Package 'phylochemistry'

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

Help Index


Insert a geom layer below others

Description

Allows the user to plot a multiple alignent using ggplot's grammar of graphics

Usage

## S3 method for class 'gg'
plot - layer

Arguments

plot

The plot to which the layer should be added

layer

The layer to be added

Examples

## Not run: 
-.gg()

## End(Not run)

alaska_lake_data

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (alaska_lake_data.csv).

Usage

alaska_lake_data

Format

A tibble with 220 rows and 7 columns:

lake

character

park

character

water_temp

numeric

pH

numeric

element

character

mg_per_L

numeric

element_type

character

Source

https://thebustalab.github.io/phylochemistry/sample_data/alaska_lake_data.csv


algae_data

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (algae_data.csv).

Usage

algae_data

Format

A tibble with 180 rows and 5 columns:

replicate

numeric

algae_strain

character

harvesting_regime

character

chemical_species

character

abundance

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/algae_data.csv


Align sequences in a seqlist

Description

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

Usage

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
)

Arguments

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.

Value

This function does not return a value. It writes the aligned sequences to the specified output path.

Examples

## 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

Description

Pairwise t-tests from group means, standard deviations and sizes

Usage

allPairsTTestMean(
  category,
  mean,
  stdev,
  n,
  correction_method = c("BH", "holm", "bonferroni", "none")
)

Arguments

category

Not yet documented.

mean

Not yet documented.

stdev

Not yet documented.

n

Not yet documented.

correction_method

Not yet documented.


Analyze a multiple sequence alignment and subset it for phylogeny building

Description

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.

Usage

analyzeAlignment(alignment_in_path, type = c("DNA", "AA"), jupyter = FALSE)

Arguments

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.

Value

A Shiny app for visualizing and subsetting the alignment.

Examples

## Not run: 
# Example usage:
# analyzeAlignment("path/to/alignment.fasta", type = "DNA", jupyter = FALSE)

## End(Not run)

Create major and minor axes ticks and labels

Description

Create major and minor axes ticks and labels

Usage

analyzeImages(folder_URL, monolist_out_path)

Arguments

folder_URL

Not yet documented.

monolist_out_path

Not yet documented.


Interactive literature analysis app

Description

Interactive literature analysis app

Usage

analyzeLiterature(
  jupyter = TRUE,
  openai_api_key = "busta_lab",
  xi_api_key = "busta_lab"
)

Arguments

jupyter

Not yet documented.

openai_api_key

Not yet documented.

xi_api_key

Not yet documented.


Use image analysis to obtain csv of mass spectrum from an image.

Description

Read a png with left-most pixel low mass, right-most pixel high mass Filename: reference~compoundName_lowmz-rightmz

Usage

analyzeMassSpectralImages(image_directory_in_path)

Arguments

image_directory_in_path

The directory containing the images to be read.

Examples

## Not run: 
analyzeMassSpectralImages()

## End(Not run)

Reconstruct ancestral trait values on a tree

Description

Reconstruct ancestral trait values on a tree

Usage

ancestralTraits(
  traits,
  column_w_names_of_tiplabels,
  column_w_names_of_traits,
  column_w_values_for_traits,
  tree
)

Arguments

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

Description

Annotate an amino acid sequence with InterProScan

Usage

annotateAminoAcidSequence(sequence, email, applications = "PfamA")

Arguments

sequence

Not yet documented.

email

Not yet documented.

applications

Not yet documented.


Import chemcial data

Description

Allows the user to plot a multiple alignent using ggplot's grammar of graphics

Usage

annotatePDB(
  pdb_in_path,
  alignment_in_path,
  pdb_name_in_alignment,
  highlights_data,
  out_file
)

Arguments

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.

Examples

## Not run: 
annotatePDB()

## End(Not run)

anova on means and standard deviations

Description

anova on means and standard deviations

Usage

anovaMean(object, n, ybar, s, ..., ylabel = "ylabel")

Arguments

object

Not yet documented.

n

Not yet documented.

ybar

Not yet documented.

s

Not yet documented.

...

Not yet documented.

ylabel

Not yet documented.

Examples

## Not run: 
anovaTestMean()

## End(Not run)

Analysis of variance table

Description

Analysis of variance table

Usage

anovaTest(data, ...)

Arguments

data

Not yet documented.

...

Not yet documented.


ANOVA from group means, standard deviations and sizes

Description

ANOVA from group means, standard deviations and sizes

Usage

anovaTestMean(category, n, mean, stdev)

Arguments

category

Not yet documented.

n

Not yet documented.

mean

Not yet documented.

stdev

Not yet documented.


beer_components

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (beer_components.csv).

Usage

beer_components

Format

A tibble with 3625 rows and 6 columns:

ingredient

character

replicate

numeric

analyte

character

analyte_class

character

abundance

numeric

analyte_odor

character

Source

https://thebustalab.github.io/phylochemistry/sample_data/beer_components.csv


Run a BLAST search at NCBI

Description

Run a BLAST search at NCBI

Usage

blastNCBI(query_sequence, program, database)

Arguments

query_sequence

Not yet documented.

program

Not yet documented.

database

Not yet documented.


Runs bootstrapping on categorical data; from github sgibb/bootstrap

Description

Runs bootstrapping on categorical data; from github sgibb/bootstrap

Usage

bootstrap(x, fun, n = 1000L, mc.cores = getOption("mc.cores", 2L))

Arguments

x

Not yet documented.

fun

Not yet documented.

n

bootstrap

mc.cores

Not yet documented.


Interactive figure-caption builder app

Description

Interactive figure-caption builder app

Usage

buildCaption(jupyter = FALSE)

Arguments

jupyter

Not yet documented.


Build a Hidden Markov Model (HMM) database from a set of sequence alignments

Description

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.

Usage

buildDomainLibrary(alignment_in_paths, domain_library_out_path)

Arguments

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.

Details

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.

Value

This function does not return a value. It creates and indexes an HMM database file at the specified path.

Examples

## 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

Description

Build a statistical or machine-learning model

Usage

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
)

Arguments

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()

Description

Former name of buildModel()

Usage

buildModel2(...)

Arguments

...

Not yet documented.


Build a network from an edgelist

