SingleR-inc / celldex

Collection of cell type reference datasets.
https://bioconductor.org/packages/devel/data/experiment/html/celldex.html
46 stars 7 forks source link

Subsetting Immgen Dataset #20

Closed errcricket closed 1 year ago

errcricket commented 1 year ago

Greetings.

I am attempting to try out the SingleR package to annotate some snRNA-seq mouse data using the Immgen dataset found inside the celldex package. The celldex vignette suggested removing some samples.

This reference provides exhaustive coverage of a dizzying number of cell subtypes. However, this can be a double-edged sword as the high resolution can be difficult to interpret, especially for samples derived from experimental conditions that are not of interest. Users may want to remove certain samples themselves depending on the use case.

As a test, I wanted to look at only macrophages; it seems simple enough, but I am having an issue subsetting the Immgen summarizedExperiment object.

ref <- ImmGenData()
ref
unique(ref$label.main)

output

class: SummarizedExperiment 
dim: 22134 830 
metadata(0):
assays(1): logcounts
rownames(22134): Zglp1 Vmn2r65 ... Tiparp Kdm1a
rowData names(0):
colnames(830):
  GSM1136119_EA07068_260297_MOGENE-1_0-ST-V1_MF.11C-11B+.LU_1.CEL
  GSM1136120_EA07068_260298_MOGENE-1_0-ST-V1_MF.11C-11B+.LU_2.CEL ...
  GSM920654_EA07068_201214_MOGENE-1_0-ST-V1_TGD.VG4+24ALO.E17.TH_1.CEL
  GSM920655_EA07068_201215_MOGENE-1_0-ST-V1_TGD.VG4+24ALO.E17.TH_2.CEL
colData names(3): label.main label.fine label.ont

 [1] "Macrophages"       "Monocytes"         "B cells"          
 [4] "DC"                "Stromal cells"     "Eosinophils"      
 [7] "Fibroblasts"       "Neutrophils"       "Endothelial cells"
[10] "T cells"           "ILC"               "NK cells"         
[13] "Basophils"         "Epithelial cells"  "Mast cells"       
[16] "Stem cells"        "Tgd"               "NKT"              
[19] "B cells, pro"      "Microglia"        
macrophages <- ref[, ref$main.label=='Macrophages']
print(macrophages)
unique(macrophages$label.main)

output

class: SummarizedExperiment 
dim: 22134 0 
metadata(0):
assays(1): logcounts
rownames(22134): Zglp1 Vmn2r65 ... Tiparp Kdm1a
rowData names(0):
colnames(0):
colData names(3): label.main label.fine label.ont

character(0)

The dimensions don't show any columns/there is nothing in colnames. Please exercise some restraint in this question -- but what am I missing?

errcricket commented 1 year ago

Got it...

macrophages <- ref[colData(ref)$label.main == 'Macrophages',]