SNPEFF¶
Annotate predicted effect of nucleotide changes with SnpEff
Software dependencies¶
- snpeff ==4.3.1t
Example¶
This wrapper can be used in the following way:
rule snpeff:
input:
"{sample}.vcf",
output:
vcf="snpeff/{sample}.vcf", # the main output file, required
stats="snpeff/{sample}.html", # summary statistics (in HTML), optional
csvstats="snpeff/{sample}.csv" # summary statistics in CSV, optional
log:
"logs/snpeff/{sample}.log"
params:
reference="ebola_zaire", # reference name (from `snpeff databases`)
extra="-Xmx4g" # optional parameters (e.g., max memory 4g)
wrapper:
"0.32.0/bio/snpeff"
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.
Authors¶
- Bradford Powell
Code¶
__author__ = "Bradford Powell"
__copyright__ = "Copyright 2018, Bradford Powell"
__email__ = "bpow@unc.edu"
__license__ = "BSD"
from snakemake.shell import shell
from os import path
import shutil
import tempfile
shell.executable("bash")
shell_command =("(snpEff {data_dir} {stats_opt} {csvstats_opt} {extra}"
" {snakemake.params.reference} {snakemake.input}"
" > {snakemake.output.vcf}) {log}")
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
extra = snakemake.params.get("extra", "")
data_dir = snakemake.params.get("data_dir", "")
if data_dir:
data_dir = '-dataDir "%s"'%data_dir
stats = snakemake.output.get("stats", "")
csvstats = snakemake.output.get("csvstats", "")
csvstats_opt = '' if not csvstats else '-csvStats {}'.format(csvstats)
stats_opt = '-noStats' if not stats else '-stats {}'.format(stats)
shell(shell_command)
#if stats:
# shutil.copy(path.join(stats_tempdir, 'stats'), stats)
#if genes:
# shutil.copy(path.join(stats_tempdir, 'stats.genes.txt'), genes)