Description

Build a network from an edgelist

Usage

buildNetwork(
  edgelist,
  node_attributes = NULL,
  facet_variable = NULL,
  directed = NULL
)

Arguments

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 weight column is invented: for the force-directed layout, a column named edgeweight or weight is used if present, otherwise column 3.

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.

Examples

## Not run: 
buildNetwork()

## End(Not run)

Build a network from an edgelist

Description

Build a network from an edgelist

Usage

buildNetwork_OG(edgelist, node_attributes = NULL, facet_variable = NULL)

Arguments

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.

Examples

## Not run: 
buildNetwork_OG()

## End(Not run)

Build a human-readable matrix of samples, analytes, and measurements

Description

Build a human-readable matrix of samples, analytes, and measurements

Usage

buildPolylist(
  samples_monolist_in_path,
  analytes_monolist_in_path,
  measurements_monolist_in_path = NULL,
  centroid = "~~~",
  polylist_out_path
)

Arguments

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


Construct various types of phylogenetic trees from alignments or other trees

Description

This function allows the construction of phylogenetic trees using different types of input data.

Usage

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
)

Arguments

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/

Description

Convert a kmer report file from Canu into a table that can be accepted by genomescope Use http://qb.cshl.edu/genomescope/genomescope2.0/

Usage

canuHistogramToKmerTable(file_in_path, file_out_path)

Arguments

file_in_path

The path to the kmer report file

file_out_path

The path to the table file to write

Examples

## Not run: 
canuHistogramToKmerTable("https://thebustalab.github.io/R_For_Chemists/sample_data/kmer_report.txt",
                         "kmer_report.txt")

## End(Not run)

chemical_blooms

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (chemical_blooms.csv).

Usage

chemical_blooms

Format

A tibble with 78 rows and 10 columns:

label

character

Alkanes

numeric

Sec_Alcohols

numeric

Others

numeric

Fatty_acids

numeric

Alcohols

numeric

Triterpenoids

numeric

Ketones

numeric

Other_compounds

numeric

Aldehydes

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/chemical_blooms.csv


Save and close the current RScript to Google Drive

Description

Save and close the current RScript to Google Drive

Usage

closeRGD(drive_share_link)

Arguments

drive_share_link

Not yet documented.


Back-translate an amino-acid alignment onto its codons

Description

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.

Usage

codonAlignFromAA(aa_alignment, nucl_seqs)

Arguments

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.

Value

A named character vector of codon-aligned nucleotide sequences.


Collapse duplicate and reciprocal edges in an edgelist (used by buildNetwork)

Description

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.

Usage

collapseReciprocalEdges(
  edgelist,
  directed = NULL,
  tol = sqrt(.Machine$double.eps)
)

Arguments

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.


Create a high-level cladogram from a low-level tree

Description

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.

Usage

collapseTree(tree, associations)

Arguments

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.

Value

A phylogenetic tree of class 'phylo' with tips renamed and collapsed according to the provided associations.

Examples

## 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

Description

Compute text embeddings with the OpenAI API

Usage

computeEmbeddings(df, column_to_embed, openai_api_key)

Arguments

df

Not yet documented.

column_to_embed

Not yet documented.

openai_api_key

Not yet documented.


Continuous colour palette 1

Description

Continuous colour palette 1

Usage

cont_1

Format

A character vector of five colours.


Continuous colour palette 2

Description

Continuous colour palette 2

Usage

cont_2

Format

A character vector of five colours.


Convert mass spectral data files (CDF) into a CSV file

Description

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.

Usage

convertCDFstoCSVs(
  paths_to_cdfs,
  min_mz = 50,
  max_mz = 800,
  min_rt = NULL,
  max_rt = NULL,
  force = FALSE
)

Arguments

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.

Examples

## 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

Description

Radar (spider) coordinate system for ggplot2

Usage

coord_radar(theta = "x", start = 0, direction = 1)

Arguments

theta

Not yet documented.

start

Not yet documented.

direction

Not yet documented.


Extract 720 and 720 wavenumber intensities from FTIR data

Description

Filenames: 123~123-1.csv To use plots: library(gridExtra); nCol <- floor(sqrt(length(plots))); do.call("grid.arrange", c(plots, ncol=nCol))

Usage

crystallinity(data_directory_in_path, make_plots = TRUE)

Arguments

data_directory_in_path

The directory containing the data to be read and processed.

make_plots

Not yet documented.

Examples

## Not run: 
crystallinity()

## End(Not run)

Provides a descendants list for a fortified tree

Description

Provides a descendants list for a fortified tree

Usage

descendantsFortified(fortified_tree)

Arguments

fortified_tree

The fortified tree that should be analyzed


Discrete colour palette

Description

Discrete colour palette

Usage

discrete_palette

Format

A character vector of 25 colours.


Returns contents of one fasta file as a StringSet object.

Description

Returns contents of one fasta file as a StringSet object.

Usage

downloadFasta(share_link)

Arguments

share_link

The path to the fasta to read. Can be local or a google drive share link.


Generate a multiple alignment graphic using ggplot

Description

Allows the user to plot a multiple alignent using ggplot's grammar of graphics

Usage

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
)

Arguments

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

Examples

## Not run: 
drawAlignment()

## End(Not run)

Draws a baseline on a signal

Description

Draws a baseline on a signal

Usage

drawBaseline(data, prelim_baseline_window)

Arguments

data

x, y dataframe

prelim_baseline_window

interval at which to draw baseline


Draw chemical structures from CSV

Description

Draw chemical structures from CSV

Usage

drawMolecules(
  csv_in_path = NULL,
  data = NULL,
  atom_color_column = "default",
  bond_color_column = "default",
  molecule_name = TRUE,
  atom_numbers = TRUE
)

Arguments

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.

Examples

## Not run: 
drawMolecules()

## End(Not run)

drops NAs from a vector

Description

drops NAs from a vector

Usage

dropNA(x)

Arguments

x

The vector to drop NAs from


Dunn's post hoc test

Description

Dunn's post hoc test

Usage

dunnTest(data, formula, ...)

Arguments

data

Not yet documented.

formula

Not yet documented.

...

Not yet documented.


Embed amino acid sequences with a protein language model

