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".
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.
See also
Other sample-modifiers:
add_alpha()
,
add_alphas()
,
add_metadata()
,
add_ord()
,
add_sample_clustered()
,
add_total_absolute_abundance()
,
add_total_count()
,
add_total_density()
,
cluster_samples()
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")