Back again with another snakemake query. This time I decided to port my read cleaning and alignment pipeline to snakemake. Repeating the steps from previous question and trying not to make any typo here, I'm now receiving this "error" while trying a dry run using snakemake snakemake -nr -s alignMake
:
Building DAG of jobs...
MissingRuleException:
No rule to produce snakemake (if you use input functions make sure that they don't raise unexpected exceptions).
Below is my snakefile:
import os
shell.executable("/bin/bash")
workdir: '/proj/uppstore2018136/publication/jupyterNotebooks'
pathToPEReads = 'raw_data/reads/BL6/totalRNA'
pathToSMReads = 'raw_data/reads/BL6/smallRNA'
pathToHISAT2index = 'indexes/hisat2/reference'
pathToBOWTIE2index = 'indexes/bowtie2/reference'
pathToTemp = 'temp/'
pathToBAM = 'processed_data/BAM'
readsPE, = glob_wildcards('raw_data/reads/BL6/totalRNA/{sample}_1.fastq.gz')
readsSE, = glob_wildcards('raw_data/reads/BL6/smallRNA/{sample}.fq.gz')
samToolsThreads = 6
rule all:
input:
expand('processed_data/BAM/{sample}.bam', sample=readsPE),
expand('processed_data/BAM/{sample}.bam', sample=readsSE)
rule trimgalorePE:
input:
fastq1 = pathToPEReads + '{sample}_1.fastq.gz',
fastq2 = pathToPEReads + '{sample}_2.fastq.gz'
output:
output1 = pathToTemp + '{sample}_1_val_1.fq.gz',
output2 = pathToTemp + '{sample}_2_val_2.fq.gz'
shell:
'''
module load bioinfo-tools
module load cutadapt
module load TrimGalore
trim_galore --quality 20 --paired --length 80 --illumina --stringency 2 --clip_R1 11 --clip_R2 11 -o {pathToTemp} --paired {input.fastq1} {input.fastq2}
'''
rule trimgaloreSEandDust:
input:
fastq = pathToSMReads + '{sample}.fq.gz',
output:
output = pathToTemp + '{sample}_trimmed.fq.gz',
shell:
'''
module load bioinfo-tools
module load cutadapt
module load TrimGalore
trim_galore --quality 20 --length 16 --max_length 32 --small_rna --fastqc --stringency 2 -o {pathToTemp} {input.fastq}
'''
rule align_hisat2:
input:
fastq1 = pathToTemp + '{sample}_1_val_1.fq.gz',
fastq2 = pathToTemp + '{sample}_2_val_2.fq.gz'
output:
output = 'processed_data/BAM/{sample}.bam'
threads: 10
shell:
'''
module load bioinfo-tools
module load HISAT2
module load samtools
hisat2 -q -p {threads} --no-discordant --no-mixed --rna-strandness RF --dta -x {pathToHISAT2index} -1 {input.fastq1} -2 {input.fastq2} | samtools sort -@ {samToolsThreads} -o {output}
'''
rule align_bowtie2:
input:
fastq = pathToTemp + '{sample}_trimmed.fq.gz'
output:
output = 'processed_data/BAM/{sample}.bam'
threads: 10
shell:
'''
module load bioinfo-tools
module load bowtie2
module load samtools
bowtie2 --no-unal --end-to-end -D 20 -R 3 -N 1 -L 20 -i S,1,0.50 -p {threads} -x {pathToBOWTIE2index} -U {fastq} | samtools sort -@ {samToolsThreads} -o {output}
'''
rule clean:
shell:
'''
rm temp/*
'''
I believe it is due snakemake being unable to find the first rule ? Maybe there is something wrong with parsing ? I tested the glob_wildcards
and expand
function independently and they appear to work properly.
Edit: Here is the directory tree:
.
├── citations
├── doc
├── genome
│ ├── genome.fa
│ └── Mus_musculus.GRCm38.94.gtf
├── indexes
│ ├── bowtie2
│ │ ├── reference.1.bt2
│ │ ├── reference.2.bt2
│ │ ├── reference.3.bt2
│ │ ├── reference.4.bt2
│ │ ├── reference.rev.1.bt2
│ │ └── reference.rev.2.bt2
│ └── hisat2
│ ├── reference.1.ht2
│ ├── reference.2.ht2
│ ├── reference.3.ht2
│ ├── reference.4.ht2
│ ├── reference.5.ht2
│ ├── reference.6.ht2
│ ├── reference.7.ht2
│ └── reference.8.ht2
├── LICENSE
├── notebooks
├── plots
├── processed_data
│ └── BAM
├── raw_data
│ └── reads
│ └── BL6
│ ├── smallRNA
│ │ ├── smBL6_1.fq.gz
│ │ ├── smBL6_2.fq.gz
│ │ └── smBL6_3.fq.gz
│ └── totalRNA
│ ├── EKIxxxx012_1.fastq.gz
│ ├── EKIxxxx012_2.fastq.gz
│ ├── EKIxxxx013_1.fastq.gz
│ ├── EKIxxxx013_2.fastq.gz
│ ├── EKIxxxx014_1.fastq.gz
│ ├── EKIxxxx014_2.fastq.gz
│ ├── ESSxxxx077_1.fastq.gz
│ └── ESSxxxx077_2.fastq.gz
├── README.md
├── recipes
│ ├── alignMake
│ ├── cluster.json
│ ├── indexMake
│ ├── indexMakeScript.out
│ └── indexMakeScript.sh
├── results
├── scripts
├── slurmLogs
│ ├── slurm-6575541.out
│ ├── slurm-6575543.out
│ ├── slurm-6575815.out
│ └── slurm-6580867.out
├── source
└── temp
clean
is never executed unless your run snakemake assnakemake [opts] clean
. If you want to clean up stuff on completion, maybe look at the onsuccess and similar handlers. Also consider the temp flag... $\endgroup$