sigma_funct: Main function to calculate sigma

Description Usage Arguments Value Examples

View source: R/sigma_function.R

Description

This function will calculate the value of sigma for each cluster and output a measure object which can be used with all the plotting functions

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sigma_funct(
  expr,
  clusters,
  exclude = NULL,
  confidence = F,
  exp_genes = 0.01,
  exclude_outlier_cells = F,
  outlier_value = 10,
  p.val = 0.01,
  nu = 50
)

Arguments

expr

a data matrix with cells in the columns and genes in the rows, preferably normalized and log-transformed

clusters

a vector of the same length as the number of cells, indicating which cell type they belong to

exclude

a data.frame of variables to reduce in the measure, e.g. total number of transcripts, average expression of MT, Rb or stress genes. The data frame should have the same number of rows as cells (also in the same order), and each column corresponds to a different variable.

confidence

TRUE/FALSE if the confidence interval for SIGMA should be calculated. Caution: Increases computational time significantly.

exp_genes

percentage of variance driving genes to extract per sigificant singular vector

exclude_outlier_cells

TRUE/FALSE if outlier cells should be excluded, default is FALSE (this functions is not fully tested)

outlier_value

cutoff for outlier cells

p.val

the p-value to be used in the test of normality for the singular vectors, default is 0.01

nu

number of left singular vectors to calculate, default is 50. High values increase computational time.

Value

A measure object:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#Load sample data simulated with splatter
library(splatter)
data("splatO")
expr <- counts(splatO)
expr <- expr[rowSums(expr)>0,]

#Normalize and log-transform the data
expr.norm <- t(t(expr)/colSums(expr))*10000
expr.norm.log <- log(expr.norm + 1)

#Create toy example of a data set
test.cluster <- as.character(splatO$Group)
test.cluster[test.cluster == "Group3"] <- "Group2"
test.cluster[test.cluster == "Group4"] <- "Group2"

#Main funcion that calculates the clusterability
out <- sigma_funct(expr = expr.norm.log, clusters = test.cluster,
              exclude = data.frame(clsm = log(colSums(expr) + 1)))

Siliegia/SIGMA documentation built on Dec. 18, 2021, 2 p.m.