Description

Embed amino acid sequences with a protein language model

Usage

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"
)

Arguments

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 platform = "local": path to a Python script that embeds the sequences in a FASTA file and writes one row per sequence to a CSV file. Required for that platform.

python_path

For platform = "local": the Python executable to run local_script with.


Embed text with a language model

Description

Embed text with a language model

Usage

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", "")
)

Arguments

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

Description

Extract total ion chromatograms from csv files containing mass spectral data

Usage

extractChromatogramsFromCSVs(
  paths_to_cdf_csvs,
  path_to_existing_chromatograms_csv = NULL
)

Arguments

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

Description

Extract modules around bait genes from an edge list

Usage

extractModules(data, baits, module_size)

Arguments

data

Not yet documented.

baits

Not yet documented.

module_size

Not yet documented.


Extract open reading frames (ORFs) from multifasta files

Description

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...

Usage

extractORFs(
  file_in_path,
  write_out_ORFs = FALSE,
  overwrite = FALSE,
  alternative_ORFs = FALSE
)

Arguments

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.

Value

A data frame containing the accession, start codon position, stop codon position, direction, and length of each ORF.

Examples

## 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

Description

Extract candidate key terms from text columns

Usage

extractTerms(
  dataframe,
  cols,
  min_freq_for_terms,
  min_n_words_per_term,
  return = c("dataframe", "terms")
)

Arguments

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.


fadb_sample

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (fadb_sample.csv).

Usage

fadb_sample

Format

A tibble with 7 rows and 11 columns:

fatty_acid

character

Agonandra_brasiliensis

numeric

Agonandra_silvatica

numeric

Agonandra_excelsa

numeric

Heisteria_silvianii

numeric

Malania_oleifera

numeric

Ximenia_americana

numeric

Ongokea_gore

numeric

Comandra_pallida

numeric

Buckleya_distichophylla

numeric

Nuytsia_floribunda

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/fadb_sample.csv


Convert fastq to fasta

Description

Convert fastq to fasta

Usage

fastqToFasta(file_in_path, file_out_path)

Arguments

file_in_path

The path to the fastq file

file_out_path

The path to the fasta file to write

Examples

## 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)

Description

Run QC on fastx file(s)

Usage

fastxQC(
  paths_to_fastxs,
  type = c("fastq", "fasta"),
  mode = c("fast", "slow"),
  max_n_seqs = NULL,
  progress = FALSE
)

Arguments

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

Description

Interactively find clustering parameters from a distance matrix and source matrix

Usage

findClusterParameters(dist_matrix, matrix, analysis = c("dbscan", "kmeans"))

Arguments

dist_matrix

Not yet documented.

matrix

Not yet documented.

analysis

Not yet documented.


Fit a Gaussian curve to a set of x y data

Description

This function may work better if you feed it a smoothed signal, or add smoothing to the derivatives

Usage

fitGaussians(
  x,
  y,
  peak_detection_threshold = 10,
  peak_means_stdevs_heights = NULL
)

Arguments

x

Not yet documented.

y

Not yet documented.

peak_detection_threshold

Not yet documented.

peak_means_stdevs_heights

Not yet documented.

Examples

## Not run: 
fitGaussians()

## End(Not run)

Games-Howell post hoc test

Description

Games-Howell post hoc test

Usage

gamesHowellTest(data, ..., compare = NULL)

Arguments

data

Not yet documented.

...

Not yet documented.

compare

Not yet documented.


Subset an alignment

Description

Subset an alignment

Usage

gblocks(
  alignment_in_path = NULL,
  max_gap_percent = 0.5,
  min_conservation_percent = 0.3,
  sequence_type = c("DNA", "AA")
)

Arguments

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

Description

Create major and minor axes ticks and labels

Usage

generateQRcodes(share_link)

Arguments

share_link

Share link to Google Sheet with QR code metadata


Generate text with a language model

Description

Generate text with a language model

Usage

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", "")
)

Arguments

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

Description

Create major and minor axes ticks and labels

Usage

generateTicks(
  major_ticks,
  minor_freq = 4,
  major_tick_size = 2,
  minor_tick_size = 1
)

Arguments

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.


Plots pie charts for data at any node using columns trait and value

Description

Plots pie charts for data at any node using columns trait and value

Usage

geom_ancestral_pie(
  data,
  pie_size = 0.1,
  pie_alpha = 1,
  pie_fill_colors = discrete_palette,
  pie_border_size = 0.1,
  ...
)

Arguments

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.


geom_cut

Description

Draw the cut on a dendrogram, in the right place, from the plot's own data.

Usage

geom_cut(height = NULL, k = NULL, linetype = "dashed", colour = "grey40", ...)

Arguments

height

Cut height, the same value passed to parameters = c(height = ...).

k

Number of groups, the same value passed to parameters = c(n_clusters = k) (or the older c(k) / c(k = k)). The line is drawn midway between the two joins that bracket that number of groups.

linetype

Not yet documented.

colour

Not yet documented.

...

Not yet documented.

Details

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.

Examples

## 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

Description

geomSignif

Usage

geomSignif(data, orientation)

Arguments

data

Not yet documented.

orientation

Not yet documented.

Examples

## Not run: 
geomSignif()

## End(Not run)

Get a course dataset by name

Description

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.

Usage

getDataset(name = NULL, refresh = FALSE)

Arguments

name

The dataset's name, as a string (for example "ny_trees"). Leave empty to list every available dataset.

refresh

If TRUE, download the file again even if it is already cached.

Value

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.

Examples

getDataset()
## Not run: 
ny_trees <- getDataset("ny_trees")

## End(Not run)

grubbsFilter on grouped data

Description

grubbsFilter on grouped data

Usage

grubbsFilter(data, col, threshold = 0.05, ...)

Arguments

data

Not yet documented.

col

Not yet documented.

threshold

Not yet documented.

...

Not yet documented.

Examples

## Not run: 
grubbsFilter()

## End(Not run)

Harmonizes species in a set of traits (wide or long) and a tree

Description

Harmonizes species in a set of traits (wide or long) and a tree

Usage

harmonizeTreeTraits(traits, column_w_names_of_tiplabels, tree)

Arguments

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


