.. _`bio/optitype`: OPTITYPE ======== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/optitype?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/optitype Precision 4-digit HLA-I-typing from NGS data based on integer linear programming. Use razers3 beforehand to generate input fastq files only mapping to HLA-regions. Please see https://github.com/FRED-2/OptiType Example ------- This wrapper can be used in the following way: .. code-block:: python rule optitype: input: # list of input reads reads=["reads/{sample}_1.fished.fastq", "reads/{sample}_2.fished.fastq"] output: pdf="optitype/{sample}_coverage_plot.pdf", tsv="optitype/{sample}_result.tsv", log: "logs/optitype/{sample}.log" params: # Type of sequencing data. Can be 'dna' or 'rna'. Default is 'dna'. sequencing_type="dna", # optiype config file, optional config="", # additional parameters extra="" wrapper: "v3.0.1/bio/optitype" 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 --------------------- * ``optitype=1.3.5`` Authors ------- * Jan Forster Code ---- .. code-block:: python __author__ = "Jan Forster, David Lähnemann" __copyright__ = "Copyright 2020, Jan Forster" __email__ = "j.forster@dkfz.de" __license__ = "MIT" import os from tempfile import TemporaryDirectory from snakemake.shell import shell extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) # get sequencing type seq_type = snakemake.params.get("sequencing_type", "dna") seq_type = "--{}".format(seq_type) # check if non-default config.ini is used config = snakemake.params.get("config", "") if any(config): config = "--config {}".format(config) with TemporaryDirectory() as tempdir: shell( "(OptiTypePipeline.py" " --input {snakemake.input.reads}" " --outdir {tempdir}" " --prefix tmp_prefix" " {seq_type}" " {config}" " {extra}; " " mv {tempdir}/tmp_prefix_coverage_plot.pdf {snakemake.output.pdf:q} ;" " mv {tempdir}/tmp_prefix_result.tsv {snakemake.output.tsv:q} )" " {log}" ) .. |nl| raw:: html