Mercurial > repos > scottx611x > qualimap2_bamqc
comparison qualimap_bamqc.py @ 43:2395818cb1f1 draft
planemo upload for repository https://github.com/scottx611x/qualimap2 commit 9fafbbc012490e70d06fcef4704a1e4a45b382c5-dirty
author | scottx611x |
---|---|
date | Sun, 29 Jul 2018 14:12:32 -0400 |
parents | c53375e61b33 |
children | 4cfe71d40d44 |
comparison
equal
deleted
inserted
replaced
42:c53375e61b33 | 43:2395818cb1f1 |
---|---|
4 import os | 4 import os |
5 from subprocess import check_call, CalledProcessError | 5 from subprocess import check_call, CalledProcessError |
6 import shutil | 6 import shutil |
7 import sys | 7 import sys |
8 | 8 |
9 QUALIMAP_OUPUT_DIR = "qualimap_results" | |
9 | 10 |
10 def qualimap_bamqc(bam_filename, out_dir, jv_mem_size): | 11 |
12 def qualimap_bamqc(bam_filename, jv_mem_size): | |
11 qualimap_command = [ | 13 qualimap_command = [ |
12 "qualimap", "bamqc", | 14 "qualimap", "bamqc", |
13 "-bam " + bam_filename, | 15 "-bam " + bam_filename, |
14 "-outdir " + out_dir, | 16 "-outdir " + QUALIMAP_OUPUT_DIR, |
15 "--java-mem-size=" + jv_mem_size | 17 "--java-mem-size=" + jv_mem_size |
16 ] | 18 ] |
17 | 19 |
18 try: | 20 try: |
19 check_call(qualimap_command) | 21 check_call(qualimap_command) |
25 parser = argparse.ArgumentParser( | 27 parser = argparse.ArgumentParser( |
26 description="Generate Bam Quality Statistics" | 28 description="Generate Bam Quality Statistics" |
27 ) | 29 ) |
28 parser.add_argument('--input_file') | 30 parser.add_argument('--input_file') |
29 parser.add_argument('--out_dir') | 31 parser.add_argument('--out_dir') |
32 parser.add_argument('--out_results') | |
30 parser.add_argument('--out_zip') | 33 parser.add_argument('--out_zip') |
31 parser.add_argument('--out_html') | |
32 parser.add_argument('--java_mem_size') | 34 parser.add_argument('--java_mem_size') |
33 | 35 |
34 args = parser.parse_args() | 36 args = parser.parse_args() |
35 print(args) | |
36 | 37 |
37 qualimap_bamqc( | 38 qualimap_bamqc( |
38 args.input_file, | 39 args.input_file, |
39 args.out_dir, | 40 QUALIMAP_OUPUT_DIR, |
40 args.java_mem_size | 41 args.java_mem_size |
41 ) | 42 ) |
42 | 43 |
43 shutil.make_archive( | 44 shutil.make_archive( |
44 'raw_data_qualimapReport', | 45 'raw_data_qualimapReport', |
45 'zip', | 46 'zip', |
46 os.path.join(args.out_dir, 'raw_data_qualimapReport') | 47 os.path.join(QUALIMAP_OUPUT_DIR, 'raw_data_qualimapReport') |
47 ) | 48 ) |
48 | 49 |
49 shutil.move("raw_data_qualimapReport.zip", args.out_zip) | 50 shutil.move("raw_data_qualimapReport.zip", args.out_zip) |
50 shutil.move( | 51 shutil.move( |
51 os.path.join(args.out_dir, "genome_results.txt"), | 52 os.path.join(QUALIMAP_OUPUT_DIR, "genome_results.txt"), |
52 args.out_results | 53 args.out_results |
53 ) | 54 ) |
54 | 55 |
55 if __name__ == "__main__": | 56 if __name__ == "__main__": |
56 main() | 57 main() |