galaxy-dev
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- 1 participants
- 10009 discussions
21 Sep '09
details: http://www.bx.psu.edu/hg/galaxy/rev/8cbdd73ab68c
changeset: 2729:8cbdd73ab68c
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Sat Sep 19 00:25:14 2009 -0400
description:
Bug fixes, enhancements, code refactoring and re-introduction of functional tests for library templates.
- Fixed bug where exception was thrown when chosing a role in the admin view
- The contents of inherited templates will no longer be displayed in the inherited container
- Old versions of library datasets will not be displayed in the lbrary browser
- Added the job.traceback information to the dataset error report
- Moved the get_form_wigets method the forms.py to the FormDefinition class, renaming it to get_wigets
15 file(s) affected in this change:
lib/galaxy/model/__init__.py
lib/galaxy/web/controllers/admin.py
lib/galaxy/web/controllers/dataset.py
lib/galaxy/web/controllers/forms.py
lib/galaxy/web/controllers/library.py
lib/galaxy/web/controllers/library_admin.py
lib/galaxy/web/controllers/library_dataset.py
lib/galaxy/web/controllers/requests.py
lib/galaxy/web/controllers/requests_admin.py
templates/admin/library/browse_library.mako
templates/library/browse_library.mako
templates/library/new_dataset.mako
test/base/twilltestcase.py
test/functional/test_forms_and_requests.py
test/functional/test_security_and_libraries.py
diffs (1993 lines):
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/model/__init__.py Sat Sep 19 00:25:14 2009 -0400
@@ -14,6 +14,7 @@
from galaxy.datatypes.metadata import MetadataCollection
from galaxy.security import RBACAgent, get_permitted_actions
from galaxy.util.hash_util import *
+from galaxy.web.form_builder import *
import logging
log = logging.getLogger( __name__ )
@@ -686,10 +687,23 @@
self.name = name or "Unnamed library"
self.description = description
self.root_folder = root_folder
- def get_info_association( self, restrict=False ):
+ def get_info_association( self, restrict=False, inherited=False ):
if self.info_association:
- return self.info_association[0]
- return None
+ return self.info_association[0], inherited
+ return None, inherited
+ def get_template_widgets( self, trans, get_contents=True ):
+ # See if we have any associated templates - the returned value for
+ # inherited is not applicable at the library level
+ info_association, inherited = self.get_info_association()
+ if info_association:
+ template = info_association.template
+ if get_contents:
+ # See if we have any field contents
+ info = info_association.info
+ if info:
+ return template.get_widgets( trans.user, contents=info.content )
+ return template.get_widgets( trans.user )
+ return []
class LibraryFolder( object ):
def __init__( self, name=None, description=None, item_count=0, order_id=None ):
@@ -708,19 +722,35 @@
folder.parent_id = self.id
folder.order_id = self.item_count
self.item_count += 1
- def get_info_association( self, restrict=False ):
+ def get_info_association( self, restrict=False, inherited=False ):
# If restrict is True, we will return this folder's info_association, not inheriting.
# If restrict is False, we'll return the next available info_association in the
- # inheritable hierarchy
+ # inheritable hierarchy. True is also returned if the info_association was inherited,
+ # and False if not. This enables us to eliminate displaying the any contents of the inherited
+ # template.
if self.info_association:
- return self.info_association[0]
+ return self.info_association[0], inherited
if restrict:
- return None
+ return None, inherited
if self.parent:
- return self.parent.get_info_association()
+ return self.parent.get_info_association( inherited=True )
if self.library_root:
- return self.library_root[0].get_info_association()
- return None
+ return self.library_root[0].get_info_association( inherited=True )
+ return None, inherited
+ def get_template_widgets( self, trans, get_contents=True ):
+ # See if we have any associated templates
+ info_association, inherited = self.get_info_association()
+ if info_association:
+ template = info_association.template
+ # See if we have any field contents, but only if the info_association was
+ # not inherited ( we do not want to display the inherited contents ).
+ if not inherited and get_contents:
+ info = info_association.info
+ if info:
+ return template.get_widgets( trans.user, info.content )
+ else:
+ return template.get_widgets( trans.user )
+ return []
@property
def active_library_datasets( self ):
# This needs to be a list
@@ -839,15 +869,31 @@
return ldda
def clear_associated_files( self, metadata_safe = False, purge = False ):
return
- def get_info_association( self, restrict=False ):
+ def get_info_association( self, restrict=False, inherited=False ):
# If restrict is True, we will return this ldda's info_association whether it
# exists or not. If restrict is False, we'll return the next available info_association
- # in the inheritable hierarchy
+ # in the inheritable hierarchy. True is also returned if the info_association was inherited,
+ # and False if not. This enables us to eliminate displaying the any contents of the inherited
+ # template.
if self.info_association:
- return self.info_association[0]
+ return self.info_association[0], inherited
if restrict:
- return None
- return self.library_dataset.folder.get_info_association()
+ return None, inherited
+ return self.library_dataset.folder.get_info_association( inherited=True )
+ def get_template_widgets( self, trans, get_contents=True ):
+ # See if we have any associated templates
+ info_association, inherited = self.get_info_association()
+ if info_association:
+ template = info_association.template
+ # See if we have any field contents, but only if the info_association was
+ # not inherited ( we do not want to display the inherited contents ).
+ if not inherited and get_contents:
+ info = info_association.info
+ if info:
+ return template.get_widgets( trans.user, info.content )
+ else:
+ return template.get_widgets( trans.user )
+ return []
class LibraryInfoAssociation( object ):
def __init__( self, library, form_definition, info ):
@@ -1030,6 +1076,62 @@
if f['layout'] == str(layout_index):
fields_dict[i] = f
return fields_dict
+ def get_widgets( self, user, contents=[], **kwd ):
+ '''
+ Return the list of widgets that comprise a form definition,
+ including field contents if any.
+ '''
+ params = util.Params( kwd )
+ widgets = []
+ for index, field in enumerate( self.fields ):
+ field_name = 'field_%i' % index
+ # determine the value of the field
+ if field_name in kwd:
+ # the user had already filled out this field and the same form is re-rendered
+ # due to some reason like required fields have been left out.
+ if field[ 'type' ] == 'CheckboxField':
+ value = CheckboxField.is_checked( util.restore_text( params.get( field_name, False ) ) )
+ else:
+ value = util.restore_text( params.get( field_name, '' ) )
+ elif contents:
+ # this field has a saved value
+ value = str( contents[ index ] )
+ else:
+ # if none of the above, then leave the field empty
+ if field[ 'type' ] == 'CheckboxField':
+ # Since we do not have contents, set checkbox value to False
+ value = False
+ else:
+ # Set other field types to empty string
+ value = ''
+ # create the field widget
+ field_widget = eval( field[ 'type' ] )( field_name )
+ if field[ 'type' ] == 'TextField':
+ field_widget.set_size( 40 )
+ field_widget.value = value
+ elif field[ 'type' ] == 'TextArea':
+ field_widget.set_size( 3, 40 )
+ field_widget.value = value
+ elif field['type'] == 'AddressField':
+ field_widget.user = user
+ field_widget.value = value
+ field_widget.params = params
+ elif field[ 'type' ] == 'SelectField':
+ for option in field[ 'selectlist' ]:
+ if option == value:
+ field_widget.add_option( option, option, selected=True )
+ else:
+ field_widget.add_option( option, option )
+ elif field[ 'type' ] == 'CheckboxField':
+ field_widget.checked = value
+ if field[ 'required' ] == 'required':
+ req = 'Required'
+ else:
+ req = 'Optional'
+ widgets.append( dict( label=field[ 'label' ],
+ widget=field_widget,
+ helptext='%s (%s)' % ( field[ 'helptext' ], req ) ) )
+ return widgets
class FormDefinitionCurrent( object ):
def __init__(self, form_definition=None):
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/web/controllers/admin.py Sat Sep 19 00:25:14 2009 -0400
@@ -3,7 +3,6 @@
from galaxy import util, datatypes
from galaxy.web.base.controller import *
from galaxy.model.orm import *
-from galaxy.web.controllers.forms import get_all_forms, get_form_widgets
from galaxy.web.framework.helpers import time_ago, iff, grids
import logging
log = logging.getLogger( __name__ )
@@ -242,7 +241,7 @@
# whose DatasetPermissions is associated with the Role
# [ ( LibraryDatasetDatasetAssociation [ action, action ] ) ]
library_dataset_actions = {}
- for dp in role.actions:
+ for dp in role.dataset_actions:
for ldda in trans.app.model.LibraryDatasetDatasetAssociation \
.filter( trans.app.model.LibraryDatasetDatasetAssociation.dataset_id==dp.dataset_id ) \
.all():
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/web/controllers/dataset.py
--- a/lib/galaxy/web/controllers/dataset.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/web/controllers/dataset.py Sat Sep 19 00:25:14 2009 -0400
@@ -35,6 +35,9 @@
-----------------------------------------------------------------------------
job info:
${info}
+-----------------------------------------------------------------------------
+job traceback:
+${traceback}
-----------------------------------------------------------------------------
(This is an automated message).
"""
@@ -76,6 +79,7 @@
tool_id=job.tool_id,
stderr=job.stderr,
stdout=job.stdout,
+ traceback=job.traceback,
info=job.info ) )
frm = to_address
# Check email a bit
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/web/controllers/forms.py
--- a/lib/galaxy/web/controllers/forms.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/web/controllers/forms.py Sat Sep 19 00:25:14 2009 -0400
@@ -500,10 +500,6 @@
Return all the latest forms from the form_definition_current table
if all_versions is set to True. Otherwise return all the versions
of all the forms from the form_definition table.
-
- TODO: when we add the concept of a form_definition_type ( e.g.,
- 'request_header', 'request_sample', 'library_template' ), filter
- the query if received filter is not None.
'''
if all_versions:
return trans.app.model.FormDefinition.query().all()
@@ -515,64 +511,3 @@
return [ fdc.latest_form for fdc in fdc_list ]
else:
return [ fdc.latest_form for fdc in fdc_list if fdc.latest_form.type == form_type ]
-
-
-
-def get_form_widgets( trans, form, contents=[], user=None, **kwd ):
- '''
- Return the list of widgets that comprise a form definition,
- including field contents if any.
- '''
- params = util.Params( kwd )
- if not user:
- user = trans.user
- widgets = []
- for index, field in enumerate( form.fields ):
- field_name = 'field_%i' % index
- # determine the value of the field
- if field_name in kwd:
- # the user had already filled out this field and the same form is re-rendered
- # due to some reason like required fields have been left out.
- if field[ 'type' ] == 'CheckboxField':
- value = CheckboxField.is_checked( util.restore_text( params.get( field_name, False ) ) )
- else:
- value = util.restore_text( params.get( field_name, '' ) )
- elif contents:
- # this field has a saved value
- value = str(contents[ index ])
- else:
- # if none of the above, then leave the field empty
- if field[ 'type' ] == 'CheckboxField':
- # Since we do not have contents, set checkbox value to False
- value = False
- else:
- # Set other field types to empty string
- value = ''
- # create the field widget
- field_widget = eval( field[ 'type' ] )( field_name )
- if field[ 'type' ] == 'TextField':
- field_widget.set_size( 40 )
- field_widget.value = value
- elif field[ 'type' ] == 'TextArea':
- field_widget.set_size( 3, 40 )
- field_widget.value = value
- elif field['type'] == 'AddressField':
- field_widget.user = user
- field_widget.value = value
- field_widget.params = params
- elif field[ 'type' ] == 'SelectField':
- for option in field[ 'selectlist' ]:
- if option == value:
- field_widget.add_option( option, option, selected=True )
- else:
- field_widget.add_option( option, option )
- elif field[ 'type' ] == 'CheckboxField':
- field_widget.checked = value
- if field[ 'required' ] == 'required':
- req = 'Required'
- else:
- req = 'Optional'
- widgets.append( dict( label=field[ 'label' ],
- widget=field_widget,
- helptext='%s (%s)' % ( field[ 'helptext' ], req ) ) )
- return widgets
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/web/controllers/library.py
--- a/lib/galaxy/web/controllers/library.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/web/controllers/library.py Sat Sep 19 00:25:14 2009 -0400
@@ -3,7 +3,7 @@
from galaxy.datatypes import sniff
from galaxy import util
from galaxy.util.odict import odict
-from galaxy.web.controllers.forms import get_all_forms, get_form_widgets
+from galaxy.web.controllers.forms import get_all_forms
from galaxy.util.streamball import StreamBall
import logging, tempfile, zipfile, tarfile, os, sys
@@ -149,16 +149,7 @@
messagetype='error' ) )
if action == 'information':
# See if we have any associated templates
- if library.info_association:
- template = library.info_association[0].template
- # See if we have any field contents
- info = library.info_association[0].info
- if info:
- widgets = get_form_widgets( trans, template, info.content )
- else:
- widgets = get_form_widgets( trans, template )
- else:
- widgets = []
+ widgets = library.get_template_widgets( trans )
if params.get( 'rename_library_button', False ):
old_name = library.name
new_name = util.restore_text( params.name )
@@ -479,17 +470,7 @@
msg=util.sanitize_text( msg ),
messagetype='error' ) )
# See if we have any associated templates
- info_association = ldda.get_info_association()
- if info_association:
- template = info_association.template
- # See if we have any field contents
- info = info_association.info
- if info:
- widgets = get_form_widgets( trans, template, info.content )
- else:
- widgets = get_form_widgets( trans, template )
- else:
- widgets = []
+ widgets = ldda.get_template_widgets( trans )
if action == 'permissions':
if params.get( 'update_roles_button', False ):
# The user clicked the Save button on the 'Associate With Roles' form
@@ -782,6 +763,8 @@
msg=util.sanitize_text( msg ),
messagetype='error' ) )
if not id or replace_dataset:
+ # See if we have any inherited templates, but do not inherit contents.
+ widgets = folder.get_template_widgets( trans, get_contents=False )
upload_option = params.get( 'upload_option', 'upload_file' )
# No dataset(s) specified, so display the upload form. Send list of data formats to the form
# so the "extension" select list can be populated dynamically
@@ -806,6 +789,7 @@
last_used_build=last_used_build,
roles=roles,
history=history,
+ widgets=widgets,
msg=msg,
messagetype=messagetype,
replace_dataset=replace_dataset )
@@ -968,17 +952,7 @@
messagetype=messagetype )
elif action == 'information':
# See if we have any associated templates
- info_association = folder.get_info_association()
- if info_association:
- template = info_association.template
- # See if we have any field contents
- info = info_association.info
- if info:
- widgets = get_form_widgets( trans, template, info.content )
- else:
- widgets = get_form_widgets( trans, template )
- else:
- widgets = []
+ widgets = folder.get_template_widgets( trans )
if params.get( 'rename_folder_button', False ):
if trans.app.security_agent.can_modify_library_item( user, roles, folder ):
old_name = folder.name
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/web/controllers/library_admin.py
--- a/lib/galaxy/web/controllers/library_admin.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/web/controllers/library_admin.py Sat Sep 19 00:25:14 2009 -0400
@@ -2,7 +2,7 @@
from galaxy import util
from galaxy.web.base.controller import *
from galaxy.model.orm import *
-from galaxy.web.controllers.forms import get_all_forms, get_form_widgets
+from galaxy.web.controllers.forms import get_all_forms
# Older py compatibility
try:
set()
@@ -96,17 +96,7 @@
return trans.fill_template( '/admin/library/new_library.mako', msg=msg, messagetype=messagetype )
elif action == 'information':
# See if we have any associated templates
- info_association = library.get_info_association()
- if info_association:
- template = info_association.template
- # See if we have any field contents
- info = info_association.info
- if info:
- widgets = get_form_widgets( trans, template, info.content )
- else:
- widgets = get_form_widgets( trans, template )
- else:
- widgets = []
+ widgets = library.get_template_widgets( trans )
if params.get( 'rename_library_button', False ):
old_name = library.name
new_name = util.restore_text( params.name )
@@ -293,17 +283,7 @@
messagetype=messagetype )
elif action == 'information':
# See if we have any associated templates
- info_association = folder.get_info_association()
- if info_association:
- template = info_association.template
- # See if we have any field contents
- info = info_association.info
- if info:
- widgets = get_form_widgets( trans, template, info.content )
- else:
- widgets = get_form_widgets( trans, template )
- else:
- widgets = []
+ widgets = folder.get_template_widgets( trans )
if params.get( 'rename_folder_button', False ):
old_name = folder.name
new_name = util.restore_text( params.name )
@@ -478,13 +458,8 @@
msg=util.sanitize_text( msg ),
messagetype=messagetype ) )
elif not id or replace_dataset:
- # See if we have any associated templates
- info_association = folder.get_info_association()
- if info_association:
- template = info_association.template
- widgets = get_form_widgets( trans, template )
- else:
- widgets = []
+ # See if we have any inherited templates, but do not inherit contents.
+ widgets = folder.get_template_widgets( trans, get_contents=False )
upload_option = params.get( 'upload_option', 'upload_file' )
# No dataset(s) specified, so display the upload form. Send list of data formats to the form
# so the "extension" select list can be populated dynamically
@@ -536,17 +511,7 @@
msg=util.sanitize_text( msg ),
messagetype='error' ) )
# See if we have any associated templates
- info_association = ldda.get_info_association()
- if info_association:
- template = info_association.template
- # See if we have any field contents
- info = info_association.info
- if info:
- widgets = get_form_widgets( trans, template, info.content )
- else:
- widgets = get_form_widgets( trans, template )
- else:
- widgets = []
+ widgets = ldda.get_template_widgets( trans )
if action == 'permissions':
if params.get( 'update_roles_button', False ):
permissions = {}
@@ -1019,8 +984,9 @@
# Since information templates are inherited, the template fields can be displayed on the information
# page for a folder or library dataset when it has no info_association object. If the user has added
# field contents on an inherited template via a parent's info_association, we'll need to create a new
- # form_values and info_association for the current object.
- info_association = library_item.get_info_association( restrict=True )
+ # form_values and info_association for the current object. The value for the returned inherited variable
+ # is not applicable at this level.
+ info_association, inherited = library_item.get_info_association( restrict=True )
if info_association:
template = info_association.template
info = info_association.info
@@ -1031,7 +997,7 @@
form_values.flush()
else:
# Inherit the next available info_association so we can get the template
- info_association = library_item.get_info_association()
+ info_association, inherited = library_item.get_info_association()
template = info_association.template
# Create a new FormValues object
form_values = trans.app.model.FormValues( template, field_contents )
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/web/controllers/library_dataset.py
--- a/lib/galaxy/web/controllers/library_dataset.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/web/controllers/library_dataset.py Sat Sep 19 00:25:14 2009 -0400
@@ -205,7 +205,7 @@
template_field_contents = []
template = None
folder = trans.app.model.LibraryFolder.get( folder_id )
- info_association = folder.get_info_association()
+ info_association, inherited = folder.get_info_association()
if info_association:
template = info_association.template
for field_index in range( len( template.fields ) ):
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/web/controllers/requests.py
--- a/lib/galaxy/web/controllers/requests.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/web/controllers/requests.py Sat Sep 19 00:25:14 2009 -0400
@@ -9,7 +9,6 @@
from galaxy.web.form_builder import *
from datetime import datetime, timedelta
from cgi import escape, FieldStorage
-from galaxy.web.controllers.forms import get_form_widgets
log = logging.getLogger( __name__ )
@@ -480,7 +479,7 @@
libraries[ library ] = hidden_folder_ids
libui = self.__library_ui(libraries, **kwd)
widgets = widgets + libui
- widgets = widgets + get_form_widgets(trans, request_type.request_form, contents=[], **kwd)
+ widgets = widgets + request_type.request_form.get_widgets( user, **kwd )
return trans.fill_template( '/requests/new_request.mako',
select_request_type=select_request_type,
request_type=request_type,
@@ -722,7 +721,7 @@
libraries[ library ] = hidden_folder_ids
libui = self.__library_ui(libraries, request, **kwd)
widgets = widgets + libui
- widgets = widgets + get_form_widgets(trans, request.type.request_form, request.values.content, **kwd)
+ widgets = widgets + request.type.request_form.get_widgets( user, request.values.content, **kwd )
return trans.fill_template( '/requests/edit_request.mako',
select_request_type=select_request_type,
request_type=request.type,
diff -r 9d615c906e6c -r 8cbdd73ab68c lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Fri Sep 18 22:41:11 2009 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Sat Sep 19 00:25:14 2009 -0400
@@ -7,7 +7,6 @@
import logging, tempfile, zipfile, tarfile, os, sys
from galaxy.web.form_builder import *
from datetime import datetime, timedelta
-from galaxy.web.controllers.forms import get_form_widgets
from galaxy.web.controllers.forms import get_all_forms
log = logging.getLogger( __name__ )
@@ -178,7 +177,7 @@
# libraries selectbox
libui = self.__library_ui(trans, request.user, request, **kwd)
widgets = widgets + libui
- widgets = widgets + get_form_widgets(trans, request.type.request_form, request.values.content, request.user, **kwd)
+ widgets = widgets + request.type.request_form.get_widgets( request.user, request.values.content, **kwd )
return trans.fill_template( '/admin/requests/edit_request.mako',
select_request_type=select_request_type,
request_type=request.type,
@@ -687,7 +686,7 @@
# libraries selectbox
libui = self.__library_ui(trans, user, **kwd)
widgets = widgets + libui
- widgets = widgets + get_form_widgets(trans, request_type.request_form, contents=[], user=user, **kwd)
+ widgets = widgets + request_type.request_form.get_widgets( user, **kwd )
return trans.fill_template( '/admin/requests/new_request.mako',
select_request_type=select_request_type,
request_type=request_type,
diff -r 9d615c906e6c -r 8cbdd73ab68c templates/admin/library/browse_library.mako
--- a/templates/admin/library/browse_library.mako Fri Sep 18 22:41:11 2009 -0400
+++ b/templates/admin/library/browse_library.mako Sat Sep 19 00:25:14 2009 -0400
@@ -85,48 +85,48 @@
else:
current_version = False
%>
- <div class="historyItemWrapper historyItem historyItem-${ldda.state}" id="libraryItem-${ldda.id}">
- ## Header row for library items (name, state, action buttons)
- <div class="historyItemTitleBar">
- <table cellspacing="0" cellpadding="0" border="0" width="100%">
- <tr>
- <td width="*">
- %if selected:
- <input type="checkbox" name="ldda_ids" value="${ldda.id}" checked/>
- %else:
- <input type="checkbox" name="ldda_ids" value="${ldda.id}"/>
- %endif
- <span class="libraryItemDeleted-${ldda.deleted}">
- <a href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, info=True, deleted=deleted, show_deleted=show_deleted )}"><b>${ldda.name[:50]}</b></a>
- </span>
- <a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">▼</a>
- %if not library.deleted and not folder.deleted and not library_dataset.deleted:
- <div popupmenu="dataset-${ldda.id}-popup">
- <a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, edit_info=True )}">Edit this dataset's information</a>
- ## We're disabling the ability to add templates at the LDDA and LibraryDataset level, but will leave this here for possible future use
- ##<a class="action-button" href="${h.url_for( controller='library_admin', action='info_template', library_id=library.id, library_dataset_id=library_dataset.id, new_template=True )}">Add an information template to this dataset</a>
- <a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
- %if current_version:
+ %if current_version:
+ <div class="historyItemWrapper historyItem historyItem-${ldda.state}" id="libraryItem-${ldda.id}">
+ ## Header row for library items (name, state, action buttons)
+ <div class="historyItemTitleBar">
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
+ <tr>
+ <td width="*">
+ %if selected:
+ <input type="checkbox" name="ldda_ids" value="${ldda.id}" checked/>
+ %else:
+ <input type="checkbox" name="ldda_ids" value="${ldda.id}"/>
+ %endif
+ <span class="libraryItemDeleted-${ldda.deleted}">
+ <a href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, info=True, deleted=deleted, show_deleted=show_deleted )}"><b>${ldda.name[:50]}</b></a>
+ </span>
+ <a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">▼</a>
+ %if not library.deleted and not folder.deleted and not library_dataset.deleted:
+ <div popupmenu="dataset-${ldda.id}-popup">
+ <a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, edit_info=True )}">Edit this dataset's information</a>
+ ## We're disabling the ability to add templates at the LDDA and LibraryDataset level, but will leave this here for possible future use
+ ##<a class="action-button" href="${h.url_for( controller='library_admin', action='info_template', library_id=library.id, library_dataset_id=library_dataset.id, new_template=True )}">Add an information template to this dataset</a>
+ <a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, replace_id=library_dataset.id )}">Upload a new version of this dataset</a>
- %endif
- %if ldda.has_data:
- <a class="action-button" href="${h.url_for( controller='library_admin', action='download_dataset_from_folder', id=ldda.id, library_id=library.id )}">Download this dataset</a>
- %endif
- <a class="action-button" confirm="Click OK to delete dataset '${ldda.name}'." href="${h.url_for( controller='library_admin', action='delete_library_item', library_id=library.id, library_item_id=library_dataset.id, library_item_type='library_dataset' )}">Delete this dataset</a>
- </div>
- %elif not library.deleted and not folder.deleted and library_dataset.deleted:
- <div popupmenu="dataset-${ldda.id}-popup">
- <a class="action-button" href="${h.url_for( controller='library_admin', action='undelete_library_item', library_id=library.id, library_item_id=library_dataset.id, library_item_type='library_dataset' )}">Undelete this dataset</a>
- </div>
- %endif
- </td>
- <td width="300">${ldda.message}</td>
- <td width="150">${uploaded_by}</td>
- <td width="60">${ldda.create_time.strftime( "%Y-%m-%d" )}</td>
- </tr>
- </table>
+ %if ldda.has_data:
+ <a class="action-button" href="${h.url_for( controller='library_admin', action='download_dataset_from_folder', id=ldda.id, library_id=library.id )}">Download this dataset</a>
+ %endif
+ <a class="action-button" confirm="Click OK to delete dataset '${ldda.name}'." href="${h.url_for( controller='library_admin', action='delete_library_item', library_id=library.id, library_item_id=library_dataset.id, library_item_type='library_dataset' )}">Delete this dataset</a>
+ </div>
+ %elif not library.deleted and not folder.deleted and library_dataset.deleted:
+ <div popupmenu="dataset-${ldda.id}-popup">
+ <a class="action-button" href="${h.url_for( controller='library_admin', action='undelete_library_item', library_id=library.id, library_item_id=library_dataset.id, library_item_type='library_dataset' )}">Undelete this dataset</a>
+ </div>
+ %endif
+ </td>
+ <td width="300">${ldda.message}</td>
+ <td width="150">${uploaded_by}</td>
+ <td width="60">${ldda.create_time.strftime( "%Y-%m-%d" )}</td>
+ </tr>
+ </table>
+ </div>
</div>
- </div>
+ %endif
</%def>
<%def name="render_folder( folder, folder_pad, deleted, show_deleted, created_ldda_ids, library_id, root_folder=False )">
diff -r 9d615c906e6c -r 8cbdd73ab68c templates/library/browse_library.mako
--- a/templates/library/browse_library.mako Fri Sep 18 22:41:11 2009 -0400
+++ b/templates/library/browse_library.mako Sat Sep 19 00:25:14 2009 -0400
@@ -91,52 +91,53 @@
uploaded_by = 'anonymous'
if ldda == library_dataset.library_dataset_dataset_association:
current_version = True
+ can_modify_library_dataset = trans.app.security_agent.can_modify_library_item( user, roles, library_dataset )
+ can_manage_library_dataset = trans.app.security_agent.can_manage_library_item( user, roles, library_dataset )
else:
current_version = False
- can_modify_library_dataset = trans.app.security_agent.can_modify_library_item( user, roles, library_dataset )
- can_manage_library_dataset = trans.app.security_agent.can_manage_library_item( user, roles, library_dataset )
%>
-
- <tr class="datasetRow"
- %if parent is not None:
- parent="${parent}"
- style="display: none;"
+ %if current_version:
+ <tr class="datasetRow"
+ %if parent is not None:
+ parent="${parent}"
+ style="display: none;"
+ %endif
+ >
+ <td style="padding-left: ${pad+20}px;">
+ %if selected:
+ <input type="checkbox" name="ldda_ids" value="${ldda.id}" checked/>
+ %else:
+ <input type="checkbox" name="ldda_ids" value="${ldda.id}"/>
+ %endif
+ <a href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, info=True )}"><b>${ldda.name[:60]}</b></a>
+ <a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">▼</a>
+ <div popupmenu="dataset-${ldda.id}-popup">
+ %if can_modify_library_dataset:
+ <a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, edit_info=True )}">Edit this dataset's information</a>
+ %else:
+ <a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, information=True )}">View this dataset's information</a>
+ %endif
+ %if can_manage_library_dataset:
+ <a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
+ %endif
+ %if can_modify_library_dataset:
+ <a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, replace_id=library_dataset.id )}">Upload a new version of this dataset</a>
+ %endif
+ %if ldda.has_data:
+ <a class="action-button" href="${h.url_for( controller='library', action='datasets', library_id=library.id, ldda_ids=str( ldda.id ), do_action='add' )}">Import this dataset into your current history</a>
+ <a class="action-button" href="${h.url_for( controller='library', action='download_dataset_from_folder', id=ldda.id, library_id=library.id )}">Download this dataset</a>
+ %endif
+ </div>
+ </td>
+ <td>${ldda.message}</td>
+ <td>${uploaded_by}</td>
+ <td>${ldda.create_time.strftime( "%Y-%m-%d" )}</td>
+ </tr>
+ <%
+ my_row = row_counter.count
+ row_counter.increment()
+ %>
%endif
- >
- <td style="padding-left: ${pad+20}px;">
- %if selected:
- <input type="checkbox" name="ldda_ids" value="${ldda.id}" checked/>
- %else:
- <input type="checkbox" name="ldda_ids" value="${ldda.id}"/>
- %endif
- <a href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, info=True )}"><b>${ldda.name[:60]}</b></a>
- <a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">▼</a>
- <div popupmenu="dataset-${ldda.id}-popup">
- %if can_modify_library_dataset:
- <a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, edit_info=True )}">Edit this dataset's information</a>
- %else:
- <a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, information=True )}">View this dataset's information</a>
- %endif
- %if can_manage_library_dataset:
- <a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
- %endif
- %if current_version and can_modify_library_dataset:
- <a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, replace_id=library_dataset.id )}">Upload a new version of this dataset</a>
- %endif
- %if ldda.has_data:
- <a class="action-button" href="${h.url_for( controller='library', action='datasets', library_id=library.id, ldda_ids=str( ldda.id ), do_action='add' )}">Import this dataset into your current history</a>
- <a class="action-button" href="${h.url_for( controller='library', action='download_dataset_from_folder', id=ldda.id, library_id=library.id )}">Download this dataset</a>
- %endif
- </div>
- </td>
- <td>${ldda.message}</td>
- <td>${uploaded_by}</td>
- <td>${ldda.create_time.strftime( "%Y-%m-%d" )}</td>
- </tr>
- <%
- my_row = row_counter.count
- row_counter.increment()
- %>
</%def>
<%def name="render_folder( folder, folder_pad, created_ldda_ids, library_id, hidden_folder_ids, parent=None, row_counter=None, root_folder=False )">
diff -r 9d615c906e6c -r 8cbdd73ab68c templates/library/new_dataset.mako
--- a/templates/library/new_dataset.mako Fri Sep 18 22:41:11 2009 -0400
+++ b/templates/library/new_dataset.mako Sat Sep 19 00:25:14 2009 -0400
@@ -170,7 +170,7 @@
</div>
<div style="clear: both"></div>
<% folder = trans.app.model.LibraryFolder.get( folder_id ) %>
- %if widgets:
+ %if upload_option == 'upload_file' and widgets:
${render_template_info( folder, library_id, widgets )}
%endif
<div class="form-row">
diff -r 9d615c906e6c -r 8cbdd73ab68c test/base/twilltestcase.py
--- a/test/base/twilltestcase.py Fri Sep 18 22:41:11 2009 -0400
+++ b/test/base/twilltestcase.py Sat Sep 19 00:25:14 2009 -0400
@@ -980,8 +980,6 @@
different scope in the tool) cannot be properly tested when they both exist at the
same time.
"""
- # TODO: RC: enhance this so that all supported field types can be passed in
- # and tested. If nothing is passed, all fields are TextField.
self.home()
self.visit_url( "%s/forms/new" % self.url )
self.check_page_for_string( 'Create a new form definition' )
@@ -1253,21 +1251,13 @@
self.check_page_for_string( check_str )
self.home()
def add_library_dataset( self, filename, library_id, folder_id, folder_name, file_format='auto',
- dbkey='hg18', roles=[], message='', root=False, check_template_str1='', check_template_str2='',
- check_template_str3='' ):
+ dbkey='hg18', roles=[], message='', root=False, template_field_name1='', template_field_contents1='' ):
"""Add a dataset to a folder"""
filename = self.get_filename( filename )
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?upload_option=upload_file&library_id=%s&folder_id=%s&message=%s" % \
( self.url, library_id, folder_id, message ) )
self.check_page_for_string( 'Upload files' )
- # If we've been sent some template labels, make sure they are included in the upload form
- if check_template_str1:
- self.check_page_for_string( check_template_str1 )
- if check_template_str2:
- self.check_page_for_string( check_template_str2 )
- if check_template_str3:
- self.check_page_for_string( check_template_str3 )
tc.fv( "1", "folder_id", folder_id )
tc.formfile( "1", "file_data", filename )
tc.fv( "1", "file_format", file_format )
@@ -1275,6 +1265,9 @@
tc.fv( "1", "message", message.replace( '+', ' ' ) )
for role_id in roles:
tc.fv( "1", "roles", role_id ) # form field 7 is the select list named out_groups, note the buttons...
+ # Add template field contents, if any...
+ if template_field_name1:
+ tc.fv( "1", template_field_name1, template_field_contents1 )
tc.submit( "new_dataset_button" )
if root:
check_str = "Added 1 datasets to the library '%s' ( each is selected )." % folder_name
@@ -1347,7 +1340,7 @@
self.check_page_for_string( check_str )
self.home()
def upload_new_dataset_version( self, filename, library_id, folder_id, folder_name, library_dataset_id, ldda_name, file_format='auto',
- dbkey='hg18', message='', check_template_str1='', check_template_str2='', check_template_str3='' ):
+ dbkey='hg18', message='', template_field_name1='', template_field_contents1='' ):
"""Upload new version(s) of a dataset"""
self.home()
filename = self.get_filename( filename )
@@ -1356,40 +1349,32 @@
self.check_page_for_string( 'Upload files' )
self.check_page_for_string( 'You are currently selecting a new file to replace' )
self.check_page_for_string( ldda_name )
- # If we've been sent some template labels, make sure they are included in the upload form
- if check_template_str1:
- self.check_page_for_string( check_template_str1 )
- if check_template_str2:
- self.check_page_for_string( check_template_str2 )
- if check_template_str3:
- self.check_page_for_string( check_template_str3 )
tc.formfile( "1", "file_data", filename )
tc.fv( "1", "file_format", file_format )
tc.fv( "1", "dbkey", dbkey )
tc.fv( "1", "message", message.replace( '+', ' ' ) )
+ # Add template field contents, if any...
+ if template_field_name1:
+ tc.fv( "1", template_field_name1, template_field_contents1 )
tc.submit( "new_dataset_button" )
check_str = "Added 1 dataset versions to the library dataset '%s' in the folder '%s'." % ( ldda_name, folder_name )
self.check_page_for_string( check_str )
self.home()
def upload_new_dataset_versions( self, library_id, folder_id, folder_name, library_dataset_id, ldda_name, file_format='auto',
- dbkey='hg18', message='', check_template_str1='', check_template_str2='', check_template_str3='' ):
+ dbkey='hg18', message='', template_field_name1='', template_field_contents1='' ):
"""Upload new version(s) of a dataset using a directory of files"""
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?upload_option=upload_directory&library_id=%s&folder_id=%s&replace_id=%s" \
% ( self.url, library_id, folder_id, library_dataset_id ) )
self.check_page_for_string( 'Upload a directory of files' )
self.check_page_for_string( 'You are currently selecting a new file to replace' )
- # If we've been sent some template labels, make sure they are included in the upload form
- if check_template_str1:
- self.check_page_for_string( check_template_str1 )
- if check_template_str2:
- self.check_page_for_string( check_template_str2 )
- if check_template_str3:
- self.check_page_for_string( check_template_str3 )
tc.fv( "1", "file_format", file_format )
tc.fv( "1", "dbkey", dbkey )
tc.fv( "1", "message", message.replace( '+', ' ' ) )
tc.fv( "1", "server_dir", "library" )
+ # Add template field contents, if any...
+ if template_field_name1:
+ tc.fv( "1", template_field_name1, template_field_contents1 )
tc.submit( "new_dataset_button" )
check_str = "Added 3 dataset versions to the library dataset '%s' in the folder '%s'." % ( ldda_name, folder_name )
self.check_page_for_string( check_str )
@@ -1406,19 +1391,12 @@
self.check_page_for_string( check_str )
self.home()
def add_dir_of_files_from_admin_view( self, library_id, folder_id, file_format='auto', dbkey='hg18', roles_tuple=[],
- message='', check_str_after_submit='', check_str1='', check_str2='', check_str3='' ):
+ message='', check_str_after_submit='', template_field_name1='', template_field_contents1='' ):
"""Add a directory of datasets to a folder"""
# roles is a list of tuples: [ ( role_id, role_description ) ]
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?upload_option=upload_directory&library_id=%s&folder_id=%s" % ( self.url, library_id, folder_id ) )
self.check_page_for_string( 'Upload a directory of files' )
- # If we've been sent some template labels, make sure they are included in the upload form
- if check_str1:
- self.check_page_for_string( check_str1 )
- if check_str2:
- self.check_page_for_string( check_str2 )
- if check_str3:
- self.check_page_for_string( check_str3 )
tc.fv( "1", "folder_id", folder_id )
tc.fv( "1", "file_format", file_format )
tc.fv( "1", "dbkey", dbkey )
@@ -1426,24 +1404,20 @@
tc.fv( "1", "server_dir", "library" )
for role_tuple in roles_tuple:
tc.fv( "1", "roles", role_tuple[1] ) # role_tuple[1] is the role name
+ # Add template field contents, if any...
+ if template_field_name1:
+ tc.fv( "1", template_field_name1, template_field_contents1 )
tc.submit( "new_dataset_button" )
if check_str_after_submit:
self.check_page_for_string( check_str_after_submit )
self.home()
def add_dir_of_files_from_libraries_view( self, library_id, folder_id, selected_dir, file_format='auto', dbkey='hg18', roles_tuple=[],
- message='', check_str_after_submit='', check_str1='', check_str2='', check_str3='' ):
+ message='', check_str_after_submit='', template_field_name1='', template_field_contents1='' ):
"""Add a directory of datasets to a folder"""
# roles is a list of tuples: [ ( role_id, role_description ) ]
self.home()
self.visit_url( "%s/library/library_dataset_dataset_association?upload_option=upload_directory&library_id=%s&folder_id=%s" % ( self.url, library_id, folder_id ) )
self.check_page_for_string( 'Upload a directory of files' )
- # If we've been sent some template labels, make sure they are included in the upload form
- if check_str1:
- self.check_page_for_string( check_str1 )
- if check_str2:
- self.check_page_for_string( check_str2 )
- if check_str3:
- self.check_page_for_string( check_str3 )
tc.fv( "1", "folder_id", folder_id )
tc.fv( "1", "file_format", file_format )
tc.fv( "1", "dbkey", dbkey )
@@ -1451,6 +1425,9 @@
tc.fv( "1", "server_dir", selected_dir )
for role_tuple in roles_tuple:
tc.fv( "1", "roles", role_tuple[1] ) # role_tuple[1] is the role name
+ # Add template field contents, if any...
+ if template_field_name1:
+ tc.fv( "1", template_field_name1, template_field_contents1 )
tc.submit( "new_dataset_button" )
if check_str_after_submit:
self.check_page_for_string( check_str_after_submit )
diff -r 9d615c906e6c -r 8cbdd73ab68c test/functional/test_forms_and_requests.py
--- a/test/functional/test_forms_and_requests.py Fri Sep 18 22:41:11 2009 -0400
+++ b/test/functional/test_forms_and_requests.py Sat Sep 19 00:25:14 2009 -0400
@@ -41,7 +41,7 @@
global form_one_name
name = form_one_name
desc = "This is Form One's description"
- formtype = 'Sequencing Request Form'
+ formtype = galaxy.model.FormDefinition.types.REQUEST
self.create_form( name=name, desc=desc, formtype=formtype )
self.home()
self.visit_page( 'forms/manage' )
diff -r 9d615c906e6c -r 8cbdd73ab68c test/functional/test_security_and_libraries.py
--- a/test/functional/test_security_and_libraries.py Fri Sep 18 22:41:11 2009 -0400
+++ b/test/functional/test_security_and_libraries.py Sat Sep 19 00:25:14 2009 -0400
@@ -475,15 +475,23 @@
library_one.refresh()
self.rename_library( str( library_one.id ), library_one.name, name=name, description=description )
library_one.refresh()
- """
- def test_075_library_template_features( self ):
- Testing adding a template to a library, along with template features on the admin side
+ def test_075_library_template_features( self ):
+ """Testing adding a template to a library, then filling in the contents"""
# Make sure a form exists
- self.create_form( name='Form One', description='This is Form One' )
- current_form = galaxy.model.FormDefinitionCurrent.filter( galaxy.model.FormDefinitionCurrent.table.c.deleted==False ) \
- .order_by( desc( galaxy.model.FormDefinitionCurrent.table.c.create_time ) ).first()
+ form_name = 'Library template Form One'
+ form_desc = 'This is Form One'
+ form_type = galaxy.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE
+ self.create_form( name=form_name, desc=form_desc, formtype=form_type )
global form_one
- form_one = current_form.latest_form
+ form_one = None
+ fdcs = galaxy.model.FormDefinitionCurrent.filter( galaxy.model.FormDefinitionCurrent.table.c.deleted==False ) \
+ .order_by( galaxy.model.FormDefinitionCurrent.table.c.create_time.desc() ) \
+ .all()
+ for fdc in fdcs:
+ if form_name == fdc.latest_form.name:
+ form_one = fdc.latest_form
+ break
+ assert form_one is not None, 'Problem retrieving form named (%s) from the database' % form_name
# Add a new information template to the library
template_name = 'Library Template 1'
self.add_library_info_template( str( library_one.id ),
@@ -491,32 +499,46 @@
str( form_one.id ),
form_one.name )
# Make sure the template fields are displayed on the library information page
- self.home()
+ field_dict = form_one.fields[ 0 ]
+ global form_one_field_label
+ form_one_field_label = '%s' % str( field_dict.get( 'label', 'Field 0' ) )
+ global form_one_field_help
+ form_one_field_help = '%s' % str( field_dict.get( 'helptext', 'Field 0 help' ) )
+ global form_one_field_required
+ form_one_field_required = '%s' % str( field_dict.get( 'required', 'optional' ) ).capitalize()
+ # Add information to the library using the template
+ global form_one_field_name
+ form_one_field_name = 'field_0'
+ contents = '%s library contents' % form_one_field_label
self.visit_url( '%s/library_admin/library?id=%s&information=True' % ( self.url, str( library_one.id ) ) )
- num_fields = len( form_one.fields )
- for index in range( num_fields ):
- label_check_str = form_one.fields[ index ][ 'label' ]
- help_check_str = form_one.fields[ index ][ 'helptext' ]
- required_check_str = form_one.fields[ index ][ 'required' ].capitalize()
- self.check_page_for_string( label_check_str )
- self.check_page_for_string( help_check_str )
- self.check_page_for_string( required_check_str )
- # Add information to the library using the template
- for index in range( num_fields ):
- field_name = 'field_%i' % index
- contents = '%s contents' % form_one.fields[ index ][ 'label' ]
- # There are 2 forms on this page and the template is the 2nd form
- tc.fv( '2', field_name, contents )
+ # There are 2 forms on this page and the template is the 2nd form
+ tc.fv( '2', form_one_field_name, contents )
tc.submit( 'edit_info_button' )
- self.check_page_for_string ( 'The information has been updated.' )
- self.home()
- # TODO: add more testing for full feature coverage
- """
- def test_080_add_public_dataset_to_root_folder( self ):
- """Testing adding a public dataset to the root folder"""
+ # For some reason, the following check:
+ # self.check_page_for_string ( 'The information has been updated.' )
+ # ...throws the following exception - I have not idea why!
+ # self.check_page_for_string ( 'The information has been updated.' )
+ # TypeError: 'str' object is not callable
+ # The work-around is to not make ANY self.check_page_for_string() calls until the next method
+ def test_080_edit_template_contents_admin_view( self ):
+ """Test editing template contents on the admin side"""
+ # First make sure the templlate contents from the previous method were correctly saved
+ contents = '%s library contents' % form_one_field_label
+ contents_edited = contents + ' edited'
+ self.visit_url( '%s/library_admin/library?id=%s&information=True' % ( self.url, str( library_one.id ) ) )
+ self.check_page_for_string( contents )
+ # Edit the contents and then save them
+ tc.fv( '2', form_one_field_name, contents_edited )
+ tc.submit( 'edit_info_button' )
+ self.check_page_for_string( 'The information has been updated.' )
+ self.check_page_for_string( contents_edited )
+ def test_085_add_public_dataset_to_root_folder( self ):
+ """Testing adding a public dataset to the root folder, making sure library template is inherited"""
actions = [ v.action for k, v in galaxy.model.Library.permitted_actions.items() ]
actions.sort()
message = 'Testing adding a public dataset to the root folder'
+ # The form_one template should be inherited to the library dataset upload form.
+ template_contents = "%s contents for root folder 1.bed" % form_one_field_label
self.add_library_dataset( '1.bed',
str( library_one.id ),
str( library_one.root_folder.id ),
@@ -524,7 +546,9 @@
file_format='bed',
dbkey='hg18',
message=message.replace( ' ', '+' ),
- root=True )
+ root=True,
+ template_field_name1=form_one_field_name,
+ template_field_contents1=template_contents )
global ldda_one
ldda_one = galaxy.model.LibraryDatasetDatasetAssociation.query() \
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
@@ -550,17 +574,11 @@
if not dp.action == galaxy.model.Dataset.permitted_actions.DATASET_MANAGE_PERMISSIONS.action:
raise AssertionError( 'The DatasetPermissions.action for dataset id %d is "%s", but it should be "manage permissions"' \
% ( ldda_one.dataset.id, dp.action ) )
- ## TODO: temporarily eliminating templates until we have the new forms features done
- # Make sure the library template was inherited by the ldda
- """
+ # Make sure the library template contents were correctly saved
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
( self.url, str( library_one.id ), str( library_one.root_folder.id ), str( ldda_one.id ) ) )
- self.check_page_for_string( 'wind' )
- self.check_page_for_string( 'This is the wind component' )
- self.check_page_for_string( 'bag' )
- self.check_page_for_string( 'This is the bag component' )
- """
+ self.check_page_for_string( template_contents )
# Make sure other users can access the dataset from the Libraries view
self.logout()
self.login( email=regular_user2.email )
@@ -570,23 +588,6 @@
self.logout()
self.login( email=admin_user.email )
self.home()
- """
- ## TODO: temporarily eliminating templates until we have the new forms features done
- def test_085_editing_dataset_information( self ):
- Testing editing dataset template element information
- # Need the current library_item_info_element.id
- last_library_item_info_element = galaxy.model.LibraryItemInfoElement.query() \
- .order_by( desc( galaxy.model.LibraryItemInfoElement.table.c.id ) ).first()
- global ldda_one_ele_2_field_name
- ldda_one_ele_2_field_name = "info_element_%s" % str( last_library_item_info_element.id )
- ele_2_contents = 'pipe'
- global ldda_one_ele_1_field_name
- ldda_one_ele_1_field_name = "info_element_%s" % ( str( last_library_item_info_element.id - 1 ) )
- ele_1_contents = 'blown'
- self.edit_ldda_template_element_info( str( library_one.id ), str( library_one.root_folder.id ), str( ldda_one.id ),
- ldda_one.name, ldda_one_ele_1_field_name, ele_1_contents, ldda_one_ele_2_field_name, ele_2_contents )
- self.home()
- """
def test_090_add_new_folder_to_root_folder( self ):
"""Testing adding a folder to a library root folder"""
root_folder = library_one.root_folder
@@ -602,42 +603,25 @@
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( name )
self.check_page_for_string( description )
- ## TODO: temporarily eliminating templates until we have the new forms features done
- # Make sure the library template is inherited
- """
self.home()
self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( folder_one.id ), str( library_one.id ) ) )
- self.check_page_for_string( 'wind' )
- self.check_page_for_string( 'This is the wind component' )
- self.check_page_for_string( 'bag' )
- self.check_page_for_string( 'This is the bag component' )
- """
- self.home()
- """
- ## TODO: temporarily eliminating templates until we have the new forms features done
- def test_095_add_folder_template( self ):
- Testing adding a new folder template to a folder
- # Add a new information template to the folder
- template_name = 'Folder Template 1'
- ele_name_0 = 'Fu'
- ele_help_0 = 'This is the Fu component'.replace( ' ', '+' )
- ele_name_1 = 'Bar'
- ele_help_1 = 'This is the Bar component'.replace( ' ', '+' )
- self.home()
- self.add_folder_info_template( str( library_one.id ), library_one.name, str( folder_one.id ), folder_one.name,
- name=template_name, num_fields='2', ele_name_0=ele_name_0, ele_help_0=ele_help_0,
- ele_name_1=ele_name_1, ele_help_1=ele_help_1 )
- self.home()
- self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( folder_one.id ), str( library_one.id ) ) )
- self.check_page_for_string( ele_name_0 )
- check_str = ele_help_0.replace( '+', ' ' )
- self.check_page_for_string( check_str )
- self.check_page_for_string( ele_name_1 )
- check_str = ele_help_1.replace( '+', ' ' )
- self.check_page_for_string( check_str )
- self.home()
- """
- def test_100_add_subfolder_to_folder( self ):
+ # Make sure the template was inherited
+ self.check_page_for_string( form_one_field_name )
+ # Make sure the template contents were NOT inherited
+ contents = '%s library contents' % form_one_field_label
+ try:
+ self.check_page_for_string( contents )
+ raise AssertionError, "Library level template contents were displayed in the folders inherited template fields"
+ except:
+ pass
+ # Add contents to the inherited template
+ template_contents = "%s contents for Folder One" % form_one_field_label
+ # There are 2 forms on this page and the template is the 2nd form
+ tc.fv( '2', form_one_field_name, template_contents )
+ tc.submit( 'edit_info_button' )
+ self.check_page_for_string( 'The information has been updated.' )
+ self.check_page_for_string( template_contents )
+ def test_095_add_subfolder_to_folder( self ):
"""Testing adding a folder to a library folder"""
name = "Folder One's Subfolder"
description = "This is the Folder One's subfolder"
@@ -651,101 +635,25 @@
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( name )
self.check_page_for_string( description )
- ## TODO: temporarily eliminating templates until we have the new forms features done
- # Make sure the parent folder's template is inherited
self.home()
- """
- self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( folder_one.id ), str( library_one.id ) ) )
- self.check_page_for_string( 'Fu' )
- self.check_page_for_string( 'This is the Fu component' )
- self.check_page_for_string( 'Bar' )
- self.check_page_for_string( 'This is the Bar component' )
- # Make sure the library template is not inherited
+ self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( subfolder_one.id ), str( library_one.id ) ) )
+ # Make sure the template was inherited
+ self.check_page_for_string( form_one_field_name )
+ # Make sure the template contents were NOT inherited
+ contents = "%s contents for Folder One" % form_one_field_label
try:
- self.check_page_for_string( 'wind' )
- raise AssertionError( 'Library template inherited by folder when it should not have been.' )
+ self.check_page_for_string( contents )
+ raise AssertionError, "Parent folder level template contents were displayed in the sub-folders inherited template fields"
except:
pass
- self.home()
- """
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
- def test_105_add_template_element( self ):
- Testing adding a new element to an existing library template
- library_one_template.refresh()
- element_ids = []
- for ele in library_one_template.elements:
- element_ids.append( ele.id )
- element_ids.sort()
-
- name = 'Library Template 1 renamed'
- ele_field_name_1 = "element_name_%s" % element_ids[0]
- ele_name_1 = 'wind'
- ele_field_desc_1 = "element_description_%s" % element_ids[0]
- ele_desc_1 = 'This is the wind component'
- ele_field_name_2 = "element_name_%s" % element_ids[1]
- ele_name_2 = 'bag'
- ele_field_desc_2 = "element_description_%s" % element_ids[1]
- ele_desc_2 = 'This is the bag component'
- new_ele_name = 'Fubar'
- new_ele_desc = 'This is the Fubar component'
- self.add_library_info_template_element( str( library_one.id ),
- str( library_one_template.id ),
- library_one_template.name,
- ele_field_name_1,
- ele_name_1,
- ele_field_desc_1,
- ele_desc_1,
- ele_field_name_2,
- ele_name_2,
- ele_field_desc_2,
- ele_desc_2,
- new_ele_name=new_ele_name,
- new_ele_desc=new_ele_desc )
- # Make sure the new template element shows up on the existing library info page
- self.home()
- self.visit_url( '%s/library_admin/library?id=%s&information=True' % ( self.url, str( library_one.id ) ) )
- self.check_page_for_string( library_one.name )
- self.check_page_for_string( library_one.description )
- self.check_page_for_string( 'wind' )
- self.check_page_for_string( 'hello' )
- self.check_page_for_string( 'This is the wind component' )
- self.check_page_for_string( 'bag' )
- self.check_page_for_string( 'world' )
- self.check_page_for_string( 'This is the bag component' )
- self.check_page_for_string( 'Fubar' )
- self.check_page_for_string( 'This is the Fubar component' )
- # Make sure the new template element does not show up on existing info pages for folder_one since it has its own template
- self.home()
- self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( folder_one.id ), str( library_one.id ) ) )
- self.check_page_for_string( 'Fu' )
- self.check_page_for_string( 'This is the Fu component' )
- self.check_page_for_string( 'Bar' )
- self.check_page_for_string( 'This is the Bar component' )
- try:
- self.check_page_for_string( 'Fubar' )
- raise AssertionError( 'Changed library template inherited by folder "%s" when folder had an associated template of its own' )
- except:
- pass
- # Make sure the new template element shows up on existing info pages for ldda_one since it is contained in the root folder
- self.home()
- self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
- ( self.url, str( library_one.id ), str( folder_one.id ), str( ldda_one.id ) ) )
- # Visiting the above page will have resulted in the creation of a new LibraryItemInfoElement, so we'll retrieve it
- # for later use
- last_library_item_info_element = galaxy.model.LibraryItemInfoElement.query() \
- .order_by( desc( galaxy.model.LibraryItemInfoElement.table.c.id ) ).first()
- global ldda_one_ele_3_field_name
- ldda_one_ele_3_field_name = "info_element_%s" % str( last_library_item_info_element.id )
- self.check_page_for_string( 'wind' )
- self.check_page_for_string( 'This is the wind component' )
- self.check_page_for_string( 'bag' )
- self.check_page_for_string( 'This is the bag component' )
- self.check_page_for_string( 'Fubar' )
- self.check_page_for_string( 'This is the Fubar component' )
- self.home()
- """
- def test_110_add_2nd_new_folder_to_root_folder( self ):
+ # Add contents to the inherited template
+ template_contents = "%s contents for Folder One's Subfolder" % form_one_field_label
+ # There are 2 forms on this page and the template is the 2nd form
+ tc.fv( '2', form_one_field_name, template_contents )
+ tc.submit( 'edit_info_button' )
+ self.check_page_for_string( 'The information has been updated.' )
+ self.check_page_for_string( template_contents )
+ def test_100_add_2nd_new_folder_to_root_folder( self ):
"""Testing adding a 2nd folder to a library root folder"""
root_folder = library_one.root_folder
name = "Folder Two"
@@ -760,24 +668,24 @@
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( name )
self.check_page_for_string( description )
- ## TODO: temporarily eliminating templates until we have the new forms features done
- # Make sure the changed library template is inherited to the new folder
- """
self.home()
- self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( folder_two.id ), str( library_one.id ) ) )
- self.check_page_for_string( 'wind' )
- self.check_page_for_string( 'This is the wind component' )
- self.check_page_for_string( 'bag' )
- self.check_page_for_string( 'This is the bag component' )
- self.check_page_for_string( 'Fubar' )
- self.check_page_for_string( 'This is the Fubar component' )
- """
- self.home()
- def test_115_add_public_dataset_to_root_folders_2nd_subfolder( self ):
+ self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( subfolder_one.id ), str( library_one.id ) ) )
+ # Make sure the template was inherited
+ self.check_page_for_string( form_one_field_name )
+ # Make sure the template contents were NOT inherited
+ contents = '%s library contents' % form_one_field_label
+ try:
+ self.check_page_for_string( contents )
+ raise AssertionError, "Parent folder level template contents were displayed in the sub-folders inherited template fields"
+ except:
+ pass
+ def test_105_add_public_dataset_to_root_folders_2nd_subfolder( self ):
"""Testing adding a public dataset to the root folder's 2nd sub-folder"""
actions = [ v.action for k, v in galaxy.model.Library.permitted_actions.items() ]
actions.sort()
message = "Testing adding a public dataset to the folder named %s" % folder_two.name
+ # The form_one template should be inherited to the library dataset upload form.
+ template_contents = "%s contents for %s 2.bed" % ( form_one_field_label, folder_two.name )
self.add_library_dataset( '2.bed',
str( library_one.id ),
str( folder_two.id ),
@@ -785,7 +693,9 @@
file_format='bed',
dbkey='hg18',
message=message.replace( ' ', '+' ),
- root=False )
+ root=False,
+ template_field_name1=form_one_field_name,
+ template_field_contents1=template_contents )
global ldda_two
ldda_two = galaxy.model.LibraryDatasetDatasetAssociation.query() \
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
@@ -795,64 +705,18 @@
self.check_page_for_string( "2.bed" )
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
- def test_120_add_template_to_root_folders_2nd_subfolder( self ):
- Testing adding a template to the root folder's 2nd sub-folder
- # Before adding the folder template, the inherited library template should be displayed
- self.home()
- self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
- ( self.url, str( library_one.id ), str( folder_two.id ), str( ldda_two.id ) ) )
- self.check_page_for_string( 'wind' )
- self.check_page_for_string( 'This is the wind component' )
- self.check_page_for_string( 'bag' )
- self.check_page_for_string( 'This is the bag component' )
- self.check_page_for_string( 'Fubar' )
- self.check_page_for_string( 'This is the Fubar component' )
- self.home()
- # Add a new folde template
- template_name = 'Folder 2 Template'
- ele_name_0 = 'kill'
- ele_help_0 = 'This is the kill component'.replace( ' ', '+' )
- ele_name_1 = 'bill'
- ele_help_1 = 'This is the bill component'.replace( ' ', '+' )
- self.home()
- self.add_folder_info_template( str( library_one.id ), library_one.name, str( folder_two.id ), folder_two.name,
- name=template_name, num_fields='2', ele_name_0=ele_name_0, ele_help_0=ele_help_0,
- ele_name_1=ele_name_1, ele_help_1=ele_help_1 )
- # Make sure the new template id displayed on the folder information page
- self.home()
- self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( folder_two.id ), str( library_one.id ) ) )
- self.check_page_for_string( ele_name_0 )
- check_str = ele_help_0.replace( '+', ' ' )
- self.check_page_for_string( check_str )
- self.check_page_for_string( ele_name_1 )
- check_str = ele_help_1.replace( '+', ' ' )
- self.check_page_for_string( check_str )
- # The library dataset ldda_two had previously inherited the library template prior to the new folder template
- # being introduced, so the library template should still be displayed on the ldda information page
- self.home()
- self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
- ( self.url, str( library_one.id ), str( folder_two.id ), str( ldda_two.id ) ) )
- self.check_page_for_string( 'wind' )
- self.check_page_for_string( 'This is the wind component' )
- self.check_page_for_string( 'bag' )
- self.check_page_for_string( 'This is the bag component' )
- self.check_page_for_string( 'Fubar' )
- self.check_page_for_string( 'This is the Fubar component' )
- # Make sure the new folder template is not displayed
- try:
- self.check_page_for_string( 'kill' )
- raise AssertionError( 'New folder template elements incorrectly included in information page for ldda "%s"' % ldda_two.name )
- except:
- pass
- self.home()
- """
- def test_125_add_2nd_public_dataset_to_root_folders_2nd_subfolder( self ):
+ # Make sure the library template contents were correctly saved
+ self.home()
+ self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
+ ( self.url, str( library_one.id ), str( folder_two.id ), str( ldda_two.id ) ) )
+ self.check_page_for_string( template_contents )
+ def test_110_add_2nd_public_dataset_to_root_folders_2nd_subfolder( self ):
"""Testing adding a 2nd public dataset to the root folder's 2nd sub-folder"""
actions = [ v.action for k, v in galaxy.model.Library.permitted_actions.items() ]
actions.sort()
message = "Testing adding a 2nd public dataset to the folder named %s" % folder_two.name
+ # The form_one template should be inherited to the library dataset upload form.
+ template_contents = "%s contents for %s 3.bed" % ( form_one_field_label, folder_two.name )
self.add_library_dataset( '3.bed',
str( library_one.id ),
str( folder_two.id ),
@@ -860,7 +724,9 @@
file_format='bed',
dbkey='hg18',
message=message.replace( ' ', '+' ),
- root=False )
+ root=False,
+ template_field_name1=form_one_field_name,
+ template_field_contents1=template_contents )
global ldda_three
ldda_three = galaxy.model.LibraryDatasetDatasetAssociation.query() \
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
@@ -870,26 +736,12 @@
self.check_page_for_string( "3.bed" )
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
- def test_130_editing_dataset_information_with_new_folder_template( self ):
- Testing editing dataset template element information with new inherited folder template
- # Need the current library_item_info_element.id
- last_library_item_info_element = galaxy.model.LibraryItemInfoElement.query() \
- .order_by( desc( galaxy.model.LibraryItemInfoElement.table.c.id ) ).first()
- # Make sure the changed inherited template is included in the ldda information
- ele_2_field_name = "info_element_%s" % str( last_library_item_info_element.id )
- ele_2_contents = 'II'
- ele_2_help = 'This is the bill component'
- ele_1_field_name = "info_element_%s" % ( str( last_library_item_info_element.id - 1 ) )
- ele_1_contents = 'Volume'
- ele_1_help = 'This is the kill component'
- self.edit_ldda_template_element_info( str( library_one.id ), str( folder_two.id ), str( ldda_three.id ),
- ldda_three.name, ele_1_field_name, ele_1_contents, ele_2_field_name, ele_2_contents,
- ele_1_help=ele_1_help, ele_2_help=ele_2_help )
- self.home()
- """
- def test_135_add_dataset_with_private_role_restriction_to_folder( self ):
+ # Make sure the library template contents were correctly saved
+ self.home()
+ self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
+ ( self.url, str( library_one.id ), str( folder_two.id ), str( ldda_three.id ) ) )
+ self.check_page_for_string( template_contents )
+ def test_115_add_dataset_with_private_role_restriction_to_folder( self ):
"""Testing adding a dataset with a private role restriction to a folder"""
# Add a dataset restricted by the following:
# DATASET_MANAGE_PERMISSIONS = "test(a)bx.psu.edu" via DefaultUserPermissions
@@ -905,10 +757,8 @@
# setting is useless if test(a)bx.psu.edu is not an admin. This should be corrected,
# by displaying a warning message on the permissions form.
message ='This is a test of the fourth dataset uploaded'
- ele_name_0 = 'Fu'
- ele_name_1 = 'Bar'
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
+ # The form_one template should be inherited to the library dataset upload form.
+ template_contents = "%s contents for %s 4.bed" % ( form_one_field_label, folder_one.name )
self.add_library_dataset( '4.bed',
str( library_one.id ),
str( folder_one.id ),
@@ -918,18 +768,8 @@
roles=[ str( regular_user1_private_role.id ) ],
message=message.replace( ' ', '+' ),
root=False,
- check_template_str1=ele_name_0,
- check_template_str2=ele_name_1 )
- """
- self.add_library_dataset( '4.bed',
- str( library_one.id ),
- str( folder_one.id ),
- folder_one.name,
- file_format='bed',
- dbkey='hg18',
- roles=[ str( regular_user1_private_role.id ) ],
- message=message.replace( ' ', '+' ),
- root=False )
+ template_field_name1=form_one_field_name,
+ template_field_contents1=template_contents )
global ldda_four
ldda_four = galaxy.model.LibraryDatasetDatasetAssociation.query() \
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
@@ -940,7 +780,12 @@
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
self.home()
- def test_140_accessing_dataset_with_private_role_restriction( self ):
+ # Make sure the library template contents were correctly saved
+ self.home()
+ self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
+ ( self.url, str( library_one.id ), str( folder_one.id ), str( ldda_four.id ) ) )
+ self.check_page_for_string( template_contents )
+ def test_120_accessing_dataset_with_private_role_restriction( self ):
"""Testing accessing a dataset with a private role restriction"""
# admin_user should not be able to see 2.bed from the analysis view's access libraries
self.home()
@@ -998,7 +843,7 @@
self.logout()
self.login( email=admin_user.email )
self.home()
- def test_145_change_dataset_access_permission( self ):
+ def test_125_change_dataset_access_permission( self ):
"""Testing changing the access permission on a dataset with a private role restriction"""
# We need admin_user to be able to access 2.bed
permissions_in = [ k for k, v in galaxy.model.Dataset.permitted_actions.items() ] + \
@@ -1012,41 +857,15 @@
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( ldda_four.name )
self.home()
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
- def test_150_editing_restricted_datasets_information( self ):
- Testing editing a restricted library dataset's template element information
- ele_1_contents = ''
- ele_2_contents = ''
- ele_3_contents = 'Adding Fubar text'
- self.edit_ldda_template_element_info( str( library_one.id ), str( library_one.root_folder.id ), str( ldda_one.id ),
- ldda_one.name, ldda_one_ele_1_field_name, ele_1_contents, ldda_one_ele_2_field_name, ele_2_contents,
- ele_1_help='This is the wind component'.replace( ' ', '+' ),
- ele_2_help='This is the bag component'.replace( ' ', '+' ),
- ele_3_field_name=ldda_one_ele_3_field_name, ele_3_contents=ele_3_contents.replace( ' ', '+' ) )
- # Check the updated information from the libraries view
- self.home()
- self.visit_url( '%s/library/library_dataset_dataset_association?info=True&library_id=%s&folder_id=%s&id=%s' \
- % ( self.url, str( library_one.id ), str( library_one.root_folder.id ), str( ldda_one.id ) ) )
- self.check_page_for_string( ele_3_contents )
- try:
- self.check_page_for_string( 'blown' )
- raise AssertionError( 'Element contents were not correctly eliminated when the information was edited for ldda %s' % ldda_one.name)
- except:
- pass
- self.home()
- """
- def test_155_add_dataset_with_role_associated_with_group_and_users( self ):
+ def test_130_add_dataset_with_role_associated_with_group_and_users( self ):
"""Testing adding a dataset with a role that is associated with a group and users"""
self.login( email='test(a)bx.psu.edu' )
# Add a dataset restricted by role_two, which is currently associated as follows:
# groups: group_two
# users: test(a)bx.psu.edu, test1(a)bx.psu.edu via group_two
message = 'Testing adding a dataset with a role that is associated with a group and users'
- ele_name_0 = 'Fu'
- ele_name_1 = 'Bar'
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
+ # The form_one template should be inherited to the library dataset upload form.
+ template_contents = "%s contents for %s 5.bed" % ( form_one_field_label, folder_one.name )
self.add_library_dataset( '5.bed',
str( library_one.id ),
str( folder_one.id ),
@@ -1056,18 +875,8 @@
roles=[ str( role_two.id ) ],
message=message.replace( ' ', '+' ),
root=False,
- check_template_str1=ele_name_0,
- check_template_str2=ele_name_1 )
- """
- self.add_library_dataset( '5.bed',
- str( library_one.id ),
- str( folder_one.id ),
- folder_one.name,
- file_format='bed',
- dbkey='hg17',
- roles=[ str( role_two.id ) ],
- message=message.replace( ' ', '+' ),
- root=False )
+ template_field_name1=form_one_field_name,
+ template_field_contents1=template_contents )
global ldda_five
ldda_five = galaxy.model.LibraryDatasetDatasetAssociation.query() \
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
@@ -1078,7 +887,12 @@
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
self.home()
- def test_160_accessing_dataset_with_role_associated_with_group_and_users( self ):
+ # Make sure the library template contents were correctly saved
+ self.home()
+ self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
+ ( self.url, str( library_one.id ), str( folder_one.id ), str( ldda_five.id ) ) )
+ self.check_page_for_string( template_contents )
+ def test_135_accessing_dataset_with_role_associated_with_group_and_users( self ):
"""Testing accessing a dataset with a role that is associated with a group and users"""
# admin_user should be able to see 5.bed since she is associated with role_two
self.home()
@@ -1152,7 +966,7 @@
pass
self.logout()
self.login( email='test(a)bx.psu.edu' )
- def test_165_copy_dataset_from_history_to_subfolder( self ):
+ def test_140_copy_dataset_from_history_to_subfolder( self ):
"""Testing copying a dataset from the current history to a subfolder"""
self.new_history()
self.upload_file( "6.bed" )
@@ -1173,18 +987,19 @@
ldda_six = galaxy.model.LibraryDatasetDatasetAssociation.query() \
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_six is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_six from the database'
+ self.home()
# Make sure the correct template was inherited
- ## TODO: temporarily eliminating templates until we have the new forms features done
- self.home()
- """
- self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
- ( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ) ) )
- self.check_page_for_string( 'Fu' )
- self.check_page_for_string( 'This is the Fu component' )
- self.check_page_for_string( 'Bar' )
- self.check_page_for_string( 'This is the Bar component' )
- """
- def test_170_editing_dataset_attribute_info( self ):
+ self.visit_url( '%s/library/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s' \
+ % ( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ) ) )
+ self.check_page_for_string( form_one_field_name )
+ # Make sure the template contents were NOT inherited
+ contents = "%s contents for Folder One's Subfolder" % form_one_field_label
+ try:
+ self.check_page_for_string( contents )
+ raise AssertionError, "Parent folder template contents were displayed in the sub-folders inherited template fields"
+ except:
+ pass
+ def test_145_editing_dataset_attribute_info( self ):
"""Testing editing a datasets attribute information"""
new_ldda_name = '6.bed ( version 1 )'
self.edit_ldda_attribute_info( str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ), ldda_six.name, new_ldda_name )
@@ -1193,11 +1008,21 @@
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( ldda_six.name )
self.home()
- def test_175_uploading_new_dataset_version( self ):
+ # Make sure the template contents were NOT inherited
+ self.visit_url( '%s/library/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s' \
+ % ( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ) ) )
+ self.check_page_for_string( form_one_field_name )
+ contents = "%s contents for Folder One's Subfolder" % form_one_field_label
+ try:
+ self.check_page_for_string( contents )
+ raise AssertionError, "Parent folder template contents were displayed in the sub-folders inherited template fields"
+ except:
+ pass
+ def test_150_uploading_new_dataset_version( self ):
"""Testing uploading a new version of a dataset"""
message = 'Testing uploading a new version of a dataset'
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
+ # The form_one template should be inherited to the library dataset upload form.
+ template_contents = "%s contents for %s new version of 6.bed" % ( form_one_field_label, folder_one.name )
self.upload_new_dataset_version( '6.bed',
str( library_one.id ),
str( subfolder_one.id ),
@@ -1207,39 +1032,31 @@
file_format='auto',
dbkey='hg18',
message=message.replace( ' ', '+' ),
- check_template_str1='Fu',
- check_template_str2='Bar' )
- """
- self.upload_new_dataset_version( '6.bed',
- str( library_one.id ),
- str( subfolder_one.id ),
- str( subfolder_one.name ),
- str( ldda_six.library_dataset.id ),
- ldda_six.name,
- file_format='auto',
- dbkey='hg18',
- message=message.replace( ' ', '+' ) )
+ template_field_name1=form_one_field_name,
+ template_field_contents1=template_contents )
global ldda_six_version_two
ldda_six_version_two = galaxy.model.LibraryDatasetDatasetAssociation.query() \
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_six_version_two is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_six_version_two from the database'
self.home()
- self.visit_url( "%s/library_admin/library_dataset_dataset_association?info=True&library_id=%s&folder_id=%s&id=%s" % \
+ self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six_version_two.id ) ) )
self.check_page_for_string( 'This is the latest version of this library dataset' )
# Make sure the correct template was inherited
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
- self.check_page_for_string( 'Fu' )
- self.check_page_for_string( 'This is the Fu component' )
- self.check_page_for_string( 'Bar' )
- self.check_page_for_string( 'This is the Bar component' )
- check_str = 'Expired versions of %s' % ldda_six_version_two.name
- self.check_page_for_string( check_str )
- self.check_page_for_string( ldda_six.name )
- """
- self.home()
- # Make sure th permissions are the same
+ self.check_page_for_string( template_contents )
+ # Make sure it does not include any inherited contents
+ contents = "%s contents for Folder One's Subfolder" % form_one_field_label
+ try:
+ self.check_page_for_string( contents )
+ raise AssertionError, "Parent folder template contents were displayed in the sub-folders inherited template fields"
+ except:
+ pass
+ # There are 4 forms on this page and the template is the 4th form
+ tc.fv( '4', form_one_field_name, template_contents )
+ tc.submit( 'edit_info_button' )
+ self.check_page_for_string( 'The information has been updated.' )
+ self.check_page_for_string( template_contents )
+ # Make sure the permissions are the same
ldda_six.refresh()
if len( ldda_six.actions ) != len( ldda_six_version_two.actions ):
raise AssertionError( 'ldda "%s" actions "%s" != ldda "%s" actions "%s"' \
@@ -1256,47 +1073,55 @@
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ) ) )
self.check_page_for_string( 'This is an expired version of this library dataset' )
self.home()
- def test_180_uploading_new_dataset_versions( self ):
+ # Make sure ldda_six is no longer displayed in the library
+ self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
+ try:
+ self.check_page_for_string( ldda_six.name )
+ raise AssertionError, "Old version of library dataset %s is displayed in library" % ldda_six.name
+ except:
+ pass
+ self.home()
+ def test_155_uploading_new_dataset_versions( self ):
"""Testing uploading new versions of a dataset using a directory of files"""
message = 'Testing uploading new versions of a dataset using a directory of files'
+ # The form_one template should be inherited to the library dataset upload form.
+ template_contents = "%s contents for %s 5th new version of 6.bed" % ( form_one_field_label, folder_one.name )
ldda_six_version_two.refresh()
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
- self.upload_new_dataset_versions( str( library_one.id ),
- str( subfolder_one.id ),
- str( subfolder_one.name ),
- str( ldda_six_version_two.library_dataset.id ),
- ldda_six_version_two.name,
- file_format='auto',
- dbkey='hg18',
- message=message.replace( ' ', '+' ),
- check_template_str1='Fu',
- check_template_str2='Bar' )
- """
- self.upload_new_dataset_versions( str( library_one.id ),
- str( subfolder_one.id ),
- str( subfolder_one.name ),
- str( ldda_six_version_two.library_dataset.id ),
- ldda_six_version_two.name,
- file_format='auto',
- dbkey='hg18',
- message=message.replace( ' ', '+' ) )
+ self.upload_new_dataset_version( '6.bed',
+ str( library_one.id ),
+ str( subfolder_one.id ),
+ str( subfolder_one.name ),
+ str( ldda_six_version_two.library_dataset.id ),
+ ldda_six_version_two.name,
+ file_format='auto',
+ dbkey='hg18',
+ message=message.replace( ' ', '+' ),
+ template_field_name1=form_one_field_name,
+ template_field_contents1=template_contents )
global ldda_six_version_five
ldda_six_version_five = galaxy.model.LibraryDatasetDatasetAssociation.query() \
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_six_version_five is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_six_version_five from the database'
self.home()
- self.visit_url( "%s/library_admin/library_dataset_dataset_association?info=True&library_id=%s&folder_id=%s&id=%s" % \
+ self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six_version_five.id ) ) )
self.check_page_for_string( 'This is the latest version of this library dataset' )
# Make sure the correct template was inherited
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
- self.check_page_for_string( 'Fu' )
- self.check_page_for_string( 'This is the Fu component' )
- self.check_page_for_string( 'Bar' )
- self.check_page_for_string( 'This is the Bar component' )
- """
+ self.check_page_for_string( template_contents )
+ # Make sure it does not include any inherited contents
+ contents = "%s contents for Folder One's Subfolder" % form_one_field_label
+ try:
+ self.check_page_for_string( contents )
+ raise AssertionError, "Parent folder template contents were displayed in the sub-folders inherited template fields"
+ except:
+ pass
+ # There are 4 forms on this page and the template is the 4th form
+ tc.fv( '4', form_one_field_name, template_contents )
+ tc.submit( 'edit_info_button' )
+ self.check_page_for_string( 'The information has been updated.' )
+ self.check_page_for_string( template_contents )
+ self.visit_url( "%s/library_admin/library_dataset_dataset_association?info=True&library_id=%s&folder_id=%s&id=%s" % \
+ ( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six_version_five.id ) ) )
check_str = 'Expired versions of %s' % ldda_six_version_five.name
self.check_page_for_string( check_str )
self.check_page_for_string( ldda_six.name )
@@ -1318,32 +1143,24 @@
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six_version_two.id ) ) )
self.check_page_for_string( 'This is an expired version of this library dataset' )
self.home()
- def test_185_upload_directory_of_files_from_admin_view( self ):
+ def test_160_upload_directory_of_files_from_admin_view( self ):
"""Testing uploading a directory of files to a root folder from the Admin view"""
message = 'This is a test for uploading a directory of files'
+ template_contents = "%s contents for directory of 3 datasets in %s" % ( form_one_field_label, folder_one.name )
roles_tuple = [ ( str( role_one.id ), role_one.name ) ]
check_str = "Added 3 datasets to the library '%s' ( each is selected )." % library_one.root_folder.name
- ## TODO: temporarily eliminating templates until we have the new forms features done
- """
- self.add_dir_of_files_from_admin_view( str( library_one.id ),
- str( library_one.root_folder.id ),
- roles_tuple=roles_tuple,
- message=message.replace( '+', ' ' ),
- check_str=check_str,
- check_template_str1='wind',
- check_template_str2='bag',
- check_template_str3='Fubar' )
- """
self.add_dir_of_files_from_admin_view( str( library_one.id ),
str( library_one.root_folder.id ),
roles_tuple=roles_tuple,
- message=message.replace( '+', ' ' ) )
+ message=message.replace( '+', ' ' ),
+ template_field_name1=form_one_field_name,
+ template_field_contents1=template_contents )
self.home()
self.visit_page( 'library_admin/browse_library?id=%s' % ( str( library_one.id ) ) )
self.check_page_for_string( admin_user.email )
self.check_page_for_string( message )
self.home()
- def test_190_change_permissions_on_datasets_uploaded_from_library_dir( self ):
+ def test_165_change_permissions_on_datasets_uploaded_from_library_dir( self ):
"""Testing changing the permissions on datasets uploaded from a directory"""
# It would be nice if twill functioned such that the above test resulted in a
# form with the uploaded datasets selected, but it does not ( they're not checked ),
@@ -1451,7 +1268,7 @@
pass
check_edit_page2( latest_3_lddas )
self.home()
- def test_195_upload_directory_of_files_from_libraries_view( self ):
+ def test_170_upload_directory_of_files_from_libraries_view( self ):
"""Testing uploading a directory of files to a root folder from the Data Libraries view"""
# admin_user will not have the option sto upload a directory of files from the
# Libraries view since a sub-directory named the same as their email is not contained
@@ -1483,7 +1300,6 @@
str( library_one.root_folder.id ),
'run1',
check_str_after_submit=check_str_after_submit,
- check_str1=check_str1,
message=message.replace( '+', ' ' ) )
self.home()
self.visit_page( 'library/browse_library?id=%s' % ( str( library_one.id ) ) )
@@ -1492,7 +1308,8 @@
self.home()
self.logout()
self.login( email=admin_user.email )
- def test_200_mark_group_deleted( self ):
+
+ def test_175_mark_group_deleted( self ):
"""Testing marking a group as deleted"""
self.home()
self.visit_url( '%s/admin/groups' % self.url )
@@ -1506,13 +1323,13 @@
raise AssertionError( '%s incorrectly lost all members when it was marked as deleted.' % group_two.name )
if not group_two.roles:
raise AssertionError( '%s incorrectly lost all role associations when it was marked as deleted.' % group_two.name )
- def test_205_undelete_group( self ):
+ def test_180_undelete_group( self ):
"""Testing undeleting a deleted group"""
self.undelete_group( str( group_two.id ), group_two.name )
group_two.refresh()
if group_two.deleted:
raise AssertionError( '%s was not correctly marked as not deleted.' % group_two.name )
- def test_210_mark_role_deleted( self ):
+ def test_185_mark_role_deleted( self ):
"""Testing marking a role as deleted"""
self.home()
self.visit_url( '%s/admin/roles' % self.url )
@@ -1526,10 +1343,10 @@
raise AssertionError( '%s incorrectly lost all user associations when it was marked as deleted.' % role_two.name )
if not role_two.groups:
raise AssertionError( '%s incorrectly lost all group associations when it was marked as deleted.' % role_two.name )
- def test_215_undelete_role( self ):
+ def test_190_undelete_role( self ):
"""Testing undeleting a deleted role"""
self.undelete_role( str( role_two.id ), role_two.name )
- def test_220_mark_dataset_deleted( self ):
+ def test_195_mark_dataset_deleted( self ):
"""Testing marking a library dataset as deleted"""
self.home()
self.delete_library_item( str( library_one.id ), str( ldda_two.library_dataset.id ), ldda_two.name, library_item_type='library_dataset' )
@@ -1542,13 +1359,13 @@
except:
pass
self.home()
- def test_225_display_deleted_dataset( self ):
+ def test_200_display_deleted_dataset( self ):
"""Testing displaying deleted dataset"""
self.home()
self.visit_url( "%s/library_admin/browse_library?id=%s&show_deleted=True" % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( ldda_two.name )
self.home()
- def test_230_hide_deleted_dataset( self ):
+ def test_205_hide_deleted_dataset( self ):
"""Testing hiding deleted dataset"""
self.home()
self.visit_url( "%s/library_admin/browse_library?id=%s&show_deleted=False" % ( self.url, str( library_one.id ) ) )
@@ -1558,7 +1375,7 @@
except:
pass
self.home()
- def test_235_mark_folder_deleted( self ):
+ def test_210_mark_folder_deleted( self ):
"""Testing marking a library folder as deleted"""
self.home()
self.delete_library_item( str( library_one.id ), str( folder_two.id ), folder_two.name, library_item_type='folder' )
@@ -1570,7 +1387,7 @@
except:
pass
self.home()
- def test_240_mark_folder_undeleted( self ):
+ def test_215_mark_folder_undeleted( self ):
"""Testing marking a library folder as undeleted"""
self.home()
self.undelete_library_item( str( library_one.id ), str( folder_two.id ), folder_two.name, library_item_type='folder' )
@@ -1585,7 +1402,7 @@
except:
pass
self.home()
- def test_245_mark_library_deleted( self ):
+ def test_220_mark_library_deleted( self ):
"""Testing marking a library as deleted"""
self.home()
# First mark folder_two as deleted to further test state saving when we undelete the library
@@ -1595,7 +1412,7 @@
self.visit_page( 'library_admin/deleted_libraries' )
self.check_page_for_string( library_one.name )
self.home()
- def test_240_mark_library_undeleted( self ):
+ def test_225_mark_library_undeleted( self ):
"""Testing marking a library as undeleted"""
self.home()
self.undelete_library_item( str( library_one.id ), str( library_one.id ), library_one.name, library_item_type='library' )
@@ -1609,7 +1426,7 @@
except:
pass
self.home()
- def test_250_purge_user( self ):
+ def test_230_purge_user( self ):
"""Testing purging a user account"""
self.mark_user_deleted( user_id=self.security.encode_id( regular_user3.id ), email=regular_user3.email )
regular_user3.refresh()
@@ -1641,7 +1458,7 @@
role = galaxy.model.Role.get( ura.role_id )
if role.type != 'private':
raise AssertionError( 'UserRoleAssociations for user %s are not related with the private role.' % regular_user3.email )
- def test_255_manually_unpurge_user( self ):
+ def test_235_manually_unpurge_user( self ):
"""Testing manually un-purging a user account"""
# Reset the user for later test runs. The user's private Role and DefaultUserPermissions for that role
# should have been preserved, so all we need to do is reset purged and deleted.
@@ -1649,7 +1466,7 @@
regular_user3.purged = False
regular_user3.deleted = False
regular_user3.flush()
- def test_260_purge_group( self ):
+ def test_240_purge_group( self ):
"""Testing purging a group"""
group_id = str( group_two.id )
self.mark_group_deleted( group_id, group_two.name )
@@ -1664,7 +1481,7 @@
raise AssertionError( "Purging the group did not delete the GroupRoleAssociations for group_id '%s'" % group_id )
# Undelete the group for later test runs
self.undelete_group( group_id, group_two.name )
- def test_265_purge_role( self ):
+ def test_245_purge_role( self ):
"""Testing purging a role"""
role_id = str( role_two.id )
self.mark_role_deleted( role_id, role_two.name )
@@ -1689,14 +1506,14 @@
dp = galaxy.model.DatasetPermissions.filter( galaxy.model.DatasetPermissions.table.c.role_id == role_id ).all()
if dp:
raise AssertionError( "Purging the role did not delete the DatasetPermissionss for role_id '%s'" % role_id )
- def test_270_manually_unpurge_role( self ):
+ def test_250_manually_unpurge_role( self ):
"""Testing manually un-purging a role"""
# Manually unpurge, then undelete the role for later test runs
# TODO: If we decide to implement the GUI feature for un-purging a role, replace this with a method call
role_two.purged = False
role_two.flush()
self.undelete_role( str( role_two.id ), role_two.name )
- def test_275_purge_library( self ):
+ def test_255_purge_library( self ):
"""Testing purging a library"""
self.home()
self.delete_library_item( str( library_one.id ), str( library_one.id ), library_one.name, library_item_type='library' )
@@ -1732,7 +1549,7 @@
raise AssertionError( 'The library_dataset id %s named "%s" has not been marked as deleted.' % \
( str( library_dataset.id ), library_dataset.name ) )
check_folder( library_one.root_folder )
- def test_280_reset_data_for_later_test_runs( self ):
+ def test_260_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
##################
# Eliminate all non-private roles
1
0
21 Sep '09
details: http://www.bx.psu.edu/hg/galaxy/rev/5e78a1fd1351
changeset: 2723:5e78a1fd1351
user: guru
date: Fri Sep 18 15:48:06 2009 -0400
description:
Commenting out functional test for fastx_collapser tool as the order of sequences in the output seems to differ between 32 bit and 64 bit machines.
1 file(s) affected in this change:
tools/fastx_toolkit/fastx_collapser.xml
diffs (19 lines):
diff -r 6ed5f088a2ad -r 5e78a1fd1351 tools/fastx_toolkit/fastx_collapser.xml
--- a/tools/fastx_toolkit/fastx_collapser.xml Fri Sep 18 15:28:18 2009 -0400
+++ b/tools/fastx_toolkit/fastx_collapser.xml Fri Sep 18 15:48:06 2009 -0400
@@ -6,13 +6,14 @@
<param format="fastqsolexa,fasta" name="input" type="data" label="Library to collapse" />
</inputs>
+ <!-- The order of sequences in the test output differ between 32 bit and 64 bit machines.
<tests>
<test>
<param name="input" value="fasta_collapser1.fasta" />
<output name="output" file="fasta_collapser1.out" />
</test>
</tests>
-
+ -->
<outputs>
<data format="fasta" name="output" metadata_source="input" />
</outputs>
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/cb9b12f8e127
changeset: 2725:cb9b12f8e127
user: James Taylor <james(a)jamestaylor.org>
date: Fri Sep 18 16:07:17 2009 -0400
description:
Backed out changeset 4e93d6c5665b
1 file(s) affected in this change:
eggs.ini
diffs (18 lines):
diff -r 4e93d6c5665b -r cb9b12f8e127 eggs.ini
--- a/eggs.ini Fri Sep 18 15:59:19 2009 -0400
+++ b/eggs.ini Fri Sep 18 16:07:17 2009 -0400
@@ -57,12 +57,12 @@
MySQL_python = _5.0.67_static
python_lzo = _static
flup = .dev_r2311
-bx_python = _dev_r405b4a48b824
+bx_python = _dev_r4bf1f32e6b76
nose = .dev_r101
; source location, necessary for scrambling
[source]
-bx_python = http://bitbucket.org/james_taylor/bx-python/get/405b4a48b824.gz
+bx_python = http://bitbucket.org/james_taylor/bx-python/get/4bf1f32e6b76.bz2
Cheetah = http://voxel.dl.sourceforge.net/sourceforge/cheetahtemplate/Cheetah-1.0.tar…
DRMAA_python = http://gridengine.sunsource.net/files/documents/7/36/DRMAA-python-0.2.tar.gz
MySQL_python = http://superb-west.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python… http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.67.tar.gz
1
0
21 Sep '09
details: http://www.bx.psu.edu/hg/galaxy/rev/71dbd24649e4
changeset: 2727:71dbd24649e4
user: James Taylor <james(a)jamestaylor.org>
date: Fri Sep 18 21:04:58 2009 -0400
description:
Comment out references to track store from app.py
1 file(s) affected in this change:
lib/galaxy/app.py
diffs (21 lines):
diff -r 891e1e2a407d -r 71dbd24649e4 lib/galaxy/app.py
--- a/lib/galaxy/app.py Fri Sep 18 16:09:14 2009 -0400
+++ b/lib/galaxy/app.py Fri Sep 18 21:04:58 2009 -0400
@@ -1,7 +1,7 @@
import sys, os, atexit
from galaxy import config, jobs, util, tools, web
-from galaxy.tracks import store
+## from galaxy.tracks import store
from galaxy.web import security
import galaxy.model
import galaxy.datatypes.registry
@@ -69,7 +69,7 @@
self.job_queue = self.job_manager.job_queue
self.job_stop_queue = self.job_manager.job_stop_queue
# Track Store
- self.track_store = store.TrackStoreManager( self.config.track_store_path )
+ ## self.track_store = store.TrackStoreManager( self.config.track_store_path )
def shutdown( self ):
self.job_manager.shutdown()
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/9d615c906e6c
changeset: 2728:9d615c906e6c
user: Kanwei Li <kanwei(a)gmail.com>
date: Fri Sep 18 22:41:11 2009 -0400
description:
minor track typos
1 file(s) affected in this change:
lib/galaxy/web/controllers/tracks.py
diffs (30 lines):
diff -r 71dbd24649e4 -r 9d615c906e6c lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py Fri Sep 18 21:04:58 2009 -0400
+++ b/lib/galaxy/web/controllers/tracks.py Fri Sep 18 22:41:11 2009 -0400
@@ -4,7 +4,7 @@
Track browsers are currently transient -- nothing is stored to the database
when a browser is created. Building a browser consists of selecting a set
of datasets associated with the same dbkey to display. Once selected, jobs
-are started to create any neccesary indexes in the background, and the user
+are started to create any necessary indexes in the background, and the user
is redirected to the browser interface, which loads the appropriate datasets.
Problems
@@ -105,7 +105,7 @@
dbkey = dataset.dbkey
chrom_lengths = self._chroms( trans, dbkey )
if chrom_lengths is None:
- error( "No chromosome lengths file found for '%s'" )
+ error( "No chromosome lengths file found for '%s'" % dataset.name )
return trans.fill_template( 'tracks/browser.mako',
dataset_ids=dataset_ids,
tracks=tracks,
@@ -186,7 +186,7 @@
return dataset
# See if we can convert the dataset
if type not in dataset.get_converter_types():
- log.debug( "Converstion from '%s' to '%d' not possible", dataset.extension, type )
+ log.debug( "Conversion from '%s' to '%d' not possible", dataset.extension, type )
return None
# See if converted dataset already exists
converted_datasets = dataset.get_converted_files_by_type( type )
1
0
21 Sep '09
details: http://www.bx.psu.edu/hg/galaxy/rev/891e1e2a407d
changeset: 2726:891e1e2a407d
user: James Taylor <james(a)jamestaylor.org>
date: Fri Sep 18 16:09:14 2009 -0400
description:
Allow array_tree.py to still load with older bx (but track browser won't work)
1 file(s) affected in this change:
lib/galaxy/visualization/tracks/data/array_tree.py
diffs (15 lines):
diff -r cb9b12f8e127 -r 891e1e2a407d lib/galaxy/visualization/tracks/data/array_tree.py
--- a/lib/galaxy/visualization/tracks/data/array_tree.py Fri Sep 18 16:07:17 2009 -0400
+++ b/lib/galaxy/visualization/tracks/data/array_tree.py Fri Sep 18 16:09:14 2009 -0400
@@ -3,7 +3,10 @@
"""
import pkg_resources; pkg_resources.require( "bx-python" )
-from bx.arrays.array_tree import FileArrayTreeDict
+try:
+ from bx.arrays.array_tree import FileArrayTreeDict
+except:
+ pass
from math import floor, ceil, log
# Maybe this should be included in the datatype itself, so users can add their
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/4e93d6c5665b
changeset: 2724:4e93d6c5665b
user: Nate Coraor <nate(a)bx.psu.edu>
date: Fri Sep 18 15:59:19 2009 -0400
description:
Update bx egg
1 file(s) affected in this change:
eggs.ini
diffs (18 lines):
diff -r 5e78a1fd1351 -r 4e93d6c5665b eggs.ini
--- a/eggs.ini Fri Sep 18 15:48:06 2009 -0400
+++ b/eggs.ini Fri Sep 18 15:59:19 2009 -0400
@@ -57,12 +57,12 @@
MySQL_python = _5.0.67_static
python_lzo = _static
flup = .dev_r2311
-bx_python = _dev_r4bf1f32e6b76
+bx_python = _dev_r405b4a48b824
nose = .dev_r101
; source location, necessary for scrambling
[source]
-bx_python = http://bitbucket.org/james_taylor/bx-python/get/4bf1f32e6b76.bz2
+bx_python = http://bitbucket.org/james_taylor/bx-python/get/405b4a48b824.gz
Cheetah = http://voxel.dl.sourceforge.net/sourceforge/cheetahtemplate/Cheetah-1.0.tar…
DRMAA_python = http://gridengine.sunsource.net/files/documents/7/36/DRMAA-python-0.2.tar.gz
MySQL_python = http://superb-west.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python… http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.67.tar.gz
1
0
21 Sep '09
details: http://www.bx.psu.edu/hg/galaxy/rev/bed484895e2d
changeset: 2721:bed484895e2d
user: James Taylor <james(a)jamestaylor.org>
date: Fri Sep 18 15:15:39 2009 -0400
description:
More work on server side for tracks. Now uses converters instead of indexers. A wiggle to array_tree converter is provided. Still need to purge indexer stuff. This will not work without new bx egg (or likely at all)
12 file(s) affected in this change:
datatypes_conf.xml.sample
lib/galaxy/datatypes/converters/wiggle_to_array_tree_converter.py
lib/galaxy/datatypes/converters/wiggle_to_array_tree_converter.xml
lib/galaxy/tracks/__init__.py
lib/galaxy/tracks/messages.py
lib/galaxy/tracks/store.py
lib/galaxy/visualization/__init__.py
lib/galaxy/visualization/tracks/__init__.py
lib/galaxy/visualization/tracks/data/__init__.py
lib/galaxy/visualization/tracks/data/array_tree.py
lib/galaxy/web/controllers/tracks.py
static/scripts/trackster.js
diffs (626 lines):
diff -r 3f3712d36034 -r bed484895e2d datatypes_conf.xml.sample
--- a/datatypes_conf.xml.sample Fri Sep 18 15:18:57 2009 -0400
+++ b/datatypes_conf.xml.sample Fri Sep 18 15:15:39 2009 -0400
@@ -58,8 +58,9 @@
<datatype extension="blastxml" type="galaxy.datatypes.xml:BlastXml" display_in_upload="true"/>
<datatype extension="txtseq.zip" type="galaxy.datatypes.images:Txtseq" mimetype="application/zip" display_in_upload="true"/>
<datatype extension="wig" type="galaxy.datatypes.interval:Wiggle" display_in_upload="true">
- <indexer file="wiggle.xml" />
+ <converter file="wiggle_to_array_tree_converter.xml" target_datatype="array_tree"/>
</datatype>
+ <datatype extension="array_tree" type="galaxy.datatypes.data:Data" />
<!-- EMBOSS TOOLS -->
<datatype extension="acedb" type="galaxy.datatypes.data:Text"/>
<datatype extension="asn1" type="galaxy.datatypes.data:Text"/>
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/datatypes/converters/wiggle_to_array_tree_converter.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/converters/wiggle_to_array_tree_converter.py Fri Sep 18 15:15:39 2009 -0400
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+from __future__ import division
+
+import sys
+
+import pkg_resources; pkg_resources.require( "bx-python" )
+from bx.arrays.array_tree import *
+from bx.arrays.wiggle import IntervalReader
+
+def main():
+
+ input_fname = sys.argv[1]
+ out_fname = sys.argv[2]
+
+ reader = IntervalReader( open( input_fname ) )
+
+ # Fill array from wiggle
+ d = array_tree_dict_from_wiggle_reader( reader, {} )
+
+ for value in d.itervalues():
+ value.root.build_summary()
+
+ f = open( out_fname, "w" )
+ FileArrayTreeDict.dict_to_file( d, f )
+ f.close()
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/datatypes/converters/wiggle_to_array_tree_converter.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/converters/wiggle_to_array_tree_converter.xml Fri Sep 18 15:15:39 2009 -0400
@@ -0,0 +1,14 @@
+<tool id="INDEXER_Wiggle_0" name="Index Wiggle for Track Viewer">
+ <!-- Used internally to generate track indexes -->
+ <command interpreter="python">wiggle_to_array_tree_converter.py $input $output</command>
+ <inputs>
+ <page>
+ <param format="wiggle" name="input" type="data" label="Choose wiggle"/>
+ </page>
+ </inputs>
+ <outputs>
+ <data format="array_tree" name="output"/>
+ </outputs>
+ <help>
+ </help>
+</tool>
\ No newline at end of file
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/tracks/messages.py
--- a/lib/galaxy/tracks/messages.py Fri Sep 18 15:18:57 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-PENDING = "pending"
-NO_DATA = "no data"
-NO_CHROMOSOME = "no chromosome"
-DATA = "data"
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/tracks/store.py
--- a/lib/galaxy/tracks/store.py Fri Sep 18 15:18:57 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-import os
-import re
-from string import Template
-from galaxy.util import sanitize_text
-
-# extra mappings/escape to keep users from traversing around the
-# filesystem and wreaking havoc
-extra_mappings = { r"/": "__fs__", r"^manifest.tab$": "__manifest.tab__" }
-
-def sanitize_name( name ):
- name = sanitize_text( name )
- for key, value in extra_mappings.items():
- name = re.sub( key, value, name )
- return name
-
-class TemplateSubber( object ):
- def __init__(self, obj):
- self.obj = obj
- def get( self, key, default=None ):
- return getattr(self.obj, key, default)
- def __getitem__(self, key):
- return self.get(key)
-
-class TrackStoreManager( object ):
- def __init__(self, path=""):
- self.path = path
-
- def get( self, dataset ):
- s = Template(self.path)
- return TrackStore( path=s.substitute(TemplateSubber(dataset)) )
-
-class TrackStore( object ):
- MANIFEST_NAME = "manifest.tab"
-
- def __init__(self, path=""):
- self.path = path
-
- def get_manifest( self ):
- if not self.exists: raise self.DoesNotExist("TrackStore at %s does not exist." % self.path)
- manifest_path = os.path.join( self.path, self.MANIFEST_NAME )
- if os.path.exists( manifest_path ):
- manifest = {}
- for line in open( manifest_path ):
- line = line.rstrip("\n\r")
- fields = line.split("\t")
- manifest[fields[0]] = fields[1:]
- return manifest
- else:
- raise self.DoesNotExist( "Manifest for TrackStore object could not be found." )
-
- def get(self, chrom="chr1", resolution=None, **kwargs):
- if not self.exists: raise self.DoesNotExist("TrackStore at %s does not exist." % self.path)
- object_path = self._get_object_path( chrom, resolution )
- if os.path.exists( object_path ):
- return open( object_path, "rb" )
- else:
- try:
- return kwargs['default']
- except KeyError:
- raise self.DoesNotExist("TrackStore object at %s does not exist." % object_path )
-
- def set(self, chrom="chr1", resolution=None, data=None):
- if not self.exists: self._build_path( self.path )
- if not data: return
- object_path = self._get_object_path( chrom, resolution )
- fd = open( object_path, "wb" )
- fd.write( data )
- fd.close()
-
- def _get_object_path( self, chrom, resolution ):
- object_name = sanitize_name(chrom)
- if resolution: object_name += "_%d" % resolution
- return os.path.join( self.path, object_name )
-
- def _build_path( self, path ):
- try:
- os.mkdir( path )
- except OSError:
- self._build_path( os.path.dirname( path ) )
- os.mkdir( path )
-
- @property
- def exists(self):
- return os.path.exists( self.path )
-
- class DoesNotExist( Exception ):
- pass
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/visualization/__init__.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/visualization/__init__.py Fri Sep 18 15:15:39 2009 -0400
@@ -0,0 +1,3 @@
+"""
+Package for Galaxy visulization plugins.
+"""
\ No newline at end of file
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/visualization/tracks/__init__.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/visualization/tracks/__init__.py Fri Sep 18 15:15:39 2009 -0400
@@ -0,0 +1,3 @@
+"""
+Package for track style visulization using the trackster UI.
+"""
\ No newline at end of file
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/visualization/tracks/data/__init__.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/visualization/tracks/data/__init__.py Fri Sep 18 15:15:39 2009 -0400
@@ -0,0 +1,3 @@
+"""
+Package for track data providers
+"""
\ No newline at end of file
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/visualization/tracks/data/array_tree.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/visualization/tracks/data/array_tree.py Fri Sep 18 15:15:39 2009 -0400
@@ -0,0 +1,50 @@
+"""
+Array tree data provider for Galaxy track browser.
+"""
+
+import pkg_resources; pkg_resources.require( "bx-python" )
+from bx.arrays.array_tree import FileArrayTreeDict
+from math import floor, ceil, log
+
+# Maybe this should be included in the datatype itself, so users can add their
+# own types to the browser as long as they return the right format of data?
+
+# FIXME: Assuming block size is always 1000 for the moment
+BLOCK_SIZE = 1000
+
+class ArrayTreeDataProvider( object ):
+ def __init__( self, dataset ):
+ self.dataset = dataset
+ def get_data( self, chrom, start, end ):
+ start = int( start )
+ end = int( end )
+ level = int( ceil( log( end - start, BLOCK_SIZE ) ) ) - 1
+ print "!!!!", start, end, level
+ # Open the file
+ print self.dataset.file_name
+ d = FileArrayTreeDict( open( self.dataset.file_name ) )
+ # Get the right chromosome
+ try:
+ chrom_array_tree = d[chrom]
+ except KeyError:
+ return None
+ # Is the requested level valid?
+ assert 0 <= level <= chrom_array_tree.levels
+ # Calculate the actual start/range/step of the block we're getting
+ size = BLOCK_SIZE ** (level+1)
+ block_start = ( start // BLOCK_SIZE ) * BLOCK_SIZE
+ block_step = size // BLOCK_SIZE
+ indexes = range( block_start, block_start + size, block_step )
+ # Return either data point or a summary depending on the level
+ if level > 0:
+ s = chrom_array_tree.get_summary( start, level )
+ if s is not None:
+ return zip( indexes, map( float, s.sums / s.counts ) )
+ else:
+ return None
+ else:
+ v = chrom_array_tree.get_leaf( start )
+ if v is not None:
+ return zip( indexes, map( float, v ) )
+ else:
+ return None
\ No newline at end of file
diff -r 3f3712d36034 -r bed484895e2d lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py Fri Sep 18 15:18:57 2009 -0400
+++ b/lib/galaxy/web/controllers/tracks.py Fri Sep 18 15:15:39 2009 -0400
@@ -9,18 +9,44 @@
Problems
--------
- - Assumes that the only indexing type in Galaxy is for this particular
- application. Thus, datatypes can only have one indexer, and the presence
- of an indexer results in assuming that datatype can be displayed as a track.
-
+ - Only line tracks supported
+ - Resolutions are a bit wonky
+ - Must have a LEN file, not currently able to infer from data (not sure we
+ need to support that, but need to make user defined build support better)
"""
import math
-from galaxy.tracks import messages
from galaxy.util.json import to_json_string
from galaxy.web.base.controller import *
from galaxy.web.framework import simplejson
+from galaxy.util.bunch import Bunch
+
+from galaxy.visualization.tracks.data.array_tree import ArrayTreeDataProvider
+
+# Message strings returned to browser
+messages = Bunch(
+ PENDING = "pending",
+ NO_DATA = "no data",
+ NO_CHROMOSOME = "no chromosome",
+ DATA = "data"
+)
+
+# Dataset type required for each track type. This needs to be more flexible,
+# there might be mutliple types of indexes that suffice for a given track type.
+track_type_to_dataset_type = {
+ "line": "array_tree"
+}
+
+# Mapping from dataset type to a class that can fetch data from a file of that
+# type. This also needs to be more flexible.
+dataset_type_to_data_provider = {
+ "array_tree": ArrayTreeDataProvider
+}
+
+# FIXME: hardcoding this for now, but it should be derived from the available
+# converters
+browsable_types = set( ["wig" ] )
class TracksController( BaseController ):
"""
@@ -41,24 +67,26 @@
session = trans.sa_session
# If the user clicked the submit button explicately, try to build the browser
if browse and dataset_ids:
+ if not isinstance( dataset_ids, list ):
+ dataset_ids = [ dataset_ids ]
dataset_ids = ",".join( map( str, dataset_ids ) )
trans.response.send_redirect( web.url_for( controller='tracks', action='browser', chrom="", dataset_ids=dataset_ids ) )
- return
- # Determine the set of all dbkeys that are used in the current history
- dbkeys = [ d.metadata.dbkey for d in trans.get_history().datasets if not d.deleted ]
- dbkey_set = set( dbkeys )
- # If a dbkey argument was not provided, or is no longer valid, default
- # to the first one
- if dbkey is None or dbkey not in dbkey_set:
- dbkey = dbkeys[0]
- # Find all datasets in the current history that are of that dbkey and
- # have an indexer.
- datasets = {}
- for dataset in session.query( model.HistoryDatasetAssociation ).filter_by( deleted=False, history_id=trans.history.id ):
- if dataset.metadata.dbkey == dbkey and trans.app.datatypes_registry.get_indexers_by_datatype( dataset.extension ):
- datasets[dataset.id] = dataset.name
- # Render the template
- return trans.fill_template( "tracks/new_browser.mako", dbkey=dbkey, dbkey_set=dbkey_set, datasets=datasets )
+ else:
+ # Determine the set of all dbkeys that are used in the current history
+ dbkeys = [ d.metadata.dbkey for d in trans.get_history().datasets if not d.deleted ]
+ dbkey_set = set( dbkeys )
+ # If a dbkey argument was not provided, or is no longer valid, default
+ # to the first one
+ if dbkey is None or dbkey not in dbkey_set:
+ dbkey = dbkeys[0]
+ # Find all datasets in the current history that are of that dbkey
+ # and can be displayed
+ datasets = {}
+ for dataset in session.query( model.HistoryDatasetAssociation ).filter_by( deleted=False, history_id=trans.history.id ):
+ if dataset.metadata.dbkey == dbkey and dataset.extension in browsable_types:
+ datasets[dataset.id] = dataset.name
+ # Render the template
+ return trans.fill_template( "tracks/new_browser.mako", dbkey=dbkey, dbkey_set=dbkey_set, datasets=datasets )
@web.expose
def browser(self, trans, dataset_ids, chrom=""):
@@ -75,13 +103,15 @@
"id": dataset.id
} )
dbkey = dataset.dbkey
- LEN = self._chroms(trans, dbkey ).get(chrom,0)
+ chrom_lengths = self._chroms( trans, dbkey )
+ if chrom_lengths is None:
+ error( "No chromosome lengths file found for '%s'" )
return trans.fill_template( 'tracks/browser.mako',
dataset_ids=dataset_ids,
tracks=tracks,
chrom=chrom,
dbkey=dbkey,
- LEN=LEN )
+ LEN=chrom_lengths.get( chrom, 0 ) )
@web.json
def chroms(self, trans, dbkey=None ):
@@ -91,85 +121,86 @@
"""
Called by the browser to get a list of valid chromosomes and lengths
"""
+ # If there is any dataset in the history of extension `len`, this will
+ # use it
db_manifest = trans.db_dataset_for( dbkey )
if not db_manifest:
db_manifest = os.path.join( trans.app.config.tool_data_path, 'shared','ucsc','chrom', "%s.len" % dbkey )
else:
db_manifest = db_manifest.file_name
manifest = {}
- if os.path.exists( db_manifest ):
- for line in open( db_manifest ):
- if line.startswith("#"): continue
- line = line.rstrip("\r\n")
- fields = line.split("\t")
- manifest[fields[0]] = int(fields[1])
- else:
- # try to fake a manifest by reading track stores
- datasets = trans.app.model.HistoryDatasetAssociation.filter_by(deleted=False, history_id=trans.history.id).all()
- for dataset in datasets:
- if not dataset.metadata.dbkey == dbkey: continue
- track_store = trans.app.track_store.get( dataset )
- if track_store.exists:
- try:
- for chrom, fields in track_store.get_manifest().items():
- manifest[chrom] = max(manifest.get(chrom, 0), int(fields[0]))
- except track_store.DoesNotExist:
- pass
+ if not os.path.exists( db_manifest ):
+ return None
+ for line in open( db_manifest ):
+ if line.startswith("#"): continue
+ line = line.rstrip("\r\n")
+ fields = line.split("\t")
+ manifest[fields[0]] = int(fields[1])
return manifest
-
- @web.json
- def data( self, trans, dataset_id, chrom="", low="", high="" ):
+
+ @web.json
+ def data( self, trans, dataset_id, track_type, chrom, low, high ):
"""
Called by the browser to request a block of data
"""
+ # Load the requested dataset
dataset = trans.app.model.HistoryDatasetAssociation.get( dataset_id )
- if not dataset: return messages.NO_DATA
+ # No dataset for that id
+ if not dataset:
+ return messages.NO_DATA
+ # Dataset is in error state, can't display
if dataset.state == trans.app.model.Job.states.ERROR:
return messages.NO_DATA
- if not dataset.state == trans.app.model.Job.states.OK:
+ # Dataset is still being generated
+ if dataset.state != trans.app.model.Job.states.OK:
return messages.PENDING
- track_store = trans.app.track_store.get( dataset )
- if not track_store.exists:
- # Test if we can make a track
- indexers = trans.app.datatypes_registry.get_indexers_by_datatype( dataset.extension )
- if indexers:
- tool = indexers[0] # They are sorted by class chain so use the top one
- # If we can, return pending and launch job
- job = trans.app.model.Job()
- job.session_id = trans.get_galaxy_session().id
- job.history_id = trans.history.id
- job.tool_id = tool.id
- job.tool_version = "1.0.0"
- job.add_input_dataset( "input_dataset", dataset )
- job.add_parameter( "input_dataset", to_json_string( dataset.id ) )
- # This is odd
- # job.add_output_dataset( "input_dataset", dataset )
- # create store path, this is rather unclear?
- track_store.set()
- job.add_parameter( "store_path", to_json_string( track_store.path ) )
- job.flush()
- trans.app.job_manager.job_queue.put( job.id, tool )
- return messages.PENDING
- else:
- return messages.NO_DATA
- else:
- # Data for that chromosome or resolution does not exist?
- # HACK: we're "pending" because the store exists without a manifest
- try:
- track_store.get_manifest()
- except track_store.DoesNotExist:
- return messages.PENDING
- if chrom and low and high:
- low = math.floor(float(low))
- high = math.ceil(float(high))
- resolution = dataset.datatype.get_track_resolution( dataset, low, high )
- try:
- data = track_store.get( chrom, resolution )
- except track_store.DoesNotExist:
- return messages.NO_DATA
- window = dataset.datatype.get_track_window( dataset, data, low, high )
- glob = {"data":window, "type":dataset.datatype.get_track_type()};
- if resolution: glob["resolution"] = resolution
- return window
- else:
- return messages.DATA
+ # Determine what to return based on the type of track being drawn.
+ converted_dataset_type = track_type_to_dataset_type[track_type]
+ converted_dataset = self.__dataset_as_type( trans, dataset, converted_dataset_type )
+ # If at this point we still don't have an `array_tree_dataset`, there
+ # is now way we can display this data as an array tree
+ if converted_dataset is None:
+ return messages.NO_DATA
+ # Need to check states again for the converted version
+ if converted_dataset.state == model.Dataset.states.ERROR:
+ return messages.NO_DATA
+ if converted_dataset.state != model.Dataset.states.OK:
+ return messages.PENDING
+ # We have a dataset in the right format that is ready to use, wrap in
+ # a data provider that knows how to access it
+ data_provider = dataset_type_to_data_provider[ converted_dataset_type ]( converted_dataset )
+ # Get the requested chunk of data
+ data = data_provider.get_data( chrom, low, high )
+ # Pack into a dictionary and return
+ return data
+
+ def __dataset_as_type( self, trans, dataset, type ):
+ """
+ Given a dataset, try to find a way to adapt it to a different type. If the
+ dataset is already of that type it is returned, if it can be converted a
+ converted dataset (possibly new) is returned, if it cannot be converted,
+ None is returned.
+ """
+ # Already of correct type
+ if dataset.extension == type:
+ return dataset
+ # See if we can convert the dataset
+ if type not in dataset.get_converter_types():
+ log.debug( "Converstion from '%s' to '%d' not possible", dataset.extension, type )
+ return None
+ # See if converted dataset already exists
+ converted_datasets = dataset.get_converted_files_by_type( type )
+ if converted_datasets:
+ for d in converted_datasets:
+ if d and d.state != 'error':
+ return d
+ # Conversion is possible but doesn't exist yet, run converter here
+ # FIXME: this is largely duplicated from DefaultToolAction
+ assoc = model.ImplicitlyConvertedDatasetAssociation( parent = dataset, file_type = type, metadata_safe = False )
+ new_dataset = dataset.datatype.convert_dataset( trans, dataset, type, return_output = True, visible = False ).values()[0]
+ new_dataset.hid = dataset.hid # Hrrmmm....
+ new_dataset.name = dataset.name
+ new_dataset.flush()
+ assoc.dataset = new_dataset
+ assoc.flush()
+ return new_dataset
diff -r 3f3712d36034 -r bed484895e2d static/scripts/trackster.js
--- a/static/scripts/trackster.js Fri Sep 18 15:18:57 2009 -0400
+++ b/static/scripts/trackster.js Fri Sep 18 15:15:39 2009 -0400
@@ -1,4 +1,8 @@
var DENSITY = 1000;
+
+var BLOCK_SIZE = 1000;
+
+var log = function( x, b ) { return Math.log( x ) / Math.log( b ) }
var View = function( chr, length, low, high ) {
this.chr = chr;
@@ -83,9 +87,12 @@
high = this.view.high,
range = high - low;
- var resolution = Math.pow( 10, Math.ceil( Math.log( range / DENSITY ) / Math.log( 10 ) ) );
+ var resolution = Math.pow( BLOCK_SIZE, Math.floor( log( range, BLOCK_SIZE ) ) );
+ // Math.pow( 10, Math.ceil( Math.log( range / DENSITY ) / Math.log( 10 ) ) );
+
+ console//.log( "resolution:", resolution );
resolution = Math.max( resolution, 1 );
- resolution = Math.min( resolution, 100000 );
+ resolution = Math.min( resolution, 1000000 );
var parent_element = $("<div style='position: relative;'></div>");
this.content_div.children( ":first" ).remove();
@@ -155,7 +162,7 @@
// use closure to preserve this and parameters for getJSON
var fetcher = function (ref) {
return function () {
- $.getJSON( TRACKSTER_DATA_URL + ref.type, { chrom: ref.view.chr, low: low, high: high, dataset_id: ref.track.dataset_id }, function ( data ) {
+ $.getJSON( TRACKSTER_DATA_URL, { track_type: ref.type, chrom: ref.view.chr, low: low, high: high, dataset_id: ref.track.dataset_id }, function ( data ) {
if( data == "pending" ) {
setTimeout( fetcher, 5000 );
} else {
@@ -175,7 +182,7 @@
Track.call( this, name, view, parent_element );
this.container_div.addClass( "line-track" );
this.dataset_id = dataset_id;
- this.cache = new DataCache( "", this, view );
+ this.cache = new DataCache( "line", this, view );
};
$.extend( LineTrack.prototype, TiledTrack.prototype, {
make_container: function () {
@@ -209,35 +216,37 @@
var canvas = element;
canvas.get(0).width = canvas.width();
canvas.get(0).height = canvas.height();
- var ctx = canvas.get(0).getContext("2d");
- var in_path = false;
- ctx.beginPath();
- var data = chunk.values;
- for ( var i = 0; i < data.length - 1; i++ ) {
- var x1 = data[i][0] - tile_low;
- var y1 = data[i][1];
- var x2 = data[i+1][0] - tile_low;
- var y2 = data[i+1][1];
- console.log( x1, y1, x2, y2 );
- // Missing data causes us to stop drawing
- if ( isNaN( y1 ) || isNaN( y2 ) ) {
- in_path = false;
- } else {
- // Translate
- x1 = x1 * w_scale;
- x2 = x2 * w_scale;
- y1 = h_scale - y1 * ( h_scale );
- y2 = h_scale - y2 * ( h_scale );
- if ( in_path ) {
- ctx.lineTo( x1, y1, x2, y2 );
- } else {
- ctx.moveTo( x1, y1, x2, y2 );
- in_path = true;
- }
- }
- }
- ctx.stroke();
- return element;
+ var data = chunk.values;
+ if ( data ) {
+ var ctx = canvas.get(0).getContext("2d");
+ var in_path = false;
+ ctx.beginPath();
+ // console.log( "Drawing tile" );
+ for ( var i = 0; i < data.length - 1; i++ ) {
+ var x1 = data[i][0] - tile_low;
+ var y1 = data[i][1];
+ var x2 = data[i+1][0] - tile_low;
+ var y2 = data[i+1][1];
+ // Missing data causes us to stop drawing
+ if ( isNaN( y1 ) || isNaN( y2 ) ) {
+ in_path = false;
+ } else {
+ // Translate
+ x1 = x1 * w_scale;
+ x2 = x2 * w_scale;
+ y1 = h_scale - y1 * ( h_scale );
+ y2 = h_scale - y2 * ( h_scale );
+ if ( in_path ) {
+ ctx.lineTo( x1, y1, x2, y2 );
+ } else {
+ ctx.moveTo( x1, y1, x2, y2 );
+ in_path = true;
+ }
+ }
+ }
+ ctx.stroke();
+ }
+ return element;
}
});
1
0
21 Sep '09
details: http://www.bx.psu.edu/hg/galaxy/rev/6ed5f088a2ad
changeset: 2722:6ed5f088a2ad
user: guru
date: Fri Sep 18 15:28:18 2009 -0400
description:
Fixed a bug in fasta_formatter tool test case, which was causing the functional tests to fail.
1 file(s) affected in this change:
tools/fastx_toolkit/fasta_formatter.xml
diffs (12 lines):
diff -r bed484895e2d -r 6ed5f088a2ad tools/fastx_toolkit/fasta_formatter.xml
--- a/tools/fastx_toolkit/fasta_formatter.xml Fri Sep 18 15:15:39 2009 -0400
+++ b/tools/fastx_toolkit/fasta_formatter.xml Fri Sep 18 15:28:18 2009 -0400
@@ -21,7 +21,7 @@
<!-- Re-format a FASTA file into a single line -->
<param name="input" value="fasta_formatter1.fasta" />
<param name="width" value="0" />
- <output name="output" file="fastx_formatter1.out" />
+ <output name="output" file="fasta_formatter1.out" />
</test>
<test>
<!-- Re-format a FASTA file into multiple lines wrapping at 60 charactes -->
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/3f3712d36034
changeset: 2720:3f3712d36034
user: rc
date: Fri Sep 18 15:18:57 2009 -0400
description:
Galaxy AMQP Listener, first pass
Added a check for testing completed requests in Requests functional tests
7 file(s) affected in this change:
lib/galaxy/web/controllers/requests_admin.py
lib/galaxy/web/framework/helpers/grids.py
run_galaxy_listener.sh
scripts/galaxy_messaging/amqp_consumer.py
scripts/galaxy_messaging/galaxydb_interface.py
test/functional/test_forms_and_requests.py
universe_wsgi.ini.sample
diffs (300 lines):
diff -r 7f18940a4821 -r 3f3712d36034 lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Fri Sep 18 14:21:59 2009 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Fri Sep 18 15:18:57 2009 -0400
@@ -98,7 +98,6 @@
else:
self.request_grid.default_filter = dict(state=kwargs['show_filter'], deleted=False)
self.request_grid.show_filter = kwargs.get('show_filter', trans.app.model.Request.states.SUBMITTED)
- self.__update_request_state(trans)
# Render the list view
return self.request_grid( trans, **kwargs )
@web.expose
@@ -980,12 +979,6 @@
request_id=request.id,
msg='Bar codes has been saved for this request',
messagetype='done'))
-
- def __update_request_state(self, trans):
- requests = trans.app.model.Request.query.filter_by(deleted=False,
- state=trans.app.model.Request.states.SUBMITTED)
- for request in requests:
- self.__set_request_state(request)
def __set_request_state(self, request):
# check if all the samples of the current request are in the final state
diff -r 7f18940a4821 -r 3f3712d36034 lib/galaxy/web/framework/helpers/grids.py
--- a/lib/galaxy/web/framework/helpers/grids.py Fri Sep 18 14:21:59 2009 -0400
+++ b/lib/galaxy/web/framework/helpers/grids.py Fri Sep 18 15:18:57 2009 -0400
@@ -121,7 +121,7 @@
return None
def build_initial_query( self, session ):
return session.query( self.model_class )
- def apply_default_filter( self, trans, query ):
+ def apply_default_filter( self, trans, query, **kwargs):
return query
class GridColumn( object ):
diff -r 7f18940a4821 -r 3f3712d36034 run_galaxy_listener.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/run_galaxy_listener.sh Fri Sep 18 15:18:57 2009 -0400
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+python scripts/galaxy_messaging/amqp_consumer.py
\ No newline at end of file
diff -r 7f18940a4821 -r 3f3712d36034 scripts/galaxy_messaging/amqp_consumer.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/galaxy_messaging/amqp_consumer.py Fri Sep 18 15:18:57 2009 -0400
@@ -0,0 +1,68 @@
+from amqplib import client_0_8 as amqp
+import ConfigParser
+import sys
+import optparse
+import xml.dom.minidom
+from galaxydb_interface import GalaxyDbInterface
+
+galaxy_config_file = 'universe_wsgi.ini'
+global dbconnstr
+
+def get_value(dom, tag_name):
+ '''
+ This method extracts the tag value from the xml message
+ '''
+ nodelist = dom.getElementsByTagName(tag_name)[0].childNodes
+ rc = ""
+ for node in nodelist:
+ if node.nodeType == node.TEXT_NODE:
+ rc = rc + node.data
+ return rc
+
+def recv_callback(msg):
+ #print 'Received: ' + msg.body + ' from channel #' + str(msg.channel.channel_id)
+ dom = xml.dom.minidom.parseString(msg.body)
+ barcode = get_value(dom, 'barcode')
+ state = get_value(dom, 'state')
+ print barcode, state
+ # update the galaxy db
+ galaxy = GalaxyDbInterface(dbconnstr)
+ sample_id = galaxy.get_sample_id(field_name='bar_code', value=barcode)
+ if sample_id == -1:
+ print 'Invalid barcode.'
+ return
+ galaxy.change_state(sample_id, state)
+
+def main():
+ config = ConfigParser.ConfigParser()
+ config.read(galaxy_config_file)
+ global dbconnstr
+ dbconnstr = config.get("app:main", "database_connection")
+ amqp_config = {}
+ for option in config.options("galaxy:amqp"):
+ amqp_config[option] = config.get("galaxy:amqp", option)
+ print amqp_config
+ conn = amqp.Connection(host=amqp_config['host']+":"+amqp_config['port'],
+ userid=amqp_config['userid'],
+ password=amqp_config['password'],
+ virtual_host=amqp_config['virtual_host'],
+ insist=False)
+ chan = conn.channel()
+ chan.queue_declare(queue=amqp_config['queue'], durable=True, exclusive=True, auto_delete=False)
+ chan.exchange_declare(exchange=amqp_config['exchange'], type="direct", durable=True, auto_delete=False,)
+ chan.queue_bind(queue=amqp_config['queue'],
+ exchange=amqp_config['exchange'],
+ routing_key=amqp_config['routing_key'])
+
+ chan.basic_consume(queue=amqp_config['queue'],
+ no_ack=True,
+ callback=recv_callback,
+ consumer_tag="testtag")
+ while True:
+ chan.wait()
+ chan.basic_cancel("testtag")
+ chan.close()
+ conn.close()
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff -r 7f18940a4821 -r 3f3712d36034 scripts/galaxy_messaging/galaxydb_interface.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/galaxy_messaging/galaxydb_interface.py Fri Sep 18 15:18:57 2009 -0400
@@ -0,0 +1,141 @@
+#/usr/bin/python
+
+from sqlalchemy import *
+from sqlalchemy.orm import sessionmaker
+from datetime import datetime, timedelta
+import sys
+import optparse
+import os
+import time
+import logging
+
+logging.basicConfig(level=logging.DEBUG)
+log = logging.getLogger( 'GalaxyDbInterface' )
+
+class GalaxyDbInterface(object):
+
+ def __init__(self, dbstr):
+ self.dbstr = dbstr
+ self.db_engine = create_engine(self.dbstr)
+# self.db_engine.echo = True
+ self.metadata = MetaData(self.db_engine)
+ self.session = sessionmaker(bind=self.db_engine)
+ self.event_table = Table('sample_event', self.metadata, autoload=True )
+ self.sample_table = Table('sample', self.metadata, autoload=True )
+ self.request_table = Table('request', self.metadata, autoload=True )
+ self.state_table = Table('sample_state', self.metadata, autoload=True )
+
+ def get_sample_id(self, field_name='bar_code', value=None):
+ if not value:
+ return -1
+ sample_id = -1
+ if field_name =='name':
+ stmt = select(columns=[self.sample_table.c.id],
+ whereclause=self.sample_table.c.name==value)
+ result = stmt.execute()
+ sample_id = result.fetchone()[0]
+ elif field_name == 'bar_code':
+ stmt = select(columns=[self.sample_table.c.id],
+ whereclause=self.sample_table.c.bar_code==value)
+ result = stmt.execute()
+ x = result.fetchone()
+ if x:
+ sample_id = x[0]
+ log.debug('Sample ID: %i' % sample_id)
+ return sample_id
+ log.warning('This sample %s %s does not belong to any sample in the database.' % (field_name, value))
+ return -1
+
+ def current_state(self, sample_id):
+ '''
+ This method returns the current state of the sample for the given sample_id
+ '''
+ stmt = select(columns=[self.event_table.c.sample_state_id],
+ whereclause=self.event_table.c.sample_id==sample_id,
+ order_by=self.event_table.c.update_time.desc())
+ result = stmt.execute()
+ all_states = result.fetchall()
+ current_state_id = all_states[0][0]
+ return current_state_id
+
+ def all_possible_states(self, sample_id):
+ subsubquery = select(columns=[self.sample_table.c.request_id],
+ whereclause=self.sample_table.c.id==sample_id)
+ self.request_id = subsubquery.execute().fetchall()[0][0]
+ log.debug('REQUESTID: %i' % self.request_id)
+ subquery = select(columns=[self.request_table.c.request_type_id],
+ whereclause=self.request_table.c.id==self.request_id)
+ request_type_id = subquery.execute().fetchall()[0][0]
+ log.debug('REQUESTTYPEID: %i' % request_type_id)
+ query = select(columns=[self.state_table.c.id, self.state_table.c.name],
+ whereclause=self.state_table.c.request_type_id==request_type_id,
+ order_by=self.state_table.c.id.asc())
+ states = query.execute().fetchall()
+ log.debug('POSSIBLESTATES: '+ str(states))
+ return states
+
+ def change_state(self, sample_id, new_state=None):
+ '''
+ This method changes the state of the sample to the the 'new_state'
+ '''
+ if not new_state:
+ return
+ new_state_id = -1
+ # find the state_id for this new state in the list of possible states
+ possible_states = self.all_possible_states(sample_id)
+ for state_id, state_name in possible_states:
+ if new_state == state_name:
+ new_state_id = state_id
+ if new_state_id == -1:
+ return
+ log.debug('Updating sample_id %i state to %s' % (sample_id, new_state))
+ d = timedelta(hours=4)
+ i = self.event_table.insert()
+ i.execute(update_time=datetime.now()+d,
+ create_time=datetime.now()+d,
+ sample_id=sample_id,
+ sample_state_id=int(new_state_id),
+ comment='bar code scanner')
+ # if all the samples for this request are in the final state
+ # then change the request state to 'Complete'
+ result = select(columns=[self.sample_table.c.id],
+ whereclause=self.sample_table.c.request_id==self.request_id).execute()
+ sample_id_list = result.fetchall()
+ request_complete = True
+ for sid in sample_id_list:
+ current_state_id = self.current_state(sid[0])
+ if current_state_id != possible_states[-1][0]:
+ request_complete = False
+ break
+ if request_complete:
+ request_state = 'Complete'
+ else:
+ request_state = 'Submitted'
+ log.debug('Updating request_id %i state to "%s"' % (self.request_id, request_state))
+ d = timedelta(hours=4)
+ i = self.request_table.update(whereclause=self.request_table.c.id==self.request_id,
+ values={self.request_table.c.state: request_state})
+ i.execute()
+
+
+
+if __name__ == '__main__':
+ print '''This file should not be run directly. To start the Galaxy AMQP Listener:
+ %sh run_galaxy_listener.sh'''
+# dbstr = 'postgres://postgres:postgres@localhost/galaxy_ft'
+#
+# parser = optparse.OptionParser()
+# parser.add_option('-n', '--name', help='name of the sample field', dest='name', \
+# action='store', default='bar_code')
+# parser.add_option('-v', '--value', help='value of the sample field', dest='value', \
+# action='store')
+# parser.add_option('-s', '--state', help='new state of the sample', dest='state', \
+# action='store')
+# (opts, args) = parser.parse_args()
+#
+# gs = GalaxyDbInterface(dbstr)
+# sample_id = gs.get_sample_id(field_name=opts.name, value=opts.value)
+# gs.change_state(sample_id, opts.state)
+
+
+
diff -r 7f18940a4821 -r 3f3712d36034 test/functional/test_forms_and_requests.py
--- a/test/functional/test_forms_and_requests.py Fri Sep 18 14:21:59 2009 -0400
+++ b/test/functional/test_forms_and_requests.py Fri Sep 18 15:18:57 2009 -0400
@@ -247,6 +247,8 @@
self.home()
request_one.refresh()
# check if the request's state is now set to 'complete'
+ self.visit_url('%s/requests_admin/list?show_filter=Complete' % self.url)
+ self.check_page_for_string( request_one.name )
assert request_one.state is not request_one.states.COMPLETE, "The state of the request '%s' should be set to '%s'" % ( request_one.name, request_one.states.COMPLETE )
# def test_40_admin_create_request_on_behalf_of_regular_user( self ):
# """Testing creating and submitting a request as an admin on behalf of a regular user"""
diff -r 7f18940a4821 -r 3f3712d36034 universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample Fri Sep 18 14:21:59 2009 -0400
+++ b/universe_wsgi.ini.sample Fri Sep 18 15:18:57 2009 -0400
@@ -240,3 +240,22 @@
ucsc_table_direct_archaea1 = local:///
ucsc_table_direct_test1 = local:///
upload1 = local:///
+
+
+# Galaxy Message Queue
+# Galaxy uses AMQ protocol to receive messages from external sources like
+# bar code scanners. Galaxy has been tested against RabbitMQ AMQP implementation.
+# For Galaxy to receive messages from a message queue the RabbitMQ server has
+# to be set up with a user account and other parameters listed below. The 'host'
+# and 'port' fields should point to where the RabbitMQ server is running.
+
+#[galaxy:amqp]
+#host = 127.0.0.1
+#port = 5672
+#userid = galaxy
+#password = galaxy
+#virtual_host = galaxy_messaging_engine
+#queue = galaxy_queue
+#exchange = galaxy_exchange
+#routing_key = bar_code_scanner
+
1
0