Skip to content

Commit

Permalink
feat: add "qualimap bamqc" wrapper (#533)
Browse files Browse the repository at this point in the history
* first commit of bamqc wrapper

* first commit of bamqc wrapper

* remove annoation, not used for bamqc

* make clear what the output is

* state target in call

* use only minor version

* use snakemake wrapper utils for JAVA OPTS

* Update bio/qualimap/bamqc/meta.yaml

Co-authored-by: Filipe G. Vieira <fgarrettvieira@gmail.com>

* Removed URL and added extra

Co-authored-by: Fritjof Lammers <f.lammers@dkfz-heidelberg.de>
Co-authored-by: Filipe G. Vieira <fgarrettvieira@gmail.com>
  • Loading branch information
3 people committed Aug 16, 2022
1 parent 0486745 commit 3af38c8
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bio/qualimap/bamqc/environment.yaml
@@ -0,0 +1,7 @@
channels:
- bioconda
- conda-forge
- defaults
dependencies:
- qualimap =2.2
- snakemake-wrapper-utils =0.4
14 changes: 14 additions & 0 deletions bio/qualimap/bamqc/meta.yaml
@@ -0,0 +1,14 @@
name: qualimap rnaseq
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.
url: http://qualimap.conesalab.org/doc_html/analysis.html#bam-qc
authors:
- Fritjof Lammers
- Brett Copeland
input:
- BAM file of data aligned to genome
output:
- QC report in TXT format (genome_results.txt)
notes: |
* The `extra` param allows for additional program arguments.
14 changes: 14 additions & 0 deletions bio/qualimap/bamqc/test/Snakefile
@@ -0,0 +1,14 @@
rule qualimap:
input:
# BAM aligned, splicing-aware, to reference genome
bam="mapped/a.bam",
output:
directory("qc/a"),
log:
"logs/qualimap/bamqc/a.log",
# optional specification of memory usage of the JVM that snakemake will respect with global
# resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources)
# and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`:
# https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties
wrapper:
"master/bio/qualimap/bamqc"
Binary file added bio/qualimap/bamqc/test/mapped/a.bai
Binary file not shown.
Binary file added bio/qualimap/bamqc/test/mapped/a.bam
Binary file not shown.
31 changes: 31 additions & 0 deletions bio/qualimap/bamqc/wrapper.py
@@ -0,0 +1,31 @@
__author__ = "Fritjof Lammers"
__copyright__ = "Copyright 2022, Fritjof Lammers"
__email__ = "f.lammers@dkfz.de"

__license__ = "MIT"


import os

from snakemake.shell import shell
from snakemake_wrapper_utils.java import get_java_opts

java_opts = get_java_opts(snakemake)

if java_opts:
java_opts_str = f'JAVA_OPTS="{java_opts}"'
else:
java_opts_str = ""

# unset DISPLAY environment variable to avoid X11 error message issued by qualimap
if os.environ.get("DISPLAY"):
del os.environ["DISPLAY"]

extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
shell(
"{java_opts_str} qualimap bamqc {extra} "
"-bam {snakemake.input.bam} "
"-outdir {snakemake.output} "
"{log}"
)
6 changes: 6 additions & 0 deletions test.py
Expand Up @@ -4629,6 +4629,12 @@ def test_qualimaprnaseq():
["snakemake", "--cores", "1", "--use-conda", "-F"],
)

@skip_if_not_modified
def test_qualimapbamqc():
run(
"bio/qualimap/bamqc",
["snakemake", "--cores", "1", "qc/a", "--use-conda", "-F"],
)

@skip_if_not_modified
def test_collectrnaseqmetrics():
Expand Down

0 comments on commit 3af38c8

Please sign in to comment.