Mercurial > repos > refinery-platform > qualimap2_bamqc
comparison qualimap_bamqc.py @ 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 | a2438e0f1bbf |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a6d048668f7f |
---|---|
1 #!/usr/bin/env python | |
2 from __future__ import print_function | |
3 import argparse | |
4 import os | |
5 from subprocess import check_call, CalledProcessError | |
6 import shutil | |
7 import sys | |
8 | |
9 QUALIMAP_OUPUT_DIR = "qualimap_results" | |
10 | |
11 | |
12 def qualimap_bamqc(bam_filename, jv_mem_size): | |
13 qualimap_command = [ | |
14 "qualimap", "bamqc", | |
15 "-bam " + bam_filename, | |
16 "-outdir " + QUALIMAP_OUPUT_DIR, | |
17 "--java-mem-size=" + jv_mem_size | |
18 ] | |
19 | |
20 try: | |
21 check_call(qualimap_command) | |
22 except CalledProcessError: | |
23 print("Error running the qualimap bamqc", file=sys.stderr) | |
24 | |
25 | |
26 def main(): | |
27 parser = argparse.ArgumentParser( | |
28 description="Generate Bam Quality Statistics" | |
29 ) | |
30 parser.add_argument('--input_file') | |
31 parser.add_argument('--out_dir') | |
32 parser.add_argument('--out_results') | |
33 parser.add_argument('--out_zip') | |
34 parser.add_argument('--java_mem_size') | |
35 | |
36 args = parser.parse_args() | |
37 | |
38 qualimap_bamqc(args.input_file, args.java_mem_size) | |
39 | |
40 shutil.make_archive( | |
41 'raw_data_qualimapReport', | |
42 'zip', | |
43 os.path.join(QUALIMAP_OUPUT_DIR, 'raw_data_qualimapReport') | |
44 ) | |
45 | |
46 shutil.move("raw_data_qualimapReport.zip", args.out_zip) | |
47 shutil.move( | |
48 os.path.join(QUALIMAP_OUPUT_DIR, "genome_results.txt"), | |
49 args.out_results | |
50 ) | |
51 | |
52 if __name__ == "__main__": | |
53 main() |