commit/galaxy-central: dannon: Merged in kellrott/galaxy-farm/tool-data-api (pull request #529)
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/46a1b41a275d/ Changeset: 46a1b41a275d User: dannon Date: 2014-10-14 22:18:25+00:00 Summary: Merged in kellrott/galaxy-farm/tool-data-api (pull request #529) Adding Tool-Data API Affected #: 3 files diff -r f31f262f9f42a3f7ce37d276edbdd5f516d4ff29 -r 46a1b41a275dc29dad7dd012d881239625c85154 lib/galaxy/tools/data/__init__.py --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -15,6 +15,8 @@ from galaxy import util from galaxy.util.odict import odict +from galaxy.model.item_attrs import Dictifiable + log = logging.getLogger( __name__ ) DEFAULT_TABLE_TYPE = 'tabular' @@ -223,7 +225,7 @@ return self._update_version() -class TabularToolDataTable( ToolDataTable ): +class TabularToolDataTable( ToolDataTable, Dictifiable ): """ Data stored in a tabular / separated value format on disk, allows multiple files to be merged but all must have the same column definitions:: @@ -235,6 +237,7 @@ </table> """ + dict_collection_visible_keys = [ 'name' ] type_key = 'tabular' @@ -514,10 +517,17 @@ else: replace = " " return map( lambda x: x.replace( separator, replace ), fields ) - + @property def xml_string( self ): return util.xml_to_string( self.config_element ) + def to_dict(self, view='collection'): + rval = super(TabularToolDataTable, self).to_dict() + if view == 'element': + rval['columns'] = sorted(self.columns.keys(), key=lambda x:self.columns[x]) + rval['fields'] = self.get_fields() + return rval + # Registry of tool data types by type_key tool_data_table_types = dict( [ ( cls.type_key, cls ) for cls in [ TabularToolDataTable ] ] ) diff -r f31f262f9f42a3f7ce37d276edbdd5f516d4ff29 -r 46a1b41a275dc29dad7dd012d881239625c85154 lib/galaxy/webapps/galaxy/api/tool_data.py --- /dev/null +++ b/lib/galaxy/webapps/galaxy/api/tool_data.py @@ -0,0 +1,23 @@ + +from galaxy import web, util +from galaxy.web.base.controller import BaseAPIController + + +class ToolData( BaseAPIController ): + """ + RESTful controller for interactions with tools. + """ + + @web.require_admin + @web.expose_api + def index( self, trans, **kwds ): + """ + GET /api/tool_data: returns a list tool_data tables:: + + """ + return list( a.to_dict() for a in trans.app.tool_data_tables.data_tables.values() ) + + @web.require_admin + @web.expose_api + def show( self, trans, id, **kwds ): + return trans.app.tool_data_tables.data_tables[id].to_dict(view='element') diff -r f31f262f9f42a3f7ce37d276edbdd5f516d4ff29 -r 46a1b41a275dc29dad7dd012d881239625c85154 lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -170,6 +170,7 @@ path_prefix='/api/histories/:history_id/contents/:history_content_id' ) webapp.mapper.resource( 'dataset', 'datasets', path_prefix='/api' ) + webapp.mapper.resource( 'tool_data', 'tool_data', path_prefix='/api' ) webapp.mapper.resource( 'dataset_collection', 'dataset_collections', path_prefix='/api/') webapp.mapper.resource( 'sample', 'samples', path_prefix='/api' ) webapp.mapper.resource( 'request', 'requests', path_prefix='/api' ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org