STOmics / Stereopy

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

how to subset slice? #177

Closed MariaRosariaNucera closed 9 months ago

MariaRosariaNucera commented 11 months ago

Hi, I have a question. If I want to cut my slice in more parts, for example to separate two samples or to cut a empty part, how do I proceed?

Thank you Maria

MariaRosariaNucera commented 11 months ago

I get this error after selecting the slice

ins.export_high_res_area(data_path2, 'p.cellbin.high_res.gef', cgef=True) processing selected 2 area selections not found, please choose a selection area

AttributeError Traceback (most recent call last) Cell In[46], line 5 2 data_path2='/group/neur6/stomics/' 3 #ins.export_high_res_area(data_path2, 'prova.gef', cgef=False) ----> 5 ins.export_high_res_area(data_path2, 'p.cellbin.high_res.gef', cgef=True)

File /group/neur6/singularity_imgs/.conda/envs/stereopy/lib/python3.8/site-packages/stereopy-0.13.0b1-py3.8.egg/stereo/plots/interact_plot/poly_selection.py:136, in PolySelection.export_high_res_area(self, origin_file_path, output_path, cgef) 126 def export_high_res_area(self, origin_file_path: str, output_path: str, cgef: bool = False) -> str: 127 """ 128 export selected area in high resolution 129 Args: (...) 134 output_path 135 """ --> 136 coors = self.get_selected_boundary_coors() 138 from gefpy.cgef_adjust_cy import CgefAdjust 139 cg = CgefAdjust()

File /group/neur6/singularity_imgs/.conda/envs/stereopy/lib/python3.8/site-packages/stereopy-0.13.0b1-py3.8.egg/stereo/plots/interact_plot/poly_selection.py:121, in PolySelection.get_selected_boundary_coors(self) 119 exp_matrix_data = self.selected_exp_data.position.tolist() 120 init = ConcaveHull(exp_matrix_data, 3) --> 121 concave_hull = init.calculate().tolist() 122 concave_hull = [int(i) for k in concave_hull for i in k] 123 self.list_poly_selection_exp_coors.append(concave_hull)

AttributeError: 'NoneType' object has no attribute 'tolist'

Zhenbin24 commented 9 months ago

Hello, It is recommended to refer to this article for examples: https://stereopy.readthedocs.io/en/latest/Tutorials/High_Resolution_Export.html

MariaRosariaNucera commented 9 months ago

thanks, I did it :)