pcaPlot: PCA plot

View source: R/pcaPlot.R

pcaPlotR Documentation

PCA plot

Description

PCA plots of the samples within MSnset

Usage

pcaPlot(
  MSnSetObj,
  omitIgG = FALSE,
  sampleColours = NULL,
  transFunc = log2xplus1,
  transform = TRUE,
  colourBy = "SampleGroup",
  title = "",
  labelColumn = "BioRep",
  labelsize = 4,
  pointsize = 4,
  x.nudge = 4,
  x.PC = 1
)

Arguments

MSnSetObj

MSnSet; an object of class MSnSet

omitIgG

Logical: whether to remove IgG from the PCA plot

sampleColours

character: A named vector of colours for samples

transFunc

func: internal helper function for log transformation

transform

logical: whether to log transform intensities

colourBy

character: column name to use for colouring samples from pData(MSnSetObj)

title

character: title for the plot

labelColumn

character: column name from pData(MSnSetObj) to use for labelling points on the plot or "none" to omit labels

labelsize

numeric: size of the labels

pointsize

numeric: size of plotting points

x.nudge

numeric: distance to move labels along the x-axis away from the plotting points

x.PC

numeric: The principle component to plot on the x-axis; the following PC will be plotted on the y-axis

Details

The column provided to the "colourBy" argument will be used to colour the samples. The colours will be determined using the function assignColours, alternatively the user may specify a named vector of colours using the "sampleColours" argument. The names of the "sampleColours" vector should match the unique values in the "colourBy" column.

Value

An object created by ggplot

Examples


data(human_anno)
data(exp3_OHT_ESR1)
MSnSet_data <- convertToMSnset(exp3_OHT_ESR1$intensities_qPLEX1,
                               metadata=exp3_OHT_ESR1$metadata_qPLEX1, 
                               indExpData=c(7:16), 
                               Sequences=2, 
                               Accessions=6)
exprs(MSnSet_data) <- exprs(MSnSet_data)+0.01
pcaPlot(MSnSet_data, omitIgG = TRUE, labelColumn = "BioRep")

# custom colours and PC2 v PC3
customCols <- rainbow(length(unique(pData(MSnSet_data)$SampleGroup)))
names(customCols) <- unique(pData(MSnSet_data)$SampleGroup)
pcaPlot(MSnSet_data, 
        omitIgG = TRUE, 
        labelColumn = "BioRep", 
        sampleColours = customCols, 
        x.PC=2)


crukci-bioinformatics/qPLEXanalyzer documentation built on Sept. 24, 2024, 1:13 a.m.