Skip to content
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

snakemake executes wrong rule #84

Open
xiao233333 opened this issue Jul 3, 2024 · 1 comment
Open

snakemake executes wrong rule #84

xiao233333 opened this issue Jul 3, 2024 · 1 comment

Comments

@xiao233333
Copy link

Thanks for your effort in providing this amazing tool. I encountered an issue while running the Snakemake pipeline for Cellpose segmentation on Phenocycler data. Could you please help me figure out what I did wrong here? Basically, I use the SLURM job system and the following command:

snakemake --profile slurm --config data_path=./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.qptiff --configfile=config/phenocycler/base_20X.yaml

It works fine until the step sopa resolve cellpose.

    shell:
        
        
        sopa resolve cellpose ./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.zarr --patch-dir ./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.zarr/.sopa_cache/cellpose_boundaries
        
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
    cluster_jobid: Submitted batch job 9867213

Error executing rule resolve_cellpose on cluster (jobid: 2, external: Submitted batch job 9867213, jobscript: .snakemake/tmp.28g0oox_/snakejob.resolve_cellpose.2.sh). For error details see the cluster log and the log files of the involved rule(s).
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2024-07-02T180930.594385.snakemake.log

When I looked at the error file, it seems that it runs the sopa read again.

AssertionError: Zarr directory 
./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.zarr already exists. Sopa will not 
continue to avoid overwritting files.
[Tue Jul  2 20:32:19 2024]
Error in rule to_spatialdata:
    jobid: 2
    input: ./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.qptiff
    output: ./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.zarr/.zgroup
    conda-env: spatialdata
    shell:
        
        
        sopa read ./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.qptiff --sdata-path ./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.zarr --technology "phenocycler"
        
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
SpatialData object path set to default: ./A2303-0606_MMT-01A-S05_nm_20240214_Scan1.zarr
To change this behavior, provide `--config sdata_path=...` when running the snakemake pipeline

Obviously, it will throw an error as there is already a .zarr folder there. I also noticed that the .zgroup file seems to have been deleted. I'm not sure what happened there.

@quentinblampey
Copy link
Collaborator

Hello @xiao233333, thanks for reporting this. I already experienced this issue, but I don't really understand what is happening. I currently believe that it's a strange Snakemake issue, which triggers the right rule, but tries to execute the command of another rule. Also, for now, it only happened on a Slurm cluster.

I wasn't able to have a clean reproducible example. Actually it seems that this happens almost randomly (even though rarely)...

Can you try to clear the snakemake cache, then clear the .zarr directory, and re-run the pipeline from zero? Sorry for the inconvenience
If you have a reproducible example (for example using the toy dataset) I'll be happy to dive deeper!

@quentinblampey quentinblampey changed the title snakemake pipeline for Phenocycler qptiff data snakemake executes wrong rule Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants