-
Notifications
You must be signed in to change notification settings - Fork 18
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
Methods for splitting SingleCellExperiment objects #55
Comments
Well, yes, that's because you're looping over every element of
Possibly, but this would likely go to the SummarizedExperiment repository rather than this one. Any such methods should benefit all SE subclasses, there isn't any reason that it would just be useful for SCEs. Tagging @mtmorgan: does this functionality already exist in SE? |
bc220ca fixes the split(sce, rowData(sce)$variable) |
Any update on this? Seurat has the |
No, it seems I clobbered my own PR (linked above) and also no one cared about it. Perhaps consider making a PR to the SummarizedExperiment repo with something like: # Completely untested!
setGeneric("splitByCol", function(x, f, ...) standardGeneric("splitByCol"))
setMethod("splitByCol", "SummarizedExperiment", function(x, f, ...) {
f <- as.factor(f)
by.levels <- split(seq_along(f), f)
for (i in seq_along(by.levels)) {
by.levels[[i]] <- x[, by.levels[[i]], drop=FALSE]
}
by.levels
})
Don't have the time/will to do it myself but it seems useful enough that a PR would warrant some consideration. |
I renamed the |
Is there scope to define a splitColData and splitRowData methods for the SingleCellExperiment class?
I am working with a rather large SingleCellExperiment object and I often find myself needing to split the object into a list of smaller objects for pre-processing based on either the column or row data.
This can obviously be done with the following:
However, I've found this approach to be slower than using a for-loop with pre-allocation (e.g. similar to the code already in the splitAltExps function):
If there is a need for these methods I can submit a pull-request? If not, it would be super helpful if you could advise what is the most robust and efficient method for splitting SCE objects. Thank you.
The text was updated successfully, but these errors were encountered: