predict_PCA: PCA plots

predict_PCAR Documentation

PCA plots

Description

Predict taxonomic classifications for sequences in a codonFreq) object, using linear discriminants from an PCA) model. Plot disciminants and predictions.

Usage

predict_PCA(
  cFobj,
  pcaObj,
  rank = "Phylum",
  minlen = 600,
  fname = NA_character_,
  units = "in",
  width = 10,
  height = 7,
  dpi = 600,
  norm = FALSE,
  save = FALSE,
  identifier = NULL,
  includeTax = NULL,
  colours = NULL
)

## S4 method for signature 'codonFreq'
predict_PCA(
  cFobj,
  pcaObj,
  rank,
  minlen,
  fname,
  units,
  width,
  height,
  dpi,
  norm,
  save,
  identifier,
  colours
)

Arguments

cFobj

An object of class codonFreq.

pcaObj

Object of class prcomp.

rank

Character, taxonomic rank to be used for categorisation. Options are "Domain", "Kingdom", and "Phylum". Default = "Phylum".

minlen

Numeric, the minimum length of sequence (in codons) to be included in the analysis. Default = 500.

fname

Character, name of figure generated.

units

Numeric, units to be used for defining the plot size. Options are "in" (default), "cm", and "mm".

width

Numeric, width of the figure (in units).

height

Numeric, height of the figure (in units).

dpi

Numeric, resolution of the figure (default = 600).

norm

Logical, should the codon abundances be normalised? If TRUE, codon abundances will be converted to codon bias scores, such that the sum of scores for each amino acid sum to 1. Default = FALSE.

save

Logical, should the enrichment results plot be saved to a file? Default = FALSE.

identifier

Character, optional group label to be assigned to sequences in the codonFreq object. If not supplied, each sequence will be labelled individually on the plot. Maximum number of unique identifiers = 6.

includeTax

Character, optional vector of taxa (at the specified rank) to be included in the PCA. If not supplied, all taxa will be used.

colours

Integer vector, containing values between 1 and 9, which specifies the colours to be used from the 'Set1' palette in the 'RColorBrewer' package.

Value

A ggplot object.

Examples

    virusSet <- readSeq(example = TRUE)
    virusCF <- codonFreq(virusSet)
    exclCod <- c("ATT", "TGT")
    PCA_tmp <- PCA(exclude = exclCod, rank = "Phylum", minlen = 600)
    predPCA <- predict_PCA(
        virusCF, PCA_tmp, rank = "Phylum", save = TRUE,
        minlen = 600, fname = "PCA_tmp2", height = 5, width = 7
    )


adamd3/codondiffR documentation built on Sept. 3, 2022, 2:26 a.m.