.. _`bio/snp-mutator`: SNP-MUTATOR =========== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/snp-mutator?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/snp-mutator Generate mutated sequence files from a reference genome. Example ------- This wrapper can be used in the following way: .. code-block:: python 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: "v3.0.1/bio/snp-mutator" Note that input, output and log file paths can be chosen freely. When running with .. code-block:: bash snakemake --use-conda the software dependencies will be automatically deployed into an isolated environment before execution. Software dependencies --------------------- * ``snp-mutator=1.2.0`` Authors ------- * Michael Hall Code ---- .. code-block:: python """Snakemake wrapper for SNP Mutator.""" __author__ = "Michael Hall" __copyright__ = "Copyright 2019, Michael Hall" __email__ = "mbhall88@gmail.com" __license__ = "MIT" from snakemake.shell import shell from pathlib import Path # Placeholder for optional parameters extra = snakemake.params.get("extra", "") num_simulations = snakemake.params.get("num_simulations", 100) fasta_outdir = Path(snakemake.output.sequences[0]).absolute().parent # 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} " "-F {fasta_outdir} " "{snakemake.input} {log} " ) .. |nl| raw:: html