STOmics / SAW

GNU General Public License v3.0
119 stars 32 forks source link

Segmentation fault(core dumped) on tissueCut #81

Closed OswaldZhang closed 5 months ago

OswaldZhang commented 6 months ago

Hi, I'm using tissueCut to cut my own gef file, however, every time I try singularity exec /home/apps/SAW-6.0.0/SAW_06.0.0.sif tissueCut it always returns /usr/local/bin/tissueCut: line 1: 139646 Segmentation fault (core dumped) python3 /opt/saw_v6.0.0_software/pipeline/tissueCut/Tissuecut.pyc $*

I've no idea about this issue, this gef is 11G in size and my device has at least 200G mem to use.

Thanks for your timely reply!

Clouate commented 6 months ago

Hi, could you provide the complete run command and the error message?

OswaldZhang commented 6 months ago

Definitely! Thanks for the timely reply!! Here is the code I use to run tissueCut

singularity exec /home/apps/SAW-6.0.0/SAW_06.0.0.sif tissueCut -i RNAcombine.gef -o ./ --sn FF293712 -O Transcriptomics -d

And here is the error message tissueCut.log

I have no idea how to solve this. Thanks for the help!

Clouate commented 6 months ago

It seems that there is something wrong with your RNAcombine.gef file, or your operation on the gef file is not compatible with our software. It is recommended that you may update SAW to the latest version or try to use the tissue segmentation function of Stereopy https://stereopy.readthedocs.io/en/latest/Tutorials/Tissue_Segmentation.html

OswaldZhang commented 6 months ago

REALLY THANKS for your prompt reply! When using the stereopy, it returns the same output for me

image

And here is my code

src_gef_path = "./RNA.raw.combine.gef" dst_bgef_path = "./RNA.raw.combine.tissue_extraction.gef"

from stereo.tools.tissue_extraction import tissue_extraction_to_bgef from stereo.image.tissue_cut import RNATissueCut from stereo.image.tissue_cut import RNA

tissue_extraction_to_bgef( src_gef_path, dst_bgef_path, "./", src_type=RNA, rna_tissue_cut_bin_size=1 )

Also, since the gef file is manually convert by me from the gem, here is the code to generate my gef

generate bgef by gem

generate_bgef(input_file=gem_file, bgef_file=bgef_file, stromics=stromics, n_thread=30, bin_sizes=bin_sizes, region=region)

and it returns

image

Not sure what's going on here.

OswaldZhang commented 6 months ago

After careful investigation, I found it is caused by this function, https://github.com/STOmics/Stereopy/blob/2c59d95378221120fb2d1cd54de4a1dcb295f530/stereo/tools/tissue_extraction.py#L76C9-L76C86

And I manually redo it, here is my code

from gefpy.bgef_creater_cy import BgefCreater

src_gef_path = "./RNA.raw.combine.gef" dst_bgef_path = "./RNA.raw.combine.tissue_extraction.gef"

bc = BgefCreater() bc.create_bgef(src_gef_path, 1, "./RNA.raw.combine_tissue_cut.tif", dst_bgef_path) It returns

image

So I guess there is sth wrong with this function in my case

https://github.com/BGIResearch/gefpy/blob/main/gefpy/bgef_creater_cy.pyx

Still not sure what's going on here.

Clouate commented 6 months ago

Hi, I have checked your command. The reason was that the conversion of .gem to .gef changed the data type of the gene matrix in the .gef, which was different from the SN.raw.gef outputted by SAW pipeline and currently not supported for tissueCut. If you want to edit the gem file, we recommend that you could use the SN.tissue.gem, gene matrix under tissue area, outputted by SAW pipeline.

OswaldZhang commented 6 months ago

Thanks for your patient reply! So currently is there any way for me to convert my combined gem file to the proper gef file as input to tissueCut? The reason behind this is we have 2 different separate stereo-seq SN.tissue.gem files measured in one tissue section (one is more dense and the other is sparse). We want to do tissue segmentation in an unbiased manner( this is to say, the transcripts located in the more dense one may not contain the transcripts located in the sparse one).

Clouate commented 6 months ago

I'm sorry that I don't have a particularly good method. When due with Similar problems in the past, we used h5py to modify the data type of the matrix but only got a tif image of tissue segmentation. Maybe you could open an new issue at Stereopy, because SAW: tissueCut also based on Stereopy. https://github.com/STOmics/Stereopy/issues

OswaldZhang commented 6 months ago

Got it! Thanks for your reply! Let's see how the Stereopy developer replies to this issue.