changeset 0:a6d048668f7f draft

planemo upload for repository https://github.com/refinery-platform/qualimap2 commit 88b5467f336ac3b6b5d3a6e824273a183e5184b6
author refinery-platform
date Mon, 30 Jul 2018 09:56:10 -0400
parents
children f36ed3bfcfe6
files qualimap_bamqc.py qualimap_bamqc.xml test-data/test.bam tool_dependencies.xml
diffstat 4 files changed, 107 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qualimap_bamqc.py	Mon Jul 30 09:56:10 2018 -0400
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+from __future__ import print_function
+import argparse
+import os
+from subprocess import check_call, CalledProcessError
+import shutil
+import sys
+
+QUALIMAP_OUPUT_DIR = "qualimap_results"
+
+
+def qualimap_bamqc(bam_filename, jv_mem_size):
+    qualimap_command = [
+        "qualimap", "bamqc",
+        "-bam " + bam_filename,
+        "-outdir " + QUALIMAP_OUPUT_DIR,
+        "--java-mem-size=" + jv_mem_size
+    ]
+
+    try:
+        check_call(qualimap_command)
+    except CalledProcessError:
+        print("Error running the qualimap bamqc", file=sys.stderr)
+
+
+def main():
+    parser = argparse.ArgumentParser(
+        description="Generate Bam Quality Statistics"
+    )
+    parser.add_argument('--input_file')
+    parser.add_argument('--out_dir')
+    parser.add_argument('--out_results')
+    parser.add_argument('--out_zip')
+    parser.add_argument('--java_mem_size')
+
+    args = parser.parse_args()
+
+    qualimap_bamqc(args.input_file, args.java_mem_size)
+
+    shutil.make_archive(
+        'raw_data_qualimapReport',
+        'zip',
+        os.path.join(QUALIMAP_OUPUT_DIR, 'raw_data_qualimapReport')
+    )
+
+    shutil.move("raw_data_qualimapReport.zip", args.out_zip)
+    shutil.move(
+        os.path.join(QUALIMAP_OUPUT_DIR, "genome_results.txt"),
+        args.out_results
+    )
+
+if __name__ == "__main__":
+    main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qualimap_bamqc.xml	Mon Jul 30 09:56:10 2018 -0400
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<tool id="qualimap_bamqc" name="QualiMap BamQC" version="2.2">
+    <description>Tool to to facilitate the quality control of alignment sequencing data and its derivatives like feature counts.</description>
+    <requirements>
+        <requirement type="package" version="2.2">qualimap</requirement>
+    </requirements>
+    <stdio>
+        <exit_code range=":-1" />
+        <exit_code range="1:" />
+    </stdio>
+    <command interpreter="python">
+        qualimap_bamqc.py
+            --input_file $input_realigned_bam_file
+            --out_results $genome_results
+            --out_zip $raw_data_qualimapReport
+            --java_mem_size $mem_size
+    </command>
+    <inputs>
+        <param name="input_realigned_bam_file" type="data" format="bam" label="Realigned BAM dataset" help="Specify realigned BAM dataset"/>
+        <param name="mem_size" type="text" value="8G" format="txt" label="Java memory size (default Gig)" help="Specify the size of memory to allocate. (Default 8 Gig)"/>
+    </inputs>
+    <outputs>
+        <data format="txt" name="genome_results" label="Qualimap BamQC Results for: ${input_realigned_bam_file}"></data>
+        <data format="zip" name="raw_data_qualimapReport" label="Qualimap Raw Data Results for: ${input_realigned_bam_file}"></data>
+    </outputs>
+   
+    <tests>
+        <test>
+          <param name="mem_size"  value="2G"></param>
+          <param name="input_realigned_bam_file" value="test.bam"></param>
+          <output name="genome_results">
+          	<assert_contents>
+              <has_text text="BamQC report" />
+            </assert_contents>
+          </output>
+          <output name="raw_data_qualimapReport" ftype="zip">
+            <assert_contents>
+              <has_text text="" />
+            </assert_contents>
+          </output>
+        </test>
+    </tests>
+    <help>
+        https://github.com/scottx611x/qualimap2
+    </help>
+    <citations>
+    </citations>
+</tool>
Binary file test-data/test.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Mon Jul 30 09:56:10 2018 -0400
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="qualimap" version="2.2">
+        <repository toolshed="http://testtoolshed.g2.bx.psu.edu" changeset_revision="21698ad1bfb1" name="package_qualimap_2_2" owner="sanbi-uwc" />
+    </package>
+</tool_dependency>
\ No newline at end of file