Skip to content

Commit

Permalink
fix: name of bamqc (#1464)
Browse files Browse the repository at this point in the history
<!-- Ensure that the PR title follows conventional commit style (<type>:
<description>)-->
<!-- Possible types are here:
https://github.com/commitizen/conventional-commit-types/blob/master/index.json
-->

### Description

The subcommand name was wrong in the description. Additionally add a
region param fro target analyse.

### QC
<!-- Make sure that you can tick the boxes below. -->

* [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 <[email protected]>
  • Loading branch information
christopher-schroeder and fgvieira committed Sep 20, 2024
1 parent 448a1cb commit ee04ec2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bio/qualimap/bamqc/meta.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
24 changes: 15 additions & 9 deletions bio/qualimap/bamqc/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
__author__ = "Fritjof Lammers"
__author__ = "Fritjof Lammers, Christopher Schröder"
__copyright__ = "Copyright 2022, Fritjof Lammers"
__email__ = "[email protected]"

__license__ = "MIT"


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:
Expand All @@ -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}"
)

0 comments on commit ee04ec2

Please sign in to comment.