| RestrictedPCA {MetabolomicsBasics} | R Documentation | 
RestrictedPCA.
Description
RestrictedPCA combines an ANOVA based on 'fmod' and
restricts a PCA using the ANOVA result as a filter.
Usage
RestrictedPCA(
  dat = NULL,
  sam = NULL,
  use.sam = NULL,
  group.col = NULL,
  text.col = NULL,
  fmod = NULL,
  sign.col = NULL,
  p.adjust.method = "none",
  P = 0.01,
  pcaMethods.scale = "pareto",
  n.metab.min = 20,
  ...
)
Arguments
| dat | Metabolite matrix (samples x metabolites). | 
| sam | Sample definition dataframe. | 
| use.sam | Numeric index vector (or logical) to select specific samples to be included in the analysis or NULL to include all. | 
| group.col | Column used for legend creation (column name from sam). | 
| text.col | Column used for text annotation of data points (column name from sam). | 
| fmod | ANOVA model to calculate before PCA. | 
| sign.col | Which column(s) of the ANOVA result shall be used for P-value filtering (specify column names or leave on NULL to filter on all). | 
| p.adjust.method | Method use to adjust P-values (e.g. none, BH or bonferroni). | 
| P | P-value threshold used as a cutoff after P-value adjustment. | 
| pcaMethods.scale | pcaMethods scale parameter (usually pareto for metabolite data). | 
| n.metab.min | Minimum number of metabolites kept for PCA calculation (even if they exceed P). | 
| ... | Handed through to  | 
Details
‘fmod' should be something like ’GT*TR+Batch' to perform an ANOVA with these factors defined as columns in sam.
Value
Will generate a PCA plot (generated by PlotMetabolitePCA internally) restricted based on an ANOVA result based on MetaboliteANOVA.
Examples
# load raw data and sample description
raw <- MetabolomicsBasics::raw
sam <- MetabolomicsBasics::sam
# standard behavior
RestrictedPCA(dat = raw, sam = sam, group.col = "GT")
## Not run: 
# apply multiple testing using a strict P-value cutoff,
# dont show a legend but plot group mean values and sd's as overlay
RestrictedPCA(
  dat = raw, sam = sam, group.col = "GT", p.adjust.method = "BH", P = 10^-10,
  fmod = "GT+Batch+Order", sign.col = "GT", medsd = T, legend.x = NULL
)
# limit to a subset of samples, switching the ANOVA selection of by setting P=1
# and adding text (from \code{sam}) to each data point
RestrictedPCA(
  dat = raw, sam = sam, use.sam = which(sam$GT %in% c("Mo17", "B73")), group.col = "GT",
  fmod = "GT+Batch+Order", P = 1, sign.col = "GT", legend.x = NULL, text.col = "Batch"
)
## End(Not run)