hawaii_aquifers

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (hawaii_aquifers.csv).

Usage

hawaii_aquifers

Format

A tibble with 954 rows and 6 columns:

aquifer_code

character

well_name

character

longitude

numeric

latitude

numeric

analyte

character

abundance

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/hawaii_aquifers.csv


Align sequences to a Hidden Markov Model (HMM)

Description

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.

Usage

hmmAlign(fasta_in_path, hmm_in_path, domain_name)

Arguments

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.

Value

An AAStringSet object containing the aligned sequences.

Examples

## Not run: 
# Example usage:
# aligned_sequences <- hmmAlign("sequences.fasta", "domains.hmm", "domain_name")
# print(aligned_sequences)

## End(Not run)

hops_components

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (hops_components.csv).

Usage

hops_components

Format

A tibble with 38 rows and 12 columns:

hop_variety

character

hop_origin

character

hop_brewing_usage

character

hop_aroma

character

total_oil

numeric

alpha_acids

numeric

beta_acids

numeric

humulene

numeric

myrcene

numeric

humulone

numeric

caryophyllene

numeric

farnesene

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/hops_components.csv


Phylogenetically independent contrasts for traits

Description

Phylogenetically independent contrasts for traits

Usage

independentContrasts(
  traits,
  column_w_names_of_tiplabels,
  column_w_names_of_traits,
  column_w_values_for_traits,
  tree
)

Arguments

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

Description

Kruskal-Wallis test

Usage

kruskalTest(data, formula, ...)

Arguments

data

Not yet documented.

formula

Not yet documented.

...

Not yet documented.


Levene's test for equal variances

Description

Levene's test for equal variances

Usage

leveneTest(data, ...)

Arguments

data

Not yet documented.

...

Not yet documented.


Fill in missing combinations of a long table

Description

Fill in missing combinations of a long table

Usage

makeRectangular(dataframe, names_from, values_from, values_fill = c(0, NA))

Arguments

dataframe

Not yet documented.

names_from

Not yet documented.

values_from

Not yet documented.

values_fill

Not yet documented.


Merge multiple peaklists into a single data frame

Description

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.

Usage

mergePeakLists(analysis_directory_path)

Arguments

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.

Value

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.

Examples

## Not run: 
# Example usage:
# Merge peak lists from a specified directory
merged_peaks <- mergePeakLists("/path/to/analysis_directory")

## End(Not run)

metabolomics_data

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (metabolomics_data.csv).

Usage

metabolomics_data

Format

A tibble with 93 rows and 126 columns:

patient_number

numeric

patient_status

character

Pyruvate

numeric

MethylSuccinate

numeric

Phosphoglyceric Acid

numeric

Glucose 1-phosphate

numeric

Malonic Acid

numeric

Fumaric Acid

numeric

Alpha-Ketoglutaric Acid

numeric

Sarcosine

numeric

Cadaverine

numeric

5-Aminovaleric Acid

numeric

Pipecolate

numeric

Tyramine

numeric

1-Methylhistidine

numeric

isoValeric Acid

numeric

2-Hydroxyisovaleric Acid

numeric

3-Methyl-2-Oxovaleric Acid

numeric

2-Aminoisobutyric acid

numeric

Creatinine

numeric

Betaine

numeric

Taurine

numeric

1-Methylhistamine

numeric

Pyroglutamic Acid

numeric

Creatine

numeric

4-Hydroxyproline

numeric

Homocysteine

numeric

Cysteamine

numeric

Carnitine

numeric

Glycerate

numeric

N-AcetylGlycine

numeric

Guanidinoacetate

numeric

Benzoic acid

numeric

Citraconic Acid

numeric

Glutaric Acid

numeric

Oxaloacetate

numeric

Anthranilate

numeric

2-Hydroxyglutarate

numeric

2-Aminoadipate

numeric

Homogentisate

numeric

Hydroxyphenylpyruvic acid

numeric

Kynurenate

numeric

Xanthurenate

numeric

Pantothenic acid

numeric

L-Kynurenine

numeric

3-Hydroxykynurenine

numeric

Cytidine

numeric

Uridine

numeric

1-Methyladenosine

numeric

Hypoxanthine

numeric

Oxypurinol

numeric

Xanthine

numeric

Orotate

numeric

Allantoin

numeric

Urate

numeric

Xanthosine

numeric

AMP

numeric

IMP

numeric

ADP

numeric

Adenylosuccinate

numeric

Choline

numeric

Dimethylglycine

numeric

Niacinamide

numeric

Methylmalonate

numeric

Ascorbic Acid

numeric

4-Pyridoxic acid

numeric

Biotin

numeric

Pyridoxal 5'-phosphate

numeric

Trimethylamine

numeric

Trimethylamine N-oxide

numeric

Shikimic Acid

numeric

Hippuric Acid

numeric

4-Hydroxybutyrate

numeric

Acetylcholine

numeric

Deoxycarnitine

numeric

13-HODE

numeric

18-Hydroxyarachidonic acid

numeric

Glycochenodeoxycholate

numeric

Acetylcarnitine

numeric

Azelaic Acid

numeric

Myristic Acid

numeric

Margaric Acid

numeric

Linoleic Acid

numeric

Linolenic Acid

numeric

Mannose

numeric

Sorbitol

numeric

Glyceraldehyde

numeric

Erythrose

numeric

myoinositol

numeric

Fructose

numeric

D-Glucoronic acid

numeric

N-Acetylneuraminic acid

numeric

Lactose

numeric

Sucrose

numeric

Ornithine

numeric

Citrulline

numeric

Propionate

numeric

Oxalic Acid

numeric

Acetoacetate

numeric

Adipic Acid

numeric

Ribose-5-P

numeric

Geranyl-PP

numeric

Glycine

numeric

Alanine

numeric

Serine

numeric

Proline

numeric

Valine

numeric

Threonine

numeric

Leucine

numeric

iso-Leucine

numeric

Asparagine

numeric

Aspartic Acid

numeric

Glutamine

numeric

Lysine

numeric

Glutamic acid

numeric

Methionine

numeric

Histidine

numeric

Phenylalanine

numeric

Arginine

numeric

Tyrosine

numeric

