Method for storing new assays inside subsets in ExperimentSubset objects
Source:R/allGenerics.R, R/SubsetRangedSummarizedExperiment.R, R/SubsetSingleCellExperiment.R, and 3 more
setSubsetAssay.RdStore a new subset assay inside a specified subset in the
input ExperimentSubset object.
Usage
setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE)
# S4 method for class 'SubsetRangedSummarizedExperiment'
setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE)
# S4 method for class 'SubsetSingleCellExperiment'
setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE)
# S4 method for class 'SubsetSummarizedExperiment'
setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE)
# S4 method for class 'SubsetSpatialExperiment'
setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE)
# S4 method for class 'SubsetTreeSummarizedExperiment'
setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE)Arguments
- x
ExperimentSubsetSpecify the input object.- subsetName
character(1)Specify the name of the existing subset inside which the new subsetassayshould be stored.- inputMatrix
A matrix-like object (for example a
matrixordgCMatrix) to store as anassayin the subset.- subsetAssayName
character(1)Specify the name of the newassayagainst theinputMatrixparameter. It can't contain"/". A subset sees its parent's assays as linked assays, so a name linked from the parent (for example a mainassay) needsunlink.- unlink
TRUE,FALSEor a character vector ofassaynames. Store theassayeven though the subset sees an assay of that name linked from its parent: withTRUE, or with a character vector that containssubsetAssayName. The subset, and subsets made from it, then use thisassayinstead, and a message says what was unlinked; the parent's is unchanged. DefaultFALSE.
Examples
data(sce_chcl, package = "scds")
es <- ExperimentSubset(sce_chcl)
es <- createSubset(es, "subset1",
rows = c(10,11,50,56,98,99,102,105,109, 200),
cols = c(20,21,40,45,90,99,100,123,166,299),
parentAssay = "counts")
counts1p <- assay(es, "subset1")
counts1p[,] <- counts1p[,] + 1
es <- setSubsetAssay(es, "subset1", counts1p, "scaledSubset1")
es
#> class: SubsetSingleCellExperiment
#> dim: 2000 2000
#> metadata(0):
#> assays(2): counts logcounts
#> rownames(2000): C12orf73 RNU6-1256P ... FOXF1 PRR3
#> rowData names(1): gene
#> colnames(2000): CTGCTGTCAGGGTATG CAGTCCTTCGGTTAAC ... GATGCTATCAGCAACT
#> ATTTCTGGTGATGATA
#> colData names(11): nGene nUMI ... ident doublet_true_labels
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):
#> subsets(1): subset1
#> subsetAssays(2): subset1 subset1/scaledSubset1