Mercurial > repos > sanbi-uwc > qualimap2
annotate qualimap_multi_bamqc.py @ 6:8dff744880cd draft
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
author | sanbi-uwc |
---|---|
date | Tue, 05 Apr 2016 04:45:41 -0400 |
parents | |
children |
rev | line source |
---|---|
6
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
2 from __future__ import print_function |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
3 import argparse |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
4 from subprocess import check_call, CalledProcessError |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
5 import shlex |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
6 import sys |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
7 import logging |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
8 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
9 log = logging.getLogger(__name__) |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
10 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
11 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
12 def qualimap_multi_bamqc(input_file, out_dir, jv_mem_size): |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
13 #multi-bamqc -r -d ./bamlistinput.txt -outdir ./Kaust_kxdr/variants/qualimap -outformat PDF --java-mem-size=16G |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
14 cmdline_str = "qualimap multi-bamqc -r -d {} -outdir {} -outformat PDF --java-mem-size={}".format(input_file, |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
15 out_dir, |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
16 jv_mem_size) |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
17 cmdline = new_split(cmdline_str) |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
18 try: |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
19 check_call(cmdline) |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
20 except CalledProcessError: |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
21 print("Error running the qualimap multi bamqc", file=sys.stderr) |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
22 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
23 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
24 def new_split(value): |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
25 lex = shlex.shlex(value) |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
26 lex.quotes = '"' |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
27 lex.whitespace_split = True |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
28 lex.commenters = '' |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
29 return list(lex) |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
30 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
31 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
32 def main(): |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
33 parser = argparse.ArgumentParser(description="Generate Bam Quality Statistics") |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
34 parser.add_argument('--input_file') |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
35 parser.add_argument('--out_dir', default="/tmp/bamstats") |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
36 parser.add_argument('--java_mem_size', default="8G") |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
37 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
38 args = parser.parse_args() |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
39 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
40 qualimap_multi_bamqc(args.input_file, args.out_dir, args.java_mem_size) |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
41 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
42 |
8dff744880cd
planemo upload for repository https://github.com/zipho/qualimap2 commit c721c32bc9c559c94c2f8cb9c77aa0c60a9fceb6
sanbi-uwc
parents:
diff
changeset
|
43 if __name__ == "__main__": main() |