Mercurial > repos > jetbrains > zinbra
comparison zinbra.py @ 6:7d532e820976
Support comparison in zinbra. 3fba761
author | oleg@oleg-desktop.times.labs.intellij.net |
---|---|
date | Wed, 28 Oct 2015 20:08:20 +0300 |
parents | 0eb50728861a |
children |
comparison
equal
deleted
inserted
replaced
5:ae6878068d07 | 6:7d532e820976 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 """ | 2 """ |
3 Python wrapper for zinbra.xml | 3 Python wrapper for zinbra.xml |
4 Usage: zinbra.py "${genome}" "${bed}" "${bin}" "${fdr}" | |
5 """ | 4 """ |
6 | 5 |
7 import os | 6 import os |
8 import sys | 7 import sys |
9 import subprocess | 8 import subprocess |
10 | 9 |
11 argv = sys.argv[1:] | 10 argv = sys.argv[1:] |
12 print 'Arguments {0}'.format(argv) | 11 print 'Arguments {0}'.format(argv) |
13 genome, bed, bin, fdr = argv | 12 |
13 # Check command | |
14 if len(argv) == 5: | |
15 genome, bin, fdr, action, bed = argv | |
16 assert action == "analyze" | |
17 else: | |
18 genome, bin, fdr, action, bed1, bed2 = argv | |
19 assert action == "compare" | |
14 | 20 |
15 # Configure main jar path | 21 # Configure main jar path |
16 jar = os.environ.get("INTEGRATION_JAR") | 22 jar = os.environ.get("INTEGRATION_JAR") |
17 print 'Using JAR distributive file {0}'.format(jar) | 23 print 'Using JAR distributive file {0}'.format(jar) |
18 | 24 |
19 cmd = 'java -cp {0} org.jetbrains.bio.genestack.FastaToTwoBitCLA {1} reference.2bit'.format(jar, genome) | 25 cmd = 'java -cp {0} org.jetbrains.bio.genestack.FastaToTwoBitCLA {1} reference.2bit'.format(jar, genome) |
20 print 'Converting reference genome fasta to 2bit: {0}'.format(cmd) | 26 print 'Converting reference genome fasta to 2bit: {0}'.format(cmd) |
21 subprocess.check_call(cmd, cwd=None, shell=True) | 27 subprocess.check_call(cmd, cwd=None, shell=True) |
22 | 28 |
23 # See https://github.com/JetBrains-Research/zinbra for command line options | 29 # See https://github.com/JetBrains-Research/zinbra for command line options |
24 # cla.argument_string_list() is configured at ZinbraApplications#rebuildArgumentStringsFromVisualOptions | 30 if action == "analyze": |
25 cmd = 'java -cp {0} org.jetbrains.bio.zinbra.ZinbraCLA ' \ | 31 cmd = 'java -cp {0} org.jetbrains.bio.zinbra.ZinbraCLA ' \ |
26 'analyze -i {1} -bed result.bed -r reference.2bit -b {3} -fdr {4}'.format(jar, | 32 'analyze -i {1} -bed result.bed -r reference.2bit -b {3} -fdr {4}'.format(jar, bed, bin, fdr) |
27 bed, | 33 else: |
28 bin, fdr) | 34 cmd = 'java -cp {0} org.jetbrains.bio.zinbra.ZinbraCLA ' \ |
35 'compare -1 {1} -2 {2} -bed result.bed -r reference.2bit -b {3} -fdr {4}'.format(jar, bed1, bed2, bin, fdr) | |
29 print 'Launching zinbra: {0}'.format(cmd) | 36 print 'Launching zinbra: {0}'.format(cmd) |
30 subprocess.check_call(cmd, cwd=None, shell=True) | 37 subprocess.check_call(cmd, cwd=None, shell=True) |