epigen / dea_limma

A Snakemake workflow and MrBiomics module for performing and visualizing differential expression analyses (DEA) on NGS data powered by the R package limma.
https://epigen.github.io/dea_limma/
MIT License
23 stars 1 forks source link

Error in setwd(snakemake@scriptdir) : cannot change working directory #26

Closed bednarsky closed 3 weeks ago

bednarsky commented 1 month ago

Do you know this bug? Confused since it seems to be basic snakemake-R interaction stuff, but one of the rules worked..

use rule from ct_annotated_dea_limma as ct_annotated_dealimma


- here the error (note: I adapted paths etc for anonymization):
```bash
rule ct_annotated_dea_limma_volcanos:
    input: path/to/project/results/backup_demulti_old/first_batch_of_samples/differential_expression/dea_limma/normal____L2/results.csv
    output: path/to/project/results/backup_demulti_old/first_batch_of_samples/differential_expression/dea_limma/normal____L2/plots/volcano/ALL
    log: logs/rules/volcanos_normal____L2_ALL.log
    jobid: 0
    reason: Forced execution
    wildcards: analysis=normal____L2, feature_list=ALL
    resources: mem_mb=32000, disk_mb=1000, disk_mib=954, tmpdir=/tmp, slurm_account=rb, slurm_partition=shortq, runtime=720, slurm_extra=--qos=shortq

Activating conda environment: ../../../../yet/another/path/user/snakemake_conda/5871cfde6a5cff7f9193590f581e3235_
During startup - Warning messages:
1: Setting LC_COLLATE failed, using "C"
2: Setting LC_TIME failed, using "C"
3: Setting LC_MESSAGES failed, using "C"
4: Setting LC_MONETARY failed, using "C"
5: Setting LC_PAPER failed, using "C"
6: Setting LC_MEASUREMENT failed, using "C"
Error in setwd(snakemake@scriptdir) : cannot change working directory
Calls: <Anonymous> -> setwd
Execution halted
[Sun Sep 29 09:19:25 2024]
Error in rule ct_annotated_dea_limma_volcanos:
    jobid: 0
    input: path/to/project/results/backup_demulti_old/first_batch_of_samples/differential_expression/dea_limma/normal____L2/results.csv
    output: path/to/project/results/backup_demulti_old/first_batch_of_samples/differential_expression/dea_limma/normal____L2/plots/volcano/ALL
    log: logs/rules/volcanos_normal____L2_ALL.log (check log file(s) for error details)
    conda-env: /yet/another/path/user/snakemake_conda/5871cfde6a5cff7f9193590f581e3235_

RuleException:
CalledProcessError in file https://raw.githubusercontent.com/epigen/dea_limma/v1.0.3/workflow/rules/visualize.smk, line 29:
Command 'source /yet/another/path/user/miniconda3/bin/activate '/yet/another/path/user/snakemake_conda/5871cfde6a5cff7f9193590f581e3235_'; se
t -eo pipefail; Rscript --vanilla path/to/project/.snakemake/scripts/tmp_77ra6nc.volcanos.R' returned non-zero exit status 1.
  File "https://raw.githubusercontent.com/epigen/dea_limma/v1.0.3/workflow/rules/visualize.smk", line 29, in __rule_volcanos
  File "/yet/another/path/user/miniconda3/envs/snakemake7_32/lib/python3.9/concurrent/futures/thread.py", line 58, in run
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
srun: error: d019: task 0: Exited with exit code 1
[Sun Sep 29 09:19:28 2024]
Error in rule ct_annotated_dea_limma_volcanos:
    jobid: 0
    input: path/to/project/results/backup_demulti_old/first_batch_of_samples/differential_expression/dea_limma/normal____L2/resul
ts.csv
    output: path/to/project/results/backup_demulti_old/first_batch_of_samples/differential_expression/dea_limma/normal____L2/plot
s/volcano/ALL
    log: logs/rules/volcanos_normal____L2_ALL.log (check log file(s) for error details)
    conda-env: /yet/another/path/user/snakemake_conda/5871cfde6a5cff7f9193590f581e3235_
bednarsky commented 1 month ago

Since I am using an outdated version of the workflow and the results.csv files are available, I would ignore this for now and check if after I migrate to snakemake 8 the issue persists

sreichl commented 1 month ago

Yes, this known when using the github() directive to load the module and the scripts load themselves other scripts e.g., utils.R or tools.py. Easy resolved by having a local dea_limma copy and not using github(), but very interesting if resolved in Snakemake 8. https://github.com/snakemake/snakemake/issues/2205 https://github.com/snakemake/snakemake/issues/1632