measureTrPhe: Measuring mutually exclusive transcriptional phenotypes

Description Usage Arguments Value Author(s) Examples

View source: R/measureTrPhe.R

Description

measureTrPhe idenfifies mutually exclusive transcriptional phenotypes in single cell data (normalised read counts, SingleCellExperiment): genes expressed in one cell type but not the other (or all other) using one-tailed Wilcox, KS or other differential expression tests

measureTrPheSingle: idenfifies mutually exclusive transcriptional phenotypes for 2 clusters of single cells

clusterCOMBS: produces a data.table specifying all combinations of clusters for differential expression analysis.

countNonZeros: count non-zero cells per gene and per cluster

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
measureTrPhe(data, method = c("wilcox", "ks")[1], mode = c("pairwise",
  "one_vs_all")[1], cutoff = 1, assays_matrix_name = "norm_counts",
  colData_cluster_col = "clusters", pval_corr_method = "fdr",
  low_exprs_threshold = 0.1, low_exprs_cells = 6,
  n_cores = detectCores() - 1)

measureTrPheSingle(norm_counts, combinations, combinations_ind = 1,
  cutoff = 0.05, pval_corr_method = "fdr", low_exprs_threshold = 1,
  low_exprs_cells = 6, method = c("wilcox", "ks")[1])

clusterCOMBS(clusters, mode = c("pairwise", "one_vs_all")[1])

countNonZeros(data, low_exprs_threshold = 0.1,
  colData_cluster_col = "clusters", assays_matrix_name = "norm_counts")

Arguments

data

object of class SingleCellExperiment containing single cell data (normalised read counts, cells already assigned to clusters)

method

method for detecting differentially expressed genes. Currently only Wilcox and KS tests are implemented wilcox.test, ks.test.

mode

compare clusters to each other ("pairwise") or "one_vs_all"

cutoff

FDR-corrected p-value cutoff

assays_matrix_name

name of the matrix in assays(data) that stores normalised read counts

colData_cluster_col

name of the column in colData(data) that stores cluster assignment of cells

pval_corr_method

multiple hypothesis p-value correction method. Details: p.adjust - method.

low_exprs_threshold

threshold (normalised read count) below which gene doesn't qualify as being expressed in a cell

low_exprs_cells

remove genes that are expressed at a level higher or equal low_exprs_threshold in fewer than low_exprs_cells cells at each between-cluster comparison

n_cores

number of cores to be used in parallel processing (over combinations of clusters). More details: parLapply, makeCluster, detectCores

combinations

data.table containing phenotype id (phenotypes) and which clusters are to be compared

combinations_ind

which combination should be analysed?

clusters

character vector, clusters (cell types) present in the data

clusters

character vector, clusters (cell types) present in the data

Value

measureTrPhe: data.table containing data.table containing phenotype id (phenotypes), which genes are assigned to them, test statistic and difference in medians between clusters

measureTrPheSingle: data.table containing phenotype id (phenotypes), which genes are assigned to them, test statistic and difference in medians between clusters

clusterCOMBS: data.table containing phenotype id (phenotypes) and which clusters are to be compared

countNonZeros: data.table containing the number of cells, number of non-zero cells per each gene and cluster

Author(s)

Vitalii Kleshchevnikov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(ArrayExpress)
library(SingleCellExperiment)
library(data.table)
library(ggplot2)
file_paths = getAE("E-MTAB-6153", type = "processed", path = "../regulatory_networks_by_cmap/data/organogenesis_scRNAseq", local = T)
# keep only normalised counts
file_paths$processedFiles = file_paths$processedFiles[file_paths$processedFiles == "normalisedCounts.tsv"]
# get the list of column names
cnames = getcolproc(file_paths)
data = readEMTAB6153ProcData(path = "../regulatory_networks_by_cmap/data/organogenesis_scRNAseq", procFile = "normalisedCounts.tsv", procol = cnames)
pVals = measureTrPhe(data, method = "wilcox", mode = c("pairwise", "one_vs_all")[1], cutoff = 1, assays_matrix_name = "norm_counts", colData_cluster_col = "clusters", pval_corr_method = "fdr", low_exprs_threshold = 0.1, low_exprs_cells = 6, n_cores = detectCores() - 1)
qplot(x = pVals$diff_median, y = -log10(pVals$pVals), geom = "bin2d", xlim = c(-1,50), ylim = c(-1, 300), bins = 150) + theme_light()

vitkl/regNETcmap documentation built on Feb. 18, 2020, 3:43 a.m.