Tryptophan

numeric

Cystine

numeric

lactate

numeric

3-Hydroxybenzoic acid

numeric

Succinate

numeric

Glucose

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/metabolomics_data.csv


metabolomics_hospital

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (metabolomics_hospital.csv).

Usage

metabolomics_hospital

Format

A tibble with 200 rows and 4 columns:

patient_number

numeric

patient_status

character

metabolite

character

concentration

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/metabolomics_hospital.csv


metabolomics_hospital_unknown

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (metabolomics_hospital_unknown.csv).

Usage

metabolomics_hospital_unknown

Format

A tibble with 10 rows and 3 columns:

patient_number

character

metabolite

character

concentration

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/metabolomics_hospital_unknown.csv


metabolomics_unknown

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (metabolomics_unknown.csv).

Usage

metabolomics_unknown

Format

A tibble with 7 rows and 124 columns:

Pyruvate

numeric

MethylSuccinate

numeric

Phosphoglyceric Acid

numeric

Glucose 1-phosphate

numeric

Malonic Acid

numeric

Fumaric Acid

numeric

Alpha-Ketoglutaric Acid

numeric

Sarcosine

numeric

Cadaverine

numeric

5-Aminovaleric Acid

numeric

Pipecolate

numeric

Tyramine

numeric

1-Methylhistidine

numeric

isoValeric Acid

numeric

2-Hydroxyisovaleric Acid

numeric

3-Methyl-2-Oxovaleric Acid

numeric

2-Aminoisobutyric acid

numeric

Creatinine

numeric

Betaine

numeric

Taurine

numeric

1-Methylhistamine

numeric

Pyroglutamic Acid

numeric

Creatine

numeric

4-Hydroxyproline

numeric

Homocysteine

numeric

Cysteamine

numeric

Carnitine

numeric

Glycerate

numeric

N-AcetylGlycine

numeric

Guanidinoacetate

numeric

Benzoic acid

numeric

Citraconic Acid

numeric

Glutaric Acid

numeric

Oxaloacetate

numeric

Anthranilate

numeric

2-Hydroxyglutarate

numeric

2-Aminoadipate

numeric

Homogentisate

numeric

Hydroxyphenylpyruvic acid

numeric

Kynurenate

numeric

Xanthurenate

numeric

Pantothenic acid

numeric

L-Kynurenine

numeric

3-Hydroxykynurenine

numeric

Cytidine

numeric

Uridine

numeric

1-Methyladenosine

numeric

Hypoxanthine

numeric

Oxypurinol

numeric

Xanthine

numeric

Orotate

numeric

Allantoin

numeric

Urate

numeric

Xanthosine

numeric

AMP

numeric

IMP

numeric

ADP

numeric

Adenylosuccinate

numeric

Choline

numeric

Dimethylglycine

numeric

Niacinamide

numeric

Methylmalonate

numeric

Ascorbic Acid

numeric

4-Pyridoxic acid

numeric

Biotin

numeric

Pyridoxal 5'-phosphate

numeric

Trimethylamine

numeric

Trimethylamine N-oxide

numeric

Shikimic Acid

numeric

Hippuric Acid

numeric

4-Hydroxybutyrate

numeric

Acetylcholine

numeric

Deoxycarnitine

numeric

13-HODE

numeric

18-Hydroxyarachidonic acid

numeric

Glycochenodeoxycholate

numeric

Acetylcarnitine

numeric

Azelaic Acid

numeric

Myristic Acid

numeric

Margaric Acid

numeric

Linoleic Acid

numeric

Linolenic Acid

numeric

Mannose

numeric

Sorbitol

numeric

Glyceraldehyde

numeric

Erythrose

numeric

myoinositol

numeric

Fructose

numeric

D-Glucoronic acid

numeric

N-Acetylneuraminic acid

numeric

Lactose

numeric

Sucrose

numeric

Ornithine

numeric

Citrulline

numeric

Propionate

numeric

Oxalic Acid

numeric

Acetoacetate

numeric

Adipic Acid

numeric

Ribose-5-P

numeric

Geranyl-PP

numeric

Glycine

numeric

Alanine

numeric

Serine

numeric

Proline

numeric

Valine

numeric

Threonine

numeric

Leucine

numeric

iso-Leucine

numeric

Asparagine

numeric

Aspartic Acid

numeric

Glutamine

numeric

Lysine

numeric

Glutamic acid

numeric

Methionine

numeric

Histidine

numeric

Phenylalanine

numeric

Arginine

numeric

Tyrosine

numeric

Tryptophan

numeric

Cystine

numeric

lactate

numeric

3-Hydroxybenzoic acid

numeric

Succinate

numeric

Glucose

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/metabolomics_unknown.csv


meteorite_fragments

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (meteorite_fragments.csv).

Usage

meteorite_fragments

Format

A tibble with 37 rows and 6 columns:

fragment

character

find_site

character

iron_percent

numeric

density_g_per_cm3

numeric

nickel_percent

numeric

silica_percent

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/meteorite_fragments.csv


mode

Description

mode

Usage

mode(x, ignore_zero = FALSE)

Arguments

x

Not yet documented.

ignore_zero

Not yet documented.

Examples

## Not run: 
mode()

## End(Not run)

Compute a moving average

Description

movingAverage

Usage

movingAverage(x, n = 5)

Arguments

x

Not yet documented.

n

Not yet documented.


Normalizes a vector of numbers to a range of zero to one.

Description

Normalizes a vector of numbers to a range of zero to one.

Usage

normalize(
  x,
  old_min = NULL,
  old_max = NULL,
  new_min = 0,
  new_max = 1,
  na_zero = FALSE
)

Arguments

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

Description

Test whether every element can be read as a number

Usage

numbersOnly(x)

Arguments

x

Not yet documented.


Open an RScript stored on Google Drive

Description

Open an RScript stored on Google Drive

Usage

openRGD(drive_share_link)

Arguments

drive_share_link

Not yet documented.


OS-aware correction of directory paths

Description

OS-aware correction of directory paths

Usage

OsDirectoryPathCorrect(directory_path)

Arguments

directory_path

The path to correct


OS-aware correction of paths

Description

OS-aware correction of paths

Usage

