galaxy-commits
Threads by month
- ----- 2025 -----
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
galaxy-dist commit 7ea4c156ae32: Add a pop-up menu for a sample if it is possible to either select datasets to transfer or transfer selected datasets for the sample. Also use better naming convention for a key variable name.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289492968 18000
# Node ID 7ea4c156ae32c4757378229bfc49584df91a024a
# Parent 591c53b44ae4a6237a841adaa3abfe59829beebe
Add a pop-up menu for a sample if it is possible to either select datasets to transfer or transfer selected datasets for the sample. Also use better naming convention for a key variable name.
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -212,14 +212,14 @@ class RequestsCommon( BaseController, Us
except:
return invalid_id_redirect( trans, cntrller, request_id )
sample_state_id = params.get( 'sample_state_id', None )
- # Get the user entered sample information
- current_samples = self.__get_sample_widgets( trans, request, request.samples, **kwd )
+ # Build a list of sample widgets (based on the attributes of each sample) for display.
+ displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
request_widgets = self.__get_request_widgets( trans, request.id )
return trans.fill_template( '/requests/common/view_request.mako',
cntrller=cntrller,
request=request,
request_widgets=request_widgets,
- current_samples=current_samples,
+ displayable_sample_widgets=displayable_sample_widgets,
status=status,
message=message )
@web.expose
@@ -415,8 +415,8 @@ class RequestsCommon( BaseController, Us
editing_samples=editing_samples ) )
# Get all libraries for which the current user has permission to add items.
libraries = request.user.accessible_libraries( trans, [ trans.app.security_agent.permitted_actions.LIBRARY_ADD ] )
- # Get the user entered sample information
- current_samples = self.__get_sample_widgets( trans, request, request.samples, **kwd )
+ # Build a list of sample widgets (based on the attributes of each sample) for display.
+ displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
encoded_selected_sample_ids = self.__get_encoded_selected_sample_ids( trans, request, **kwd )
sample_operation = params.get( 'sample_operation', 'none' )
def handle_error( **kwd ):
@@ -433,14 +433,17 @@ class RequestsCommon( BaseController, Us
handle_error( **kwd )
if params.get( 'import_samples_button', False ):
# Import sample field values from a csv file
- return self.__import_samples( trans, cntrller, request, current_samples, libraries, **kwd )
+ return self.__import_samples( trans, cntrller, request, displayable_sample_widgets, libraries, **kwd )
elif params.get( 'add_sample_button', False ):
return self.add_sample( trans, cntrller, request_id, **kwd )
elif params.get( 'save_samples_button', False ):
if encoded_selected_sample_ids:
- # This gets tricky because we need the list of samples to include the same number
- # of objects that that current_samples ( i.e., request.samples ) has. We'll first
- # get the set of samples corresponding to the checked sample ids.
+ # We need the list of displayable_sample_widgets to include the same number
+ # of objects that that request.samples has so that we can enumerate over each
+ # list without problems. We have to be careful here since the user may have
+ # used the multi-select check boxes when editing sample widgets, but didn't
+ # select all of them. We'll first get the set of samples corresponding to the
+ # checked sample ids.
samples = []
selected_samples = []
for encoded_sample_id in encoded_selected_sample_ids:
@@ -453,12 +456,12 @@ class RequestsCommon( BaseController, Us
else:
samples.append( None )
# The __save_samples method requires sample_widgets, not sample objects
- samples = self.__get_sample_widgets( trans, request, samples, **kwd )
+ sample_widgets = self.__get_sample_widgets( trans, request, samples, **kwd )
else:
- samples = current_samples
- return self.__save_samples( trans, cntrller, request, samples, **kwd )
+ sample_widgets = displayable_sample_widgets
+ return self.__save_samples( trans, cntrller, request, sample_widgets, **kwd )
request_widgets = self.__get_request_widgets( trans, request.id )
- sample_copy = self.__build_copy_sample_select_field( trans, current_samples )
+ sample_copy = self.__build_copy_sample_select_field( trans, displayable_sample_widgets )
libraries_select_field, folders_select_field = self.__build_library_and_folder_select_fields( trans,
request.user,
0,
@@ -473,7 +476,7 @@ class RequestsCommon( BaseController, Us
request=request,
encoded_selected_sample_ids=encoded_selected_sample_ids,
request_widgets=request_widgets,
- current_samples=current_samples,
+ displayable_sample_widgets=displayable_sample_widgets,
sample_copy=sample_copy,
libraries=libraries,
sample_operation_select_field=sample_operation_select_field,
@@ -805,12 +808,12 @@ class RequestsCommon( BaseController, Us
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
# Get the widgets for rendering the request form
request_widgets = self.__get_request_widgets( trans, request.id )
- current_samples = self.__get_sample_widgets( trans, request, request.samples, **kwd )
- if not current_samples:
+ displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
+ if not displayable_sample_widgets:
# Form field names are zero-based.
sample_index = 0
else:
- sample_index = len( current_samples )
+ sample_index = len( displayable_sample_widgets )
if params.get( 'add_sample_button', False ):
# Get all libraries for which the current user has permission to add items
libraries = request.user.accessible_libraries( trans, [ trans.app.security_agent.permitted_actions.LIBRARY_ADD ] )
@@ -818,18 +821,18 @@ class RequestsCommon( BaseController, Us
# See if the user has selected a sample to copy.
copy_sample_index = int( params.get( 'copy_sample_index', -1 ) )
for index in range( num_samples_to_add ):
- id_index = len( current_samples ) + 1
+ id_index = len( displayable_sample_widgets ) + 1
if copy_sample_index != -1:
# The user has selected a sample to copy.
- library_id = current_samples[ copy_sample_index][ 'library_select_field' ].get_selected( return_value=True )
- folder_id = current_samples[ copy_sample_index ][ 'folder_select_field' ].get_selected( return_value=True )
- name = current_samples[ copy_sample_index ][ 'name' ] + '_%i' % ( len( current_samples ) + 1 )
- field_values = [ val for val in current_samples[ copy_sample_index ][ 'field_values' ] ]
+ library_id = displayable_sample_widgets[ copy_sample_index][ 'library_select_field' ].get_selected( return_value=True )
+ folder_id = displayable_sample_widgets[ copy_sample_index ][ 'folder_select_field' ].get_selected( return_value=True )
+ name = displayable_sample_widgets[ copy_sample_index ][ 'name' ] + '_%i' % ( len( displayable_sample_widgets ) + 1 )
+ field_values = [ val for val in displayable_sample_widgets[ copy_sample_index ][ 'field_values' ] ]
else:
# The user has not selected a sample to copy, just adding a new generic sample.
library_id = None
folder_id = None
- name = 'Sample_%i' % ( len( current_samples ) + 1 )
+ name = 'Sample_%i' % ( len( displayable_sample_widgets ) + 1 )
field_values = [ '' for field in request.type.sample_form.fields ]
# Build the library_select_field and folder_select_field for the new sample being added.
library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans,
@@ -841,25 +844,26 @@ class RequestsCommon( BaseController, Us
folder_id=folder_id,
**kwd )
# Append the new sample to the current list of samples for the request
- current_samples.append( dict( name=name,
- barcode='',
- library=None,
- library_id=library_id,
- folder=None,
- folder_id=folder_id,
- field_values=field_values,
- library_select_field=library_select_field,
- folder_select_field=folder_select_field ) )
+ displayable_sample_widgets.append( dict( id=None,
+ name=name,
+ barcode='',
+ library=None,
+ library_id=library_id,
+ folder=None,
+ folder_id=folder_id,
+ field_values=field_values,
+ library_select_field=library_select_field,
+ folder_select_field=folder_select_field ) )
encoded_selected_sample_ids = self.__get_encoded_selected_sample_ids( trans, request, **kwd )
sample_operation = params.get( 'sample_operation', 'none' )
sample_operation_select_field = self.__build_sample_operation_select_field( trans, is_admin, request, sample_operation )
- sample_copy = self.__build_copy_sample_select_field( trans, current_samples )
+ sample_copy = self.__build_copy_sample_select_field( trans, displayable_sample_widgets )
return trans.fill_template( '/requests/common/edit_samples.mako',
cntrller=cntrller,
request=request,
encoded_selected_sample_ids=encoded_selected_sample_ids,
request_widgets=request_widgets,
- current_samples=current_samples,
+ displayable_sample_widgets=displayable_sample_widgets,
sample_operation_select_field=sample_operation_select_field,
sample_copy=sample_copy,
editing_samples=False,
@@ -876,9 +880,9 @@ class RequestsCommon( BaseController, Us
request = trans.sa_session.query( trans.model.Request ).get( trans.security.decode_id( request_id ) )
except:
return invalid_id_redirect( trans, cntrller, request_id )
- current_samples = self.__get_sample_widgets( trans, request, request.samples, **kwd )
+ displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
sample_index = int( params.get( 'sample_id', 0 ) )
- sample_name = current_samples[sample_index]['name']
+ sample_name = displayable_sample_widgets[sample_index]['name']
sample = request.has_sample( sample_name )
if sample:
trans.sa_session.delete( sample.values )
@@ -960,7 +964,7 @@ class RequestsCommon( BaseController, Us
status=status,
files=[],
folder_path=folder_path )
- def __import_samples( self, trans, cntrller, request, current_samples, libraries, **kwd ):
+ def __import_samples( self, trans, cntrller, request, displayable_sample_widgets, libraries, **kwd ):
"""
Reads the samples csv file and imports all the samples. The format of the csv file is:
SampleName,DataLibrary,DataLibraryFolder,Field1,Field2....
@@ -987,19 +991,20 @@ class RequestsCommon( BaseController, Us
folder_id = folder.id
library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans,
request.user,
- len( current_samples ),
+ len( displayable_sample_widgets ),
libraries,
None,
library_id,
folder_id,
**kwd )
- current_samples.append( dict( name=row[0],
- barcode='',
- library=None,
- folder=None,
- library_select_field=library_select_field,
- folder_select_field=folder_select_field,
- field_values=row[3:] ) )
+ displayable_sample_widgets.append( dict( id=None,
+ name=row[0],
+ barcode='',
+ library=None,
+ folder=None,
+ library_select_field=library_select_field,
+ folder_select_field=folder_select_field,
+ field_values=row[3:] ) )
except Exception, e:
if str( e ) == "'unicode' object has no attribute 'file'":
message = "Select a file"
@@ -1014,12 +1019,12 @@ class RequestsCommon( BaseController, Us
status='error',
message=message ) )
request_widgets = self.__get_request_widgets( trans, request.id )
- sample_copy = self.__build_copy_sample_select_field( trans, current_samples )
+ sample_copy = self.__build_copy_sample_select_field( trans, displayable_sample_widgets )
return trans.fill_template( '/requests/common/edit_samples.mako',
cntrller=cntrller,
request=request,
request_widgets=request_widgets,
- current_samples=current_samples,
+ displayable_sample_widgets=displayable_sample_widgets,
sample_copy=sample_copy,
editing_samples=False )
def __save_samples( self, trans, cntrller, request, samples, **kwd ):
@@ -1110,17 +1115,17 @@ class RequestsCommon( BaseController, Us
# by the admin ( i.e., the sample's SampleState would be set to request.type.states[0] ).
for index in range( len( samples ) - len( request.samples ) ):
sample_index = len( request.samples )
- current_sample = samples[ sample_index ]
- form_values = trans.model.FormValues( request.type.sample_form, current_sample[ 'field_values' ] )
+ sample_widget = samples[ sample_index ]
+ form_values = trans.model.FormValues( request.type.sample_form, sample_widget[ 'field_values' ] )
trans.sa_session.add( form_values )
trans.sa_session.flush()
- s = trans.model.Sample( name=current_sample[ 'name' ],
+ s = trans.model.Sample( name=sample_widget[ 'name' ],
desc='',
request=request,
form_values=form_values,
bar_code='',
- library=current_sample[ 'library' ],
- folder=current_sample[ 'folder' ] )
+ library=sample_widget[ 'library' ],
+ folder=sample_widget[ 'folder' ] )
trans.sa_session.add( s )
trans.sa_session.flush()
return trans.response.send_redirect( web.url_for( controller='requests_common',
@@ -1264,9 +1269,9 @@ class RequestsCommon( BaseController, Us
for index, sample in enumerate( samples ):
id_index = index + 1
if sample is None:
- # Id sample is None, then we'll use the sample from the request object since it will
- # not have updated =values from kwd.
+ # Use the sample from the request object since it will not have updated values from kwd.
sample = request.samples[ index ]
+ sample_id = sample.id
name = sample.name
bar_code = sample.bar_code
library = sample.library
@@ -1274,6 +1279,7 @@ class RequestsCommon( BaseController, Us
field_values = sample.values.content
else:
# Update the sample attributes from kwd
+ sample_id = None
name = util.restore_text( params.get( 'sample_%i_name' % index, sample.name ) )
bar_code = util.restore_text( params.get( 'sample_%i_barcode' % index, sample.bar_code ) )
library_id = util.restore_text( params.get( 'sample_%i_library_id' % id_index, '' ) )
@@ -1295,7 +1301,8 @@ class RequestsCommon( BaseController, Us
library_id=library_id,
folder_id=folder_id,
**kwd )
- sample_widgets.append( dict( name=name,
+ sample_widgets.append( dict( id=sample_id,
+ name=name,
barcode=bar_code,
library=library,
folder=folder,
@@ -1325,7 +1332,8 @@ class RequestsCommon( BaseController, Us
library_id=library_id,
folder_id=folder_id,
**kwd )
- sample_widgets.append( dict( name=name,
+ sample_widgets.append( dict( id=None,
+ name=name,
barcode=bar_code,
library=library,
folder=folder,
@@ -1335,10 +1343,10 @@ class RequestsCommon( BaseController, Us
index += 1
return sample_widgets
# ===== Methods for building SelectFields used on various request forms =====
- def __build_copy_sample_select_field( self, trans, current_samples ):
+ def __build_copy_sample_select_field( self, trans, displayable_sample_widgets ):
copy_sample_index_select_field = SelectField( 'copy_sample_index' )
copy_sample_index_select_field.add_option( 'None', -1, selected=True )
- for index, sample_dict in enumerate( current_samples ):
+ for index, sample_dict in enumerate( displayable_sample_widgets ):
copy_sample_index_select_field.add_option( sample_dict[ 'name' ], index )
return copy_sample_index_select_field
def __build_request_type_id_select_field( self, trans, selected_value='none' ):
@@ -1458,20 +1466,20 @@ class RequestsCommon( BaseController, Us
message += '<b>' + ef + '</b> '
return message
return None
- def __validate_sample_names( self, trans, cntrller, request, current_samples, **kwd ):
+ def __validate_sample_names( self, trans, cntrller, request, displayable_sample_widgets, **kwd ):
# Check for duplicate sample names for all samples of the request.
editing_samples = util.string_as_bool( kwd.get( 'editing_samples', False ) )
message = ''
- for index in range( len( current_samples ) - len( request.samples ) ):
+ for index in range( len( displayable_sample_widgets ) - len( request.samples ) ):
sample_index = index + len( request.samples )
- current_sample = current_samples[ sample_index ]
- sample_name = current_sample[ 'name' ]
+ sample_widget = displayable_sample_widgets[ sample_index ]
+ sample_name = sample_widget[ 'name' ]
if not sample_name.strip():
message = 'Enter the name of sample number %i' % sample_index
break
count = 0
- for i in range( len( current_samples ) ):
- if sample_name == current_samples[ i ][ 'name' ]:
+ for i in range( len( displayable_sample_widgets ) ):
+ if sample_name == displayable_sample_widgets[ i ][ 'name' ]:
count += 1
if count > 1:
message = "You tried to add %i samples with the name (%s). Samples belonging to a request must have unique names." % ( count, sample_name )
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -113,7 +113,7 @@
</script></%def>
-<%def name="render_editable_sample_row( cntrller, sample, current_sample_index, current_sample, encoded_selected_sample_ids )">
+<%def name="render_editable_sample_row( cntrller, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )"><%
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
if sample:
@@ -145,7 +145,7 @@
<td><input type="checkbox" name=select_sample_${sample.id} id="sample_checkbox" value="true" ${checked_str}/><input type="hidden" name=select_sample_${sample.id} id="sample_checkbox" value="true"/></td>
%endif
<td valign="top">
- <input type="text" name="sample_${current_sample_index}_name" value="${current_sample['name']}" size="10"/>
+ <input type="text" name="sample_${sample_widget_index}_name" value="${sample_widget['name']}" size="10"/><div class="toolParamHelp" style="clear: both;"><i>${' (required)' }</i></div>
@@ -153,10 +153,10 @@
%if display_bar_code:
<td valign="top">
%if is_admin:
- <input type="text" name="sample_${current_sample_index}_barcode" value="${current_sample['barcode']}" size="10"/>
+ <input type="text" name="sample_${sample_widget_index}_barcode" value="${sample_widget['barcode']}" size="10"/>
%else:
- ${current_sample['barcode']}
- <input type="hidden" name="sample_${current_sample_index}_barcode" value="${current_sample['barcode']}"/>
+ ${sample_widget['barcode']}
+ <input type="hidden" name="sample_${sample_widget_index}_barcode" value="${sample_widget['barcode']}"/>
%endif
</td>
%endif
@@ -169,8 +169,8 @@
%else:
<td></td>
%endif
- <td valign="top">${current_sample['library_select_field'].get_html()}</td>
- <td valign="top">${current_sample['folder_select_field'].get_html()}</td>
+ <td valign="top">${sample_widget['library_select_field'].get_html()}</td>
+ <td valign="top">${sample_widget['folder_select_field'].get_html()}</td>
%if display_datasets:
<td valign="top">
## An admin can select the datasets to transfer, while a non-admin can only view what has been selected
@@ -220,11 +220,11 @@
%endif
%if can_delete_samples:
## Delete button
- <td valign="top"><a class="action-button" href="${h.url_for( controller='requests_common', action='delete_sample', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=current_sample_index )}"><img src="${h.url_for('/static/images/delete_icon.png')}" style="cursor:pointer;"/></a></td>
+ <td valign="top"><a class="action-button" href="${h.url_for( controller='requests_common', action='delete_sample', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=sample_widget_index )}"><img src="${h.url_for('/static/images/delete_icon.png')}" style="cursor:pointer;"/></a></td>
%endif
</%def>
-<%def name="render_samples_grid( cntrller, request, current_samples, action, editing_samples=False, encoded_selected_sample_ids=[], render_buttons=False, grid_header='<h3>Samples</h3>' )">
+<%def name="render_samples_grid( cntrller, request, displayable_sample_widgets, action, editing_samples=False, encoded_selected_sample_ids=[], render_buttons=False, grid_header='<h3>Samples</h3>' )">
## Displays the "Samples" grid
<%
trans.sa_session.refresh( request )
@@ -236,7 +236,8 @@
can_add_samples = request.is_unsubmitted
can_delete_samples = editing_samples and request.samples and not is_complete
can_edit_samples = request.samples and ( is_admin or not is_complete )
- can_select_datasets = is_admin and current_samples and ( is_submitted or is_complete )
+ can_select_datasets = is_admin and displayable_sample_widgets and ( is_submitted or is_complete )
+ can_transfer_datasets = is_admin and request.samples and not request.is_rejected
display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted )
display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted )
display_datasets = request.samples and ( is_complete or is_submitted )
@@ -278,46 +279,67 @@
<thead><tbody><% trans.sa_session.refresh( request ) %>
- ## current_samples is a dictionary whose keys are:
- ## name, barcode, library, folder, field_values, library_select_field, folder_select_field
- %for current_sample_index, current_sample in enumerate( current_samples ):
+ ## displayable_sample_widgets is a dictionary whose keys are:
+ ## id, name, barcode, library, folder, field_values, library_select_field, folder_select_field
+ ## A displayable_sample_widget will have an id == None if the widget's associated sample has not
+ ## yet been saved (i.e., the use clicked the "Add sample" button but has not yet clicked the
+ ## "Save" button.
+ %for sample_widget_index, sample_widget in enumerate( displayable_sample_widgets ):
<%
- current_sample_name = current_sample[ 'name' ]
- current_sample_barcode = current_sample[ 'barcode' ]
- current_sample_library = current_sample[ 'library' ]
- if current_sample_library:
+ sample_widget_name = sample_widget[ 'name' ]
+ sample_widget_barcode = sample_widget[ 'barcode' ]
+ sample_widget_library = sample_widget[ 'library' ]
+ if sample_widget_library:
if cntrller == 'requests':
library_cntrller = 'library'
elif is_admin:
library_cntrller = 'library_admin'
else:
library_cntrller = None
- current_sample_folder = current_sample[ 'folder' ]
+ sample_widget_folder = sample_widget[ 'folder' ]
try:
- sample = request.samples[ current_sample_index ]
+ sample = request.samples[ sample_widget_index ]
except:
sample = None
%>
%if editing_samples:
- <tr>${render_editable_sample_row( cntrller, sample, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr>
+ <tr>${render_editable_sample_row( cntrller, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr>
%elif sample:
<tr>
- <td>${current_sample_name}</td>
+ <td>
+ %if sample.state and ( can_select_datasets or can_transfer_datasets ):
+ ## A sample will have a state only after the request has been submitted.
+ <% encoded_id = trans.security.encode_id( sample.id ) %>
+ <div style="float: left; margin-left: 2px;" class="menubutton split popup" id="sample-${sample.id}-popup">
+ ${sample.name}
+ </div>
+ <div popupmenu="sample-${sample.id}-popup">
+ %if can_select_datasets:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select datasets to transfer</a></li>
+ %endif
+ %if sample.untransferred_dataset_files:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li>
+ %endif
+ </div>
+ %else:
+ ${sample_widget_name}
+ %endif
+ </td>
%if display_bar_code:
- <td>${current_sample_barcode}</td>
+ <td>${sample_widget_barcode}</td>
%endif
%if is_unsubmitted:
<td>Unsubmitted</td>
%else:
<td><a id="sampleState-${sample.id}" href="${h.url_for( controller='requests_common', action='sample_events', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${render_sample_state( sample )}</a></td>
%endif
- %if current_sample_library and library_cntrller is not None:
- <td><a href="${h.url_for( controller='library_common', action='browse_library', cntrller=library_cntrller, id=trans.security.encode_id( current_sample_library.id ) )}">${current_sample_library.name}</a></td>
+ %if sample_widget_library and library_cntrller is not None:
+ <td><a href="${h.url_for( controller='library_common', action='browse_library', cntrller=library_cntrller, id=trans.security.encode_id( sample_widget_library.id ) )}">${sample_widget_library.name}</a></td>
%else:
<td></td>
%endif
- %if current_sample_folder:
- <td>${current_sample_folder.name}</td>
+ %if sample_widget_folder:
+ <td>${sample_widget_folder.name}</td>
%else:
<td></td>
%endif
@@ -371,7 +393,7 @@
</tr>
%else:
## The Add sample button was clicked for this sample_widget
- <tr>${render_editable_sample_row( cntrller, None, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr>
+ <tr>${render_editable_sample_row( cntrller, None, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr>
%endif
%endfor
</tbody>
@@ -439,7 +461,7 @@
</tr></%def>
-<%def name="render_request_type_sample_form_grids( grid_index, grid_name, fields_dict, current_samples, editing_samples )">
+<%def name="render_request_type_sample_form_grids( grid_index, grid_name, fields_dict, displayable_sample_widgets, editing_samples )"><%
if not grid_name:
grid_name = "Sample form layout " + grid_index
@@ -466,7 +488,7 @@
<thead><tbody><% trans.sa_session.refresh( request ) %>
- %for sample_index, sample in enumerate( current_samples ):
+ %for sample_index, sample in enumerate( displayable_sample_widgets ):
<%
if editing_samples or sample_index >= len( request.samples ):
display_only = False
@@ -505,7 +527,7 @@
<tr><td>
%if is_admin:
- <% encoded_id = trans.security.encode_id(dataset.id) %>
+ <% encoded_id = trans.security.encode_id( dataset.id ) %><span class="expandLink dataset-${dataset}-click"><span class="rowIcon"></span><div style="float: left; margin-left: 2px;" class="menubutton split popup" id="dataset-${dataset.id}-popup"><a class="dataset-${encoded_id}-click" href="${h.url_for( controller='requests_admin', action='manage_datasets', operation='view', id=trans.security.encode_id( dataset.id ) )}">${dataset.name}</a>
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -72,14 +72,14 @@
<div class="toolFormBody"><form id="edit_samples" name="edit_samples" action="${h.url_for( controller='requests_common', action='edit_samples', cntrller=cntrller, id=trans.security.encode_id( request.id ), editing_samples=editing_samples )}" method="post">
- %if current_samples:
+ %if displayable_sample_widgets:
<%
if editing_samples:
grid_header = '<h3>Edit Current Samples of Request "%s"</h3>' % request.name
else:
grid_header = '<h3>Add Samples to Request "%s"</h3>' % request.name
%>
- ${render_samples_grid( cntrller, request, current_samples, action='edit_samples', editing_samples=editing_samples, encoded_selected_sample_ids=encoded_selected_sample_ids, render_buttons=False, grid_header=grid_header )}
+ ${render_samples_grid( cntrller, request, displayable_sample_widgets, action='edit_samples', editing_samples=editing_samples, encoded_selected_sample_ids=encoded_selected_sample_ids, render_buttons=False, grid_header=grid_header )}
%if editing_samples and len( sample_operation_select_field.options ) > 1 and not is_unsubmitted:
<div class="form-row" style="background-color:#FAFAFA;">
For selected samples:
@@ -118,14 +118,14 @@
## Render the other grids
<% trans.sa_session.refresh( request.type.sample_form ) %>
%for grid_index, grid_name in enumerate( request.type.sample_form.layout ):
- ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), current_samples=current_samples, editing_samples=editing_samples )}
+ ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=editing_samples )}
%endfor
%else:
<label>There are no samples.</label>
%endif
%if not editing_samples and is_unsubmitted:
## The user is adding a new sample
- %if current_samples:
+ %if displayable_sample_widgets:
<p/><div class="form-row"><label> Copy <input type="text" name="num_sample_to_copy" value="1" size="3"/> samples from sample ${sample_copy.get_html()}</label>
@@ -138,7 +138,7 @@
<div class="form-row">
## hidden element to make twill work.
<input type="hidden" name="hidden_input" value=""/>
- %if ( request.samples or current_samples ) and ( editing_samples or len( current_samples ) > len( request.samples ) ):
+ %if ( request.samples or displayable_sample_widgets ) and ( editing_samples or len( displayable_sample_widgets ) > len( request.samples ) ):
<input type="submit" name="add_sample_button" value="Add sample" /><input type="submit" name="save_samples_button" value="Save"/><input type="submit" name="cancel_changes_button" value="Cancel"/>
--- a/templates/requests/common/view_request.mako
+++ b/templates/requests/common/view_request.mako
@@ -148,12 +148,12 @@
</div></div><p/>
-%if current_samples:
+%if displayable_sample_widgets:
<%
grid_header = '<h3>Samples</h3>'
render_buttons = can_edit_samples
%>
- ${render_samples_grid( cntrller, request, current_samples=current_samples, action='view_request', editing_samples=False, encoded_selected_sample_ids=[], render_buttons=render_buttons, grid_header=grid_header )}
+ ${render_samples_grid( cntrller, request, displayable_sample_widgets=displayable_sample_widgets, action='view_request', editing_samples=False, encoded_selected_sample_ids=[], render_buttons=render_buttons, grid_header=grid_header )}
%else:
There are no samples.
%if can_add_samples:
@@ -165,5 +165,5 @@
## Render the other grids
<% trans.sa_session.refresh( request.type.sample_form ) %>
%for grid_index, grid_name in enumerate( request.type.sample_form.layout ):
- ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), current_samples=current_samples, editing_samples=False )}
+ ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=False )}
%endfor
1
0
galaxy-dist commit d6a0dd8e55e2: Sample tracking functional tests refactored till add samples.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289406533 18000
# Node ID d6a0dd8e55e2f7d2077bc282bca3e42d98fbb7f2
# Parent ecaf015e009a35a3cf421a87fbab1c5d0bbba5b4
Sample tracking functional tests refactored till add samples.
Rest of the tests are disabled.
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -17,6 +17,9 @@ address_dict = dict( short_desc="Office"
phone="007-007-0007" )
class TestFormsAndRequests( TwillTestCase ):
+ #
+ # ====== Setup Users, Groups & Roles required for this test suite =========
+ #
def test_000_initiate_users( self ):
"""Ensuring all required user accounts exist"""
self.logout()
@@ -50,9 +53,9 @@ class TestFormsAndRequests( TwillTestCas
def test_005_create_required_groups_and_roles( self ):
"""Testing creating all required groups and roles for this script"""
# Logged in as admin_user
- # Create role_one
- name = 'Role One'
- description = "This is Role One's description"
+ # Create role1
+ name = 'Role1'
+ description = "This is Role1's description"
user_ids = [ str( admin_user.id ), str( regular_user1.id ), str( regular_user3.id ) ]
self.create_role( name=name,
description=description,
@@ -61,25 +64,25 @@ class TestFormsAndRequests( TwillTestCas
create_group_for_role='no',
private_role=admin_user.email )
# Get the role object for later tests
- global role_one
- role_one = get_role_by_name( name )
- # Create group_one
- name = 'Group One'
- self.create_group( name=name, in_user_ids=[ str( regular_user1.id ) ], in_role_ids=[ str( role_one.id ) ] )
+ global role1
+ role1 = get_role_by_name( name )
+ # Create group1
+ name = 'Group1'
+ self.create_group( name=name, in_user_ids=[ str( regular_user1.id ) ], in_role_ids=[ str( role1.id ) ] )
# Get the group object for later tests
- global group_one
- group_one = get_group_by_name( name )
- assert group_one is not None, 'Problem retrieving group named "Group One" from the database'
+ global group1
+ group1 = get_group_by_name( name )
+ assert group1 is not None, 'Problem retrieving group named "Group1" from the database'
# NOTE: To get this to work with twill, all select lists on the ~/admin/role page must contain at least
# 1 option value or twill throws an exception, which is: ParseError: OPTION outside of SELECT
# Due to this bug in twill, we create the role, we bypass the page and visit the URL in the
# associate_users_and_groups_with_role() method.
#
- #create role_two
- name = 'Role Two'
- description = 'This is Role Two'
+ #create role2
+ name = 'Role2'
+ description = 'This is Role2'
user_ids = [ str( admin_user.id ) ]
- group_ids = [ str( group_one.id ) ]
+ group_ids = [ str( group1.id ) ]
private_role = admin_user.email
self.create_role( name=name,
description=description,
@@ -87,11 +90,14 @@ class TestFormsAndRequests( TwillTestCas
in_group_ids=group_ids,
private_role=private_role )
# Get the role object for later tests
- global role_two
- role_two = get_role_by_name( name )
- assert role_two is not None, 'Problem retrieving role named "Role Two" from the database'
- def test_010_create_request_form( self ):
- """Testing creating a request form definition, editing the name and description and adding fields"""
+ global role2
+ role2 = get_role_by_name( name )
+ assert role2 is not None, 'Problem retrieving role named "Role2" from the database'
+ #
+ # ====== Form definition test methods ================================================
+ #
+ def test_010_create_request_form_definition( self ):
+ """Testing creating a sequencing request form definition, editing the name and description and adding fields"""
# Logged in as admin_user
# Create a form definition
tmp_name = "Temp form"
@@ -107,23 +113,23 @@ class TestFormsAndRequests( TwillTestCas
# Edit the name and description of the form definition, and add 3 fields.
new_name = "Request Form"
new_desc = "Request Form description"
- global test_field_name1
- test_field_name1 = 'Test field name one'
- global test_field_name2
- test_field_name2 = 'Test field name two'
- global test_field_name3
- test_field_name3 = 'Test field name three'
- field_dicts = [ dict( name=test_field_name1,
- desc='Test field description one',
+ global request_field_name1
+ request_field_name1 = 'Request form field1'
+ global request_field_name2
+ request_field_name2 = 'Request form field2'
+ global request_field_name3
+ request_field_name3 = 'Request form field3'
+ field_dicts = [ dict( name=request_field_name1,
+ desc='Description of '+request_field_name1,
type='SelectField',
required='optional',
selectlist=[ 'option1', 'option2' ] ),
- dict( name=test_field_name2,
- desc='Test field description two',
+ dict( name=request_field_name2,
+ desc='Description of '+request_field_name2,
type='AddressField',
required='optional' ),
- dict( name=test_field_name3,
- desc='Test field description three',
+ dict( name=request_field_name3,
+ desc='Description of '+request_field_name3,
type='TextField',
required='required' ) ]
self.edit_form( id=self.security.encode_id( tmp_form.current.id ),
@@ -134,48 +140,99 @@ class TestFormsAndRequests( TwillTestCas
strings_displayed=[ 'Edit form definition "%s"' % tmp_name ],
strings_displayed_after_submit=[ "The form '%s' has been updated with the changes." % new_name ] )
# Get the form_definition object for later tests
- global form_one
- form_one = get_form( new_name )
- assert form_one is not None, 'Problem retrieving form named "%s" from the database' % new_name
- assert len( form_one.fields ) == len( tmp_form.fields ) + len( field_dicts )
- def test_015_create_sample_form( self ):
- """Testing creating sample form definition"""
+ global request_form_definition1
+ request_form_definition1 = get_form( new_name )
+ assert request_form_definition1 is not None, 'Problem retrieving form named "%s" from the database' % new_name
+ assert len( request_form_definition1.fields ) == len( tmp_form.fields ) + len( field_dicts )
+ # check form view
+ self.view_form( id=self.security.encode_id( request_form_definition1.current.id ),
+ form_name=new_name,
+ form_desc=new_desc,
+ form_type=form_type,
+ field_dicts=field_dicts )
+ def test_015_create_sample_form_definition( self ):
+ """Testing creating sequencing sample form definition and adding fields"""
name = "Sample Form"
- desc = "This is Form Two's description"
+ desc = "This is Sample Form's description"
form_type = galaxy.model.FormDefinition.types.SAMPLE
- form_layout_name = 'Layout Grid One'
+ global sample_form_layout_grid_name
+ sample_form_layout_grid_name = 'Layout Grid1'
self.create_form( name=name,
desc=desc,
form_type=form_type,
- form_layout_name=form_layout_name,
+ form_layout_name=sample_form_layout_grid_name,
+ num_fields=0,
strings_displayed=[ 'Create a new form definition' ],
strings_displayed_after_submit=[ "The form '%s' has been updated with the changes." % name ] )
- global form_two
- form_two = get_form( name )
- assert form_two is not None, "Error retrieving form %s from db" % name
+ tmp_form = get_form( name )
+ # now add fields to the sample form definition
+ global sample_field_name1
+ sample_field_name1 = 'Sample form field1'
+ global sample_field_name2
+ sample_field_name2 = 'Sample form field2'
+ global sample_field_name3
+ sample_field_name3 = 'Sample form field3'
+ field_dicts = [ dict( name=sample_field_name1,
+ desc='Description of '+sample_field_name1,
+ type='SelectField',
+ required='optional',
+ selectlist=[ 'option1', 'option2' ] ),
+ dict( name=sample_field_name2,
+ desc='Description of '+sample_field_name2,
+ type='TextField',
+ required='optional' ),
+ dict( name=sample_field_name3,
+ desc='Description of '+sample_field_name3,
+ type='TextField',
+ required='required' ) ]
+ self.edit_form( id=self.security.encode_id( tmp_form.current.id ),
+ new_form_name=name,
+ new_form_desc=desc,
+ field_dicts=field_dicts,
+ field_index=len( tmp_form.fields ),
+ strings_displayed=[ 'Edit form definition "%s"' % name ],
+ strings_displayed_after_submit=[ "The form '%s' has been updated with the changes." % name ] )
+ global sample_form_definition1
+ sample_form_definition1 = get_form( name )
+ assert sample_form_definition1 is not None, "Error retrieving form %s from db" % name
+ print len( sample_form_definition1.fields ), len( field_dicts )
+ print sample_form_definition1.fields
+ print field_dicts
+ assert len( sample_form_definition1.fields ) == len( field_dicts )
+ # check form view
+ self.view_form( id=self.security.encode_id( sample_form_definition1.current.id ),
+ form_name=name,
+ form_desc=desc,
+ form_type=form_type,
+ form_layout_name=sample_form_layout_grid_name,
+ field_dicts=field_dicts )
def test_020_create_request_type( self ):
"""Testing creating a request_type"""
- request_form = get_form( form_one.name )
- sample_form = get_form( form_two.name )
- name = 'Test Requestype'
+ name = 'Sequencer configuration1'
self.create_request_type( name,
"test sequencer configuration",
- self.security.encode_id( request_form.id ),
- self.security.encode_id( sample_form.id ),
+ self.security.encode_id( request_form_definition1.id ),
+ self.security.encode_id( sample_form_definition1.id ),
sample_states,
strings_displayed=[ 'Create a new sequencer configuration' ],
strings_displayed_after_submit=[ "Sequencer configuration (%s) has been created" % name ] )
global request_type1
request_type1 = get_request_type_by_name( name )
assert request_type1 is not None, 'Problem retrieving sequencer configuration named "%s" from the database' % name
+ # check view
+ self.view_request_type( self.security.encode_id( request_type1.id ),
+ request_type1.name,
+ strings_displayed=[ request_form_definition1.name,
+ sample_form_definition1.name ],
+ sample_states=sample_states)
# Set permissions
permissions_in = [ k for k, v in galaxy.model.RequestType.permitted_actions.items() ]
permissions_out = []
- # Role one members are: admin_user, regular_user1, regular_user3. Each of these users will be permitted for
+ # Role1 members are: admin_user, regular_user1, regular_user3. Each of these users will be permitted for
# REQUEST_TYPE_ACCESS on this request_type
self.request_type_permissions( self.security.encode_id( request_type1.id ),
request_type1.name,
- str( role_one.id ),
+ str( role1.id ),
permissions_in,
permissions_out )
# Make sure the request_type1 is not accessible by regular_user2 since regular_user2 does not have Role1.
@@ -189,8 +246,11 @@ class TestFormsAndRequests( TwillTestCas
pass
self.logout()
self.login( email=admin_user.email )
+ #
+ # ====== Sequencing request test methods - User perspective ================
+ #
def test_025_create_request( self ):
- """Testing creating a sequence run request"""
+ """Testing creating a sequencing request as a regular user"""
# logged in as admin_user
# Create a user_address
self.logout()
@@ -200,195 +260,223 @@ class TestFormsAndRequests( TwillTestCas
user_address1 = get_user_address( regular_user1, address_dict[ 'short_desc' ] )
# Set field values - the tuples in the field_values list include the field_value, and True if refresh_on_change
# is required for that field.
- field_value_tuples = [ ( 'option1', False ), ( str( user_address1.id ), True ), ( 'field three value', False ) ]
+ field_value_tuples = [ ( 'option1', False ), ( str( user_address1.id ), True ), ( 'field3 value', False ) ]
# Create the request
- name = 'Request One'
- desc = 'Request One Description'
+ name = 'Request1'
+ desc = 'Request1 Description'
self.create_request( cntrller='requests',
request_type_id=self.security.encode_id( request_type1.id ),
name=name,
desc=desc,
field_value_tuples=field_value_tuples,
strings_displayed=[ 'Create a new sequencing request',
- test_field_name1,
- test_field_name2,
- test_field_name3 ],
+ request_field_name1,
+ request_field_name2,
+ request_field_name3 ],
strings_displayed_after_submit=[ name, desc ] )
- global request_one
- request_one = get_request_by_name( name )
+ global request1
+ request1 = get_request_by_name( name )
# Make sure the request's state is now set to NEW
- assert request_one.state is not request_one.states.NEW, "The state of the request '%s' should be set to '%s'" \
- % ( request_one.name, request_one.states.NEW )
+ assert request1.state is not request1.states.NEW, "The state of the request '%s' should be set to '%s'" \
+ % ( request1.name, request1.states.NEW )
+ # check request page
+ self.view_request( cntrller='requests',
+ request_id=self.security.encode_id( request1.id ),
+ strings_displayed=[ 'Sequencing request "%s"' % request1.name,
+ 'There are no samples.',
+ sample_form_layout_grid_name ],
+ strings_not_displayed=[ request1.states.SUBMITTED,
+ request1.states.COMPLETE,
+ request1.states.REJECTED ] )
+ # check if the request is showing in the 'new' filter
+ self.check_request_grid( cntrller='requests',
+ state=request1.states.NEW,
+ strings_displayed=[ request1.name ] )
+ self.view_request_history( cntrller='requests',
+ request_id=self.security.encode_id( request1.id ),
+ strings_displayed=[ 'History of Sequencing Request "%s"' % request1.name,
+ request1.states.NEW,
+ 'Request created' ],
+ strings_not_displayed=[ request1.states.SUBMITTED,
+ request1.states.COMPLETE,
+ request1.states.REJECTED ] )
+ def test_030_edit_basic_request_info( self ):
+ """Testing editing the basic information of a sequencing request"""
+ # logged in as regular_user1
+ fields = [ 'option2', str( user_address1.id ), 'field3 value (edited)' ]
+ new_name=request1.name + ' (Renamed)'
+ new_desc=request1.desc + ' (Re-described)'
+ self.edit_basic_request_info( request_id=self.security.encode_id( request1.id ),
+ cntrller='requests',
+ name=request1.name,
+ new_name=new_name,
+ new_desc=new_desc,
+ new_fields=fields,
+ strings_displayed=[ 'Edit sequencing request "%s"' % request1.name ],
+ strings_displayed_after_submit=[ new_name, new_desc ] )
+ refresh( request1 )
+ def test_035_add_samples_to_request( self ):
+ """Testing adding samples to request"""
+ # logged in as regular_user1
# Sample fields - the tuple represents a sample name and a list of sample form field values
- sample_value_tuples = [ ( 'Sample One', [ 'S1 Field 0 Value' ] ),
- ( 'Sample Two', [ 'S2 Field 0 Value' ] ) ]
+ sample_value_tuples = [ ( 'Sample1', [ 'option1', 'sample1 field2 value', 'sample1 field3 value' ] ),
+ ( 'Sample2', [ 'option2', 'sample2 field2 value', 'sample2 field3 value' ] ),
+ ( 'Sample3', [ 'option1', 'sample3 field2 value', 'sample3 field3 value' ] ) ]
strings_displayed_after_submit = [ 'Unsubmitted' ]
for sample_name, field_values in sample_value_tuples:
strings_displayed_after_submit.append( sample_name )
# Add samples to the request
self.add_samples( cntrller='requests',
- request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
+ request_id=self.security.encode_id( request1.id ),
+ request_name=request1.name,
sample_value_tuples=sample_value_tuples,
- strings_displayed=[ 'There are no samples.' ],
+ strings_displayed=[ 'Add Samples to Request "%s"' % request1.name,
+ '<input type="text" name="sample_0_name" value="Sample_1" size="10"/>' ], # sample name input field
strings_displayed_after_submit=strings_displayed_after_submit )
- def test_030_edit_basic_request_info( self ):
- """Testing editing the basic information of a sequence run request"""
- # logged in as regular_user1
- fields = [ 'option2', str( user_address1.id ), 'field three value (edited)' ]
- new_name=request_one.name + ' (Renamed)'
- new_desc=request_one.desc + ' (Re-described)'
- self.edit_basic_request_info( request_id=self.security.encode_id( request_one.id ),
- cntrller='requests',
- name=request_one.name,
- new_name=new_name,
- new_desc=new_desc,
- new_fields=fields,
- strings_displayed=[ 'Edit sequencing request "%s"' % request_one.name ],
- strings_displayed_after_submit=[ new_name, new_desc ] )
- refresh( request_one )
- # check if the request is showing in the 'new' filter
- self.check_request_grid( cntrller='requests',
- state=request_one.states.NEW,
- strings_displayed=[ request_one.name ] )
- def test_035_submit_request( self ):
- """Testing editing a sequence run request"""
- # logged in as regular_user1
- self.submit_request( cntrller='requests',
- request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
- strings_displayed_after_submit=[ 'The request has been submitted.' ] )
- refresh( request_one )
- # Make sure the request is showing in the 'submitted' filter
- self.check_request_grid( cntrller='requests',
- state=request_one.states.SUBMITTED,
- strings_displayed=[ request_one.name ] )
- # Make sure the request's state is now set to 'submitted'
- assert request_one.state is not request_one.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" \
- % ( request_one.name, request_one.states.SUBMITTED )
- def test_040_request_lifecycle( self ):
- """Testing request life-cycle as it goes through all the states"""
- # logged in as regular_user1
- self.logout()
- self.login( email=admin_user.email )
- self.check_request_grid( cntrller='requests_admin',
- state=request_one.states.SUBMITTED,
- strings_displayed=[ request_one.name ] )
- self.visit_url( "%s/requests_common/view_request?cntrller=requests&id=%s" % ( self.url, self.security.encode_id( request_one.id ) ) )
- # TODO: add some string for checking on the page above...
- # Set bar codes for the samples
- bar_codes = [ '1234567890', '0987654321' ]
- strings_displayed_after_submit=[ 'Changes made to the samples have been saved.' ]
- for bar_code in bar_codes:
- strings_displayed_after_submit.append( bar_code )
- self.add_bar_codes( request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
- bar_codes=bar_codes,
- samples=request_one.samples,
- strings_displayed_after_submit=strings_displayed_after_submit )
- # Change the states of all the samples of this request to ultimately be COMPLETE
- self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
- sample_names=[ sample.name for sample in request_one.samples ],
- sample_ids=[ sample.id for sample in request_one.samples ],
- new_sample_state_id=request_type1.states[1].id,
- new_state_name=request_type1.states[1].name )
- self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
- sample_names=[ sample.name for sample in request_one.samples ],
- sample_ids=[ sample.id for sample in request_one.samples ],
- new_sample_state_id=request_type1.states[2].id,
- new_state_name=request_type1.states[2].name )
- refresh( request_one )
- self.logout()
- self.login( email=regular_user1.email )
- # check if the request's state is now set to 'complete'
- self.check_request_grid( cntrller='requests',
- state='Complete',
- strings_displayed=[ request_one.name ] )
- assert request_one.state is not request_one.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
- % ( request_one.name, request_one.states.COMPLETE )
-
- def test_045_admin_create_request_on_behalf_of_regular_user( self ):
- """Testing creating and submitting a request as an admin on behalf of a regular user"""
- # Logged in as regular_user1
- self.logout()
- self.login( email=admin_user.email )
- # Create the request
- name = "RequestTwo"
- desc = 'Request Two Description'
- # Set field values - the tuples in the field_values list include the field_value, and True if refresh_on_change
- # is required for that field.
- field_value_tuples = [ ( 'option2', False ), ( str( user_address1.id ), True ), ( 'field_2_value', False ) ]
- self.create_request( cntrller='requests_admin',
- request_type_id=self.security.encode_id( request_type1.id ),
- other_users_id=self.security.encode_id( regular_user1.id ),
- name=name,
- desc=desc,
- field_value_tuples=field_value_tuples,
- strings_displayed=[ 'Create a new sequencing request',
- test_field_name1,
- test_field_name2,
- test_field_name3 ],
- strings_displayed_after_submit=[ "The request has been created." ] )
- global request_two
- request_two = get_request_by_name( name )
- # Make sure the request is showing in the 'new' filter
- self.check_request_grid( cntrller='requests_admin',
- state=request_two.states.NEW,
- strings_displayed=[ request_two.name ] )
- # Make sure the request's state is now set to 'new'
- assert request_two.state is not request_two.states.NEW, "The state of the request '%s' should be set to '%s'" \
- % ( request_two.name, request_two.states.NEW )
- # Sample fields - the tuple represents a sample name and a list of sample form field values
- sample_value_tuples = [ ( 'Sample One', [ 'S1 Field 0 Value' ] ),
- ( 'Sample Two', [ 'S2 Field 0 Value' ] ) ]
- strings_displayed_after_submit = [ 'Unsubmitted' ]
- for sample_name, field_values in sample_value_tuples:
- strings_displayed_after_submit.append( sample_name )
- # Add samples to the request
- self.add_samples( cntrller='requests_admin',
- request_id=self.security.encode_id( request_two.id ),
- request_name=request_two.name,
- sample_value_tuples=sample_value_tuples,
- strings_displayed=[ 'There are no samples.' ],
- strings_displayed_after_submit=strings_displayed_after_submit )
- # Submit the request
- self.submit_request( cntrller='requests_admin',
- request_id=self.security.encode_id( request_two.id ),
- request_name=request_two.name,
- strings_displayed_after_submit=[ 'The request has been submitted.' ] )
- refresh( request_two )
- # Make sure the request is showing in the 'submitted' filter
- self.check_request_grid( cntrller='requests_admin',
- state=request_two.states.SUBMITTED,
- strings_displayed=[ request_two.name ] )
- # Make sure the request's state is now set to 'submitted'
- assert request_two.state is not request_two.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" \
- % ( request_two.name, request_two.states.SUBMITTED )
- # Make sure both requests are showing in the 'All' filter
- self.check_request_grid( cntrller='requests_admin',
- state='All',
- strings_displayed=[ request_one.name, request_two.name ] )
- def test_050_reject_request( self ):
- """Testing rejecting a request"""
- # Logged in as admin_user
- self.reject_request( request_id=self.security.encode_id( request_two.id ),
- request_name=request_two.name,
- comment="Rejection test comment",
- strings_displayed=[ 'Reject Sequencing Request "%s"' % request_two.name ],
- strings_displayed_after_submit=[ 'Request (%s) has been rejected.' % request_two.name ] )
- refresh( request_two )
- # Make sure the request is showing in the 'rejected' filter
- self.check_request_grid( cntrller='requests_admin',
- state=request_two.states.REJECTED,
- strings_displayed=[ request_two.name ] )
- # Make sure the request's state is now set to REJECTED
- assert request_two.state is not request_two.states.REJECTED, "The state of the request '%s' should be set to '%s'" \
- % ( request_two.name, request_two.states.REJECTED )
+# def test_040_edit_samples_of_new_request( self ):
+# """Testing editing the sample information of new request1"""
+# # logged in as regular_user1
+# pass
+# def test_035_submit_request( self ):
+# """Testing editing a sequence run request"""
+# # logged in as regular_user1
+# self.submit_request( cntrller='requests',
+# request_id=self.security.encode_id( request1.id ),
+# request_name=request1.name,
+# strings_displayed_after_submit=[ 'The request has been submitted.' ] )
+# refresh( request1 )
+# # Make sure the request is showing in the 'submitted' filter
+# self.check_request_grid( cntrller='requests',
+# state=request1.states.SUBMITTED,
+# strings_displayed=[ request1.name ] )
+# # Make sure the request's state is now set to 'submitted'
+# assert request1.state is not request1.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" \
+# % ( request1.name, request1.states.SUBMITTED )
+# def test_040_request_lifecycle( self ):
+# """Testing request life-cycle as it goes through all the states"""
+# # logged in as regular_user1
+# self.logout()
+# self.login( email=admin_user.email )
+# self.check_request_grid( cntrller='requests_admin',
+# state=request1.states.SUBMITTED,
+# strings_displayed=[ request1.name ] )
+# self.visit_url( "%s/requests_common/view_request?cntrller=requests&id=%s" % ( self.url, self.security.encode_id( request1.id ) ) )
+# # TODO: add some string for checking on the page above...
+# # Set bar codes for the samples
+# bar_codes = [ '1234567890', '0987654321' ]
+# strings_displayed_after_submit=[ 'Changes made to the samples have been saved.' ]
+# for bar_code in bar_codes:
+# strings_displayed_after_submit.append( bar_code )
+# self.add_bar_codes( request_id=self.security.encode_id( request1.id ),
+# request_name=request1.name,
+# bar_codes=bar_codes,
+# samples=request1.samples,
+# strings_displayed_after_submit=strings_displayed_after_submit )
+# # Change the states of all the samples of this request to ultimately be COMPLETE
+# self.change_sample_state( request_id=self.security.encode_id( request1.id ),
+# request_name=request1.name,
+# sample_names=[ sample.name for sample in request1.samples ],
+# sample_ids=[ sample.id for sample in request1.samples ],
+# new_sample_state_id=request_type1.states[1].id,
+# new_state_name=request_type1.states[1].name )
+# self.change_sample_state( request_id=self.security.encode_id( request1.id ),
+# request_name=request1.name,
+# sample_names=[ sample.name for sample in request1.samples ],
+# sample_ids=[ sample.id for sample in request1.samples ],
+# new_sample_state_id=request_type1.states[2].id,
+# new_state_name=request_type1.states[2].name )
+# refresh( request1 )
+# self.logout()
+# self.login( email=regular_user1.email )
+# # check if the request's state is now set to 'complete'
+# self.check_request_grid( cntrller='requests',
+# state='Complete',
+# strings_displayed=[ request1.name ] )
+# assert request1.state is not request1.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
+# % ( request1.name, request1.states.COMPLETE )
+#
+# def test_045_admin_create_request_on_behalf_of_regular_user( self ):
+# """Testing creating and submitting a request as an admin on behalf of a regular user"""
+# # Logged in as regular_user1
+# self.logout()
+# self.login( email=admin_user.email )
+# # Create the request
+# name = "Request2"
+# desc = 'Request2 Description'
+# # Set field values - the tuples in the field_values list include the field_value, and True if refresh_on_change
+# # is required for that field.
+# field_value_tuples = [ ( 'option2', False ), ( str( user_address1.id ), True ), ( 'field_2_value', False ) ]
+# self.create_request( cntrller='requests_admin',
+# request_type_id=self.security.encode_id( request_type1.id ),
+# other_users_id=self.security.encode_id( regular_user1.id ),
+# name=name,
+# desc=desc,
+# field_value_tuples=field_value_tuples,
+# strings_displayed=[ 'Create a new sequencing request',
+# request_field_name1,
+# request_field_name2,
+# request_field_name3 ],
+# strings_displayed_after_submit=[ "The request has been created." ] )
+# global request2
+# request2 = get_request_by_name( name )
+# # Make sure the request is showing in the 'new' filter
+# self.check_request_grid( cntrller='requests_admin',
+# state=request2.states.NEW,
+# strings_displayed=[ request2.name ] )
+# # Make sure the request's state is now set to 'new'
+# assert request2.state is not request2.states.NEW, "The state of the request '%s' should be set to '%s'" \
+# % ( request2.name, request2.states.NEW )
+# # Sample fields - the tuple represents a sample name and a list of sample form field values
+# sample_value_tuples = [ ( 'Sample1', [ 'S1 Field 0 Value' ] ),
+# ( 'Sample2', [ 'S2 Field 0 Value' ] ) ]
+# strings_displayed_after_submit = [ 'Unsubmitted' ]
+# for sample_name, field_values in sample_value_tuples:
+# strings_displayed_after_submit.append( sample_name )
+# # Add samples to the request
+# self.add_samples( cntrller='requests_admin',
+# request_id=self.security.encode_id( request2.id ),
+# request_name=request2.name,
+# sample_value_tuples=sample_value_tuples,
+# strings_displayed=[ 'There are no samples.' ],
+# strings_displayed_after_submit=strings_displayed_after_submit )
+# # Submit the request
+# self.submit_request( cntrller='requests_admin',
+# request_id=self.security.encode_id( request2.id ),
+# request_name=request2.name,
+# strings_displayed_after_submit=[ 'The request has been submitted.' ] )
+# refresh( request2 )
+# # Make sure the request is showing in the 'submitted' filter
+# self.check_request_grid( cntrller='requests_admin',
+# state=request2.states.SUBMITTED,
+# strings_displayed=[ request2.name ] )
+# # Make sure the request's state is now set to 'submitted'
+# assert request2.state is not request2.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" \
+# % ( request2.name, request2.states.SUBMITTED )
+# # Make sure both requests are showing in the 'All' filter
+# self.check_request_grid( cntrller='requests_admin',
+# state='All',
+# strings_displayed=[ request1.name, request2.name ] )
+# def test_050_reject_request( self ):
+# """Testing rejecting a request"""
+# # Logged in as admin_user
+# self.reject_request( request_id=self.security.encode_id( request2.id ),
+# request_name=request2.name,
+# comment="Rejection test comment",
+# strings_displayed=[ 'Reject Sequencing Request "%s"' % request2.name ],
+# strings_displayed_after_submit=[ 'Request (%s) has been rejected.' % request2.name ] )
+# refresh( request2 )
+# # Make sure the request is showing in the 'rejected' filter
+# self.check_request_grid( cntrller='requests_admin',
+# state=request2.states.REJECTED,
+# strings_displayed=[ request2.name ] )
+# # Make sure the request's state is now set to REJECTED
+# assert request2.state is not request2.states.REJECTED, "The state of the request '%s' should be set to '%s'" \
+# % ( request2.name, request2.states.REJECTED )
def test_055_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
# Logged in as admin_user
+ self.logout()
+ self.login( email=admin_user.email )
##################
# Delete request_type permissions
##################
@@ -402,12 +490,12 @@ class TestFormsAndRequests( TwillTestCas
##################
# Mark all requests deleted
##################
- for request in [ request_one, request_two ]:
+ for request in [ request1 ]:
mark_obj_deleted( request )
##################
# Mark all forms deleted
##################
- for form in [ form_one, form_two ]:
+ for form in [ request_form_definition1, sample_form_definition1 ]:
self.mark_form_deleted( self.security.encode_id( form.current.id ) )
##################
# Mark all user_addresses deleted
@@ -417,18 +505,18 @@ class TestFormsAndRequests( TwillTestCas
##################
# Delete all non-private roles
##################
- for role in [ role_one, role_two ]:
+ for role in [ role1, role2 ]:
self.mark_role_deleted( self.security.encode_id( role.id ), role.name )
self.purge_role( self.security.encode_id( role.id ), role.name )
# Manually delete the role from the database
refresh( role )
- delete( role )
+ delete_obj( role )
##################
# Delete all groups
##################
- for group in [ group_one ]:
+ for group in [ group1 ]:
self.mark_group_deleted( self.security.encode_id( group.id ), group.name )
self.purge_group( self.security.encode_id( group.id ), group.name )
# Manually delete the group from the database
refresh( group )
- delete( group )
+ delete_obj( group )
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -870,6 +870,14 @@ class TwillTestCase( unittest.TestCase )
fname = self.write_temp_file( page )
errmsg = "no match to '%s'\npage content written to '%s'" % ( patt, fname )
raise AssertionError( errmsg )
+
+ def check_string_not_in_page( self, patt ):
+ """Checks to make sure 'patt' is NOT in the page."""
+ page = self.last_page()
+ if page.find( patt ) != -1:
+ fname = self.write_temp_file( page )
+ errmsg = "string (%s) incorrectly displayed in page.\npage content written to '%s'" % ( patt, fname )
+ raise AssertionError( errmsg )
def write_temp_file( self, content, suffix='.html' ):
fd, fname = tempfile.mkstemp( suffix=suffix, prefix='twilltestcase-' )
@@ -1330,6 +1338,9 @@ class TwillTestCase( unittest.TestCase )
if form_type == "Sequencing Sample Form":
tc.submit( "add_layout_grid" )
tc.fv( "1", "grid_layout0", form_layout_name )
+ # if not adding any fields at this time, remove the default empty field
+ if num_fields == 0:
+ tc.submit( "remove_button" )
# Add fields to the new form definition
for index1 in range( num_fields ):
field_name = 'field_name_%i' % index1
@@ -1357,9 +1368,8 @@ class TwillTestCase( unittest.TestCase )
else:
tc.fv( "1", "field_type_0", field_type )
tc.fv( "1", field_default, field_default_contents )
+ # All done... now save
tc.submit( "save_changes_button" )
- if num_fields == 0:
- self.visit_url( "%s/forms/manage" % self.url )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
self.home()
@@ -1392,7 +1402,7 @@ class TwillTestCase( unittest.TestCase )
# SelectFields require a refresh_on_change
self.refresh_form( field_type, field_type_value )
for option_index, option in enumerate( field_dict[ 'selectlist' ] ):
- tc.submit( "addoption_0" )
+ tc.submit( "addoption_%i" % index )
tc.fv( "1", "field_%i_option_%i" % ( index, option_index ), option )
else:
tc.fv( "1", field_type, field_type_value )
@@ -1400,6 +1410,22 @@ class TwillTestCase( unittest.TestCase )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
self.home()
+ def view_form( self, id, form_type='', form_name='', form_desc='', form_layout_name='', field_dicts=[] ):
+ '''View form details'''
+ self.home()
+ self.visit_url( "%s/forms/manage?operation=view&id=%s" % ( self.url, id ) )
+ self.check_page_for_string( form_type )
+ self.check_page_for_string( form_name )
+ self.check_page_for_string( form_desc )
+ self.check_page_for_string( form_layout_name )
+ for i, field_dict in enumerate( field_dicts ):
+ self.check_page_for_string( field_dict[ 'name' ] )
+ self.check_page_for_string( field_dict[ 'desc' ] )
+ self.check_page_for_string( field_dict[ 'type' ] )
+ if field_dict[ 'type' ].lower() == 'selectfield':
+ for option_index, option in enumerate( field_dict[ 'selectlist' ] ):
+ self.check_page_for_string( option )
+ self.home()
def mark_form_deleted( self, form_id ):
"""Mark a form_definition as deleted"""
self.home()
@@ -1445,6 +1471,17 @@ class TwillTestCase( unittest.TestCase )
check_str = "Permissions updated for sequencer configuration '%s'" % request_type_name
self.check_page_for_string( check_str )
self.home()
+ def view_request_type( self, request_type_id, request_type_name, sample_states, strings_displayed=[] ):
+ '''View request_type details'''
+ self.home()
+ self.visit_url( "%s/requests_admin/browse_request_types?operation=view&id=%s" % ( self.url, request_type_id ) )
+ self.check_page_for_string( 'Sequencer configuration information' )
+ self.check_page_for_string( request_type_name )
+ for name, desc in sample_states:
+ self.check_page_for_string( name )
+ self.check_page_for_string( desc )
+ for check_str in strings_displayed:
+ self.check_page_for_string( check_str )
def create_request( self, cntrller, request_type_id, name, desc, field_value_tuples, other_users_id='',
strings_displayed=[], strings_displayed_after_submit=[] ):
self.visit_url( "%s/requests_common/create_request?cntrller=%s" % ( self.url, cntrller ) )
@@ -1473,6 +1510,18 @@ class TwillTestCase( unittest.TestCase )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
self.home()
+ def view_request( self, cntrller, request_id, strings_displayed=[], strings_not_displayed=[] ):
+ self.visit_url( "%s/%s/browse_requests?operation=view_request&id=%s" % ( self.url, cntrller, request_id ) )
+ for check_str in strings_displayed:
+ self.check_page_for_string( check_str )
+ for check_str in strings_not_displayed:
+ self.check_string_not_in_page( check_str )
+ def view_request_history( self, cntrller, request_id, strings_displayed=[], strings_not_displayed=[] ):
+ self.visit_url( "%s/requests_common/request_events?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) )
+ for check_str in strings_displayed:
+ self.check_page_for_string( check_str )
+ for check_str in strings_not_displayed:
+ self.check_string_not_in_page( check_str )
def edit_basic_request_info( self, cntrller, request_id, name, new_name='', new_desc='', new_fields=[],
strings_displayed=[], strings_displayed_after_submit=[] ):
self.visit_url( "%s/requests_common/edit_basic_request_info?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) )
@@ -1489,40 +1538,22 @@ class TwillTestCase( unittest.TestCase )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
def add_samples( self, cntrller, request_id, request_name, sample_value_tuples, strings_displayed=[], strings_displayed_after_submit=[] ):
- self.visit_url( "%s/requests_common/edit_samples?cntrller=%s&id=%s&editing_samples=False" % ( self.url, cntrller, request_id ) )
+ url = "%s/requests_common/add_sample?cntrller=%s&request_id=%s&add_sample_button=Add+sample" % ( self.url, cntrller, request_id )
+ self.visit_url( url )
for check_str in strings_displayed:
self.check_page_for_string( check_str )
- # Simulate clicking the add-sample_button on the form. (gvk: 9/21/10 - TODO : There must be a bug in the mako template
- # because twill cannot find any forms on the page, but I cannot find it although I've spent time cleaning up the
- # template code and looking for any problems.
- url = "%s/requests_common/edit_samples?cntrller=%s&id=%s&editing_samples=False" % ( self.url, cntrller, request_id )
- # This should work, but although twill does not thorw any exceptions, the button click never occurs
- # There are multiple forms on this page, and we'll only be using the form named edit_samples.
- # for sample_index, sample_value_tuple in enumerate( sample_value_tuples ):
- # # Add the following form value to the already populated hidden field so that the edit_samples
- # # form is the current form
- # tc.fv( "1", "id", request_id )
- # tc.submit( 'add_sample_button' )
- for sample_index, sample_value_tuple in enumerate( sample_value_tuples ):
- sample_name, field_values = sample_value_tuple
- sample_name = sample_name.replace( ' ', '+' )
- field_name = "sample_%i_name" % sample_index
- # The following form_value setting should work but since twill barfed on submitting the add_sample_button
- # above, we have to simulate it by appending to the url.
- # tc.fv( "1", field_name, sample_name )
- url += "&%s=%s" % ( field_name, sample_name )
- for field_index, field_value in enumerate( field_values ):
- field_name = "sample_%i_field_%i" % ( sample_index, field_index )
- field_value = field_value.replace( ' ', '+' )
- # The following form_value setting should work but since twill barfed on submitting the add_sample_button
- # above, we have to simulate it by appending to the url.
- # tc.fv( "1", field_name, field_value )
- url += "&%s=%s" % ( field_name , field_value )
- # The following button submit should work but since twill barfed on submitting the add_sample_button
- # above, we have to simulate it by appending to the url.
- # tc.submit( "save_samples_button" )
- url += "&save_samples_button=Save"
- self.visit_url( url )
+ for sample_index, sample_info in enumerate( sample_value_tuples ):
+ sample_name = sample_info[0]
+ sample_field_values = sample_info[1]
+ tc.fv( "1", "sample_%i_name" % sample_index, sample_name )
+ for field_index, field_value in enumerate( sample_field_values ):
+ tc.fv( "1", "sample_%i_field_%i" % ( sample_index, field_index ), field_value )
+ # Do not click on Add sample button when all the sample have been added
+ if sample_index < len( sample_value_tuples ) - 1:
+ tc.submit( "add_sample_button" )
+ # select the correct form before submitting it
+ tc.fv( "1", "copy_sample_index", "-1" )
+ tc.submit( "save_samples_button" )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
def submit_request( self, cntrller, request_id, request_name, strings_displayed_after_submit=[] ):
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -136,8 +136,10 @@
%endif
<p/><div class="form-row">
+ ## hidden element to make twill work.
+ <input type="hidden" name="hidden_input" value=""/>
%if ( request.samples or current_samples ) and ( editing_samples or len( current_samples ) > len( request.samples ) ):
- <input type="submit" name="add_sample_button" value="Add sample"/>
+ <input type="submit" name="add_sample_button" value="Add sample" /><input type="submit" name="save_samples_button" value="Save"/><input type="submit" name="cancel_changes_button" value="Cancel"/><div class="toolParamHelp" style="clear: both;">
1
0
galaxy-dist commit ecaf015e009a: (recommit): porocessTaxonomynow removes parenthesis fixing various tree drawing issues in metagenomic tools. Major rework of MG tools needed to ensure reproducibility
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Nate Coraor <nate(a)bx.psu.edu>
# Date 1289402803 18000
# Node ID ecaf015e009a35a3cf421a87fbab1c5d0bbba5b4
# Parent 2c2a22396a2641a52dc5f200d26a3d947cf11cbd
(recommit): porocessTaxonomynow removes parenthesis fixing various tree drawing issues in metagenomic tools. Major rework of MG tools needed to ensure reproducibility
--- a/scripts/taxonomy/processTaxonomy.sh
+++ b/scripts/taxonomy/processTaxonomy.sh
@@ -10,5 +10,9 @@ cat gi_taxid_nucl.dmp gi_taxid_prot.dmp
echo "Sorting gi2tax files..."
sort -n -k 1 gi_taxid_all.dmp > gi_taxid_sorted.txt
rm gi_taxid_nucl.dmp gi_taxid_prot.dmp gi_taxid_all.dmp
+echo "Removing parenthesis from names.dmp"
+cat names.dmp | sed s/\(/_/g | sed s/\)/_/g > names.temporary
+mv names.dmp names.dmp.orig
+mv names.temporary names.dmp
1
0
galaxy-dist commit 479b377ef455: fix the add sample bug in request page
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289333440 18000
# Node ID 479b377ef455f2d676fb84363b0b6d437d6af5f6
# Parent 7c60d74ba2df4488df90d08ed0ae9c7cc3871222
fix the add sample bug in request page
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -131,6 +131,8 @@
is_submitted = False
is_unsubmitted = False
display_checkboxes = False
+ display_bar_code = False
+ display_datasets = False
%><%
if display_checkboxes and trans.security.encode_id( sample.id ) in encoded_selected_sample_ids:
1
0
galaxy-dist commit 9ee40043b826: rgHaploView tool version upgrade - now shows thumbnail of ld plots
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Ross Lazarus <ross.lazarus(a)gmail.com>
# Date 1289322752 18000
# Node ID 9ee40043b826b3bc1e29f84996f9fe14dd119a45
# Parent a77b2888759e94861252ca65437e11ec298b3058
rgHaploView tool version upgrade - now shows thumbnail of ld plots
--- a/tools/rgenetics/rgHaploView.xml
+++ b/tools/rgenetics/rgHaploView.xml
@@ -1,4 +1,4 @@
-<tool id="rgHaploView1" name="LD plots:" version="0.2">
+<tool id="rgHaploView1" name="LD plots:" version="0.3"><description>and comparisons with HapMap data</description>
--- a/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.html
+++ b/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.html
@@ -9,9 +9,11 @@
</head><body><div class="document">
-<h4>rgenetics for Galaxy rgHaploView.py, wrapping HaploView</h4><br><div><hr><ul>
+<h4>rgenetics for Galaxy rgHaploView.py, wrapping HaploView</h4><table><tr><td><a href="allnup.pdf"><img src="allnup.png" alt="Main combined LD image" hspace="10" align="middle"></td><td>Click the thumbnail at left to download the main combined LD image <a href=allnup.pdf>allnup.pdf</a></td></tr></table>
+<br><div><hr><ul><li><a href="alljoin.pdf">alljoin.pdf - All pdf plots, each on a separate page</a></li><li><a href="allnup.pdf">allnup.pdf - All pdf plots on a single page</a></li>
+<li><a href="allnup.png">allnup.png - allnup.png</a></li><li><a href="1_rgHaploViewtest1.pdf">1_rgHaploViewtest1.pdf - 1_rgHaploViewtest1.pdf</a></li><li><a href="1_rgHaploViewtest1.png">1_rgHaploViewtest1.png - 1_rgHaploViewtest1.png</a></li><li><a href="2_HapMap_YRI_22.pdf">2_HapMap_YRI_22.pdf - Hapmap data</a></li>
@@ -33,7 +35,7 @@ Haploview 4.2 Java Version: 1.6.0_03
-Arguments: -n -pairwiseTagging -pedfile /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped -info /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info -tagrsqcounts -tagrsqcutoff 0.8 -ldcolorscheme RSQ -maxDistance 200000 -compressedpng -chromosome 22
+Arguments: -n -pairwiseTagging -pedfile /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped -info /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info -tagrsqcounts -tagrsqcutoff 0.8 -ldcolorscheme RSQ -maxDistance 200000 -compressedpng -chromosome 22
@@ -41,9 +43,9 @@ Arguments: -n -pairwiseTagging -pedfile
Max LD comparison distance = 200000kb
-Using data file: /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped
+Using data file: /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped
-Using marker information file: /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info
+Using marker information file: /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info
Writing output to rgHaploViewtest1.ped.LD.PNG
@@ -79,27 +81,37 @@ Downloading chromosome 22, analysis pane
Writing output to Chromosome22YRI.LD.PNG
-This is pdfjoin version 1.20
+ ----
-Reading site configuration from /etc/pdfnup.conf
+ pdfjam: This is pdfjam version 2.06.
- Temporary LaTeX file for this job is /var/tmp/22578.tex
+ pdfjam: Reading any site-wide or user-specific defaults...
- Calling pdflatex...
+ (none found)
- Finished: output is /opt/galaxy/test-data/rgtestouts/rgHaploView/alljoin.pdf
+ pdfjam: Effective call for this run of pdfjam:
-This is pdfnup version 1.20
+ /usr/local/bin/pdfjam --fitpaper 'true' --rotateoversize 'true' --suffix joined --fitpaper 'true' --outfile alljoin.pdf -- 1_rgHaploViewtest1.pdf - 2_HapMap_YRI_22.pdf -
-Reading site configuration from /etc/pdfnup.conf
+ pdfjam: Calling pdflatex...
-Processing alljoin.pdf...
+ pdfjam: Finished. Output was to 'alljoin.pdf'.
- Temporary LaTeX file for this job is /var/tmp/22621-1.tex
+ ----
- Calling pdflatex...
+ pdfjam: This is pdfjam version 2.06.
- Finished: output is /opt/galaxy/test-data/rgtestouts/rgHaploView/allnup.pdf
+ pdfjam: Reading any site-wide or user-specific defaults...
+
+ (none found)
+
+ pdfjam: Effective call for this run of pdfjam:
+
+ /usr/local/bin/pdfjam --suffix nup --nup '2x1' --landscape --nup '1x2' --outfile allnup.pdf -- alljoin.pdf -
+
+ pdfjam: Calling pdflatex...
+
+ pdfjam: Finished. Output was to 'allnup.pdf'.
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/rerla/bin
@@ -107,7 +119,7 @@ PATH=/usr/kerberos/bin:/usr/local/bin:/b
-## executing java -jar /opt/galaxy/tool-data/shared/jars/haploview.jar -n -memory 2048 -pairwiseTagging -pedfile /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped -info /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info -tagrsqcounts -tagrsqcutoff 0.8 -ldcolorscheme RSQ -maxDistance 200000 -compressedpng -chromosome 22 returned 0
+## executing java -jar /opt/galaxy/tool-data/shared/jars/haploview.jar -n -memory 2048 -pairwiseTagging -pedfile /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped -info /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info -tagrsqcounts -tagrsqcutoff 0.8 -ldcolorscheme RSQ -maxDistance 200000 -compressedpng -chromosome 22 returned 0
## executing mogrify -resize 800x400! *.PNG returned 0
@@ -123,7 +135,9 @@ PATH=/usr/kerberos/bin:/usr/local/bin:/b
## executing mogrify -format pdf -resize 800x400! *.png returned 0
-## executing pdfjoin "*.pdf" --fitpaper true --outfile alljoin.pdf returned 0
+## executing pdfjoin *.pdf --fitpaper true --outfile alljoin.pdf returned 0
## executing pdfnup alljoin.pdf --nup 1x2 --outfile allnup.pdf returned 0
+
+## executing convert -resize x300 allnup.pdf allnup.png returned 0
</pre><hr></div></body></html>
Binary file test-data/rgtestouts/rgHaploView/alljoin.pdf has changed
Binary file test-data/rgtestouts/rgHaploView/2_HapMap_YRI_22.png has changed
Binary file test-data/rgtestouts/rgHaploView/1_rgHaploViewtest1.pdf has changed
Binary file test-data/rgtestouts/rgHaploView/2_HapMap_YRI_22.pdf has changed
Binary file test-data/rgtestouts/rgHaploView/1_rgHaploViewtest1.png has changed
--- a/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped.TESTS
+++ b/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped.TESTS
@@ -1,9 +1,9 @@
rs2283804
rs756632
-rs4820537
-rs3788347
-rs2283802
-rs4822363
rs4820539
rs16997606
+rs4822363
rs2267000
+rs3788347
+rs4820537
+rs2283802
Binary file test-data/rgtestouts/rgHaploView/allnup.pdf has changed
--- a/tools/rgenetics/rgHaploView.py
+++ b/tools/rgenetics/rgHaploView.py
@@ -47,7 +47,7 @@ class ldPlot:
self.args=argv
self.parseArgs(argv=self.args)
self.setupRegions()
-
+
def parseArgs(self,argv=[]):
"""
"""
@@ -405,10 +405,10 @@ class ldPlot:
p=subprocess.Popen(vcl,shell=True,cwd=self.outfpath,stderr=self.lf,stdout=self.lf)
retval = p.wait()
self.lf.write('## executing %s returned %d\n' % (vcl,retval))
- #vcl = ['convert', 'allnup.pdf', 'allnup.png'] # this fails - bad pdf?
- #p=subprocess.Popen(' '.join(vcl),shell=True,cwd=outfpath)
- #retval = p.wait()
- #lf.write('## executing %s returned %d\n' % (vcl,retval))
+ vcl = '%s -resize x300 allnup.pdf allnup.png' % (self.convert)
+ p=subprocess.Popen(vcl,shell=True,cwd=self.outfpath,stderr=self.lf,stdout=self.lf)
+ retval = p.wait()
+ self.lf.write('## executing %s returned %d\n' % (vcl,retval))
ste.close() # temp file used to catch haploview blather
hblather = open(blog,'r').readlines() # to catch the blather
os.unlink(blog)
@@ -425,20 +425,16 @@ class ldPlot:
outf.write(galhtmlprefix % progname)
s = '<h4>rgenetics for Galaxy %s, wrapping HaploView</h4>' % (progname)
outf.write(s)
- """
- as at ashg 2009, convert fails on allnup.pdf - probably too complex...
mainthumb = 'allnup.png'
mainpdf = 'allnup.pdf'
- if os.path.exists(mainpdf):
- if not os.path.exists(mainthumb):
+ if os.path.exists(os.path.join(self.outfpath,mainpdf)):
+ if not os.path.exists(os.path.join(self.outfpath,mainthumb)):
outf.write('<table><tr><td colspan="3"><a href="%s">Main combined LD plot</a></td></tr></table>\n' % (mainpdf))
else:
- outf.write('<table><tr><td><a href="%s"><img src="%s" alt="Main combined LD image" hspace="10" align="middle">')
- outf.write('</td><td>Click this thumbnail to display the main combined LD image</td></tr></table>\n' % (mainpdf,mainthumb))
+ outf.write('<table><tr><td><a href="%s"><img src="%s" alt="Main combined LD image" hspace="10" align="middle">' % (mainpdf,mainthumb))
+ outf.write('</td><td>Click the thumbnail at left to download the main combined LD image <a href=%s>%s</a></td></tr></table>\n' % (mainpdf,mainpdf))
else:
outf.write('(No main image was generated - this usually means a Haploview error connecting to Hapmap site - please try later)<br/>\n')
- outf.write('## Called as %s' % sys.argv)
- """
outf.write('<br><div><hr><ul>\n')
for i, data in enumerate( flist ):
dn = os.path.split(data)[-1]
@@ -515,3 +511,4 @@ if __name__ == "__main__":
ld.doPlots()
+
--- a/test-data/rgtestouts/rgHaploView/Log_rgHaploViewtest1.txt
+++ b/test-data/rgtestouts/rgHaploView/Log_rgHaploViewtest1.txt
@@ -3,12 +3,12 @@ Haploview 4.2 Java Version: 1.6.0_03
*****************************************************
-Arguments: -n -pairwiseTagging -pedfile /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped -info /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info -tagrsqcounts -tagrsqcutoff 0.8 -ldcolorscheme RSQ -maxDistance 200000 -compressedpng -chromosome 22
+Arguments: -n -pairwiseTagging -pedfile /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped -info /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info -tagrsqcounts -tagrsqcutoff 0.8 -ldcolorscheme RSQ -maxDistance 200000 -compressedpng -chromosome 22
Max LD comparison distance = 200000kb
-Using data file: /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped
-Using marker information file: /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info
+Using data file: /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped
+Using marker information file: /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info
Writing output to rgHaploViewtest1.ped.LD.PNG
Starting tagging.
Writing output to rgHaploViewtest1.ped.TAGS
@@ -26,21 +26,26 @@ Arguments: -n -chromosome 22 -panel YRI
Max LD comparison distance = 200000kb
Downloading chromosome 22, analysis panel YRI, 21784..21905 from HapMap release 21.
Writing output to Chromosome22YRI.LD.PNG
-This is pdfjoin version 1.20
-Reading site configuration from /etc/pdfnup.conf
- Temporary LaTeX file for this job is /var/tmp/22578.tex
- Calling pdflatex...
- Finished: output is /opt/galaxy/test-data/rgtestouts/rgHaploView/alljoin.pdf
-This is pdfnup version 1.20
-Reading site configuration from /etc/pdfnup.conf
-Processing alljoin.pdf...
- Temporary LaTeX file for this job is /var/tmp/22621-1.tex
- Calling pdflatex...
- Finished: output is /opt/galaxy/test-data/rgtestouts/rgHaploView/allnup.pdf
+ ----
+ pdfjam: This is pdfjam version 2.06.
+ pdfjam: Reading any site-wide or user-specific defaults...
+ (none found)
+ pdfjam: Effective call for this run of pdfjam:
+ /usr/local/bin/pdfjam --fitpaper 'true' --rotateoversize 'true' --suffix joined --fitpaper 'true' --outfile alljoin.pdf -- 1_rgHaploViewtest1.pdf - 2_HapMap_YRI_22.pdf -
+ pdfjam: Calling pdflatex...
+ pdfjam: Finished. Output was to 'alljoin.pdf'.
+ ----
+ pdfjam: This is pdfjam version 2.06.
+ pdfjam: Reading any site-wide or user-specific defaults...
+ (none found)
+ pdfjam: Effective call for this run of pdfjam:
+ /usr/local/bin/pdfjam --suffix nup --nup '2x1' --landscape --nup '1x2' --outfile allnup.pdf -- alljoin.pdf -
+ pdfjam: Calling pdflatex...
+ pdfjam: Finished. Output was to 'allnup.pdf'.
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/rerla/bin
## rgHaploView.py looking for 10 rs (['rs2283802', 'rs2267000', 'rs16997606', 'rs4820537', 'rs3788347'])## rgHaploView.py: wrote 10 markers, 40 subjects for region
-## executing java -jar /opt/galaxy/tool-data/shared/jars/haploview.jar -n -memory 2048 -pairwiseTagging -pedfile /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped -info /opt/galaxy/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info -tagrsqcounts -tagrsqcutoff 0.8 -ldcolorscheme RSQ -maxDistance 200000 -compressedpng -chromosome 22 returned 0
+## executing java -jar /opt/galaxy/tool-data/shared/jars/haploview.jar -n -memory 2048 -pairwiseTagging -pedfile /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped -info /tmp/foo/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.info -tagrsqcounts -tagrsqcutoff 0.8 -ldcolorscheme RSQ -maxDistance 200000 -compressedpng -chromosome 22 returned 0
## executing mogrify -resize 800x400! *.PNG returned 0
## executing convert -resize 800x400! rgHaploViewtest1.ped.LD.PNG rgHaploViewtest1.tmp.png returned 0
## executing convert -pointsize 25 -fill maroon -draw "text 10,300 'rgHaploViewtest1'" rgHaploViewtest1.tmp.png 1_rgHaploViewtest1.png returned 0
@@ -48,5 +53,6 @@ PATH=/usr/kerberos/bin:/usr/local/bin:/b
## executing convert -pointsize 25 -fill maroon -draw "text 10,300 'HapMap YRI'" rgHaploViewtest1.tmp.png 2_HapMap_YRI_22.png returned 0
### nimages=2
## executing mogrify -format pdf -resize 800x400! *.png returned 0
-## executing pdfjoin "*.pdf" --fitpaper true --outfile alljoin.pdf returned 0
+## executing pdfjoin *.pdf --fitpaper true --outfile alljoin.pdf returned 0
## executing pdfnup alljoin.pdf --nup 1x2 --outfile allnup.pdf returned 0
+## executing convert -resize x300 allnup.pdf allnup.png returned 0
--- a/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped.TAGS
+++ b/test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped.TAGS
@@ -14,12 +14,12 @@ rs2267006 rs2283804 1.0
rs4822363 rs4822363 1.0
Test Alleles Captured
-rs2283804 rs2283804,rs2267006
+rs2283804 rs2267006,rs2283804
rs756632 rs756632
-rs4820537 rs4820537
-rs3788347 rs3788347
-rs2283802 rs2283802
-rs4822363 rs4822363
rs4820539 rs4820539
rs16997606 rs16997606
+rs4822363 rs4822363
rs2267000 rs2267000
+rs3788347 rs3788347
+rs4820537 rs4820537
+rs2283802 rs2283802
Binary file test-data/rgtestouts/rgHaploView/rgHaploViewtest1.ped.LD.PNG has changed
1
0
galaxy-dist commit 2c2a22396a26: Backed out changeset 081ce300b688 (some files accidentally committed).
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Nate Coraor <nate(a)bx.psu.edu>
# Date 1289402767 18000
# Node ID 2c2a22396a2641a52dc5f200d26a3d947cf11cbd
# Parent 081ce300b688968521edd30f25a020d96999cd64
Backed out changeset 081ce300b688 (some files accidentally committed).
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -388,7 +388,6 @@ class TestFormsAndRequests( TwillTestCas
% ( request_two.name, request_two.states.REJECTED )
def test_055_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
- '''
# Logged in as admin_user
##################
# Delete request_type permissions
@@ -433,4 +432,3 @@ class TestFormsAndRequests( TwillTestCas
# Manually delete the group from the database
refresh( group )
delete( group )
- '''
--- a/static/welcome.html
+++ b/static/welcome.html
@@ -2,211 +2,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
-<link rel="stylesheet" href="style/base.css" type="text/css" />
-<style type="text/css">
-
- .quickie {
- text-align: center;
- background: black;
- margin: 10px;
- }
-
- .current-quickie {
- width: 300px;
- background: white;
- margin: auto;
- }
-
- .current-quickie img {
- padding: 15px;
- border: 1px solid #ccc;
- margin: auto;
- background-color: white;
- -moz-border-radius:4px;
- -webkit-border-radius:4px;
-
- }
-
- .previous {
- width: 100%;
- overflow: auto;
- border: solid #ccc 1px;
- -moz-border-radius:4px;
- -webkit-border-radius:4px;
-
- }
- .previous .quickie {
- padding-top: 10px;
- min-height: 90px;
- min-width: 150px;
- }
- #screencasts {
- max-width: 50em;
- margin-left: auto;
- margin-right: auto;
- }
-
-</style>
-<script type="text/javascript" src="http://galaxy.psu.edu/welcome_img/jquery.min.js"></script>
-<script type="text/javascript" src="http://galaxy.psu.edu/welcome_img/jquery.cycle.all.2.72.js"></script>
-<script type="text/javascript">
-
-$(document).ready(function() {
- $('.current-quickie').cycle({
- fx: 'fade',
- pause: 1,
- timeout: 1000,
- speed: 1000
- });
-});
-</script>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link rel="stylesheet" href="style/base.css" type="text/css" /></head><body>
-<div class="document">
-<h3 align="center">Here is what's happening...</h3>
-<div align="center" class="current-quickie">
- <a target="_blank" href="http://usegalaxy.org/cloud"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.001.png" width="300" height="200"></a>
- <a target="_blank" href="http://bitbucket.org/galaxy/galaxy-central/wiki/ISMB2010_GalaxyTutorial_3_R…"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.002.png" width="300" height="200"></a>
- <a target="_blank" href="http://main.g2.bx.psu.edu/u/aun1/p/ismb2010-demo"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.003.png" width="300" height="200" /></a>
- <a target="_blank" href="http://bitbucket.org/galaxy/galaxy-central/wiki/DataLibraries/Tutorial/Data…"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.004.png" width="300" height="200" /></a>
- <a target="_blank" href="http://main.g2.bx.psu.edu/u/aun1/p/windshield-splatter"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.005.png" width="300" height="200" /></a>
-</div>
-
-<h3 align="center">Live Quickies</h3>
-
-<div class="previous" id="previous">
- <table border="0" cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie1_TabSeq/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie1_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie2_Grouping/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie2_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie3_Intervals/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie3_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie4_whatsNew/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie4_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie5_join/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie5_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie6_share/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie6_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie7_sr_beta/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie7_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie8_solid_single_end/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie8_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie9_solid_mate_pair/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie9_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie10_custom_genome/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie10_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie_11_illumina_se/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie11_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie12_illumina_pe/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie12_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie_13_fastq_basic/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie13_small.png" border="0">
- </div>
- </a>
- </td>
-
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie_14_fastq_adv/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie14_small.png" border="0">
- </div>
- </a>
- </td>
- <td>
- <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie_15_lastz_frag/flow.html',width:640,height:480,scroll:'no'})">
- <div class="quickie">
- <img src="images/qk/quickie15_small.png" border="0">
- </div>
- </a>
- </td>
-
-
-
- </tr>
- </table>
-</div>
-
-<script type="text/javascript">
- // Scroll to last quickie in box
- document.getElementById("previous").scrollLeft = 100000000;
-</script>
-
-<br/>
-<br/>
-<br/>
-<hr/>
-
-<p><a target="_blank" class="reference" href="http://g2.trac.bx.psu.edu/wiki/GalaxyTeam">The Galaxy team</a> is a part of <a target="_blank" class="reference" href="http://www.bx.psu.edu">BX</a> at <a target="_blank" class="reference" href="http://www.psu.edu">Penn State</a>.</p>
-
-This project is supported in part by <a target="_blank" class="reference" href="http://www.nsf.gov">NSF</a>, <a target="_blank" class="reference" href="http://www.genome.gov">NHGRI</a>, <a target="_blank" class="reference" href="http://www.huck.psu.edu">The Huck Institutes of the Life Sciences</a>, and <a target="_blank" class="reference" href="http://www.ics.psu.edu">The Institute for CyberScience at Penn State</a>.
-<p><small>Galaxy build: <b>$Rev 3885:1ab9d6b0ddfc$</b></small></p>
-</div>
-</div>
+ <div class="document">
+ <div class="donemessagelarge">
+ <strong>Hello world! It's running...</strong>
+ <hr>
+ To customize this page edit <code>static/welcome.html</code>
+ </div>
+ <br/>
+ <img src="images/noodles.png" alt="WWFSMD?" style="display: block; margin-left: auto; margin-right: auto;" />
+ <hr/>
+ This project is supported in part by <a target="_blank" class="reference" href="http://www.nsf.gov">NSF</a>, <a target="_blank" class="reference" href="http://www.genome.gov">NHGRI</a>, and <a target="_blank" class="reference" href="http://www.huck.psu.edu">the Huck Institutes of the Life Sciences</a>.
+ </div></body></html>
--- a/scripts/taxonomy/processTaxonomy.sh
+++ b/scripts/taxonomy/processTaxonomy.sh
@@ -10,9 +10,5 @@ cat gi_taxid_nucl.dmp gi_taxid_prot.dmp
echo "Sorting gi2tax files..."
sort -n -k 1 gi_taxid_all.dmp > gi_taxid_sorted.txt
rm gi_taxid_nucl.dmp gi_taxid_prot.dmp gi_taxid_all.dmp
-echo "Removing parenthesis from names.dmp"
-cat names.dmp | sed s/\(/_/g | sed s/\)/_/g > names.temporary
-mv names.dmp names.dmp.orig
-mv names.temporary names.dmp
1
0
galaxy-dist commit 081ce300b688: porocessTaxonomynow removes parenthesis fixing various tree drawing issues in metagenomic tools. Major rework of MG tools needed to ensure reproducibility
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Anton Nekrutenko <anton(a)bx.psu.edu>
# Date 1289402232 18000
# Node ID 081ce300b688968521edd30f25a020d96999cd64
# Parent 0e3fe3e7b21bfd78461869817c6b43db827d77f0
porocessTaxonomynow removes parenthesis fixing various tree drawing issues in metagenomic tools. Major rework of MG tools needed to ensure reproducibility
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -388,6 +388,7 @@ class TestFormsAndRequests( TwillTestCas
% ( request_two.name, request_two.states.REJECTED )
def test_055_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
+ '''
# Logged in as admin_user
##################
# Delete request_type permissions
@@ -432,3 +433,4 @@ class TestFormsAndRequests( TwillTestCas
# Manually delete the group from the database
refresh( group )
delete( group )
+ '''
--- a/static/welcome.html
+++ b/static/welcome.html
@@ -2,20 +2,211 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="stylesheet" href="style/base.css" type="text/css" />
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
+<link rel="stylesheet" href="style/base.css" type="text/css" />
+<style type="text/css">
+
+ .quickie {
+ text-align: center;
+ background: black;
+ margin: 10px;
+ }
+
+ .current-quickie {
+ width: 300px;
+ background: white;
+ margin: auto;
+ }
+
+ .current-quickie img {
+ padding: 15px;
+ border: 1px solid #ccc;
+ margin: auto;
+ background-color: white;
+ -moz-border-radius:4px;
+ -webkit-border-radius:4px;
+
+ }
+
+ .previous {
+ width: 100%;
+ overflow: auto;
+ border: solid #ccc 1px;
+ -moz-border-radius:4px;
+ -webkit-border-radius:4px;
+
+ }
+ .previous .quickie {
+ padding-top: 10px;
+ min-height: 90px;
+ min-width: 150px;
+ }
+ #screencasts {
+ max-width: 50em;
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+</style>
+<script type="text/javascript" src="http://galaxy.psu.edu/welcome_img/jquery.min.js"></script>
+<script type="text/javascript" src="http://galaxy.psu.edu/welcome_img/jquery.cycle.all.2.72.js"></script>
+<script type="text/javascript">
+
+$(document).ready(function() {
+ $('.current-quickie').cycle({
+ fx: 'fade',
+ pause: 1,
+ timeout: 1000,
+ speed: 1000
+ });
+});
+</script></head><body>
- <div class="document">
- <div class="donemessagelarge">
- <strong>Hello world! It's running...</strong>
- <hr>
- To customize this page edit <code>static/welcome.html</code>
- </div>
- <br/>
- <img src="images/noodles.png" alt="WWFSMD?" style="display: block; margin-left: auto; margin-right: auto;" />
- <hr/>
- This project is supported in part by <a target="_blank" class="reference" href="http://www.nsf.gov">NSF</a>, <a target="_blank" class="reference" href="http://www.genome.gov">NHGRI</a>, and <a target="_blank" class="reference" href="http://www.huck.psu.edu">the Huck Institutes of the Life Sciences</a>.
- </div>
+<div class="document">
+<h3 align="center">Here is what's happening...</h3>
+<div align="center" class="current-quickie">
+ <a target="_blank" href="http://usegalaxy.org/cloud"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.001.png" width="300" height="200"></a>
+ <a target="_blank" href="http://bitbucket.org/galaxy/galaxy-central/wiki/ISMB2010_GalaxyTutorial_3_R…"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.002.png" width="300" height="200"></a>
+ <a target="_blank" href="http://main.g2.bx.psu.edu/u/aun1/p/ismb2010-demo"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.003.png" width="300" height="200" /></a>
+ <a target="_blank" href="http://bitbucket.org/galaxy/galaxy-central/wiki/DataLibraries/Tutorial/Data…"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.004.png" width="300" height="200" /></a>
+ <a target="_blank" href="http://main.g2.bx.psu.edu/u/aun1/p/windshield-splatter"><img src="http://galaxy.psu.edu/welcome_img/welcome_images.005.png" width="300" height="200" /></a>
+</div>
+
+<h3 align="center">Live Quickies</h3>
+
+<div class="previous" id="previous">
+ <table border="0" cellpadding="0" cellspacing="0" width="100%">
+ <tr>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie1_TabSeq/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie1_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie2_Grouping/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie2_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie3_Intervals/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie3_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie4_whatsNew/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie4_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie5_join/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie5_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie6_share/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie6_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie7_sr_beta/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie7_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie8_solid_single_end/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie8_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie9_solid_mate_pair/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie9_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie10_custom_genome/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie10_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie_11_illumina_se/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie11_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie12_illumina_pe/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie12_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie_13_fastq_basic/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie13_small.png" border="0">
+ </div>
+ </a>
+ </td>
+
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie_14_fastq_adv/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie14_small.png" border="0">
+ </div>
+ </a>
+ </td>
+ <td>
+ <a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie_15_lastz_frag/flow.html',width:640,height:480,scroll:'no'})">
+ <div class="quickie">
+ <img src="images/qk/quickie15_small.png" border="0">
+ </div>
+ </a>
+ </td>
+
+
+
+ </tr>
+ </table>
+</div>
+
+<script type="text/javascript">
+ // Scroll to last quickie in box
+ document.getElementById("previous").scrollLeft = 100000000;
+</script>
+
+<br/>
+<br/>
+<br/>
+<hr/>
+
+<p><a target="_blank" class="reference" href="http://g2.trac.bx.psu.edu/wiki/GalaxyTeam">The Galaxy team</a> is a part of <a target="_blank" class="reference" href="http://www.bx.psu.edu">BX</a> at <a target="_blank" class="reference" href="http://www.psu.edu">Penn State</a>.</p>
+
+This project is supported in part by <a target="_blank" class="reference" href="http://www.nsf.gov">NSF</a>, <a target="_blank" class="reference" href="http://www.genome.gov">NHGRI</a>, <a target="_blank" class="reference" href="http://www.huck.psu.edu">The Huck Institutes of the Life Sciences</a>, and <a target="_blank" class="reference" href="http://www.ics.psu.edu">The Institute for CyberScience at Penn State</a>.
+<p><small>Galaxy build: <b>$Rev 3885:1ab9d6b0ddfc$</b></small></p>
+</div>
+</div></body></html>
--- a/scripts/taxonomy/processTaxonomy.sh
+++ b/scripts/taxonomy/processTaxonomy.sh
@@ -10,5 +10,9 @@ cat gi_taxid_nucl.dmp gi_taxid_prot.dmp
echo "Sorting gi2tax files..."
sort -n -k 1 gi_taxid_all.dmp > gi_taxid_sorted.txt
rm gi_taxid_nucl.dmp gi_taxid_prot.dmp gi_taxid_all.dmp
+echo "Removing parenthesis from names.dmp"
+cat names.dmp | sed s/\(/_/g | sed s/\)/_/g > names.temporary
+mv names.dmp names.dmp.orig
+mv names.temporary names.dmp
1
0
galaxy-dist commit a77b2888759e: Streamline the sample tracking UI in selecting and transferring sample datasets.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289275808 18000
# Node ID a77b2888759e94861252ca65437e11ec298b3058
# Parent 2875445df9906828bc804e9b0923160f902b3fac
Streamline the sample tracking UI in selecting and transferring sample datasets.
--- a/templates/requests/common/sample_datasets.mako
+++ b/templates/requests/common/sample_datasets.mako
@@ -1,5 +1,5 @@
<%def name="render_sample_datasets( sample )">
- ${len( sample.transferred_dataset_files )} / ${len( sample.datasets )}
+ ${len( sample.datasets )} / ${len( sample.transferred_dataset_files )}
</%def>
${render_sample_datasets( sample )}
--- /dev/null
+++ b/templates/admin/requests/view_sample_dataset.mako
@@ -0,0 +1,72 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<br/><br/>
+
+<%
+ sample = sample_dataset.sample
+ is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
+ can_manage_datasets = is_admin and sample.untransferred_dataset_files
+%>
+
+<ul class="manage-table-actions">
+ %if can_manage_datasets:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Manage sample datasets</a></li>
+ %endif
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a></li>
+</ul>
+
+<div class="toolForm">
+ <div class="toolFormTitle">"${sample.name}" Dataset</div>
+ <div class="toolFormBody">
+ <div class="form-row">
+ <label>Name:</label>
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ ${sample_dataset.name}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>File path:</label>
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ ${sample_dataset.file_path}
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ This file is contained in a sub-directory of the data directory configured for the sequencer.
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Size:</label>
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ ${sample_dataset.size}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Date this dataset was selected for this sample:</label>
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ ${sample_dataset.create_time}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Transfer status:</label>
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ ${sample_dataset.status}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ %if sample_dataset.status == trans.app.model.SampleDataset.transfer_status.ERROR:
+ <div class="form-row">
+ <label>Transfer error:</label>
+ ${sample_dataset.error_msg}
+ </div>
+ <div style="clear: both"></div>
+ %endif
+ </div>
+</div>
--- a/templates/admin/requests/get_data.mako
+++ /dev/null
@@ -1,114 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-${h.js( "ui.core", "jquery.cookie" )}
-<link href='/static/june_2007_style/blue/dynatree_skin/ui.dynatree.css' rel='stylesheet' type='text/css'>
-${h.js( "jquery.dynatree" )}
-
-<script type="text/javascript">
- $(function(){
- $("#tree").ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
- _log("debug", "ajaxComplete: %o", this); // dom element listening
- });
- // --- Initialize sample trees
- $("#tree").dynatree({
- title: "${request.type.datatx_info['data_dir']}",
- rootVisible: true,
- minExpandLevel: 0, // 1: root node is not collapsible
- persist: false,
- checkbox: true,
- selectMode: 3,
- onPostInit: function(isReloading, isError) {
-// alert("reloading: "+isReloading+", error:"+isError);
- logMsg("onPostInit(%o, %o) - %o", isReloading, isError, this);
- // Re-fire onActivate, so the text is updated
- this.reactivate();
- },
- fx: { height: "toggle", duration: 200 },
- // initAjax is hard to fake, so we pass the children as object array:
- initAjax: {url: "${h.url_for( controller='requests_admin', action='open_folder' )}",
- dataType: "json",
- data: { id: "${request.id}", key: "${request.type.datatx_info['data_dir']}" },
- },
- onLazyRead: function(dtnode){
- dtnode.appendAjax({
- url: "${h.url_for( controller='requests_admin', action='open_folder' )}",
- dataType: "json",
- data: { id: "${request.id}", key: dtnode.data.key },
- });
- },
- onSelect: function(select, dtnode) {
- // Display list of selected nodes
- var selNodes = dtnode.tree.getSelectedNodes();
- // convert to title/key array
- var selKeys = $.map(selNodes, function(node){
- return node.data.key;
- });
- document.get_data.selected_files.value = selKeys.join(",")
- },
- onActivate: function(dtnode) {
- var cell = $("#file_details");
- var selected_value = dtnode.data.key
- if(selected_value.charAt(selected_value.length-1) != '/') {
- // Make ajax call
- $.ajax( {
- type: "POST",
- url: "${h.url_for( controller='requests_admin', action='get_file_details' )}",
- dataType: "json",
- data: { id: "${request.id}", folder_path: dtnode.data.key },
- success : function ( data ) {
- cell.html( '<label>'+data+'</label>' )
- }
- });
- } else {
- cell.html( '' )
- }
- },
- });
- });
-
-</script>
-
-<br/>
-<br/>
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='view_request_type', id=trans.security.encode_id( request.type.id ) )}">Sequencer configuration "${request.type.name}"</a>
- </li>
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a>
- </li>
-</ul>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <div class="toolFormTitle">Select files for transfer</div>
- <form name="get_data" id="get_data" action="${h.url_for( controller='requests_admin', action='get_data', cntrller=cntrller, request_id=trans.security.encode_id( request.id ))}" method="post" >
- <div class="form-row">
- <label>Sample:</label>
- ${sample_id_select_field.get_html()}
- <div class="toolParamHelp" style="clear: both;">
- Select the sample with which you want to associate the datasets
- </div>
- </div>
- <div class="form-row" >
- <label>Select dataset files in the sequencer:</label>
- <div id="tree" >
- Loading...
- </div>
- <input id="selected_files" name="selected_files" type="hidden" size=40"/>
- <div class="toolParamHelp" style="clear: both;">
- To select a folder, select all the individual files in that folder.
- </div>
- </div>
- <div class="form-row">
- <div id="file_details" class="toolParamHelp" style="clear: both;background-color:#FAFAFA;"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="select_show_datasets_button" value="Select & show datasets"/>
- <input type="submit" name="select_more_button" value="Select more"/>
- </div>
- </form>
-</div>
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -58,7 +58,7 @@ class RequestsGrid( grids.Grid ):
columns = [
NameColumn( "Name",
key="name",
- link=( lambda item: iff( item.deleted, None, dict( operation="view_request", id=item.id ) ) ),
+ link=( lambda item: dict( operation="view_request", id=item.id ) ),
attach_popup=True,
filterable="advanced" ),
DescriptionColumn( "Description",
@@ -318,11 +318,10 @@ class RequestsCommon( BaseController, Us
trans.sa_session.flush()
trans.sa_session.refresh( request )
# Create an event with state 'New' for this new request
+ comment = "Request created by %s" % trans.user.email
if request.user != trans.user:
- sample_event_comment = "Request created by user %s for user %s." % ( trans.user.email, request.user.email )
- else:
- sample_event_comment = "Request created."
- event = trans.model.RequestEvent( request, request.states.NEW, sample_event_comment )
+ comment += " on behalf of %s." % request.user.email
+ event = trans.model.RequestEvent( request, request.states.NEW, comment )
trans.sa_session.add( event )
trans.sa_session.flush()
else:
@@ -361,11 +360,10 @@ class RequestsCommon( BaseController, Us
status='error',
message=message ) )
# Change the request state to 'Submitted'
- if request.user.email is not trans.user:
- sample_event_comment = "Request submitted by %s on behalf of %s." % ( trans.user.email, request.user.email )
- else:
- sample_event_comment = ""
- event = trans.model.RequestEvent( request, request.states.SUBMITTED, sample_event_comment )
+ comment = "Request submitted by %s" % trans.user.email
+ if request.user != trans.user:
+ comment += " on behalf of %s." % request.user.email
+ event = trans.model.RequestEvent( request, request.states.SUBMITTED, comment )
trans.sa_session.add( event )
# Change the state of each of the samples of this request
# request.type.states is the list of SampleState objects configured
@@ -511,23 +509,39 @@ class RequestsCommon( BaseController, Us
id_list = util.listify( kwd.get( 'id', '' ) )
message = util.restore_text( params.get( 'message', '' ) )
status = util.restore_text( params.get( 'status', 'done' ) )
+ is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
num_deleted = 0
+ not_deleted = []
for id in id_list:
ok_for_now = True
try:
+ # This block will handle bots that do not send valid request ids.
request = trans.sa_session.query( trans.model.Request ).get( trans.security.decode_id( id ) )
except:
ok_for_now = False
if ok_for_now:
- request.deleted = True
- trans.sa_session.add( request )
- # Delete all the samples belonging to this request
- for s in request.samples:
- s.deleted = True
- trans.sa_session.add( s )
- trans.sa_session.flush()
- num_deleted += 1
+ # We will only allow the request to be deleted by a non-admin user if not request.submitted
+ if is_admin or not request.is_submitted:
+ request.deleted = True
+ trans.sa_session.add( request )
+ # Delete all the samples belonging to this request
+ for s in request.samples:
+ s.deleted = True
+ trans.sa_session.add( s )
+ comment = "Request marked deleted by %s." % trans.user.email
+ # There is no DELETED state for a request, so keep the current request state
+ event = trans.model.RequestEvent( request, request.state, comment )
+ trans.sa_session.add( event )
+ trans.sa_session.flush()
+ num_deleted += 1
+ else:
+ not_deleted.append( request )
message += '%i requests have been deleted.' % num_deleted
+ if not_deleted:
+ message += ' Contact the administrator to delete the following submitted requests: '
+ for request in not_deleted:
+ message += '%s, ' % request.name
+ message = message.rstrip( ', ' )
return trans.response.send_redirect( web.url_for( controller=cntrller,
action='browse_requests',
status=status,
@@ -543,6 +557,7 @@ class RequestsCommon( BaseController, Us
for id in id_list:
ok_for_now = True
try:
+ # This block will handle bots that do not send valid request ids.
request = trans.sa_session.query( trans.model.Request ).get( trans.security.decode_id( id ) )
except:
ok_for_now = False
@@ -553,6 +568,9 @@ class RequestsCommon( BaseController, Us
for s in request.samples:
s.deleted = False
trans.sa_session.add( s )
+ comment = "Request marked undeleted by %s." % trans.user.email
+ event = trans.model.RequestEvent( request, request.state, comment )
+ trans.sa_session.add( event )
trans.sa_session.flush()
num_undeleted += 1
message += '%i requests have been undeleted.' % num_undeleted
@@ -651,7 +669,7 @@ class RequestsCommon( BaseController, Us
# If the current request state is complete and one of its samples moved from
# the final sample state, then move the request state to In-progress
if request.is_complete:
- message = "At least 1 sample state moved from the final sample state, so now the request is in the '%s' state" % request.states.SUBMITTED
+ message = "At least 1 sample state moved from the final sample state, so now the request's state is (%s)" % request.states.SUBMITTED
event = trans.model.RequestEvent( request, request.states.SUBMITTED, message )
trans.sa_session.add( event )
trans.sa_session.flush()
@@ -668,13 +686,13 @@ class RequestsCommon( BaseController, Us
request_type_state = request.type.final_sample_state
if common_state.id == request_type_state.id:
# since all the samples are in the final state, change the request state to 'Complete'
- comments = "All samples of this request are in the last sample state (%s). " % request_type_state.name
+ comment = "All samples of this request are in the final sample state (%s). " % request_type_state.name
state = request.states.COMPLETE
final_state = True
else:
- comments = "All samples are in %s state. " % common_state.name
+ comment = "All samples of this request are in the (%s) sample state. " % common_state.name
state = request.states.SUBMITTED
- event = trans.model.RequestEvent( request, state, comments )
+ event = trans.model.RequestEvent( request, state, comment )
trans.sa_session.add( event )
trans.sa_session.flush()
# See if an email notification is configured to be sent when the samples
@@ -879,7 +897,10 @@ class RequestsCommon( BaseController, Us
message=message ) )
@web.expose
@web.require_login( "view data transfer page" )
- def view_dataset_transfer( self, trans, cntrller, **kwd ):
+ def view_selected_datasets( self, trans, cntrller, **kwd ):
+ # The link on the number of selected datasets will only appear if there is at least 1 selected dataset.
+ # If there are 0 selected datasets, there is no link, so this method will only be reached from the requests
+ # controller if there are selected datasets.
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
@@ -890,9 +911,9 @@ class RequestsCommon( BaseController, Us
except:
return invalid_id_redirect( trans, cntrller, sample_id )
# See if a library and folder have been set for this sample.
- if not sample.library or not sample.folder:
+ if is_admin and not sample.library or not sample.folder:
status = 'error'
- message = "Set a data library and folder for sequencing request (%s) to transfer datasets." % sample.name
+ message = "Select a target data library and folder for the sample before selecting the datasets."
return trans.response.send_redirect( web.url_for( controller='requests_common',
action='edit_samples',
cntrller=cntrller,
@@ -900,11 +921,6 @@ class RequestsCommon( BaseController, Us
editing_samples=True,
status=status,
message=message ) )
- if is_admin:
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='manage_datasets',
- sample_id=sample_id ) )
-
folder_path = util.restore_text( params.get( 'folder_path', '' ) )
if not folder_path:
if len( sample.datasets ):
@@ -917,11 +933,10 @@ class RequestsCommon( BaseController, Us
or not sample.request.type.datatx_info['username'] \
or not sample.request.type.datatx_info['password']:
status = 'error'
- message = 'The sequencer login information is incomplete. Click on sequencer information to add login details.'
- return trans.fill_template( '/requests/common/dataset_transfer.mako',
+ message = 'The sequencer login information is incomplete. Click sequencer information to add login details.'
+ return trans.fill_template( '/requests/common/view_selected_datasets.mako',
cntrller=cntrller,
- sample=sample,
- dataset_files=sample.datasets,
+ sample=sample,
message=message,
status=status,
files=[],
@@ -1063,9 +1078,8 @@ class RequestsCommon( BaseController, Us
# See if all the samples' barcodes are in the same state, and if so send email if configured to.
common_state = request.samples_have_common_state
if common_state and common_state.id == request.type.states[1].id:
- event = trans.model.RequestEvent( request,
- request.states.SUBMITTED,
- "All samples are in %s state." % common_state.name )
+ comment = "All samples of this request are in the (%s) sample state. " % common_state.name
+ event = trans.model.RequestEvent( request, request.states.SUBMITTED, comment )
trans.sa_session.add( event )
trans.sa_session.flush()
request.send_email_notification( trans, request.type.states[1] )
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1595,7 +1595,7 @@ class Request( object ):
states = Bunch( NEW = 'New',
SUBMITTED = 'In Progress',
REJECTED = 'Rejected',
- COMPLETE = 'Complete' )
+ COMPLETE = 'Complete' )
api_collection_visible_keys = ( 'id', 'name', 'state' )
def __init__( self, name=None, desc=None, request_type=None, user=None, form_values=None, notification=None ):
self.name = name
@@ -1813,17 +1813,21 @@ class Sample( object ):
if dataset.status == SampleDataset.transfer_status.COMPLETE:
transferred_datasets.append( dataset )
return transferred_datasets
- def dataset_size( self, filepath ):
- def print_ticks(d):
+ def get_untransferred_dataset_size( self, filepath ):
+ # TODO: RC: If rsh keys are not set, this method will return something like the following:
+ # greg(a)scofield.bx.psu.edu's password: 46M /afs/bx.psu.edu/home/greg/chr22/chr21.fa
+ # This method should return the number of bytes in the file. I believe du
+ # displays the file system block usage which may not be the number of bytes in the file.
+ # Would ls -l be better?
+ def print_ticks( d ):
pass
datatx_info = self.request.type.datatx_info
- cmd = 'ssh %s@%s "du -sh \'%s\'"' % ( datatx_info['username'],
- datatx_info['host'],
- filepath)
- output = pexpect.run(cmd, events={'.ssword:*': datatx_info['password']+'\r\n',
- pexpect.TIMEOUT:print_ticks},
- timeout=10)
- return output.replace(filepath, '').strip()
+ cmd = 'ssh %s@%s "du -sh \'%s\'"' % ( datatx_info['username'], datatx_info['host'], filepath )
+ output = pexpect.run( cmd,
+ events={ '.ssword:*': datatx_info['password']+'\r\n',
+ pexpect.TIMEOUT:print_ticks},
+ timeout=10 )
+ return output.replace( filepath, '' ).strip()
def get_api_value( self, view='collection' ):
rval = {}
try:
@@ -1856,8 +1860,7 @@ class SampleDataset( object ):
ADD_TO_LIBRARY = 'Adding to data library',
COMPLETE = 'Complete',
ERROR = 'Error' )
- def __init__(self, sample=None, name=None, file_path=None,
- status=None, error_msg=None, size=None):
+ def __init__( self, sample=None, name=None, file_path=None, status=None, error_msg=None, size=None):
self.sample = sample
self.name = name
self.file_path = file_path
@@ -1866,9 +1869,9 @@ class SampleDataset( object ):
self.size = size
class UserAddress( object ):
- def __init__(self, user=None, desc=None, name=None, institution=None,
- address=None, city=None, state=None, postal_code=None,
- country=None, phone=None):
+ def __init__( self, user=None, desc=None, name=None, institution=None,
+ address=None, city=None, state=None, postal_code=None,
+ country=None, phone=None ):
self.user = user
self.desc = desc
self.name = name
--- a/templates/admin/requests/rename_datasets.mako
+++ b/templates/admin/requests/rename_datasets.mako
@@ -6,19 +6,14 @@
<h3>Rename datasets for Sample "${sample.name}"</h3><ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Browse datasets</a>
- </li>
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller='requests_admin', id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a>
- </li>
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Browse datasets</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller='requests_admin', id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a></li></ul>
%if message:
${render_msg( message, status )}
%endif
-${render_msg( 'A dataset can be renamed only if it is in <b>Not Started</b> state.', 'warning' )}
<div class="toolForm"><form name="rename_datasets" id="rename_datasets" action="${h.url_for( controller='requests_admin', action='rename_datasets', id_list=id_list, sample_id=trans.security.encode_id( sample.id ) )}" method="post" ><table class="grid">
--- a/templates/requests/common/find_samples.mako
+++ b/templates/requests/common/find_samples.mako
@@ -71,7 +71,7 @@
%else:
State: ${sample.state.name}<br/>
%endif
- Datasets: <a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}/${len( sample.datasets )}</a><br/>
+ Datasets: <a href="${h.url_for( controller='requests_common', action='view_selected_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}/${len( sample.datasets )}</a><br/>
%if is_admin:
<i>User: ${sample.request.user.email}</i>
%endif
--- /dev/null
+++ b/templates/requests/common/view_selected_datasets.mako
@@ -0,0 +1,37 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+<%namespace file="/requests/common/common.mako" import="render_sample_datasets" />
+
+<%
+ is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
+ is_complete = sample.request.is_complete
+ is_submitted = sample.request.is_submitted
+ can_select_datasets = is_admin and ( is_complete or is_submitted )
+ can_transfer_datasets = is_admin and sample.untransferred_dataset_files
+%>
+
+<br/><br/>
+
+<ul class="manage-table-actions">
+ %if can_transfer_datasets:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li>
+ %endif
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_selected_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Refresh page</a></li>
+ <li><a class="action-button" id="sample-${sample.id}-popup" class="menubutton">Dataset Actions</a></li>
+ <div popupmenu="sample-${sample.id}-popup">
+ %if can_select_datasets:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', cntrller=cntrller, request_id=trans.security.encode_id( sample.request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select more datasets</a></li>
+ %endif
+ <li><a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( sample.library.id ) )}">View target Data Library</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a></li>
+ </div>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+%if sample and sample.datasets:
+ <% title = 'Datasets currently selected for "sample.name"' %>
+ ${render_sample_datasets( cntrller, sample, sample.datasets, title )}
+%endif
--- a/templates/requests/common/dataset_transfer.mako
+++ /dev/null
@@ -1,46 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<br/><br/>
-
-<ul class="manage-table-actions">
- <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Refresh</a></li>
- <li><a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( sample.library.id ) )}">Target Data Library</a></li>
- <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a></li>
-</ul>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <div class="toolFormTitle">Sample "${sample.name}"</div>
- <div class="toolFormBody">
- %if dataset_files:
- <div class="form-row">
- <table class="grid">
- <thead>
- <tr>
- <th>Name</th>
- <th>Size</th>
- <th>Status</th>
- </tr>
- <thead>
- <tbody>
- %for dataset_file in dataset_files:
- <tr>
- <td>${dataset_file.name}</td>
- <td>${dataset_file.size}</td>
- <td>${dataset_file.status}</td>
- </tr>
- %endfor
- </tbody>
- </table>
- </div>
- %else:
- <div class="form-row">
- There are no datasets associated with this sample.
- </div>
- %endif
- </div>
-</div>
--- /dev/null
+++ b/templates/admin/requests/select_datasets_to_transfer.mako
@@ -0,0 +1,133 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+<%namespace file="/requests/common/common.mako" import="render_sample_datasets" />
+
+${h.js( "ui.core", "jquery.cookie", "jquery.dynatree" )}
+<link href='/static/june_2007_style/blue/dynatree_skin/ui.dynatree.css' rel='stylesheet' type='text/css'>
+##${h.js( "jquery.dynatree" )}
+
+<script type="text/javascript">
+ $(function(){
+ $("#tree").ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
+ _log("debug", "ajaxComplete: %o", this); // dom element listening
+ });
+ // --- Initialize sample trees
+ $("#tree").dynatree({
+ title: "${request.type.datatx_info['data_dir']}",
+ rootVisible: true,
+ minExpandLevel: 0, // 1: root node is not collapsible
+ persist: false,
+ checkbox: true,
+ selectMode: 3,
+ onPostInit: function(isReloading, isError) {
+// alert("reloading: "+isReloading+", error:"+isError);
+ logMsg("onPostInit(%o, %o) - %o", isReloading, isError, this);
+ // Re-fire onActivate, so the text is updated
+ this.reactivate();
+ },
+ fx: { height: "toggle", duration: 200 },
+ // initAjax is hard to fake, so we pass the children as object array:
+ initAjax: {url: "${h.url_for( controller='requests_admin', action='open_folder' )}",
+ dataType: "json",
+ data: { id: "${request.id}", key: "${request.type.datatx_info['data_dir']}" },
+ },
+ onLazyRead: function(dtnode){
+ dtnode.appendAjax({
+ url: "${h.url_for( controller='requests_admin', action='open_folder' )}",
+ dataType: "json",
+ data: { id: "${request.id}", key: dtnode.data.key },
+ });
+ },
+ onSelect: function(select, dtnode) {
+ // Display list of selected nodes
+ var selNodes = dtnode.tree.getSelectedNodes();
+ // convert to title/key array
+ var selKeys = $.map(selNodes, function(node){
+ return node.data.key;
+ });
+ document.select_datasets_to_transfer.selected_datasets_to_transfer.value = selKeys.join(",")
+ },
+ onActivate: function(dtnode) {
+ var cell = $("#file_details");
+ var selected_value = dtnode.data.key
+ if(selected_value.charAt(selected_value.length-1) != '/') {
+ // Make ajax call
+ $.ajax( {
+ type: "POST",
+ url: "${h.url_for( controller='requests_admin', action='get_file_details' )}",
+ dataType: "json",
+ data: { id: "${request.id}", folder_path: dtnode.data.key },
+ success : function ( data ) {
+ cell.html( '<label>'+data+'</label>' )
+ }
+ });
+ } else {
+ cell.html( '' )
+ }
+ },
+ });
+ });
+
+</script>
+
+<%
+ is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
+ can_transfer_datasets = is_admin and sample.untransferred_dataset_files
+%>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='view_request_type', id=trans.security.encode_id( request.type.id ) )}">Sequencer configuration</a></li>
+ %if can_transfer_datasets:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li>
+ %endif
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a></li>
+</ul>
+
+%if not sample:
+ <font color="red"><b><i>Select a sample before selecting datasets to transfer</i></b></font>
+ <br/><br/>
+%endif
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Select datasets to transfer from data directory configured for the sequencer</div>
+ <form name="select_datasets_to_transfer" id="select_datasets_to_transfer" action="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', cntrller=cntrller, request_id=trans.security.encode_id( request.id ))}" method="post" >
+ <div class="form-row">
+ <label>Sample:</label>
+ ${sample_id_select_field.get_html()}
+ <div class="toolParamHelp" style="clear: both;">
+ Select the sample that was sequenced to produce the datasets you want to transfer.
+ </div>
+ </div>
+ <div class="form-row" >
+ <label>Select datasets from source data location defined in the sequencer configuration:</label>
+ <div id="tree" >
+ Loading...
+ </div>
+ <input id="selected_datasets_to_transfer" name="selected_datasets_to_transfer" type="hidden" size=40"/>
+ <div class="toolParamHelp" style="clear: both;">
+ <ul>
+ <li>Click the <b>Sequencer configuration</b> button and change the <b>Data directory</b> setting to redefine the source data location.</li>
+ <li>Select a folder to select all of the individual files within that folder.</li>
+ <li>Click the <b>Select datasets</b> button when desired dataset check boxes are checked.</li>
+ </ul>
+ </div>
+ </div>
+ <div class="form-row">
+ <div id="file_details" class="toolParamHelp" style="clear: both;background-color:#FAFAFA;"></div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="select_datasets_to_transfer_button" value="Select datasets"/>
+ </div>
+ </form>
+</div>
+
+%if sample and sample.datasets:
+ <% title = 'Datasets currently selected for "sample.name"' %>
+ <p/>
+ ${render_sample_datasets( 'requests_admin', sample, sample.datasets, title )}
+%endif
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -23,10 +23,6 @@ class AdminRequestsGrid( RequestsGrid ):
operations.append( grids.GridOperation( "Reject", allow_multiple=False, condition=( lambda item: not item.deleted and item.is_submitted ) ) )
operations.append( grids.GridOperation( "Delete", allow_multiple=True, condition=( lambda item: not item.deleted ) ) )
operations.append( grids.GridOperation( "Undelete", condition=( lambda item: item.deleted ) ) )
- operations.append( grids.GridOperation( "Purge",
- allow_multiple=False,
- confirm="This will permanently delete this sequencing request. Click OK to proceed.",
- condition=( lambda item: item.deleted ) ) )
global_actions = [
grids.GridAction( "Create new request", dict( controller='requests_common',
action='create_request',
@@ -227,7 +223,8 @@ class RequestsAdmin( BaseController, Use
status=status,
message=message )
# Create an event with state 'Rejected' for this request
- event = trans.model.RequestEvent( request, request.states.REJECTED, comment )
+ event_comment = "Request marked rejected by %s. Reason: %s " % ( trans.user.email, comment )
+ event = trans.model.RequestEvent( request, request.states.REJECTED, event_comment )
trans.sa_session.add( event )
trans.sa_session.flush()
message='Request (%s) has been rejected.' % request.name
@@ -240,6 +237,11 @@ class RequestsAdmin( BaseController, Use
@web.expose
@web.require_admin
def manage_datasets( self, trans, **kwd ):
+ def handle_error( **kwd ):
+ kwd[ 'status' ] = 'error'
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='manage_datasets',
+ **kwd ) )
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
@@ -247,23 +249,28 @@ class RequestsAdmin( BaseController, Use
operation = kwd[ 'operation' ].lower()
sample_dataset_id = params.get( 'id', None )
if not sample_dataset_id:
- return invalid_id_redirect( trans, 'requests_admin', sample_dataset_id )
+ message = 'Select at least 1 dataset to %s.' % operation
+ kwd[ 'message' ] = message
+ del kwd[ 'operation' ]
+ handle_error( **kwd )
id_list = util.listify( sample_dataset_id )
selected_sample_datasets = []
for sample_dataset_id in id_list:
- try:
- selected_sample_datasets.append( trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) ) )
+ try:
+ sample_dataset = trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) )
except:
return invalid_id_redirect( trans, 'requests_admin', sample_dataset_id )
+ selected_sample_datasets.append( sample_dataset )
if operation == "view":
- return trans.fill_template( '/admin/requests/dataset.mako',
+ return trans.fill_template( '/admin/requests/view_sample_dataset.mako',
+ cntrller='requests_admin',
sample_dataset=selected_sample_datasets[0] )
elif operation == "delete":
not_deleted = []
for sample_dataset in selected_sample_datasets:
# Make sure the dataset has been transferred before deleting it.
if sample_dataset in sample_dataset.sample.untransferred_dataset_files:
- # save the sample to which these datasets belong to
+ # Save the sample dataset
sample = sample_dataset.sample
trans.sa_session.delete( sample_dataset )
trans.sa_session.flush()
@@ -299,7 +306,9 @@ class RequestsAdmin( BaseController, Use
sample=selected_sample_datasets[0].sample,
id_list=id_list )
elif operation == "transfer":
- self.initiate_data_transfer( trans, selected_sample_datasets[0].sample, selected_sample_datasets )
+ self.initiate_data_transfer( trans,
+ trans.security.encode_id( selected_sample_datasets[0].sample.id ),
+ sample_datasets=selected_sample_datasets )
# Render the grid view
sample_id = params.get( 'sample_id', None )
try:
@@ -308,13 +317,10 @@ class RequestsAdmin( BaseController, Use
return invalid_id_redirect( trans, 'requests_admin', sample_id )
request_id = trans.security.encode_id( sample.request.id )
library_id = trans.security.encode_id( sample.library.id )
- self.datatx_grid.global_actions = [ grids.GridAction( "Refresh page",
+ self.datatx_grid.title = 'Manage "%s" datasets' % sample.name
+ self.datatx_grid.global_actions = [ grids.GridAction( "Select more datasets",
dict( controller='requests_admin',
- action='manage_datasets',
- sample_id=sample_id ) ),
- grids.GridAction( "Select datasets",
- dict( controller='requests_admin',
- action='get_data',
+ action='select_datasets_to_transfer',
request_id=request_id,
sample_id=sample_id ) ),
grids.GridAction( "Browse target data library",
@@ -326,7 +332,11 @@ class RequestsAdmin( BaseController, Use
dict( controller='requests_common',
action='view_request',
cntrller='requests_admin',
- id=request_id ) ) ]
+ id=request_id ) ),
+ grids.GridAction( "Refresh page",
+ dict( controller='requests_admin',
+ action='manage_datasets',
+ sample_id=sample_id ) ) ]
return self.datatx_grid( trans, **kwd )
@web.expose
@web.require_admin
@@ -372,70 +382,68 @@ class RequestsAdmin( BaseController, Use
sample_id=sample_id ) )
@web.expose
@web.require_admin
- def get_data( self, trans, **kwd ):
+ def select_datasets_to_transfer( self, trans, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
request_id = kwd.get( 'request_id', None )
files = []
+ def handle_error( **kwd ):
+ kwd[ 'status' ] = 'error'
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='select_datasets_to_transfer',
+ **kwd ) )
try:
request = trans.sa_session.query( trans.model.Request ).get( trans.security.decode_id( request_id ) )
except:
return invalid_id_redirect( trans, 'requests_admin', request_id )
- selected_files = util.restore_text( params.get( 'selected_files', '' ) )
- if len( selected_files ):
- selected_files = selected_files.split(',')
+ selected_datasets_to_transfer = util.restore_text( params.get( 'selected_datasets_to_transfer', '' ) )
+ if selected_datasets_to_transfer:
+ selected_datasets_to_transfer = selected_datasets_to_transfer.split(',')
else:
- selected_files = []
- selected_sample_id = kwd.get( 'sample_id', 'none' )
- sample_id_select_field = self.__build_sample_id_select_field( trans, request, selected_sample_id )
+ selected_datasets_to_transfer = []
+ sample_id = kwd.get( 'sample_id', 'none' )
+ sample_id_select_field = self.__build_sample_id_select_field( trans, request, sample_id )
+ if sample_id != 'none':
+ sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( sample_id ) )
+ else:
+ sample = None
# The __get_files() method redirects here with a status of 'error' and a message if there
# was a problem retrieving the files.
- if params.get( 'select_show_datasets_button', False ) or params.get( 'select_more_button', False ):
- # get the sample these datasets are associated with
- try:
- sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( selected_sample_id ) )
- except:
- message = 'Select a sample before selecting its associated datasets.'
- return trans.fill_template( '/admin/requests/get_data.mako',
- cntrller='requests_admin',
- request=request,
- sample_id_select_field=sample_id_select_field,
- status='error',
- message=message )
+ if params.get( 'select_datasets_to_transfer_button', False ):
+ # Get the sample that was sequenced to produce these datasets.
+ if sample_id == 'none':
+ message = 'Select the sample that was sequenced to produce the datasets you want to transfer.'
+ kwd[ 'message' ] = message
+ del kwd[ 'select_datasets_to_transfer_button' ]
+ handle_error( **kwd )
if sample in sample.request.samples_without_library_destinations:
# Display an error if a sample has been selected that
# has not yet been associated with a destination library.
+ message = 'Select a target data library and folder for the sample before selecting the datasets.'
status = 'error'
- message = 'Select a sample with associated data library and folder before selecting the datasets.'
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='get_data',
- request_id=request_id,
- sample_id=sample.id,
+ return trans.response.send_redirect( web.url_for( controller='requests_common',
+ action='edit_samples',
+ cntrller='requests_admin',
+ id=trans.security.encode_id( request.id ),
+ editing_samples=True,
status=status,
message=message ) )
# Save the sample datasets
- sample_dataset_file_names = self.__save_sample_datasets( trans, sample, selected_files )
+ sample_dataset_file_names = self.__save_sample_datasets( trans, sample, selected_datasets_to_transfer )
if sample_dataset_file_names:
message = 'Datasets (%s) have been selected for sample (%s)' % \
( str( sample_dataset_file_names )[1:-1].replace( "'", "" ), sample.name )
- if params.get( 'select_show_datasets_button', False ):
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='manage_datasets',
- request_id=request_id,
- sample_id=selected_sample_id,
- message=message,
- status=status ) )
- else: # 'select_more_button' was clicked
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='get_data',
- request_id=request_id,
- sample_id=sample.id,
- message=message,
- status=status ) )
- return trans.fill_template( '/admin/requests/get_data.mako',
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='manage_datasets',
+ request_id=request_id,
+ sample_id=sample_id,
+ message=message,
+ status=status ) )
+ return trans.fill_template( '/admin/requests/select_datasets_to_transfer.mako',
cntrller='requests_admin',
request=request,
+ sample=sample,
sample_id_select_field=sample_id_select_field,
status=status,
message=message )
@@ -499,7 +507,7 @@ class RequestsAdmin( BaseController, Use
if ok:
return output.splitlines()
return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='get_data',
+ action='select_datasets_to_transfer',
request_id=trans.security.encode_id( request.id ),
status=status,
message=message ) )
@@ -508,24 +516,36 @@ class RequestsAdmin( BaseController, Use
if a_path and not a_path.endswith( os.sep ):
a_path += os.sep
return a_path
- def __save_sample_datasets( self, trans, sample, selected_files ):
+ def __save_sample_datasets( self, trans, sample, selected_datasets_to_transfer ):
sample_dataset_file_names = []
- if selected_files:
- for filepath in selected_files:
+ if selected_datasets_to_transfer:
+ for filepath in selected_datasets_to_transfer:
# FIXME: handle folder selection
# ignore folders for now
if filepath[-1] != os.sep:
name = self.__dataset_name( sample, filepath.split( '/' )[-1] )
+ status = trans.app.model.SampleDataset.transfer_status.NOT_STARTED
+ size = sample.get_untransferred_dataset_size( filepath )
sample_dataset = trans.model.SampleDataset( sample=sample,
file_path=filepath,
- status=trans.app.model.SampleDataset.transfer_status.NOT_STARTED,
+ status=status,
name=name,
error_msg='',
- size=sample.dataset_size( filepath ) )
+ size=size )
trans.sa_session.add( sample_dataset )
trans.sa_session.flush()
sample_dataset_file_names.append( str( sample_dataset.name ) )
return sample_dataset_file_names
+ def dataset_file_size( self, sample, filepath ):
+ def print_ticks(d):
+ pass
+ datatx_info = sample.request.type.datatx_info
+ cmd = 'ssh %s@%s "du -sh \'%s\'"' % ( datatx_info['username'], datatx_info['host'], filepath )
+ output = pexpect.run( cmd,
+ events={ '.ssword:*': datatx_info['password']+'\r\n',
+ pexpect.TIMEOUT:print_ticks},
+ timeout=10 )
+ return output.replace( filepath, '' ).strip()
def __dataset_name( self, sample, filepath ):
name = filepath.split( '/' )[-1]
options = sample.request.type.rename_dataset_options
@@ -610,38 +630,54 @@ class RequestsAdmin( BaseController, Use
if not datatx_info[ 'host' ] \
or not datatx_info[ 'username' ] \
or not datatx_info[ 'password' ]:
- err_msg = "Error in sequencer login information."
- # check if web API is enabled and API key exists
- if not trans.user.api_keys or not trans.app.config.enable_api:
- err_msg = "Could not start data transfer as Galaxy Web API is not enabled. Enable Galaxy Web API in the Galaxy config file and create an API key."
+ err_msg += "Error in sequencer login information. "
+ # Make sure web API is enabled and API key exists
+ if not trans.app.config.enable_api:
+ err_msg += "The 'enable_api = True' setting is not correctly set in the Galaxy config file. "
+ if not trans.user.api_keys:
+ err_msg += "Set your API Key in your User Preferences to transfer datasets."
# check if library_import_dir is set
if not trans.app.config.library_import_dir:
- err_msg = "'library_import_dir' config variable is not set in the Galaxy config file."
+ err_msg = "'The library_import_dir' setting is not set in the Galaxy config file."
# check the RabbitMQ server settings in the config file
for k, v in trans.app.config.amqp.items():
if not v:
- err_msg = 'Set RabbitMQ server settings in the "galaxy_amqp" section of the Galaxy config file. %s is not set.' % k
+ err_msg += 'Set RabbitMQ server settings in the "galaxy_amqp" section of the Galaxy config file. %s is not set.' % k
break
return err_msg
- def initiate_data_transfer( self, trans, sample, selected_sample_datasets ):
+ @web.expose
+ @web.require_admin
+ def initiate_data_transfer( self, trans, sample_id, sample_datasets=[], sample_dataset_id='' ):
'''
This method initiates the transfer of the datasets from the sequencer. It
happens in the following steps:
- - The current admin user needs to have ADD_LIBRARY_ITEM permission for the
+ - The current admin user needs to have LIBRARY_ADD permission for the
target library and folder
- Create an XML message encapsulating all the data transfer info and send it
to the message queue (RabbitMQ broker)
'''
- # check data transfer settings
+ try:
+ sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( sample_id ) )
+ except:
+ return invalid_id_redirect( trans, 'requests_admin', sample_id )
+ # Check data transfer settings
err_msg = self.__validate_data_transfer_settings( trans, sample )
if not err_msg:
- # check if the current user has add_library_item permission to the sample
- # target library & folder
+ # Make sure the current user has LIBRARY_ADD
+ # permission on the target library and folder.
self.__check_library_add_permission( trans, sample.library, sample.folder )
- # create the message
+ if sample_dataset_id and not sample_datasets:
+ # Either a list of SampleDataset objects or a comma-separated string of
+ # encoded SampleDataset ids can be received. If the latter, parse the
+ # sample_dataset_id to build the list of sample_datasets.
+ id_list = util.listify( sample_dataset_id )
+ for sample_dataset_id in id_list:
+ sample_dataset = trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) )
+ sample_datasets.append( sample_dataset )
+ # Create the message
message = self.__create_data_transfer_message( trans,
sample,
- selected_sample_datasets )
+ sample_datasets )
# Send the message
try:
conn = amqp.Connection( host=trans.app.config.amqp[ 'host' ] + ":" + trans.app.config.amqp[ 'port' ],
@@ -660,9 +696,9 @@ class RequestsAdmin( BaseController, Use
chan.close()
conn.close()
except Exception, e:
- err_msg = "Error in sending the data transfer message to the Galaxy AMQP message queue:<br/>%s" % str(e)
+ err_msg = "Error sending the data transfer message to the Galaxy AMQP message queue:<br/>%s" % str(e)
if not err_msg:
- err_msg = "%i datasets have been queued for transfer from the sequencer. Click the Refresh button above to monitor the transfer status." % len( selected_sample_datasets )
+ err_msg = "%i datasets have been queued for transfer from the sequencer. Click the Refresh button above to monitor the transfer status." % len( sample_datasets )
status = "done"
else:
status = 'error'
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -19,12 +19,13 @@
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
is_complete = request.is_complete
+ is_submitted = request.is_submitted
is_unsubmitted = request.is_unsubmitted
can_add_samples = is_unsubmitted
can_delete_samples = request.samples and not is_complete
can_edit_samples = request.samples and ( is_admin or not is_complete )
can_edit_request = ( is_admin and not request.is_complete ) or request.is_unsubmitted
- can_reject_or_transfer = is_admin and request.is_submitted
+ can_reject = is_admin and is_submitted
can_submit = request.samples and is_unsubmitted
%>
@@ -47,9 +48,8 @@
<a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit</a>
%endif
<a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
- %if can_reject_or_transfer:
+ %if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='get_data', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
%endif
</div></ul>
--- a/templates/requests/common/events.mako
+++ b/templates/requests/common/events.mako
@@ -20,7 +20,7 @@
%endif
%if is_admin and request.is_submitted:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='get_data', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
+ <a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
%endif
</div></ul>
--- a/templates/requests/common/edit_basic_request_info.mako
+++ b/templates/requests/common/edit_basic_request_info.mako
@@ -17,7 +17,7 @@
<a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
%if is_admin and request.is_submitted:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='get_data', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
+ <a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
%endif
</div></ul>
--- a/templates/requests/common/view_request.mako
+++ b/templates/requests/common/view_request.mako
@@ -19,11 +19,13 @@
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
is_complete = request.is_complete
+ is_submitted = request.is_submitted
is_unsubmitted = request.is_unsubmitted
+ can_add_samples = is_unsubmitted
can_edit_request = ( is_admin and not request.is_complete ) or request.is_unsubmitted
- can_add_samples = is_unsubmitted
can_delete_samples = request.samples and not is_complete
can_edit_samples = request.samples and ( is_admin or not is_complete )
+ can_reject = is_admin and is_submitted
can_submit = request.samples and is_unsubmitted
%>
@@ -35,13 +37,15 @@
%endif
<li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request actions</a></li><div popupmenu="request-${request.id}-popup">
+ %if request.deleted:
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='undelete_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Undelete</a>
+ %endif
%if can_edit_request:
<a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit</a>
%endif
<a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
- %if is_admin and request.is_submitted:
+ %if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='get_data', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
%endif
</div></ul>
--- a/templates/admin/requests/dataset.mako
+++ /dev/null
@@ -1,69 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<br/><br/>
-
-<% sample = sample_dataset.sample %>
-
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller='requests_admin', sample_id=trans.security.encode_id( sample.id ) )}">
- <span>Browse datasets</span></a>
- </li>
-</ul>
-
-<div class="toolForm">
- <div class="toolFormTitle">Dataset Information</div>
- <div class="toolFormBody">
- <div class="form-row">
- <label>Name:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- ${sample_dataset.name}
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>File on the Sequencer:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- ${sample_dataset.file_path}
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Size:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- ${sample_dataset.size}
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Created on:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- ${sample_dataset.create_time}
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Updated on:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- ${sample_dataset.update_time}
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Transfer status:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- ${sample_dataset.status}
- %if sample_dataset.status == trans.app.model.SampleDataset.transfer_status.ERROR:
- <br/>
- ${sample_dataset.error_msg}
- %endif
- </div>
- <div style="clear: both"></div>
- </div>
- </div>
-</div>
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -168,15 +168,25 @@
%endif
<td valign="top">${current_sample['library_select_field'].get_html()}</td><td valign="top">${current_sample['folder_select_field'].get_html()}</td>
- %if display_datasets:
- <%
- if sample:
- label = str( len( sample.datasets ) )
- else:
- label = 'add'
- %>
- <td valign="top"><a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${label}</a></td>
- <td valign="top"><a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${label}</a></td>
+ %if display_datasets:
+ <td valign="top">
+ ## An admin can select the datasets to transfer, while a non-admin can only view what has been selected
+ %if is_admin:
+ <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a>
+ %elif sample.datasets:
+ ## Only display a link if there is at least 1 selected dataset for the sample
+ <a href="${h.url_for( controller='requests_common', action='view_selected_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a></td>
+ %else:
+ ${len( sample.datasets )}
+ %endif
+ </td>
+ <td valign="top">
+ %if is_admin and sample.untransferred_dataset_files:
+ <a href="${h.url_for( controller='requests_common', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}</a>
+ %else:
+ ${len( sample.transferred_dataset_files )}
+ %endif
+ </td>
%endif
%if sample and ( is_admin or is_unsubmitted ) and not is_complete:
## Delete button
@@ -196,6 +206,7 @@
can_add_samples = request.is_unsubmitted
can_delete_samples = request.samples and not is_complete
can_edit_samples = request.samples and ( is_admin or not is_complete )
+ can_select_datasets = is_admin and current_samples and ( is_submitted or is_complete )
display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted )
display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted )
display_datasets = request.samples and ( is_complete or is_rejected or is_submitted )
@@ -280,9 +291,31 @@
%else:
<td></td>
%endif
- %if is_submitted or is_complete:
- <td><a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a></td>
- <td><a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}</a></td>
+ %if is_submitted or is_complete:
+ <td>
+ ## An admin can select the datasets to transfer, while a non-admin can only view what has been selected
+ %if is_admin:
+ %if not sample.datasets:
+ ## If there are no selected datasets, display a page alowing the admin to select some.
+ <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id= trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a>
+ %else:
+ ## If there are selected datasets, display them
+ <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_selected_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a>
+ %endif
+ %elif sample.datasets:
+ ## Only display a link if there is at least 1 selected dataset for the sample
+ <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_selected_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a>
+ %else:
+ ${len( sample.datasets )}
+ %endif
+ </td>
+ <td>
+ %if is_admin and sample.untransferred_dataset_files:
+ <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}</a>
+ %else:
+ ${len( sample.transferred_dataset_files )}
+ %endif
+ </td>
%endif
</tr>
%else:
@@ -395,3 +428,52 @@
</table></div></%def>
+
+<%def name="render_sample_datasets( cntrller, sample, sample_datasets, title )">
+ %if sample_datasets:
+ <%
+ is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
+ is_complete = sample.request.is_complete
+ is_submitted = sample.request.is_submitted
+ can_select_datasets = is_admin and ( is_complete or is_submitted )
+ can_transfer_datasets = is_admin and sample.untransferred_dataset_files
+ %>
+ <h3>${title}</h3>
+ <table class="grid">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Size</th>
+ <th>Status</th>
+ </tr>
+ <thead>
+ <tbody>
+ %for dataset in sample_datasets:
+ <tr>
+ <td>
+ %if is_admin:
+ <% encoded_id = trans.security.encode_id(dataset.id) %>
+ <span class="expandLink dataset-${dataset}-click"><span class="rowIcon"></span>
+ <div style="float: left; margin-left: 2px;" class="menubutton split popup" id="dataset-${dataset.id}-popup">
+ <a class="dataset-${encoded_id}-click" href="${h.url_for( controller='requests_admin', action='manage_datasets', operation='view', id=trans.security.encode_id( dataset.id ) )}">${dataset.name}</a>
+ </div>
+ </span>
+ <div popupmenu="dataset-${dataset.id}-popup">
+ %if can_transfer_datasets and dataset in sample.untransferred_dataset_files:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='initiate_data_transfer', sample_id=trans.security.encode_id( sample.id ), sample_dataset_id=trans.security.encode_id( dataset.id ) )}">Transfer</a></li>
+ %endif
+ </div>
+ %else:
+ ${dataset.name}
+ %endif
+ </td>
+ <td>${dataset.size}</td>
+ <td>${dataset.status}</td>
+ </tr>
+ %endfor
+ </tbody>
+ </table>
+ %else:
+ No datasets for this sample.
+ %endif
+</%def>
1
0
galaxy-dist commit 0e3fe3e7b21b: Allow display framework to work with workflows that contain tools that have been updated. Previously, this would cause a server error when trying to view a workflow or a page with an embedded workflow that contained an updated tool.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Daniel Blankenberg <dan(a)bx.psu.edu>
# Date 1289341236 18000
# Node ID 0e3fe3e7b21bfd78461869817c6b43db827d77f0
# Parent 479b377ef455f2d676fb84363b0b6d437d6af5f6
Allow display framework to work with workflows that contain tools that have been updated. Previously, this would cause a server error when trying to view a workflow or a page with an embedded workflow that contained an updated tool.
--- a/templates/workflow/display.mako
+++ b/templates/workflow/display.mako
@@ -1,4 +1,5 @@
<%inherit file="/display_base.mako"/>
+<%namespace file="/display_common.mako" import="render_message" /><%!
from galaxy.tools.parameters import DataToolParameter, RuntimeValue
@@ -54,6 +55,9 @@
${param.value_to_display_text( value, app )}
%endif
</div>
+ %if hasattr( step, 'upgrade_messages' ) and step.upgrade_messages and param.name in step.upgrade_messages:
+ ${render_message( step.upgrade_messages[param.name], "info" )}
+ %endif
</div></%def>
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -207,9 +207,12 @@ class UsesStoredWorkflow( SharableItemSe
def get_stored_workflow_steps( self, trans, stored_workflow ):
""" Restores states for a stored workflow's steps. """
for step in stored_workflow.latest_workflow.steps:
+ step.upgrade_messages = {}
if step.type == 'tool' or step.type is None:
# Restore the tool state for the step
module = module_factory.from_workflow_step( trans, step )
+ #Check if tool was upgraded
+ step.upgrade_messages = module.check_and_update_state()
# Any connected input needs to have value DummyDataset (these
# are not persisted so we need to do it every time)
module.add_dummy_datasets( connections=step.input_connections )
1
0
galaxy-dist commit 7c60d74ba2df: Aggressively sanitize metadata parameter values when provided on the upload form and which are subsequently used for filename substitution.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Daniel Blankenberg <dan(a)bx.psu.edu>
# Date 1289329026 18000
# Node ID 7c60d74ba2df4488df90d08ed0ae9c7cc3871222
# Parent 9ee40043b826b3bc1e29f84996f9fe14dd119a45
Aggressively sanitize metadata parameter values when provided on the upload form and which are subsequently used for filename substitution.
--- a/lib/galaxy/util/__init__.py
+++ b/lib/galaxy/util/__init__.py
@@ -155,6 +155,26 @@ def sanitize_param(value):
print value
raise Exception, 'Unknown parameter type (%s)' % ( type( value ) )
+valid_filename_chars = set( string.ascii_letters + string.digits + '_.' )
+invalid_filenames = [ '', '.', '..' ]
+def sanitize_for_filename( text, default=None ):
+ """
+ Restricts the characters that are allowed in a filename portion; Returns default value or a unique id string if result is not a valid name.
+ Method is overly aggressive to minimize possible complications, but a maximum length is not considered.
+ """
+ out = []
+ for c in text:
+ if c in valid_filename_chars:
+ out.append( c )
+ else:
+ out.append( '_' )
+ out = ''.join( out )
+ if out in invalid_filenames:
+ if default is None:
+ return sanitize_for_filename( str( unique_id() ) )
+ return default
+ return out
+
class Params:
"""
Stores and 'sanitizes' parameters. Alphanumeric characters and the
--- a/lib/galaxy/tools/parameters/grouping.py
+++ b/lib/galaxy/tools/parameters/grouping.py
@@ -12,7 +12,7 @@ import StringIO, os, urllib
from galaxy.datatypes import sniff
from galaxy.util.bunch import Bunch
from galaxy.util.odict import odict
-from galaxy.util import json, relpath
+from galaxy.util import json, relpath, sanitize_for_filename
class Group( object ):
def __init__( self ):
@@ -335,10 +335,14 @@ class UploadDataset( Group ):
dataset.composite_files = {}
#load metadata
files_metadata = context.get( self.metadata_ref, {} )
+ metadata_name_substition_default_dict = dict( [ ( composite_file.substitute_name_with_metadata, d_type.metadata_spec[ composite_file.substitute_name_with_metadata ].default ) for composite_file in d_type.composite_files.values() if composite_file.substitute_name_with_metadata ] )
for meta_name, meta_spec in d_type.metadata_spec.iteritems():
if meta_spec.set_in_upload:
if meta_name in files_metadata:
- dataset.metadata[ meta_name ] = files_metadata[ meta_name ]
+ meta_value = files_metadata[ meta_name ]
+ if meta_name in metadata_name_substition_default_dict:
+ meta_value = sanitize_for_filename( meta_value, default = metadata_name_substition_default_dict[ meta_name ] )
+ dataset.metadata[ meta_name ] = meta_value
dataset.precreated_name = dataset.name = self.get_composite_dataset_name( context )
if dataset.datatype.composite_type == 'auto_primary_file':
#replace sniff here with just creating an empty file
1
0