Skip to content
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

Adding a utility function to subset RCTD/spacexr object based on spatial spot ids #144

Merged
merged 1 commit into from
Apr 4, 2023

Conversation

simoncmo
Copy link
Contributor

Hi Spacexr team,

Thanks for the great tool! In some scenario I realize I want to subset the resulting RCTD/spacexr object based on the desired spatial barcode id to make the downstream processing smoother. So I wrote this simple subset function that essentially subset following 3 slots

  1. @spatialRNA
  2. @originalSpatialRNA
  3. @results$weights
    to match spots provided by user
    a example using (using Visium seurat object) would be
rctd_obj = readRDS('path/to/rctd_object.rds')
st_obj = readRDS('path/to/visium_seurat_object.rds')
spot_ids_keep = colnames(st_obj)[1:300]
rctd_obj_new = subset(rctd_obj, spot_ids_keep)

Hope this make sense and could benefit other user too. Please let me know if you have any questions or suggestions for improvement!

Thanks,

Simon

Copy link
Owner

@dmcable dmcable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks, this looks like a useful function!

@dmcable dmcable merged commit dc80bb0 into dmcable:master Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants