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

How to Subset CellScopes Objects with Metadata from Seurat or stLearn #12

Open
YuxiZhang-0113 opened this issue Aug 2, 2024 · 1 comment

Comments

@YuxiZhang-0113
Copy link

Hi,

I've been testing CellScopes with various spatial transcriptomics datasets and find its capabilities very impressive. However, I encountered an issue when trying to subset CellScopes objects.

I often use metadata from objects processed with Seurat or stLearn and integrate this metadata into a processed CellScopes object for visualization. Sometimes, the metadata I have does not cover all the spots in the CellScopes object, leading to mismatches.

I also attempted to convert Seurat's visium object to a CellScopes object using cs.from_seurat. However, this approach does not allow me to use cs.add_visium_img to add the original Tiff file. The error I received is:

MethodError: no method matching add_visium_img(::CellScopes.VisiumObject, ::String)
Closest candidates are:
add_visium_img(::CellScopes.VisiumObject; img_path) at ~/.julia/packages/CellScopes/mRlqf/src/spatial/sp_processing.jl:251

Stacktrace:
[1] top-level scope
@ In[5]:1

Therefore, I would appreciate any guidance on how to subset CellScopes objects for various spatial transcriptomics and single-cell data.

Thank you for your assistance!

Best regards

@HaojiaWu
Copy link
Owner

HaojiaWu commented Aug 7, 2024

Hi,
"I often use metadata from objects processed with Seurat or stLearn and integrate this metadata into a processed CellScopes object for visualization. Sometimes, the metadata I have does not cover all the spots in the CellScopes object, leading to mismatches."
You can try this:

  1. create a complete CellScopes object.
  2. subset the CellScopes object using the same cell ids that are used in your Seurat object. Here we provide a function for subseting cells.
subset_obj = cs.subset_objec(cs_obj;  cells = a_vector_of_cell_ids)
  1. Input the metadata from seurat or stlearn into the CellScopes metadata. Make sure the cell order is the same between the CellScope object and your seurat/stlearn object.

"I also attempted to convert Seurat's visium object to a CellScopes object using cs.from_seurat. However, this approach does not allow me to use cs.add_visium_img to add the original Tiff file. The error I received is:"
Can you use this line below and see if it works for you? I have updated the tutorial for this part.

visium = cs.add_visium_img(visium; img_path ="/mnt/sdb/breast_cancer_visium/CytAssist_FFPE_Human_Breast_Cancer_tissue_image_8bit.tif")

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

No branches or pull requests

2 participants