Closed ananyapavuluri closed 1 year ago
You can shuffle the list of cells, split this into test/train set and then pass it to the subset
function to create subsets of test/train objects.
shuffled_cells <- sample(Cells(data_female))
train_cells <- shuffled_cells[1:10]
test_cells <- shuffled_cells[11:20]
train_object <- subset(data_female, cells = train_cells)
test_object <- subset(data_female, cells=test_cells)
I have a Large Seurat object of single-cell ATAC-seq assay. I need to find a way to shuffle the elements of the Seurat object such that the profiles of each single cell remain intact (i.e., it should not just shuffle the count matrix, it should shuffle the whole object including metadata values accordingly as well) and then split the shuffled Seurat object into testing and training sets.
This is how my data looks at the moment:
I need to perform the shuffling and splitting on data_female.
Thank you in advance.
Please note: The goal is to feed this into a machine learning algorithm and is unrelated to the shuffle attribute in DimPlot().