snakemake-workflows / docs

Documentation of the Snakemake-Workflows project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tutorial does not create bam indices

splaisan opened this issue · comments

I deleted the two results folders and re-ran the full script but the bam's do not get indexed
What I am missing?
Thanks

rule bwa_map:
    input:
        "data/genome.fa",
        "data/samples/{sample}.fastq"
    output:
        "mapped_reads/{sample}.bam"
    shell:
        "bwa mem {input} | samtools view -Sb - > {output}"

rule samtools_sort:
    input:
        "mapped_reads/{sample}.bam"
    output:
        "sorted_reads/{sample}.bam"
    shell:
        "samtools sort -T sorted_reads/{sample} "
        "-O bam {input} > {output}"

rule samtools_index:
    input:
        "sorted_reads/{sample}.bam"
    output:
        "sorted_reads/{sample}.bam.bai"
    shell:
        "samtools index {input}"

> snakemake sorted_reads/{A,B}.bam

Building DAG of jobs...
Using shell: /bin/bash
Provided cores: 1
Rules claiming more threads will be scaled down.
Job counts:
	count	jobs
	2	samtools_sort
	2

[Mon Oct 22 11:40:17 2018]
rule samtools_sort:
    input: mapped_reads/B.bam
    output: sorted_reads/B.bam
    jobid: 0
    wildcards: sample=B

[Mon Oct 22 11:40:17 2018]
Finished job 0.
1 of 2 steps (50%) done

[Mon Oct 22 11:40:17 2018]
rule samtools_sort:
    input: mapped_reads/A.bam
    output: sorted_reads/A.bam
    jobid: 1
    wildcards: sample=A

[Mon Oct 22 11:40:17 2018]
Finished job 1.
2 of 2 steps (100%) done
Complete log: /data/NC_projects/snakemake-tutorial/.snakemake/log/2018-10-22T114017.262317.snakemake.log

# is leading to 
> ls -lah sorted_reads/
total 4.4M
drwxr-xr-x 2 u0002316 domain users 4.0K Oct 22 11:30 .
drwxr-xr-x 6 u0002316 domain users 4.0K Oct 22 11:39 ..
-rw-r--r-- 1 u0002316 domain users 2.2M Oct 22 11:30 A.bam
-rw-r--r-- 1 u0002316 domain users 2.2M Oct 22 11:30 B.bam

This issue tracker is for the Snakemake workflows project, which is auxilliary to Snakemake itself.

In the future, please report issues with Snakemake here: https://bitbucket.org/snakemake/snakemake/issues or ask on Stack overflow, like outlined on https://snakemake.readthedocs.io.

Regarding your question:

Snakemake does not create the index files because you are not requesting them as a target. Please go further through the tutorial as this is explained in the text.