Snakemake“ X秒后丢失文件”错误

时间:2019-12-11 14:16:17

标签: snakemake

每次尝试运行snakemake脚本时,都会出现以下错误:

Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cluster nodes: 99
Job counts:
        count   jobs
        1       all
        1       antiSMASH
        1       pear
        1       prodigal
        4

[Wed Dec 11 14:59:43 2019]
rule pear:
    input: Unmap_41_1.fastq, Unmap_41_2.fastq
    output: merged_reads/Unmap_41.fastq
    jobid: 3
    wildcards: sample=Unmap_41, extension=fastq

Submitted job 3 with external jobid 'Submitted batch job 4572437'.
Waiting at most 120 seconds for missing files.
MissingOutputException in line 14 of /faststorage/project/ABR/scripts/antismash.smk:
Missing files after 120 seconds:
merged_reads/Unmap_41.fastq
This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait.
Job failed, going on with independent jobs.
Exiting because a job execution failed. Look above for error message

第一个规则似乎没有执行,但是我不确定为什么从所有语法中我都会看到它是正确的。有人有什么建议吗?

snakefile如下:

#!/miniconda/bin/python

workdir: config["path_to_files"]
wildcard_constraints:
    separator = config["separator"],
    extension = config["file_extension"],
    sample = '|' .join(config["samples"])

rule all:
    input:
        expand("antismash-output/{sample}/{sample}.txt", sample = config["samples"])

# merging the paired end reads (either fasta or fastq) as prodigal only takes single end reads
rule pear:
    input:
        forward = f"{{sample}}{config['separator']}1.{{extension}}",
        reverse = f"{{sample}}{config['separator']}2.{{extension}}"

    output:
        "merged_reads/{sample}.{extension}"

    #conda:
        #"/home/lamma/env-export/antismash.yaml"

    run:
        shell("set +u")
        shell("source ~/miniconda3/etc/profile.d/conda.sh")
        shell("conda activate antismash")
        shell("pear -f {input.forward} -r {input.reverse} -o {output} -t 21")


# If single end then move them to merged_reads directory
rule move:
    input:
        "{sample}.{extension}"

    output:
        "merged_reads/{sample}.{extension}"

    shell:
        "cp {path}/{sample}.{extension} {path}/merged_reads/"

# Setting the rule order on the 3 above rules which should be treated equally and only one run.
ruleorder: pear > move
# annotating the metagenome with prodigal#. Can be done inside antiSMASH but prefer to do it out
rule prodigal:
    input:
        f"merged_reads/{{sample}}.{config['file_extension']}"

    output:
        gbk_files = "annotated_reads/{sample}.gbk",
        protein_files = "protein_reads/{sample}.faa"

    #conda:
        #"/home/lamma/env-export/antismash.yaml"

    run:
        shell("set +u")
        shell("source ~/miniconda3/etc/profile.d/conda.sh")
        shell("conda activate antismash")
        shell("prodigal -i {input} -o {output.gbk_files} -a {output.protein_files} -p meta")


# running antiSMASH on the annotated metagenome
rule antiSMASH:
    input:
        "annotated_reads/{sample}.gbk"

    output:
        touch("antismash-output/{sample}/{sample}.txt")

    #conda:
        #"/home/lamma/env-export/antismash.yaml"

    run:
        shell("set +u")
        shell("source ~/miniconda3/etc/profile.d/conda.sh")
        shell("conda activate antismash")
        shell("antismash --knownclusterblast --subclusterblast --full-hmmer --smcog --outputfolder antismash-output/{wildcards.sample}/ {input}")

此刻我仅在一个文件上运行管道,但是如果yaml文件具有证明,则它看起来像这样:

file_extension: fastq
path_to_files: /home/lamma/ABR/Each_reads
samples:
- Unmap_41
separator: _

我知道当您在snakemake中使用某些标志时可能会发生错误,但是我不相信我正在使用这些标志。提交来运行蛇文件的命令是:

snakemake --latency-wait 120 --rerun-incomplete --keep-going --jobs 99 --cluster-status 'python /home/lamma/ABR/scripts/slurm-status.py' --cluster 'sbatch  -t {cluster.time} --mem={cluster.mem} --cpus-per-task={cluster.c} --error={cluster.error}  --job-name={cluster.name} --output={cluster.output}' --cluster-config antismash-config.json --configfile yaml-config-files/antismash-on-rawMetagenome.yaml --snakefile antismash.smk

我尝试过-F标志来强制重新运行,但这似乎无济于事,增加--latency-wait数也是如此。任何帮助都将被申请:)

我认为这可能与在运行命令中调用conda环境的方式有关,但是将conda:选项与yaml文件一起使用会返回未找到版本的样式错误。

1 个答案:

答案 0 :(得分:0)

从我从梨documentation中读到的内容开始:

  

-o指定用作输出文件基础的名称。 PEAR输出四个文件。包含汇编读取的文件,带有   assembled.fastq扩展名,两个文件包含转发,响应。   反向,未汇编读取,扩展名为unassembled.forward.fastq,   分别unassembled.reverse.fastq,以及包含丢弃的文件   读取时使用了一个被丢弃的.fastq扩展名

因此,如果规则中定义的输出只是一个基础,建议您将其作为参数,并将输出的真实名称作为输出:

@testable import My-Awesome-App

我还没有测试过梨,所以不确定输出文件名到底是什么。