Mercurial > repos > sanbi-uwc > qualimap2
comparison qualimap_bamqc.py @ 0:d87d6c0c27f5 draft
planemo upload for repository https://github.com/zipho/qualimap2 commit fb67f375d3ae592c62f73d647d8afa19b79037c0
author | sanbi-uwc |
---|---|
date | Wed, 30 Mar 2016 03:19:15 -0400 |
parents | |
children | a19abfa30ca7 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d87d6c0c27f5 |
---|---|
1 #!/usr/bin/env python | |
2 from __future__ import print_function | |
3 import argparse | |
4 from subprocess import check_call, CalledProcessError | |
5 import shlex | |
6 import sys | |
7 import logging | |
8 log = logging.getLogger( __name__ ) | |
9 | |
10 def qualimap_bamqc( bam_filename, genomecov_file, out_dir, pdf_file, jv_mem_size): | |
11 #qualimap bamqc -bam R.bam.sorted_dedup.bam_realigned.bam -oc ./test.genomecov -outdir ./Kaust_kxdr/variants/qualimap/bamqc_report --outfile test.pdf --java-mem-size=16G | |
12 cmdline_str = "qualimap bamqc -bam {} -oc {} -outdir {} --outfile {} --java-mem-size={}".format( bam_filename, | |
13 genomecov_file, | |
14 out_dir, | |
15 pdf_file, | |
16 jv_mem_size) | |
17 cmdline = newSplit(cmdline_str) | |
18 try: | |
19 check_call(cmdline) | |
20 except CalledProcessError: | |
21 print("Error running the qualimap bamqc", file=sys.stderr) | |
22 | |
23 def newSplit(value): | |
24 lex = shlex.shlex(value) | |
25 lex.quotes = '"' | |
26 lex.whitespace_split = True | |
27 lex.commenters = '' | |
28 return list(lex) | |
29 | |
30 def main(): | |
31 parser = argparse.ArgumentParser(description="Generate Bam Quality Statistics") | |
32 parser.add_argument('--input_file') | |
33 parser.add_argument('--out_genome_file', default="bam_stats.genomecov") | |
34 parser.add_argument('--out_dir', default="/tmp/bamstats") | |
35 parser.add_argument('--out_pdf_file', default="bam_stats.pdf") | |
36 parser.add_argument('--java_mem_size', default="8G" ) | |
37 | |
38 args = parser.parse_args() | |
39 | |
40 qualimap_bamqc(args.input_file, args.out_genome_file, args.out_dir, args.out_pdf_file, args.java_mem_size) | |
41 | |
42 if __name__ == "__main__": main() |