changeset 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 ae6878068d07
children 617b5857ce96
files tool_dependencies.xml zinbra.py zinbra.xml
diffstat 3 files changed, 38 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/tool_dependencies.xml	Wed Oct 28 19:52:30 2015 +0300
+++ b/tool_dependencies.xml	Wed Oct 28 20:08:20 2015 +0300
@@ -20,7 +20,6 @@
         </install>
         <readme>
             Downloads epigenome integration JAR.
-            See for more details: https://teamcity.jetbrains.com/project.html?projectId=Epigenome_Tools&amp;tab=projectOverview&amp;guest=1
         </readme>
     </package>
 </tool_dependency>
--- a/zinbra.py	Wed Oct 28 19:52:30 2015 +0300
+++ b/zinbra.py	Wed Oct 28 20:08:20 2015 +0300
@@ -1,7 +1,6 @@
 #!/usr/bin/env python
 """
 Python wrapper for zinbra.xml
-Usage: zinbra.py "${genome}" "${bed}" "${bin}" "${fdr}"
 """
 
 import os
@@ -10,7 +9,14 @@
 
 argv = sys.argv[1:]
 print 'Arguments {0}'.format(argv)
-genome, bed, bin, fdr = argv
+
+# Check command
+if len(argv) == 5:
+    genome, bin, fdr, action, bed = argv
+    assert action == "analyze"
+else:
+    genome, bin, fdr, action, bed1, bed2 = argv
+    assert action == "compare"
 
 # Configure main jar path
 jar = os.environ.get("INTEGRATION_JAR")
@@ -21,10 +27,11 @@
 subprocess.check_call(cmd, cwd=None, shell=True)
 
 # See https://github.com/JetBrains-Research/zinbra for command line options
-# cla.argument_string_list() is configured at ZinbraApplications#rebuildArgumentStringsFromVisualOptions
-cmd = 'java -cp {0} org.jetbrains.bio.zinbra.ZinbraCLA ' \
-      'analyze -i {1} -bed result.bed -r reference.2bit -b {3} -fdr {4}'.format(jar,
-                                                                                bed,
-                                                                                bin, fdr)
+if action == "analyze":
+    cmd = 'java -cp {0} org.jetbrains.bio.zinbra.ZinbraCLA ' \
+          'analyze -i {1} -bed result.bed -r reference.2bit -b {3} -fdr {4}'.format(jar, bed, bin, fdr)
+else:
+    cmd = 'java -cp {0} org.jetbrains.bio.zinbra.ZinbraCLA ' \
+          'compare -1 {1} -2 {2} -bed result.bed -r reference.2bit -b {3} -fdr {4}'.format(jar, bed1, bed2, bin, fdr)
 print 'Launching zinbra: {0}'.format(cmd)
 subprocess.check_call(cmd, cwd=None, shell=True)
--- a/zinbra.xml	Wed Oct 28 19:52:30 2015 +0300
+++ b/zinbra.xml	Wed Oct 28 20:08:20 2015 +0300
@@ -5,20 +5,36 @@
     </requirements>
     <stdio>
         <!-- Wrapper ensures anything other than zero is an error -->
-        <exit_code range="1:" />
-        <exit_code range=":-1" />
+        <exit_code range="1:"/>
+        <exit_code range=":-1"/>
     </stdio>
     <command interpreter="python">
-        zinbra.py "${genome}" "${bed}" "${bin}" "${fdr}"
+        #if $action.selection == "analyze"
+            zinbra.py "${genome}" "${bin}" "${fdr}" analyze "${bed}"
+        #else
+            zinbra.py "${genome}" "${bin}" "${fdr}" compare "${bed1}" "${bed2}"
+        #end if
     </command>
     <inputs>
-        <param name="bed" type="data" format="bed" label="Aligned reads" description="BED Aligned reads to process" />
-        <param name="genome" type="data" format="fasta" label="Genome build" description="Genome build reference" />
-        <param name="bin" size="5" type="integer" value="200" label="Bin size" />
-        <param name="fdr" size="5" type="float" value="0.0001" label="FDR" />
+        <param name="genome" type="data" format="fasta" label="Genome build" description="Genome build reference"/>
+        <param name="bin" size="5" type="integer" value="200" label="Bin size"/>
+        <param name="fdr" size="5" type="float" value="0.0001" label="FDR"/>
+        <conditional name="action">
+            <param name="selection" type="select" label="Action">
+                <option value="analyze">Compute enrichment of ChIP-Seq</option>
+                <option value="compare">Compare different ChIP-Seqs</option>
+            </param>
+            <when value="analyze">
+                <param name="bed" type="data" format="bed" label="ChIP-Seq bed" description="BED Aligned reads to process"/>
+            </when>
+            <when value="compare">
+                <param name="bed1" type="data" format="bed" label="ChIP-Seq bed1" description="BED Aligned reads 1 to process"/>
+                <param name="bed2" type="data" format="bed" label="ChIP-Seq bed2" description="BED Aligned reads 2 to process"/>
+            </when>
+        </conditional>
     </inputs>
     <outputs>
-        <data name="result" format="bed" label="result.bed" />
+        <data name="result" format="bed" label="result.bed"/>
     </outputs>
     <help>
 Zinbra is a tool for analyzing and comparing ChIP-Seq data using Zero Inflated Negative Binomial Restricted Algorithm.