-
Notifications
You must be signed in to change notification settings - Fork 21
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
[help wanted] FileNotFoundError: [Errno 2] No such file or directory for --sopa resolve baysor #161
Comments
Hello @KunHHE, This is an issue that should be fixed in the next release ( I'll let you know when it's released! |
Dear @quentinblampey, can I ask you the new version of sopa==2.0.0? Thank you!!! |
Hello @KunHHE, it's still not released, I'm waiting for the new version of SpatialData. It should arrive soon, hopefully this week |
Hi, @quentinblampey, is this a CLI-specific issue? If we switch to snakemake or API, is there no issue at all? Thank you so much! appy holidays! |
Hi @KunHHE, no it's not specific to the CLI, you'll also have the error using the API/pipeline. |
Sorry for the delay! |
Wonderful @quentinblampey, I will test it right away!
It still say "[INFO] (sopa._settings) Using dask backend It dies: KilledWorker: Attempted to run task 'write_patch_cells-a14416f5-18b3-4cd0-a3e8-684b9ae65f5a' on 4 different workers, but |
Update: I create a .py file running in the CLI: The segmentation.py file is: import sopa sopa.settings.dask_client_kwargs['n_workers'] = 4 Error: (sopa) C:\Users\hekun>python C:/Users/hekun/segmentation.py |
Hi @KunHHE, For the first example, in simply means that you have too many workers with too few memory. You can use a different machine, or, as you tried, use a different number of workers, as described below. For the second, you actually try to use the API, whose usage is described in this tutorial. In particular, the API uses directly the SpatialData object as an input, not paths. So, the command So, finally, it should look like so: import sopa
sopa.settings.parallelization_backend = "dask"
sopa.settings.dask_client_kwargs["n_workers"] = 4
sopa.segmentation.cellpose(sdata, ...) # add the other arguments
... # continue using the API |
Hi @quentinblampey, so "sopa.settings.parallelization_backend = "dask"; sopa.settings.dask_client_kwargs["n_workers"] = 4" cannot be done in the CLI, so API only? I want to use CLI only I think.... Can I ask you a stupid question, sorry, when saying "API usage", we can run sopa "API" using jupyter notebook? Thanks! |
Yes, using the API means you can use a Jupyter Notebook, among others.
It can be done using the CLI, but the command is different. For the CLI, you need to set an environment variable, as you did above. The thing is, this only sets dask, but you can't (yet) choose the number of workers via the CLI. I can add this, but, meanwhile, prefer using the API or you can also use a machine with more RAM per worker |
Thanks very much! @quentinblampey, sorry too many questions. I have to run Baysor using cellpose as prior, so want to double-check, I am using API now, do we still need the .toml for Baysor config? OR we just need te default setting using: For "resolve", both Cellpose and Baysor running in the sopa, it will always automatically run resolve NOW? |
You can provide a baysor config, as detailed in the tutorial, but you don't have to. If you don't provide a baysor config, it will be inferred. But if you already have a good config, it's easier to use. Yes, you don't need to run "resolve" using the API. |
Cool! If I run sopa.segmentation.tissue(sdata) prior to "sopa.make_image_patches(sdata, patch_width=6000, patch_overlap=150)" and "sopa.segmentation.cellpose", will te patches and segmentation run the "region_of_interest" region only? |
Yes, as described in the tutorial, it will only run inside the segmented tissue |
Thanks so much @quentinblampey, I was stopped by Baysor running. I can run it before using CLI. Now I am using the API. sopa.segmentation.baysor(sdata, min_area=20), error is "FileNotFoundError: Please install baysor and ensure that either I freshened the notebook and 'env', but still the sopa cannot find the baysor's executable. Thanks! |
Updates: figure it out using But I had issues:
AssertionError: Could not find the segmentation polygons file in C:\Users\hekun\Downloads\Slide1307.zarr.sopa_cache\transcript_patches\0 I can see patches in the folder of.zarr.sopa_cache\transcript_patches, but each folder of patches only have config.toml and transcript.csv, I did not see segmentation polygons file........... [INFO] (sopa.segmentation.methods._baysor) The Baysor config was not provided, using the following by default: 0%| | 0/9 [00:00<?, ?it/s] Reading transcript-segmentation outputs: 0%| | 0/9 [00:00<?, ?it/s]AssertionError Traceback (most recent call last) File ~\miniconda3\envs\sopa\lib\site-packages\sopa\segmentation\methods_baysor.py:79, in baysor(sdata, config, min_area, delete_cache, recover, force, scale, key_added, patch_index) File ~\miniconda3\envs\sopa\lib\site-packages\sopa\segmentation_transcripts.py:43, in resolve(sdata, patches_dirs, gene_column, min_area, key_added) File ~\miniconda3\envs\sopa\lib\site-packages\sopa\segmentation_transcripts.py:142, in _read_all_segmented_patches(patches_dirs, min_area) File ~\miniconda3\envs\sopa\lib\site-packages\sopa\segmentation_transcripts.py:143, in (.0) File ~\miniconda3\envs\sopa\lib\site-packages\sopa\segmentation_transcripts.py:93, in _read_one_segmented_patch(directory, min_area, min_vertices) File ~\miniconda3\envs\sopa\lib\site-packages\sopa\segmentation_transcripts.py:134, in _find_polygon_file(directory) AssertionError: Could not find the segmentation polygons file in C:\Users\hekun\Downloads\Slide1307.zarr.sopa_cache\transcript_patches\0 |
You can use Please, next time, can you try to send a way for me to reproduce your issue? I.e., using the toy dataset for instance. |
Hi @quentinblampey Thanks for suggestions, I did use Toy data for testing for Baysor, and it phenocopys the issue that there's no segmentation polygons file in the .sopa_cache\transcript_patches. I share the notebook for your reference via OneDrive link, hope it works! |
The notebook ran successfully for me. |
Yeah, I re-installed the BAYSOR dependencies. using CLI: Then in the CLI I test: 'baysor segfree -c C:/Users/hekun/sopa/workflow/config/merscope/merscope.toml C:/Users/hekun/Downloads/Slide1307/detected_transcripts.csv', looks it is working in the baysor itself? |
Thanks for trying this! And do you have the results of Baysor somewhere? |
Hi @quentinblampey. MY ALL the process is under windows.. Run baysor run -c C:/Users/hekun/sopa/workflow/config/merscope/merscope.toml C:/Users/hekun/Downloads/Slide1307.zarr/.sopa_cache/transcript_patches/0/transcripts.csv -o C:/Users/hekun/Downloads/Slide1307 I got outputs: https://esbc22-my.sharepoint.com/:u:/g/personal/kun_he_omapix_com/EUkDYiuT_LRPtcoAjI50XVUBU8M87fef_-sc7EnNimW4oA?e=ZgV4iy I did sopa[baysor] install, then installed julia 1.10 and open julia; I did not see error during those installation process. Then tried to go back to sopa notebook using Toy data, run baysor, it runs the first stage but failed for patches call: sopa.segmentation.baysor(sdata, 100%|████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 50.98it/s]AssertionError Traceback (most recent call last) File ~\miniconda3\envs\sopa\lib\site-packages\sopa\segmentation\methods_baysor.py:76, in baysor(sdata, config, min_area, delete_cache, recover, force, scale, key_added, patch_index) AssertionError: Baysor failed on all patches |
Updates: I run the baysor patch-by-patch one by one manually in the CLI successfully using: In the API, after run :sopa.make_transcript_patches(sdata, |
Hi @quentinblampey, I tested using ubuntu, and it worked out. looks like there are some issue running in windows? |
Hi,
Dear community, I finished Baysor segmentation and tried to run --sopa resolve baysor C:/Users/hekun/Downloads/S3R1.zarr --gene-column genes; But an error showed up: FileNotFoundError: [Errno 2] No such file or directory:
'C:\Users\hekun\Downloads\S3R1.zarr\.sopa_cache\baysor_boundaries\0\segmentation_polygons.json'
I know there's one report in #152 report. Yes, I did notice the output for the JSON file is segmentation_polygons_2d, but not segmentation_polygons. I guess renaming all the patch folders won't help? Any suggestions?
Thanks very very much!
The text was updated successfully, but these errors were encountered: