BarplotOnOff: Pyramid barplot of on/off scores

View source: R/BarplotOnOff.R

BarplotOnOffR Documentation

Pyramid barplot of on/off scores

Description

This function will generate a horizontal barplot of the OnOff scores of test cell types, as defined by the eset$sub_cell_type1 column of the input dataset. Note that if the cell types as provided in the second argument (score data frame as produced by the function OnOff, are not matching the phenotype of the input dataset, the function will return an error.

Usage

BarplotOnOff(eset, group.score)

Arguments

eset

an ExpressionSet containing data matrices of normalized expression data, present/absent calls, a gene annotation data.frame and a phenotype data.frame.

group.score

a data frame with cell type specific on/off scores as generated by the OnOff function.

Value

This function returns a list of two objects, as follows:

GroupComparisonsForPlot

an ordered data.frame of on/off scores,

OnOffBarplotData

a data frame of marker gain/loss and aditional features, used for making the plot.

See Also

OnOff for details on on/off score calculations, and hgu133plus2CellScore for details on the specific expressionSet object that should be provided as an input.

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 a marker list
   group.OnOff <- OnOff(eset, cell.change, out.put="marker.list")

   ## Calculate on/off score for individual samples
   individ.OnOff <- OnOff(eset, cell.change, out.put="individual")
   
   ## Plot pyramid bar plot of on/off scores
   BarplotOnOff(eset, group.OnOff$scores)
}

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