getUNDmatrix {BrainSABER} | R Documentation |
This function returns a matrix showing whether gene expression values in
dataSet
are up-regulated, down-regulated, or normal.
method = "discrete"
will function on any CellScabbard object, while
method = "log2FC"
requires a trimmed data set as returned by
getTrimmedExternalSet
and a matching subset of AIBSARNA as
returned by getRelevantGenes
. Results are stored in the 'UNDmatrices'
slot of the dataSet
if it's a CellScabbard object.
getUNDmatrix( dataSet, relevantGenes = NULL, method = c("discrete", "log2FC"), up_threshold = 0.5, down_threshold = -0.5, matrix_type = c("num", "char") )
dataSet |
a CellScabbard or SummarizedExperiment object |
relevantGenes |
(optional) a SummarizedExperiment and subset of AIBSARNA |
method |
|
up_threshold |
a numerical value defining the lower bound (inclusive) by which to consider a gene up-regulated, defaults to 0.5 |
down_threshold |
a numerical value defining the upper bound (inclusive) by which to consider a gene down-regulated, defaults to -0.5 |
matrix_type |
either |
a list containing as many numerical or character matrices as samples
in dataSet
, with each matrix having as many rows as genes in
dataSet
and as many columns as samples in relevantGenes
AIBSARNA <- buildAIBSARNA(mini = TRUE) # Example 1 - using CellScabbard class # get a random sample of 3 genes totalGenes <- nrow(AIBSARNA) gene_idx <- sample.int(totalGenes, 3) sample_idx <- c(1,3,5) # Subset AIBSARNA exprs <- assay(AIBSARNA)[gene_idx, sample_idx] fd <- rowData(AIBSARNA)[gene_idx, ] pd <- colData(AIBSARNA)[sample_idx, ] # build a trimmed data set myGenes <- CellScabbard(exprsData = exprs, phenoData = pd, featureData = fd, AIBSARNA = AIBSARNA, autoTrim = TRUE) UNDmatrices(myGenes) <- getUNDmatrix(myGenes, method = "discrete", up_threshold = 3, down_threshold = 1, matrix_type = "char") UNDmatrices(myGenes) UNDmatrices(myGenes) <- getUNDmatrix(myGenes, method = "log2FC", up_threshold = 3, down_threshold = 1, matrix_type = "num") UNDmatrices(myGenes) # Example 2 - manual gene selection and relevant gene extraction myGenes <- c(4.484885, 0.121902, 0.510035) names(myGenes) <- c("TSPAN6", "DPM1", "C1orf112") myGeneSet <- getRelevantGenes(myGenes, AIBSARNA = AIBSARNA, AIBSARNAid = "gene_symbol") myTrimmedGeneSet <- getTrimmedExternalSet(myGeneSet, dataSetId = "gene_symbol", AIBSARNA, AIBSARNAid = "gene_symbol") myUNDnumericalMatrix <- getUNDmatrix(myTrimmedGeneSet, method = "discrete", up_threshold = 3, down_threshold = 1, matrix_type = "num") myUNDcharacterMatrix <- getUNDmatrix(myTrimmedGeneSet, myGeneSet, method = "log2FC", up_threshold = 3, down_threshold = 1, matrix_type = "char")