getPValues: getPValues

Description Usage Arguments Value Author(s) See Also Examples

View source: R/getPValues.R

Description

getPValues performs a permutation test on the gene-cell type specificity score to obtain a p-value value on each gene-cell type specificity score. The permutation keeps everything the same except that cell type assignments are permuted between the cells (but note that cell type proportions are also kept the same). This function is a way to select all differentially expressed genes between all cell classes globally in a dataset in one go or to define differentially expressed genes in a specific cell cluster.

Usage

1
2
3
4
5
6
7
8
9
getPValues(
  gs,
  numPerm = 5,
  correctMethod = "BH",
  testGenes = NULL,
  subsetCells = NULL,
  cores = 1,
  seed = 111
)

Arguments

gs

The output of sortGenes().

numPerm

The number of permutations to do. The default value 5 is to ensure quick running time for very large datasets but can be increased to increase the power of the permutation test, see Details.

correctMethod

The method used to correct p-values for multiple hypothesis testing. Any valid input to "method" in p.adjust is allowed. p-value correction is done on a gene-by-gene basis.

testGenes

A character vector of gene names to restrict the output p-values to.

subsetCells

A numeric vector of cell indeces to restrict the permutation to. Note that the selected cells should still contain at least one cell from each of the cell clusters contained in $specScore. Note this option is still experimental and might not give consistent results.

cores

An integer greater than zero (1 by default) that indicates how many cores to use for parallelization using mclapply.

seed

The seed for random permutations.

Value

getPValues returns a list with the following components:

permuteVal

A sparse matrix with as many rows as genes and as many columns as ncol($specScore) * numPerm, containing the specificity score matrices for all permutations concatenated after each other column-wise.

startIndeces

A numeric vector of length numPerm that indicates the starting column for each performed permutation in permuteVal

pval

A matrix with as many rows as genes and columns as ncol($specScore), containing the p-values for the null hypothesis that the gene is not highly specific to a cell cluster is true.

adjpval

A matrix with the same size as pval, containing the corrected p-values using the method specified in correctMethod

Author(s)

Mahmoud M Ibrahim <mmibrahim@pm.me>

See Also

getMarkers

Examples

1
2
3
4
5
data(kidneyTabulaMuris)
gs = sortGenes(kidneyTabulaMuris$exp, kidneyTabulaMuris$cellType)
pp = getPValues(gs)
#obtain genes that are "differentially expressed" in at least one cluster
markers = names(which(apply(pp$adjpval, 1, function(x) any(x < 0.01))))

mahmoudibrahim/genesorteR documentation built on April 20, 2021, 4:07 p.m.