changeset 25:99435bb90725 draft

Uploaded
author bgruening
date Fri, 18 Oct 2013 03:35:17 -0400
parents b942dfd80819
children a5eb6fad2a76
files antismash.xml src/genecluster_sequence/__init__.py tool_dependencies.xml
diffstat 3 files changed, 99 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/antismash.xml	Tue Oct 15 04:19:33 2013 -0400
+++ b/antismash.xml	Fri Oct 18 03:35:17 2013 -0400
@@ -2,14 +2,18 @@
     <description>and Antibiotics Analysis (antiSMASH)</description>
     <requirements>
         <requirement type="package" version="3.0">hmmer</requirement>
+        <requirement type="package">hmmer</requirement>
         <requirement type="package" version="2.2.28">blast+</requirement>
+        <requirement type="package">blast+</requirement>
         <requirement type="package" version="3.8.31">muscle</requirement>
+        <requirement type="package">muscle</requirement>
         <requirement type="package" version="1.4.0-post-1">straight.plugin</requirement>
         <requirement type="package" version="1.62">biopython</requirement>
         <requirement type="package" version="1.2.6">pyquery</requirement>
         <requirement type="package" version="0.1.2">helperlibs</requirement>
         <requirement type="package" version="0.9">cssselect</requirement>
         <requirement type="package" version="2.0.2">antismash</requirement>
+        <requirement type="package">antismash</requirement>
     </requirements>
     <command>
         #import os, glob
@@ -24,7 +28,7 @@
         ln -s $infile #echo 'input_tempfile.' + $file_extension#;
         mkdir -p $outputfolder;
         run_antismash.py 
-            --cpus 4
+            --cpus 12
             --enable $types
             --input-type 'nucl'
             $smcogs
@@ -33,11 +37,15 @@
             $inclusive
             $full_hmmer
             $full_blast
+            $eukaryotic
+
 
             #if str($pfam_database) != "None":
                 --pfamdir $pfam_database.fields.path
             #end if
 
+            --debug
+
             --disable-embl
             --outputfolder $outputfolder
 
@@ -47,49 +55,63 @@
             ##--from START          Start analysis at nucleotide specified
             ##--to END
 
-        ;
+        2>&#38;1
+
+        ##
         ## shuffling files to create the correct outputs for Galaxy
-        
+        ##
+
         ## html output
-        #if 'html' in str($outputs).split(','):
-            cp #echo os.path.join($outputfolder, 'index.html')# $html 2>/dev/null;
-        #end if
+        ;
+        cp #echo os.path.join($outputfolder, 'index.html')# $html 2> /dev/null
         
         ## gene clusters
         #if 'geneclusterprots_tabular' in str($outputs).split(','):
-            cp #echo os.path.join($outputfolder, 'geneclusters.txt')# $geneclusterprots_tabular 2>/dev/null;
+            ;
+            cp #echo os.path.join($outputfolder, 'geneclusters.txt')# $geneclusterprots_tabular 2> /dev/null
         #end if
 
         #if 'geneclusterprots_fasta' in str($outputs).split(','):
-            cp #echo os.path.join($outputfolder, '*_genecluster_proteins.fa')# $geneclusterprots_fasta 2>/dev/null;
+            ;
+            cp #echo os.path.join($outputfolder, '*_genecluster_proteins.fa')# $geneclusterprots_fasta 2> /dev/null
         #end if
 
 
         ##SVG images
         #if 'archive_svgs' in str($outputs).split(','):
-            cd #echo os.path.join($outputfolder, 'svg')#;
+            ;
+            cd #echo os.path.join($outputfolder, 'svg')#
             #if $clusterblast:
-                tar cfz $archive_svgs *_all.svg genecluster* 2>/dev/null;
+                ;
+                tar cfz $archive_svgs *_all.svg genecluster* 2> /dev/null
             #else:
-                tar cfz $archive_svgs genecluster*;
+                ;
+                tar cfz $archive_svgs genecluster*
             #end if
         #end if
 
         ##all files in a archive
         #if 'archive' in str($outputs).split(','):
+            ;
             cd $outputfolder;
-            tar cf $archive *.zip 2>/dev/null;
+            tar cf $archive *.zip 2> /dev/null
         #end if
 
         ## genbank
         #if 'gb' in str($outputs).split(','):
