Splitting a Seurat Object HTO classification
Entering edit mode
3 months ago
ecl75 • 0

Hello, I am trying to split a Seurat object based on HTO classification. I have 3 different HTO based on different stimulation conditions. I want to pull out the unstimulated condition and make it its own Seurat object. I have tried

Sample_1_unstim<- SplitObject(Sample_1@meta.data$HTO_classification, ident= "Unstim")

And get the error

Error in SplitObject(Sample_1@meta.data$HTO_classification, ident= "Unstim") : 

unused argument (ident = "Unstim")

However I can see the unstim cells in HTO_classification I have also tried subsetting the Unstim cells first doing

Sample_1[['Unstim']] = Sample_1[['HTO_classification']][grepl('Unstim',rownames(Sample_1[['HTO_classification']])),]

and got this error

Warning: Invalid name supplied, making object name syntactically valid. New object name is Unstim; see ?make.names for more details on syntax validity

Error: Cannot add more or fewer cell meta.data information without values being named with cell names

Any ideas? Thanks!

Seurat RNA-Seq 10X R • 402 views
Entering edit mode
3 months ago

Since you only want the data from a single classification you can just subset the Seurat object.

unstim <- subset(Sample_1, subset = HTO_classification == "Unstim")

If you want a list of Seurat objects where each list element is a Seurat object containing only a single 'HTO_classification' class that's when you would use the SplitObject function.

split_obj <- SplitObject(Sample_1, split.by="HTO_classification")

You could then subset out only the "Unstim" data if you wanted to (which would give you the same result as the initial subset method from above).

unstim <- split_obj[["Unstim"]] 

Login before adding your answer.

Traffic: 2625 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6