plotWithinFactor: Evaluate gene-specific factors in the the data.

View source: R/plotWithinFactor.R

plotWithinFactorR Documentation

Evaluate gene-specific factors in the the data.

Description

This function can be used to evaluate the extent of gene-specific biases in the data. If a bias exists, the plots provided here will identify whether it affects cells equally or not. Correction for such features may be considered especially if the bias is different between conditions (see SCnorm vignette for details).

Usage

plotWithinFactor(
  Data,
  withinSample = NULL,
  Conditions = NULL,
  FilterExpression = 0,
  NumExpressionGroups = 4
)

Arguments

Data

can be a matrix of single-cell expression with cells where rows are genes and columns are samples. Gene names should not be a column in this matrix, but should be assigned to rownames(Data). Data can also be an object of class SummarizedExperiment that contains the single-cell expression matrix and other metadata. The assays slot contains the expression matrix and is named "Counts". This matrix should have one row for each gene and one sample for each column. The colData slot should contain a data.frame with one row per sample and columns that contain metadata for each sample. This data.frame should contain a variable that represents biological condition in the same order as the columns of NormCounts). Additional information about the experiment can be contained in the metadata slot as a list.

withinSample

a vector of gene-specific features.

Conditions

vector of condition labels, this should correspond to the columns of the un-normalized expression matrix. If provided the cells will be colored by Condition instead of individually.

FilterExpression

exclude genes having median of non-zero expression below this threshold.

NumExpressionGroups

the number of groups to split the within sample factor into, e.g genes will be split into equally sized groups based on their GC content/Gene length/etc.

Value

produces a plot and returns the data the plot is based on.

Author(s)

Rhonda Bacher

Examples

 
data(ExampleSimSCData)
Conditions = rep(c(1,2), each= 90) 
exampleFactor = runif(dim(ExampleSimSCData)[1], 0, 1)
names(exampleFactor) = rownames(ExampleSimSCData)
#plotWithinFactor(Data = ExampleSimSCData,  
  #withinSample=exampleFactor, Conditions = Conditions)

rhondabacher/SCnorm documentation built on July 8, 2023, 11:36 p.m.