grad_mplot {JMDplots}R Documentation

Plotting functions for chemical composition of metagenomes

Description

These are plotting functions for the redox gradients (gradox) and salinity gradients (gradH2O) papers. The functions are exported in the package so they are available to user scripts.

Usage

  mplot(study, seqtype, plottype = "bars", ylim = NULL, plot.RNA = TRUE,
    taxid = NULL, dsDNA = TRUE, abbrev = NULL, col = NULL, add.label = TRUE,
    maxdepth = NULL, H2O = FALSE, plot.it = TRUE, add.title = TRUE, yline = 2,
    datadir = NULL, mdata = studies, add = FALSE,
    pch = 19, var = NULL, srt = 45, ilabel = NULL)
  mpage(subset = "gradoxSI", H2O = FALSE, plottype = "bars", dsDNA = TRUE,
    set.par = TRUE, add.label = TRUE, mfrow = NULL)
  ppage(subset = "gradoxSI", H2O = FALSE, set.par = TRUE, plot.it = TRUE,
    add.label = TRUE, mfrow = NULL)
  mcomp(mout, yvar = "RNA")
  pcomp(mout, pout, seqtype = "MG", vars = NULL, parts = c("plot", "legend"),
    yline = 2, xlim = NULL, ylim = NULL, reorder = TRUE,
    plot.techtype = FALSE, add = FALSE, pch = NULL, lty = 2,
    labels.at = "max", cex.ylab = 1, font = 1, labdx = NULL, labdy = NULL)

Arguments

study

character, name of study

seqtype

character, description of sequence data type

plottype

character, type of plot

ylim

numeric, y-axis limits

plot.RNA

logical, plot RNA compositions?

taxid

numeric, select only this taxid

dsDNA

logical, use chemical composition of double-stranded DNA?

abbrev

character, abbreviations for studies

col

character, line color

add.label

logical, label the plot with MG (metagenome) or MT (metatranscriptome)?

maxdepth

numeric, maximum sample depth (meters)

H2O

logical, plot nH2O instead of ZC?

plot.it

logical, make a plot (use FALSE to return processed data without plotting)?

add.title

logical, add a title to the plot?

yline

numeric, margin position for y-axis label

var

character, other variable to plot (‘⁠GRAVY⁠’ or ‘⁠pI⁠’)

srt

numeric, string rotation for non-numeric labels

ilabel

numeric, which labels to include on plot

subset

character, name of subset of studies to plot

set.par

logical, set up plot with par commands?

mfrow

numeric, optional setting for par(mfrow)

mout

list, output from mpage or ppage

yvar

character, y-axis variable (‘⁠RNA⁠’ or ‘⁠GC⁠’)

pout

list, output from ppage

vars

character, variables to plot (‘⁠ZC⁠’, ‘⁠H2O-ZC⁠’, ‘⁠GRAVY⁠’, ‘⁠pI⁠’, or ‘⁠pIG⁠’)

parts

character, parts of figure to include

xlim

numeric, x-axis limits

reorder

logical, put points in order of increasing x value?

plot.techtype

logical, identify 454 or Sanger datasets by open symbols?

add

logical, add to existing plot?

datadir

character, location of data directory (default is from package)

mdata

list, metadata for studies (default is from package)

pch

numeric, plot symbol (default is determined from sample type)

lty

numeric, line type

labels.at

character, plot study labels at ‘⁠max⁠’ or ‘⁠min⁠’ values (use NA to omit labels)

cex.ylab

numeric, size of y-axis label

font

integer, font to use for study labels (see par)

labdx

numeric, x-adjustment for label position

labdy

numeric, y-adjustment for label position

Details

The study is composed of two names for the locality separated by an underscore. For mplot, the seqtype contains the name of the database followed by an underscore and MG (metagenome) or MT (metatranscriptome), i.e. ‘⁠[SRA|IMG|MGRAST|GenBank]_[MG|MT]⁠’. These can be changed to ‘⁠_MGP⁠’ and ‘⁠_MTP⁠’ to indicate protein sequences.

mplot plots a compositional variable for a particular combination of study and seqtype. The variable plotted is ZC by default, but this can be changed to nH2O with H2O = TRUE or GRAVY or pI (specified in the var argument). ZC of both DNA and RNA are plotted, with an offset of -0.28 applied to that of RNA, so that values can be shown on the same scale (see Dick et al., 2019). The default value of plottype, ‘⁠bars⁠’, specifies a plot with mean values connected by dashed lines and error bars for each sample. A polygon plot (shaded area instead of error bars) is made if the first character of plottype is ‘⁠#⁠’. In this case, plottype is interpreted as the fill color for the polygon.

mcomp makes a scatterplot of (ZC of RNA - ZC of DNA) vs ZC of DNA. Set yvar to ‘⁠GC⁠’ to change the y-axis to GC ratio of DNA. (For double-stranded DNA, this should be a linear function of ZC.)

For pcomp, seqtype is just ‘⁠MG⁠’ or ‘⁠MT⁠’. The variables (vars) are automatically determined based on the values of mout and pout. Use vars = "GRAVY" or vars = "pI" to plot the values of GRAVY or pI instead of Zc. Use vars = "pIG" to make a GRAVY-pI plot.

datadir and mdata are used to specify alternate location of compositional data and metadata for metagenomic studies. This permits the processing of user-provided data sets; see subsurface for some examples.

References

Dick JM, Yu M, Tan J and Lu A (2019) Changes in carbon oxidation state of metagenomes along geochemical redox gradients. Front. Microbiol. 10, 120. doi:10.3389/fmicb.2019.00120

Examples

# plot ZC of DNA and RNA
mplot("Bison_Pool", "IMG_MG")
# plot ZC of protein
mplot("Bison_Pool", "IMG_MGP")

# make a page of plots of ZC of DNA and RNA
mout <- mpage()
# compare ZC of RNA and DNA for these datasets
mcomp(mout)
# compare GC and ZC of DNA for these datasets
mcomp(mout, yvar = "GC")

# make a page of plots of ZC of proteins
pout <- ppage()
# plot ZC of DNA vs proteins for the metagenomes
pcomp(mout, pout)
# plot ZC of DNA vs proteins for the metatranscriptomes
pcomp(mout, pout, "MT")

## TODO: plot nH2O of DNA vs proteins
#mout <- mpage(H2O = TRUE)
#pout <- ppage(H2O = TRUE)
#pcomp(mout, pout)

# plot nH2O vs ZC of proteins in a few redox gradients
mout <- ppage("gradoxGS")
pout <- ppage("gradoxGS", H2O = TRUE)
pcomp(mout, pout, reorder = FALSE, yline = 2)
# overlay data for protein from the Baltic Sea
mout <- ppage("balticsurface", plot.it = FALSE)
pout <- ppage("balticsurface", H2O = TRUE, plot.it = FALSE)
pcomp(mout, pout, reorder = FALSE, add = TRUE)

# plot nH2O vs GRAVY of proteins
pcomp(mout, pout, vars = "GRAVY")

[Package JMDplots version 1.2.19-14 Index]