OsPathCorrect(path)

Arguments

path

The path to correct


Pairwise t-tests

Description

Pairwise t-tests

Usage

pairwiseTTest(data, ..., p.adjust.method = "holm", pool.sd = FALSE)

Arguments

data

Not yet documented.

...

Not yet documented.

p.adjust.method

Not yet documented.

pool.sd

Not yet documented.


Pairwise Wilcoxon tests

Description

Pairwise Wilcoxon tests

Usage

pairwiseWilcoxTest(data, ..., p.adjust.method = "holm")

Arguments

data

Not yet documented.

...

Not yet documented.

p.adjust.method

Not yet documented.


Parse an RIS reference file into a table

Description

Parse an RIS reference file into a table

Usage

parseRISFile(filepath)

Arguments

filepath

Not yet documented.


passenger_flows

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (passenger_flows.csv).

Usage

passenger_flows

Format

A tibble with 192 rows and 3 columns:

origin

character

destination

character

passengers

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/passenger_flows.csv


Interactive PCA visualizer

Description

Interactive PCA visualizer

Usage

pcaVisualizer(
  data,
  columns_w_sample_ID_info = NULL,
  columns_w_values_for_single_analyte = NULL
)

Arguments

data

Not yet documented.

columns_w_sample_ID_info

Not yet documented.

columns_w_values_for_single_analyte

Not yet documented.


periodic_table

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (per_table.csv).

Usage

periodic_table

Format

A tibble with 118 rows and 41 columns:

atomic_number

numeric

element_name

character

atomic_symbol

character

group_number

character

period

numeric

atomic_mass_rounded

numeric

melting_point_C

numeric

boiling_point_C

numeric

state_at_RT

character

density_g_per_mL

numeric

electronegativity_pauling

numeric

first_ionization_poten_eV

numeric

second_ionization_poten_eV

numeric

third_ionization_poten_eV

numeric

electron_affinity_eV

numeric

atomic_radius_ang

numeric

ionic_radius_ang

numeric

covalent_radius_ang

numeric

atomic_volume_cm3_per_mol

numeric

crystal_structure

character

electrical_conductivity_mho_per_cm

numeric

specific_heat_J_per_g_K

numeric

heat_of_fusion_kJ_per_mol

numeric

heat_of_vaporization_kJ_per_mol

numeric

thermal_conductivity_W_per_m_K

numeric

mg_per_kg_in_Earths_crust

numeric

mg_per_L_in_seawater

numeric

percent_human_body_mass

numeric

Notes

character

color

character

structure

character

hardness_mohs

numeric

hydride

character

oxide

character

chloride

character

polarizability_A_cubed

numeric

heat_atomization_kJ_per_mol

numeric

year_discovered

numeric

rel_abund_solar_system_log

numeric

abundance_earths_crust_log

numeric

cost_pure_dollar_per_100g

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/per_table.csv


periodic_table_subset

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (per_table_small.csv).

Usage

periodic_table_subset

Format

A tibble with 56 rows and 25 columns:

atomic_number

numeric

atomic_symbol

character

group_number

numeric

period

numeric

atomic_mass_rounded

numeric

melting_point_C

numeric

boiling_point_C

numeric

state_at_RT

character

density_g_per_mL

numeric

electronegativity_pauling

numeric

first_ionization_poten_eV

numeric

second_ionization_poten_eV

numeric

third_ionization_poten_eV

numeric

electron_affinity_eV

numeric

atomic_radius_ang

numeric

ionic_radius_ang

numeric

covalent_radius_ang

numeric

atomic_volume_cm3_per_mol

numeric

electrical_conductivity_mho_per_cm

numeric

specific_heat_J_per_g_K

numeric

heat_of_fusion_kJ_per_mol

numeric

heat_of_vaporization_kJ_per_mol

numeric

thermal_conductivity_W_per_m_K

numeric

polarizability_A_cubed

numeric

heat_atomization_kJ_per_mol

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/per_table_small.csv


Permutational multivariate analysis of variance

Description

Permutational multivariate analysis of variance

Usage

permanovaTest(
  data,
  formula,
  distance = "euclidean",
  permutations = 999,
  profile = NULL,
  sample = NULL
)

Arguments

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

Description

Determine which samples are identical based on p values

Usage

pGroups(data)

Arguments

data

Not yet documented.


Phred+33 quality score lookup table

Description

Phred+33 quality score lookup table

Usage

phred33_lookup

Format

A data frame mapping Phred+33 characters to quality scores.


Compute phylogenetic signal for continuous and discrete traits

Description

Compute phylogenetic signal for continuous and discrete traits

Usage

phylogeneticSignal(
  traits,
  column_w_names_of_tiplabels,
  column_w_names_of_traits,
  column_w_values_for_traits,
  tree,
  replicates = 999,
  cost = NULL
)

Arguments

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

Description

Compare phylogenetic and trait distances

Usage

phyloTraitDistance(
  traits,
  column_w_names_of_tiplabels,
  column_w_values_for_traits,
  tree,
  mode = c("presence_absence", "quantitative")
)

Arguments

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

Description

Pick a free port for a Shiny app on the lab JupyterHub

Usage

pick_shiny_port()

Get coordinates for a 3D scatter plot

Description

Get coordinates for a 3D scatter plot

Usage

points3D(
  data,
  angle,
  tick_round,
  x_tick_interval,
  y_tick_interval,
  z_tick_interval
)

Arguments

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

Examples

## Not run: 
points3D()

## End(Not run)

BLAST search local sequence collections

Description

Search locally stored sequence collections for query sequences. Download Blast+ here: https://www.ncbi.nlm.nih.gov/books/NBK279671/

Usage

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
)

Arguments

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

Details

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.

Value

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.

Examples

## 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)

Predict PFAM domains from sequences in a FASTA file using HMMER

Description

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.

Usage

predictDomains(
  fasta_in_path,
  domain_library_in_path = "/project_data/shared/general_lab_resources/hmmer/Pfam-A.hmm"
)

Arguments

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".

Details

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.

Value

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.

Examples

## 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()

Description

Predict new values with a model from buildModel()

Usage

predictWithModel(data, model, model_type = NULL, id_cols = NULL)

Arguments

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

