SAMTOOLS INDEX¶
Index bam file with samtools. For more information see SAMtools documentation.
URL:
Example¶
This wrapper can be used in the following way:
rule samtools_index:
input:
"mapped/{sample}.sorted.bam"
output:
"mapped/{sample}.sorted.bam.bai"
log:
"logs/samtools_index/{sample}.log"
params:
"" # optional params string
threads: # Samtools takes additional threads through its option -@
4 # This value - 1 will be sent to -@
wrapper:
"v0.80.1/bio/samtools/index"
Note that input, output and log file paths can be chosen freely.
When running with
snakemake --use-conda
the software dependencies will be automatically deployed into an isolated environment before execution.
Software dependencies¶
samtools==1.10
Authors¶
- Johannes Köster
Code¶
__author__ = "Johannes Köster"
__copyright__ = "Copyright 2016, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"
from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
# Samtools takes additional threads through its option -@
# One thread for samtools merge
# Other threads are *additional* threads passed to the '-@' argument
threads = "" if snakemake.threads <= 1 else " -@ {} ".format(snakemake.threads - 1)
shell(
"samtools index {threads} {snakemake.params} {snakemake.input[0]} {snakemake.output[0]} {log}"
)