I would like to add the results of escape to the metadata (colData) of my data object, instead of an assay.
Add the dense numeric matrix from the output of escape.matrix to the colData of my SingleCellExperiment object. Are the orders of the cells conserved (matched) when I add this to metadata?
gene set
str(GS)
List of 2
$ Bcells: chr [1:5] "MS4A1" "CD79B" "CD79A" "IGH1" ...
$ Tcells: chr [1:5] "CD3E" "CD3D" "CD3G" "CD7" ...
Run escape
trial <- escape.matrix(spe,
method = "AUCell",
gene.sets = GS,
min.size = NULL)
output
str(trial)
num [1:163797, 1:2] 0 0 0 0 0 0 0 0 0 0 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:163797] "1" "2" "4" "5" ...
..$ : chr [1:2] "Bcells" "Tcells"
then
# add results to colData of SPE
colData(spe)[, colnames(trial)] <- trial
colData
colData(spe)
DataFrame with 163797 rows and 15 columns
cell_id transcript_counts control_probe_counts control_codeword_counts total_counts cell_area nucleus_area sample_id in_tissue sum
<integer> <integer> <integer> <integer> <integer> <numeric> <numeric> <character> <logical> <numeric>
1 1 28 1 0 29 58.3870 26.6422 xenium TRUE 28
2 2 94 0 0 94 197.0167 42.1308 xenium TRUE 94
4 4 11 0 0 11 42.3114 10.0698 xenium TRUE 11
5 5 48 0 0 48 107.6525 37.4797 xenium TRUE 48
8 8 39 0 0 39 85.0292 26.3712 xenium TRUE 39
... ... ... ... ... ... ... ... ... ... ...
167776 167776 229 1 0 230 220.4528 60.5997 xenium TRUE 229
167777 167777 79 0 0 79 37.3894 25.2423 xenium TRUE 79
167778 167778 397 0 0 397 287.0583 86.7000 xenium TRUE 397
167779 167779 117 0 0 117 235.3544 25.1972 xenium TRUE 117
167780 167780 378 0 0 378 270.0795 111.8069 xenium TRUE 378
detected total sizeFactor Bcells Tcells
<integer> <numeric> <numeric> <numeric> <numeric>
1 15 28 0.1429156 0 0.00000000
2 38 94 0.4797882 0 0.00000000
4 9 11 0.0561454 0 0.19421488
5 33 48 0.2449982 0 0.00000000
8 25 39 0.1990610 0 0.00826446
... ... ... ... ... ...
167776 77 229 1.168846 0 0
167777 37 79 0.403226 0 0
167778 75 397 2.026339 0 0
167779 51 117 0.597183 0 0
167780 77 378 1.929361 0 0
Thanks in advance!
I would like to add the results of escape to the metadata (colData) of my data object, instead of an assay.
Add the dense numeric matrix from the output of
escape.matrixto the colData of mySingleCellExperimentobject. Are the orders of the cells conserved (matched) when I add this to metadata?gene set
Run escape
output
then
colData
Thanks in advance!