annotate qualimap_bamqc.py @ 23:cefa83db3ebf draft

planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
author scottx611x
date Thu, 26 Jul 2018 15:58:53 -0400
parents 4e5e0a116434
children 1f206c5af024
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
1 #!/usr/bin/env python
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
2 from __future__ import print_function
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
3 import argparse
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
4 from subprocess import check_call, CalledProcessError
23
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
5 import shutil
1
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
6 import sys
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
7
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
8
23
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
9 def qualimap_bamqc(bam_filename, genomecov_file, jv_mem_size):
1
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
10 qualimap_command = [
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
11 "qualimap", "bamqc",
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
12 "-bam " + bam_filename,
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
13 "-oc " + genomecov_file,
23
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
14 "-outdir .",
1
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
15 "--java-mem-size=" + jv_mem_size
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
16 ]
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
17
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
18 try:
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
19 check_call(qualimap_command)
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
20 except CalledProcessError:
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
21 print("Error running the qualimap bamqc", file=sys.stderr)
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
22
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
23
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
24 def main():
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
25 parser = argparse.ArgumentParser(
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
26 description="Generate Bam Quality Statistics"
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
27 )
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
28 parser.add_argument('--input_file')
23
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
29 parser.add_argument('--out_genome_file')
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
30 parser.add_argument('--java_mem_size')
1
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
31
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
32 args = parser.parse_args()
10
4e5e0a116434 planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 2
diff changeset
33
1
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
34 qualimap_bamqc(
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
35 args.input_file,
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
36 args.out_genome_file,
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
37 args.java_mem_size
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
38 )
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
39
23
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
40 shutil.make_archive(
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
41 'raw_data_qualimapReport.zip',
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
42 'zip',
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
43 'qualimap_results/raw_data_qualimapReport/'
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
44 )
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
45
cefa83db3ebf planemo upload for repository https://github.com/scottx611x/qualimap2 commit dc78b7c4b1780b316ca4aba2be247969ac1100ec-dirty
scottx611x
parents: 10
diff changeset
46
1
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
47
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
48 if __name__ == "__main__":
716e406ce6ea planemo upload for repository https://github.com/scottx611x/qualimap2 commit 2e9620ea29d3a146e8669ec0037932d9a2135c79-dirty
scottx611x
parents:
diff changeset
49 main()