-            cat #echo os.path.join($outputfolder, '*.gbk')# > $genbank 2>/dev/null;
+            ;
+            cat #echo os.path.join($outputfolder, '*.gbk')# > $genbank 2> /dev/null
         #end if
 
     </command>
     <inputs>
         <param name="infile" type="data" format="genbank" label="Nucleotide sequence file in GenBank format"/>
 
+        <param name="eukaryotic" type="select" label="Origin of DNA">
+            <option value="" selected="True">Prokaryotic</option>
+            <option value="--eukaryotic">Eukaryotic</option>
+        </param>
+
         <param name="clusterblast" type="boolean" label="BLAST identified clusters against known clusters"
             help="(--clusterblast)"
             truevalue="--clusterblast" falsevalue="" checked="True" />
@@ -146,10 +168,9 @@
             <option value="other" selected="True">others</option>
         </param>
 
-        <param name="outputs" type="select" multiple="true" label="Output formats">
+        <param name="outputs" type="select" multiple="true" label="Additional outputs">
             <option value="geneclusterprots_fasta" selected="True">Gene cluster proteins (FASTA)</option>
             <option value="geneclusterprots_tabular">Gene cluster proteins (Tabular)</option>
-            <option value="html" selected="True">Interactive summary page (html)</option>
             <option value="archive_svgs">All clusters as image (compressed)</option>
             <option value="archive">All files compressed</option>
             <option value="gb">Annotated genome (GenBank)</option>
@@ -170,7 +191,9 @@
           <filter>'archive_svgs' in outputs</filter>
         </data>
         <data format="html" name="html" label="${tool.name} on ${on_string} (html report)">
+          <!-- html is default output at any time.
           <filter>'html' in outputs</filter>
+          -->
         </data>
         <data name="genbank" format="genbank" label="${tool.name} on ${on_string} (genbank)">
           <filter>'gb' in outputs</filter>
@@ -217,5 +240,8 @@
 
 http://antismash.secondarymetabolites.org/help.html
 
+
+Bjoern A. Gruening: https://github.com/bgruening/galaxytools/tree/master/antismash
+
   </help>
 </tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/genecluster_sequence/__init__.py	Fri Oct 18 03:35:17 2013 -0400
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+"""
+    antiSMASH 2.0 output plugin to write all cluster proteins to a file (*_genecluster_proteins.fa)
+"""
+import logging
+import textwrap
+from os import path
+from antismash import utils
+
+name = "genecluster_proteins"
+short_description = "Ouptut gene clusters as FASTA sequences"
+# Output plugins are sorted by priority, lower numbers get run first
+priority = 9
+
+def write(seq_records, options):
+    """Write all cluster proteins to a file
+
+    Args:
+        seq_records (iterable): An iterable containing Bio.SeqRecords
+        options (argparse.Namespace): The options passed to the program
+    """
+    basename = seq_records[0].id
+    output_name = path.join(options.outputfoldername, "%s_genecluster_proteins.fa" % basename)
+    logging.debug("Writing seq_records to %r" % output_name)
+
+    with open(output_name, 'w+') as handle:
+        for seq_record in seq_records:
+            clusters = utils.get_cluster_features(seq_record)
+            for cluster in clusters:
+                clustertype = utils.get_cluster_type(cluster)
+                clusternr = utils.get_cluster_number(cluster)
+                for feature in utils.get_cluster_cds_features(cluster, seq_record):
+                    qual = feature.qualifiers
+                    fasta_header = '>%s:%s %s #%s - %s\n' % (qual['locus_tag'][0], qual['protein_id'][0], clustertype, clusternr, qual['product'][0])
+                    handle.write( fasta_header )
+                    handle.write( '%s\n' % '\n'.join( textwrap.wrap(qual['translation'][0], 60) ) )
--- a/tool_dependencies.xml	Tue Oct 15 04:19:33 2013 -0400
+++ b/tool_dependencies.xml	Fri Oct 18 03:35:17 2013 -0400
@@ -7,7 +7,7 @@
         <repository changeset_revision="a44693e3a2c4" name="package_hmmer_3_0" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
     </package>
     <package name="muscle" version="3.8.31">
