ntp: nearest template prediction

Description Usage Arguments Details Value Note References See Also Examples

View source: R/ntp.R

Description

Nearest Template Prediction (NTP) based on predefined class templates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ntp(
  emat,
  templates,
  nPerm = 1000,
  distance = "cosine",
  nCores = 1,
  seed = NULL,
  verbose = getOption("verbose"),
  doPlot = FALSE
)

Arguments

emat

a numeric matrix with row features and sample columns. rownames(emat) are matched against templates$probe.

templates

a data frame with two columns; class (coerced to factor) and probe (coerced to character).

nPerm

an integer, number of permutations for p-value estimation.

distance

a character, either c("cosine", "pearson", "spearman" or "kendall").

nCores

an integer specifying number of threads for parallelization.

seed

an integer, for p-value reproducibility. Setting seed enforces serial processing.

verbose

logical, whether console messages are to be displayed.

doPlot

logical, whether to produce prediction subHeatmap.

Details

ntp implements the Nearest Template Prediction (NTP) algorithm, largely as proposed by Yujin Hoshida (2010) (see below). For each sample, distances to templates are calculated and class assigned based on smallest distance. Distances are transformed from the sample-templates correlations as follows:

d.class = √(1/2 * (1-(cor(sample,templates))

Template values are 1 for class features and 0 for non-class features (-1 if there are only two classes). Prediction confidence is estimated based on the distance of the null-distribution, estimated from permutation tests. Thus the lowest possible estimate of the p-value is 1/nPerm.

For further details on the NTP algorithm, please refer to package vignette and Hoshida (2010).

Parallel processing is implemented through parallel mclapply or snow parLapply for nix and Windows systems, respectively.

Value

a data frame with class predictions, template distances, p-values and false discovery rate adjusted p-values (p.adjust(method = "fdr")). Rownames equal emat colnames.

Note

References

Hoshida, Y. (2010). Nearest Template Prediction: A Single-Sample-Based Flexible Class Prediction with Confidence Assessment. PLoS ONE 5, e15543.

See Also

corCosine, cor

Examples

1
2
3
emat <- ematAdjust(crcTCGAsubset, normMethod = "quantile")
res <- ntp(emat, templates.CMS, doPlot=TRUE, nPerm=100)
head(res)

peterawe/CMScaller documentation built on June 13, 2020, 4:49 a.m.