| Title: | Chemical, Statistical and Sequence Analyses for Integrated Bioanalytical Chemistry |
|---|---|
| Description: | Data visualization helpers, statistics verbs, matrix analyses (principal components, clustering, distances, networks), predictive models, sequence and phylogenetic tools, and the teaching datasets used in the 'Integrated Bioanalytical Chemistry' course book and the Busta lab. |
| Authors: | Lucas Busta [aut, cre] |
| Maintainer: | Lucas Busta <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-11-23 18:24:47 UTC |
| Source: | https://github.com/thebustalab/phylochemistry |
Allows the user to plot a multiple alignent using ggplot's grammar of graphics
## S3 method for class 'gg' plot - layer## S3 method for class 'gg' plot - layer
plot |
The plot to which the layer should be added |
layer |
The layer to be added |
## Not run: -.gg() ## End(Not run)## Not run: -.gg() ## End(Not run)
Teaching dataset from the Integrated Bioanalytical Chemistry course (alaska_lake_data.csv).
alaska_lake_dataalaska_lake_data
A tibble with 220 rows and 7 columns:
character
character
numeric
numeric
character
numeric
character
https://thebustalab.github.io/phylochemistry/sample_data/alaska_lake_data.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (algae_data.csv).
algae_dataalgae_data
A tibble with 180 rows and 5 columns:
numeric
character
character
character
numeric
https://thebustalab.github.io/phylochemistry/sample_data/algae_data.csv
This function aligns sequences from a given monolist based on the specified mode and input sequence type. It supports nucleotide, amino acid, codon, and fragment alignments. The aligned sequences are written to the specified output path. ERROR: inconsistency between the following pep and nuc seqs" - usually means there are duplicate accessions numbers in the input monolist
alignSequences( monolist, subset, alignment_out_path, sequences_of_interest_directory_path, input_sequence_type = c("nucl", "amin"), mode = c("nucl_align", "amin_align", "codon_align", "fragment_align"), base_fragment = NULL )alignSequences( monolist, subset, alignment_out_path, sequences_of_interest_directory_path, input_sequence_type = c("nucl", "amin"), mode = c("nucl_align", "amin_align", "codon_align", "fragment_align"), base_fragment = NULL )
monolist |
A data frame containing the sequences to be aligned. The first column should be "accession". |
subset |
A logical vector indicating which sequences in the monolist should be included in the alignment. |
alignment_out_path |
A character string specifying the path to the file where the alignment should be written. |
sequences_of_interest_directory_path |
A character string specifying the path to a directory where blast hits should be written out as fasta files. |
input_sequence_type |
A character string specifying the type of input sequences. Options are "nucl" for nucleotide sequences or "amin" for amino acid sequences. |
mode |
A character string specifying the alignment mode. Options are "nucl_align" for nucleotide alignment, "amin_align" for amino acid alignment, "codon_align" for codon alignment, or "fragment_align" for fragment alignment. |
base_fragment |
A character string specifying the base fragment for fragment alignment. Default is NULL. |
This function does not return a value. It writes the aligned sequences to the specified output path.
## Not run: # Example usage: # Align nucleotide sequences alignSequences( monolist = my_monolist, subset = my_subset, alignment_out_path = "output_alignment.fa", sequences_of_interest_directory_path = "sequences/", input_sequence_type = "nucl", mode = "nucl_align" ) ## End(Not run)## Not run: # Example usage: # Align nucleotide sequences alignSequences( monolist = my_monolist, subset = my_subset, alignment_out_path = "output_alignment.fa", sequences_of_interest_directory_path = "sequences/", input_sequence_type = "nucl", mode = "nucl_align" ) ## End(Not run)
Pairwise t-tests from group means, standard deviations and sizes
allPairsTTestMean( category, mean, stdev, n, correction_method = c("BH", "holm", "bonferroni", "none") )allPairsTTestMean( category, mean, stdev, n, correction_method = c("BH", "holm", "bonferroni", "none") )
category |
Not yet documented. |
mean |
Not yet documented. |
stdev |
Not yet documented. |
n |
Not yet documented. |
correction_method |
Not yet documented. |
This function reads a multiple sequence alignment, analyzes the composition of each position, and subsets the alignment based on user-defined thresholds for gap percentage and conservation percentage. It also provides a user interface for visualizing the alignment and the resulting phylogenetic trees.
analyzeAlignment(alignment_in_path, type = c("DNA", "AA"), jupyter = FALSE)analyzeAlignment(alignment_in_path, type = c("DNA", "AA"), jupyter = FALSE)
alignment_in_path |
The path to the alignment file to analyze, in fasta format. |
type |
The type of sequences in the alignment, either "DNA" or "AA". |
jupyter |
Logical. If TRUE, the function will run in a Jupyter notebook environment. |
A Shiny app for visualizing and subsetting the alignment.
## Not run: # Example usage: # analyzeAlignment("path/to/alignment.fasta", type = "DNA", jupyter = FALSE) ## End(Not run)## Not run: # Example usage: # analyzeAlignment("path/to/alignment.fasta", type = "DNA", jupyter = FALSE) ## End(Not run)
Create major and minor axes ticks and labels
analyzeImages(folder_URL, monolist_out_path)analyzeImages(folder_URL, monolist_out_path)
folder_URL |
Not yet documented. |
monolist_out_path |
Not yet documented. |
Interactive literature analysis app
analyzeLiterature( jupyter = TRUE, openai_api_key = "busta_lab", xi_api_key = "busta_lab" )analyzeLiterature( jupyter = TRUE, openai_api_key = "busta_lab", xi_api_key = "busta_lab" )
jupyter |
Not yet documented. |
openai_api_key |
Not yet documented. |
xi_api_key |
Not yet documented. |
Read a png with left-most pixel low mass, right-most pixel high mass Filename: reference~compoundName_lowmz-rightmz
analyzeMassSpectralImages(image_directory_in_path)analyzeMassSpectralImages(image_directory_in_path)
image_directory_in_path |
The directory containing the images to be read. |
## Not run: analyzeMassSpectralImages() ## End(Not run)## Not run: analyzeMassSpectralImages() ## End(Not run)
Reconstruct ancestral trait values on a tree
ancestralTraits( traits, column_w_names_of_tiplabels, column_w_names_of_traits, column_w_values_for_traits, tree )ancestralTraits( traits, column_w_names_of_tiplabels, column_w_names_of_traits, column_w_values_for_traits, tree )
traits |
Not yet documented. |
column_w_names_of_tiplabels |
Not yet documented. |
column_w_names_of_traits |
Not yet documented. |
column_w_values_for_traits |
Not yet documented. |
tree |
Not yet documented. |
Annotate an amino acid sequence with InterProScan
annotateAminoAcidSequence(sequence, email, applications = "PfamA")annotateAminoAcidSequence(sequence, email, applications = "PfamA")
sequence |
Not yet documented. |
email |
Not yet documented. |
applications |
Not yet documented. |
Allows the user to plot a multiple alignent using ggplot's grammar of graphics
annotatePDB( pdb_in_path, alignment_in_path, pdb_name_in_alignment, highlights_data, out_file )annotatePDB( pdb_in_path, alignment_in_path, pdb_name_in_alignment, highlights_data, out_file )
pdb_in_path |
Not yet documented. |
alignment_in_path |
Not yet documented. |
pdb_name_in_alignment |
Not yet documented. |
highlights_data |
Not yet documented. |
out_file |
Not yet documented. |
## Not run: annotatePDB() ## End(Not run)## Not run: annotatePDB() ## End(Not run)
anova on means and standard deviations
anovaMean(object, n, ybar, s, ..., ylabel = "ylabel")anovaMean(object, n, ybar, s, ..., ylabel = "ylabel")
object |
Not yet documented. |
n |
Not yet documented. |
ybar |
Not yet documented. |
s |
Not yet documented. |
... |
Not yet documented. |
ylabel |
Not yet documented. |
## Not run: anovaTestMean() ## End(Not run)## Not run: anovaTestMean() ## End(Not run)
Analysis of variance table
anovaTest(data, ...)anovaTest(data, ...)
data |
Not yet documented. |
... |
Not yet documented. |
ANOVA from group means, standard deviations and sizes
anovaTestMean(category, n, mean, stdev)anovaTestMean(category, n, mean, stdev)
category |
Not yet documented. |
n |
Not yet documented. |
mean |
Not yet documented. |
stdev |
Not yet documented. |
Teaching dataset from the Integrated Bioanalytical Chemistry course (beer_components.csv).
beer_componentsbeer_components
A tibble with 3625 rows and 6 columns:
character
numeric
character
character
numeric
character
https://thebustalab.github.io/phylochemistry/sample_data/beer_components.csv
Run a BLAST search at NCBI
blastNCBI(query_sequence, program, database)blastNCBI(query_sequence, program, database)
query_sequence |
Not yet documented. |
program |
Not yet documented. |
database |
Not yet documented. |
Runs bootstrapping on categorical data; from github sgibb/bootstrap
bootstrap(x, fun, n = 1000L, mc.cores = getOption("mc.cores", 2L))bootstrap(x, fun, n = 1000L, mc.cores = getOption("mc.cores", 2L))
x |
Not yet documented. |
fun |
Not yet documented. |
n |
bootstrap |
mc.cores |
Not yet documented. |
Interactive figure-caption builder app
buildCaption(jupyter = FALSE)buildCaption(jupyter = FALSE)
jupyter |
Not yet documented. |
This function takes a list of sequence alignment files and constructs a HMM database. It uses the HMMER suite to build individual HMMs from each alignment and then combines them into a single HMM database file. The resulting database is then indexed for efficient searching.
buildDomainLibrary(alignment_in_paths, domain_library_out_path)buildDomainLibrary(alignment_in_paths, domain_library_out_path)
alignment_in_paths |
A character vector containing the file paths to the sequence alignment files. Each file should be in a format compatible with the HMMER 'hmmbuild' tool. |
domain_library_out_path |
A character string specifying the file path where the resulting HMM database will be saved. This file will contain all the HMMs built from the input alignments. |
The function first removes any existing files at the output path to prevent appending to old data. It then iterates over each alignment file, builds a temporary HMM file using 'hmmbuild', and appends it to the output database file. After processing all alignments, the temporary file is deleted, and the 'hmmpress' command is used to index the database for faster access during searches.
This function does not return a value. It creates and indexes an HMM database file at the specified path.
## Not run: \dontrun{ buildDomainLibrary( alignment_in_paths = c("alignment1.sto", "alignment2.sto"), domain_library_out_path = "output_hmm_database.hmm" ) } ## End(Not run)## Not run: \dontrun{ buildDomainLibrary( alignment_in_paths = c("alignment1.sto", "alignment2.sto"), domain_library_out_path = "output_hmm_database.hmm" ) } ## End(Not run)
Build a statistical or machine-learning model
buildModel( data, model_type = c("linear_regression", "random_forest_regression", "random_forest_classification", "logistic_regression", "contrastive_learning"), predictors = NULL, response = NULL, fold_cross_validation = 10, optimization_parameters = list(n_vars_tried_at_split = seq(10, 20, 5), n_trees = seq(100, 200, 50), min_leaf_size = 1), formula = NULL, scale_variance = FALSE, input_variables = NULL, output_variable = NULL )buildModel( data, model_type = c("linear_regression", "random_forest_regression", "random_forest_classification", "logistic_regression", "contrastive_learning"), predictors = NULL, response = NULL, fold_cross_validation = 10, optimization_parameters = list(n_vars_tried_at_split = seq(10, 20, 5), n_trees = seq(100, 200, 50), min_leaf_size = 1), formula = NULL, scale_variance = FALSE, input_variables = NULL, output_variable = NULL )
data |
Not yet documented. |
model_type |
Not yet documented. |
predictors |
Not yet documented. |
response |
Not yet documented. |
fold_cross_validation |
Not yet documented. |
optimization_parameters |
Not yet documented. |
formula |
Not yet documented. |
scale_variance |
Not yet documented. |
input_variables |
Not yet documented. |
output_variable |
Not yet documented. |
Former name of buildModel()
buildModel2(...)buildModel2(...)
... |
Not yet documented. |
Build a network from an edgelist
buildNetwork( edgelist, node_attributes = NULL, facet_variable = NULL, directed = NULL )buildNetwork( edgelist, node_attributes = NULL, facet_variable = NULL, directed = NULL )
edgelist |
A data frame with origin nodes in the first column, destination nodes in the second column, and optional edge attributes in columns 3+, which are carried through to the returned edges frame as-is. No |
node_attributes |
A dataframe of attributes associated with the nodes. First column must contain node names. |
facet_variable |
Currently unused; retained for API compatibility. |
directed |
How to handle node pairs that appear more than once. Rows identical in every column are always dropped. NULL (default) decides from the data: if every A->B / B->A pair (and any same-direction repeat) agrees on all edge attributes, as in a long-format distance or correlation matrix, the edgelist is collapsed to one edge per pair; if any pair disagrees, every edge is kept. TRUE always keeps both directions; FALSE always collapses, keeping the first occurrence of each pair. A message reports what was done. Note that when both directions are kept, their segments are drawn on top of one another, so a plot will only show one of them. |
## Not run: buildNetwork() ## End(Not run)## Not run: buildNetwork() ## End(Not run)
Build a network from an edgelist
buildNetwork_OG(edgelist, node_attributes = NULL, facet_variable = NULL)buildNetwork_OG(edgelist, node_attributes = NULL, facet_variable = NULL)
edgelist |
A data frame with names of origin nodes in first column, destination nodes in second column, and an optional third column of edgeweights. |
node_attributes |
A dataframe of attributes associated with the nodes. |
facet_variable |
Include in the output graphic a line plot corresponding to the degree of conservation at each site in the alignment. |
## Not run: buildNetwork_OG() ## End(Not run)## Not run: buildNetwork_OG() ## End(Not run)
Build a human-readable matrix of samples, analytes, and measurements
buildPolylist( samples_monolist_in_path, analytes_monolist_in_path, measurements_monolist_in_path = NULL, centroid = "~~~", polylist_out_path )buildPolylist( samples_monolist_in_path, analytes_monolist_in_path, measurements_monolist_in_path = NULL, centroid = "~~~", polylist_out_path )
samples_monolist_in_path |
The monolist of samples to be used in building the polylist. Should contain a column "sample_unique_ID". |
analytes_monolist_in_path |
The monolist of analytes to be used in building the polylist. Should contain a column "analyte_unique_ID". |
measurements_monolist_in_path |
The monolist of measurements to be used in building the polylist. Should contain columns "sample_unique_ID", "analyte_unique_ID", and a column of values corresponding to measurements |
centroid |
The characters to use in the centroid |
polylist_out_path |
The path to which the polylist should be written |
This function allows the construction of phylogenetic trees using different types of input data.
buildTree( scaffold_type = c("amin_alignment", "nucl_alignment", "newick", "url"), scaffold_in_path, members = NULL, ml = FALSE, model_test = FALSE, bootstrap = FALSE, ancestral_states = FALSE, root = NULL )buildTree( scaffold_type = c("amin_alignment", "nucl_alignment", "newick", "url"), scaffold_in_path, members = NULL, ml = FALSE, model_test = FALSE, bootstrap = FALSE, ancestral_states = FALSE, root = NULL )
scaffold_type |
The type of information that should be used to build the tree. Options include "amin_alignment", "nucl_alignment", "newick", or "url". |
scaffold_in_path |
The path to the information that should be used to build the tree. If using a URL, a recommended source is: https://sftp.kew.org/pub/treeoflife/current_release/tree/species/ |
members |
The tips of the tree that should be included. Default is to include everything. |
ml |
TRUE/FALSE whether to use maximum likelihood when constructing the tree. |
model_test |
TRUE/FALSE whether to test various maximum likelihood models while constructing the tree. |
bootstrap |
TRUE/FALSE whether to calculate bootstrap values for tree nodes. |
ancestral_states |
TRUE/FALSE whether to calculate ancestral states at nodes in the tree. Requires specifying a root via the 'root' parameter. |
root |
The tree tip to use as the root of the tree. |
Convert a kmer report file from Canu into a table that can be accepted by genomescope Use http://qb.cshl.edu/genomescope/genomescope2.0/
canuHistogramToKmerTable(file_in_path, file_out_path)canuHistogramToKmerTable(file_in_path, file_out_path)
file_in_path |
The path to the kmer report file |
file_out_path |
The path to the table file to write |
## Not run: canuHistogramToKmerTable("https://thebustalab.github.io/R_For_Chemists/sample_data/kmer_report.txt", "kmer_report.txt") ## End(Not run)## Not run: canuHistogramToKmerTable("https://thebustalab.github.io/R_For_Chemists/sample_data/kmer_report.txt", "kmer_report.txt") ## End(Not run)
Teaching dataset from the Integrated Bioanalytical Chemistry course (chemical_blooms.csv).
chemical_bloomschemical_blooms
A tibble with 78 rows and 10 columns:
character
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/chemical_blooms.csv
Save and close the current RScript to Google Drive
closeRGD(drive_share_link)closeRGD(drive_share_link)
drive_share_link |
Not yet documented. |
Given an aligned set of amino-acid sequences and the ungapped coding nucleotide sequences they were translated from, produce the corresponding codon (nucleotide) alignment: each non-gap residue becomes its three nucleotides and each gap ("-") becomes "—". This is the in-frame core of PAL2NAL and replaces the former orthologr::codon_aln() dependency. It assumes each peptide is an exact, in-frame translation of its nucleotide sequence (equal codon counts, no frameshift) – which holds inside alignSequences(), where the peptides are translated from the same ORFs. If that correspondence is broken it stops with a clear message rather than misaligning silently.
codonAlignFromAA(aa_alignment, nucl_seqs)codonAlignFromAA(aa_alignment, nucl_seqs)
aa_alignment |
A named character vector (or object coercible with as.character, e.g. an AAStringSet) of aligned, gapped amino-acid sequences. |
nucl_seqs |
A named DNAStringSet (or named character vector) of the ungapped coding nucleotides, one per aligned sequence, matched by name. |
A named character vector of codon-aligned nucleotide sequences.
Rows that are identical in every column are always dropped. Beyond that, each row's node pair is put in alphabetical order so A->B and B->A share a key. If every key's rows agree on all attribute columns (columns 3+; numbers compared with a small relative tolerance), the input is symmetric and is collapsed to one row per pair (the first occurrence, in its original direction). If any key's rows disagree, the input is treated as directed and returned whole. It is all or nothing across the table, never pair by pair.
collapseReciprocalEdges( edgelist, directed = NULL, tol = sqrt(.Machine$double.eps) )collapseReciprocalEdges( edgelist, directed = NULL, tol = sqrt(.Machine$double.eps) )
edgelist |
A data frame, node names (character) in columns 1 and 2. |
directed |
NULL (decide from the data, as above), TRUE (never collapse reciprocal pairs), or FALSE (always collapse, keeping the first occurrence). |
tol |
Relative tolerance for comparing numeric attribute columns. |
This function takes a detailed phylogenetic tree and collapses it into a higher-level cladogram based on specified associations. It is useful for summarizing complex trees by grouping tips into broader categories.
collapseTree(tree, associations)collapseTree(tree, associations)
tree |
A phylogenetic tree to manipulate. It can be an object of class 'phylo' or a fortified tree. |
associations |
A data frame or matrix with two columns. The first column contains tree tip names, and the second column contains the corresponding higher-level group names to which these tips should be summarized. |
A phylogenetic tree of class 'phylo' with tips renamed and collapsed according to the provided associations.
## Not run: # Example usage: # tree <- readTree("path/to/tree") # associations <- data.frame(tip_name = c("tip1", "tip2"), group_name = c("group1", "group1")) # collapsed_tree <- collapseTree(tree, associations) # plot(collapsed_tree) collapseTree() ## End(Not run)## Not run: # Example usage: # tree <- readTree("path/to/tree") # associations <- data.frame(tip_name = c("tip1", "tip2"), group_name = c("group1", "group1")) # collapsed_tree <- collapseTree(tree, associations) # plot(collapsed_tree) collapseTree() ## End(Not run)
Compute text embeddings with the OpenAI API
computeEmbeddings(df, column_to_embed, openai_api_key)computeEmbeddings(df, column_to_embed, openai_api_key)
df |
Not yet documented. |
column_to_embed |
Not yet documented. |
openai_api_key |
Not yet documented. |
Continuous colour palette 1
cont_1cont_1
A character vector of five colours.
Continuous colour palette 2
cont_2cont_2
A character vector of five colours.
This function processes mass spectral data stored in CDF files and converts them into CSV format. It allows filtering based on m/z values and retention times, and can optionally force conversion even if CSV files already exist.
convertCDFstoCSVs( paths_to_cdfs, min_mz = 50, max_mz = 800, min_rt = NULL, max_rt = NULL, force = FALSE )convertCDFstoCSVs( paths_to_cdfs, min_mz = 50, max_mz = 800, min_rt = NULL, max_rt = NULL, force = FALSE )
paths_to_cdfs |
A character vector containing the paths to the CDF files that need to be converted. |
min_mz |
A numeric value specifying the smallest m/z (mass-to-charge ratio) value to process. This acts as a filter to exclude data below this threshold. |
max_mz |
A numeric value specifying the largest m/z value to process. This acts as a filter to exclude data above this threshold. |
min_rt |
(optional) A numeric value specifying the smallest retention time to process. This acts as a filter to exclude data below this threshold. Default is NULL, meaning no minimum retention time filter is applied. |
max_rt |
(optional) A numeric value specifying the largest retention time to process. This acts as a filter to exclude data above this threshold. Default is NULL, meaning no maximum retention time filter is applied. |
force |
A logical value indicating whether to convert all CDF files even if they have already been converted previously. Default is FALSE, meaning only files without existing CSV counterparts will be converted. |
## Not run: # Convert CDF files to CSV with default m/z range and no retention time filtering convertCDFstoCSVs(paths_to_cdfs = c("file1.cdf", "file2.cdf")) # Convert CDF files to CSV with specified m/z and retention time ranges, forcing conversion convertCDFstoCSVs(paths_to_cdfs = c("file1.cdf", "file2.cdf"), min_mz = 100, max_mz = 700, min_rt = 5, max_rt = 20, force = TRUE) ## End(Not run)## Not run: # Convert CDF files to CSV with default m/z range and no retention time filtering convertCDFstoCSVs(paths_to_cdfs = c("file1.cdf", "file2.cdf")) # Convert CDF files to CSV with specified m/z and retention time ranges, forcing conversion convertCDFstoCSVs(paths_to_cdfs = c("file1.cdf", "file2.cdf"), min_mz = 100, max_mz = 700, min_rt = 5, max_rt = 20, force = TRUE) ## End(Not run)
Radar (spider) coordinate system for ggplot2
coord_radar(theta = "x", start = 0, direction = 1)coord_radar(theta = "x", start = 0, direction = 1)
theta |
Not yet documented. |
start |
Not yet documented. |
direction |
Not yet documented. |
Filenames: 123~123-1.csv To use plots: library(gridExtra); nCol <- floor(sqrt(length(plots))); do.call("grid.arrange", c(plots, ncol=nCol))
crystallinity(data_directory_in_path, make_plots = TRUE)crystallinity(data_directory_in_path, make_plots = TRUE)
data_directory_in_path |
The directory containing the data to be read and processed. |
make_plots |
Not yet documented. |
## Not run: crystallinity() ## End(Not run)## Not run: crystallinity() ## End(Not run)
Provides a descendants list for a fortified tree
descendantsFortified(fortified_tree)descendantsFortified(fortified_tree)
fortified_tree |
The fortified tree that should be analyzed |
Discrete colour palette
discrete_palettediscrete_palette
A character vector of 25 colours.
Returns contents of one fasta file as a StringSet object.
downloadFasta(share_link)downloadFasta(share_link)
share_link |
The path to the fasta to read. Can be local or a google drive share link. |
Allows the user to plot a multiple alignent using ggplot's grammar of graphics
drawAlignment( infile, monolist, alignment_labels, wrap = FALSE, wrap_length = NULL, roi = FALSE, roi_data = NULL, consensus = FALSE, consensus_height = 5, funct_assoc = FALSE, funct_assoc_data = NULL, funct_assoc_height = 5, highlights = FALSE, highlights_data = NULL, hlines = FALSE, hlines_data = NULL, tick_spacing = 5, ticks_text_size = 30, order = NULL, color_pal = NULL )drawAlignment( infile, monolist, alignment_labels, wrap = FALSE, wrap_length = NULL, roi = FALSE, roi_data = NULL, consensus = FALSE, consensus_height = 5, funct_assoc = FALSE, funct_assoc_data = NULL, funct_assoc_height = 5, highlights = FALSE, highlights_data = NULL, hlines = FALSE, hlines_data = NULL, tick_spacing = 5, ticks_text_size = 30, order = NULL, color_pal = NULL )
infile |
The alignment to use (fasta file) |
monolist |
A dataframe with metadata for the alignment |
alignment_labels |
The name of the column to label the entries in the alignment with |
wrap |
TRUE/FALSE whether to use a column of plots to show the alignment |
wrap_length |
Length at which to cut the wrap |
roi |
TRUE/FALSE whether to only show regions of interest in the alignment |
roi_data |
Dataframe defining the regions to show |
consensus |
TRUE/FALSE whether to include a consensus line in the alignment |
consensus_height |
Height of the consensus line plot |
funct_assoc |
TRUE/FALSE whether to show functional associations in the alignment |
funct_assoc_data |
Columns in the metadata dataframe to use in searching for functional association (e.g. "c(sterol~other, sterol~cyclo)") |
funct_assoc_height |
Height of the functional association lines |
highlights |
TRUE/FALSE whether to highlight certain sites in the alignment |
highlights_data |
Dataframe specifying which site to highlight |
hlines |
TRUE/FALSE whether to divide the alignment with horizontal lines |
hlines_data |
Dataframe specifying where to divide alignment |
tick_spacing |
Spacing between x-axis ticks |
ticks_text_size |
Size of x-axis ticks text |
order |
Order in which to display the members of the alignment |
color_pal |
Color palette to use |
## Not run: drawAlignment() ## End(Not run)## Not run: drawAlignment() ## End(Not run)
Draws a baseline on a signal
drawBaseline(data, prelim_baseline_window)drawBaseline(data, prelim_baseline_window)
data |
x, y dataframe |
prelim_baseline_window |
interval at which to draw baseline |
Draw chemical structures from CSV
drawMolecules( csv_in_path = NULL, data = NULL, atom_color_column = "default", bond_color_column = "default", molecule_name = TRUE, atom_numbers = TRUE )drawMolecules( csv_in_path = NULL, data = NULL, atom_color_column = "default", bond_color_column = "default", molecule_name = TRUE, atom_numbers = TRUE )
csv_in_path |
Path to the csv with the molecular coordinates. |
data |
Data that the functions should plot. |
atom_color_column |
Not yet documented. |
bond_color_column |
Not yet documented. |
molecule_name |
Not yet documented. |
atom_numbers |
Not yet documented. |
## Not run: drawMolecules() ## End(Not run)## Not run: drawMolecules() ## End(Not run)
drops NAs from a vector
dropNA(x)dropNA(x)
x |
The vector to drop NAs from |
Dunn's post hoc test
dunnTest(data, formula, ...)dunnTest(data, formula, ...)
data |
Not yet documented. |
formula |
Not yet documented. |
... |
Not yet documented. |
Embed amino acid sequences with a protein language model
embedAminoAcids( amino_acid_stringset = NULL, dataframe = NULL, biolm_api_key = NULL, nvidia_api_key = NULL, platform = c("nvidia", "biolm", "local"), input_type = c("amino_acid_stringset", "dataframe"), model_name = c("esm2-650m", "esm2-8m", "esm2-35m", "esm2-150m", "esm2_t30_150M_UR50D"), seq_column = NULL, local_script = NULL, python_path = "python3" )embedAminoAcids( amino_acid_stringset = NULL, dataframe = NULL, biolm_api_key = NULL, nvidia_api_key = NULL, platform = c("nvidia", "biolm", "local"), input_type = c("amino_acid_stringset", "dataframe"), model_name = c("esm2-650m", "esm2-8m", "esm2-35m", "esm2-150m", "esm2_t30_150M_UR50D"), seq_column = NULL, local_script = NULL, python_path = "python3" )
amino_acid_stringset |
Not yet documented. |
dataframe |
Not yet documented. |
biolm_api_key |
Not yet documented. |
nvidia_api_key |
Not yet documented. |
platform |
Not yet documented. |
input_type |
Not yet documented. |
model_name |
Not yet documented. |
seq_column |
Not yet documented. |
local_script |
For |
python_path |
For |
Embed text with a language model
embedText( df, column_name, hf_api_key = Sys.getenv("HF_TOKEN"), path_to_glove_file = NULL, local = FALSE, model_id = "BAAI/bge-small-en-v1.5", batch_size = 16, max_retries = 5, timeout_sec = 60, server_url = Sys.getenv("EMBED_SERVER_URL", ""), server_token = Sys.getenv("EMBED_SERVER_TOKEN", "") )embedText( df, column_name, hf_api_key = Sys.getenv("HF_TOKEN"), path_to_glove_file = NULL, local = FALSE, model_id = "BAAI/bge-small-en-v1.5", batch_size = 16, max_retries = 5, timeout_sec = 60, server_url = Sys.getenv("EMBED_SERVER_URL", ""), server_token = Sys.getenv("EMBED_SERVER_TOKEN", "") )
df |
Not yet documented. |
column_name |
Not yet documented. |
hf_api_key |
Not yet documented. |
path_to_glove_file |
Not yet documented. |
local |
Not yet documented. |
model_id |
Not yet documented. |
batch_size |
Not yet documented. |
max_retries |
Not yet documented. |
timeout_sec |
Not yet documented. |
server_url |
Not yet documented. |
server_token |
Not yet documented. |
Extract total ion chromatograms from csv files containing mass spectral data
extractChromatogramsFromCSVs( paths_to_cdf_csvs, path_to_existing_chromatograms_csv = NULL )extractChromatogramsFromCSVs( paths_to_cdf_csvs, path_to_existing_chromatograms_csv = NULL )
paths_to_cdf_csvs |
Paths to the cdf.csvs |
path_to_existing_chromatograms_csv |
Path to an existing chromatograms.csv file. The function will append new chromatograms to this file that are not already in it. |
Extract modules around bait genes from an edge list
extractModules(data, baits, module_size)extractModules(data, baits, module_size)
data |
Not yet documented. |
baits |
Not yet documented. |
module_size |
Not yet documented. |
This function identifies and extracts open reading frames (ORFs) from sequences in a multifasta file. It can optionally write the ORFs to a new fasta file and overwrite the input file with the ORF file. The function can also search for alternative ORFs in the complementary, reverse, and reverse-complementary sequences. Note: Searching for ORFs in the reverse direction leads to issues during codon alignment...
extractORFs( file_in_path, write_out_ORFs = FALSE, overwrite = FALSE, alternative_ORFs = FALSE )extractORFs( file_in_path, write_out_ORFs = FALSE, overwrite = FALSE, alternative_ORFs = FALSE )
file_in_path |
The path to the multifasta file to analyze. |
write_out_ORFs |
Logical. If TRUE, writes out a new fasta file containing the ORFs. |
overwrite |
Logical. If TRUE, optionally overwrites the input file with the ORF file. |
alternative_ORFs |
Logical. If TRUE, searches for alternative ORFs in the complementary, reverse, and reverse-complementary sequences. |
A data frame containing the accession, start codon position, stop codon position, direction, and length of each ORF.
## Not run: # Example usage: # Extract ORFs from a multifasta file and write them to a new file # orfs <- extractORFs("sequences.fasta", write_out_ORFs = TRUE, # overwrite = FALSE, alternative_ORFs = TRUE) # print(orfs) ## End(Not run)## Not run: # Example usage: # Extract ORFs from a multifasta file and write them to a new file # orfs <- extractORFs("sequences.fasta", write_out_ORFs = TRUE, # overwrite = FALSE, alternative_ORFs = TRUE) # print(orfs) ## End(Not run)
Extract candidate key terms from text columns
extractTerms( dataframe, cols, min_freq_for_terms, min_n_words_per_term, return = c("dataframe", "terms") )extractTerms( dataframe, cols, min_freq_for_terms, min_n_words_per_term, return = c("dataframe", "terms") )
dataframe |
Not yet documented. |
cols |
Not yet documented. |
min_freq_for_terms |
Not yet documented. |
min_n_words_per_term |
Not yet documented. |
return |
Not yet documented. |
Teaching dataset from the Integrated Bioanalytical Chemistry course (fadb_sample.csv).
fadb_samplefadb_sample
A tibble with 7 rows and 11 columns:
character
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/fadb_sample.csv
Convert fastq to fasta
fastqToFasta(file_in_path, file_out_path)fastqToFasta(file_in_path, file_out_path)
file_in_path |
The path to the fastq file |
file_out_path |
The path to the fasta file to write |
## Not run: fastqToFasta("https://thebustalab.github.io/R_For_Chemists/sample_data/reads.fastq", "reads.fasta") ## End(Not run)## Not run: fastqToFasta("https://thebustalab.github.io/R_For_Chemists/sample_data/reads.fastq", "reads.fasta") ## End(Not run)
Run QC on fastx file(s)
fastxQC( paths_to_fastxs, type = c("fastq", "fasta"), mode = c("fast", "slow"), max_n_seqs = NULL, progress = FALSE )fastxQC( paths_to_fastxs, type = c("fastq", "fasta"), mode = c("fast", "slow"), max_n_seqs = NULL, progress = FALSE )
paths_to_fastxs |
A list of the paths to the fastx file(s) you want to analyze |
type |
Not yet documented. |
mode |
Not yet documented. |
max_n_seqs |
The maximum number of sequences PER FILE to analyze. Default is no limit. |
progress |
Not yet documented. |
Interactively find clustering parameters from a distance matrix and source matrix
findClusterParameters(dist_matrix, matrix, analysis = c("dbscan", "kmeans"))findClusterParameters(dist_matrix, matrix, analysis = c("dbscan", "kmeans"))
dist_matrix |
Not yet documented. |
matrix |
Not yet documented. |
analysis |
Not yet documented. |
This function may work better if you feed it a smoothed signal, or add smoothing to the derivatives
fitGaussians( x, y, peak_detection_threshold = 10, peak_means_stdevs_heights = NULL )fitGaussians( x, y, peak_detection_threshold = 10, peak_means_stdevs_heights = NULL )
x |
Not yet documented. |
y |
Not yet documented. |
peak_detection_threshold |
Not yet documented. |
peak_means_stdevs_heights |
Not yet documented. |
## Not run: fitGaussians() ## End(Not run)## Not run: fitGaussians() ## End(Not run)
Games-Howell post hoc test
gamesHowellTest(data, ..., compare = NULL)gamesHowellTest(data, ..., compare = NULL)
data |
Not yet documented. |
... |
Not yet documented. |
compare |
Not yet documented. |
Subset an alignment
gblocks( alignment_in_path = NULL, max_gap_percent = 0.5, min_conservation_percent = 0.3, sequence_type = c("DNA", "AA") )gblocks( alignment_in_path = NULL, max_gap_percent = 0.5, min_conservation_percent = 0.3, sequence_type = c("DNA", "AA") )
alignment_in_path |
The path to the information that should be used to build the tree. |
max_gap_percent |
The maximum percentage of gaps allowed in a column of the alignment. Default is 0.5. |
min_conservation_percent |
The minimum percentage of conservation allowed in a column of the alignment. Default is 0.3. |
sequence_type |
The type of sequence in the alignment, either "DNA" or "AA" |
Create major and minor axes ticks and labels
generateQRcodes(share_link)generateQRcodes(share_link)
share_link |
Share link to Google Sheet with QR code metadata |
Generate text with a language model
generateText( df, prompt_column, system_column = NULL, hf_api_key = Sys.getenv("HF_TOKEN"), model_id = "Qwen/Qwen2.5-14B-Instruct", provider = "featherless-ai", max_retries = 5, timeout_sec = 120, temperature = NULL, verbose = FALSE, max_new_tokens = 512, server_url = Sys.getenv("GENERATE_SERVER_URL", ""), server_token = Sys.getenv("GENERATE_SERVER_TOKEN", "") )generateText( df, prompt_column, system_column = NULL, hf_api_key = Sys.getenv("HF_TOKEN"), model_id = "Qwen/Qwen2.5-14B-Instruct", provider = "featherless-ai", max_retries = 5, timeout_sec = 120, temperature = NULL, verbose = FALSE, max_new_tokens = 512, server_url = Sys.getenv("GENERATE_SERVER_URL", ""), server_token = Sys.getenv("GENERATE_SERVER_TOKEN", "") )
df |
Not yet documented. |
prompt_column |
Not yet documented. |
system_column |
Not yet documented. |
hf_api_key |
Not yet documented. |
model_id |
Not yet documented. |
provider |
Not yet documented. |
max_retries |
Not yet documented. |
timeout_sec |
Not yet documented. |
temperature |
Not yet documented. |
verbose |
Not yet documented. |
max_new_tokens |
Not yet documented. |
server_url |
Not yet documented. |
server_token |
Not yet documented. |
Create major and minor axes ticks and labels
generateTicks( major_ticks, minor_freq = 4, major_tick_size = 2, minor_tick_size = 1 )generateTicks( major_ticks, minor_freq = 4, major_tick_size = 2, minor_tick_size = 1 )
major_ticks |
Values at which major ticks should be generated |
minor_freq |
Number of minor ticks between each major tick |
major_tick_size |
Not yet documented. |
minor_tick_size |
Not yet documented. |
trait and value
Plots pie charts for data at any node using columns trait and value
geom_ancestral_pie( data, pie_size = 0.1, pie_alpha = 1, pie_fill_colors = discrete_palette, pie_border_size = 0.1, ... )geom_ancestral_pie( data, pie_size = 0.1, pie_alpha = 1, pie_fill_colors = discrete_palette, pie_border_size = 0.1, ... )
data |
Not yet documented. |
pie_size |
Not yet documented. |
pie_alpha |
Not yet documented. |
pie_fill_colors |
Not yet documented. |
pie_border_size |
Not yet documented. |
... |
Not yet documented. |
Draw the cut on a dendrogram, in the right place, from the plot's own data.
geom_cut(height = NULL, k = NULL, linetype = "dashed", colour = "grey40", ...)geom_cut(height = NULL, k = NULL, linetype = "dashed", colour = "grey40", ...)
height |
Cut height, the same value passed to |
k |
Number of groups, the same value passed to |
linetype |
Not yet documented. |
colour |
Not yet documented. |
... |
Not yet documented. |
WHY THIS EXISTS (2026-09-23). A cut IS a vertical line across the tree, and saying so
with geom_vline(xintercept = 5) is wrong twice over: ape::as.phylo() HALVES an
hclust's merge heights, and ggtree then measures x from the ROOT, so the tips sit at
max(height)/2 and a cut at height 5 actually belongs at max(x) - 5/2. Drawn the naive
way the line lands out past the tip labels. geom_cut() does that conversion, so the
student writes the same height they cut at and the picture agrees with the cluster
column.
It reads only x, which ggtree always maps, so nothing extra has to be threaded into
the layer. Tips are the rightmost nodes, so everything left of max(x) is a join.
## Not run: ggtree(out) + geom_tippoint(aes(fill = cluster)) + geom_cut(height = 5) ggtree(out) + geom_tippoint(aes(fill = cluster)) + geom_cut(k = 4) ## End(Not run)## Not run: ggtree(out) + geom_tippoint(aes(fill = cluster)) + geom_cut(height = 5) ggtree(out) + geom_tippoint(aes(fill = cluster)) + geom_cut(k = 4) ## End(Not run)
geomSignif
geomSignif(data, orientation)geomSignif(data, orientation)
data |
Not yet documented. |
orientation |
Not yet documented. |
## Not run: geomSignif() ## End(Not run)## Not run: geomSignif() ## End(Not run)
The small datasets used in the book ship with the package and are available directly by
name (for example alaska_lake_data). The large or rarely used ones (ny_trees,
lake_superior_shoreline, mushrooms, OSC_sequences) are downloaded from the course
website the first time you ask for them and kept in a cache folder, so later calls work
offline. getDataset() also returns the shipped datasets, so one call works for every name.
getDataset(name = NULL, refresh = FALSE)getDataset(name = NULL, refresh = FALSE)
name |
The dataset's name, as a string (for example |
refresh |
If |
A tibble (or, for OSC_sequences, a Biostrings AAStringSet). With no name, a
data frame listing the datasets: name, file, type ("data" = shipped with the
package, "download" = fetched and cached on first use) and cached.
getDataset() ## Not run: ny_trees <- getDataset("ny_trees") ## End(Not run)getDataset() ## Not run: ny_trees <- getDataset("ny_trees") ## End(Not run)
grubbsFilter on grouped data
grubbsFilter(data, col, threshold = 0.05, ...)grubbsFilter(data, col, threshold = 0.05, ...)
data |
Not yet documented. |
col |
Not yet documented. |
threshold |
Not yet documented. |
... |
Not yet documented. |
## Not run: grubbsFilter() ## End(Not run)## Not run: grubbsFilter() ## End(Not run)
Harmonizes species in a set of traits (wide or long) and a tree
harmonizeTreeTraits(traits, column_w_names_of_tiplabels, tree)harmonizeTreeTraits(traits, column_w_names_of_tiplabels, tree)
traits |
A data frame in which the first column contains the names of the species |
column_w_names_of_tiplabels |
Not yet documented. |
tree |
A phylo object containing the tree |
Teaching dataset from the Integrated Bioanalytical Chemistry course (hawaii_aquifers.csv).
hawaii_aquifershawaii_aquifers
A tibble with 954 rows and 6 columns:
character
character
numeric
numeric
character
numeric
https://thebustalab.github.io/phylochemistry/sample_data/hawaii_aquifers.csv
This function aligns sequences from a FASTA file to a specified domain in an HMM file. It extracts the relevant positions based on the RF (Reference) sequence and returns the aligned sequences as an AAStringSet object.
hmmAlign(fasta_in_path, hmm_in_path, domain_name)hmmAlign(fasta_in_path, hmm_in_path, domain_name)
fasta_in_path |
The path to the input FASTA file containing sequences to be aligned. |
hmm_in_path |
The path to the HMM file containing the domain model. |
domain_name |
The name of the domain to fetch from the HMM file for alignment. |
An AAStringSet object containing the aligned sequences.
## Not run: # Example usage: # aligned_sequences <- hmmAlign("sequences.fasta", "domains.hmm", "domain_name") # print(aligned_sequences) ## End(Not run)## Not run: # Example usage: # aligned_sequences <- hmmAlign("sequences.fasta", "domains.hmm", "domain_name") # print(aligned_sequences) ## End(Not run)
Teaching dataset from the Integrated Bioanalytical Chemistry course (hops_components.csv).
hops_componentshops_components
A tibble with 38 rows and 12 columns:
character
character
character
character
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/hops_components.csv
Phylogenetically independent contrasts for traits
independentContrasts( traits, column_w_names_of_tiplabels, column_w_names_of_traits, column_w_values_for_traits, tree )independentContrasts( traits, column_w_names_of_tiplabels, column_w_names_of_traits, column_w_values_for_traits, tree )
traits |
Not yet documented. |
column_w_names_of_tiplabels |
Not yet documented. |
column_w_names_of_traits |
Not yet documented. |
column_w_values_for_traits |
Not yet documented. |
tree |
Not yet documented. |
Kruskal-Wallis test
kruskalTest(data, formula, ...)kruskalTest(data, formula, ...)
data |
Not yet documented. |
formula |
Not yet documented. |
... |
Not yet documented. |
Levene's test for equal variances
leveneTest(data, ...)leveneTest(data, ...)
data |
Not yet documented. |
... |
Not yet documented. |
Fill in missing combinations of a long table
makeRectangular(dataframe, names_from, values_from, values_fill = c(0, NA))makeRectangular(dataframe, names_from, values_from, values_fill = c(0, NA))
dataframe |
Not yet documented. |
names_from |
Not yet documented. |
values_from |
Not yet documented. |
values_fill |
Not yet documented. |
This function reads multiple peak list files from a specified directory, processes them, and merges them into a single data frame. Each peak list is expected to be stored in a CSV file named "peaks_monolist.csv" within subdirectories of the specified directory.
mergePeakLists(analysis_directory_path)mergePeakLists(analysis_directory_path)
analysis_directory_path |
A character string specifying the path to the directory containing subdirectories with peak list files. Each subdirectory should contain a "peaks_monolist.csv" file. |
A data frame containing the merged peak lists. The data frame includes the first nine columns of each peak list, with the 'area' column converted to numeric.
## Not run: # Example usage: # Merge peak lists from a specified directory merged_peaks <- mergePeakLists("/path/to/analysis_directory") ## End(Not run)## Not run: # Example usage: # Merge peak lists from a specified directory merged_peaks <- mergePeakLists("/path/to/analysis_directory") ## End(Not run)
Teaching dataset from the Integrated Bioanalytical Chemistry course (metabolomics_data.csv).
metabolomics_datametabolomics_data
A tibble with 93 rows and 126 columns:
numeric
character
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/metabolomics_data.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (metabolomics_hospital.csv).
metabolomics_hospitalmetabolomics_hospital
A tibble with 200 rows and 4 columns:
numeric
character
character
numeric
https://thebustalab.github.io/phylochemistry/sample_data/metabolomics_hospital.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (metabolomics_hospital_unknown.csv).
metabolomics_hospital_unknownmetabolomics_hospital_unknown
A tibble with 10 rows and 3 columns:
character
character
numeric
https://thebustalab.github.io/phylochemistry/sample_data/metabolomics_hospital_unknown.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (metabolomics_unknown.csv).
metabolomics_unknownmetabolomics_unknown
A tibble with 7 rows and 124 columns:
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/metabolomics_unknown.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (meteorite_fragments.csv).
meteorite_fragmentsmeteorite_fragments
A tibble with 37 rows and 6 columns:
character
character
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/meteorite_fragments.csv
mode
mode(x, ignore_zero = FALSE)mode(x, ignore_zero = FALSE)
x |
Not yet documented. |
ignore_zero |
Not yet documented. |
## Not run: mode() ## End(Not run)## Not run: mode() ## End(Not run)
movingAverage
movingAverage(x, n = 5)movingAverage(x, n = 5)
x |
Not yet documented. |
n |
Not yet documented. |
Normalizes a vector of numbers to a range of zero to one.
normalize( x, old_min = NULL, old_max = NULL, new_min = 0, new_max = 1, na_zero = FALSE )normalize( x, old_min = NULL, old_max = NULL, new_min = 0, new_max = 1, na_zero = FALSE )
x |
The vector to normalize |
old_min |
The minimum of the old range |
old_max |
The maximum of the old range |
new_min |
The minimum of the new range, defaults to 0 |
new_max |
The maximum of the new range, defaults to 1 |
na_zero |
Not yet documented. |
Test whether every element can be read as a number
numbersOnly(x)numbersOnly(x)
x |
Not yet documented. |
Open an RScript stored on Google Drive
openRGD(drive_share_link)openRGD(drive_share_link)
drive_share_link |
Not yet documented. |
OS-aware correction of directory paths
OsDirectoryPathCorrect(directory_path)OsDirectoryPathCorrect(directory_path)
directory_path |
The path to correct |
OS-aware correction of paths
OsPathCorrect(path)OsPathCorrect(path)
path |
The path to correct |
Pairwise t-tests
pairwiseTTest(data, ..., p.adjust.method = "holm", pool.sd = FALSE)pairwiseTTest(data, ..., p.adjust.method = "holm", pool.sd = FALSE)
data |
Not yet documented. |
... |
Not yet documented. |
p.adjust.method |
Not yet documented. |
pool.sd |
Not yet documented. |
Pairwise Wilcoxon tests
pairwiseWilcoxTest(data, ..., p.adjust.method = "holm")pairwiseWilcoxTest(data, ..., p.adjust.method = "holm")
data |
Not yet documented. |
... |
Not yet documented. |
p.adjust.method |
Not yet documented. |
Parse an RIS reference file into a table
parseRISFile(filepath)parseRISFile(filepath)
filepath |
Not yet documented. |
Teaching dataset from the Integrated Bioanalytical Chemistry course (passenger_flows.csv).
passenger_flowspassenger_flows
A tibble with 192 rows and 3 columns:
character
character
numeric
https://thebustalab.github.io/phylochemistry/sample_data/passenger_flows.csv
Interactive PCA visualizer
pcaVisualizer( data, columns_w_sample_ID_info = NULL, columns_w_values_for_single_analyte = NULL )pcaVisualizer( data, columns_w_sample_ID_info = NULL, columns_w_values_for_single_analyte = NULL )
data |
Not yet documented. |
columns_w_sample_ID_info |
Not yet documented. |
columns_w_values_for_single_analyte |
Not yet documented. |
Teaching dataset from the Integrated Bioanalytical Chemistry course (per_table.csv).
periodic_tableperiodic_table
A tibble with 118 rows and 41 columns:
numeric
character
character
character
numeric
numeric
numeric
numeric
character
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
character
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
character
character
character
numeric
character
character
character
numeric
numeric
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/per_table.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (per_table_small.csv).
periodic_table_subsetperiodic_table_subset
A tibble with 56 rows and 25 columns:
numeric
character
numeric
numeric
numeric
numeric
numeric
character
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/per_table_small.csv
Permutational multivariate analysis of variance
permanovaTest( data, formula, distance = "euclidean", permutations = 999, profile = NULL, sample = NULL )permanovaTest( data, formula, distance = "euclidean", permutations = 999, profile = NULL, sample = NULL )
data |
Not yet documented. |
formula |
Not yet documented. |
distance |
Not yet documented. |
permutations |
Not yet documented. |
profile |
Not yet documented. |
sample |
Not yet documented. |
Determine which samples are identical based on p values
pGroups(data)pGroups(data)
data |
Not yet documented. |
Phred+33 quality score lookup table
phred33_lookupphred33_lookup
A data frame mapping Phred+33 characters to quality scores.
Compute phylogenetic signal for continuous and discrete traits
phylogeneticSignal( traits, column_w_names_of_tiplabels, column_w_names_of_traits, column_w_values_for_traits, tree, replicates = 999, cost = NULL )phylogeneticSignal( traits, column_w_names_of_tiplabels, column_w_names_of_traits, column_w_values_for_traits, tree, replicates = 999, cost = NULL )
traits |
Not yet documented. |
column_w_names_of_tiplabels |
Not yet documented. |
column_w_names_of_traits |
Not yet documented. |
column_w_values_for_traits |
Not yet documented. |
tree |
A phylogenetic tree (class phylo) with tips that exactly match the names of trait |
replicates |
Number of random replications to run |
cost |
Optional. A specialized transition matrix |
Compare phylogenetic and trait distances
phyloTraitDistance( traits, column_w_names_of_tiplabels, column_w_values_for_traits, tree, mode = c("presence_absence", "quantitative") )phyloTraitDistance( traits, column_w_names_of_tiplabels, column_w_values_for_traits, tree, mode = c("presence_absence", "quantitative") )
traits |
Not yet documented. |
column_w_names_of_tiplabels |
Not yet documented. |
column_w_values_for_traits |
Not yet documented. |
tree |
Not yet documented. |
mode |
Not yet documented. |
Pick a free port for a Shiny app on the lab JupyterHub
pick_shiny_port()pick_shiny_port()
Get coordinates for a 3D scatter plot
points3D( data, angle, tick_round, x_tick_interval, y_tick_interval, z_tick_interval )points3D( data, angle, tick_round, x_tick_interval, y_tick_interval, z_tick_interval )
data |
Data frame with columns x, y, z, and sample_unique_ID |
angle |
Angle of the z axis |
tick_round |
Integer to which tick labels should be rounded |
x_tick_interval |
Interval of ticks on x axis |
y_tick_interval |
Interval of ticks on y axis |
z_tick_interval |
Interval of ticks on z axis |
## Not run: points3D() ## End(Not run)## Not run: points3D() ## End(Not run)
Search locally stored sequence collections for query sequences. Download Blast+ here: https://www.ncbi.nlm.nih.gov/books/NBK279671/
polyBlast( named_subjects_list, query_in_path, sequences_of_interest_directory_path, blast_module_directory_path, blast_mode = c("nnblastn", "ntblastp", "pnblastp"), e_value_cutoff = 1, word_size = 4, queries_in_output = TRUE, monolist_out_path )polyBlast( named_subjects_list, query_in_path, sequences_of_interest_directory_path, blast_module_directory_path, blast_mode = c("nnblastn", "ntblastp", "pnblastp"), e_value_cutoff = 1, word_size = 4, queries_in_output = TRUE, monolist_out_path )
named_subjects_list |
A list of paths to the transcriptomes that should be searched, named by taxonomic identifier (e.g. species names) |
query_in_path |
Path to a fasta file containing the query or queries |
sequences_of_interest_directory_path |
Path to a directory where blast hits should be written out as fasta files |
blast_module_directory_path |
Path to directory containing the BLAST+ module (perhaps something like "/usr/local/ncbi/blast/bin/") |
blast_mode |
One of "blastn" or "dc-megablast". "blastn" is a traditional BLASTN requiring an exact match of 11. "dc-megablast" is a discontiguous megablast used to find more distant (e.g., interspecies) sequences. |
e_value_cutoff |
e-value cutoff to apply to results. Defaults to 1. |
word_size |
Word size for the BLAST search. Defaults to 4. |
queries_in_output |
Should the queries be included in the fasta output? |
monolist_out_path |
Path to where the output monolist should be written |
This function performs a BLAST search on a set of query sequences against a list of subject transcriptomes. It supports both nucleotide and protein BLAST searches, and can handle both Unix and Windows operating systems. The function first translates the transcriptomes if necessary, builds BLAST databases, and then performs the BLAST search. The results are processed to remove duplicates and are written to a monolist, which is also saved to a specified output path.
A data frame (monolist) containing the BLAST search results with columns for accession, Genus, species, annotation, length, longestORF, length_aligned_with_query, percent_identity, e_value, bitscore, subset_all, word_size, query, query_length, and query_longestORF.
## Not run: named_subjects_list <- list("species1" = "path/to/species1.fasta", "species2" = "path/to/species2.fasta") query_in_path <- "path/to/query.fasta" sequences_of_interest_directory_path <- "path/to/output/directory" blast_module_directory_path <- "/usr/local/ncbi/blast/bin/" blast_mode <- "blastn" e_value_cutoff <- 1 word_size <- 4 queries_in_output <- TRUE monolist_out_path <- "path/to/monolist_output" polyBlast(named_subjects_list, query_in_path, sequences_of_interest_directory_path, blast_module_directory_path, blast_mode, e_value_cutoff, word_size, queries_in_output, monolist_out_path) ## End(Not run)## Not run: named_subjects_list <- list("species1" = "path/to/species1.fasta", "species2" = "path/to/species2.fasta") query_in_path <- "path/to/query.fasta" sequences_of_interest_directory_path <- "path/to/output/directory" blast_module_directory_path <- "/usr/local/ncbi/blast/bin/" blast_mode <- "blastn" e_value_cutoff <- 1 word_size <- 4 queries_in_output <- TRUE monolist_out_path <- "path/to/monolist_output" polyBlast(named_subjects_list, query_in_path, sequences_of_interest_directory_path, blast_module_directory_path, blast_mode, e_value_cutoff, word_size, queries_in_output, monolist_out_path) ## End(Not run)
This function utilizes the HMMER software suite to scan a given multifasta file for PFAM domains using a specified HMM domain library. The results are parsed and returned as a data frame.
predictDomains( fasta_in_path, domain_library_in_path = "/project_data/shared/general_lab_resources/hmmer/Pfam-A.hmm" )predictDomains( fasta_in_path, domain_library_in_path = "/project_data/shared/general_lab_resources/hmmer/Pfam-A.hmm" )
fasta_in_path |
A character string specifying the path to the multifasta file containing the sequences to be analyzed. The file should be in a format compatible with the HMMER 'hmmscan' tool. |
domain_library_in_path |
A character string specifying the path to the HMM file that contains a library of domains. By default, it uses the Pfam-A.hmm library located at "/project_data/shared/general_lab_resources/hmmer/Pfam-A.hmm". |
The function first removes any existing temporary output file to ensure clean results. It then runs the 'hmmscan' command to predict domains in the input sequences. The output is parsed into a structured data frame using predefined column types. The function handles the parsing of domain descriptions separately and appends them to the resulting data frame.
A data frame containing the parsed results of the domain predictions. The data frame includes columns such as domain name, domain accession, domain length, query name, query accession, sequence e-value, and more.
## Not run: \dontrun{ predictDomains( fasta_in_path = "example_sequences.fasta", domain_library_in_path = "custom_domain_library.hmm" ) } ## End(Not run)## Not run: \dontrun{ predictDomains( fasta_in_path = "example_sequences.fasta", domain_library_in_path = "custom_domain_library.hmm" ) } ## End(Not run)
Predict new values with a model from buildModel()
predictWithModel(data, model, model_type = NULL, id_cols = NULL)predictWithModel(data, model, model_type = NULL, id_cols = NULL)
data |
Not yet documented. |
model |
Not yet documented. |
model_type |
Not yet documented. |
id_cols |
Not yet documented. |
Prune a tree so it only contains user-specified tips
pruneTree(tree_in, tips_to_keep)pruneTree(tree_in, tips_to_keep)
tree_in |
Either the path to the tree to manipulate, an in-memory phylo object, or a fortified tree |
tips_to_keep |
The tips to keep |
Create a question
question(question, distractors, correct, no, fb = "", print_question = TRUE)question(question, distractors, correct, no, fb = "", print_question = TRUE)
question |
Not yet documented. |
distractors |
Not yet documented. |
correct |
Not yet documented. |
no |
Not yet documented. |
fb |
Not yet documented. |
print_question |
Not yet documented. |
Build a questionnaire from a table of questions
questionnaire(x, shuffle = TRUE, print_question = TRUE)questionnaire(x, shuffle = TRUE, print_question = TRUE)
x |
Not yet documented. |
shuffle |
Not yet documented. |
print_question |
Not yet documented. |
Reads an alignment into a tidy dataframe
readAlignment(alignment_in_path, type = c("DNA", "AA"))readAlignment(alignment_in_path, type = c("DNA", "AA"))
alignment_in_path |
The path to the alignment |
type |
Not yet documented. |
Allows the user to import chromatograms stored as .csv files. Files should have originated from an Agilent GC system running ChemStation Files should be in the format of character~var1-var2.csv "character" is the name of the chromatogram, var1 and var2 are NUMERIC variables you want associated with that chromatogram.
readChromatograms( dir, normalize_level = c("none", "var1", "var2"), normalize_range = NULL )readChromatograms( dir, normalize_level = c("none", "var1", "var2"), normalize_range = NULL )
dir |
A directory containing (ONLY) the chromatogram(s) that are to be plotted |
normalize_level |
Level at which to normalize chromatogram |
normalize_range |
y range to consider during normalization. Useful for normalizing but excluding solvent peak(s), for example |
## Not run: readChromatograms() ## End(Not run)## Not run: readChromatograms() ## End(Not run)
This function allows the user to interactively select a CSV file to read. The file can be delimited by either a comma or a space.
readCSV(sep = c(",", " "))readCSV(sep = c(",", " "))
sep |
A character vector indicating the delimiter to use when reading the file. The default is a comma (","), but a space (" ") can also be used. |
A data frame containing the contents of the selected CSV file.
## Not run: \dontrun{ # To read a CSV file with comma delimiter data <- readCSV() # To read a CSV file with space delimiter data <- readCSV(sep = " ") } ## End(Not run)## Not run: \dontrun{ # To read a CSV file with comma delimiter data <- readCSV() # To read a CSV file with space delimiter data <- readCSV(sep = " ") } ## End(Not run)
Returns contents of one fasta file as a StringSet object.
readFasta(fasta_in_path, fasta_type = "nonspecific")readFasta(fasta_in_path, fasta_type = "nonspecific")
fasta_in_path |
The path to the fasta to read. Can be local or a google drive share link. |
fasta_type |
The type of sequence data contained in the fasta file. Options: "nonspecific", "DNA", "RNA", or "AA" |
Read multiple genome feature files into a tidy dataframe
readGFFs( input_frame, subset_mode = c("none", "goi_only", "goi_region", "name_check"), goi = NULL, concatenate_by_species = TRUE, chromosomes_only = FALSE, omit = NULL )readGFFs( input_frame, subset_mode = c("none", "goi_only", "goi_region", "name_check"), goi = NULL, concatenate_by_species = TRUE, chromosomes_only = FALSE, omit = NULL )
input_frame |
A dataframe with columns: Genus_species, GFF_in_path, region_reach (20000), concatenation_spacing (10000) |
subset_mode |
A character vector of length 1. One of: "none", "goi_only", "goi_region", "name_check" |
goi |
A character vector of gene names. Labelling by species is not necessary |
concatenate_by_species |
A logical. If TRUE, concatenate all GFFs for a species into a single GFF |
chromosomes_only |
A logical. If TRUE, only keep chromosome features |
omit |
A character vector of columns to omit from the output dataframe |
This function reads multiple genome feature files (GFFs) and processes them into a tidy dataframe. It allows for various modes of subsetting and concatenation of GFFs based on user-defined parameters.
A tidy dataframe containing the processed GFF data
## Not run: # Example usage: # Read GFFs without any subsetting gff_data <- readGFFs(input_frame, subset_mode = "none") # Read GFFs and subset by genes of interest (goi) gff_data <- readGFFs(input_frame, subset_mode = "goi_only", goi = c("gene1", "gene2")) # Read GFFs and subset by regions around genes of interest (goi) gff_data <- readGFFs(input_frame, subset_mode = "goi_region", goi = c("gene1", "gene2"), region_reach = 20000) # Read GFFs and check for unique gene names gff_data <- readGFFs(input_frame, subset_mode = "name_check") ## End(Not run)## Not run: # Example usage: # Read GFFs without any subsetting gff_data <- readGFFs(input_frame, subset_mode = "none") # Read GFFs and subset by genes of interest (goi) gff_data <- readGFFs(input_frame, subset_mode = "goi_only", goi = c("gene1", "gene2")) # Read GFFs and subset by regions around genes of interest (goi) gff_data <- readGFFs(input_frame, subset_mode = "goi_region", goi = c("gene1", "gene2"), region_reach = 20000) # Read GFFs and check for unique gene names gff_data <- readGFFs(input_frame, subset_mode = "name_check") ## End(Not run)
Returns the contents of many fasta files as a StringSet object.
readManyFastas(fasta_in_paths, fasta_type = "nonspecific")readManyFastas(fasta_in_paths, fasta_type = "nonspecific")
fasta_in_paths |
The paths to the fastas to read |
fasta_type |
The type of sequence data contained in the fasta file. Options: "nonspecific", "DNA", "RNA", or "AA" |
This function reads a monolist from a specified path or URL. The monolist should be in CSV format.
readMonolist(monolist_in_path)readMonolist(monolist_in_path)
monolist_in_path |
A string specifying the path or URL to the monolist CSV file. |
A data frame containing the contents of the monolist.
## Not run: \dontrun{ # To read a monolist from a local file monolist <- readMonolist("path/to/monolist.csv") # To read a monolist from a URL monolist <- readMonolist("http://example.com/monolist.csv") } ## End(Not run)## Not run: \dontrun{ # To read a monolist from a local file monolist <- readMonolist("path/to/monolist.csv") # To read a monolist from a URL monolist <- readMonolist("http://example.com/monolist.csv") } ## End(Not run)
Read the text of a PDF file
readPDF(path_to_pdf)readPDF(path_to_pdf)
path_to_pdf |
Not yet documented. |
Reads a spreadsheet in polylist format (wide format, multiple column and row headers), and converts it into tidy format
readPolylist( polylist_in_path, centroid = "~~~", table_value_unit = "abundance" )readPolylist( polylist_in_path, centroid = "~~~", table_value_unit = "abundance" )
polylist_in_path |
The path to the polylist (in .csv format) to be read |
centroid |
The characters in the cell that defines the boundaries of the multiple row and column headers |
table_value_unit |
The name to be given to the column that will contain the values in the polylist table |
Used to import one or more mass spectra and collect the data in a dataframe. The names of the files containing the mass spectra must have the following format: "var2~var3-var4.csv", with var1 being the file's position in the directory
readSpectra(dir, source = c("phylochemistry", "agilent"))readSpectra(dir, source = c("phylochemistry", "agilent"))
dir |
The directory containing the mass spectral (.csv) files of interest and nothing else |
source |
Not yet documented. |
## Not run: readSpectra() ## End(Not run)## Not run: readSpectra() ## End(Not run)
Reads a phylogenetic tree
readTree(tree_in_path)readTree(tree_in_path)
tree_in_path |
The path to the phylogenetic tree |
Replace special characters in text
removeSpecialCharacters(text_string)removeSpecialCharacters(text_string)
text_string |
Not yet documented. |
Rename (move) a file, creating the destination folder if needed
renameFile(from, to)renameFile(from, to)
from |
Not yet documented. |
to |
Not yet documented. |
This function takes a protein sequence from a fasta file and reverse translates it into a nucleotide sequence using a specified codon table. The resulting nucleotide sequence is then written to an output fasta file.
reverseTranslate( fasta_in_path, fasta_out_path, organism = c("Arabidopsis_thaliana", "Zea_mays", "Nicotiana_tabacum", "Saccharomyces_cerevisiae") )reverseTranslate( fasta_in_path, fasta_out_path, organism = c("Arabidopsis_thaliana", "Zea_mays", "Nicotiana_tabacum", "Saccharomyces_cerevisiae") )
fasta_in_path |
A character string specifying the path to the input fasta file containing the protein sequence(s). |
fasta_out_path |
A character string specifying the path to the output fasta file where the nucleotide sequence(s) will be written. |
organism |
A character string specifying the organism whose codon table should be used for reverse translation. Options are "Arabidopsis_thaliana", "Zea_mays", "Nicotiana_tabacum", or "Saccharomyces_cerevisiae". The default is to use the codon table for "Arabidopsis_thaliana". |
The function reads a codon table from a predefined URL and filters it based on the specified organism. It then constructs a substitution table to map amino acids to their most frequently used codons in the organism. Each protein sequence in the input file is reverse translated, ensuring a terminal stop codon is present, and the resulting nucleotide sequences are saved to the output file.
This function does not return a value. It writes the reverse-translated nucleotide sequences to the specified output fasta file.
## Not run: # Reverse translate a protein sequence for Arabidopsis thaliana reverseTranslate("https://thebustalab.github.io/R_For_Chemists/sample_data/peptide.fasta", "peptide.fasta", "Arabidopsis_thaliana") ## End(Not run)## Not run: # Reverse translate a protein sequence for Arabidopsis thaliana reverseTranslate("https://thebustalab.github.io/R_For_Chemists/sample_data/peptide.fasta", "peptide.fasta", "Arabidopsis_thaliana") ## End(Not run)
Teaching dataset from the Integrated Bioanalytical Chemistry course (rice_proteins.csv).
rice_proteinsrice_proteins
A tibble with 57 rows and 3 columns:
character
character
character
https://thebustalab.github.io/phylochemistry/sample_data/rice_proteins.csv
rotates a set of x,y coordinates
rotate_coord(x, y, angle, center = c(0, 0))rotate_coord(x, y, angle, center = c(0, 0))
x |
The x values |
y |
The y values |
angle |
The angle to rotate (in degrees) |
center |
The center of rotation (default = 0,0) |
Retired 2026-09-22. This was a wide-data-only fork of runMatrixAnalysis(); every capability it had has been ported into the singular, which also handles long-format input. Calling it raises an error explaining the migration.
runMatrixAnalyses(...)runMatrixAnalyses(...)
... |
Ignored; the function always stops. |
The single matrix-analysis verb for the course. It absorbed runMatrixAnalyses() (plural) on 2026-09-22; the plural is retired and now stops with a migration message.
runMatrixAnalysis( data, analysis = c("pca", "pca_ord", "pca_dim", "mca", "mca_ord", "mca_dim", "mds", "mds_ord", "mds_dim", "tsne", "dbscan", "kmeans", "hclust", "hclust_phylo", "hclust_cat", "dist"), parameters = NULL, column_w_names_of_multiple_analytes = NULL, column_w_values_for_multiple_analytes = NULL, columns_w_values_for_single_analyte = NULL, columns_w_additional_analyte_info = NULL, columns_w_sample_ID_info = NULL, transpose = FALSE, distance_method = c("euclidean", "manhattan", "gower", "correlation", "cosine", "bray_curtis", "jaccard", "aitchison"), agglomeration_method = c("ward.D2", "ward.D", "single", "complete", "average", "mcquitty", "median", "centroid"), tree_method = c("linkage_dendrogram", "neighbor_joining"), unknown_sample_ID_info = NULL, components_to_return = 2, scale_variance = NULL, na_replacement = c("mean", "none", "zero", "drop"), output_format = c("wide", "long"), ... )runMatrixAnalysis( data, analysis = c("pca", "pca_ord", "pca_dim", "mca", "mca_ord", "mca_dim", "mds", "mds_ord", "mds_dim", "tsne", "dbscan", "kmeans", "hclust", "hclust_phylo", "hclust_cat", "dist"), parameters = NULL, column_w_names_of_multiple_analytes = NULL, column_w_values_for_multiple_analytes = NULL, columns_w_values_for_single_analyte = NULL, columns_w_additional_analyte_info = NULL, columns_w_sample_ID_info = NULL, transpose = FALSE, distance_method = c("euclidean", "manhattan", "gower", "correlation", "cosine", "bray_curtis", "jaccard", "aitchison"), agglomeration_method = c("ward.D2", "ward.D", "single", "complete", "average", "mcquitty", "median", "centroid"), tree_method = c("linkage_dendrogram", "neighbor_joining"), unknown_sample_ID_info = NULL, components_to_return = 2, scale_variance = NULL, na_replacement = c("mean", "none", "zero", "drop"), output_format = c("wide", "long"), ... )
data |
The data frame or tibble to analyze. May be WIDE (one column per analyte, named in columns_w_values_for_single_analyte) or LONG (one row per sample per analyte, named in column_w_names_of_multiple_analytes plus column_w_values_for_multiple_analytes). |
analysis |
The type of analysis to run: one of "pca", "pca_ord", "pca_dim", "mca", "mca_ord", "mca_dim", "mds", "mds_ord", "mds_dim", "tsne", "dbscan", "kmeans", "hclust", "hclust_phylo", "hclust_cat" or "dist". |
parameters |
Analysis-specific parameters. For kmeans, the number of clusters; for dbscan, c(eps, MinPts). Required for both. |
column_w_names_of_multiple_analytes |
Long input: the column holding analyte names. |
column_w_values_for_multiple_analytes |
Long input: the column holding the values. |
columns_w_values_for_single_analyte |
Wide input: the columns holding the values. |
columns_w_additional_analyte_info |
Per-analyte metadata to carry through. |
columns_w_sample_ID_info |
The columns that together identify a sample. |
transpose |
Analyse analytes as rows rather than samples. Default FALSE. |
distance_method |
What "similar" means. "euclidean" (default) and "manhattan" (absolute differences; less pulled by one extreme variable); "gower" (mixed numeric and categorical columns, via cluster::daisy); "correlation" (1 - Pearson r between samples: same pattern, regardless of size) and "cosine" (1 - cosine similarity: same direction, regardless of length); "bray_curtis" (abundance data; shared absences do not count as similarity), "jaccard" (presence/absence: any value > 0 is present) and "aitchison" (compositional data: euclidean on centred log-ratios; zeros are replaced with half the smallest positive value, with a message). bray_curtis, jaccard and aitchison need raw non-negative values, so pass scale_variance = FALSE with them. All are computed in base R (no vegan), so every one also runs in WebR. |
agglomeration_method |
The linkage rule for hierarchical clustering. Only used when tree_method = "linkage_dendrogram". |
tree_method |
How a tree is built for "hclust"/"hclust_phylo". "linkage_dendrogram" (the DEFAULT) is hierarchical clustering proper: it honours agglomeration_method and returns bootstrap support. "neighbor_joining" is the phylogenetic method, works from the distance matrix alone, IGNORES agglomeration_method, and returns no bootstrap values. |
unknown_sample_ID_info |
Sample IDs to treat as unknowns for nearest-neighbour matching against the rest (used by the GC-MS workflows). |
components_to_return |
How many components to return. Default 2. |
scale_variance |
Center each column and divide it by its standard deviation before computing distances. Default TRUE for every analysis (including "hclust", which defaulted to FALSE until 2026-09-28). Pass FALSE for compositional data – where every column is a share of the same whole and is already on one scale. |
na_replacement |
"mean" (default), "none", "zero" or "drop". |
output_format |
"wide" (default) or "long". For analysis = "dist" this chooses
the RETURN TYPE: "wide" gives a base R |
... |
Not yet documented. |
Run phylogenetic comparative analyses on traits
runPhylogeneticAnalyses( traits, column_w_names_of_tiplabels, column_w_names_of_traits, column_w_values_for_traits, tree, replicates = 999, cost = NULL )runPhylogeneticAnalyses( traits, column_w_names_of_tiplabels, column_w_names_of_traits, column_w_values_for_traits, tree, replicates = 999, cost = NULL )
traits |
Not yet documented. |
column_w_names_of_tiplabels |
Not yet documented. |
column_w_names_of_traits |
Not yet documented. |
column_w_values_for_traits |
Not yet documented. |
tree |
Not yet documented. |
replicates |
Not yet documented. |
cost |
Not yet documented. |
Search text for a set of query terms
searchField(subject_list, query_list)searchField(subject_list, query_list)
subject_list |
Not yet documented. |
query_list |
Not yet documented. |
Search NCBI for protein (or nucleotide) records and return their sequences
searchNCBI(search_term, retmax = 5, type = "protein")searchNCBI(search_term, retmax = 5, type = "protein")
search_term |
The term to search for in the NCBI database. |
retmax |
The maximum number of results to return. Default is 5. |
type |
|
An AAStringSet (protein) or DNAStringSet (nucleotide), or NULL if nothing matched.
Search PubMed and return article metadata
searchPubMed( search_terms, pubmed_api_key, sort = c("date", "relevance"), retmax_per_term = 20 )searchPubMed( search_terms, pubmed_api_key, sort = c("date", "relevance"), retmax_per_term = 20 )
search_terms |
Not yet documented. |
pubmed_api_key |
Not yet documented. |
sort |
Not yet documented. |
retmax_per_term |
Not yet documented. |
Shapiro-Wilk normality test by group
shapiroTest(data, var)shapiroTest(data, var)
data |
Not yet documented. |
var |
Not yet documented. |
Teaching dataset from the Integrated Bioanalytical Chemistry course (solvents.csv).
solventssolvents
A tibble with 32 rows and 14 columns:
character
character
numeric
numeric
numeric
logical
numeric
numeric
numeric
character
numeric
numeric
numeric
character
https://thebustalab.github.io/phylochemistry/sample_data/solvents.csv
Split text into overlapping chunks of tokens
splitIntoChunks( data_frame, column_to_split, source_ID_column, chunk_size_in_tokens, overlap_in_tokens )splitIntoChunks( data_frame, column_to_split, source_ID_column, chunk_size_in_tokens, overlap_in_tokens )
data_frame |
Not yet documented. |
column_to_split |
Not yet documented. |
source_ID_column |
Not yet documented. |
chunk_size_in_tokens |
Not yet documented. |
overlap_in_tokens |
Not yet documented. |
Places the cut line on a dendrogram from the plot's own x data; used by geom_cut().
StatCutStatCut
A ggplot2 ggproto object.
Teaching dataset from the Integrated Bioanalytical Chemistry course (tequila_chemistry.csv).
tequila_chemistrytequila_chemistry
A tibble with 4720 rows and 6 columns:
character
character
character
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/tequila_chemistry.csv
t-tests on data or on a fitted model
tTest(data, ..., compare = NULL, slopes_of = NULL, p.adjust.method = "holm")tTest(data, ..., compare = NULL, slopes_of = NULL, p.adjust.method = "holm")
data |
Not yet documented. |
... |
Not yet documented. |
compare |
Not yet documented. |
slopes_of |
Not yet documented. |
p.adjust.method |
Not yet documented. |
Tukey's honest significant difference test
tukeyTest(data, ..., compare = NULL, slopes_of = NULL)tukeyTest(data, ..., compare = NULL, slopes_of = NULL)
data |
Not yet documented. |
... |
Not yet documented. |
compare |
Not yet documented. |
slopes_of |
Not yet documented. |
Teaching dataset from the Integrated Bioanalytical Chemistry course (unknown_mushroom.csv).
unknown_mushroomunknown_mushroom
A tibble with 1 rows and 11 columns:
numeric
character
character
logical
character
numeric
numeric
character
logical
character
character
https://thebustalab.github.io/phylochemistry/sample_data/unknown_mushroom.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (unknown_smoke.csv).
unknown_smokeunknown_smoke
A tibble with 254 rows and 5 columns:
character
character
numeric
character
character
https://thebustalab.github.io/phylochemistry/sample_data/unknown_smoke.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (us_airports.csv).
us_airportsus_airports
A tibble with 29 rows and 7 columns:
character
character
character
character
character
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/us_airports.csv
Get coordinates for quantitative Venn Diagram
vennAnalysis(data)vennAnalysis(data)
data |
Data frame of TRUE FALSE for whether each observation belongs to each category |
## Not run: vennAnalysis() ## End(Not run)## Not run: vennAnalysis() ## End(Not run)
Wilcoxon rank-sum test
wilcoxTest(data, ...)wilcoxTest(data, ...)
data |
Not yet documented. |
... |
Not yet documented. |
Teaching dataset from the Integrated Bioanalytical Chemistry course (wine_grape_data.csv).
wine_grape_datawine_grape_data
A tibble with 1070 rows and 5 columns:
character
character
character
character
numeric
https://thebustalab.github.io/phylochemistry/sample_data/wine_grape_data.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (wine_quality.csv).
wine_qualitywine_quality
A tibble with 6497 rows and 14 columns:
character
numeric
character
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
numeric
https://thebustalab.github.io/phylochemistry/sample_data/wine_quality.csv
Teaching dataset from the Integrated Bioanalytical Chemistry course (wood_smoke_data.csv).
wood_smokewood_smoke
A tibble with 1524 rows and 5 columns:
character
character
numeric
character
character
https://thebustalab.github.io/phylochemistry/sample_data/wood_smoke_data.csv
This function writes a long-format alignment DataFrame to a FASTA file. The DataFrame must contain specific columns: 'name', 'position', and 'state'. The function can automatically detect the type of sequence data (DNA or AA) if not specified.
writeAlignment(alignment, alignment_out_path, type = "auto")writeAlignment(alignment, alignment_out_path, type = "auto")
alignment |
A DataFrame containing the alignment data with columns 'name', 'position', and 'state'. |
alignment_out_path |
A string specifying the file path where the FASTA file will be saved. |
type |
A string indicating the type of sequence data: "DNA", "AA", or "auto" for automatic detection. Default is "auto". |
None. The function writes the alignment to a specified FASTA file.
## Not run: \dontrun{ # Write a DNA alignment to a FASTA file writeAlignment(alignment_df, "output.fasta", type = "DNA") # Automatically detect the type and write to a FASTA file writeAlignment(alignment_df, "output.fasta") } ## End(Not run)## Not run: \dontrun{ # Write a DNA alignment to a FASTA file writeAlignment(alignment_df, "output.fasta", type = "DNA") # Automatically detect the type and write to a FASTA file writeAlignment(alignment_df, "output.fasta") } ## End(Not run)
This function allows the user to interactively select a location to save a monolist as a CSV file.
writeCSV(monolist)writeCSV(monolist)
monolist |
A data frame representing the monolist to be written to a CSV file. |
None. The function writes the monolist to a file and does not return a value.
## Not run: \dontrun{ # To write a monolist to a CSV file writeCSV(monolist) } ## End(Not run)## Not run: \dontrun{ # To write a monolist to a CSV file writeCSV(monolist) } ## End(Not run)
Writes one or more sequences as a single fasta file
writeFasta( XStringSet, fasta_out_path, append = FALSE, fasta_type = c("DNA", "AA") )writeFasta( XStringSet, fasta_out_path, append = FALSE, fasta_type = c("DNA", "AA") )
XStringSet |
The sequences to write out |
fasta_out_path |
The path to where the file should be written |
append |
Not yet documented. |
fasta_type |
Not yet documented. |
Writes one or more sequences as individual fasta file(s), each with one sequence
writeManyFastas(XStringSet, fasta_out_directory_path)writeManyFastas(XStringSet, fasta_out_directory_path)
XStringSet |
The sequence(s) to write out |
fasta_out_directory_path |
The path to the directory where the file(s) should be written |
Writes a monolist
writeMonolist(monolist, monolist_out_path, ...)writeMonolist(monolist, monolist_out_path, ...)
monolist |
The monolist to write out |
monolist_out_path |
The path to where the monolist should be written |
... |
Not yet documented. |
This function allows the user to interactively select a location to save a polylist as a CSV file.
writePolylist(polylist, polylist_out_path)writePolylist(polylist, polylist_out_path)
polylist |
The polylist to write out |
polylist_out_path |
The path to where the polylist should be written |
Writes a human-readable supplemental table of quantitative data
writeSupplementalTable( supplementalTable, round_level, file_out_path, replicates )writeSupplementalTable( supplementalTable, round_level, file_out_path, replicates )
supplementalTable |
The data to write out |
round_level |
The number of decimal places summary statistics should have |
file_out_path |
The path to the location where the file should be written |
replicates |
Not yet documented. |
Writes a phylogenetic tree
writeTree(tree, tree_out_path)writeTree(tree, tree_out_path)
tree |
Not yet documented. |
tree_out_path |
The path to where the tree should be written |