Description

Prune a tree so it only contains user-specified tips

Usage

pruneTree(tree_in, tips_to_keep)

Arguments

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

Description

Create a question

Usage

question(question, distractors, correct, no, fb = "", print_question = TRUE)

Arguments

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

Description

Build a questionnaire from a table of questions

Usage

questionnaire(x, shuffle = TRUE, print_question = TRUE)

Arguments

x

Not yet documented.

shuffle

Not yet documented.

print_question

Not yet documented.


Reads an alignment into a tidy dataframe

Description

Reads an alignment into a tidy dataframe

Usage

readAlignment(alignment_in_path, type = c("DNA", "AA"))

Arguments

alignment_in_path

The path to the alignment

type

Not yet documented.


Import chromatograms stored as ChemStation exported .csv files

Description

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.

Usage

readChromatograms(
  dir,
  normalize_level = c("none", "var1", "var2"),
  normalize_range = NULL
)

Arguments

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

Examples

## Not run: 
readChromatograms()

## End(Not run)

Interactive selection of a CSV file to read

Description

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.

Usage

readCSV(sep = c(",", " "))

Arguments

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.

Value

A data frame containing the contents of the selected CSV file.

Examples

## 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.

Description

Returns contents of one fasta file as a StringSet object.

Usage

readFasta(fasta_in_path, fasta_type = "nonspecific")

Arguments

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"


readGFFs

Description

Read multiple genome feature files into a tidy dataframe

Usage

readGFFs(
  input_frame,
  subset_mode = c("none", "goi_only", "goi_region", "name_check"),
  goi = NULL,
  concatenate_by_species = TRUE,
  chromosomes_only = FALSE,
  omit = NULL
)

Arguments

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

Details

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.

Value

A tidy dataframe containing the processed GFF data

Examples

## 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.

Description

Returns the contents of many fasta files as a StringSet object.

Usage

readManyFastas(fasta_in_paths, fasta_type = "nonspecific")

Arguments

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"


Read a monolist from a CSV file or URL

Description

This function reads a monolist from a specified path or URL. The monolist should be in CSV format.

Usage

readMonolist(monolist_in_path)

Arguments

monolist_in_path

A string specifying the path or URL to the monolist CSV file.

Value

A data frame containing the contents of the monolist.

Examples

## 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

Description

Read the text of a PDF file

Usage

readPDF(path_to_pdf)

Arguments

path_to_pdf

Not yet documented.


Reads a polylist

Description

Reads a spreadsheet in polylist format (wide format, multiple column and row headers), and converts it into tidy format

Usage

readPolylist(
  polylist_in_path,
  centroid = "~~~",
  table_value_unit = "abundance"
)

Arguments

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


Import mass spectral data

Description

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

Usage

readSpectra(dir, source = c("phylochemistry", "agilent"))

Arguments

dir

The directory containing the mass spectral (.csv) files of interest and nothing else

source

Not yet documented.

Examples

## Not run: 
readSpectra()

## End(Not run)

Reads a phylogenetic tree

Description

Reads a phylogenetic tree

Usage

readTree(tree_in_path)

Arguments

tree_in_path

The path to the phylogenetic tree


Replace special characters in text

Description

Replace special characters in text

Usage

removeSpecialCharacters(text_string)

Arguments

text_string

Not yet documented.


Rename (move) a file, creating the destination folder if needed

Description

Rename (move) a file, creating the destination folder if needed

Usage

renameFile(from, to)

Arguments

from

Not yet documented.

to

Not yet documented.


Reverse translate a protein sequence to its corresponding nucleotide sequence

Description

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.

Usage

reverseTranslate(
  fasta_in_path,
  fasta_out_path,
  organism = c("Arabidopsis_thaliana", "Zea_mays", "Nicotiana_tabacum",
    "Saccharomyces_cerevisiae")
)

Arguments

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".

Details

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.

Value

This function does not return a value. It writes the reverse-translated nucleotide sequences to the specified output fasta file.

Examples

## 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)

rice_proteins

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (rice_proteins.csv).

Usage

rice_proteins

Format

A tibble with 57 rows and 3 columns:

ID_number

character

Protein_name

character

Protein_function

character

Source

https://thebustalab.github.io/phylochemistry/sample_data/rice_proteins.csv


rotates a set of x,y coordinates

Description

rotates a set of x,y coordinates

Usage

rotate_coord(x, y, angle, center = c(0, 0))

Arguments

x

The x values

y

The y values

angle

The angle to rotate (in degrees)

center

The center of rotation (default = 0,0)


RETIRED. Use runMatrixAnalysis() (singular) instead.

Description

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.

Usage

runMatrixAnalyses(...)

Arguments

...

Ignored; the function always stops.


Runs a matrix analysis (clustering, kmeans, pca, distances).

Description

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.

Usage

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"),
  ...
)

Arguments

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 dist object, "long" gives one row per pair (sample_1, sample_2, distance) plus the sample ID columns, which is the shape an edge list wants.

...

Not yet documented.


Run phylogenetic comparative analyses on traits

Description

Run phylogenetic comparative analyses on traits

Usage

runPhylogeneticAnalyses(
  traits,
  column_w_names_of_tiplabels,
  column_w_names_of_traits,
  column_w_values_for_traits,
  tree,
  replicates = 999,
  cost = NULL
)

Arguments

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

Description

Search text for a set of query terms

Usage

searchField(subject_list, query_list)

Arguments

subject_list

Not yet documented.

query_list

Not yet documented.


Search NCBI for protein (or nucleotide) records and return their sequences

Description

Search NCBI for protein (or nucleotide) records and return their sequences

Usage

searchNCBI(search_term, retmax = 5, type = "protein")

Arguments

search_term

The term to search for in the NCBI database.

retmax

The maximum number of results to return. Default is 5.

type

"protein" (the default) or "nucleotide".

Value

An AAStringSet (protein) or DNAStringSet (nucleotide), or NULL if nothing matched.


Search PubMed and return article metadata

Description

Search PubMed and return article metadata

Usage

searchPubMed(
  search_terms,
  pubmed_api_key,
  sort = c("date", "relevance"),
  retmax_per_term = 20
)

Arguments

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

Description

