Learn R Programming

patPRO (version 1.1.0)

plotNormalizedAlphaDiv: Plot Normalized Alpha Diversity.

Description

Plot the normalized alpha diversity data, over time, of the desired patient or patient group means. The patient patient.mean function must be used to calculate and format the normalized data for this plotting function. If only a single patient plot is desired, please use the patient mean function with only a single patient. This subroutine takes in the data frame output from normalize.alpha.div.

Usage

plotNormalizedAlphaDiv(input.df, alpha.div.metrics, tmpt.id.col="Time_point", y.lab="Normalized Alpha Diversity Value", x.lab="Time Point", plot.title, color.brewer.set="", color.manual.set="", mean.mark=FALSE, legend.text.size = 7)

Arguments

input.df
The data.frame output from the diversity normalization subroutine normalize.alpha.div containing the alpha diversity information for the dataset. This will be the data frame used for plotting.
alpha.div.metrics
The name(s) of the alpha diversity metrics to be plotted.
tmpt.id.col
Name of the time point column found in alpha.div.input. Default is "Time_point".
y.lab
Name of the y axis label to be used in the plot. Default is "Normalized Alpha Diversity Value".
x.lab
Name of the x axis label to be used in the plot. Default is "Time Point".
plot.title
The desired plot title.
color.brewer.set
Name of the color brewer palet to use for plot coloring. Default value uses default colors.
color.manual.set
Name of the manually specified color palet to use for plot coloring. Default value uses default colors.
mean.mark
Allows the user to define whether this is used to plot mean values (including standard error; set to TRUE) or if this is for a single subject. Default is FALSE.
legend.text.size
Allows the user to manually set the figure legend text size digit. Default is size 7.

Details

Package:
patPRO
Type:
Package
Version:
1.0.0
Date:
2015-09-18
License:
GPLv3
An overview of how to use the package, including the most important functions, is included in the supplemental R notebook patPROExampleWorkflow.html.

References

patPRO: An R package for the visualization of longitudinal microbiome data. Hannigan GD, Loesche MA, Hodkinson BP, Mehta S, Grice EA.

Examples

Run this code
# Plot individual patient
data("PatProAlphaDiv",package="patPRO")
data("PatProMap",package="patPRO")
mergedMapAlpha <- mergeMapMetaData(map.file=PatProMap, 
	merging.file=PatProAlphaDiv, 
	map.sub.id="SubjectID", 
	map.tmpt="Time_point", 
	map.smpl.id="SampleID", 
	sample.id.col="SampleID")
testNormAlphaDiv <- normalizeAlphaDiv(mergedMapAlpha, c("chao1","shannon"), 1)
alphaDivPlot <- plotNormalizedAlphaDiv(testNormAlphaDiv, 
	c("chao1","shannon"), 
	plot.title="Subject One Diversity", 
	color.brewer.set="Set2", 
	legend.text.size = 12)
# Plot patient average
data("PatProAlphaDiv",package="patPRO")
data("PatProMap",package="patPRO")
mergedMapAlpha <- mergeMapMetaData(map.file=PatProMap, 
  merging.file=PatProAlphaDiv, 
  map.sub.id="SubjectID", 
  map.tmpt="Time_point", 
  map.smpl.id="SampleID", 
  sample.id.col="SampleID")
testNormAlphaDivForMean <- normalizeAlphaDiv(mergedMapAlpha, c("chao1","shannon"), 1:5)
AlphaDivMean <- patientMean(x=testNormAlphaDivForMean, 
  sub.range=c(1:5), 
  metric.col="variable", 
  abundance.val="value")
alphaDivPlotMean <- plotNormalizedAlphaDiv(AlphaDivMean, 
	c("chao1","shannon"), 
	plot.title="Mean Diversity For Subjects 1-5", 
	color.brewer.set="Set2", 
	mean.mark=TRUE, 
	legend.text.size = 12)

Run the code above in your browser using DataLab