[hg] galaxy 1558: Fixes for data_source tools, data.name, data.i...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[hg] galaxy 1558: Fixes for data_source tools, data.name, data.i...

Nate Coraor (nate@bx.psu.edu)
details:   http://www.bx.psu.edu/hg/galaxy/rev/f5b051c51295
changeset: 1558:f5b051c51295
user:      Greg Von Kuster <[hidden email]>
date:      Fri Oct 17 10:46:29 2008 -0400
description:
Fixes for data_source tools, data.name, data.info, data.dbkey, and data.extension should now be properly set.  Eliminated fastq data type from datatypes_conf.xml.sample since it is not a supported data type.

6 file(s) affected in this change:

datatypes_conf.xml.sample
lib/galaxy/tools/__init__.py
tools/data_source/flymine.xml
tools/data_source/ucsc_tablebrowser.xml
tools/data_source/ucsc_tablebrowser_archaea.xml
tools/data_source/ucsc_tablebrowser_test.xml

diffs (119 lines):

diff -r a5831435c654 -r f5b051c51295 datatypes_conf.xml.sample
--- a/datatypes_conf.xml.sample Thu Oct 16 14:12:37 2008 -0400
+++ b/datatypes_conf.xml.sample Fri Oct 17 10:46:29 2008 -0400
@@ -150,7 +150,6 @@
     <sniffer order="05" type="galaxy.datatypes.sequence:Maf"/>
     <sniffer order="10" type="galaxy.datatypes.sequence:Lav"/>
     <sniffer order="15" type="galaxy.datatypes.sequence:Fasta"/>
-    <sniffer order="20" type="galaxy.datatypes.sequence:Fastq"/>
     <sniffer order="25" type="galaxy.datatypes.sequence:FastqSolexa"/>
     <sniffer order="30" type="galaxy.datatypes.interval:Wiggle"/>
     <sniffer order="35" type="galaxy.datatypes.images:Html"/>
diff -r a5831435c654 -r f5b051c51295 lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py Thu Oct 16 14:12:37 2008 -0400
+++ b/lib/galaxy/tools/__init__.py Fri Oct 17 10:46:29 2008 -0400
@@ -23,6 +23,7 @@
 from galaxy.tools.actions import DefaultToolAction
 from galaxy.model import directory_hash_id
 from galaxy.util.none_like import NoneDataset
+from galaxy.datatypes import sniff
 
 log = logging.getLogger( __name__ )
 
@@ -1143,22 +1144,21 @@
                 description = param_dict.get( 'position', '' )
                 if not description:
                     description = 'unknown position'
-            data_type = param_dict.get( 'data_type ')
+            data_type = param_dict.get( 'data_type' )
             items = out_data.items()
             for name, data in items:
                 if organism and table and description:
                     data.name  = '%s on %s: %s (%s)' % ( data.name, organism, table, description )
                 data.info = info
                 data.dbkey = dbkey
-                ext = data_type
-                try:
-                    ext = data_type_to_ext[ data_type ]
+                try:
+                    data_type = data_type_to_ext[ data_type ]
                 except:
                     pass
-                if ext not in app.datatypes_registry.datatypes_by_extension:
-                    ext = 'interval'
-                data = app.datatypes_registry.change_datatype( data, ext )
-                # store external data source's request parameters temporarily in output file
+                if data_type not in app.datatypes_registry.datatypes_by_extension:
+                    data_type = 'interval'
+                data = app.datatypes_registry.change_datatype( data, data_type )
+                # Store external data source's request parameters temporarily in output file
                 out = open( data.file_name, 'w' )
                 for key, value in param_dict.items():
                     print >> out, '%s\t%s' % ( key, value )
@@ -1171,9 +1171,15 @@
         # tag set in the tool config.
         if self.tool_type == 'data_source':
             name, data = out_data.items()[0]
