changeset 2:bad8a51514dd draft

Directly call edge.pl, remove edge_pro.py . Move minimun and maximum insert size params to paired library section. Update Orione citation.
author crs4
date Wed, 05 Mar 2014 06:44:35 -0500
parents f77ce4f92b46
children ddcbf8732706
files edge_pro.py edge_pro.xml get_edge_data.xml readme.rst
diffstat 4 files changed, 33 insertions(+), 112 deletions(-) [+]
line wrap: on
line diff
--- a/edge_pro.py	Fri Jan 31 05:44:03 2014 -0500
+++ b/edge_pro.py	Wed Mar 05 06:44:35 2014 -0500
@@ -1,77 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Wrapper for EDGE - Gene expression in Prokaryotes
-Author: Paolo Uva paolo dot uva at crs4 dot it
-Date: March 18, 2013
-"""
-
-import glob
-import optparse
-import os
-import shutil
-import subprocess
-import tempfile
-import sys
-
-def __main__():
-    # Parse Command Line
-    parser = optparse.OptionParser()
-    # Input
-    parser.add_option('-g', '--genome', dest="genome")
-    parser.add_option('-p', '--ptt', dest="ptt")
-    parser.add_option('-r', '--rnt', dest="rnt")
-    parser.add_option('-u', '--input1', dest="input1")
-    parser.add_option('-v', '--input2', dest="input2")
-    parser.add_option('-t', '--num-threads', dest="num_threads", type='int')
-    parser.add_option('-m', '--minInsertSize', dest="minInsertSize", type='int')
-    parser.add_option('-M', '--maxInsertSize', dest="maxInsertSize", type='int')
-    parser.add_option('-w', '--window', dest="window", type='int')
-    parser.add_option('-i', '--utrSize', dest="utrSize", type='int')
-    parser.add_option('-x', '--similarity', dest="similarity", type='float')
-    parser.add_option('-c', '--minCoverage', dest="minCoverage", type='int')
-    parser.add_option('-l', '--readLength', dest="readLength", type='int')
-    # Output
-    parser.add_option('--out-aln', dest="out_aln")
-    parser.add_option('--out-rpkm', dest="out_rpkm")
-    parser.add_option('--out-log', dest="out_log")
-    (options, args) = parser.parse_args()
-    if len(args) > 0:
-        parser.error('Wrong number of arguments')
-
-    # Build command
-    input2_flag = '-v %s' % (options.input2) if options.input2 else ''
-    num_threads_flag = '-t %d' % options.num_threads if options.num_threads is not None else ''
-    minInsertSize_flag = '-m %d' % options.minInsertSize if options.minInsertSize is not None else ''
-    maxInsertSize_flag = '-M %d' % options.maxInsertSize if options.maxInsertSize is not None else ''
-    window_flag = '-w %d' % options.window if options.window is not None else ''
-    utrSize_flag = '-i %d' % options.utrSize if options.utrSize is not None else ''
-    similarity_flag = '-x %s' % options.similarity if options.similarity is not None else ''
-    readLength_flag = '-l %d' % (options.readLength) if options.readLength is not None else ''
-    minCoverage_flag = '-c %d' % options.minCoverage if options.minCoverage is not None else ''
-
-    wd = tempfile.mkdtemp()
-    try:
-        prefix = os.path.join(wd, 'out')
-        cl = 'edge.pl -g %s -p %s -r %s -u %s -o %s %s %s %s %s %s %s %s %s %s' % (options.genome, options.ptt, options.rnt, options.input1, prefix, input2_flag, num_threads_flag, minInsertSize_flag, maxInsertSize_flag, window_flag, utrSize_flag, similarity_flag, readLength_flag, minCoverage_flag)
-        print "EDGE-pro command to be executed:\n %s" % (cl)
-
-        sout = open(options.out_log, 'w') if options.out_log else sys.stdout
-        try:
-            subprocess.check_call(cl, stdout=sout, stderr=subprocess.STDOUT, shell=True) # need to redirect stderr because edge.pl calls bowtie2 and count which write some logging info there
-        finally:
-            if sout != sys.stdout:
-                sout.close()
-
-        # Move alignment file
-        shutil.move(prefix + '.alignments', options.out_aln)
-        # Concatenate multiple RPKM files together
-        with open(options.out_rpkm, 'wb') as destination:
-            for filename in glob.iglob(prefix + '.rpkm_*'):
-                with open(filename, 'rb') as source:
-                    shutil.copyfileobj(source, destination)
-    finally:
-        shutil.rmtree(wd)
-
-
-if __name__ == "__main__":
-    __main__()
--- a/edge_pro.xml	Fri Jan 31 05:44:03 2014 -0500
+++ b/edge_pro.xml	Wed Mar 05 06:44:35 2014 -0500
@@ -1,54 +1,52 @@
-<tool id="edge_pro" name="EDGE-pro" version="1.0.0">
+<tool id="edge_pro" name="EDGE-pro" version="1.0.1">
   <description>Gene expression in Prokaryotes</description>
   <requirements>
     <requirement type="package" version="2.1.0">bowtie2</requirement>
     <requirement type="package" version="1.3.1">edge-pro</requirement>
   </requirements>
-  <command interpreter="python">
-    edge_pro.py
-    --num-threads=\${GALAXY_SLOTS:-4}
-    
+  <command>
+    edge.pl -t \${GALAXY_SLOTS:-4} -o edge_out
     ## Mandatory input parameters
-    --genome $genome
-    --ptt $ptt
-    --rnt $rnt
+    -g $genome
+    -p $ptt
+    -r $rnt
     ## First input file always required
-    --input1 $singlePaired.input1
+    -u $singlePaired.input1
     ## Second input only if input is paired-end
     #if $singlePaired.sPaired == "paired"
-      --input2=$singlePaired.input2
+      -v $singlePaired.input2
+      #if str($singlePaired.minInsertSize)
+        -m $singlePaired.minInsertSize
+      #end if
+      #if str($singlePaired.maxInsertSize)
+        -M $singlePaired.maxInsertSize
+      #end if
     #end if
     
     ## Optional input parameters
     #if $params.settingsType == "full"
-      #if str($params.minInsertSize)
-        --minInsertSize=$params.minInsertSize
-      #end if
-      #if str($params.maxInsertSize)
-        --maxInsertSize=$params.maxInsertSize
-      #end if
       #if str($params.window)
-        --window=$params.window
+        -w $params.window
       #end if
       #if str($params.utrSize)
-        --utrSize=$params.utrSize
+        -i $params.utrSize
       #end if
       #if str($params.similarity)
-        --similarity=$params.similarity
+        -x $params.similarity
       #end if
       #if str($params.readLength)
-        --readLength=$params.readLength
+        -l $params.readLength
       #end if
       #if str($params.minCoverage)
-        --minCoverage=$params.minCoverage
+        -c $params.minCoverage
       #end if
     #end if
-    
-    ## Outputs
-    --out-aln $out_aln
-    --out-rpkm $out_rpkm
-    --out-log $out_log
+    &gt; $out_log 2&gt;&amp;1 ## need to redirect stderr because edge.pl calls bowtie2 and count which write some logging info there
+    &amp;&amp; cat edge_out.rpkm_* > $out_rpkm
   </command>
+  <stdio>
+    <exit_code range="1:" level="fatal" />
+  </stdio>
   <inputs>
     <conditional name="singlePaired">
       <param name="sPaired" type="select" label="Is this library mate-paired?">
@@ -61,6 +59,8 @@
       <when value="paired">
         <param format="fastqsanger" name="input1" type="data" label="Forward FASTQ file" help="FASTQ format with Sanger-scaled quality values (Galaxy fastqsanger datatype)" />
         <param format="fastqsanger" name="input2" type="data" label="Reverse FASTQ file" help="FASTQ format with Sanger-scaled quality values (Galaxy fastqsanger datatype)" />
+        <param name="minInsertSize" type="integer" optional="true" min="0" value="0" label="Minimun insert size in paired-end library for Bowtie2 (-m)" />
+        <param name="maxInsertSize" type="integer" optional="true" min="1" value="500" label="Maximun insert size in paired-end library for Bowtie2 (-M)" />
       </when>
     </conditional>
     
@@ -70,25 +70,22 @@
     
     <conditional name="params">
       <param name="settingsType" type="select" label="Parameter settings" help="For most needs, use default settings. If you want full control use Full Parameter List">
-        <option value="preSet">Use Defaults</option>
+        <option value="preSet">Use defaults</option>
         <option value="full">Full parameter list</option>
       </param>
       <when value="preSet" />
-      <!-- Full/advanced params. -->
       <when value="full">
-        <param name="minInsertSize" type="integer" optional="true" value="0" label="Minimun insert size for a read pair (-m)" help="For paired-end reads only" />
-        <param name="maxInsertSize" type="integer" optional="true" value="500" label="Maximun insert size for a read pair (-M)" help="For paired-end reads only" />
         <param name="window" type="integer" optional="true" value="100" label="Window length for coverage distribution (-w)" help="Used to distribute the coverage between two overlapping genes. See help below for details" />
         <param name="utrSize" type="integer" optional="true" value="40" label="Size of the untranslated region (-i)" help="Enter the size of the untranslated region between the initial transcription site and the start codon" />
         <param name="similarity" type="float" optional="true" value="0.15" label="Percentage for similar coverage (-x)" help="Enter the percentage used to determine when two coverage values are considered similar. See help below for details" />
         <param name="readLength" type="integer" optional="true" value="" label="Read length (-l)" help="If not specified, the first 1000 reads are used to approximate the read length" />
         <param name="minCoverage" type="integer" optional="true" value="3" label="Minimum average coverage for expressed genes (-c)" help="Coverage less than specified is assumed to be noise and gene is considered to not be expressed" />
-      </when> <!-- full -->
+      </when>
     </conditional>
   </inputs>
 
   <outputs>
-    <data format="sam" name="out_aln" label="${tool.name} on ${on_string}: alignment"/>
+    <data format="sam" name="out_aln" label="${tool.name} on ${on_string}: alignment" from_work_dir="edge_out.alignments" />
     <data format="tabular" name="out_rpkm" label="${tool.name} on ${on_string}: rpkm"/>
     <data format="txt" name="out_log" label="${tool.name} on ${on_string}: log"/>
   </outputs>
@@ -122,7 +119,7 @@
 
 If you use this tool in Galaxy, please cite |Cuccuru2013|_.
 
-.. |Cuccuru2013| replace:: Cuccuru, G., Orsini, M., Pinna, A., Sbardellati, A., Soranzo, N., Travaglione, A., Uva, P., Zanetti, G., Fotia, G. (2013) Orione, a web-based framework for NGS analysis in microbiology. *Submitted*
+.. |Cuccuru2013| replace:: Cuccuru, G., Orsini, M., Pinna, A., Sbardellati, A., Soranzo, N., Travaglione, A., Uva, P., Zanetti, G., Fotia, G. (2014) Orione, a web-based framework for NGS analysis in microbiology. *Bioinformatics*, accepted
 .. _Cuccuru2013: http://orione.crs4.it/
 
 This tool uses `EDGE-pro`_, which is licensed separately. Please cite |Magoc2013|_.
--- a/get_edge_data.xml	Fri Jan 31 05:44:03 2014 -0500
+++ b/get_edge_data.xml	Wed Mar 05 06:44:35 2014 -0500
@@ -32,7 +32,7 @@
 
 If you use this tool in Galaxy, please cite |Cuccuru2013|_.
 
-.. |Cuccuru2013| replace:: Cuccuru, G., Orsini, M., Pinna, A., Sbardellati, A., Soranzo, N., Travaglione, A., Uva, P., Zanetti, G., Fotia, G. (2013) Orione, a web-based framework for NGS analysis in microbiology. *Submitted*
+.. |Cuccuru2013| replace:: Cuccuru, G., Orsini, M., Pinna, A., Sbardellati, A., Soranzo, N., Travaglione, A., Uva, P., Zanetti, G., Fotia, G. (2014) Orione, a web-based framework for NGS analysis in microbiology. *Bioinformatics*, accepted
 .. _Cuccuru2013: http://orione.crs4.it/
   </help>
 </tool>
--- a/readme.rst	Fri Jan 31 05:44:03 2014 -0500
+++ b/readme.rst	Wed Mar 05 06:44:35 2014 -0500
@@ -11,7 +11,7 @@
 Configuration
 -------------
 
-EDGE-pro tool may be configured to use more than one CPU core by selecting an appropriate destination for this tool in Galaxy job_conf.xml file (see http://wiki.galaxyproject.org/Admin/Config/Jobs and http://wiki.galaxyproject.org/Admin/Config/Performance/Cluster ).
+edge_pro tool may be configured to use more than one CPU core by selecting an appropriate destination for this tool in Galaxy job_conf.xml file (see https://wiki.galaxyproject.org/Admin/Config/Jobs and https://wiki.galaxyproject.org/Admin/Config/Performance/Cluster ).
 
 If you are using Galaxy release_2013.11.04 or later, this tool will automatically use the number of CPU cores allocated by the job runner according to the configuration of the destination selected for this tool.
 
@@ -26,6 +26,7 @@
 Version history
 ---------------
 
+- Release 2: Directly call edge.pl, remove edge_pro.py . Move minimun and maximum insert size params to paired library section. Update Orione citation.
 - Release 1: Use $GALAXY_SLOTS instead of $EDGE_PRO_SITE_OPTIONS. Add dependency on bowtie2. Add readme.rst .
 - Release 0: Initial release in the Tool Shed.