From c454370ff76959445f4de23998fadaddb2790191 Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Thu, 13 Nov 2008 14:56:33 -0500 Subject: [PATCH] Add a new 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. --- lib/galaxy/tools/__init__.py | 13 +++++++++++++ lib/galaxy/util/__init__.py | 12 +++++++++++- lib/galaxy/webapps/reports/controllers/jobs.py | 9 +++------ .../reports/templates/jobs_per_month_in_error.mako | 4 ++-- .../templates/jobs_specified_date_in_error.mako | 4 +--- .../templates/jobs_specified_month_in_error.mako | 4 ++-- tools/data_source/ucsc_tablebrowser.xml | 6 +++++- tools/data_source/ucsc_tablebrowser_archaea.xml | 6 +++++- tools/data_source/ucsc_tablebrowser_test.xml | 6 +++++- 9 files changed, 47 insertions(+), 17 deletions(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index a79843d046a..8e3fee4eae1 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -242,6 +242,19 @@ class Tool: 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 + # + # + # + 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 --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index a3e07c5985d..5c7d068f861 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -155,7 +155,17 @@ class Params: 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 --git a/lib/galaxy/webapps/reports/controllers/jobs.py b/lib/galaxy/webapps/reports/controllers/jobs.py index f0630198355..d14b6bfe04d 100644 --- a/lib/galaxy/webapps/reports/controllers/jobs.py +++ b/lib/galaxy/webapps/reports/controllers/jobs.py @@ -91,8 +91,7 @@ class Jobs( BaseController ): 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 @@ class Jobs( BaseController ): 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 @@ class Jobs( BaseController ): 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 --git a/lib/galaxy/webapps/reports/templates/jobs_per_month_in_error.mako b/lib/galaxy/webapps/reports/templates/jobs_per_month_in_error.mako index c4818677f5a..92b8158330e 100644 --- a/lib/galaxy/webapps/reports/templates/jobs_per_month_in_error.mako +++ b/lib/galaxy/webapps/reports/templates/jobs_per_month_in_error.mako @@ -2,7 +2,7 @@ <%def name="main_body()">
-

Jobs In Error Per Month ( includes jobs deleted before finishing )

+

Jobs In Error Per Month

Click Month to view the number of jobs in error for each day of that month

%if msg: @@ -11,7 +11,7 @@ %endif
%if len( jobs ) == 0: - + %else: diff --git a/lib/galaxy/webapps/reports/templates/jobs_specified_date_in_error.mako b/lib/galaxy/webapps/reports/templates/jobs_specified_date_in_error.mako index 3da2741aa95..633919e33c6 100644 --- a/lib/galaxy/webapps/reports/templates/jobs_specified_date_in_error.mako +++ b/lib/galaxy/webapps/reports/templates/jobs_specified_date_in_error.mako @@ -10,15 +10,13 @@ %endif
There are no jobs in the deleted or error state
There are no jobs in the error state
Month
%if len( jobs ) == 0: - + %else: %for job in jobs: <% state = job[0] if state == 'error': rowdef = '' - elif state == 'deleted': - rowdef = '' else: rowdef = '' %> diff --git a/lib/galaxy/webapps/reports/templates/jobs_specified_month_in_error.mako b/lib/galaxy/webapps/reports/templates/jobs_specified_month_in_error.mako index 1f649fffca1..1bca33cef29 100644 --- a/lib/galaxy/webapps/reports/templates/jobs_specified_month_in_error.mako +++ b/lib/galaxy/webapps/reports/templates/jobs_specified_month_in_error.mako @@ -2,7 +2,7 @@ <%def name="main_body()">
-

Jobs in Error for ${month_label} ${year_label} ( includes jobs deleted before finishing )

+

Jobs in Error for ${month_label} ${year_label}

Click Jobs in Error to view jobs in error for that day

%if msg:
There are no jobs in the deleted or error state for ${day_label}, ${month_label} ${day_of_month}, ${year_label}
There are no jobs in the error state for ${day_label}, ${month_label} ${day_of_month}, ${year_label}
@@ -11,7 +11,7 @@ %endif
%if len( jobs ) == 0: - + %else: diff --git a/tools/data_source/ucsc_tablebrowser.xml b/tools/data_source/ucsc_tablebrowser.xml index 6146e5d10f2..e00e5db7d1c 100644 --- a/tools/data_source/ucsc_tablebrowser.xml +++ b/tools/data_source/ucsc_tablebrowser.xml @@ -21,7 +21,11 @@ - + + + + + diff --git a/tools/data_source/ucsc_tablebrowser_archaea.xml b/tools/data_source/ucsc_tablebrowser_archaea.xml index de59043ad15..807ac75e015 100644 --- a/tools/data_source/ucsc_tablebrowser_archaea.xml +++ b/tools/data_source/ucsc_tablebrowser_archaea.xml @@ -21,7 +21,11 @@ - + + + + + diff --git a/tools/data_source/ucsc_tablebrowser_test.xml b/tools/data_source/ucsc_tablebrowser_test.xml index 6a0a5c909ab..e1ace249977 100644 --- a/tools/data_source/ucsc_tablebrowser_test.xml +++ b/tools/data_source/ucsc_tablebrowser_test.xml @@ -21,7 +21,11 @@ - + + + + +
There are no jobs in error for ${month_label} ${year_label}
There are no jobs in the error state for ${month_label} ${year_label}
Day