我正在运行带有--use-conda
选项的Snakemake。Snakemake成功地创造了环境,其中应该包括pysam。我能够手动激活这个创建的环境,并在其中运行我的脚本split_strands.py
,它导入模块pysam,没有任何问题。然而,当运行Snakemake管道时,我得到以下错误日志:
Activating conda environment: /projects/ps-yeolab3/ekofman/sc_STAMP_pipeline/STAMP/workflow/.snakemake/conda/7c375b6b
/projects/ps-yeolab3/ekofman/sc_STAMP_pipeline/STAMP/workflow/scripts/split_strands.py:166: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if args.output_fwd_bam is not '-':
/projects/ps-yeolab3/ekofman/sc_STAMP_pipeline/STAMP/workflow/scripts/split_strands.py:171: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if args.output_rev_bam is not '-':
Traceback (most recent call last):
File "/projects/ps-yeolab3/ekofman/sc_STAMP_pipeline/STAMP/workflow/scripts/split_strands.py", line 20, in <module>
import pysam
ModuleNotFoundError: No module named 'pysam'
[Mon Mar 29 16:41:06 2021]
Error in rule split_strands:
jobid: 0
output: 1_split_strands/TWA1_possorted_genome_bam_MD-GTCGCGACACGAGGTA-1.bam.fwd.bam, 1_split_strands/TWA1_possorted_genome_bam_MD-GTCGCGACACGAGGTA-1.bam.rev.bam
conda-env: /projects/ps-yeolab3/ekofman/sc_STAMP_pipeline/STAMP/workflow/.snakemake/conda/7c375b6b
shell:
python scripts/split_strands.py -i /projects/ps-yeolab3/ekofman/sc_STAMP_pipeline/STAMP/workflow/inputs/TWA1_possorted_genome_bam_MD-GTCGCGACACGAGGTA-1.bam -f 1_split_strands/TWA1_possorted_genome_bam_MD-GTCGCGACACGAGGTA-1.bam.fwd.bam -r 1_split_strands/TWA1_possorted_genome_bam_MD-GTCGCGACACGAGGTA-1.bam.rev.bam
(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
Nodes: tscc-1-37
正如你所看到的,尽管它说它是";激活conda环境";,这似乎不是真的,因为随后没有找到模块"pysam",我已经验证了在手动激活时会找到它。
规则是这样指定的:
rule split_strands:
input:
input_bam=config["samples_path"]+"{sample}",
index=config["samples_path"]+"{sample}.bai"
output:
output_fwd="1_split_strands/{sample}.fwd.bam",
output_rev="1_split_strands/{sample}.rev.bam"
conda:
"envs/python2.7.yaml"
shell:
"""
python scripts/split_strands.py -i {input.input_bam} -f {output.output_fwd} -r {output.output_rev}
"""
我已经验证了散列7c375b6b对应于python2.7.yaml.中指定的适当env
有什么想法吗?我的规则正在集群中运行,并通过qsub命令提交。
事实证明,新版本的snakemake6.0.0+一定有一些问题。我用了Snake 5.8.2,一切都很好。不确定引擎盖下到底发生了什么,但似乎与这个问题完全相同:https://github.com/snakemake/snakemake/issues/883