[hg] galaxy 1630: Add a new <data_type_translation> tag set to d...
details: http://www.bx.psu.edu/hg/galaxy/rev/311ee61dc989 changeset: 1630:311ee61dc989 user: Greg Von Kuster <greg@bx.psu.edu> date: Thu Nov 13 14:56:33 2008 -0500 description: Add a new <data_type_translation> tag set to data_source tools that enable the translation of an unsupported data type to a supported one in Galaxy ( currently only used in UCSC ). Also some tweaks to the jobs reports. 9 file(s) affected in this change: lib/galaxy/tools/__init__.py lib/galaxy/util/__init__.py lib/galaxy/webapps/reports/controllers/jobs.py lib/galaxy/webapps/reports/templates/jobs_per_month_in_error.mako lib/galaxy/webapps/reports/templates/jobs_specified_date_in_error.mako lib/galaxy/webapps/reports/templates/jobs_specified_month_in_error.mako tools/data_source/ucsc_tablebrowser.xml tools/data_source/ucsc_tablebrowser_archaea.xml tools/data_source/ucsc_tablebrowser_test.xml diffs (188 lines): diff -r df23879dec70 -r 311ee61dc989 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py Wed Nov 12 15:42:46 2008 -0500 +++ b/lib/galaxy/tools/__init__.py Thu Nov 13 14:56:33 2008 -0500 @@ -242,6 +242,19 @@ remote_name = req_param.get( "remote_name" ) trans_list.append( req_param.get( "galaxy_name" ) ) trans_list.append( req_param.get( "missing" ) ) + if req_param.get( "galaxy_name" ) == "data_type": + # The req_param tag for data_type is special in that it can contain another tag set like + # <data_type_translation> + # <format galaxy_format="tabular" remote_format="selectedFields" /> + # </data_type_translation> + format_trans = req_param.find( "data_type_translation" ) + if format_trans is not None: + format_trans_dict = {} + for format in format_trans.findall( "format" ): + remote_format = format.get( "remote_format" ) + galaxy_format = format.get( "galaxy_format" ) + format_trans_dict[ remote_format ] = galaxy_format + trans_list.append( format_trans_dict ) self.param_trans_dict[ remote_name ] = trans_list # Command line (template). Optional for tools that do not invoke a local program command = root.find("command") diff -r df23879dec70 -r 311ee61dc989 lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py Wed Nov 12 15:42:46 2008 -0500 +++ b/lib/galaxy/util/__init__.py Thu Nov 13 14:56:33 2008 -0500 @@ -155,7 +155,17 @@ if tool and tool.tool_type == 'data_source': if key in tool.param_trans_dict: new_key = tool.param_trans_dict[ key ][0] - if not value: + if new_key == 'data_type': + try: + # The Galaxy "data_type entry is special in that it can include the ability + # to translate the format to a Galaxy supported format. In the dict, this entry + # looks something like: {'hgta_outputType': ['data_type', 'bed', {'selectedFields': 'tabular'}] } + format_trans_dict = tool.param_trans_dict[ key ][2] + if value in format_trans_dict: + new_value = format_trans_dict[ value ] + except: + pass + if not value and not new_value: new_value = tool.param_trans_dict[ key ][1] if key not in self.NEVER_SANITIZE and sanitize: self.__dict__[ new_key ] = sanitize_param( new_value ) diff -r df23879dec70 -r 311ee61dc989 lib/galaxy/webapps/reports/controllers/jobs.py --- a/lib/galaxy/webapps/reports/controllers/jobs.py Wed Nov 12 15:42:46 2008 -0500 +++ b/lib/galaxy/webapps/reports/controllers/jobs.py Thu Nov 13 14:56:33 2008 -0500 @@ -91,8 +91,7 @@ year_label = start_date.strftime( "%Y" ) q = sa.select( ( sa.func.date( galaxy.model.Job.table.c.create_time ).label( 'date' ), sa.func.count( galaxy.model.Job.table.c.id ).label( 'total_jobs' ) ), - whereclause = sa.and_( sa.or_( galaxy.model.Job.table.c.state == 'error', - galaxy.model.Job.table.c.state == 'deleted' ), + whereclause = sa.and_( galaxy.model.Job.table.c.state == 'error', galaxy.model.Job.table.c.create_time >= start_date, galaxy.model.Job.table.c.create_time < end_date ), from_obj = [ sa.outerjoin( galaxy.model.Job.table, @@ -134,8 +133,7 @@ galaxy.model.Job.table.c.info, ( galaxy.model.User.table.c.email ).label( 'user_email' ), galaxy.model.GalaxySession.table.c.remote_addr ), - whereclause = sa.and_( sa.or_( galaxy.model.Job.table.c.state == 'error', - galaxy.model.Job.table.c.state == 'deleted' ), + whereclause = sa.and_( galaxy.model.Job.table.c.state == 'error', galaxy.model.Job.table.c.create_time >= start_date, galaxy.model.Job.table.c.create_time < end_date ), from_obj = [ sa.outerjoin( galaxy.model.Job.table, @@ -305,8 +303,7 @@ msg = '' q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date( galaxy.model.Job.table.c.create_time ) ).label( 'date' ), sa.func.count( galaxy.model.Job.table.c.id ).label( 'total_jobs' ) ), - whereclause = sa.or_( galaxy.model.Job.table.c.state == 'error', - galaxy.model.Job.table.c.state == 'deleted' ), + whereclause = galaxy.model.Job.table.c.state == 'error', from_obj = [ galaxy.model.Job.table ], group_by = [ sa.func.date_trunc( 'month', sa.func.date( galaxy.model.Job.table.c.create_time ) ) ], order_by = [ sa.desc( 'date' ) ] ) diff -r df23879dec70 -r 311ee61dc989 lib/galaxy/webapps/reports/templates/jobs_per_month_in_error.mako --- a/lib/galaxy/webapps/reports/templates/jobs_per_month_in_error.mako Wed Nov 12 15:42:46 2008 -0500 +++ b/lib/galaxy/webapps/reports/templates/jobs_per_month_in_error.mako Thu Nov 13 14:56:33 2008 -0500 @@ -2,7 +2,7 @@ <%def name="main_body()"> <div class="reportBody"> - <h3 align="center">Jobs In Error Per Month ( includes jobs deleted before finishing )</h3> + <h3 align="center">Jobs In Error Per Month</h3> <h4 align="center">Click Month to view the number of jobs in error for each day of that month</h4> %if msg: <table align="center" width="70%" class="border" cellpadding="5" cellspacing="5"> @@ -11,7 +11,7 @@ %endif <table align="center" width="60%" class="colored"> %if len( jobs ) == 0: - <tr><td colspan="2">There are no jobs in the deleted or error state</td></tr> + <tr><td colspan="2">There are no jobs in the error state</td></tr> %else: <tr class="header"> <td>Month</td> diff -r df23879dec70 -r 311ee61dc989 lib/galaxy/webapps/reports/templates/jobs_specified_date_in_error.mako --- a/lib/galaxy/webapps/reports/templates/jobs_specified_date_in_error.mako Wed Nov 12 15:42:46 2008 -0500 +++ b/lib/galaxy/webapps/reports/templates/jobs_specified_date_in_error.mako Thu Nov 13 14:56:33 2008 -0500 @@ -10,15 +10,13 @@ %endif <table align="center" width="60%" class="colored"> %if len( jobs ) == 0: - <tr><td colspan="5">There are no jobs in the deleted or error state for ${day_label}, ${month_label} ${day_of_month}, ${year_label}</td></tr> + <tr><td colspan="5">There are no jobs in the error state for ${day_label}, ${month_label} ${day_of_month}, ${year_label}</td></tr> %else: %for job in jobs: <% state = job[0] if state == 'error': rowdef = '<tr class="headererror">' - elif state == 'deleted': - rowdef = '<tr class="headerdeleted">' else: rowdef = '<tr class="headerunknown">' %> diff -r df23879dec70 -r 311ee61dc989 lib/galaxy/webapps/reports/templates/jobs_specified_month_in_error.mako --- a/lib/galaxy/webapps/reports/templates/jobs_specified_month_in_error.mako Wed Nov 12 15:42:46 2008 -0500 +++ b/lib/galaxy/webapps/reports/templates/jobs_specified_month_in_error.mako Thu Nov 13 14:56:33 2008 -0500 @@ -2,7 +2,7 @@ <%def name="main_body()"> <div class="reportBody"> - <h3 align="center">Jobs in Error for ${month_label} ${year_label} ( includes jobs deleted before finishing )</h3> + <h3 align="center">Jobs in Error for ${month_label} ${year_label}</h3> <h4 align="center">Click Jobs in Error to view jobs in error for that day</h4> %if msg: <table align="center" width="70%" class="border" cellpadding="5" cellspacing="5"> @@ -11,7 +11,7 @@ %endif <table align="center" width="60%" class="colored"> %if len( jobs ) == 0: - <tr><td colspan="3">There are no jobs in error for ${month_label} ${year_label}</td></tr> + <tr><td colspan="3">There are no jobs in the error state for ${month_label} ${year_label}</td></tr> %else: <tr class="header"> <td>Day</td> diff -r df23879dec70 -r 311ee61dc989 tools/data_source/ucsc_tablebrowser.xml --- a/tools/data_source/ucsc_tablebrowser.xml Wed Nov 12 15:42:46 2008 -0500 +++ b/tools/data_source/ucsc_tablebrowser.xml Thu Nov 13 14:56:33 2008 -0500 @@ -21,7 +21,11 @@ <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="bed" /> + <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="bed" > + <data_type_translation> + <format galaxy_format="tabular" remote_format="selectedFields" /> + </data_type_translation> + </request_param> </request_param_translation> <uihints minwidth="800"/> <outputs> diff -r df23879dec70 -r 311ee61dc989 tools/data_source/ucsc_tablebrowser_archaea.xml --- a/tools/data_source/ucsc_tablebrowser_archaea.xml Wed Nov 12 15:42:46 2008 -0500 +++ b/tools/data_source/ucsc_tablebrowser_archaea.xml Thu Nov 13 14:56:33 2008 -0500 @@ -21,7 +21,11 @@ <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="bed" /> + <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="bed" > + <data_type_translation> + <format galaxy_format="tabular" remote_format="selectedFields" /> + </data_type_translation> + </request_param> </request_param_translation> <uihints minwidth="800"/> <outputs> diff -r df23879dec70 -r 311ee61dc989 tools/data_source/ucsc_tablebrowser_test.xml --- a/tools/data_source/ucsc_tablebrowser_test.xml Wed Nov 12 15:42:46 2008 -0500 +++ b/tools/data_source/ucsc_tablebrowser_test.xml Thu Nov 13 14:56:33 2008 -0500 @@ -21,7 +21,11 @@ <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="bed" /> + <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="bed" > + <data_type_translation> + <format galaxy_format="tabular" remote_format="selectedFields" /> + </data_type_translation> + </request_param> </request_param_translation> <uihints minwidth="800"/> <outputs>
participants (1)
-
Greg Von Kuster