Snakemake无法识别规则

问题描述 投票:0回答:1

我正在用Snakemake编写管道,程序无法识别规则串。我找不到我在做错什么。我已经运行过fastp和star规则,这个问题特定于严格规则。

include:
'config.py'

rule all:
    input:
        expand(FASTP_DIR + "{sample}R{read_no}.fastq",sample=SAMPLES ,read_no=['1', '2']), #fastp       
        expand(STAR_DIR + STAR_DIR + "output/{sample}/{sample}Aligned.sortedByCoord.out.bam",sample=SAMPLES), #STAR
        expand(STRINGTIE_DIR + "/{sample}/{sample}Aligned.sortedByCoord.out.gtf", sample=SAMPLES),
        GTF_DIR + "path_samplesGTF.txt"

rule fastp:
    input:
        R1= DATA_DIR + "{sample}R1_001.fastq.gz",
        R2= DATA_DIR + "{sample}R2_001.fastq.gz"
    output:
        R1out= FASTP_DIR + "{sample}R1.fastq",
        R2out= FASTP_DIR + "{sample}R2.fastq"
    params:
        data_dir = DATA_DIR,
        name_sample = "{sample}"
    log: FASTP_LOG + "{sample}.html"
    message: "Executando o programa FASTP"
    run:
        shell('fastp -i {input.R1} -I {input.R2} -o {output.R1out} -O {output.R2out} \
    -h {log} -j {log}')
    shell("find {params.data_dir} -type f -name '{params.name_sample}*' -delete ")

rule star:
    input:
        idx_star = IDX_DIR,
        R1 = FASTP_DIR + "{sample}R1.fastq",
        R2 = FASTP_DIR + "{sample}R2.fastq",
        parameters = "parameters.txt",

    params:
        outdir = STAR_DIR + "output/{sample}/{sample}",
        star_dir = STAR_DIR,
        star_sample = '{sample}'
    # threads: 18
    output:
        out = STAR_DIR + "output/{sample}/{sample}Aligned.sortedByCoord.out.bam"
        #run_time = STAR + "log/star_run.time"
    #  log: STAR_LOG
    # benchmark: BENCHMARK + "star/{sample_star}"
    run:
        shell("STAR --runThreadN 12 --genomeDir {input.idx_star} \
        --readFilesIn {input.R1} {input.R2} --outFileNamePrefix {params.outdir}\
        --parametersFiles {input.parameters} \
        --quantMode TranscriptomeSAM GeneCounts \
        --genomeChrBinNbits 12")
        # shell("find {params.star_dir} -type f ! -name 
'{params.star_sample}Aligned.sortedByCoord.out.bam' -delete")

rule stringtie:
    input:
        star_output = STAR_DIR + "output/{sample}/{sample}Aligned.sortedByCoord.out.bam"
    output:
        stringtie_output = STRINGTIE_DIR + "/{sample}/{sample}Aligned.sortedByCoord.out.gtf"
    run:
        shell("stringtie {input.star_output} -o {output.stringtie_output} \
        -v -p 12 ")

rule grep_gtf:
    input:
        list_gtf = STRINGTIE_DIR
    output:
        paths = GTF_DIR + "path_samplesGTF.txt"
    shell:
        "find {input.list_gtf} | grep .gtf > {output.paths}"

这是我通过空运行选项获得的输出(标志-n)

Building DAG of jobs...
Job counts:
    count   jobs
    1   all
    1   grep_gtf
    2

[Fri Apr 17 15:59:24 2020]
rule grep_gtf:
    input: /homelocal/boralli/workdir/pipeline_v4/STRINGTIE/
    output: /homelocal/boralli/workdir/pipeline_v4/GTF/path_samplesGTF.txt
    jobid: 1

find /homelocal/boralli/workdir/pipeline_v4/STRINGTIE/ | grep .gtf > 
/homelocal/boralli/workdir/pipeline_v4/GTF/path_samplesGTF.txt

[Fri Apr 17 15:59:24 2020]
localrule all:
    input: /homelocal/boralli/workdir/pipeline_v4/GTF/path_samplesGTF.txt
    jobid: 0

Job counts:
    count   jobs
    1   all
    1   grep_gtf
    2
This was a dry-run (flag -n). The order of jobs does not reflect the order of execution.

我真的不知道发生了什么。之前使用过相同的管道。

bioinformatics snakemake
1个回答
0
投票

您将目录指定为规则stringtie的输入。由于该目录可能已经存在,因此该规则无需再次执行。

使用目录作为输入不是一个好主意。如果在执行规则stringtie之前需要规则grep_gtf的输出,我建议您指定规则stringtie的输出文件作为规则grep_gtf的输入。

因此您的规则grep_gtf应该类似于:

    rule grep_gtf:
        input:
            expand(STRINGTIE_DIR + "/{sample}/{sample}Aligned.sortedByCoord.out.gtf", sample=SAMPLES)
        output:
            paths = GTF_DIR + "path_samplesGTF.txt"
        shell:
            "find {STRINGTIE_DIR} | grep .gtf > {output.paths}"
© www.soinside.com 2019 - 2024. All rights reserved.