commit/galaxy-central: 4 new changesets
4 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/224188b46163/ Changeset: 224188b46163 Branch: tool-data-api User: kell...@gmail.com Date: 2014-10-13 17:27:15+00:00 Summary: Adding in tool-data API point Affected #: 3 files diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 224188b4616365fb1b9e20e8f1bd8c70d21d63af lib/galaxy/tools/data/__init__.py --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -514,10 +514,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): + rval = dict( + columns=sorted(self.columns.keys(), key=lambda x:self.columns[x]), + 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 04015a2bc7375f1179950a3f698353d033fc3a5d -r 224188b4616365fb1b9e20e8f1bd8c70d21d63af lib/galaxy/webapps/galaxy/api/tool_data.py --- /dev/null +++ b/lib/galaxy/webapps/galaxy/api/tool_data.py @@ -0,0 +1,31 @@ + +from galaxy import exceptions +from galaxy import web, util +from galaxy.web import _future_expose_api_anonymous +from galaxy.web import _future_expose_api +from galaxy.web.base.controller import BaseAPIController +from galaxy.web.base.controller import UsesVisualizationMixin +from galaxy.web.base.controller import UsesHistoryMixin +from galaxy.visualization.genomes import GenomeRegion +from galaxy.util.json import dumps +from galaxy.visualization.data_providers.genome import * + +from galaxy.managers.collections_util import dictify_dataset_collection_instance + + +class ToolData( BaseAPIController ): + """ + RESTful controller for interactions with tools. + """ + + @web.expose_api + def index( self, trans, **kwds ): + """ + GET /api/tool_data: returns a list tool_data tables:: + + """ + return trans.app.tool_data_tables.data_tables.keys() + + @web.expose_api + def show( self, trans, id, **kwds ): + return trans.app.tool_data_tables.data_tables[id].to_dict() diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 224188b4616365fb1b9e20e8f1bd8c70d21d63af 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' ) https://bitbucket.org/galaxy/galaxy-central/commits/3e978842fac2/ Changeset: 3e978842fac2 Branch: tool-data-api User: kellrott Date: 2014-10-13 20:36:50+00:00 Summary: Making the tool_data api use normal to_dict calls Affected #: 2 files diff -r 224188b4616365fb1b9e20e8f1bd8c70d21d63af -r 3e978842fac25ea4702c8e5b09da0818c74bd028 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' @@ -519,11 +522,11 @@ def xml_string( self ): return util.xml_to_string( self.config_element ) - def to_dict(self): - rval = dict( - columns=sorted(self.columns.keys(), key=lambda x:self.columns[x]), - fields=self.get_fields() - ) + 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 diff -r 224188b4616365fb1b9e20e8f1bd8c70d21d63af -r 3e978842fac25ea4702c8e5b09da0818c74bd028 lib/galaxy/webapps/galaxy/api/tool_data.py --- a/lib/galaxy/webapps/galaxy/api/tool_data.py +++ b/lib/galaxy/webapps/galaxy/api/tool_data.py @@ -24,8 +24,8 @@ GET /api/tool_data: returns a list tool_data tables:: """ - return trans.app.tool_data_tables.data_tables.keys() + return list( a.to_dict() for a in trans.app.tool_data_tables.data_tables.values() ) @web.expose_api def show( self, trans, id, **kwds ): - return trans.app.tool_data_tables.data_tables[id].to_dict() + return trans.app.tool_data_tables.data_tables[id].to_dict(view='element') https://bitbucket.org/galaxy/galaxy-central/commits/8f7128937f08/ Changeset: 8f7128937f08 Branch: tool-data-api User: kellrott Date: 2014-10-13 22:48:50+00:00 Summary: Removing unneeded imports and limiting access to admin for ToolData api Affected #: 1 file diff -r 3e978842fac25ea4702c8e5b09da0818c74bd028 -r 8f7128937f08776c8714aae6a3ee3b22d27c0601 lib/galaxy/webapps/galaxy/api/tool_data.py --- a/lib/galaxy/webapps/galaxy/api/tool_data.py +++ b/lib/galaxy/webapps/galaxy/api/tool_data.py @@ -1,16 +1,6 @@ -from galaxy import exceptions from galaxy import web, util -from galaxy.web import _future_expose_api_anonymous -from galaxy.web import _future_expose_api from galaxy.web.base.controller import BaseAPIController -from galaxy.web.base.controller import UsesVisualizationMixin -from galaxy.web.base.controller import UsesHistoryMixin -from galaxy.visualization.genomes import GenomeRegion -from galaxy.util.json import dumps -from galaxy.visualization.data_providers.genome import * - -from galaxy.managers.collections_util import dictify_dataset_collection_instance class ToolData( BaseAPIController ): @@ -18,6 +8,7 @@ RESTful controller for interactions with tools. """ + @web.require_admin @web.expose_api def index( self, trans, **kwds ): """ @@ -26,6 +17,7 @@ """ 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') 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