How to make Galaxy link to a local installed UCSC database?
by xue dong
Hallo every one,
I am new to Galaxy, I have a idea which maybe not new to people here. I work
on arabidopsis. maybe you know that UCSC do not offer the genome assembly
for plant.
so i will install UCSC locally and built the genome assembly for
arabidopsis. this work is half done now.
I also installed Galaxy, if i understand correctly, Galaxy has the link to
UCSC so the user can get data from UCSC. since what i interested is
arabidopsis information, I hope Galaxy can retrive data form the locally
installed UCSC in future. I do not know if it is possible to make this idea
come ture.maybe some of you have done it. if yes, I am gratefully if you
can tell me the how to get it.
many thanks,
Xue
11 years, 7 months
Round-Robin Scheduling
by Assaf Gordon
Hello,
I have another question regarding the local job scheduler:
Is it possible to limit the number of jobs *per user* ?
That is - any given user can have up to X number of jobs running
concurrently, regardless of the value of local_job_queue_workers ?
Imagine the following situation:
local_job_queue_worker = 5
job_scheduler_policy =
galaxy.jobs.schedulingpolicy.roundrobin:UserRoundRobin
Which means that at any given moment, galaxy can run only five jobs.
Now, Galaxy is completely Idle, no jobs are running.
One users starts 7 very long running jobs (each jobs will take about two
hours).
If I understand correctly - since no jobs are running, 5 of the user's
job will be started immediately, even with the round-robin policy, right ?
And this means that for the next two hours, every other user which
starts a job - his/her job will be either new or limbo-running, but none
will actually be started, right ?
I think I'm experiencing this situation on my galaxy server.
Users are complaining their jobs have been running 'forever' or not even
starting for a long long time.
Close examination shows that there are running 5 jobs (all from the same
user) which have been running for three hours, and they are kind of
hogging all the worker threads.
To make a long story short -
I would like to make sure a single user can't hog Galaxy.
Is it possible with the local job runner, and if not - is it possible
with the SGE job runner ?
Thanks for reading so far,
Gordon.
11 years, 7 months
Wrappers for Sequence Alignment Programs
by SHAUN WEBB
Hi,
I am planning on integrating sequence alignment programs to our local
instance of Galaxy. I was wondering if anyone else has developed
wrappers for the following programs: Maq, Bowtie, Tophat.
Also, is there a central repository for any new tools or wrappers that
have been created by other developers? It would certainly be a useful
resource and if I need to wrap these tools myself I would be happy
share the code.
Shaun Webb
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
11 years, 7 months
[hg] galaxy 2421: Add a defaulttimeout setting of 10 minutes to ...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/186fcb977e75
changeset: 2421:186fcb977e75
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Thu May 28 11:10:44 2009 -0400
description:
Add a defaulttimeout setting of 10 minutes to the urlopen() call for requests to remote data sources.
1 file(s) affected in this change:
tools/data_source/data_source.py
diffs (43 lines):
diff -r 5c2d30d3fb04 -r 186fcb977e75 tools/data_source/data_source.py
--- a/tools/data_source/data_source.py Wed May 27 14:19:59 2009 -0400
+++ b/tools/data_source/data_source.py Thu May 28 11:10:44 2009 -0400
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-#Retreives data from UCSC and stores in a file. UCSC parameters are provided in the input/output file.
-import urllib, sys, os, gzip, tempfile, shutil
+# Retrieves data from external data source applications and stores in a dataset file.
+# Data source application parameters are temporarily stored in the dataset file.
+import socket, urllib, sys, os, gzip, tempfile, shutil
from galaxy import eggs
-#from galaxy.datatypes import data
from galaxy.util import gzip_magic
assert sys.version_info[:2] >= ( 2, 4 )
@@ -34,15 +34,23 @@
open( filename, 'w' ).write( "" )
stop_err( 'The remote data source application has not sent back a URL parameter in the request.' )
URL_method = params.get( 'URL_method', None )
- out = open( filename, 'w' )
- CHUNK_SIZE = 2**20 # 1Mb
+ CHUNK_SIZE = 2**20 # 1Mb
+ # The Python support for fetching resources from the web is layered. urllib uses the httplib
+ # library, which in turn uses the socket library. As of Python 2.3 you can specify how long
+ # a socket should wait for a response before timing out. By default the socket module has no
+ # timeout and can hang. Currently, the socket timeout is not exposed at the httplib or urllib2
+ # levels. However, you can set the default timeout ( in seconds ) globally for all sockets by
+ # doing the following.
+ socket.setdefaulttimeout( 600 )
+ # The following calls to urllib2.urlopen() will use the above default timeout
try:
if not URL_method or URL_method == 'get':
page = urllib.urlopen( URL )
elif URL_method == 'post':
page = urllib.urlopen( URL, urllib.urlencode( params ) )
- except:
- stop_err( 'It appears that the remote data source application is currently off line. Please try again later.' )
+ except Exception, e:
+ stop_err( 'The remote data source application may be off line, please try again later. Error: %s' % str( e ) )
+ out = open( filename, 'w' )
while 1:
chunk = page.read( CHUNK_SIZE )
if not chunk:
11 years, 7 months
[hg] galaxy 2422: Fix for DrillDownParameter when no option is s...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/a07e84e73b45
changeset: 2422:a07e84e73b45
user: Dan Blankenberg <dan(a)bx.psu.edu>
date: Thu May 28 13:58:56 2009 -0400
description:
Fix for DrillDownParameter when no option is selected and saved in worflow editing.
1 file(s) affected in this change:
lib/galaxy/tools/parameters/basic.py
diffs (15 lines):
diff -r 186fcb977e75 -r a07e84e73b45 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py Thu May 28 11:10:44 2009 -0400
+++ b/lib/galaxy/tools/parameters/basic.py Thu May 28 13:58:56 2009 -0400
@@ -947,7 +947,10 @@
def from_html( self, value, trans=None, other_values={} ):
if self.need_late_validation( trans, other_values ):
if self.multiple:
- value = value.split( "\n" )
+ if value == '': #No option selected
+ value = None
+ else:
+ value = value.split( "\n" )
return UnvalidatedValue( value )
if not value: return None
if not isinstance( value, list ):
11 years, 7 months
[hg] galaxy 2423: Fix the cleanup_datasets script
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/7a6f75bf4be5
changeset: 2423:7a6f75bf4be5
user: Nate Coraor <nate(a)bx.psu.edu>
date: Thu May 28 15:18:49 2009 -0400
description:
Fix the cleanup_datasets script
1 file(s) affected in this change:
scripts/cleanup_datasets/cleanup_datasets.py
diffs (17 lines):
diff -r a07e84e73b45 -r 7a6f75bf4be5 scripts/cleanup_datasets/cleanup_datasets.py
--- a/scripts/cleanup_datasets/cleanup_datasets.py Thu May 28 13:58:56 2009 -0400
+++ b/scripts/cleanup_datasets/cleanup_datasets.py Thu May 28 15:18:49 2009 -0400
@@ -264,8 +264,13 @@
if dataset.extra_files_path and os.path.exists( dataset.extra_files_path ):
shutil.rmtree( dataset.extra_files_path ) #we need to delete the directory and its contents; os.unlink would always fail on a directory
dataset.purged = True
+ dataset.flush()
else:
print "# This dataset (%i) is not purgable, the file (%s) will not be removed.\n" % ( dataset.id, dataset.file_name )
+ except OSError, exc:
+ print "# Error, file has already been removed: %s" % str( exc )
+ dataset.purged = True
+ dataset.flush()
except Exception, exc:
print "# Error, exception: %s caught attempting to purge %s\n" %( str( exc ), dataset.file_name )
else:
11 years, 7 months
[hg] galaxy 2420: Add tool config for GrameneMart data source.
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/5c2d30d3fb04
changeset: 2420:5c2d30d3fb04
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Wed May 27 14:19:59 2009 -0400
description:
Add tool config for GrameneMart data source.
3 file(s) affected in this change:
tool_conf.xml.main
tool_conf.xml.sample
tools/data_source/gramene_mart.xml
diffs (67 lines):
diff -r 1acbcbcebeb3 -r 5c2d30d3fb04 tool_conf.xml.main
--- a/tool_conf.xml.main Wed May 27 11:15:35 2009 -0400
+++ b/tool_conf.xml.main Wed May 27 14:19:59 2009 -0400
@@ -6,6 +6,7 @@
<tool file="data_source/ucsc_tablebrowser_archaea.xml" />
<tool file="data_source/microbial_import.xml" />
<tool file="data_source/biomart.xml" />
+ <tool file="data_source/gramene_mart.xml" />
<tool file="data_source/flymine.xml" />
<tool file="data_source/encode_db.xml" />
<tool file="data_source/epigraph_import.xml" />
diff -r 1acbcbcebeb3 -r 5c2d30d3fb04 tool_conf.xml.sample
--- a/tool_conf.xml.sample Wed May 27 11:15:35 2009 -0400
+++ b/tool_conf.xml.sample Wed May 27 14:19:59 2009 -0400
@@ -8,6 +8,7 @@
<tool file="data_source/microbial_import.xml" />
<tool file="data_source/biomart.xml" />
<tool file="data_source/biomart_test.xml" />
+ <tool file="data_source/gramene_mart.xml" />
<tool file="data_source/wormbase.xml" />
<tool file="data_source/wormbase_test.xml" />
<tool file="data_source/flymine.xml" />
diff -r 1acbcbcebeb3 -r 5c2d30d3fb04 tools/data_source/gramene_mart.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/data_source/gramene_mart.xml Wed May 27 14:19:59 2009 -0400
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+ If the value of 'URL_method' is 'get', the request will consist of the value of 'URL' coming back in
+ the initial response. If value of 'URL_method' is 'post', any additional params coming back in the
+ initial response ( in addition to 'URL' ) will be encoded and appended to URL and a post will be performed.
+
+ TODO: Hack to get biomart to work - the 'add_to_URL' param can be eliminated when the Biomart team encodes URL prior to sending, meanwhile
+ everything including and beyond the first '&' is truncated from URL. They said they'll let us know when this is fixed at their end.
+-->
+<tool name="GrameneMart" id="gramenemart" tool_type="data_source" URL_method="get" version="1.0.1">
+ <description> Central server</description>
+ <command interpreter="python">data_source.py $output</command>
+ <inputs action="http://www.gramene.org/biomart/martview" check_values="false" method="get" target="_top">
+ <display>go to GrameneMart Central $GALAXY_URL</display>
+ <param name="GALAXY_URL" type="baseurl" value="/tool_runner/biomart" />
+ </inputs>
+ <request_param_translation>
+ <request_param galaxy_name="URL" remote_name="URL" missing="">
+ <add_to_url>
+ <param_from_source name="_export" missing="1" />
+ <param_from_source name="GALAXY_URL" missing="0" />
+ </add_to_url>
+ </request_param>
+ <request_param galaxy_name="data_type" remote_name="exportView_outputformat" missing="tabular">
+ <data_type_translation>
+ <format galaxy_format="tabular" remote_format="TSV" />
+ </data_type_translation>
+ </request_param>
+ <request_param galaxy_name="dbkey" remote_name="dbkey" missing="?" />
+ <request_param galaxy_name="organism" remote_name="organism" missing="" />
+ <request_param galaxy_name="table" remote_name="table" missing="" />
+ <request_param galaxy_name="description" remote_name="description" missing="" />
+ <request_param galaxy_name="name" remote_name="name" missing="Biomart query" />
+ <request_param galaxy_name="info" remote_name="info" missing="" />
+ </request_param_translation>
+ <uihints minwidth="800"/>
+ <outputs>
+ <data name="output" format="tabular" />
+ </outputs>
+ <options sanitize="False" refresh="True"/>
+</tool>
11 years, 7 months
[hg] galaxy 2419: Add a hack to force UCSC links to be rewritten...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/1acbcbcebeb3
changeset: 2419:1acbcbcebeb3
user: Nate Coraor <nate(a)bx.psu.edu>
date: Wed May 27 11:15:35 2009 -0400
description:
Add a hack to force UCSC links to be rewritten as http if your upstream uses https
1 file(s) affected in this change:
lib/galaxy/datatypes/interval.py
diffs (16 lines):
diff -r 7414f90d7eae -r 1acbcbcebeb3 lib/galaxy/datatypes/interval.py
--- a/lib/galaxy/datatypes/interval.py Tue May 26 16:35:23 2009 -0400
+++ b/lib/galaxy/datatypes/interval.py Wed May 27 11:15:35 2009 -0400
@@ -223,6 +223,12 @@
stop = viewport_tuple[2]
for site_name, site_url in util.get_ucsc_by_build(dataset.dbkey):
if site_name in app.config.ucsc_display_sites:
+ # HACK: UCSC doesn't support https, so force http even
+ # if our URL scheme is https. Making this work
+ # requires additional hackery in your upstream proxy.
+ # If UCSC ever supports https, remove this hack.
+ if base_url.startswith( 'https://' ):
+ base_url = base_url.replace( 'https', 'http', 1 )
display_url = urllib.quote_plus( "%s%s/display_as?id=%i&display_app=%s" % (base_url, url_for( controller='root' ), dataset.id, type) )
link = "%sdb=%s&position=%s:%s-%s&hgt.customText=%s" % (site_url, dataset.dbkey, chrom, start, stop, display_url )
ret_val.append( (site_name, link) )
11 years, 7 months
[hg] galaxy 2418: Bug fix for undeleting deleted history items.
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/7414f90d7eae
changeset: 2418:7414f90d7eae
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Tue May 26 16:35:23 2009 -0400
description:
Bug fix for undeleting deleted history items.
1 file(s) affected in this change:
lib/galaxy/web/controllers/dataset.py
diffs (52 lines):
diff -r 76890d7fb3dd -r 7414f90d7eae lib/galaxy/web/controllers/dataset.py
--- a/lib/galaxy/web/controllers/dataset.py Tue May 26 14:59:40 2009 -0400
+++ b/lib/galaxy/web/controllers/dataset.py Tue May 26 16:35:23 2009 -0400
@@ -127,27 +127,31 @@
return trans.show_error_message( "You are not allowed to access this dataset" )
def _undelete( self, trans, id ):
- if isinstance( id, type( 1 ) ):
- history = trans.get_history()
- data = self.app.model.HistoryDatasetAssociation.get( id )
- if data and data.undeletable:
- # Walk up parent datasets to find the containing history
- topmost_parent = data
- while topmost_parent.parent:
- topmost_parent = topmost_parent.parent
- assert topmost_parent in history.datasets, "Data does not belong to current history"
- # Mark undeleted
- data.mark_undeleted()
- self.app.model.flush()
- trans.log_event( "Dataset id %s has been undeleted" % str(id) )
- return True
+ try:
+ id = int( id )
+ except ValueError, e:
+ return False
+ history = trans.get_history()
+ data = self.app.model.HistoryDatasetAssociation.get( id )
+ if data and data.undeletable:
+ # Walk up parent datasets to find the containing history
+ topmost_parent = data
+ while topmost_parent.parent:
+ topmost_parent = topmost_parent.parent
+ assert topmost_parent in history.datasets, "Data does not belong to current history"
+ # Mark undeleted
+ data.mark_undeleted()
+ self.app.model.flush()
+ trans.log_event( "Dataset id %s has been undeleted" % str(id) )
+ return True
return False
@web.expose
def undelete( self, trans, id ):
- self._undelete( trans, id )
- return trans.response.send_redirect( web.url_for( controller='root', action='history', show_deleted = True ) )
-
+ if self._undelete( trans, id ):
+ return trans.response.send_redirect( web.url_for( controller='root', action='history', show_deleted = True ) )
+ raise "Error undeleting"
+
@web.expose
def undelete_async( self, trans, id ):
if self._undelete( trans, id ):
11 years, 7 months
[hg] galaxy 2416: Bug fixes for the new security and libraries f...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/48e4b965545b
changeset: 2416:48e4b965545b
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Tue May 26 14:32:18 2009 -0400
description:
Bug fixes for the new security and libraries functional tests.
3 file(s) affected in this change:
lib/galaxy/web/controllers/admin.py
test/base/twilltestcase.py
test/functional/test_security_and_libraries.py
diffs (253 lines):
diff -r 386e245f8076 -r 48e4b965545b lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py Thu May 21 15:48:39 2009 -0400
+++ b/lib/galaxy/web/controllers/admin.py Tue May 26 14:32:18 2009 -0400
@@ -875,14 +875,21 @@
library_folder.deleted = True
library_folder.purged = True
library_folder.flush()
- purge_folder( library.root_folder )
- library.purged = True
- library.flush()
- msg = "Library '%s' and all of its contents have been purged, datasets will be removed from disk via the cleanup_datasets script" % library.name
- return trans.response.send_redirect( web.url_for( controller='admin',
- action='deleted_libraries',
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ if not library.deleted:
+ msg = "Library '%s' has not been marked deleted, so it cannot be purged" % ( library.name )
+ return trans.response.send_redirect( web.url_for( controller='admin',
+ action='browse_libraries',
+ msg=util.sanitize_text( msg ),
+ messagetype='error' ) )
+ else:
+ purge_folder( library.root_folder )
+ library.purged = True
+ library.flush()
+ msg = "Library '%s' and all of its contents have been purged, datasets will be removed from disk via the cleanup_datasets script" % library.name
+ return trans.response.send_redirect( web.url_for( controller='admin',
+ action='deleted_libraries',
+ msg=util.sanitize_text( msg ),
+ messagetype='done' ) )
@web.expose
@web.require_admin
def folder( self, trans, id, library_id, **kwd ):
@@ -1545,7 +1552,7 @@
messagetype=messagetype )
@web.expose
@web.require_admin
- def info_template( self, trans, library_id, id=None, num_fields=0, folder_id=None, ldda_id=None, library_dataset_id=None, **kwd ):
+ def info_template( self, trans, library_id, id=None, num_fields=0, folder_id=None, ldda_id=None, library_dataset_id=None, **kwd ):
params = util.Params( kwd )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
diff -r 386e245f8076 -r 48e4b965545b test/base/twilltestcase.py
--- a/test/base/twilltestcase.py Thu May 21 15:48:39 2009 -0400
+++ b/test/base/twilltestcase.py Tue May 26 14:32:18 2009 -0400
@@ -855,9 +855,14 @@
tc.fv( '1', 'new_element_name_0', ele_name_0 )
tc.fv( '1', 'new_element_name_1', ele_name_1 )
tc.submit( 'new_info_template_button' )
+ self.check_page_for_string( 'The new information template has been created.' )
self.home()
- def add_library_info_template_element( self, library_id, template_id, template_name, ele_name_1, ele_desc_1,
- ele_name_2, ele_desc_2, new_ele_name='Fubar', new_ele_desc='This is the Fubar compnent' ):
+ def add_library_info_template_element( self, library_id, template_id, 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='Fubar', new_ele_desc='This is the Fubar compnent' ):
"""Add a new element to an existing library info template"""
self.home()
url = "%s/admin/info_template?library_id=%s&id=%s&edit_template=True&num_fields=1&edit_info_template_button=Save" % \
@@ -868,10 +873,10 @@
tc.fv( '1', 'id', template_id )
tc.fv( '1', 'set_num_fields', '0' )
tc.fv( '1', 'name', template_name )
- tc.fv( '1', 'element_name_1', ele_name_1 )
- tc.fv( '1', 'element_description_1', ele_desc_1 )
- tc.fv( '1', 'element_name_2', ele_name_2 )
- tc.fv( '1', 'element_description_2', ele_desc_2 )
+ tc.fv( '1', ele_field_name_1, ele_name_1 )
+ tc.fv( '1', ele_field_desc_1, ele_desc_1 )
+ tc.fv( '1', ele_field_name_2, ele_name_2 )
+ tc.fv( '1', ele_field_desc_2, ele_desc_2 )
tc.fv( '1', 'new_element_name_0', new_ele_name )
tc.fv( '1', 'new_element_description_0', new_ele_desc )
tc.submit( 'edit_info_template_button' )
@@ -888,7 +893,8 @@
tc.fv( '2', ele_2_field_name, ele_2_contents )
tc.submit( 'create_new_info_button' )
self.home()
- def edit_library_info_template( self, library_id, id, name, name_1, desc_1, name_2, desc_2 ):
+ def edit_library_info_template( self, library_id, id, name, ele_name_1, name_1,
+ ele_desc_1, desc_1, ele_name_2, name_2, ele_desc_2, desc_2 ):
"""Edit an existing library info template"""
self.home()
url = "%s/admin/info_template?library_id=%s&id=%s&edit_template=True" % ( self.url, library_id, id )
@@ -897,10 +903,10 @@
tc.fv( '1', 'id', id )
tc.fv( '1', 'set_num_fields', '0' )
tc.fv( '1', 'name', name )
- tc.fv( '1', 'element_name_1', name_1 )
- tc.fv( '1', 'element_description_1', desc_1 )
- tc.fv( '1', 'element_name_2', name_2 )
- tc.fv( '1', 'element_description_2', desc_2 )
+ tc.fv( '1', ele_name_1, name_1 )
+ tc.fv( '1', ele_desc_1, desc_1 )
+ tc.fv( '1', ele_name_2, name_2 )
+ tc.fv( '1', ele_desc_2, desc_2 )
tc.submit( 'edit_info_template_button' )
check_str = "Information template '%s' has been updated" % name
self.check_page_for_string( check_str )
@@ -988,7 +994,6 @@
for pi in permissions_in:
key = '%s_in' % pi
url ="%s&%s=%s" % ( url, key, str( role_id ) )
- print url
self.home()
self.visit_url( "%s/%s" % ( self.url, url ) )
check_str = "Permissions updated for dataset '%s'" % ldda_name
@@ -1046,12 +1051,7 @@
dbkey='hg18', message='', check_template_str1='', check_template_str2='', check_template_str3='' ):
"""Upload new version(s) of a dataset"""
self.home()
- filename = self.get_filename( filename )
-
- url = "%s/admin/library_dataset_dataset_association?upload_option=upload_file&library_id=%s&folder_id=%s&replace_id=%s&message=%s" % \
- ( self.url, library_id, folder_id, library_dataset_id, message )
- print "####url: ", url
-
+ filename = self.get_filename( filename )
self.visit_url( "%s/admin/library_dataset_dataset_association?upload_option=upload_file&library_id=%s&folder_id=%s&replace_id=%s&message=%s" % \
( self.url, library_id, folder_id, library_dataset_id, message ) )
self.check_page_for_string( 'Upload files' )
diff -r 386e245f8076 -r 48e4b965545b test/functional/test_security_and_libraries.py
--- a/test/functional/test_security_and_libraries.py Thu May 21 15:48:39 2009 -0400
+++ b/test/functional/test_security_and_libraries.py Tue May 26 14:32:18 2009 -0400
@@ -515,17 +515,30 @@
info_permissions.sort()
assert actions == info_permissions, "Permissions for library_item_info id %s not correctly inherited from library %s" \
% ( library_item_info.id, library_one.name )
- # Need the current library_item_info_element.id
- last_library_item_info_element_id = galaxy.model.LibraryItemInfoElement.query() \
- .order_by( desc( galaxy.model.LibraryItemInfoElement.table.c.id ) ).first()
- if last_library_item_info_element_id is None:
- last_library_item_info_element_id = 0
+ element_ids = []
+ if library_one.library_info_associations:
+ # We have a set of LibraryItemInfoElements
+ last_library_item_info_element = galaxy.model.LibraryItemInfoElement.query() \
+ .order_by( desc( galaxy.model.LibraryItemInfoElement.table.c.id ) ).first()
+ if not last_library_item_info_element:
+ element_ids.append( 0 )
+ element_ids.append( 1 )
+ else:
+ element_ids.append( last_library_item_info_element.id + 1 )
+ element_ids.append( last_library_item_info_element.id + 2 )
+ else:
+ # We only have a set of LibraryItemInfoTemplateElements
+ for ele in library_one_template.elements:
+ element_ids.append( ele.id )
+ element_ids.sort()
# Add information to the library using the template
- ele_1_field_name = "info_element_%s_%s" % ( str( library_one_template.id ), str( last_library_item_info_element_id + 1 ) )
+ ele_1_field_name = "info_element_%s_%s" % ( str( library_one_template.id ), str( element_ids[0] ) )
ele_1_contents = 'hello'
- ele_2_field_name = "info_element_%s_%s" % ( str( library_one_template.id ), str( last_library_item_info_element_id + 2 ) )
+ ele_2_field_name = "info_element_%s_%s" % ( str( library_one_template.id ), str( element_ids[1] ) )
ele_2_contents = 'world'
- self.edit_library_info( str( library_one.id ), library_one.name, ele_1_field_name, ele_1_contents, ele_2_field_name, ele_2_contents )
+ self.edit_library_info( str( library_one.id ), library_one.name,
+ ele_1_field_name, ele_1_contents,
+ ele_2_field_name, ele_2_contents )
self.home()
self.visit_url( '%s/admin/library?id=%s&information=True' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( ele_1_contents )
@@ -536,11 +549,17 @@
self.check_page_for_string( ele_2_contents )
# Edit the template
new_name = 'Library Template 1 renamed'
+ new_ele_name_1_field = "element_name_%s" % element_ids[0]
new_ele_name_1 = 'wind'
+ new_ele_desc_1_field = "element_description_%s" % element_ids[0]
ele_desc_1 = 'This is the wind component'
+ new_ele_name_2_field = "element_name_%s" % element_ids[1]
new_ele_name_2 = 'bag'
+ new_ele_desc_2_field = "element_description_%s" % element_ids[1]
ele_desc_2 = 'This is the bag component'
- self.edit_library_info_template( str( library_one.id ), library_one_template.id, new_name, new_ele_name_1, ele_desc_1, new_ele_name_2, ele_desc_2 )
+ self.edit_library_info_template( str( library_one.id ), library_one_template.id, new_name,
+ new_ele_name_1_field, new_ele_name_1, new_ele_desc_1_field, ele_desc_1,
+ new_ele_name_2_field, new_ele_name_2, new_ele_desc_2_field, ele_desc_2 )
self.home()
self.visit_url( '%s/admin/library?id=%s&information=True' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( new_ele_name_1 )
@@ -692,20 +711,34 @@
self.home()
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'
- library_one_template.refresh()
+
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 )
@@ -1601,11 +1634,13 @@
self.undelete_role( str( role_two.id ), role_two.name )
def test_270_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' )
self.purge_library( str( library_one.id ), library_one.name )
# Make sure the library was purged
library_one.refresh()
- if not library_one.purged:
- raise AssertionError( 'The library id %s named "%s" has not been marked as purged.' % ( str( library_one.id ), library_one.name ) )
+ if not ( library_one.deleted and library_one.purged ):
+ raise AssertionError( 'The library id %s named "%s" has not been marked as deleted and purged.' % ( str( library_one.id ), library_one.name ) )
def check_folder( library_folder ):
for folder in library_folder.folders:
folder.refresh()
@@ -1635,15 +1670,6 @@
check_folder( library_one.root_folder )
def test_275_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
- ##################
- # Eliminate all templates and info associations
- ##################
- for lia in library_one.library_info_associations:
- lia.delete()
- lia.flush()
- for lita in library_one.library_info_template_associations:
- lita.delete()
- lita.flush()
##################
# Eliminate all non-private roles
##################
11 years, 7 months