'Snakemake only execut the first rule of the rulefile

I'm trying to run a snakemake pipeline. It works but only for the first rule which is merged_fastp. Then, the script is still running but doesn't do anything else. I have to run again the script if I want the next step to be done (the jellyfish_process rule). I have no idea why the script is not completely executed. Any help would be appreciated. Here is my snakefile:

#!/usr/bin/env python
from snakemake.shell import shell
from os.path import join
shell.executable("/bin/bash")
#set the workdir
workdir:config["workdir"]
datadir=config["datadir"]

SAMPLES, = glob_wildcards(join(datadir, "{sample}_R1_fastp.fastq.gz"))

PATTERN_R1 = '{sample}_R1_fastp.fastq.gz'
PATTERN_R2 = '{sample}_R2_fastp.fastq.gz'

#All
rule all:
  input:
    expand("GenomeScope/{sample}_histo_jellyfish.histo", sample=SAMPLES),
    expand("GenomeScope/{sample}_plot.pdf", sample=SAMPLES),
    expand("GenomeScope/{sample}_plot.log.pdf", sample=SAMPLES),
    expand("GenomeScope/{sample}_model.txt", sample=SAMPLES),
    expand("GenomeScope/{sample}_progress.txt", sample=SAMPLES),
    expand("GenomeScope/{sample}_summary.txt", sample=SAMPLES)

## K-mer process

rule merge_fastq:
  input:
    r1 = join(datadir, PATTERN_R1),
    r2 = join(datadir, PATTERN_R2)
  output:
    merge_fastq="GenomeScope/{sample}_merge_fastp.fastq"
  message:
    "Merge fastq : {wildcards.sample}"
  run:
    shell(
        "cat {input.r1} {input.r2} > GenomeScope/{wildcards.sample}_merge_fastp.fastq.gz && "
        "gzip -d GenomeScope/{wildcards.sample}_merge_fastp.fastq.gz"
        )
rule jellyfish_process:
  input:
    merge_fastq="GenomeScope/{sample}_merge_fastp.fastq"
  output:
    reads_jellyfish="GenomeScope/{sample}_reads_jellyfish"
  message: 
    "Jellyfish processing - Counting k-mer : {wildcards.sample}"
  run:
    shell(
        ". /appli/bioinfo/jellyfish/2.2.10/env.sh ; "
        "jellyfish "
        "count -C "
        "-m 21 "
        "-s 1000000 "
        "-t 30 "
        "{input.merge_fastq} "
        " -o {output.reads_jellyfish} "
        ". /appli/bioinfo/jellyfish/2.2.10/delenv.sh"
        )
rule jellyfish_histogram:
  input:
    reads_jellyfish="GenomeScope/{sample}_reads_jellyfish"
  output:
    histo_jellyfish="GenomeScope/{sample}_histo_jellyfish.histo"
  message:
    "Jellyfish processing - Exporting the histogram : {wildcards.sample}"
  run:
    shell(
      ". /appli/bioinfo/jellyfish/2.2.10/env.sh ; "
      "jellyfish "
      "histo "
      "-t 10 "
      "{input.reads_jellyfish} > {output.histo_jellyfish} && " 
      "rm GenomeScope/{wildcards.sample}_reads_jellyfish &&" 
      "rm GenomeScope/{wildcards.sample}_merge_fastp.fastq "
      ". /appli/bioinfo/jellyfish/2.2.10/delenv.sh"
      )
rule GenomeScope:
  input:
    histo_jellyfish="GenomeScope/{sample}_histo_jellyfish.histo"
  output:
    plot_genomescope="GenomeScope/{sample}_plot.pdf",
    model_genomescope="GenomeScope/{sample}_model.txt",
    plotlog_genomescope="GenomeScope/{sample}_plot.log.pdf",
    progress_genomescope="GenomeScope/{sample}_progress.txt",
    summary_genomescope="GenomeScope/{sample}_summary.txt"
  message:
    "GenomeScope processing - Fitting the model : {wildcards.sample}"
  run:
    shell(
      ". /appli/bioinfo/genomescope2/2.0/env.sh ; "
      "mv {input.histo_jellyfish} ~ "
      "module load R "
      "R --vanilla --slave --args "
      "{wildcards.sample}_histo_jellyfish.histo "
      "21 "
      "150 "
      "OutputGenomeScope "
      "10000 "
      "Summary "
      "{wildcards.sample} "
      "< ~/GenomeScope/genomescope_cluster.R "
      "mv OutputGenomeScope/model.txt {output.model_genomescope} && "
      "mv OutputGenomeScope/plot.log.pdf {output.plotlog_genomescope} && "
      "mv OutputGenomeScope/plot.pdf {output.plot_genomescope} && "
      "mv OutputGenomeScope/progress.txt {output.progress_genomescope} && "
      "mv OutputGenomeScope/summary.txt {output.summary_genomescope} && "
      "mv {wildcards.sample}_histo_jellyfish.histo fastp.fastq/{wildcards.species}/GenomeScope"
      ". /appli/bioinfo/genomescope2/2.0/delenv.sh"
      )


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source