PcaStandards: PCA plot on the most variable portion of the standard...

Description Usage Arguments Value See Also Examples

View source: R/PcaStandards.R

Description

This function will generate a principal component analysis (PCA) plot of the IQR-filtered expression values that were used to generate the cosine similarity scores.

Usage

1
2
3
4
5
6
7
8
9
PcaStandards(label, label.name, exps, text.label = NULL,
  col.palette = c("blue", "magenta", "green", "red", "goldenrod",
  "mediumslateblue", "olivedrab", "navyblue", "plum", "tomato", "thistle",
  "limegreen", "burlywood4", "cornflowerblue", "deeppink", "chartreuse",
  "forestgreen", "darkslateblue", "blueviolet", "gray50", "darkorange", "black",
  "lightsalmon4", "mediumseagreen", "palegreen4", "palevioletred4",
  "peachpuff4", "plum4", "mediumspringgreen", "darkred", "khaki4", "lawngreen",
  "lightseagreen", "orange", "orchid3", "sienna4", "snow4", "turquoise3",
  "wheat3", "goldenrod2",      "darkorange3"))

Arguments

label

vector to be used for the point colours

label.name

name of the label

exps

an expression matrix of the IQR-filtered values as obtained by the function CosineSimScore().

text.label

a vector of characters to label each point.

col.palette

a vector of colours to be used. There are 41 default colours.

Value

The function will plot two panels, a PCA plot on the left and a legend on the right. This is to accommodate that fact that the cell types names are NOT abbreviated and the legend might not fit in the plot area.

See Also

CosineSimScore for details on cosine similarity calculation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Load the expression set for the standard cell types
library(Biobase)
library(hgu133plus2CellScore) # eset.std

## Locate the external data files in the CellScore package
rdata.path <- system.file("extdata", "eset48.RData", package = "CellScore")
tsvdata.path <- system.file("extdata", "cell_change_test.tsv",
                            package = "CellScore")

if (file.exists(rdata.path) && file.exists(tsvdata.path)) {

   ## Load the expression set with normalized expressions of 48 test samples
   load(rdata.path)

   ## Import the cell change info for the loaded test samples
   cell.change <- read.delim(file= tsvdata.path, sep="\t",
                             header=TRUE, stringsAsFactors=FALSE)

   ## Combine the standards and the test data
   eset <- combine(eset.std, eset48)

   ## Generate cosine similarity for the combined data
   ## NOTE: May take 1-2 minutes on the full eset object
   ## so we subset it for 4 cell types
   pdata <- pData(eset)
   sel.samples <- pdata$general_cell_type %in% c("ESC", "EC", "FIB", "KER")
   eset.sub <- eset[, sel.samples]
   cs <- CosineSimScore(eset.sub, cell.change, iqr.cutoff=0.1)

   PcaStandards(cs$pdataSub$experiment_id, "Experiment ID", cs$esetSub.IQR)
}

nmah/CellScore documentation built on May 28, 2019, 3:12 p.m.