Skip to contents

add_spike_ratio() calculates the ratio of non-spike to spike reads for each sample and adds this to the sample table under the name "spike_ratio".

Usage

add_spike_ratio(ta, spike_taxon)

Arguments

ta

A tidytacos object.

spike_taxon

The taxon_id of the spike.

Value

A tidytacos object with the spike ratio added to the sample table.

Details

This function is useful if a DNA spike was added prior to sequencing and is based on the method described by Smets et al., 2016.

Without calculating absolute abundances, the spike ratio allows to compare absolute abundances between sample. For example, if the spike ration of one sample is twice that of another, then the absolute number of sequenced strands at the time of spiking in the one sample is twice that of the other sample.

Examples

# Initiate counts matrix
x <- matrix(
  c(1500, 1300, 280, 356),
  ncol = 2
)
rownames(x) <- c("taxon1", "taxon2")
colnames(x) <- c("sample1", "sample2")

# Convert to tidytacos object
data <- create_tidytacos(x,
  taxa_are_columns = FALSE
)

# Add total abundance
data <- data %>%
  add_spike_ratio(spike_taxon = "t1")