ScatterplotCellScoreComponents: Scatterplot of the the donor-like and target-like scores

View source: R/ScatterplotCellScoreComponents.R

ScatterplotCellScoreComponentsR Documentation

Scatterplot of the the donor-like and target-like scores

Description

This function will plot the components of the CellScore, namely the donor- like and the target-like scores. The function will only plot the scores for the test samples (annotated by the cellscore$column sub_cell_type1). Standards are not included.

Usage

ScatterplotCellScoreComponents(cellscore, cell.change, index.plot = FALSE)

Arguments

cellscore

a data.frame of CellScore values as calculated by CellScore()

cell.change

a data.frame with 3 columns: start cell type, test cell type, target cell type

index.plot

a logical variable, with TRUE meaning sample index should be plotted for easy identification of spots. Default is FALSE. This is useful if you want to see where the samples are located on the plot.

Value

This function outputs the plot on the active graphical device and returns invisibly NULL.

See Also

CellScore for details on CellScore.

Examples

## 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", 
                 "ASC", "NPC", "MSC", "iPS", "piPS")
   eset.sub <- eset[, sel.samples]
   cs <- CosineSimScore(eset.sub, cell.change, iqr.cutoff=0.1)

   ## Generate the on/off scores for the combined data
   individ.OnOff <- OnOff(eset.sub, cell.change, out.put="individual")

   ## Generate the CellScore values for all samples
   cellscore <- CellScore(data=eset.sub, transitions=cell.change, scores.onoff=individ.OnOff$scores,
                          scores.cosine=cs$cosine.samples)

   ## Make the scaterplot of CellScore components
   ScatterplotCellScoreComponents(cellscore, cell.change, FALSE)
}

nmah/CellScore documentation built on May 4, 2023, 2:52 p.m.