predictByProportionPositive: Identify the Dominant Signatures in Clusters of Samples

Description Usage Arguments Details Value Functions Author(s) See Also Examples

View source: R/predict-methods.R

Description

The predictByProportionPositive() function computes the proportion of samples positive for each signature in each (predefined) cluster and identifies the predominant signature in each cluster. The function stores information tracing the prediction process in the metadata slot. See Details.

Usage

1
2
3
4
5
6
plotProportionPositive(se, ..., row_title = "Signature",
  row_title_side = "left", column_title = "Cluster",
  column_title_side = "top")

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

Arguments

se

An object of class inheriting from SummarizedExperiment.

...

Additional arguments to be passed to methods.

row_title, row_title_side, column_title, column_title_side

See Heatmap().

object

A collection of signatures inheriting from Sets or GeneSetCollection".

cluster.col

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

assay.type

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

threshold

Value above which the marker is considered detected.

Details

The function populates the "hancock" element of the metadata slot with the following fields and values:

"GeneSets"

Signatures used to make the predictions

"method"

Name of the method used to make the predictions

"packageVersion"

hancock version used to make the predictions

"ProportionPositiveByCluster"

Matrix indicating the proportion of samples in each cluster that are positive for each signature.

"TopSignatureByCluster"

Named vector indicating the predominant signature for each cluster.

Value

The object se, updated as follows:

Functions

Author(s)

Kevin Rue-Albrecht

See Also

predict.GeneSetCollection(), predict.Sets().

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
# Example data ----
library(SummarizedExperiment)
nsamples <- 100
u <- matrix(rpois(20000, 1), ncol=nsamples)
rownames(u) <- paste0("Gene", sprintf("%03d", seq_len(nrow(u))))
colnames(u) <- paste0("Cell", sprintf("%03d", seq_len(ncol(u))))
se <- SummarizedExperiment(assays=list(counts=u))

bs <- Sets(
    relations=DataFrame(
        element = c("Gene001", "Gene002", "Gene003", "Gene004"),
        set     = c(rep("Cell type 1", 2), rep("Cell type 2", 2))
    )
)
colData(se)[, "cluster"] <- factor(sample(head(LETTERS, 3), ncol(se), replace=TRUE))

# Example usage ----
library(circlize)
# Identify the dominant signature in each cluster
se <- predictByProportionPositive(bs, se, cluster.col="cluster")
# Visualise the proportion of samples positive for each signature in each cluster
plotProportionPositive(
  se, cluster_rows=FALSE, cluster_columns=FALSE,
  col=colorRamp2(c(0, 100), c("white", "red")))

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