-
Notifications
You must be signed in to change notification settings - Fork 40
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
Feedback on concatenate() #541
Comments
I am a bit swamped at the moment, but I will look into implementing your suggestions. As you said it would be worthwhile to handle dicts. |
I have the same issue ! |
And it's better to have a way to retrieve (subset) each objects from the concatenated objects. |
@wangjiawen2013 does |
What I mean is how to concatenate multi spatialdata objects and subset each objects from the concatenated objects according to the sample names (each object have a unique name) again. The SpatialData objects from xenium all have the same names for images, shapes and coordinate systems, so I cannot concatenate them because |
While I in the end was able to concatenate the data the way I like, the user experience wasn't as great as I had hoped, so wanted to drop some feedback. As I'm not that familiar with spatialdata yet, it might be that there are already better solutions -- please let me know if there are.
Starting situation
I have ~20 Visium Cytassist samples from a clinical trial processed with nf-core/spatialtranscriptomics (using the nf-core/spatialvi#67 branch that already uses spatialdata). The pipeline generates a single
.zarr
folder for each sample.Desired outcome
I would like to have all samples in a single SpatialData object. The AnnData table should contain the gene expression from all samples.
Pain points
sd.concatenate
enforces that the input is a list. Is there a reason this can't accept anySequence
type (e.g.dict_values
)?Usually, I pass a dictionary
sample_id -> AnnData
toanndata.concat
, which nicely makes unique obs_names in combination withconcat(..., index_unique="_")
. This doesn't work with spatialdata.concatenate, which leaves me with either manipulating theobs_names
for each object before concatenation, or ugly obs names with numeric sufficies (e.g.AACTCAACCTTGACCA-1_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0
). IMO it would be great to support a dict as input to spatialdata.concatenate, too.The per-sample SpatialData objects all have the same names for images, shapes and coordinate systems. I currently rename them like this:
which seems a bit cumbersome. I'm wondering if there's a better solution or what's the intended way of handling such cases. It could also be worth adding a process to the nf-core/spatialtranscriptomics pipeline that already does the concatenation step.
The text was updated successfully, but these errors were encountered: