STOmics / Stereopy

A toolkit of spatial transcriptomic analysis.
MIT License
184 stars 64 forks source link

Convert the data from bin100 to cellbin resolution #307

Closed Yungong1 closed 1 month ago

Yungong1 commented 1 month ago

Hi,

I am currently working on the Stereo-seq data of mouse brain samples. l need first to use 100 bin size for structure and are identification and then perform further analysis at cellbin resolution in a specific region identified by 100 bin size. I am wondering if there is any way to achieve this.

Thanks so much for your help!

tanliwei-coder commented 1 month ago

Do you mean you want to first do annotation on a bin-size 100 data and then convert it to a cell-bin to do further analysis?

Yungong1 commented 1 month ago

Yes! Since I first select the region of interest based on the bin-size 100 and want to perform further analysis at single-nucleus resolution in that area, I need to convert the selected area from bin100 to cellbin data.

Thanks!

From: tanliwei @.> Date: Wednesday, July 17, 2024 at 10:53 PM To: STOmics/Stereopy @.> Cc: Gong, Yun @.>, Author @.> Subject: Re: [STOmics/Stereopy] Convert the data from bin100 to cellbin resolution (Issue #307) External Sender. Be aware of links, attachments and requests.

Do you mean you want to first do annotation on a bin-size 100 data and then convert it to a cell-bin to do further analysis?

— Reply to this email directly, view it on GitHubhttps://github.com/STOmics/Stereopy/issues/307#issuecomment-2235268005, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHJD5DX27JQYDR6HUVPTH2LZM43Z5AVCNFSM6AAAAABLA2TTSGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZVGI3DQMBQGU. You are receiving this because you authored the thread.Message ID: @.***>

tanliwei-coder commented 1 month ago

If you already have the cell-bin file (.gef or .gem) corresponding to the square-bin file you are using, you can use stereo.utils.cluster_bins_to_cellbins to map the annotations of square-bin to the corresponding cell-bin.

Example codes:

import stereo as st
from stereo.utils import cluster_bins_to_cellbins

data_bin = st.io.read_gef(bin_file, bin_type='bins', bin_size=100)

# do annotation on data_bin and name the annotation as 'annotation'

data_cellbin = st.io.read_gef(cellbin_file, bin_type='cell_bins')

cluster_bins_to_cellbins(data_bin, data_cellbin, 'annotation')

# do analysis on data_cellbin, the annotation mapped to data_cellbin is named as 'annotation_from_bin'
Yungong1 commented 1 month ago

If you already have the cell-bin file (.gef or .gem) corresponding to the square-bin file you are using, you can use stereo.utils.cluster_bins_to_cellbins to map the annotations of square-bin to the corresponding cell-bin.

Example codes:

import stereo as st
from stereo.utils import cluster_bins_to_cellbins

data_bin = st.io.read_gef(bin_file, bin_type='bins', bin_size=100)

# do annotation on data_bin and name the annotation as 'annotation'

data_cellbin = st.io.read_gef(cellbin_file, bin_type='cell_bins')

cluster_bins_to_cellbins(data_bin, data_cellbin, 'annotation')

# do analysis on data_cellbin, the annotation mapped to data_cellbin is named as 'annotation_from_bin'
Yungong1 commented 1 month ago

Got it!.

Thanks so much!

From: tanliwei @.> Date: Thursday, July 18, 2024 at 1:00 AM To: STOmics/Stereopy @.> Cc: Gong, Yun @.>, Author @.> Subject: Re: [STOmics/Stereopy] Convert the data from bin100 to cellbin resolution (Issue #307) External Sender. Be aware of links, attachments and requests.

If you already have the cell-bin file (.gef or .gem) corresponding to the square-bin file you are using, you can use stereo.utils.cluster_bins_to_cellbinshttps://stereopy.readthedocs.io/en/latest/content/stereo.utils.cluster_bins_to_cellbins.html to map the annotations of square-bin to the corresponding cell-bin.

— Reply to this email directly, view it on GitHubhttps://github.com/STOmics/Stereopy/issues/307#issuecomment-2235678402, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHJD5DTJR5YJNSSVACUTUUTZM5KYTAVCNFSM6AAAAABLA2TTSGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZVGY3TQNBQGI. You are receiving this because you authored the thread.Message ID: @.***>