galaxy-dev
Threads by month
- ----- 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
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
October 2009
- 18 participants
- 172 discussions
Hi,
I want to run a few of the interval operation tools on the command
line, however I am getting the following error:
Traceback (most recent call last):
File
"/home/swebb/galaxy/galaxy_dist/tools/new_operations/gops_join.py",
line 11, in <module>
from galaxy import eggs
ImportError: No module named galaxy
I assume I may need to alter some Environmental variables.
Any help appreciated.
Thanks
Shaun Webb
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
2
1
To whom it may concern,
Here is my test code.
********************************************************
<tests>
<test>
<param name="source" value="From current history" />
<param name="fasta_input" value="chr4.fas" ftype="fasta" />
<param name="organism" value="Arabidopsis thaliana (TAIR9)" />
<output name="output" file="tair9_test.txt" />
</test>
</tests>
********************************************************
And I am getting a failure result for my test.
The error message is
*******************************************************
Traceback (most recent call last):
File "/home/galaxy/galaxy-2.1.2009/test/functional/test_toolbox.py", line 114, in test_tool
self.do_it()
File "/home/galaxy/galaxy-2.1.2009/test/functional/test_toolbox.py", line 54, in do_it
self.verify_dataset_correctness( file )
File "/home/galaxy/galaxy-2.1.2009/test/base/twilltestcase.py", line 363, in verify_dataset_correctness
raise AssertionError( errmsg )
AssertionError: History item 3 different than expected, difference:
--- local_file
+++ history_data
@@ -1,0 +1,14 @@
*****************************************************
It will be great if you can suggest a way for me to solve the problem.
Many thanks in advance,
Vipin T S
2
2
Hello,
I'd like to request a small change:
to create a dedicated python file for user customizable datatypes -
something like "user_intervals.py" along side "intervals.py" (in /lib/galaxy/datatypes).
The reason is that we have our own custom types, with special column assignment.
So for example, I've added the following class to the bottom of "intervals.py":
=========
class Foobar ( Interval ):
"""Foobar results"""
"""Add metadata elements"""
MetadataElement( name="chromCol", default=2, desc="Chrom column", param=metadata.ColumnParameter )
MetadataElement( name="startCol", default=4, desc="Start column", param=metadata.ColumnParameter )
MetadataElement( name="endCol", default=5, desc="End column", param=metadata.ColumnParameter )
MetadataElement( name="strandCol", default=3, desc="Strand column", param=metadata.ColumnParameter )
MetadataElement( name="nameCol", default=1, desc="Name/Identifier column", param=metadata.ColumnParameter )
MetadataElement( name="columns", default=6, desc="Number of columns", readonly=True, visible=False )
===========
It's a simple text file containing intervals, but with different column assignment.
I also updated <datatypes_conf.xml>, and this way, if my tool outputs a "foobar" format - the columns assignment works perfectly.
The only problem is merging:
If the "intervals.py" file is changed in the main repository - automatic merging doesn't work cleanly. It needs to merge an old intervals.py (with my custom types) together with a new intervals.py (without my custom types).
Maybe I'm doing something wrong, but I always end up having to manually resolve the conflicts.
My suggestion is to have an empty "user_intervals.py" (or other datatypes, too), which will be monitored in the repository, but will not contain any Galaxy official types. That will keep a clear separation between galaxy types and user types.
If this is already possible somehow, please let me know.
Thanks!
gordon.
2
1
14 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/878ca31a4995
changeset: 2883:878ca31a4995
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Wed Oct 14 09:33:56 2009 -0400
description:
Remove a debug statement, slight cleanup.
3 file(s) affected in this change:
lib/galaxy/web/controllers/forms.py
lib/galaxy/web/controllers/library.py
lib/galaxy/web/controllers/library_admin.py
diffs (37 lines):
diff -r ca816e66ec69 -r 878ca31a4995 lib/galaxy/web/controllers/forms.py
--- a/lib/galaxy/web/controllers/forms.py Wed Oct 14 02:22:11 2009 -0400
+++ b/lib/galaxy/web/controllers/forms.py Wed Oct 14 09:33:56 2009 -0400
@@ -135,7 +135,6 @@
renaming fields, adding/deleting fields, changing fields attributes.
'''
params = util.Params( kwd )
- log.debug( kwd )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
try:
diff -r ca816e66ec69 -r 878ca31a4995 lib/galaxy/web/controllers/library.py
--- a/lib/galaxy/web/controllers/library.py Wed Oct 14 02:22:11 2009 -0400
+++ b/lib/galaxy/web/controllers/library.py Wed Oct 14 09:33:56 2009 -0400
@@ -114,7 +114,8 @@
created_ldda_ids = params.get( 'created_ldda_ids', '' )
hidden_folder_ids = util.listify( util.restore_text( params.get( 'hidden_folder_ids', '' ) ) )
if created_ldda_ids and not msg:
- msg = "%d datasets are now uploading in the background to the library '%s' ( each is selected ). Please do not navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons (on this tab) until the upload(s) change from the \"uploading\" state." % ( len( created_ldda_ids.split(',') ), library.name )
+ msg = "%d datasets are now uploading in the background to the library '%s' ( each is selected ). " % ( len( created_ldda_ids.split(',') ), library.name )
+ msg += "Do not navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons ( on this tab ) until the upload(s) change from the \"uploading\" state."
messagetype = "info"
return trans.fill_template( '/library/browse_library.mako',
library=library,
diff -r ca816e66ec69 -r 878ca31a4995 lib/galaxy/web/controllers/library_admin.py
--- a/lib/galaxy/web/controllers/library_admin.py Wed Oct 14 02:22:11 2009 -0400
+++ b/lib/galaxy/web/controllers/library_admin.py Wed Oct 14 09:33:56 2009 -0400
@@ -50,7 +50,8 @@
messagetype='error' ) )
created_ldda_ids = params.get( 'created_ldda_ids', '' )
if created_ldda_ids and not msg:
- msg = "%d datasets are now uploading in the background to the library '%s' ( each is selected ). Please do not navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons (on this tab) until the upload(s) change from the \"uploading\" state." % ( len( created_ldda_ids.split(',') ), library.name )
+ msg = "%d datasets are now uploading in the background to the library '%s' ( each is selected ). " % ( len( created_ldda_ids.split( ',' ) ), library.name )
+ msg += "Do not navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons ( on this tab ) until the upload(s) change from the \"uploading\" state."
messagetype = "info"
return trans.fill_template( '/admin/library/browse_library.mako',
library=library,
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/ca816e66ec69
changeset: 2882:ca816e66ec69
user: rc
date: Wed Oct 14 02:22:11 2009 -0400
description:
Forms & request controllers
- refactored to work on main
- cleanup
Added more functional tests
12 file(s) affected in this change:
lib/galaxy/model/__init__.py
lib/galaxy/web/controllers/forms.py
lib/galaxy/web/controllers/requests.py
lib/galaxy/web/controllers/requests_admin.py
lib/galaxy/web/framework/__init__.py
templates/admin/forms/edit_form.mako
templates/admin/forms/show_form_read_only.mako
templates/admin/requests/show_request.mako
templates/requests/show_request.mako
templates/user/address.mako
test/base/twilltestcase.py
test/functional/test_forms_and_requests.py
diffs (2308 lines):
diff -r b16a6d767e65 -r ca816e66ec69 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Tue Oct 13 18:15:06 2009 -0400
+++ b/lib/galaxy/model/__init__.py Wed Oct 14 02:22:11 2009 -0400
@@ -1090,11 +1090,12 @@
types = Bunch( REQUEST = 'Sequencing Request Form',
SAMPLE = 'Sequencing Sample Form',
LIBRARY_INFO_TEMPLATE = 'Library information template' )
- def __init__(self, name=None, desc=None, fields=[], current_form=None, form_type=None, layout=None):
+ def __init__(self, name=None, desc=None, fields=[],
+ form_definition_current=None, form_type=None, layout=None):
self.name = name
self.desc = desc
self.fields = fields
- self.form_definition_current = current_form
+ self.form_definition_current = form_definition_current
self.type = form_type
self.layout = layout
def fields_of_grid(self, layout_grid_name):
@@ -1263,20 +1264,26 @@
self.postal_code = postal_code
self.country = country
self.phone = phone
- def display(self):
- return self.name+'<br/>'+ \
- self.institution+'<br/>'+ \
- self.address+'<br/>'+ \
- self.city+' '+self.state+' '+self.postal_code+'<br/>'+ \
- self.country+'<br/>'+ \
- 'Phone: '+self.phone
def get_html(self):
- return self.name+'<br/>'+ \
- self.institution+'<br/>'+ \
- self.address+'<br/>'+ \
- self.city+' '+self.state+' '+self.postal_code+'<br/>'+ \
- self.country+'<br/>'+ \
- 'Phone: '+self.phone
+ html = ''
+ if self.name:
+ html = html + self.name
+ if self.institution:
+ html = html + '<br/>' + self.institution
+ if self.address:
+ html = html + '<br/>' + self.address
+ if self.city:
+ html = html + '<br/>' + self.city
+ if self.state:
+ html = html + ' ' + self.state
+ if self.postal_code:
+ html = html + ' ' + self.postal_code
+ if self.country:
+ html = html + '<br/>' + self.country
+ if self.phone:
+ html = html + '<br/>' + 'Phone: ' + self.phone
+ return html
+
class Page( object ):
def __init__( self ):
diff -r b16a6d767e65 -r ca816e66ec69 lib/galaxy/web/controllers/forms.py
--- a/lib/galaxy/web/controllers/forms.py Tue Oct 13 18:15:06 2009 -0400
+++ b/lib/galaxy/web/controllers/forms.py Wed Oct 14 02:22:11 2009 -0400
@@ -12,6 +12,14 @@
log = logging.getLogger( __name__ )
class Forms( BaseController ):
+ # Empty form field
+ empty_field = { 'label': '',
+ 'helptext': '',
+ 'visible': True,
+ 'required': False,
+ 'type': BaseField.form_field_types()[0],
+ 'selectlist': [],
+ 'layout': 'none' }
@web.expose
@web.require_admin
def index( self, trans, **kwd ):
@@ -84,19 +92,12 @@
action='edit',
form_id=fd.id,
add_field_button='Add field',
- num_fields=0,
name=fd.name,
description=fd.desc,
form_type_selectbox=fd.type ) )
- self.current_form = {}
- self.current_form[ 'name' ] = 'New Form'
- self.current_form[ 'desc' ] = ''
- self.current_form[ 'type' ] = params.get( 'form_type', 'none' )
- self.current_form[ 'layout' ] = [ 'Main' ]
- self.current_form[ 'fields' ] = []
- inputs = [ ( 'Name', TextField( 'name', 40, self.current_form[ 'name' ] ) ),
- ( 'Description', TextField( 'description', 40, self.current_form[ 'desc' ] ) ),
- ( 'Type', self.__form_types_widget(trans, selected=self.current_form['type']) ),
+ inputs = [ ( 'Name', TextField( 'name', 40, 'New Form' ) ),
+ ( 'Description', TextField( 'description', 40, '' ) ),
+ ( 'Type', self.__form_types_widget(trans, selected=params.get( 'form_type', 'none' )) ),
( 'Import from csv file (Optional)', FileField( 'file_data', 40, '' ) ) ]
return trans.fill_template( '/admin/forms/create_form.mako',
inputs=inputs,
@@ -134,102 +135,156 @@
renaming fields, adding/deleting fields, changing fields attributes.
'''
params = util.Params( kwd )
+ log.debug( kwd )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
- form_id = params.get( 'form_id', None )
- if not form_id:
- msg = 'Invalid form id %s' % str( form_id )
- trans.response.send_redirect( web.url_for( controller='forms',
- action='manage',
- msg=msg,
- messagetype='error' ) )
- fd = trans.app.model.FormDefinition.get( int( params.form_id ) )
+ try:
+ fd = trans.app.model.FormDefinition.get( int( params.get( 'form_id', None ) ) )
+ except:
+ return trans.response.send_redirect( web.url_for( controller='forms',
+ action='manage',
+ msg='Invalid form',
+ messagetype='error' ) )
+ #
# Show the form for editing
+ #
if params.get( 'show_form', False ):
- self.__get_saved_form( fd )
- # The following two dicts store the unsaved select box options
- self.del_options = {}
- self.add_options = {}
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
- #Add a layout grid
+ current_form = self.__get_saved_form( fd )
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+ #
+ # Add a layout grid
+ #
elif params.get( 'add_layout_grid', False ):
- self.__update_current_form( trans, **kwd )
- self.__add_layout_grid()
+ current_form = self.__get_form( trans, **kwd )
+ current_form['layout'].append('')
# show the form again
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+ #
# Delete a layout grid
+ #
elif params.get( 'remove_layout_grid_button', False ):
- self.__update_current_form( trans, **kwd )
+ current_form = self.__get_form( trans, **kwd )
index = int( kwd[ 'remove_layout_grid_button' ].split( ' ' )[2] ) - 1
- self.__remove_layout_grid( index )
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
+ del current_form['layout'][index]
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+ #
+ # Add a field
+ #
+ elif params.get( 'add_field_button', False ):
+ current_form = self.__get_form( trans, **kwd )
+ current_form['fields'].append( self.empty_field )
+ # show the form again with one empty field
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+ #
# Delete a field
+ #
elif params.get( 'remove_button', False ):
- self.__update_current_form( trans, **kwd )
+ current_form = self.__get_form( trans, **kwd )
+ # find the index of the field to be removed from the remove button label
index = int( kwd[ 'remove_button' ].split( ' ' )[2] ) - 1
- self.__remove_field( index )
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
+ del current_form['fields'][index]
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+ #
# Save changes
+ #
elif params.get( 'save_changes_button', False ):
- self.__update_current_form( trans, **kwd )
- fd_new, msg = self.__save_form( trans, fd.form_definition_current.id, **kwd )
+ fd_new, msg = self.__save_form( trans, fdc_id=fd.form_definition_current.id, **kwd )
+ # if validation error encountered while saving the form, show the
+ # unsaved form, with the error message
if not fd_new:
- return self.__show( trans=trans, form=fd, msg=msg, messagetype='error', **kwd )
- else:
- fd = fd_new
+ current_form = self.__get_form( trans, **kwd )
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype='error', **kwd )
+ # everything went fine. form saved successfully. Show the saved form
+ fd = fd_new
+ current_form = self.__get_saved_form( fd )
msg = "The form '%s' has been updated with the changes." % fd.name
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
- #Add a field
- elif params.get( 'add_field_button', False ):
- self.__update_current_form( trans, **kwd )
- self.__add_field()
- # show the form again with one empty field
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+ #
# Show form read-only
+ #
elif params.get( 'read_only', False ):
return trans.fill_template( '/admin/forms/show_form_read_only.mako',
form=fd,
msg=msg,
messagetype=messagetype )
- # Refresh page, SelectField is selected/deselected as the type of a field
+ #
+ # Add SelectField option
+ #
+ elif 'Add' in kwd.values():
+ return self.__add_selectbox_option(trans, fd, msg, messagetype, **kwd)
+ #
+ # Remove SelectField option
+ #
+ elif 'Remove' in kwd.values():
+ return self.__remove_selectbox_option(trans, fd, msg, messagetype, **kwd)
+ #
+ # Refresh page
+ #
elif params.get( 'refresh', False ):
- self.__update_current_form( trans, **kwd )
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
- # Remove SelectField option
- elif params.get( 'select_box_options', False ) == 'remove':
- index = int( kwd[ 'field_index' ] )
- option = int( kwd[ 'option_index' ] )
- del self.current_form[ 'fields' ][ index ][ 'selectlist' ][ option ]
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
- # Add SelectField option
- elif params.get( 'select_box_options', False ) == 'add':
- index = int( kwd[ 'field_index' ] )
- self.current_form[ 'fields' ][ index ][ 'selectlist' ].append( '' )
- return self.__show( trans=trans, form=fd, msg=msg, messagetype=messagetype, **kwd )
- def __add_layout_grid(self):
- self.current_form['layout'].append('')
- def __remove_layout_grid(self, index):
- del self.current_form['layout'][index]
- def __remove_field(self, index):
- del self.current_form['fields'][index]
- def __add_field(self):
+ current_form = self.__get_form( trans, **kwd )
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+
+ def __add_selectbox_option( self, trans, fd, msg, messagetype, **kwd ):
'''
- add an empty field to the fields list
+ This method adds a selectbox option. The kwd dict searched for
+ the field index which needs to be removed
'''
- empty_field = { 'label': '',
- 'helptext': '',
- 'visible': True,
- 'required': False,
- 'type': BaseField.form_field_types()[0],
- 'selectlist': [],
- 'layout': 'none' }
- self.current_form['fields'].append(empty_field)
+ current_form = self.__get_form( trans, **kwd )
+ index = -1
+ for k, v in kwd.items():
+ if v == 'Add':
+ # extract the field index from the
+ # button name of format: 'addoption_<field>'
+ index = int(k.split('_')[1])
+ break
+ if index == -1:
+ # something wrong happened
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg='Error in adding selectfield option',
+ messagetype='error', **kwd )
+ # add an empty option
+ current_form[ 'fields' ][ index ][ 'selectlist' ].append( '' )
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+ def __remove_selectbox_option( self, trans, fd, msg, messagetype, **kwd ):
+ '''
+ This method removes a selectbox option. The kwd dict searched for
+ the field index and option index which needs to be removed
+ '''
+ current_form = self.__get_form( trans, **kwd )
+ option = -1
+ for k, v in kwd.items():
+ if v == 'Remove':
+ # extract the field & option indices from the
+ # button name of format: 'removeoption_<field>_<option>'
+ index = int(k.split('_')[1])
+ option = int(k.split('_')[2])
+ break
+ if option == -1:
+ # something wrong happened
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg='Error in removing selectfield option',
+ messagetype='error', **kwd )
+ # remove the option
+ del current_form[ 'fields' ][ index ][ 'selectlist' ][ option ]
+ return self.__show( trans=trans, form=fd, current_form=current_form,
+ msg=msg, messagetype=messagetype, **kwd )
+
+
def __get_field(self, index, **kwd):
+ '''
+ This method retrieves all the user-entered details of a field and
+ returns a dict.
+ '''
params = util.Params( kwd )
- #TODO: RC this needs to be handled so that it does not throw an exception.
- # To reproduce, create a new form, click the "add field" button, click the
- # browser back arrow, then click the "add field" button again.
- # You should never attempt to "restore_text()" on a None object...
name = util.restore_text( params.get( 'field_name_%i' % index, '' ) )
helptext = util.restore_text( params.get( 'field_helptext_%i' % index, '' ) )
required = params.get( 'field_required_%i' % index, False )
@@ -266,57 +321,54 @@
else:
return sb_options
def __get_saved_form(self, fd):
- self.current_form = {}
- self.current_form['name'] = fd.name
- self.current_form['desc'] = fd.desc
- self.current_form['type'] = fd.type
- self.current_form['layout'] = list(copy.deepcopy(fd.layout))
- self.current_form['fields'] = list(copy.deepcopy(fd.fields))
- def __validate_form(self, **kwd):
'''
- This method checks the following text inputs are filled out by the user
- - the name of form
- - name of all the fields
+ This retrieves the saved form and returns a dictionary containing the name,
+ desc, type, layout & fields of the form
'''
- params = util.Params( kwd )
- # form name
- if not util.restore_text( params.name ):
- return None, 'Form name must be filled.'
- # form type
- if util.restore_text( params.form_type_selectbox ) == 'none':
- return None, 'Form type must be selected.'
- # fields
-# for i in range( len(self.current_form['fields']) ):
-# if not util.restore_text(params.get( 'field_name_%i' % i, None )):
-# return None, "All the field label(s) must be completed."
- return True, ''
+ return dict(name = fd.name,
+ desc = fd.desc,
+ type = fd.type,
+ layout = list(copy.deepcopy(fd.layout)),
+ fields = list(copy.deepcopy(fd.fields)))
def __get_form(self, trans, **kwd):
+ '''
+ This method gets all the user-entered form details and returns a
+ dictionary containing the name, desc, type, layout & fields of the form
+ '''
params = util.Params( kwd )
name = util.restore_text( params.name )
desc = util.restore_text( params.description ) or ""
form_type = util.restore_text( params.form_type_selectbox )
+ # get the user entered layout grids
layout = []
- if form_type == trans.app.model.FormDefinition.types.SAMPLE:
- for index in range(len(self.current_form[ 'layout' ])):
- layout.append(params.get( 'grid_layout%i' % index, '' ))
+ index = 0
+ while True:
+ grid_name = util.restore_text( params.get( 'grid_layout%i' % index, '' ) )
+ if grid_name:
+ layout.append( grid_name )
+ index = index + 1
+ else:
+ break
+ # for csv file import
csv_file = params.get( 'file_data', '' )
+ fields = []
if csv_file == '':
- # set form fields
- fields = []
- for i in range( len(self.current_form['fields']) ):
- fields.append(self.__get_field(i, **kwd))
+ # get the user entered fields
+ index = 0
+ while True:
+ if params.get( 'field_name_%i' % index, False ):
+ fields.append( self.__get_field( index, **kwd ) )
+ index = index + 1
+ else:
+ break
fields = fields
else:
fields, layout = self.__import_fields(trans, csv_file, form_type)
- return name, desc, form_type, layout, fields
- def __update_current_form(self, trans, **kwd):
- name, desc, form_type, layout, fields = self.__get_form(trans, **kwd)
- self.current_form = {}
- self.current_form['name'] = name
- self.current_form['desc'] = desc
- self.current_form['type'] = form_type
- self.current_form['layout'] = layout
- self.current_form['fields'] = fields
+ return dict(name = name,
+ desc = desc,
+ type = form_type,
+ layout = layout,
+ fields = fields)
def __import_fields(self, trans, csv_file, form_type):
'''
@@ -356,7 +408,20 @@
**kwd))
self.__imported_from_file = True
return fields, list(layouts)
-
+ def __validate_form(self, **kwd):
+ '''
+ This method checks the following text inputs are filled out by the user
+ - the name of form
+ - form type
+ '''
+ params = util.Params( kwd )
+ # form name
+ if not util.restore_text( params.name ):
+ return None, 'Form name must be filled.'
+ # form type
+ if util.restore_text( params.form_type_selectbox ) == 'none':
+ return None, 'Form type must be selected.'
+ return True, ''
def __save_form(self, trans, fdc_id=None, **kwd):
'''
This method saves the current form
@@ -365,13 +430,18 @@
flag, msg = self.__validate_form(**kwd)
if not flag:
return None, msg
- name, desc, form_type, layout, fields = self.__get_form(trans, **kwd)
+ current_form = self.__get_form( trans, **kwd )
# validate fields
- for field in fields:
+ for field in current_form[ 'fields' ]:
if not field[ 'label' ]:
return None, "All the field label(s) must be completed."
- fd = trans.app.model.FormDefinition(name, desc, fields, current_form=None,
- form_type=form_type, layout=layout )
+ # create a new form definition
+ fd = trans.app.model.FormDefinition(name=current_form[ 'name' ],
+ desc=current_form[ 'desc' ],
+ fields=current_form[ 'fields' ],
+ form_definition_current=None,
+ form_type=current_form[ 'type' ],
+ layout=current_form[ 'layout' ] )
if fdc_id: # save changes to the existing form
# change the pointer in the form_definition_current table to point
# to this new record
@@ -467,7 +537,7 @@
def label(self):
return str(self.index)+'.'+self.label
- def __show( self, trans, form, msg='', messagetype='done', **kwd ):
+ def __show( self, trans, form, current_form, msg='', messagetype='done', **kwd ):
'''
This method displays the form and any of the changes made to it,
The empty_form param allows for this method to simulate clicking
@@ -476,18 +546,18 @@
'''
params = util.Params( kwd )
# name & description
- form_details = [ ( 'Name', TextField( 'name', 40, self.current_form[ 'name' ] ) ),
- ( 'Description', TextField( 'description', 40, self.current_form[ 'desc' ] ) ),
- ( 'Type', self.__form_types_widget(trans, selected=self.current_form['type']) ) ]
+ form_details = [ ( 'Name', TextField( 'name', 40, current_form[ 'name' ] ) ),
+ ( 'Description', TextField( 'description', 40, current_form[ 'desc' ] ) ),
+ ( 'Type', self.__form_types_widget(trans, selected=current_form[ 'type' ]) ) ]
form_layout = []
- if self.current_form['type'] == trans.app.model.FormDefinition.types.SAMPLE:
- for index, lg in enumerate(self.current_form['layout']):
+ if current_form[ 'type' ] == trans.app.model.FormDefinition.types.SAMPLE:
+ for index, lg in enumerate(current_form[ 'layout' ]):
form_layout.append( TextField( 'grid_layout%i' % index, 40, lg ))
# fields
field_details = []
- for index, field in enumerate( self.current_form[ 'fields' ] ):
- if self.current_form['type'] == trans.app.model.FormDefinition.types.SAMPLE:
- field_ui = self.FieldUI( self.current_form['layout'], index, field )
+ for index, field in enumerate( current_form[ 'fields' ] ):
+ if current_form['type'] == trans.app.model.FormDefinition.types.SAMPLE:
+ field_ui = self.FieldUI( current_form['layout'], index, field )
else:
field_ui = self.FieldUI( None, index, field )
field_details.append( field_ui.get() )
@@ -498,7 +568,7 @@
field_types=BaseField.form_field_types(),
msg=msg,
messagetype=messagetype,
- current_form_type=self.current_form['type'],
+ current_form_type=current_form[ 'type' ],
layout_grids=form_layout )
# Common methods for all components that use forms
diff -r b16a6d767e65 -r ca816e66ec69 lib/galaxy/web/controllers/requests.py
--- a/lib/galaxy/web/controllers/requests.py Tue Oct 13 18:15:06 2009 -0400
+++ b/lib/galaxy/web/controllers/requests.py Wed Oct 14 02:22:11 2009 -0400
@@ -115,20 +115,17 @@
status='error',
message="Invalid request ID",
**kwd) )
- self.current_samples = []
- self.edit_mode = False
+ current_samples = []
for s in request.samples:
- self.current_samples.append([s.name, s.values.content])
+ current_samples.append([s.name, s.values.content])
if add_sample:
- self.current_samples.append(['Sample_%i' % (len(self.current_samples)+1),['' for field in request.type.sample_form.fields]])
- self.details_state = 'Show request details'
+ current_samples.append(['Sample_%i' % (len(current_samples)+1),['' for field in request.type.sample_form.fields]])
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, id),
- current_samples = self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
+ current_samples = current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details='hide', edit_mode='False')
def request_details(self, trans, id):
'''
Shows the request details
@@ -186,25 +183,34 @@
value=request.values.content[index],
helptext=field['helptext']+' ('+req+')'))
return request_details
-
def __update_samples(self, request, **kwd):
+ '''
+ This method retrieves all the user entered sample information and
+ returns an list of all the samples and their field values
+ '''
params = util.Params( kwd )
- num_samples = len(self.current_samples)
- self.current_samples = []
+ current_samples = []
for s in request.samples:
- self.current_samples.append([s.name, s.values.content])
- for index in range(num_samples-len(request.samples)):
- sample_index = index + len(request.samples)
- sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
- sample_values = []
- for field_index in range(len(request.type.sample_form.fields)):
- sample_values.append(util.restore_text( params.get( 'sample_%i_field_%i' % (sample_index, field_index), '' ) ))
- self.current_samples.append([sample_name, sample_values])
-
- def __copy_sample(self):
+ current_samples.append([s.name, s.values.content])
+ index = len(request.samples)
+ while True:
+ if params.get( 'sample_%i_name' % index, '' ):
+ sample_index = index
+ sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
+ sample_values = []
+ for field_index in range(len(request.type.sample_form.fields)):
+ sample_values.append(util.restore_text( params.get( 'sample_%i_field_%i' % (sample_index, field_index), '' ) ))
+ current_samples.append([sample_name, sample_values])
+ index = index + 1
+ else:
+ break
+ details = params.get( 'details', 'hide' )
+ edit_mode = params.get( 'edit_mode', 'False' )
+ return current_samples, details, edit_mode
+ def __copy_sample(self, current_samples):
copy_list = SelectField('copy_sample')
copy_list.add_option('None', -1, selected=True)
- for i, s in enumerate(self.current_samples):
+ for i, s in enumerate(current_samples):
copy_list.add_option(s[0], i)
return copy_list
@web.expose
@@ -221,20 +227,22 @@
status='error',
message="Invalid request ID",
**kwd) )
+ # get the user entered sample details
+ current_samples, details, edit_mode = self.__update_samples( request, **kwd )
if params.get('import_samples_button', False) == 'Import samples':
try:
file_obj = params.get('file_data', '')
import csv
reader = csv.reader(file_obj.file)
for row in reader:
- self.current_samples.append([row[0], row[1:]])
+ current_samples.append([row[0], row[1:]])
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
- current_samples=self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
+ current_samples=current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
except:
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
@@ -242,39 +250,35 @@
message='Error in importing samples file',
**kwd))
elif params.get('add_sample_button', False) == 'Add New':
- # save the all (saved+unsaved) sample info in 'current_samples'
- self.__update_samples(request, **kwd)
# add an empty or filled sample
# if the user has selected a sample no. to copy then copy the contents
# of the src sample to the new sample else an empty sample
src_sample_index = int(params.get( 'copy_sample', -1 ))
if src_sample_index == -1:
# empty sample
- self.current_samples.append(['Sample_%i' % (len(self.current_samples)+1),['' for field in request.type.sample_form.fields]])
+ current_samples.append(['Sample_%i' % (len(current_samples)+1),['' for field in request.type.sample_form.fields]])
else:
- self.current_samples.append([self.current_samples[src_sample_index][0]+'_%i' % (len(self.current_samples)+1),
- [val for val in self.current_samples[src_sample_index][1]]])
+ current_samples.append([current_samples[src_sample_index][0]+'_%i' % (len(current_samples)+1),
+ [val for val in current_samples[src_sample_index][1]]])
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
- current_samples=self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
+ current_samples=current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
elif params.get('save_samples_button', False) == 'Save':
- # update current_samples
- self.__update_samples(request, **kwd)
# check for duplicate sample names
msg = ''
- for index in range(len(self.current_samples)-len(request.samples)):
+ for index in range(len(current_samples)-len(request.samples)):
sample_index = index + len(request.samples)
- sample_name = self.current_samples[sample_index][0]
+ sample_name = current_samples[sample_index][0]
if not sample_name.strip():
msg = 'Please enter the name of sample number %i' % sample_index
break
count = 0
- for i in range(len(self.current_samples)):
- if sample_name == self.current_samples[i][0]:
+ for i in range(len(current_samples)):
+ if sample_name == current_samples[i][0]:
count = count + 1
if count > 1:
msg = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
@@ -283,12 +287,13 @@
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
- current_samples = self.current_samples,
- sample_copy=self.__copy_sample(), details_state=self.details_state,
+ current_samples = current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details, edit_mode=edit_mode,
messagetype='error', msg=msg)
# save all the new/unsaved samples entered by the user
- if not self.edit_mode:
- for index in range(len(self.current_samples)-len(request.samples)):
+ if edit_mode == 'False':
+ for index in range(len(current_samples)-len(request.samples)):
sample_index = index + len(request.samples)
sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
sample_values = []
@@ -299,9 +304,9 @@
s = trans.app.model.Sample(sample_name, '', request, form_values)
s.flush()
else:
- for index in range(len(self.current_samples)):
+ for index in range(len(current_samples)):
sample_index = index
- sample_name = self.current_samples[sample_index][0]
+ sample_name = current_samples[sample_index][0]
new_sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
sample_values = []
for field_index in range(len(request.type.sample_form.fields)):
@@ -318,14 +323,14 @@
operation='show_request',
id=trans.security.encode_id(request.id)) )
elif params.get('edit_samples_button', False) == 'Edit samples':
- self.edit_mode = True
+ edit_mode = 'True'
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
- current_samples=self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
+ current_samples=current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
elif params.get('cancel_changes_button', False) == 'Cancel':
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
@@ -340,21 +345,22 @@
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
request = trans.app.model.Request.get(int(params.get('request_id', 0)))
+ current_samples, details, edit_mode = self.__update_samples( request, **kwd )
sample_index = int(params.get('sample_id', 0))
- sample_name = self.current_samples[sample_index][0]
+ sample_name = current_samples[sample_index][0]
s = request.has_sample(sample_name)
if s:
s.delete()
s.flush()
request.flush()
- del self.current_samples[sample_index]
+ del current_samples[sample_index]
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
- current_samples = self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
+ current_samples = current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
@web.expose
@web.require_login( "create/submit sequencing requests" )
@@ -363,17 +369,14 @@
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
request = trans.app.model.Request.get(int(params.get('request_id', 0)))
- if self.details_state == 'Show request details':
- self.details_state = 'Hide request details'
- elif self.details_state == 'Hide request details':
- self.details_state = 'Show request details'
+ current_samples, details, edit_mode = self.__update_samples( request, **kwd )
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
- current_samples = self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
+ current_samples = current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
def __select_request_type(self, trans, rtid):
rt_ids = ['none']
for rt in trans.app.model.RequestType.query().all():
@@ -476,17 +479,22 @@
msg=msg,
messagetype=messagetype)
def __library_ui(self, trans, request=None, **kwd):
+ '''
+ This method creates the data library & folder selectbox for new &
+ editing requests. First we get a list of all the libraries accessible to
+ the current user and display it in a selectbox. If the user has select an
+ existing library then display all the accessible sub folders of the selected
+ data library.
+ '''
params = util.Params( kwd )
lib_id = params.get( 'library_id', 'none' )
- # if editing a request
selected_lib = None
+ # if editing a request and the user has already associated a library to
+ # this request, then set the selected_lib to the request.library
if request and lib_id == 'none':
if request.library:
lib_id = str(request.library.id)
selected_lib = request.library
- else:
- # new request
- selected_lib = None
# get all permitted libraries for this user
all_libraries = trans.app.model.Library.filter( trans.app.model.Library.table.c.deleted == False ) \
.order_by( trans.app.model.Library.name ).all()
@@ -497,15 +505,16 @@
can_show, hidden_folder_ids = trans.app.security_agent.show_library_item( user, roles, library, actions_to_check )
if can_show:
libraries[ library ] = hidden_folder_ids
+ # create data library selectbox with refresh on change enabled
lib_id_list = ['new'] + [str(lib.id) for lib in libraries.keys()]
lib_list = SelectField( 'library_id', refresh_on_change=True, refresh_on_change_values=lib_id_list )
- # fill up the options in the Library selectfield
- # first option
+ # fill up the options in the Library selectbox
+ # first option 'none' is the value for "Select one" option
if lib_id == 'none':
lib_list.add_option('Select one', 'none', selected=True)
else:
lib_list.add_option('Select one', 'none')
- # all the libraries available to the user
+ # add all the libraries available to the user to the library selectbox
for lib, hidden_folder_ids in libraries.items():
if str(lib.id) == lib_id:
lib_list.add_option(lib.name, lib.id, selected=True)
@@ -524,14 +533,21 @@
helptext='Data library where the resultant dataset will be stored.')
# show the folder widget only if the user has selected a valid library above
if selected_lib:
- # when editing a request
+ # when editing a request, either the user has already selected a subfolder or not
if request:
if request.folder:
current_fid = request.folder.id
- else:
- current_fid = request.library.root_folder.id
+ else:
+ # when a folder not yet associated with the request then the
+ # the current folder is set to the root_folder of the
+ # parent data library if present.
+ if request.library:
+ current_fid = request.library.root_folder.id
+ else:
+ current_fid = params.get( 'folder_id', 'none' )
else:
current_fid = params.get( 'folder_id', 'none' )
+ # create the folder selectbox
folder_list = SelectField( 'folder_id')
# first option
if lib_id == 'none':
@@ -543,6 +559,7 @@
selected_lib,
actions_to_check,
selected_hidden_folder_ids )
+ # add all the folders to the folder selectbox
for f in showable_folders:
if str(f.id) == str(current_fid):
folder_list.add_option(f.name, f.id, selected=True)
@@ -568,8 +585,6 @@
Validates the request entered by the user
'''
empty_fields = []
-# if not request.library:
-# empty_fields.append('Data library')
# check rest of the fields of the form
for index, field in enumerate(request.type.request_form.fields):
if field['required'] == 'required' and request.values.content[index] in ['', None]:
diff -r b16a6d767e65 -r ca816e66ec69 lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Tue Oct 13 18:15:06 2009 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Wed Oct 14 02:22:11 2009 -0400
@@ -10,6 +10,10 @@
from galaxy.web.controllers.forms import get_all_forms
log = logging.getLogger( __name__ )
+
+#
+# ---- Request Grid ------------------------------------------------------------
+#
class RequestsListGrid( grids.Grid ):
title = "Sequencing Requests"
@@ -60,6 +64,11 @@
else:
return query
+
+#
+# ---- Request Controller ------------------------------------------------------
+#
+
class Requests( BaseController ):
request_grid = RequestsListGrid()
@@ -67,6 +76,7 @@
@web.require_admin
def index( self, trans ):
return trans.fill_template( "/admin/requests/index.mako" )
+
@web.expose
@web.require_admin
def list( self, trans, **kwargs ):
@@ -104,51 +114,26 @@
self.request_grid.show_filter = kwargs.get('show_filter', trans.app.model.Request.states.SUBMITTED)
# Render the list view
return self.request_grid( trans, **kwargs )
- @web.expose
- @web.require_admin
- def edit(self, trans, **kwd):
- params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ def __show_request(self, trans, id, messagetype, msg):
try:
- request = trans.app.model.Request.get(int(params.get('request_id', None)))
+ request = trans.app.model.Request.get(id)
except:
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
message="Invalid request ID",
**kwd) )
- if params.get('show', False) == 'True':
- return self.__edit_request(trans, request.id, **kwd)
- elif params.get('save_changes_request_button', False) == 'Save changes' \
- or params.get('edit_samples_button', False) == 'Edit samples':
- request_type = trans.app.model.RequestType.get(int(params.select_request_type))
- if not util.restore_text(params.get('name', '')):
- msg = 'Please enter the <b>Name</b> of the request'
- kwd['messagetype'] = 'error'
- kwd['msg'] = msg
- kwd['show'] = 'True'
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='edit',
- **kwd) )
- request = self.__save_request(trans, request, **kwd)
- msg = 'The changes made to the request named %s has been saved' % request.name
- if params.get('save_changes_request_button', False) == 'Save changes':
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='list',
- message=msg ,
- status='done') )
- elif params.get('edit_samples_button', False) == 'Edit samples':
- new_kwd = {}
- new_kwd['request_id'] = request.id
- new_kwd['edit_samples_button'] = 'Edit samples'
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='show_request',
- msg=msg ,
- messagetype='done',
- **new_kwd) )
- elif params.get('refresh', False) == 'true':
- return self.__edit_request(trans, request.id, **kwd)
+ current_samples = []
+ for s in request.samples:
+ current_samples.append([s.name, s.values.content])
+ return trans.fill_template( '/admin/requests/show_request.mako',
+ request=request,
+ request_details=self.request_details(trans, id),
+ current_samples = current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details='hide', edit_mode='False',
+ msg=msg, messagetype=messagetype)
+
def __edit_request(self, trans, id, **kwd):
try:
request = trans.app.model.Request.get(id)
@@ -276,317 +261,10 @@
action='list',
show_filter=trans.app.model.Request.states.SUBMITTED,
**kwd) )
- @web.expose
- @web.require_admin
- def submit_request(self, trans, **kwd):
- params = util.Params( kwd )
- try:
- id = int(params.get('id', False))
- request = trans.app.model.Request.get(id)
- except:
- msg = "Invalid request ID"
- log.warn( msg )
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='list',
- status='error',
- message=msg,
- **kwd) )
- msg = self.__validate(trans, request)
- if msg:
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='edit',
- messagetype='error',
- msg=msg,
- request_id=request.id,
- show='True') )
- # get the new state
- new_state = request.type.states[0]
- for s in request.samples:
- event = trans.app.model.SampleEvent(s, new_state, 'Samples submitted to the system')
- event.flush()
- # change request's submitted field
- request.state = request.states.SUBMITTED
- request.flush()
- kwd['id'] = trans.security.encode_id(request.id)
- kwd['status'] = 'done'
- kwd['message'] = 'The request <b>%s</b> has been submitted.' % request.name
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='list',
- show_filter=trans.app.model.Request.states.SUBMITTED,
- **kwd) )
- def __copy_sample(self):
- copy_list = SelectField('copy_sample')
- copy_list.add_option('None', -1, selected=True)
- for i, s in enumerate(self.current_samples):
- copy_list.add_option(s[0], i)
- return copy_list
- def __update_samples(self, request, **kwd):
- params = util.Params( kwd )
- num_samples = len(self.current_samples)
- self.current_samples = []
- for s in request.samples:
- self.current_samples.append([s.name, s.values.content])
- for index in range(num_samples-len(request.samples)):
- sample_index = index + len(request.samples)
- sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
- sample_values = []
- for field_index in range(len(request.type.sample_form.fields)):
- sample_values.append(util.restore_text( params.get( 'sample_%i_field_%i' % (sample_index, field_index), '' ) ))
- self.current_samples.append([sample_name, sample_values])
- def __show_request(self, trans, id, messagetype, msg):
- try:
- request = trans.app.model.Request.get(id)
- except:
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='list',
- status='error',
- message="Invalid request ID",
- **kwd) )
- self.current_samples = []
- self.edit_mode = False
- for s in request.samples:
- self.current_samples.append([s.name, s.values.content])
- self.details_state = 'Show request details'
- return trans.fill_template( '/admin/requests/show_request.mako',
- request=request,
- request_details=self.request_details(trans, id),
- current_samples = self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode,
- msg=msg, messagetype=messagetype)
- @web.expose
- @web.require_admin
- def show_request(self, trans, **kwd):
- params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
- try:
- request = trans.app.model.Request.get(int(params.get('request_id', None)))
- except:
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='list',
- status='error',
- message="Invalid request ID",
- **kwd) )
- if params.get('import_samples_button', False) == 'Import samples':
- try:
- file_obj = params.get('file_data', '')
- import csv
- reader = csv.reader(file_obj.file)
- for row in reader:
- self.current_samples.append([row[0], row[1:]])
- return trans.fill_template( '/admin/requests/show_request.mako',
- request=request,
- request_details=self.request_details(trans, request.id),
- current_samples=self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
- except:
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='list',
- status='error',
- operation='show_request',
- id=trans.security.encode_id(request.id),
- message='Error in importing samples from the given file.',
- **kwd))
- elif params.get('add_sample_button', False) == 'Add New':
- # save the all (saved+unsaved) sample info in 'current_samples'
- self.__update_samples(request, **kwd)
- # add an empty or filled sample
- # if the user has selected a sample no. to copy then copy the contents
- # of the src sample to the new sample else an empty sample
- src_sample_index = int(params.get( 'copy_sample', -1 ))
- if src_sample_index == -1:
- # empty sample
- self.current_samples.append(['Sample_%i' % (len(self.current_samples)+1),['' for field in request.type.sample_form.fields]])
- else:
- self.current_samples.append([self.current_samples[src_sample_index][0]+'_%i' % (len(self.current_samples)+1),
- [val for val in self.current_samples[src_sample_index][1]]])
- return trans.fill_template( '/admin/requests/show_request.mako',
- request=request,
- request_details=self.request_details(trans, request.id),
- current_samples=self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
- elif params.get('save_samples_button', False) == 'Save':
- # update current_samples
- self.__update_samples(request, **kwd)
- # check for duplicate sample names
- msg = ''
- for index in range(len(self.current_samples)-len(request.samples)):
- sample_index = index + len(request.samples)
- sample_name = self.current_samples[sample_index][0]
- if not sample_name.strip():
- msg = 'Please enter the name of sample number %i' % sample_index
- break
- count = 0
- for i in range(len(self.current_samples)):
- if sample_name == self.current_samples[i][0]:
- count = count + 1
- if count > 1:
- msg = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
- break
- if msg:
- return trans.fill_template( '/admin/requests/show_request.mako',
- request=request,
- request_details=self.request_details(trans, request.id),
- current_samples = self.current_samples,
- sample_copy=self.__copy_sample(), details_state=self.details_state,
- messagetype='error', msg=msg)
- # save all the new/unsaved samples entered by the user
- if not self.edit_mode:
- for index in range(len(self.current_samples)-len(request.samples)):
- sample_index = index + len(request.samples)
- sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
- sample_values = []
- for field_index in range(len(request.type.sample_form.fields)):
- sample_values.append(util.restore_text( params.get( 'sample_%i_field_%i' % (sample_index, field_index), '' ) ))
- form_values = trans.app.model.FormValues(request.type.sample_form, sample_values)
- form_values.flush()
- s = trans.app.model.Sample(sample_name, '', request, form_values)
- s.flush()
- else:
- for index in range(len(self.current_samples)):
- sample_index = index
- sample_name = self.current_samples[sample_index][0]
- new_sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
- sample_values = []
- for field_index in range(len(request.type.sample_form.fields)):
- sample_values.append(util.restore_text( params.get( 'sample_%i_field_%i' % (sample_index, field_index), '' ) ))
- sample = request.has_sample(sample_name)
- if sample:
- form_values = trans.app.model.FormValues.get(sample.values.id)
- form_values.content = sample_values
- form_values.flush()
- sample.name = new_sample_name
- sample.flush()
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='list',
- operation='show_request',
- id=trans.security.encode_id(request.id)) )
- elif params.get('edit_samples_button', False) == 'Edit samples':
- self.edit_mode = True
- return trans.fill_template( '/admin/requests/show_request.mako',
- request=request,
- request_details=self.request_details(trans, request.id),
- current_samples=self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
- elif params.get('cancel_changes_button', False) == 'Cancel':
- return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='list',
- operation='show_request',
- id=trans.security.encode_id(request.id)) )
-
- @web.expose
- @web.require_admin
- def delete_sample(self, trans, **kwd):
- params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
- request = trans.app.model.Request.get(int(params.get('request_id', 0)))
- sample_index = int(params.get('sample_id', 0))
- sample_name = self.current_samples[sample_index][0]
- s = request.has_sample(sample_name)
- if s:
- s.delete()
- s.flush()
- request.flush()
- del self.current_samples[sample_index]
- return trans.fill_template( '/admin/requests/show_request.mako',
- request=request,
- request_details=self.request_details(trans, request.id),
- current_samples = self.current_samples,
- sample_copy=self.__copy_sample(),
- details_state=self.details_state,
- edit_mode=self.edit_mode)
-
- @web.expose
- @web.require_admin
- def toggle_request_details(self, trans, **kwd):
- params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
- request = trans.app.model.Request.get(int(params.get('request_id', 0)))
- if self.details_state == 'Show request details':
- self.details_state = 'Hide request details'
- elif self.details_state == 'Hide request details':
- self.details_state = 'Show request details'
- copy_list = SelectField('copy_sample')
- copy_list.add_option('None', -1, selected=True)
- for i, s in enumerate(self.current_samples):
- copy_list.add_option(i+1, i)
- return trans.fill_template( '/admin/requests/show_request.mako',
- request=request,
- request_details=self.request_details(trans, request.id),
- current_samples = self.current_samples,
- sample_copy=copy_list, details_state=self.details_state)
- def request_details(self, trans, id):
- '''
- Shows the request details
- '''
- request = trans.app.model.Request.get(id)
- # list of widgets to be rendered on the request form
- request_details = []
- # main details
- request_details.append(dict(label='User',
- value=str(request.user.email),
- helptext=''))
- request_details.append(dict(label='Description',
- value=request.desc,
- helptext=''))
- request_details.append(dict(label='Type',
- value=request.type.name,
- helptext=''))
- request_details.append(dict(label='State',
- value=request.state,
- helptext=''))
- request_details.append(dict(label='Date created',
- value=request.create_time,
- helptext=''))
- # library associated
- if request.library:
- value=request.library.name
- else:
- value = None
- request_details.append(dict(label='Data library',
- value=value,
- helptext='Data library where the resultant dataset will be stored'))
- # folder associated
- if request.folder:
- value = request.folder.name
- else:
- value = None
- request_details.append( dict( label='Data library folder',
- value=value,
- helptext='Data library folder where the resultant dataset will be stored' ) )
-
- # form fields
- for index, field in enumerate(request.type.request_form.fields):
- if field['required']:
- req = 'Required'
- else:
- req = 'Optional'
- if field['type'] == 'AddressField':
- if request.values.content[index]:
- request_details.append(dict(label=field['label'],
- value=trans.app.model.UserAddress.get(int(request.values.content[index])).get_html(),
- helptext=field['helptext']+' ('+req+')'))
- else:
- request_details.append(dict(label=field['label'],
- value=None,
- helptext=field['helptext']+' ('+req+')'))
- else:
- request_details.append(dict(label=field['label'],
- value=request.values.content[index],
- helptext=field['helptext']+' ('+req+')'))
- return request_details
-
+#
+#---- Request Creation ----------------------------------------------------------
+#
def __select_request_type(self, trans, rtid):
rt_ids = ['none']
for rt in trans.app.model.RequestType.query().all():
@@ -723,21 +401,22 @@
return select_user
def __library_ui(self, trans, user, request=None, **kwd):
- """
- Return a list of libraries for which user has the permission
- to perform the LIBRARY_ADD action on any of it's folders
- """
+ '''
+ This method creates the data library & folder selectbox for new &
+ editing requests. First we get a list of all the libraries accessible to
+ the current user and display it in a selectbox. If the user has select an
+ existing library then display all the accessible sub folders of the selected
+ data library.
+ '''
params = util.Params( kwd )
lib_id = params.get( 'library_id', 'none' )
- # if editing a request
+ # if editing a request and the user has already associated a library to
+ # this request, then set the selected_lib to the request.library
selected_lib = None
if request and lib_id == 'none':
if request.library:
lib_id = str(request.library.id)
selected_lib = request.library
- else:
- # new request
- selected_lib = None
# if new request no user is selected initially, none of the libraries are
# listed in the selectfield
if not user:
@@ -759,10 +438,11 @@
can_show, hidden_folder_ids = trans.app.security_agent.show_library_item( user, roles, library, actions_to_check )
if can_show:
libraries[ library ] = hidden_folder_ids
- # create the selectfield
+ # create data library selectbox with refresh on change enabled
lib_id_list = ['new'] + [str(lib.id) for lib in libraries.keys()]
lib_list = SelectField( 'library_id', refresh_on_change=True, refresh_on_change_values=lib_id_list )
- # first option
+ # fill up the options in the Library selectbox
+ # first option 'none' is the value for "Select one" option
if lib_id == 'none':
lib_list.add_option('Select one', 'none', selected=True)
else:
@@ -784,15 +464,23 @@
lib_widget = dict(label='Data library',
widget=lib_list,
helptext='Data library where the resultant dataset will be stored.')
+ # show the folder widget only if the user has selected a valid library above
if selected_lib:
- # when editing a request
+ # when editing a request, either the user has already selected a subfolder or not
if request:
if request.folder:
current_fid = request.folder.id
- else:
- current_fid = request.library.root_folder.id
+ else:
+ # when a folder not yet associated with the request then the
+ # the current folder is set to the root_folder of the
+ # parent data library if present.
+ if request.library:
+ current_fid = request.library.root_folder.id
+ else:
+ current_fid = params.get( 'folder_id', 'none' )
else:
current_fid = params.get( 'folder_id', 'none' )
+ # create the folder selectbox
folder_list = SelectField( 'folder_id')
# first option
if lib_id == 'none':
@@ -828,9 +516,14 @@
'''
Validates the request entered by the user
'''
+ if not request.samples:
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ operation='show_request',
+ message='Please add one or more samples to this request before submitting.',
+ status='error',
+ id=trans.security.encode_id(request.id)) )
empty_fields = []
-# if not request.library:
-# empty_fields.append('Library')
# check rest of the fields of the form
for index, field in enumerate(request.type.request_form.fields):
if field['required'] == 'required' and request.values.content[index] in ['', None]:
@@ -909,6 +602,350 @@
request.folder = folder
request.flush()
return request
+
+
+#
+#---- Request Editing ----------------------------------------------------------
+#
+ @web.expose
+ @web.require_admin
+ def edit(self, trans, **kwd):
+ params = util.Params( kwd )
+ msg = util.restore_text( params.get( 'msg', '' ) )
+ messagetype = params.get( 'messagetype', 'done' )
+ try:
+ request = trans.app.model.Request.get(int(params.get('request_id', None)))
+ except:
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ status='error',
+ message="Invalid request ID",
+ **kwd) )
+ if params.get('show', False) == 'True':
+ return self.__edit_request(trans, request.id, **kwd)
+ elif params.get('save_changes_request_button', False) == 'Save changes' \
+ or params.get('edit_samples_button', False) == 'Edit samples':
+ request_type = trans.app.model.RequestType.get(int(params.select_request_type))
+ if not util.restore_text(params.get('name', '')):
+ msg = 'Please enter the <b>Name</b> of the request'
+ kwd['messagetype'] = 'error'
+ kwd['msg'] = msg
+ kwd['show'] = 'True'
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='edit',
+ **kwd) )
+ request = self.__save_request(trans, request, **kwd)
+ msg = 'The changes made to the request named %s has been saved' % request.name
+ if params.get('save_changes_request_button', False) == 'Save changes':
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ message=msg ,
+ status='done') )
+ elif params.get('edit_samples_button', False) == 'Edit samples':
+ new_kwd = {}
+ new_kwd['request_id'] = request.id
+ new_kwd['edit_samples_button'] = 'Edit samples'
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='show_request',
+ msg=msg ,
+ messagetype='done',
+ **new_kwd) )
+ elif params.get('refresh', False) == 'true':
+ return self.__edit_request(trans, request.id, **kwd)
+ @web.expose
+ @web.require_admin
+ def submit_request(self, trans, **kwd):
+ params = util.Params( kwd )
+ try:
+ id = int(params.get('id', False))
+ request = trans.app.model.Request.get(id)
+ except:
+ msg = "Invalid request ID"
+ log.warn( msg )
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ status='error',
+ message=msg,
+ **kwd) )
+ msg = self.__validate(trans, request)
+ if msg:
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='edit',
+ messagetype='error',
+ msg=msg,
+ request_id=request.id,
+ show='True') )
+ # get the new state
+ new_state = request.type.states[0]
+ for s in request.samples:
+ event = trans.app.model.SampleEvent(s, new_state, 'Samples submitted to the system')
+ event.flush()
+ # change request's submitted field
+ request.state = request.states.SUBMITTED
+ request.flush()
+ kwd['id'] = trans.security.encode_id(request.id)
+ kwd['status'] = 'done'
+ kwd['message'] = 'The request <b>%s</b> has been submitted.' % request.name
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ show_filter=trans.app.model.Request.states.SUBMITTED,
+ **kwd) )
+ def __update_samples(self, request, **kwd):
+ '''
+ This method retrieves all the user entered sample information and
+ returns an list of all the samples and their field values
+ '''
+ params = util.Params( kwd )
+ current_samples = []
+ for s in request.samples:
+ current_samples.append([s.name, s.values.content])
+ index = len(request.samples)
+ while True:
+ if params.get( 'sample_%i_name' % index, '' ):
+ sample_index = index
+ sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
+ sample_values = []
+ for field_index in range(len(request.type.sample_form.fields)):
+ sample_values.append(util.restore_text( params.get( 'sample_%i_field_%i' % (sample_index, field_index), '' ) ))
+ current_samples.append([sample_name, sample_values])
+ index = index + 1
+ else:
+ break
+ details = params.get( 'details', 'hide' )
+ edit_mode = params.get( 'edit_mode', 'False' )
+ return current_samples, details, edit_mode
+ def __copy_sample(self, current_samples):
+ copy_list = SelectField('copy_sample')
+ copy_list.add_option('None', -1, selected=True)
+ for i, s in enumerate(current_samples):
+ copy_list.add_option(s[0], i)
+ return copy_list
+ @web.expose
+ @web.require_login( "create/submit sequencing requests" )
+ def show_request(self, trans, **kwd):
+ params = util.Params( kwd )
+ msg = util.restore_text( params.get( 'msg', '' ) )
+ messagetype = params.get( 'messagetype', 'done' )
+ try:
+ request = trans.app.model.Request.get(int(params.get('request_id', None)))
+ except:
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ status='error',
+ message="Invalid request ID",
+ **kwd) )
+ # get the user entered sample details
+ current_samples, details, edit_mode = self.__update_samples( request, **kwd )
+ if params.get('import_samples_button', False) == 'Import samples':
+ try:
+ file_obj = params.get('file_data', '')
+ import csv
+ reader = csv.reader(file_obj.file)
+ for row in reader:
+ current_samples.append([row[0], row[1:]])
+ return trans.fill_template( '/admin/requests/show_request.mako',
+ request=request,
+ request_details=self.request_details(trans, request.id),
+ current_samples=current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
+ except:
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ status='error',
+ message='Error in importing samples file',
+ **kwd))
+ elif params.get('add_sample_button', False) == 'Add New':
+ # add an empty or filled sample
+ # if the user has selected a sample no. to copy then copy the contents
+ # of the src sample to the new sample else an empty sample
+ src_sample_index = int(params.get( 'copy_sample', -1 ))
+ if src_sample_index == -1:
+ # empty sample
+ current_samples.append(['Sample_%i' % (len(current_samples)+1),['' for field in request.type.sample_form.fields]])
+ else:
+ current_samples.append([current_samples[src_sample_index][0]+'_%i' % (len(current_samples)+1),
+ [val for val in current_samples[src_sample_index][1]]])
+ return trans.fill_template( '/admin/requests/show_request.mako',
+ request=request,
+ request_details=self.request_details(trans, request.id),
+ current_samples=current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
+ elif params.get('save_samples_button', False) == 'Save':
+ # check for duplicate sample names
+ msg = ''
+ for index in range(len(current_samples)-len(request.samples)):
+ sample_index = index + len(request.samples)
+ sample_name = current_samples[sample_index][0]
+ if not sample_name.strip():
+ msg = 'Please 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][0]:
+ count = count + 1
+ if count > 1:
+ msg = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
+ break
+ if msg:
+ return trans.fill_template( '/admin/requests/show_request.mako',
+ request=request,
+ request_details=self.request_details(trans, request.id),
+ current_samples = current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details, edit_mode=edit_mode,
+ messagetype='error', msg=msg)
+ # save all the new/unsaved samples entered by the user
+ if edit_mode == 'False':
+ for index in range(len(current_samples)-len(request.samples)):
+ sample_index = index + len(request.samples)
+ sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
+ sample_values = []
+ for field_index in range(len(request.type.sample_form.fields)):
+ sample_values.append(util.restore_text( params.get( 'sample_%i_field_%i' % (sample_index, field_index), '' ) ))
+ form_values = trans.app.model.FormValues(request.type.sample_form, sample_values)
+ form_values.flush()
+ s = trans.app.model.Sample(sample_name, '', request, form_values)
+ s.flush()
+ else:
+ for index in range(len(current_samples)):
+ sample_index = index
+ sample_name = current_samples[sample_index][0]
+ new_sample_name = util.restore_text( params.get( 'sample_%i_name' % sample_index, '' ) )
+ sample_values = []
+ for field_index in range(len(request.type.sample_form.fields)):
+ sample_values.append(util.restore_text( params.get( 'sample_%i_field_%i' % (sample_index, field_index), '' ) ))
+ sample = request.has_sample(sample_name)
+ if sample:
+ form_values = trans.app.model.FormValues.get(sample.values.id)
+ form_values.content = sample_values
+ form_values.flush()
+ sample.name = new_sample_name
+ sample.flush()
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ operation='show_request',
+ id=trans.security.encode_id(request.id)) )
+ elif params.get('edit_samples_button', False) == 'Edit samples':
+ edit_mode = 'True'
+ return trans.fill_template( '/admin/requests/show_request.mako',
+ request=request,
+ request_details=self.request_details(trans, request.id),
+ current_samples=current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
+ elif params.get('cancel_changes_button', False) == 'Cancel':
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='list',
+ operation='show_request',
+ id=trans.security.encode_id(request.id)) )
+
+
+ @web.expose
+ @web.require_login( "create/submit sequencing requests" )
+ def delete_sample(self, trans, **kwd):
+ params = util.Params( kwd )
+ msg = util.restore_text( params.get( 'msg', '' ) )
+ messagetype = params.get( 'messagetype', 'done' )
+ request = trans.app.model.Request.get(int(params.get('request_id', 0)))
+ current_samples, details, edit_mode = self.__update_samples( request, **kwd )
+ sample_index = int(params.get('sample_id', 0))
+ sample_name = current_samples[sample_index][0]
+ s = request.has_sample(sample_name)
+ if s:
+ s.delete()
+ s.flush()
+ request.flush()
+ del current_samples[sample_index]
+ return trans.fill_template( '/admin/requests/show_request.mako',
+ request=request,
+ request_details=self.request_details(trans, request.id),
+ current_samples = current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
+
+ @web.expose
+ @web.require_login( "create/submit sequencing requests" )
+ def toggle_request_details(self, trans, **kwd):
+ params = util.Params( kwd )
+ msg = util.restore_text( params.get( 'msg', '' ) )
+ messagetype = params.get( 'messagetype', 'done' )
+ request = trans.app.model.Request.get(int(params.get('request_id', 0)))
+ current_samples, details, edit_mode = self.__update_samples( request, **kwd )
+ return trans.fill_template( '/admin/requests/show_request.mako',
+ request=request,
+ request_details=self.request_details(trans, request.id),
+ current_samples = current_samples,
+ sample_copy=self.__copy_sample(current_samples),
+ details=details,
+ edit_mode=edit_mode)
+ @web.expose
+ @web.require_admin
+ def request_details(self, trans, id):
+ '''
+ Shows the request details
+ '''
+ request = trans.app.model.Request.get(id)
+ # list of widgets to be rendered on the request form
+ request_details = []
+ # main details
+ request_details.append(dict(label='User',
+ value=str(request.user.email),
+ helptext=''))
+ request_details.append(dict(label='Description',
+ value=request.desc,
+ helptext=''))
+ request_details.append(dict(label='Type',
+ value=request.type.name,
+ helptext=''))
+ request_details.append(dict(label='State',
+ value=request.state,
+ helptext=''))
+ request_details.append(dict(label='Date created',
+ value=request.create_time,
+ helptext=''))
+ # library associated
+ if request.library:
+ value=request.library.name
+ else:
+ value = None
+ request_details.append(dict(label='Data library',
+ value=value,
+ helptext='Data library where the resultant dataset will be stored'))
+ # folder associated
+ if request.folder:
+ value = request.folder.name
+ else:
+ value = None
+ request_details.append( dict( label='Data library folder',
+ value=value,
+ helptext='Data library folder where the resultant dataset will be stored' ) )
+
+ # form fields
+ for index, field in enumerate(request.type.request_form.fields):
+ if field['required']:
+ req = 'Required'
+ else:
+ req = 'Optional'
+ if field['type'] == 'AddressField':
+ if request.values.content[index]:
+ request_details.append(dict(label=field['label'],
+ value=trans.app.model.UserAddress.get(int(request.values.content[index])).get_html(),
+ helptext=field['helptext']+' ('+req+')'))
+ else:
+ request_details.append(dict(label=field['label'],
+ value=None,
+ helptext=field['helptext']+' ('+req+')'))
+ else:
+ request_details.append(dict(label=field['label'],
+ value=request.values.content[index],
+ helptext=field['helptext']+' ('+req+')'))
+ return request_details
@web.expose
@web.require_admin
def bar_codes(self, trans, **kwd):
@@ -1086,7 +1123,9 @@
events_list=events_list,
sample=sample, widgets=widgets, title=title)
- # Request Type Stuff
+##
+#### Request Type Stuff ###################################################
+##
@web.expose
@web.require_admin
def manage_request_types( self, trans, **kwd ):
diff -r b16a6d767e65 -r ca816e66ec69 lib/galaxy/web/framework/__init__.py
--- a/lib/galaxy/web/framework/__init__.py Tue Oct 13 18:15:06 2009 -0400
+++ b/lib/galaxy/web/framework/__init__.py Wed Oct 14 02:22:11 2009 -0400
@@ -635,7 +635,7 @@
return None
def request_types(self):
- if self.app.model.RequestType.query().all():
+ if self.app.model.RequestType.query().filter_by(deleted=False).all():
return True
return False
diff -r b16a6d767e65 -r ca816e66ec69 templates/admin/forms/edit_form.mako
--- a/templates/admin/forms/edit_form.mako Tue Oct 13 18:15:06 2009 -0400
+++ b/templates/admin/forms/edit_form.mako Wed Oct 14 02:22:11 2009 -0400
@@ -36,16 +36,20 @@
<% options = field_attr[2] %>
<div class="repeat-group-item">
<div class="form-row">
- <label> Options</label>
- %for i, option in enumerate(options):
- <b> ${i+1}</b>
- ${option[1].get_html()}
- <a class="action-button" href="${h.url_for( controller='forms', action='edit', form_id=form.id, select_box_options='remove', field_index=index, option_index=i )}">Remove</a><br>
- %endfor
+ <label> Options</label>
+ %for i, option in enumerate(options):
+ <div class="form-row">
+ <b> ${i+1}</b>
+ ${option[1].get_html()}
+ ##<a class="action-button" href="${h.url_for( controller='forms', action='edit', form_id=form.id, select_box_options='remove', field_index=index, option_index=i )}">Remove</a><br>
+ <input type="submit" name="removeoption_${index}_${i}" value="Remove"/>
+ </div>
+ %endfor
+ <input type="hidden" name="field_index" value="${index}"/>
</div>
</div>
<div class="form-row">
- <a class="action-button" href="${h.url_for( controller='forms', action='edit', form_id=form.id, select_box_options='add', field_index=index )}">Add</a>
+ <input type="submit" name="addoption_${index}" value="Add"/>
</div>
%endif
%endif
@@ -81,7 +85,7 @@
<div class="toolForm">
<div class="toolFormTitle">Edit form definition "${form.name}"</div>
- <form id="edit_form" name="edit_form" action="${h.url_for( controller='forms', action='edit', form_id=form.id, num_fields=len(form.fields) )}" method="post" >
+ <form id="edit_form" name="edit_form" action="${h.url_for( controller='forms', action='edit', form_id=form.id )}" method="post" >
%for label, input in form_details:
<div class="form-row">
<label>${label}</label>
diff -r b16a6d767e65 -r ca816e66ec69 templates/admin/forms/show_form_read_only.mako
--- a/templates/admin/forms/show_form_read_only.mako Tue Oct 13 18:15:06 2009 -0400
+++ b/templates/admin/forms/show_form_read_only.mako Wed Oct 14 02:22:11 2009 -0400
@@ -63,9 +63,19 @@
<div class="toolForm">
%if form.desc:
- <div class="toolFormTitle">${form.name} - <i>${form.desc}</i></div>
+ <div class="toolFormTitle">${form.name} - <i>${form.desc}</i>
+ <a id="form-${form.id}-popup" class="popup-arrow" style="display: none;">▼</a>
+ <div popupmenu="form-${form.id}-popup">
+ <a class="action-button" href="${h.url_for( action='edit', form_id=form.id, show_form=True )}">Edit</a>
+ </div>
+ </div>
%else:
- <div class="toolFormTitle">${form.name}</div>
+ <div class="toolFormTitle">${form.name}
+ <a id="form-${form.id}-popup" class="popup-arrow" style="display: none;">▼</a>
+ <div popupmenu="form-${form.id}-popup">
+ <a class="action-button" href="${h.url_for( action='edit', form_id=form.id, show_form=True )}">Edit</a>
+ </div>
+ </div>
%endif
<form name="library" action="${h.url_for( controller='forms', action='manage' )}" method="post" >
%if form.type == trans.app.model.FormDefinition.types.SAMPLE:
@@ -77,58 +87,27 @@
%endfor
%endif
%else:
- <table class = "grid">
- <tbody>
- %for index, field in enumerate(form.fields):
- <tr>
- <td>
- <div class="form-row">
- <label>${1+index}. Label</label>
- <a>${field['label']}</a>
- %if field['type'] == 'SelectField':
- <a id="${field['label']}-popup" class="popup-arrow" style="display: none;">▼</a>
- %for option in field['selectlist']:
- <div popupmenu="${field['label']}-type-popup">
- <a class="action-button" href="" >${option}</a>
- </div>
- %endfor
- %endif
- </div>
- </td>
- <td>
- <div class="form-row">
- <label>Help text </label>
- %if not field['helptext']:
- <a><i>No helptext</i></a>
- %else:
- <a>${field['helptext']}</a>
- %endif
- </div>
- </td>
- <td>
- <div class="form-row">
- <label>Type:</label>
- <a>${field['type']}</a>
- %if field['type'] == 'SelectField':
- <a id="fieldtype-popup" class="popup-arrow" style="display: none;">▼</a>
- %for option in field['selectlist']:
- <div popupmenu="type-popup">
- <a class="action-button" href="" >${option}</a>
- </div>
- %endfor
- %endif
- </div>
- </td>
- <td>
- <div class="form-row">
- <label>Required?</label>
- <a>${field['required']}</a>
- </div>
- </td>
- </tr>
- %endfor
- </tbody>
- </table>
+ %for index, field in enumerate(form.fields):
+ <div class="form-row">
+ <label>${field['label']}</label>
+ %if field['helptext']:
+ <div class="toolParamHelp" style="clear: both;">
+ <i>${field['helptext']}</i>
+ </div>
+ %endif
+ <div>${field['required']}</div>
+ <i>Type: </i> ${field['type']}
+ %if field['type'] == 'SelectField':
+ <div>
+ <div><i>Options:</i></div>
+ %for option in field['selectlist']:
+ <div>${option}</div>
+ %endfor
+ </div>
+ %endif
+ </div>
+ <div style="clear: both"></div>
+ %endfor
%endif
</form>
</div>
diff -r b16a6d767e65 -r ca816e66ec69 templates/admin/requests/show_request.mako
--- a/templates/admin/requests/show_request.mako Tue Oct 13 18:15:06 2009 -0400
+++ b/templates/admin/requests/show_request.mako Wed Oct 14 02:22:11 2009 -0400
@@ -58,6 +58,8 @@
</select>
%elif field['type'] == 'CheckboxField':
<input type="checkbox" name="sample_${index}_field_${field_index}" value="Yes"/>
+ %elif field['type'] == 'NumberField':
+ <input type=int name="sample_${index}_field_${field_index}" value="${sample_values[field_index]}" size="7"/>
%endif
<div class="toolParamHelp" style="clear: both;">
<i>${'('+field['required']+')' }</i>
@@ -91,35 +93,41 @@
</%def>
<div class="toolForm">
- <div class="form-row">
- <a href="${h.url_for( controller='requests_admin', action='toggle_request_details', request_id=request.id )}">${details_state}</a>
- </div>
- %if details_state == "Hide request details":
- %for index, rd in enumerate(request_details):
+ <div class="form-row">
+ %if details == "show":
+ <a href="${h.url_for( controller='requests_admin', action='toggle_request_details', request_id=request.id, details="hide" )}">Hide request details</a>
+ </div>
+ %for index, rd in enumerate(request_details):
+ <div class="form-row">
+ <label>${rd['label']}</label>
+ %if not rd['value']:
+ <i>None</i>
+ %else:
+ %if rd['label'] == 'Data library':
+ %if rd['value']:
+ <a href="${h.url_for( controller='library', action='browse_library', obj_id=request.library.id )}">${rd['value']}</a>
+ %else:
+ <i>None</i>
+ %endif
+ %else:
+ ${rd['value']}
+ %endif
+ %endif
+ </div>
+ <div style="clear: both"></div>
+ %endfor
<div class="form-row">
- <label>${rd['label']}</label>
- %if not rd['value']:
- <i>None</i>
- %else:
- %if rd['label'] == 'Data library':
- <a href="${h.url_for( controller='library_admin', action='browse_library', obj_id=request.library.id )}">${rd['value']}</a>
- %else:
- ${rd['value']}
- %endif
- %endif
- </div>
- <div style="clear: both"></div>
- %endfor
- <div class="form-row">
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='requests_admin', action='edit', show=True, request_id=request.id)}">
<span>Edit request details</span></a>
</li>
</ul>
+ </div>
</div>
+ %else:
+ <a href="${h.url_for( controller='requests_admin', action='toggle_request_details', request_id=request.id, details="show" )}">Show request details</a>
%endif
- </div>
</div>
<%def name="render_grid( grid_index, grid_name, fields_dict )">
@@ -151,13 +159,13 @@
request.refresh()
%>
%for sample_index, sample in enumerate(current_samples):
- %if edit_mode:
+ %if edit_mode == 'True':
<tr>
<td>${sample_index+1}</td>
${render_sample_form( sample_index, sample[0], sample[1], grid_index, fields_dict)}
<td>
%if request.unsubmitted() and grid_index == 0:
- <a class="action-button" href="${h.url_for( controller='requests', action='delete_sample', request_id=request.id, sample_id=sample_index)}">
+ <a class="action-button" href="${h.url_for( controller='requests_admin', action='delete_sample', request_id=request.id, sample_id=sample_index)}">
<img src="${h.url_for('/static/images/delete_icon.png')}" />
<span></span></a>
%endif
@@ -173,7 +181,7 @@
%endif
<td>
%if request.unsubmitted() and grid_index == 0:
- <a class="action-button" href="${h.url_for( controller='requests', action='delete_sample', request_id=request.id, sample_id=sample_index)}">
+ <a class="action-button" href="${h.url_for( controller='requests_admin', action='delete_sample', request_id=request.id, sample_id=sample_index)}">
<img src="${h.url_for('/static/images/delete_icon.png')}" />
<span></span></a>
%endif
@@ -201,7 +209,7 @@
<label>There are no samples.</label>
%endif
</div>
- %if not edit_mode:
+ %if edit_mode == 'False':
<table class="grid">
<tbody>
<tr>
@@ -238,7 +246,7 @@
<div style="clear: both"></div>
</div>
<div class="form-row">
- %if edit_mode:
+ %if edit_mode == 'True':
<input type="submit" name="save_samples_button" value="Save"/>
<input type="submit" name="cancel_changes_button" value="Cancel"/>
%elif request.unsubmitted():
diff -r b16a6d767e65 -r ca816e66ec69 templates/requests/show_request.mako
--- a/templates/requests/show_request.mako Tue Oct 13 18:15:06 2009 -0400
+++ b/templates/requests/show_request.mako Wed Oct 14 02:22:11 2009 -0400
@@ -92,41 +92,43 @@
</%def>
<div class="toolForm">
- <div class="form-row">
- <a href="${h.url_for( controller='requests', action='toggle_request_details', request_id=request.id )}">${details_state}</a>
- </div>
- %if details_state == "Hide request details":
- %for index, rd in enumerate(request_details):
- <div class="form-row">
- <label>${rd['label']}</label>
- %if not rd['value']:
- <i>None</i>
- %else:
- %if rd['label'] == 'Data library':
- %if rd['value']:
- <a href="${h.url_for( controller='library', action='browse_library', obj_id=request.library.id )}">${rd['value']}</a>
+ <div class="form-row">
+ %if details == "show":
+ <a href="${h.url_for( controller='requests', action='toggle_request_details', request_id=request.id, details="hide" )}">Hide request details</a>
+ </div>
+ %for index, rd in enumerate(request_details):
+ <div class="form-row">
+ <label>${rd['label']}</label>
+ %if not rd['value']:
+ <i>None</i>
+ %else:
+ %if rd['label'] == 'Data library':
+ %if rd['value']:
+ <a href="${h.url_for( controller='library', action='browse_library', obj_id=request.library.id )}">${rd['value']}</a>
+ %else:
+ <i>None</i>
+ %endif
%else:
- <i>None</i>
+ ${rd['value']}
%endif
- %else:
- ${rd['value']}
%endif
- %endif
- </div>
- <div style="clear: both"></div>
- %endfor
- %if request.unsubmitted():
- <div class="form-row">
- <ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='edit', show=True, request_id=request.id)}">
- <span>Edit request details</span></a>
- </li>
- </ul>
- </div>
- %endif
+ </div>
+ <div style="clear: both"></div>
+ %endfor
+ %if request.unsubmitted():
+ <div class="form-row">
+ <ul class="manage-table-actions">
+ <li>
+ <a class="action-button" href="${h.url_for( controller='requests', action='edit', show=True, request_id=request.id)}">
+ <span>Edit request details</span></a>
+ </li>
+ </ul>
+ </div>
+ %endif
+ </div>
+ %else:
+ <a href="${h.url_for( controller='requests', action='toggle_request_details', request_id=request.id, details="show" )}">Show request details</a>
%endif
- </div>
</div>
<%def name="render_grid( grid_index, grid_name, fields_dict )">
@@ -158,7 +160,7 @@
request.refresh()
%>
%for sample_index, sample in enumerate(current_samples):
- %if edit_mode:
+ %if edit_mode == 'True':
<tr>
<td>${sample_index+1}</td>
${render_sample_form( sample_index, sample[0], sample[1], grid_index, fields_dict)}
@@ -194,7 +196,7 @@
<div class="toolForm">
##<div class="toolFormTitle">Samples (${len(request.samples)})</div>
- <form id="show_request" name="show_request" action="${h.url_for( controller='requests', action='show_request' )}" enctype="multipart/form-data" method="post" >
+ <form id="show_request" name="show_request" action="${h.url_for( controller='requests', action='show_request', edit_mode=edit_mode )}" enctype="multipart/form-data" method="post" >
<div class="form-row">
%if current_samples:
%if not request.type.sample_form.layout:
@@ -211,7 +213,7 @@
%endif
</div>
- %if request.unsubmitted() and not edit_mode:
+ %if request.unsubmitted() and edit_mode == 'False':
<table class="grid">
<tbody>
<tr>
@@ -251,7 +253,7 @@
</div>
<div class="form-row">
<input type="submit" name="save_samples_button" value="Save"/>
- %if edit_mode:
+ %if edit_mode == 'True':
<input type="submit" name="cancel_changes_button" value="Cancel"/>
%endif
</div>
diff -r b16a6d767e65 -r ca816e66ec69 templates/user/address.mako
--- a/templates/user/address.mako Tue Oct 13 18:15:06 2009 -0400
+++ b/templates/user/address.mako Wed Oct 14 02:22:11 2009 -0400
@@ -46,7 +46,7 @@
<td>
<div class="form-row">
<label>${address.desc}</label>
- ${address.display()}
+ ${address.get_html()}
</div>
<div class="form-row">
<ul class="manage-table-actions">
diff -r b16a6d767e65 -r ca816e66ec69 test/base/twilltestcase.py
--- a/test/base/twilltestcase.py Tue Oct 13 18:15:06 2009 -0400
+++ b/test/base/twilltestcase.py Wed Oct 14 02:22:11 2009 -0400
@@ -1059,8 +1059,15 @@
tc.fv( "1", field_name, field_contents )
tc.fv( "1", field_help_name, field_help_contents )
tc.submit( "save_changes_button" )
+ if num_fields:
check_str = "The form '%s' has been updated with the changes." % name
- self.check_page_for_string( check_str )
+ self.check_page_for_string( check_str )
+ else:
+ self.home()
+ self.visit_url( "%s/forms/manage" % self.url )
+ self.check_page_for_string( name )
+ self.check_page_for_string( desc )
+ self.check_page_for_string( formtype )
self.home()
def edit_form( self, form_id, form_name, new_form_name="Form One's Name (Renamed)", new_form_desc="This is Form One's description (Re-described)"):
"""
@@ -1074,7 +1081,7 @@
tc.submit( "save_changes_button" )
self.check_page_for_string( "The form '%s' has been updated with the changes." % new_form_name )
self.home()
- def form_add_field( self, form_id, form_name, field_index, fields):
+ def form_add_field( self, form_id, form_name, form_desc, form_type, field_index, fields):
"""
Add a new fields to the form definition
"""
@@ -1088,13 +1095,18 @@
tc.fv( "1", "field_helptext_%i" % index, field['desc'] )
tc.fv( "1", "field_type_%i" % index, field['type'] )
tc.fv( "1", "field_required_%i" % index, field['required'] )
-# if field['type'] == 'SelectField':
-# for option_index, option in enumerate(field['selectlist']):
-# self.visit_url( "%s/forms/edit?select_box_options=add&form_id=%i&field_index=%i" % \
-# (self.url, form_id, index))
-# #data = self.last_page()
-# #file( "rc.html", 'wb' ).write(data)
-# tc.fv( "1", "field_%i_option_%i" % (index, option_index), option )
+ if field['type'] == 'SelectField':
+ options = ''
+ for option_index, option in enumerate(field['selectlist']):
+ url_str = "%s/forms/edit?description=%s&form_id=%i&form_type_selectbox=%s&addoption_%i=Add&name=%s&field_name_%i=%s&field_helptext_%i=%s&field_type_%i=%s" % \
+ (self.url, form_desc.replace(" ", "+"), form_id, form_type.replace(" ", "+"),
+ index, form_name.replace(" ", "+"), index, field['name'].replace(" ", "+"),
+ index, field['desc'].replace(" ", "+"), index, field['type'])
+ self.visit_url( url_str + options )
+ data = self.last_page()
+ file( "rc.html", 'wb' ).write(data)
+ tc.fv( "1", "field_%i_option_%i" % (index, option_index), option )
+ options = options + "&field_%i_option_%i=%s" % (index, option_index, option)
tc.submit( "save_changes_button" )
check_str = "The form '%s' has been updated with the changes." % form_name
self.check_page_for_string( check_str )
@@ -1130,18 +1142,22 @@
self.check_page_for_string( "Request type <b>%s</b> has been created" % name )
def create_request( self, request_type_id, name, desc, library_id, folder_id, fields ):
self.home()
- self.visit_url( "%s/requests/new?create=True&select_request_type=%i" % (self.url, request_type_id) )
+ self.visit_url( "%s/requests/new?create=True&select_request_type=%i&library_id=%i" % ( self.url,
+ request_type_id,
+ library_id ) )
self.check_page_for_string( 'Add a new request' )
tc.fv( "1", "name", name )
tc.fv( "1", "desc", desc )
tc.fv( "1", "library_id", str(library_id) )
- #tc.fv( "1", "folder_id", str(folder_id) )
+ tc.fv( "1", "folder_id", str(folder_id) )
for index, field_value in enumerate(fields):
tc.fv( "1", "field_%i" % index, field_value )
tc.submit( "create_request_button" )
def create_request_admin( self, request_type_id, user_id, name, desc, library_id, fields ):
self.home()
- self.visit_url( "%s/requests_admin/new?create=True&select_request_type=%i" % (self.url, request_type_id) )
+ self.visit_url( "%s/requests_admin/new?create=True&select_request_type=%i&library_id=%i" % ( self.url,
+ request_type_id,
+ library_id ) )
self.check_page_for_string( 'Add a new request' )
tc.fv( "1", "select_user", str(user_id) )
tc.fv( "1", "name", name )
diff -r b16a6d767e65 -r ca816e66ec69 test/functional/test_forms_and_requests.py
--- a/test/functional/test_forms_and_requests.py Tue Oct 13 18:15:06 2009 -0400
+++ b/test/functional/test_forms_and_requests.py Wed Oct 14 02:22:11 2009 -0400
@@ -42,12 +42,7 @@
name = form_one_name
desc = "This is Form One's description"
formtype = galaxy.model.FormDefinition.types.REQUEST
- self.create_form( name=name, desc=desc, formtype=formtype )
- self.home()
- self.visit_page( 'forms/manage' )
- self.check_page_for_string( name )
- self.check_page_for_string( desc )
- self.check_page_for_string( formtype )
+ self.create_form( name=name, desc=desc, formtype=formtype, num_fields=0 )
# Get the form_definition object for later tests
form_one = galaxy.model.FormDefinition.filter( and_( galaxy.model.FormDefinition.table.c.name==name,
galaxy.model.FormDefinition.table.c.desc==desc,
@@ -66,24 +61,21 @@
"""Testing adding fields to a form definition"""
fields = [dict(name='Test field name one',
desc='Test field description one',
- type='TextField',
- required='required'),
+ type='SelectField',
+ required='optional',
+ selectlist=['option1', 'option2']),
dict(name='Test field name two',
desc='Test field description two',
type='AddressField',
- required='optional')]
+ required='optional'),
+ dict(name='Test field name three',
+ desc='Test field description three',
+ type='TextField',
+ required='required')]
form_one = get_latest_form(form_one_name)
- self.form_add_field(form_one.id, form_one.name, field_index=len(form_one.fields), fields=fields)
+ self.form_add_field(form_one.id, form_one.name, form_one.desc, form_one.type, field_index=len(form_one.fields), fields=fields)
form_one_latest = get_latest_form(form_one_name)
assert len(form_one_latest.fields) == len(form_one.fields)+len(fields)
-#This following test has been commented out as it is causing:
-#TwillException: multiple matches to "remove_button"
-# def test_010_remove_form_fields( self ):
-# """Testing removing fields from a form definition"""
-# form_one = get_latest_form(form_one_name)
-# self.form_remove_field( form_one.id, form_one.name, 'Test field name one' )
-# form_one_latest = get_latest_form(form_one_name)
-# assert len(form_one_latest.fields) == len(form_one.fields)-1
def test_015_create_sample_form( self ):
"""Testing creating another form (for samples)"""
global form_two_name
@@ -186,10 +178,10 @@
self.logout()
self.login( email='test1(a)bx.psu.edu' )
# set field values
- fields = ['field one value', 'field two value', str(user_address.id)]
+ fields = ['option1', str(user_address.id), 'field three value']
# create the request
request_name, request_desc = 'Request One', 'Request One Description'
- self.create_request(request_type.id, request_name, request_desc, library_one.id, folder_one.id, fields)
+ self.create_request(request_type.id, request_name, request_desc, library_one.id, 'none', fields)
self.check_page_for_string( request_name )
self.check_page_for_string( request_desc )
global request_one
@@ -208,8 +200,9 @@
for field_value in fields:
self.check_page_for_string( field_value )
# edit this request
- fields = ['field one value (edited)', 'field two value (edited)', str(user_address.id)]
- self.edit_request(request_one.id, request_one.name, request_one.name+' (Renamed)', request_one.desc+' (Re-described)', library_one.id, folder_one.id, fields)
+ fields = ['option2', str(user_address.id), 'field three value (edited)']
+ self.edit_request(request_one.id, request_one.name, request_one.name+' (Renamed)',
+ request_one.desc+' (Re-described)', library_one.id, folder_one.id, fields)
request_one.refresh()
self.check_page_for_string( request_name+' (Renamed)' )
self.check_page_for_string( request_desc+' (Re-described)' )
@@ -261,8 +254,8 @@
self.login( email='test(a)bx.psu.edu' )
request_name = "RequestTwo"
# simulate request creation
- url_str = '%s/requests_admin/new?create=True&create_request_button=Save&select_request_type=%i&select_user=%i&name=%s&library_id=%i&folder_id=%i&refresh=True&field_1=%s&field_2=%i' \
- % ( self.url, request_type.id, regular_user.id, request_name, library_one.id, library_one.root_folder.id, "field_1_value", user_address.id )
+ url_str = '%s/requests_admin/new?create=True&create_request_button=Save&select_request_type=%i&select_user=%i&name=%s&library_id=%i&folder_id=%i&refresh=True&field_2=%s&field_0=%s&field_1=%i' \
+ % ( self.url, request_type.id, regular_user.id, request_name, library_one.id, library_one.root_folder.id, "field_2_value", 'option1', user_address.id )
self.home()
self.visit_url( url_str )
self.check_page_for_string( "The new request named %s has been created" % request_name )
@@ -299,10 +292,3 @@
self.visit_url( '%s/requests_admin/list?show_filter=All' % self.url )
self.check_page_for_string( request_one.name )
self.check_page_for_string( request_two.name )
-
-
-
-
-
-
-
\ No newline at end of file
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/b16a6d767e65
changeset: 2881:b16a6d767e65
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Tue Oct 13 18:15:06 2009 -0400
description:
Add 2 rgenetics test files I missed for testing uploading composite data types.
2 file(s) affected in this change:
test-data/rgenetics.map
test-data/rgenetics.ped
diffs (108 lines):
diff -r 738085dcc542 -r b16a6d767e65 test-data/rgenetics.map
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/rgenetics.map Tue Oct 13 18:15:06 2009 -0400
@@ -0,0 +1,10 @@
+22 rs5992809 16.5965 16596539
+22 rs12168131 16.6573 16657262
+22 rs390041 16.6629 16662916
+22 rs437633 16.6697 16669684
+22 rs450960 16.6909 16690858
+22 rs450975 16.6909 16690887
+22 rs451740 16.6912 16691174
+22 rs8139723 16.6917 16691696
+22 rs405490 16.6922 16692175
+22 rs415170 16.6935 16693517
diff -r 738085dcc542 -r b16a6d767e65 test-data/rgenetics.ped
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/rgenetics.ped Tue Oct 13 18:15:06 2009 -0400
@@ -0,0 +1,90 @@
+CH18526 NA18526 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18524 NA18524 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+CH18529 NA18529 0 0 2 1 C C A A T C A G T C T C T C C C G A G C
+CH18558 NA18558 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+CH18532 NA18532 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18561 NA18561 0 0 1 1 C C A A C C G G T C C C T C C C G A G C
+CH18562 NA18562 0 0 1 1 C C G A T C A G T C C C T C C C G A G C
+CH18537 NA18537 0 0 2 2 C C A A T C A G C C C C C C C C A A C C
+CH18603 NA18603 0 0 1 2 C C G A T C A G C C C C C C C C A A C C
+CH18540 NA18540 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18605 NA18605 0 0 1 1 C C A A T T A A C C C C C C C C A A C C
+CH18542 NA18542 0 0 2 1 C C G A T C G G C C C C C C C C A A C C
+CH18545 NA18545 0 0 2 1 C C G A T C A G T C C C T C C C G A G C
+CH18572 NA18572 0 0 1 2 C C A A T C A G C C C C C C C C A A G C
+CH18547 NA18547 0 0 2 2 C C G A T C A G T C C C T C C C G A G C
+CH18609 NA18609 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+CH18550 NA18550 0 0 2 1 C C G G T T A A T C C C T C T C G A G C
+CH18608 NA18608 0 0 1 1 C C G A T C G G C C C C C C C C A A C C
+CH18552 NA18552 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18611 NA18611 0 0 1 1 C C G A T C A G T C C C T C C C G A G C
+CH18555 NA18555 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18564 NA18564 0 0 2 2 C C A A T C G G C C C C C C C C A A C C
+CH18566 NA18566 0 0 2 1 C C A A T C A G C C C C C C T C A A C C
+CH18563 NA18563 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+CH18570 NA18570 0 0 2 1 C C A A T C A G T C T C T C C C G A G C
+CH18612 NA18612 0 0 1 2 C C A A T C A A T C T C T C C C G A G C
+CH18571 NA18571 0 0 2 1 C C A A T C A G C C C C C C C C A A C C
+CH18620 NA18620 0 0 1 1 C C A A C C G G T C T C T C C C G A G C
+CH18621 NA18621 0 0 1 1 C C G G T T A A T C C C T C C C G A G C
+CH18594 NA18594 0 0 2 1 C C A A T T A A C C C C C C C C A A G C
+CH18622 NA18622 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+CH18573 NA18573 0 0 2 2 C C A A T C A G C C C C C C C C A A C C
+CH18623 NA18623 0 0 1 1 C C G A T C G G C C C C C C C C A A C C
+CH18576 NA18576 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18577 NA18577 0 0 2 1 C C A A T C A G C C C C C C C C A A G C
+CH18624 NA18624 0 0 1 1 C C A A T C A G C C C C C C C C A A C C
+CH18579 NA18579 0 0 2 1 C C A A T C A G T C T C T C T C G A G C
+CH18632 NA18632 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+CH18582 NA18582 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18633 NA18633 0 0 1 1 C C G A T C G G C C C C C C C C A A C C
+CH18635 NA18635 0 0 1 2 C C A A T C G G C C C C C C C C A A C C
+CH18592 NA18592 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18636 NA18636 0 0 1 1 C C A A T C A A T C T C T C C C G A G C
+CH18593 NA18593 0 0 2 2 C C A A C C G G T C T C T C C C G A G C
+CH18637 NA18637 0 0 1 1 C C A A T C A G T C T C T C C C G A G C
+JA18942 NA18942 0 0 2 2 C C A A C C A G C C C C C C C C A A C C
+JA18940 NA18940 0 0 1 2 C C A A T C A G C C C C C C C C A A G C
+JA18951 NA18951 0 0 2 2 C C G A T C A G C C C C C C C C A A C C
+JA18943 NA18943 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+JA18947 NA18947 0 0 2 2 C C G A T T A A C C C C C C C C A A G C
+JA18944 NA18944 0 0 1 2 C C A A T C A G T C T C T C C C G A G C
+JA18945 NA18945 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+JA18949 NA18949 0 0 2 2 C C G A T C G G C C C C C C C C A A C C
+JA18948 NA18948 0 0 1 2 C C G A T C G G C C C C C C C C A A C C
+JA18952 NA18952 0 0 1 2 C C A A T C A G C C C C C C C C A A C C
+JA18956 NA18956 0 0 2 2 C C A A C C A G T C T C T C C C G A G C
+JA18964 NA18964 0 0 2 2 C C A A T T A A C C C C C C C C A A G C
+JA18953 NA18953 0 0 1 1 C C A A T C A G C C C C C C T C A A C C
+JA18968 NA18968 0 0 2 2 C C A A C C G G C C C C C C C C A A C C
+JA18959 NA18959 0 0 1 2 C C G A T C G G C C C C C C C C A A C C
+JA18969 NA18969 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+JA18960 NA18960 0 0 1 2 C C A A T C A G T C T C T C C C G A G C
+JA18961 NA18961 0 0 1 2 C C A A C C A G C C C C C C C C A A C C
+JA18972 NA18972 0 0 2 2 C C G A T T A A T T T C T T C C G G G G
+JA18965 NA18965 0 0 1 2 C C A A T T A A C C C C C C C C A A C C
+JA18973 NA18973 0 0 2 2 C C A A C C G G C C C C C C T C A A C C
+JA18966 NA18966 0 0 1 2 C C G A T C A G T C C C T C C C G A G C
+JA18975 NA18975 0 0 2 2 C C A A C C G G C C C C C C C C A A G C
+JA18967 NA18967 0 0 1 2 C C A A C C G G C C C C C C C C A A G C
+JA18976 NA18976 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+JA18978 NA18978 0 0 2 2 C C G A T C G G C C C C C C C C A A C C
+JA18970 NA18970 0 0 1 1 C C G G T T A A T T C C T T C C G G G G
+JA18980 NA18980 0 0 2 2 C C A A T C A G T C T C T C C C G A G C
+JA18995 NA18995 0 0 1 1 C C A A T T A A C C C C C C C C A A G G
+JA18981 NA18981 0 0 2 2 C C A A T C A G C C C C C C C C A A G C
+JA18971 NA18971 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+JA18974 NA18974 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+JA18987 NA18987 0 0 2 2 C C A A C C G G C C C C C C C C A A C C
+JA18990 NA18990 0 0 1 1 C C A A T C G G C C C C C C C C A A G C
+JA18991 NA18991 0 0 2 2 C C A A C C G G C C C C C C C C A A C C
+JA18994 NA18994 0 0 1 2 C C G A T C A G C C C C C C C C A A G C
+JA18992 NA18992 0 0 2 2 C C A A T C A G C C C C C C T C A A C C
+JA18997 NA18997 0 0 2 2 C C A A C C G G C C C C C C C C A A C C
+JA18998 NA18998 0 0 2 2 C C A A C C G G C C C C C C T C A A C C
+JA19000 NA19000 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+JA19005 NA19005 0 0 1 2 C C A A C C G G C C C C C C C C A A G C
+JA18999 NA18999 0 0 2 2 C C A A T C A G C C C C C C C C A A C C
+JA19007 NA19007 0 0 1 2 C C A A T C A G C C C C C C C C A A G C
+JA19003 NA19003 0 0 2 2 C C A A T C G G C C C C C C C C A A C C
+JA19012 NA19012 0 0 1 2 C C A A 0 0 G G C C C C C C 0 0 A A C C
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/738085dcc542
changeset: 2880:738085dcc542
user: Kelly Vincent <kpvincent(a)bx.psu.edu>
date: Tue Oct 13 16:49:38 2009 -0400
description:
Modified Solid_to_Fastq's underlying perl script so that it would not produce the None file, and also uncommented tests and updated example
3 file(s) affected in this change:
tools/next_gen_conversion/bwa_solid2fastq_modified.pl
tools/next_gen_conversion/solid_to_fastq.py
tools/next_gen_conversion/solid_to_fastq.xml
diffs (169 lines):
diff -r 39c1d12c2e7d -r 738085dcc542 tools/next_gen_conversion/bwa_solid2fastq_modified.pl
--- a/tools/next_gen_conversion/bwa_solid2fastq_modified.pl Tue Oct 13 16:37:20 2009 -0400
+++ b/tools/next_gen_conversion/bwa_solid2fastq_modified.pl Tue Oct 13 16:49:38 2009 -0400
@@ -8,9 +8,9 @@
use Getopt::Std;
my %opts;
-my $version = '0.1.2';
+my $version = '0.1.3';
my $usage = qq{
-Usage: solid2fastq.pl <paired> <outfile1> <outfile2> <outfile3> <F3.csfasta> <F3.qual> <R3.csfasta> <R3.qual>
+Usage: solid2fastq.pl <paired> <outfile1> <outfile2> <F3.csfasta> <F3.qual> <R3.csfasta> <R3.qual>
Note: <in.title> is the string showed in the `# Title:' line of a
".csfasta" read file. Then <in.title>F3.csfasta is read sequence
@@ -25,13 +25,11 @@
};
getopts('', \%opts);
-die($usage) if (@ARGV != 8);
-my ($is_paired,$outfile1,$outfile2,$outfile3,$f3reads,$f3qual,$r3reads,$r3qual) = @ARGV;
+die($usage) if (@ARGV != 7);
+my ($is_paired,$outfile1,$outfile2,$f3reads,$f3qual,$r3reads,$r3qual) = @ARGV;
my (@fhr, @fhw);
my $fn = '';
my @fn_suff = ($f3reads,$f3qual,$r3reads,$r3qual);
-#my @fn_suff = ('F3.csfasta', 'F3_QV.qual', 'R3.csfasta', 'R3_QV.qual');
-#my $is_paired = (-f "$title$fn_suff[2]" || -f "$title$fn_suff[2].gz")? 1 : 0;
if ($is_paired eq "yes") { # paired end
for (0 .. 3) {
$fn = $fn_suff[$_];
@@ -40,33 +38,12 @@
}
open($fhw[0], "|gzip >$outfile2") || die;
open($fhw[1], "|gzip >$outfile1") || die;
- open($fhw[2], "|gzip >$outfile3") || die;
my (@df, @dr);
@df = &read1(1); @dr = &read1(2);
while (@df && @dr) {
if ($df[0] eq $dr[0]) { # mate pair
print {$fhw[0]} $df[1]; print {$fhw[1]} $dr[1];
@df = &read1(1); @dr = &read1(2);
- } else {
- if ($df[0] le $dr[0]) {
- print {$fhw[2]} $df[1];
- @df = &read1(1);
- } else {
- print {$fhw[2]} $dr[1];
- @dr = &read1(2);
- }
- }
- }
- if (@df) {
- print {$fhw[2]} $df[1];
- while (@df = &read1(1, $fhr[0], $fhr[1])) {
- print {$fhw[2]} $df[1];
- }
- }
- if (@dr) {
- print {$fhw[2]} $dr[1];
- while (@dr = &read1(2, $fhr[2], $fhr[3])) {
- print {$fhw[2]} $dr[1];
}
}
close($fhr[$_]) for (0 .. $#fhr);
@@ -95,7 +72,7 @@
my $t = <$fhq>;
if (/^>(\d+)_(\d+)_(\d+)_[FR]3/) {
$key = sprintf("%.4d_%.4d_%.4d", $1, $2, $3); # this line could be improved on 64-bit machines
- #print $key;
+ #print $key;
die(qq/** unmatched read name: '$_' != '$_'\n/) unless ($_ eq $t);
my $name = "$1_$2_$3/$i";
$_ = substr(<$fhs>, 2);
@@ -106,7 +83,7 @@
s/(\d+)\s*/chr($1+33)/eg;
$seq = qq/\@$name\n$s+\n$_\n/;
last;
- }
+ }
}
return defined($seq)? ($key, $seq) : ();
}
diff -r 39c1d12c2e7d -r 738085dcc542 tools/next_gen_conversion/solid_to_fastq.py
--- a/tools/next_gen_conversion/solid_to_fastq.py Tue Oct 13 16:37:20 2009 -0400
+++ b/tools/next_gen_conversion/solid_to_fastq.py Tue Oct 13 16:49:38 2009 -0400
@@ -30,7 +30,7 @@
tmpf = tempfile.NamedTemporaryFile() #forward reads
if options.input3 != "None" and options.input4 != "None":
tmpr = tempfile.NamedTemporaryFile() #reverse reads
- cmd1 = "%s/bwa_solid2fastq_modified.pl 'yes' %s %s %s %s %s %s %s 2>&1" %(os.path.split(sys.argv[0])[0], tmpf.name,tmpr.name,None,options.input1,options.input2,options.input3,options.input4)
+ cmd1 = "%s/bwa_solid2fastq_modified.pl 'yes' %s %s %s %s %s %s 2>&1" %(os.path.split(sys.argv[0])[0], tmpf.name,tmpr.name,options.input1,options.input2,options.input3,options.input4)
try:
os.system(cmd1)
os.system('gunzip -c %s >> %s' %(tmpf.name,options.output1))
@@ -40,7 +40,7 @@
tmpr.close()
# if single-end data
else:
- cmd1 = "%s/bwa_solid2fastq_modified.pl 'no' %s %s %s %s %s %s %s 2>&1" % (os.path.split(sys.argv[0])[0], tmpf.name, None, None, options.input1, options.input2, None, None)
+ cmd1 = "%s/bwa_solid2fastq_modified.pl 'no' %s %s %s %s %s %s 2>&1" % (os.path.split(sys.argv[0])[0], tmpf.name, None, options.input1, options.input2, None, None)
try:
os.system(cmd1)
os.system('gunzip -c %s >> %s' % (tmpf.name, options.output1))
diff -r 39c1d12c2e7d -r 738085dcc542 tools/next_gen_conversion/solid_to_fastq.xml
--- a/tools/next_gen_conversion/solid_to_fastq.xml Tue Oct 13 16:37:20 2009 -0400
+++ b/tools/next_gen_conversion/solid_to_fastq.xml Tue Oct 13 16:49:38 2009 -0400
@@ -44,15 +44,12 @@
</data>
</outputs>
<tests>
-<!--
<test>
<param name="pairedSingle" value="single" />
<param name="input1" value="s2fq_phiX.csfasta" ftype="csfasta" />
<param name="input2" value="s2fq_phiX.qualsolid" ftype="qualsolid" />
<output name="output1" file="s2fq_out1.fastqsanger" />
</test>
--->
- <!-- testing framework does not deal with multiple outputs yet
<test>
<param name="pairedSingle" value="paired" />
<param name="input1" value="s2fq_paired_F3.csfasta" ftype="csfasta" />
@@ -60,9 +57,10 @@
<param name="input3" value="s2fq_paired_R3.csfasta" ftype="csfasta" />
<param name="input4" value="s2fq_paired_R3_QV.qualsolid" ftype="qualsolid" />
<output name="output1" file="s2fq_out2.fastqsanger" />
+ <!-- testing framework does not deal with multiple outputs yet
<output name="output2" file="s2fq_out3.fastqsanger" />
+ -->
</test>
- -->
</tests>
<help>
@@ -76,25 +74,25 @@
- Converting the following sequences::
- >seq1
+ >1831_573_1004_F3
T00030133312212111300011021310132222
- >seq2
+ >1831_573_1567_F3
T03330322230322112131010221102122113
- and quality scores::
- >seq1
- 4 29 34 34 32 32 24 24 20 17 10 34 29 20 34 13 30 34 22 24 11 28 19 17 34 17 24 17 25 34 7 24 14 12 22
- >seq2
- 8 26 31 31 16 22 30 31 28 29 22 30 30 31 32 23 30 28 28 31 19 32 30 32 19 8 32 10 13 6 32 10 6 16 11
+ >1831_573_1004_F3
+ 4 29 34 34 32 32 24 24 20 17 10 34 29 20 34 13 30 34 22 24 11 28 19 17 34 17 24 17 25 34 7 24 14 12 22
+ >1831_573_1567_F3
+ 8 26 31 31 16 22 30 31 28 29 22 30 30 31 32 23 30 28 28 31 19 32 30 32 19 8 32 10 13 6 32 10 6 16 11
- will produce the following Sanger FASTQ data::
- @seq1
+ @1831_573_1004/1
AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG
+
>CCAA9952+C>5C.?C79,=42C292:C(9/-7
- @seq2
+ @1831_573_1567/1
TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT
+
;@@17?@=>7??@A8?==@4A?A4)A+.'A+'1,
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/39c1d12c2e7d
changeset: 2879:39c1d12c2e7d
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Tue Oct 13 16:37:20 2009 -0400
description:
Add new functional tests for uploading composite data types lped and pbed - handles ticket # 173.
11 file(s) affected in this change:
datatypes_conf.xml.sample
test-data/rgenetics.bed
test-data/rgenetics.bim
test-data/rgenetics.fam
test-data/tinywga.bed
test-data/tinywga.bim
test-data/tinywga.fam
test-data/tinywga.map
test-data/tinywga.ped
test/base/twilltestcase.py
test/functional/test_get_data.py
diffs (504 lines):
diff -r 286958ef8157 -r 39c1d12c2e7d datatypes_conf.xml.sample
--- a/datatypes_conf.xml.sample Tue Oct 13 16:18:16 2009 -0400
+++ b/datatypes_conf.xml.sample Tue Oct 13 16:37:20 2009 -0400
@@ -162,9 +162,9 @@
<datatype extension="gg" type="galaxy.datatypes.genetics:GenomeGraphs"/>
<datatype extension="rgenetics" type="galaxy.datatypes.genetics:Rgenetics"/>
<!-- linkage format pedigree (separate .map file) -->
- <datatype extension="lped" type="galaxy.datatypes.genetics:Lped"/>
+ <datatype extension="lped" type="galaxy.datatypes.genetics:Lped" display_in_upload="true"/>
<!-- plink compressed file - has bed extension unfortunately -->
- <datatype extension="pbed" type="galaxy.datatypes.genetics:Pbed"/>
+ <datatype extension="pbed" type="galaxy.datatypes.genetics:Pbed" display_in_upload="true"/>
<!-- eigenstrat pedigree input file -->
<datatype extension="eigenstratgeno" type="galaxy.datatypes.genetics:Eigenstratgeno"/>
<!-- eigenstrat pca output file for adjusted eigenQTL eg -->
diff -r 286958ef8157 -r 39c1d12c2e7d test-data/rgenetics.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/rgenetics.bed Tue Oct 13 16:37:20 2009 -0400
@@ -0,0 +1,1 @@
+lÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿïŸîžÿÿüþ¿ÿ¿ûú¿¿ï/ÿÿþÿï¯êžëê°®Ÿî®ãêž;ì/âïú¯ï¯ÎêŒïâ°¯þϪã¯ø+ì?âÿú¯ïëÿîŸÿºþÿþ¯þï¿ÿ;ï?þÿÿÿïÿÿÿÿÿºÿÿþ¯þï¿ÿ»ÿÿþÿÿÿïëÿîŸÿºþÿþ¯þï¿ÿ;ï?þÿÿÿÿÿÿÿþïÿÿÿþÿÿÿÿûÿûÿÿÿ»ÿïëÿîŸÿºþÿþ¯þï¿ÿ;ï?þÿÿÿïëÿêŸÿºúïþ¯îë¿þ;¯>âïþ»
\ No newline at end of file
diff -r 286958ef8157 -r 39c1d12c2e7d test-data/rgenetics.bim
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/rgenetics.bim Tue Oct 13 16:37:20 2009 -0400
@@ -0,0 +1,10 @@
+22 rs5992809 16.5965 16596539 0 C
+22 rs12168131 16.6573 16657262 G A
+22 rs390041 16.6629 16662916 T C
+22 rs437633 16.6697 16669684 A G
+22 rs450960 16.6909 16690858 T C
+22 rs450975 16.6909 16690887 T C
+22 rs451740 16.6912 16691174 T C
+22 rs8139723 16.6917 16691696 T C
+22 rs405490 16.6922 16692175 G A
+22 rs415170 16.6935 16693517 G C
diff -r 286958ef8157 -r 39c1d12c2e7d test-data/rgenetics.fam
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/rgenetics.fam Tue Oct 13 16:37:20 2009 -0400
@@ -0,0 +1,90 @@
+CH18526 NA18526 0 0 2 1
+CH18524 NA18524 0 0 1 1
+CH18529 NA18529 0 0 2 1
+CH18558 NA18558 0 0 1 1
+CH18532 NA18532 0 0 2 1
+CH18561 NA18561 0 0 1 1
+CH18562 NA18562 0 0 1 1
+CH18537 NA18537 0 0 2 2
+CH18603 NA18603 0 0 1 2
+CH18540 NA18540 0 0 2 1
+CH18605 NA18605 0 0 1 1
+CH18542 NA18542 0 0 2 1
+CH18545 NA18545 0 0 2 1
+CH18572 NA18572 0 0 1 2
+CH18547 NA18547 0 0 2 2
+CH18609 NA18609 0 0 1 1
+CH18550 NA18550 0 0 2 1
+CH18608 NA18608 0 0 1 1
+CH18552 NA18552 0 0 2 1
+CH18611 NA18611 0 0 1 1
+CH18555 NA18555 0 0 2 1
+CH18564 NA18564 0 0 2 2
+CH18566 NA18566 0 0 2 1
+CH18563 NA18563 0 0 1 1
+CH18570 NA18570 0 0 2 1
+CH18612 NA18612 0 0 1 2
+CH18571 NA18571 0 0 2 1
+CH18620 NA18620 0 0 1 1
+CH18621 NA18621 0 0 1 1
+CH18594 NA18594 0 0 2 1
+CH18622 NA18622 0 0 1 2
+CH18573 NA18573 0 0 2 2
+CH18623 NA18623 0 0 1 1
+CH18576 NA18576 0 0 2 1
+CH18577 NA18577 0 0 2 1
+CH18624 NA18624 0 0 1 1
+CH18579 NA18579 0 0 2 1
+CH18632 NA18632 0 0 1 2
+CH18582 NA18582 0 0 2 1
+CH18633 NA18633 0 0 1 1
+CH18635 NA18635 0 0 1 2
+CH18592 NA18592 0 0 2 1
+CH18636 NA18636 0 0 1 1
+CH18593 NA18593 0 0 2 2
+CH18637 NA18637 0 0 1 1
+JA18942 NA18942 0 0 2 2
+JA18940 NA18940 0 0 1 2
+JA18951 NA18951 0 0 2 2
+JA18943 NA18943 0 0 1 2
+JA18947 NA18947 0 0 2 2
+JA18944 NA18944 0 0 1 2
+JA18945 NA18945 0 0 1 2
+JA18949 NA18949 0 0 2 2
+JA18948 NA18948 0 0 1 2
+JA18952 NA18952 0 0 1 2
+JA18956 NA18956 0 0 2 2
+JA18964 NA18964 0 0 2 2
+JA18953 NA18953 0 0 1 1
+JA18968 NA18968 0 0 2 2
+JA18959 NA18959 0 0 1 2
+JA18969 NA18969 0 0 2 1
+JA18960 NA18960 0 0 1 2
+JA18961 NA18961 0 0 1 2
+JA18972 NA18972 0 0 2 2
+JA18965 NA18965 0 0 1 2
+JA18973 NA18973 0 0 2 2
+JA18966 NA18966 0 0 1 2
+JA18975 NA18975 0 0 2 2
+JA18967 NA18967 0 0 1 2
+JA18976 NA18976 0 0 2 1
+JA18978 NA18978 0 0 2 2
+JA18970 NA18970 0 0 1 1
+JA18980 NA18980 0 0 2 2
+JA18995 NA18995 0 0 1 1
+JA18981 NA18981 0 0 2 2
+JA18971 NA18971 0 0 1 2
+JA18974 NA18974 0 0 1 1
+JA18987 NA18987 0 0 2 2
+JA18990 NA18990 0 0 1 1
+JA18991 NA18991 0 0 2 2
+JA18994 NA18994 0 0 1 2
+JA18992 NA18992 0 0 2 2
+JA18997 NA18997 0 0 2 2
+JA18998 NA18998 0 0 2 2
+JA19000 NA19000 0 0 1 2
+JA19005 NA19005 0 0 1 2
+JA18999 NA18999 0 0 2 2
+JA19007 NA19007 0 0 1 2
+JA19003 NA19003 0 0 2 2
+JA19012 NA19012 0 0 1 2
diff -r 286958ef8157 -r 39c1d12c2e7d test-data/tinywga.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tinywga.bed Tue Oct 13 16:37:20 2009 -0400
@@ -0,0 +1,1 @@
+lÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿïŸîžÿÿüþ¿ÿ¿ûú¿¿ï/ÿÿþÿï¯êžëê°®Ÿî®ãêž;ì/âïú¯ï¯ÎêŒïâ°¯þϪã¯ø+ì?âÿú¯ïëÿîŸÿºþÿþ¯þï¿ÿ;ï?þÿÿÿïÿÿÿÿÿºÿÿþ¯þï¿ÿ»ÿÿþÿÿÿïëÿîŸÿºþÿþ¯þï¿ÿ;ï?þÿÿÿÿÿÿÿþïÿÿÿþÿÿÿÿûÿûÿÿÿ»ÿïëÿîŸÿºþÿþ¯þï¿ÿ;ï?þÿÿÿïëÿêŸÿºúïþ¯îë¿þ;¯>âïþ»
\ No newline at end of file
diff -r 286958ef8157 -r 39c1d12c2e7d test-data/tinywga.bim
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tinywga.bim Tue Oct 13 16:37:20 2009 -0400
@@ -0,0 +1,10 @@
+22 rs5992809 16.5965 16596539 0 C
+22 rs12168131 16.6573 16657262 G A
+22 rs390041 16.6629 16662916 T C
+22 rs437633 16.6697 16669684 A G
+22 rs450960 16.6909 16690858 T C
+22 rs450975 16.6909 16690887 T C
+22 rs451740 16.6912 16691174 T C
+22 rs8139723 16.6917 16691696 T C
+22 rs405490 16.6922 16692175 G A
+22 rs415170 16.6935 16693517 G C
diff -r 286958ef8157 -r 39c1d12c2e7d test-data/tinywga.fam
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tinywga.fam Tue Oct 13 16:37:20 2009 -0400
@@ -0,0 +1,90 @@
+CH18526 NA18526 0 0 2 1
+CH18524 NA18524 0 0 1 1
+CH18529 NA18529 0 0 2 1
+CH18558 NA18558 0 0 1 1
+CH18532 NA18532 0 0 2 1
+CH18561 NA18561 0 0 1 1
+CH18562 NA18562 0 0 1 1
+CH18537 NA18537 0 0 2 2
+CH18603 NA18603 0 0 1 2
+CH18540 NA18540 0 0 2 1
+CH18605 NA18605 0 0 1 1
+CH18542 NA18542 0 0 2 1
+CH18545 NA18545 0 0 2 1
+CH18572 NA18572 0 0 1 2
+CH18547 NA18547 0 0 2 2
+CH18609 NA18609 0 0 1 1
+CH18550 NA18550 0 0 2 1
+CH18608 NA18608 0 0 1 1
+CH18552 NA18552 0 0 2 1
+CH18611 NA18611 0 0 1 1
+CH18555 NA18555 0 0 2 1
+CH18564 NA18564 0 0 2 2
+CH18566 NA18566 0 0 2 1
+CH18563 NA18563 0 0 1 1
+CH18570 NA18570 0 0 2 1
+CH18612 NA18612 0 0 1 2
+CH18571 NA18571 0 0 2 1
+CH18620 NA18620 0 0 1 1
+CH18621 NA18621 0 0 1 1
+CH18594 NA18594 0 0 2 1
+CH18622 NA18622 0 0 1 2
+CH18573 NA18573 0 0 2 2
+CH18623 NA18623 0 0 1 1
+CH18576 NA18576 0 0 2 1
+CH18577 NA18577 0 0 2 1
+CH18624 NA18624 0 0 1 1
+CH18579 NA18579 0 0 2 1
+CH18632 NA18632 0 0 1 2
+CH18582 NA18582 0 0 2 1
+CH18633 NA18633 0 0 1 1
+CH18635 NA18635 0 0 1 2
+CH18592 NA18592 0 0 2 1
+CH18636 NA18636 0 0 1 1
+CH18593 NA18593 0 0 2 2
+CH18637 NA18637 0 0 1 1
+JA18942 NA18942 0 0 2 2
+JA18940 NA18940 0 0 1 2
+JA18951 NA18951 0 0 2 2
+JA18943 NA18943 0 0 1 2
+JA18947 NA18947 0 0 2 2
+JA18944 NA18944 0 0 1 2
+JA18945 NA18945 0 0 1 2
+JA18949 NA18949 0 0 2 2
+JA18948 NA18948 0 0 1 2
+JA18952 NA18952 0 0 1 2
+JA18956 NA18956 0 0 2 2
+JA18964 NA18964 0 0 2 2
+JA18953 NA18953 0 0 1 1
+JA18968 NA18968 0 0 2 2
+JA18959 NA18959 0 0 1 2
+JA18969 NA18969 0 0 2 1
+JA18960 NA18960 0 0 1 2
+JA18961 NA18961 0 0 1 2
+JA18972 NA18972 0 0 2 2
+JA18965 NA18965 0 0 1 2
+JA18973 NA18973 0 0 2 2
+JA18966 NA18966 0 0 1 2
+JA18975 NA18975 0 0 2 2
+JA18967 NA18967 0 0 1 2
+JA18976 NA18976 0 0 2 1
+JA18978 NA18978 0 0 2 2
+JA18970 NA18970 0 0 1 1
+JA18980 NA18980 0 0 2 2
+JA18995 NA18995 0 0 1 1
+JA18981 NA18981 0 0 2 2
+JA18971 NA18971 0 0 1 2
+JA18974 NA18974 0 0 1 1
+JA18987 NA18987 0 0 2 2
+JA18990 NA18990 0 0 1 1
+JA18991 NA18991 0 0 2 2
+JA18994 NA18994 0 0 1 2
+JA18992 NA18992 0 0 2 2
+JA18997 NA18997 0 0 2 2
+JA18998 NA18998 0 0 2 2
+JA19000 NA19000 0 0 1 2
+JA19005 NA19005 0 0 1 2
+JA18999 NA18999 0 0 2 2
+JA19007 NA19007 0 0 1 2
+JA19003 NA19003 0 0 2 2
+JA19012 NA19012 0 0 1 2
diff -r 286958ef8157 -r 39c1d12c2e7d test-data/tinywga.map
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tinywga.map Tue Oct 13 16:37:20 2009 -0400
@@ -0,0 +1,10 @@
+22 rs5992809 16.5965 16596539
+22 rs12168131 16.6573 16657262
+22 rs390041 16.6629 16662916
+22 rs437633 16.6697 16669684
+22 rs450960 16.6909 16690858
+22 rs450975 16.6909 16690887
+22 rs451740 16.6912 16691174
+22 rs8139723 16.6917 16691696
+22 rs405490 16.6922 16692175
+22 rs415170 16.6935 16693517
diff -r 286958ef8157 -r 39c1d12c2e7d test-data/tinywga.ped
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tinywga.ped Tue Oct 13 16:37:20 2009 -0400
@@ -0,0 +1,90 @@
+CH18526 NA18526 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18524 NA18524 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+CH18529 NA18529 0 0 2 1 C C A A T C A G T C T C T C C C G A G C
+CH18558 NA18558 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+CH18532 NA18532 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18561 NA18561 0 0 1 1 C C A A C C G G T C C C T C C C G A G C
+CH18562 NA18562 0 0 1 1 C C G A T C A G T C C C T C C C G A G C
+CH18537 NA18537 0 0 2 2 C C A A T C A G C C C C C C C C A A C C
+CH18603 NA18603 0 0 1 2 C C G A T C A G C C C C C C C C A A C C
+CH18540 NA18540 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18605 NA18605 0 0 1 1 C C A A T T A A C C C C C C C C A A C C
+CH18542 NA18542 0 0 2 1 C C G A T C G G C C C C C C C C A A C C
+CH18545 NA18545 0 0 2 1 C C G A T C A G T C C C T C C C G A G C
+CH18572 NA18572 0 0 1 2 C C A A T C A G C C C C C C C C A A G C
+CH18547 NA18547 0 0 2 2 C C G A T C A G T C C C T C C C G A G C
+CH18609 NA18609 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+CH18550 NA18550 0 0 2 1 C C G G T T A A T C C C T C T C G A G C
+CH18608 NA18608 0 0 1 1 C C G A T C G G C C C C C C C C A A C C
+CH18552 NA18552 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18611 NA18611 0 0 1 1 C C G A T C A G T C C C T C C C G A G C
+CH18555 NA18555 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18564 NA18564 0 0 2 2 C C A A T C G G C C C C C C C C A A C C
+CH18566 NA18566 0 0 2 1 C C A A T C A G C C C C C C T C A A C C
+CH18563 NA18563 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+CH18570 NA18570 0 0 2 1 C C A A T C A G T C T C T C C C G A G C
+CH18612 NA18612 0 0 1 2 C C A A T C A A T C T C T C C C G A G C
+CH18571 NA18571 0 0 2 1 C C A A T C A G C C C C C C C C A A C C
+CH18620 NA18620 0 0 1 1 C C A A C C G G T C T C T C C C G A G C
+CH18621 NA18621 0 0 1 1 C C G G T T A A T C C C T C C C G A G C
+CH18594 NA18594 0 0 2 1 C C A A T T A A C C C C C C C C A A G C
+CH18622 NA18622 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+CH18573 NA18573 0 0 2 2 C C A A T C A G C C C C C C C C A A C C
+CH18623 NA18623 0 0 1 1 C C G A T C G G C C C C C C C C A A C C
+CH18576 NA18576 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18577 NA18577 0 0 2 1 C C A A T C A G C C C C C C C C A A G C
+CH18624 NA18624 0 0 1 1 C C A A T C A G C C C C C C C C A A C C
+CH18579 NA18579 0 0 2 1 C C A A T C A G T C T C T C T C G A G C
+CH18632 NA18632 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+CH18582 NA18582 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18633 NA18633 0 0 1 1 C C G A T C G G C C C C C C C C A A C C
+CH18635 NA18635 0 0 1 2 C C A A T C G G C C C C C C C C A A C C
+CH18592 NA18592 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+CH18636 NA18636 0 0 1 1 C C A A T C A A T C T C T C C C G A G C
+CH18593 NA18593 0 0 2 2 C C A A C C G G T C T C T C C C G A G C
+CH18637 NA18637 0 0 1 1 C C A A T C A G T C T C T C C C G A G C
+JA18942 NA18942 0 0 2 2 C C A A C C A G C C C C C C C C A A C C
+JA18940 NA18940 0 0 1 2 C C A A T C A G C C C C C C C C A A G C
+JA18951 NA18951 0 0 2 2 C C G A T C A G C C C C C C C C A A C C
+JA18943 NA18943 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+JA18947 NA18947 0 0 2 2 C C G A T T A A C C C C C C C C A A G C
+JA18944 NA18944 0 0 1 2 C C A A T C A G T C T C T C C C G A G C
+JA18945 NA18945 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+JA18949 NA18949 0 0 2 2 C C G A T C G G C C C C C C C C A A C C
+JA18948 NA18948 0 0 1 2 C C G A T C G G C C C C C C C C A A C C
+JA18952 NA18952 0 0 1 2 C C A A T C A G C C C C C C C C A A C C
+JA18956 NA18956 0 0 2 2 C C A A C C A G T C T C T C C C G A G C
+JA18964 NA18964 0 0 2 2 C C A A T T A A C C C C C C C C A A G C
+JA18953 NA18953 0 0 1 1 C C A A T C A G C C C C C C T C A A C C
+JA18968 NA18968 0 0 2 2 C C A A C C G G C C C C C C C C A A C C
+JA18959 NA18959 0 0 1 2 C C G A T C G G C C C C C C C C A A C C
+JA18969 NA18969 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+JA18960 NA18960 0 0 1 2 C C A A T C A G T C T C T C C C G A G C
+JA18961 NA18961 0 0 1 2 C C A A C C A G C C C C C C C C A A C C
+JA18972 NA18972 0 0 2 2 C C G A T T A A T T T C T T C C G G G G
+JA18965 NA18965 0 0 1 2 C C A A T T A A C C C C C C C C A A C C
+JA18973 NA18973 0 0 2 2 C C A A C C G G C C C C C C T C A A C C
+JA18966 NA18966 0 0 1 2 C C G A T C A G T C C C T C C C G A G C
+JA18975 NA18975 0 0 2 2 C C A A C C G G C C C C C C C C A A G C
+JA18967 NA18967 0 0 1 2 C C A A C C G G C C C C C C C C A A G C
+JA18976 NA18976 0 0 2 1 C C A A C C G G C C C C C C C C A A C C
+JA18978 NA18978 0 0 2 2 C C G A T C G G C C C C C C C C A A C C
+JA18970 NA18970 0 0 1 1 C C G G T T A A T T C C T T C C G G G G
+JA18980 NA18980 0 0 2 2 C C A A T C A G T C T C T C C C G A G C
+JA18995 NA18995 0 0 1 1 C C A A T T A A C C C C C C C C A A G G
+JA18981 NA18981 0 0 2 2 C C A A T C A G C C C C C C C C A A G C
+JA18971 NA18971 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+JA18974 NA18974 0 0 1 1 C C A A C C G G C C C C C C C C A A C C
+JA18987 NA18987 0 0 2 2 C C A A C C G G C C C C C C C C A A C C
+JA18990 NA18990 0 0 1 1 C C A A T C G G C C C C C C C C A A G C
+JA18991 NA18991 0 0 2 2 C C A A C C G G C C C C C C C C A A C C
+JA18994 NA18994 0 0 1 2 C C G A T C A G C C C C C C C C A A G C
+JA18992 NA18992 0 0 2 2 C C A A T C A G C C C C C C T C A A C C
+JA18997 NA18997 0 0 2 2 C C A A C C G G C C C C C C C C A A C C
+JA18998 NA18998 0 0 2 2 C C A A C C G G C C C C C C T C A A C C
+JA19000 NA19000 0 0 1 2 C C A A C C G G C C C C C C C C A A C C
+JA19005 NA19005 0 0 1 2 C C A A C C G G C C C C C C C C A A G C
+JA18999 NA18999 0 0 2 2 C C A A T C A G C C C C C C C C A A C C
+JA19007 NA19007 0 0 1 2 C C A A T C A G C C C C C C C C A A G C
+JA19003 NA19003 0 0 2 2 C C A A T C G G C C C C C C C C A A C C
+JA19012 NA19012 0 0 1 2 C C A A 0 0 G G C C C C C C 0 0 A A C C
diff -r 286958ef8157 -r 39c1d12c2e7d test/base/twilltestcase.py
--- a/test/base/twilltestcase.py Tue Oct 13 16:18:16 2009 -0400
+++ b/test/base/twilltestcase.py Tue Oct 13 16:37:20 2009 -0400
@@ -83,7 +83,7 @@
tc.submit("runtool_btn")
self.home()
except AssertionError, err:
- errmsg = "The file (%s) doesn't exist." % filename
+ errmsg = "Uploading file resulted in the following exception. Make sure the file (%s) exists. " % filename
errmsg += str( err )
raise AssertionError( errmsg )
# Make sure every history item has a valid hid
@@ -116,7 +116,36 @@
raise AssertionError, "Invalid hid (%s) created when pasting %s" % ( hid, url_paste )
# Wait for upload processing to finish (TODO: this should be done in each test case instead)
self.wait()
-
+ def upload_composite_datatype_file( self, ftype, ped_file='', map_file='', bim_file='', bed_file='', fam_file='', dbkey='unspecified (?)', base_name='rgenetics' ):
+ """Tests uploading either of 2 different composite data types ( lped and pbed )"""
+ self.visit_url( "%s/tool_runner/index?tool_id=upload1" % self.url )
+ # Handle refresh_on_change
+ self.refresh_form( "file_type", ftype )
+ tc.fv( "1", "dbkey", dbkey )
+ tc.fv( "1", "files_metadata|base_name", base_name )
+ if ftype == 'lped':
+ # lped data types include a ped_file and a map_file
+ ped_file = self.get_filename( ped_file )
+ tc.formfile( "1", "files_0|file_data", ped_file )
+ map_file = self.get_filename( map_file )
+ tc.formfile( "1", "files_1|file_data", map_file )
+ elif ftype == 'pbed':
+ # pbed data types include a bim_file, a bed_file and a fam_file
+ bim_file = self.get_filename( bim_file )
+ tc.formfile( "1", "files_0|file_data", bim_file )
+ bed_file = self.get_filename( bed_file )
+ tc.formfile( "1", "files_1|file_data", bed_file )
+ fam_file = self.get_filename( fam_file )
+ tc.formfile( "1", "files_2|file_data", fam_file )
+ else:
+ raise AssertionError, "Unsupported composite data type (%s) received, currently only lped and pbed data types are supported." % ftype
+ tc.submit( "runtool_btn" )
+ self.check_page_for_string( 'The following job has been succesfully added to the queue:' )
+ check_str = 'Uploaded Composite Dataset (%s)' % ftype
+ self.check_page_for_string( check_str )
+ # Wait for upload processing to finish (TODO: this should be done in each test case instead)
+ self.wait()
+ self.check_history_for_string( check_str )
# Functions associated with histories
def check_history_for_errors( self ):
"""Raises an exception if there are errors in a history"""
@@ -522,7 +551,20 @@
errmsg += str( err )
raise AssertionError( errmsg )
os.remove(temp_name)
-
+ def verify_composite_datatype_file_content( self, file_name, hda_id ):
+ local_name = self.get_filename( file_name )
+ temp_name = self.get_filename( 'temp_%s' % file_name )
+ self.visit_url( "%s/datasets/%s/display/%s" % ( self.url, hda_id, file_name ) )
+ data = self.last_page()
+ file( temp_name, 'wb' ).write( data )
+ try:
+ self.files_diff( local_name, temp_name )
+ except AssertionError, err:
+ os.remove( temp_name )
+ errmsg = 'History item %s different than expected, difference:\n' % str( hda_id )
+ errmsg += str( err )
+ raise AssertionError( errmsg )
+ os.remove( temp_name )
def is_zipped( self, filename ):
if not zipfile.is_zipfile( filename ):
return False
@@ -722,7 +764,29 @@
# Add conditions for other control types here when necessary.
pass
tc.submit( button )
-
+ def refresh_form( self, control_name, value, form_no=0, **kwd ):
+ """Handles Galaxy's refresh_on_change for forms without ultimately submitting the form"""
+ # control_name is the name of the form field that requires refresh_on_change, and value is
+ # the value to which that field is being set.
+ for i, f in enumerate( self.showforms() ):
+ if i == form_no:
+ break
+ try:
+ control = f.find_control( name=control_name )
+ except:
+ # This assumes we always want the first control of the given name, which may not be ideal...
+ control = f.find_control( name=control_name, nr=0 )
+ # Check for refresh_on_change attribute, submit a change if required
+ if 'refresh_on_change' in control.attrs.keys():
+ # Clear Control and set to proper value
+ control.clear()
+ tc.fv( f.name, control.name, value )
+ # Create a new submit control, allows form to refresh, instead of going to next page
+ control = ClientForm.SubmitControl( 'SubmitControl', '___refresh_grouping___', {'name':'refresh_grouping'} )
+ control.add_to_form( f )
+ control.fixup()
+ # Submit for refresh
+ tc.submit( '___refresh_grouping___' )
def visit_page( self, page ):
# tc.go("./%s" % page)
if not page.startswith( "/" ):
diff -r 286958ef8157 -r 39c1d12c2e7d test/functional/test_get_data.py
--- a/test/functional/test_get_data.py Tue Oct 13 16:18:16 2009 -0400
+++ b/test/functional/test_get_data.py Tue Oct 13 16:37:20 2009 -0400
@@ -45,6 +45,7 @@
self.delete_history( id=self.security.encode_id( history1.id ) )
def test_005_url_paste( self ):
"""Test url paste behavior"""
+ # Logged in as admin_user
# Deleting the current history should have created a new history
self.check_history_for_string( 'Your history is empty' )
history2 = galaxy.model.History.filter( and_( galaxy.model.History.table.c.deleted==False,
@@ -57,3 +58,38 @@
self.check_history_for_string( 'Pasted Entry' )
self.check_history_for_string( 'hello world' )
self.delete_history( id=self.security.encode_id( history2.id ) )
+ def test_010_upload_lped_composite_datatype_files( self ):
+ """Test uploading lped composite datatype files"""
+ # Logged in as admin_user
+ self.check_history_for_string( 'Your history is empty' )
+ history3 = galaxy.model.History.filter( and_( galaxy.model.History.table.c.deleted==False,
+ galaxy.model.History.table.c.user_id==admin_user.id ) ) \
+ .order_by( desc( galaxy.model.History.table.c.create_time ) ).first()
+ # lped data types include a ped_file and a map_file ( which is binary )
+ self.upload_composite_datatype_file( 'lped', ped_file='tinywga.ped', map_file='tinywga.map', base_name='rgenetics' )
+ # Get the latest hid for testing
+ hda1 = galaxy.model.HistoryDatasetAssociation.query() \
+ .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ).first()
+ assert hda1 is not None, "Problem retrieving hda1 from database"
+ # We'll test against the resulting ped file and map file for correctness
+ self.verify_composite_datatype_file_content( 'rgenetics.ped', str( hda1.id ) )
+ self.verify_composite_datatype_file_content( 'rgenetics.map', str( hda1.id ) )
+ self.delete_history( id=self.security.encode_id( history3.id ) )
+ def test_015_upload_pbed_composite_datatype_files( self ):
+ """Test uploading pbed composite datatype files"""
+ # Logged in as admin_user
+ self.check_history_for_string( 'Your history is empty' )
+ history4 = galaxy.model.History.filter( and_( galaxy.model.History.table.c.deleted==False,
+ galaxy.model.History.table.c.user_id==admin_user.id ) ) \
+ .order_by( desc( galaxy.model.History.table.c.create_time ) ).first()
+ # pbed data types include a bim_file, a bed_file and a fam_file
+ self.upload_composite_datatype_file( 'pbed', bim_file='tinywga.bim', bed_file='tinywga.bed', fam_file='tinywga.fam', base_name='rgenetics' )
+ # Get the latest hid for testing
+ hda1 = galaxy.model.HistoryDatasetAssociation.query() \
+ .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ).first()
+ assert hda1 is not None, "Problem retrieving hda1 from database"
+ # We'll test against the resulting ped file and map file for correctness
+ self.verify_composite_datatype_file_content( 'rgenetics.bim', str( hda1.id ) )
+ self.verify_composite_datatype_file_content( 'rgenetics.bed', str( hda1.id ) )
+ self.verify_composite_datatype_file_content( 'rgenetics.fam', str( hda1.id ) )
+ self.delete_history( id=self.security.encode_id( history4.id ) )
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/286958ef8157
changeset: 2878:286958ef8157
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Tue Oct 13 16:18:16 2009 -0400
description:
Revert the additional valid_chars added in change set 2868.
1 file(s) affected in this change:
lib/galaxy/util/__init__.py
diffs (12 lines):
diff -r a2662059af4d -r 286958ef8157 lib/galaxy/util/__init__.py
--- a/lib/galaxy/util/__init__.py Tue Oct 13 13:07:43 2009 -0400
+++ b/lib/galaxy/util/__init__.py Tue Oct 13 16:18:16 2009 -0400
@@ -109,7 +109,7 @@
return text
# characters that are valid
-valid_chars = set(string.letters + string.digits + " -=_.()/+*^,:?!;|")
+valid_chars = set(string.letters + string.digits + " -=_.()/+*^,:?!")
# characters that are allowed but need to be escaped
mapped_chars = { '>' :'__gt__',
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/a2662059af4d
changeset: 2877:a2662059af4d
user: Ross Lazarus <ross.lazarus(a)gmail.com>
date: Tue Oct 13 13:07:43 2009 -0400
description:
use files_path not extra_files_path for all outputs in rgenetics converters
3 file(s) affected in this change:
lib/galaxy/datatypes/converters/lped_to_fped_converter.xml
lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml
lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml
diffs (36 lines):
diff -r e11e89fd2c82 -r a2662059af4d lib/galaxy/datatypes/converters/lped_to_fped_converter.xml
--- a/lib/galaxy/datatypes/converters/lped_to_fped_converter.xml Mon Oct 12 19:00:39 2009 -0400
+++ b/lib/galaxy/datatypes/converters/lped_to_fped_converter.xml Tue Oct 13 13:07:43 2009 -0400
@@ -2,7 +2,7 @@
<!-- <description>__NOT_USED_CURRENTLY_FOR_CONVERTERS__</description> -->
<!-- Used on the metadata edit page. -->
<command interpreter="python">
- lped_to_fped_converter.py '$input1.extra_files_path/$input1.metadata.base_name' '$output1' '$output1.extra_files_path'
+ lped_to_fped_converter.py '$input1.extra_files_path/$input1.metadata.base_name' '$output1' '$output1.files_path'
</command>
<inputs>
<param format="lped" name="input1" type="data" label="Choose linkage pedigree file"/>
diff -r e11e89fd2c82 -r a2662059af4d lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml
--- a/lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml Mon Oct 12 19:00:39 2009 -0400
+++ b/lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml Tue Oct 13 13:07:43 2009 -0400
@@ -3,7 +3,7 @@
<!-- Used on the metadata edit page. -->
<command interpreter="python">
lped_to_pbed_converter.py '$input1.extra_files_path/$input1.metadata.base_name'
- '$output1' '$output1.extra_files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
+ '$output1' '$output1.files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
</command>
<inputs>
<param format="lped" name="input1" type="data" label="Choose linkage pedigree file"/>
diff -r e11e89fd2c82 -r a2662059af4d lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml
--- a/lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml Mon Oct 12 19:00:39 2009 -0400
+++ b/lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml Tue Oct 13 13:07:43 2009 -0400
@@ -3,7 +3,7 @@
<!-- Used on the metadata edit page. -->
<command interpreter="python">
pbed_to_lped_converter.py '$input1.extra_files_path/$input1.metadata.base_name'
- '$output1' '$output1.extra_files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
+ '$output1' '$output1.files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
</command>
<inputs>
<param format="pbed" name="input1" type="data" label="Choose compressed Plink binary format genotype file"/>
1
0