From ee04ec22b24c8d380ef98f5cee677f4ff4730ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Schr=C3=B6der?= Date: Fri, 20 Sep 2024 11:36:41 +0200 Subject: [PATCH] fix: name of bamqc (#1464) ### Description The subcommand name was wrong in the description. Additionally add a region param fro target analyse. ### QC * [x] I confirm that: For all wrappers added by this PR, * there is a test case which covers any introduced changes, * `input:` and `output:` file paths in the resulting rule can be changed arbitrarily, * either the wrapper can only use a single core, or the example rule contains a `threads: x` statement with `x` being a reasonable default, * rule names in the test case are in [snake_case](https://en.wikipedia.org/wiki/Snake_case) and somehow tell what the rule is about or match the tools purpose or name (e.g., `map_reads` for a step that maps reads), * all `environment.yaml` specifications follow [the respective best practices](https://stackoverflow.com/a/64594513/2352071), * wherever possible, command line arguments are inferred and set automatically (e.g. based on file extensions in `input:` or `output:`), * all fields of the example rules in the `Snakefile`s and their entries are explained via comments (`input:`/`output:`/`params:` etc.), * `stderr` and/or `stdout` are logged correctly (`log:`), depending on the wrapped tool, * temporary files are either written to a unique hidden folder in the working directory, or (better) stored where the Python function `tempfile.gettempdir()` points to (see [here](https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir); this also means that using any Python `tempfile` default behavior works), * the `meta.yaml` contains a link to the documentation of the respective tool or command, * `Snakefile`s pass the linting (`snakemake --lint`), * `Snakefile`s are formatted with [snakefmt](https://github.com/snakemake/snakefmt), * Python wrapper scripts are formatted with [black](https://black.readthedocs.io). * Conda environments use a minimal amount of channels, in recommended ordering. E.g. for bioconda, use (conda-forge, bioconda, nodefaults, as conda-forge should have highest priority and defaults channels are usually not needed because most packages are in conda-forge nowadays). --------- Co-authored-by: Filipe G. Vieira <1151762+fgvieira@users.noreply.github.com> --- bio/qualimap/bamqc/meta.yaml | 2 +- bio/qualimap/bamqc/wrapper.py | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/bio/qualimap/bamqc/meta.yaml b/bio/qualimap/bamqc/meta.yaml index d3f77cf2cd..70ce4cd58a 100644 --- a/bio/qualimap/bamqc/meta.yaml +++ b/bio/qualimap/bamqc/meta.yaml @@ -1,4 +1,4 @@ -name: qualimap rnaseq +name: qualimap bamqc description: | Run qualimap bamqc to create a QC report for aligned NGS data data. It can be used for WGS, WES, RNA, ChIP-Seq, etc. diff --git a/bio/qualimap/bamqc/wrapper.py b/bio/qualimap/bamqc/wrapper.py index ebd49d19b0..6c41fcb50b 100644 --- a/bio/qualimap/bamqc/wrapper.py +++ b/bio/qualimap/bamqc/wrapper.py @@ -1,4 +1,4 @@ -__author__ = "Fritjof Lammers" +__author__ = "Fritjof Lammers, Christopher Schröder" __copyright__ = "Copyright 2022, Fritjof Lammers" __email__ = "f.lammers@dkfz.de" @@ -6,12 +6,14 @@ import os - from snakemake.shell import shell from snakemake_wrapper_utils.java import get_java_opts -java_opts = get_java_opts(snakemake) +extra = snakemake.params.get("extra", "") +log = snakemake.log_fmt_shell(stdout=True, stderr=True) +# Set JAVA options +java_opts = get_java_opts(snakemake) if java_opts: java_opts_str = f'JAVA_OPTS="{java_opts}"' else: @@ -21,11 +23,15 @@ if os.environ.get("DISPLAY"): del os.environ["DISPLAY"] -extra = snakemake.params.get("extra", "") -log = snakemake.log_fmt_shell(stdout=True, stderr=True) +if target := snakemake.input.get("target", ""): + target = f"--feature-file {target}" + shell( - "{java_opts_str} qualimap bamqc {extra} " - "-bam {snakemake.input.bam} " - "-outdir {snakemake.output} " - "{log}" + "{java_opts_str} qualimap bamqc" + " -nt {snakemake.threads}" + " -bam {snakemake.input.bam}" + " {target}" + " {extra}" + " -outdir {snakemake.output}" + " {log}" )