-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Randomly downsample seurat object #3108
Comments
You should be able to run: downsampled.obj <- large.obj[, sample(colnames(large.obj), size = ncol(small.obj), replace=F)] |
Thank you Tim. If anybody happens upon this in the future, there was a missing ')' in the above code. This is what worked for me:
|
They actually both fail due to syntax errors, yours included @williamsdrake .
I hope this helps someone. |
Hi everyone. Just a quick question
Hy Km Short... I was trying to do the same and is used your code. The number of column it is reduced ( so the object). My question is... Is this randomized ? which command here is leading to randomization ? I managed to reduce the vignette pbmc from the from 2700 to 600. I ma just worried it is just picking the first 600 and not randomizing |
https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/sample |
Hi Seurat Team,
Thanks for the wonderful package. I have two seurat objects, one with about 40k cells and another with around 20k cells. I would like to randomly downsample the larger object to have the same number of cells as the smaller object, however I am getting an error when trying to subset. I followed the example in #243, however this issue used a previous version of Seurat and the code didn't work as-is. Here is the slightly modified code I tried with the error:
The error after the last line is:
Error in CellsByIdentities(object = object, cells = cells) :
Cannot find cells provided
Seurat version 3.1.4
Any help or guidance would be appreciated. Thank you
The text was updated successfully, but these errors were encountered: