satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.23k stars 900 forks source link

How to add image to SeuratObject of CosMx data, which was created in AtoMx SIP web platform? #8232

Open hjbp0610 opened 8 months ago

hjbp0610 commented 8 months ago

Hi, I'm pretty new to CosMx analysis, and it's difficult for me that there are not much tutorial or vignettes with detailed scripts.

I've recently did some CosMx analysis, and all the data is uploaded in AtoMx SIP web platform. And I have two questions about importing image files into the Seurat objects for CosMx data.

  1. I can export the data from the web platform into my local environment as a form of SeuratObject, but it seems that there are no images attached to the Seurat object. How can I use the original FOV images to overlay my downstream analysis data?

  2. I understand that i can download flat files (I haven't tried, yet, actually) from the web platform, not as SeuratObject, and then I can load the data with LoadNanostring(). However, when I read the instructions, the downloaded files also do not seem to include images.

So in both cases, how can I use the original (I don't know what you call these original or raw FOV images) images for my analysis with Seurat package?

Below is an example of my exported Seurat Object from AtoMx web platform after preprocessing of QC, normalization, PCA, and UMAP

An object of class Seurat 4051 features across 290498 samples within 6 assays Active assay: RNA (961 features, 0 variable features) 2 layers present: counts, data 5 other assays present: RNA_normalized_5691a50e.04fc.48b8.a2b2.f1669dac802d_1, falsecode, RNA_normalized_93311689.1e46.4145.8bb9.75c7f5f30650_1, negprobes, RNA_normalized_e9aea3f2.fd3f.453d.958f.788a533128fd_1 6 dimensional reductions calculated: approximatepca_f2d8fa8c.3e9e.4b0b.bbf0.eda1cb33599f_1, approximatepca_7e5c9f9b.605a.4472.a4e6.ac3449425ac3_1, approximateumap_1f9c43e8.0788.4866.a4e0.15b431f38e8a_1, approximatepca_1ddc155d.f653.4de8.9b75.f35bf9a8b6e3_1, approximateumap_b0c884d1.6511.4e47.9dc1.5dfc8e8c88ad_1, approximateumap_ac74a13d.b80e.4e25.939b.b9ade88f3a94_1

Thank you very much for your insights.

pik0702 commented 4 months ago

did you figure it out?

hjbp0610 commented 4 months ago

With flat files downloaded from the platform, I could use the spatial image. The flat files include the information regarding location of each gene / fov. However, I still haven't figured out how to merge with the original H&E images.

On Wed, Apr 17, 2024 at 3:32 PM pik0702 @.***> wrote:

did you figure it out?

— Reply to this email directly, view it on GitHub https://github.com/satijalab/seurat/issues/8232#issuecomment-2060478283, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBWDWCHGZQHFIYHAUMZPQDY5YJRLAVCNFSM6AAAAABBFDA42CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRQGQ3TQMRYGM . You are receiving this because you authored the thread.Message ID: @.***>

pik0702 commented 4 months ago

I encountered several issues while using Seurat in R with flat files downloaded from Atomx. I experienced errors related to 'cell_id' while loading data with LoadNanostring (refer to issue https://github.com/satijalab/seurat/issues/8303). To resolve this, I had to remove the cell_id column from the expMat_file. Unfortunately, i think this resulted in the exclusion of all metadata from the analysis from seurat object. Additionally, I am facing problems with images from CellComposit folders; they appear as uniformly black, blank files of the same size. Have you experienced similar issues while working with Seurat? 2024-04-22 09 49 24 2024-04-22 09 51 29

hjbp0610 commented 4 months ago

As you mentioned, I also did remove one column, but it was 'cell'column, not cell_id. All the metadata was also successfully added to the resulting Seurat object.

On Mon, Apr 22, 2024 at 9:52 AM pik0702 @.***> wrote:

I encountered several issues while using Seurat in R with flat files downloaded from Atomx. I experienced errors related to 'cell_id' while loading data with LoadNanostring (refer to issue #8303 https://github.com/satijalab/seurat/issues/8303). To resolve this, I had to remove the cell_id column from the expMat_file. Unfortunately, i think this resulted in the exclusion of all metadata from the analysis from seurat object. Additionally, I am facing problems with images from CellComposit folders; they appear as uniformly black, blank files of the same size. Have you experienced similar issues while working with Seurat? 2024-04-22.09.49.24.jpg (view on web) https://github.com/satijalab/seurat/assets/150877193/c59b32f3-5a6d-4753-8a9b-a602968d9546 2024-04-22.09.51.29.jpg (view on web) https://github.com/satijalab/seurat/assets/150877193/a702b5bc-c084-4e22-bedc-fac0c206bd32

— Reply to this email directly, view it on GitHub https://github.com/satijalab/seurat/issues/8232#issuecomment-2068298669, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBWDWF2CAWNL2D4YOCSGOTY6RNMFAVCNFSM6AAAAABBFDA42CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRYGI4TQNRWHE . You are receiving this because you authored the thread.Message ID: @.***>

pik0702 commented 4 months ago

Oh, that was a typo; I also removed the 'cell' column, not 'cell_id', which contained entries like 'c_1_1_1'. You mentioned that all the metadata was successfully added to your Seurat object, which surprised me since mine only had 'nFeature' and 'nCounter' information in 'seuratObject@meta.data' from 'loadNanostring. Compared to the Seurat object provided by atomx, which has many metadata, I thought that removing the cell information might disrupt the matching metadata. Did you start with the flat files, such as a_fov_position_file, a_expMat_file, and a_meta_file, as well as the cell composite and cell overlay files, right?

image

hjbp0610 commented 4 months ago

I'm sorry, but I did the initial analysis a while ago. I don't exactly remember what metadata was loaded (maybe only nFeature and nCount at first). But at least, there were not much of error for downstream analysis.

On Mon, Apr 22, 2024 at 1:35 PM pik0702 @.***> wrote:

Oh, that was a typo; I also removed the 'cell' column, not 'cell_id', which contained entries like 'c_1_1_1'. You mentioned that all the metadata was successfully added to your Seurat object, which surprised me since mine only had 'nFeature' and 'nCounter' information in @.***' from 'loadNanostring. Compared to the Seurat object provided by atomx, which has many metadata, I thought that removing the cell information might disrupt the matching metadata. Did you start with the flat files, such as a_fov_position_file, a_expMat_file, and a_meta_file, as well as the cell composite and cell overlay files, right?

image.png (view on web) https://github.com/satijalab/seurat/assets/150877193/d9b0e368-daf7-466e-9395-746ef220b68a

— Reply to this email directly, view it on GitHub https://github.com/satijalab/seurat/issues/8232#issuecomment-2068471093, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBWDWCY6F4H754NYGKTNWTY6SHPTAVCNFSM6AAAAABBFDA42CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRYGQ3TCMBZGM . You are receiving this because you authored the thread.Message ID: @.***>

Gesmira commented 2 months ago

Hi @hjbp0610 ,

Thank you for reaching out! We’re always grateful when folks take the time to post issues and help make Seurat better 🙂

Unfortunately, with the details provided, we cannot reproduce your issue. To help us better understand and resolve this issue, please ensure that you provide the following information when reporting a bug:

  1. Describe your issue:

    • A clear and concise description of what the bug is — avoid just pasting in the error message.
  2. Reproducing Code Example:

    • Provide a minimal reproducible example that demonstrates the issue.
  3. Error Message:

    • If any, paste the full error message (starting from line Traceback) in a code block.
    • If no error is raised, consider writing a simple test case that explicitly raises an error if the
  4. System Information:

    • Run sessionInfo() and paste the result in a code block.

Once you’ve gathered these details we will be more than happy to help you resolve the problem.

AlbertoFabbri93 commented 2 months ago

I think the question here is how to plot a ImageDimPlot using the immunofluorescence images from AtoMx