SNP-MUTATOR¶
Generate mutated sequence files from a reference genome.
Software dependencies¶
- snp-mutator ==1.0.0
Example¶
This wrapper can be used in the following way:
NUM_SIMULATIONS = 2
rule snpmutator:
input:
"{sample}.fa"
output:
vcf = "{sample}.mutated.vcf",
sequences = expand(
"{{sample}}_mutated_{simulation_number}.fasta",
simulation_number=range(1, NUM_SIMULATIONS + 1)
)
params:
num_simulations = NUM_SIMULATIONS,
extra = " ".join([
"--num-substitutions 2",
"--num-insertions 2",
"--num-deletions 0"
]),
log:
"logs/snp-mutator/test/{sample}.log"
wrapper:
"0.32.0/bio/snp-mutator"
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¶
- Michael Hall
Code¶
"""Snakemake wrapper for SNP Mutator."""
__author__ = "Michael Hall"
__copyright__ = "Copyright 2019, Michael Hall"
__email__ = "mbhall88@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
# Placeholder for optional parameters
extra = snakemake.params.get("extra", "")
num_simulations = snakemake.params.get("num_simulations", 100)
# Formats the log redrection string
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
# Executed shell command
shell(
"snpmutator {extra} "
"--num-simulations {num_simulations} "
"--vcf {snakemake.output.vcf} "
"{snakemake.input} {log} "
)