runReverseDecon: Run Reversedecon

runReverseDeconR Documentation

Run Reversedecon

Description

Runs reversedecon from an S4 object

A wrapper for applying reversedecon to a NanostringGeomxSet object.

Usage

runReverseDecon(object, ...)

## S4 method for signature 'NanoStringGeoMxSet'
runReverseDecon(object, norm_elt = NULL, beta, epsilon = NULL)

Arguments

object

An S4 object such as a GeoMxSet object

...

Arguments passed to reversedecon

norm_elt

normalized data element in assayData.

beta

Matrix of cell abundance estimates, with cells in columns and observations in rows. Columns are aligned to "norm".

epsilon

All y and yhat values are thresholded up to this point when performing decon. Essentially says, "ignore variability in counts below this threshold."

Value

a valid GeoMx S4 object including the following items:

  • in fData

    • coefs, a matrix of coefficients for genes * cells, where element i,j is interpreted as "every unit increase in cell score j is expected to increase expression of gene i by _".

    • cors, a vector giving each gene's correlation between fitted and observed expression

    • resid.sd, a vector of each gene's residual SD, a metric of how much variability genes have independend of cell mixing.

  • in assayData

    • yhat, a matrix of fitted values, in the same dimension as norm

    • resids, a matrix of log2-scale residuals from the reverse decon fit, in the same dimension as norm

Examples

library(GeomxTools)
datadir <- system.file("extdata", "DSP_NGS_Example_Data", package = "GeomxTools")
demoData <- readRDS(file.path(datadir, "/demoData.rds"))

demoData <- shiftCountsOne(demoData)
target_demoData <- aggregateCounts(demoData)

target_demoData <- normalize(target_demoData, "quant")
                
# run basic decon:
res0 <- runspatialdecon(object = target_demoData,
                        norm_elt = "exprs_norm",
                        raw_elt = "exprs")

# run reverse decon:
target_demoData <- runReverseDecon(object = target_demoData,
                                   norm_elt = "exprs_norm",
                                   beta = pData(res0)$beta)


Nanostring-Biostats/SpatialDecon documentation built on Jan. 26, 2024, 8:20 p.m.