Shapiro-Wilk normality test by group

Usage

shapiroTest(data, var)

Arguments

data

Not yet documented.

var

Not yet documented.


solvents

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (solvents.csv).

Usage

solvents

Format

A tibble with 32 rows and 14 columns:

solvent

character

formula

character

boiling_point

numeric

melting_point

numeric

density

numeric

miscible_with_water

logical

solubility_in_water

numeric

relative_polarity

numeric

vapor_pressure

numeric

CAS_number

character

formula_weight

numeric

refractive_index

numeric

specific_gravity

numeric

category

character

Source

https://thebustalab.github.io/phylochemistry/sample_data/solvents.csv


Split text into overlapping chunks of tokens

Description

Split text into overlapping chunks of tokens

Usage

splitIntoChunks(
  data_frame,
  column_to_split,
  source_ID_column,
  chunk_size_in_tokens,
  overlap_in_tokens
)

Arguments

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.


The ggproto Stat behind geom_cut()

Description

Places the cut line on a dendrogram from the plot's own x data; used by geom_cut().

Usage

StatCut

Format

A ggplot2 ggproto object.


tequila_chemistry

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (tequila_chemistry.csv).

Usage

tequila_chemistry

Format

A tibble with 4720 rows and 6 columns:

class

character

compound

character

bottle

character

replicate

numeric

value

numeric

average

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/tequila_chemistry.csv


t-tests on data or on a fitted model

Description

t-tests on data or on a fitted model

Usage

tTest(data, ..., compare = NULL, slopes_of = NULL, p.adjust.method = "holm")

Arguments

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

Description

Tukey's honest significant difference test

Usage

tukeyTest(data, ..., compare = NULL, slopes_of = NULL)

Arguments

data

Not yet documented.

...

Not yet documented.

compare

Not yet documented.

slopes_of

Not yet documented.


unknown_mushroom

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (unknown_mushroom.csv).

Usage

unknown_mushroom

Format

A tibble with 1 rows and 11 columns:

cap_diameter

numeric

cap_shape

character

cap_color

character

does_bruise_or_bleed

logical

gill_color

character

stem_height

numeric

stem_width

numeric

stem_color

character

has_ring

logical

habitat

character

season

character

Source

https://thebustalab.github.io/phylochemistry/sample_data/unknown_mushroom.csv


unknown_smoke

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (unknown_smoke.csv).

Usage

unknown_smoke

Format

A tibble with 254 rows and 5 columns:

wood_type

character

species

character

abundance_mg_g

numeric

compound_class

character

compound

character

Source

https://thebustalab.github.io/phylochemistry/sample_data/unknown_smoke.csv


us_airports

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (us_airports.csv).

Usage

us_airports

Format

A tibble with 29 rows and 7 columns:

airport

character

name

character

city

character

state

character

region

character

latitude

numeric

longitude

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/us_airports.csv


Get coordinates for quantitative Venn Diagram

Description

Get coordinates for quantitative Venn Diagram

Usage

vennAnalysis(data)

Arguments

data

Data frame of TRUE FALSE for whether each observation belongs to each category

Examples

## Not run: 
vennAnalysis()

## End(Not run)

Wilcoxon rank-sum test

Description

Wilcoxon rank-sum test

Usage

wilcoxTest(data, ...)

Arguments

data

Not yet documented.

...

Not yet documented.


wine_grape_data

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (wine_grape_data.csv).

Usage

wine_grape_data

Format

A tibble with 1070 rows and 5 columns:

cultivar

character

treatment

character

chromatography

character

metabolite

character

log_abundance

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/wine_grape_data.csv


wine_quality

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (wine_quality.csv).

Usage

wine_quality

Format

A tibble with 6497 rows and 14 columns:

type

character

quality_score

numeric

quality_category

character

fixed_acidity

numeric

volatile_acidity

numeric

citric_acid

numeric

residual_sugar

numeric

chlorides

numeric

free_sulfur_dioxide

numeric

total_sulfur_dioxide

numeric

density

numeric

pH

numeric

sulphates

numeric

alcohol

numeric

Source

https://thebustalab.github.io/phylochemistry/sample_data/wine_quality.csv


wood_smoke

Description

Teaching dataset from the Integrated Bioanalytical Chemistry course (wood_smoke_data.csv).

Usage

wood_smoke

Format

A tibble with 1524 rows and 5 columns:

wood_type

character

species

character

abundance_mg_g

numeric

compound_class

character

compound

character

Source

https://thebustalab.github.io/phylochemistry/sample_data/wood_smoke_data.csv


Write Alignment DataFrame to FASTA File

Description

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.

Usage

writeAlignment(alignment, alignment_out_path, type = "auto")

Arguments

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".

Value

None. The function writes the alignment to a specified FASTA file.

Examples

## 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)

Write a monolist to a CSV file

Description

This function allows the user to interactively select a location to save a monolist as a CSV file.

Usage

writeCSV(monolist)

Arguments

monolist

A data frame representing the monolist to be written to a CSV file.

Value

None. The function writes the monolist to a file and does not return a value.

Examples

## 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

Description

Writes one or more sequences as a single fasta file

Usage

writeFasta(
  XStringSet,
  fasta_out_path,
  append = FALSE,
  fasta_type = c("DNA", "AA")
)

Arguments

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

Description

Writes one or more sequences as individual fasta file(s), each with one sequence

Usage

writeManyFastas(XStringSet, fasta_out_directory_path)

Arguments

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

Description

Writes a monolist

Usage

writeMonolist(monolist, monolist_out_path, ...)

Arguments

monolist

The monolist to write out

monolist_out_path

The path to where the monolist should be written

...

Not yet documented.


Writes a polylist

Description

This function allows the user to interactively select a location to save a polylist as a CSV file.

Usage

writePolylist(polylist, polylist_out_path)

Arguments

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

Description

Writes a human-readable supplemental table of quantitative data

Usage

writeSupplementalTable(
  supplementalTable,
  round_level,
  file_out_path,
  replicates
)

Arguments

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

Description

Writes a phylogenetic tree

Usage

writeTree(tree, tree_out_path)

Arguments

tree

Not yet documented.

tree_out_path

The path to where the tree should be written