-            if data.state == data.states.OK and not data.info:
-                data.info = data.name
-            if not isinstance( data.datatype, datatypes.interval.Bed ) and isinstance( data.datatype, datatypes.interval.Interval ):
+            if data.state == data.states.OK:
+                data.name = param_dict.get( 'name', data.name )
+                data.info = param_dict.get( 'info', data.name )
+                data.dbkey = param_dict.get( 'dbkey', data.dbkey )
+                data.extension = param_dict.get( 'data_type', data.extension )
+            if data.extension == 'txt':
+                data_type = sniff.guess_ext( data.file_name, sniff_order=app.datatypes_registry.sniff_order )
+                data = app.datatypes_registry.change_datatype( data, data_type )
+            elif not isinstance( data.datatype, datatypes.interval.Bed ) and isinstance( data.datatype, datatypes.interval.Interval ):
                 data.set_meta()
                 if data.missing_meta():
                     data = app.datatypes_registry.change_datatype( data, 'tabular' )
diff -r a5831435c654 -r f5b051c51295 tools/data_source/flymine.xml
--- a/tools/data_source/flymine.xml Thu Oct 16 14:12:37 2008 -0400
+++ b/tools/data_source/flymine.xml Fri Oct 17 10:46:29 2008 -0400
@@ -14,7 +14,7 @@
         <request_param galaxy_name="description" remote_name="description" missing="" />
         <request_param galaxy_name="name" remote_name="name" missing="FlyMine query" />
         <request_param galaxy_name="info" remote_name="info" missing="" />
-        <request_param galaxy_name="data_type" remote_name="data_type" missing="interval" />
+        <request_param galaxy_name="data_type" remote_name="data_type" missing="txt" />
     </request_param_translation>
     <uihints minwidth="800"/>
     <outputs>
diff -r a5831435c654 -r f5b051c51295 tools/data_source/ucsc_tablebrowser.xml
--- a/tools/data_source/ucsc_tablebrowser.xml Thu Oct 16 14:12:37 2008 -0400
+++ b/tools/data_source/ucsc_tablebrowser.xml Fri Oct 17 10:46:29 2008 -0400
@@ -16,7 +16,7 @@
         <request_param galaxy_name="organism" remote_name="org" missing="unknown species" />
     <request_param galaxy_name="table" remote_name="hgta_track" missing="unknown table" />
     <request_param galaxy_name="description" remote_name="hgta_regionType" missing="no description" />
-    <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="interval" />
+    <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="bed" />
  </request_param_translation>
  <uihints minwidth="800"/>
  <outputs>
diff -r a5831435c654 -r f5b051c51295 tools/data_source/ucsc_tablebrowser_archaea.xml
--- a/tools/data_source/ucsc_tablebrowser_archaea.xml Thu Oct 16 14:12:37 2008 -0400
+++ b/tools/data_source/ucsc_tablebrowser_archaea.xml Fri Oct 17 10:46:29 2008 -0400
@@ -16,7 +16,7 @@
         <request_param galaxy_name="organism" remote_name="org" missing="unknown species" />
         <request_param galaxy_name="table" remote_name="hgta_track" missing="" />
         <request_param galaxy_name="description" remote_name="hgta_regionType" missing="" />
-        <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="interval" />
+        <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="bed" />
     </request_param_translation>
  <uihints minwidth="800"/>
  <outputs>
diff -r a5831435c654 -r f5b051c51295 tools/data_source/ucsc_tablebrowser_test.xml
--- a/tools/data_source/ucsc_tablebrowser_test.xml Thu Oct 16 14:12:37 2008 -0400
+++ b/tools/data_source/ucsc_tablebrowser_test.xml Fri Oct 17 10:46:29 2008 -0400
@@ -16,7 +16,7 @@
         <request_param galaxy_name="organism" remote_name="org" missing="unknown species" />
         <request_param galaxy_name="table" remote_name="hgta_track" missing="" />
         <request_param galaxy_name="description" remote_name="hgta_regionType" missing="" />
-        <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="interval" />
+        <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="bed" />
     </request_param_translation>
  <uihints minwidth="800"/>
  <outputs>