makeDetectionMatrices: Identify Markers and Signatures Present in Individual Samples

Description Usage Arguments Details Value Author(s) Examples

Description

Create matrices of detection events for individual gene features or combination thereof (i.e., signatures).

Usage

1
2
3
4
5
6
7
8
9
makeMarkerDetectionMatrix(se, markers, threshold = 0,
  assay.type = "counts")

makeMarkerProportionScree(matrix)

makeSignatureDetectionMatrix(matrix, object)

makeMarkerProportionMatrix(se, cluster.col, assay.type = "counts",
  threshold = 0)

Arguments

se

An object of class inheriting from SummarizedExperiment.

markers

A character vector, subset of rownames(se).

threshold

Value above which the marker is considered detected.

assay.type

A string specifying which assay values to use, e.g., "counts" or "logcounts".

matrix

A logical matrix indicating the presence of each marker (row) in each sample (column).

object

A collection of signatures inheriting from "GeneSetCollection" or "Sets".

cluster.col

Name of a column in colData(se) that contains a factor indicating cluster membership for each column (i.e. sample) in se.

Details

The makeMarkerDetectionMatrix function returns a marker by sample matrix declaring a feature as detected if it is detected above a given threshold in a specific assay (e.g., "counts", "logcounts").

The makeSignatureDetectionMatrix function returns a sample by signature matrix declaring a signature (composed of one or more gene features) as detected if all the associated features are detected.

The makeMarkerProportionMatrix function returns a signature by cluster matrix indicating the proportion of samples expressing detectable levels of each marker in individual predefined clusters.

The makeMarkerProportionScree function compute the 'cumulative' (i.e., combined) detection rate of markers: the proportion of samples with detectable levels of the first marker, both of the first two markers, etc.

Value

makeMarkerDetectionMatrix

A logical matrix indicating detectable levels of each marker in each sample.

makeSignatureDetectionMatrix

A logical matrix indicating detectable levels of each signature in each sample.

makeMarkerProportionMatrix

A matrix indicating for each feature the proportion of samples expressing detectable levels in each cluster.

makeMarkerProportionScree

A double vector indicating the proportion of samples positive for markers in the input logical matrix.

Author(s)

Kevin Rue-Albrecht, with C++ code by Aaron Lun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Example data ----
library(SummarizedExperiment)
nsamples <- 100
u <- matrix(rpois(20000, 2), ncol=nsamples)
rownames(u) <- paste0("Gene", sprintf("%03d", seq_len(nrow(u))))
se <- SummarizedExperiment(assays=list(counts=u))

geneLists <- list(
  "Cell type 1" = c("Gene001", "Gene002"),
  "Cell type 2" = c("Gene003", "Gene004")
)
bs <- as(geneLists, "Sets")

# Example usage ----

markerMatrix <- makeMarkerDetectionMatrix(se, ids(elementInfo(bs)))
signatureMatrix <- makeSignatureDetectionMatrix(markerMatrix, bs)

tab <- makeMarkerProportionScree(markerMatrix)
plot(tab$markers, tab$proportion, ylim=c(0, 1), main="Combined detection scree")

se$cluster <- factor(sample(c("A", "B"), ncol(se), TRUE))
proportionMatrix <- makeMarkerProportionMatrix(
    se, cluster.col="cluster", assay.type="counts", threshold=0)
head(proportionMatrix)

kevinrue/hancock documentation built on May 17, 2020, 7:55 a.m.