plot_frequency {decontam} | R Documentation |
Plot frequencies as a function of input DNA concentration
Description
Plots the frequencies of selected sequence features vs. each sample's DNA concentration.
Usage
plot_frequency(seqtab, taxa, conc, neg = NULL, normalize = TRUE,
showModels = TRUE, log = TRUE, facet = TRUE)
Arguments
seqtab |
(Required). Integer matrix or phyloseq object.
A feature table recording the observed abundances of each sequence feature (e.g. OTUs or ASVs or
or genus or ortholog or...) in each sample.
Rows should correspond to samples, and columns to sequences (or OTUs).
If a phyloseq object is provided, the otu-table component will be extracted.
|
taxa |
(Required). character .
The names of the sequence features to include in this plot. Should match colnames(setab)
if a matrix was provided, or taxa_names(seqtab) if a phyloseq object was provided.
|
conc |
(Required). numeric .
A quantitative measure of the concentration of amplified DNA in each sample prior to sequencing.
All values must be greater than zero. Zero is assumed to represent the complete absence of DNA.
If seqtab was provided as a phyloseq object, the name of the sample variable in the
phyloseq object can be provided.
|
neg |
(Optional). logical . Default NULL.
TRUE if sample is a negative control, and FALSE if not.
If seqtab was provided as a phyloseq object, the name of the appropriate sample-variable in that
phyloseq object can be provided. NULL indicates no samples should be condired negative controls.
|
normalize |
(Optional). logical . Default TRUE.
If TRUE, the input seqtab is normalized so that each row sums to 1 (converted to frequency).
If FALSE, no normalization is performed (the data should already be frequencies or counts from
equal-depth samples).
|
showModels |
(Optional). logical . Default TRUE.
If TRUE, the contaminant (red, dashed line) and non-contaminant (black, solid line) models are
shown in the plot.
|
log |
(Optional). logical . Default TRUE.
If TRUE, the axes are log10-scaled.
|
facet |
(Optional). logical . Default TRUE.
If TRUE, multiple sequence features will be plotted in separate facets.
|
Value
A ggplot2
object.
Will be rendered to default device if printed
,
or can be stored and further modified.
See ggsave
for additional options.
Examples
# MUC is a phyloseq object, MUC.conc is the vector of sample concentrations
MUC <- readRDS(system.file("extdata", "MUClite.rds", package="decontam"))
MUC.conc <- readRDS(system.file("extdata", "MUCconc.rds", package="decontam"))
plot_frequency(MUC, "Seq1", conc=MUC.conc)
# The concentration can also be reference directly as the quant_reading sample variable in MUC
plot_frequency(MUC, "Seq1", conc="quant_reading")
plot_frequency(MUC, c("Seq1", "Seq10", "Seq33"), conc="quant_reading", log=FALSE)
[Package
decontam version 1.0.0
Index]