galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
June 2012
- 1 participants
- 98 discussions
commit/galaxy-central: greg: Miscellaneous fixes for installing tool shed repositories.
by Bitbucket 30 Jun '12
by Bitbucket 30 Jun '12
30 Jun '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/81d637b6fdad/
changeset: 81d637b6fdad
user: greg
date: 2012-06-30 23:49:07
summary: Miscellaneous fixes for installing tool shed repositories.
affected #: 2 files
diff -r f3c8c73009c90025a068fc7eaf1641ebd1f3cc47 -r 81d637b6fdad65d74fdccd02c7d71e0e6eaf37dd lib/galaxy/web/controllers/admin_toolshed.py
--- a/lib/galaxy/web/controllers/admin_toolshed.py
+++ b/lib/galaxy/web/controllers/admin_toolshed.py
@@ -86,15 +86,18 @@
operations = [ grids.GridOperation( "Get updates",
allow_multiple=False,
condition=( lambda item: not item.deleted ),
- async_compatible=False ),
+ async_compatible=False,
+ url_args=dict( controller='admin_toolshed', action='browse_repositories', operation='get updates' ) ),
grids.GridOperation( "Deactivate or uninstall",
allow_multiple=False,
condition=( lambda item: not item.deleted ),
- async_compatible=False ),
+ async_compatible=False,
+ url_args=dict( controller='admin_toolshed', action='browse_repositories', operation='deactivate or uninstall' ) ),
grids.GridOperation( "Activate or reinstall",
allow_multiple=False,
condition=( lambda item: item.deleted ),
- async_compatible=False ) ]
+ async_compatible=False,
+ url_args=dict( controller='admin_toolshed', action='browse_repositories', operation='activate or reinstall' ) ) ]
standard_filters = []
default_filter = dict( deleted="False" )
num_rows_per_page = 50
@@ -589,43 +592,38 @@
if file_name == shed_tool_conf:
tool_path = shed_tool_conf_dict[ 'tool_path' ]
break
- if includes_tools and ( new_tool_panel_section or tool_panel_section ):
- if new_tool_panel_section:
- section_id = new_tool_panel_section.lower().replace( ' ', '_' )
- new_section_key = 'section_%s' % str( section_id )
- if new_section_key in trans.app.toolbox.tool_panel:
- # Appending a tool to an existing section in trans.app.toolbox.tool_panel
- log.debug( "Appending to tool panel section: %s" % new_tool_panel_section )
- tool_section = trans.app.toolbox.tool_panel[ new_section_key ]
- else:
- # Appending a new section to trans.app.toolbox.tool_panel
- log.debug( "Loading new tool panel section: %s" % new_tool_panel_section )
- elem = Element( 'section' )
- elem.attrib[ 'name' ] = new_tool_panel_section
- elem.attrib[ 'id' ] = section_id
- elem.attrib[ 'version' ] = ''
- tool_section = tools.ToolSection( elem )
- trans.app.toolbox.tool_panel[ new_section_key ] = tool_section
- else:
- section_key = 'section_%s' % tool_panel_section
- tool_section = trans.app.toolbox.tool_panel[ section_key ]
- else:
- tool_section = None
# Make sure all tool_shed_repository records exist.
- new_tool_shed_repositories = []
+ created_or_updated_tool_shed_repositories = []
for name, repo_info_tuple in repo_info_dict.items():
description, repository_clone_url, changeset_revision, ctx_rev = repo_info_tuple
clone_dir = os.path.join( tool_path, self.generate_tool_path( repository_clone_url, changeset_revision ) )
relative_install_dir = os.path.join( clone_dir, name )
owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) )
# Make sure the repository was not already installed.
- installed_changeset_revision = self.repository_was_previously_installed( trans, tool_shed_url, name, repo_info_tuple, clone_dir )
- if installed_changeset_revision:
- message = "Tool shed repository <b>%s</b> with owner <b>%s</b> and changeset revision <b>%s</b> " % ( name, owner, changeset_revision )
- message += "was previously installed using changeset revision <b>%s</b>. You can get " % installed_changeset_revision
- message += "the latest updates for the installed repository using the <b>Get updates</b> option from the repository's "
- message += "<b>Repository Actions</b> pop-up menu."
+ installed_tool_shed_repository, installed_changeset_revision = self.repository_was_previously_installed( trans,
+ tool_shed_url,
+ name,
+ repo_info_tuple,
+ clone_dir )
+ if installed_tool_shed_repository:
+ message = "The tool shed repository <b>%s</b> with owner <b>%s</b> and changeset revision <b>%s</b> " % ( name, owner, changeset_revision )
+ if installed_changeset_revision != changeset_revision:
+ message += "was previously installed using changeset revision <b>%s</b>. " % installed_changeset_revision
+ else:
+ message += "was previously installed. "
+ if installed_tool_shed_repository.uninstalled:
+ message += "The repository has been uninstalled, however, so reinstall the original repository instead of installing it again. "
+ elif installed_tool_shed_repository.deleted:
+ message += "The repository has been deactivated, however, so activate the original repository instead of installing it again. "
+ if installed_changeset_revision != changeset_revision:
+ message += "You can get the latest updates for the repository using the <b>Get updates</b> option from the repository's "
+ message += "<b>Repository Actions</b> pop-up menu. "
status = 'error'
+ if len( repo_info_dict ) == 1:
+ new_kwd = dict( message=message, status=status )
+ return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
+ action='browse_repositories',
+ **new_kwd ) )
else:
print "Adding new row (or updating an existing row) for repository '%s' in the tool_shed_repository table." % name
tool_shed_repository = create_or_update_tool_shed_repository( app=trans.app,
@@ -639,9 +637,31 @@
current_changeset_revision=changeset_revision,
owner=owner,
dist_to_shed=False )
- new_tool_shed_repositories.append( tool_shed_repository )
- if new_tool_shed_repositories:
- tsrids_list = [ trans.security.encode_id( tsr.id ) for tsr in new_tool_shed_repositories ]
+ created_or_updated_tool_shed_repositories.append( tool_shed_repository )
+ if created_or_updated_tool_shed_repositories:
+ if includes_tools and ( new_tool_panel_section or tool_panel_section ):
+ if new_tool_panel_section:
+ section_id = new_tool_panel_section.lower().replace( ' ', '_' )
+ tool_panel_section_key = 'section_%s' % str( section_id )
+ if tool_panel_section_key in trans.app.toolbox.tool_panel:
+ # Appending a tool to an existing section in trans.app.toolbox.tool_panel
+ log.debug( "Appending to tool panel section: %s" % new_tool_panel_section )
+ tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ]
+ else:
+ # Appending a new section to trans.app.toolbox.tool_panel
+ log.debug( "Loading new tool panel section: %s" % new_tool_panel_section )
+ elem = Element( 'section' )
+ elem.attrib[ 'name' ] = new_tool_panel_section
+ elem.attrib[ 'id' ] = section_id
+ elem.attrib[ 'version' ] = ''
+ tool_section = tools.ToolSection( elem )
+ trans.app.toolbox.tool_panel[ tool_panel_section_key ] = tool_section
+ else:
+ tool_panel_section_key = 'section_%s' % tool_panel_section
+ tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ]
+ else:
+ tool_section = None
+ tsrids_list = [ trans.security.encode_id( tsr.id ) for tsr in created_or_updated_tool_shed_repositories ]
new_kwd = dict( includes_tool_dependencies=kwd.get( 'includes_tool_dependencies', False ),
includes_tools=kwd.get( 'includes_tools', False ),
install_tool_dependencies=install_tool_dependencies,
@@ -652,7 +672,7 @@
status=status,
tool_panel_section=kwd.get( 'tool_panel_section', '' ),
tool_path=tool_path,
- tool_section=tool_section,
+ tool_panel_section_key=tool_panel_section_key,
tool_shed_repository_ids=tsrids_list,
tool_shed_url=kwd[ 'tool_shed_url' ] )
encoded_kwd = tool_shed_encode( new_kwd )
@@ -760,6 +780,11 @@
tool_path = kwd[ 'tool_path' ]
includes_tool_dependencies = util.string_as_bool( kwd[ 'includes_tool_dependencies' ] )
install_tool_dependencies = CheckboxField.is_checked( kwd.get( 'install_tool_dependencies', '' ) )
+ tool_panel_section_key = kwd.get( 'tool_panel_section_key', None )
+ if tool_panel_section_key:
+ tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ]
+ else:
+ tool_section = None
for tool_shed_repository in tool_shed_repositories:
# Clone each repository to the configured location.
update_tool_shed_repository_status( trans.app, tool_shed_repository, trans.model.ToolShedRepository.installation_status.CLONING )
@@ -777,7 +802,7 @@
repository_clone_url=repository_clone_url,
relative_install_dir=relative_install_dir,
tool_shed=tool_shed_repository.tool_shed,
- tool_section=kwd.get( 'tool_section', '' ),
+ tool_section=tool_section,
shed_tool_conf=kwd.get( 'shed_tool_conf', '' ) )
trans.sa_session.refresh( tool_shed_repository )
metadata = tool_shed_repository.metadata
@@ -1262,25 +1287,29 @@
def repository_was_previously_installed( self, trans, tool_shed_url, repository_name, repo_info_tuple, clone_dir ):
# Handle case where the repository was previously installed using an older changeset_revsion, but later the repository was updated
# in the tool shed and now we're trying to install the latest changeset revision of the same repository instead of updating the one
- # that was previously installed.
+ # that was previously installed. We'll look in the database instead of on disk since the repository may be uninstalled.
description, repository_clone_url, changeset_revision, ctx_rev = repo_info_tuple
- if os.path.exists( clone_dir ):
- # The installed changeset revision already exists on disk.
- return changeset_revision
repository_owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) )
+ tool_shed = get_tool_shed_from_clone_url( repository_clone_url )
+ # Get all previous change set revisions from the tool shed for the repository back to, but excluding, the previous valid changeset
+ # revision to see if it was previously installed using one of them.
url = '%s/repository/previous_changeset_revisions?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s&webapp=galaxy&no_reset=true' % \
( tool_shed_url, url_for( '/', qualified=True ), repository_name, repository_owner, changeset_revision )
response = urllib2.urlopen( url )
text = response.read()
response.close()
if text:
- clone_path, clone_directory = os.path.split( clone_dir )
+ #clone_path, clone_directory = os.path.split( clone_dir )
changeset_revisions = util.listify( text )
for previous_changeset_revision in changeset_revisions:
- new_clone_dir = os.path.join( clone_path, previous_changeset_revision )
- if os.path.exists( new_clone_dir ):
- return previous_changeset_revision
- return None
+ tool_shed_repository = get_tool_shed_repository_by_shed_name_owner_installed_changeset_revision( trans.app,
+ tool_shed,
+ repository_name,
+ repository_owner,
+ previous_changeset_revision )
+ if tool_shed_repository and tool_shed_repository.status not in [ trans.model.ToolShedRepository.installation_status.NEW ]:
+ return tool_shed_repository, previous_changeset_revision
+ return None, None
@web.expose
@web.require_admin
def reselect_tool_panel_section( self, trans, **kwd ):
diff -r f3c8c73009c90025a068fc7eaf1641ebd1f3cc47 -r 81d637b6fdad65d74fdccd02c7d71e0e6eaf37dd templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
--- a/templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
+++ b/templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
@@ -23,7 +23,7 @@
<div class="toolForm"><div class="toolFormTitle">${repository.name}</div><div class="toolFormBody">
- <form name="uninstall_repository" id="uninstall_repository" action="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}" method="post" >
+ <form name="deactivate_or_uninstall_repository" id="deactivate_or_uninstall_repository" action="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}" method="post" ><div class="form-row"><label>Description:</label>
${repository.description}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Enable scrolling for tiles area in parameter space visualization.
by Bitbucket 29 Jun '12
by Bitbucket 29 Jun '12
29 Jun '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/f3c8c73009c9/
changeset: f3c8c73009c9
user: jgoecks
date: 2012-06-30 00:15:02
summary: Enable scrolling for tiles area in parameter space visualization.
affected #: 2 files
diff -r c0afbd9f63713787b4fa4d3d42a00c91cb7fb3b1 -r f3c8c73009c90025a068fc7eaf1641ebd1f3cc47 static/scripts/viz/paramamonster.js
--- a/static/scripts/viz/paramamonster.js
+++ b/static/scripts/viz/paramamonster.js
@@ -695,7 +695,8 @@
});
tr.children().first().attr('colspan', 2);
- $('#right').append(this.track_collection_container);
+ var tracks_div = $('<div>').addClass('tiles');
+ $('#right').append( tracks_div.append(this.track_collection_container) );
self.model.get('tracks').each(function(track) {
self.add_track(track);
diff -r c0afbd9f63713787b4fa4d3d42a00c91cb7fb3b1 -r f3c8c73009c90025a068fc7eaf1641ebd1f3cc47 templates/visualization/paramamonster.mako
--- a/templates/visualization/paramamonster.mako
+++ b/templates/visualization/paramamonster.mako
@@ -88,6 +88,14 @@
#right {
width: 600px;
}
+ .tiles {
+ overflow: auto;
+ position: absolute;
+ top: 25px;
+ bottom: 25px;
+ left: 0;
+ right: 0;
+ }
</style></%def>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/c0afbd9f6371/
changeset: c0afbd9f6371
user: jgoecks
date: 2012-06-30 00:00:38
summary: Remove debugging code.
affected #: 1 file
diff -r 29abb6c4b296815594c93cd8d72944628160145c -r c0afbd9f63713787b4fa4d3d42a00c91cb7fb3b1 lib/galaxy/web/api/tools.py
--- a/lib/galaxy/web/api/tools.py
+++ b/lib/galaxy/web/api/tools.py
@@ -148,9 +148,6 @@
# Merge overlapping regions so that regions do not overlap
# and hence data is not included multiple times.
- print "REGIONS", regions
- for region in regions:
- print "\t", region.chrom, region.start, region.end
prev = regions[0]
cur = regions[1]
index = 1
@@ -170,10 +167,7 @@
break
else:
cur = regions[ index ]
-
- print "REGIONS", regions
- for region in regions:
- print "\t", region.chrom, region.start, region.end
+
run_on_regions = True
# Dataset check.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
29 Jun '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/29abb6c4b296/
changeset: 29abb6c4b296
user: jgoecks
date: 2012-06-29 23:57:40
summary: Use Trackster as an entry point for parameter space visualization. Current viewing area, bookmarks, or both can be used as regions in parameter space visualization. Also handle multiple intervals well.
affected #: 10 files
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c lib/galaxy/web/api/tools.py
--- a/lib/galaxy/web/api/tools.py
+++ b/lib/galaxy/web/api/tools.py
@@ -141,6 +141,39 @@
elif isinstance( regions, list ):
# There is a list of regions.
regions = [ GenomeRegion.from_dict( r ) for r in regions ]
+
+ # Sort by chrom name, start so that data is not fetched out of order.
+ regions.sort( key=lambda r: r.chrom )
+ regions.sort( key=lambda r: r.start )
+
+ # Merge overlapping regions so that regions do not overlap
+ # and hence data is not included multiple times.
+ print "REGIONS", regions
+ for region in regions:
+ print "\t", region.chrom, region.start, region.end
+ prev = regions[0]
+ cur = regions[1]
+ index = 1
+ while True:
+ if cur.start <= prev.end:
+ # Found overlapping regions, so join them.
+ prev.end = cur.end
+ del regions[ index ]
+ else:
+ # No overlap, move to next region.
+ prev = cur
+ index += 1
+
+ # Get next region or exit.
+ if index == len( regions ):
+ # Done.
+ break
+ else:
+ cur = regions[ index ]
+
+ print "REGIONS", regions
+ for region in regions:
+ print "\t", region.chrom, region.start, region.end
run_on_regions = True
# Dataset check.
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py
+++ b/lib/galaxy/web/controllers/tracks.py
@@ -484,22 +484,8 @@
viz_config = {
'dataset_id': dataset_id,
'tool_id': job.tool_id,
- 'regions': regions
+ 'regions': from_json_string( regions )
}
-
- viz_config[ 'regions' ] = [
- {
- 'chrom': 'chr19',
- 'start': '10000',
- 'end': '26000'
- },
- {
- 'chrom': 'chr19',
- 'start': '150000',
- 'end': '175000'
- }
-
- ]
# Add tool, dataset attributes to config based on id.
tool = trans.app.toolbox.get_tool( viz_config[ 'tool_id' ] )
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c static/images/fugue/arrow-split-bw.png
Binary file static/images/fugue/arrow-split-bw.png has changed
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c static/images/fugue/arrow-split.png
Binary file static/images/fugue/arrow-split.png has changed
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c static/june_2007_style/base_sprites.less.tmpl
--- a/static/june_2007_style/base_sprites.less.tmpl
+++ b/static/june_2007_style/base_sprites.less.tmpl
@@ -122,6 +122,14 @@
-sprite-group: fugue;
-sprite-image: fugue/cross-circle.png;
}
+.icon-button.arrow-split {
+ -sprite-group: fugue;
+ -sprite-image: fugue/arrow-split-bw.png;
+}
+.icon-button.arrow-split:hover {
+ -sprite-group: fugue;
+ -sprite-image: fugue/arrow-split.png;
+}
.text-and-autocomplete-select {
-sprite-group: fugue;
-sprite-image: fugue/control-270.png;
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c static/june_2007_style/blue/base.css
--- a/static/june_2007_style/blue/base.css
+++ b/static/june_2007_style/blue/base.css
@@ -759,7 +759,9 @@
.icon-button.disk--arrow:hover{background:url(fugue.png) no-repeat 0px -494px;}
.icon-button.cross-circle{background:url(fugue.png) no-repeat 0px -520px;}
.icon-button.cross-circle:hover{background:url(fugue.png) no-repeat 0px -546px;}
-.text-and-autocomplete-select{background:url(fugue.png) no-repeat right -572px;}
+.icon-button.arrow-split{background:url(fugue.png) no-repeat 0px -572px;}
+.icon-button.arrow-split:hover{background:url(fugue.png) no-repeat 0px -598px;}
+.text-and-autocomplete-select{background:url(fugue.png) no-repeat right -624px;}
div.historyItem-error .state-icon{background:url(history-states.png) no-repeat 0px 0px;}
div.historyItem-empty .state-icon{background:url(history-states.png) no-repeat 0px -25px;}
div.historyItem-queued .state-icon{background:url(history-states.png) no-repeat 0px -50px;}
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c static/june_2007_style/blue/fugue.png
Binary file static/june_2007_style/blue/fugue.png has changed
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c static/scripts/viz/trackster.js
--- a/static/scripts/viz/trackster.js
+++ b/static/scripts/viz/trackster.js
@@ -838,11 +838,11 @@
//
/// All tracks the same?
- var drawable,
+ var i, j, drawable,
same_type = true,
a_type = this.drawables[0].get_type(),
num_feature_tracks = 0;
- for (var i = 0; i < num_drawables; i++) {
+ for (i = 0; i < num_drawables; i++) {
drawable = this.drawables[i];
if (drawable.get_type() !== a_type) {
can_composite = false;
@@ -868,21 +868,20 @@
//
// Find shared filters.
//
- var
- shared_filters = {},
+ var shared_filters = {},
filter;
// Init shared filters with filters from first drawable.
drawable = this.drawables[0];
- for (var j = 0; j < drawable.filters_manager.filters.length; j++) {
+ for (j = 0; j < drawable.filters_manager.filters.length; j++) {
filter = drawable.filters_manager.filters[j];
shared_filters[filter.name] = [filter];
}
// Create lists of shared filters.
- for (var i = 1; i < this.drawables.length; i++) {
+ for (i = 1; i < this.drawables.length; i++) {
drawable = this.drawables[i];
- for (var j = 0; j < drawable.filters_manager.filters.length; j++) {
+ for (j = 0; j < drawable.filters_manager.filters.length; j++) {
filter = drawable.filters_manager.filters[j];
if (filter.name in shared_filters) {
shared_filters[filter.name].push(filter);
@@ -1278,8 +1277,8 @@
* Load chrom data for the view. Returns a jQuery Deferred.
*/
load_chroms: function(url_parms) {
- url_parms['num'] = MAX_CHROMS_SELECTABLE;
- url_parms['dbkey'] = this.dbkey;
+ url_parms.num = MAX_CHROMS_SELECTABLE;
+ url_parms.dbkey = this.dbkey;
var
view = this,
@@ -1729,7 +1728,6 @@
var run_tool_row = $("<div>").addClass("param-row").appendTo(this.parent_div);
var run_on_dataset_button = $("<input type='submit'>").attr("value", "Run on complete dataset").appendTo(run_tool_row);
var run_on_region_button = $("<input type='submit'>").attr("value", "Run on visible region").css("margin-left", "3em").appendTo(run_tool_row);
- var tool = this;
run_on_region_button.click( function() {
// Run tool to create new track.
tool.run_on_region();
@@ -2413,14 +2411,14 @@
filter = this.filters[i];
filter_dicts.push(filter.to_dict());
}
- obj_dict['filters'] = filter_dicts;
+ obj_dict.filters = filter_dicts;
// Include transparency, height filters.
- obj_dict['alpha_filter'] = (this.alpha_filter ? this.alpha_filter.name : null);
- obj_dict['height_filter'] = (this.height_filter ? this.height_filter.name : null);
+ obj_dict.alpha_filter = (this.alpha_filter ? this.alpha_filter.name : null);
+ obj_dict.height_filter = (this.height_filter ? this.height_filter.name : null);
// Include visibility.
- obj_dict['visible'] = this.parent_div.is(":visible");
+ obj_dict.visible = this.parent_div.is(":visible");
return obj_dict;
},
@@ -3028,6 +3026,76 @@
$(".tipsy").remove();
}
},
+ // Go to parameter exploration visualization.
+ {
+ name: "param_space_viz_icon",
+ title: "Tool parameter space visualization",
+ css_class: "arrow-split",
+ on_click_fn: function(track) {
+ var template =
+ '<strong>Tool</strong>: <%= track.tool.name %><br/>' +
+ '<strong>Dataset</strong>: <%= track.name %><br/>' +
+ '<strong>Region(s)</strong>: <select name="regions">' +
+ '<option value="cur">current viewing area</option>' +
+ '<option value="bookmarks">bookmarks</option>' +
+ '<option value="both">current viewing area and bookmarks</option>' +
+ '</select>',
+ html = _.template(template, { track: track });
+ var cancel_fn = function() { hide_modal(); $(window).unbind("keypress.check_enter_esc"); },
+ ok_fn = function() {
+ var regions_to_use = $('select[name="regions"] option:selected').val(),
+ regions,
+ view_region = new GenomeRegion({
+ chrom: view.chrom,
+ start: view.low,
+ end: view.high
+ }),
+ bookmarked_regions = _.map($(".bookmark"), function(elt) {
+ return new GenomeRegion({from_str: $(elt).children(".position").text()});
+ });
+
+ console.log(regions_to_use);
+
+ // Get regions for visualization.
+ if (regions_to_use === 'cur') {
+ // Use only current region.
+ regions = [ view_region ];
+ }
+ else if (regions_to_use === 'bookmarks') {
+ // Use only bookmarks.
+ regions = new Backbone.Collection(bookmarked_regions);
+ }
+ else {
+ // Use both current region and bookmarks.
+ regions = new Backbone.Collection([ view_region ].concat(bookmarked_regions));
+ }
+
+ hide_modal();
+
+ // Go to visualization.
+ window.location.href =
+ galaxy_paths.get('paramamonster_url') + "?" +
+ $.param({
+ dataset_id: track.dataset_id,
+ hda_ldda: track.hda_ldda,
+ regions: JSON.stringify(regions.toJSON())
+ });
+ },
+ check_enter_esc = function(e) {
+ if ((e.keyCode || e.which) === 27) { // Escape key
+ cancel_fn();
+ } else if ((e.keyCode || e.which) === 13) { // Enter key
+ ok_fn();
+ }
+ };
+
+ show_modal("Visualize tool parameter space and output from different parameter settings?", html, {
+ "No": cancel_fn,
+ "Yes": ok_fn
+ });
+
+ }
+ },
// Remove track.
Drawable.prototype.action_icons_def[2]
],
@@ -3379,13 +3447,15 @@
}
//
- // Show/hide tool icon.
+ // Show/hide tool icons.
//
if (track.tool) {
track.action_icons.tools_icon.show();
+ track.action_icons.param_space_viz_icon.show();
}
else {
track.action_icons.tools_icon.hide();
+ track.action_icons.param_space_viz_icon.hide();
}
//
@@ -3856,6 +3926,7 @@
// For now, hide filters and tool.
this.action_icons.filters_icon.hide();
this.action_icons.tools_icon.hide();
+ this.action_icons.param_space_viz_icon.hide();
},
can_draw: Drawable.prototype.can_draw,
draw_helper: function(force, width, tile_index, resolution, parent_element, w_scale, kwargs) {
@@ -4341,6 +4412,7 @@
}
this.tiles_div.css("height", track_height + "px");
},
+
/**
* Actions to be taken after draw has been completed. Draw is completed when all tiles have been
* drawn/fetched and shown.
@@ -4353,15 +4425,15 @@
// If mode is Histogram and tiles do not share max, redraw tiles as necessary using new max.
if (track.mode === "Histogram") {
// Get global max.
- var global_max = -1;
- for (var i = 0; i < tiles.length; i++) {
+ var i, global_max = -1;
+ for (i = 0; i < tiles.length; i++) {
var cur_max = tiles[i].max_val;
if (cur_max > global_max) {
global_max = cur_max;
}
}
- for (var i = 0; i < tiles.length; i++) {
+ for (i = 0; i < tiles.length; i++) {
var tile = tiles[i];
if (tile.max_val !== global_max) {
tile.html_elt.remove();
@@ -4477,7 +4549,7 @@
var dummy_context = this.view.canvas_manager.dummy_context,
slotter = this.slotters[level];
if (!slotter || (slotter.mode !== mode)) {
- slotter = new (slotting.FeatureSlotter)( level, mode, MAX_FEATURE_DEPTH, function ( x ) { return dummy_context.measureText( x ) } );
+ slotter = new (slotting.FeatureSlotter)( level, mode, MAX_FEATURE_DEPTH, function ( x ) { return dummy_context.measureText( x ); } );
this.slotters[level] = slotter;
}
@@ -4726,7 +4798,7 @@
}
return true;
- },
+ }
});
var VcfTrack = function(view, container, obj_dict) {
@@ -4740,7 +4812,7 @@
{ key: 'label_color', label: 'Label color', type: 'color', default_value: 'black' },
{ key: 'show_insertions', label: 'Show insertions', type: 'bool', default_value: false },
{ key: 'show_counts', label: 'Show summary counts', type: 'bool', default_value: true },
- { key: 'mode', type: 'string', default_value: this.mode, hidden: true },
+ { key: 'mode', type: 'string', default_value: this.mode, hidden: true }
],
saved_values: obj_dict.prefs,
onchange: function() {
@@ -4773,7 +4845,7 @@
{ key: 'show_differences', label: 'Show differences only', type: 'bool', default_value: true },
{ key: 'show_counts', label: 'Show summary counts', type: 'bool', default_value: true },
{ key: 'histogram_max', label: 'Histogram maximum', type: 'float', default_value: null, help: 'Clear value to set automatically' },
- { key: 'mode', type: 'string', default_value: this.mode, hidden: true },
+ { key: 'mode', type: 'string', default_value: this.mode, hidden: true }
],
saved_values: obj_dict.prefs,
onchange: function() {
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -269,7 +269,7 @@
obj_cache = this.get('obj_cache'),
key, entry_region;
for (var i = 0; i < key_ary.length; i++) {
- entry_region = new GenomeRegion(key_ary[i]);
+ entry_region = new GenomeRegion({from_str: key_ary[i]});
if (entry_region.contains(region)) {
// This entry has data in the requested range. Return if data
@@ -420,20 +420,19 @@
},
/**
- * If options is a string, parsing using the format
- * chrom:start-end is attempted to set object attributes.
+ * If from_str specified, use it to initialize attributes.
*/
initialize: function(options) {
- if (typeof(options) === 'string') {
- var pieces = options.split(':'),
+ if (options.from_str) {
+ var pieces = options.from_str.split(':'),
chrom = pieces[0],
start_end = pieces[1].split('-');
this.set({
chrom: chrom,
- start: parseInt(start_end[0]),
- end: parseInt(start_end[1])
+ start: parseInt(start_end[0], 10),
+ end: parseInt(start_end[1], 10)
});
- }
+ }
},
copy: function() {
@@ -552,7 +551,12 @@
datasets: []
},
- url: galaxy_paths.get("visualization_url"),
+ // Use function because visualization_url changes depending on viz.
+ // FIXME: all visualizations should save to the same URL (and hence
+ // this function won't be needed).
+ url: function() {
+ return galaxy_paths.get("visualization_url");
+ },
/**
* POSTs visualization's JSON to its URL using the parameter 'vis_json'
@@ -561,7 +565,7 @@
*/
save: function() {
return $.ajax({
- url: this.url,
+ url: this.url(),
type: "POST",
dataType: "json",
data: {
diff -r cc5fea2e382ed8edadf0d694f559b46e86a66884 -r 29abb6c4b296815594c93cd8d72944628160145c templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -49,7 +49,8 @@
// Place URLs here so that url_for can be used to generate them.
//
galaxy_paths.set({
- visualization_url: "${h.url_for( action='save' )}"
+ visualization_url: "${h.url_for( action='save' )}",
+ paramamonster_url: "${h.url_for( action='paramamonster' )}",
});
var
add_track_async_url = "${h.url_for( action='add_track_async' )}",
@@ -141,10 +142,10 @@
// Save bookmarks.
var bookmarks = [];
$(".bookmark").each(function() {
- bookmarks[bookmarks.length] = {
+ bookmarks.push({
position: $(this).children(".position").text(),
annotation: $(this).children(".annotation").text()
- };
+ });
});
// FIXME: give unique IDs to Drawables and save overview as ID.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Refinements for installing tool shed repositories and tool dependencies.
by Bitbucket 29 Jun '12
by Bitbucket 29 Jun '12
29 Jun '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/cc5fea2e382e/
changeset: cc5fea2e382e
user: greg
date: 2012-06-29 21:44:49
summary: Refinements for installing tool shed repositories and tool dependencies.
affected #: 18 files
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -2647,15 +2647,23 @@
pass
class ToolShedRepository( object ):
- installation_status = Bunch( CLONED='cloned',
- SETTING_TOOL_VERSIONS='setting tool versions',
- INSTALLING_TOOL_DEPENDENCIES='installing tool dependencies',
- INSTALLED='installed',
- ERROR='error',
- UNINSTALLED='uninstalled' )
+ installation_status = Bunch( NEW='New',
+ CLONING='Cloning',
+ SETTING_TOOL_VERSIONS='Setting tool versions',
+ INSTALLING_TOOL_DEPENDENCIES='Installing tool dependencies',
+ LOADING_PROPRIETARY_DATATYPES='Loading proprietary datatypes',
+ INSTALLED='Installed',
+ DEACTIVATED='Deactivated',
+ ERROR='Error',
+ UNINSTALLED='Uninstalled' )
+ states = Bunch( INSTALLING = 'running',
+ OK = 'ok',
+ WARNING = 'queued',
+ ERROR = 'error',
+ UNINSTALLED = 'deleted_new' )
def __init__( self, id=None, create_time=None, tool_shed=None, name=None, description=None, owner=None, installed_changeset_revision=None,
changeset_revision=None, ctx_rev=None, metadata=None, includes_datatypes=False, update_available=False, deleted=False,
- uninstalled=False, dist_to_shed=False ):
+ uninstalled=False, dist_to_shed=False, status=None, error_message=None ):
self.id = id
self.create_time = create_time
self.tool_shed = tool_shed
@@ -2671,6 +2679,8 @@
self.deleted = deleted
self.uninstalled = uninstalled
self.dist_to_shed = dist_to_shed
+ self.status = status
+ self.error_message = error_message
def repo_files_directory( self, app ):
repo_path = self.repo_path( app )
if repo_path:
@@ -2723,6 +2733,16 @@
dependencies_being_installed.append( tool_dependency )
return dependencies_being_installed
@property
+ def tool_dependencies_missing_or_being_installed( self ):
+ dependencies_missing_or_being_installed = []
+ for tool_dependency in self.tool_dependencies:
+ if tool_dependency.status in [ ToolDependency.installation_status.ERROR,
+ ToolDependency.installation_status.INSTALLING,
+ ToolDependency.installation_status.NEVER_INSTALLED,
+ ToolDependency.installation_status.UNINSTALLED ]:
+ dependencies_missing_or_being_installed.append( tool_dependency )
+ return dependencies_missing_or_being_installed
+ @property
def tool_dependencies_with_installation_errors( self ):
dependencies_with_installation_errors = []
for tool_dependency in self.tool_dependencies:
@@ -2746,6 +2766,7 @@
UNINSTALLED='Uninstalled' )
states = Bunch( INSTALLING = 'running',
OK = 'ok',
+ WARNING = 'queued',
ERROR = 'error',
UNINSTALLED = 'deleted_new' )
def __init__( self, tool_shed_repository_id=None, name=None, version=None, type=None, status=None, error_message=None ):
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 lib/galaxy/model/mapping.py
--- a/lib/galaxy/model/mapping.py
+++ b/lib/galaxy/model/mapping.py
@@ -388,7 +388,9 @@
Column( "update_available", Boolean, default=False ),
Column( "deleted", Boolean, index=True, default=False ),
Column( "uninstalled", Boolean, default=False ),
- Column( "dist_to_shed", Boolean, default=False ) )
+ Column( "dist_to_shed", Boolean, default=False ),
+ Column( "status", TrimmedString( 255 ) ),
+ Column( "error_message", TEXT ) )
ToolDependency.table = Table( "tool_dependency", metadata,
Column( "id", Integer, primary_key=True ),
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 lib/galaxy/model/migrate/versions/0103_add_tool_shed_repository_status_columns.py
--- /dev/null
+++ b/lib/galaxy/model/migrate/versions/0103_add_tool_shed_repository_status_columns.py
@@ -0,0 +1,68 @@
+"""Migration script to add status and error_message columns to the tool_shed_repository table."""
+
+from sqlalchemy import *
+from sqlalchemy.orm import *
+from migrate import *
+from migrate.changeset import *
+
+import datetime
+now = datetime.datetime.utcnow
+# Need our custom types, but don't import anything else from model
+from galaxy.model.custom_types import *
+
+metadata = MetaData( migrate_engine )
+db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) )
+
+def upgrade():
+ print __doc__
+ metadata.reflect()
+ ToolShedRepository_table = Table( "tool_shed_repository", metadata, autoload=True )
+ # Add the status column to the tool_shed_repository table.
+ col = Column( "status", TrimmedString( 255 ) )
+ try:
+ col.create( ToolShedRepository_table )
+ assert col is ToolShedRepository_table.c.status
+ except Exception, e:
+ print "Adding status column to the tool_shed_repository table failed: %s" % str( e )
+ # Add the error_message column to the tool_shed_repository table.
+ col = Column( "error_message", TEXT )
+ try:
+ col.create( ToolShedRepository_table )
+ assert col is ToolShedRepository_table.c.error_message
+ except Exception, e:
+ print "Adding error_message column to the tool_shed_repository table failed: %s" % str( e )
+ # Update the status column value for tool_shed_repositories to the default value 'Installed'.
+ cmd = "UPDATE tool_shed_repository SET status = 'Installed';"
+ try:
+ db_session.execute( cmd )
+ except Exception, e:
+ print "Exception executing sql command: "
+ print cmd
+ print str( e )
+ # Update the status column for tool_shed_repositories that have been uninstalled.
+ cmd = "UPDATE tool_shed_repository SET status = 'Uninstalled' WHERE uninstalled;"
+ try:
+ db_session.execute( cmd )
+ except Exception, e:
+ print "Exception executing sql command: "
+ print cmd
+ print str( e )
+ # Update the status column for tool_shed_repositories that have been deactivated.
+ cmd = "UPDATE tool_shed_repository SET status = 'Deactivated' where deleted and not uninstalled;"
+ try:
+ db_session.execute( cmd )
+ except Exception, e:
+ print "Exception executing sql command: "
+ print cmd
+ print str( e )
+def downgrade():
+ metadata.reflect()
+ ToolShedRepository_table = Table( "tool_shed_repository", metadata, autoload=True )
+ try:
+ ToolShedRepository_table.c.status.drop()
+ except Exception, e:
+ print "Dropping column status from the tool_shed_repository table failed: %s" % str( e )
+ try:
+ ToolShedRepository_table.c.error_message.drop()
+ except Exception, e:
+ print "Dropping column error_message from the tool_shed_repository table failed: %s" % str( e )
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 lib/galaxy/tool_shed/install_manager.py
--- a/lib/galaxy/tool_shed/install_manager.py
+++ b/lib/galaxy/tool_shed/install_manager.py
@@ -119,12 +119,8 @@
if not is_displayed:
is_displayed = True
return is_displayed, tool_sections
- def handle_repository_contents( self, repository_clone_url, relative_install_dir, repository_elem, repository_name, description,
- installed_changeset_revision, ctx_rev, install_dependencies ):
- # Generate the metadata for the installed tool shed repository, among other things. It is critical that the installed repository is
- # updated to the desired changeset_revision before metadata is set because the process for setting metadata uses the repository files on disk.
- # The values for the keys in each of the following dictionaries will be a list to allow for the same tool to be displayed in multiple places
- # in the tool panel.
+ def handle_repository_contents( self, tool_shed_repository, repository_clone_url, relative_install_dir, repository_elem, install_dependencies ):
+ """Generate the metadata for the installed tool shed repository, among other things."""
tool_panel_dict_for_display = odict()
for tool_elem in repository_elem:
# The tool_elem looks something like this: <tool id="EMBOSS: antigenic1" version="5.0.0" file="emboss_antigenic.xml" />
@@ -137,21 +133,12 @@
for k, v in tool_panel_dict_for_tool_config.items():
tool_panel_dict_for_display[ k ] = v
metadata_dict = generate_metadata_using_disk_files( self.toolbox, relative_install_dir, repository_clone_url )
- # Add a new record to the tool_shed_repository table if one doesn't already exist. If one exists but is marked
- # deleted, undelete it. It is critical that this happens before the call to add_to_tool_panel() below because
- # tools will not be properly loaded if the repository is marked deleted.
- print "Adding new row (or updating an existing row) for repository '%s' in the tool_shed_repository table." % repository_name
- tool_shed_repository = create_or_update_tool_shed_repository( self.app,
- repository_name,
- description,
- installed_changeset_revision,
- ctx_rev,
- repository_clone_url,
- metadata_dict,
- dist_to_shed=True )
+ tool_shed_repository.metadata = metadata_dict
+ self.app.sa_session.add( tool_shed_repository )
+ self.app.sa_session.flush()
if 'tool_dependencies' in metadata_dict:
- # All tool_dependency objects must be created before the tools are processed no matter whether tool dependencies are going to be installed.
- tool_dependencies = create_tool_dependency_objects( self.app, tool_shed_repository, installed_changeset_revision )
+ # All tool_dependency objects must be created before the tools are processed even if no tool dependencies will be installed.
+ tool_dependencies = create_tool_dependency_objects( self.app, tool_shed_repository, tool_shed_repository.installed_changeset_revision )
else:
tool_dependencies = None
if 'tools' in metadata_dict:
@@ -162,7 +149,7 @@
# Handle missing data table entries for tool parameters that are dynamically generated select lists.
repository_tools_tups = handle_missing_data_table_entry( self.app,
tool_shed_repository,
- installed_changeset_revision,
+ tool_shed_repository.installed_changeset_revision,
self.tool_path,
repository_tools_tups,
work_dir )
@@ -171,13 +158,16 @@
# Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance.
copy_sample_files( self.app, sample_files, sample_files_copied=sample_files_copied )
if install_dependencies and tool_dependencies and 'tool_dependencies' in metadata_dict:
+ # Install tool dependencies.
+ update_tool_shed_repository_status( self.app,
+ tool_shed_repository,
+ self.app.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES )
# Get the tool_dependencies.xml file from the repository.
tool_dependencies_config = get_config_from_repository( self.app,
'tool_dependencies.xml',
tool_shed_repository,
- installed_changeset_revision,
+ tool_shed_repository.installed_changeset_revision,
work_dir )
- # Install tool dependencies.
installed_tool_dependencies = handle_tool_dependencies( app=self.app,
tool_shed_repository=tool_shed_repository,
tool_dependencies_config=tool_dependencies_config,
@@ -187,9 +177,9 @@
print '\nThe following error occurred from the InstallManager while installing tool dependency ', installed_tool_dependency.name, ':'
print installed_tool_dependency.error_message, '\n\n'
add_to_tool_panel( self.app,
- repository_name,
+ tool_shed_repository.name,
repository_clone_url,
- installed_changeset_revision,
+ tool_shed_repository.installed_changeset_revision,
repository_tools_tups,
self.repository_owner,
self.migrated_tools_config,
@@ -200,11 +190,14 @@
except:
pass
if 'datatypes' in metadata_dict:
+ update_tool_shed_repository_status( self.app,
+ tool_shed_repository,
+ self.app.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES )
work_dir = make_tmp_directory()
datatypes_config = get_config_from_repository( self.app,
'datatypes_conf.xml',
tool_shed_repository,
- installed_changeset_revision,
+ tool_shed_repository.installed_changeset_revision,
work_dir )
# Load proprietary data types required by tools. The value of override is not important here since the Galaxy server will be started
# after this installation completes.
@@ -212,9 +205,9 @@
if converter_path or display_path:
# Create a dictionary of tool shed repository related information.
repository_dict = create_repository_dict_for_proprietary_datatypes( tool_shed=self.tool_shed,
- name=repository_name,
+ name=tool_shed_repository.name,
owner=self.repository_owner,
- installed_changeset_revision=installed_changeset_revision,
+ installed_changeset_revision=tool_shed_repository.installed_changeset_revision,
tool_dicts=metadata_dict.get( 'tools', [] ),
converter_path=converter_path,
display_path=display_path )
@@ -228,7 +221,6 @@
shutil.rmtree( work_dir )
except:
pass
- return tool_shed_repository, metadata_dict
def install_repository( self, repository_elem, install_dependencies ):
# Install a single repository, loading contained tools into the tool panel.
name = repository_elem.get( 'name' )
@@ -243,16 +235,31 @@
repository_clone_url = os.path.join( tool_shed_url, 'repos', self.repository_owner, name )
relative_install_dir = os.path.join( clone_dir, name )
ctx_rev = get_ctx_rev( tool_shed_url, name, self.repository_owner, installed_changeset_revision )
+ print "Adding new row (or updating an existing row) for repository '%s' in the tool_shed_repository table." % name
+ tool_shed_repository = create_or_update_tool_shed_repository( app=self.app,
+ name=name,
+ description=description,
+ installed_changeset_revision=installed_changeset_revision,
+ ctx_rev=ctx_rev,
+ repository_clone_url=repository_clone_url,
+ metadata_dict={},
+ status=self.app.model.ToolShedRepository.installation_status.NEW,
+ current_changeset_revision=None,
+ owner=self.repository_owner,
+ dist_to_shed=True )
+ update_tool_shed_repository_status( self.app, tool_shed_repository, self.app.model.ToolShedRepository.installation_status.CLONING )
clone_repository( repository_clone_url, os.path.abspath( relative_install_dir ), ctx_rev )
- tool_shed_repository, metadata_dict = self.handle_repository_contents( repository_clone_url,
- relative_install_dir,
- repository_elem,
- name,
- description,
- installed_changeset_revision,
- ctx_rev,
- install_dependencies )
+ self.handle_repository_contents( tool_shed_repository=tool_shed_repository,
+ repository_clone_url=repository_clone_url,
+ relative_install_dir=relative_install_dir,
+ repository_elem=repository_elem,
+ install_dependencies=install_dependencies )
+ self.app.sa_session.refresh( tool_shed_repository )
+ metadata_dict = tool_shed_repository.metadata
if 'tools' in metadata_dict:
+ update_tool_shed_repository_status( self.app,
+ tool_shed_repository,
+ self.app.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS )
# Get the tool_versions from the tool shed for each tool in the installed change set.
url = '%s/repository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy&no_reset=true' % \
( tool_shed_url, tool_shed_repository.name, self.repository_owner, installed_changeset_revision )
@@ -291,6 +298,7 @@
parent_id=tool_version_using_old_id.id )
self.app.sa_session.add( tool_version_association )
self.app.sa_session.flush()
+ update_tool_shed_repository_status( self.app, tool_shed_repository, self.app.model.ToolShedRepository.installation_status.INSTALLED )
@property
def non_shed_tool_panel_configs( self ):
# Get the non-shed related tool panel config file names from the Galaxy config - the default is tool_conf.xml.
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -279,11 +279,11 @@
def clone_repository( repository_clone_url, repository_file_dir, ctx_rev ):
"""Clone the repository up to the specified changeset_revision. No subsequent revisions will be present in the cloned repository."""
commands.clone( get_configured_ui(),
- repository_clone_url,
- dest=repository_file_dir,
+ str( repository_clone_url ),
+ dest=str( repository_file_dir ),
pull=True,
noupdate=False,
- rev=[ ctx_rev ] )
+ rev=util.listify( str( ctx_rev ) ) )
def copy_sample_file( app, filename, dest_path=None ):
"""Copy xxx.loc.sample to dest_path/xxx.loc.sample and dest_path/xxx.loc. The default value for dest_path is ~/tool-data."""
if dest_path is None:
@@ -313,7 +313,7 @@
converter_path=converter_path,
display_path=display_path )
def create_or_update_tool_shed_repository( app, name, description, installed_changeset_revision, ctx_rev, repository_clone_url, metadata_dict,
- current_changeset_revision=None, owner='', dist_to_shed=False ):
+ status, current_changeset_revision=None, owner='', dist_to_shed=False ):
# The received value for dist_to_shed will be True if the InstallManager is installing a repository that contains tools or datatypes that used
# to be in the Galaxy distribution, but have been moved to the main Galaxy tool shed.
if current_changeset_revision is None:
@@ -337,8 +337,17 @@
tool_shed_repository.ctx_rev = ctx_rev
tool_shed_repository.metadata = metadata_dict
tool_shed_repository.includes_datatypes = includes_datatypes
- tool_shed_repository.deleted = False
- tool_shed_repository.uninstalled = False
+ tool_shed_repository.status = status
+ if status in [ app.model.ToolShedRepository.installation_status.NEW,
+ app.model.ToolShedRepository.installation_status.CLONING,
+ app.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS,
+ app.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES,
+ app.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES,
+ app.model.ToolShedRepository.installation_status.INSTALLED,
+ app.model.ToolShedRepository.installation_status.ERROR ]:
+ tool_shed_repository.deleted = False
+ if status not in [ app.model.ToolShedRepository.installation_status.UNINSTALLED ]:
+ tool_shed_repository.uninstalled = False
else:
tool_shed_repository = app.model.ToolShedRepository( tool_shed=tool_shed,
name=name,
@@ -349,7 +358,8 @@
ctx_rev=ctx_rev,
metadata=metadata_dict,
includes_datatypes=includes_datatypes,
- dist_to_shed=dist_to_shed )
+ dist_to_shed=dist_to_shed,
+ status=status )
sa_session.add( tool_shed_repository )
sa_session.flush()
return tool_shed_repository
@@ -1255,87 +1265,6 @@
def load_installed_display_applications( installed_repository_dict, deactivate=False ):
# Load or deactivate proprietary datatype display applications
app.datatypes_registry.load_display_applications( installed_repository_dict=installed_repository_dict, deactivate=deactivate )
-def load_repository_contents( trans, repository_name, description, owner, installed_changeset_revision, current_changeset_revision, ctx_rev,
- tool_path, repository_clone_url, relative_install_dir, tool_shed=None, tool_section=None, shed_tool_conf=None ):
- """
- Generate the metadata for the installed tool shed repository, among other things. This method is called from Galaxy (never the tool shed)
- when an admin is installing a new repository or reinstalling an uninstalled repository.
- """
- metadata_dict = generate_metadata_using_disk_files( trans.app.toolbox, relative_install_dir, repository_clone_url )
- # Add a new record to the tool_shed_repository table if one doesn't already exist. If one exists but is marked deleted, undelete it. This
- # must happen before the call to add_to_tool_panel() below because tools will not be properly loaded if the repository is marked deleted.
- log.debug( "Adding new row (or updating an existing row) for repository '%s' in the tool_shed_repository table." % repository_name )
- tool_shed_repository = create_or_update_tool_shed_repository( trans.app,
- repository_name,
- description,
- installed_changeset_revision,
- ctx_rev,
- repository_clone_url,
- metadata_dict,
- current_changeset_revision=current_changeset_revision,
- owner='',
- dist_to_shed=False )
- if 'tools' in metadata_dict:
- tool_panel_dict = generate_tool_panel_dict_for_new_install( metadata_dict[ 'tools' ], tool_section )
- repository_tools_tups = get_repository_tools_tups( trans.app, metadata_dict )
- if repository_tools_tups:
- # Handle missing data table entries for tool parameters that are dynamically generated select lists.
- work_dir = make_tmp_directory()
- repository_tools_tups = handle_missing_data_table_entry( trans.app,
- tool_shed_repository,
- current_changeset_revision,
- tool_path,
- repository_tools_tups,
- work_dir )
- # Handle missing index files for tool parameters that are dynamically generated select lists.
- sample_files = metadata_dict.get( 'sample_files', [] )
- repository_tools_tups, sample_files_copied = handle_missing_index_file( trans.app, tool_path, sample_files, repository_tools_tups )
- # Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance.
- copy_sample_files( trans.app, sample_files, sample_files_copied=sample_files_copied )
- add_to_tool_panel( app=trans.app,
- repository_name=repository_name,
- repository_clone_url=repository_clone_url,
- changeset_revision=current_changeset_revision,
- repository_tools_tups=repository_tools_tups,
- owner=owner,
- shed_tool_conf=shed_tool_conf,
- tool_panel_dict=tool_panel_dict,
- new_install=True )
- try:
- shutil.rmtree( work_dir )
- except:
- pass
- if 'datatypes' in metadata_dict:
- work_dir = make_tmp_directory()
- datatypes_config = get_config_from_repository( trans.app,
- 'datatypes_conf.xml',
- tool_shed_repository,
- current_changeset_revision,
- work_dir )
- # Load data types required by tools.
- converter_path, display_path = alter_config_and_load_prorietary_datatypes( trans.app, datatypes_config, relative_install_dir, override=False )
- if converter_path or display_path:
- # Create a dictionary of tool shed repository related information.
- repository_dict = create_repository_dict_for_proprietary_datatypes( tool_shed=tool_shed,
- name=repository_name,
- owner=owner,
- installed_changeset_revision=installed_changeset_revision,
- tool_dicts=metadata_dict.get( 'tools', [] ),
- converter_path=converter_path,
- display_path=display_path )
- if converter_path:
- # Load proprietary datatype converters
- trans.app.datatypes_registry.load_datatype_converters( trans.app.toolbox, installed_repository_dict=repository_dict )
- if display_path:
- # Load proprietary datatype display applications
- trans.app.datatypes_registry.load_display_applications( installed_repository_dict=repository_dict )
- try:
- shutil.rmtree( work_dir )
- except:
- pass
- if 'tool_dependencies' in metadata_dict:
- tool_dependencies = create_tool_dependency_objects( trans.app, tool_shed_repository, current_changeset_revision )
- return tool_shed_repository, metadata_dict
def make_tmp_directory():
tmp_dir = os.getenv( 'TMPDIR', '' )
if tmp_dir:
@@ -1582,3 +1511,8 @@
commands.update( get_configured_ui(),
repo,
rev=ctx_rev )
+def update_tool_shed_repository_status( app, tool_shed_repository, status ):
+ sa_session = app.model.context.current
+ tool_shed_repository.status = status
+ sa_session.add( tool_shed_repository )
+ sa_session.flush()
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 lib/galaxy/web/controllers/admin_toolshed.py
--- a/lib/galaxy/web/controllers/admin_toolshed.py
+++ b/lib/galaxy/web/controllers/admin_toolshed.py
@@ -7,17 +7,17 @@
from galaxy import eggs, tools
eggs.require( 'mercurial' )
-from mercurial import hg
+from mercurial import hg, ui, commands
log = logging.getLogger( __name__ )
MAX_CONTENT_SIZE = 32768
-class RepositoryListGrid( grids.Grid ):
+class InstalledRepositoryGrid( grids.Grid ):
class NameColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool_shed_repository ):
if tool_shed_repository.update_available:
- return '<div class="count-box state-color-error">%s</div>' % tool_shed_repository.name
+ return '<div class="count-box state-color-running">%s</div>' % tool_shed_repository.name
return tool_shed_repository.name
class DescriptionColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool_shed_repository ):
@@ -28,6 +28,30 @@
class RevisionColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool_shed_repository ):
return tool_shed_repository.changeset_revision
+ class StatusColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool_shed_repository ):
+ if tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.CLONING,
+ trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS,
+ trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES,
+ trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES ]:
+ bgcolor = trans.model.ToolShedRepository.states.INSTALLING
+ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.NEW,
+ trans.model.ToolShedRepository.installation_status.UNINSTALLED ]:
+ bgcolor = trans.model.ToolShedRepository.states.UNINSTALLED
+ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.ERROR ]:
+ bgcolor = trans.model.ToolShedRepository.states.ERROR
+ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.DEACTIVATED ]:
+ bgcolor = trans.model.ToolShedRepository.states.WARNING
+ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLED ]:
+ if tool_shed_repository.missing_tool_dependencies:
+ bgcolor = trans.model.ToolShedRepository.states.WARNING
+ else:
+ bgcolor = trans.model.ToolShedRepository.states.OK
+ else:
+ bgcolor = trans.model.ToolShedRepository.states.ERROR
+ rval = '<div class="count-box state-color-%s">' % bgcolor
+ rval += '%s</div>' % tool_shed_repository.status
+ return rval
class ToolShedColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool_shed_repository ):
return tool_shed_repository.tool_shed
@@ -44,6 +68,8 @@
DescriptionColumn( "Description" ),
OwnerColumn( "Owner" ),
RevisionColumn( "Revision" ),
+ StatusColumn( "Installation Status",
+ filterable="advanced" ),
ToolShedColumn( "Tool shed" ),
# Columns that are valid for filtering but are not visible.
grids.DeletedColumn( "Deleted",
@@ -77,6 +103,101 @@
def build_initial_query( self, trans, **kwd ):
return trans.sa_session.query( self.model_class )
+class RepositoryInstallationGrid( grids.Grid ):
+ class NameColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool_shed_repository ):
+ return tool_shed_repository.name
+ class DescriptionColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool_shed_repository ):
+ return tool_shed_repository.description
+ class OwnerColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool_shed_repository ):
+ return tool_shed_repository.owner
+ class RevisionColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool_shed_repository ):
+ return tool_shed_repository.changeset_revision
+ class StatusColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool_shed_repository ):
+ if tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.CLONING,
+ trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS,
+ trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES,
+ trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES ]:
+ bgcolor = trans.model.ToolShedRepository.states.INSTALLING
+ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.NEW,
+ trans.model.ToolShedRepository.installation_status.UNINSTALLED ]:
+ bgcolor = trans.model.ToolShedRepository.states.UNINSTALLED
+ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.ERROR ]:
+ bgcolor = trans.model.ToolShedRepository.states.ERROR
+ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.DEACTIVATED ]:
+ bgcolor = trans.model.ToolShedRepository.states.WARNING
+ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLED ]:
+ if tool_shed_repository.missing_tool_dependencies:
+ bgcolor = trans.model.ToolShedRepository.states.WARNING
+ else:
+ bgcolor = trans.model.ToolShedRepository.states.OK
+ else:
+ bgcolor = trans.model.ToolShedRepository.states.ERROR
+ rval = '<div class="count-box state-color-%s" id="ToolShedRepositoryStatus-%s">' % ( bgcolor, trans.security.encode_id( tool_shed_repository.id ) )
+ rval += '%s</div>' % tool_shed_repository.status
+ return rval
+
+ webapp = "galaxy"
+ title = "Monitor installing tool shed repositories"
+ template = "admin/tool_shed_repository/repository_installation_grid.mako"
+ model_class = model.ToolShedRepository
+ default_sort_key = "-create_time"
+ num_rows_per_page = 50
+ preserve_state = True
+ use_paging = False
+ columns = [
+ NameColumn( "Name",
+ link=( lambda item: iff( item.status in \
+ [ model.ToolShedRepository.installation_status.NEW,
+ model.ToolShedRepository.installation_status.CLONING,
+ model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS,
+ model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES,
+ model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES,
+ model.ToolShedRepository.installation_status.UNINSTALLED ], \
+ None, dict( action="manage_repository", id=item.id ) ) ),
+ filterable="advanced" ),
+ DescriptionColumn( "Description",
+ filterable="advanced" ),
+ OwnerColumn( "Owner",
+ filterable="advanced" ),
+ RevisionColumn( "Revision",
+ filterable="advanced" ),
+ StatusColumn( "Installation Status",
+ filterable="advanced" ),
+ ]
+ operations = []
+ def build_initial_query( self, trans, **kwd ):
+ clause_list = []
+ tool_shed_repository_ids = util.listify( kwd.get( 'tool_shed_repository_ids', None ) )
+ if tool_shed_repository_ids:
+ for tool_shed_repository_id in tool_shed_repository_ids:
+ clause_list.append( self.model_class.table.c.id == trans.security.decode_id( tool_shed_repository_id ) )
+ if clause_list:
+ return trans.sa_session.query( self.model_class ) \
+ .filter( or_( *clause_list ) )
+ for tool_shed_repository in trans.sa_session.query( self.model_class ) \
+ .filter( self.model_class.table.c.deleted == False ):
+ if tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.NEW,
+ trans.model.ToolShedRepository.installation_status.CLONING,
+ trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS,
+ trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES,
+ trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES ]:
+ clause_list.append( self.model_class.table.c.id == trans.security.decode_id( tool_shed_repository.id ) )
+ if clause_list:
+ return trans.sa_session.query( self.model_class ) \
+ .filter( or_( *clause_list ) )
+ return trans.sa_session.query( self.model_class ) \
+ .filter( self.model_class.table.c.status == trans.model.ToolShedRepository.installation_status.NEW )
+ def apply_query_filter( self, trans, query, **kwd ):
+ tool_shed_repository_id = kwd.get( 'tool_shed_repository_id', None )
+ if tool_shed_repository_id:
+ return query.filter_by( tool_shed_repository_id=trans.security.decode_id( tool_shed_repository_id ) )
+ return query
+
class ToolDependencyGrid( grids.Grid ):
class NameColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool_dependency ):
@@ -90,18 +211,17 @@
class StatusColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool_dependency ):
if tool_dependency.status in [ trans.model.ToolDependency.installation_status.INSTALLING ]:
- return tool_dependency.status
- else:
- if tool_dependency.status in [ trans.model.ToolDependency.installation_status.NEVER_INSTALLED,
- trans.model.ToolDependency.installation_status.UNINSTALLED ]:
- bgcolor = trans.model.ToolDependency.states.UNINSTALLED
- elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.ERROR ]:
- bgcolor = trans.model.ToolDependency.states.ERROR
- elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.INSTALLED ]:
- bgcolor = trans.model.ToolDependency.states.OK
- rval = '<div class="count-box state-color-%s" id="ToolDependencyStatus-%s">' % ( bgcolor, trans.security.encode_id( tool_dependency.id ) )
- rval += '%s</div>' % tool_dependency.status
- return rval
+ bgcolor = trans.model.ToolDependency.states.INSTALLING
+ elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.NEVER_INSTALLED,
+ trans.model.ToolDependency.installation_status.UNINSTALLED ]:
+ bgcolor = trans.model.ToolDependency.states.UNINSTALLED
+ elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.ERROR ]:
+ bgcolor = trans.model.ToolDependency.states.ERROR
+ elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.INSTALLED ]:
+ bgcolor = trans.model.ToolDependency.states.OK
+ rval = '<div class="count-box state-color-%s" id="ToolDependencyStatus-%s">' % ( bgcolor, trans.security.encode_id( tool_dependency.id ) )
+ rval += '%s</div>' % tool_dependency.status
+ return rval
webapp = "galaxy"
title = "Tool Dependencies"
@@ -138,7 +258,7 @@
model.ToolDependency.installation_status.ERROR ] ) )
]
def build_initial_query( self, trans, **kwd ):
- tool_dependency_ids = kwd.get( 'tool_dependency_ids', None )
+ tool_dependency_ids = util.listify( kwd.get( 'tool_dependency_ids', None ) )
if tool_dependency_ids:
clause_list = []
for tool_dependency_id in tool_dependency_ids:
@@ -148,13 +268,14 @@
return trans.sa_session.query( self.model_class )
def apply_query_filter( self, trans, query, **kwd ):
tool_dependency_id = kwd.get( 'tool_dependency_id', None )
- if not tool_dependency_id:
- return query
- return query.filter_by( tool_dependency_id=trans.security.decode_id( tool_dependency_id ) )
+ if tool_dependency_id:
+ return query.filter_by( tool_dependency_id=trans.security.decode_id( tool_dependency_id ) )
+ return query
class AdminToolshed( AdminGalaxy ):
- repository_list_grid = RepositoryListGrid()
+ installed_repository_grid = InstalledRepositoryGrid()
+ repository_installation_grid = RepositoryInstallationGrid()
tool_dependency_grid = ToolDependencyGrid()
@web.expose
@@ -165,6 +286,7 @@
shed_tool_conf, tool_path, relative_install_dir = get_tool_panel_config_tool_path_install_dir( trans.app, repository )
repository_clone_url = self.__generate_clone_url( trans, repository )
repository.deleted = False
+ repository.status = trans.model.ToolShedRepository.installation_status.INSTALLED
trans.sa_session.add( repository )
trans.sa_session.flush()
if repository.includes_tools:
@@ -220,8 +342,8 @@
if operation == "deactivate or uninstall":
return self.deactivate_or_uninstall_repository( trans, **kwd )
if 'message' not in kwd or not kwd[ 'message' ]:
- kwd[ 'message' ] = 'Names of repositories for which updates are available are highlighted in red.'
- return self.repository_list_grid( trans, **kwd )
+ kwd[ 'message' ] = 'Names of repositories for which updates are available are highlighted in yellow.'
+ return self.installed_repository_grid( trans, **kwd )
@web.expose
@web.require_admin
def browse_tool_dependency( self, trans, **kwd ):
@@ -262,52 +384,23 @@
return trans.response.send_redirect( url )
@web.expose
@web.require_admin
- def confirm_tool_dependency_install( self, trans, **kwd ):
- """Display a page enabling the Galaxy administrator to choose to install tool dependencies for a tool shed repository they are installing."""
- # This method is called from the tool shed (never Galaxy) when a tool shed repository that includes a file named tool_dependencies.xml
- # is being installed into a local Galaxy instance.
- message = kwd.get( 'message', '' )
- status = kwd.get( 'status', 'done' )
- tool_shed_url = kwd[ 'tool_shed_url' ]
- repo_info_dict = kwd[ 'repo_info_dict' ]
- includes_tools = util.string_as_bool( kwd.get( 'includes_tools', False ) )
- # Decode the encoded repo_info_dict param value.
- dict_with_tool_dependencies = tool_shed_decode( repo_info_dict )
- # The repo_info_dict includes tool dependencies which we need to display so the user knows what will be installed.
- new_repo_info_dict = {}
- for name, repo_info_tuple in dict_with_tool_dependencies.items():
- description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple
- # Create a new repo_info_dict by eliminating tool-dependencies from the repo_info_tuple.
- new_repo_info_dict[ name ] = ( description, repository_clone_url, changeset_revision, ctx_rev )
- repo_info_dict = tool_shed_encode( new_repo_info_dict )
- install_tool_dependencies_check_box = CheckboxField( 'install_tool_dependencies', checked=True )
- return trans.fill_template( '/admin/tool_shed_repository/confirm_tool_dependency_install.mako',
- tool_shed_url=tool_shed_url,
- repo_info_dict=repo_info_dict,
- dict_with_tool_dependencies=dict_with_tool_dependencies,
- includes_tools=includes_tools,
- install_tool_dependencies_check_box=install_tool_dependencies_check_box,
- message=message,
- status=status )
- @web.expose
- @web.require_admin
def deactivate_or_uninstall_repository( self, trans, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
remove_from_disk = params.get( 'remove_from_disk', '' )
remove_from_disk_checked = CheckboxField.is_checked( remove_from_disk )
- repository = get_repository( trans, kwd[ 'id' ] )
- shed_tool_conf, tool_path, relative_install_dir = get_tool_panel_config_tool_path_install_dir( trans.app, repository )
+ tool_shed_repository = get_repository( trans, kwd[ 'id' ] )
+ shed_tool_conf, tool_path, relative_install_dir = get_tool_panel_config_tool_path_install_dir( trans.app, tool_shed_repository )
repository_install_dir = os.path.abspath ( relative_install_dir )
errors = ''
if params.get( 'deactivate_or_uninstall_repository_button', False ):
- if repository.includes_tools:
+ if tool_shed_repository.includes_tools:
# Handle tool panel alterations.
- remove_from_tool_panel( trans, repository, shed_tool_conf, uninstall=remove_from_disk_checked )
- if repository.includes_datatypes:
+ remove_from_tool_panel( trans, tool_shed_repository, shed_tool_conf, uninstall=remove_from_disk_checked )
+ if tool_shed_repository.includes_datatypes:
# Deactivate proprietary datatypes.
- installed_repository_dict = load_installed_datatypes( trans.app, repository, repository_install_dir, deactivate=True )
+ installed_repository_dict = load_installed_datatypes( trans.app, tool_shed_repository, repository_install_dir, deactivate=True )
if installed_repository_dict[ 'converter_path' ]:
load_installed_datatype_converters( trans.app, installed_repository_dict, deactivate=True )
if installed_repository_dict[ 'display_path' ]:
@@ -322,24 +415,28 @@
log.debug( "Error removing repository installation directory %s: %s" % ( str( repository_install_dir ), str( e ) ) )
removed = False
if removed:
- repository.uninstalled = True
+ tool_shed_repository.uninstalled = True
# Remove all installed tool dependencies.
- for tool_dependency in repository.installed_tool_dependencies:
+ for tool_dependency in tool_shed_repository.installed_tool_dependencies:
uninstalled, error_message = remove_tool_dependency( trans, tool_dependency )
if error_message:
errors = '%s %s' % ( errors, error_message )
- repository.deleted = True
- trans.sa_session.add( repository )
+ tool_shed_repository.deleted = True
+ if remove_from_disk_checked:
+ tool_shed_repository.status = trans.model.ToolShedRepository.installation_status.UNINSTALLED
+ else:
+ tool_shed_repository.status = trans.model.ToolShedRepository.installation_status.DEACTIVATED
+ trans.sa_session.add( tool_shed_repository )
trans.sa_session.flush()
if remove_from_disk_checked:
- message = 'The repository named <b>%s</b> has been uninstalled. ' % repository.name
+ message = 'The repository named <b>%s</b> has been uninstalled. ' % tool_shed_repository.name
if errors:
message += 'Attempting to uninstall tool dependencies resulted in errors: %s' % errors
status = 'error'
else:
status = 'done'
else:
- message = 'The repository named <b>%s</b> has been deactivated. ' % repository.name
+ message = 'The repository named <b>%s</b> has been deactivated. ' % tool_shed_repository.name
status = 'done'
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
action='browse_repositories',
@@ -347,7 +444,7 @@
status=status ) )
remove_from_disk_check_box = CheckboxField( 'remove_from_disk', checked=remove_from_disk_checked )
return trans.fill_template( '/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako',
- repository=repository,
+ repository=tool_shed_repository,
remove_from_disk_check_box=remove_from_disk_check_box,
message=message,
status=status )
@@ -365,6 +462,20 @@
galaxy_url = url_for( '/', qualified=True )
url = '%srepository/find_workflows?galaxy_url=%s&webapp=galaxy&no_reset=true' % ( tool_shed_url, galaxy_url )
return trans.response.send_redirect( url )
+ def generate_tool_path( self, repository_clone_url, changeset_revision ):
+ """
+ Generate a tool path that guarantees repositories with the same name will always be installed
+ in different directories. The tool path will be of the form:
+ <tool shed url>/repos/<repository owner>/<repository name>/<installed changeset revision>
+ http://test@bx.psu.edu:9009/repos/test/filter
+ """
+ tmp_url = clean_repository_clone_url( repository_clone_url )
+ # Now tmp_url is something like: bx.psu.edu:9009/repos/some_username/column
+ items = tmp_url.split( 'repos' )
+ tool_shed_url = items[ 0 ]
+ repo_path = items[ 1 ]
+ tool_shed_url = clean_tool_shed_url( tool_shed_url )
+ return '%s/repos%s/%s' % ( tool_shed_url, repo_path, changeset_revision )
@web.json
@web.require_admin
def get_file_contents( self, trans, file_path ):
@@ -374,6 +485,23 @@
return get_repository_file_contents( file_path )
@web.expose
@web.require_admin
+ def initiate_repository_installation( self, trans, shed_repository_ids, encoded_kwd ):
+ tsr_ids = util.listify( shed_repository_ids )
+ tool_shed_repositories = []
+ for tsr_id in tsr_ids:
+ tsr = trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( tsr_id ) )
+ tool_shed_repositories.append( tsr )
+ clause_list = []
+ for tsr_id in tsr_ids:
+ clause_list.append( trans.model.ToolShedRepository.table.c.id == trans.security.decode_id( tsr_id ) )
+ query = trans.sa_session.query( trans.model.ToolShedRepository ).filter( or_( *clause_list ) )
+ return trans.fill_template( 'admin/tool_shed_repository/initiate_repository_installation.mako',
+ encoded_kwd=encoded_kwd,
+ query=query,
+ tool_shed_repositories=tool_shed_repositories,
+ initiate_repository_installation_ids=shed_repository_ids )
+ @web.expose
+ @web.require_admin
def initiate_tool_dependency_installation( self, trans, tool_dependencies ):
"""Install specified dependencies for repository tools."""
# Get the tool_shed_repository from one of the tool_dependencies.
@@ -403,9 +531,10 @@
else:
message = "Installed tool dependencies: %s" % ','.join( td.name for td in installed_tool_dependencies )
status = 'done'
+ td_ids = [ trans.security.encode_id( td.id ) for td in tool_shed_repository.tool_dependencies ]
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
action='manage_tool_dependencies',
- tool_dependency_ids=tool_dependency_ids,
+ tool_dependency_ids=td_ids,
message=message,
status=status ) )
@web.expose
@@ -423,22 +552,33 @@
message = kwd.get( 'message', '' )
status = kwd.get( 'status', 'done' )
tool_shed_url = kwd[ 'tool_shed_url' ]
- repo_info_dict = kwd[ 'repo_info_dict' ]
new_tool_panel_section = kwd.get( 'new_tool_panel_section', '' )
tool_panel_section = kwd.get( 'tool_panel_section', '' )
includes_tools = util.string_as_bool( kwd.get( 'includes_tools', False ) )
+ includes_tool_dependencies = util.string_as_bool( kwd.get( 'includes_tool_dependencies', False ) )
+ if includes_tool_dependencies:
+ dict_with_tool_dependencies = tool_shed_decode( kwd[ 'repo_info_dict' ] )
+ # The repo_info_dict includes tool dependencies which we need to display so the user knows what will be installed.
+ repo_info_dict = {}
+ for name, repo_info_tuple in dict_with_tool_dependencies.items():
+ description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple
+ # Create a new repo_info_dict by eliminating tool_dependencies from the repo_info_tuple.
+ repo_info_dict[ name ] = ( description, repository_clone_url, changeset_revision, ctx_rev )
+ else:
+ dict_with_tool_dependencies = {}
+ repo_info_dict = tool_shed_decode( kwd[ 'repo_info_dict' ] )
install_tool_dependencies = kwd.get( 'install_tool_dependencies', '' )
+ tool_section = None
if not includes_tools or ( includes_tools and kwd.get( 'select_tool_panel_section_button', False ) ):
if includes_tools:
install_tool_dependencies = CheckboxField.is_checked( install_tool_dependencies )
shed_tool_conf = kwd[ 'shed_tool_conf' ]
else:
install_tool_dependencies = False
- # If installing a repository that includes no tools, get the relative tool_path from the file
- # to which the migrated_tools_config setting points.
+ # If installing a repository that includes no tools, get the relative tool_path from the file to which the
+ # migrated_tools_config setting points.
shed_tool_conf = trans.app.config.migrated_tools_config
- # Get the tool path by searching the list of shed_tool_confs for the dictionary
- # that contains the information about shed_tool_conf.
+ # Get the tool path by searching the list of shed_tool_confs for the dictionary that contains the information about shed_tool_conf.
for shed_tool_conf_dict in trans.app.toolbox.shed_tool_confs:
config_filename = shed_tool_conf_dict[ 'config_filename' ]
if config_filename == shed_tool_conf:
@@ -471,79 +611,62 @@
tool_section = trans.app.toolbox.tool_panel[ section_key ]
else:
tool_section = None
- # Decode the encoded repo_info_dict param value.
- repo_info_dict = tool_shed_decode( repo_info_dict )
- # Clone the repository to the configured location.
- installed_repository_names = []
+ # Make sure all tool_shed_repository records exist.
+ new_tool_shed_repositories = []
for name, repo_info_tuple in repo_info_dict.items():
description, repository_clone_url, changeset_revision, ctx_rev = repo_info_tuple
- clone_dir = os.path.join( tool_path, self.__generate_tool_path( repository_clone_url, changeset_revision ) )
+ clone_dir = os.path.join( tool_path, self.generate_tool_path( repository_clone_url, changeset_revision ) )
relative_install_dir = os.path.join( clone_dir, name )
- if os.path.exists( clone_dir ):
- # Repository and revision has already been cloned.
- message += 'Revision <b>%s</b> of repository <b>%s</b> was previously installed.<br/>' % ( changeset_revision, name )
+ owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) )
+ # Make sure the repository was not already installed.
+ installed_changeset_revision = self.repository_was_previously_installed( trans, tool_shed_url, name, repo_info_tuple, clone_dir )
+ if installed_changeset_revision:
+ message = "Tool shed repository <b>%s</b> with owner <b>%s</b> and changeset revision <b>%s</b> " % ( name, owner, changeset_revision )
+ message += "was previously installed using changeset revision <b>%s</b>. You can get " % installed_changeset_revision
+ message += "the latest updates for the installed repository using the <b>Get updates</b> option from the repository's "
+ message += "<b>Repository Actions</b> pop-up menu."
+ status = 'error'
else:
- clone_repository( repository_clone_url, os.path.abspath( relative_install_dir ), ctx_rev )
- owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) )
- tool_shed = clean_tool_shed_url( tool_shed_url )
- tool_shed_repository, metadata_dict, = load_repository_contents( trans,
- repository_name=name,
- description=description,
- owner=owner,
- installed_changeset_revision=changeset_revision,
- current_changeset_revision=changeset_revision,
- ctx_rev=ctx_rev,
- tool_path=tool_path,
- repository_clone_url=repository_clone_url,
- relative_install_dir=relative_install_dir,
- tool_shed=tool_shed,
- tool_section=tool_section,
- shed_tool_conf=shed_tool_conf )
- if 'tools' in metadata_dict:
- # Get the tool_versions from the tool shed for each tool in the installed change set.
- url = '%srepository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy&no_reset=true' % \
- ( tool_shed_url, name, owner, changeset_revision )
- response = urllib2.urlopen( url )
- text = response.read()
- response.close()
- if text:
- tool_version_dicts = from_json_string( text )
- handle_tool_versions( trans.app, tool_version_dicts, tool_shed_repository )
- else:
- message += "Version information for the tools included in the <b>%s</b> repository is missing. " % name
- message += "Reset all of this repository's metadata in the tool shed, then set the installed tool versions "
- message += "from the installed repository's <b>Repository Actions</b> menu. "
- status = 'error'
- installed_repository_names.append( name )
- if installed_repository_names:
- installed_repository_names.sort()
- num_repositories_installed = len( installed_repository_names )
- if tool_section:
- message += 'Installed %d %s and all tools were loaded into tool panel section <b>%s</b>:<br/>Installed repositories: ' % \
- ( num_repositories_installed,
- inflector.cond_plural( num_repositories_installed, 'repository' ),
- tool_section.name )
- else:
- message += 'Installed %d %s and all tools were loaded into the tool panel outside of any sections.<br/>Installed repositories: ' % \
- ( num_repositories_installed,
- inflector.cond_plural( num_repositories_installed, 'repository' ) )
- for i, repo_name in enumerate( installed_repository_names ):
- if i == len( installed_repository_names ) -1:
- message += '%s.<br/>' % repo_name
- else:
- message += '%s, ' % repo_name
- if install_tool_dependencies:
- tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in tool_shed_repository.missing_tool_dependencies ]
+ print "Adding new row (or updating an existing row) for repository '%s' in the tool_shed_repository table." % name
+ tool_shed_repository = create_or_update_tool_shed_repository( app=trans.app,
+ name=name,
+ description=description,
+ installed_changeset_revision=changeset_revision,
+ ctx_rev=ctx_rev,
+ repository_clone_url=repository_clone_url,
+ metadata_dict={},
+ status=trans.model.ToolShedRepository.installation_status.NEW,
+ current_changeset_revision=changeset_revision,
+ owner=owner,
+ dist_to_shed=False )
+ new_tool_shed_repositories.append( tool_shed_repository )
+ if new_tool_shed_repositories:
+ tsrids_list = [ trans.security.encode_id( tsr.id ) for tsr in new_tool_shed_repositories ]
+ new_kwd = dict( includes_tool_dependencies=kwd.get( 'includes_tool_dependencies', False ),
+ includes_tools=kwd.get( 'includes_tools', False ),
+ install_tool_dependencies=install_tool_dependencies,
+ repo_info_dict=kwd[ 'repo_info_dict' ],
+ message=message,
+ new_tool_panel_section=kwd.get( 'new_tool_panel_section', '' ),
+ shed_tool_conf = kwd[ 'shed_tool_conf' ],
+ status=status,
+ tool_panel_section=kwd.get( 'tool_panel_section', '' ),
+ tool_path=tool_path,
+ tool_section=tool_section,
+ tool_shed_repository_ids=tsrids_list,
+ tool_shed_url=kwd[ 'tool_shed_url' ] )
+ encoded_kwd = tool_shed_encode( new_kwd )
+ tsrids_str = ','.join( tsrids_list )
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
- action='manage_tool_dependencies',
- operation='install',
- tool_dependency_ids=tool_dependency_ids,
- status=status,
- message=message ) )
- return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
- action='browse_repositories',
- message=message,
- status=status ) )
+ action='initiate_repository_installation',
+ shed_repository_ids=tsrids_str,
+ encoded_kwd=encoded_kwd ) )
+ else:
+ kwd[ 'message' ] = message
+ kwd[ 'status' ] = status
+ return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
+ action='manage_repositories',
+ **kwd ) )
if len( trans.app.toolbox.shed_tool_confs ) > 1:
shed_tool_conf_select_field = build_shed_tool_conf_select_field( trans )
shed_tool_conf = None
@@ -553,35 +676,35 @@
shed_tool_conf = shed_tool_conf.replace( './', '', 1 )
shed_tool_conf_select_field = None
tool_panel_section_select_field = build_tool_panel_section_select_field( trans )
- if includes_tools:
+ if includes_tools and len( repo_info_dict ) == 1:
# If we're installing a single repository that contains a readme file, get it's contents to display.
- decoded_repo_info_dict = tool_shed_decode( repo_info_dict )
- if len( decoded_repo_info_dict ) == 1:
- name = decoded_repo_info_dict.keys()[ 0 ]
- repo_info_tuple = decoded_repo_info_dict[ name ]
- description, repository_clone_url, changeset_revision, ctx_rev = repo_info_tuple
- owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) )
- url = '%srepository/get_readme?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy&no_reset=true' % ( tool_shed_url, name, owner, changeset_revision )
- response = urllib2.urlopen( url )
- raw_text = response.read()
- response.close()
- readme_text = ''
- for i, line in enumerate( raw_text ):
- readme_text = '%s%s' % ( readme_text, to_html_str( line ) )
- if len( readme_text ) > MAX_CONTENT_SIZE:
- large_str = '\nFile contents truncated because file size is larger than maximum viewing size of %s\n' % util.nice_size( MAX_CONTENT_SIZE )
- readme_text = '%s%s' % ( readme_text, to_html_str( large_str ) )
- break
- else:
- readme_text = ''
+ name = repo_info_dict.keys()[ 0 ]
+ repo_info_tuple = repo_info_dict[ name ]
+ description, repository_clone_url, changeset_revision, ctx_rev = repo_info_tuple
+ repository_owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) )
+ url = '%srepository/get_readme?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy&no_reset=true' % \
+ ( tool_shed_url, name, repository_owner, changeset_revision )
+ response = urllib2.urlopen( url )
+ raw_text = response.read()
+ response.close()
+ readme_text = ''
+ for i, line in enumerate( raw_text ):
+ readme_text = '%s%s' % ( readme_text, to_html_str( line ) )
+ if len( readme_text ) > MAX_CONTENT_SIZE:
+ large_str = '\nFile contents truncated because file size is larger than maximum viewing size of %s\n' % util.nice_size( MAX_CONTENT_SIZE )
+ readme_text = '%s%s' % ( readme_text, to_html_str( large_str ) )
+ break
else:
- readme_text = ''
+ readme_text = ''
+ install_tool_dependencies_check_box = CheckboxField( 'install_tool_dependencies', checked=True )
return trans.fill_template( '/admin/tool_shed_repository/select_tool_panel_section.mako',
tool_shed_url=tool_shed_url,
- repo_info_dict=repo_info_dict,
+ repo_info_dict=kwd[ 'repo_info_dict' ],
+ dict_with_tool_dependencies=dict_with_tool_dependencies,
shed_tool_conf=shed_tool_conf,
includes_tools=includes_tools,
- install_tool_dependencies=install_tool_dependencies,
+ includes_tool_dependencies=includes_tool_dependencies,
+ install_tool_dependencies_check_box=install_tool_dependencies_check_box,
shed_tool_conf_select_field=shed_tool_conf_select_field,
tool_panel_section_select_field=tool_panel_section_select_field,
new_tool_panel_section=new_tool_panel_section,
@@ -610,10 +733,10 @@
tool_dependencies_for_installation.append( tool_dependency )
if tool_dependencies_for_installation:
# Redirect back to the ToolDependencyGrid before initiating installation.
- tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in tool_dependencies_for_installation ]
+ encoded_tool_dependency_for_installation_ids = [ trans.security.encode_id( td.id ) for td in tool_dependencies_for_installation ]
new_kwd = dict( action='manage_tool_dependencies',
operation='initiate_tool_dependency_installation',
- tool_dependency_ids=tool_dependency_ids,
+ tool_dependency_ids=encoded_tool_dependency_for_installation_ids,
message=message,
status=status )
return self.tool_dependency_grid( trans, **new_kwd )
@@ -631,12 +754,196 @@
status=status )
@web.expose
@web.require_admin
+ def install_tool_shed_repositories( self, trans, tool_shed_repositories, **kwd ):
+ """Install specified tool shed repositories."""
+ repo_info_dict = tool_shed_decode( kwd[ 'repo_info_dict' ] )
+ tool_path = kwd[ 'tool_path' ]
+ includes_tool_dependencies = util.string_as_bool( kwd[ 'includes_tool_dependencies' ] )
+ install_tool_dependencies = CheckboxField.is_checked( kwd.get( 'install_tool_dependencies', '' ) )
+ for tool_shed_repository in tool_shed_repositories:
+ # Clone each repository to the configured location.
+ update_tool_shed_repository_status( trans.app, tool_shed_repository, trans.model.ToolShedRepository.installation_status.CLONING )
+ repo_info_tuple = repo_info_dict[ tool_shed_repository.name ]
+ if includes_tool_dependencies:
+ description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple
+ else:
+ description, repository_clone_url, changeset_revision, ctx_rev = repo_info_tuple
+ clone_dir = os.path.join( tool_path, self.generate_tool_path( repository_clone_url, tool_shed_repository.installed_changeset_revision ) )
+ relative_install_dir = os.path.join( clone_dir, tool_shed_repository.name )
+ clone_repository( repository_clone_url, os.path.abspath( relative_install_dir ), ctx_rev )
+ self.handle_repository_contents( trans,
+ tool_shed_repository=tool_shed_repository,
+ tool_path=tool_path,
+ repository_clone_url=repository_clone_url,
+ relative_install_dir=relative_install_dir,
+ tool_shed=tool_shed_repository.tool_shed,
+ tool_section=kwd.get( 'tool_section', '' ),
+ shed_tool_conf=kwd.get( 'shed_tool_conf', '' ) )
+ trans.sa_session.refresh( tool_shed_repository )
+ metadata = tool_shed_repository.metadata
+ if 'tools' in metadata:
+ # Get the tool_versions from the tool shed for each tool in the installed change set.
+ update_tool_shed_repository_status( trans.app,
+ tool_shed_repository,
+ trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS )
+ tool_shed_url = get_url_from_repository_tool_shed( trans.app, tool_shed_repository )
+ url = '%s/repository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy&no_reset=true' % \
+ ( tool_shed_url, tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.changeset_revision )
+ response = urllib2.urlopen( url )
+ text = response.read()
+ response.close()
+ if text:
+ tool_version_dicts = from_json_string( text )
+ handle_tool_versions( trans.app, tool_version_dicts, tool_shed_repository )
+ else:
+ message += "Version information for the tools included in the <b>%s</b> repository is missing. " % name
+ message += "Reset all of this repository's metadata in the tool shed, then set the installed tool versions "
+ message += "from the installed repository's <b>Repository Actions</b> menu. "
+ status = 'error'
+ if install_tool_dependencies and tool_shed_repository.tool_dependencies and 'tool_dependencies' in metadata:
+ work_dir = make_tmp_directory()
+ # Install tool dependencies.
+ update_tool_shed_repository_status( trans.app,
+ tool_shed_repository,
+ trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES )
+ # Get the tool_dependencies.xml file from the repository.
+ tool_dependencies_config = get_config_from_repository( trans.app,
+ 'tool_dependencies.xml',
+ tool_shed_repository,
+ tool_shed_repository.installed_changeset_revision,
+ work_dir )
+ installed_tool_dependencies = handle_tool_dependencies( app=trans.app,
+ tool_shed_repository=tool_shed_repository,
+ tool_dependencies_config=tool_dependencies_config,
+ tool_dependencies=tool_shed_repository.tool_dependencies )
+ try:
+ shutil.rmtree( work_dir )
+ except:
+ pass
+ if 'datatypes' in metadata:
+ update_tool_shed_repository_status( trans.app,
+ tool_shed_repository,
+ trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES )
+ work_dir = make_tmp_directory()
+ datatypes_config = get_config_from_repository( trans.app,
+ 'datatypes_conf.xml',
+ tool_shed_repository,
+ tool_shed_repository.installed_changeset_revision,
+ work_dir )
+ # Load proprietary data types required by tools.
+ converter_path, display_path = alter_config_and_load_prorietary_datatypes( trans.app, datatypes_config, relative_install_dir, override=False )
+ if converter_path or display_path:
+ # Create a dictionary of tool shed repository related information.
+ repository_dict = create_repository_dict_for_proprietary_datatypes( tool_shed=self.tool_shed,
+ name=tool_shed_repository.name,
+ owner=tool_shed_repository.owner,
+ installed_changeset_revision=tool_shed_repository.installed_changeset_revision,
+ tool_dicts=metadata.get( 'tools', [] ),
+ converter_path=converter_path,
+ display_path=display_path )
+ if converter_path:
+ # Load proprietary datatype converters
+ trans.app.datatypes_registry.load_datatype_converters( trans.app.toolbox, installed_repository_dict=repository_dict )
+ if display_path:
+ # Load proprietary datatype display applications
+ trans.app.datatypes_registry.load_display_applications( installed_repository_dict=repository_dict )
+ try:
+ shutil.rmtree( work_dir )
+ except:
+ pass
+ update_tool_shed_repository_status( trans.app, tool_shed_repository, trans.model.ToolShedRepository.installation_status.INSTALLED )
+ tsr_ids_for_monitoring = [ trans.security.encode_id( tsr.id ) for tsr in tool_shed_repositories ]
+ return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
+ action='monitor_repository_installation',
+ tool_shed_repository_ids=tsr_ids_for_monitoring ) )
+ def handle_repository_contents( self, trans, tool_shed_repository, tool_path, repository_clone_url, relative_install_dir, tool_shed=None,
+ tool_section=None, shed_tool_conf=None ):
+ """
+ Generate the metadata for the installed tool shed repository, among other things. This method is called from Galaxy (never the tool shed)
+ when an admin is installing a new repository or reinstalling an uninstalled repository.
+ """
+ metadata_dict = generate_metadata_using_disk_files( trans.app.toolbox, relative_install_dir, repository_clone_url )
+ tool_shed_repository.metadata = metadata_dict
+ trans.sa_session.add( tool_shed_repository )
+ trans.sa_session.flush()
+ if 'tool_dependencies' in metadata_dict:
+ tool_dependencies = create_tool_dependency_objects( trans.app, tool_shed_repository, tool_shed_repository.installed_changeset_revision )
+ if 'tools' in metadata_dict:
+ tool_panel_dict = generate_tool_panel_dict_for_new_install( metadata_dict[ 'tools' ], tool_section )
+ repository_tools_tups = get_repository_tools_tups( trans.app, metadata_dict )
+ if repository_tools_tups:
+ # Handle missing data table entries for tool parameters that are dynamically generated select lists.
+ work_dir = make_tmp_directory()
+ repository_tools_tups = handle_missing_data_table_entry( trans.app,
+ tool_shed_repository,
+ tool_shed_repository.changeset_revision,
+ tool_path,
+ repository_tools_tups,
+ work_dir )
+ # Handle missing index files for tool parameters that are dynamically generated select lists.
+ sample_files = metadata_dict.get( 'sample_files', [] )
+ repository_tools_tups, sample_files_copied = handle_missing_index_file( trans.app, tool_path, sample_files, repository_tools_tups )
+ # Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance.
+ copy_sample_files( trans.app, sample_files, sample_files_copied=sample_files_copied )
+ add_to_tool_panel( app=trans.app,
+ repository_name=tool_shed_repository.name,
+ repository_clone_url=repository_clone_url,
+ changeset_revision=tool_shed_repository.changeset_revision,
+ repository_tools_tups=repository_tools_tups,
+ owner=tool_shed_repository.owner,
+ shed_tool_conf=shed_tool_conf,
+ tool_panel_dict=tool_panel_dict,
+ new_install=True )
+ try:
+ shutil.rmtree( work_dir )
+ except:
+ pass
+ if 'datatypes' in metadata_dict:
+ update_tool_shed_repository_status( trans.app,
+ tool_shed_repository,
+ trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES )
+ work_dir = make_tmp_directory()
+ datatypes_config = get_config_from_repository( trans.app,
+ 'datatypes_conf.xml',
+ tool_shed_repository,
+ tool_shed_repository.changeset_revision,
+ work_dir )
+ # Load data types required by tools.
+ converter_path, display_path = alter_config_and_load_prorietary_datatypes( trans.app, datatypes_config, relative_install_dir, override=False )
+ if converter_path or display_path:
+ # Create a dictionary of tool shed repository related information.
+ repository_dict = create_repository_dict_for_proprietary_datatypes( tool_shed=tool_shed,
+ name=tool_shed_repository.name,
+ owner=tool_shed_repository.owner,
+ installed_changeset_revision=tool_shed_repository.installed_changeset_revision,
+ tool_dicts=metadata_dict.get( 'tools', [] ),
+ converter_path=converter_path,
+ display_path=display_path )
+ if converter_path:
+ # Load proprietary datatype converters
+ trans.app.datatypes_registry.load_datatype_converters( trans.app.toolbox, installed_repository_dict=repository_dict )
+ if display_path:
+ # Load proprietary datatype display applications
+ trans.app.datatypes_registry.load_display_applications( installed_repository_dict=repository_dict )
+ try:
+ shutil.rmtree( work_dir )
+ except:
+ pass
+ @web.expose
+ @web.require_admin
def manage_repository( self, trans, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
repository_id = kwd[ 'id' ]
repository = get_repository( trans, repository_id )
+ if repository.status in [ trans.model.ToolShedRepository.installation_status.NEW,
+ trans.model.ToolShedRepository.installation_status.CLONING ]:
+ message = "The repository '%s' is not yet cloned, please try again..."
+ status = 'warning'
+ return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
+ action='monitor_repository_installation',
+ **kwd ) )
description = util.restore_text( params.get( 'description', repository.description ) )
shed_tool_conf, tool_path, relative_install_dir = get_tool_panel_config_tool_path_install_dir( trans.app, repository )
repo_files_dir = os.path.abspath( os.path.join( relative_install_dir, repository.name ) )
@@ -662,6 +969,62 @@
status=status )
@web.expose
@web.require_admin
+ def manage_repositories( self, trans, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ tsrid = params.get( 'tool_shed_repository_id', None )
+ tsridslist = util.listify( params.get( 'tool_shed_repository_ids', None ) )
+ if not tsridslist:
+ tsridslist = util.listify( params.get( 'id', None ) )
+ if tsrid and tsrid not in tsridslist:
+ tsridslist.append( tsrid )
+ if 'operation' in kwd:
+ operation = kwd[ 'operation' ].lower()
+ if not tsridslist:
+ message = 'Select at least 1 tool shed repository to %s.' % operation
+ kwd[ 'message' ] = message
+ kwd[ 'status' ] = 'error'
+ del kwd[ 'operation' ]
+ return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
+ action='manage_repositories',
+ **kwd ) )
+ if operation == 'browse':
+ return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
+ action='browse_repository',
+ **kwd ) )
+ elif operation == 'uninstall':
+ repositories_for_uninstallation = []
+ for repository_id in tool_shed_repository_id:
+ repository = trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( repository_id ) )
+ if repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLED,
+ trans.model.ToolShedRepository.installation_status.ERROR ]:
+ repositories_for_uninstallation.append( repository )
+ if repositories_for_uninstallation:
+ return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
+ action='uninstall_repositories',
+ **kwd ) )
+ else:
+ kwd[ 'message' ] = 'All selected tool shed repositories are already uninstalled.'
+ kwd[ 'status' ] = 'error'
+ elif operation == "install":
+ encoded_kwd = kwd[ 'encoded_kwd' ]
+ decoded_kwd = tool_shed_decode( encoded_kwd )
+ tsr_ids = decoded_kwd[ 'tool_shed_repository_ids' ]
+ repositories_for_installation = []
+ for tsr_id in tsr_ids:
+ repository = trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( tsr_id ) )
+ if repository.status in [ trans.model.ToolShedRepository.installation_status.NEW,
+ trans.model.ToolShedRepository.installation_status.UNINSTALLED ]:
+ repositories_for_installation.append( repository )
+ if repositories_for_installation:
+ self.install_tool_shed_repositories( trans, repositories_for_installation, **decoded_kwd )
+ else:
+ kwd[ 'message' ] = 'All selected tool shed repositories are already installed.'
+ kwd[ 'status' ] = 'error'
+ return self.repository_installation_grid( trans, **kwd )
+ @web.expose
+ @web.require_admin
def manage_tool_dependencies( self, trans, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
@@ -672,7 +1035,6 @@
tool_dependency_ids = util.listify( params.get( 'id', None ) )
if tool_dependency_id and tool_dependency_id not in tool_dependency_ids:
tool_dependency_ids.append( tool_dependency_id )
- tool_dependencies = []
# We need a tool_shed_repository, so get it from one of the tool_dependencies.
tool_dependency = get_tool_dependency( trans, tool_dependency_ids[ 0 ] )
tool_shed_repository = tool_dependency.tool_shed_repository
@@ -739,6 +1101,18 @@
kwd[ 'message' ] = 'All selected tool dependencies are already installed.'
kwd[ 'status' ] = 'error'
return self.tool_dependency_grid( trans, **kwd )
+ @web.expose
+ @web.require_admin
+ def monitor_repository_installation( self, trans, **kwd ):
+ params = util.Params( kwd )
+ tsrid = params.get( 'tool_shed_repository_id', None )
+ tsridslist = util.listify( params.get( 'tool_shed_repository_ids', None ) )
+ if not tsridslist:
+ tsridslist = util.listify( params.get( 'id', None ) )
+ if tsrid and tsrid not in tsridslist:
+ tsridslist.append( tsrid )
+ kwd[ 'tool_shed_repository_ids' ] = tsridslist
+ return self.repository_installation_grid( trans, **kwd )
@web.json
@web.require_admin
def open_folder( self, trans, folder_path ):
@@ -752,31 +1126,32 @@
message = kwd.get( 'message', '' )
status = kwd.get( 'status', 'done' )
repository_id = kwd[ 'id' ]
- repository = get_repository( trans, repository_id )
+ tool_shed_repository = get_repository( trans, repository_id )
no_changes = kwd.get( 'no_changes', '' )
no_changes_checked = CheckboxField.is_checked( no_changes )
install_tool_dependencies = CheckboxField.is_checked( kwd.get( 'install_tool_dependencies', '' ) )
- shed_tool_conf, tool_path, relative_install_dir = get_tool_panel_config_tool_path_install_dir( trans.app, repository )
- repository_clone_url = generate_clone_url( trans, repository )
- clone_dir = os.path.join( tool_path, self.__generate_tool_path( repository_clone_url, repository.installed_changeset_revision ) )
- relative_install_dir = os.path.join( clone_dir, repository.name )
- tool_shed_url = get_url_from_repository_tool_shed( trans.app, repository )
- if not repository.ctx_rev:
+ shed_tool_conf, tool_path, relative_install_dir = get_tool_panel_config_tool_path_install_dir( trans.app, tool_shed_repository )
+ repository_clone_url = generate_clone_url( trans, tool_shed_repository )
+ clone_dir = os.path.join( tool_path, self.generate_tool_path( repository_clone_url, tool_shed_repository.installed_changeset_revision ) )
+ relative_install_dir = os.path.join( clone_dir, tool_shed_repository.name )
+ tool_shed_url = get_url_from_repository_tool_shed( trans.app, tool_shed_repository )
+ if not tool_shed_repository.ctx_rev:
# The ctx_rev column was introduced late, so may be null for some installed ToolShedRepositories.
- ctx_rev = get_ctx_rev( tool_shed_url, repository.name, repository.owner, repository.installed_changeset_revision )
+ ctx_rev = get_ctx_rev( tool_shed_url, tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.installed_changeset_revision )
else:
- ctx_rev = repository.ctx_rev
+ ctx_rev = tool_shed_repository.ctx_rev
+ update_tool_shed_repository_status( trans.app, tool_shed_repository, trans.model.ToolShedRepository.installation_status.CLONING )
clone_repository( repository_clone_url, os.path.abspath( relative_install_dir ), ctx_rev )
# Since we're reinstalling the repository we need to find the latest changeset revision to which is can be updated.
- current_changeset_revision, current_ctx_rev = get_update_to_changeset_revision_and_ctx_rev( trans, repository )
+ current_changeset_revision, current_ctx_rev = get_update_to_changeset_revision_and_ctx_rev( trans, tool_shed_repository )
if current_ctx_rev != ctx_rev:
repo = hg.repository( get_configured_ui(), path=os.path.abspath( relative_install_dir ) )
pull_repository( repo, repository_clone_url, current_changeset_revision )
update_repository( repo, ctx_rev=current_ctx_rev )
tool_section = None
- if repository.includes_tools:
+ metadata = tool_shed_repository.metadata
+ if tool_shed_repository.includes_tools:
# Get the location in the tool panel in which each tool was originally loaded.
- metadata = repository.metadata
if 'tool_panel_section' in metadata:
tool_panel_dict = metadata[ 'tool_panel_section' ]
if not tool_panel_dict:
@@ -829,52 +1204,83 @@
tool_section = trans.app.toolbox.tool_panel[ section_key ]
else:
tool_section = None
- tool_shed_repository, metadata_dict, load_repository_contents( trans,
- repository_name=repository.name,
- description=repository.description,
- owner=repository.owner,
- installed_changeset_revision=repository.installed_changeset_revision,
- current_changeset_revision=current_changeset_revision,
- ctx_rev=ctx_rev,
- tool_path=tool_path,
- repository_clone_url=repository_clone_url,
- relative_install_dir=relative_install_dir,
- tool_shed=repository.tool_shed,
- tool_section=tool_section,
- shed_tool_conf=shed_tool_conf )
- repository.uninstalled = False
- repository.deleted = False
- trans.sa_session.add( repository )
+ self.handle_repository_contents( trans,
+ tool_shed_repository=tool_shed_repository,
+ tool_path=tool_path,
+ repository_clone_url=repository_clone_url,
+ relative_install_dir=relative_install_dir,
+ tool_shed=tool_shed_repository.tool_shed,
+ tool_section=tool_section,
+ shed_tool_conf=shed_tool_conf )
+
+ if install_tool_dependencies and tool_shed_repository.tool_dependencies and 'tool_dependencies' in metadata:
+ # Install tool dependencies.
+ update_tool_shed_repository_status( trans.app,
+ tool_shed_repository,
+ trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES )
+ work_dir = make_tmp_directory()
+ # Get the tool_dependencies.xml file from the repository.
+ tool_dependencies_config = get_config_from_repository( trans.app,
+ 'tool_dependencies.xml',
+ tool_shed_repository,
+ tool_shed_repository.installed_changeset_revision,
+ work_dir )
+ installed_tool_dependencies = handle_tool_dependencies( app=trans.app,
+ tool_shed_repository=tool_shed_repository,
+ tool_dependencies_config=tool_dependencies_config,
+ tool_dependencies=tool_dependencies )
+ tool_shed_repository.uninstalled = False
+ tool_shed_repository.deleted = False
+ tool_shed_repository.status = trans.model.ToolShedRepository.installation_status.INSTALLED
+ trans.sa_session.add( tool_shed_repository )
trans.sa_session.flush()
- message += 'The <b>%s</b> repository has been reinstalled. ' % repository.name
- if install_tool_dependencies:
- message += 'The following tool dependencies are now being installed, please wait...'
- tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in tool_shed_repository.missing_tool_dependencies ]
- return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
- action='manage_tool_dependencies',
- operation='install',
- tool_dependency_ids=tool_dependency_ids,
- status=status,
- message=message ) )
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
action='browse_repositories',
message=message,
status=status ) )
@web.json
- def repository_installation_status_updates( self, trans, id=None, status=None ):
+ def repository_installation_status_updates( self, trans, ids=None, status_list=None ):
# Avoid caching
trans.response.headers[ 'Pragma' ] = 'no-cache'
trans.response.headers[ 'Expires' ] = '0'
- # Create new HTML for any that have changed
- rval = {}
- if id is not None and status is not None:
- repository = trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( id ) )
- if repository.status != status:
- repository.status = status
- rval[ id ] = { "status": repository.status,
- "html_status": unicode( trans.fill_template( "admin/tool_shed_repository/repository_installation_status.mako",
- repository=repository ),
- 'utf-8' ) }
+ # Create new HTML for any ToolShedRepository records whose status that has changed.
+ rval = []
+ if ids is not None and status_list is not None:
+ ids = util.listify( ids )
+ status_list = util.listify( status_list )
+ for id, status in zip( ids, status_list ):
+ repository = trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( id ) )
+ if repository.status != status:
+ rval.append( dict( id=id,
+ status=repository.status,
+ html_status=unicode( trans.fill_template( "admin/tool_shed_repository/repository_installation_status.mako",
+ repository=repository ),
+ 'utf-8' ) ) )
+ return rval
+ @web.expose
+ @web.require_admin
+ def repository_was_previously_installed( self, trans, tool_shed_url, repository_name, repo_info_tuple, clone_dir ):
+ # Handle case where the repository was previously installed using an older changeset_revsion, but later the repository was updated
+ # in the tool shed and now we're trying to install the latest changeset revision of the same repository instead of updating the one
+ # that was previously installed.
+ description, repository_clone_url, changeset_revision, ctx_rev = repo_info_tuple
+ if os.path.exists( clone_dir ):
+ # The installed changeset revision already exists on disk.
+ return changeset_revision
+ repository_owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) )
+ url = '%s/repository/previous_changeset_revisions?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s&webapp=galaxy&no_reset=true' % \
+ ( tool_shed_url, url_for( '/', qualified=True ), repository_name, repository_owner, changeset_revision )
+ response = urllib2.urlopen( url )
+ text = response.read()
+ response.close()
+ if text:
+ clone_path, clone_directory = os.path.split( clone_dir )
+ changeset_revisions = util.listify( text )
+ for previous_changeset_revision in changeset_revisions:
+ new_clone_dir = os.path.join( clone_path, previous_changeset_revision )
+ if os.path.exists( new_clone_dir ):
+ return previous_changeset_revision
+ return None
@web.expose
@web.require_admin
def reselect_tool_panel_section( self, trans, **kwd ):
@@ -948,18 +1354,19 @@
# Avoid caching
trans.response.headers[ 'Pragma' ] = 'no-cache'
trans.response.headers[ 'Expires' ] = '0'
- # Create new HTML for any that have changed
- rval = {}
+ # Create new HTML for any ToolDependency records whose status that has changed.
+ rval = []
if ids is not None and status_list is not None:
- ids = ids.split( "," )
- status_list = status_list.split( "," )
+ ids = util.listify( ids )
+ status_list = util.listify( status_list )
for id, status in zip( ids, status_list ):
tool_dependency = trans.sa_session.query( trans.model.ToolDependency ).get( trans.security.decode_id( id ) )
if tool_dependency.status != status:
- rval[ id ] = { "status": tool_dependency.status,
- "html_status": unicode( trans.fill_template( "admin/tool_shed_repository/tool_dependency_installation_status.mako",
- tool_dependency=tool_dependency ),
- 'utf-8' ) }
+ rval.append( dict( id=id,
+ status=tool_dependency.status,
+ html_status=unicode( trans.fill_template( "admin/tool_shed_repository/tool_dependency_installation_status.mako",
+ tool_dependency=tool_dependency ),
+ 'utf-8' ) ) )
return rval
@web.expose
@web.require_admin
@@ -992,9 +1399,11 @@
status = 'error'
else:
message = "These tool dependencies have been uninstalled: %s" % ','.join( td.name for td in tool_dependencies_for_uninstallation )
+ tool_shed_repository = tool_dependencies[ 0 ].tool_shed_repository
+ td_ids = [ trans.security.encode_id( td.id ) for td in tool_shed_repository.tool_dependencies ]
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
action='manage_tool_dependencies',
- tool_dependency_ids=tool_dependency_ids,
+ tool_dependency_ids=td_ids,
status=status,
message=message ) )
return trans.fill_template( '/admin/tool_shed_repository/uninstall_tool_dependencies.mako',
@@ -1081,20 +1490,6 @@
"""Generate the URL for cloning a repository."""
tool_shed_url = get_url_from_repository_tool_shed( trans.app, repository )
return '%s/repos/%s/%s' % ( tool_shed_url, repository.owner, repository.name )
- def __generate_tool_path( self, repository_clone_url, changeset_revision ):
- """
- Generate a tool path that guarantees repositories with the same name will always be installed
- in different directories. The tool path will be of the form:
- <tool shed url>/repos/<repository owner>/<repository name>/<installed changeset revision>
- http://test@bx.psu.edu:9009/repos/test/filter
- """
- tmp_url = clean_repository_clone_url( repository_clone_url )
- # Now tmp_url is something like: bx.psu.edu:9009/repos/some_username/column
- items = tmp_url.split( 'repos' )
- tool_shed_url = items[ 0 ]
- repo_path = items[ 1 ]
- tool_shed_url = clean_tool_shed_url( tool_shed_url )
- return '%s/repos%s/%s' % ( tool_shed_url, repo_path, changeset_revision )
## ---- Utility methods -------------------------------------------------------
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -10,7 +10,7 @@
from galaxy.util.json import from_json_string, to_json_string
from galaxy.model.orm import *
from galaxy.util.shed_util import get_changectx_for_changeset, get_configured_ui, get_repository_file_contents, make_tmp_directory, NOT_TOOL_CONFIGS
-from galaxy.util.shed_util import open_repository_files_folder, strip_path
+from galaxy.util.shed_util import open_repository_files_folder, reversed_lower_upper_bounded_changelog, strip_path
from galaxy.tool_shed.encoding_util import *
from common import *
@@ -1096,8 +1096,9 @@
repo = hg.repository( get_configured_ui(), repo_dir )
# Default to the received changeset revision and ctx_rev.
update_to_ctx = get_changectx_for_changeset( repo, changeset_revision )
+ ctx_rev = str( update_to_ctx.rev() )
latest_changeset_revision = changeset_revision
- update_dict = dict( changeset_revision=update_to_ctx, ctx_rev=str( update_to_ctx.rev() ) )
+ update_dict = dict( changeset_revision=changeset_revision, ctx_rev=ctx_rev )
if changeset_revision == repository.tip:
# If changeset_revision is the repository tip, there are no additional updates.
return tool_shed_encode( update_dict )
@@ -1227,14 +1228,9 @@
changeset_revision,
str( ctx.rev() ) )
encoded_repo_info_dict = encode( repo_info_dict )
- if includes_tool_dependencies:
- # Redirect back to local Galaxy to present the option to install tool dependencies.
- url = '%sadmin_toolshed/confirm_tool_dependency_install?tool_shed_url=%s&repo_info_dict=%s&includes_tools=%s' % \
- ( galaxy_url, url_for( '/', qualified=True ), encoded_repo_info_dict, str( includes_tools ) )
- else:
- # Redirect back to local Galaxy to perform install.
- url = '%sadmin_toolshed/install_repository?tool_shed_url=%s&repo_info_dict=%s&includes_tools=%s' % \
- ( galaxy_url, url_for( '/', qualified=True ), encoded_repo_info_dict, str( includes_tools ) )
+ # Redirect back to local Galaxy to perform install.
+ url = '%sadmin_toolshed/install_repository?tool_shed_url=%s&repo_info_dict=%s&includes_tools=%s&includes_tool_dependencies=%s' % \
+ ( galaxy_url, url_for( '/', qualified=True ), encoded_repo_info_dict, str( includes_tools ), str( includes_tool_dependencies ) )
return trans.response.send_redirect( url )
@web.expose
def load_invalid_tool( self, trans, repository_id, tool_config, changeset_revision, **kwd ):
@@ -1563,6 +1559,34 @@
message=message,
status=status )
@web.expose
+ def previous_changeset_revisions( self, trans, **kwd ):
+ """
+ Handle a request from a local Galaxy instance. This method will handle the case where the repository was previously installed using an
+ older changeset_revsion, but later the repository was updated in the tool shed and the Galaxy admin is trying to install the latest
+ changeset revision of the same repository instead of updating the one that was previously installed.
+ """
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ # If the request originated with the UpdateManager, it will not include a galaxy_url.
+ galaxy_url = kwd.get( 'galaxy_url', '' )
+ name = params.get( 'name', None )
+ owner = params.get( 'owner', None )
+ changeset_revision = params.get( 'changeset_revision', None )
+ repository = get_repository_by_name_and_owner( trans, name, owner )
+ repo_dir = repository.repo_path
+ repo = hg.repository( get_configured_ui(), repo_dir )
+ # Get the lower bound changeset revision
+ lower_bound_changeset_revision = get_previous_valid_changset_revision( repository, repo, changeset_revision )
+ # Build the list of changeset revision hashes.
+ changeset_hashes = []
+ for changeset in reversed_lower_upper_bounded_changelog( repo, lower_bound_changeset_revision, changeset_revision ):
+ changeset_hashes.append( str( repo.changectx( changeset ) ) )
+ if changeset_hashes:
+ changeset_hashes_str = ','.join( changeset_hashes )
+ return changeset_hashes_str
+ return ''
+ @web.expose
@web.require_login( "rate repositories" )
def rate_repository( self, trans, **kwd ):
""" Rate a repository and return updated rating data. """
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/common.mako
--- a/templates/admin/tool_shed_repository/common.mako
+++ b/templates/admin/tool_shed_repository/common.mako
@@ -54,7 +54,7 @@
url: "${h.url_for( controller='admin_toolshed', action='get_file_contents' )}",
dataType: "json",
data: { file_path: selected_value },
- success : function ( data ) {
+ success : function( data ) {
cell.html( '<label>'+data+'</label>' )
}
});
@@ -69,27 +69,31 @@
<%def name="dependency_status_updater()"><script type="text/javascript">
-
- // Tool dependency status updater - used to update the installation status on the Tool Dependencies grid.
+ // Tool dependency status updater - used to update the installation status on the Tool Dependencies Grid.
// Looks for changes in tool dependency installation status using an async request. Keeps calling itself
// (via setTimeout) until dependency installation status is neither 'Installing' nor 'Building'.
- var tool_dependency_status_updater = function ( dependency_status_list ) {
+ var tool_dependency_status_updater = function( dependency_status_list ) {
// See if there are any items left to track
var empty = true;
- for ( i in dependency_status_list ) {
- empty = false;
- break;
+ for ( var item in dependency_status_list ) {
+ //alert( "item" + item.toSource() );
+ //alert( "dependency_status_list[item] " + dependency_status_list[item].toSource() );
+ //alert( "dependency_status_list[item]['status']" + dependency_status_list[item]['status'] );
+ if ( dependency_status_list[item]['status'] != 'Installed' ) {
+ empty = false;
+ break;
+ }
}
if ( ! empty ) {
setTimeout( function() { tool_dependency_status_updater_callback( dependency_status_list ) }, 3000 );
}
};
- var tool_dependency_status_updater_callback = function ( dependency_status_list ) {
- var ids = []
- var status_list = []
- $.each( dependency_status_list, function ( id, dependency_status ) {
- ids.push( id );
- status_list.push( dependency_status );
+ var tool_dependency_status_updater_callback = function( dependency_status_list ) {
+ var ids = [];
+ var status_list = [];
+ $.each( dependency_status_list, function( index, dependency_status ) {
+ ids.push( dependency_status[ 'id' ] );
+ status_list.push( dependency_status[ 'status' ] );
});
// Make ajax call
$.ajax( {
@@ -97,17 +101,75 @@
url: "${h.url_for( controller='admin_toolshed', action='tool_dependency_status_updates' )}",
dataType: "json",
data: { ids: ids.join( "," ), status_list: status_list.join( "," ) },
- success : function ( data ) {
- $.each( data, function( id, val ) {
+ success : function( data ) {
+ $.each( data, function( index, val ) {
// Replace HTML
- var cell1 = $("#ToolDependencyStatus-" + id);
- cell1.html( val.html_status );
- dependency_status_list[ id ] = val.status;
+ var cell1 = $( "#ToolDependencyStatus-" + val[ 'id' ] );
+ cell1.html( val[ 'html_status' ] );
+ dependency_status_list[ index ] = val;
});
tool_dependency_status_updater( dependency_status_list );
},
error: function() {
- tool_dependency_status_updater( dependency_status_list );
+ alert( "tool_dependency_status_updater_callback failed..." );
+ }
+ });
+ };
+ </script>
+</%def>
+
+<%def name="repository_installation_status_updater()">
+ <script type="text/javascript">
+ // Tool shed repository status updater - used to update the installation status on the Repository Installation Grid.
+ // Looks for changes in repository installation status using an async request. Keeps calling itself (via setTimeout) until
+ // repository installation status is not one of: 'New', 'Cloning', 'Setting tool versions', 'Installing tool dependencies',
+ // 'Loading proprietary datatypes'.
+ var tool_shed_repository_status_updater = function( repository_status_list ) {
+ // See if there are any items left to track
+ //alert( "repository_status_list start " + repository_status_list.toSource() );
+ var empty = true;
+ for ( var item in repository_status_list ) {
+ //alert( "item" + item.toSource() );
+ //alert( "repository_status_list[item] " + repository_status_list[item].toSource() );
+ //alert( "repository_status_list[item]['status']" + repository_status_list[item]['status'] );
+ if (repository_status_list[item]['status'] != 'Installed'){
+ empty = false;
+ break;
+ }
+ }
+ if ( ! empty ) {
+ setTimeout( function() { tool_shed_repository_status_updater_callback( repository_status_list ) }, 3000 );
+ }
+ };
+ var tool_shed_repository_status_updater_callback = function( repository_status_list ) {
+ //alert( repository_status_list );
+ //alert( repository_status_list.toSource() );
+ var ids = [];
+ var status_list = [];
+ $.each( repository_status_list, function( index, repository_status ) {
+ //alert('repository_status '+ repository_status.toSource() );
+ //alert('id '+ repository_status['id'] );
+ //alert( 'status'+ repository_status['status'] );
+ ids.push( repository_status[ 'id' ] );
+ status_list.push( repository_status[ 'status' ] );
+ });
+ // Make ajax call
+ $.ajax( {
+ type: "POST",
+ url: "${h.url_for( controller='admin_toolshed', action='repository_installation_status_updates' )}",
+ dataType: "json",
+ data: { ids: ids.join( "," ), status_list: status_list.join( "," ) },
+ success : function( data ) {
+ $.each( data, function( index, val ) {
+ // Replace HTML
+ var cell1 = $( "#RepositoryStatus-" + val[ 'id' ] );
+ cell1.html( val[ 'html_status' ] );
+ repository_status_list[ index ] = val;
+ });
+ tool_shed_repository_status_updater( repository_status_list );
+ },
+ error: function() {
+ alert( "tool_shed_repository_status_updater_callback failed..." );
}
});
};
@@ -126,71 +188,27 @@
%if can_update:
<script type="text/javascript">
// Tool dependency installation status updater
- tool_dependency_status_updater( {${ ",".join( [ '"%s" : "%s"' % ( trans.security.encode_id( td.id ), td.status ) for td in query ] ) }});
+ tool_dependency_status_updater( [${ ",".join( [ '{"id" : "%s", "status" : "%s"}' % ( trans.security.encode_id( td.id ), td.status ) for td in query ] ) } ] );
</script>
%endif
</%def>
-<%def name="repository_installation_status_updater()">
- <script type="text/javascript">
-
- // Tool shed repository status updater - used to update the installation status on the repository_installation.mako template.
- // Looks for changes in repository installation status using an async request. Keeps calling itself (via setTimeout) until
- // repository installation status is neither 'cloning', 'cloned' nor 'installing tool dependencies'.
- var tool_shed_repository_status_updater = function ( repository_status_list ) {
- // See if there are any items left to track
- var empty = true;
- for ( i in repository_status_list ) {
- empty = false;
- break;
- }
- if ( ! empty ) {
- setTimeout( function() { tool_shed_repository_status_updater_callback( repository_status_list ) }, 3000 );
- }
- };
- var tool_shed_repository_status_updater_callback = function ( repository_status_list ) {
- var ids = []
- var status_list = []
- $.each( repository_status_list, function ( id, repository_status ) {
- ids.push( id );
- status_list.push( repository_status );
- });
- // Make ajax call
- $.ajax( {
- type: "POST",
- url: "${h.url_for( controller='admin_toolshed', action='repository_installation_status_updates' )}",
- dataType: "json",
- data: { id: ids[0], status_list: status_list.join( "," ) },
- success : function ( data ) {
- $.each( data, function( id, val ) {
- // Replace HTML
- var cell1 = $("#RepositoryStatus-" + id);
- cell1.html( val.html_status );
- repository_status_list[ id ] = val.status;
- });
- tool_shed_repository_status_updater( repository_status_list );
- },
- error: function() {
- tool_shed_repository_status_updater( repository_status_list );
- }
- });
- };
- </script>
-</%def>
-
<%def name="repository_installation_updater()"><%
- can_update = True
- if tool_shed_repository:
- can_update = tool_shed_repository.status not in [ trans.model.ToolShedRepository.installation_status.INSTALLED,
- trans.model.ToolShedRepository.installation_status.ERROR,
- trans.model.ToolShedRepository.installation_status.UNINSTALLED ]
+ can_update = False
+ if query.count():
+ for tool_shed_repository in query:
+ if tool_shed_repository.status not in [ trans.model.ToolShedRepository.installation_status.INSTALLED,
+ trans.model.ToolShedRepository.installation_status.ERROR,
+ trans.model.ToolShedRepository.installation_status.DEACTIVATED,
+ trans.model.ToolShedRepository.installation_status.UNINSTALLED ]:
+ can_update = True
+ break
%>
%if can_update:
<script type="text/javascript">
// Tool shed repository installation status updater
- repository_installation_status_updater( {${ ",".join( [ '"%s" : "%s"' % ( trans.security.encode_id( repository.id ), repository.status ) for repository in query ] ) }});
+ tool_shed_repository_status_updater( [${ ",".join( [ '{"id" : "%s", "status" : "%s"}' % ( trans.security.encode_id( tsr.id ), tsr.status ) for tsr in query ] ) } ] );
</script>
%endif
</%def>
-
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/confirm_tool_dependency_install.mako
--- a/templates/admin/tool_shed_repository/confirm_tool_dependency_install.mako
+++ /dev/null
@@ -1,86 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<% import os %>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="warningmessage">
- <p>
- The tool dependencies listed below can be automatically installed with the repository. Installing them provides significant
- benefits and Galaxy includes various features to manage them.
- </p>
- <p>
- Each of these dependencies may require their own build requirements (e.g., CMake, g++, etc). Galaxy will not attempt to install
- these build requirements, so if any are missing from your environment tool dependency installation may partially fail. The
- repository and all of it's contents will be installed in any case.
- </p>
- <p>
- If tool dependency installation fails in any way, you can install the missing build requirements and have Galaxy attempt to install
- the tool dependencies again using the <b>Install tool dependencies</b> pop-up menu option on the <b>Manage repository</b> page.
- </p>
-</div>
-
-<div class="toolForm">
- <div class="toolFormBody">
- <form name="confirm_tool_dependency_install" id="confirm_tool_dependency_install" action="${h.url_for( controller='admin_toolshed', action='install_repository', tool_shed_url=tool_shed_url, repo_info_dict=repo_info_dict, includes_tools=includes_tools )}" method="post" >
- <div style="clear: both"></div>
- <div class="form-row">
- <label>Install tool dependencies?</label>
- ${install_tool_dependencies_check_box.get_html()}
- <div class="toolParamHelp" style="clear: both;">
- Un-check to skip automatic installation of these tool dependencies.
- </div>
- </div>
- <div style="clear: both"></div>
- <div class="form-row">
- <table class="grid">
- <tr><td colspan="4" bgcolor="#D8D8D8"><b>Tool dependencies</b></td></tr>
- <tr>
- <th>Name</th>
- <th>Version</th>
- <th>Type</th>
- <th>Install directory</th>
- </tr>
- %for repository_name, repo_info_tuple in dict_with_tool_dependencies.items():
- <%
- description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple
- %>
- %for dependency_key, requirements_dict in tool_dependencies.items():
- <%
- name = requirements_dict[ 'name' ]
- version = requirements_dict[ 'version' ]
- type = requirements_dict[ 'type' ]
- install_dir = os.path.join( trans.app.config.tool_dependency_dir,
- name,
- version,
- repository_owner,
- repository_name,
- changeset_revision )
- readme_text = requirements_dict.get( 'readme', None )
- %>
- %if not os.path.exists( install_dir ):
- <tr>
- <td>${name}</td>
- <td>${version}</td>
- <td>${type}</td>
- <td>${install_dir}</td>
- </tr>
- %if readme_text:
- <tr><td colspan="4" bgcolor="#FFFFCC">${name} ${version} requirements and installation information</td></tr>
- <tr><td colspan="4"><pre>${readme_text}</pre></td></tr>
- %endif
- %endif
- %endfor
- %endfor
- </table>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="confirm_tool_dependency_install_button" value="Continue"/>
- </div>
- </form>
- </div>
-</div>
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
--- a/templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
+++ b/templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
@@ -10,7 +10,8 @@
<a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( repository.id ) )}">Manage repository</a><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='check_for_updates', id=trans.security.encode_id( repository.id ) )}">Get updates</a>
%if repository.tool_dependencies:
- <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Manage tool dependencies</a>
+ <% tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in repository.tool_dependencies ] %>
+ <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', tool_dependency_ids=tool_dependency_ids )}">Manage tool dependencies</a>
%endif
</div></ul>
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/initiate_repository_installation.mako
--- /dev/null
+++ b/templates/admin/tool_shed_repository/initiate_repository_installation.mako
@@ -0,0 +1,75 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/admin/tool_shed_repository/common.mako" import="*" />
+
+<%def name="javascripts()">
+ ${parent.javascripts()}
+ ${repository_installation_status_updater()}
+ ${repository_installation_updater()}
+ ${self.repository_installation_javascripts()}
+</%def>
+
+<%def name="repository_installation_javascripts()">
+ <script type="text/javascript">
+ $(document).ready(function( ){
+ initiate_repository_installation( "${initiate_repository_installation_ids}", "${encoded_kwd}" );
+ });
+ var initiate_repository_installation = function ( iri_ids, encoded_kwd ) {
+ // Make ajax call
+ $.ajax( {
+ type: "POST",
+ url: "${h.url_for( controller='admin_toolshed', action='manage_repositories' )}",
+ dataType: "html",
+ data: { operation: "install", tool_shed_repository_ids: iri_ids, encoded_kwd: encoded_kwd },
+ success : function ( data ) {
+ //alert( "Initializing repository installation succeeded" );
+ },
+ error: function() {
+ alert( "Initializing repository installation failed" );
+ },
+ });
+ };
+ </script>
+</%def>
+
+%if tool_shed_repositories:
+ <div class="toolForm">
+ <div class="toolFormTitle">Monitor installing tool shed repositories</div>
+ <div class="toolFormBody">
+ <table class="grid">
+ <tr>
+ <td>Name</td>
+ <td>Description</td>
+ <td>Owner</td>
+ <td>Revision</td>
+ <td>Status</td>
+ </tr>
+ %for tool_shed_repository in tool_shed_repositories:
+ <%
+ encoded_repository_id = trans.security.encode_id( tool_shed_repository.id )
+ ids_of_tool_dependencies_missing_or_being_installed = [ trans.security.encode_id( td.id ) for td in tool_shed_repository.tool_dependencies_missing_or_being_installed ]
+ link_to_manage_tool_dependencies = tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES ]
+ %>
+ <tr>
+ <td>
+ %if link_to_manage_tool_dependencies:
+ <a class="view-info" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', tool_dependency_ids=ids_of_tool_dependencies_missing_or_being_installed )}">
+ ${tool_shed_repository.name}
+ </a>
+ %else:
+ <a class="view-info" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=encoded_repository_id )}">
+ ${tool_shed_repository.name}
+ </a>
+ %endif
+ </td>
+ <td>${tool_shed_repository.description}</td>
+ <td>${tool_shed_repository.owner}</td>
+ <td>${tool_shed_repository.changeset_revision}</td>
+ <td><div id="RepositoryStatus-${encoded_repository_id}">${tool_shed_repository.status}</div></td>
+ </tr>
+ %endfor
+ </table>
+ <br clear="left"/>
+ </div>
+ </div>
+%endif
+
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/repository_installation_grid.mako
--- /dev/null
+++ b/templates/admin/tool_shed_repository/repository_installation_grid.mako
@@ -0,0 +1,8 @@
+<%inherit file="/grid_base.mako"/>
+<%namespace file="/admin/tool_shed_repository/common.mako" import="*" />
+
+<%def name="javascripts()">
+ ${parent.javascripts()}
+ ${repository_installation_status_updater()}
+ ${repository_installation_updater()}
+</%def>
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/repository_installation_status.mako
--- /dev/null
+++ b/templates/admin/tool_shed_repository/repository_installation_status.mako
@@ -0,0 +1,29 @@
+<%def name="render_repository_status( repository )">
+ <%
+ if repository.status in [ trans.model.ToolShedRepository.installation_status.CLONING,
+ trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS,
+ trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES,
+ trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES ]:
+ bgcolor = trans.model.ToolShedRepository.states.INSTALLING
+ elif repository.status in [ trans.model.ToolShedRepository.installation_status.NEW,
+ trans.model.ToolShedRepository.installation_status.UNINSTALLED ]:
+ bgcolor = trans.model.ToolShedRepository.states.UNINSTALLED
+ elif repository.status in [ trans.model.ToolShedRepository.installation_status.ERROR ]:
+ bgcolor = trans.model.ToolShedRepository.states.ERROR
+ elif repository.status in [ trans.model.ToolShedRepository.installation_status.DEACTIVATED ]:
+ bgcolor = trans.model.ToolShedRepository.states.WARNING
+ elif repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLED ]:
+ if repository.missing_tool_dependencies:
+ bgcolor = trans.model.ToolShedRepository.states.WARNING
+ else:
+ bgcolor = trans.model.ToolShedRepository.states.OK
+ else:
+ bgcolor = trans.model.ToolShedRepository.states.ERROR
+ rval = '<div class="count-box state-color-%s" id="ToolShedRepositoryStatus-%s">' % ( bgcolor, trans.security.encode_id( repository.id ) )
+ rval += '%s</div>' % repository.status
+ return rval
+ %>
+ ${rval}
+</%def>
+
+${render_repository_status( repository )}
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/reselect_tool_panel_section.mako
--- a/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako
+++ b/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako
@@ -8,12 +8,7 @@
<div class="toolForm"><div class="toolFormTitle">Choose the tool panel section to contain the installed tools (optional)</div><div class="toolFormBody">
- %if repository.tool_dependencies:
- <% tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in repository.tool_dependencies ] %>
- <form name="reselect_tool_panel_section" id="reselect_tool_panel_section" action="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', operation='install', tool_dependency_ids=tool_dependency_ids )}" method="post" >
- %else:
- <form name="reselect_tool_panel_section" id="reselect_tool_panel_section" action="${h.url_for( controller='admin_toolshed', action='reinstall_repository', id=trans.security.encode_id( repository.id ) )}" method="post" >
- %endif
+ <form name="reselect_tool_panel_section" id="reselect_tool_panel_section" action="${h.url_for( controller='admin_toolshed', action='reinstall_repository', id=trans.security.encode_id( repository.id ) )}" method="post" ><div class="form-row">
${no_changes_check_box.get_html()}
<label style="display: inline;">No changes</label>
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/select_tool_panel_section.mako
--- a/templates/admin/tool_shed_repository/select_tool_panel_section.mako
+++ b/templates/admin/tool_shed_repository/select_tool_panel_section.mako
@@ -1,6 +1,8 @@
<%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" />
+<% import os %>
+
%if message:
${render_msg( message, status )}
%endif
@@ -20,24 +22,83 @@
</p></div><br/>
-<div class="warningmessage">
- <p>
- Installation may take a while with large repositories or if you elect to install tool dependencies. <b>Always wait until a message is
- displayed in your browser after clicking the <b>Install</b> button below.</b> If you get bored, watching your Galaxy server's paster log
- will help pass the time.
- </p>
- <p>
- If installing tool dependencies, information about installation process will be saved in various files named with a ".log"
- extension in the directory:
- ${trans.app.config.tool_dependency_dir}/<i>package name</i>/<i>package version</i>/<i>repository owner</i>/<i>repository name</i>/<i>repository changeset revision</i>
- </p>
-</div>
-<br/><div class="toolForm">
- <div class="toolFormTitle">Choose the tool panel section to contain the installed tools (optional)</div>
+ <div class="toolFormTitle">Confirm tool dependency installation</div><div class="toolFormBody">
- <form name="select_tool_panel_section" id="select_tool_panel_section" action="${h.url_for( controller='admin_toolshed', action='install_repository', tool_shed_url=tool_shed_url, repo_info_dict=repo_info_dict, includes_tools=includes_tools, install_tool_dependencies=install_tool_dependencies )}" method="post" >
+ <form name="select_tool_panel_section" id="select_tool_panel_section" action="${h.url_for( controller='admin_toolshed', action='install_repository', tool_shed_url=tool_shed_url, repo_info_dict=repo_info_dict, includes_tools=includes_tools, includes_tool_dependencies=includes_tool_dependencies )}" method="post" >
+ <div style="clear: both"></div>
+ %if includes_tool_dependencies:
+ <div class="form-row">
+ <div class="toolParamHelp" style="clear: both;">
+ <p>
+ These tool dependencies can be automatically installed with the repository. Installing them provides significant benefits and
+ Galaxy includes various features to manage them.
+ </p>
+ <p>
+ Each of these dependencies may require their own build requirements (e.g., CMake, g++, etc). Galaxy will not attempt to install
+ these build requirements, so tool dependency installation may partially fail if any are missing from your environment, but the
+ repository and all of it's contents will be installed. You can install the missing build requirements and have Galaxy attempt
+ to install the tool dependencies again if tool dependency installation fails in any way.
+ </p>
+ </div>
+ </div>
+ <div class="form-row">
+ <label>Install tool dependencies?</label>
+ ${install_tool_dependencies_check_box.get_html()}
+ <div class="toolParamHelp" style="clear: both;">
+ Un-check to skip automatic installation of these tool dependencies.
+ </div>
+ </div>
+ <div style="clear: both"></div>
+ <div class="form-row">
+ <table class="grid">
+ <tr><td colspan="4" bgcolor="#D8D8D8"><b>Tool dependencies</b></td></tr>
+ <tr>
+ <th>Name</th>
+ <th>Version</th>
+ <th>Type</th>
+ <th>Install directory</th>
+ </tr>
+ %for repository_name, repo_info_tuple in dict_with_tool_dependencies.items():
+ <% description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple %>
+ %for dependency_key, requirements_dict in tool_dependencies.items():
+ <%
+ name = requirements_dict[ 'name' ]
+ version = requirements_dict[ 'version' ]
+ type = requirements_dict[ 'type' ]
+ install_dir = os.path.join( trans.app.config.tool_dependency_dir,
+ name,
+ version,
+ repository_owner,
+ repository_name,
+ changeset_revision )
+ tool_dependency_readme_text = requirements_dict.get( 'readme', None )
+ %>
+ %if not os.path.exists( install_dir ):
+ <tr>
+ <td>${name}</td>
+ <td>${version}</td>
+ <td>${type}</td>
+ <td>${install_dir}</td>
+ </tr>
+ %if tool_dependency_readme_text:
+ <tr><td colspan="4" bgcolor="#FFFFCC">${name} ${version} requirements and installation information</td></tr>
+ <tr><td colspan="4"><pre>${tool_dependency_readme_text}</pre></td></tr>
+ %endif
+ %endif
+ %endfor
+ %endfor
+ </table>
+ <div style="clear: both"></div>
+ </div>
+ %endif
+ <div style="clear: both"></div>
+ <div class="form-row">
+ <table class="colored" width="100%">
+ <th bgcolor="#EBD9B2">Choose the tool panel section to contain the installed tools (optional)</th>
+ </table>
+ </div>
%if shed_tool_conf_select_field:
<div class="form-row"><label>Shed tool configuration file:</label>
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/tool_dependency_installation_status.mako
--- a/templates/admin/tool_shed_repository/tool_dependency_installation_status.mako
+++ b/templates/admin/tool_shed_repository/tool_dependency_installation_status.mako
@@ -1,11 +1,17 @@
<%def name="render_tool_dependency_status( tool_dependency )"><%
- if tool_dependency.status == trans.model.ToolDependency.installation_status.INSTALLING:
+ if tool_dependency.status in [ trans.model.ToolDependency.installation_status.INSTALLING ]:
bgcolor = trans.model.ToolDependency.states.INSTALLING
- rval = '<div class="count-box state-color-%s" id="ToolDependencyStatus-%s">' % ( bgcolor, trans.security.encode_id( tool_dependency.id ) )
- rval += '%s</div>' % tool_dependency.status
- else:
- rval = tool_dependency.status
+ elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.NEVER_INSTALLED,
+ trans.model.ToolDependency.installation_status.UNINSTALLED ]:
+ bgcolor = trans.model.ToolDependency.states.UNINSTALLED
+ elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.ERROR ]:
+ bgcolor = trans.model.ToolDependency.states.ERROR
+ elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.INSTALLED ]:
+ bgcolor = trans.model.ToolDependency.states.OK
+ rval = '<div class="count-box state-color-%s" id="ToolDependencyStatus-%s">' % ( bgcolor, trans.security.encode_id( tool_dependency.id ) )
+ rval += '%s</div>' % tool_dependency.status
+ return rval
%>
${rval}
</%def>
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/admin/tool_shed_repository/view_tool_metadata.mako
--- a/templates/admin/tool_shed_repository/view_tool_metadata.mako
+++ b/templates/admin/tool_shed_repository/view_tool_metadata.mako
@@ -9,7 +9,8 @@
<a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( repository.id ) )}">Manage repository</a><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='check_for_updates', id=trans.security.encode_id( repository.id ) )}">Get updates</a>
%if repository.tool_dependencies:
- <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Manage tool dependencies</a>
+ <% tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in repository.tool_dependencies ] %>
+ <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', tool_dependency_ids=tool_dependency_ids )}">Manage tool dependencies</a>
%endif
<a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a></div>
diff -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 -r cc5fea2e382ed8edadf0d694f559b46e86a66884 templates/webapps/galaxy/admin/index.mako
--- a/templates/webapps/galaxy/admin/index.mako
+++ b/templates/webapps/galaxy/admin/index.mako
@@ -73,6 +73,7 @@
%if cloned_repositories:
<div class="toolTitle"><a href="${h.url_for( controller='admin_toolshed', action='browse_repositories' )}" target="galaxy_main">Manage installed tool shed repositories</a></div>
%endif
+ <div class="toolTitle"><a href="${h.url_for( controller='admin_toolshed', action='monitor_repository_installation' )}" target="galaxy_main">Monitor installing tool shed repositories</a></div></div></div>
%if trans.app.tool_shed_registry and trans.app.tool_shed_registry.tool_sheds:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Trackster modifications to work with new tools API controller.
by Bitbucket 29 Jun '12
by Bitbucket 29 Jun '12
29 Jun '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/1a4d6f11f284/
changeset: 1a4d6f11f284
user: jgoecks
date: 2012-06-29 19:17:10
summary: Trackster modifications to work with new tools API controller.
affected #: 6 files
diff -r b2640a90e1b40a963be910329b243ae8c3fb9967 -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 lib/galaxy/web/api/tools.py
--- a/lib/galaxy/web/api/tools.py
+++ b/lib/galaxy/web/api/tools.py
@@ -135,7 +135,6 @@
run_on_regions = False
regions = payload.get( 'regions', None )
if regions:
- regions = from_json_string( regions )
if isinstance( regions, dict ):
# Regions is a single region.
regions = [ GenomeRegion.from_dict( regions ) ]
diff -r b2640a90e1b40a963be910329b243ae8c3fb9967 -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 static/scripts/mvc/data.js
--- a/static/scripts/mvc/data.js
+++ b/static/scripts/mvc/data.js
@@ -4,10 +4,10 @@
*/
var Dataset = Backbone.RelationalModel.extend({
defaults: {
- id: "",
- type: "",
- name: "",
- hda_ldda: ""
+ id: '',
+ type: '',
+ name: '',
+ hda_ldda: 'hda'
}
});
diff -r b2640a90e1b40a963be910329b243ae8c3fb9967 -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 static/scripts/mvc/tools.js
--- a/static/scripts/mvc/tools.js
+++ b/static/scripts/mvc/tools.js
@@ -112,7 +112,7 @@
return this._run({
action: 'rerun',
target_dataset_id: target_dataset.id,
- regions: JSON.stringify(regions)
+ regions: regions
});
},
diff -r b2640a90e1b40a963be910329b243ae8c3fb9967 -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 static/scripts/viz/trackster.js
--- a/static/scripts/viz/trackster.js
+++ b/static/scripts/viz/trackster.js
@@ -87,6 +87,9 @@
* Helper to determine if object is jQuery deferred.
*/
var is_deferred = function ( d ) {
+ if (d === 'pending') {
+ console.log('pending');
+ }
return ( 'isResolved' in d );
};
@@ -1770,7 +1773,7 @@
var param_dict = {};
this.parent_div.find(":input").each(function() {
var name = $(this).attr("name"), value = $(this).val();
- param_dict[name] = JSON.stringify(value);
+ param_dict[name] = value;
});
return param_dict;
},
@@ -1796,7 +1799,7 @@
tool.run(
// URL params.
{
- dataset_id: this.track.original_dataset_id,
+ target_dataset_id: this.track.original_dataset_id,
tool_id: tool.name
},
null,
@@ -1820,11 +1823,14 @@
var
url_params =
{
- dataset_id: this.track.original_dataset_id,
- chrom: this.track.view.chrom,
- low: this.track.view.low,
- high: this.track.view.high,
- tool_id: this.name
+ target_dataset_id: this.track.original_dataset_id,
+ action: 'rerun',
+ tool_id: this.name,
+ regions: [{
+ chrom: this.track.view.chrom,
+ start: this.track.view.low,
+ end: this.track.view.high
+ }]
},
current_track = this.track,
// Set name of track to include tool name, parameters, and region used.
@@ -1871,10 +1877,7 @@
this.run(url_params, new_track,
// Success callback.
function(track_data) {
- new_track.set_dataset(new Dataset({
- id: track_data.dataset_id,
- hda_ldda: track_data.hda_ldda
- }));
+ new_track.set_dataset(new Dataset(track_data));
new_track.tiles_div.text("Running job.");
new_track.init();
}
@@ -1885,9 +1888,15 @@
*/
run: function(url_params, new_track, success_callback) {
// Run tool.
+ url_params.inputs = this.get_param_values_dict();
var ss_deferred = new ServerStateDeferred({
- url: rerun_tool_url,
- url_params: $.extend(url_params, this.get_param_values_dict()),
+ ajax_settings: {
+ url: galaxy_paths.get('tool_url'),
+ data: JSON.stringify(url_params),
+ dataType: "json",
+ contentType: 'application/json',
+ type: "POST"
+ },
interval: 2000,
success_fn: function(response) {
return response !== "pending";
@@ -4636,7 +4645,7 @@
// Paint summary tree into canvas
var painter = new painters.SummaryTreePainter(result, tile_low, tile_high, this.prefs);
painter.draw(ctx, canvas.width, canvas.height, w_scale);
- return new SummaryTreeTile(track, tile_index, resolution, canvas, result.data, result.max);
+ return new SummaryTreeTile(track, region, resolution, canvas, result.data, result.max);
}
// Handle row-by-row tracks
diff -r b2640a90e1b40a963be910329b243ae8c3fb9967 -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -420,20 +420,19 @@
},
/**
- * as_str attribute using the format chrom:start-end can be
- * used to set object's attributes.
+ * If options is a string, parsing using the format
+ * chrom:start-end is attempted to set object attributes.
*/
initialize: function(options) {
- if (!this.get('chrom') && !this.get('start') &&
- !this.get('end') && 'as_str' in options) {
- var pieces = options.as_str.split(':'),
+ if (typeof(options) === 'string') {
+ var pieces = options.split(':'),
chrom = pieces[0],
- start_end = pieces.split('-'),
- start = start_end[0],
- end = start_end[1];
- this.set('chrom', chrom);
- this.set('start', start);
- this.set('end', end);
+ start_end = pieces[1].split('-');
+ this.set({
+ chrom: chrom,
+ start: parseInt(start_end[0]),
+ end: parseInt(start_end[1])
+ });
}
},
diff -r b2640a90e1b40a963be910329b243ae8c3fb9967 -r 1a4d6f11f28453aa98b32439a8df479a2830bc50 templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -49,8 +49,7 @@
// Place URLs here so that url_for can be used to generate them.
//
galaxy_paths.set({
- visualization_url: "${h.url_for( action='save' )}",
- run_tool_url: "${h.url_for( controller='/api/tools' )}"
+ visualization_url: "${h.url_for( action='save' )}"
});
var
add_track_async_url = "${h.url_for( action='add_track_async' )}",
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/b2640a90e1b4/
changeset: b2640a90e1b4
user: jgoecks
date: 2012-06-29 01:11:25
summary: Code cleanup from JSHint.
affected #: 1 file
diff -r 1033af3c659443a981d7475e60171fb86a3e7e38 -r b2640a90e1b40a963be910329b243ae8c3fb9967 static/scripts/viz/trackster.js
--- a/static/scripts/viz/trackster.js
+++ b/static/scripts/viz/trackster.js
@@ -12,7 +12,7 @@
var target = arguments[0];
for ( var i = 1; i < arguments.length; i++ ) {
var other = arguments[i];
- for ( key in other ) {
+ for ( var key in other ) {
target[key] = other[key];
}
}
@@ -97,7 +97,7 @@
*/
var get_random_color = function(colors) {
// Default for colors is white.
- if (!colors) { colors = "#ffffff" };
+ if (!colors) { colors = "#ffffff"; }
// If needed, create list of colors.
if ( typeof(colors) === "string" ) {
@@ -138,7 +138,7 @@
nb = new_color & 0x0000ff;
n_brightness = brightness(nr, ng, nb);
ok = true;
- for (var i = 0; i < colors.length; i++) {
+ for (i = 0; i < colors.length; i++) {
other_color = colors[i];
or = ( other_color & 0xff0000 ) >> 16;
og = ( other_color & 0x00ff00 ) >> 8;
@@ -155,7 +155,7 @@
}
num_tries++
- } while (!ok && num_tries <= 10 );
+; } while (!ok && num_tries <= 10 );
// Add 0x1000000 to left pad number with 0s.
return '#' + ( 0x1000000 + new_color ).toString(16).substr(1,6);
@@ -211,8 +211,7 @@
// Need to provide selector for handle, not class.
element.bind( "drag", { handle: "." + handle_class, relative: true }, function ( e, d ) {
- var element = $(this);
- var
+ var element = $(this),
parent = $(this).parent(),
children = parent.children(),
this_obj = html_elt_js_obj_dict[$(this).attr("id")],
@@ -278,7 +277,6 @@
// Handle sibling movement, aka sorting.
// Determine new position
- var child;
for ( i = 0; i < children.length; i++ ) {
child = $(children.get(i));
if ( d.offsetY < child.position().top &&
@@ -343,8 +341,8 @@
DATA_ERROR = "There was an error in indexing this dataset. ",
DATA_NOCONVERTER = "A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",
DATA_NONE = "No data for this chrom/contig.",
- DATA_PENDING = "Preparing data. This can take a while for a large dataset. \
- If the visualization is saved and closed, preparation will continue in the background.",
+ DATA_PENDING = "Preparing data. This can take a while for a large dataset. " +
+ "If the visualization is saved and closed, preparation will continue in the background.",
DATA_CANNOT_RUN_TOOL = "Tool cannot be rerun: ",
DATA_LOADING = "Loading data...",
DATA_OK = "Ready for display",
@@ -512,7 +510,6 @@
* Use from_dict to recreate object.
*/
to_dict: function() {},
- update_icons: function() {},
/**
* Set drawable name.
*/
@@ -744,7 +741,7 @@
if ('filters' in obj_dict) {
// FIXME: Pass collection_dict to DrawableCollection/Drawable will make this easier.
var old_manager = this.filters_manager;
- this.filters_manager = new FiltersManager(this, obj_dict['filters']);
+ this.filters_manager = new FiltersManager(this, obj_dict.filters);
old_manager.parent_div.replaceWith(this.filters_manager.parent_div);
if (obj_dict.filters.visible) {
@@ -818,7 +815,7 @@
//
// Handle update when there are no tracks.
//
- var num_drawables = this.drawables.length
+ var num_drawables = this.drawables.length;
if (num_drawables === 0) {
this.action_icons.composite_icon.hide();
this.action_icons.filters_icon.hide();
@@ -843,7 +840,7 @@
a_type = this.drawables[0].get_type(),
num_feature_tracks = 0;
for (var i = 0; i < num_drawables; i++) {
- drawable = this.drawables[i]
+ drawable = this.drawables[i];
if (drawable.get_type() !== a_type) {
can_composite = false;
break;
@@ -1183,8 +1180,7 @@
// to zoom in
this.top_labeltrack.bind( "dragstart", function( e, d ) {
return $("<div />").css( {
- "height": view.browser_content_div.height() + view.top_labeltrack.height()
- + view.nav_labeltrack.height() + 1,
+ "height": view.browser_content_div.height() + view.top_labeltrack.height() + view.nav_labeltrack.height() + 1,
"top": "0px",
"position": "absolute",
"background-color": "#ccf",
@@ -1339,8 +1335,6 @@
return;
}
- var view = this;
-
//
// If user is navigating to previous/next set of chroms, load new chrom set and return.
//
@@ -1484,11 +1478,11 @@
*/
// FIXME: change method call so that track is first and additional parameters are optional.
// FIXME: is nodraw parameter needed?
- request_redraw: function(nodraw, force, clear_after, track) {
+ request_redraw: function(nodraw, force, clear_after, a_track) {
var
view = this,
// Either redrawing a single drawable or all view's drawables.
- track_list = (track ? [track] : view.drawables),
+ track_list = (a_track ? [a_track] : view.drawables),
track_index;
// Add/update tracks in track list to redraw list.
@@ -1519,7 +1513,7 @@
// Set up redraw if it has not been requested since last redraw.
if (!this.requested_redraw) {
- requestAnimationFrame(function() { view._redraw(nodraw) });
+ requestAnimationFrame(function() { view._redraw(nodraw); });
this.requested_redraw = true;
}
},
@@ -1726,7 +1720,7 @@
});
// Highlight value for inputs for easy replacement.
- this.parent_div.find("input").click(function() { $(this).select() });
+ this.parent_div.find("input").click(function() { $(this).select(); });
// Add buttons for running on dataset, region.
var run_tool_row = $("<div>").addClass("param-row").appendTo(this.parent_div);
@@ -1785,7 +1779,6 @@
*/
get_param_values: function() {
var param_values = [];
- var param_dict = {};
this.parent_div.find(":input").each(function() {
// Only include inputs with names; this excludes Run button.
var name = $(this).attr("name"), value = $(this).val();
@@ -1843,7 +1836,7 @@
// already in group, add track to group.
if (current_track.container === view) {
// Create new group.
- var group = new DrawableGroup(view, view, { name: this.name })
+ var group = new DrawableGroup(view, view, { name: this.name });
// Replace track with group.
var index = current_track.container.replace_drawable(current_track, group, false);
@@ -1942,7 +1935,7 @@
});
var NumberParameter = function(name, label, html, value, min, max) {
- ToolParameter.call(this, name, label, html, value)
+ ToolParameter.call(this, name, label, html, value);
this.min = min;
this.max = max;
};
@@ -1994,7 +1987,7 @@
this.high = ('high' in obj_dict ? obj_dict.high : Number.MAX_VALUE);
// Slide min/max. These values are used to set/update slider.
this.min = ('min' in obj_dict ? obj_dict.min : Number.MAX_VALUE);
- this.max = ('max' in obj_dict ? obj_dict.max : -Number.MAX_VALUE)
+ this.max = ('max' in obj_dict ? obj_dict.max : -Number.MAX_VALUE);
// UI elements associated with filter.
this.container = null;
this.slider = null;
@@ -2370,7 +2363,7 @@
}
}
else {
- console.log("ERROR: unsupported filter: ", name, type)
+ console.log("ERROR: unsupported filter: ", name, type);
}
}
@@ -2486,8 +2479,7 @@
//
var active_filters = {},
filter,
- tool_filter_conditions,
- operation;
+ tool_filter_conditions;
for (var i = 0; i < this.filters.length; i++) {
filter = this.filters[i];
if (filter.tool_id) {
@@ -2515,7 +2507,6 @@
// Invoke recursive function to run filters; this enables chaining of filters via
// iteratively application.
- var num_filters = active_filters_list.length;
(function run_filter(input_dataset_id, filters) {
var
// Set up filtering info and params.
@@ -2579,9 +2570,9 @@
var DrawableConfig = function( options ) {
this.track = options.track;
this.params = options.params;
- this.values = {}
+ this.values = {};
this.restore_values( (options.saved_values ? options.saved_values : {}) );
- this.onchange = options.onchange
+ this.onchange = options.onchange;
};
extend(DrawableConfig.prototype, {
@@ -2615,7 +2606,7 @@
row.append( $('<input type="checkbox" />').attr("id", id ).attr("name", id ).attr( 'checked', value ) );
// Draw parameter as textbox
} else if ( param.type === 'text' ) {
- row.append( $('<input type="text"/>').attr("id", id ).val(value).click( function() { $(this).select() }));
+ row.append( $('<input type="text"/>').attr("id", id ).val(value).click( function() { $(this).select(); }));
// Draw paramter as select area
} else if ( param.type === 'select' ) {
var select = $('<select />').attr("id", id);
@@ -2733,7 +2724,7 @@
this.resolution = resolution;
// Wrap element in div for background and explicitly set height. Use canvas
// height attribute because canvas may not have height if it is not in document yet.
- this.html_elt = $("<div class='track-tile'/>").append(canvas).height( $(canvas).attr("height") )
+ this.html_elt = $("<div class='track-tile'/>").append(canvas).height( $(canvas).attr("height") );
this.data = data;
this.stale = false;
};
@@ -2851,8 +2842,7 @@
var popup = popups[feature_uid];
if (!popup) {
// Create feature's popup element.
- var
- feature_uid = feature_data[0],
+ var feature_uid = feature_data[0],
feature_dict = {
name: feature_data[3],
start: feature_data[1],
@@ -2893,7 +2883,7 @@
var
popupX = offsetX + parseInt( tile.html_elt.css("left") ) - popup.width() / 2,
popupY = offsetY + parseInt( tile.html_elt.css("top") ) + 7;
- popup.css("left", popupX + "px").css("top", popupY + "px")
+ popup.css("left", popupX + "px").css("top", popupY + "px");
}
else if (!e.isPropagationStopped()) {
// Propogate event to other tiles because overlapping tiles prevent mousemove from being
@@ -2933,7 +2923,7 @@
// Attribute init.
//
this.data_url = ('data_url' in obj_dict ? obj_dict.data_url : default_data_url);
- this.data_url_extra_params = {}
+ this.data_url_extra_params = {};
this.data_query_wait = ('data_query_wait' in obj_dict ? obj_dict.data_query_wait : DEFAULT_DATA_QUERY_WAIT);
this.dataset_check_url = ('converted_datasets_state_url' in obj_dict ? obj_dict.converted_datasets_state_url : converted_datasets_state_url);
@@ -2950,7 +2940,7 @@
data_url: track.data_url,
dataset_state_url: track.dataset_check_url,
data_mode_compatible: this.data_and_mode_compatible,
- can_subset: this.can_subset,
+ can_subset: this.can_subset
}));
// Height attributes: min height, max height, and visible height.
@@ -3059,7 +3049,7 @@
var track = this;
var in_handle = false;
var in_drag = false;
- var drag_control = $( "<div class='track-resize'>" )
+ var drag_control = $( "<div class='track-resize'>" );
// Control shows on hover over track, stays while dragging
$(track.container_div).hover( function() {
if ( track.content_visible ) {
@@ -3135,12 +3125,12 @@
// Hide tiles.
this.tiles_div.hide();
// Hide any y axis labels (common to several track types)
- this.container_div.find(".yaxislabel, .track-resize").hide()
+ this.container_div.find(".yaxislabel, .track-resize").hide();
},
show_contents: function() {
// Show the contents div and labels (if present)
this.tiles_div.show();
- this.container_div.find(".yaxislabel, .track-resize").show()
+ this.container_div.find(".yaxislabel, .track-resize").show();
// Request a redraw of the content
this.request_draw();
},
@@ -3461,7 +3451,7 @@
// If any tile could not be drawn yet, this will be set to false.
all_tiles_drawn = true,
drawn_tiles = [],
- is_tile = function(o) { return (o && 'track' in o) };
+ is_tile = function(o) { return (o && 'track' in o); };
// Draw tiles.
while ( ( tile_index * TILE_SIZE * resolution ) < high ) {
var draw_result = this.draw_helper( force, width, tile_index, resolution, this.tiles_div, w_scale );
@@ -3531,7 +3521,7 @@
}
// Flag to track whether we can draw everything now
- var can_draw_now = true
+ var can_draw_now = true;
// Get the track data, maybe a deferred
var tile_data = track.data_manager.get_data( region, track.mode, resolution, track.data_url_extra_params );
@@ -3542,7 +3532,7 @@
// Get seq data if needed, maybe a deferred
var seq_data;
if ( view.reference_track && w_scale > view.canvas_manager.char_width_px ) {
- seq_data = view.reference_track.data_manager.get_data(region, track.mode, resolution, view.reference_track.data_url_extra_params)
+ seq_data = view.reference_track.data_manager.get_data(region, track.mode, resolution, view.reference_track.data_url_extra_params);
if ( is_deferred( seq_data ) ) {
can_draw_now = false;
}
@@ -3724,7 +3714,7 @@
url_params: {dataset_id : self.dataset_id, hda_ldda: self.hda_ldda},
interval: self.data_query_wait,
// Set up deferred to check dataset state until it is not pending.
- success_fn: function(result) { return result !== "pending" }
+ success_fn: function(result) { return result !== "pending"; }
});
$.when(ss_deferred.go()).then(function() {
// Dataset is indexed, so use default data URL.
@@ -3896,7 +3886,7 @@
// Get seq data if needed, maybe a deferred.
seq_data = null;
if ( view.reference_track && w_scale > view.canvas_manager.char_width_px ) {
- seq_data = view.reference_track.data_manager.get_data(tile_low, tile_high, track.mode, resolution, view.reference_track.data_url_extra_params)
+ seq_data = view.reference_track.data_manager.get_data(tile_low, tile_high, track.mode, resolution, view.reference_track.data_url_extra_params);
if ( is_deferred( seq_data ) ) {
can_draw_now = false;
}
@@ -3934,7 +3924,7 @@
mode = track.get_mode(tile_data);
track.update_auto_mode(mode);
}
- track_modes.push(mode)
+ track_modes.push(mode);
track_canvas_height = track.get_canvas_height(tile_data, mode, w_scale, width);
if (track_canvas_height > height) { height = track_canvas_height; }
@@ -3945,7 +3935,7 @@
//
canvas.width = width;
// Height is specified in kwargs or is the height found above.
- canvas.height = (kwargs['height'] ? kwargs['height'] : height);
+ canvas.height = (kwargs.height ? kwargs.height : height);
all_data_index = 0;
var ctx = canvas.getContext('2d');
ctx.translate(this.left_offset, 0);
@@ -3986,7 +3976,7 @@
}),
track;
for (var i = 0; i < this.drawables.length; i++) {
- track = this.drawables[i]
+ track = this.drawables[i];
group.add_drawable(track);
track.container = group;
group.content_div.append(track.container_div);
@@ -4013,10 +4003,10 @@
track = this.drawables[i];
if (track instanceof LineTrack) {
if (track.prefs.min_value < min) {
- min = track.prefs.min_value
+ min = track.prefs.min_value;
}
if (track.prefs.max_value > max) {
- max = track.prefs.max_value
+ max = track.prefs.max_value;
}
}
}
@@ -4175,12 +4165,12 @@
var data = result.data;
if ( isNaN(parseFloat(track.prefs.min_value)) || isNaN(parseFloat(track.prefs.max_value)) ) {
// Compute default minimum and maximum values
- var min_value = data.min
- var max_value = data.max
+ var min_value = data.min,
+ max_value = data.max;
// If mean and sd are present, use them to compute a ~95% window
// but only if it would shrink the range on one side
- min_value = Math.floor( Math.min( 0, Math.max( min_value, data.mean - 2 * data.sd ) ) )
- max_value = Math.ceil( Math.max( 0, Math.min( max_value, data.mean + 2 * data.sd ) ) )
+ min_value = Math.floor( Math.min( 0, Math.max( min_value, data.mean - 2 * data.sd ) ) );
+ max_value = Math.ceil( Math.max( 0, Math.min( max_value, data.mean + 2 * data.sd ) ) );
// Update the prefs
track.prefs.min_value = min_value;
track.prefs.max_value = max_value;
@@ -4244,7 +4234,7 @@
*/
can_subset: function(data) {
return false;
- },
+ }
});
var FeatureTrack = function(view, container, obj_dict) {
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Fix bug when adding tracks due to recent refactoring.
by Bitbucket 28 Jun '12
by Bitbucket 28 Jun '12
28 Jun '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/1033af3c6594/
changeset: 1033af3c6594
user: jgoecks
date: 2012-06-29 00:34:44
summary: Fix bug when adding tracks due to recent refactoring.
affected #: 1 file
diff -r 447ed3a57217d5465758eeb720abad407cfe934c -r 1033af3c659443a981d7475e60171fb86a3e7e38 templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -124,7 +124,7 @@
{ icon_class: 'plus-button', title: 'Add tracks', on_click: function() {
add_datasets(add_datasets_url, add_track_async_url, function(tracks) {
_.each(tracks, function(track) {
- view.add_drawable( object_from_template(track, view) );
+ view.add_drawable( object_from_template(track, view, view) );
});
});
} },
@@ -248,7 +248,7 @@
url: "${h.url_for( action='add_track_async' )}",
data: { hda_id: "${add_dataset}" },
dataType: "json",
- success: function(track_data) { view.add_drawable( object_from_template(track_data, view) ) }
+ success: function(track_data) { view.add_drawable( object_from_template(track_data, view, view) ) }
});
%endif
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Paramamonster polish: (1) size panels appropriately; (2) initialize tool form from saved data; (3) use constant for tile size; (4) bug fixes.
by Bitbucket 28 Jun '12
by Bitbucket 28 Jun '12
28 Jun '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/447ed3a57217/
changeset: 447ed3a57217
user: jgoecks
date: 2012-06-29 00:00:30
summary: Paramamonster polish: (1) size panels appropriately; (2) initialize tool form from saved data; (3) use constant for tile size; (4) bug fixes.
affected #: 2 files
diff -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea -r 447ed3a57217d5465758eeb720abad407cfe934c static/scripts/viz/paramamonster.js
--- a/static/scripts/viz/paramamonster.js
+++ b/static/scripts/viz/paramamonster.js
@@ -112,6 +112,7 @@
this.set('tree_data', {
name: 'Root',
+ id: node_id++,
children: (params_samples.length !== 0 ? create_tree_data(params_samples, 0) : null)
});
},
@@ -149,8 +150,11 @@
// Walk subtree starting at clicked node to get full list of settings.
var get_settings = function(node, settings) {
- // Add setting for this node.
- settings[node.param.get('name')] = node.value;
+ // Add setting for this node. Root node does not have a param,
+ // however.
+ if (node.param) {
+ settings[node.param.get('name')] = node.value;
+ }
if (!node.children) {
// At leaf node: add param setting and return.
@@ -244,14 +248,16 @@
],
initialize: function(options) {
- // FIXME: find a better way to deal with needed URLs:
- var track_config = _.extend({
- data_url: galaxy_paths.get('raw_data_url'),
- converted_datasets_state_url: galaxy_paths.get('dataset_state_url')
- }, options.track);
- // HACK: remove prefs b/c they cause a redraw, which is not supported now.
- delete track_config.mode;
- this.set('track', object_from_template(track_config, {}, null));
+ if (options.track) {
+ // FIXME: find a better way to deal with needed URLs:
+ var track_config = _.extend({
+ data_url: galaxy_paths.get('raw_data_url'),
+ converted_datasets_state_url: galaxy_paths.get('dataset_state_url')
+ }, options.track);
+ // HACK: remove prefs b/c they cause a redraw, which is not supported now.
+ delete track_config.mode;
+ this.set('track', object_from_template(track_config, {}, null));
+ }
},
same_settings: function(a_track) {
@@ -358,6 +364,8 @@
var ParamaMonsterTrackView = Backbone.View.extend({
tagName: 'tr',
+ TILE_LEN: 250,
+
initialize: function(options) {
this.canvas_manager = options.canvas_manager;
this.render();
@@ -382,10 +390,19 @@
{
title: 'Settings',
icon_class: 'gear track-settings',
- on_click: function () {
+ on_click: function() {
settings_div.toggle();
},
tipsy_config: { gravity: 's' }
+ },
+ {
+ title: 'Remove',
+ icon_class: 'cross-circle',
+ on_click: function() {
+ self.$el.remove();
+ $('.tipsy').remove();
+ // TODO: remove track from viz collection.
+ }
}
]);
settings_td.prepend(icon_menu.$el);
@@ -413,12 +430,12 @@
$.when(track.data_manager.data_is_ready()).then(function(data_ok) {
// Draw tile for each region.
regions.each(function(region, index) {
- var resolution = region.length() / 300,
+ var resolution = region.length() / self.TILE_LEN,
w_scale = 1/resolution,
mode = 'Pack';
$.when(track.data_manager.get_data(region, mode, resolution, {})).then(function(tile_data) {
var canvas = self.canvas_manager.new_canvas();
- canvas.width = 300;
+ canvas.width = self.TILE_LEN;
canvas.height = track.get_canvas_height(tile_data, mode, w_scale, canvas.width);
track.draw_tile(tile_data, canvas.getContext('2d'), mode, resolution, region, w_scale);
$(tile_containers[index]).empty().append(canvas);
@@ -473,9 +490,17 @@
}));
}
+ sweep_inputs_row.insertAfter(single_input_row);
+
+ if (input.get('in_ptree')) {
+ single_input_row.hide();
+ }
+ else {
+ sweep_inputs_row.hide();
+ }
+
// Fow now, assume parameter is included in tree to start.
- sweep_inputs_row.insertAfter(single_input_row);
- single_input_row.hide();
+
// Add buttons for adding/removing parameter.
var self = this,
@@ -554,10 +579,14 @@
},
render: function() {
- var tree_params = this.model.get_tree_params();
// Start fresh.
this.$el.children().remove();
+ var tree_params = this.model.get_tree_params();
+ if (!tree_params.length) {
+ return;
+ }
+
// Set width, height based on params and samples.
this.width = 100 * (2 + tree_params.length);
this.height = 15 * this.model.get_num_leaves();
@@ -692,7 +721,8 @@
* Add track to model and view.
*/
add_track: function(pm_track) {
- var self = this;
+ var self = this,
+ param_tree = this.model.get('parameter_tree');
self.model.add_track(pm_track);
var track_view = new ParamaMonsterTrackView({
model: pm_track,
@@ -701,7 +731,7 @@
track_view.on('run_on_dataset', self.run_tool_on_dataset, self);
self.track_collection_container.append(track_view.$el);
track_view.$el.hover(function() {
- var settings_leaf = param_tree.get_leaf(settings);
+ var settings_leaf = param_tree.get_leaf(pm_track.get('settings'));
var connected_node_ids = _.pluck(param_tree.get_connected_nodes(settings_leaf), 'id');
// TODO: can do faster with enter?
@@ -736,26 +766,7 @@
settings: settings,
regions: regions
});
- self.model.add_track(pm_track);
- var track_view = new ParamaMonsterTrackView({
- model: pm_track,
- canvas_manager: self.canvas_manager
- });
- track_view.on('run_on_dataset', self.run_tool_on_dataset, self);
- self.track_collection_container.append(track_view.$el);
- track_view.$el.hover(function() {
- var settings_leaf = param_tree.get_leaf(settings);
- var connected_node_ids = _.pluck(param_tree.get_connected_nodes(settings_leaf), 'id');
-
- // TODO: can do faster with enter?
- d3.select(self.tool_param_tree_view.$el[0]).selectAll("g.node")
- .filter(function(d) {
- return _.find(connected_node_ids, function(id) { return id === d.id; }) !== undefined;
- }).style('fill', '#f00');
- },
- function() {
- d3.select(self.tool_param_tree_view.$el[0]).selectAll("g.node").style('fill', '#000');
- });
+ self.add_track(pm_track);
return pm_track;
});
@@ -763,7 +774,7 @@
_.each(tracks, function(pm_track, index) {
setTimeout(function() {
// Set inputs and run tool.
- //console.log('running with settings', pm_track.get('settings'));
+ // console.log('running with settings', pm_track.get('settings'));
tool.set_input_values(pm_track.get('settings'));
$.when(tool.rerun(dataset, regions)).then(function(output) {
// Create and add track for output dataset.
diff -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea -r 447ed3a57217d5465758eeb720abad407cfe934c templates/visualization/paramamonster.mako
--- a/templates/visualization/paramamonster.mako
+++ b/templates/visualization/paramamonster.mako
@@ -78,6 +78,16 @@
background-image: none;
border-radius: 12px;
}
+ #left {
+ width: 300px;
+ }
+ #center {
+ left: 300px;
+ right: 600px;
+ }
+ #right {
+ width: 600px;
+ }
</style></%def>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Make it simpler to save/restore visualizations and enable saving/restoring of paramamonster visualizations.
by Bitbucket 28 Jun '12
by Bitbucket 28 Jun '12
28 Jun '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/603e4ed98fa7/
changeset: 603e4ed98fa7
user: jgoecks
date: 2012-06-28 21:48:50
summary: Make it simpler to save/restore visualizations and enable saving/restoring of paramamonster visualizations.
affected #: 9 files
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -353,8 +353,6 @@
viz_types = [ "trackster", "circster" ]
- len_files = None
-
def create_visualization( self, trans, title, slug, type, dbkey, annotation=None, config={} ):
""" Create visualiation and first revision. """
visualization = self._create_visualization( trans, title, type, dbkey, slug, annotation )
@@ -434,9 +432,9 @@
end = config['viewport']['end']
overview = config['viewport']['overview']
vis_rev.config[ "viewport" ] = { 'chrom': chrom, 'start': start, 'end': end, 'overview': overview }
- elif type == 'circster':
- # TODO.
- pass
+ else:
+ # Default action is to save the config as is with no validation.
+ vis_rev.config = config
vis.latest_revision = vis_rev
session.add( vis_rev )
@@ -543,6 +541,10 @@
if 'viewport' in latest_revision.config:
config['viewport'] = latest_revision.config['viewport']
+ else:
+ # Default action is to return config unaltered.
+ latest_revision = visualization.latest_revision
+ config = latest_revision.config
return config
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py
+++ b/lib/galaxy/web/controllers/tracks.py
@@ -16,7 +16,7 @@
from galaxy.model import NoConverterException, ConverterDependencyException
from galaxy.visualization.tracks.data_providers import *
from galaxy.visualization.genomes import decode_dbkey, Genomes
-from galaxy.visualization.tracks.visual_analytics import get_tool_def, get_dataset_job
+from galaxy.visualization.tracks.visual_analytics import get_dataset_job
class NameColumn( grids.TextColumn ):
@@ -471,12 +471,42 @@
@web.expose
@web.require_login( "use Galaxy visualizations", use_panels=True )
- def paramamonster( self, trans, hda_ldda, dataset_id ):
- # Get dataset.
- dataset = self.get_hda_or_ldda( trans, hda_ldda, dataset_id )
+ def paramamonster( self, trans, id=None, hda_ldda=None, dataset_id=None, regions=None ):
+ if id:
+ # Loading a shared visualization.
+ viz = self.get_visualization( trans, id )
+ viz_config = self.get_visualization_config( trans, viz )
+ dataset = self.get_dataset( trans, viz_config[ 'dataset_id' ] )
+ else:
+ # Loading new visualization.
+ dataset = self.get_hda_or_ldda( trans, hda_ldda, dataset_id )
+ job = get_dataset_job( dataset )
+ viz_config = {
+ 'dataset_id': dataset_id,
+ 'tool_id': job.tool_id,
+ 'regions': regions
+ }
+
+ viz_config[ 'regions' ] = [
+ {
+ 'chrom': 'chr19',
+ 'start': '10000',
+ 'end': '26000'
+ },
+ {
+ 'chrom': 'chr19',
+ 'start': '150000',
+ 'end': '175000'
+ }
+
+ ]
- return trans.fill_template_mako( "visualization/paramamonster.mako", dataset=dataset,
- tool=self.app.toolbox.tools_by_id[ 'cufflinks' ].to_dict( trans, for_display=True ) )
+ # Add tool, dataset attributes to config based on id.
+ tool = trans.app.toolbox.get_tool( viz_config[ 'tool_id' ] )
+ viz_config[ 'tool' ] = tool.to_dict( trans, for_display=True )
+ viz_config[ 'dataset' ] = dataset.get_api_value()
+
+ return trans.fill_template_mako( "visualization/paramamonster.mako", config=viz_config )
@web.expose
@web.require_login( "use Galaxy visualizations", use_panels=True )
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea lib/galaxy/web/controllers/visualization.py
--- a/lib/galaxy/web/controllers/visualization.py
+++ b/lib/galaxy/web/controllers/visualization.py
@@ -5,14 +5,26 @@
from galaxy.util.sanitize_html import sanitize_html
class VisualizationListGrid( grids.Grid ):
+ def get_link( item ):
+ """
+ Returns dictionary used to create item link.
+ """
+ controller = "tracks"
+ if item.type == "trackster":
+ action = "browser"
+ elif item.type == "paramamonster":
+ action = "paramamonster"
+ elif item.type == "circster":
+ action = "circster"
+ return dict( controller=controller, action=action, id=item.id )
+
# Grid definition
title = "Saved Visualizations"
model_class = model.Visualization
default_sort_key = "-update_time"
default_filter = dict( title="All", deleted="False", tags="All", sharing="All" )
columns = [
- grids.TextColumn( "Title", key="title", attach_popup=True,
- link=( lambda item: dict( controller="tracks", action="browser", id=item.id ) ) ),
+ grids.TextColumn( "Title", key="title", attach_popup=True, link=get_link ),
grids.TextColumn( "Type", key="type" ),
grids.TextColumn( "Dbkey", key="dbkey" ),
grids.IndividualTagsColumn( "Tags", key="tags", model_tag_association_class=model.VisualizationTagAssociation, filterable="advanced", grid_name="VisualizationListGrid" ),
@@ -383,12 +395,20 @@
template="visualization/create.mako" )
@web.json
- def save( self, trans, config, type, id=None, title=None, dbkey=None, annotation=None ):
+ def save( self, trans, vis_json=None, type=None, id=None, title=None, dbkey=None, annotation=None ):
"""
Save a visualization; if visualization does not have an ID, a new
visualization is created. Returns JSON of visualization.
"""
- return self.save_visualization( trans, from_json_string( config ), type, id, title, dbkey, annotation )
+
+ # Get visualization attributes from kwargs or from config.
+ vis_config = from_json_string( vis_json )
+ vis_type = type or vis_config[ 'type' ]
+ vis_id = id or vis_config.get( 'id', None )
+ vis_title = title or vis_config.get( 'title', None )
+ vis_dbkey = dbkey or vis_config.get( 'dbkey', None )
+ vis_annotation = annotation or vis_config.get( 'annotation', None )
+ return self.save_visualization( trans, vis_config, vis_type, vis_id, vis_title, vis_dbkey, vis_annotation )
@web.expose
@web.require_login( "edit visualizations" )
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea static/scripts/mvc/data.js
--- a/static/scripts/mvc/data.js
+++ b/static/scripts/mvc/data.js
@@ -2,7 +2,7 @@
* A dataset. In Galaxy, datasets are associated with a history, so
* this object is also known as a HistoryDatasetAssociation.
*/
-var Dataset = Backbone.Model.extend({
+var Dataset = Backbone.RelationalModel.extend({
defaults: {
id: "",
type: "",
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea static/scripts/mvc/tools.js
--- a/static/scripts/mvc/tools.js
+++ b/static/scripts/mvc/tools.js
@@ -46,7 +46,8 @@
key: 'inputs',
relatedModel: 'ToolInput',
reverseRelation: {
- key: 'tool'
+ key: 'tool',
+ includeInJSON: false
}
}
],
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea static/scripts/viz/paramamonster.js
--- a/static/scripts/viz/paramamonster.js
+++ b/static/scripts/viz/paramamonster.js
@@ -6,7 +6,7 @@
/**
* Tree for a tool's parameters.
*/
-var ToolParameterTree = Backbone.Model.extend({
+var ToolParameterTree = Backbone.RelationalModel.extend({
defaults: {
tool: null,
tree_data: null
@@ -18,9 +18,6 @@
this.get('tool').get('inputs').each(function(input) {
if (!input.get_samples()) { return; }
- // All inputs are in tree to start.
- self.add_param(input);
-
// Listen for changes to input's attributes.
input.on('change:min change:max change:num_samples', function(input) {
if (input.get('in_ptree')) {
@@ -38,7 +35,16 @@
}, self);
});
- self.set_tree_data();
+ // If there is a config, use it.
+ if (options.config) {
+ _.each(options.config, function(input_config) {
+ var input = self.get('tool').get('inputs').find(function(input) {
+ return input.get('name') === input_config.name;
+ });
+ self.add_param(input);
+ input.set(input_config);
+ });
+ }
},
add_param: function(param) {
@@ -203,16 +209,51 @@
cur_node = find_child(cur_node.children);
}
return cur_node;
+ },
+
+ /**
+ * Returns a list of parameters used in tree.
+ */
+ toJSON: function() {
+ // FIXME: returning and jsonifying complete param causes trouble on the server side,
+ // so just use essential attributes for now.
+ return this.get_tree_params().map(function(param) {
+ return {
+ name: param.get('name'),
+ min: param.get('min'),
+ max: param.get('max'),
+ num_samples: param.get('num_samples')
+ };
+ });
}
});
-var ParamaMonsterTrack = Backbone.Model.extend({
+var ParamaMonsterTrack = Backbone.RelationalModel.extend({
defaults: {
track: null,
settings: null,
regions: null
},
+ relations: [
+ {
+ type: Backbone.HasMany,
+ key: 'regions',
+ relatedModel: 'GenomeRegion'
+ }
+ ],
+
+ initialize: function(options) {
+ // FIXME: find a better way to deal with needed URLs:
+ var track_config = _.extend({
+ data_url: galaxy_paths.get('raw_data_url'),
+ converted_datasets_state_url: galaxy_paths.get('dataset_state_url')
+ }, options.track);
+ // HACK: remove prefs b/c they cause a redraw, which is not supported now.
+ delete track_config.mode;
+ this.set('track', object_from_template(track_config, {}, null));
+ },
+
same_settings: function(a_track) {
var this_settings = this.get('settings'),
other_settings = a_track.get('settings');
@@ -223,6 +264,14 @@
}
}
return true;
+ },
+
+ toJSON: function() {
+ return {
+ track: this.get('track').to_dict(),
+ settings: this.get('settings'),
+ regions: this.get('regions')
+ };
}
});
@@ -235,18 +284,45 @@
*/
var ParamaMonsterVisualization = Visualization.extend({
defaults: _.extend({}, Visualization.prototype.defaults, {
+ dataset: null,
tool: null,
parameter_tree: null,
regions: null,
tracks: null
}),
+
+ relations: [
+ {
+ type: Backbone.HasOne,
+ key: 'dataset',
+ relatedModel: 'Dataset'
+ },
+ {
+ type: Backbone.HasOne,
+ key: 'tool',
+ relatedModel: 'Tool'
+ },
+ {
+ type: Backbone.HasMany,
+ key: 'regions',
+ relatedModel: 'GenomeRegion'
+ },
+ {
+ type: Backbone.HasMany,
+ key: 'tracks',
+ relatedModel: 'ParamaMonsterTrack'
+ }
+ // NOTE: cannot use relationship for parameter tree because creating tree is complex.
+ ],
initialize: function(options) {
var tool_with_samplable_inputs = this.get('tool').copy(true);
this.set('tool_with_samplable_inputs', tool_with_samplable_inputs);
- this.set('parameter_tree', new ToolParameterTree({ tool: tool_with_samplable_inputs }));
- this.set('tracks', new TrackCollection());
+ this.set('parameter_tree', new ToolParameterTree({
+ tool: tool_with_samplable_inputs,
+ config: options.tree_config
+ }));
},
add_placeholder: function(settings) {
@@ -255,6 +331,20 @@
add_track: function(track) {
this.get('tracks').add(track);
+ },
+
+ toJSON: function() {
+ // TODO: could this be easier by using relational models?
+ return {
+ id: this.get('id'),
+ title: 'Parameter exploration for dataset \'' + this.get('dataset').get('name') + '\'',
+ type: 'paramamonster',
+ dataset_id: this.get('dataset').id,
+ tool_id: this.get('tool').id,
+ regions: this.get('regions').toJSON(),
+ tree_config: this.get('parameter_tree').toJSON(),
+ tracks: this.get('tracks').toJSON()
+ };
}
});
@@ -301,7 +391,7 @@
settings_td.prepend(icon_menu.$el);
// Render tile placeholders.
- _.each(this.model.get('regions'), function() {
+ this.model.get('regions').each(function() {
self.$el.append($('<td/>').addClass('tile').html(
$('<img/>').attr('src', galaxy_paths.get('image_path') + '/loading_large_white_bg.gif')
));
@@ -322,7 +412,7 @@
// When data is ready, draw tiles.
$.when(track.data_manager.data_is_ready()).then(function(data_ok) {
// Draw tile for each region.
- _.each(regions, function(region, index) {
+ regions.each(function(region, index) {
var resolution = region.length() / 300,
w_scale = 1/resolution,
mode = 'Pack';
@@ -550,6 +640,12 @@
// Handle node clicks for tree data.
this.model.get('parameter_tree').on('change:tree_data', this.handle_node_clicks, this);
+
+ // Each track must have a view so it has a canvas manager.
+ var self = this;
+ this.model.get('tracks').each(function(track) {
+ track.get('track').view = self;
+ });
},
render: function() {
@@ -565,13 +661,17 @@
regions = self.model.get('regions'),
tr = $('<tr/>').appendTo(this.track_collection_container);
- _.each(regions, function(region) {
+ regions.each(function(region) {
tr.append( $('<th>').text(region.toString()) );
});
tr.children().first().attr('colspan', 2);
$('#right').append(this.track_collection_container);
+ self.model.get('tracks').each(function(track) {
+ self.add_track(track);
+ });
+
// Render tool parameter tree in center panel.
this.tool_param_tree_view.render();
$('#center').append(this.tool_param_tree_view.$el);
@@ -588,6 +688,34 @@
});
},
+ /**
+ * Add track to model and view.
+ */
+ add_track: function(pm_track) {
+ var self = this;
+ self.model.add_track(pm_track);
+ var track_view = new ParamaMonsterTrackView({
+ model: pm_track,
+ canvas_manager: self.canvas_manager
+ });
+ track_view.on('run_on_dataset', self.run_tool_on_dataset, self);
+ self.track_collection_container.append(track_view.$el);
+ track_view.$el.hover(function() {
+ var settings_leaf = param_tree.get_leaf(settings);
+ var connected_node_ids = _.pluck(param_tree.get_connected_nodes(settings_leaf), 'id');
+
+ // TODO: can do faster with enter?
+ d3.select(self.tool_param_tree_view.$el[0]).selectAll("g.node")
+ .filter(function(d) {
+ return _.find(connected_node_ids, function(id) { return id === d.id; }) !== undefined;
+ }).style('fill', '#f00');
+ },
+ function() {
+ d3.select(self.tool_param_tree_view.$el[0]).selectAll("g.node").style('fill', '#000');
+ });
+ return pm_track;
+ },
+
handle_node_clicks: function() {
// When node clicked in tree, run tool and add tracks to model.
var self = this,
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -69,7 +69,7 @@
this.load_pattern( 'left_strand', "/visualization/strand_left.png" );
this.load_pattern( 'right_strand_inv', "/visualization/strand_right_inv.png" );
this.load_pattern( 'left_strand_inv', "/visualization/strand_left_inv.png" );
-}
+};
_.extend( CanvasManager.prototype, {
load_pattern: function( key, path ) {
@@ -79,7 +79,7 @@
image.src = galaxy_paths.attributes.image_path + path;
image.onload = function() {
patterns[key] = dummy_context.createPattern( image, "repeat" );
- }
+ };
},
get_pattern: function( key ) {
return this.patterns[key];
@@ -215,8 +215,8 @@
// ReferenceDataManager does not have dataset.
if (dataset) {
- params['dataset_id'] = dataset.id;
- params['hda_ldda'] = dataset.get('hda_ldda');
+ params.dataset_id = dataset.id;
+ params.hda_ldda = dataset.get('hda_ldda');
}
$.extend(params, extra_params);
@@ -265,17 +265,16 @@
// TODO: this logic could be improved if the visualization knew whether
// the data was "index" or "data."
//
- var
- key_ary = this.get('key_ary'),
+ var key_ary = this.get('key_ary'),
obj_cache = this.get('obj_cache'),
- key, region, entry_region, mode, entry;
+ key, entry_region;
for (var i = 0; i < key_ary.length; i++) {
entry_region = new GenomeRegion(key_ary[i]);
if (entry_region.contains(region)) {
// This entry has data in the requested range. Return if data
// is compatible and can be subsetted.
- var entry = obj_cache[key];
+ entry = obj_cache[key];
if ( is_deferred(entry) ||
( this.get('data_mode_compatible')(entry, mode) && this.get('can_subset')(entry) ) ) {
this.move_key_to_end(key, i);
@@ -298,8 +297,6 @@
this.set_elt(region, entry);
},
- /**
-
/** "Deep" data request; used as a parameter for DataManager.get_more_data() */
DEEP_DATA_REQ: "deep",
@@ -341,7 +338,7 @@
//
var
data_manager = this,
- new_data_request = this.load_data(query_region, mode, resolution, extra_params)
+ new_data_request = this.load_data(query_region, mode, resolution, extra_params),
new_data_available = $.Deferred();
// load_data sets cache to new_data_request, but use custom deferred object so that signal and data
// is all data, not just new data.
@@ -408,7 +405,7 @@
/**
* A genomic region.
*/
-var GenomeRegion = Backbone.Model.extend({
+var GenomeRegion = Backbone.RelationalModel.extend({
defaults: {
chrom: null,
start: 0,
@@ -431,9 +428,9 @@
!this.get('end') && 'as_str' in options) {
var pieces = options.as_str.split(':'),
chrom = pieces[0],
- pieces = pieces.split('-'),
- start = pieces[0],
- end = pieces[1];
+ start_end = pieces.split('-'),
+ start = start_end[0],
+ end = start_end[1];
this.set('chrom', chrom);
this.set('start', start);
this.set('end', end);
@@ -462,7 +459,7 @@
chrom: this.get('chrom'),
start: this.get('start'),
end: this.get('end')
- }
+ };
},
/**
@@ -556,7 +553,7 @@
datasets: []
},
- url: function() { return galaxy_paths.get("visualization_url"); },
+ url: galaxy_paths.get("visualization_url"),
/**
* POSTs visualization's JSON to its URL using the parameter 'vis_json'
@@ -565,7 +562,7 @@
*/
save: function() {
return $.ajax({
- url: this.url(),
+ url: this.url,
type: "POST",
dataType: "json",
data: {
@@ -818,7 +815,7 @@
requests[requests.length] = $.ajax({
url: add_track_async_url,
data: data,
- dataType: "json",
+ dataType: "json"
});
});
// To preserve order, wait until there are definitions for all tracks and then add
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea templates/base_panels.mako
--- a/templates/base_panels.mako
+++ b/templates/base_panels.mako
@@ -57,7 +57,8 @@
data_url: '${h.url_for( controller="tracks", action="data" )}',
raw_data_url: '${h.url_for( controller="tracks", action="raw_data" )}',
converted_datasets_state_url: '${h.url_for( controller="tracks", action="converted_datasets_state" )}',
- dataset_state_url: '${h.url_for( controller="tracks", action="dataset_state" )}'
+ dataset_state_url: '${h.url_for( controller="tracks", action="dataset_state" )}',
+ visualization_url: '${h.url_for( controller="visualization", action="save" )}'
});
</script></%def>
diff -r 063a1d690724b3485f41c620f664f11c7390ceef -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea templates/visualization/paramamonster.mako
--- a/templates/visualization/paramamonster.mako
+++ b/templates/visualization/paramamonster.mako
@@ -90,34 +90,43 @@
<script type="text/javascript">
var viz;
$(function() {
- // -- Viz set up. --
-
- var tool = new Tool(JSON.parse('${ h.to_json_string( tool ) }')),
- regions = [
- new GenomeRegion({
- chrom: 'chr19',
- start: '10000',
- end: '26000'
- }),
- new GenomeRegion({
- chrom: 'chr19',
- start: '150000',
- end: '175000'
- })
- ],
- // HACK: need to replace \ with \\ due to simplejson bug.
- dataset = new Dataset(JSON.parse('${ h.to_json_string( dataset.get_api_value() ).replace('\\', '\\\\' ) }'));
-
-
- viz = new ParamaMonsterVisualization({
- tool: tool,
- dataset: dataset,
- regions: regions
- });
+ // -- Viz set up. --
+ var viz = new ParamaMonsterVisualization(
+ ${ h.to_json_string( config ).replace('\\', '\\\\' )}
+ );
var viz_view = new ParamaMonsterVisualizationView({ model: viz });
viz_view.render();
$('.unified-panel-body').append(viz_view.$el);
+
+ // -- Menu set up. --
+ var menu = create_icon_buttons_menu([
+ { icon_class: 'disk--arrow', title: 'Save', on_click: function() {
+ // Show saving dialog box
+ show_modal("Saving...", "progress");
+
+ viz.save().success(function(vis_info) {
+ hide_modal();
+ viz.set({
+ 'id': vis_info.vis_id,
+ 'has_changes': false
+ });
+ })
+ .error(function() {
+ show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
+ { "Close" : hide_modal } );
+ });
+ } },
+ { icon_class: 'cross-circle', title: 'Close', on_click: function() {
+ window.location = "${h.url_for( controller='visualization', action='list' )}";
+ } }
+ ],
+ {
+ tipsy_config: {gravity: 'n'}
+ });
+
+ menu.$el.attr("style", "float: right");
+ $("#right .unified-panel-header-inner").append(menu.$el);
});
</script></%def>
@@ -129,4 +138,8 @@
</%def><%def name="right_panel()">
+ <div class="unified-panel-header" unselectable="on">
+ <div class="unified-panel-header-inner">
+ </div>
+ </div></%def>
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0