I am trying to make a snakemake workflow for whatshap haplotype caller but I am struggling with MissingInputException errors. This is what I get:
Building DAG of jobs...
MissingInputException in line 9 of /srv/KLN/users/esv/KRISPS/whatshap/phased_illumina_FILT5/snakefile:
Missing input files for rule all:
saturna/saturna_phased_illumina_FILT5.vcf.gz
stratos/stratos_phased_illumina_FILT5.vcf.gz
ydun/ydun_phased_illumina_FILT5.vcf.gz
12NAE3/12NAE3_phased_illumina_FILT5.vcf.gz
verdi/verdi_phased_illumina_FILT5.vcf.gz
wotan/wotan_phased_illumina_FILT5.vcf.gz
avarna/avarna_phased_illumina_FILT5.vcf.gz
avenue/avenue_phased_illumina_FILT5.vcf.gz
seresta/seresta_phased_illumina_FILT5.vcf.gz
15NOH7/15NOH7_phased_illumina_FILT5.vcf.gz
If I remove "rule all" and try to produce a single file I get this error:
Building DAG of jobs...
MissingRuleException:
No rule to produce 12NAE3/12NAE3_phased_illumina_FILT5.vcf.gz (if you use input functions make sure that they don't raise unexpected exceptions).
What am I missing? I am new to snakemake so maybe (hopefully) it's just a basic mistake. Here is my code:
shell.prefix("module load whatshap/1.1-foss-2020b-Python-3.8.6; module load BCFtools/1.11-GCC-10.2.0; ")
reference = "/srv/KLN/users/esv/Reference/DM_v6/DM_1-3_516_R44_potato_genome_assembly.v6.1.fa"
samples= ['12NAE3', '15NOH7', 'avarna', 'avenue', 'Kuras', 'saturna', 'seresta', 'stratos', 'verdi', 'wotan', 'ydun']
chroms= ['chr01','chr02','chr03','chr04','chr05','chr06','chr07','chr08','chr09','chr10','chr11','chr12']
rule all:
input:
"12NAE3/12NAE3_phased_illumina_FILT5.vcf.gz",
"15NOH7/15NOH7_phased_illumina_FILT5.vcf.gz",
"avarna/avarna_phased_illumina_FILT5.vcf.gz",
"avenue/avenue_phased_illumina_FILT5.vcf.gz",
"Kuras/Kuras_phased_illumina_FILT5.vcf.gz",
"saturna/saturna_phased_illumina_FILT5.vcf.gz",
"seresta/seresta_phased_illumina_FILT5.vcf.gz",
"stratos/stratos_phased_illumina_FILT5.vcf.gz",
"verdi/verdi_phased_illumina_FILT5.vcf.gz",
"wotan/wotan_phased_illumina_FILT5.vcf.gz",
"ydun/ydun_phased_illumina_FILT5.vcf.gz"
rule HaplotypeCalling:
input:
reference = reference,
vcf = "/srv/KLN/users/esv/KRISPS/snakemake/2110_variantcalling/results/variants/filtered/FILT5/variants_FILT5_{chrom}.vcf",
bam = "/srv/KLN/users/esv/KRISPS/Data/Illumina/DM_v6/BAM/{sample}.bam"
output:
"temp/{{sample}}/{sample}_phased_illumina_FILT5_{chrom}.vcf"
params:
chroms = chroms
shell:
"whatshap polyphase --ploidy 4 -o {output} --reference {input.reference} {input.vcf} {input.bam} --sample {wildcards.sample} --chromosome {params.chroms}"
rule SplitVCF:
input:
"temp/{{sample}}/{sample}_phased_illumina_FILT5_{chrom}.vcf"
output:
"{{sample}}/{sample}_phased_illumina_FILT5_{chrom}.vcf"
shell:
"bcftools view -s {wildcards.sample} -o {output} {input}"
rule ConcatVCF:
input:
expand("{{sample}}/{sample}_phased_illumina_FILT5_{chrom}.vcf", sample=samples, chrom=chroms)
output:
"{{sample}}/{sample}_phased_illumina_FILT5.vcf"
shell:
"bcftools concat {input} -o {output}"
rule GZipVCF:
input:
"{{sample}}/{sample}_phased_illumina_FILT5.vcf"
output:
"{{sample}}/{sample}_phased_illumina_FILT5.vcf.gz"
shell:
"bgzip -c {input} > {output}"
Edit: the commands I expect for each sample are these, assuming that I only have two chromosomes (chr01 and chr02) (the example is for sample ydun):
#rule HaplotypeCalling
whatshap polyphase --ploidy 4 -o temp/ydun/ydun_phased_illumina_FILT5_chr01.vcf --reference /srv/KLN/users/esv/Reference/DM_v6/DM_1-3_516_R44_potato_genome_assembly.v6.1.fa /srv/KLN/users/esv/KRISPS/snakemake/2110_variantcalling/results/variants/filtered/FILT5/variants_FILT5_chr01.vcf /srv/KLN/users/esv/KRISPS/Data/Illumina/DM_v6/BAM/ydun.bam --sample ydun --chromosome chr01
whatshap polyphase --ploidy 4 -o temp/ydun/ydun_phased_illumina_FILT5_chr02.vcf --reference /srv/KLN/users/esv/Reference/DM_v6/DM_1-3_516_R44_potato_genome_assembly.v6.1.fa /srv/KLN/users/esv/KRISPS/snakemake/2110_variantcalling/results/variants/filtered/FILT5/variants_FILT5_chr02.vcf /srv/KLN/users/esv/KRISPS/Data/Illumina/DM_v6/BAM/ydun.bam --sample ydun --chromosome chr02
#rule SplitVCF
bcftools view -s ydun -o ydun/ydun_phased_illumina_FILT5_chr01.vcf temp/ydun/ydun_phased_illumina_FILT5_chr01.vcf
#rule ConcatVCF
bcftools concat ydun/ydun_phased_illumina_FILT5_chr01.vcf ydun/ydun_phased_illumina_FILT5_chr02.vcf -o ydun/ydun_phased_illumina_FILT5.vcf
#rule GZipVCF
bgzip -c ydun/ydun_phased_illumina_FILT5.vcf > ydun/ydun_phased_illumina_FILT5.vcf.gz