-        <repository changeset_revision="ce304c51f69b" name="package_muscle_3_8_31" owner="bgruening" toolshed="http://testtoolshed.g2.bx.psu.edu" />
+        <repository changeset_revision="83bd107a5300" name="package_muscle_3_8_31" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
     </package>
     <package name="biopython" version="1.62">
         <repository changeset_revision="ac9cc2992b69" name="package_biopython_1_62" owner="biopython" toolshed="http://testtoolshed.g2.bx.psu.edu" />
@@ -18,7 +18,10 @@
             <actions>
                 <action type="download_by_url">https://pypi.python.org/packages/source/h/helperlibs/helperlibs-0.1.2.tar.gz</action>
                 <action type="make_directory">$INSTALL_DIR/lib/python</action>
-                <action type="shell_command">export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin</action>
+                    <action type="shell_command">
+                        export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; 
+                        python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin
+                    </action>
                 <action type="set_environment">
                     <environment_variable action="append_to" name="PYTHONPATH">$INSTALL_DIR/lib/python</environment_variable>
                     <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable>
@@ -35,7 +38,10 @@
             <actions>
                 <action type="download_by_url">https://pypi.python.org/packages/source/c/cssselect/cssselect-0.9.tar.gz</action>
                 <action type="make_directory">$INSTALL_DIR/lib/python</action>
-                <action type="shell_command">export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin</action>
+                    <action type="shell_command">
+                        export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; 
+                        python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin
+                    </action>
                 <action type="set_environment">
                     <environment_variable action="append_to" name="PYTHONPATH">$INSTALL_DIR/lib/python</environment_variable>
                     <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable>
@@ -52,7 +58,10 @@
             <actions>
                 <action type="download_by_url">https://github.com/gawel/pyquery/archive/1.2.6.tar.gz</action>
                 <action type="make_directory">$INSTALL_DIR/lib/python</action>
-                <action type="shell_command">export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin</action>
+                    <action type="shell_command">
+                        export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; 
+                        python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin
+                    </action>
                 <action type="set_environment">
                     <environment_variable action="append_to" name="PYTHONPATH">$INSTALL_DIR/lib/python</environment_variable>
                     <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable>
@@ -69,7 +78,10 @@
             <actions>
                 <action type="download_by_url">https://pypi.python.org/packages/source/s/straight.plugin/straight.plugin-1.4.0-post-1.tar.gz</action>
                 <action type="make_directory">$INSTALL_DIR/lib/python</action>
-                <action type="shell_command">export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin</action>
+                    <action type="shell_command">
+                        export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; 
+                        python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin
+                    </action>
                 <action type="set_environment">
                     <environment_variable action="append_to" name="PYTHONPATH">$INSTALL_DIR/lib/python</environment_variable>
                     <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable>
@@ -83,8 +95,7 @@
     <package name="antismash" version="2.0.2">
         <install version="1.0">
            <actions_group>
-
-                <!-- Download the binaries for antiSMASH compatible with 64-bit OSX. -->
+                <!-- Download the binaries for MUSCLE compatible with 64-bit OSX. -->
                 <actions architecture="x86_64" os="darwin">
                     <action type="download_by_url">https://bitbucket.org/antismash/antismash2/downloads/antiSMASH2.0.2_macosx.zip</action>
                     <action type="move_directory_files">
@@ -109,10 +120,10 @@
                     -->
                     <action type="shell_command">sed -i 's/check_prereqs(plugins, options) &gt; 0/False/g' $INSTALL_DIR/run_antismash.py</action>
                     <action type="download_file">https://bitbucket.org/antismash/antismash2/downloads/clusterblast.tar.gz</action>
-                    <action type="shell_command">tar xfvz clusterblast.tar.gz -C $INSTALL_DIR/antismash/generic_modules/clusterblast</action>n&gt;
+                    <action type="shell_command">tar xfvz clusterblast.tar.gz -C $INSTALL_DIR/antismash/generic_modules/clusterblast</action>
                 </actions>
 
-                <!-- Download the binaries for antiSMASH compatible with 64-bit OSX. -->
+                <!-- Download the binaries for MUSCLE compatible with 64-bit OSX. -->
                 <actions architecture="i386" os="darwin">
                     <action type="download_by_url">https://bitbucket.org/antismash/antismash2/downloads/antiSMASH2.0.2_macosx.zip</action>
                     <action type="move_directory_files">
@@ -209,6 +220,7 @@
         </install>
         <readme>
             AntiSmash installation with all dependencies.
+            Java needs to be installed.
         </readme>
     </package>
 </tool_dependency>