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
September 2013
- 1 participants
- 149 discussions
commit/galaxy-central: Dave Bouvier: Fix for tool shed repository metadata API value mappers when time_last_tested is null for a metadata record.
by commits-noreply@bitbucket.org 11 Sep '13
by commits-noreply@bitbucket.org 11 Sep '13
11 Sep '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e1c5eeed1bd6/
Changeset: e1c5eeed1bd6
User: Dave Bouvier
Date: 2013-09-11 22:36:52
Summary: Fix for tool shed repository metadata API value mappers when time_last_tested is null for a metadata record.
Affected #: 2 files
diff -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de -r e1c5eeed1bd6ba5c66dce308e69e44e6edea920f lib/galaxy/webapps/tool_shed/api/repositories.py
--- a/lib/galaxy/webapps/tool_shed/api/repositories.py
+++ b/lib/galaxy/webapps/tool_shed/api/repositories.py
@@ -96,9 +96,6 @@
]
}
"""
- metadata_value_mapper = { 'id' : trans.security.encode_id,
- 'repository_id' : trans.security.encode_id,
- 'time_last_tested' : time_ago }
repository_value_mapper = { 'id' : trans.security.encode_id,
'user_id' : trans.security.encode_id }
# Example URL: http://localhost:9009/api/repositories/get_repository_revision_install_info…
@@ -123,7 +120,7 @@
if repository_metadata:
encoded_repository_metadata_id = trans.security.encode_id( repository_metadata.id )
repository_metadata_dict = repository_metadata.to_dict( view='collection',
- value_mapper=metadata_value_mapper )
+ value_mapper=self.__get_value_mapper( trans, repository_metadata ) )
repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
action='show',
id=encoded_repository_metadata_id )
@@ -194,3 +191,10 @@
log.error( message, exc_info=True )
trans.response.status = 500
return message
+
+ def __get_value_mapper( self, trans, repository_metadata ):
+ value_mapper = { 'id' : trans.security.encode_id,
+ 'repository_id' : trans.security.encode_id }
+ if repository_metadata.time_last_tested is not None:
+ value_mapper[ 'time_last_tested' ] = time_ago
+ return value_mapper
diff -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de -r e1c5eeed1bd6ba5c66dce308e69e44e6edea920f lib/galaxy/webapps/tool_shed/api/repository_revisions.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
@@ -72,9 +72,6 @@
GET /api/repository_revisions
Displays a collection (list) of repository revisions.
"""
- value_mapper = { 'id' : trans.security.encode_id,
- 'repository_id' : trans.security.encode_id,
- 'time_last_tested' : time_ago }
# Example URL: http://localhost:9009/api/repository_revisions
repository_metadata_dicts = []
# Build up an anded clause list of filters.
@@ -124,7 +121,7 @@
.all()
for repository_metadata in query:
repository_metadata_dict = repository_metadata.to_dict( view='collection',
- value_mapper=value_mapper )
+ value_mapper=self.__get_value_mapper( trans, repository_metadata ) )
repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
action='show',
id=trans.security.encode_id( repository_metadata.id ) )
@@ -144,13 +141,10 @@
:param id: the encoded id of the `RepositoryMetadata` object
"""
- value_mapper = { 'id' : trans.security.encode_id,
- 'repository_id' : trans.security.encode_id,
- 'time_last_tested' : time_ago }
# Example URL: http://localhost:9009/api/repository_revisions/bb125606ff9ea620
try:
repository_metadata = metadata_util.get_repository_metadata_by_id( trans, id )
- repository_metadata_dict = repository_metadata.to_dict( value_mapper=value_mapper )
+ repository_metadata_dict = repository_metadata.to_dict( value_mapper=self.__get_value_mapper( trans, repository_metadata ) )
repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
action='show',
id=trans.security.encode_id( repository_metadata.id ) )
@@ -167,7 +161,6 @@
PUT /api/repository_revisions/{encoded_repository_metadata_id}/{payload}
Updates the value of specified columns of the repository_metadata table based on the key / value pairs in payload.
"""
- value_mapper = dict( id=trans.security.encode_id, repository_id=trans.security.encode_id, time_last_tested=time_ago )
repository_metadata_id = kwd.get( 'id', None )
try:
repository_metadata = metadata_util.get_repository_metadata_by_id( trans, repository_metadata_id )
@@ -188,8 +181,15 @@
log.error( message, exc_info=True )
trans.response.status = 500
return message
- repository_metadata_dict = repository_metadata.to_dict( value_mapper=value_mapper )
+ repository_metadata_dict = repository_metadata.to_dict( value_mapper=self.__get_value_mapper( trans, repository_metadata ) )
repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
action='show',
id=trans.security.encode_id( repository_metadata.id ) )
return repository_metadata_dict
+
+ def __get_value_mapper( self, trans, repository_metadata ):
+ value_mapper = { 'id' : trans.security.encode_id,
+ 'repository_id' : trans.security.encode_id }
+ if repository_metadata.time_last_tested is not None:
+ value_mapper[ 'time_last_tested' ] = time_ago
+ return value_mapper
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: carlfeberhard: Style: fix tooltips in history panel; pack scripts
by commits-noreply@bitbucket.org 11 Sep '13
by commits-noreply@bitbucket.org 11 Sep '13
11 Sep '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/18745fd87025/
Changeset: 18745fd87025
User: carlfeberhard
Date: 2013-09-11 22:36:01
Summary: Style: fix tooltips in history panel; pack scripts
Affected #: 15 files
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/mvc/dataset/hda-base.js
--- a/static/scripts/mvc/dataset/hda-base.js
+++ b/static/scripts/mvc/dataset/hda-base.js
@@ -174,7 +174,7 @@
// set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)
//TODO: we can potentially skip this step and call popupmenu directly on the download button
make_popup_menus( $container );
- $container.find( '.tooltip' ).tooltip({ placement : 'bottom' });
+ $container.find( '[title]' ).tooltip({ placement : 'bottom' });
},
// ................................................................................ RENDER titlebar
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/mvc/history/history-panel.js
--- a/static/scripts/mvc/history/history-panel.js
+++ b/static/scripts/mvc/history/history-panel.js
@@ -271,7 +271,7 @@
// render the main template, tooltips
//NOTE: this is done before the items, since item views should handle theirs themselves
newRender.append( HistoryPanel.templates.historyPanel( modelJson ) );
- newRender.find( '.tooltip' ).tooltip({ placement: 'bottom' });
+ newRender.find( '[title]' ).tooltip({ placement: 'bottom' });
// render hda views (if any and any shown (show_deleted/hidden)
//TODO: this seems too elaborate
@@ -485,7 +485,7 @@
success: function(tag_elt_html) {
//view.log( view + ' tag elt html (ajax)', tag_elt_html );
tagElt.html(tag_elt_html);
- tagElt.find(".tooltip").tooltip();
+ tagElt.find("[title]").tooltip();
tagArea.slideDown("fast");
}
});
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/packed/galaxy.modal.js
--- a/static/scripts/packed/galaxy.modal.js
+++ b/static/scripts/packed/galaxy.modal.js
@@ -1,1 +1,1 @@
-define(["utils/galaxy.css","libs/backbone/backbone-relational"],function(a){var b=Backbone.View.extend({el_main:"#everything",options:{title:"galaxy-modal",body:"No content available."},initialize:function(d){a.load_file("static/style/galaxy.modal.css");if(!d){d=this.options}else{d=_.defaults(d,this.options)}this.setElement(this.template(d.title,d.body));$(this.el_main).append($(this.el));var e=(this.$el).find(".footer");var c=this;if(d.buttons){$.each(d.buttons,function(f,g){e.append($("<button></button>").text(f).click(g)).append(" ")})}else{e.append($("<button></button>").text("Close").click(function(){c.hide()})).append(" ")}$(this.el).hide()},events:{"mousedown .dialog":"event_default","mousedown .background":"hide"},event_default:function(c){c.preventDefault()},show:function(){this.$el.fadeIn("fast")},hide:function(){this.$el.fadeOut("fast")},destroy:function(){this.$el.remove()},template:function(d,c){return'<div class="galaxy-modal"><div class="background"></div><div class="dialog galaxy-corner"><div class="header"><span><h3 class="title">'+d+'</h3></span></div><div class="body">'+c+'</div><div class="footer"></div></div></div>'}});return{GalaxyModal:b}});
\ No newline at end of file
+define(["utils/galaxy.css","libs/backbone/backbone-relational"],function(a){var b=Backbone.View.extend({el_main:"#everything",options:{title:"galaxy-modal",body:"No content available."},initialize:function(d){if(!d){d=this.options}else{d=_.defaults(d,this.options)}this.setElement(this.template(d.title,d.body));$(this.el_main).append($(this.el));var e=(this.$el).find(".footer");var c=this;if(d.buttons){$.each(d.buttons,function(f,g){e.append($("<button></button>").text(f).click(g)).append(" ")})}else{e.append($("<button></button>").text("Close").click(function(){c.hide()})).append(" ")}$(this.el).hide()},events:{"mousedown .dialog":"event_default","mousedown .background":"hide"},event_default:function(c){c.preventDefault()},show:function(){this.$el.fadeIn("fast")},hide:function(){this.$el.fadeOut("fast")},destroy:function(){this.$el.remove()},template:function(d,c){return'<div class="modal"><div class="modal-backdrop"></div><div class="modal-dialog galaxy-corner"><div class="modal-content"><div class="header"><span><h3 class="title">'+d+'</h3></span></div><div class="body">'+c+'</div><div class="footer"></div></div</div></div>'}});return{GalaxyModal:b}});
\ No newline at end of file
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/packed/mvc/dataset/hda-base.js
--- a/static/scripts/packed/mvc/dataset/hda-base.js
+++ b/static/scripts/packed/mvc/dataset/hda-base.js
@@ -1,1 +1,1 @@
-var HDABaseView=Backbone.View.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",initialize:function(a){if(a.logger){this.logger=this.model.logger=a.logger}this.log(this+".initialize:",a);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];if(!a.urlTemplates){throw ("HDAView needs urlTemplates on initialize")}this.urlTemplates=a.urlTemplates;this.expanded=a.expanded||false;this.model.bind("change",function(d,c){var b=_.omit(this.model.changedAttributes(),"display_apps","display_types");if(_.keys(b).length){this.render()}else{if(this.expanded){this._render_displayApps()}}},this)},render:function(){var b=this,e=this.model.get("id"),c=this.model.get("state"),a=$("<div/>").attr("id","historyItem-"+e),d=(this.$el.children().size()===0);this.$el.attr("id","historyItemContainer-"+e);this.urls=this._renderUrls(this.urlTemplates,this.model.toJSON());a.addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+c);a.append(this._render_warnings());a.append(this._render_titleBar());this._setUpBehaviors(a);this.body=$(this._render_body());a.append(this.body);this.$el.fadeOut("fast",function(){b.$el.children().remove();b.$el.append(a).fadeIn("fast",function(){b.log(b+" rendered:",b.$el);var f="rendered";if(d){f+=":initial"}else{if(b.model.inReadyState()){f+=":ready"}}b.trigger(f)})});return this},_renderUrls:function(d,a){var b=this,c={};_.each(d,function(e,f){if(_.isObject(e)){c[f]=b._renderUrls(e,a)}else{if(f==="meta_download"){c[f]=b._renderMetaDownloadUrls(e,a)}else{try{c[f]=_.template(e,a)}catch(g){throw (b+"._renderUrls error: "+g+"\n rendering:"+e+"\n with "+JSON.stringify(a))}}}});return c},_renderMetaDownloadUrls:function(b,a){return _.map(a.meta_files,function(c){return{url:_.template(b,{id:a.id,file_type:c.file_type}),file_type:c.file_type}})},_setUpBehaviors:function(a){a=a||this.$el;make_popup_menus(a);a.find(".tooltip").tooltip({placement:"bottom"})},_render_warnings:function(){return $(jQuery.trim(HDABaseView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>');a.append(this._render_displayButton());return a},_render_displayButton:function(){if((this.model.get("state")===HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===HistoryDatasetAssociation.STATES.NEW)||(!this.model.get("accessible"))){this.displayButton=null;return null}var b={icon_class:"display",target:"galaxy_main"};if(this.model.get("purged")){b.enabled=false;b.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===HistoryDatasetAssociation.STATES.UPLOAD){b.enabled=false;b.title=_l("This dataset must finish uploading before it can be viewed")}else{b.title=_l("View data");b.href=this.urls.display;var a=this;b.on_click=function(){Galaxy.frame_manager.frame_new({title:"Data Viewer",type:"url",location:"center",content:a.urls.display})}}}this.displayButton=new IconButtonView({model:new IconButton(b)});return this.displayButton.render().$el},_render_titleLink:function(){return $(jQuery.trim(HDABaseView.templates.titleLink(_.extend(this.model.toJSON(),{urls:this.urls}))))},_render_hdaSummary:function(){var a=_.extend(this.model.toJSON(),{urls:this.urls});return HDABaseView.templates.hdaSummary(a)},_render_primaryActionButtons:function(c){var a=this,b=$("<div/>").attr("id","primary-actions-"+this.model.get("id"));_.each(c,function(d){b.append(d.call(a))});return b},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var a=HDABaseView.templates.downloadLinks(_.extend(this.model.toJSON(),{urls:this.urls}));return $(a.trim())},_render_showParamsButton:function(){this.showParamsButton=new IconButtonView({model:new IconButton({title:_l("View details"),href:this.urls.show_params,target:"galaxy_main",icon_class:"information"})});return this.showParamsButton.render().$el},_render_displayAppArea:function(){return $("<div/>").addClass("display-apps")},_render_displayApps:function(c){c=c||this.$el;var d=c.find("div.display-apps"),a=this.model.get("display_types"),b=this.model.get("display_apps");if((!this.model.hasData())||(!c||!c.length)||(!d.length)){return}d.html(null);if(!_.isEmpty(a)){d.append(HDABaseView.templates.displayApps({displayApps:a}))}if(!_.isEmpty(b)){d.append(HDABaseView.templates.displayApps({displayApps:b}))}},_render_peek:function(){var a=this.model.get("peek");if(!a){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(a))},_render_body:function(){var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: none");if(this.expanded){this._render_body_html(a);a.css("display","block")}return a},_render_body_html:function(a){a.html("");switch(this.model.get("state")){case HistoryDatasetAssociation.STATES.NEW:this._render_body_new(a);break;case HistoryDatasetAssociation.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryDatasetAssociation.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryDatasetAssociation.STATES.PAUSED:this._render_body_paused(a);break;case HistoryDatasetAssociation.STATES.QUEUED:this._render_body_queued(a);break;case HistoryDatasetAssociation.STATES.RUNNING:this._render_body_running(a);break;case HistoryDatasetAssociation.STATES.ERROR:this._render_body_error(a);break;case HistoryDatasetAssociation.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryDatasetAssociation.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryDatasetAssociation.STATES.EMPTY:this._render_body_empty(a);break;case HistoryDatasetAssociation.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryDatasetAssociation.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+this.model.get("state")+'".</div>'))}a.append('<div style="clear: both"></div>');this._setUpBehaviors(a)},_render_body_new:function(b){var a=_l("This is a new dataset and not all of its data are available yet");b.append($("<div>"+_l(a)+"</div>"))},_render_body_not_viewable:function(a){a.append($("<div>"+_l("You do not have permission to view dataset")+"</div>"))},_render_body_uploading:function(a){a.append($("<div>"+_l("Dataset is uploading")+"</div>"))},_render_body_queued:function(a){a.append($("<div>"+_l("Job is waiting to run")+"</div>"));a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_paused:function(a){a.append($("<div>"+_l("Job is paused. Use the history menu to resume")+"</div>"));a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_running:function(a){a.append("<div>"+_l("Job is currently running")+"</div>");a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append((_l("An error occurred with this dataset")+": <i>"+$.trim(this.model.get("misc_info"))+"</i>"));a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers.concat([this._render_downloadButton])))},_render_body_discarded:function(a){a.append("<div>"+_l("The job creating this dataset was cancelled before completion")+".</div>");a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_setting_metadata:function(a){a.append($("<div>"+_l("Metadata is being auto-detected")+".</div>"))},_render_body_empty:function(a){a.append($("<div>"+_l("No data")+": <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_failed_metadata:function(a){a.append($(HDABaseView.templates.failedMetadata(_.extend(this.model.toJSON(),{urls:this.urls}))));this._render_body_ok(a)},_render_body_ok:function(a){a.append(this._render_hdaSummary());if(this.model.isDeletedOrPurged()){a.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton]));return}a.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton]));a.append('<div class="clear"/>');a.append(this._render_displayAppArea());this._render_displayApps(a);a.append(this._render_peek())},events:{"click .historyItemTitle":"toggleBodyVisibility"},toggleBodyVisibility:function(c,a){var b=this;this.expanded=(a===undefined)?(!this.body.is(":visible")):(a);if(this.expanded){b._render_body_html(b.body);this.body.slideDown("fast",function(){b.trigger("body-expanded",b.model.get("id"))})}else{this.body.slideUp("fast",function(){b.trigger("body-collapsed",b.model.get("id"))})}},remove:function(b){var a=this;this.$el.fadeOut("fast",function(){a.$el.remove();a.off();if(b){b()}})},toString:function(){var a=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+a+")"}});HDABaseView.templates={warningMsg:Handlebars.templates["template-warningmessagesmall"],messages:Handlebars.templates["template-hda-warning-messages"],titleLink:Handlebars.templates["template-hda-titleLink"],hdaSummary:Handlebars.templates["template-hda-hdaSummary"],downloadLinks:Handlebars.templates["template-hda-downloadLinks"],failedMetadata:Handlebars.templates["template-hda-failedMetadata"],displayApps:Handlebars.templates["template-hda-displayApps"]};
\ No newline at end of file
+var HDABaseView=Backbone.View.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",initialize:function(a){if(a.logger){this.logger=this.model.logger=a.logger}this.log(this+".initialize:",a);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];if(!a.urlTemplates){throw ("HDAView needs urlTemplates on initialize")}this.urlTemplates=a.urlTemplates;this.expanded=a.expanded||false;this.model.bind("change",function(d,c){var b=_.omit(this.model.changedAttributes(),"display_apps","display_types");if(_.keys(b).length){this.render()}else{if(this.expanded){this._render_displayApps()}}},this)},render:function(){var b=this,e=this.model.get("id"),c=this.model.get("state"),a=$("<div/>").attr("id","historyItem-"+e),d=(this.$el.children().size()===0);this.$el.attr("id","historyItemContainer-"+e);this.urls=this._renderUrls(this.urlTemplates,this.model.toJSON());a.addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+c);a.append(this._render_warnings());a.append(this._render_titleBar());this._setUpBehaviors(a);this.body=$(this._render_body());a.append(this.body);this.$el.fadeOut("fast",function(){b.$el.children().remove();b.$el.append(a).fadeIn("fast",function(){b.log(b+" rendered:",b.$el);var f="rendered";if(d){f+=":initial"}else{if(b.model.inReadyState()){f+=":ready"}}b.trigger(f)})});return this},_renderUrls:function(d,a){var b=this,c={};_.each(d,function(e,f){if(_.isObject(e)){c[f]=b._renderUrls(e,a)}else{if(f==="meta_download"){c[f]=b._renderMetaDownloadUrls(e,a)}else{try{c[f]=_.template(e,a)}catch(g){throw (b+"._renderUrls error: "+g+"\n rendering:"+e+"\n with "+JSON.stringify(a))}}}});return c},_renderMetaDownloadUrls:function(b,a){return _.map(a.meta_files,function(c){return{url:_.template(b,{id:a.id,file_type:c.file_type}),file_type:c.file_type}})},_setUpBehaviors:function(a){a=a||this.$el;make_popup_menus(a);a.find("[title]").tooltip({placement:"bottom"})},_render_warnings:function(){return $(jQuery.trim(HDABaseView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>');a.append(this._render_displayButton());return a},_render_displayButton:function(){if((this.model.get("state")===HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===HistoryDatasetAssociation.STATES.NEW)||(!this.model.get("accessible"))){this.displayButton=null;return null}var b={icon_class:"display",target:"galaxy_main"};if(this.model.get("purged")){b.enabled=false;b.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===HistoryDatasetAssociation.STATES.UPLOAD){b.enabled=false;b.title=_l("This dataset must finish uploading before it can be viewed")}else{b.title=_l("View data");b.href=this.urls.display;var a=this;b.on_click=function(){Galaxy.frame_manager.frame_new({title:"Data Viewer",type:"url",location:"center",content:a.urls.display})}}}this.displayButton=new IconButtonView({model:new IconButton(b)});return this.displayButton.render().$el},_render_titleLink:function(){return $(jQuery.trim(HDABaseView.templates.titleLink(_.extend(this.model.toJSON(),{urls:this.urls}))))},_render_hdaSummary:function(){var a=_.extend(this.model.toJSON(),{urls:this.urls});return HDABaseView.templates.hdaSummary(a)},_render_primaryActionButtons:function(c){var a=this,b=$("<div/>").attr("id","primary-actions-"+this.model.get("id"));_.each(c,function(d){b.append(d.call(a))});return b},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var a=HDABaseView.templates.downloadLinks(_.extend(this.model.toJSON(),{urls:this.urls}));return $(a.trim())},_render_showParamsButton:function(){this.showParamsButton=new IconButtonView({model:new IconButton({title:_l("View details"),href:this.urls.show_params,target:"galaxy_main",icon_class:"information"})});return this.showParamsButton.render().$el},_render_displayAppArea:function(){return $("<div/>").addClass("display-apps")},_render_displayApps:function(c){c=c||this.$el;var d=c.find("div.display-apps"),a=this.model.get("display_types"),b=this.model.get("display_apps");if((!this.model.hasData())||(!c||!c.length)||(!d.length)){return}d.html(null);if(!_.isEmpty(a)){d.append(HDABaseView.templates.displayApps({displayApps:a}))}if(!_.isEmpty(b)){d.append(HDABaseView.templates.displayApps({displayApps:b}))}},_render_peek:function(){var a=this.model.get("peek");if(!a){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(a))},_render_body:function(){var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: none");if(this.expanded){this._render_body_html(a);a.css("display","block")}return a},_render_body_html:function(a){a.html("");switch(this.model.get("state")){case HistoryDatasetAssociation.STATES.NEW:this._render_body_new(a);break;case HistoryDatasetAssociation.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryDatasetAssociation.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryDatasetAssociation.STATES.PAUSED:this._render_body_paused(a);break;case HistoryDatasetAssociation.STATES.QUEUED:this._render_body_queued(a);break;case HistoryDatasetAssociation.STATES.RUNNING:this._render_body_running(a);break;case HistoryDatasetAssociation.STATES.ERROR:this._render_body_error(a);break;case HistoryDatasetAssociation.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryDatasetAssociation.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryDatasetAssociation.STATES.EMPTY:this._render_body_empty(a);break;case HistoryDatasetAssociation.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryDatasetAssociation.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+this.model.get("state")+'".</div>'))}a.append('<div style="clear: both"></div>');this._setUpBehaviors(a)},_render_body_new:function(b){var a=_l("This is a new dataset and not all of its data are available yet");b.append($("<div>"+_l(a)+"</div>"))},_render_body_not_viewable:function(a){a.append($("<div>"+_l("You do not have permission to view dataset")+"</div>"))},_render_body_uploading:function(a){a.append($("<div>"+_l("Dataset is uploading")+"</div>"))},_render_body_queued:function(a){a.append($("<div>"+_l("Job is waiting to run")+"</div>"));a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_paused:function(a){a.append($("<div>"+_l("Job is paused. Use the history menu to resume")+"</div>"));a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_running:function(a){a.append("<div>"+_l("Job is currently running")+"</div>");a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append((_l("An error occurred with this dataset")+": <i>"+$.trim(this.model.get("misc_info"))+"</i>"));a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers.concat([this._render_downloadButton])))},_render_body_discarded:function(a){a.append("<div>"+_l("The job creating this dataset was cancelled before completion")+".</div>");a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_setting_metadata:function(a){a.append($("<div>"+_l("Metadata is being auto-detected")+".</div>"))},_render_body_empty:function(a){a.append($("<div>"+_l("No data")+": <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_failed_metadata:function(a){a.append($(HDABaseView.templates.failedMetadata(_.extend(this.model.toJSON(),{urls:this.urls}))));this._render_body_ok(a)},_render_body_ok:function(a){a.append(this._render_hdaSummary());if(this.model.isDeletedOrPurged()){a.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton]));return}a.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton]));a.append('<div class="clear"/>');a.append(this._render_displayAppArea());this._render_displayApps(a);a.append(this._render_peek())},events:{"click .historyItemTitle":"toggleBodyVisibility"},toggleBodyVisibility:function(c,a){var b=this;this.expanded=(a===undefined)?(!this.body.is(":visible")):(a);if(this.expanded){b._render_body_html(b.body);this.body.slideDown("fast",function(){b.trigger("body-expanded",b.model.get("id"))})}else{this.body.slideUp("fast",function(){b.trigger("body-collapsed",b.model.get("id"))})}},remove:function(b){var a=this;this.$el.fadeOut("fast",function(){a.$el.remove();a.off();if(b){b()}})},toString:function(){var a=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+a+")"}});HDABaseView.templates={warningMsg:Handlebars.templates["template-warningmessagesmall"],messages:Handlebars.templates["template-hda-warning-messages"],titleLink:Handlebars.templates["template-hda-titleLink"],hdaSummary:Handlebars.templates["template-hda-hdaSummary"],downloadLinks:Handlebars.templates["template-hda-downloadLinks"],failedMetadata:Handlebars.templates["template-hda-failedMetadata"],displayApps:Handlebars.templates["template-hda-displayApps"]};
\ No newline at end of file
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/packed/mvc/history/history-panel.js
--- a/static/scripts/packed/mvc/history/history-panel.js
+++ b/static/scripts/packed/mvc/history/history-panel.js
@@ -1,1 +1,1 @@
-var HistoryPanel=Backbone.View.extend(LoggableMixin).extend({el:"body.historyPage",HDAView:HDAEditView,events:{"click #history-tag":"loadAndDisplayTags","click #message-container":"removeMessage"},initialize:function(a){if(a.logger){this.logger=this.model.logger=a.logger}this.log(this+".initialize:",a);if(!a.urlTemplates){throw (this+" needs urlTemplates on initialize")}if(!a.urlTemplates.history){throw (this+" needs urlTemplates.history on initialize")}if(!a.urlTemplates.hda){throw (this+" needs urlTemplates.hda on initialize")}this.urlTemplates=a.urlTemplates.history;this.hdaUrlTemplates=a.urlTemplates.hda;this._setUpWebStorage(a.initiallyExpanded,a.show_deleted,a.show_hidden);this._setUpEventHandlers();this.hdaViews={};this.urls={}},refresh:function(){window.location=window.location},_setUpEventHandlers:function(){this.model.bind("change:nice_size",this.updateHistoryDiskSize,this);this.model.bind("error",function(d,c,b,a){this.displayMessage("error",d);this.model.attributes.error=undefined},this);this.model.hdas.bind("add",this.add,this);this.model.hdas.bind("reset",this.addAll,this);this.model.hdas.bind("change:deleted",this.handleHdaDeletionChange,this);this.model.hdas.bind("change:purged",function(a){this.model.fetch()},this);this.model.hdas.bind("state:ready",function(b,c,a){if((!b.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(b.get("id"))}},this);this.bind("error",function(d,c,b,a){this.displayMessage("error",d)});if(this.logger){this.bind("all",function(a){this.log(this+"",arguments)},this)}},_setUpWebStorage:function(b,a,c){this.storage=new PersistantStorage("HistoryView."+this.model.get("id"),{expandedHdas:{},show_deleted:false,show_hidden:false});this.log(this+" (prev) storage:",JSON.stringify(this.storage.get(),null,2));if(b){this.storage.set("exandedHdas",b)}if((a===true)||(a===false)){this.storage.set("show_deleted",a)}if((c===true)||(c===false)){this.storage.set("show_hidden",c)}this.show_deleted=this.storage.get("show_deleted");this.show_hidden=this.storage.get("show_hidden");this.log(this+" (init'd) storage:",this.storage.get())},add:function(a){this.render()},addAll:function(){this.render()},handleHdaDeletionChange:function(a){if(a.get("deleted")&&!this.storage.get("show_deleted")){this.removeHdaView(a.get("id"))}},removeHdaView:function(c,b){var a=this.hdaViews[c];if(!a){return}a.remove(b);delete this.hdaViews[c];if(_.isEmpty(this.hdaViews)){this.render()}},render:function(){var b=this,d=b.toString()+".set-up",c=$("<div/>"),a=this.model.toJSON(),e=(this.$el.children().size()===0);a.urls=this._renderUrls(a);c.append(HistoryPanel.templates.historyPanel(a));c.find(".tooltip").tooltip({placement:"bottom"});if(!this.model.hdas.length||!this.renderItems(c.find("#"+this.model.get("id")+"-datasets"))){c.find("#emptyHistoryMessage").show()}$(b).queue(d,function(f){b.$el.fadeOut("fast",function(){f()})});$(b).queue(d,function(f){b.$el.html("");b.$el.append(c.children());b.$el.fadeIn("fast",function(){f()})});$(b).queue(d,function(f){this.log(b+" rendered:",b.$el);b._setUpBehaviours();if(e){b.trigger("rendered:initial")}else{b.trigger("rendered")}f()});$(b).dequeue(d);return this},_renderUrls:function(a){var b=this;b.urls={};_.each(this.urlTemplates,function(d,c){b.urls[c]=_.template(d,a)});return b.urls},renderItems:function(b){this.hdaViews={};var a=this,c=this.model.hdas.getVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"));_.each(c,function(f){var e=f.get("id"),d=a.storage.get("expandedHdas").get(e);a.hdaViews[e]=new a.HDAView({model:f,expanded:d,urlTemplates:a.hdaUrlTemplates,logger:a.logger});a._setUpHdaListeners(a.hdaViews[e]);b.prepend(a.hdaViews[e].render().$el)});return c.length},_setUpHdaListeners:function(b){var a=this;b.bind("body-expanded",function(c){a.storage.get("expandedHdas").set(c,true)});b.bind("body-collapsed",function(c){a.storage.get("expandedHdas").deleteKey(c)});b.bind("error",function(f,e,c,d){a.displayMessage("error",f)})},_setUpBehaviours:function(){if(!(this.model.get("user")&&this.model.get("user").email)){return}var a=this.$("#history-annotation-area");this.$("#history-annotate").click(function(){if(a.is(":hidden")){a.slideDown("fast")}else{a.slideUp("fast")}return false});async_save_text("history-name-container","history-name",this.urls.rename,"new_name",18);async_save_text("history-annotation-container","history-annotation",this.urls.annotate,"new_annotation",18,true,4)},updateHistoryDiskSize:function(){this.$el.find("#history-size").text(this.model.get("nice_size"))},showQuotaMessage:function(){var a=this.$el.find("#quota-message-container");if(a.is(":hidden")){a.slideDown("fast")}},hideQuotaMessage:function(){var a=this.$el.find("#quota-message-container");if(!a.is(":hidden")){a.slideUp("fast")}},toggleShowDeleted:function(){this.storage.set("show_deleted",!this.storage.get("show_deleted"));this.render();return this.storage.get("show_deleted")},toggleShowHidden:function(){this.storage.set("show_hidden",!this.storage.get("show_hidden"));this.render();return this.storage.get("show_hidden")},collapseAllHdaBodies:function(){_.each(this.hdaViews,function(a){a.toggleBodyVisibility(null,false)});this.storage.set("expandedHdas",{})},loadAndDisplayTags:function(d){this.log(this+".loadAndDisplayTags",d);var b=this,e=this.$el.find("#history-tag-area"),c=e.find(".tag-elt");this.log("\t tagArea",e," tagElt",c);if(e.is(":hidden")){if(!jQuery.trim(c.html())){var a=this;$.ajax({url:a.urls.tag,error:function(h,g,f){b.log("Error loading tag area html",h,g,f);b.trigger("error",_l("Tagging failed"),h,g,f)},success:function(f){c.html(f);c.find(".tooltip").tooltip();e.slideDown("fast")}})}else{e.slideDown("fast")}}else{e.slideUp("fast")}return false},displayMessage:function(c,d){var b=this.$el.find("#message-container"),a=$("<div/>").addClass(c+"message").text(d);b.html(a)},removeMessage:function(){var a=this.$el.find("#message-container");a.html(null)},scrollToTop:function(){$(document).scrollTop(0);return this},scrollIntoView:function(b,c){if(!c){$(document).scrollTop(b);return this}var a=window,d=this.$el.parent(),f=$(a).innerHeight(),e=(f/2)-(c/2);$(d).scrollTop(b-e);return this},scrollToId:function(b){if((!b)||(!this.hdaViews[b])){return this}var a=this.hdaViews[b].$el;this.scrollIntoView(a.offset().top,a.outerHeight());return this},scrollToHid:function(a){var b=this.model.hdas.getByHid(a);if(!b){return this}return this.scrollToId(b.id)},toString:function(){var a=this.model.get("name")||"";return"HistoryPanel("+a+")"}});HistoryPanel.templates={historyPanel:Handlebars.templates["template-history-historyPanel"]};
\ No newline at end of file
+var HistoryPanel=Backbone.View.extend(LoggableMixin).extend({el:"body.historyPage",HDAView:HDAEditView,events:{"click #history-tag":"loadAndDisplayTags","click #message-container":"removeMessage"},initialize:function(a){if(a.logger){this.logger=this.model.logger=a.logger}this.log(this+".initialize:",a);if(!a.urlTemplates){throw (this+" needs urlTemplates on initialize")}if(!a.urlTemplates.history){throw (this+" needs urlTemplates.history on initialize")}if(!a.urlTemplates.hda){throw (this+" needs urlTemplates.hda on initialize")}this.urlTemplates=a.urlTemplates.history;this.hdaUrlTemplates=a.urlTemplates.hda;this._setUpWebStorage(a.initiallyExpanded,a.show_deleted,a.show_hidden);this._setUpEventHandlers();this.hdaViews={};this.urls={}},refresh:function(){window.location=window.location},_setUpEventHandlers:function(){this.model.bind("change:nice_size",this.updateHistoryDiskSize,this);this.model.bind("error",function(d,c,b,a){this.displayMessage("error",d);this.model.attributes.error=undefined},this);this.model.hdas.bind("add",this.add,this);this.model.hdas.bind("reset",this.addAll,this);this.model.hdas.bind("change:deleted",this.handleHdaDeletionChange,this);this.model.hdas.bind("change:purged",function(a){this.model.fetch()},this);this.model.hdas.bind("state:ready",function(b,c,a){if((!b.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(b.get("id"))}},this);this.bind("error",function(d,c,b,a){this.displayMessage("error",d)});if(this.logger){this.bind("all",function(a){this.log(this+"",arguments)},this)}},_setUpWebStorage:function(b,a,c){this.storage=new PersistantStorage("HistoryView."+this.model.get("id"),{expandedHdas:{},show_deleted:false,show_hidden:false});this.log(this+" (prev) storage:",JSON.stringify(this.storage.get(),null,2));if(b){this.storage.set("exandedHdas",b)}if((a===true)||(a===false)){this.storage.set("show_deleted",a)}if((c===true)||(c===false)){this.storage.set("show_hidden",c)}this.show_deleted=this.storage.get("show_deleted");this.show_hidden=this.storage.get("show_hidden");this.log(this+" (init'd) storage:",this.storage.get())},add:function(a){this.render()},addAll:function(){this.render()},handleHdaDeletionChange:function(a){if(a.get("deleted")&&!this.storage.get("show_deleted")){this.removeHdaView(a.get("id"))}},removeHdaView:function(c,b){var a=this.hdaViews[c];if(!a){return}a.remove(b);delete this.hdaViews[c];if(_.isEmpty(this.hdaViews)){this.render()}},render:function(){var b=this,d=b.toString()+".set-up",c=$("<div/>"),a=this.model.toJSON(),e=(this.$el.children().size()===0);a.urls=this._renderUrls(a);c.append(HistoryPanel.templates.historyPanel(a));c.find("[title]").tooltip({placement:"bottom"});if(!this.model.hdas.length||!this.renderItems(c.find("#"+this.model.get("id")+"-datasets"))){c.find("#emptyHistoryMessage").show()}$(b).queue(d,function(f){b.$el.fadeOut("fast",function(){f()})});$(b).queue(d,function(f){b.$el.html("");b.$el.append(c.children());b.$el.fadeIn("fast",function(){f()})});$(b).queue(d,function(f){this.log(b+" rendered:",b.$el);b._setUpBehaviours();if(e){b.trigger("rendered:initial")}else{b.trigger("rendered")}f()});$(b).dequeue(d);return this},_renderUrls:function(a){var b=this;b.urls={};_.each(this.urlTemplates,function(d,c){b.urls[c]=_.template(d,a)});return b.urls},renderItems:function(b){this.hdaViews={};var a=this,c=this.model.hdas.getVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"));_.each(c,function(f){var e=f.get("id"),d=a.storage.get("expandedHdas").get(e);a.hdaViews[e]=new a.HDAView({model:f,expanded:d,urlTemplates:a.hdaUrlTemplates,logger:a.logger});a._setUpHdaListeners(a.hdaViews[e]);b.prepend(a.hdaViews[e].render().$el)});return c.length},_setUpHdaListeners:function(b){var a=this;b.bind("body-expanded",function(c){a.storage.get("expandedHdas").set(c,true)});b.bind("body-collapsed",function(c){a.storage.get("expandedHdas").deleteKey(c)});b.bind("error",function(f,e,c,d){a.displayMessage("error",f)})},_setUpBehaviours:function(){if(!(this.model.get("user")&&this.model.get("user").email)){return}var a=this.$("#history-annotation-area");this.$("#history-annotate").click(function(){if(a.is(":hidden")){a.slideDown("fast")}else{a.slideUp("fast")}return false});async_save_text("history-name-container","history-name",this.urls.rename,"new_name",18);async_save_text("history-annotation-container","history-annotation",this.urls.annotate,"new_annotation",18,true,4)},updateHistoryDiskSize:function(){this.$el.find("#history-size").text(this.model.get("nice_size"))},showQuotaMessage:function(){var a=this.$el.find("#quota-message-container");if(a.is(":hidden")){a.slideDown("fast")}},hideQuotaMessage:function(){var a=this.$el.find("#quota-message-container");if(!a.is(":hidden")){a.slideUp("fast")}},toggleShowDeleted:function(){this.storage.set("show_deleted",!this.storage.get("show_deleted"));this.render();return this.storage.get("show_deleted")},toggleShowHidden:function(){this.storage.set("show_hidden",!this.storage.get("show_hidden"));this.render();return this.storage.get("show_hidden")},collapseAllHdaBodies:function(){_.each(this.hdaViews,function(a){a.toggleBodyVisibility(null,false)});this.storage.set("expandedHdas",{})},loadAndDisplayTags:function(d){this.log(this+".loadAndDisplayTags",d);var b=this,e=this.$el.find("#history-tag-area"),c=e.find(".tag-elt");this.log("\t tagArea",e," tagElt",c);if(e.is(":hidden")){if(!jQuery.trim(c.html())){var a=this;$.ajax({url:a.urls.tag,error:function(h,g,f){b.log("Error loading tag area html",h,g,f);b.trigger("error",_l("Tagging failed"),h,g,f)},success:function(f){c.html(f);c.find("[title]").tooltip();e.slideDown("fast")}})}else{e.slideDown("fast")}}else{e.slideUp("fast")}return false},displayMessage:function(c,d){var b=this.$el.find("#message-container"),a=$("<div/>").addClass(c+"message").text(d);b.html(a)},removeMessage:function(){var a=this.$el.find("#message-container");a.html(null)},scrollToTop:function(){$(document).scrollTop(0);return this},scrollIntoView:function(b,c){if(!c){$(document).scrollTop(b);return this}var a=window,d=this.$el.parent(),f=$(a).innerHeight(),e=(f/2)-(c/2);$(d).scrollTop(b-e);return this},scrollToId:function(b){if((!b)||(!this.hdaViews[b])){return this}var a=this.hdaViews[b].$el;this.scrollIntoView(a.offset().top,a.outerHeight());return this},scrollToHid:function(a){var b=this.model.hdas.getByHid(a);if(!b){return this}return this.scrollToId(b.id)},toString:function(){var a=this.model.get("name")||"";return"HistoryPanel("+a+")"}});HistoryPanel.templates={historyPanel:Handlebars.templates["template-history-historyPanel"]};
\ No newline at end of file
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/packed/templates/compiled/template-history-historyPanel.js
--- a/static/scripts/packed/templates/compiled/template-history-historyPanel.js
+++ b/static/scripts/packed/templates/compiled/template-history-historyPanel.js
@@ -1,1 +1,1 @@
-(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-historyPanel"]=b(function(m,C,A,s,J){this.compilerInfo=[4,">= 1.0.0"];A=this.merge(A,m.helpers);J=J||{};var B="",p,l,h,x=this,e="function",c=A.blockHelperMissing,d=this.escapeExpression;function v(O,N){var K="",M,L;K+='\n <div id="history-name" class="editable-text"\n title="';L={hash:{},inverse:x.noop,fn:x.program(2,u,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='">';if(M=A.name){M=M.call(O,{hash:{},data:N})}else{M=O.name;M=typeof M===e?M.apply(O):M}K+=d(M)+"</div>\n ";return K}function u(L,K){return"Click to rename history"}function t(O,N){var K="",M,L;K+='\n <div id="history-name"\n title="';L={hash:{},inverse:x.noop,fn:x.program(5,r,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='">';if(M=A.name){M=M.call(O,{hash:{},data:N})}else{M=O.name;M=typeof M===e?M.apply(O):M}K+=d(M)+"</div>\n ";return K}function r(L,K){return"You must be logged in to edit your history name"}function q(O,N){var K="",M,L;K+='\n <a id="history-tag" title="';L={hash:{},inverse:x.noop,fn:x.program(8,o,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='"\n class="icon-button tags tooltip" target="galaxy_main" href="javascript:void(0)"></a>\n <a id="history-annotate" title="';L={hash:{},inverse:x.noop,fn:x.program(10,I,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='"\n class="icon-button annotate tooltip" target="galaxy_main" href="javascript:void(0)"></a>\n ';return K}function o(L,K){return"Edit history tags"}function I(L,K){return"Edit history annotation"}function H(O,N){var K="",M,L;K+='\n <div id="history-tag-annotation">\n\n <div id="history-tag-area" style="display: none">\n <strong>';L={hash:{},inverse:x.noop,fn:x.program(13,G,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+=':</strong>\n <div class="tag-elt"></div>\n </div>\n\n <div id="history-annotation-area" style="display: none">\n <strong>';L={hash:{},inverse:x.noop,fn:x.program(15,F,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+=':</strong>\n <div id="history-annotation-container">\n <div id="history-annotation" class="tooltip editable-text"\n title="';L={hash:{},inverse:x.noop,fn:x.program(17,E,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='">\n ';M=A["if"].call(O,O.annotation,{hash:{},inverse:x.program(21,n,N),fn:x.program(19,D,N),data:N});if(M||M===0){K+=M}K+="\n </div>\n </div>\n </div>\n </div>\n ";return K}function G(L,K){return"Tags"}function F(L,K){return"Annotation"}function E(L,K){return"Click to edit annotation"}function D(N,M){var K="",L;K+="\n ";if(L=A.annotation){L=L.call(N,{hash:{},data:M})}else{L=N.annotation;L=typeof L===e?L.apply(N):L}K+=d(L)+"\n ";return K}function n(O,N){var K="",M,L;K+="\n <em>";L={hash:{},inverse:x.noop,fn:x.program(22,k,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+="</em>\n ";return K}function k(L,K){return"Describe or add notes to history"}function j(O,N){var K="",M,L;K+="\n ";L={hash:{},inverse:x.noop,fn:x.program(25,i,N),data:N};if(M=A.warningmessagesmall){M=M.call(O,L)}else{M=O.warningmessagesmall;M=typeof M===e?M.apply(O):M}if(!A.warningmessagesmall){M=c.call(O,M,L)}if(M||M===0){K+=M}K+="\n ";return K}function i(N,M){var L,K;K={hash:{},inverse:x.noop,fn:x.program(26,g,M),data:M};if(L=A.local){L=L.call(N,K)}else{L=N.local;L=typeof L===e?L.apply(N):L}if(!A.local){L=c.call(N,L,K)}if(L||L===0){return L}else{return""}}function g(L,K){return"You are currently viewing a deleted history!"}function f(N,M){var K="",L;K+='\n <div class="';if(L=A.status){L=L.call(N,{hash:{},data:M})}else{L=N.status;L=typeof L===e?L.apply(N):L}K+=d(L)+'message">';if(L=A.message){L=L.call(N,{hash:{},data:M})}else{L=N.message;L=typeof L===e?L.apply(N):L}K+=d(L)+"</div>\n ";return K}function z(L,K){return"You are over your disk quota"}function y(L,K){return"Tool execution is on hold until your disk usage drops below your allocated quota"}function w(L,K){return"Your history is empty. Click 'Get Data' on the left pane to start"}B+='<div id="history-controls">\n\n <div id="history-title-area" class="historyLinks">\n \n <div id="history-name-container">\n \n ';l=A["if"].call(C,((p=C.user),p==null||p===false?p:p.email),{hash:{},inverse:x.program(4,t,J),fn:x.program(1,v,J),data:J});if(l||l===0){B+=l}B+='\n </div>\n </div>\n\n <div id="history-subtitle-area">\n <div id="history-size" style="float:left;">';if(l=A.nice_size){l=l.call(C,{hash:{},data:J})}else{l=C.nice_size;l=typeof l===e?l.apply(C):l}B+=d(l)+'</div>\n\n <div id="history-secondary-links" style="float: right;">\n ';l=A["if"].call(C,((p=C.user),p==null||p===false?p:p.email),{hash:{},inverse:x.noop,fn:x.program(7,q,J),data:J});if(l||l===0){B+=l}B+='\n </div>\n <div style="clear: both;"></div>\n </div>\n\n \n \n ';l=A["if"].call(C,((p=C.user),p==null||p===false?p:p.email),{hash:{},inverse:x.noop,fn:x.program(12,H,J),data:J});if(l||l===0){B+=l}B+="\n\n ";l=A["if"].call(C,C.deleted,{hash:{},inverse:x.noop,fn:x.program(24,j,J),data:J});if(l||l===0){B+=l}B+='\n\n <div id="message-container">\n ';l=A["if"].call(C,C.message,{hash:{},inverse:x.noop,fn:x.program(28,f,J),data:J});if(l||l===0){B+=l}B+='\n </div>\n\n <div id="quota-message-container" style="display: none">\n <div id="quota-message" class="errormessage">\n ';h={hash:{},inverse:x.noop,fn:x.program(30,z,J),data:J};if(l=A.local){l=l.call(C,h)}else{l=C.local;l=typeof l===e?l.apply(C):l}if(!A.local){l=c.call(C,l,h)}if(l||l===0){B+=l}B+=".\n ";h={hash:{},inverse:x.noop,fn:x.program(32,y,J),data:J};if(l=A.local){l=l.call(C,h)}else{l=C.local;l=typeof l===e?l.apply(C):l}if(!A.local){l=c.call(C,l,h)}if(l||l===0){B+=l}B+='.\n </div>\n </div>\n</div>\n\n<div id="';if(l=A.id){l=l.call(C,{hash:{},data:J})}else{l=C.id;l=typeof l===e?l.apply(C):l}B+=d(l)+'-datasets" class="history-datasets-list"></div>\n\n<div class="infomessagesmall" id="emptyHistoryMessage" style="display: none;">\n ';h={hash:{},inverse:x.noop,fn:x.program(34,w,J),data:J};if(l=A.local){l=l.call(C,h)}else{l=C.local;l=typeof l===e?l.apply(C):l}if(!A.local){l=c.call(C,l,h)}if(l||l===0){B+=l}B+="\n</div>";return B})})();
\ No newline at end of file
+(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-historyPanel"]=b(function(m,C,A,s,J){this.compilerInfo=[4,">= 1.0.0"];A=this.merge(A,m.helpers);J=J||{};var B="",p,l,h,x=this,e="function",c=A.blockHelperMissing,d=this.escapeExpression;function v(O,N){var K="",M,L;K+='\n <div id="history-name" class="editable-text"\n title="';L={hash:{},inverse:x.noop,fn:x.program(2,u,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='">';if(M=A.name){M=M.call(O,{hash:{},data:N})}else{M=O.name;M=typeof M===e?M.apply(O):M}K+=d(M)+"</div>\n ";return K}function u(L,K){return"Click to rename history"}function t(O,N){var K="",M,L;K+='\n <div id="history-name"\n title="';L={hash:{},inverse:x.noop,fn:x.program(5,r,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='">';if(M=A.name){M=M.call(O,{hash:{},data:N})}else{M=O.name;M=typeof M===e?M.apply(O):M}K+=d(M)+"</div>\n ";return K}function r(L,K){return"You must be logged in to edit your history name"}function q(O,N){var K="",M,L;K+='\n <a id="history-tag" title="';L={hash:{},inverse:x.noop,fn:x.program(8,o,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='"\n class="icon-button tags" target="galaxy_main" href="javascript:void(0)"></a>\n <a id="history-annotate" title="';L={hash:{},inverse:x.noop,fn:x.program(10,I,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='"\n class="icon-button annotate" target="galaxy_main" href="javascript:void(0)"></a>\n ';return K}function o(L,K){return"Edit history tags"}function I(L,K){return"Edit history annotation"}function H(O,N){var K="",M,L;K+='\n <div id="history-tag-annotation">\n\n <div id="history-tag-area" style="display: none">\n <strong>';L={hash:{},inverse:x.noop,fn:x.program(13,G,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+=':</strong>\n <div class="tag-elt"></div>\n </div>\n\n <div id="history-annotation-area" style="display: none">\n <strong>';L={hash:{},inverse:x.noop,fn:x.program(15,F,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+=':</strong>\n <div id="history-annotation-container">\n <div id="history-annotation" class="editable-text"\n title="';L={hash:{},inverse:x.noop,fn:x.program(17,E,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+='">\n ';M=A["if"].call(O,O.annotation,{hash:{},inverse:x.program(21,n,N),fn:x.program(19,D,N),data:N});if(M||M===0){K+=M}K+="\n </div>\n </div>\n </div>\n </div>\n ";return K}function G(L,K){return"Tags"}function F(L,K){return"Annotation"}function E(L,K){return"Click to edit annotation"}function D(N,M){var K="",L;K+="\n ";if(L=A.annotation){L=L.call(N,{hash:{},data:M})}else{L=N.annotation;L=typeof L===e?L.apply(N):L}K+=d(L)+"\n ";return K}function n(O,N){var K="",M,L;K+="\n <em>";L={hash:{},inverse:x.noop,fn:x.program(22,k,N),data:N};if(M=A.local){M=M.call(O,L)}else{M=O.local;M=typeof M===e?M.apply(O):M}if(!A.local){M=c.call(O,M,L)}if(M||M===0){K+=M}K+="</em>\n ";return K}function k(L,K){return"Describe or add notes to history"}function j(O,N){var K="",M,L;K+="\n ";L={hash:{},inverse:x.noop,fn:x.program(25,i,N),data:N};if(M=A.warningmessagesmall){M=M.call(O,L)}else{M=O.warningmessagesmall;M=typeof M===e?M.apply(O):M}if(!A.warningmessagesmall){M=c.call(O,M,L)}if(M||M===0){K+=M}K+="\n ";return K}function i(N,M){var L,K;K={hash:{},inverse:x.noop,fn:x.program(26,g,M),data:M};if(L=A.local){L=L.call(N,K)}else{L=N.local;L=typeof L===e?L.apply(N):L}if(!A.local){L=c.call(N,L,K)}if(L||L===0){return L}else{return""}}function g(L,K){return"You are currently viewing a deleted history!"}function f(N,M){var K="",L;K+='\n <div class="';if(L=A.status){L=L.call(N,{hash:{},data:M})}else{L=N.status;L=typeof L===e?L.apply(N):L}K+=d(L)+'message">';if(L=A.message){L=L.call(N,{hash:{},data:M})}else{L=N.message;L=typeof L===e?L.apply(N):L}K+=d(L)+"</div>\n ";return K}function z(L,K){return"You are over your disk quota"}function y(L,K){return"Tool execution is on hold until your disk usage drops below your allocated quota"}function w(L,K){return"Your history is empty. Click 'Get Data' on the left pane to start"}B+='<div id="history-controls">\n\n <div id="history-title-area" class="historyLinks">\n \n <div id="history-name-container">\n \n ';l=A["if"].call(C,((p=C.user),p==null||p===false?p:p.email),{hash:{},inverse:x.program(4,t,J),fn:x.program(1,v,J),data:J});if(l||l===0){B+=l}B+='\n </div>\n </div>\n\n <div id="history-subtitle-area">\n <div id="history-size" style="float:left;">';if(l=A.nice_size){l=l.call(C,{hash:{},data:J})}else{l=C.nice_size;l=typeof l===e?l.apply(C):l}B+=d(l)+'</div>\n\n <div id="history-secondary-links" style="float: right;">\n ';l=A["if"].call(C,((p=C.user),p==null||p===false?p:p.email),{hash:{},inverse:x.noop,fn:x.program(7,q,J),data:J});if(l||l===0){B+=l}B+='\n </div>\n <div style="clear: both;"></div>\n </div>\n\n \n \n ';l=A["if"].call(C,((p=C.user),p==null||p===false?p:p.email),{hash:{},inverse:x.noop,fn:x.program(12,H,J),data:J});if(l||l===0){B+=l}B+="\n\n ";l=A["if"].call(C,C.deleted,{hash:{},inverse:x.noop,fn:x.program(24,j,J),data:J});if(l||l===0){B+=l}B+='\n\n <div id="message-container">\n ';l=A["if"].call(C,C.message,{hash:{},inverse:x.noop,fn:x.program(28,f,J),data:J});if(l||l===0){B+=l}B+='\n </div>\n\n <div id="quota-message-container" style="display: none">\n <div id="quota-message" class="errormessage">\n ';h={hash:{},inverse:x.noop,fn:x.program(30,z,J),data:J};if(l=A.local){l=l.call(C,h)}else{l=C.local;l=typeof l===e?l.apply(C):l}if(!A.local){l=c.call(C,l,h)}if(l||l===0){B+=l}B+=".\n ";h={hash:{},inverse:x.noop,fn:x.program(32,y,J),data:J};if(l=A.local){l=l.call(C,h)}else{l=C.local;l=typeof l===e?l.apply(C):l}if(!A.local){l=c.call(C,l,h)}if(l||l===0){B+=l}B+='.\n </div>\n </div>\n</div>\n\n<div id="';if(l=A.id){l=l.call(C,{hash:{},data:J})}else{l=C.id;l=typeof l===e?l.apply(C):l}B+=d(l)+'-datasets" class="history-datasets-list"></div>\n\n<div class="infomessagesmall" id="emptyHistoryMessage" style="display: none;">\n ';h={hash:{},inverse:x.noop,fn:x.program(34,w,J),data:J};if(l=A.local){l=l.call(C,h)}else{l=C.local;l=typeof l===e?l.apply(C):l}if(!A.local){l=c.call(C,l,h)}if(l||l===0){B+=l}B+="\n</div>";return B})})();
\ No newline at end of file
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/packed/viz/trackster/tracks.js
--- a/static/scripts/packed/viz/trackster/tracks.js
+++ b/static/scripts/packed/viz/trackster/tracks.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","viz/trackster/filters","mvc/data","mvc/tools"],function(ac,w,j,s,L,h,X,R){var o=ac.extend;var l={};var i=function(ad,ae){l[ad.attr("id")]=ae};var k=function(ad,af,ah,ag){ah=".group";var ae={};l[ad.attr("id")]=ag;ad.bind("drag",{handle:"."+af,relative:true},function(ap,aq){var ao=$(this),au=$(this).parent(),al=au.children(),an=l[$(this).attr("id")],ak,aj,ar,ai,am;aj=$(this).parents(ah);if(aj.length!==0){ar=aj.position().top;ai=ar+aj.outerHeight();if(aq.offsetY<ar){$(this).insertBefore(aj);var at=l[aj.attr("id")];at.remove_drawable(an);at.container.add_drawable_before(an,at);return}else{if(aq.offsetY>ai){$(this).insertAfter(aj);var at=l[aj.attr("id")];at.remove_drawable(an);at.container.add_drawable(an);return}}}aj=null;for(am=0;am<al.length;am++){ak=$(al.get(am));ar=ak.position().top;ai=ar+ak.outerHeight();if(ak.is(ah)&&this!==ak.get(0)&&aq.offsetY>=ar&&aq.offsetY<=ai){if(aq.offsetY-ar<ai-aq.offsetY){ak.find(".content-div").prepend(this)}else{ak.find(".content-div").append(this)}if(an.container){an.container.remove_drawable(an)}l[ak.attr("id")].add_drawable(an);return}}for(am=0;am<al.length;am++){ak=$(al.get(am));if(aq.offsetY<ak.position().top&&!(ak.hasClass("reference-track")||ak.hasClass("intro"))){break}}if(am===al.length){if(this!==al.get(am-1)){au.append(this);l[au.attr("id")].move_drawable(an,am)}}else{if(this!==al.get(am)){$(this).insertBefore(al.get(am));l[au.attr("id")].move_drawable(an,(aq.deltaY>0?am-1:am))}}}).bind("dragstart",function(){ae["border-top"]=ad.css("border-top");ae["border-bottom"]=ad.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ae)})};var aa=16,G=9,D=20,z=100,I=12000,S=400,K=5000,v=100,m="Cannot display dataset due to an error. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",u="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",x="Tool cannot be rerun: ",a="Loading data...",U="Ready for display",Q=10,H=20,A=["Histogram","Line","Filled","Intensity"];function V(ae,ad){if(!ad){ad=0}var af=Math.pow(10,ad);return Math.round(ae*af)/af}var p=function(ae,ad,ag){if(!p.id_counter){p.id_counter=0}this.id=p.id_counter++;this.name=ag.name;this.view=ae;this.container=ad;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=ag.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ah){ah.stopPropagation()});var af=this;this.container_div.hover(function(){af.icons_div.show()},function(){af.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};p.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ad){if(ad.content_visible){ad.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ad.hide_contents();ad.content_visible=false}else{ad.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ad.content_visible=true;ad.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ae){var ag=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ad=function(){ae.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},af=function(ah){if((ah.keyCode||ah.which)===27){ag()}else{if((ah.keyCode||ah.which)===13){ad()}}};$(window).bind("keypress.check_enter_esc",af);show_modal("Configure",ae.config.build_form(),{Cancel:ag,OK:ad})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ad){$(".tooltip").remove();ad.remove()}}];o(p.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(ad){},to_dict:function(){},set_name:function(ad){this.old_name=this.name;this.name=ad;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ad=this.view;this.container_div.hide(0,function(){$(this).remove();ad.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ae,aj,ai,ah,ad,ag){var af=this;this.action_icons[ae]=$("<a/>").attr("href","javascript:void(0);").attr("title",aj).addClass("icon-button").addClass(ai).tooltip().click(function(){ah(af)}).appendTo(this.icons_div);if(ag){this.action_icons[ae].hide()}},build_action_icons:function(ad){var af;for(var ae=0;ae<ad.length;ae++){af=ad[ae];this.add_action_icon(af.name,af.title,af.css_class,af.on_click_fn,af.prepend,af.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var y=function(ae,ad,af){p.call(this,ae,ad,af);this.obj_type=af.obj_type;this.drawables=[]};o(y.prototype,p.prototype,{unpack_drawables:function(af){this.drawables=[];var ae;for(var ad=0;ad<af.length;ad++){ae=n(af[ad],this.view,this);this.add_drawable(ae)}},init:function(){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].init()}},_draw:function(ad){for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae]._draw(ad)}},to_dict:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ae}},add_drawable:function(ad){this.drawables.push(ad);ad.container=this;this.changed()},add_drawable_before:function(af,ad){this.changed();var ae=this.drawables.indexOf(ad);if(ae!==-1){this.drawables.splice(ae,0,af);return true}return false},replace_drawable:function(af,ad,ae){var ag=this.drawables.indexOf(af);if(ag!==-1){this.drawables[ag]=ad;if(ae){af.container_div.replaceWith(ad.container_div)}this.changed()}return ag},remove_drawable:function(ae){var ad=this.drawables.indexOf(ae);if(ad!==-1){this.drawables.splice(ad,1);ae.container=null;this.changed();return true}return false},move_drawable:function(ae,af){var ad=this.drawables.indexOf(ae);if(ad!==-1){this.drawables.splice(ad,1);this.drawables.splice(af,0,ae);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(ag){var ad=this.drawables.slice(0),ae=[],af;while(ad.length!==0){af=ad.shift();if(af instanceof ag){ae.push(af)}else{if(af.drawables){ad=ad.concat(af.drawables)}}}return ae}});var P=function(ae,ad,ag){o(ag,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});y.call(this,ae,ad,ag);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);i(this.container_div,this);i(this.content_div,this);k(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new h.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in ag){this.unpack_drawables(ag.drawables)}if("filters" in ag){var af=this.filters_manager;this.filters_manager=new h.FiltersManager(this,ag.filters);af.parent_div.replaceWith(this.filters_manager.parent_div);if(ag.filters.visible){this.setup_multitrack_filtering()}}};o(P.prototype,p.prototype,y.prototype,{action_icons_def:[p.prototype.action_icons_def[0],p.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ad){$(".tooltip").remove();ad.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ad){if(ad.filters_manager.visible()){ad.filters_manager.clear_filters();ad._restore_filter_managers()}else{ad.setup_multitrack_filtering();ad.request_draw({clear_tile_cache:true})}ad.filters_manager.toggle()}},p.prototype.action_icons_def[2]],build_container_div:function(){var ad=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ad)}return ad},build_header_div:function(){var ad=$("<div/>").addClass("track-header");ad.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ad);return ad},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var af=this.drawables.length;if(af===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(af===1){if(this.drawables[0] instanceof e){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var am,al,aj,ap=true,ah=this.drawables[0].get_type(),ad=0;for(am=0;am<af;am++){aj=this.drawables[am];if(aj.get_type()!==ah){can_composite=false;break}if(aj instanceof c){ad++}}if(ap||ad===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tooltip").remove()}if(ad>1&&ad===this.drawables.length){var aq={},ae;aj=this.drawables[0];for(al=0;al<aj.filters_manager.filters.length;al++){ae=aj.filters_manager.filters[al];aq[ae.name]=[ae]}for(am=1;am<this.drawables.length;am++){aj=this.drawables[am];for(al=0;al<aj.filters_manager.filters.length;al++){ae=aj.filters_manager.filters[al];if(ae.name in aq){aq[ae.name].push(ae)}}}this.filters_manager.remove_all();var ag,ai,ak,an;for(var ao in aq){ag=aq[ao];if(ag.length===ad){ai=new h.NumberFilter({name:ag[0].name,index:ag[0].index});this.filters_manager.add_filter(ai)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].filters_manager=this.saved_filters_managers[ad]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ad=0;ad<this.drawables.length;ad++){drawable=this.drawables[ad];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ae=new e(this.view,this.view,{name:this.name,drawables:this.drawables});var ad=this.container.replace_drawable(this,ae,true);ae.request_draw()},add_drawable:function(ad){y.prototype.add_drawable.call(this,ad);this.update_icons()},remove_drawable:function(ad){y.prototype.remove_drawable.call(this,ad);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ad=o(y.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ad},request_draw:function(ad){ac.each(this.drawables,function(ae){ae.request_draw(ad)})}});var Y=Backbone.View.extend({initialize:function(ad){o(ad,{obj_type:"View"});y.call(this,"View",ad.container,ad);this.chrom=null;this.vis_id=ad.vis_id;this.dbkey=ad.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new w.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=new F({track:this,params:[{key:"a_color",label:"A Color",type:"color",default_value:"#FF0000"},{key:"c_color",label:"C Color",type:"color",default_value:"#00FF00"},{key:"g_color",label:"G Color",type:"color",default_value:"#0000FF"},{key:"t_color",label:"T Color",type:"color",default_value:"#FF00FF"},{key:"n_color",label:"N Color",type:"color",default_value:"#AAAAAA"}],saved_values:ad.prefs,onchange:function(){track.request_redraw({clear_tile_cache:true})}})},render:function(){this.requested_redraw=false;var af=this.container,ad=this;this.top_container=$("<div/>").addClass("top-container").appendTo(af);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(af);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(af);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;i(this.viewport_container,ad);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var ag=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){w.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",{"f-dbkey":ad.dbkey},function(ah){ac.each(ah,function(ai){ad.add_drawable(n(ai,ad,ad))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ae=function(ah){if(ah.type==="focusout"||(ah.keyCode||ah.which)===13||(ah.keyCode||ah.which)===27){if((ah.keyCode||ah.which)!==27){ad.go_to($(this).val())}$(this).hide();$(this).val("");ad.location_span.show();ad.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ae).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ad.location_span.hide();ad.chrom_select.hide();ad.nav_input.val(ad.chrom+":"+ad.low+"-"+ad.high);ad.nav_input.css("display","inline-block");ad.nav_input.select();ad.nav_input.focus();ad.nav_input.autocomplete({source:function(aj,ah){var ak=[],ai=$.map(ad.get_tracks(c),function(al){return al.data_manager.search_features(aj.term).success(function(am){ak=ak.concat(am)})});$.when.apply($,ai).done(function(){ah($.map(ak,function(al){return{label:al[0],value:al[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ad.zoom_out();ad.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ad.zoom_in();ad.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ad.change_chrom(ad.chrom_select.val())});this.browser_content_div.click(function(ah){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ah){ad.zoom_in(ah.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ah,ai){this.current_x=ai.offsetX}).bind("drag",function(ah,aj){var ak=aj.offsetX-this.current_x;this.current_x=aj.offsetX;var ai=Math.round(ak/ad.viewport_container.width()*(ad.max_high-ad.max_low));ad.move_delta(-ai)});this.overview_close.click(function(){ad.reset_overview()});this.viewport_container.bind("draginit",function(ah,ai){if(ah.clientX>ad.viewport_container.width()-16){return false}}).bind("dragstart",function(ah,ai){ai.original_low=ad.low;ai.current_height=ah.clientY;ai.current_x=ai.offsetX}).bind("drag",function(aj,al){var ah=$(this);var am=al.offsetX-al.current_x;var ai=ah.scrollTop()-(aj.clientY-al.current_height);ah.scrollTop(ai);al.current_height=aj.clientY;al.current_x=al.offsetX;var ak=Math.round(am/ad.viewport_container.width()*(ad.high-ad.low));ad.move_delta(ak)}).bind("mousewheel",function(aj,al,ai,ah){if(ai){ai*=50;var ak=Math.round(-ai/ad.viewport_container.width()*(ad.high-ad.low));ad.move_delta(ak)}});this.top_labeltrack.bind("dragstart",function(ah,ai){return $("<div />").css({height:ad.browser_content_div.height()+ad.top_labeltrack.height()+ad.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(al,am){$(am.proxy).css({left:Math.min(al.pageX,am.startX)-ad.container.offset().left,width:Math.abs(al.pageX-am.startX)});var ai=Math.min(al.pageX,am.startX)-ad.container.offset().left,ah=Math.max(al.pageX,am.startX)-ad.container.offset().left,ak=(ad.high-ad.low),aj=ad.viewport_container.width();ad.update_location(Math.round(ai/aj*ak)+ad.low,Math.round(ah/aj*ak)+ad.low)}).bind("dragend",function(am,an){var ai=Math.min(am.pageX,an.startX),ah=Math.max(am.pageX,an.startX),ak=(ad.high-ad.low),aj=ad.viewport_container.width(),al=ad.low;ad.low=Math.round(ai/aj*ak)+al;ad.high=Math.round(ah/aj*ak)+al;$(an.proxy).remove();ad.request_redraw()});this.add_label_track(new W(this,{content_div:this.top_labeltrack}));this.add_label_track(new W(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ad.resize_window()},500)});$(document).bind("redraw",function(){ad.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ad){return this.config.values[ad.toLowerCase()+"_color"]||this.config.values.n_color}});o(Y.prototype,y.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(ae,ag,ad,ah){if(this.timer){clearTimeout(this.timer)}if(ah){var af=this;this.timer=setTimeout(function(){af.trigger("navigate",ae+":"+ag+"-"+ad)},500)}else{view.trigger("navigate",ae+":"+ag+"-"+ad)}},update_location:function(ad,af){this.location_span.text(commatize(ad)+" - "+commatize(af));this.nav_input.val(this.chrom+":"+commatize(ad)+"-"+commatize(af));var ae=view.chrom_select.val();if(ae!==""){this.trigger_navigate(ae,view.low,view.high,true)}},load_chroms:function(af){af.num=v;var ad=this,ae=$.Deferred();$.ajax({url:galaxy_config.root+"api/genomes/"+this.dbkey,data:af,dataType:"json",success:function(ah){if(ah.chrom_info.length===0){return}if(ah.reference){ad.add_label_track(new B(ad))}ad.chrom_data=ah.chrom_info;var ak='<option value="">Select Chrom/Contig</option>';for(var aj=0,ag=ad.chrom_data.length;aj<ag;aj++){var ai=ad.chrom_data[aj].chrom;ak+='<option value="'+ai+'">'+ai+"</option>"}if(ah.prev_chroms){ak+='<option value="previous">Previous '+v+"</option>"}if(ah.next_chroms){ak+='<option value="next">Next '+v+"</option>"}ad.chrom_select.html(ak);ad.chrom_start_index=ah.start_index;ae.resolve(ah.chrom_info)},error:function(){alert("Could not load chroms for this dbkey:",ad.dbkey)}});return ae},change_chrom:function(ai,ae,ak){var af=this;if(!af.chrom_data){af.load_chroms_deferred.then(function(){af.change_chrom(ai,ae,ak)});return}if(!ai||ai==="None"){return}if(ai==="previous"){af.load_chroms({low:this.chrom_start_index-v});return}if(ai==="next"){af.load_chroms({low:this.chrom_start_index+v});return}var aj=$.grep(af.chrom_data,function(al,am){return al.chrom===ai})[0];if(aj===undefined){af.load_chroms({chrom:ai},function(){af.change_chrom(ai,ae,ak)});return}else{if(ai!==af.chrom){af.chrom=ai;af.chrom_select.val(af.chrom);af.max_high=aj.len-1;af.reset();for(var ah=0,ad=af.drawables.length;ah<ad;ah++){var ag=af.drawables[ah];if(ag.init){ag.init()}}if(af.reference_track){af.reference_track.init()}}if(ae&&ak){af.low=Math.max(ae,0);af.high=Math.min(ak,af.max_high)}else{af.low=0;af.high=af.max_high}af.reset_overview();af.request_redraw()}},go_to:function(ah){ah=ah.replace(/,/g,"");ah=ah.replace(/:|\-/g," ");var ae=ah.split(/\s+/),ag=ae[0],af=(ae[1]?parseInt(ae[1],10):null),ad=(ae[2]?parseInt(ae[2],10):null);if(!ad){af=af-15;ad=af+15}this.change_chrom(ag,af,ad)},move_fraction:function(af){var ad=this;var ae=ad.high-ad.low;this.move_delta(af*ae)},move_delta:function(ag){var ad=this;var af=ad.high-ad.low;if(ad.low-ag<ad.max_low){ad.low=ad.max_low;ad.high=ad.max_low+af}else{if(ad.high-ag>ad.max_high){ad.high=ad.max_high;ad.low=ad.max_high-af}else{ad.high-=ag;ad.low-=ag}}ad.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ad.request_redraw()},200);var ae=ad.chrom_select.val();this.trigger_navigate(ae,ad.low,ad.high,true)},add_drawable:function(ad){y.prototype.add_drawable.call(this,ad);ad.init();this.changed();this.update_intro_div()},add_label_track:function(ad){ad.view=this;ad.init();this.label_tracks.push(ad)},remove_drawable:function(af,ae){y.prototype.remove_drawable.call(this,af);if(ae){var ad=this;af.container_div.hide(0,function(){$(this).remove();ad.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ae,af){var ad=this,ag=(af?[af]:ad.drawables);ac.each(ag,function(ah){var ai=ac.find(ad.tracks_to_be_redrawn,function(aj){return aj[0]===ah});if(ai){ai[1]=ae}else{ad.tracks_to_be_redrawn.push([ah,ae])}});if(!this.requested_redraw){requestAnimationFrame(function(){ad._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ad=this.low,ah=this.high;if(ad<this.max_low){ad=this.max_low}if(ah>this.max_high){ah=this.max_high}var ae=this.high-this.low;if(this.high!==0&&ae<this.min_separation){ah=ad+this.min_separation}this.low=Math.floor(ad);this.high=Math.ceil(ah);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=1/this.resolution_b_px;var ag=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ai=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var af=13;this.overview_box.css({left:ag,width:Math.max(af,ai)}).show();if(ai<af){this.overview_box.css("left",ag-(af-ai)/2)}if(this.overview_highlight){this.overview_highlight.css({left:ag,width:ai})}ac.each(this.tracks_to_be_redrawn,function(al){var aj=al[0],ak=al[1];if(aj){aj._draw(ak)}});this.tracks_to_be_redrawn=[];ac.each(this.label_tracks,function(aj){aj._draw()})},zoom_in:function(ae,af){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var ag=this.high-this.low,ah=ag/2+this.low,ad=(ag/this.zoom_factor)/2;if(ae){ah=ae/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ah-ad);this.high=Math.round(ah+ad);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ae=this.high-this.low,af=ae/2+this.low,ad=(ae*this.zoom_factor)/2;this.low=Math.round(af-ad);this.high=Math.round(af+ad);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(af){if(this.overview_drawable){if(this.overview_drawable.dataset.id===af.dataset.id){return}this.overview_viewport.find(".track").remove()}var ae=af.copy({content_div:this.overview_viewport}),ad=this;ae.header_div.hide();ae.is_overview=true;ad.overview_drawable=ae;this.overview_drawable.postdraw_actions=function(){ad.overview_highlight.show().height(ad.overview_drawable.content_div.height());ad.overview_viewport.height(ad.overview_drawable.content_div.height()+ad.overview_box.outerHeight());ad.overview_close.show();ad.resize_window()};ad.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var q=R.Tool.extend({defaults:{track:null},initialize:function(ad){if(ad.tool_state!==undefined){this.set("hidden",ad.tool_state.hidden)}this.remove_inputs(["data","hidden_data","conditional"])},state_dict:function(ad){return ac.extend(this.get_inputs_dict(),{hidden:!this.is_visible()})}});var t=Backbone.View.extend({events:{"change input":"update_value"},render:function(){var af=this.$el.addClass("param-row"),ag=this.model;var ad=$("<div>").addClass("param-label").text(ag.get("label")).appendTo(af);var ae=$("<div/>").addClass("param-input").html(ag.get("html")).appendTo(af);ae.find(":input").val(ag.get("value"));$("<div style='clear: both;'/>").appendTo(af)},update_value:function(ad){this.model.set_value($(ad.target).val())}});var ab=Backbone.View.extend({initialize:function(ad){this.model.on("change:hidden",this.set_visible,this)},render:function(){var ae=this;tool=this.model,parent_div=this.$el.addClass("dynamic-tool").hide();parent_div.bind("drag",function(ai){ai.stopPropagation()}).click(function(ai){ai.stopPropagation()}).bind("dblclick",function(ai){ai.stopPropagation()}).keydown(function(ai){ai.stopPropagation()});var af=$("<div class='tool-name'>").appendTo(parent_div).text(tool.get("name"));tool.get("inputs").each(function(aj){var ai=new t({model:aj});ai.render();parent_div.append(ai.$el)});parent_div.find("input").click(function(){$(this).select()});var ag=$("<div>").addClass("param-row").appendTo(parent_div);var ah=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(ag);var ad=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(ag);ad.click(function(){ae.run_on_region()});ah.click(function(){ae.run_on_dataset()});if(tool.is_visible()){this.$el.show()}},set_visible:function(){if(this.model.is_visible()){this.$el.show()}else{this.$el.hide()}},update_params:function(){for(var ad=0;ad<this.params.length;ad++){this.params[ad].update_value()}},run_on_dataset:function(){var ad=this.model;this.run({target_dataset_id:this.model.get("track").dataset.id,action:"rerun",tool_id:ad.id},null,function(ae){show_modal(ad.get("name")+" is Running",ad.get("name")+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ae=this.model.get("track"),ah=this.model,aj=new w.GenomeRegion({chrom:ae.view.chrom,start:ae.view.low,end:ae.view.high}),ak={target_dataset_id:ae.dataset.id,action:"rerun",tool_id:ah.id,regions:[aj.toJSON()]},ai=ae,am=ak.tool_id+ai.tool_region_and_parameters_str(aj),ad;if(ai.container===view){var al=new P(view,view,{name:this.name});var ag=ai.container.replace_drawable(ai,al,false);al.container_div.insertBefore(ai.view.content_div.children()[ag]);al.add_drawable(ai);ai.container_div.appendTo(al.content_div);ad=al}else{ad=ai.container}var af=new ai.constructor(view,ad,{name:am,hda_ldda:"hda"});af.init_for_tool_data();af.change_mode(ai.mode);af.set_filters_manager(ai.filters_manager.copy(af));af.update_icons();ad.add_drawable(af);af.tiles_div.text("Starting job.");this.run(ak,af,function(an){af.set_dataset(new X.Dataset(an));af.tiles_div.text("Running job.");af.init()})},run:function(ad,af,ag){ad.inputs=this.model.get_inputs_dict();var ae=new j.ServerStateDeferred({ajax_settings:{url:galaxy_config.root+"api/tools",data:JSON.stringify(ad),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ah){return ah!=="pending"}});$.when(ae.go()).then(function(ah){if(ah==="no converter"){af.container_div.addClass("error");af.content_div.text(J)}else{if(ah.error){af.container_div.addClass("error");af.content_div.text(x+ah.message)}else{ag(ah)}}})}});var C=function(ad,ae){L.Scaler.call(this,ae);this.filter=ad};C.prototype.gen_val=function(ad){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ad[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var F=function(ad){this.track=ad.track;this.params=ad.params;this.values={};this.restore_values((ad.saved_values?ad.saved_values:{}));this.onchange=ad.onchange};o(F.prototype,{set_param_default_value:function(ae,ad){var af=ac.find(this.params,function(ag){return ag.key===ae});if(af){af.default_value=ad}},set_param_value:function(ad,ae){var af=ac.find(this.params,function(ag){return ag.key===ad});if(af){if(typeof ae==="string"||ae instanceof String){if(ae.trim()===""){ae=af.default_value}else{if(af.type==="float"){ae=parseFloat(ae)}else{if(af.type==="int"){ae=parseInt(ae,10)}}}}}if(this.values[ad]!==ae){this.values[ad]=ae;return true}else{return false}},restore_values:function(ad){var ae=this;$.each(this.params,function(af,ag){if(ad[ag.key]!==undefined){ae.values[ag.key]=ad[ag.key]}else{ae.values[ag.key]=ag.default_value}})},build_form:function(){var ag=this;var ad=$("<div />");var af;function ae(al,ah){for(var ap=0;ap<al.length;ap++){af=al[ap];if(af.hidden){continue}var aj="param_"+ap;var au=ag.values[af.key];var aw=$("<div class='form-row' />").appendTo(ah);aw.append($("<label />").attr("for",aj).text(af.label+":"));if(af.type==="bool"){aw.append($('<input type="checkbox" />').attr("id",aj).attr("name",aj).attr("checked",au))}else{if(af.type==="text"){aw.append($('<input type="text"/>').attr("id",aj).val(au).click(function(){$(this).select()}))}else{if(af.type==="select"){var ar=$("<select />").attr("id",aj);for(var an=0;an<af.options.length;an++){$("<option/>").text(af.options[an].label).attr("value",af.options[an].value).appendTo(ar)}ar.val(au);aw.append(ar)}else{if(af.type==="color"){var av=$("<div/>").appendTo(aw),aq=$("<input />").attr("id",aj).attr("name",aj).val(au).css("float","left").appendTo(av).click(function(ay){$(".tooltip").removeClass("in");var ax=$(this).siblings(".tooltip").addClass("in");ax.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(ax).height()/2)+($(this).height()/2)}).show();ax.click(function(az){az.stopPropagation()});$(document).bind("click.color-picker",function(){ax.hide();$(document).unbind("click.color-picker")});ay.stopPropagation()}),ao=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(av).attr("title","Set new random color").tooltip(),at=$("<div class='tooltip right' style='position: absolute;' />").appendTo(av).hide(),ak=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(at),ai=$("<div class='tooltip-arrow'></div>").appendTo(at),am=$.farbtastic(ak,{width:100,height:100,callback:aq,color:au});av.append($("<div/>").css("clear","both"));(function(ax){ao.click(function(){ax.setColor(j.get_random_color())})})(am)}else{aw.append($("<input />").attr("id",aj).attr("name",aj).val(au))}}}}if(af.help){aw.append($("<div class='help'/>").text(af.help))}}}ae(this.params,ad);return ad},update_from_form:function(ad){var af=this;var ae=false;$.each(this.params,function(ag,ai){if(!ai.hidden){var aj="param_"+ag;var ah=ad.find("#"+aj).val();if(ai.type==="bool"){ah=ad.find("#"+aj).is(":checked")}ae=af.set_param_value(ai.key,ah)||ae}});if(ae){this.onchange();this.track.changed()}}});var b=function(ad,ah,af,ae,ag){this.track=ad;this.region=ah;this.low=ah.get("start");this.high=ah.get("end");this.resolution=af;this.html_elt=$("<div class='track-tile'/>").append(ae).height($(ae).attr("height"));this.data=ag;this.stale=false};b.prototype.predisplay_actions=function(){};var M=function(ad,ah,af,ae,ag){b.call(this,ad,ah,af,ae,ag)};M.prototype.predisplay_actions=function(){};var O=function(ag,ao,ah,af,aj,aq,ak,ar,ae,an){b.call(this,ag,ao,ah,af,aj);this.mode=ak;this.all_slotted=ae;this.feature_mapper=an;this.has_icons=false;if(ar){this.has_icons=true;var al=this;af=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:D-1,width:af.width}).prependTo(this.html_elt);var am=new w.GenomeRegion({chrom:ag.view.chrom,start:this.low,end:this.high}),ap=aj.length,ai=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ap+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ad=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ap+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ai.click(function(){al.stale=true;ag.data_manager.get_more_data(am,ag.mode,al.resolution,{},ag.data_manager.DEEP_DATA_REQ);$(".tooltip").hide();ag.request_draw()}).dblclick(function(at){at.stopPropagation()});ad.click(function(){al.stale=true;ag.data_manager.get_more_data(am,ag.mode,al.resolution,{},ag.data_manager.BROAD_DATA_REQ);$(".tooltip").hide();ag.request_draw()}).dblclick(function(at){at.stopPropagation()})}};o(O.prototype,b.prototype);O.prototype.predisplay_actions=function(){var ae=this,ad={};if(ae.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(ap){if(!this.hovered){return}var ak=$(this).offset(),ao=ap.pageX-ak.left,an=ap.pageY-ak.top,au=ae.feature_mapper.get_feature_data(ao,an),al=(au?au[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!al||$(this).attr("id")!==al.toString()){$(this).remove()}});if(au){var ag=ad[al];if(!ag){var al=au[0],aq={name:au[3],start:au[1],end:au[2],strand:au[4]},aj=ae.track.filters_manager.filters,ai;for(var am=0;am<aj.length;am++){ai=aj[am];aq[ai.name]=au[ai.index]}var ag=$("<div/>").attr("id",al).addClass("feature-popup"),av=$("<table/>"),at,ar,aw;for(at in aq){ar=aq[at];aw=$("<tr/>").appendTo(av);$("<th/>").appendTo(aw).text(at);$("<td/>").attr("align","left").appendTo(aw).text(typeof(ar)==="number"?V(ar,2):ar)}ag.append($("<div class='feature-popup-inner'>").append(av));ad[al]=ag}ag.appendTo($(this).parents(".track-content").children(".overlay"));var ah=ao+parseInt(ae.html_elt.css("left"))-ag.width()/2,af=an+parseInt(ae.html_elt.css("top"))+7;ag.css("left",ah+"px").css("top",af+"px")}else{if(!ap.isPropagationStopped()){ap.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ap)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var f=function(ae,ad,af){o(af,{drag_handle_class:"draghandle"});p.call(this,ae,ad,af);this.dataset=null;if(af.dataset){this.dataset=(af.dataset instanceof Backbone.Model?af.dataset:new X.Dataset(af.dataset))}this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in af?af.data_query_wait:K);this.data_manager=("data_manager" in af?af.data_manager:new w.GenomeDataManager({dataset:this.dataset,genome:new w.Genome({key:ae.dbkey,chroms_info:{chrom_info:ae.chrom_data}}),data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in af)||af.resize){this.add_resize_handle()}}};o(f.prototype,p.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},p.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ad){ad.view.set_overview(ad)}},p.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ad){if(ad.filters_manager.visible()){ad.filters_manager.clear_filters()}else{ad.filters_manager.init_filters()}ad.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ad){ad.tool.toggle();if(ad.tool.is_visible()){ad.set_name(ad.name+ad.tool_region_and_parameters_str())}else{ad.revert_name()}$(".tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ad){var ag='<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>',af=ac.template(ag,{track:ad});var ai=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(){var ak=$('select[name="regions"] option:selected').val(),am,aj=new w.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),al=ac.map($(".bookmark"),function(an){return new w.GenomeRegion({from_str:$(an).children(".position").text()})});if(ak==="cur"){am=[aj]}else{if(ak==="bookmarks"){am=al}else{am=[aj].concat(al)}}hide_modal();window.location.href=galaxy_config.root+"visualization/sweepster?"+$.param({dataset_id:ad.dataset.id,hda_ldda:ad.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(am).toJSON())})},ah=function(aj){if((aj.keyCode||aj.which)===27){ai()}else{if((aj.keyCode||aj.which)===13){ae()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",af,{No:ai,Yes:ae})}},p.prototype.action_icons_def[2]],can_draw:function(){return this.dataset&&p.prototype.can_draw.call(this)},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ad=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ad)}this.name_div=$("<div/>").addClass("track-name").appendTo(ad).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ad},set_dataset:function(ad){this.dataset=ad;this.data_manager.set("dataset",ad)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ad=this;var ag=false;var af=false;var ae=$("<div class='track-resize'>");$(ad.container_div).hover(function(){if(ad.content_visible){ag=true;ae.show()}},function(){ag=false;if(!af){ae.hide()}});ae.hide().bind("dragstart",function(ah,ai){af=true;ai.original_height=$(ad.content_div).height()}).bind("drag",function(ai,aj){var ah=Math.min(Math.max(aj.original_height+aj.deltaY,ad.min_height_px),ad.max_height_px);$(ad.tiles_div).css("height",ah);ad.visible_height_px=(ad.max_height_px===ah?0:ah);ad.on_resize()}).bind("dragend",function(ah,ai){ad.tile_cache.clear();af=false;if(!ag){ae.hide()}ad.config.values.height=ad.visible_height_px;ad.changed()}).appendTo(ad.container_div)},set_display_modes:function(ag,aj){this.display_modes=ag;this.mode=(aj?aj:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ae=this,ah={};for(var af=0,ad=ae.display_modes.length;af<ad;af++){var ai=ae.display_modes[af];ah[ai]=function(ak){return function(){ae.change_mode(ak);ae.icons_div.show();ae.container_div.mouseleave(function(){ae.icons_div.hide()})}}(ai)}make_popupmenu(this.action_icons.mode_icon,ah)},build_action_icons:function(){p.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof W){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof g){return"LineTrack"}else{if(this instanceof T){return"ReadTrack"}else{if(this instanceof Z){return"VariantTrack"}else{if(this instanceof e){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(af){var ae=this;ae.enabled=false;ae.tile_cache.clear();ae.data_manager.clear();ae.tiles_div.css("height","auto");ae.tiles_div.text("").children().remove();ae.container_div.removeClass("nodata error pending");if(!ae.dataset.id){return}var ad=$.Deferred(),ag={hda_ldda:ae.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:ae.view.chrom,retry:af};$.getJSON(this.dataset.url(),ag,function(ah){if(!ah||ah==="error"||ah.kind==="error"){ae.container_div.addClass("error");ae.tiles_div.text(m);if(ah.message){ae.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ah.message+"</pre>",{Close:hide_modal})}));ae.tiles_div.append($("<span/>").text(" "));ae.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ae.init(true)}))}}else{if(ah==="no converter"){ae.container_div.addClass("error");ae.tiles_div.text(J)}else{if(ah==="no data"||(ah.data!==undefined&&(ah.data===null||ah.data.length===0))){ae.container_div.addClass("nodata");ae.tiles_div.text(E)}else{if(ah==="pending"){ae.container_div.addClass("pending");ae.tiles_div.html(u);setTimeout(function(){ae.init()},ae.data_query_wait)}else{if(ah==="data"||ah.status==="data"){if(ah.valid_chroms){ae.valid_chroms=ah.valid_chroms;ae.update_icons()}ae.tiles_div.text(U);if(ae.view.chrom){ae.tiles_div.text("");ae.tiles_div.css("height",ae.visible_height_px+"px");ae.enabled=true;$.when.apply($,ae.predraw_init()).done(function(){ad.resolve();ae.container_div.removeClass("nodata error pending");ae.request_draw()})}else{ad.resolve()}}}}}}});this.update_icons();return ad},predraw_init:function(){var ad=this;return $.getJSON(ad.dataset.url(),{data_type:"data",stats:true,chrom:ad.view.chrom,low:0,high:ad.view.max_high,hda_ldda:ad.dataset.get("hda_ldda")},function(ae){ad.container_div.addClass("line-track");var ag=ae.data;if(ag&&ag.min&&ag.max){var af=ag.min,ah=ag.max;af=Math.floor(Math.min(0,Math.max(af,ag.mean-2*ag.sd)));ah=Math.ceil(Math.max(0,Math.min(ah,ag.mean+2*ag.sd)));ad.config.set_param_default_value("min_value",af);ad.config.set_param_default_value("max_value",ah);ad.prefs.min_value=af;ad.prefs.max_value=ah}})},get_drawables:function(){return this}});var N=function(af,ae,ah){f.call(this,af,ae,ah);var ad=this;k(ad.container_div,ad.drag_handle_class,".group",ad);this.filters_manager=new h.FiltersManager(this,("filters" in ah?ah.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=(ah.tool?new q(ac.extend(ah.tool,{track:this,tool_state:ah.tool_state})):null);this.tile_cache=new w.Cache(Q);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){var ag=new ab({model:this.tool});ag.render();this.dynamic_tool_div=ag.$el;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ah.mode){this.change_mode(ah.mode)}};o(N.prototype,p.prototype,f.prototype,{action_icons_def:f.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ad){$(".tooltip").remove();ad.slotters[ad.view.resolution_px_b].max_rows*=2;ad.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ad){var ae=this.to_dict();o(ae,{data_manager:this.data_manager});var af=new this.constructor(this.view,ad,ae);af.change_mode(this.mode);af.enabled=this.enabled;return af},set_filters_manager:function(ad){this.filters_manager=ad;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,dataset:{id:this.dataset.id,hda_ldda:this.dataset.get("hda_ldda")},prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},set_min_max:function(){var ad=this;return $.getJSON(ad.dataset.url(),{data_type:"data",stats:true,chrom:ad.view.chrom,low:0,high:ad.view.max_high,hda_ldda:ad.dataset.get("hda_ldda")},function(ae){var ag=ae.data;if(isNaN(parseFloat(ad.prefs.min_value))||isNaN(parseFloat(ad.prefs.max_value))){var af=ag.min,ah=ag.max;af=Math.floor(Math.min(0,Math.max(af,ag.mean-2*ag.sd)));ah=Math.ceil(Math.max(0,Math.min(ah,ag.mean+2*ag.sd)));ad.prefs.min_value=af;ad.prefs.max_value=ah}})},change_mode:function(ae){var ad=this;ad.mode=ae;ad.config.values.mode=ae;if(ae==="Auto"){this.data_manager.clear()}ad.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ad.mode+")");return ad},update_icons:function(){var ad=this;if(ad.filters_available){ad.action_icons.filters_icon.show()}else{ad.action_icons.filters_icon.hide()}if(ad.tool){ad.action_icons.tools_icon.show();ad.action_icons.param_space_viz_icon.show()}else{ad.action_icons.tools_icon.hide();ad.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ae,ad){return ae+"_"+ad},request_draw:function(ad){if(ad&&ad.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ad,this)},before_draw:function(){this.max_height_px=0},_draw:function(aq){if(!this.can_draw()){return}var an=aq&&aq.clear_after,al=this.view.low,ah=this.view.high,ak=ah-al,ae=this.view.container.width(),ap=this.view.resolution_px_b,ag=this.view.resolution_b_px;if(this.is_overview){al=this.view.max_low;ah=this.view.max_high;ag=(view.max_high-view.max_low)/ae;ap=1/ag}this.before_draw();this.tiles_div.children().addClass("remove");var ad=Math.floor(al/(ag*S)),am,ai,aj=[],ao=[];while((ad*S*ag)<ah){am=this._get_tile_bounds(ad,ag);ai=this.draw_helper(am,ag,ap,aq);aj.push(ai);$.when(ai).then(function(ar){ao.push(ar)});ad+=1}if(!an){this.tiles_div.children(".remove").removeClass("remove").remove()}var af=this;$.when.apply($,aj).then(function(){af.tiles_div.children(".remove").remove();ao=ac.filter(ao,function(ar){return ar!==null});if(ao.length!==0){af.postdraw_actions(ao,ae,ap,an)}})},_add_yaxis_label:function(ag,ai){var ae=this,ah=(ag==="max"?"top":"bottom"),aj=(ag==="max"?"max":"min"),ad=(ag==="max"?"max_value":"min_value"),ai=ai||function(){ae.request_draw({clear_tile_cache:true})},af=this.container_div.find(".yaxislabel."+ah);if(af.length!==0){af.text(ae.prefs[ad])}else{af=$("<div/>").text(ae.prefs[ad]).make_text_editable({num_cols:12,on_finish:function(ak){$(".tooltip").remove();ae.config.set_param_value(ad,ak);ai()},help_text:"Set "+aj+" value"}).addClass("yaxislabel "+ah).css("color",this.prefs.label_color);this.container_div.prepend(af)}},postdraw_actions:function(ag,ah,aj,ad){var af=ac.filter(ag,function(ak){return(ak instanceof M)});if(af.length>0){this.max_height_px=0;var ae=this;ac.each(ag,function(ak){if(!(ak instanceof M)){ak.html_elt.remove();ae.draw_helper(ak.region,ak.resolution,aj,{force:true,mode:"Coverage"})}});ae._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var ai=ac.find(ag,function(ak){return ak.has_icons});if(ai){ac.each(ag,function(ak){if(!ak.has_icons){ak.html_elt.css("padding-top",D)}})}}},get_mode:function(ad){return this.mode},update_auto_mode:function(ad){},_get_drawables:function(){return[this]},draw_helper:function(am,ag,ap,aq){if(!aq){aq={}}var ae=aq.force,ao=!(aq.data_fetch===false),aj=aq.mode||this.mode,af=this,ah=this._get_drawables(),an=this._gen_tile_cache_key(ap,am),ai=function(ar){return(ar&&"track" in ar)};var ak=(ae?undefined:af.tile_cache.get_elt(an));if(ak){if(ai(ak)){af.show_tile(ak,ap)}return ak}if(!ao){return null}var al=function(){var ar=(ac.find(A,function(au){return au===aj})?"Coverage":aj);var at=ac.map(ah,function(au){return au.data_manager.get_data(am,ar,ag,af.data_url_extra_params)});if(view.reference_track){at.push(view.reference_track.data_manager.get_data(am,aj,ag,view.reference_track.data_url_extra_params))}return at};var ad=$.Deferred();af.tile_cache.set_elt(an,ad);$.when.apply($,al()).then(function(){var ar=al(),ax=ar,aD;if(view.reference_track){aD=view.reference_track.data_manager.subset_entry(ar.pop(),am)}var ay=[],av=[];ac.each(ah,function(aI,aF){var aH=aI.mode,aG=ax[aF];if(aH==="Auto"){aH=aI.get_mode(aG);aI.update_auto_mode(aH)}ay.push(aH);av.push(aI.get_canvas_height(aG,aH,ap,at))});var aw=af.view.canvas_manager.new_canvas(),az=am.get("start"),aE=am.get("end"),au=0,at=Math.ceil((aE-az)*ap)+af.left_offset,aB=ac.max(av),aA;aw.width=at;aw.height=(aq.height||aB);var aC=aw.getContext("2d");aC.translate(af.left_offset,0);if(ah.length>1){aC.globalAlpha=0.5;aC.globalCompositeOperation="source-over"}ac.each(ah,function(aG,aF){aA=aG.draw_tile(ax[aF],aC,ay[aF],ag,am,ap,aD)});if(aA!==undefined){af.tile_cache.set_elt(an,aA);af.show_tile(aA,ap)}ad.resolve(aA)});return ad},get_canvas_height:function(ad,af,ag,ae){return this.visible_height_px},_draw_line_track_tile:function(ad,af,aj,ah,ai,ak){var ag=af.canvas,ae=new L.LinePainter(ad.data,ai.get("start"),ai.get("end"),this.prefs,aj);ae.draw(af,ag.width,ag.height,ak);return new M(this,ai,ah,ag,ad.data)},draw_tile:function(ad,ae,ai,ag,ah,aj,af){},show_tile:function(af,ai){var ae=this,ad=af.html_elt;af.predisplay_actions();var ah=(af.low-(this.is_overview?this.view.max_low:this.view.low))*ai;if(this.left_offset){ah-=this.left_offset}ad.css({position:"absolute",top:0,left:ah});if(ad.hasClass("remove")){ad.removeClass("remove")}else{this.tiles_div.append(ad)}af.html_elt.height("auto");this.max_height_px=Math.max(this.max_height_px,af.html_elt.height());af.html_elt.parent().children().css("height",this.max_height_px+"px");var ag=this.max_height_px;if(this.visible_height_px!==0){ag=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",ag+"px")},_get_tile_bounds:function(ad,ae){var ag=Math.floor(ad*S*ae),ah=Math.ceil(S*ae),af=(ag+ah<=this.view.max_high?ag+ah:this.view.max_high);return new w.GenomeRegion({chrom:this.view.chrom,start:ag,end:af})},tool_region_and_parameters_str:function(ag){var ad=this,af=(ag!==undefined?ag.toString():"all"),ae=ac.values(ad.tool.get_inputs_dict()).join(", ");return" - region=["+af+"], parameters=["+ae+"]"},data_and_mode_compatible:function(ad,ae){if(ae==="Auto"){return true}else{if(ae==="Coverage"){return ad.dataset_type==="bigwig"}else{if(ad.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ad){if(ad.dataset_type==="bigwig"||ad.message||ad.extra_info==="no_detail"){return false}return true},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state"}});var W=function(ae,ad){var af={resize:false};f.call(this,ae,ad,af);this.container_div.addClass("label-track")};o(W.prototype,f.prototype,{build_header_div:function(){},init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ah){var af=this.view,ag=af.high-af.low,ak=Math.floor(Math.pow(10,Math.floor(Math.log(ag)/Math.log(10)))),ad=Math.floor(af.low/ak)*ak,ai=this.view.container.width(),ae=$("<div style='position: relative; height: 1.3em;'></div>");while(ad<af.high){var aj=(ad-af.low)/ag*ai;ae.append($("<div class='label'>"+commatize(ad)+"</div>").css({position:"absolute",left:aj-1}));ad+=ak}this.content_div.children(":first").remove();this.content_div.append(ae)}});var e=function(ae,ad,ah){this.display_modes=A;N.call(this,ae,ad,ah);this.drawables=[];if("drawables" in ah){var ag;for(var af=0;af<ah.drawables.length;af++){ag=ah.drawables[af];this.drawables[af]=n(ag,ae,null);if(ag.left_offset>this.left_offset){this.left_offset=ag.left_offset}}this.enabled=true}ac.each(this.drawables,function(ai){if(ai instanceof c||ai instanceof T){ai.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};o(e.prototype,N.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ad){$(".tooltip").remove();ad.show_group()}}].concat(N.prototype.action_icons_def),to_dict:y.prototype.to_dict,add_drawable:y.prototype.add_drawable,unpack_drawables:y.prototype.unpack_drawables,change_mode:function(ad){N.prototype.change_mode.call(this,ad);for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae].change_mode(ad)}},init:function(){var af=[];for(var ae=0;ae<this.drawables.length;ae++){af.push(this.drawables[ae].init())}var ad=this;$.when.apply($,af).then(function(){ad.enabled=true;ad.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:p.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var ag=new P(this.view,this.container,{name:this.name}),ad;for(var af=0;af<this.drawables.length;af++){ad=this.drawables[af];ad.update_icons();ag.add_drawable(ad);ad.container=ag;ag.content_div.append(ad.container_div)}var ae=this.container.replace_drawable(this,ag,true);ag.request_draw({clear_tile_cache:true})},before_draw:function(){N.prototype.before_draw.call(this);var ae=ac.min(ac.map(this.drawables,function(af){return af.prefs.min_value})),ad=ac.max(ac.map(this.drawables,function(af){return af.prefs.max_value}));this.prefs.min_value=ae;this.prefs.max_value=ad;ac.each(this.drawables,function(af){af.prefs.min_value=ae;af.prefs.max_value=ad})},update_all_min_max:function(){var ad=this;ac.each(this.drawables,function(ae){ae.prefs.min_value=ad.prefs.min_value;ae.prefs.max_value=ad.prefs.max_value});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(aj,ad,am,ai){N.prototype.postdraw_actions.call(this,aj,ad,am,ai);var ah=-1;for(var af=0;af<aj.length;af++){var ak=aj[af].html_elt.find("canvas").height();if(ak>ah){ah=ak}}for(var af=0;af<aj.length;af++){var ag=aj[af];if(ag.html_elt.find("canvas").height()!==ah){this.draw_helper(ag.region,ag.resolution,am,{force:true,height:ah});ag.html_elt.remove()}}var ae=this,al=function(){ae.update_all_min_max()};this._add_yaxis_label("min",al);this._add_yaxis_label("max",al)}});var B=function(ad){N.call(this,ad,{content_div:ad.top_labeltrack},{resize:false});ad.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=galaxy_config.root+"api/genomes//"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new w.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};o(B.prototype,p.prototype,N.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:p.prototype.can_draw,draw_helper:function(af,ae,ag,ad){if(ag>this.view.canvas_manager.char_width_px){this.tiles_div.show();return N.prototype.draw_helper.call(this,af,ae,ag,ad)}else{this.tiles_div.hide();return null}},can_subset:function(ad){return true},draw_tile:function(ag,am,ah,ae,aj,an){var af=this.data_manager.subset_entry(ag,aj),al=af.data;var ad=am.canvas;am.font=am.canvas.manager.default_font;am.textAlign="center";for(var ai=0,ak=al.length;ai<ak;ai++){am.fillStyle=this.view.get_base_color(al[ai]);am.fillText(al[ai],Math.floor(ai*an),10)}return new b(this,aj,ae,ad,af)}});var g=function(af,ae,ag){var ad=this;this.display_modes=A;this.mode="Histogram";N.call(this,af,ae,ag);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:j.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:ag.prefs,onchange:function(){ad.set_name(ad.prefs.name);ad.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};o(g.prototype,p.prototype,N.prototype,{before_draw:function(){},draw_tile:function(ad,ae,ah,af,ag,ai){return this._draw_line_track_tile(ad,ae,ah,af,ag,ai)},can_subset:function(ad){return(ad.data[1][0]-ad.data[0][0]===1)},postdraw_actions:function(ae,af,ag,ad){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var r=function(af,ae,ag){var ad=this;this.display_modes=["Heatmap"];this.mode="Heatmap";N.call(this,af,ae,ag);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:ag.prefs,onchange:function(){ad.set_name(ad.prefs.name);this.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};o(r.prototype,p.prototype,N.prototype,{draw_tile:function(ad,af,aj,ah,ai,ak){var ag=af.canvas,ae=new L.DiagonalHeatmapPainter(ad.data,ai.get("start"),ai.get("end"),this.prefs,aj);ae.draw(af,ag.width,ag.height,ak);return new b(this,ai,ah,ag,ad.data)}});var c=function(ag,af,ai){var ae=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ag,af,ai);var ah=j.get_random_color(),ad=j.get_random_color([ah,"#FFFFFF"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ah},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ad},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ai.prefs,onchange:function(){ae.set_name(ae.prefs.name);ae.set_painter_from_config();ae.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};o(c.prototype,p.prototype,N.prototype,{set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},postdraw_actions:function(an,af,ao,am){N.prototype.postdraw_actions.call(this,an,af,ao,am);var ah=this,ai;if(ah.filters_manager){var ag=ah.filters_manager.filters;for(var ak=0;ak<ag.length;ak++){ag[ak].update_ui_elt()}var aj=false,al,ae;for(ai=0;ai<an.length;ai++){if(an[ai].data.length){al=an[ai].data[0];for(var ak=0;ak<ag.length;ak++){ae=ag[ak];if(ae.applies_to(al)&&ae.min!==ae.max){aj=true;break}}}}if(ah.filters_available!==aj){ah.filters_available=aj;if(!ah.filters_available){ah.filters_manager.hide()}ah.update_icons()}}if(an[0] instanceof O){var ad=true;for(ai=0;ai<an.length;ai++){if(!an[ai].all_slotted){ad=false;break}}if(!ad){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ad){var ad;if(this.mode==="Auto"){if(ad==="no_detail"){ad="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ad+")")}},incremental_slots:function(ah,ad,ag){var ae=this.view.canvas_manager.dummy_context,af=this.slotters[ah];if(!af||(af.mode!==ag)){af=new (s.FeatureSlotter)(ah,ag,z,function(ai){return ae.measureText(ai)});this.slotters[ah]=af}return af.slot_features(ad)},get_mode:function(ad){if(ad.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>I){mode="Squish"}else{mode="Pack"}}return mode},get_canvas_height:function(ad,ah,ai,ae){if(ah==="Coverage"||ad.dataset_type==="bigwig"){return this.summary_draw_height}else{var ag=this.incremental_slots(ai,ad.data,ah);var af=new (this.painter)(null,null,null,this.prefs,ah);return Math.max(aa,af.get_required_height(ag,ae))}},draw_tile:function(an,ar,ap,at,ag,ak,af){var aq=this,ae=ar.canvas,az=ag.get("start"),ad=ag.get("end"),ah=this.left_offset;if(an.dataset_type==="bigwig"){return this._draw_line_track_tile(an,ar,ap,at,ag,ak)}var aj=[],ao=this.slotters[ak].slots;all_slotted=true;if(an.data){var al=this.filters_manager.filters;for(var au=0,aw=an.data.length;au<aw;au++){var ai=an.data[au];var av=false;var am;for(var ay=0,aD=al.length;ay<aD;ay++){am=al[ay];am.update_attrs(ai);if(!am.keep(ai)){av=true;break}}if(!av){aj.push(ai);if(!(ai[0] in ao)){all_slotted=false}}}}var aC=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null),aA=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null),aB=new (this.painter)(aj,az,ad,this.prefs,ap,aC,aA,af,function(aE){return aq.view.get_base_color(aE)});var ax=null;ar.fillStyle=this.prefs.block_color;ar.font=ar.canvas.manager.default_font;ar.textAlign="right";if(an.data){ax=aB.draw(ar,ae.width,ae.height,ak,ao);ax.translation=-ah}return new O(aq,ag,at,ae,an.data,ak,ap,an.message,all_slotted,ax)}});var Z=function(ae,ad,af){this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ae,ad,af);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Histogram color",type:"color",default_value:j.get_random_color()},{key:"show_sample_data",label:"Show sample data",type:"bool",default_value:true},{key:"show_labels",label:"Show summary and sample labels",type:"bool",default_value:true},{key:"summary_height",label:"Locus summary height",type:"float",default_value:20},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:af.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=L.VariantPainter;this.summary_draw_height=30;this.left_offset=30};o(Z.prototype,p.prototype,N.prototype,{draw_tile:function(ad,ag,aj,ah,ai,ak){if(ad.dataset_type==="bigwig"){return this._draw_line_track_tile(ad,ag,"Histogram",ah,ai,ak)}else{var af=this.view,ae=new (this.painter)(ad.data,ai.get("start"),ai.get("end"),this.prefs,aj,function(al){return af.get_base_color(al)});ae.draw(ag,ag.canvas.width,ag.canvas.height,ak);return new b(this,ai,ah,ag.canvas,ad.data)}},get_canvas_height:function(ad,ah,ai,af){if(ad.dataset_type==="bigwig"){return this.summary_draw_height}else{var ag=new (this.painter)(null,null,null,this.prefs,ah);var ae=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(ae===0&&ad.data.length!==0){ae=ad.data[0][7].match(/,/g);if(ae===null){ae=1}else{ae=ae.length+1}}return ag.get_required_height(ae)}},predraw_init:function(){var ad=[f.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ad.push(this.dataset.fetch())}return ad},postdraw_actions:function(ag,ah,aj,ae){N.prototype.postdraw_actions.call(this,ag,ah,aj,ae);var af=ac.filter(ag,function(ak){return(ak instanceof M)});if(af.length===0&&this.prefs.show_labels){var ad;if(this.container_div.find(".yaxislabel.variant").length===0){ad=this.prefs.summary_height/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ad+"px",top:(this.prefs.summary_height-ad)/2+"px"}));if(this.prefs.show_sample_data){var ai=this.dataset.get("metadata").get("sample_names").join("<br/>");this.tiles_div.prepend($("<div/>").html(ai).addClass("yaxislabel variant top sample").css({top:this.prefs.summary_height+2,}))}}ad=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ad,"line-height":ad});$(this.tiles_div).find(".yaxislabel").css("color",this.prefs.label_color)}else{this.container_div.find(".yaxislabel.variant").remove()}}});var T=function(af,ae,ah){c.call(this,af,ae,ah);var ag=j.get_random_color(),ad=j.get_random_color([ag,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:ag},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ad},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{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:"mode",type:"string",default_value:this.mode,hidden:true},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"}],saved_values:ah.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=(af.reference_track?L.RefBasedReadPainter:L.ReadPainter);this.update_icons()};o(T.prototype,p.prototype,N.prototype,c.prototype);var d={CompositeTrack:e,DrawableGroup:P,DiagonalHeatmapTrack:r,FeatureTrack:c,LineTrack:g,ReadTrack:T,VariantTrack:Z,VcfTrack:Z};var n=function(af,ae,ad){if("copy" in af){return af.copy(ad)}else{var ag=af.obj_type;if(!ag){ag=af.track_type}return new d[ag](ae,ad,af)}};return{TracksterView:Y,DrawableGroup:P,LineTrack:g,FeatureTrack:c,DiagonalHeatmapTrack:r,ReadTrack:T,VariantTrack:Z,CompositeTrack:e,object_from_template:n}});
\ No newline at end of file
+define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","viz/trackster/filters","mvc/data","mvc/tools"],function(ac,w,j,s,L,h,X,R){var o=ac.extend;var l={};var i=function(ad,ae){l[ad.attr("id")]=ae};var k=function(ad,af,ah,ag){ah=".group";var ae={};l[ad.attr("id")]=ag;ad.bind("drag",{handle:"."+af,relative:true},function(ap,aq){var ao=$(this),au=$(this).parent(),al=au.children(),an=l[$(this).attr("id")],ak,aj,ar,ai,am;aj=$(this).parents(ah);if(aj.length!==0){ar=aj.position().top;ai=ar+aj.outerHeight();if(aq.offsetY<ar){$(this).insertBefore(aj);var at=l[aj.attr("id")];at.remove_drawable(an);at.container.add_drawable_before(an,at);return}else{if(aq.offsetY>ai){$(this).insertAfter(aj);var at=l[aj.attr("id")];at.remove_drawable(an);at.container.add_drawable(an);return}}}aj=null;for(am=0;am<al.length;am++){ak=$(al.get(am));ar=ak.position().top;ai=ar+ak.outerHeight();if(ak.is(ah)&&this!==ak.get(0)&&aq.offsetY>=ar&&aq.offsetY<=ai){if(aq.offsetY-ar<ai-aq.offsetY){ak.find(".content-div").prepend(this)}else{ak.find(".content-div").append(this)}if(an.container){an.container.remove_drawable(an)}l[ak.attr("id")].add_drawable(an);return}}for(am=0;am<al.length;am++){ak=$(al.get(am));if(aq.offsetY<ak.position().top&&!(ak.hasClass("reference-track")||ak.hasClass("intro"))){break}}if(am===al.length){if(this!==al.get(am-1)){au.append(this);l[au.attr("id")].move_drawable(an,am)}}else{if(this!==al.get(am)){$(this).insertBefore(al.get(am));l[au.attr("id")].move_drawable(an,(aq.deltaY>0?am-1:am))}}}).bind("dragstart",function(){ae["border-top"]=ad.css("border-top");ae["border-bottom"]=ad.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ae)})};var aa=16,G=9,D=20,z=100,I=12000,S=400,K=5000,v=100,m="Cannot display dataset due to an error. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",u="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",x="Tool cannot be rerun: ",a="Loading data...",U="Ready for display",Q=10,H=20,A=["Histogram","Line","Filled","Intensity"];function V(ae,ad){if(!ad){ad=0}var af=Math.pow(10,ad);return Math.round(ae*af)/af}var p=function(ae,ad,ag){if(!p.id_counter){p.id_counter=0}this.id=p.id_counter++;this.name=ag.name;this.view=ae;this.container=ad;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=ag.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ah){ah.stopPropagation()});var af=this;this.container_div.hover(function(){af.icons_div.show()},function(){af.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};p.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ad){if(ad.content_visible){ad.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ad.hide_contents();ad.content_visible=false}else{ad.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ad.content_visible=true;ad.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ae){var ag=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ad=function(){ae.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},af=function(ah){if((ah.keyCode||ah.which)===27){ag()}else{if((ah.keyCode||ah.which)===13){ad()}}};$(window).bind("keypress.check_enter_esc",af);show_modal("Configure",ae.config.build_form(),{Cancel:ag,OK:ad})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ad){$(".tooltip").remove();ad.remove()}}];o(p.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(ad){},to_dict:function(){},set_name:function(ad){this.old_name=this.name;this.name=ad;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ad=this.view;this.container_div.hide(0,function(){$(this).remove();ad.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ae,aj,ai,ah,ad,ag){var af=this;this.action_icons[ae]=$("<a/>").attr("href","javascript:void(0);").attr("title",aj).addClass("icon-button").addClass(ai).tooltip().click(function(){ah(af)}).appendTo(this.icons_div);if(ag){this.action_icons[ae].hide()}},build_action_icons:function(ad){var af;for(var ae=0;ae<ad.length;ae++){af=ad[ae];this.add_action_icon(af.name,af.title,af.css_class,af.on_click_fn,af.prepend,af.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var y=function(ae,ad,af){p.call(this,ae,ad,af);this.obj_type=af.obj_type;this.drawables=[]};o(y.prototype,p.prototype,{unpack_drawables:function(af){this.drawables=[];var ae;for(var ad=0;ad<af.length;ad++){ae=n(af[ad],this.view,this);this.add_drawable(ae)}},init:function(){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].init()}},_draw:function(ad){for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae]._draw(ad)}},to_dict:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ae}},add_drawable:function(ad){this.drawables.push(ad);ad.container=this;this.changed()},add_drawable_before:function(af,ad){this.changed();var ae=this.drawables.indexOf(ad);if(ae!==-1){this.drawables.splice(ae,0,af);return true}return false},replace_drawable:function(af,ad,ae){var ag=this.drawables.indexOf(af);if(ag!==-1){this.drawables[ag]=ad;if(ae){af.container_div.replaceWith(ad.container_div)}this.changed()}return ag},remove_drawable:function(ae){var ad=this.drawables.indexOf(ae);if(ad!==-1){this.drawables.splice(ad,1);ae.container=null;this.changed();return true}return false},move_drawable:function(ae,af){var ad=this.drawables.indexOf(ae);if(ad!==-1){this.drawables.splice(ad,1);this.drawables.splice(af,0,ae);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(ag){var ad=this.drawables.slice(0),ae=[],af;while(ad.length!==0){af=ad.shift();if(af instanceof ag){ae.push(af)}else{if(af.drawables){ad=ad.concat(af.drawables)}}}return ae}});var P=function(ae,ad,ag){o(ag,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});y.call(this,ae,ad,ag);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);i(this.container_div,this);i(this.content_div,this);k(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new h.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in ag){this.unpack_drawables(ag.drawables)}if("filters" in ag){var af=this.filters_manager;this.filters_manager=new h.FiltersManager(this,ag.filters);af.parent_div.replaceWith(this.filters_manager.parent_div);if(ag.filters.visible){this.setup_multitrack_filtering()}}};o(P.prototype,p.prototype,y.prototype,{action_icons_def:[p.prototype.action_icons_def[0],p.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ad){$(".tooltip").remove();ad.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ad){if(ad.filters_manager.visible()){ad.filters_manager.clear_filters();ad._restore_filter_managers()}else{ad.setup_multitrack_filtering();ad.request_draw({clear_tile_cache:true})}ad.filters_manager.toggle()}},p.prototype.action_icons_def[2]],build_container_div:function(){var ad=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ad)}return ad},build_header_div:function(){var ad=$("<div/>").addClass("track-header");ad.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ad);return ad},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var af=this.drawables.length;if(af===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(af===1){if(this.drawables[0] instanceof e){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var am,al,aj,ap=true,ah=this.drawables[0].get_type(),ad=0;for(am=0;am<af;am++){aj=this.drawables[am];if(aj.get_type()!==ah){can_composite=false;break}if(aj instanceof c){ad++}}if(ap||ad===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tooltip").remove()}if(ad>1&&ad===this.drawables.length){var aq={},ae;aj=this.drawables[0];for(al=0;al<aj.filters_manager.filters.length;al++){ae=aj.filters_manager.filters[al];aq[ae.name]=[ae]}for(am=1;am<this.drawables.length;am++){aj=this.drawables[am];for(al=0;al<aj.filters_manager.filters.length;al++){ae=aj.filters_manager.filters[al];if(ae.name in aq){aq[ae.name].push(ae)}}}this.filters_manager.remove_all();var ag,ai,ak,an;for(var ao in aq){ag=aq[ao];if(ag.length===ad){ai=new h.NumberFilter({name:ag[0].name,index:ag[0].index});this.filters_manager.add_filter(ai)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].filters_manager=this.saved_filters_managers[ad]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ad=0;ad<this.drawables.length;ad++){drawable=this.drawables[ad];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ae=new e(this.view,this.view,{name:this.name,drawables:this.drawables});var ad=this.container.replace_drawable(this,ae,true);ae.request_draw()},add_drawable:function(ad){y.prototype.add_drawable.call(this,ad);this.update_icons()},remove_drawable:function(ad){y.prototype.remove_drawable.call(this,ad);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ad=o(y.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ad},request_draw:function(ad){ac.each(this.drawables,function(ae){ae.request_draw(ad)})}});var Y=Backbone.View.extend({initialize:function(ad){o(ad,{obj_type:"View"});y.call(this,"View",ad.container,ad);this.chrom=null;this.vis_id=ad.vis_id;this.dbkey=ad.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new w.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=new F({track:this,params:[{key:"a_color",label:"A Color",type:"color",default_value:"#FF0000"},{key:"c_color",label:"C Color",type:"color",default_value:"#00FF00"},{key:"g_color",label:"G Color",type:"color",default_value:"#0000FF"},{key:"t_color",label:"T Color",type:"color",default_value:"#FF00FF"},{key:"n_color",label:"N Color",type:"color",default_value:"#AAAAAA"}],saved_values:ad.prefs,onchange:function(){track.request_redraw({clear_tile_cache:true})}})},render:function(){this.requested_redraw=false;var af=this.container,ad=this;this.top_container=$("<div/>").addClass("top-container").appendTo(af);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(af);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(af);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;i(this.viewport_container,ad);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var ag=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){w.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",{"f-dbkey":ad.dbkey},function(ah){ac.each(ah,function(ai){ad.add_drawable(n(ai,ad,ad))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ae=function(ah){if(ah.type==="focusout"||(ah.keyCode||ah.which)===13||(ah.keyCode||ah.which)===27){if((ah.keyCode||ah.which)!==27){ad.go_to($(this).val())}$(this).hide();$(this).val("");ad.location_span.show();ad.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ae).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ad.location_span.hide();ad.chrom_select.hide();ad.nav_input.val(ad.chrom+":"+ad.low+"-"+ad.high);ad.nav_input.css("display","inline-block");ad.nav_input.select();ad.nav_input.focus();ad.nav_input.autocomplete({source:function(aj,ah){var ak=[],ai=$.map(ad.get_tracks(c),function(al){return al.data_manager.search_features(aj.term).success(function(am){ak=ak.concat(am)})});$.when.apply($,ai).done(function(){ah($.map(ak,function(al){return{label:al[0],value:al[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ad.zoom_out();ad.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ad.zoom_in();ad.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ad.change_chrom(ad.chrom_select.val())});this.browser_content_div.click(function(ah){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ah){ad.zoom_in(ah.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ah,ai){this.current_x=ai.offsetX}).bind("drag",function(ah,aj){var ak=aj.offsetX-this.current_x;this.current_x=aj.offsetX;var ai=Math.round(ak/ad.viewport_container.width()*(ad.max_high-ad.max_low));ad.move_delta(-ai)});this.overview_close.click(function(){ad.reset_overview()});this.viewport_container.bind("draginit",function(ah,ai){if(ah.clientX>ad.viewport_container.width()-16){return false}}).bind("dragstart",function(ah,ai){ai.original_low=ad.low;ai.current_height=ah.clientY;ai.current_x=ai.offsetX}).bind("drag",function(aj,al){var ah=$(this);var am=al.offsetX-al.current_x;var ai=ah.scrollTop()-(aj.clientY-al.current_height);ah.scrollTop(ai);al.current_height=aj.clientY;al.current_x=al.offsetX;var ak=Math.round(am/ad.viewport_container.width()*(ad.high-ad.low));ad.move_delta(ak)}).bind("mousewheel",function(aj,al,ai,ah){if(ai){ai*=50;var ak=Math.round(-ai/ad.viewport_container.width()*(ad.high-ad.low));ad.move_delta(ak)}});this.top_labeltrack.bind("dragstart",function(ah,ai){return $("<div />").css({height:ad.browser_content_div.height()+ad.top_labeltrack.height()+ad.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(al,am){$(am.proxy).css({left:Math.min(al.pageX,am.startX)-ad.container.offset().left,width:Math.abs(al.pageX-am.startX)});var ai=Math.min(al.pageX,am.startX)-ad.container.offset().left,ah=Math.max(al.pageX,am.startX)-ad.container.offset().left,ak=(ad.high-ad.low),aj=ad.viewport_container.width();ad.update_location(Math.round(ai/aj*ak)+ad.low,Math.round(ah/aj*ak)+ad.low)}).bind("dragend",function(am,an){var ai=Math.min(am.pageX,an.startX),ah=Math.max(am.pageX,an.startX),ak=(ad.high-ad.low),aj=ad.viewport_container.width(),al=ad.low;ad.low=Math.round(ai/aj*ak)+al;ad.high=Math.round(ah/aj*ak)+al;$(an.proxy).remove();ad.request_redraw()});this.add_label_track(new W(this,{content_div:this.top_labeltrack}));this.add_label_track(new W(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ad.resize_window()},500)});$(document).bind("redraw",function(){ad.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ad){return this.config.values[ad.toLowerCase()+"_color"]||this.config.values.n_color}});o(Y.prototype,y.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(ae,ag,ad,ah){if(this.timer){clearTimeout(this.timer)}if(ah){var af=this;this.timer=setTimeout(function(){af.trigger("navigate",ae+":"+ag+"-"+ad)},500)}else{view.trigger("navigate",ae+":"+ag+"-"+ad)}},update_location:function(ad,af){this.location_span.text(commatize(ad)+" - "+commatize(af));this.nav_input.val(this.chrom+":"+commatize(ad)+"-"+commatize(af));var ae=view.chrom_select.val();if(ae!==""){this.trigger_navigate(ae,view.low,view.high,true)}},load_chroms:function(af){af.num=v;var ad=this,ae=$.Deferred();$.ajax({url:galaxy_config.root+"api/genomes/"+this.dbkey,data:af,dataType:"json",success:function(ah){if(ah.chrom_info.length===0){return}if(ah.reference){ad.add_label_track(new B(ad))}ad.chrom_data=ah.chrom_info;var ak='<option value="">Select Chrom/Contig</option>';for(var aj=0,ag=ad.chrom_data.length;aj<ag;aj++){var ai=ad.chrom_data[aj].chrom;ak+='<option value="'+ai+'">'+ai+"</option>"}if(ah.prev_chroms){ak+='<option value="previous">Previous '+v+"</option>"}if(ah.next_chroms){ak+='<option value="next">Next '+v+"</option>"}ad.chrom_select.html(ak);ad.chrom_start_index=ah.start_index;ae.resolve(ah.chrom_info)},error:function(){alert("Could not load chroms for this dbkey:",ad.dbkey)}});return ae},change_chrom:function(ai,ae,ak){var af=this;if(!af.chrom_data){af.load_chroms_deferred.then(function(){af.change_chrom(ai,ae,ak)});return}if(!ai||ai==="None"){return}if(ai==="previous"){af.load_chroms({low:this.chrom_start_index-v});return}if(ai==="next"){af.load_chroms({low:this.chrom_start_index+v});return}var aj=$.grep(af.chrom_data,function(al,am){return al.chrom===ai})[0];if(aj===undefined){af.load_chroms({chrom:ai},function(){af.change_chrom(ai,ae,ak)});return}else{if(ai!==af.chrom){af.chrom=ai;af.chrom_select.val(af.chrom);af.max_high=aj.len-1;af.reset();for(var ah=0,ad=af.drawables.length;ah<ad;ah++){var ag=af.drawables[ah];if(ag.init){ag.init()}}if(af.reference_track){af.reference_track.init()}}if(ae&&ak){af.low=Math.max(ae,0);af.high=Math.min(ak,af.max_high)}else{af.low=0;af.high=af.max_high}af.reset_overview();af.request_redraw()}},go_to:function(ah){ah=ah.replace(/,/g,"");ah=ah.replace(/:|\-/g," ");var ae=ah.split(/\s+/),ag=ae[0],af=(ae[1]?parseInt(ae[1],10):null),ad=(ae[2]?parseInt(ae[2],10):null);if(!ad){af=af-15;ad=af+15}this.change_chrom(ag,af,ad)},move_fraction:function(af){var ad=this;var ae=ad.high-ad.low;this.move_delta(af*ae)},move_delta:function(ag){var ad=this;var af=ad.high-ad.low;if(ad.low-ag<ad.max_low){ad.low=ad.max_low;ad.high=ad.max_low+af}else{if(ad.high-ag>ad.max_high){ad.high=ad.max_high;ad.low=ad.max_high-af}else{ad.high-=ag;ad.low-=ag}}ad.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ad.request_redraw()},200);var ae=ad.chrom_select.val();this.trigger_navigate(ae,ad.low,ad.high,true)},add_drawable:function(ad){y.prototype.add_drawable.call(this,ad);ad.init();this.changed();this.update_intro_div()},add_label_track:function(ad){ad.view=this;ad.init();this.label_tracks.push(ad)},remove_drawable:function(af,ae){y.prototype.remove_drawable.call(this,af);if(ae){var ad=this;af.container_div.hide(0,function(){$(this).remove();ad.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ae,af){var ad=this,ag=(af?[af]:ad.drawables);ac.each(ag,function(ah){var ai=ac.find(ad.tracks_to_be_redrawn,function(aj){return aj[0]===ah});if(ai){ai[1]=ae}else{ad.tracks_to_be_redrawn.push([ah,ae])}});if(!this.requested_redraw){requestAnimationFrame(function(){ad._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ad=this.low,ah=this.high;if(ad<this.max_low){ad=this.max_low}if(ah>this.max_high){ah=this.max_high}var ae=this.high-this.low;if(this.high!==0&&ae<this.min_separation){ah=ad+this.min_separation}this.low=Math.floor(ad);this.high=Math.ceil(ah);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=1/this.resolution_b_px;var ag=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ai=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var af=13;this.overview_box.css({left:ag,width:Math.max(af,ai)}).show();if(ai<af){this.overview_box.css("left",ag-(af-ai)/2)}if(this.overview_highlight){this.overview_highlight.css({left:ag,width:ai})}ac.each(this.tracks_to_be_redrawn,function(al){var aj=al[0],ak=al[1];if(aj){aj._draw(ak)}});this.tracks_to_be_redrawn=[];ac.each(this.label_tracks,function(aj){aj._draw()})},zoom_in:function(ae,af){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var ag=this.high-this.low,ah=ag/2+this.low,ad=(ag/this.zoom_factor)/2;if(ae){ah=ae/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ah-ad);this.high=Math.round(ah+ad);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ae=this.high-this.low,af=ae/2+this.low,ad=(ae*this.zoom_factor)/2;this.low=Math.round(af-ad);this.high=Math.round(af+ad);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(af){if(this.overview_drawable){if(this.overview_drawable.dataset.id===af.dataset.id){return}this.overview_viewport.find(".track").remove()}var ae=af.copy({content_div:this.overview_viewport}),ad=this;ae.header_div.hide();ae.is_overview=true;ad.overview_drawable=ae;this.overview_drawable.postdraw_actions=function(){ad.overview_highlight.show().height(ad.overview_drawable.content_div.height());ad.overview_viewport.height(ad.overview_drawable.content_div.height()+ad.overview_box.outerHeight());ad.overview_close.show();ad.resize_window()};ad.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var q=R.Tool.extend({defaults:{track:null},initialize:function(ad){if(ad.tool_state!==undefined){this.set("hidden",ad.tool_state.hidden)}this.remove_inputs(["data","hidden_data","conditional"])},state_dict:function(ad){return ac.extend(this.get_inputs_dict(),{hidden:!this.is_visible()})}});var t=Backbone.View.extend({events:{"change input":"update_value"},render:function(){var af=this.$el.addClass("param-row"),ag=this.model;var ad=$("<div>").addClass("param-label").text(ag.get("label")).appendTo(af);var ae=$("<div/>").addClass("param-input").html(ag.get("html")).appendTo(af);ae.find(":input").val(ag.get("value"));$("<div style='clear: both;'/>").appendTo(af)},update_value:function(ad){this.model.set_value($(ad.target).val())}});var ab=Backbone.View.extend({initialize:function(ad){this.model.on("change:hidden",this.set_visible,this)},render:function(){var ae=this;tool=this.model,parent_div=this.$el.addClass("dynamic-tool").hide();parent_div.bind("drag",function(ai){ai.stopPropagation()}).click(function(ai){ai.stopPropagation()}).bind("dblclick",function(ai){ai.stopPropagation()}).keydown(function(ai){ai.stopPropagation()});var af=$("<div class='tool-name'>").appendTo(parent_div).text(tool.get("name"));tool.get("inputs").each(function(aj){var ai=new t({model:aj});ai.render();parent_div.append(ai.$el)});parent_div.find("input").click(function(){$(this).select()});var ag=$("<div>").addClass("param-row").appendTo(parent_div);var ah=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(ag);var ad=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(ag);ad.click(function(){ae.run_on_region()});ah.click(function(){ae.run_on_dataset()});if(tool.is_visible()){this.$el.show()}},set_visible:function(){if(this.model.is_visible()){this.$el.show()}else{this.$el.hide()}},update_params:function(){for(var ad=0;ad<this.params.length;ad++){this.params[ad].update_value()}},run_on_dataset:function(){var ad=this.model;this.run({target_dataset_id:this.model.get("track").dataset.id,action:"rerun",tool_id:ad.id},null,function(ae){show_modal(ad.get("name")+" is Running",ad.get("name")+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ae=this.model.get("track"),ah=this.model,aj=new w.GenomeRegion({chrom:ae.view.chrom,start:ae.view.low,end:ae.view.high}),ak={target_dataset_id:ae.dataset.id,action:"rerun",tool_id:ah.id,regions:[aj.toJSON()]},ai=ae,am=ak.tool_id+ai.tool_region_and_parameters_str(aj),ad;if(ai.container===view){var al=new P(view,view,{name:this.name});var ag=ai.container.replace_drawable(ai,al,false);al.container_div.insertBefore(ai.view.content_div.children()[ag]);al.add_drawable(ai);ai.container_div.appendTo(al.content_div);ad=al}else{ad=ai.container}var af=new ai.constructor(view,ad,{name:am,hda_ldda:"hda"});af.init_for_tool_data();af.change_mode(ai.mode);af.set_filters_manager(ai.filters_manager.copy(af));af.update_icons();ad.add_drawable(af);af.tiles_div.text("Starting job.");this.run(ak,af,function(an){af.set_dataset(new X.Dataset(an));af.tiles_div.text("Running job.");af.init()})},run:function(ad,af,ag){ad.inputs=this.model.get_inputs_dict();var ae=new j.ServerStateDeferred({ajax_settings:{url:galaxy_config.root+"api/tools",data:JSON.stringify(ad),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ah){return ah!=="pending"}});$.when(ae.go()).then(function(ah){if(ah==="no converter"){af.container_div.addClass("error");af.content_div.text(J)}else{if(ah.error){af.container_div.addClass("error");af.content_div.text(x+ah.message)}else{ag(ah)}}})}});var C=function(ad,ae){L.Scaler.call(this,ae);this.filter=ad};C.prototype.gen_val=function(ad){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ad[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var F=function(ad){this.track=ad.track;this.params=ad.params;this.values={};this.restore_values((ad.saved_values?ad.saved_values:{}));this.onchange=ad.onchange};o(F.prototype,{set_param_default_value:function(ae,ad){var af=ac.find(this.params,function(ag){return ag.key===ae});if(af){af.default_value=ad}},set_param_value:function(ad,ae){var af=ac.find(this.params,function(ag){return ag.key===ad});if(af){if(typeof ae==="string"||ae instanceof String){if(ae.trim()===""){ae=af.default_value}else{if(af.type==="float"){ae=parseFloat(ae)}else{if(af.type==="int"){ae=parseInt(ae,10)}}}}}if(this.values[ad]!==ae){this.values[ad]=ae;return true}else{return false}},restore_values:function(ad){var ae=this;$.each(this.params,function(af,ag){if(ad[ag.key]!==undefined){ae.values[ag.key]=ad[ag.key]}else{ae.values[ag.key]=ag.default_value}})},build_form:function(){var ag=this;var ad=$("<div />");var af;function ae(al,ah){for(var ap=0;ap<al.length;ap++){af=al[ap];if(af.hidden){continue}var aj="param_"+ap;var au=ag.values[af.key];var aw=$("<div class='form-row' />").appendTo(ah);aw.append($("<label />").attr("for",aj).text(af.label+":"));if(af.type==="bool"){aw.append($('<input type="checkbox" />').attr("id",aj).attr("name",aj).attr("checked",au))}else{if(af.type==="text"){aw.append($('<input type="text"/>').attr("id",aj).val(au).click(function(){$(this).select()}))}else{if(af.type==="select"){var ar=$("<select />").attr("id",aj);for(var an=0;an<af.options.length;an++){$("<option/>").text(af.options[an].label).attr("value",af.options[an].value).appendTo(ar)}ar.val(au);aw.append(ar)}else{if(af.type==="color"){var av=$("<div/>").appendTo(aw),aq=$("<input />").attr("id",aj).attr("name",aj).val(au).css("float","left").appendTo(av).click(function(ay){$(".tooltip").removeClass("in");var ax=$(this).siblings(".tooltip").addClass("in");ax.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(ax).height()/2)+($(this).height()/2)}).show();ax.click(function(az){az.stopPropagation()});$(document).bind("click.color-picker",function(){ax.hide();$(document).unbind("click.color-picker")});ay.stopPropagation()}),ao=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(av).attr("title","Set new random color").tooltip(),at=$("<div class='tooltip right' style='position: absolute;' />").appendTo(av).hide(),ak=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(at),ai=$("<div class='tooltip-arrow'></div>").appendTo(at),am=$.farbtastic(ak,{width:100,height:100,callback:aq,color:au});av.append($("<div/>").css("clear","both"));(function(ax){ao.click(function(){ax.setColor(j.get_random_color())})})(am)}else{aw.append($("<input />").attr("id",aj).attr("name",aj).val(au))}}}}if(af.help){aw.append($("<div class='help'/>").text(af.help))}}}ae(this.params,ad);return ad},update_from_form:function(ad){var af=this;var ae=false;$.each(this.params,function(ag,ai){if(!ai.hidden){var aj="param_"+ag;var ah=ad.find("#"+aj).val();if(ai.type==="bool"){ah=ad.find("#"+aj).is(":checked")}ae=af.set_param_value(ai.key,ah)||ae}});if(ae){this.onchange();this.track.changed()}}});var b=function(ad,ah,af,ae,ag){this.track=ad;this.region=ah;this.low=ah.get("start");this.high=ah.get("end");this.resolution=af;this.html_elt=$("<div class='track-tile'/>").append(ae).height($(ae).attr("height"));this.data=ag;this.stale=false};b.prototype.predisplay_actions=function(){};var M=function(ad,ah,af,ae,ag){b.call(this,ad,ah,af,ae,ag)};M.prototype.predisplay_actions=function(){};var O=function(ag,ao,ah,af,aj,aq,ak,ar,ae,an){b.call(this,ag,ao,ah,af,aj);this.mode=ak;this.all_slotted=ae;this.feature_mapper=an;this.has_icons=false;if(ar){this.has_icons=true;var al=this;af=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:D-1,width:af.width}).prependTo(this.html_elt);var am=new w.GenomeRegion({chrom:ag.view.chrom,start:this.low,end:this.high}),ap=aj.length,ai=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ap+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ad=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ap+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ai.click(function(){al.stale=true;ag.data_manager.get_more_data(am,ag.mode,al.resolution,{},ag.data_manager.DEEP_DATA_REQ);$(".tooltip").hide();ag.request_draw()}).dblclick(function(at){at.stopPropagation()});ad.click(function(){al.stale=true;ag.data_manager.get_more_data(am,ag.mode,al.resolution,{},ag.data_manager.BROAD_DATA_REQ);$(".tooltip").hide();ag.request_draw()}).dblclick(function(at){at.stopPropagation()})}};o(O.prototype,b.prototype);O.prototype.predisplay_actions=function(){var ae=this,ad={};if(ae.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(ap){if(!this.hovered){return}var ak=$(this).offset(),ao=ap.pageX-ak.left,an=ap.pageY-ak.top,au=ae.feature_mapper.get_feature_data(ao,an),al=(au?au[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!al||$(this).attr("id")!==al.toString()){$(this).remove()}});if(au){var ag=ad[al];if(!ag){var al=au[0],aq={name:au[3],start:au[1],end:au[2],strand:au[4]},aj=ae.track.filters_manager.filters,ai;for(var am=0;am<aj.length;am++){ai=aj[am];aq[ai.name]=au[ai.index]}var ag=$("<div/>").attr("id",al).addClass("feature-popup"),av=$("<table/>"),at,ar,aw;for(at in aq){ar=aq[at];aw=$("<tr/>").appendTo(av);$("<th/>").appendTo(aw).text(at);$("<td/>").attr("align","left").appendTo(aw).text(typeof(ar)==="number"?V(ar,2):ar)}ag.append($("<div class='feature-popup-inner'>").append(av));ad[al]=ag}ag.appendTo($(this).parents(".track-content").children(".overlay"));var ah=ao+parseInt(ae.html_elt.css("left"))-ag.width()/2,af=an+parseInt(ae.html_elt.css("top"))+7;ag.css("left",ah+"px").css("top",af+"px")}else{if(!ap.isPropagationStopped()){ap.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ap)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var f=function(ae,ad,af){o(af,{drag_handle_class:"draghandle"});p.call(this,ae,ad,af);this.dataset=null;if(af.dataset){this.dataset=(af.dataset instanceof Backbone.Model?af.dataset:X.Dataset.findOrCreate(af.dataset))}this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in af?af.data_query_wait:K);this.data_manager=("data_manager" in af?af.data_manager:new w.GenomeDataManager({dataset:this.dataset,genome:new w.Genome({key:ae.dbkey,chroms_info:{chrom_info:ae.chrom_data}}),data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in af)||af.resize){this.add_resize_handle()}}};o(f.prototype,p.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},p.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ad){ad.view.set_overview(ad)}},p.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ad){if(ad.filters_manager.visible()){ad.filters_manager.clear_filters()}else{ad.filters_manager.init_filters()}ad.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ad){ad.tool.toggle();if(ad.tool.is_visible()){ad.set_name(ad.name+ad.tool_region_and_parameters_str())}else{ad.revert_name()}$(".tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ad){var ag='<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>',af=ac.template(ag,{track:ad});var ai=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(){var ak=$('select[name="regions"] option:selected').val(),am,aj=new w.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),al=ac.map($(".bookmark"),function(an){return new w.GenomeRegion({from_str:$(an).children(".position").text()})});if(ak==="cur"){am=[aj]}else{if(ak==="bookmarks"){am=al}else{am=[aj].concat(al)}}hide_modal();window.location.href=galaxy_config.root+"visualization/sweepster?"+$.param({dataset_id:ad.dataset.id,hda_ldda:ad.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(am).toJSON())})},ah=function(aj){if((aj.keyCode||aj.which)===27){ai()}else{if((aj.keyCode||aj.which)===13){ae()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",af,{No:ai,Yes:ae})}},p.prototype.action_icons_def[2]],can_draw:function(){return this.dataset&&p.prototype.can_draw.call(this)},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ad=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ad)}this.name_div=$("<div/>").addClass("track-name").appendTo(ad).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ad},set_dataset:function(ad){this.dataset=ad;this.data_manager.set("dataset",ad)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ad=this;var ag=false;var af=false;var ae=$("<div class='track-resize'>");$(ad.container_div).hover(function(){if(ad.content_visible){ag=true;ae.show()}},function(){ag=false;if(!af){ae.hide()}});ae.hide().bind("dragstart",function(ah,ai){af=true;ai.original_height=$(ad.content_div).height()}).bind("drag",function(ai,aj){var ah=Math.min(Math.max(aj.original_height+aj.deltaY,ad.min_height_px),ad.max_height_px);$(ad.tiles_div).css("height",ah);ad.visible_height_px=(ad.max_height_px===ah?0:ah);ad.on_resize()}).bind("dragend",function(ah,ai){ad.tile_cache.clear();af=false;if(!ag){ae.hide()}ad.config.values.height=ad.visible_height_px;ad.changed()}).appendTo(ad.container_div)},set_display_modes:function(ag,aj){this.display_modes=ag;this.mode=(aj?aj:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ae=this,ah={};for(var af=0,ad=ae.display_modes.length;af<ad;af++){var ai=ae.display_modes[af];ah[ai]=function(ak){return function(){ae.change_mode(ak);ae.icons_div.show();ae.container_div.mouseleave(function(){ae.icons_div.hide()})}}(ai)}make_popupmenu(this.action_icons.mode_icon,ah)},build_action_icons:function(){p.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof W){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof g){return"LineTrack"}else{if(this instanceof T){return"ReadTrack"}else{if(this instanceof Z){return"VariantTrack"}else{if(this instanceof e){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(af){var ae=this;ae.enabled=false;ae.tile_cache.clear();ae.data_manager.clear();ae.tiles_div.css("height","auto");ae.tiles_div.text("").children().remove();ae.container_div.removeClass("nodata error pending");if(!ae.dataset.id){return}var ad=$.Deferred(),ag={hda_ldda:ae.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:ae.view.chrom,retry:af};$.getJSON(this.dataset.url(),ag,function(ah){if(!ah||ah==="error"||ah.kind==="error"){ae.container_div.addClass("error");ae.tiles_div.text(m);if(ah.message){ae.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ah.message+"</pre>",{Close:hide_modal})}));ae.tiles_div.append($("<span/>").text(" "));ae.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ae.init(true)}))}}else{if(ah==="no converter"){ae.container_div.addClass("error");ae.tiles_div.text(J)}else{if(ah==="no data"||(ah.data!==undefined&&(ah.data===null||ah.data.length===0))){ae.container_div.addClass("nodata");ae.tiles_div.text(E)}else{if(ah==="pending"){ae.container_div.addClass("pending");ae.tiles_div.html(u);setTimeout(function(){ae.init()},ae.data_query_wait)}else{if(ah==="data"||ah.status==="data"){if(ah.valid_chroms){ae.valid_chroms=ah.valid_chroms;ae.update_icons()}ae.tiles_div.text(U);if(ae.view.chrom){ae.tiles_div.text("");ae.tiles_div.css("height",ae.visible_height_px+"px");ae.enabled=true;$.when.apply($,ae.predraw_init()).done(function(){ad.resolve();ae.container_div.removeClass("nodata error pending");ae.request_draw()})}else{ad.resolve()}}}}}}});this.update_icons();return ad},predraw_init:function(){var ad=this;return $.getJSON(ad.dataset.url(),{data_type:"data",stats:true,chrom:ad.view.chrom,low:0,high:ad.view.max_high,hda_ldda:ad.dataset.get("hda_ldda")},function(ae){ad.container_div.addClass("line-track");var ag=ae.data;if(ag&&ag.min&&ag.max){var af=ag.min,ah=ag.max;af=Math.floor(Math.min(0,Math.max(af,ag.mean-2*ag.sd)));ah=Math.ceil(Math.max(0,Math.min(ah,ag.mean+2*ag.sd)));ad.config.set_param_default_value("min_value",af);ad.config.set_param_default_value("max_value",ah);ad.prefs.min_value=af;ad.prefs.max_value=ah}})},get_drawables:function(){return this}});var N=function(af,ae,ah){f.call(this,af,ae,ah);var ad=this;k(ad.container_div,ad.drag_handle_class,".group",ad);this.filters_manager=new h.FiltersManager(this,("filters" in ah?ah.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=(ah.tool?new q(ac.extend(ah.tool,{track:this,tool_state:ah.tool_state})):null);this.tile_cache=new w.Cache(Q);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){var ag=new ab({model:this.tool});ag.render();this.dynamic_tool_div=ag.$el;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ah.mode){this.change_mode(ah.mode)}};o(N.prototype,p.prototype,f.prototype,{action_icons_def:f.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ad){$(".tooltip").remove();ad.slotters[ad.view.resolution_px_b].max_rows*=2;ad.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ad){var ae=this.to_dict();o(ae,{data_manager:this.data_manager});var af=new this.constructor(this.view,ad,ae);af.change_mode(this.mode);af.enabled=this.enabled;return af},set_filters_manager:function(ad){this.filters_manager=ad;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,dataset:{id:this.dataset.id,hda_ldda:this.dataset.get("hda_ldda")},prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},set_min_max:function(){var ad=this;return $.getJSON(ad.dataset.url(),{data_type:"data",stats:true,chrom:ad.view.chrom,low:0,high:ad.view.max_high,hda_ldda:ad.dataset.get("hda_ldda")},function(ae){var ag=ae.data;if(isNaN(parseFloat(ad.prefs.min_value))||isNaN(parseFloat(ad.prefs.max_value))){var af=ag.min,ah=ag.max;af=Math.floor(Math.min(0,Math.max(af,ag.mean-2*ag.sd)));ah=Math.ceil(Math.max(0,Math.min(ah,ag.mean+2*ag.sd)));ad.prefs.min_value=af;ad.prefs.max_value=ah}})},change_mode:function(ae){var ad=this;ad.mode=ae;ad.config.values.mode=ae;if(ae==="Auto"){this.data_manager.clear()}ad.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ad.mode+")");return ad},update_icons:function(){var ad=this;if(ad.filters_available){ad.action_icons.filters_icon.show()}else{ad.action_icons.filters_icon.hide()}if(ad.tool){ad.action_icons.tools_icon.show();ad.action_icons.param_space_viz_icon.show()}else{ad.action_icons.tools_icon.hide();ad.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ae,ad){return ae+"_"+ad},request_draw:function(ad){if(ad&&ad.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ad,this)},before_draw:function(){this.max_height_px=0},_draw:function(aq){if(!this.can_draw()){return}var an=aq&&aq.clear_after,al=this.view.low,ah=this.view.high,ak=ah-al,ae=this.view.container.width(),ap=this.view.resolution_px_b,ag=this.view.resolution_b_px;if(this.is_overview){al=this.view.max_low;ah=this.view.max_high;ag=(view.max_high-view.max_low)/ae;ap=1/ag}this.before_draw();this.tiles_div.children().addClass("remove");var ad=Math.floor(al/(ag*S)),am,ai,aj=[],ao=[];while((ad*S*ag)<ah){am=this._get_tile_bounds(ad,ag);ai=this.draw_helper(am,ag,ap,aq);aj.push(ai);$.when(ai).then(function(ar){ao.push(ar)});ad+=1}if(!an){this.tiles_div.children(".remove").removeClass("remove").remove()}var af=this;$.when.apply($,aj).then(function(){af.tiles_div.children(".remove").remove();ao=ac.filter(ao,function(ar){return ar!==null});if(ao.length!==0){af.postdraw_actions(ao,ae,ap,an)}})},_add_yaxis_label:function(ag,ai){var ae=this,ah=(ag==="max"?"top":"bottom"),aj=(ag==="max"?"max":"min"),ad=(ag==="max"?"max_value":"min_value"),ai=ai||function(){ae.request_draw({clear_tile_cache:true})},af=this.container_div.find(".yaxislabel."+ah);if(af.length!==0){af.text(ae.prefs[ad])}else{af=$("<div/>").text(ae.prefs[ad]).make_text_editable({num_cols:12,on_finish:function(ak){$(".tooltip").remove();ae.config.set_param_value(ad,ak);ai()},help_text:"Set "+aj+" value"}).addClass("yaxislabel "+ah).css("color",this.prefs.label_color);this.container_div.prepend(af)}},postdraw_actions:function(ag,ah,aj,ad){var af=ac.filter(ag,function(ak){return(ak instanceof M)});if(af.length>0){this.max_height_px=0;var ae=this;ac.each(ag,function(ak){if(!(ak instanceof M)){ak.html_elt.remove();ae.draw_helper(ak.region,ak.resolution,aj,{force:true,mode:"Coverage"})}});ae._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var ai=ac.find(ag,function(ak){return ak.has_icons});if(ai){ac.each(ag,function(ak){if(!ak.has_icons){ak.html_elt.css("padding-top",D)}})}}},get_mode:function(ad){return this.mode},update_auto_mode:function(ad){},_get_drawables:function(){return[this]},draw_helper:function(am,ag,ap,aq){if(!aq){aq={}}var ae=aq.force,ao=!(aq.data_fetch===false),aj=aq.mode||this.mode,af=this,ah=this._get_drawables(),an=this._gen_tile_cache_key(ap,am),ai=function(ar){return(ar&&"track" in ar)};var ak=(ae?undefined:af.tile_cache.get_elt(an));if(ak){if(ai(ak)){af.show_tile(ak,ap)}return ak}if(!ao){return null}var al=function(){var ar=(ac.find(A,function(au){return au===aj})?"Coverage":aj);var at=ac.map(ah,function(au){return au.data_manager.get_data(am,ar,ag,af.data_url_extra_params)});if(view.reference_track){at.push(view.reference_track.data_manager.get_data(am,aj,ag,view.reference_track.data_url_extra_params))}return at};var ad=$.Deferred();af.tile_cache.set_elt(an,ad);$.when.apply($,al()).then(function(){var ar=al(),ax=ar,aD;if(view.reference_track){aD=view.reference_track.data_manager.subset_entry(ar.pop(),am)}var ay=[],av=[];ac.each(ah,function(aI,aF){var aH=aI.mode,aG=ax[aF];if(aH==="Auto"){aH=aI.get_mode(aG);aI.update_auto_mode(aH)}ay.push(aH);av.push(aI.get_canvas_height(aG,aH,ap,at))});var aw=af.view.canvas_manager.new_canvas(),az=am.get("start"),aE=am.get("end"),au=0,at=Math.ceil((aE-az)*ap)+af.left_offset,aB=ac.max(av),aA;aw.width=at;aw.height=(aq.height||aB);var aC=aw.getContext("2d");aC.translate(af.left_offset,0);if(ah.length>1){aC.globalAlpha=0.5;aC.globalCompositeOperation="source-over"}ac.each(ah,function(aG,aF){aA=aG.draw_tile(ax[aF],aC,ay[aF],ag,am,ap,aD)});if(aA!==undefined){af.tile_cache.set_elt(an,aA);af.show_tile(aA,ap)}ad.resolve(aA)});return ad},get_canvas_height:function(ad,af,ag,ae){return this.visible_height_px},_draw_line_track_tile:function(ad,af,aj,ah,ai,ak){var ag=af.canvas,ae=new L.LinePainter(ad.data,ai.get("start"),ai.get("end"),this.prefs,aj);ae.draw(af,ag.width,ag.height,ak);return new M(this,ai,ah,ag,ad.data)},draw_tile:function(ad,ae,ai,ag,ah,aj,af){},show_tile:function(af,ai){var ae=this,ad=af.html_elt;af.predisplay_actions();var ah=(af.low-(this.is_overview?this.view.max_low:this.view.low))*ai;if(this.left_offset){ah-=this.left_offset}ad.css({position:"absolute",top:0,left:ah});if(ad.hasClass("remove")){ad.removeClass("remove")}else{this.tiles_div.append(ad)}af.html_elt.height("auto");this.max_height_px=Math.max(this.max_height_px,af.html_elt.height());af.html_elt.parent().children().css("height",this.max_height_px+"px");var ag=this.max_height_px;if(this.visible_height_px!==0){ag=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",ag+"px")},_get_tile_bounds:function(ad,ae){var ag=Math.floor(ad*S*ae),ah=Math.ceil(S*ae),af=(ag+ah<=this.view.max_high?ag+ah:this.view.max_high);return new w.GenomeRegion({chrom:this.view.chrom,start:ag,end:af})},tool_region_and_parameters_str:function(ag){var ad=this,af=(ag!==undefined?ag.toString():"all"),ae=ac.values(ad.tool.get_inputs_dict()).join(", ");return" - region=["+af+"], parameters=["+ae+"]"},data_and_mode_compatible:function(ad,ae){if(ae==="Auto"){return true}else{if(ae==="Coverage"){return ad.dataset_type==="bigwig"}else{if(ad.dataset_type==="bigwig"||ad.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ad){if(ad.dataset_type==="bigwig"||ad.message||ad.extra_info==="no_detail"){return false}return true},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state"}});var W=function(ae,ad){var af={resize:false};f.call(this,ae,ad,af);this.container_div.addClass("label-track")};o(W.prototype,f.prototype,{build_header_div:function(){},init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ah){var af=this.view,ag=af.high-af.low,ak=Math.floor(Math.pow(10,Math.floor(Math.log(ag)/Math.log(10)))),ad=Math.floor(af.low/ak)*ak,ai=this.view.container.width(),ae=$("<div style='position: relative; height: 1.3em;'></div>");while(ad<af.high){var aj=(ad-af.low)/ag*ai;ae.append($("<div class='label'>"+commatize(ad)+"</div>").css({position:"absolute",left:aj-1}));ad+=ak}this.content_div.children(":first").remove();this.content_div.append(ae)}});var e=function(ae,ad,ah){this.display_modes=A;N.call(this,ae,ad,ah);this.drawables=[];if("drawables" in ah){var ag;for(var af=0;af<ah.drawables.length;af++){ag=ah.drawables[af];this.drawables[af]=n(ag,ae,null);if(ag.left_offset>this.left_offset){this.left_offset=ag.left_offset}}this.enabled=true}ac.each(this.drawables,function(ai){if(ai instanceof c||ai instanceof T){ai.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};o(e.prototype,N.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ad){$(".tooltip").remove();ad.show_group()}}].concat(N.prototype.action_icons_def),to_dict:y.prototype.to_dict,add_drawable:y.prototype.add_drawable,unpack_drawables:y.prototype.unpack_drawables,change_mode:function(ad){N.prototype.change_mode.call(this,ad);for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae].change_mode(ad)}},init:function(){var af=[];for(var ae=0;ae<this.drawables.length;ae++){af.push(this.drawables[ae].init())}var ad=this;$.when.apply($,af).then(function(){ad.enabled=true;ad.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:p.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var ag=new P(this.view,this.container,{name:this.name}),ad;for(var af=0;af<this.drawables.length;af++){ad=this.drawables[af];ad.update_icons();ag.add_drawable(ad);ad.container=ag;ag.content_div.append(ad.container_div)}var ae=this.container.replace_drawable(this,ag,true);ag.request_draw({clear_tile_cache:true})},before_draw:function(){N.prototype.before_draw.call(this);var ae=ac.min(ac.map(this.drawables,function(af){return af.prefs.min_value})),ad=ac.max(ac.map(this.drawables,function(af){return af.prefs.max_value}));this.prefs.min_value=ae;this.prefs.max_value=ad;ac.each(this.drawables,function(af){af.prefs.min_value=ae;af.prefs.max_value=ad})},update_all_min_max:function(){var ad=this;ac.each(this.drawables,function(ae){ae.prefs.min_value=ad.prefs.min_value;ae.prefs.max_value=ad.prefs.max_value});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(aj,ad,am,ai){N.prototype.postdraw_actions.call(this,aj,ad,am,ai);var ah=-1;for(var af=0;af<aj.length;af++){var ak=aj[af].html_elt.find("canvas").height();if(ak>ah){ah=ak}}for(var af=0;af<aj.length;af++){var ag=aj[af];if(ag.html_elt.find("canvas").height()!==ah){this.draw_helper(ag.region,ag.resolution,am,{force:true,height:ah});ag.html_elt.remove()}}var ae=this,al=function(){ae.update_all_min_max()};this._add_yaxis_label("min",al);this._add_yaxis_label("max",al)}});var B=function(ad){N.call(this,ad,{content_div:ad.top_labeltrack},{resize:false});ad.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=galaxy_config.root+"api/genomes//"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new w.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};o(B.prototype,p.prototype,N.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:p.prototype.can_draw,draw_helper:function(af,ae,ag,ad){if(ag>this.view.canvas_manager.char_width_px){this.tiles_div.show();return N.prototype.draw_helper.call(this,af,ae,ag,ad)}else{this.tiles_div.hide();return null}},can_subset:function(ad){return true},draw_tile:function(ag,am,ah,ae,aj,an){var af=this.data_manager.subset_entry(ag,aj),al=af.data;var ad=am.canvas;am.font=am.canvas.manager.default_font;am.textAlign="center";for(var ai=0,ak=al.length;ai<ak;ai++){am.fillStyle=this.view.get_base_color(al[ai]);am.fillText(al[ai],Math.floor(ai*an),10)}return new b(this,aj,ae,ad,af)}});var g=function(af,ae,ag){var ad=this;this.display_modes=A;this.mode="Histogram";N.call(this,af,ae,ag);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:j.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:ag.prefs,onchange:function(){ad.set_name(ad.prefs.name);ad.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};o(g.prototype,p.prototype,N.prototype,{before_draw:function(){},draw_tile:function(ad,ae,ah,af,ag,ai){return this._draw_line_track_tile(ad,ae,ah,af,ag,ai)},can_subset:function(ad){return(ad.data[1][0]-ad.data[0][0]===1)},postdraw_actions:function(ae,af,ag,ad){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var r=function(af,ae,ag){var ad=this;this.display_modes=["Heatmap"];this.mode="Heatmap";N.call(this,af,ae,ag);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:ag.prefs,onchange:function(){ad.set_name(ad.prefs.name);this.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};o(r.prototype,p.prototype,N.prototype,{draw_tile:function(ad,af,aj,ah,ai,ak){var ag=af.canvas,ae=new L.DiagonalHeatmapPainter(ad.data,ai.get("start"),ai.get("end"),this.prefs,aj);ae.draw(af,ag.width,ag.height,ak);return new b(this,ai,ah,ag,ad.data)}});var c=function(ag,af,ai){var ae=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ag,af,ai);var ah=j.get_random_color(),ad=j.get_random_color([ah,"#FFFFFF"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ah},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ad},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ai.prefs,onchange:function(){ae.set_name(ae.prefs.name);ae.set_painter_from_config();ae.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};o(c.prototype,p.prototype,N.prototype,{set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},postdraw_actions:function(an,af,ao,am){N.prototype.postdraw_actions.call(this,an,af,ao,am);var ah=this,ai;if(ah.filters_manager){var ag=ah.filters_manager.filters;for(var ak=0;ak<ag.length;ak++){ag[ak].update_ui_elt()}var aj=false,al,ae;for(ai=0;ai<an.length;ai++){if(an[ai].data.length){al=an[ai].data[0];for(var ak=0;ak<ag.length;ak++){ae=ag[ak];if(ae.applies_to(al)&&ae.min!==ae.max){aj=true;break}}}}if(ah.filters_available!==aj){ah.filters_available=aj;if(!ah.filters_available){ah.filters_manager.hide()}ah.update_icons()}}if(an[0] instanceof O){var ad=true;for(ai=0;ai<an.length;ai++){if(!an[ai].all_slotted){ad=false;break}}if(!ad){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ad){var ad;if(this.mode==="Auto"){if(ad==="no_detail"){ad="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ad+")")}},incremental_slots:function(ah,ad,ag){var ae=this.view.canvas_manager.dummy_context,af=this.slotters[ah];if(!af||(af.mode!==ag)){af=new (s.FeatureSlotter)(ah,ag,z,function(ai){return ae.measureText(ai)});this.slotters[ah]=af}return af.slot_features(ad)},get_mode:function(ad){if(ad.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>I){mode="Squish"}else{mode="Pack"}}return mode},get_canvas_height:function(ad,ah,ai,ae){if(ah==="Coverage"||ad.dataset_type==="bigwig"){return this.summary_draw_height}else{var ag=this.incremental_slots(ai,ad.data,ah);var af=new (this.painter)(null,null,null,this.prefs,ah);return Math.max(aa,af.get_required_height(ag,ae))}},draw_tile:function(an,ar,ap,at,ag,ak,af){var aq=this,ae=ar.canvas,az=ag.get("start"),ad=ag.get("end"),ah=this.left_offset;if(an.dataset_type==="bigwig"){return this._draw_line_track_tile(an,ar,ap,at,ag,ak)}var aj=[],ao=this.slotters[ak].slots;all_slotted=true;if(an.data){var al=this.filters_manager.filters;for(var au=0,aw=an.data.length;au<aw;au++){var ai=an.data[au];var av=false;var am;for(var ay=0,aD=al.length;ay<aD;ay++){am=al[ay];am.update_attrs(ai);if(!am.keep(ai)){av=true;break}}if(!av){aj.push(ai);if(!(ai[0] in ao)){all_slotted=false}}}}var aC=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null),aA=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null),aB=new (this.painter)(aj,az,ad,this.prefs,ap,aC,aA,af,function(aE){return aq.view.get_base_color(aE)});var ax=null;ar.fillStyle=this.prefs.block_color;ar.font=ar.canvas.manager.default_font;ar.textAlign="right";if(an.data){ax=aB.draw(ar,ae.width,ae.height,ak,ao);ax.translation=-ah}return new O(aq,ag,at,ae,an.data,ak,ap,an.message,all_slotted,ax)}});var Z=function(ae,ad,af){this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ae,ad,af);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Histogram color",type:"color",default_value:j.get_random_color()},{key:"show_sample_data",label:"Show sample data",type:"bool",default_value:true},{key:"show_labels",label:"Show summary and sample labels",type:"bool",default_value:true},{key:"summary_height",label:"Locus summary height",type:"float",default_value:20},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:af.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=L.VariantPainter;this.summary_draw_height=30;this.left_offset=30};o(Z.prototype,p.prototype,N.prototype,{draw_tile:function(ad,ag,aj,ah,ai,ak){if(ad.dataset_type==="bigwig"){return this._draw_line_track_tile(ad,ag,"Histogram",ah,ai,ak)}else{var af=this.view,ae=new (this.painter)(ad.data,ai.get("start"),ai.get("end"),this.prefs,aj,function(al){return af.get_base_color(al)});ae.draw(ag,ag.canvas.width,ag.canvas.height,ak);return new b(this,ai,ah,ag.canvas,ad.data)}},get_canvas_height:function(ad,ah,ai,af){if(ad.dataset_type==="bigwig"){return this.summary_draw_height}else{var ag=new (this.painter)(null,null,null,this.prefs,ah);var ae=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(ae===0&&ad.data.length!==0){ae=ad.data[0][7].match(/,/g);if(ae===null){ae=1}else{ae=ae.length+1}}return ag.get_required_height(ae)}},predraw_init:function(){var ad=[f.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ad.push(this.dataset.fetch())}return ad},postdraw_actions:function(ag,ah,aj,ae){N.prototype.postdraw_actions.call(this,ag,ah,aj,ae);var af=ac.filter(ag,function(ak){return(ak instanceof M)});if(af.length===0&&this.prefs.show_labels){var ad;if(this.container_div.find(".yaxislabel.variant").length===0){ad=this.prefs.summary_height/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ad+"px",top:(this.prefs.summary_height-ad)/2+"px"}));if(this.prefs.show_sample_data){var ai=this.dataset.get("metadata").get("sample_names").join("<br/>");this.tiles_div.prepend($("<div/>").html(ai).addClass("yaxislabel variant top sample").css({top:this.prefs.summary_height+2,}))}}ad=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ad,"line-height":ad});$(this.tiles_div).find(".yaxislabel").css("color",this.prefs.label_color)}else{this.container_div.find(".yaxislabel.variant").remove()}}});var T=function(af,ae,ah){c.call(this,af,ae,ah);var ag=j.get_random_color(),ad=j.get_random_color([ag,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:ag},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ad},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{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:"mode",type:"string",default_value:this.mode,hidden:true},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"}],saved_values:ah.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=(af.reference_track?L.RefBasedReadPainter:L.ReadPainter);this.update_icons()};o(T.prototype,p.prototype,N.prototype,c.prototype);var d={CompositeTrack:e,DrawableGroup:P,DiagonalHeatmapTrack:r,FeatureTrack:c,LineTrack:g,ReadTrack:T,VariantTrack:Z,VcfTrack:Z};var n=function(af,ae,ad){if("copy" in af){return af.copy(ad)}else{var ag=af.obj_type;if(!ag){ag=af.track_type}return new d[ag](ae,ad,af)}};return{TracksterView:Y,DrawableGroup:P,LineTrack:g,FeatureTrack:c,DiagonalHeatmapTrack:r,ReadTrack:T,VariantTrack:Z,CompositeTrack:e,object_from_template:n}});
\ No newline at end of file
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/templates/compiled/template-history-historyPanel.js
--- a/static/scripts/templates/compiled/template-history-historyPanel.js
+++ b/static/scripts/templates/compiled/template-history-historyPanel.js
@@ -58,13 +58,13 @@
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\"\n class=\"icon-button tags tooltip\" target=\"galaxy_main\" href=\"javascript:void(0)\"></a>\n <a id=\"history-annotate\" title=\"";
+ buffer += "\"\n class=\"icon-button tags\" target=\"galaxy_main\" href=\"javascript:void(0)\"></a>\n <a id=\"history-annotate\" title=\"";
options = {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data};
if (stack1 = helpers.local) { stack1 = stack1.call(depth0, options); }
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\"\n class=\"icon-button annotate tooltip\" target=\"galaxy_main\" href=\"javascript:void(0)\"></a>\n ";
+ buffer += "\"\n class=\"icon-button annotate\" target=\"galaxy_main\" href=\"javascript:void(0)\"></a>\n ";
return buffer;
}
function program8(depth0,data) {
@@ -94,7 +94,7 @@
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += ":</strong>\n <div id=\"history-annotation-container\">\n <div id=\"history-annotation\" class=\"tooltip editable-text\"\n title=\"";
+ buffer += ":</strong>\n <div id=\"history-annotation-container\">\n <div id=\"history-annotation\" class=\"editable-text\"\n title=\"";
options = {hash:{},inverse:self.noop,fn:self.program(17, program17, data),data:data};
if (stack1 = helpers.local) { stack1 = stack1.call(depth0, options); }
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/scripts/templates/history-templates.html
--- a/static/scripts/templates/history-templates.html
+++ b/static/scripts/templates/history-templates.html
@@ -24,9 +24,9 @@
<div id="history-secondary-links" style="float: right;">
{{#if user.email}}
<a id="history-tag" title="{{#local}}Edit history tags{{/local}}"
- class="icon-button tags tooltip" target="galaxy_main" href="javascript:void(0)"></a>
+ class="icon-button tags" target="galaxy_main" href="javascript:void(0)"></a><a id="history-annotate" title="{{#local}}Edit history annotation{{/local}}"
- class="icon-button annotate tooltip" target="galaxy_main" href="javascript:void(0)"></a>
+ class="icon-button annotate" target="galaxy_main" href="javascript:void(0)"></a>
{{/if}}
</div><div style="clear: both;"></div>
@@ -45,7 +45,7 @@
<div id="history-annotation-area" style="display: none"><strong>{{#local}}Annotation{{/local}}:</strong><div id="history-annotation-container">
- <div id="history-annotation" class="tooltip editable-text"
+ <div id="history-annotation" class="editable-text"
title="{{#local}}Click to edit annotation{{/local}}">
{{#if annotation}}
{{annotation}}
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1341,6 +1341,7 @@
.icon-button.link-broken{background:url(../images/silk/link_break.png) no-repeat;cursor:pointer;float:none;display:inline-block;margin-left:10px}
.workflow-invocation-complete{border:solid 1px #6A6;border-left-width:5px;margin:10px 0;padding-left:5px}
body.historyPage{background:#dfe5f9;color:#000;margin:5px;border:0;padding:0}
+body.historyPage>*{margin:0px;padding:0px}
div.historyLinks{margin:5px 5px}
div.historyItem{margin:0 -5px;padding:8px 10px;border-top:solid #bfbfbf 1px;border-right:none;word-wrap:break-word;background:#eee}div.historyItem .state-icon{display:inline-block;vertical-align:middle;width:16px;height:16px;background-position:0 1px;background-repeat:no-repeat}
div.historyItem .historyItemTitle{font-weight:bold;line-height:16px}
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/style/blue/sprite-fugue.png
Binary file static/style/blue/sprite-fugue.png has changed
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/style/blue/sprite-history-buttons.png
Binary file static/style/blue/sprite-history-buttons.png has changed
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/style/blue/sprite-history-states.png
Binary file static/style/blue/sprite-history-states.png has changed
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de static/style/src/less/base.less
--- a/static/style/src/less/base.less
+++ b/static/style/src/less/base.less
@@ -1358,6 +1358,11 @@
padding: 0;
}
+body.historyPage > * {
+ margin: 0px;
+ padding: 0px;
+}
+
// Control links at top of history
div.historyLinks {
margin: 5px 5px;
@@ -1754,4 +1759,4 @@
}
.icon-button.chevron-expand {
.sprite(@chevron-expand-bw);
-}
\ No newline at end of file
+}
diff -r 5432c6f3fe421b820673d6096cc039085555b44c -r 18745fd87025971fb7f8a3bc9cd9e54a5f5759de templates/webapps/galaxy/root/history.mako
--- a/templates/webapps/galaxy/root/history.mako
+++ b/templates/webapps/galaxy/root/history.mako
@@ -342,13 +342,6 @@
margin: 0px;
}
- #history-subtitle-area {
- }
- #history-size {
- }
- #history-secondary-links {
- }
-
#history-secondary-links #history-refresh {
text-decoration: none;
}
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: make compatible with recent Backbone-relational update by using findOrCreate rather than creating new dataset objects each time. This fixes composite tracks and readding tracks.
by commits-noreply@bitbucket.org 11 Sep '13
by commits-noreply@bitbucket.org 11 Sep '13
11 Sep '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5432c6f3fe42/
Changeset: 5432c6f3fe42
User: jgoecks
Date: 2013-09-11 22:27:16
Summary: Trackster: make compatible with recent Backbone-relational update by using findOrCreate rather than creating new dataset objects each time. This fixes composite tracks and readding tracks.
Affected #: 1 file
diff -r bfcb397e240947dead624e730c3bc1ebb9fbf933 -r 5432c6f3fe421b820673d6096cc039085555b44c static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -2321,7 +2321,7 @@
this.dataset = null;
if (obj_dict.dataset) {
// Dataset can be a Backbone model or a dict that can be used to create a model.
- this.dataset = (obj_dict.dataset instanceof Backbone.Model ? obj_dict.dataset : new data.Dataset(obj_dict.dataset) );
+ this.dataset = (obj_dict.dataset instanceof Backbone.Model ? obj_dict.dataset : data.Dataset.findOrCreate(obj_dict.dataset) );
}
this.dataset_check_type = 'converted_datasets_state';
this.data_url_extra_params = {};
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
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/bfcb397e2409/
Changeset: bfcb397e2409
User: jgoecks
Date: 2013-09-11 22:00:19
Summary: Trackster: fix data-mode compatibility test; this fixes mode changing from coverage to dense/squish/pack.
Affected #: 1 file
diff -r c90e760da0fdc89f2e6b9e42dfaa7b365c8eeea4 -r bfcb397e240947dead624e730c3bc1ebb9fbf933 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -3421,7 +3421,8 @@
return data.dataset_type === "bigwig";
}
// All other modes--Dense, Squish, Pack--require data + details.
- else if (data.extra_info === "no_detail") {
+ else if (data.dataset_type === "bigwig" ||
+ data.extra_info === "no_detail") {
return false;
}
else {
https://bitbucket.org/galaxy/galaxy-central/commits/185e24997925/
Changeset: 185e24997925
Branch: stable
User: jgoecks
Date: 2013-09-11 22:00:19
Summary: Trackster: fix data-mode compatibility test; this fixes mode changing from coverage to dense/squish/pack.
Affected #: 1 file
diff -r 055ef20e662a4e0806df7832625792cd5da17c44 -r 185e24997925d70a287243fac83530208819fac2 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -3444,7 +3444,8 @@
return data.dataset_type === "bigwig";
}
// All other modes--Dense, Squish, Pack--require data + details.
- else if (data.extra_info === "no_detail") {
+ else if (data.dataset_type === "bigwig" ||
+ data.extra_info === "no_detail") {
return false;
}
else {
https://bitbucket.org/galaxy/galaxy-central/commits/1f34ec186fcf/
Changeset: 1f34ec186fcf
Branch: stable
User: jgoecks
Date: 2013-09-11 22:06:32
Summary: Pack script.
Affected #: 1 file
diff -r 185e24997925d70a287243fac83530208819fac2 -r 1f34ec186fcf79e5d82ea2a7e73ba5f537fb80f9 static/scripts/packed/viz/trackster/tracks.js
--- a/static/scripts/packed/viz/trackster/tracks.js
+++ b/static/scripts/packed/viz/trackster/tracks.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","mvc/data","viz/trackster/filters"],function(ab,w,k,t,L,X,i){var p=ab.extend;var m={};var j=function(ac,ad){m[ac.attr("id")]=ad};var l=function(ac,ae,ag,af){ag=".group";var ad={};m[ac.attr("id")]=af;ac.bind("drag",{handle:"."+ae,relative:true},function(ao,ap){var an=$(this),at=$(this).parent(),ak=at.children(),am=m[$(this).attr("id")],aj,ai,aq,ah,al;ai=$(this).parents(ag);if(ai.length!==0){aq=ai.position().top;ah=aq+ai.outerHeight();if(ap.offsetY<aq){$(this).insertBefore(ai);var ar=m[ai.attr("id")];ar.remove_drawable(am);ar.container.add_drawable_before(am,ar);return}else{if(ap.offsetY>ah){$(this).insertAfter(ai);var ar=m[ai.attr("id")];ar.remove_drawable(am);ar.container.add_drawable(am);return}}}ai=null;for(al=0;al<ak.length;al++){aj=$(ak.get(al));aq=aj.position().top;ah=aq+aj.outerHeight();if(aj.is(ag)&&this!==aj.get(0)&&ap.offsetY>=aq&&ap.offsetY<=ah){if(ap.offsetY-aq<ah-ap.offsetY){aj.find(".content-div").prepend(this)}else{aj.find(".content-div").append(this)}if(am.container){am.container.remove_drawable(am)}m[aj.attr("id")].add_drawable(am);return}}for(al=0;al<ak.length;al++){aj=$(ak.get(al));if(ap.offsetY<aj.position().top&&!(aj.hasClass("reference-track")||aj.hasClass("intro"))){break}}if(al===ak.length){if(this!==ak.get(al-1)){at.append(this);m[at.attr("id")].move_drawable(am,al)}}else{if(this!==ak.get(al)){$(this).insertBefore(ak.get(al));m[at.attr("id")].move_drawable(am,(ap.deltaY>0?al-1:al))}}}).bind("dragstart",function(){ad["border-top"]=ac.css("border-top");ad["border-bottom"]=ac.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ad)})};var aa=16,G=9,D=20,z=100,I=12000,S=400,K=5000,v=100,n="Cannot display dataset due to an error. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",u="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",x="Tool cannot be rerun: ",a="Loading data...",U="Ready for display",R=10,H=20,A=["Histogram","Line","Filled","Intensity"];function V(ad,ac){if(!ac){ac=0}var ae=Math.pow(10,ac);return Math.round(ad*ae)/ae}var q=function(ad,ac,af){if(!q.id_counter){q.id_counter=0}this.id=q.id_counter++;this.name=af.name;this.view=ad;this.container=ac;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:af.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=af.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ag){ag.stopPropagation()});var ae=this;this.container_div.hover(function(){ae.icons_div.show()},function(){ae.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};q.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ac){if(ac.content_visible){ac.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ac.hide_contents();ac.content_visible=false}else{ac.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ac.content_visible=true;ac.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ad){var af=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ac=function(){ad.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(ag){if((ag.keyCode||ag.which)===27){af()}else{if((ag.keyCode||ag.which)===13){ac()}}};$(window).bind("keypress.check_enter_esc",ae);show_modal("Configure",ad.config.build_form(),{Cancel:af,OK:ac})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.remove()}}];p(q.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(ac){},to_dict:function(){},set_name:function(ac){this.old_name=this.name;this.name=ac;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ac=this.view;this.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ad,ai,ah,ag,ac,af){var ae=this;this.action_icons[ad]=$("<a/>").attr("href","javascript:void(0);").attr("title",ai).addClass("icon-button").addClass(ah).tooltip().click(function(){ag(ae)}).appendTo(this.icons_div);if(af){this.action_icons[ad].hide()}},build_action_icons:function(ac){var ae;for(var ad=0;ad<ac.length;ad++){ae=ac[ad];this.add_action_icon(ae.name,ae.title,ae.css_class,ae.on_click_fn,ae.prepend,ae.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var y=function(ad,ac,ae){q.call(this,ad,ac,ae);this.obj_type=ae.obj_type;this.drawables=[]};p(y.prototype,q.prototype,{unpack_drawables:function(ae){this.drawables=[];var ad;for(var ac=0;ac<ae.length;ac++){ad=o(ae[ac],this.view,this);this.add_drawable(ad)}},init:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].init()}},_draw:function(ac){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad]._draw(ac)}},to_dict:function(){var ad=[];for(var ac=0;ac<this.drawables.length;ac++){ad.push(this.drawables[ac].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ad}},add_drawable:function(ac){this.drawables.push(ac);ac.container=this;this.changed()},add_drawable_before:function(ae,ac){this.changed();var ad=this.drawables.indexOf(ac);if(ad!==-1){this.drawables.splice(ad,0,ae);return true}return false},replace_drawable:function(ae,ac,ad){var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables[af]=ac;if(ad){ae.container_div.replaceWith(ac.container_div)}this.changed()}return af},remove_drawable:function(ad){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);ad.container=null;this.changed();return true}return false},move_drawable:function(ad,ae){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);this.drawables.splice(ae,0,ad);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(af){var ac=this.drawables.slice(0),ad=[],ae;while(ac.length!==0){ae=ac.shift();if(ae instanceof af){ad.push(ae)}else{if(ae.drawables){ac=ac.concat(ae.drawables)}}}return ad}});var Q=function(ad,ac,af){p(af,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});y.call(this,ad,ac,af);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);j(this.container_div,this);j(this.content_div,this);l(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new i.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in af){this.unpack_drawables(af.drawables)}if("filters" in af){var ae=this.filters_manager;this.filters_manager=new i.FiltersManager(this,af.filters);ae.parent_div.replaceWith(this.filters_manager.parent_div);if(af.filters.visible){this.setup_multitrack_filtering()}}};p(Q.prototype,q.prototype,y.prototype,{action_icons_def:[q.prototype.action_icons_def[0],q.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters();ac._restore_filter_managers()}else{ac.setup_multitrack_filtering();ac.request_draw({clear_tile_cache:true})}ac.filters_manager.toggle()}},q.prototype.action_icons_def[2]],build_container_div:function(){var ac=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ac)}return ac},build_header_div:function(){var ac=$("<div/>").addClass("track-header");ac.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ac);return ac},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ae=this.drawables.length;if(ae===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ae===1){if(this.drawables[0] instanceof f){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var al,ak,ai,ao=true,ag=this.drawables[0].get_type(),ac=0;for(al=0;al<ae;al++){ai=this.drawables[al];if(ai.get_type()!==ag){can_composite=false;break}if(ai instanceof c){ac++}}if(ao||ac===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".bs-tooltip").remove()}if(ac>1&&ac===this.drawables.length){var ap={},ad;ai=this.drawables[0];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];ap[ad.name]=[ad]}for(al=1;al<this.drawables.length;al++){ai=this.drawables[al];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];if(ad.name in ap){ap[ad.name].push(ad)}}}this.filters_manager.remove_all();var af,ah,aj,am;for(var an in ap){af=ap[an];if(af.length===ac){ah=new i.NumberFilter({name:af[0].name,index:af[0].index});this.filters_manager.add_filter(ah)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].filters_manager=this.saved_filters_managers[ac]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ac=0;ac<this.drawables.length;ac++){drawable=this.drawables[ac];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ad=new f(this.view,this.view,{name:this.name,drawables:this.drawables});var ac=this.container.replace_drawable(this,ad,true);ad.request_draw()},add_drawable:function(ac){y.prototype.add_drawable.call(this,ac);this.update_icons()},remove_drawable:function(ac){y.prototype.remove_drawable.call(this,ac);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ac=p(y.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ac},request_draw:function(ac){ab.each(this.drawables,function(ad){ad.request_draw(ac)})}});var Y=Backbone.View.extend({initialize:function(ac){p(ac,{obj_type:"View"});y.call(this,"View",ac.container,ac);this.chrom=null;this.vis_id=ac.vis_id;this.dbkey=ac.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new w.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=new F({track:this,params:[{key:"a_color",label:"A Color",type:"color",default_value:"#FF0000"},{key:"c_color",label:"C Color",type:"color",default_value:"#00FF00"},{key:"g_color",label:"G Color",type:"color",default_value:"#0000FF"},{key:"t_color",label:"T Color",type:"color",default_value:"#FF00FF"},{key:"n_color",label:"N Color",type:"color",default_value:"#AAAAAA"},],saved_values:ac.prefs,onchange:function(){track.request_redraw({clear_tile_cache:true})}})},render:function(){this.requested_redraw=false;var ae=this.container,ac=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ae);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ae);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ae);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;j(this.viewport_container,ac);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var af=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){w.select_datasets(select_datasets_url,add_track_async_url,{"f-dbkey":ac.dbkey},function(ag){ab.each(ag,function(ah){ac.add_drawable(o(ah,ac,ac))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ad=function(ag){if(ag.type==="focusout"||(ag.keyCode||ag.which)===13||(ag.keyCode||ag.which)===27){if((ag.keyCode||ag.which)!==27){ac.go_to($(this).val())}$(this).hide();$(this).val("");ac.location_span.show();ac.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ad).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ac.location_span.hide();ac.chrom_select.hide();ac.nav_input.val(ac.chrom+":"+ac.low+"-"+ac.high);ac.nav_input.css("display","inline-block");ac.nav_input.select();ac.nav_input.focus();ac.nav_input.autocomplete({source:function(ai,ag){var aj=[],ah=$.map(ac.get_tracks(c),function(ak){return ak.data_manager.search_features(ai.term).success(function(al){aj=aj.concat(al)})});$.when.apply($,ah).done(function(){ag($.map(aj,function(ak){return{label:ak[0],value:ak[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ac.zoom_out();ac.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ac.zoom_in();ac.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ac.change_chrom(ac.chrom_select.val())});this.browser_content_div.click(function(ag){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ag){ac.zoom_in(ag.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ag,ah){this.current_x=ah.offsetX}).bind("drag",function(ag,ai){var aj=ai.offsetX-this.current_x;this.current_x=ai.offsetX;var ah=Math.round(aj/ac.viewport_container.width()*(ac.max_high-ac.max_low));ac.move_delta(-ah)});this.overview_close.click(function(){ac.reset_overview()});this.viewport_container.bind("draginit",function(ag,ah){if(ag.clientX>ac.viewport_container.width()-16){return false}}).bind("dragstart",function(ag,ah){ah.original_low=ac.low;ah.current_height=ag.clientY;ah.current_x=ah.offsetX}).bind("drag",function(ai,ak){var ag=$(this);var al=ak.offsetX-ak.current_x;var ah=ag.scrollTop()-(ai.clientY-ak.current_height);ag.scrollTop(ah);ak.current_height=ai.clientY;ak.current_x=ak.offsetX;var aj=Math.round(al/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}).bind("mousewheel",function(ai,ak,ah,ag){if(ah){ah*=50;var aj=Math.round(-ah/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}});this.top_labeltrack.bind("dragstart",function(ag,ah){return $("<div />").css({height:ac.browser_content_div.height()+ac.top_labeltrack.height()+ac.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ak,al){$(al.proxy).css({left:Math.min(ak.pageX,al.startX)-ac.container.offset().left,width:Math.abs(ak.pageX-al.startX)});var ah=Math.min(ak.pageX,al.startX)-ac.container.offset().left,ag=Math.max(ak.pageX,al.startX)-ac.container.offset().left,aj=(ac.high-ac.low),ai=ac.viewport_container.width();ac.update_location(Math.round(ah/ai*aj)+ac.low,Math.round(ag/ai*aj)+ac.low)}).bind("dragend",function(al,am){var ah=Math.min(al.pageX,am.startX),ag=Math.max(al.pageX,am.startX),aj=(ac.high-ac.low),ai=ac.viewport_container.width(),ak=ac.low;ac.low=Math.round(ah/ai*aj)+ak;ac.high=Math.round(ag/ai*aj)+ak;$(am.proxy).remove();ac.request_redraw()});this.add_label_track(new W(this,{content_div:this.top_labeltrack}));this.add_label_track(new W(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ac.resize_window()},500)});$(document).bind("redraw",function(){ac.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ac){return this.config.values[ac.toLowerCase()+"_color"]||this.config.values.n_color}});p(Y.prototype,y.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(ad,af,ac,ag){if(this.timer){clearTimeout(this.timer)}if(ag){var ae=this;this.timer=setTimeout(function(){ae.trigger("navigate",ad+":"+af+"-"+ac)},500)}else{view.trigger("navigate",ad+":"+af+"-"+ac)}},update_location:function(ac,ae){this.location_span.text(commatize(ac)+" - "+commatize(ae));this.nav_input.val(this.chrom+":"+commatize(ac)+"-"+commatize(ae));var ad=view.chrom_select.val();if(ad!==""){this.trigger_navigate(ad,view.low,view.high,true)}},load_chroms:function(ae){ae.num=v;var ac=this,ad=$.Deferred();$.ajax({url:chrom_url+"/"+this.dbkey,data:ae,dataType:"json",success:function(ag){if(ag.chrom_info.length===0){return}if(ag.reference){ac.add_label_track(new B(ac))}ac.chrom_data=ag.chrom_info;var aj='<option value="">Select Chrom/Contig</option>';for(var ai=0,af=ac.chrom_data.length;ai<af;ai++){var ah=ac.chrom_data[ai].chrom;aj+='<option value="'+ah+'">'+ah+"</option>"}if(ag.prev_chroms){aj+='<option value="previous">Previous '+v+"</option>"}if(ag.next_chroms){aj+='<option value="next">Next '+v+"</option>"}ac.chrom_select.html(aj);ac.chrom_start_index=ag.start_index;ad.resolve(ag.chrom_info)},error:function(){alert("Could not load chroms for this dbkey:",ac.dbkey)}});return ad},change_chrom:function(ah,ad,aj){var ae=this;if(!ae.chrom_data){ae.load_chroms_deferred.then(function(){ae.change_chrom(ah,ad,aj)});return}if(!ah||ah==="None"){return}if(ah==="previous"){ae.load_chroms({low:this.chrom_start_index-v});return}if(ah==="next"){ae.load_chroms({low:this.chrom_start_index+v});return}var ai=$.grep(ae.chrom_data,function(ak,al){return ak.chrom===ah})[0];if(ai===undefined){ae.load_chroms({chrom:ah},function(){ae.change_chrom(ah,ad,aj)});return}else{if(ah!==ae.chrom){ae.chrom=ah;ae.chrom_select.val(ae.chrom);ae.max_high=ai.len-1;ae.reset();for(var ag=0,ac=ae.drawables.length;ag<ac;ag++){var af=ae.drawables[ag];if(af.init){af.init()}}if(ae.reference_track){ae.reference_track.init()}}if(ad&&aj){ae.low=Math.max(ad,0);ae.high=Math.min(aj,ae.max_high)}else{ae.low=0;ae.high=ae.max_high}ae.reset_overview();ae.request_redraw()}},go_to:function(ag){ag=ag.replace(/,/g,"");ag=ag.replace(/:|\-/g," ");var ad=ag.split(/\s+/),af=ad[0],ae=(ad[1]?parseInt(ad[1],10):null),ac=(ad[2]?parseInt(ad[2],10):null);if(!ac){ae=ae-15;ac=ae+15}this.change_chrom(af,ae,ac)},move_fraction:function(ae){var ac=this;var ad=ac.high-ac.low;this.move_delta(ae*ad)},move_delta:function(af){var ac=this;var ae=ac.high-ac.low;if(ac.low-af<ac.max_low){ac.low=ac.max_low;ac.high=ac.max_low+ae}else{if(ac.high-af>ac.max_high){ac.high=ac.max_high;ac.low=ac.max_high-ae}else{ac.high-=af;ac.low-=af}}ac.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ac.request_redraw()},200);var ad=ac.chrom_select.val();this.trigger_navigate(ad,ac.low,ac.high,true)},add_drawable:function(ac){y.prototype.add_drawable.call(this,ac);ac.init();this.changed();this.update_intro_div()},add_label_track:function(ac){ac.view=this;ac.init();this.label_tracks.push(ac)},remove_drawable:function(ae,ad){y.prototype.remove_drawable.call(this,ae);if(ad){var ac=this;ae.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ad,ae){var ac=this,af=(ae?[ae]:ac.drawables);ab.each(af,function(ag){var ah=ab.find(ac.tracks_to_be_redrawn,function(ai){return ai[0]===ag});if(ah){ah[1]=ad}else{ac.tracks_to_be_redrawn.push([ag,ad])}});if(!this.requested_redraw){requestAnimationFrame(function(){ac._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ac=this.low,ag=this.high;if(ac<this.max_low){ac=this.max_low}if(ag>this.max_high){ag=this.max_high}var ad=this.high-this.low;if(this.high!==0&&ad<this.min_separation){ag=ac+this.min_separation}this.low=Math.floor(ac);this.high=Math.ceil(ag);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=1/this.resolution_b_px;var af=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ah=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=13;this.overview_box.css({left:af,width:Math.max(ae,ah)}).show();if(ah<ae){this.overview_box.css("left",af-(ae-ah)/2)}if(this.overview_highlight){this.overview_highlight.css({left:af,width:ah})}ab.each(this.tracks_to_be_redrawn,function(ak){var ai=ak[0],aj=ak[1];if(ai){ai._draw(aj)}});this.tracks_to_be_redrawn=[];ab.each(this.label_tracks,function(ai){ai._draw()})},zoom_in:function(ad,ae){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var af=this.high-this.low,ag=af/2+this.low,ac=(af/this.zoom_factor)/2;if(ad){ag=ad/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ag-ac);this.high=Math.round(ag+ac);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ad=this.high-this.low,ae=ad/2+this.low,ac=(ad*this.zoom_factor)/2;this.low=Math.round(ae-ac);this.high=Math.round(ae+ac);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(ae){if(this.overview_drawable){if(this.overview_drawable.dataset.id===ae.dataset.id){return}this.overview_viewport.find(".track").remove()}var ad=ae.copy({content_div:this.overview_viewport}),ac=this;ad.header_div.hide();ad.is_overview=true;ac.overview_drawable=ad;this.overview_drawable.postdraw_actions=function(){ac.overview_highlight.show().height(ac.overview_drawable.content_div.height());ac.overview_viewport.height(ac.overview_drawable.content_div.height()+ac.overview_box.outerHeight());ac.overview_close.show();ac.resize_window()};ac.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".bs-tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var r=function(ae,aj,af){this.track=ae;this.id=aj.id;this.name=aj.name;this.params=[];var aq=aj.params;for(var ag=0;ag<aq.length;ag++){var al=aq[ag],ad=al.name,ap=al.label,ah=unescape(al.html),ar=al.value,an=al.type;if(an==="number"){this.params.push(new e(ad,ap,ah,(ad in af?af[ad]:ar),al.min,al.max))}else{if(an==="select"){this.params.push(new O(ad,ap,ah,(ad in af?af[ad]:ar)))}else{console.log("WARNING: unrecognized tool parameter type:",ad,an)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(au){au.stopPropagation()}).click(function(au){au.stopPropagation()}).bind("dblclick",function(au){au.stopPropagation()});var ao=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var am=this.params;var ak=this;$.each(this.params,function(av,ay){var ax=$("<div>").addClass("param-row").appendTo(ak.parent_div);var au=$("<div>").addClass("param-label").text(ay.label).appendTo(ax);var aw=$("<div/>").addClass("param-input").html(ay.html).appendTo(ax);aw.find(":input").val(ay.value);$("<div style='clear: both;'/>").appendTo(ax)});this.parent_div.find("input").click(function(){$(this).select()});var at=$("<div>").addClass("param-row").appendTo(this.parent_div);var ai=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(at);var ac=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(at);ac.click(function(){ak.run_on_region()});ai.click(function(){ak.run_on_dataset()});if("visible" in af&&af.visible){this.parent_div.show()}};p(r.prototype,{update_params:function(){for(var ac=0;ac<this.params.length;ac++){this.params[ac].update_value()}},state_dict:function(){var ad={};for(var ac=0;ac<this.params.length;ac++){ad[this.params[ac].name]=this.params[ac].value}ad.visible=this.parent_div.is(":visible");return ad},get_param_values_dict:function(){var ac={};this.parent_div.find(":input").each(function(){var ad=$(this).attr("name"),ae=$(this).val();ac[ad]=ae});return ac},get_param_values:function(){var ac=[];this.parent_div.find(":input").each(function(){var ad=$(this).attr("name"),ae=$(this).val();if(ad){ac[ac.length]=ae}});return ac},run_on_dataset:function(){var ac=this;ac.run({target_dataset_id:this.track.dataset.id,action:"rerun",tool_id:ac.id},null,function(ad){show_modal(ac.name+" is Running",ac.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ai=new w.GenomeRegion({chrom:this.track.view.chrom,start:this.track.view.low,end:this.track.view.high}),ad={target_dataset_id:this.track.dataset.id,action:"rerun",tool_id:this.id,regions:[ai.toJSON()]},ah=this.track,ae=ad.tool_id+ah.tool_region_and_parameters_str(ai),ac;if(ah.container===view){var ag=new Q(view,view,{name:this.name});var af=ah.container.replace_drawable(ah,ag,false);ag.container_div.insertBefore(ah.view.content_div.children()[af]);ag.add_drawable(ah);ah.container_div.appendTo(ag.content_div);ac=ag}else{ac=ah.container}var aj=new ah.constructor(view,ac,{name:ae,hda_ldda:"hda"});aj.init_for_tool_data();aj.change_mode(ah.mode);aj.set_filters_manager(ah.filters_manager.copy(aj));aj.update_icons();ac.add_drawable(aj);aj.tiles_div.text("Starting job.");this.update_params();this.run(ad,aj,function(ak){aj.set_dataset(new X.Dataset(ak));aj.tiles_div.text("Running job.");aj.init()})},run:function(ac,ae,af){ac.inputs=this.get_param_values_dict();var ad=new k.ServerStateDeferred({ajax_settings:{url:galaxy_paths.get("tool_url"),data:JSON.stringify(ac),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ag){return ag!=="pending"}});$.when(ad.go()).then(function(ag){if(ag==="no converter"){ae.container_div.addClass("error");ae.content_div.text(J)}else{if(ag.error){ae.container_div.addClass("error");ae.content_div.text(x+ag.message)}else{af(ag)}}})}});var O=function(ad,ac,ae,af){this.name=ad;this.label=ac;this.html=$(ae);this.value=af};p(O.prototype,{update_value:function(){this.value=$(this.html).val()}});var e=function(ae,ad,ag,ah,af,ac){O.call(this,ae,ad,ag,ah);this.min=af;this.max=ac};p(e.prototype,O.prototype,{update_value:function(){O.prototype.update_value.call(this);this.value=parseFloat(this.value)}});var C=function(ac,ad){L.Scaler.call(this,ad);this.filter=ac};C.prototype.gen_val=function(ac){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ac[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var F=function(ac){this.track=ac.track;this.params=ac.params;this.values={};this.restore_values((ac.saved_values?ac.saved_values:{}));this.onchange=ac.onchange};p(F.prototype,{set_param_default_value:function(ad,ac){var ae=ab.find(this.params,function(af){return af.key===ad});if(ae){ae.default_value=ac}},set_param_value:function(ac,ad){var ae=ab.find(this.params,function(af){return af.key===ac});if(ae){if(typeof ad==="string"||ad instanceof String){if(ad.trim()===""){ad=ae.default_value}else{if(ae.type==="float"){ad=parseFloat(ad)}else{if(ae.type==="int"){ad=parseInt(ad,10)}}}}}if(this.values[ac]!==ad){this.values[ac]=ad;return true}else{return false}},restore_values:function(ac){var ad=this;$.each(this.params,function(ae,af){if(ac[af.key]!==undefined){ad.values[af.key]=ac[af.key]}else{ad.values[af.key]=af.default_value}})},build_form:function(){var af=this;var ac=$("<div />");var ae;function ad(ak,ag){for(var ao=0;ao<ak.length;ao++){ae=ak[ao];if(ae.hidden){continue}var ai="param_"+ao;var at=af.values[ae.key];var av=$("<div class='form-row' />").appendTo(ag);av.append($("<label />").attr("for",ai).text(ae.label+":"));if(ae.type==="bool"){av.append($('<input type="checkbox" />').attr("id",ai).attr("name",ai).attr("checked",at))}else{if(ae.type==="text"){av.append($('<input type="text"/>').attr("id",ai).val(at).click(function(){$(this).select()}))}else{if(ae.type==="select"){var aq=$("<select />").attr("id",ai);for(var am=0;am<ae.options.length;am++){$("<option/>").text(ae.options[am].label).attr("value",ae.options[am].value).appendTo(aq)}aq.val(at);av.append(aq)}else{if(ae.type==="color"){var au=$("<div/>").appendTo(av),ap=$("<input />").attr("id",ai).attr("name",ai).val(at).css("float","left").appendTo(au).click(function(ax){$(".bs-tooltip").removeClass("in");var aw=$(this).siblings(".bs-tooltip").addClass("in");aw.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(aw).height()/2)+($(this).height()/2)}).show();aw.click(function(ay){ay.stopPropagation()});$(document).bind("click.color-picker",function(){aw.hide();$(document).unbind("click.color-picker")});ax.stopPropagation()}),an=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(au).attr("title","Set new random color").tooltip(),ar=$("<div class='bs-tooltip right' style='position: absolute;' />").appendTo(au).hide(),aj=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(ar),ah=$("<div class='tooltip-arrow'></div>").appendTo(ar),al=$.farbtastic(aj,{width:100,height:100,callback:ap,color:at});au.append($("<div/>").css("clear","both"));(function(aw){an.click(function(){aw.setColor(k.get_random_color())})})(al)}else{av.append($("<input />").attr("id",ai).attr("name",ai).val(at))}}}}if(ae.help){av.append($("<div class='help'/>").text(ae.help))}}}ad(this.params,ac);return ac},update_from_form:function(ac){var ae=this;var ad=false;$.each(this.params,function(af,ah){if(!ah.hidden){var ai="param_"+af;var ag=ac.find("#"+ai).val();if(ah.type==="bool"){ag=ac.find("#"+ai).is(":checked")}ad=ae.set_param_value(ah.key,ag)||ad}});if(ad){this.onchange();this.track.changed()}}});var b=function(ac,ag,ae,ad,af){this.track=ac;this.region=ag;this.low=ag.get("start");this.high=ag.get("end");this.resolution=ae;this.html_elt=$("<div class='track-tile'/>").append(ad).height($(ad).attr("height"));this.data=af;this.stale=false};b.prototype.predisplay_actions=function(){};var M=function(ac,ag,ae,ad,af){b.call(this,ac,ag,ae,ad,af)};M.prototype.predisplay_actions=function(){};var P=function(af,an,ag,ae,ai,ap,aj,aq,ad,am){b.call(this,af,an,ag,ae,ai);this.mode=aj;this.all_slotted=ad;this.feature_mapper=am;this.has_icons=false;if(aq){this.has_icons=true;var ak=this;ae=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:D-1,width:ae.width}).prependTo(this.html_elt);var al=new w.GenomeRegion({chrom:af.view.chrom,start:this.low,end:this.high}),ao=ai.length,ah=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ac=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ah.click(function(){ak.stale=true;af.data_manager.get_more_data(al,af.mode,ak.resolution,{},af.data_manager.DEEP_DATA_REQ);$(".bs-tooltip").hide();af.request_draw()}).dblclick(function(ar){ar.stopPropagation()});ac.click(function(){ak.stale=true;af.data_manager.get_more_data(al,af.mode,ak.resolution,{},af.data_manager.BROAD_DATA_REQ);$(".bs-tooltip").hide();af.request_draw()}).dblclick(function(ar){ar.stopPropagation()})}};p(P.prototype,b.prototype);P.prototype.predisplay_actions=function(){var ad=this,ac={};if(ad.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(ao){if(!this.hovered){return}var aj=$(this).offset(),an=ao.pageX-aj.left,am=ao.pageY-aj.top,at=ad.feature_mapper.get_feature_data(an,am),ak=(at?at[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!ak||$(this).attr("id")!==ak.toString()){$(this).remove()}});if(at){var af=ac[ak];if(!af){var ak=at[0],ap={name:at[3],start:at[1],end:at[2],strand:at[4]},ai=ad.track.filters_manager.filters,ah;for(var al=0;al<ai.length;al++){ah=ai[al];ap[ah.name]=at[ah.index]}var af=$("<div/>").attr("id",ak).addClass("feature-popup"),au=$("<table/>"),ar,aq,av;for(ar in ap){aq=ap[ar];av=$("<tr/>").appendTo(au);$("<th/>").appendTo(av).text(ar);$("<td/>").attr("align","left").appendTo(av).text(typeof(aq)==="number"?V(aq,2):aq)}af.append($("<div class='feature-popup-inner'>").append(au));ac[ak]=af}af.appendTo($(this).parents(".track-content").children(".overlay"));var ag=an+parseInt(ad.html_elt.css("left"))-af.width()/2,ae=am+parseInt(ad.html_elt.css("top"))+7;af.css("left",ag+"px").css("top",ae+"px")}else{if(!ao.isPropagationStopped()){ao.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ao)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var g=function(ad,ac,ae){p(ae,{drag_handle_class:"draghandle"});q.call(this,ad,ac,ae);this.dataset=new X.Dataset(ae.dataset);this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ae?ae.data_query_wait:K);this.data_manager=("data_manager" in ae?ae.data_manager:new w.GenomeDataManager({dataset:this.dataset,genome:new w.Genome({key:ad.dbkey,chroms_info:{chrom_info:ad.chrom_data}}),data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ae)||ae.resize){this.add_resize_handle()}}};p(g.prototype,q.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},q.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ac){ac.view.set_overview(ac)}},q.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters()}else{ac.filters_manager.init_filters()}ac.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ac){ac.dynamic_tool_div.toggle();if(ac.dynamic_tool_div.is(":visible")){ac.set_name(ac.name+ac.tool_region_and_parameters_str())}else{ac.revert_name()}$(".bs-tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ac){var af='<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>',ae=ab.template(af,{track:ac});var ah=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ad=function(){var aj=$('select[name="regions"] option:selected').val(),al,ai=new w.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ak=ab.map($(".bookmark"),function(am){return new w.GenomeRegion({from_str:$(am).children(".position").text()})});if(aj==="cur"){al=[ai]}else{if(aj==="bookmarks"){al=ak}else{al=[ai].concat(ak)}}hide_modal();window.location.href=galaxy_paths.get("sweepster_url")+"?"+$.param({dataset_id:ac.dataset.id,hda_ldda:ac.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(al).toJSON())})},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){ad()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",ae,{No:ah,Yes:ad})}},q.prototype.action_icons_def[2]],can_draw:function(){if(this.dataset.id&&q.prototype.can_draw.call(this)){return true}return false},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ac=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ac)}this.name_div=$("<div/>").addClass("track-name").appendTo(ac).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ac},set_dataset:function(ac){this.dataset=ac;this.data_manager.set("dataset",ac)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ac=this;var af=false;var ae=false;var ad=$("<div class='track-resize'>");$(ac.container_div).hover(function(){if(ac.content_visible){af=true;ad.show()}},function(){af=false;if(!ae){ad.hide()}});ad.hide().bind("dragstart",function(ag,ah){ae=true;ah.original_height=$(ac.content_div).height()}).bind("drag",function(ah,ai){var ag=Math.min(Math.max(ai.original_height+ai.deltaY,ac.min_height_px),ac.max_height_px);$(ac.tiles_div).css("height",ag);ac.visible_height_px=(ac.max_height_px===ag?0:ag);ac.on_resize()}).bind("dragend",function(ag,ah){ac.tile_cache.clear();ae=false;if(!af){ad.hide()}ac.config.values.height=ac.visible_height_px;ac.changed()}).appendTo(ac.container_div)},set_display_modes:function(af,ai){this.display_modes=af;this.mode=(ai?ai:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ad=this,ag={};for(var ae=0,ac=ad.display_modes.length;ae<ac;ae++){var ah=ad.display_modes[ae];ag[ah]=function(aj){return function(){ad.change_mode(aj);ad.icons_div.show();ad.container_div.mouseleave(function(){ad.icons_div.hide()})}}(ah)}make_popupmenu(this.action_icons.mode_icon,ag)},build_action_icons:function(){q.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof W){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof h){return"LineTrack"}else{if(this instanceof T){return"ReadTrack"}else{if(this instanceof Z){return"VariantTrack"}else{if(this instanceof f){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(ae){var ad=this;ad.enabled=false;ad.tile_cache.clear();ad.data_manager.clear();ad.tiles_div.css("height","auto");ad.tiles_div.text("").children().remove();ad.container_div.removeClass("nodata error pending");if(!ad.dataset.id){return}var ac=$.Deferred(),af={hda_ldda:ad.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:ad.view.chrom,retry:ae};$.getJSON(this.dataset.url(),af,function(ag){if(!ag||ag==="error"||ag.kind==="error"){ad.container_div.addClass("error");ad.tiles_div.text(n);if(ag.message){ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ag.message+"</pre>",{Close:hide_modal})}));ad.tiles_div.append($("<span/>").text(" "));ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ad.init(true)}))}}else{if(ag==="no converter"){ad.container_div.addClass("error");ad.tiles_div.text(J)}else{if(ag==="no data"||(ag.data!==undefined&&(ag.data===null||ag.data.length===0))){ad.container_div.addClass("nodata");ad.tiles_div.text(E)}else{if(ag==="pending"){ad.container_div.addClass("pending");ad.tiles_div.html(u);setTimeout(function(){ad.init()},ad.data_query_wait)}else{if(ag==="data"||ag.status==="data"){if(ag.valid_chroms){ad.valid_chroms=ag.valid_chroms;ad.update_icons()}ad.tiles_div.text(U);if(ad.view.chrom){ad.tiles_div.text("");ad.tiles_div.css("height",ad.visible_height_px+"px");ad.enabled=true;$.when.apply($,ad.predraw_init()).done(function(){ac.resolve();ad.container_div.removeClass("nodata error pending");ad.request_draw()})}else{ac.resolve()}}}}}}});this.update_icons();return ac},predraw_init:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){ac.container_div.addClass("line-track");var af=ad.data;if(af&&af.min&&af.max){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.config.set_param_default_value("min_value",ae);ac.config.set_param_default_value("max_value",ag);ac.prefs.min_value=ae;ac.prefs.max_value=ag}})},get_drawables:function(){return this}});var N=function(ae,ad,af){g.call(this,ae,ad,af);var ac=this;l(ac.container_div,ac.drag_handle_class,".group",ac);this.filters_manager=new i.FiltersManager(this,("filters" in af?af.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=("tool" in af&&af.tool?new r(this,af.tool,af.tool_state):null);this.tile_cache=new w.Cache(R);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(af.mode){this.change_mode(af.mode)}};p(N.prototype,q.prototype,g.prototype,{action_icons_def:g.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.slotters[ac.view.resolution_px_b].max_rows*=2;ac.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ac){var ad=this.to_dict();p(ad,{data_manager:this.data_manager});var ae=new this.constructor(this.view,ac,ad);ae.change_mode(this.mode);ae.enabled=this.enabled;return ae},set_filters_manager:function(ac){this.filters_manager=ac;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,dataset:{id:this.dataset.id,hda_ldda:this.dataset.get("hda_ldda")},prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},set_min_max:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){var af=ad.data;if(isNaN(parseFloat(ac.prefs.min_value))||isNaN(parseFloat(ac.prefs.max_value))){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.prefs.min_value=ae;ac.prefs.max_value=ag}})},change_mode:function(ad){var ac=this;ac.mode=ad;ac.config.values.mode=ad;if(ad==="Auto"){this.data_manager.clear()}ac.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ac.mode+")");return ac},update_icons:function(){var ac=this;if(ac.filters_available){ac.action_icons.filters_icon.show()}else{ac.action_icons.filters_icon.hide()}if(ac.tool){ac.action_icons.tools_icon.show();ac.action_icons.param_space_viz_icon.show()}else{ac.action_icons.tools_icon.hide();ac.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ad,ac){return ad+"_"+ac},request_draw:function(ac){if(ac&&ac.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ac,this)},before_draw:function(){this.max_height_px=0},_draw:function(ap){if(!this.can_draw()){return}var am=ap&&ap.clear_after,ak=this.view.low,ag=this.view.high,aj=ag-ak,ad=this.view.container.width(),ao=this.view.resolution_px_b,af=this.view.resolution_b_px;if(this.is_overview){ak=this.view.max_low;ag=this.view.max_high;af=(view.max_high-view.max_low)/ad;ao=1/af}this.before_draw();this.tiles_div.children().addClass("remove");var ac=Math.floor(ak/(af*S)),al,ah,ai=[],an=[];while((ac*S*af)<ag){al=this._get_tile_bounds(ac,af);ah=this.draw_helper(al,af,ao,ap);ai.push(ah);$.when(ah).then(function(aq){an.push(aq)});ac+=1}if(!am){this.tiles_div.children(".remove").removeClass("remove").remove()}var ae=this;$.when.apply($,ai).then(function(){ae.tiles_div.children(".remove").remove();an=ab.filter(an,function(aq){return aq!==null});if(an.length!==0){ae.postdraw_actions(an,ad,ao,am)}})},_add_yaxis_label:function(af,ah){var ad=this,ag=(af==="max"?"top":"bottom"),ai=(af==="max"?"max":"min"),ac=(af==="max"?"max_value":"min_value"),ah=ah||function(){ad.request_draw({clear_tile_cache:true})},ae=this.container_div.find(".yaxislabel."+ag);if(ae.length!==0){ae.text(ad.prefs[ac])}else{ae=$("<div/>").text(ad.prefs[ac]).make_text_editable({num_cols:12,on_finish:function(aj){$(".bs-tooltip").remove();ad.config.set_param_value(ac,aj);ah()},help_text:"Set "+ai+" value"}).addClass("yaxislabel "+ag).css("color",this.prefs.label_color);this.container_div.prepend(ae)}},postdraw_actions:function(af,ag,ai,ac){var ae=ab.filter(af,function(aj){return(aj instanceof M)});if(ae.length>0){this.max_height_px=0;var ad=this;ab.each(af,function(aj){if(!(aj instanceof M)){aj.html_elt.remove();ad.draw_helper(aj.region,aj.resolution,ai,{force:true,mode:"Coverage"})}});ad._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var ah=ab.find(af,function(aj){return aj.has_icons});if(ah){ab.each(af,function(aj){if(!aj.has_icons){aj.html_elt.css("padding-top",D)}})}}},get_mode:function(ac){return this.mode},update_auto_mode:function(ac){},_get_drawables:function(){return[this]},draw_helper:function(al,af,ao,ap){if(!ap){ap={}}var ad=ap.force,an=!(ap.data_fetch===false),ai=ap.mode||this.mode,ae=this,ag=this._get_drawables(),am=this._gen_tile_cache_key(ao,al),ah=function(aq){return(aq&&"track" in aq)};var aj=(ad?undefined:ae.tile_cache.get_elt(am));if(aj){if(ah(aj)){ae.show_tile(aj,ao)}return aj}if(!an){return null}var ak=function(){var aq=(ab.find(A,function(at){return at===ai})?"Coverage":ai);var ar=ab.map(ag,function(at){return at.data_manager.get_data(al,aq,af,ae.data_url_extra_params)});if(view.reference_track){ar.push(view.reference_track.data_manager.get_data(al,ai,af,view.reference_track.data_url_extra_params))}return ar};var ac=$.Deferred();ae.tile_cache.set_elt(am,ac);$.when.apply($,ak()).then(function(){var aq=ak(),aw=aq,aC;if(view.reference_track){aC=view.reference_track.data_manager.subset_entry(aq.pop(),al)}var ax=[],au=[];ab.each(ag,function(aH,aE){var aG=aH.mode,aF=aw[aE];if(aG==="Auto"){aG=aH.get_mode(aF);aH.update_auto_mode(aG)}ax.push(aG);au.push(aH.get_canvas_height(aF,aG,ao,ar))});var av=ae.view.canvas_manager.new_canvas(),ay=al.get("start"),aD=al.get("end"),at=0,ar=Math.ceil((aD-ay)*ao)+ae.left_offset,aA=ab.max(au),az;av.width=ar;av.height=(ap.height||aA);var aB=av.getContext("2d");aB.translate(ae.left_offset,0);if(ag.length>1){aB.globalAlpha=0.5;aB.globalCompositeOperation="source-over"}ab.each(ag,function(aF,aE){az=aF.draw_tile(aw[aE],aB,ax[aE],af,al,ao,aC)});if(az!==undefined){ae.tile_cache.set_elt(am,az);ae.show_tile(az,ao)}ac.resolve(az)});return ac},get_canvas_height:function(ac,ae,af,ad){return this.visible_height_px},_draw_line_track_tile:function(ac,ae,ai,ag,ah,aj){var af=ae.canvas,ad=new L.LinePainter(ac.data,ah.get("start"),ah.get("end"),this.prefs,ai);ad.draw(ae,af.width,af.height,aj);return new M(this,ah,ag,af,ac.data)},draw_tile:function(ac,ad,ah,af,ag,ai,ae){console.log("Warning: TiledTrack.draw_tile() not implemented.")},show_tile:function(ae,ah){var ad=this,ac=ae.html_elt;ae.predisplay_actions();var ag=(ae.low-(this.is_overview?this.view.max_low:this.view.low))*ah;if(this.left_offset){ag-=this.left_offset}ac.css({position:"absolute",top:0,left:ag});if(ac.hasClass("remove")){ac.removeClass("remove")}else{this.tiles_div.append(ac)}ae.html_elt.height("auto");this.max_height_px=Math.max(this.max_height_px,ae.html_elt.height());ae.html_elt.parent().children().css("height",this.max_height_px+"px");var af=this.max_height_px;if(this.visible_height_px!==0){af=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",af+"px")},_get_tile_bounds:function(ac,ad){var af=Math.floor(ac*S*ad),ag=Math.ceil(S*ad),ae=(af+ag<=this.view.max_high?af+ag:this.view.max_high);return new w.GenomeRegion({chrom:this.view.chrom,start:af,end:ae})},tool_region_and_parameters_str:function(ae){var ac=this,ad=(ae!==undefined?ae.toString():"all");return" - region=["+ad+"], parameters=["+ac.tool.get_param_values().join(", ")+"]"},data_and_mode_compatible:function(ac,ad){if(ad==="Auto"){return true}else{if(ad==="Coverage"){return ac.dataset_type==="bigwig"}else{if(ac.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ac){if(ac.dataset_type==="bigwig"||ac.message||ac.extra_info==="no_detail"){return false}return true},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state";this.normal_postdraw_actions=this.postdraw_actions;this.postdraw_actions=function(ae,af,ah,ac){var ad=this;ad.normal_postdraw_actions(ae,af,ah,ac);ad.dataset_check_type="converted_datasets_state";ad.data_query_wait=K;var ag=new k.ServerStateDeferred({url:ad.dataset_state_url,url_params:{dataset_id:ad.dataset.id,hda_ldda:ad.dataset.get("hda_ldda")},interval:ad.data_query_wait,success_fn:function(ai){return ai!=="pending"}});$.when(ag.go()).then(function(){ad.data_manager.set("data_type","data")});ad.postdraw_actions=ad.normal_postdraw_actions}}});var W=function(ad,ac){var ae={resize:false};g.call(this,ad,ac,ae);this.container_div.addClass("label-track")};p(W.prototype,g.prototype,{build_header_div:function(){},init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ag){var ae=this.view,af=ae.high-ae.low,aj=Math.floor(Math.pow(10,Math.floor(Math.log(af)/Math.log(10)))),ac=Math.floor(ae.low/aj)*aj,ah=this.view.container.width(),ad=$("<div style='position: relative; height: 1.3em;'></div>");while(ac<ae.high){var ai=(ac-ae.low)/af*ah;ad.append($("<div class='label'>"+commatize(ac)+"</div>").css({position:"absolute",left:ai-1}));ac+=aj}this.content_div.children(":first").remove();this.content_div.append(ad)}});var f=function(ad,ac,ag){this.display_modes=A;N.call(this,ad,ac,ag);this.drawables=[];if("drawables" in ag){var af;for(var ae=0;ae<ag.drawables.length;ae++){af=ag.drawables[ae];this.drawables[ae]=o(af,ad,null);if(af.left_offset>this.left_offset){this.left_offset=af.left_offset}}this.enabled=true}ab.each(this.drawables,function(ah){if(ah instanceof c||ah instanceof T){ah.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};p(f.prototype,N.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.show_group()}}].concat(N.prototype.action_icons_def),to_dict:y.prototype.to_dict,add_drawable:y.prototype.add_drawable,unpack_drawables:y.prototype.unpack_drawables,change_mode:function(ac){N.prototype.change_mode.call(this,ac);for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].change_mode(ac)}},init:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].init())}var ac=this;$.when.apply($,ae).then(function(){ac.enabled=true;ac.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:q.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var af=new Q(this.view,this.container,{name:this.name}),ac;for(var ae=0;ae<this.drawables.length;ae++){ac=this.drawables[ae];ac.update_icons();af.add_drawable(ac);ac.container=af;af.content_div.append(ac.container_div)}var ad=this.container.replace_drawable(this,af,true);af.request_draw({clear_tile_cache:true})},before_draw:function(){N.prototype.before_draw.call(this);var ad=ab.min(ab.map(this.drawables,function(ae){return ae.prefs.min_value})),ac=ab.max(ab.map(this.drawables,function(ae){return ae.prefs.max_value}));this.prefs.min_value=ad;this.prefs.max_value=ac;ab.each(this.drawables,function(ae){ae.prefs.min_value=ad;ae.prefs.max_value=ac})},update_all_min_max:function(){var ac=this;ab.each(this.drawables,function(ad){ad.prefs.min_value=ac.prefs.min_value;ad.prefs.max_value=ac.prefs.max_value});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(ai,ac,al,ah){N.prototype.postdraw_actions.call(this,ai,ac,al,ah);var ag=-1;for(var ae=0;ae<ai.length;ae++){var aj=ai[ae].html_elt.find("canvas").height();if(aj>ag){ag=aj}}for(var ae=0;ae<ai.length;ae++){var af=ai[ae];if(af.html_elt.find("canvas").height()!==ag){this.draw_helper(af.region,af.resolution,al,{force:true,height:ag});af.html_elt.remove()}}var ad=this,ak=function(){ad.update_all_min_max()};this._add_yaxis_label("min",ak);this._add_yaxis_label("max",ak)}});var B=function(ac){N.call(this,ac,{content_div:ac.top_labeltrack},{resize:false});ac.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url+"/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new w.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};p(B.prototype,q.prototype,N.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:q.prototype.can_draw,draw_helper:function(ae,ad,af,ac){if(af>this.view.canvas_manager.char_width_px){this.tiles_div.show();return N.prototype.draw_helper.call(this,ae,ad,af,ac)}else{this.tiles_div.hide();return null}},can_subset:function(ac){return true},draw_tile:function(af,al,ag,ad,ai,am){var ae=this.data_manager.subset_entry(af,ai),ak=ae.data;var ac=al.canvas;al.font=al.canvas.manager.default_font;al.textAlign="center";for(var ah=0,aj=ak.length;ah<aj;ah++){al.fillStyle=this.view.get_base_color(ak[ah]);al.fillText(ak[ah],Math.floor(ah*am),10)}return new b(this,ai,ad,ac,ae)}});var h=function(ae,ad,af){var ac=this;this.display_modes=A;this.mode="Histogram";N.call(this,ae,ad,af);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:k.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:af.prefs,onchange:function(){ac.set_name(ac.prefs.name);ac.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};p(h.prototype,q.prototype,N.prototype,{before_draw:function(){},draw_tile:function(ac,ad,ag,ae,af,ah){return this._draw_line_track_tile(ac,ad,ag,ae,af,ah)},can_subset:function(ac){return(ac.data[1][0]-ac.data[0][0]===1)},postdraw_actions:function(ad,ae,af,ac){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var s=function(ae,ad,af){var ac=this;this.display_modes=["Heatmap"];this.mode="Heatmap";N.call(this,ae,ad,af);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:af.prefs,onchange:function(){ac.set_name(ac.prefs.name);this.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};p(s.prototype,q.prototype,N.prototype,{draw_tile:function(ac,ae,ai,ag,ah,aj){var af=ae.canvas,ad=new L.DiagonalHeatmapPainter(ac.data,ah.get("start"),ah.get("end"),this.prefs,ai);ad.draw(ae,af.width,af.height,aj);return new b(this,ah,ag,af,ac.data)}});var c=function(af,ae,ah){var ad=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,af,ae,ah);var ag=k.get_random_color(),ac=k.get_random_color([ag,"#FFFFFF"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ag},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ac},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ah.prefs,onchange:function(){ad.set_name(ad.prefs.name);ad.set_painter_from_config();ad.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};p(c.prototype,q.prototype,N.prototype,{set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},postdraw_actions:function(am,ae,an,al){N.prototype.postdraw_actions.call(this,am,ae,an,al);var ag=this,ah;if(ag.filters_manager){var af=ag.filters_manager.filters;for(var aj=0;aj<af.length;aj++){af[aj].update_ui_elt()}var ai=false,ak,ad;for(ah=0;ah<am.length;ah++){if(am[ah].data.length){ak=am[ah].data[0];for(var aj=0;aj<af.length;aj++){ad=af[aj];if(ad.applies_to(ak)&&ad.min!==ad.max){ai=true;break}}}}if(ag.filters_available!==ai){ag.filters_available=ai;if(!ag.filters_available){ag.filters_manager.hide()}ag.update_icons()}}if(am[0] instanceof P){var ac=true;for(ah=0;ah<am.length;ah++){if(!am[ah].all_slotted){ac=false;break}}if(!ac){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ac){var ac;if(this.mode==="Auto"){if(ac==="no_detail"){ac="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ac+")")}},incremental_slots:function(ag,ac,af){var ad=this.view.canvas_manager.dummy_context,ae=this.slotters[ag];if(!ae||(ae.mode!==af)){ae=new (t.FeatureSlotter)(ag,af,z,function(ah){return ad.measureText(ah)});this.slotters[ag]=ae}return ae.slot_features(ac)},get_mode:function(ac){if(ac.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>I){mode="Squish"}else{mode="Pack"}}return mode},get_canvas_height:function(ac,ag,ah,ad){if(ag==="Coverage"||ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var af=this.incremental_slots(ah,ac.data,ag);var ae=new (this.painter)(null,null,null,this.prefs,ag);return Math.max(aa,ae.get_required_height(af,ad))}},draw_tile:function(am,aq,ao,ar,af,aj,ae){var ap=this,ad=aq.canvas,ay=af.get("start"),ac=af.get("end"),ag=this.left_offset;if(am.dataset_type==="bigwig"){return this._draw_line_track_tile(am,aq,ao,ar,af,aj)}var ai=[],an=this.slotters[aj].slots;all_slotted=true;if(am.data){var ak=this.filters_manager.filters;for(var at=0,av=am.data.length;at<av;at++){var ah=am.data[at];var au=false;var al;for(var ax=0,aC=ak.length;ax<aC;ax++){al=ak[ax];al.update_attrs(ah);if(!al.keep(ah)){au=true;break}}if(!au){ai.push(ah);if(!(ah[0] in an)){all_slotted=false}}}}var aB=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null),az=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null),aA=new (this.painter)(ai,ay,ac,this.prefs,ao,aB,az,ae,function(aD){return ap.view.get_base_color(aD)});var aw=null;aq.fillStyle=this.prefs.block_color;aq.font=aq.canvas.manager.default_font;aq.textAlign="right";if(am.data){aw=aA.draw(aq,ad.width,ad.height,aj,an);aw.translation=-ag}return new P(ap,af,ar,ad,am.data,aj,ao,am.message,all_slotted,aw)}});var Z=function(ad,ac,ae){this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ad,ac,ae);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Histogram color",type:"color",default_value:k.get_random_color()},{key:"show_sample_data",label:"Show sample data",type:"bool",default_value:true},{key:"show_labels",label:"Show summary and sample labels",type:"bool",default_value:true},{key:"summary_height",label:"Locus summary height",type:"float",default_value:20},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ae.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=L.VariantPainter;this.summary_draw_height=30;this.left_offset=30};p(Z.prototype,q.prototype,N.prototype,{draw_tile:function(ac,af,ai,ag,ah,aj){if(ac.dataset_type==="bigwig"){return this._draw_line_track_tile(ac,af,"Histogram",ag,ah,aj)}else{var ae=this.view,ad=new (this.painter)(ac.data,ah.get("start"),ah.get("end"),this.prefs,ai,function(ak){return ae.get_base_color(ak)});ad.draw(af,af.canvas.width,af.canvas.height,aj);return new b(this,ah,ag,af.canvas,ac.data)}},get_canvas_height:function(ac,ag,ah,ae){if(ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var af=new (this.painter)(null,null,null,this.prefs,ag);var ad=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(ad===0&&ac.data.length!==0){ad=ac.data[0][7].match(/,/g);if(ad===null){ad=1}else{ad=ad.length+1}}return af.get_required_height(ad)}},predraw_init:function(){var ac=[g.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ac.push(this.dataset.fetch())}return ac},postdraw_actions:function(af,ag,ai,ad){N.prototype.postdraw_actions.call(this,af,ag,ai,ad);var ae=ab.filter(af,function(aj){return(aj instanceof M)});if(ae.length===0&&this.prefs.show_labels){var ac;if(this.container_div.find(".yaxislabel.variant").length===0){ac=this.prefs.summary_height/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ac+"px",top:(this.prefs.summary_height-ac)/2+"px"}));if(this.prefs.show_sample_data){var ah=this.dataset.get("metadata").get("sample_names").join("<br/>");this.tiles_div.prepend($("<div/>").html(ah).addClass("yaxislabel variant top sample").css({top:this.prefs.summary_height+2,}))}}ac=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ac,"line-height":ac});$(this.tiles_div).find(".yaxislabel").css("color",this.prefs.label_color)}else{this.container_div.find(".yaxislabel.variant").remove()}}});var T=function(ae,ad,ag){c.call(this,ae,ad,ag);var af=k.get_random_color(),ac=k.get_random_color([af,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:af},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ac},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{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:"mode",type:"string",default_value:this.mode,hidden:true},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=(ae.reference_track?L.RefBasedReadPainter:L.ReadPainter);this.update_icons()};p(T.prototype,q.prototype,N.prototype,c.prototype);var d={CompositeTrack:f,DrawableGroup:Q,DiagonalHeatmapTrack:s,FeatureTrack:c,LineTrack:h,ReadTrack:T,VariantTrack:Z,VcfTrack:Z};var o=function(ae,ad,ac){if("copy" in ae){return ae.copy(ac)}else{var af=ae.obj_type;if(!af){af=ae.track_type}return new d[af](ad,ac,ae)}};return{TracksterView:Y,DrawableGroup:Q,LineTrack:h,FeatureTrack:c,DiagonalHeatmapTrack:s,ReadTrack:T,VariantTrack:Z,CompositeTrack:f,object_from_template:o}});
\ No newline at end of file
+define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","mvc/data","viz/trackster/filters"],function(ab,w,k,t,L,X,i){var p=ab.extend;var m={};var j=function(ac,ad){m[ac.attr("id")]=ad};var l=function(ac,ae,ag,af){ag=".group";var ad={};m[ac.attr("id")]=af;ac.bind("drag",{handle:"."+ae,relative:true},function(ao,ap){var an=$(this),at=$(this).parent(),ak=at.children(),am=m[$(this).attr("id")],aj,ai,aq,ah,al;ai=$(this).parents(ag);if(ai.length!==0){aq=ai.position().top;ah=aq+ai.outerHeight();if(ap.offsetY<aq){$(this).insertBefore(ai);var ar=m[ai.attr("id")];ar.remove_drawable(am);ar.container.add_drawable_before(am,ar);return}else{if(ap.offsetY>ah){$(this).insertAfter(ai);var ar=m[ai.attr("id")];ar.remove_drawable(am);ar.container.add_drawable(am);return}}}ai=null;for(al=0;al<ak.length;al++){aj=$(ak.get(al));aq=aj.position().top;ah=aq+aj.outerHeight();if(aj.is(ag)&&this!==aj.get(0)&&ap.offsetY>=aq&&ap.offsetY<=ah){if(ap.offsetY-aq<ah-ap.offsetY){aj.find(".content-div").prepend(this)}else{aj.find(".content-div").append(this)}if(am.container){am.container.remove_drawable(am)}m[aj.attr("id")].add_drawable(am);return}}for(al=0;al<ak.length;al++){aj=$(ak.get(al));if(ap.offsetY<aj.position().top&&!(aj.hasClass("reference-track")||aj.hasClass("intro"))){break}}if(al===ak.length){if(this!==ak.get(al-1)){at.append(this);m[at.attr("id")].move_drawable(am,al)}}else{if(this!==ak.get(al)){$(this).insertBefore(ak.get(al));m[at.attr("id")].move_drawable(am,(ap.deltaY>0?al-1:al))}}}).bind("dragstart",function(){ad["border-top"]=ac.css("border-top");ad["border-bottom"]=ac.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ad)})};var aa=16,G=9,D=20,z=100,I=12000,S=400,K=5000,v=100,n="Cannot display dataset due to an error. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",u="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",x="Tool cannot be rerun: ",a="Loading data...",U="Ready for display",R=10,H=20,A=["Histogram","Line","Filled","Intensity"];function V(ad,ac){if(!ac){ac=0}var ae=Math.pow(10,ac);return Math.round(ad*ae)/ae}var q=function(ad,ac,af){if(!q.id_counter){q.id_counter=0}this.id=q.id_counter++;this.name=af.name;this.view=ad;this.container=ac;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:af.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=af.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ag){ag.stopPropagation()});var ae=this;this.container_div.hover(function(){ae.icons_div.show()},function(){ae.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};q.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ac){if(ac.content_visible){ac.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ac.hide_contents();ac.content_visible=false}else{ac.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ac.content_visible=true;ac.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ad){var af=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ac=function(){ad.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(ag){if((ag.keyCode||ag.which)===27){af()}else{if((ag.keyCode||ag.which)===13){ac()}}};$(window).bind("keypress.check_enter_esc",ae);show_modal("Configure",ad.config.build_form(),{Cancel:af,OK:ac})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.remove()}}];p(q.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(ac){},to_dict:function(){},set_name:function(ac){this.old_name=this.name;this.name=ac;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ac=this.view;this.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ad,ai,ah,ag,ac,af){var ae=this;this.action_icons[ad]=$("<a/>").attr("href","javascript:void(0);").attr("title",ai).addClass("icon-button").addClass(ah).tooltip().click(function(){ag(ae)}).appendTo(this.icons_div);if(af){this.action_icons[ad].hide()}},build_action_icons:function(ac){var ae;for(var ad=0;ad<ac.length;ad++){ae=ac[ad];this.add_action_icon(ae.name,ae.title,ae.css_class,ae.on_click_fn,ae.prepend,ae.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var y=function(ad,ac,ae){q.call(this,ad,ac,ae);this.obj_type=ae.obj_type;this.drawables=[]};p(y.prototype,q.prototype,{unpack_drawables:function(ae){this.drawables=[];var ad;for(var ac=0;ac<ae.length;ac++){ad=o(ae[ac],this.view,this);this.add_drawable(ad)}},init:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].init()}},_draw:function(ac){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad]._draw(ac)}},to_dict:function(){var ad=[];for(var ac=0;ac<this.drawables.length;ac++){ad.push(this.drawables[ac].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ad}},add_drawable:function(ac){this.drawables.push(ac);ac.container=this;this.changed()},add_drawable_before:function(ae,ac){this.changed();var ad=this.drawables.indexOf(ac);if(ad!==-1){this.drawables.splice(ad,0,ae);return true}return false},replace_drawable:function(ae,ac,ad){var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables[af]=ac;if(ad){ae.container_div.replaceWith(ac.container_div)}this.changed()}return af},remove_drawable:function(ad){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);ad.container=null;this.changed();return true}return false},move_drawable:function(ad,ae){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);this.drawables.splice(ae,0,ad);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(af){var ac=this.drawables.slice(0),ad=[],ae;while(ac.length!==0){ae=ac.shift();if(ae instanceof af){ad.push(ae)}else{if(ae.drawables){ac=ac.concat(ae.drawables)}}}return ad}});var Q=function(ad,ac,af){p(af,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});y.call(this,ad,ac,af);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);j(this.container_div,this);j(this.content_div,this);l(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new i.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in af){this.unpack_drawables(af.drawables)}if("filters" in af){var ae=this.filters_manager;this.filters_manager=new i.FiltersManager(this,af.filters);ae.parent_div.replaceWith(this.filters_manager.parent_div);if(af.filters.visible){this.setup_multitrack_filtering()}}};p(Q.prototype,q.prototype,y.prototype,{action_icons_def:[q.prototype.action_icons_def[0],q.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters();ac._restore_filter_managers()}else{ac.setup_multitrack_filtering();ac.request_draw({clear_tile_cache:true})}ac.filters_manager.toggle()}},q.prototype.action_icons_def[2]],build_container_div:function(){var ac=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ac)}return ac},build_header_div:function(){var ac=$("<div/>").addClass("track-header");ac.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ac);return ac},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ae=this.drawables.length;if(ae===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ae===1){if(this.drawables[0] instanceof f){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var al,ak,ai,ao=true,ag=this.drawables[0].get_type(),ac=0;for(al=0;al<ae;al++){ai=this.drawables[al];if(ai.get_type()!==ag){can_composite=false;break}if(ai instanceof c){ac++}}if(ao||ac===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".bs-tooltip").remove()}if(ac>1&&ac===this.drawables.length){var ap={},ad;ai=this.drawables[0];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];ap[ad.name]=[ad]}for(al=1;al<this.drawables.length;al++){ai=this.drawables[al];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];if(ad.name in ap){ap[ad.name].push(ad)}}}this.filters_manager.remove_all();var af,ah,aj,am;for(var an in ap){af=ap[an];if(af.length===ac){ah=new i.NumberFilter({name:af[0].name,index:af[0].index});this.filters_manager.add_filter(ah)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].filters_manager=this.saved_filters_managers[ac]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ac=0;ac<this.drawables.length;ac++){drawable=this.drawables[ac];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ad=new f(this.view,this.view,{name:this.name,drawables:this.drawables});var ac=this.container.replace_drawable(this,ad,true);ad.request_draw()},add_drawable:function(ac){y.prototype.add_drawable.call(this,ac);this.update_icons()},remove_drawable:function(ac){y.prototype.remove_drawable.call(this,ac);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ac=p(y.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ac},request_draw:function(ac){ab.each(this.drawables,function(ad){ad.request_draw(ac)})}});var Y=Backbone.View.extend({initialize:function(ac){p(ac,{obj_type:"View"});y.call(this,"View",ac.container,ac);this.chrom=null;this.vis_id=ac.vis_id;this.dbkey=ac.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new w.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=new F({track:this,params:[{key:"a_color",label:"A Color",type:"color",default_value:"#FF0000"},{key:"c_color",label:"C Color",type:"color",default_value:"#00FF00"},{key:"g_color",label:"G Color",type:"color",default_value:"#0000FF"},{key:"t_color",label:"T Color",type:"color",default_value:"#FF00FF"},{key:"n_color",label:"N Color",type:"color",default_value:"#AAAAAA"},],saved_values:ac.prefs,onchange:function(){track.request_redraw({clear_tile_cache:true})}})},render:function(){this.requested_redraw=false;var ae=this.container,ac=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ae);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ae);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ae);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;j(this.viewport_container,ac);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var af=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){w.select_datasets(select_datasets_url,add_track_async_url,{"f-dbkey":ac.dbkey},function(ag){ab.each(ag,function(ah){ac.add_drawable(o(ah,ac,ac))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ad=function(ag){if(ag.type==="focusout"||(ag.keyCode||ag.which)===13||(ag.keyCode||ag.which)===27){if((ag.keyCode||ag.which)!==27){ac.go_to($(this).val())}$(this).hide();$(this).val("");ac.location_span.show();ac.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ad).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ac.location_span.hide();ac.chrom_select.hide();ac.nav_input.val(ac.chrom+":"+ac.low+"-"+ac.high);ac.nav_input.css("display","inline-block");ac.nav_input.select();ac.nav_input.focus();ac.nav_input.autocomplete({source:function(ai,ag){var aj=[],ah=$.map(ac.get_tracks(c),function(ak){return ak.data_manager.search_features(ai.term).success(function(al){aj=aj.concat(al)})});$.when.apply($,ah).done(function(){ag($.map(aj,function(ak){return{label:ak[0],value:ak[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ac.zoom_out();ac.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ac.zoom_in();ac.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ac.change_chrom(ac.chrom_select.val())});this.browser_content_div.click(function(ag){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ag){ac.zoom_in(ag.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ag,ah){this.current_x=ah.offsetX}).bind("drag",function(ag,ai){var aj=ai.offsetX-this.current_x;this.current_x=ai.offsetX;var ah=Math.round(aj/ac.viewport_container.width()*(ac.max_high-ac.max_low));ac.move_delta(-ah)});this.overview_close.click(function(){ac.reset_overview()});this.viewport_container.bind("draginit",function(ag,ah){if(ag.clientX>ac.viewport_container.width()-16){return false}}).bind("dragstart",function(ag,ah){ah.original_low=ac.low;ah.current_height=ag.clientY;ah.current_x=ah.offsetX}).bind("drag",function(ai,ak){var ag=$(this);var al=ak.offsetX-ak.current_x;var ah=ag.scrollTop()-(ai.clientY-ak.current_height);ag.scrollTop(ah);ak.current_height=ai.clientY;ak.current_x=ak.offsetX;var aj=Math.round(al/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}).bind("mousewheel",function(ai,ak,ah,ag){if(ah){ah*=50;var aj=Math.round(-ah/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}});this.top_labeltrack.bind("dragstart",function(ag,ah){return $("<div />").css({height:ac.browser_content_div.height()+ac.top_labeltrack.height()+ac.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ak,al){$(al.proxy).css({left:Math.min(ak.pageX,al.startX)-ac.container.offset().left,width:Math.abs(ak.pageX-al.startX)});var ah=Math.min(ak.pageX,al.startX)-ac.container.offset().left,ag=Math.max(ak.pageX,al.startX)-ac.container.offset().left,aj=(ac.high-ac.low),ai=ac.viewport_container.width();ac.update_location(Math.round(ah/ai*aj)+ac.low,Math.round(ag/ai*aj)+ac.low)}).bind("dragend",function(al,am){var ah=Math.min(al.pageX,am.startX),ag=Math.max(al.pageX,am.startX),aj=(ac.high-ac.low),ai=ac.viewport_container.width(),ak=ac.low;ac.low=Math.round(ah/ai*aj)+ak;ac.high=Math.round(ag/ai*aj)+ak;$(am.proxy).remove();ac.request_redraw()});this.add_label_track(new W(this,{content_div:this.top_labeltrack}));this.add_label_track(new W(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ac.resize_window()},500)});$(document).bind("redraw",function(){ac.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ac){return this.config.values[ac.toLowerCase()+"_color"]||this.config.values.n_color}});p(Y.prototype,y.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(ad,af,ac,ag){if(this.timer){clearTimeout(this.timer)}if(ag){var ae=this;this.timer=setTimeout(function(){ae.trigger("navigate",ad+":"+af+"-"+ac)},500)}else{view.trigger("navigate",ad+":"+af+"-"+ac)}},update_location:function(ac,ae){this.location_span.text(commatize(ac)+" - "+commatize(ae));this.nav_input.val(this.chrom+":"+commatize(ac)+"-"+commatize(ae));var ad=view.chrom_select.val();if(ad!==""){this.trigger_navigate(ad,view.low,view.high,true)}},load_chroms:function(ae){ae.num=v;var ac=this,ad=$.Deferred();$.ajax({url:chrom_url+"/"+this.dbkey,data:ae,dataType:"json",success:function(ag){if(ag.chrom_info.length===0){return}if(ag.reference){ac.add_label_track(new B(ac))}ac.chrom_data=ag.chrom_info;var aj='<option value="">Select Chrom/Contig</option>';for(var ai=0,af=ac.chrom_data.length;ai<af;ai++){var ah=ac.chrom_data[ai].chrom;aj+='<option value="'+ah+'">'+ah+"</option>"}if(ag.prev_chroms){aj+='<option value="previous">Previous '+v+"</option>"}if(ag.next_chroms){aj+='<option value="next">Next '+v+"</option>"}ac.chrom_select.html(aj);ac.chrom_start_index=ag.start_index;ad.resolve(ag.chrom_info)},error:function(){alert("Could not load chroms for this dbkey:",ac.dbkey)}});return ad},change_chrom:function(ah,ad,aj){var ae=this;if(!ae.chrom_data){ae.load_chroms_deferred.then(function(){ae.change_chrom(ah,ad,aj)});return}if(!ah||ah==="None"){return}if(ah==="previous"){ae.load_chroms({low:this.chrom_start_index-v});return}if(ah==="next"){ae.load_chroms({low:this.chrom_start_index+v});return}var ai=$.grep(ae.chrom_data,function(ak,al){return ak.chrom===ah})[0];if(ai===undefined){ae.load_chroms({chrom:ah},function(){ae.change_chrom(ah,ad,aj)});return}else{if(ah!==ae.chrom){ae.chrom=ah;ae.chrom_select.val(ae.chrom);ae.max_high=ai.len-1;ae.reset();for(var ag=0,ac=ae.drawables.length;ag<ac;ag++){var af=ae.drawables[ag];if(af.init){af.init()}}if(ae.reference_track){ae.reference_track.init()}}if(ad&&aj){ae.low=Math.max(ad,0);ae.high=Math.min(aj,ae.max_high)}else{ae.low=0;ae.high=ae.max_high}ae.reset_overview();ae.request_redraw()}},go_to:function(ag){ag=ag.replace(/,/g,"");ag=ag.replace(/:|\-/g," ");var ad=ag.split(/\s+/),af=ad[0],ae=(ad[1]?parseInt(ad[1],10):null),ac=(ad[2]?parseInt(ad[2],10):null);if(!ac){ae=ae-15;ac=ae+15}this.change_chrom(af,ae,ac)},move_fraction:function(ae){var ac=this;var ad=ac.high-ac.low;this.move_delta(ae*ad)},move_delta:function(af){var ac=this;var ae=ac.high-ac.low;if(ac.low-af<ac.max_low){ac.low=ac.max_low;ac.high=ac.max_low+ae}else{if(ac.high-af>ac.max_high){ac.high=ac.max_high;ac.low=ac.max_high-ae}else{ac.high-=af;ac.low-=af}}ac.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ac.request_redraw()},200);var ad=ac.chrom_select.val();this.trigger_navigate(ad,ac.low,ac.high,true)},add_drawable:function(ac){y.prototype.add_drawable.call(this,ac);ac.init();this.changed();this.update_intro_div()},add_label_track:function(ac){ac.view=this;ac.init();this.label_tracks.push(ac)},remove_drawable:function(ae,ad){y.prototype.remove_drawable.call(this,ae);if(ad){var ac=this;ae.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ad,ae){var ac=this,af=(ae?[ae]:ac.drawables);ab.each(af,function(ag){var ah=ab.find(ac.tracks_to_be_redrawn,function(ai){return ai[0]===ag});if(ah){ah[1]=ad}else{ac.tracks_to_be_redrawn.push([ag,ad])}});if(!this.requested_redraw){requestAnimationFrame(function(){ac._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ac=this.low,ag=this.high;if(ac<this.max_low){ac=this.max_low}if(ag>this.max_high){ag=this.max_high}var ad=this.high-this.low;if(this.high!==0&&ad<this.min_separation){ag=ac+this.min_separation}this.low=Math.floor(ac);this.high=Math.ceil(ag);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=1/this.resolution_b_px;var af=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ah=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=13;this.overview_box.css({left:af,width:Math.max(ae,ah)}).show();if(ah<ae){this.overview_box.css("left",af-(ae-ah)/2)}if(this.overview_highlight){this.overview_highlight.css({left:af,width:ah})}ab.each(this.tracks_to_be_redrawn,function(ak){var ai=ak[0],aj=ak[1];if(ai){ai._draw(aj)}});this.tracks_to_be_redrawn=[];ab.each(this.label_tracks,function(ai){ai._draw()})},zoom_in:function(ad,ae){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var af=this.high-this.low,ag=af/2+this.low,ac=(af/this.zoom_factor)/2;if(ad){ag=ad/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ag-ac);this.high=Math.round(ag+ac);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ad=this.high-this.low,ae=ad/2+this.low,ac=(ad*this.zoom_factor)/2;this.low=Math.round(ae-ac);this.high=Math.round(ae+ac);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(ae){if(this.overview_drawable){if(this.overview_drawable.dataset.id===ae.dataset.id){return}this.overview_viewport.find(".track").remove()}var ad=ae.copy({content_div:this.overview_viewport}),ac=this;ad.header_div.hide();ad.is_overview=true;ac.overview_drawable=ad;this.overview_drawable.postdraw_actions=function(){ac.overview_highlight.show().height(ac.overview_drawable.content_div.height());ac.overview_viewport.height(ac.overview_drawable.content_div.height()+ac.overview_box.outerHeight());ac.overview_close.show();ac.resize_window()};ac.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".bs-tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var r=function(ae,aj,af){this.track=ae;this.id=aj.id;this.name=aj.name;this.params=[];var aq=aj.params;for(var ag=0;ag<aq.length;ag++){var al=aq[ag],ad=al.name,ap=al.label,ah=unescape(al.html),ar=al.value,an=al.type;if(an==="number"){this.params.push(new e(ad,ap,ah,(ad in af?af[ad]:ar),al.min,al.max))}else{if(an==="select"){this.params.push(new O(ad,ap,ah,(ad in af?af[ad]:ar)))}else{console.log("WARNING: unrecognized tool parameter type:",ad,an)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(au){au.stopPropagation()}).click(function(au){au.stopPropagation()}).bind("dblclick",function(au){au.stopPropagation()});var ao=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var am=this.params;var ak=this;$.each(this.params,function(av,ay){var ax=$("<div>").addClass("param-row").appendTo(ak.parent_div);var au=$("<div>").addClass("param-label").text(ay.label).appendTo(ax);var aw=$("<div/>").addClass("param-input").html(ay.html).appendTo(ax);aw.find(":input").val(ay.value);$("<div style='clear: both;'/>").appendTo(ax)});this.parent_div.find("input").click(function(){$(this).select()});var at=$("<div>").addClass("param-row").appendTo(this.parent_div);var ai=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(at);var ac=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(at);ac.click(function(){ak.run_on_region()});ai.click(function(){ak.run_on_dataset()});if("visible" in af&&af.visible){this.parent_div.show()}};p(r.prototype,{update_params:function(){for(var ac=0;ac<this.params.length;ac++){this.params[ac].update_value()}},state_dict:function(){var ad={};for(var ac=0;ac<this.params.length;ac++){ad[this.params[ac].name]=this.params[ac].value}ad.visible=this.parent_div.is(":visible");return ad},get_param_values_dict:function(){var ac={};this.parent_div.find(":input").each(function(){var ad=$(this).attr("name"),ae=$(this).val();ac[ad]=ae});return ac},get_param_values:function(){var ac=[];this.parent_div.find(":input").each(function(){var ad=$(this).attr("name"),ae=$(this).val();if(ad){ac[ac.length]=ae}});return ac},run_on_dataset:function(){var ac=this;ac.run({target_dataset_id:this.track.dataset.id,action:"rerun",tool_id:ac.id},null,function(ad){show_modal(ac.name+" is Running",ac.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ai=new w.GenomeRegion({chrom:this.track.view.chrom,start:this.track.view.low,end:this.track.view.high}),ad={target_dataset_id:this.track.dataset.id,action:"rerun",tool_id:this.id,regions:[ai.toJSON()]},ah=this.track,ae=ad.tool_id+ah.tool_region_and_parameters_str(ai),ac;if(ah.container===view){var ag=new Q(view,view,{name:this.name});var af=ah.container.replace_drawable(ah,ag,false);ag.container_div.insertBefore(ah.view.content_div.children()[af]);ag.add_drawable(ah);ah.container_div.appendTo(ag.content_div);ac=ag}else{ac=ah.container}var aj=new ah.constructor(view,ac,{name:ae,hda_ldda:"hda"});aj.init_for_tool_data();aj.change_mode(ah.mode);aj.set_filters_manager(ah.filters_manager.copy(aj));aj.update_icons();ac.add_drawable(aj);aj.tiles_div.text("Starting job.");this.update_params();this.run(ad,aj,function(ak){aj.set_dataset(new X.Dataset(ak));aj.tiles_div.text("Running job.");aj.init()})},run:function(ac,ae,af){ac.inputs=this.get_param_values_dict();var ad=new k.ServerStateDeferred({ajax_settings:{url:galaxy_paths.get("tool_url"),data:JSON.stringify(ac),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ag){return ag!=="pending"}});$.when(ad.go()).then(function(ag){if(ag==="no converter"){ae.container_div.addClass("error");ae.content_div.text(J)}else{if(ag.error){ae.container_div.addClass("error");ae.content_div.text(x+ag.message)}else{af(ag)}}})}});var O=function(ad,ac,ae,af){this.name=ad;this.label=ac;this.html=$(ae);this.value=af};p(O.prototype,{update_value:function(){this.value=$(this.html).val()}});var e=function(ae,ad,ag,ah,af,ac){O.call(this,ae,ad,ag,ah);this.min=af;this.max=ac};p(e.prototype,O.prototype,{update_value:function(){O.prototype.update_value.call(this);this.value=parseFloat(this.value)}});var C=function(ac,ad){L.Scaler.call(this,ad);this.filter=ac};C.prototype.gen_val=function(ac){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ac[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var F=function(ac){this.track=ac.track;this.params=ac.params;this.values={};this.restore_values((ac.saved_values?ac.saved_values:{}));this.onchange=ac.onchange};p(F.prototype,{set_param_default_value:function(ad,ac){var ae=ab.find(this.params,function(af){return af.key===ad});if(ae){ae.default_value=ac}},set_param_value:function(ac,ad){var ae=ab.find(this.params,function(af){return af.key===ac});if(ae){if(typeof ad==="string"||ad instanceof String){if(ad.trim()===""){ad=ae.default_value}else{if(ae.type==="float"){ad=parseFloat(ad)}else{if(ae.type==="int"){ad=parseInt(ad,10)}}}}}if(this.values[ac]!==ad){this.values[ac]=ad;return true}else{return false}},restore_values:function(ac){var ad=this;$.each(this.params,function(ae,af){if(ac[af.key]!==undefined){ad.values[af.key]=ac[af.key]}else{ad.values[af.key]=af.default_value}})},build_form:function(){var af=this;var ac=$("<div />");var ae;function ad(ak,ag){for(var ao=0;ao<ak.length;ao++){ae=ak[ao];if(ae.hidden){continue}var ai="param_"+ao;var at=af.values[ae.key];var av=$("<div class='form-row' />").appendTo(ag);av.append($("<label />").attr("for",ai).text(ae.label+":"));if(ae.type==="bool"){av.append($('<input type="checkbox" />').attr("id",ai).attr("name",ai).attr("checked",at))}else{if(ae.type==="text"){av.append($('<input type="text"/>').attr("id",ai).val(at).click(function(){$(this).select()}))}else{if(ae.type==="select"){var aq=$("<select />").attr("id",ai);for(var am=0;am<ae.options.length;am++){$("<option/>").text(ae.options[am].label).attr("value",ae.options[am].value).appendTo(aq)}aq.val(at);av.append(aq)}else{if(ae.type==="color"){var au=$("<div/>").appendTo(av),ap=$("<input />").attr("id",ai).attr("name",ai).val(at).css("float","left").appendTo(au).click(function(ax){$(".bs-tooltip").removeClass("in");var aw=$(this).siblings(".bs-tooltip").addClass("in");aw.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(aw).height()/2)+($(this).height()/2)}).show();aw.click(function(ay){ay.stopPropagation()});$(document).bind("click.color-picker",function(){aw.hide();$(document).unbind("click.color-picker")});ax.stopPropagation()}),an=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(au).attr("title","Set new random color").tooltip(),ar=$("<div class='bs-tooltip right' style='position: absolute;' />").appendTo(au).hide(),aj=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(ar),ah=$("<div class='tooltip-arrow'></div>").appendTo(ar),al=$.farbtastic(aj,{width:100,height:100,callback:ap,color:at});au.append($("<div/>").css("clear","both"));(function(aw){an.click(function(){aw.setColor(k.get_random_color())})})(al)}else{av.append($("<input />").attr("id",ai).attr("name",ai).val(at))}}}}if(ae.help){av.append($("<div class='help'/>").text(ae.help))}}}ad(this.params,ac);return ac},update_from_form:function(ac){var ae=this;var ad=false;$.each(this.params,function(af,ah){if(!ah.hidden){var ai="param_"+af;var ag=ac.find("#"+ai).val();if(ah.type==="bool"){ag=ac.find("#"+ai).is(":checked")}ad=ae.set_param_value(ah.key,ag)||ad}});if(ad){this.onchange();this.track.changed()}}});var b=function(ac,ag,ae,ad,af){this.track=ac;this.region=ag;this.low=ag.get("start");this.high=ag.get("end");this.resolution=ae;this.html_elt=$("<div class='track-tile'/>").append(ad).height($(ad).attr("height"));this.data=af;this.stale=false};b.prototype.predisplay_actions=function(){};var M=function(ac,ag,ae,ad,af){b.call(this,ac,ag,ae,ad,af)};M.prototype.predisplay_actions=function(){};var P=function(af,an,ag,ae,ai,ap,aj,aq,ad,am){b.call(this,af,an,ag,ae,ai);this.mode=aj;this.all_slotted=ad;this.feature_mapper=am;this.has_icons=false;if(aq){this.has_icons=true;var ak=this;ae=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:D-1,width:ae.width}).prependTo(this.html_elt);var al=new w.GenomeRegion({chrom:af.view.chrom,start:this.low,end:this.high}),ao=ai.length,ah=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ac=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ah.click(function(){ak.stale=true;af.data_manager.get_more_data(al,af.mode,ak.resolution,{},af.data_manager.DEEP_DATA_REQ);$(".bs-tooltip").hide();af.request_draw()}).dblclick(function(ar){ar.stopPropagation()});ac.click(function(){ak.stale=true;af.data_manager.get_more_data(al,af.mode,ak.resolution,{},af.data_manager.BROAD_DATA_REQ);$(".bs-tooltip").hide();af.request_draw()}).dblclick(function(ar){ar.stopPropagation()})}};p(P.prototype,b.prototype);P.prototype.predisplay_actions=function(){var ad=this,ac={};if(ad.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(ao){if(!this.hovered){return}var aj=$(this).offset(),an=ao.pageX-aj.left,am=ao.pageY-aj.top,at=ad.feature_mapper.get_feature_data(an,am),ak=(at?at[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!ak||$(this).attr("id")!==ak.toString()){$(this).remove()}});if(at){var af=ac[ak];if(!af){var ak=at[0],ap={name:at[3],start:at[1],end:at[2],strand:at[4]},ai=ad.track.filters_manager.filters,ah;for(var al=0;al<ai.length;al++){ah=ai[al];ap[ah.name]=at[ah.index]}var af=$("<div/>").attr("id",ak).addClass("feature-popup"),au=$("<table/>"),ar,aq,av;for(ar in ap){aq=ap[ar];av=$("<tr/>").appendTo(au);$("<th/>").appendTo(av).text(ar);$("<td/>").attr("align","left").appendTo(av).text(typeof(aq)==="number"?V(aq,2):aq)}af.append($("<div class='feature-popup-inner'>").append(au));ac[ak]=af}af.appendTo($(this).parents(".track-content").children(".overlay"));var ag=an+parseInt(ad.html_elt.css("left"))-af.width()/2,ae=am+parseInt(ad.html_elt.css("top"))+7;af.css("left",ag+"px").css("top",ae+"px")}else{if(!ao.isPropagationStopped()){ao.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ao)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var g=function(ad,ac,ae){p(ae,{drag_handle_class:"draghandle"});q.call(this,ad,ac,ae);this.dataset=new X.Dataset(ae.dataset);this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ae?ae.data_query_wait:K);this.data_manager=("data_manager" in ae?ae.data_manager:new w.GenomeDataManager({dataset:this.dataset,genome:new w.Genome({key:ad.dbkey,chroms_info:{chrom_info:ad.chrom_data}}),data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ae)||ae.resize){this.add_resize_handle()}}};p(g.prototype,q.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},q.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ac){ac.view.set_overview(ac)}},q.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters()}else{ac.filters_manager.init_filters()}ac.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ac){ac.dynamic_tool_div.toggle();if(ac.dynamic_tool_div.is(":visible")){ac.set_name(ac.name+ac.tool_region_and_parameters_str())}else{ac.revert_name()}$(".bs-tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ac){var af='<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>',ae=ab.template(af,{track:ac});var ah=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ad=function(){var aj=$('select[name="regions"] option:selected').val(),al,ai=new w.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ak=ab.map($(".bookmark"),function(am){return new w.GenomeRegion({from_str:$(am).children(".position").text()})});if(aj==="cur"){al=[ai]}else{if(aj==="bookmarks"){al=ak}else{al=[ai].concat(ak)}}hide_modal();window.location.href=galaxy_paths.get("sweepster_url")+"?"+$.param({dataset_id:ac.dataset.id,hda_ldda:ac.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(al).toJSON())})},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){ad()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",ae,{No:ah,Yes:ad})}},q.prototype.action_icons_def[2]],can_draw:function(){if(this.dataset.id&&q.prototype.can_draw.call(this)){return true}return false},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ac=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ac)}this.name_div=$("<div/>").addClass("track-name").appendTo(ac).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ac},set_dataset:function(ac){this.dataset=ac;this.data_manager.set("dataset",ac)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ac=this;var af=false;var ae=false;var ad=$("<div class='track-resize'>");$(ac.container_div).hover(function(){if(ac.content_visible){af=true;ad.show()}},function(){af=false;if(!ae){ad.hide()}});ad.hide().bind("dragstart",function(ag,ah){ae=true;ah.original_height=$(ac.content_div).height()}).bind("drag",function(ah,ai){var ag=Math.min(Math.max(ai.original_height+ai.deltaY,ac.min_height_px),ac.max_height_px);$(ac.tiles_div).css("height",ag);ac.visible_height_px=(ac.max_height_px===ag?0:ag);ac.on_resize()}).bind("dragend",function(ag,ah){ac.tile_cache.clear();ae=false;if(!af){ad.hide()}ac.config.values.height=ac.visible_height_px;ac.changed()}).appendTo(ac.container_div)},set_display_modes:function(af,ai){this.display_modes=af;this.mode=(ai?ai:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ad=this,ag={};for(var ae=0,ac=ad.display_modes.length;ae<ac;ae++){var ah=ad.display_modes[ae];ag[ah]=function(aj){return function(){ad.change_mode(aj);ad.icons_div.show();ad.container_div.mouseleave(function(){ad.icons_div.hide()})}}(ah)}make_popupmenu(this.action_icons.mode_icon,ag)},build_action_icons:function(){q.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof W){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof h){return"LineTrack"}else{if(this instanceof T){return"ReadTrack"}else{if(this instanceof Z){return"VariantTrack"}else{if(this instanceof f){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(ae){var ad=this;ad.enabled=false;ad.tile_cache.clear();ad.data_manager.clear();ad.tiles_div.css("height","auto");ad.tiles_div.text("").children().remove();ad.container_div.removeClass("nodata error pending");if(!ad.dataset.id){return}var ac=$.Deferred(),af={hda_ldda:ad.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:ad.view.chrom,retry:ae};$.getJSON(this.dataset.url(),af,function(ag){if(!ag||ag==="error"||ag.kind==="error"){ad.container_div.addClass("error");ad.tiles_div.text(n);if(ag.message){ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ag.message+"</pre>",{Close:hide_modal})}));ad.tiles_div.append($("<span/>").text(" "));ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ad.init(true)}))}}else{if(ag==="no converter"){ad.container_div.addClass("error");ad.tiles_div.text(J)}else{if(ag==="no data"||(ag.data!==undefined&&(ag.data===null||ag.data.length===0))){ad.container_div.addClass("nodata");ad.tiles_div.text(E)}else{if(ag==="pending"){ad.container_div.addClass("pending");ad.tiles_div.html(u);setTimeout(function(){ad.init()},ad.data_query_wait)}else{if(ag==="data"||ag.status==="data"){if(ag.valid_chroms){ad.valid_chroms=ag.valid_chroms;ad.update_icons()}ad.tiles_div.text(U);if(ad.view.chrom){ad.tiles_div.text("");ad.tiles_div.css("height",ad.visible_height_px+"px");ad.enabled=true;$.when.apply($,ad.predraw_init()).done(function(){ac.resolve();ad.container_div.removeClass("nodata error pending");ad.request_draw()})}else{ac.resolve()}}}}}}});this.update_icons();return ac},predraw_init:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){ac.container_div.addClass("line-track");var af=ad.data;if(af&&af.min&&af.max){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.config.set_param_default_value("min_value",ae);ac.config.set_param_default_value("max_value",ag);ac.prefs.min_value=ae;ac.prefs.max_value=ag}})},get_drawables:function(){return this}});var N=function(ae,ad,af){g.call(this,ae,ad,af);var ac=this;l(ac.container_div,ac.drag_handle_class,".group",ac);this.filters_manager=new i.FiltersManager(this,("filters" in af?af.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=("tool" in af&&af.tool?new r(this,af.tool,af.tool_state):null);this.tile_cache=new w.Cache(R);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(af.mode){this.change_mode(af.mode)}};p(N.prototype,q.prototype,g.prototype,{action_icons_def:g.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.slotters[ac.view.resolution_px_b].max_rows*=2;ac.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ac){var ad=this.to_dict();p(ad,{data_manager:this.data_manager});var ae=new this.constructor(this.view,ac,ad);ae.change_mode(this.mode);ae.enabled=this.enabled;return ae},set_filters_manager:function(ac){this.filters_manager=ac;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,dataset:{id:this.dataset.id,hda_ldda:this.dataset.get("hda_ldda")},prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},set_min_max:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){var af=ad.data;if(isNaN(parseFloat(ac.prefs.min_value))||isNaN(parseFloat(ac.prefs.max_value))){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.prefs.min_value=ae;ac.prefs.max_value=ag}})},change_mode:function(ad){var ac=this;ac.mode=ad;ac.config.values.mode=ad;if(ad==="Auto"){this.data_manager.clear()}ac.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ac.mode+")");return ac},update_icons:function(){var ac=this;if(ac.filters_available){ac.action_icons.filters_icon.show()}else{ac.action_icons.filters_icon.hide()}if(ac.tool){ac.action_icons.tools_icon.show();ac.action_icons.param_space_viz_icon.show()}else{ac.action_icons.tools_icon.hide();ac.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ad,ac){return ad+"_"+ac},request_draw:function(ac){if(ac&&ac.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ac,this)},before_draw:function(){this.max_height_px=0},_draw:function(ap){if(!this.can_draw()){return}var am=ap&&ap.clear_after,ak=this.view.low,ag=this.view.high,aj=ag-ak,ad=this.view.container.width(),ao=this.view.resolution_px_b,af=this.view.resolution_b_px;if(this.is_overview){ak=this.view.max_low;ag=this.view.max_high;af=(view.max_high-view.max_low)/ad;ao=1/af}this.before_draw();this.tiles_div.children().addClass("remove");var ac=Math.floor(ak/(af*S)),al,ah,ai=[],an=[];while((ac*S*af)<ag){al=this._get_tile_bounds(ac,af);ah=this.draw_helper(al,af,ao,ap);ai.push(ah);$.when(ah).then(function(aq){an.push(aq)});ac+=1}if(!am){this.tiles_div.children(".remove").removeClass("remove").remove()}var ae=this;$.when.apply($,ai).then(function(){ae.tiles_div.children(".remove").remove();an=ab.filter(an,function(aq){return aq!==null});if(an.length!==0){ae.postdraw_actions(an,ad,ao,am)}})},_add_yaxis_label:function(af,ah){var ad=this,ag=(af==="max"?"top":"bottom"),ai=(af==="max"?"max":"min"),ac=(af==="max"?"max_value":"min_value"),ah=ah||function(){ad.request_draw({clear_tile_cache:true})},ae=this.container_div.find(".yaxislabel."+ag);if(ae.length!==0){ae.text(ad.prefs[ac])}else{ae=$("<div/>").text(ad.prefs[ac]).make_text_editable({num_cols:12,on_finish:function(aj){$(".bs-tooltip").remove();ad.config.set_param_value(ac,aj);ah()},help_text:"Set "+ai+" value"}).addClass("yaxislabel "+ag).css("color",this.prefs.label_color);this.container_div.prepend(ae)}},postdraw_actions:function(af,ag,ai,ac){var ae=ab.filter(af,function(aj){return(aj instanceof M)});if(ae.length>0){this.max_height_px=0;var ad=this;ab.each(af,function(aj){if(!(aj instanceof M)){aj.html_elt.remove();ad.draw_helper(aj.region,aj.resolution,ai,{force:true,mode:"Coverage"})}});ad._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var ah=ab.find(af,function(aj){return aj.has_icons});if(ah){ab.each(af,function(aj){if(!aj.has_icons){aj.html_elt.css("padding-top",D)}})}}},get_mode:function(ac){return this.mode},update_auto_mode:function(ac){},_get_drawables:function(){return[this]},draw_helper:function(al,af,ao,ap){if(!ap){ap={}}var ad=ap.force,an=!(ap.data_fetch===false),ai=ap.mode||this.mode,ae=this,ag=this._get_drawables(),am=this._gen_tile_cache_key(ao,al),ah=function(aq){return(aq&&"track" in aq)};var aj=(ad?undefined:ae.tile_cache.get_elt(am));if(aj){if(ah(aj)){ae.show_tile(aj,ao)}return aj}if(!an){return null}var ak=function(){var aq=(ab.find(A,function(at){return at===ai})?"Coverage":ai);var ar=ab.map(ag,function(at){return at.data_manager.get_data(al,aq,af,ae.data_url_extra_params)});if(view.reference_track){ar.push(view.reference_track.data_manager.get_data(al,ai,af,view.reference_track.data_url_extra_params))}return ar};var ac=$.Deferred();ae.tile_cache.set_elt(am,ac);$.when.apply($,ak()).then(function(){var aq=ak(),aw=aq,aC;if(view.reference_track){aC=view.reference_track.data_manager.subset_entry(aq.pop(),al)}var ax=[],au=[];ab.each(ag,function(aH,aE){var aG=aH.mode,aF=aw[aE];if(aG==="Auto"){aG=aH.get_mode(aF);aH.update_auto_mode(aG)}ax.push(aG);au.push(aH.get_canvas_height(aF,aG,ao,ar))});var av=ae.view.canvas_manager.new_canvas(),ay=al.get("start"),aD=al.get("end"),at=0,ar=Math.ceil((aD-ay)*ao)+ae.left_offset,aA=ab.max(au),az;av.width=ar;av.height=(ap.height||aA);var aB=av.getContext("2d");aB.translate(ae.left_offset,0);if(ag.length>1){aB.globalAlpha=0.5;aB.globalCompositeOperation="source-over"}ab.each(ag,function(aF,aE){az=aF.draw_tile(aw[aE],aB,ax[aE],af,al,ao,aC)});if(az!==undefined){ae.tile_cache.set_elt(am,az);ae.show_tile(az,ao)}ac.resolve(az)});return ac},get_canvas_height:function(ac,ae,af,ad){return this.visible_height_px},_draw_line_track_tile:function(ac,ae,ai,ag,ah,aj){var af=ae.canvas,ad=new L.LinePainter(ac.data,ah.get("start"),ah.get("end"),this.prefs,ai);ad.draw(ae,af.width,af.height,aj);return new M(this,ah,ag,af,ac.data)},draw_tile:function(ac,ad,ah,af,ag,ai,ae){console.log("Warning: TiledTrack.draw_tile() not implemented.")},show_tile:function(ae,ah){var ad=this,ac=ae.html_elt;ae.predisplay_actions();var ag=(ae.low-(this.is_overview?this.view.max_low:this.view.low))*ah;if(this.left_offset){ag-=this.left_offset}ac.css({position:"absolute",top:0,left:ag});if(ac.hasClass("remove")){ac.removeClass("remove")}else{this.tiles_div.append(ac)}ae.html_elt.height("auto");this.max_height_px=Math.max(this.max_height_px,ae.html_elt.height());ae.html_elt.parent().children().css("height",this.max_height_px+"px");var af=this.max_height_px;if(this.visible_height_px!==0){af=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",af+"px")},_get_tile_bounds:function(ac,ad){var af=Math.floor(ac*S*ad),ag=Math.ceil(S*ad),ae=(af+ag<=this.view.max_high?af+ag:this.view.max_high);return new w.GenomeRegion({chrom:this.view.chrom,start:af,end:ae})},tool_region_and_parameters_str:function(ae){var ac=this,ad=(ae!==undefined?ae.toString():"all");return" - region=["+ad+"], parameters=["+ac.tool.get_param_values().join(", ")+"]"},data_and_mode_compatible:function(ac,ad){if(ad==="Auto"){return true}else{if(ad==="Coverage"){return ac.dataset_type==="bigwig"}else{if(ac.dataset_type==="bigwig"||ac.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ac){if(ac.dataset_type==="bigwig"||ac.message||ac.extra_info==="no_detail"){return false}return true},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state";this.normal_postdraw_actions=this.postdraw_actions;this.postdraw_actions=function(ae,af,ah,ac){var ad=this;ad.normal_postdraw_actions(ae,af,ah,ac);ad.dataset_check_type="converted_datasets_state";ad.data_query_wait=K;var ag=new k.ServerStateDeferred({url:ad.dataset_state_url,url_params:{dataset_id:ad.dataset.id,hda_ldda:ad.dataset.get("hda_ldda")},interval:ad.data_query_wait,success_fn:function(ai){return ai!=="pending"}});$.when(ag.go()).then(function(){ad.data_manager.set("data_type","data")});ad.postdraw_actions=ad.normal_postdraw_actions}}});var W=function(ad,ac){var ae={resize:false};g.call(this,ad,ac,ae);this.container_div.addClass("label-track")};p(W.prototype,g.prototype,{build_header_div:function(){},init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ag){var ae=this.view,af=ae.high-ae.low,aj=Math.floor(Math.pow(10,Math.floor(Math.log(af)/Math.log(10)))),ac=Math.floor(ae.low/aj)*aj,ah=this.view.container.width(),ad=$("<div style='position: relative; height: 1.3em;'></div>");while(ac<ae.high){var ai=(ac-ae.low)/af*ah;ad.append($("<div class='label'>"+commatize(ac)+"</div>").css({position:"absolute",left:ai-1}));ac+=aj}this.content_div.children(":first").remove();this.content_div.append(ad)}});var f=function(ad,ac,ag){this.display_modes=A;N.call(this,ad,ac,ag);this.drawables=[];if("drawables" in ag){var af;for(var ae=0;ae<ag.drawables.length;ae++){af=ag.drawables[ae];this.drawables[ae]=o(af,ad,null);if(af.left_offset>this.left_offset){this.left_offset=af.left_offset}}this.enabled=true}ab.each(this.drawables,function(ah){if(ah instanceof c||ah instanceof T){ah.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};p(f.prototype,N.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.show_group()}}].concat(N.prototype.action_icons_def),to_dict:y.prototype.to_dict,add_drawable:y.prototype.add_drawable,unpack_drawables:y.prototype.unpack_drawables,change_mode:function(ac){N.prototype.change_mode.call(this,ac);for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].change_mode(ac)}},init:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].init())}var ac=this;$.when.apply($,ae).then(function(){ac.enabled=true;ac.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:q.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var af=new Q(this.view,this.container,{name:this.name}),ac;for(var ae=0;ae<this.drawables.length;ae++){ac=this.drawables[ae];ac.update_icons();af.add_drawable(ac);ac.container=af;af.content_div.append(ac.container_div)}var ad=this.container.replace_drawable(this,af,true);af.request_draw({clear_tile_cache:true})},before_draw:function(){N.prototype.before_draw.call(this);var ad=ab.min(ab.map(this.drawables,function(ae){return ae.prefs.min_value})),ac=ab.max(ab.map(this.drawables,function(ae){return ae.prefs.max_value}));this.prefs.min_value=ad;this.prefs.max_value=ac;ab.each(this.drawables,function(ae){ae.prefs.min_value=ad;ae.prefs.max_value=ac})},update_all_min_max:function(){var ac=this;ab.each(this.drawables,function(ad){ad.prefs.min_value=ac.prefs.min_value;ad.prefs.max_value=ac.prefs.max_value});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(ai,ac,al,ah){N.prototype.postdraw_actions.call(this,ai,ac,al,ah);var ag=-1;for(var ae=0;ae<ai.length;ae++){var aj=ai[ae].html_elt.find("canvas").height();if(aj>ag){ag=aj}}for(var ae=0;ae<ai.length;ae++){var af=ai[ae];if(af.html_elt.find("canvas").height()!==ag){this.draw_helper(af.region,af.resolution,al,{force:true,height:ag});af.html_elt.remove()}}var ad=this,ak=function(){ad.update_all_min_max()};this._add_yaxis_label("min",ak);this._add_yaxis_label("max",ak)}});var B=function(ac){N.call(this,ac,{content_div:ac.top_labeltrack},{resize:false});ac.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url+"/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new w.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};p(B.prototype,q.prototype,N.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:q.prototype.can_draw,draw_helper:function(ae,ad,af,ac){if(af>this.view.canvas_manager.char_width_px){this.tiles_div.show();return N.prototype.draw_helper.call(this,ae,ad,af,ac)}else{this.tiles_div.hide();return null}},can_subset:function(ac){return true},draw_tile:function(af,al,ag,ad,ai,am){var ae=this.data_manager.subset_entry(af,ai),ak=ae.data;var ac=al.canvas;al.font=al.canvas.manager.default_font;al.textAlign="center";for(var ah=0,aj=ak.length;ah<aj;ah++){al.fillStyle=this.view.get_base_color(ak[ah]);al.fillText(ak[ah],Math.floor(ah*am),10)}return new b(this,ai,ad,ac,ae)}});var h=function(ae,ad,af){var ac=this;this.display_modes=A;this.mode="Histogram";N.call(this,ae,ad,af);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:k.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:af.prefs,onchange:function(){ac.set_name(ac.prefs.name);ac.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};p(h.prototype,q.prototype,N.prototype,{before_draw:function(){},draw_tile:function(ac,ad,ag,ae,af,ah){return this._draw_line_track_tile(ac,ad,ag,ae,af,ah)},can_subset:function(ac){return(ac.data[1][0]-ac.data[0][0]===1)},postdraw_actions:function(ad,ae,af,ac){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var s=function(ae,ad,af){var ac=this;this.display_modes=["Heatmap"];this.mode="Heatmap";N.call(this,ae,ad,af);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:af.prefs,onchange:function(){ac.set_name(ac.prefs.name);this.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};p(s.prototype,q.prototype,N.prototype,{draw_tile:function(ac,ae,ai,ag,ah,aj){var af=ae.canvas,ad=new L.DiagonalHeatmapPainter(ac.data,ah.get("start"),ah.get("end"),this.prefs,ai);ad.draw(ae,af.width,af.height,aj);return new b(this,ah,ag,af,ac.data)}});var c=function(af,ae,ah){var ad=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,af,ae,ah);var ag=k.get_random_color(),ac=k.get_random_color([ag,"#FFFFFF"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ag},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ac},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ah.prefs,onchange:function(){ad.set_name(ad.prefs.name);ad.set_painter_from_config();ad.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};p(c.prototype,q.prototype,N.prototype,{set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},postdraw_actions:function(am,ae,an,al){N.prototype.postdraw_actions.call(this,am,ae,an,al);var ag=this,ah;if(ag.filters_manager){var af=ag.filters_manager.filters;for(var aj=0;aj<af.length;aj++){af[aj].update_ui_elt()}var ai=false,ak,ad;for(ah=0;ah<am.length;ah++){if(am[ah].data.length){ak=am[ah].data[0];for(var aj=0;aj<af.length;aj++){ad=af[aj];if(ad.applies_to(ak)&&ad.min!==ad.max){ai=true;break}}}}if(ag.filters_available!==ai){ag.filters_available=ai;if(!ag.filters_available){ag.filters_manager.hide()}ag.update_icons()}}if(am[0] instanceof P){var ac=true;for(ah=0;ah<am.length;ah++){if(!am[ah].all_slotted){ac=false;break}}if(!ac){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ac){var ac;if(this.mode==="Auto"){if(ac==="no_detail"){ac="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ac+")")}},incremental_slots:function(ag,ac,af){var ad=this.view.canvas_manager.dummy_context,ae=this.slotters[ag];if(!ae||(ae.mode!==af)){ae=new (t.FeatureSlotter)(ag,af,z,function(ah){return ad.measureText(ah)});this.slotters[ag]=ae}return ae.slot_features(ac)},get_mode:function(ac){if(ac.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>I){mode="Squish"}else{mode="Pack"}}return mode},get_canvas_height:function(ac,ag,ah,ad){if(ag==="Coverage"||ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var af=this.incremental_slots(ah,ac.data,ag);var ae=new (this.painter)(null,null,null,this.prefs,ag);return Math.max(aa,ae.get_required_height(af,ad))}},draw_tile:function(am,aq,ao,ar,af,aj,ae){var ap=this,ad=aq.canvas,ay=af.get("start"),ac=af.get("end"),ag=this.left_offset;if(am.dataset_type==="bigwig"){return this._draw_line_track_tile(am,aq,ao,ar,af,aj)}var ai=[],an=this.slotters[aj].slots;all_slotted=true;if(am.data){var ak=this.filters_manager.filters;for(var at=0,av=am.data.length;at<av;at++){var ah=am.data[at];var au=false;var al;for(var ax=0,aC=ak.length;ax<aC;ax++){al=ak[ax];al.update_attrs(ah);if(!al.keep(ah)){au=true;break}}if(!au){ai.push(ah);if(!(ah[0] in an)){all_slotted=false}}}}var aB=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null),az=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null),aA=new (this.painter)(ai,ay,ac,this.prefs,ao,aB,az,ae,function(aD){return ap.view.get_base_color(aD)});var aw=null;aq.fillStyle=this.prefs.block_color;aq.font=aq.canvas.manager.default_font;aq.textAlign="right";if(am.data){aw=aA.draw(aq,ad.width,ad.height,aj,an);aw.translation=-ag}return new P(ap,af,ar,ad,am.data,aj,ao,am.message,all_slotted,aw)}});var Z=function(ad,ac,ae){this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ad,ac,ae);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Histogram color",type:"color",default_value:k.get_random_color()},{key:"show_sample_data",label:"Show sample data",type:"bool",default_value:true},{key:"show_labels",label:"Show summary and sample labels",type:"bool",default_value:true},{key:"summary_height",label:"Locus summary height",type:"float",default_value:20},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ae.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=L.VariantPainter;this.summary_draw_height=30;this.left_offset=30};p(Z.prototype,q.prototype,N.prototype,{draw_tile:function(ac,af,ai,ag,ah,aj){if(ac.dataset_type==="bigwig"){return this._draw_line_track_tile(ac,af,"Histogram",ag,ah,aj)}else{var ae=this.view,ad=new (this.painter)(ac.data,ah.get("start"),ah.get("end"),this.prefs,ai,function(ak){return ae.get_base_color(ak)});ad.draw(af,af.canvas.width,af.canvas.height,aj);return new b(this,ah,ag,af.canvas,ac.data)}},get_canvas_height:function(ac,ag,ah,ae){if(ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var af=new (this.painter)(null,null,null,this.prefs,ag);var ad=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(ad===0&&ac.data.length!==0){ad=ac.data[0][7].match(/,/g);if(ad===null){ad=1}else{ad=ad.length+1}}return af.get_required_height(ad)}},predraw_init:function(){var ac=[g.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ac.push(this.dataset.fetch())}return ac},postdraw_actions:function(af,ag,ai,ad){N.prototype.postdraw_actions.call(this,af,ag,ai,ad);var ae=ab.filter(af,function(aj){return(aj instanceof M)});if(ae.length===0&&this.prefs.show_labels){var ac;if(this.container_div.find(".yaxislabel.variant").length===0){ac=this.prefs.summary_height/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ac+"px",top:(this.prefs.summary_height-ac)/2+"px"}));if(this.prefs.show_sample_data){var ah=this.dataset.get("metadata").get("sample_names").join("<br/>");this.tiles_div.prepend($("<div/>").html(ah).addClass("yaxislabel variant top sample").css({top:this.prefs.summary_height+2,}))}}ac=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ac,"line-height":ac});$(this.tiles_div).find(".yaxislabel").css("color",this.prefs.label_color)}else{this.container_div.find(".yaxislabel.variant").remove()}}});var T=function(ae,ad,ag){c.call(this,ae,ad,ag);var af=k.get_random_color(),ac=k.get_random_color([af,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:af},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ac},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{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:"mode",type:"string",default_value:this.mode,hidden:true},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=(ae.reference_track?L.RefBasedReadPainter:L.ReadPainter);this.update_icons()};p(T.prototype,q.prototype,N.prototype,c.prototype);var d={CompositeTrack:f,DrawableGroup:Q,DiagonalHeatmapTrack:s,FeatureTrack:c,LineTrack:h,ReadTrack:T,VariantTrack:Z,VcfTrack:Z};var o=function(ae,ad,ac){if("copy" in ae){return ae.copy(ac)}else{var af=ae.obj_type;if(!af){af=ae.track_type}return new d[af](ad,ac,ae)}};return{TracksterView:Y,DrawableGroup:Q,LineTrack:h,FeatureTrack:c,DiagonalHeatmapTrack:s,ReadTrack:T,VariantTrack:Z,CompositeTrack:f,object_from_template:o}});
\ 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
commit/galaxy-central: james_taylor: style: do not word wrap in pre blocks
by commits-noreply@bitbucket.org 11 Sep '13
by commits-noreply@bitbucket.org 11 Sep '13
11 Sep '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c90e760da0fd/
Changeset: c90e760da0fd
User: james_taylor
Date: 2013-09-11 21:47:26
Summary: style: do not word wrap in pre blocks
Affected #: 3 files
diff -r 669dd89d39c410688d5c6201fcdb9d30f2259787 -r c90e760da0fdc89f2e6b9e42dfaa7b365c8eeea4 lib/galaxy/__init__.py
--- a/lib/galaxy/__init__.py
+++ b/lib/galaxy/__init__.py
@@ -106,4 +106,6 @@
class NullHandler( logging.Handler ):
def emit( self, record ):
pass
- logging.NullHandler = NullHandler
\ No newline at end of file
+ logging.NullHandler = NullHandler
+
+import galaxy.eggs
\ No newline at end of file
diff -r 669dd89d39c410688d5c6201fcdb9d30f2259787 -r c90e760da0fdc89f2e6b9e42dfaa7b365c8eeea4 static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -752,6 +752,7 @@
.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}
.affix{position:fixed}
.navbar-fixed-top .navbar-brand{font-family:Verdana;font-weight:bold;font-size:160%}
+pre{overflow:auto;word-wrap:normal;white-space:pre}
.btn.active,.btn:active{color:inherit}
.dropdown-menu{max-width:auto}
input[type="checkbox"],input[type="radio"]{margin-left:0.5ex;margin-right:0.5ex}
diff -r 669dd89d39c410688d5c6201fcdb9d30f2259787 -r c90e760da0fdc89f2e6b9e42dfaa7b365c8eeea4 static/style/src/less/galaxy_bootstrap/overrides.less
--- a/static/style/src/less/galaxy_bootstrap/overrides.less
+++ b/static/style/src/less/galaxy_bootstrap/overrides.less
@@ -1,9 +1,17 @@
.navbar-fixed-top .navbar-brand {
- font-family: Verdana;
- font-weight: bold;
- font-size: 160%;
+ font-family: Verdana;
+ font-weight: bold;
+ font-size: 160%;
}
+// Don't wrap text inside pre
+pre {
+ overflow: auto;
+ word-wrap: normal;
+ white-space: pre;
+}
+
+
.btn.hover {
@btn:hover();
}
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: Remove TODO because it is not needed--any Backbone object can be a mixin.
by commits-noreply@bitbucket.org 11 Sep '13
by commits-noreply@bitbucket.org 11 Sep '13
11 Sep '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4ff34b0a0f9d/
Changeset: 4ff34b0a0f9d
User: jgoecks
Date: 2013-09-11 20:45:06
Summary: Remove TODO because it is not needed--any Backbone object can be a mixin.
Affected #: 1 file
diff -r 5c606445f35e6328e92e70a2c55eb148086696e1 -r 4ff34b0a0f9dc763b87ce20bcb39c75447aed94d static/scripts/viz/circster.js
--- a/static/scripts/viz/circster.js
+++ b/static/scripts/viz/circster.js
@@ -3,7 +3,6 @@
/**
* Utility class for working with SVG.
*/
-// TODO: make into a mixin.
var SVGUtils = Backbone.Model.extend({
/**
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
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/63c492b8f6da/
Changeset: 63c492b8f6da
User: dannon
Date: 2013-09-11 20:35:33
Summary: Touch.
Affected #: 1 file
diff -r fe1a800dfcb6d842c3769c3334d602ce95095570 -r 63c492b8f6da79d7ecc4459419c4e90fe4bf4fc6 universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -42,7 +42,7 @@
# Set the number of seconds a thread can work before you should kill it (assuming it will never finish) to 3 hours.
threadpool_kill_thread_limit = 10800
-
+
# ---- Filters --------------------------------------------------------------
# Filters sit between Galaxy and the HTTP server.
https://bitbucket.org/galaxy/galaxy-central/commits/5c606445f35e/
Changeset: 5c606445f35e
User: dannon
Date: 2013-09-11 20:36:00
Summary: Merge
Affected #: 1 file
diff -r 63c492b8f6da79d7ecc4459419c4e90fe4bf4fc6 -r 5c606445f35e6328e92e70a2c55eb148086696e1 lib/tool_shed/util/common_install_util.py
--- a/lib/tool_shed/util/common_install_util.py
+++ b/lib/tool_shed/util/common_install_util.py
@@ -344,7 +344,7 @@
required_repository_tups.append( components_list )
else:
# We have a single repository with no dependencies.
- components_list = [ tool_shed_url, repository_name, repository_owner, changeset_revision, 'False', 'False' ]
+ components_list = [ tool_shed_url, repository_name, repository_owner, changeset_revision ]
required_repository_tups.append( components_list )
if required_repository_tups:
# The value of required_repository_tups is a list of tuples, so we need to encode it.
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: Dave Bouvier: Backward compatibility fix for installing repositories without repository dependencies.
by commits-noreply@bitbucket.org 11 Sep '13
by commits-noreply@bitbucket.org 11 Sep '13
11 Sep '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/48191107fd2d/
Changeset: 48191107fd2d
User: Dave Bouvier
Date: 2013-09-11 20:16:52
Summary: Backward compatibility fix for installing repositories without repository dependencies.
Affected #: 1 file
diff -r fe1a800dfcb6d842c3769c3334d602ce95095570 -r 48191107fd2da06e10af5e7d83e197585e859f06 lib/tool_shed/util/common_install_util.py
--- a/lib/tool_shed/util/common_install_util.py
+++ b/lib/tool_shed/util/common_install_util.py
@@ -344,7 +344,7 @@
required_repository_tups.append( components_list )
else:
# We have a single repository with no dependencies.
- components_list = [ tool_shed_url, repository_name, repository_owner, changeset_revision, 'False', 'False' ]
+ components_list = [ tool_shed_url, repository_name, repository_owner, changeset_revision ]
required_repository_tups.append( components_list )
if required_repository_tups:
# The value of required_repository_tups is a list of tuples, so we need to encode it.
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
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/055ef20e662a/
Changeset: 055ef20e662a
Branch: stable
User: jgoecks
Date: 2013-09-11 18:22:16
Summary: Close branch 10517:97d020901403
Affected #: 0 files
https://bitbucket.org/galaxy/galaxy-central/commits/684ef8edd1d4/
Changeset: 684ef8edd1d4
Branch: dataset-cleanup
User: jgoecks
Date: 2013-09-11 18:24:00
Summary: Close branch 10525:e4734c99812a
Affected #: 0 files
https://bitbucket.org/galaxy/galaxy-central/commits/fe1a800dfcb6/
Changeset: fe1a800dfcb6
User: jgoecks
Date: 2013-09-11 18:25:02
Summary: Close branch 10558:dcd9809d0239
Affected #: 0 files
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
25 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/0a37731994c9/
Changeset: 0a37731994c9
User: saketkc
Date: 2013-06-19 08:51:46
Summary: Adding a small check to skip the assertion of tagNumber being
an integer for VCF4.1 files.
I am not sure if there are better ways or beter checks that can be implemen=
ted to
do this. So, this should require discussions.
The description of ##INFO and ##FORMAT tag as given on
[http://www.1000genomes.org/wiki/Analysis/Variant%20Call%20Format/vcf-varia=
nt-call-format-version-41]
is :
##INFO=3D<ID=3DID,Number=3Dnumber,Type=3Dtype,Description=3D=E2=80=9Ddescri=
ption=E2=80=9D>
Possible Types for INFO fields are: Integer, Float, Flag, Character, and St=
ring.
The Number entry is an Integer that describes the number of values that can=
be included with the INFO field.
For example, if the INFO field contains a single number, then this value sh=
ould be 1;
if the INFO field describes a pair of numbers, then this value should be 2 =
and so on.
If the field has one value per alternate allele then this value should be '=
A';
if the field has one value for each possible genotype (more relevant to the=
FORMAT tags) then this value should be 'G'.
If the number of possible values varies, is unknown, or is unbounded, then =
this value should be '.'.
The 'Flag' type indicates that the INFO field does not contain a Value entr=
y, and hence the Number should
be 0 in this case. The Description value must be surrounded by double-quote=
s.
Double-quote character can be escaped with backslash (\") and backslash as =
\\.
Affected #: 1 file
diff -r 81a2bb351c1a0f545a1f69b5514a29d96eb4575a -r 0a37731994c91fd59d2d31f=
79156abb58cc76d75 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/ebdaa310677b/
Changeset: ebdaa310677b
User: saketkc
Date: 2013-06-19 08:52:22
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 170dd4c157b8b5e010804ba4a1ef3b5da08fa49d -r ebdaa310677b57337f5fcc0=
aa2ac475379bf271c tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/493bee44220a/
Changeset: 493bee44220a
User: saketkc
Date: 2013-06-20 05:58:14
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 36d9e5bcd2cbcd5b34b2ae0e7839a71a55350011 -r 493bee44220a54f4d0595bf=
3fd49efdf8a8795bd tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/a52434fb61a8/
Changeset: a52434fb61a8
User: saketkc
Date: 2013-06-20 18:32:29
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 7362302b2c638d377931fa710d40ba2f86f25dba -r a52434fb61a8968735ed1b5=
03b6a5b2b253963ea tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/b1bb5b64dd8e/
Changeset: b1bb5b64dd8e
User: saketkc
Date: 2013-06-20 18:58:11
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 13b5283f964cfa7364b653f2c578b4d7cc27c6e5 -r b1bb5b64dd8eb871451b6bd=
489cc26a6c08dbb7e tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/caa8fd7a0dcf/
Changeset: caa8fd7a0dcf
User: saketkc
Date: 2013-06-20 19:02:55
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 89e7db1cd8098fd6191ab3b4af92e4af32e4c651 -r caa8fd7a0dcf279fec70c3d=
1581296610fc6f636 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/adb63b769897/
Changeset: adb63b769897
User: saketkc
Date: 2013-06-21 07:01:54
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r cf58e35b3a973311ab291e90b501c6f4bc31b6d3 -r adb63b769897f2d2f34b935=
d1a9597df6d1a9cdf tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/b092c9d9a17b/
Changeset: b092c9d9a17b
User: saketkc
Date: 2013-06-21 12:18:18
Summary: Automated merge with ssh://bitbucket.org/saketkc/galaxy-central
Affected #: 1 file
diff -r adb63b769897f2d2f34b935d1a9597df6d1a9cdf -r b092c9d9a17b448e5cb7249=
828dbcd90ab27f1f1 lib/galaxy/workflow/modules.py
--- a/lib/galaxy/workflow/modules.py
+++ b/lib/galaxy/workflow/modules.py
@@ -246,8 +246,8 @@
return module_factory.from_dict(trans, from_json_string(st=
ep.config), secure=3DFalse)
module =3D Class( trans, tool_id )
module.state =3D galaxy.tools.DefaultToolState()
- if step.tool_version and (step.tool_version !=3D tool.version=
):
- module.version_changes.append("%s: using version '%s' inst=
ead of version '%s' indicated in this workflow." % (tool_id, tool.version, =
step.tool_version))
+ if step.tool_version and (step.tool_version !=3D module.tool.v=
ersion):
+ module.version_changes.append("%s: using version '%s' inst=
ead of version '%s' indicated in this workflow." % (tool_id, module.tool.ve=
rsion, step.tool_version))
module.state.inputs =3D module.tool.params_from_strings( step.=
tool_inputs, trans.app, ignore_errors=3DTrue )
module.errors =3D step.tool_errors
# module.post_job_actions =3D step.post_job_actions
https://bitbucket.org/galaxy/galaxy-central/commits/46f4beebb766/
Changeset: 46f4beebb766
User: saketkc
Date: 2013-06-22 12:02:56
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 4f7b7e4ca213498824d5fba7526676ddf976b823 -r 46f4beebb766fd75edb59bc=
3598342ef95775af9 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/1ff57c7a9deb/
Changeset: 1ff57c7a9deb
User: saketkc
Date: 2013-06-26 21:44:43
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 62 files
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -267,25 +267,25 @@
# bam does not use '#' to indicate comments/headers - we need to strip=
out those headers from the std. providers
#TODO:?? seems like there should be an easier way to do/inherit this -=
metadata.comment_char?
#TODO: incorporate samtools options to control output: regions first, =
then flags, etc.
- @dataproviders.decorators.dataprovider_factory( 'line' )
+ @dataproviders.decorators.dataprovider_factory( 'line', dataproviders.=
line.FilteredLineDataProvider.settings )
def line_dataprovider( self, dataset, **settings ):
samtools_source =3D dataproviders.dataset.SamtoolsDataProvider( da=
taset )
settings[ 'comment_char' ] =3D '@'
return dataproviders.line.FilteredLineDataProvider( samtools_sourc=
e, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'regex-line' )
+ @dataproviders.decorators.dataprovider_factory( 'regex-line', dataprov=
iders.line.RegexLineDataProvider.settings )
def regex_line_dataprovider( self, dataset, **settings ):
samtools_source =3D dataproviders.dataset.SamtoolsDataProvider( da=
taset )
settings[ 'comment_char' ] =3D '@'
return dataproviders.line.RegexLineDataProvider( samtools_source, =
**settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'column' )
+ @dataproviders.decorators.dataprovider_factory( 'column', dataprovider=
s.column.ColumnarDataProvider.settings )
def column_dataprovider( self, dataset, **settings ):
samtools_source =3D dataproviders.dataset.SamtoolsDataProvider( da=
taset )
settings[ 'comment_char' ] =3D '@'
return dataproviders.column.ColumnarDataProvider( samtools_source,=
**settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'map' )
+ @dataproviders.decorators.dataprovider_factory( 'map', dataproviders.c=
olumn.MapDataProvider.settings )
def map_dataprovider( self, dataset, **settings ):
samtools_source =3D dataproviders.dataset.SamtoolsDataProvider( da=
taset )
settings[ 'comment_char' ] =3D '@'
@@ -293,30 +293,30 @@
=20
# these can't be used directly - may need BamColumn, BamMap (Bam metad=
ata -> column/map)
# OR - see genomic_region_dataprovider
- #(a)dataproviders.decorators.dataprovider_factory( 'dataset-column' )
+ #(a)dataproviders.decorators.dataprovider_factory( 'dataset-column', dat=
aproviders.column.ColumnarDataProvider.settings )
#def dataset_column_dataprovider( self, dataset, **settings ):
# settings[ 'comment_char' ] =3D '@'
# return super( Sam, self ).dataset_column_dataprovider( dataset, *=
*settings )
=20
- #(a)dataproviders.decorators.dataprovider_factory( 'dataset-map' )
+ #(a)dataproviders.decorators.dataprovider_factory( 'dataset-map', datapr=
oviders.column.MapDataProvider.settings )
#def dataset_map_dataprovider( self, dataset, **settings ):
# settings[ 'comment_char' ] =3D '@'
# return super( Sam, self ).dataset_map_dataprovider( dataset, **se=
ttings )
=20
- @dataproviders.decorators.dataprovider_factory( 'header' )
+ @dataproviders.decorators.dataprovider_factory( 'header', dataprovider=
s.line.RegexLineDataProvider.settings )
def header_dataprovider( self, dataset, **settings ):
# in this case we can use an option of samtools view to provide ju=
st what we need (w/o regex)
samtools_source =3D dataproviders.dataset.SamtoolsDataProvider( da=
taset, '-H' )
return dataproviders.line.RegexLineDataProvider( samtools_source, =
**settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'id-seq-qual' )
+ @dataproviders.decorators.dataprovider_factory( 'id-seq-qual', datapro=
viders.column.MapDataProvider.settings )
def id_seq_qual_dataprovider( self, dataset, **settings ):
settings[ 'indeces' ] =3D [ 0, 9, 10 ]
settings[ 'column_types' ] =3D [ 'str', 'str', 'str' ]
settings[ 'column_names' ] =3D [ 'id', 'seq', 'qual' ]
return self.map_dataprovider( dataset, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'genomic-region' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region', data=
providers.column.ColumnarDataProvider.settings )
def genomic_region_dataprovider( self, dataset, **settings ):
# GenomicRegionDataProvider currently requires a dataset as source=
- may not be necc.
#TODO:?? consider (at least) the possible use of a kwarg: metadata=
_source (def. to source.dataset),
@@ -330,7 +330,7 @@
settings[ 'column_types' ] =3D [ 'str', 'int', 'int' ]
return self.column_dataprovider( dataset, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'genomic-region-map' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region-map', =
dataproviders.column.MapDataProvider.settings )
def genomic_region_map_dataprovider( self, dataset, **settings ):
settings[ 'indeces' ] =3D [ 2, 3, 3 ]
settings[ 'column_types' ] =3D [ 'str', 'int', 'int' ]
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py
+++ b/lib/galaxy/datatypes/data.py
@@ -593,7 +593,6 @@
Base dataprovider factory for all datatypes that returns the prope=
r provider
for the given `data_format` or raises a `NoProviderAvailable`.
"""
- #TODO:?? is this handling super class providers?
if self.has_dataprovider( data_format ):
return self.dataproviders[ data_format ]( self, dataset, **set=
tings )
raise dataproviders.exceptions.NoProviderAvailable( self, data_for=
mat )
@@ -603,12 +602,12 @@
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
return dataproviders.base.DataProvider( dataset_source, **settings=
)
=20
- @dataproviders.decorators.dataprovider_factory( 'chunk' )
+ @dataproviders.decorators.dataprovider_factory( 'chunk', dataproviders=
.chunk.ChunkDataProvider.settings )
def chunk_dataprovider( self, dataset, **settings ):
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
return dataproviders.chunk.ChunkDataProvider( dataset_source, **se=
ttings )
=20
- @dataproviders.decorators.dataprovider_factory( 'chunk64' )
+ @dataproviders.decorators.dataprovider_factory( 'chunk64', dataprovide=
rs.chunk.Base64ChunkDataProvider.settings )
def chunk64_dataprovider( self, dataset, **settings ):
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
return dataproviders.chunk.Base64ChunkDataProvider( dataset_source=
, **settings )
@@ -785,7 +784,7 @@
split =3D classmethod(split)
=20
# ------------- Dataproviders
- @dataproviders.decorators.dataprovider_factory( 'line' )
+ @dataproviders.decorators.dataprovider_factory( 'line', dataproviders.=
line.FilteredLineDataProvider.settings )
def line_dataprovider( self, dataset, **settings ):
"""
Returns an iterator over the dataset's lines (that have been `stri=
p`ed)
@@ -794,7 +793,7 @@
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
return dataproviders.line.FilteredLineDataProvider( dataset_source=
, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'regex-line' )
+ @dataproviders.decorators.dataprovider_factory( 'regex-line', dataprov=
iders.line.RegexLineDataProvider.settings )
def regex_line_dataprovider( self, dataset, **settings ):
"""
Returns an iterator over the dataset's lines
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/dataproviders/base.py
--- a/lib/galaxy/datatypes/dataproviders/base.py
+++ b/lib/galaxy/datatypes/dataproviders/base.py
@@ -22,8 +22,13 @@
=20
icorporate existing visualization/dataproviders
some of the sources (esp. in datasets) don't need to be re-created
+YAGNI: InterleavingMultiSourceDataProvider, CombiningMultiSourceDataProvid=
er
=20
-YAGNI: InterleavingMultiSourceDataProvider, CombiningMultiSourceDataProvid=
er
+datasets API entry point:
+ kwargs should be parsed from strings 2 layers up (in the DatasetsAPI) =
- that's the 'proper' place for that.
+ but how would it know how/what to parse if it doesn't have access to t=
he classes used in the provider?
+ Building a giant list by sweeping all possible dprov classes doesn=
't make sense
+ For now - I'm burying them in the class __init__s - but I don't like t=
hat
"""
=20
import logging
@@ -31,6 +36,31 @@
=20
=20
# ------------------------------------------------------------------------=
----- base classes
+class HasSettings( type ):
+ """
+ Metaclass for data providers that allows defining and inheriting
+ a dictionary named 'settings'.
+
+ Useful for allowing class level access to expected variable types
+ passed to class `__init__` functions so they can be parsed from a quer=
y string.
+ """
+ # yeah - this is all too acrobatic
+ def __new__( cls, name, base_classes, attributes ):
+ settings =3D {}
+ # get settings defined in base classes
+ for base_class in base_classes:
+ base_settings =3D getattr( base_class, 'settings', None )
+ if base_settings:
+ settings.update( base_settings )
+ # get settings defined in this class
+ new_settings =3D attributes.pop( 'settings', None )
+ if new_settings:
+ settings.update( new_settings )
+ attributes[ 'settings' ] =3D settings
+ return type.__new__( cls, name, base_classes, attributes )
+
+
+# ------------------------------------------------------------------------=
----- base classes
class DataProvider( object ):
"""
Base class for all data providers. Data providers:
@@ -39,6 +69,12 @@
(c) do not allow write methods
(but otherwise implement the other file object interface metho=
ds)
"""
+ # a definition of expected types for keyword arguments sent to __init__
+ # useful for controlling how query string dictionaries can be parsed=
into correct types for __init__
+ # empty in this base class
+ __metaclass__ =3D HasSettings
+ settings =3D {}
+
def __init__( self, source, **kwargs ):
"""
:param source: the source that this iterator will loop over.
@@ -130,13 +166,16 @@
- `num_valid_data_read`: how many data have been returned from `fi=
lter`.
- `num_data_returned`: how many data has this provider yielded.
"""
+ # not useful here - we don't want functions over the query string
+ #settings.update({ 'filter_fn': 'function' })
+
def __init__( self, source, filter_fn=3DNone, **kwargs ):
"""
:param filter_fn: a lambda or function that will be passed a datum=
and
return either the (optionally modified) datum or None.
"""
super( FilteredDataProvider, self ).__init__( source, **kwargs )
- self.filter_fn =3D filter_fn
+ self.filter_fn =3D filter_fn if hasattr( filter_fn, '__call__' ) e=
lse None
# count how many data we got from the source
self.num_data_read =3D 0
# how many valid data have we gotten from the source
@@ -179,6 +218,12 @@
=20
Useful for grabbing sections from a source (e.g. pagination).
"""
+ # define the expected types of these __init__ arguments so they can be=
parsed out from query strings
+ settings =3D {
+ 'limit' : 'int',
+ 'offset': 'int'
+ }
+
#TODO: may want to squash this into DataProvider
def __init__( self, source, offset=3D0, limit=3DNone, **kwargs ):
"""
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/dataproviders/chunk.py
--- a/lib/galaxy/datatypes/dataproviders/chunk.py
+++ b/lib/galaxy/datatypes/dataproviders/chunk.py
@@ -26,6 +26,10 @@
"""
MAX_CHUNK_SIZE =3D 2**16
DEFAULT_CHUNK_SIZE =3D MAX_CHUNK_SIZE
+ settings =3D {
+ 'chunk_index' : 'int',
+ 'chunk_size' : 'int'
+ }
=20
#TODO: subclass from LimitedOffsetDataProvider?
# see web/framework/base.iterate_file, util/__init__.file_reader, and =
datatypes.tabular
@@ -38,8 +42,8 @@
(gen. in bytes).
"""
super( ChunkDataProvider, self ).__init__( source, **kwargs )
- self.chunk_size =3D chunk_size
- self.chunk_pos =3D chunk_index * self.chunk_size
+ self.chunk_size =3D int( chunk_size )
+ self.chunk_pos =3D int( chunk_index ) * self.chunk_size
=20
def validate_source( self, source ):
"""
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/dataproviders/column.py
--- a/lib/galaxy/datatypes/dataproviders/column.py
+++ b/lib/galaxy/datatypes/dataproviders/column.py
@@ -29,6 +29,14 @@
the same number of columns as the number of indeces asked for (even if=
they
are filled with None).
"""
+ settings =3D {
+ 'indeces' : 'list:int',
+ 'column_count' : 'int',
+ 'column_types' : 'list:str',
+ 'parse_columns' : 'bool',
+ 'deliminator' : 'str'
+ }
+
def __init__( self, source, indeces=3DNone,
column_count=3DNone, column_types=3DNone, parsers=3DNone, pars=
e_columns=3DTrue,
deliminator=3D'\t', **kwargs ):
@@ -91,11 +99,11 @@
# how/whether to parse each column value
self.parsers =3D {}
if parse_columns:
- self.parsers =3D self._get_default_parsers()
+ self.parsers =3D self.get_default_parsers()
# overwrite with user desired parsers
self.parsers.update( parsers or {} )
=20
- def _get_default_parsers( self ):
+ def get_default_parsers( self ):
"""
Return parser dictionary keyed for each columnar type
(as defined in datatypes).
@@ -132,7 +140,7 @@
#'gffstrand': # -, +, ?, or '.' for None, etc.
}
=20
- def _parse_value( self, val, type ):
+ def parse_value( self, val, type ):
"""
Attempt to parse and return the given value based on the given typ=
e.
=20
@@ -153,7 +161,7 @@
return None
return val
=20
- def _get_column_type( self, index ):
+ def get_column_type( self, index ):
"""
Get the column type for the parser from `self.column_types` or `No=
ne`
if the type is unavailable.
@@ -165,18 +173,18 @@
except IndexError, ind_err:
return None
=20
- def _parse_column_at_index( self, columns, parser_index, index ):
+ def parse_column_at_index( self, columns, parser_index, index ):
"""
Get the column type for the parser from `self.column_types` or `No=
ne`
if the type is unavailable.
"""
try:
- return self._parse_value( columns[ index ], self._get_column_t=
ype( parser_index ) )
+ return self.parse_value( columns[ index ], self.get_column_typ=
e( parser_index ) )
# if a selected index is not within columns, return None
except IndexError, index_err:
return None
=20
- def _parse_columns_from_line( self, line ):
+ def parse_columns_from_line( self, line ):
"""
Returns a list of the desired, parsed columns.
:param line: the line to parse
@@ -188,13 +196,13 @@
selected_indeces =3D self.selected_column_indeces or list( xrange(=
len( all_columns ) ) )
parsed_columns =3D []
for parser_index, column_index in enumerate( selected_indeces ):
- parsed_columns.append( self._parse_column_at_index( all_column=
s, parser_index, column_index ) )
+ parsed_columns.append( self.parse_column_at_index( all_columns=
, parser_index, column_index ) )
return parsed_columns
=20
def __iter__( self ):
parent_gen =3D super( ColumnarDataProvider, self ).__iter__()
for line in parent_gen:
- columns =3D self._parse_columns_from_line( line )
+ columns =3D self.parse_columns_from_line( line )
yield columns
=20
#TODO: implement column filters here and not below - flatten hierarchy
@@ -223,6 +231,10 @@
.. note: that the subclass constructors are passed kwargs - so they're
params (limit, offset, etc.) are also applicable here.
"""
+ settings =3D {
+ 'column_names' : 'list:str',
+ }
+
def __init__( self, source, column_names=3DNone, **kwargs ):
"""
:param column_names: an ordered list of strings that will be used =
as the keys
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/dataproviders/dataset.py
--- a/lib/galaxy/datatypes/dataproviders/dataset.py
+++ b/lib/galaxy/datatypes/dataproviders/dataset.py
@@ -141,7 +141,7 @@
"""
# metadata columns are 1-based indeces
column =3D getattr( self.dataset.metadata, name )
- return ( column - 1 ) if isinstance( column, int ) else None
+ return ( column - 1 ) if ( isinstance( column, int ) and column > =
0 ) else None
=20
def get_genomic_region_indeces( self, check=3DFalse ):
"""
@@ -271,6 +271,12 @@
"""
# dictionary keys when named_columns=3DTrue
COLUMN_NAMES =3D [ 'chrom', 'start', 'end' ]
+ settings =3D {
+ 'chrom_column' : 'int',
+ 'start_column' : 'int',
+ 'end_column' : 'int',
+ 'named_columns' : 'bool',
+ }
=20
def __init__( self, dataset, chrom_column=3DNone, start_column=3DNone,=
end_column=3DNone, named_columns=3DFalse, **kwargs ):
"""
@@ -333,6 +339,14 @@
'chrom', 'start', 'end' (and 'strand' and 'name' if available).
"""
COLUMN_NAMES =3D [ 'chrom', 'start', 'end', 'strand', 'name' ]
+ settings =3D {
+ 'chrom_column' : 'int',
+ 'start_column' : 'int',
+ 'end_column' : 'int',
+ 'strand_column' : 'int',
+ 'name_column' : 'int',
+ 'named_columns' : 'bool',
+ }
=20
def __init__( self, dataset, chrom_column=3DNone, start_column=3DNone,=
end_column=3DNone,
strand_column=3DNone, name_column=3DNone, named_columns=
=3DFalse, **kwargs ):
@@ -349,25 +363,40 @@
dataset_source =3D DatasetDataProvider( dataset )
=20
# get genomic indeces and add strand and name
+ self.column_names =3D []
+ indeces =3D []
+ #TODO: this is sort of involved and oogly
if chrom_column =3D=3D None:
chrom_column =3D dataset_source.get_metadata_column_index_by_n=
ame( 'chromCol' )
+ if chrom_column !=3D None:
+ self.column_names.append( 'chrom' )
+ indeces.append( chrom_column )
if start_column =3D=3D None:
start_column =3D dataset_source.get_metadata_column_index_by_n=
ame( 'startCol' )
+ if start_column !=3D None:
+ self.column_names.append( 'start' )
+ indeces.append( start_column )
if end_column =3D=3D None:
end_column =3D dataset_source.get_metadata_column_index_by_nam=
e( 'endCol' )
+ if end_column !=3D None:
+ self.column_names.append( 'end' )
+ indeces.append( end_column )
if strand_column =3D=3D None:
strand_column =3D dataset_source.get_metadata_column_index_by_=
name( 'strandCol' )
+ if strand_column !=3D None:
+ self.column_names.append( 'strand' )
+ indeces.append( strand_column )
if name_column =3D=3D None:
name_column =3D dataset_source.get_metadata_column_index_by_na=
me( 'nameCol' )
- indeces =3D [ chrom_column, start_column, end_column, strand_colum=
n, name_column ]
+ if name_column !=3D None:
+ self.column_names.append( 'name' )
+ indeces.append( name_column )
+
kwargs.update({ 'indeces' : indeces })
-
if not kwargs.get( 'column_types', None ):
kwargs.update({ 'column_types' : dataset_source.get_metadata_c=
olumn_types( indeces=3Dindeces ) })
=20
self.named_columns =3D named_columns
- if self.named_columns:
- self.column_names =3D self.COLUMN_NAMES
=20
super( IntervalDataProvider, self ).__init__( dataset_source, **kw=
args )
=20
@@ -390,6 +419,10 @@
sequence: <joined lines of nucleotide/amino data>
}
"""
+ settings =3D {
+ 'ids' : 'list:str',
+ }
+
def __init__( self, source, ids=3DNone, **kwargs ):
"""
:param ids: optionally return only ids (and sequences) that are in=
this list.
@@ -419,6 +452,10 @@
sequence: <joined lines of nucleotide/amino data>
}
"""
+ settings =3D {
+ 'ids' : 'list:str',
+ }
+
def __init__( self, source, ids=3DNone, **kwargs ):
"""
:param ids: optionally return only ids (and sequences) that are in=
this list.
@@ -445,6 +482,10 @@
Class that returns chrom, pos, data from a wiggle source.
"""
COLUMN_NAMES =3D [ 'chrom', 'pos', 'value' ]
+ settings =3D {
+ 'named_columns' : 'bool',
+ 'column_names' : 'list:str',
+ }
=20
def __init__( self, source, named_columns=3DFalse, column_names=3DNone=
, **kwargs ):
"""
@@ -483,6 +524,10 @@
Class that returns chrom, pos, data from a wiggle source.
"""
COLUMN_NAMES =3D [ 'chrom', 'pos', 'value' ]
+ settings =3D {
+ 'named_columns' : 'bool',
+ 'column_names' : 'list:str',
+ }
=20
def __init__( self, source, chrom, start, end, named_columns=3DFalse, =
column_names=3DNone, **kwargs ):
"""
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/dataproviders/decorators.py
--- a/lib/galaxy/datatypes/dataproviders/decorators.py
+++ b/lib/galaxy/datatypes/dataproviders/decorators.py
@@ -87,17 +87,40 @@
# log.debug( '\t\t ', fn.__doc__ )
return cls
=20
-def dataprovider_factory( name ):
+def dataprovider_factory( name, settings=3DNone ):
"""
- Wraps a class method and marks it as a dataprovider factory.
+ Wraps a class method and marks it as a dataprovider factory and create=
s a
+ function to parse query strings to __init__ arguments as the
+ `parse_query_string_settings` attribute of the factory function.
+
+ An example use of the `parse_query_string_settings`:
+ ..example::
+ kwargs =3D dataset.datatype.dataproviders[ provider ].parse_query_stri=
ng_settings( query_kwargs )
+ return list( dataset.datatype.dataprovider( dataset, provider, **kwarg=
s ) )
=20
:param name: what name/key to register the factory under in `cls.datap=
roviders`
- :param type: any hashable var
+ :type name: any hashable var
+ :param settings: dictionary containing key/type pairs for parsing quer=
y strings
+ to __init__ arguments
+ :type settings: dictionary
"""
+ #TODO:?? use *args for settings allowing mulitple dictionaries
+ # make a function available through the name->provider dispatch to par=
se query strings
+ # callable like:
+ # settings_dict =3D dataproviders[ provider_name ].parse_query_string_=
settings( query_kwargs )
+ #TODO: ugh - overly complicated but the best I could think of
+ def parse_query_string_settings( query_kwargs ):
+ return _parse_query_string_settings( query_kwargs, settings )
+
#log.debug( 'dataprovider:', name )
def named_dataprovider_factory( func ):
#log.debug( 'named_dataprovider_factory:', name, '->', func.__name=
__ )
setattr( func, _DATAPROVIDER_METHOD_NAME_KEY, name )
+
+ setattr( func, 'parse_query_string_settings', parse_query_string_s=
ettings )
+ setattr( func, 'settings', settings )
+ #TODO: I want a way to inherit settings from the previous provider=
( this_name ) instead of defining over and over
+
#log.debug( '\t setting:', getattr( func, _DATAPROVIDER_METHOD_NAM=
E_KEY ) )
@wraps( func )
def wrapped_dataprovider_factory( self, *args, **kwargs ):
@@ -105,3 +128,38 @@
return func( self, *args, **kwargs )
return wrapped_dataprovider_factory
return named_dataprovider_factory
+
+def _parse_query_string_settings( query_kwargs, settings=3DNone ):
+ """
+ Parse the values in `query_kwargs` from strings to the proper types
+ listed in the same key in `settings`.
+ """
+ def list_from_query_string( s ):
+ # assume csv
+ return s.split( ',' )
+
+ parsers =3D {
+ 'int' : int,
+ 'float' : float,
+ 'bool' : bool,
+ 'list:str' : lambda s: list_from_query_string( s ),
+ 'list:int' : lambda s: [ int( i ) for i in list_from_query_string=
( s ) ],
+ }
+ settings =3D settings or {}
+ # yay! yet another set of query string parsers! <-- sarcasm
+ # work through the keys in settings finding matching keys in query_kwa=
rgs
+ # if found in both, get the expected/needed type from settings and s=
tore the new parsed value
+ # if we can't parse it (no parser, bad value), delete the key from q=
uery_kwargs so the provider will use the defaults
+ for key in settings:
+ if key in query_kwargs:
+ #TODO: this would be the place to sanitize any strings
+ query_value =3D query_kwargs[ key ]
+ needed_type =3D settings[ key ]
+ try:
+ query_kwargs[ key ] =3D parsers[ needed_type ]( query_valu=
e )
+ except ( KeyError, ValueError ):
+ del query_kwargs[ key ]
+
+ #TODO:?? do we want to remove query_kwarg entries NOT in settings?
+ return query_kwargs
+
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/dataproviders/line.py
--- a/lib/galaxy/datatypes/dataproviders/line.py
+++ b/lib/galaxy/datatypes/dataproviders/line.py
@@ -27,6 +27,12 @@
to return.
"""
DEFAULT_COMMENT_CHAR =3D '#'
+ settings =3D {
+ 'string_lines' : 'bool',
+ 'provide_blank' : 'bool',
+ 'comment_char' : 'str',
+ }
+
def __init__( self, source, strip_lines=3DTrue, provide_blank=3DFalse,=
comment_char=3DDEFAULT_COMMENT_CHAR, **kwargs ):
"""
:param strip_lines: remove whitespace from the beginning an ending
@@ -78,6 +84,11 @@
.. note:: the regex matches are effectively OR'd (if **any** regex mat=
ches
the line it is considered valid and will be provided).
"""
+ settings =3D {
+ 'regex_list' : 'list:str',
+ 'invert' : 'bool',
+ }
+
def __init__( self, source, regex_list=3DNone, invert=3DFalse, **kwarg=
s ):
"""
:param regex_list: list of strings or regular expression strings t=
hat will
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/interval.py
--- a/lib/galaxy/datatypes/interval.py
+++ b/lib/galaxy/datatypes/interval.py
@@ -334,20 +334,24 @@
return None
=20
# ------------- Dataproviders
- @dataproviders.decorators.dataprovider_factory( 'genomic-region' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_dataprovider( self, dataset, **settings ):
return dataproviders.dataset.GenomicRegionDataProvider( dataset, *=
*settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'genomic-region-map' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region-map',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_map_dataprovider( self, dataset, **settings ):
settings[ 'named_columns' ] =3D True
return self.genomic_region_dataprovider( dataset, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'interval' )
+ @dataproviders.decorators.dataprovider_factory( 'interval',
+ dataproviders.dataset.=
IntervalDataProvider.settings )
def interval_dataprovider( self, dataset, **settings ):
return dataproviders.dataset.IntervalDataProvider( dataset, **sett=
ings )
=20
- @dataproviders.decorators.dataprovider_factory( 'interval-map' )
+ @dataproviders.decorators.dataprovider_factory( 'interval-map',
+ dataproviders.dataset.=
IntervalDataProvider.settings )
def interval_map_dataprovider( self, dataset, **settings ):
settings[ 'named_columns' ] =3D True
return self.interval_dataprovider( dataset, **settings )
@@ -809,20 +813,24 @@
=20
# ------------- Dataproviders
# redefine bc super is Tabular
- @dataproviders.decorators.dataprovider_factory( 'genomic-region' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_dataprovider( self, dataset, **settings ):
return dataproviders.dataset.GenomicRegionDataProvider( dataset, 0=
, 3, 4, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'genomic-region-map' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region-map',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_map_dataprovider( self, dataset, **settings ):
settings[ 'named_columns' ] =3D True
return self.genomic_region_dataprovider( dataset, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'interval' )
+ @dataproviders.decorators.dataprovider_factory( 'interval',
+ dataproviders.dataset.=
IntervalDataProvider.settings )
def interval_dataprovider( self, dataset, **settings ):
return dataproviders.dataset.IntervalDataProvider( dataset, 0, 3, =
4, 6, 2, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'interval-map' )
+ @dataproviders.decorators.dataprovider_factory( 'interval-map',
+ dataproviders.dataset.=
IntervalDataProvider.settings )
def interval_map_dataprovider( self, dataset, **settings ):
settings[ 'named_columns' ] =3D True
return self.interval_dataprovider( dataset, **settings )
@@ -1193,12 +1201,12 @@
return resolution
=20
# ------------- Dataproviders
- @dataproviders.decorators.dataprovider_factory( 'wiggle' )
+ @dataproviders.decorators.dataprovider_factory( 'wiggle', dataprovider=
s.dataset.WiggleDataProvider.settings )
def wiggle_dataprovider( self, dataset, **settings ):
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
return dataproviders.dataset.WiggleDataProvider( dataset_source, *=
*settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'wiggle-map' )
+ @dataproviders.decorators.dataprovider_factory( 'wiggle-map', dataprov=
iders.dataset.WiggleDataProvider.settings )
def wiggle_map_dataprovider( self, dataset, **settings ):
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
settings[ 'named_columns' ] =3D True
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/sequence.py
--- a/lib/galaxy/datatypes/sequence.py
+++ b/lib/galaxy/datatypes/sequence.py
@@ -15,8 +15,6 @@
from galaxy import util
from sniff import *
=20
-from galaxy.datatypes import dataproviders
-
import pkg_resources
pkg_resources.require("simplejson")
import simplejson
@@ -399,15 +397,6 @@
f.close()
_count_split =3D classmethod(_count_split)
=20
- def provider( self, dataset, data_format, **settings ):
- from galaxy.dataproviders import dataset as dataset_providers
-
- if data_format =3D=3D 'id_seq':
- source =3D dataset_providers.DatasetDataProvider( dataset )
- return dataset_providers.FastaDataProvider( source, **settings=
)
-
- return super( Fasta, self ).provider( dataset, data_format, **sett=
ings )
-
=20
class csFasta( Sequence ):
""" Class representing the SOLID Color-Space sequence ( csfasta ) """
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/sniff.py
--- a/lib/galaxy/datatypes/sniff.py
+++ b/lib/galaxy/datatypes/sniff.py
@@ -6,6 +6,7 @@
from galaxy import util
from galaxy.datatypes.checkers import *
from encodings import search_function as encodings_search_function
+from binary import Binary
=20
log =3D logging.getLogger(__name__)
=20
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py
+++ b/lib/galaxy/datatypes/tabular.py
@@ -345,26 +345,25 @@
return vizs
=20
# ------------- Dataproviders
- @dataproviders.decorators.dataprovider_factory( 'column' )
+ @dataproviders.decorators.dataprovider_factory( 'column', dataprovider=
s.column.ColumnarDataProvider.settings )
def column_dataprovider( self, dataset, **settings ):
"""Uses column settings that are passed in"""
- print 'Tabular.comment_char:', settings.get( 'comment_char', None )
-
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
return dataproviders.column.ColumnarDataProvider( dataset_source, =
**settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'dataset-column' )
+ @dataproviders.decorators.dataprovider_factory( 'dataset-column',
+ dataproviders.column.C=
olumnarDataProvider.settings )
def dataset_column_dataprovider( self, dataset, **settings ):
"""Attempts to get column settings from dataset.metadata"""
return dataproviders.dataset.DatasetColumnarDataProvider( dataset,=
**settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'map' )
+ @dataproviders.decorators.dataprovider_factory( 'map', dataproviders.c=
olumn.MapDataProvider.settings )
def map_dataprovider( self, dataset, **settings ):
"""Uses column settings that are passed in"""
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
return dataproviders.column.MapDataProvider( dataset_source, **set=
tings )
=20
- @dataproviders.decorators.dataprovider_factory( 'dataset-map' )
+ @dataproviders.decorators.dataprovider_factory( 'dataset-map', datapro=
viders.column.MapDataProvider.settings )
def dataset_map_dataprovider( self, dataset, **settings ):
"""Attempts to get column settings from dataset.metadata"""
return dataproviders.dataset.DatasetMapDataProvider( dataset, **se=
ttings )
@@ -502,55 +501,58 @@
# ------------- Dataproviders
# sam does not use '#' to indicate comments/headers - we need to strip=
out those headers from the std. providers
#TODO:?? seems like there should be an easier way to do this - metadat=
a.comment_char?
- @dataproviders.decorators.dataprovider_factory( 'line' )
+ @dataproviders.decorators.dataprovider_factory( 'line', dataproviders.=
line.FilteredLineDataProvider.settings )
def line_dataprovider( self, dataset, **settings ):
settings[ 'comment_char' ] =3D '@'
return super( Sam, self ).line_dataprovider( dataset, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'regex-line' )
+ @dataproviders.decorators.dataprovider_factory( 'regex-line', dataprov=
iders.line.RegexLineDataProvider.settings )
def regex_line_dataprovider( self, dataset, **settings ):
settings[ 'comment_char' ] =3D '@'
return super( Sam, self ).regex_line_dataprovider( dataset, **sett=
ings )
=20
- @dataproviders.decorators.dataprovider_factory( 'column' )
+ @dataproviders.decorators.dataprovider_factory( 'column', dataprovider=
s.column.ColumnarDataProvider.settings )
def column_dataprovider( self, dataset, **settings ):
settings[ 'comment_char' ] =3D '@'
return super( Sam, self ).column_dataprovider( dataset, **settings=
)
=20
- @dataproviders.decorators.dataprovider_factory( 'dataset-column' )
+ @dataproviders.decorators.dataprovider_factory( 'dataset-column',
+ dataproviders.column.C=
olumnarDataProvider.settings )
def dataset_column_dataprovider( self, dataset, **settings ):
settings[ 'comment_char' ] =3D '@'
return super( Sam, self ).dataset_column_dataprovider( dataset, **=
settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'map' )
+ @dataproviders.decorators.dataprovider_factory( 'map', dataproviders.c=
olumn.MapDataProvider.settings )
def map_dataprovider( self, dataset, **settings ):
settings[ 'comment_char' ] =3D '@'
return super( Sam, self ).map_dataprovider( dataset, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'dataset-map' )
+ @dataproviders.decorators.dataprovider_factory( 'dataset-map', datapro=
viders.column.MapDataProvider.settings )
def dataset_map_dataprovider( self, dataset, **settings ):
settings[ 'comment_char' ] =3D '@'
return super( Sam, self ).dataset_map_dataprovider( dataset, **set=
tings )
=20
- @dataproviders.decorators.dataprovider_factory( 'header' )
+ @dataproviders.decorators.dataprovider_factory( 'header', dataprovider=
s.line.RegexLineDataProvider.settings )
def header_dataprovider( self, dataset, **settings ):
dataset_source =3D dataproviders.dataset.DatasetDataProvider( data=
set )
headers_source =3D dataproviders.line.RegexLineDataProvider( datas=
et_source, regex_list=3D[ '^@' ] )
return dataproviders.line.RegexLineDataProvider( headers_source, *=
*settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'id-seq-qual' )
+ @dataproviders.decorators.dataprovider_factory( 'id-seq-qual', map_dat=
aprovider.settings )
def id_seq_qual_dataprovider( self, dataset, **settings ):
# provided as an example of a specified column map (w/o metadata)
settings[ 'indeces' ] =3D [ 0, 9, 10 ]
settings[ 'column_names' ] =3D [ 'id', 'seq', 'qual' ]
return self.map_dataprovider( dataset, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'genomic-region' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_dataprovider( self, dataset, **settings ):
settings[ 'comment_char' ] =3D '@'
return dataproviders.dataset.GenomicRegionDataProvider( dataset, 2=
, 3, 3, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'genomic-region-map' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region-map',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_map_dataprovider( self, dataset, **settings ):
settings[ 'comment_char' ] =3D '@'
return dataproviders.dataset.GenomicRegionDataProvider( dataset, 2=
, 3, 3, True, **settings )
@@ -621,11 +623,13 @@
return False
=20
# ------------- Dataproviders
- @dataproviders.decorators.dataprovider_factory( 'genomic-region' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_dataprovider( self, dataset, **settings ):
return dataproviders.dataset.GenomicRegionDataProvider( dataset, *=
*settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'genomic-region-map' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region-map',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_map_dataprovider( self, dataset, **settings ):
settings[ 'named_columns' ] =3D True
return self.genomic_region_dataprovider( dataset, **settings )
@@ -668,11 +672,13 @@
dataset.metadata.sample_names =3D line.split()[ 9: ]
=20
# ------------- Dataproviders
- @dataproviders.decorators.dataprovider_factory( 'genomic-region' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_dataprovider( self, dataset, **settings ):
return dataproviders.dataset.GenomicRegionDataProvider( dataset, 0=
, 1, 1, **settings )
=20
- @dataproviders.decorators.dataprovider_factory( 'genomic-region-map' )
+ @dataproviders.decorators.dataprovider_factory( 'genomic-region-map',
+ dataproviders.dataset.=
GenomicRegionDataProvider.settings )
def genomic_region_map_dataprovider( self, dataset, **settings ):
settings[ 'named_columns' ] =3D True
return self.genomic_region_dataprovider( dataset, **settings )
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/visualization/data_providers/registry.py
--- a/lib/galaxy/visualization/data_providers/registry.py
+++ b/lib/galaxy/visualization/data_providers/registry.py
@@ -32,7 +32,7 @@
"bigwig": genome.BigWigDataProvider,
"bigbed": genome.BigBedDataProvider,
=20
- "column": ColumnDataProvider
+ "column_with_stats": ColumnDataProvider
}
=20
def get_data_provider( self, trans, name=3DNone, source=3D'data', raw=
=3DFalse, original_dataset=3DNone ):
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/visualization/registry.py
--- a/lib/galaxy/visualization/registry.py
+++ b/lib/galaxy/visualization/registry.py
@@ -15,22 +15,27 @@
log =3D logging.getLogger( __name__ )
=20
__TODO__ =3D """
- BUGS:
- anon users clicking a viz link gets 'must be' msg in galaxy_main (=
w/ masthead)
- should not show visualizations (no icon)?
- newick files aren't being sniffed prop? - datatype is txt
+BUGS:
+ anon users clicking a viz link gets 'must be' msg in galaxy_main (w/ m=
asthead)
+ should not show visualizations (no icon)?
+ newick files aren't being sniffed prop? - datatype is txt
=20
- have parsers create objects instead of dicts
- allow data_sources with no model_class but have tests (isAdmin, etc.)
- maybe that's an instance of User model_class?
- some confused vocabulary in docs, var names
- tests:
- anding, grouping, not
- data_sources:
- lists of
- add description element to visualization.
+have parsers create objects instead of dicts
+allow data_sources with no model_class but have tests (isAdmin, etc.)
+ maybe that's an instance of User model_class?
+some confused vocabulary in docs, var names
+tests:
+ anding, grouping, not
+data_sources:
+ lists of
+add description element to visualization.
+
+TESTS to add:
+ has dataprovider
+ user is admin
"""
=20
+# ------------------------------------------------------------------- the =
registry
class VisualizationsRegistry( object ):
"""
Main responsibilities are:
@@ -93,6 +98,45 @@
"""
self.listings =3D VisualizationsConfigParser.parse( self.configura=
tion_filepath )
=20
+ def get_visualization( self, trans, visualization_name, target_object =
):
+ """
+ Return data to build a url to the visualization with the given
+ `visualization_name` if it's applicable to `target_object` or
+ `None` if it's not.
+ """
+ # a little weird to pass trans because this registry is part of th=
e trans.app
+ listing_data =3D self.listings.get( visualization_name, None )
+ if not listing_data:
+ return None
+
+ data_sources =3D listing_data[ 'data_sources' ]
+ for data_source in data_sources:
+ # currently a model class is required
+ model_class =3D data_source[ 'model_class' ]
+ if not isinstance( target_object, model_class ):
+ continue
+
+ # tests are optional - default is the above class test
+ tests =3D data_source[ 'tests' ]
+ if tests and not self.is_object_applicable( trans, target_obje=
ct, tests ):
+ continue
+
+ param_data =3D data_source[ 'to_params' ]
+ url =3D self.get_visualization_url( trans, target_object, visu=
alization_name, param_data )
+ link_text =3D listing_data.get( 'link_text', None )
+ if not link_text:
+ # default to visualization name, titlecase, and replace un=
derscores
+ link_text =3D visualization_name.title().replace( '_', ' '=
)
+ render_location =3D listing_data.get( 'render_location' )
+ # remap some of these vars for direct use in ui.js, PopupMenu =
(e.g. text->html)
+ return {
+ 'href' : url,
+ 'html' : link_text,
+ 'target': render_location
+ }
+
+ return None
+
# -- building links to visualizations from objects --
def get_visualizations( self, trans, target_object ):
"""
@@ -100,36 +144,11 @@
the urls to call in order to render the visualizations.
"""
#TODO:?? a list of objects? YAGNI?
- # a little weird to pass trans because this registry is part of th=
e trans.app
applicable_visualizations =3D []
- for vis_name, listing_data in self.listings.items():
-
- data_sources =3D listing_data[ 'data_sources' ]
- for data_source in data_sources:
- # currently a model class is required
- model_class =3D data_source[ 'model_class' ]
- if not isinstance( target_object, model_class ):
- continue
-
- # tests are optional - default is the above class test
- tests =3D data_source[ 'tests' ]
- if tests and not self.is_object_applicable( trans, target_=
object, tests ):
- continue
-
- param_data =3D data_source[ 'to_params' ]
- url =3D self.get_visualization_url( trans, target_object, =
vis_name, param_data )
- link_text =3D listing_data.get( 'link_text', None )
- if not link_text:
- # default to visualization name, titlecase, and replac=
e underscores
- link_text =3D vis_name.title().replace( '_', ' ' )
- render_location =3D listing_data.get( 'render_location' )
- # remap some of these vars for direct use in ui.js, PopupM=
enu (e.g. text->html)
- applicable_visualizations.append({
- 'href' : url,
- 'html' : link_text,
- 'target': render_location
- })
-
+ for vis_name in self.listings:
+ url_data =3D self.get_visualization( trans, vis_name, target_o=
bject )
+ if url_data:
+ applicable_visualizations.append( url_data )
return applicable_visualizations
=20
def is_object_applicable( self, trans, target_object, data_source_test=
s ):
@@ -151,10 +170,11 @@
# convert datatypes to their actual classes (for use w=
ith isinstance)
test_result =3D trans.app.datatypes_registry.get_datat=
ype_class_by_name( test_result )
if not test_result:
- # warn if can't find class, but continue
+ # warn if can't find class, but continue (with oth=
er tests)
log.warn( 'visualizations_registry cannot find cla=
ss (%s) for applicability test', test_result )
continue
=20
+ #NOTE: tests are OR'd, if any test passes - the visualization =
can be applied
if test_fn( target_object, test_result ):
#log.debug( 'test passed' )
return True
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/webapps/galaxy/api/datasets.py
--- a/lib/galaxy/webapps/galaxy/api/datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/datasets.py
@@ -6,6 +6,7 @@
from galaxy.web.base.controller import BaseAPIController, UsesVisualizatio=
nMixin, UsesHistoryDatasetAssociationMixin
from galaxy.web.base.controller import UsesHistoryMixin
from galaxy.web.framework.helpers import is_true
+from galaxy.datatypes import dataproviders
=20
import logging
log =3D logging.getLogger( __name__ )
@@ -217,10 +218,24 @@
return msg
=20
registry =3D trans.app.data_provider_registry
+
# allow the caller to specifiy which provider is used
- if provider and provider in registry.dataset_type_name_to_data_pro=
vider:
- data_provider =3D registry.dataset_type_name_to_data_provider[=
provider ]( dataset )
- # or have it look up by datatype
+ # pulling from the original providers if possible, then the new =
providers
+ if provider:
+ if provider in registry.dataset_type_name_to_data_provider:
+ data_provider =3D registry.dataset_type_name_to_data_provi=
der[ provider ]( dataset )
+
+ elif dataset.datatype.has_dataprovider( provider ):
+ kwargs =3D dataset.datatype.dataproviders[ provider ].pars=
e_query_string_settings( kwargs )
+ # use dictionary to allow more than the data itself to be =
returned (data totals, other meta, etc.)
+ return {
+ 'data': list( dataset.datatype.dataprovider( dataset, =
provider, **kwargs ) )
+ }
+
+ else:
+ raise dataproviders.exceptions.NoProviderAvailable( datase=
t.datatype, provider )
+
+ # no provider name: look up by datatype
else:
data_provider =3D registry.get_data_provider( trans, raw=3DTru=
e, original_dataset=3Ddataset )
=20
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
--- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
+++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
@@ -179,6 +179,11 @@
# Get the information about the Galaxy components (e.g., tool pane=
section, tool config file, etc) that will contain the repository informati=
on.
install_repository_dependencies =3D payload.get( 'install_reposito=
ry_dependencies', False )
install_tool_dependencies =3D payload.get( 'install_tool_dependenc=
ies', False )
+ if install_tool_dependencies:
+ if trans.app.config.tool_dependency_dir is None:
+ no_tool_dependency_dir_message =3D "Tool dependencies can =
be automatically installed only if you set the value of your 'tool_dependen=
cy_dir' "
+ no_tool_dependency_dir_message +=3D "setting in your Galax=
y configuration file (universe_wsgi.ini) and restart your Galaxy server."
+ raise HTTPBadRequest( detail=3Dno_tool_dependency_dir_mess=
age )
new_tool_panel_section =3D payload.get( 'new_tool_panel_section_la=
bel', '' )
shed_tool_conf =3D payload.get( 'shed_tool_conf', None )
if shed_tool_conf:
@@ -211,13 +216,8 @@
tool_path=3Dtool_path,
tool_shed_url=3Dtool_shed_url )
# Create the tool_shed_repository database records and gather addi=
tional information for repository installation.
- created_or_updated_tool_shed_repositories, tool_panel_section_keys=
, repo_info_dicts, filtered_repo_info_dicts, message =3D \
+ created_or_updated_tool_shed_repositories, tool_panel_section_keys=
, repo_info_dicts, filtered_repo_info_dicts =3D \
repository_util.handle_tool_shed_repositories( trans, installa=
tion_dict, using_api=3DTrue )
- if message and len( repo_info_dicts ) =3D=3D 1:
- # We're attempting to install a single repository that has alr=
eady been installed into this Galaxy instance.
- log.error( message, exc_info=3DTrue )
- trans.response.status =3D 500
- return dict( status=3D'error', error=3Dmessage )
if created_or_updated_tool_shed_repositories:
# Build the dictionary of information necessary for installing=
the repositories.
installation_dict =3D dict( created_or_updated_tool_shed_repos=
itories=3Dcreated_or_updated_tool_shed_repositories,
@@ -266,11 +266,7 @@
acti=
on=3D'show',
id=
=3Dtrans.security.encode_id( tool_shed_repository.id ) )
installed_tool_shed_repositories.append( tool_shed_rep=
ository_dict )
- elif message:
- log.error( message, exc_info=3DTrue )
- trans.response.status =3D 500
- return dict( status=3D'error', error=3Dmessage )
- elif not created_or_updated_tool_shed_repositories and not message:
+ else:
# We're attempting to install more than 1 repository, and all =
of them have already been installed.
return dict( status=3D'error', error=3D'All repositories that =
you are attempting to install have been previously installed.' )
# Display the list of installed repositories.
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
--- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
+++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
@@ -155,7 +155,8 @@
def browse_tool_dependency( self, trans, **kwd ):
message =3D kwd.get( 'message', '' )
status =3D kwd.get( 'status', 'done' )
- tool_dependency =3D tool_dependency_util.get_tool_dependency( tran=
s, kwd[ 'id' ] )
+ tool_dependency_ids =3D tool_dependency_util.get_tool_dependency_i=
ds( as_string=3DFalse, **kwd )
+ tool_dependency =3D tool_dependency_util.get_tool_dependency( tran=
s, tool_dependency_ids[ 0 ] )
if tool_dependency.in_error_state:
message =3D "This tool dependency is not installed correctly (=
see the <b>Tool dependency installation error</b> below). "
message +=3D "Choose <b>Uninstall this tool dependency</b> fro=
m the <b>Repository Actions</b> menu, correct problems "
@@ -482,9 +483,7 @@
def install_tool_dependencies( self, trans, **kwd ):
message =3D kwd.get( 'message', '' )
status =3D kwd.get( 'status', 'done' )
- tool_dependency_ids =3D util.listify( kwd.get( 'tool_dependency_id=
s', None ) )
- if not tool_dependency_ids:
- tool_dependency_ids =3D util.listify( kwd.get( 'id', None ) )
+ tool_dependency_ids =3D tool_dependency_util.get_tool_dependency_i=
ds( as_string=3DFalse, **kwd )
tool_dependencies =3D []
for tool_dependency_id in tool_dependency_ids:
tool_dependency =3D tool_dependency_util.get_tool_dependency( =
trans, tool_dependency_id )
@@ -731,11 +730,11 @@
kwd[ 'status' ] =3D 'error'
installed_tool_dependencies_select_field =3D suc.build_tool_depend=
encies_select_field( trans,
=
tool_shed_repository=3Dtool_shed_repository,
- =
name=3D'tool_dependency_ids',
+ =
name=3D'inst_td_ids',
=
uninstalled=3DFalse )
uninstalled_tool_dependencies_select_field =3D suc.build_tool_depe=
ndencies_select_field( trans,
=
tool_shed_repository=3Dtool_shed_repository,
- =
name=3D'tool_dependency_ids',
+ =
name=3D'uninstalled_tool_dependency_ids',
=
uninstalled=3DTrue )
return trans.fill_template( '/admin/tool_shed_repository/manage_re=
pository_tool_dependencies.mako',
repository=3Dtool_shed_repository,
@@ -886,15 +885,8 @@
tool_panel_section=3Dtool_panel_sect=
ion,
tool_path=3Dtool_path,
tool_shed_url=3Dtool_shed_url )
- created_or_updated_tool_shed_repositories, tool_panel_section_=
keys, repo_info_dicts, filtered_repo_info_dicts, message =3D \
+ created_or_updated_tool_shed_repositories, tool_panel_section_=
keys, repo_info_dicts, filtered_repo_info_dicts =3D \
repository_util.handle_tool_shed_repositories( trans, inst=
allation_dict, using_api=3DFalse )
- if message and len( repo_info_dicts ) =3D=3D 1:
- # We're undoubtedly attempting to install a repository tha=
t has been previously installed.
- return trans.response.send_redirect( web.url_for( controll=
er=3D'admin_toolshed',
- action=
=3D'browse_repositories',
- message=
=3Dmessage,
- status=
=3D'error' ) )
-
if created_or_updated_tool_shed_repositories:
installation_dict =3D dict( created_or_updated_tool_shed_r=
epositories=3Dcreated_or_updated_tool_shed_repositories,
filtered_repo_info_dicts=3Dfilte=
red_repo_info_dicts,
@@ -1128,7 +1120,7 @@
reposi=
tory_dependencies=3Drepository_dependencies )
repo_info_dicts.append( repo_info_dict )
# Make sure all tool_shed_repository records exist.
- created_or_updated_tool_shed_repositories, tool_panel_section_keys=
, repo_info_dicts, filtered_repo_info_dicts, message =3D \
+ created_or_updated_tool_shed_repositories, tool_panel_section_keys=
, repo_info_dicts, filtered_repo_info_dicts =3D \
repository_dependency_util.create_repository_dependency_object=
s( trans=3Dtrans,
=
tool_path=3Dtool_path,
=
tool_shed_url=3Dtool_shed_url,
@@ -1175,6 +1167,18 @@
initiate_repository_installation_ids=
=3Dencoded_repository_ids,
reinstalling=3DTrue )
=20
+ @web.expose
+ @web.require_admin
+ def repair_repository( self, trans, **kwd ):
+ """
+ Inspect the repository dependency hierarchy for a specified reposi=
tory and attempt to make sure they are all properly installed as well as
+ each repository's tool dependencies.
+ """
+ message =3D kwd.get( 'message', '' )
+ status =3D kwd.get( 'status', 'done' )
+ repository_id =3D kwd[ 'id' ]
+ tool_shed_repository =3D suc.get_installed_tool_shed_repository( t=
rans, repository_id )
+
@web.json
def repository_installation_status_updates( self, trans, ids=3DNone, s=
tatus_list=3DNone ):
# Avoid caching
@@ -1517,7 +1521,7 @@
def uninstall_tool_dependencies( self, trans, **kwd ):
message =3D kwd.get( 'message', '' )
status =3D kwd.get( 'status', 'done' )
- tool_dependency_ids =3D util.listify( kwd.get( 'tool_dependency_id=
s', None ) )
+ tool_dependency_ids =3D tool_dependency_util.get_tool_dependency_i=
ds( as_string=3DFalse, **kwd )
if not tool_dependency_ids:
tool_dependency_ids =3D util.listify( kwd.get( 'id', None ) )
tool_dependencies =3D []
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/tool_shed/galaxy_install/repository_util.py
--- a/lib/tool_shed/galaxy_install/repository_util.py
+++ b/lib/tool_shed/galaxy_install/repository_util.py
@@ -358,7 +358,7 @@
tool_panel_section =3D installation_dict[ 'tool_panel_section' ]
tool_path =3D installation_dict[ 'tool_path' ]
tool_shed_url =3D installation_dict[ 'tool_shed_url' ]
- created_or_updated_tool_shed_repositories, tool_panel_section_keys, re=
po_info_dicts, filtered_repo_info_dicts, message =3D \
+ created_or_updated_tool_shed_repositories, tool_panel_section_keys, re=
po_info_dicts, filtered_repo_info_dicts =3D \
repository_dependency_util.create_repository_dependency_objects( t=
rans=3Dtrans,
t=
ool_path=3Dtool_path,
t=
ool_shed_url=3Dtool_shed_url,
@@ -368,11 +368,7 @@
n=
o_changes_checked=3Dno_changes_checked,
t=
ool_panel_section=3Dtool_panel_section,
n=
ew_tool_panel_section=3Dnew_tool_panel_section )
- if message and len( repo_info_dicts ) =3D=3D 1 and not using_api:
- installed_tool_shed_repository =3D created_or_updated_tool_shed_re=
positories[ 0 ]
- message +=3D 'Click <a href=3D"%s">here</a> to manage the reposito=
ry. ' % \
- ( web.url_for( controller=3D'admin_toolshed', action=3D'manage=
_repository', id=3Dtrans.security.encode_id( installed_tool_shed_repository=
.id ) ) )
- return created_or_updated_tool_shed_repositories, tool_panel_section_k=
eys, repo_info_dicts, filtered_repo_info_dicts, message
+ return created_or_updated_tool_shed_repositories, tool_panel_section_k=
eys, repo_info_dicts, filtered_repo_info_dicts
=20
def initiate_repository_installation( trans, installation_dict ):
# The following installation_dict entries are all required.
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/tool_shed/galaxy_install/tool_dependencies/common_uti=
l.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/common_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/common_util.py
@@ -216,7 +216,7 @@
return os.path.abspath( file_path )
raise ValueError( 'Could not find path to file %s' % os.path.abspath( =
os.path.join( file_path, file_name ) ) )
=20
-def url_download( install_dir, downloaded_file_name, download_url ):
+def url_download( install_dir, downloaded_file_name, download_url, extract=
=3DTrue ):
file_path =3D os.path.join( install_dir, downloaded_file_name )
src =3D None
dst =3D None
@@ -236,7 +236,22 @@
src.close()
if dst:
dst.close()
- return os.path.abspath( file_path )
+ if extract:
+ if istar( file_path ):
+ # <action type=3D"download_by_url">http://sourceforge.net/proj=
ects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2</action>
+ extract_tar( file_path, install_dir )
+ dir =3D tar_extraction_directory( install_dir, downloaded_file=
_name )
+ elif isjar( file_path ):
+ dir =3D os.path.curdir
+ elif iszip( file_path ):
+ # <action type=3D"download_by_url">http://downloads.sourceforg=
e.net/project/picard/picard-tools/1.56/picard-tools-1.56.zip</action>
+ zip_archive_extracted =3D extract_zip( file_path, install_dir )
+ dir =3D zip_extraction_directory( install_dir, downloaded_file=
_name )
+ else:
+ dir =3D install_dir
+ else:
+ dir =3D install_dir
+ return dir
=20
def zip_extraction_directory( file_path, file_name ):
"""Try to return the correct extraction directory."""
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/tool_shed/galaxy_install/tool_dependencies/fabric_uti=
l.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -180,19 +180,7 @@
downloaded_filename =3D action_dict[ 'target_filen=
ame' ]
else:
downloaded_filename =3D os.path.split( url )[ -1 ]
- downloaded_file_path =3D common_util.url_download( wor=
k_dir, downloaded_filename, url )
- if common_util.istar( downloaded_file_path ):
- # <action type=3D"download_by_url">http://sourcefo=
rge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2</ac=
tion>
- common_util.extract_tar( downloaded_file_path, wor=
k_dir )
- dir =3D common_util.tar_extraction_directory( work=
_dir, downloaded_filename )
- elif common_util.isjar( downloaded_file_path ):
- dir =3D os.path.curdir
- elif common_util.iszip( downloaded_file_path ):
- # <action type=3D"download_by_url">http://download=
s.sourceforge.net/project/picard/picard-tools/1.56/picard-tools-1.56.zip</a=
ction>
- zip_archive_extracted =3D common_util.extract_zip(=
downloaded_file_path, work_dir )
- dir =3D common_util.zip_extraction_directory( work=
_dir, downloaded_filename )
- else:
- dir =3D os.path.curdir
+ dir =3D common_util.url_download( work_dir, downloaded=
_filename, url, extract=3DTrue )
elif action_type =3D=3D 'shell_command':
# <action type=3D"shell_command">git clone --recursive=
git://github.com/ekg/freebayes.git</action>
# Eliminate the shell_command clone action so remainin=
g actions can be processed correctly.
@@ -206,7 +194,7 @@
# Download a single file to the working directory.
filtered_actions =3D actions[ 1: ]
url =3D action_dict[ 'url' ]
- if action_dict[ 'target_filename' ]:
+ if 'target_filename' in action_dict:
# Sometimes compressed archives extracts their con=
tent to a folder other than the default defined file name. Using this
# attribute will ensure that the file name is set =
appropriately and can be located after download, decompression and extracti=
on.
filename =3D action_dict[ 'target_filename' ]
@@ -227,10 +215,10 @@
if not os.path.exists( full_path_to_dir ):
os.makedirs( full_path_to_dir )
# The package has been down-loaded, so we can now perform =
all of the actions defined for building it.
- with lcd( dir ):
- for action_tup in filtered_actions:
+ for action_tup in filtered_actions:
+ current_dir =3D os.path.abspath( os.path.join( work_di=
r, dir ) )
+ with lcd( current_dir ):
action_type, action_dict =3D action_tup
- current_dir =3D os.path.abspath( os.path.join( wor=
k_dir, dir ) )
if action_type =3D=3D 'make_directory':
common_util.make_directory( full_path=3Daction=
_dict[ 'full_path' ] )
elif action_type =3D=3D 'move_directory_files':
@@ -316,13 +304,20 @@
if return_code:
return
elif action_type =3D=3D 'download_file':
- # Download a single file to the current direct=
ory.
+ # Download a single file to the current workin=
g directory.
url =3D action_dict[ 'url' ]
- if action_dict[ 'target_filename' ]:
+ if 'target_filename' in action_dict:
filename =3D action_dict[ 'target_filename=
' ]
else:
filename =3D url.split( '/' )[ -1 ]
- common_util.url_download( current_dir, filenam=
e, url )
+ extract =3D action_dict.get( 'extract', False )
+ common_util.url_download( current_dir, filenam=
e, url, extract=3Dextract )
+ elif action_type =3D=3D 'change_directory':
+ target_directory =3D os.path.realpath( os.path=
.join( current_dir, action_dict[ 'directory' ] ) )
+ if target_directory.startswith( os.path.realpa=
th( current_dir ) ) and os.path.exists( target_directory ):
+ dir =3D target_directory
+ else:
+ log.error( 'Invalid or nonexistent directo=
ry %s specified, ignoring change_directory action.', target_directory )
=20
def log_results( command, fabric_AttributeString, file_path ):
"""
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/tool_shed/galaxy_install/tool_dependencies/install_ut=
il.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
@@ -13,6 +13,7 @@
from tool_shed.util import xml_util
from galaxy.model.orm import and_
from galaxy.web import url_for
+from galaxy.util import asbool
=20
log =3D logging.getLogger( __name__ )
=20
@@ -390,15 +391,19 @@
# <action type=3D"download_by_url">http://sourceforge.net/proj=
ects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2</action>
if action_elem.text:
action_dict[ 'url' ] =3D action_elem.text
- if 'target_filename' in action_elem.attrib:
- action_dict[ 'target_filename' ] =3D action_elem.attri=
b[ 'target_filename' ]
+ target_filename =3D action_elem.get( 'target_filename', No=
ne )
+ if target_filename:
+ action_dict[ 'target_filename' ] =3D target_filename
else:
continue
elif action_type =3D=3D 'download_file':
# <action type=3D"download_file">http://effectors.org/download=
/version/TTSS_GUI-1.0.1.jar</action>
if action_elem.text:
action_dict[ 'url' ] =3D action_elem.text
- action_dict[ 'target_filename' ] =3D action_elem.attrib.ge=
t( 'target_filename', None )
+ target_filename =3D action_elem.get( 'target_filename', No=
ne )
+ if target_filename:
+ action_dict[ 'target_filename' ] =3D target_filename
+ action_dict[ 'extract' ] =3D asbool( action_elem.get( 'ext=
ract', False ) )
else:
continue
elif action_type =3D=3D 'make_directory':
@@ -407,6 +412,12 @@
action_dict[ 'full_path' ] =3D evaluate_template( action_e=
lem.text )
else:
continue
+ elif action_type =3D=3D 'change_directory':
+ # <action type=3D"change_directory">PHYLIP-3.6b</action>
+ if action_elem.text:
+ action_dict[ 'directory' ] =3D action_elem.text
+ else:
+ continue
elif action_type in [ 'move_directory_files', 'move_file' ]:
# <action type=3D"move_file">
# <source>misc/some_file</source>
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/tool_shed/util/repository_dependency_util.py
--- a/lib/tool_shed/util/repository_dependency_util.py
+++ b/lib/tool_shed/util/repository_dependency_util.py
@@ -103,7 +103,6 @@
the dependency relationships between installed repositories. This met=
hod is called when new repositories are being installed into a Galaxy
instance and when uninstalled repositories are being reinstalled.
"""
- message =3D ''
# The following list will be maintained within this method to contain =
all created or updated tool shed repositories, including repository depende=
ncies
# that may not be installed.
all_created_or_updated_tool_shed_repositories =3D []
@@ -241,7 +240,7 @@
filtered_repo_info_dicts.append( repo_info_dict )
# Build repository dependency relationships even if the user chose to =
not install repository dependencies.
build_repository_dependency_relationships( trans, all_repo_info_dicts,=
all_created_or_updated_tool_shed_repositories )
- return created_or_updated_tool_shed_repositories, tool_panel_section_k=
eys, all_repo_info_dicts, filtered_repo_info_dicts, message
+ return created_or_updated_tool_shed_repositories, tool_panel_section_k=
eys, all_repo_info_dicts, filtered_repo_info_dicts
=20
def generate_message_for_invalid_repository_dependencies( metadata_dict ):
"""Return the error message associated with an invalid repository depe=
ndency for display in the caller."""
diff -r 46f4beebb766fd75edb59bc3598342ef95775af9 -r 1ff57c7a9debe0ced8bd216=
a33789218190f1f47 lib/tool_shed/util/tool_dependency_util.py
--- a/lib/tool_shed/util/tool_dependency_util.py
+++ b/lib/tool_shed/util/tool_dependency_util.py
@@ -220,9 +220,16 @@
=20
def get_tool_dependency_ids( as_string=3DFalse, **kwd ):
tool_dependency_id =3D kwd.get( 'tool_dependency_id', None )
- tool_dependency_ids =3D util.listify( kwd.get( 'tool_dependency_ids', =
None ) )
- if not tool_dependency_ids:
- tool_dependency_ids =3D util.listify( kwd.get( 'id', None ) )
+ if 'tool_dependency_ids' in kwd:
+ tool_dependency_ids =3D util.listify( kwd[ 'tool_dependency_ids' ]=
)
+ elif 'id' in kwd:
+ tool_dependency_ids =3D util.listify( kwd[ 'id' ] )
+ elif 'inst_td_ids' in kwd:
+ tool_dependency_ids =3D util.listify( kwd[ 'inst_td_ids' ] )
+ elif 'uninstalled_tool_dependency_ids' in kwd:
+ tool_dependency_ids =3D util.listify( kwd[ 'uninstalled_tool_depen=
dency_ids' ] )
+ else:
+ tool_dependency_ids =3D []
if tool_dependency_id and tool_dependency_id not in tool_dependency_id=
s:
tool_dependency_ids.append( tool_dependency_id )
if as_string:
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/galaxy/galaxy-central/commits/f1e5dfbbea46/
Changeset: f1e5dfbbea46
User: saketkc
Date: 2013-06-27 06:35:20
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 3fa9df444b4b81f94b1c42a033c685a6e23827be -r f1e5dfbbea46f0957ce4849=
4996444eb61f4a818 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/7e13235ae59a/
Changeset: 7e13235ae59a
User: saketkc
Date: 2013-06-28 07:00:22
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r b89b721a0b3db47cdeddef35f03ce4c2ffcb47b5 -r 7e13235ae59a1fb5eaa795c=
0797b4afa38001a38 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/8a88c559d596/
Changeset: 8a88c559d596
User: saketkc
Date: 2013-06-29 11:41:22
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 019ad31c3c2502005846dadc5c0457bbb6f80712 -r 8a88c559d5961d41c630b8e=
2dd1dafe6f275b9b2 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/13dc3f5865da/
Changeset: 13dc3f5865da
User: saketkc
Date: 2013-07-01 22:14:34
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 2cabbf3687634090fbbc024726f15f43db4ff314 -r 13dc3f5865da864c3823b31=
df455b5f6f1acb9f3 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/868bfd34f465/
Changeset: 868bfd34f465
User: saketkc
Date: 2013-07-09 10:41:15
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 86efa5ac1fae6fb46e7af9804e036a7ab44b0e26 -r 868bfd34f465dc1b6176d02=
fce93baecf3129279 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/f8c0c28b902e/
Changeset: f8c0c28b902e
User: saketkc
Date: 2013-07-10 21:30:38
Summary: vcfclass change merged
Affected #: 1 file
diff -r 4cc057df762c219406af27dd04ac725a07a5a6eb -r f8c0c28b902ecad5821ece5=
5030a9e7d02f779cf tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/4ff5c8a3ff34/
Changeset: 4ff5c8a3ff34
User: saketkc
Date: 2013-07-24 20:59:58
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r b42dfe74e237ea7f9c77059e427db92d9859bc67 -r 4ff5c8a3ff347824b430c99=
3303f2d97d907e2ed tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/28bad82d523b/
Changeset: 28bad82d523b
User: saketkc
Date: 2013-07-25 15:07:54
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 2abd0819d354d3d11182297c7206408d299f0d16 -r 28bad82d523b2053fa69c70=
301de69a74e57f323 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/a360e1b7b506/
Changeset: a360e1b7b506
User: saketkc
Date: 2013-07-31 15:48:50
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 951e853b0bcd2c62cedee0b95d46c9e36ab6c605 -r a360e1b7b506450385be74b=
2c6b7762d3e794bbd tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/79ae7df72fba/
Changeset: 79ae7df72fba
User: saketkc
Date: 2013-08-02 19:20:58
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 24 files
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -85,6 +85,7 @@
.coverage
htmlcov
run_unit_tests.html
+test/unit/**.log
=20
# Project files
*.kpf
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -475,6 +475,9 @@
=20
def sniff(self, filename):
try:
+ # All twobit files start with a 16-byte header. If the file is=
smaller than 16 bytes, it's obviously not a valid twobit file.
+ if os.path.getsize(filename) < 16:
+ return False
input =3D file(filename)
magic =3D struct.unpack(">L", input.read(TWOBIT_MAGIC_SIZE))[0]
if magic =3D=3D TWOBIT_MAGIC_NUMBER or magic =3D=3D TWOBIT_MAG=
IC_NUMBER_SWAP:
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -1514,8 +1514,8 @@
NOTE: This is wasteful since dynamic options and dataset collection
happens twice (here and when generating HTML).=20
"""
- # Can't look at history in workflow mode
- if trans is None or trans.workflow_building_mode:
+ # Can't look at history in workflow mode. Tool shed has no histori=
es.
+ if trans is None or trans.workflow_building_mode or trans.webapp.n=
ame =3D=3D 'tool_shed':
return DummyDataset()
assert trans is not None, "DataToolParameter requires a trans"
history =3D trans.get_history()
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/galaxy/visualization/data_providers/genome.py
--- a/lib/galaxy/visualization/data_providers/genome.py
+++ b/lib/galaxy/visualization/data_providers/genome.py
@@ -13,6 +13,7 @@
from galaxy.util.json import from_json_string
from bx.interval_index_file import Indexes
from bx.bbi.bigwig_file import BigWigFile
+from bx.bbi.bigbed_file import BigBedFile
from galaxy.util.lrucache import LRUCache
from galaxy.visualization.data_providers.basic import BaseDataProvider
from galaxy.visualization.data_providers.cigar import get_ref_based_read_s=
eq_and_cigar
@@ -861,14 +862,14 @@
"""
Returns an iterator that provides data in the region chrom:start-e=
nd
"""
- start, end =3D int(start), int(end)
+ start, end =3D int( start ), int( end )
orig_data_filename =3D self.original_dataset.file_name
index_filename =3D self.converted_dataset.file_name
=20
# Attempt to open the BAM file with index
bamfile =3D csamtools.Samfile( filename=3Dorig_data_filename, mode=
=3D'rb', index_filename=3Dindex_filename )
try:
- data =3D bamfile.fetch(start=3Dstart, end=3Dend, reference=3Dc=
hrom)
+ data =3D bamfile.fetch( start=3Dstart, end=3Dend, reference=3D=
chrom )
except ValueError, e:
# Try alternative chrom naming.
chrom =3D _convert_between_ucsc_and_ensemble_naming( chrom )
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/galaxy/webapps/galaxy/api/histories.py
--- a/lib/galaxy/webapps/galaxy/api/histories.py
+++ b/lib/galaxy/webapps/galaxy/api/histories.py
@@ -1,5 +1,7 @@
"""
API operations on a history.
+
+.. seealso:: :class:`galaxy.model.History`
"""
=20
import pkg_resources
@@ -21,17 +23,28 @@
@web.expose_api_anonymous
def index( self, trans, deleted=3D'False', **kwd ):
"""
- GET /api/histories
- GET /api/histories/deleted
- Displays a collection (list) of histories.
+ index( trans, deleted=3D'False' )
+ * GET /api/histories:
+ return undeleted histories for the current user
+ * GET /api/histories/deleted:
+ return deleted histories for the current user
+ .. note:: Anonymous users are allowed to get their current history
+
+ :type deleted: boolean
+ :param deleted: if True, show only deleted histories, if False, n=
on-deleted
+
+ :rtype: list
+ :returns: list of dictionaries containing summary history inform=
ation
"""
#TODO: query (by name, date, etc.)
rval =3D []
deleted =3D string_as_bool( deleted )
try:
if trans.user:
- query =3D trans.sa_session.query(trans.app.model.History )=
.filter_by( user=3Dtrans.user, deleted=3Ddeleted ).order_by(
- desc(trans.app.model.History.table.c.update_time)).all=
()
+ query =3D ( trans.sa_session.query( trans.app.model.Histor=
y )
+ .filter_by( user=3Dtrans.user, deleted=3Ddelet=
ed )
+ .order_by( desc( trans.app.model.History.table=
.c.update_time ) )
+ .all() )
for history in query:
item =3D history.get_api_value(value_mapper=3D{'id':tr=
ans.security.encode_id})
item['url'] =3D url_for( 'history', id=3Dtrans.securit=
y.encode_id( history.id ) )
@@ -52,11 +65,25 @@
=20
@web.expose_api_anonymous
def show( self, trans, id, deleted=3D'False', **kwd ):
+ # oh, sphinx - you bastard
"""
- GET /api/histories/{encoded_history_id}
- GET /api/histories/deleted/{encoded_history_id}
- GET /api/histories/most_recently_used
- Displays information about a history.
+ show( trans, id, deleted=3D'False' )
+ * GET /api/histories/{id}:
+ return the history with ``id``
+ * GET /api/histories/deleted/{id}:
+ return the deleted history with ``id``
+ * GET /api/histories/most_recently_used:
+ return the most recently used history
+ .. note:: Anonymous users are allowed to get their current history
+
+ :type id: an encoded id string
+ :param id: the encoded id of the history to query or the str=
ing 'most_recently_used'
+ :type deleted: boolean
+ :param deleted: if True, allow information on a deleted history t=
o be shown.
+
+ :rtype: dictionary
+ :returns: detailed history information from
+ :func:`galaxy.web.base.controller.UsesHistoryDatasetAssociatio=
nMixin.get_history_dict`
"""
#TODO: GET /api/histories/{encoded_history_id}?as_archive=3DTrue
#TODO: GET /api/histories/s/{username}/{slug}
@@ -94,8 +121,16 @@
@web.expose_api
def create( self, trans, payload, **kwd ):
"""
- POST /api/histories
- Creates a new history.
+ create( trans, payload )
+ * POST /api/histories:
+ create a new history
+
+ :type payload: dict
+ :param payload: (optional) dictionary structure containing:
+ * name: the new history's name
+ =20
+ :rtype: dict
+ :returns: element view of new history
"""
hist_name =3D None
if payload.get( 'name', None ):
@@ -115,8 +150,24 @@
@web.expose_api
def delete( self, trans, id, **kwd ):
"""
- DELETE /api/histories/{encoded_history_id}
- Deletes a history
+ delete( self, trans, id, **kwd )
+ * DELETE /api/histories/{id}
+ delete the history with the given ``id``
+ .. note:: Currently does not stop any active jobs in the history.
+
+ :type id: str
+ :param id: the encoded id of the history to delete
+ :type kwd: dict
+ :param kwd: (optional) dictionary structure containing:
+ =20
+ * payload: a dictionary itself containing:
+ * purge: if True, purge the history and all of it's HDAs
+
+ :rtype: dict
+ :returns: an error object if an error occurred or a dictionary c=
ontaining:
+ * id: the encoded id of the history,
+ * deleted: if the history was marked as deleted,
+ * purged: if the history was purged
"""
history_id =3D id
# a request body is optional here
@@ -175,8 +226,15 @@
@web.expose_api
def undelete( self, trans, id, **kwd ):
"""
- POST /api/histories/deleted/{encoded_history_id}/undelete
- Undeletes a history
+ undelete( self, trans, id, **kwd )
+ * POST /api/histories/deleted/{id}/undelete:
+ undelete history (that hasn't been purged) with the given ``id=
``
+
+ :type id: str
+ :param id: the encoded id of the history to undelete
+
+ :rtype: str
+ :returns: 'OK' if the history was undeleted
"""
history_id =3D id
history =3D self.get_history( trans, history_id, check_ownership=
=3DTrue, check_accessible=3DFalse, deleted=3DTrue )
@@ -188,8 +246,21 @@
@web.expose_api
def update( self, trans, id, payload, **kwd ):
"""
- PUT /api/histories/{encoded_history_id}
- Changes an existing history.
+ update( self, trans, id, payload, **kwd )
+ * PUT /api/histories/{id}
+ updates the values for the history with the given ``id``
+
+ :type id: str
+ :param id: the encoded id of the history to undelete
+ :type payload: dict
+ :param payload: a dictionary containing any or all the
+ fields in :func:`galaxy.model.History.get_api_value` and/or th=
e following:
+ =20
+ * annotation: an annotation for the history
+
+ :rtype: dict
+ :returns: an error object if an error occurred or a dictionary c=
ontaining
+ any values that were different from the original and, therefor=
e, updated
"""
#TODO: PUT /api/histories/{encoded_history_id} payload =3D { ratin=
g: rating } (w/ no security checks)
try:
@@ -255,6 +326,6 @@
raise ValueError( 'annotation must be a string or unic=
ode: %s' %( str( type( val ) ) ) )
validated_payload[ 'annotation' ] =3D sanitize_html( val, =
'utf-8' )
elif key not in valid_but_uneditable_keys:
- raise AttributeError( 'unknown key: %s' %( str( key ) ) )
+ pass
+ #log.warn( 'unknown key: %s', str( key ) )
return validated_payload
-
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -15,21 +15,27 @@
@web.expose_api_anonymous
def index( self, trans, history_id, ids=3DNone, **kwd ):
"""
- GET /api/histories/{encoded_history_id}/contents
- Displays a collection (list) of history contents (HDAs)
+ index( self, trans, history_id, ids=3DNone, **kwd )
+ * GET /api/histories/{history_id}/contents
+ return a list of HDA data for the history with the given ``id``
+ .. note:: Anonymous users are allowed to get their current history=
contents
=20
- :param history_id: an encoded id string of the `History` to search
- :param ids: (optional) a comma separated list of encoded `HDA` ids
-
- If Ids is not given, index returns a list of *summary* json object=
s for
- every `HDA` associated with the given `history_id`.
- See _summary_hda_dict.
+ If Ids is not given, index returns a list of *summary* objects for
+ every HDA associated with the given `history_id`.
=20
If ids is given, index returns a *more complete* json object for e=
ach
HDA in the ids list.
=20
- Note: Anonymous users are allowed to get their current history con=
tents
- (generally useful for browser UI access of the api)
+ :type history_id: str
+ :param history_id: encoded id string of the HDA's History
+ :type ids: str
+ :param ids: (optional) a comma separated list of encoded `=
HDA` ids
+
+ :rtype: list
+ :returns: dictionaries containing summary or detailed HDA inform=
ation
+ .. seealso::
+ :func:`_summary_hda_dict` and
+ :func:`galaxy.web.base.controller.UsesHistoryDatasetAssociatio=
nMixin.get_hda_dict`
"""
rval =3D []
try:
@@ -78,13 +84,13 @@
#TODO: move to model or Mixin
def _summary_hda_dict( self, trans, history_id, hda ):
"""
- Returns a dictionary based on the HDA in .. _summary form::
- {
- 'id' : < the encoded dataset id >,
- 'name' : < currently only returns 'file' >,
- 'type' : < name of the dataset >,
- 'url' : < api url to retrieve this datasets full data >,
- }
+ Returns a dictionary based on the HDA in summary form::
+ {
+ 'id' : < the encoded dataset id >,
+ 'name' : < currently only returns 'file' >,
+ 'type' : < name of the dataset >,
+ 'url' : < api url to retrieve this datasets full data >,
+ }
"""
api_type =3D "file"
encoded_id =3D trans.security.encode_id( hda.id )
@@ -98,8 +104,19 @@
@web.expose_api_anonymous
def show( self, trans, id, history_id, **kwd ):
"""
- GET /api/histories/{encoded_history_id}/contents/{encoded_content_=
id}
- Displays information about a history content (dataset).
+ show( self, trans, id, history_id, **kwd )
+ * GET /api/histories/{history_id}/contents/{id}
+ return detailed information about an HDA within a history
+ .. note:: Anonymous users are allowed to get their current history=
contents
+
+ :type id: str
+ :param ids: the encoded id of the HDA to return
+ :type history_id: str
+ :param history_id: encoded id string of the HDA's History
+
+ :rtype: dict
+ :returns: dictionary containing detailed HDA information
+ .. seealso:: :func:`galaxy.web.base.controller.UsesHistoryDatasetA=
ssociationMixin.get_hda_dict`
"""
hda_dict =3D {}
try:
@@ -135,8 +152,18 @@
@web.expose_api
def create( self, trans, history_id, payload, **kwd ):
"""
- POST /api/histories/{encoded_history_id}/contents
- Creates a new history content item (file, aka HistoryDatasetAssoci=
ation).
+ create( self, trans, history_id, payload, **kwd )
+ * POST /api/histories/{history_id}/contents
+ create a new HDA by copying an accessible LibraryDataset
+
+ :type history_id: str
+ :param history_id: encoded id string of the new HDA's History
+ :type payload: dict
+ :param payload: dictionary structure containing::
+ 'from_ld_id': the encoded id of the LibraryDataset to copy
+
+ :rtype: dict
+ :returns: dictionary containing detailed information for the new=
HDA
"""
#TODO: copy existing, accessible hda - dataset controller, copy_da=
tasets
#TODO: convert existing, accessible hda - model.DatasetInstance(or=
hda.datatype).get_converter_types
@@ -173,8 +200,24 @@
@web.expose_api
def update( self, trans, history_id, id, payload, **kwd ):
"""
- PUT /api/histories/{encoded_history_id}/contents/{encoded_content_=
id}
- Changes an existing history dataset.
+ update( self, trans, history_id, id, payload, **kwd )
+ * PUT /api/histories/{history_id}/contents/{id}
+ updates the values for the HDA with the given ``id``
+
+ :type history_id: str
+ :param history_id: encoded id string of the HDA's History
+ :type id: str
+ :param id: the encoded id of the history to undelete
+ :type payload: dict
+ :param payload: a dictionary containing any or all the
+ fields in :func:`galaxy.model.HistoryDatasetAssociation.get_ap=
i_value`
+ and/or the following:
+
+ * annotation: an annotation for the HDA
+
+ :rtype: dict
+ :returns: an error object if an error occurred or a dictionary c=
ontaining
+ any values that were different from the original and, therefor=
e, updated
"""
#TODO: PUT /api/histories/{encoded_history_id} payload =3D { ratin=
g: rating } (w/ no security checks)
changed =3D {}
@@ -251,6 +294,7 @@
raise ValueError( 'misc_info must be a string or unico=
de: %s' %( str( type( val ) ) ) )
validated_payload[ 'info' ] =3D util.sanitize_html.sanitiz=
e_html( val, 'utf-8' )
elif key not in valid_but_uneditable_keys:
- raise AttributeError( 'unknown key: %s' %( str( key ) ) )
+ pass
+ #log.warn( 'unknown key: %s', str( key ) )
return validated_payload
=20
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/galaxy/webapps/galaxy/api/libraries.py
--- a/lib/galaxy/webapps/galaxy/api/libraries.py
+++ b/lib/galaxy/webapps/galaxy/api/libraries.py
@@ -15,9 +15,18 @@
@web.expose_api
def index( self, trans, deleted=3D'False', **kwd ):
"""
- GET /api/libraries
- GET /api/libraries/deleted
- Displays a collection (list) of libraries.
+ index( self, trans, deleted=3D'False', **kwd )
+ * GET /api/libraries:
+ returns a list of summary data for libraries
+ * GET /api/libraries/deleted:
+ returns a list of summary data for deleted libraries
+
+ :type deleted: boolean
+ :param deleted: if True, show only deleted libraries, if False, n=
on-deleted
+
+ :rtype: list
+ :returns: list of dictionaries containing library information
+ .. seealso:: :attr:`galaxy.model.Library.api_collection_visible_ke=
ys`
"""
log.debug( "LibrariesController.index: enter" )
query =3D trans.sa_session.query( trans.app.model.Library )
@@ -49,9 +58,20 @@
@web.expose_api
def show( self, trans, id, deleted=3D'False', **kwd ):
"""
- GET /api/libraries/{encoded_library_id}
- GET /api/libraries/deleted/{encoded_library_id}
- Displays information about a library.
+ show( self, trans, id, deleted=3D'False', **kwd )
+ * GET /api/libraries/{id}:
+ returns detailed information about a library
+ * GET /api/libraries/deleted/{id}:
+ returns detailed information about a deleted library
+
+ :type id: an encoded id string
+ :param id: the encoded id of the library
+ :type deleted: boolean
+ :param deleted: if True, allow information on a deleted library
+
+ :rtype: dictionary
+ :returns: detailed library information
+ .. seealso:: :attr:`galaxy.model.Library.api_element_visible_keys`
"""
log.debug( "LibraryContentsController.show: enter" )
library_id =3D id
@@ -75,8 +95,20 @@
@web.expose_api
def create( self, trans, payload, **kwd ):
"""
- POST /api/libraries
- Creates a new library.
+ create( self, trans, payload, **kwd )
+ * POST /api/libraries:
+ create a new library
+ .. note:: Currently, only admin users can create libraries.
+
+ :type payload: dict
+ :param payload: (optional) dictionary structure containing::
+ 'name': the new library's name
+ 'description': the new library's description
+ 'synopsis': the new library's synopsis
+
+ :rtype: dict
+ :returns: a dictionary containing the id, name, and 'show' url
+ of the new library
"""
if not trans.user_is_admin():
raise HTTPForbidden( detail=3D'You are not authorized to creat=
e a new library.' )
@@ -102,6 +134,19 @@
=20
@web.expose_api
def delete( self, trans, id, **kwd ):
+ """
+ delete( self, trans, id, **kwd )
+ * DELETE /api/histories/{id}
+ mark the library with the given ``id`` as deleted
+ .. note:: Currently, only admin users can delete libraries.
+
+ :type id: str
+ :param id: the encoded id of the library to delete
+
+ :rtype: dictionary
+ :returns: detailed library information
+ .. seealso:: :attr:`galaxy.model.Library.api_element_visible_keys`
+ """
if not trans.user_is_admin():
raise HTTPForbidden( detail=3D'You are not authorized to delet=
e libraries.' )
try:
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -19,8 +19,21 @@
# TODO: Add parameter to only get top level of datasets/subfolders.
def index( self, trans, library_id, **kwd ):
"""
- GET /api/libraries/{encoded_library_id}/contents
- Displays a collection (list) of library contents (files and folder=
s).
+ index( self, trans, library_id, **kwd )
+ * GET /api/libraries/{library_id}/contents:
+ return a list of library files and folders
+
+ :type library_id: str
+ :param library_id: encoded id string of the library that contains=
this item
+
+ :rtype: list
+ :returns: list of dictionaries of the form:
+
+ * id: the encoded id of the library item
+ * name: the 'libary path'
+ or relationship of the library item to the root
+ * type: 'file' or 'folder'
+ * url: the url to get detailed information on the library item
"""
rval =3D []
current_user_roles =3D trans.get_current_user_roles()
@@ -80,8 +93,20 @@
@web.expose_api
def show( self, trans, id, library_id, **kwd ):
"""
- GET /api/libraries/{encoded_library_id}/contents/{encoded_content_=
id}
- Displays information about a library content (file or folder).
+ show( self, trans, id, library_id, **kwd )
+ * GET /api/libraries/{library_id}/contents/{id}
+ return information about library file or folder
+
+ :type id: str
+ :param id: the encoded id of the library item to return
+ :type library_id: str
+ :param library_id: encoded id string of the library that contains=
this item
+
+ :rtype: dict
+ :returns: detailed library item information
+ .. seealso::
+ :func:`galaxy.model.LibraryDataset.get_api_value` and
+ :attr:`galaxy.model.LibraryFolder.api_element_visible_keys`
"""
class_name, content_id =3D self.__decode_library_content_id( trans=
, id )
if class_name =3D=3D 'LibraryFolder':
@@ -93,8 +118,29 @@
@web.expose_api
def create( self, trans, library_id, payload, **kwd ):
"""
- POST /api/libraries/{encoded_library_id}/contents
- Creates a new library content item (file or folder).
+ create( self, trans, library_id, payload, **kwd )
+ * POST /api/libraries/{library_id}/contents:
+ create a new library file or folder
+
+ To copy an HDA into a library send ``create_type`` of 'file' and
+ the HDA's encoded id in ``from_hda_id`` (and optionally ``ldda_mes=
sage``).
+
+ :type library_id: str
+ :param library_id: encoded id string of the library that contains=
this item
+ :type payload: dict
+ :param payload: dictionary structure containing:
+ =20
+ * folder_id: the parent folder of the new item
+ * create_type: the type of item to create ('file' or 'folder')
+ * from_hda_id: (optional) the id of an accessible HDA to copy=
into the
+ library
+ * ldda_message: (optional) the new message attribute of the LD=
DA created
+ * extended_metadata: (optional) dub-dictionary containing any =
extended
+ metadata to associate with the item
+
+ :rtype: dict
+ :returns: a dictionary containing the id, name,
+ and 'show' url of the new item
"""
create_type =3D None
if 'create_type' not in payload:
@@ -195,10 +241,10 @@
=20
def _copy_hda_to_library_folder( self, trans, from_hda_id, library_id,=
folder_id, ldda_message=3D'' ):
"""
- Copies hda `from_hda_id` to library folder `library_folder_id` opt=
ionally
- adding `ldda_message` to the new ldda's `message`.
+ Copies hda ``from_hda_id`` to library folder ``library_folder_id``=
optionally
+ adding ``ldda_message`` to the new ldda's ``message``.
=20
- `library_contents.create` will branch to this if called with 'from=
_hda_id'
+ ``library_contents.create`` will branch to this if called with 'fr=
om_hda_id'
in it's payload.
"""
log.debug( '_copy_hda_to_library_folder: %s' %( str(( from_hda_id,=
library_id, folder_id, ldda_message )) ) )
@@ -236,10 +282,23 @@
return rval
=20
@web.expose_api
- def update( self, trans, id, library_id, payload, **kwd ):
+ def update( self, trans, id, library_id, payload, **kwd ):
"""
- PUT /api/libraries/{encoded_library_id}/contents/{encoded_content_=
type_and_id}
- Sets relationships among items
+ update( self, trans, id, library_id, payload, **kwd )
+ * PUT /api/libraries/{library_id}/contents/{id}
+ create a ImplicitlyConvertedDatasetAssociation
+ .. seealso:: :class:`galaxy.model.ImplicitlyConvertedDatasetAssoci=
ation`
+
+ :type id: str
+ :param id: the encoded id of the library item to return
+ :type library_id: str
+ :param library_id: encoded id string of the library that contains=
this item
+ :type payload: dict
+ :param payload: dictionary structure containing::
+ 'converted_dataset_id':
+
+ :rtype: None
+ :returns: None
"""
if 'converted_dataset_id' in payload:
converted_id =3D payload.pop( 'converted_dataset_id' )
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/tool_shed/galaxy_install/tool_dependencies/common_uti=
l.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/common_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/common_util.py
@@ -8,6 +8,7 @@
import zipfile
import tool_shed.util.shed_util_common as suc
from galaxy.datatypes import checkers
+from urllib2 import HTTPError
=20
log =3D logging.getLogger( __name__ )
=20
@@ -70,6 +71,23 @@
__shellquote(env_shell_file_path=
))
return cmd
=20
+def download_binary_from_url( url, work_dir, install_dir ):
+ '''
+ Download a pre-compiled binary from the specified URL. If the download=
ed file is an archive,
+ extract it into install_dir and delete the archive.
+ '''
+ downloaded_filename =3D os.path.split( url )[ -1 ]
+ try:
+ dir =3D url_download( work_dir, downloaded_filename, url, extract=
=3DTrue )
+ downloaded_filepath =3D os.path.join( work_dir, downloaded_filenam=
e )
+ if is_compressed( downloaded_filepath ):
+ os.remove( downloaded_filepath )
+ move_directory_files( current_dir=3Dwork_dir,
+ source_dir=3Ddir,
+ destination_dir=3Dinstall_dir )
+ return True
+ except HTTPError:
+ return False
=20
def extract_tar( file_name, file_path ):
if isgzip( file_name ) or isbz2( file_name ):
@@ -190,6 +208,12 @@
def iszip( file_path ):
return checkers.check_zip( file_path )
=20
+def is_compressed( file_path ):
+ if isjar( file_path ):
+ return False
+ else:
+ return iszip( file_path ) or isgzip( file_path ) or istar( file_pa=
th ) or isbz2( file_path )
+
def make_directory( full_path ):
if not os.path.exists( full_path ):
os.makedirs( full_path )
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/tool_shed/galaxy_install/tool_dependencies/fabric_uti=
l.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -165,12 +165,29 @@
actions =3D actions_dict.get( 'actions', None )
filtered_actions =3D []
env_shell_file_paths =3D []
+ # Default to false so that the install process will default to compili=
ng.
+ binary_found =3D False
if actions:
with make_tmp_dir() as work_dir:
with lcd( work_dir ):
# The first action in the list of actions will be the one =
that defines the installation process. There
# are currently only two supported processes; download_by_=
url and clone via a "shell_command" action type.
action_type, action_dict =3D actions[ 0 ]
+ if action_type =3D=3D 'download_binary':
+ # Eliminate the download_binary action so remaining ac=
tions can be processed correctly.
+ filtered_actions =3D actions[ 1: ]
+ url =3D action_dict[ 'url' ]
+ # Attempt to download a binary from the specified URL.
+ log.debug( 'Attempting to download from %s', url )
+ binary_found =3D common_util.download_binary_from_url(=
url, work_dir, install_dir )
+ if binary_found:
+ # If the attempt succeeded, set the action_type to=
binary_found, in order to skip any download_by_url or shell_command action=
s.
+ actions =3D filtered_actions
+ action_type =3D 'binary_found'
+ else:
+ # No binary exists, or there was an error download=
ing the binary from the generated URL. Proceed with the remaining actions.
+ del actions[ 0 ]
+ action_type, action_dict =3D actions[ 0 ]
if action_type =3D=3D 'download_by_url':
# Eliminate the download_by_url action so remaining ac=
tions can be processed correctly.
filtered_actions =3D actions[ 1: ]
@@ -220,6 +237,9 @@
current_dir =3D os.path.abspath( os.path.join( work_di=
r, dir ) )
with lcd( current_dir ):
action_type, action_dict =3D action_tup
+ # If a binary was found, we only need to process e=
nvironment variables, file permissions, and any other binary downloads.
+ if binary_found and action_type not in [ 'set_envi=
ronment', 'chmod', 'download_binary' ]:
+ continue
if action_type =3D=3D 'make_directory':
common_util.make_directory( full_path=3Daction=
_dict[ 'full_path' ] )
elif action_type =3D=3D 'move_directory_files':
@@ -348,6 +368,18 @@
dir =3D target_directory.replace( os.path.=
realpath( work_dir ), '' ).lstrip( '/' )
else:
log.error( 'Invalid or nonexistent directo=
ry %s specified, ignoring change_directory action.', target_directory )
+ elif action_type =3D=3D 'chmod':
+ for target_file, mode in action_dict[ 'change_=
modes' ]:
+ if os.path.exists( target_file ):
+ os.chmod( target_file, mode )
+ elif action_type =3D=3D 'download_binary':
+ url =3D action_dict[ 'url' ]
+ binary_found =3D common_util.download_binary_f=
rom_url( url, work_dir, install_dir )
+ if binary_found:
+ log.debug( 'Successfully downloaded binary=
from %s', url )
+ else:
+ log.error( 'Unable to download binary from=
%s', url )
+ =20
=20
def log_results( command, fabric_AttributeString, file_path ):
"""
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/tool_shed/galaxy_install/tool_dependencies/install_ut=
il.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
@@ -1,6 +1,7 @@
import logging
import os
import sys
+import stat
import subprocess
import tempfile
from string import Template
@@ -379,7 +380,22 @@
for action_elem in actions_elem.findall( 'action' ):
action_dict =3D {}
action_type =3D action_elem.get( 'type', 'shell_command' )
- if action_type =3D=3D 'shell_command':
+ if action_type =3D=3D 'download_binary':
+ platform_info_dict =3D tool_dependency_util.get_platform_info_=
dict()
+ platform_info_dict[ 'name' ] =3D tool_dependency.name
+ platform_info_dict[ 'version' ] =3D tool_dependency.version
+ url_template_elems =3D action_elem.findall( 'url_template' )
+ # Check if there are multiple url_template elements, each with=
attrib entries for a specific platform.
+ if len( url_template_elems ) > 1:
+ # <base_url os=3D"darwin" extract=3D"false">http://hgdownl=
oad.cse.ucsc.edu/admin/exe/macOSX.${architecture}/faToTwoBit</base_url>
+ # This method returns the url_elem that best matches the c=
urrent platform as received from os.uname().
+ # Currently checked attributes are os and architecture.
+ # These correspond to the values sysname and processor fro=
m the Python documentation for os.uname().
+ url_template_elem =3D tool_dependency_util.get_download_ur=
l_for_platform( url_template_elems, platform_info_dict )
+ else:
+ url_template_elem =3D url_template_elems[ 0 ]
+ action_dict[ 'url' ] =3D Template( url_template_elem.text ).sa=
fe_substitute( platform_info_dict )
+ elif action_type =3D=3D 'shell_command':
# <action type=3D"shell_command">make</action>
action_elem_text =3D evaluate_template( action_elem.text )
if action_elem_text:
@@ -492,6 +508,27 @@
# lxml=3D=3D2.3.0</action>
## Manually specify contents of requirements.txt file to creat=
e dynamically.
action_dict[ 'requirements' ] =3D evaluate_template( action_el=
em.text or 'requirements.txt' )
+ elif action_type =3D=3D 'chmod':
+ # Change the read, write, and execute bits on a file.
+ file_elems =3D action_elem.findall( 'file' )
+ chmod_actions =3D []
+ # A unix octal mode is the sum of the following values:
+ # Owner:
+ # 400 Read 200 Write 100 Execute
+ # Group:
+ # 040 Read 020 Write 010 Execute
+ # World:
+ # 004 Read 002 Write 001 Execute
+ for file_elem in file_elems:
+ # So by the above table, owner read/write/execute and grou=
p read permission would be 740.
+ # Python's os.chmod uses base 10 modes, convert received u=
nix-style octal modes to base 10.
+ received_mode =3D int( file_elem.get( 'mode', 600 ), base=
=3D8 )
+ # For added security, ensure that the setuid and setgid bi=
ts are not set.
+ mode =3D received_mode & ~( stat.S_ISUID | stat.S_ISGID )
+ file =3D evaluate_template( file_elem.text )
+ chmod_tuple =3D ( file, mode )
+ chmod_actions.append( chmod_tuple )
+ action_dict[ 'change_modes' ] =3D chmod_actions
else:
log.debug( "Unsupported action type '%s'. Not proceeding." % s=
tr( action_type ) )
raise Exception( "Unsupported action type '%s' in tool depende=
ncy definition." % str( action_type ) )
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c lib/tool_shed/util/tool_dependency_util.py
--- a/lib/tool_shed/util/tool_dependency_util.py
+++ b/lib/tool_shed/util/tool_dependency_util.py
@@ -39,6 +39,37 @@
tool_dependencies[ dependency_key ] =3D requirements_dict
return tool_dependencies
=20
+def get_download_url_for_platform( url_templates, platform_info_dict ):
+ '''
+ Compare the dict returned by get_platform_info() with the values speci=
fied in the base_url element. Return
+ true if and only if all defined attributes match the corresponding dic=
t entries. If an entry is not
+ defined in the base_url element, it is assumed to be irrelevant at thi=
s stage. For example,
+ <base_url os=3D"darwin">http://hgdownload.cse.ucsc.edu/admin/exe/macOS=
X.${architecture}/faToTwoBit</base_url>
+ where the OS must be 'darwin', but the architecture is filled in later=
using string.Template.
+ '''
+ os_ok =3D False
+ architecture_ok =3D False
+ for url_template in url_templates:
+ os_name =3D url_template.get( 'os', None )
+ architecture =3D url_template.get( 'architecture', None )
+ if os_name:
+ if os_name.lower() =3D=3D platform_info_dict[ 'os' ]:
+ os_ok =3D True
+ else:
+ os_ok =3D False
+ else:
+ os_ok =3D True
+ if architecture:
+ if architecture.lower() =3D=3D platform_info_dict[ 'architectu=
re' ]:
+ architecture_ok =3D True
+ else:
+ architecture_ok =3D False
+ else:
+ architecture_ok =3D True
+ if os_ok and architecture_ok:
+ return url_template
+ return None
+
def create_or_update_tool_dependency( app, tool_shed_repository, name, ver=
sion, type, status, set_status=3DTrue ):
# Called from Galaxy (never the tool shed) when a new repository is be=
ing installed or when an uninstalled repository is being reinstalled.
sa_session =3D app.model.context.current
@@ -204,6 +235,14 @@
missing_tool_dependencies =3D None
return tool_dependencies, missing_tool_dependencies
=20
+def get_platform_info_dict():
+ '''Return a dict with information about the current platform.'''
+ platform_dict =3D {}
+ sysname, nodename, release, version, machine =3D os.uname()
+ platform_dict[ 'os' ] =3D sysname.lower()
+ platform_dict[ 'architecture' ] =3D machine.lower()
+ return platform_dict
+
def get_tool_dependency( trans, id ):
"""Get a tool_dependency from the database via id"""
return trans.sa_session.query( trans.model.ToolDependency ).get( trans=
.security.decode_id( id ) )
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c static/scripts/galaxy.pages.js
--- a/static/scripts/galaxy.pages.js
+++ b/static/scripts/galaxy.pages.js
@@ -164,18 +164,19 @@
{
"Make link": function() {
// Get URL, name/title.
- var sUrl =3D $(wym._options.hrefSelector).val(),
- sName =3D $(".wym_title").val();
+ var sUrl =3D $(wym._options.hrefSelector).val() || '',
+ sId =3D $(".wym_id").val() || '',
+ sName =3D $(wym._options.titleSelector).val() || '=
';
=20
- if (sUrl && sName) {
+ if (sUrl || sId) {
// Create link.
wym._exec(WYMeditor.CREATE_LINK, sStamp);
=20
// Set link attributes.
var link =3D $("a[href=3D" + sStamp + "]", wym._do=
c.body);
link.attr(WYMeditor.HREF, sUrl)
- .attr(WYMeditor.TITLE, $(wym._options.titleSel=
ector).val())
- .attr("id", sName);
+ .attr(WYMeditor.TITLE, sName)
+ .attr("id", sId);
=20
// If link's text is default (wym-...), change it =
to the title.
if (link.text().indexOf('wym-') =3D=3D=3D 0) {
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c static/scripts/packed/galaxy.pages.js
--- a/static/scripts/packed/galaxy.pages.js
+++ b/static/scripts/packed/galaxy.pages.js
@@ -1,1 +1,1 @@
-var Galaxy=3D{ITEM_HISTORY:"item_history",ITEM_DATASET:"item_dataset",ITEM=
_WORKFLOW:"item_workflow",ITEM_PAGE:"item_page",ITEM_VISUALIZATION:"item_vi=
sualization",DIALOG_HISTORY_LINK:"link_history",DIALOG_DATASET_LINK:"link_d=
ataset",DIALOG_WORKFLOW_LINK:"link_workflow",DIALOG_PAGE_LINK:"link_page",D=
IALOG_VISUALIZATION_LINK:"link_visualization",DIALOG_EMBED_HISTORY:"embed_h=
istory",DIALOG_EMBED_DATASET:"embed_dataset",DIALOG_EMBED_WORKFLOW:"embed_w=
orkflow",DIALOG_EMBED_PAGE:"embed_page",DIALOG_EMBED_VISUALIZATION:"embed_v=
isualization",DIALOG_HISTORY_ANNOTATE:"history_annotate",};function init_ga=
laxy_elts(a){$(".annotation",a._doc.body).each(function(){$(this).click(fun=
ction(){var b=3Da._doc.createRange();b.selectNodeContents(this);var d=3Dwin=
dow.getSelection();d.removeAllRanges();d.addRange(b);var c=3D""})})}functio=
n get_item_info(d){var f,c,b;switch(d){case (Galaxy.ITEM_HISTORY):f=3D"Hist=
ory";c=3D"Histories";b=3D"history";item_class=3D"History";break;case (Galax=
y.ITEM_DATASET):f=3D"Dataset";c=3D"Datasets";b=3D"dataset";item_class=3D"Hi=
storyDatasetAssociation";break;case (Galaxy.ITEM_WORKFLOW):f=3D"Workflow";c=
=3D"Workflows";b=3D"workflow";item_class=3D"StoredWorkflow";break;case (Gal=
axy.ITEM_PAGE):f=3D"Page";c=3D"Pages";b=3D"page";item_class=3D"Page";break;=
case (Galaxy.ITEM_VISUALIZATION):f=3D"Visualization";c=3D"Visualizations";b=
=3D"visualization";item_class=3D"Visualization";break}var e=3D"list_"+c.toL=
owerCase()+"_for_selection";var a=3Dlist_objects_url.replace("LIST_ACTION",=
e);return{singular:f,plural:c,controller:b,iclass:item_class,list_ajax_url:=
a}}function make_item_importable(a,c,b){ajax_url=3Dset_accessible_url.repla=
ce("ITEM_CONTROLLER",a);$.ajax({type:"POST",url:ajax_url,data:{id:c,accessi=
ble:"True"},error:function(){alert("Making "+b+" accessible failed")}})}WYM=
editor.editor.prototype.dialog=3Dfunction(i,e,g){var a=3Dthis;var b=3Da.uni=
queStamp();var f=3Da.selected();function h(){$("#set_link_id").click(functi=
on(){$("#link_attribute_label").text("ID/Name");var k=3D$(".wym_href");k.ad=
dClass("wym_id").removeClass("wym_href");if(f){k.val($(f).attr("id"))}$(thi=
s).remove()})}if(i=3D=3DWYMeditor.DIALOG_LINK){if(f){$(a._options.hrefSelec=
tor).val($(f).attr(WYMeditor.HREF));$(a._options.srcSelector).val($(f).attr=
(WYMeditor.SRC));$(a._options.titleSelector).val($(f).attr(WYMeditor.TITLE)=
);$(a._options.altSelector).val($(f).attr(WYMeditor.ALT))}var c,d;if(f){c=
=3D$(f).attr("href");if(c=3D=3Dundefined){c=3D""}d=3D$(f).attr("title");if(=
d=3D=3Dundefined){d=3D""}}show_modal("Create Link","<div><div><label id=3D'=
link_attribute_label'>URL <span style=3D'float: right; font-size: 90%'><a h=
ref=3D'#' id=3D'set_link_id'>Create in-page anchor</a></span></label><br><i=
nput type=3D'text' class=3D'wym_href' value=3D'"+c+"' size=3D'40' /></div><=
div><label>Title</label><br><input type=3D'text' class=3D'wym_title' value=
=3D'"+d+"' size=3D'40' /></div><div>",{"Make link":function(){var l=3D$(a._=
options.hrefSelector).val(),m=3D$(".wym_title").val();if(l&&m){a._exec(WYMe=
ditor.CREATE_LINK,b);var k=3D$("a[href=3D"+b+"]",a._doc.body);k.attr(WYMedi=
tor.HREF,l).attr(WYMeditor.TITLE,$(a._options.titleSelector).val()).attr("i=
d",m);if(k.text().indexOf("wym-")=3D=3D=3D0){k.text(m)}}hide_modal()},Cance=
l:function(){hide_modal()}},{},h)}if(i=3D=3DWYMeditor.DIALOG_IMAGE){if(a._s=
elected_image){$(a._options.dialogImageSelector+" "+a._options.srcSelector)=
.val($(a._selected_image).attr(WYMeditor.SRC));$(a._options.dialogImageSele=
ctor+" "+a._options.titleSelector).val($(a._selected_image).attr(WYMeditor.=
TITLE));$(a._options.dialogImageSelector+" "+a._options.altSelector).val($(=
a._selected_image).attr(WYMeditor.ALT))}show_modal("Image","<div class=3D'r=
ow'><label>URL</label><br><input type=3D'text' class=3D'wym_src' value=3D''=
size=3D'40' /></div><div class=3D'row'><label>Alt text</label><br><input t=
ype=3D'text' class=3D'wym_alt' value=3D'' size=3D'40' /></div><div class=3D=
'row'><label>Title</label><br><input type=3D'text' class=3D'wym_title' valu=
e=3D'' size=3D'40' /></div>",{Insert:function(){var k=3D$(a._options.srcSel=
ector).val();if(k.length>0){a._exec(WYMeditor.INSERT_IMAGE,b);$("img[src$=
=3D"+b+"]",a._doc.body).attr(WYMeditor.SRC,k).attr(WYMeditor.TITLE,$(a._opt=
ions.titleSelector).val()).attr(WYMeditor.ALT,$(a._options.altSelector).val=
())}hide_modal()},Cancel:function(){hide_modal()}});return}if(i=3D=3DWYMedi=
tor.DIALOG_TABLE){show_modal("Table","<div class=3D'row'><label>Caption</la=
bel><br><input type=3D'text' class=3D'wym_caption' value=3D'' size=3D'40' /=
></div><div class=3D'row'><label>Summary</label><br><input type=3D'text' cl=
ass=3D'wym_summary' value=3D'' size=3D'40' /></div><div class=3D'row'><labe=
l>Number Of Rows<br></label><input type=3D'text' class=3D'wym_rows' value=
=3D'3' size=3D'3' /></div><div class=3D'row'><label>Number Of Cols<br></lab=
el><input type=3D'text' class=3D'wym_cols' value=3D'2' size=3D'3' /></div>"=
,{Insert:function(){var o=3D$(a._options.rowsSelector).val();var r=3D$(a._o=
ptions.colsSelector).val();if(o>0&&r>0){var n=3Da._doc.createElement(WYMedi=
tor.TABLE);var l=3Dnull;var q=3Dnull;var k=3D$(a._options.captionSelector).=
val();var p=3Dn.createCaption();p.innerHTML=3Dk;for(x=3D0;x<o;x++){l=3Dn.in=
sertRow(x);for(y=3D0;y<r;y++){l.insertCell(y)}}$(n).attr("summary",$(a._opt=
ions.summarySelector).val());var m=3D$(a.findUp(a.container(),WYMeditor.MAI=
N_CONTAINERS)).get(0);if(!m||!m.parentNode){$(a._doc.body).append(n)}else{$=
(m).after(n)}}hide_modal()},Cancel:function(){hide_modal()}})}if(i=3D=3DGal=
axy.DIALOG_HISTORY_LINK||i=3D=3DGalaxy.DIALOG_DATASET_LINK||i=3D=3DGalaxy.D=
IALOG_WORKFLOW_LINK||i=3D=3DGalaxy.DIALOG_PAGE_LINK||i=3D=3DGalaxy.DIALOG_V=
ISUALIZATION_LINK){var j;switch(i){case (Galaxy.DIALOG_HISTORY_LINK):j=3Dge=
t_item_info(Galaxy.ITEM_HISTORY);break;case (Galaxy.DIALOG_DATASET_LINK):j=
=3Dget_item_info(Galaxy.ITEM_DATASET);break;case (Galaxy.DIALOG_WORKFLOW_LI=
NK):j=3Dget_item_info(Galaxy.ITEM_WORKFLOW);break;case (Galaxy.DIALOG_PAGE_=
LINK):j=3Dget_item_info(Galaxy.ITEM_PAGE);break;case (Galaxy.DIALOG_VISUALI=
ZATION_LINK):j=3Dget_item_info(Galaxy.ITEM_VISUALIZATION);break}$.ajax({url=
:j.list_ajax_url,data:{},error:function(){alert("Failed to list "+j.plural.=
toLowerCase()+" for selection")},success:function(k){show_modal("Insert Lin=
k to "+j.singular,k+"<div><input id=3D'make-importable' type=3D'checkbox' c=
hecked/>Make the selected "+j.plural.toLowerCase()+" accessible so that the=
y can viewed by everyone.</div>",{Insert:function(){var m=3Dfalse;if($("#ma=
ke-importable:checked").val()!=3D=3Dnull){m=3Dtrue}var l=3Dnew Array();$("i=
nput[name=3Did]:checked").each(function(){var n=3D$(this).val();if(m){make_=
item_importable(j.controller,n,j.singular)}url_template=3Dget_name_and_link=
_url+n;ajax_url=3Durl_template.replace("ITEM_CONTROLLER",j.controller);$.ge=
tJSON(ajax_url,function(p){a._exec(WYMeditor.CREATE_LINK,b);var o=3D$("a[hr=
ef=3D"+b+"]",a._doc.body).text();if(o=3D=3D""||o=3D=3Db){a.insert("<a href=
=3D'"+p.link+"'>"+j.singular+" '"+p.name+"'</a>")}else{$("a[href=3D"+b+"]",=
a._doc.body).attr(WYMeditor.HREF,p.link).attr(WYMeditor.TITLE,j.singular+n)=
}})});hide_modal()},Cancel:function(){hide_modal()}})}})}if(i=3D=3DGalaxy.D=
IALOG_EMBED_HISTORY||i=3D=3DGalaxy.DIALOG_EMBED_DATASET||i=3D=3DGalaxy.DIAL=
OG_EMBED_WORKFLOW||i=3D=3DGalaxy.DIALOG_EMBED_PAGE||i=3D=3DGalaxy.DIALOG_EM=
BED_VISUALIZATION){var j;switch(i){case (Galaxy.DIALOG_EMBED_HISTORY):j=3Dg=
et_item_info(Galaxy.ITEM_HISTORY);break;case (Galaxy.DIALOG_EMBED_DATASET):=
j=3Dget_item_info(Galaxy.ITEM_DATASET);break;case (Galaxy.DIALOG_EMBED_WORK=
FLOW):j=3Dget_item_info(Galaxy.ITEM_WORKFLOW);break;case (Galaxy.DIALOG_EMB=
ED_PAGE):j=3Dget_item_info(Galaxy.ITEM_PAGE);break;case (Galaxy.DIALOG_EMBE=
D_VISUALIZATION):j=3Dget_item_info(Galaxy.ITEM_VISUALIZATION);break}$.ajax(=
{url:j.list_ajax_url,data:{},error:function(){alert("Failed to list "+j.plu=
ral.toLowerCase()+" for selection")},success:function(k){if(i=3D=3DGalaxy.D=
IALOG_EMBED_HISTORY||i=3D=3DGalaxy.DIALOG_EMBED_WORKFLOW||i=3D=3DGalaxy.DIA=
LOG_EMBED_VISUALIZATION){k=3Dk+"<div><input id=3D'make-importable' type=3D'=
checkbox' checked/>Make the selected "+j.plural.toLowerCase()+" accessible =
so that they can viewed by everyone.</div>"}show_modal("Embed "+j.plural,k,=
{Embed:function(){var l=3Dfalse;if($("#make-importable:checked").val()!=3Dn=
ull){l=3Dtrue}$("input[name=3Did]:checked").each(function(){var m=3D$(this)=
.val();var p=3D$("label[for=3D'"+m+"']:first").text();if(l){make_item_impor=
table(j.controller,m,j.singular)}var n=3Dj.iclass+"-"+m;var o=3D"<p><div id=
=3D'"+n+"' class=3D'embedded-item "+j.singular.toLowerCase()+" placeholder'=
><p class=3D'title'>Embedded Galaxy "+j.singular+" '"+p+"'</p><p class=3D'c=
ontent'> [Do not edit this bloc=
k; Galaxy will fill it in with the annotated "+j.singular.toLowerCase()+" w=
hen it is displayed.] </p></div></p=
>";a.insert(" ");a.insert(o);$("#"+n,a._doc.body).each(function(){var =
q=3Dtrue;while(q){var r=3D$(this).prev();if(r.length!=3D0&&jQuery.trim(r.te=
xt())=3D=3D""){r.remove()}else{q=3Dfalse}}})});hide_modal()},Cancel:functio=
n(){hide_modal()}})}})}if(i=3D=3DGalaxy.DIALOG_ANNOTATE_HISTORY){$.ajax({ur=
l:list_histories_for_selection_url,data:{},error:function(){alert("Grid ref=
resh failed")},success:function(k){show_modal("Insert Link to History",k,{A=
nnotate:function(){var l=3Dnew Array();$("input[name=3Did]:checked").each(f=
unction(){var m=3D$(this).val();$.ajax({url:get_history_annotation_table_ur=
l,data:{id:m},error:function(){alert("Grid refresh failed")},success:functi=
on(n){a.insert(n);init_galaxy_elts(a)}})});hide_modal()},Cancel:function(){=
hide_modal()}})}})}};$(function(){$(document).ajaxError(function(i,g){var h=
=3Dg.responseText||g.statusText||"Could not connect to server";show_modal("=
Server error",h,{"Ignore error":hide_modal});return false});$("[name=3Dpage=
_content]").wymeditor({skin:"galaxy",basePath:editor_base_path,iframeBasePa=
th:iframe_base_path,boxHtml:"<table class=3D'wym_box' width=3D'100%' height=
=3D'100%'><tr><td><div class=3D'wym_area_top'>"+WYMeditor.TOOLS+"</div></td=
></tr><tr height=3D'100%'><td><div class=3D'wym_area_main' style=3D'height:=
100%;'>"+WYMeditor.IFRAME+WYMeditor.STATUS+"</div></div></td></tr></table>=
",toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"It=
alic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"Superscript",title:=
"Superscript",css:"wym_tools_superscript"},{name:"Subscript",title:"Subscri=
pt",css:"wym_tools_subscript"},{name:"InsertOrderedList",title:"Ordered_Lis=
t",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unorder=
ed_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:=
"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"=
},{name:"Undo",title:"Undo",css:"wym_tools_undo"},{name:"Redo",title:"Redo"=
,css:"wym_tools_redo"},{name:"CreateLink",title:"Link",css:"wym_tools_link"=
},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"},{name:"InsertImage"=
,title:"Image",css:"wym_tools_image"},{name:"InsertTable",title:"Table",css=
:"wym_tools_table"},]});var d=3D$.wymeditors(0);var f=3Dfunction(g){show_mo=
dal("Saving page","progress");$.ajax({url:save_url,type:"POST",data:{id:pag=
e_id,content:d.xhtml(),annotations:JSON.stringify(new Object()),_:"true"},s=
uccess:function(){g()}})};$("#save-button").click(function(){f(function(){h=
ide_modal()})});$("#close-button").click(function(){var h=3Dfalse;if(h){var=
g=3Dfunction(){window.onbeforeunload=3Dundefined;window.document.location=
=3Dpage_list_url};show_modal("Close editor","There are unsaved changes to y=
our page which will be lost.",{Cancel:hide_modal,"Save Changes":function(){=
f(g)}},{"Don't Save":g})}else{window.document.location=3Dpage_list_url}});v=
ar a=3D$("<div class=3D'galaxy-page-editor-button'><a id=3D'insert-galaxy-l=
ink' class=3D'action-button popup' href=3D'#'>Paragraph type</a></div>");$(=
".wym_area_top").append(a);var b=3D{};$.each(d._options.containersItems,fun=
ction(h,g){var i=3Dg.name;b[g.title.replace("_"," ")]=3Dfunction(){d.contai=
ner(i)}});make_popupmenu(a,b);var c=3D$("<div><a id=3D'insert-galaxy-link' =
class=3D'action-button popup' href=3D'#'>Insert Link to Galaxy Object</a></=
div>").addClass("galaxy-page-editor-button");$(".wym_area_top").append(c);m=
ake_popupmenu(c,{"Insert History Link":function(){d.dialog(Galaxy.DIALOG_HI=
STORY_LINK)},"Insert Dataset Link":function(){d.dialog(Galaxy.DIALOG_DATASE=
T_LINK)},"Insert Workflow Link":function(){d.dialog(Galaxy.DIALOG_WORKFLOW_=
LINK)},"Insert Page Link":function(){d.dialog(Galaxy.DIALOG_PAGE_LINK)},"In=
sert Visualization Link":function(){d.dialog(Galaxy.DIALOG_VISUALIZATION_LI=
NK)},});var e=3D$("<div><a id=3D'embed-galaxy-object' class=3D'action-butto=
n popup' href=3D'#'>Embed Galaxy Object</a></div>").addClass("galaxy-page-e=
ditor-button");$(".wym_area_top").append(e);make_popupmenu(e,{"Embed Histor=
y":function(){d.dialog(Galaxy.DIALOG_EMBED_HISTORY)},"Embed Dataset":functi=
on(){d.dialog(Galaxy.DIALOG_EMBED_DATASET)},"Embed Workflow":function(){d.d=
ialog(Galaxy.DIALOG_EMBED_WORKFLOW)},"Embed Visualization":function(){d.dia=
log(Galaxy.DIALOG_EMBED_VISUALIZATION)},})});
\ No newline at end of file
+var Galaxy=3D{ITEM_HISTORY:"item_history",ITEM_DATASET:"item_dataset",ITEM=
_WORKFLOW:"item_workflow",ITEM_PAGE:"item_page",ITEM_VISUALIZATION:"item_vi=
sualization",DIALOG_HISTORY_LINK:"link_history",DIALOG_DATASET_LINK:"link_d=
ataset",DIALOG_WORKFLOW_LINK:"link_workflow",DIALOG_PAGE_LINK:"link_page",D=
IALOG_VISUALIZATION_LINK:"link_visualization",DIALOG_EMBED_HISTORY:"embed_h=
istory",DIALOG_EMBED_DATASET:"embed_dataset",DIALOG_EMBED_WORKFLOW:"embed_w=
orkflow",DIALOG_EMBED_PAGE:"embed_page",DIALOG_EMBED_VISUALIZATION:"embed_v=
isualization",DIALOG_HISTORY_ANNOTATE:"history_annotate",};function init_ga=
laxy_elts(a){$(".annotation",a._doc.body).each(function(){$(this).click(fun=
ction(){var b=3Da._doc.createRange();b.selectNodeContents(this);var d=3Dwin=
dow.getSelection();d.removeAllRanges();d.addRange(b);var c=3D""})})}functio=
n get_item_info(d){var f,c,b;switch(d){case (Galaxy.ITEM_HISTORY):f=3D"Hist=
ory";c=3D"Histories";b=3D"history";item_class=3D"History";break;case (Galax=
y.ITEM_DATASET):f=3D"Dataset";c=3D"Datasets";b=3D"dataset";item_class=3D"Hi=
storyDatasetAssociation";break;case (Galaxy.ITEM_WORKFLOW):f=3D"Workflow";c=
=3D"Workflows";b=3D"workflow";item_class=3D"StoredWorkflow";break;case (Gal=
axy.ITEM_PAGE):f=3D"Page";c=3D"Pages";b=3D"page";item_class=3D"Page";break;=
case (Galaxy.ITEM_VISUALIZATION):f=3D"Visualization";c=3D"Visualizations";b=
=3D"visualization";item_class=3D"Visualization";break}var e=3D"list_"+c.toL=
owerCase()+"_for_selection";var a=3Dlist_objects_url.replace("LIST_ACTION",=
e);return{singular:f,plural:c,controller:b,iclass:item_class,list_ajax_url:=
a}}function make_item_importable(a,c,b){ajax_url=3Dset_accessible_url.repla=
ce("ITEM_CONTROLLER",a);$.ajax({type:"POST",url:ajax_url,data:{id:c,accessi=
ble:"True"},error:function(){alert("Making "+b+" accessible failed")}})}WYM=
editor.editor.prototype.dialog=3Dfunction(i,e,g){var a=3Dthis;var b=3Da.uni=
queStamp();var f=3Da.selected();function h(){$("#set_link_id").click(functi=
on(){$("#link_attribute_label").text("ID/Name");var k=3D$(".wym_href");k.ad=
dClass("wym_id").removeClass("wym_href");if(f){k.val($(f).attr("id"))}$(thi=
s).remove()})}if(i=3D=3DWYMeditor.DIALOG_LINK){if(f){$(a._options.hrefSelec=
tor).val($(f).attr(WYMeditor.HREF));$(a._options.srcSelector).val($(f).attr=
(WYMeditor.SRC));$(a._options.titleSelector).val($(f).attr(WYMeditor.TITLE)=
);$(a._options.altSelector).val($(f).attr(WYMeditor.ALT))}var c,d;if(f){c=
=3D$(f).attr("href");if(c=3D=3Dundefined){c=3D""}d=3D$(f).attr("title");if(=
d=3D=3Dundefined){d=3D""}}show_modal("Create Link","<div><div><label id=3D'=
link_attribute_label'>URL <span style=3D'float: right; font-size: 90%'><a h=
ref=3D'#' id=3D'set_link_id'>Create in-page anchor</a></span></label><br><i=
nput type=3D'text' class=3D'wym_href' value=3D'"+c+"' size=3D'40' /></div><=
div><label>Title</label><br><input type=3D'text' class=3D'wym_title' value=
=3D'"+d+"' size=3D'40' /></div><div>",{"Make link":function(){var m=3D$(a._=
options.hrefSelector).val()||"",k=3D$(".wym_id").val()||"",n=3D$(a._options=
.titleSelector).val()||"";if(m||k){a._exec(WYMeditor.CREATE_LINK,b);var l=
=3D$("a[href=3D"+b+"]",a._doc.body);l.attr(WYMeditor.HREF,m).attr(WYMeditor=
.TITLE,n).attr("id",k);if(l.text().indexOf("wym-")=3D=3D=3D0){l.text(n)}}hi=
de_modal()},Cancel:function(){hide_modal()}},{},h)}if(i=3D=3DWYMeditor.DIAL=
OG_IMAGE){if(a._selected_image){$(a._options.dialogImageSelector+" "+a._opt=
ions.srcSelector).val($(a._selected_image).attr(WYMeditor.SRC));$(a._option=
s.dialogImageSelector+" "+a._options.titleSelector).val($(a._selected_image=
).attr(WYMeditor.TITLE));$(a._options.dialogImageSelector+" "+a._options.al=
tSelector).val($(a._selected_image).attr(WYMeditor.ALT))}show_modal("Image"=
,"<div class=3D'row'><label>URL</label><br><input type=3D'text' class=3D'wy=
m_src' value=3D'' size=3D'40' /></div><div class=3D'row'><label>Alt text</l=
abel><br><input type=3D'text' class=3D'wym_alt' value=3D'' size=3D'40' /></=
div><div class=3D'row'><label>Title</label><br><input type=3D'text' class=
=3D'wym_title' value=3D'' size=3D'40' /></div>",{Insert:function(){var k=3D=
$(a._options.srcSelector).val();if(k.length>0){a._exec(WYMeditor.INSERT_IMA=
GE,b);$("img[src$=3D"+b+"]",a._doc.body).attr(WYMeditor.SRC,k).attr(WYMedit=
or.TITLE,$(a._options.titleSelector).val()).attr(WYMeditor.ALT,$(a._options=
.altSelector).val())}hide_modal()},Cancel:function(){hide_modal()}});return=
}if(i=3D=3DWYMeditor.DIALOG_TABLE){show_modal("Table","<div class=3D'row'><=
label>Caption</label><br><input type=3D'text' class=3D'wym_caption' value=
=3D'' size=3D'40' /></div><div class=3D'row'><label>Summary</label><br><inp=
ut type=3D'text' class=3D'wym_summary' value=3D'' size=3D'40' /></div><div =
class=3D'row'><label>Number Of Rows<br></label><input type=3D'text' class=
=3D'wym_rows' value=3D'3' size=3D'3' /></div><div class=3D'row'><label>Numb=
er Of Cols<br></label><input type=3D'text' class=3D'wym_cols' value=3D'2' s=
ize=3D'3' /></div>",{Insert:function(){var o=3D$(a._options.rowsSelector).v=
al();var r=3D$(a._options.colsSelector).val();if(o>0&&r>0){var n=3Da._doc.c=
reateElement(WYMeditor.TABLE);var l=3Dnull;var q=3Dnull;var k=3D$(a._option=
s.captionSelector).val();var p=3Dn.createCaption();p.innerHTML=3Dk;for(x=3D=
0;x<o;x++){l=3Dn.insertRow(x);for(y=3D0;y<r;y++){l.insertCell(y)}}$(n).attr=
("summary",$(a._options.summarySelector).val());var m=3D$(a.findUp(a.contai=
ner(),WYMeditor.MAIN_CONTAINERS)).get(0);if(!m||!m.parentNode){$(a._doc.bod=
y).append(n)}else{$(m).after(n)}}hide_modal()},Cancel:function(){hide_modal=
()}})}if(i=3D=3DGalaxy.DIALOG_HISTORY_LINK||i=3D=3DGalaxy.DIALOG_DATASET_LI=
NK||i=3D=3DGalaxy.DIALOG_WORKFLOW_LINK||i=3D=3DGalaxy.DIALOG_PAGE_LINK||i=
=3D=3DGalaxy.DIALOG_VISUALIZATION_LINK){var j;switch(i){case (Galaxy.DIALOG=
_HISTORY_LINK):j=3Dget_item_info(Galaxy.ITEM_HISTORY);break;case (Galaxy.DI=
ALOG_DATASET_LINK):j=3Dget_item_info(Galaxy.ITEM_DATASET);break;case (Galax=
y.DIALOG_WORKFLOW_LINK):j=3Dget_item_info(Galaxy.ITEM_WORKFLOW);break;case =
(Galaxy.DIALOG_PAGE_LINK):j=3Dget_item_info(Galaxy.ITEM_PAGE);break;case (G=
alaxy.DIALOG_VISUALIZATION_LINK):j=3Dget_item_info(Galaxy.ITEM_VISUALIZATIO=
N);break}$.ajax({url:j.list_ajax_url,data:{},error:function(){alert("Failed=
to list "+j.plural.toLowerCase()+" for selection")},success:function(k){sh=
ow_modal("Insert Link to "+j.singular,k+"<div><input id=3D'make-importable'=
type=3D'checkbox' checked/>Make the selected "+j.plural.toLowerCase()+" ac=
cessible so that they can viewed by everyone.</div>",{Insert:function(){var=
m=3Dfalse;if($("#make-importable:checked").val()!=3D=3Dnull){m=3Dtrue}var =
l=3Dnew Array();$("input[name=3Did]:checked").each(function(){var n=3D$(thi=
s).val();if(m){make_item_importable(j.controller,n,j.singular)}url_template=
=3Dget_name_and_link_url+n;ajax_url=3Durl_template.replace("ITEM_CONTROLLER=
",j.controller);$.getJSON(ajax_url,function(p){a._exec(WYMeditor.CREATE_LIN=
K,b);var o=3D$("a[href=3D"+b+"]",a._doc.body).text();if(o=3D=3D""||o=3D=3Db=
){a.insert("<a href=3D'"+p.link+"'>"+j.singular+" '"+p.name+"'</a>")}else{$=
("a[href=3D"+b+"]",a._doc.body).attr(WYMeditor.HREF,p.link).attr(WYMeditor.=
TITLE,j.singular+n)}})});hide_modal()},Cancel:function(){hide_modal()}})}})=
}if(i=3D=3DGalaxy.DIALOG_EMBED_HISTORY||i=3D=3DGalaxy.DIALOG_EMBED_DATASET|=
|i=3D=3DGalaxy.DIALOG_EMBED_WORKFLOW||i=3D=3DGalaxy.DIALOG_EMBED_PAGE||i=3D=
=3DGalaxy.DIALOG_EMBED_VISUALIZATION){var j;switch(i){case (Galaxy.DIALOG_E=
MBED_HISTORY):j=3Dget_item_info(Galaxy.ITEM_HISTORY);break;case (Galaxy.DIA=
LOG_EMBED_DATASET):j=3Dget_item_info(Galaxy.ITEM_DATASET);break;case (Galax=
y.DIALOG_EMBED_WORKFLOW):j=3Dget_item_info(Galaxy.ITEM_WORKFLOW);break;case=
(Galaxy.DIALOG_EMBED_PAGE):j=3Dget_item_info(Galaxy.ITEM_PAGE);break;case =
(Galaxy.DIALOG_EMBED_VISUALIZATION):j=3Dget_item_info(Galaxy.ITEM_VISUALIZA=
TION);break}$.ajax({url:j.list_ajax_url,data:{},error:function(){alert("Fai=
led to list "+j.plural.toLowerCase()+" for selection")},success:function(k)=
{if(i=3D=3DGalaxy.DIALOG_EMBED_HISTORY||i=3D=3DGalaxy.DIALOG_EMBED_WORKFLOW=
||i=3D=3DGalaxy.DIALOG_EMBED_VISUALIZATION){k=3Dk+"<div><input id=3D'make-i=
mportable' type=3D'checkbox' checked/>Make the selected "+j.plural.toLowerC=
ase()+" accessible so that they can viewed by everyone.</div>"}show_modal("=
Embed "+j.plural,k,{Embed:function(){var l=3Dfalse;if($("#make-importable:c=
hecked").val()!=3Dnull){l=3Dtrue}$("input[name=3Did]:checked").each(functio=
n(){var m=3D$(this).val();var p=3D$("label[for=3D'"+m+"']:first").text();if=
(l){make_item_importable(j.controller,m,j.singular)}var n=3Dj.iclass+"-"+m;=
var o=3D"<p><div id=3D'"+n+"' class=3D'embedded-item "+j.singular.toLowerCa=
se()+" placeholder'><p class=3D'title'>Embedded Galaxy "+j.singular+" '"+p+=
"'</p><p class=3D'content'> [Do=
not edit this block; Galaxy will fill it in with the annotated "+j.singula=
r.toLowerCase()+" when it is displayed.] =
</p></div></p>";a.insert(" ");a.insert(o);$("#"+n,a._doc.body).e=
ach(function(){var q=3Dtrue;while(q){var r=3D$(this).prev();if(r.length!=3D=
0&&jQuery.trim(r.text())=3D=3D""){r.remove()}else{q=3Dfalse}}})});hide_moda=
l()},Cancel:function(){hide_modal()}})}})}if(i=3D=3DGalaxy.DIALOG_ANNOTATE_=
HISTORY){$.ajax({url:list_histories_for_selection_url,data:{},error:functio=
n(){alert("Grid refresh failed")},success:function(k){show_modal("Insert Li=
nk to History",k,{Annotate:function(){var l=3Dnew Array();$("input[name=3Di=
d]:checked").each(function(){var m=3D$(this).val();$.ajax({url:get_history_=
annotation_table_url,data:{id:m},error:function(){alert("Grid refresh faile=
d")},success:function(n){a.insert(n);init_galaxy_elts(a)}})});hide_modal()}=
,Cancel:function(){hide_modal()}})}})}};$(function(){$(document).ajaxError(=
function(i,g){var h=3Dg.responseText||g.statusText||"Could not connect to s=
erver";show_modal("Server error",h,{"Ignore error":hide_modal});return fals=
e});$("[name=3Dpage_content]").wymeditor({skin:"galaxy",basePath:editor_bas=
e_path,iframeBasePath:iframe_base_path,boxHtml:"<table class=3D'wym_box' wi=
dth=3D'100%' height=3D'100%'><tr><td><div class=3D'wym_area_top'>"+WYMedito=
r.TOOLS+"</div></td></tr><tr height=3D'100%'><td><div class=3D'wym_area_mai=
n' style=3D'height: 100%;'>"+WYMeditor.IFRAME+WYMeditor.STATUS+"</div></div=
></td></tr></table>",toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools=
_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"=
Superscript",title:"Superscript",css:"wym_tools_superscript"},{name:"Subscr=
ipt",title:"Subscript",css:"wym_tools_subscript"},{name:"InsertOrderedList"=
,title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedL=
ist",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",=
title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:=
"wym_tools_outdent"},{name:"Undo",title:"Undo",css:"wym_tools_undo"},{name:=
"Redo",title:"Redo",css:"wym_tools_redo"},{name:"CreateLink",title:"Link",c=
ss:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"},=
{name:"InsertImage",title:"Image",css:"wym_tools_image"},{name:"InsertTable=
",title:"Table",css:"wym_tools_table"},]});var d=3D$.wymeditors(0);var f=3D=
function(g){show_modal("Saving page","progress");$.ajax({url:save_url,type:=
"POST",data:{id:page_id,content:d.xhtml(),annotations:JSON.stringify(new Ob=
ject()),_:"true"},success:function(){g()}})};$("#save-button").click(functi=
on(){f(function(){hide_modal()})});$("#close-button").click(function(){var =
h=3Dfalse;if(h){var g=3Dfunction(){window.onbeforeunload=3Dundefined;window=
.document.location=3Dpage_list_url};show_modal("Close editor","There are un=
saved changes to your page which will be lost.",{Cancel:hide_modal,"Save Ch=
anges":function(){f(g)}},{"Don't Save":g})}else{window.document.location=3D=
page_list_url}});var a=3D$("<div class=3D'galaxy-page-editor-button'><a id=
=3D'insert-galaxy-link' class=3D'action-button popup' href=3D'#'>Paragraph =
type</a></div>");$(".wym_area_top").append(a);var b=3D{};$.each(d._options.=
containersItems,function(h,g){var i=3Dg.name;b[g.title.replace("_"," ")]=3D=
function(){d.container(i)}});make_popupmenu(a,b);var c=3D$("<div><a id=3D'i=
nsert-galaxy-link' class=3D'action-button popup' href=3D'#'>Insert Link to =
Galaxy Object</a></div>").addClass("galaxy-page-editor-button");$(".wym_are=
a_top").append(c);make_popupmenu(c,{"Insert History Link":function(){d.dial=
og(Galaxy.DIALOG_HISTORY_LINK)},"Insert Dataset Link":function(){d.dialog(G=
alaxy.DIALOG_DATASET_LINK)},"Insert Workflow Link":function(){d.dialog(Gala=
xy.DIALOG_WORKFLOW_LINK)},"Insert Page Link":function(){d.dialog(Galaxy.DIA=
LOG_PAGE_LINK)},"Insert Visualization Link":function(){d.dialog(Galaxy.DIAL=
OG_VISUALIZATION_LINK)},});var e=3D$("<div><a id=3D'embed-galaxy-object' cl=
ass=3D'action-button popup' href=3D'#'>Embed Galaxy Object</a></div>").addC=
lass("galaxy-page-editor-button");$(".wym_area_top").append(e);make_popupme=
nu(e,{"Embed History":function(){d.dialog(Galaxy.DIALOG_EMBED_HISTORY)},"Em=
bed Dataset":function(){d.dialog(Galaxy.DIALOG_EMBED_DATASET)},"Embed Workf=
low":function(){d.dialog(Galaxy.DIALOG_EMBED_WORKFLOW)},"Embed Visualizatio=
n":function(){d.dialog(Galaxy.DIALOG_EMBED_VISUALIZATION)},})});
\ No newline at end of file
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c static/scripts/packed/mvc/tools.js
--- a/static/scripts/packed/mvc/tools.js
+++ b/static/scripts/packed/mvc/tools.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","viz/trackster/util","mvc/data","libs/backbone/b=
ackbone-relational"],function(q,a,r){var f=3DBackbone.RelationalModel.exten=
d({defaults:{name:null,hidden:false},show:function(){this.set("hidden",fals=
e)},hide:function(){this.set("hidden",true)},is_visible:function(){return !=
this.attributes.hidden}});var k=3DBackbone.RelationalModel.extend({defaults=
:{name:null,label:null,type:null,value:null,num_samples:5},initialize:funct=
ion(){this.attributes.html=3Dunescape(this.attributes.html)},copy:function(=
){return new k(this.toJSON())},get_samples:function(){var u=3Dthis.get("typ=
e"),t=3Dnull;if(u=3D=3D=3D"number"){t=3Dd3.scale.linear().domain([this.get(=
"min"),this.get("max")]).ticks(this.get("num_samples"))}else{if(u=3D=3D=3D"=
select"){t=3Dq.map(this.get("options"),function(v){return v[0]})}}return t}=
});var e=3Df.extend({defaults:{description:null,target:null,inputs:[]},rela=
tions:[{type:Backbone.HasMany,key:"inputs",relatedModel:k,reverseRelation:{=
key:"tool",includeInJSON:false}}],urlRoot:galaxy_paths.get("tool_url"),copy=
:function(u){var v=3Dnew e(this.toJSON());if(u){var t=3Dnew Backbone.Collec=
tion();v.get("inputs").each(function(w){if(w.get_samples()){t.push(w)}});v.=
set("inputs",t)}return v},apply_search_results:function(t){(q.indexOf(t,thi=
s.attributes.id)!=3D=3D-1?this.show():this.hide());return this.is_visible()=
},set_input_value:function(t,u){this.get("inputs").find(function(v){return =
v.get("name")=3D=3D=3Dt}).set("value",u)},set_input_values:function(u){var =
t=3Dthis;q.each(q.keys(u),function(v){t.set_input_value(v,u[v])})},run:func=
tion(){return this._run()},rerun:function(u,t){return this._run({action:"re=
run",target_dataset_id:u.id,regions:t})},get_inputs_dict:function(){var t=
=3D{};this.get("inputs").each(function(u){t[u.get("name")]=3Du.get("value")=
});return t},_run:function(v){var w=3Dq.extend({tool_id:this.id,inputs:this=
.get_inputs_dict()},v);var u=3D$.Deferred(),t=3Dnew a.ServerStateDeferred({=
ajax_settings:{url:this.urlRoot,data:JSON.stringify(w),dataType:"json",cont=
entType:"application/json",type:"POST"},interval:2000,success_fn:function(x=
){return x!=3D=3D"pending"}});$.when(t.go()).then(function(x){u.resolve(new=
r.DatasetCollection().reset(x))});return u}});var i=3DBackbone.Collection.=
extend({model:e});var m=3Df.extend({});var p=3Df.extend({defaults:{elems:[]=
,open:false},clear_search_results:function(){q.each(this.attributes.elems,f=
unction(t){t.show()});this.show();this.set("open",false)},apply_search_resu=
lts:function(u){var v=3Dtrue,t;q.each(this.attributes.elems,function(w){if(=
w instanceof m){t=3Dw;t.hide()}else{if(w instanceof e){if(w.apply_search_re=
sults(u)){v=3Dfalse;if(t){t.show()}}}}});if(v){this.hide()}else{this.show()=
;this.set("open",true)}}});var b=3Df.extend({defaults:{search_hint_string:"=
search tools",min_chars_for_search:3,spinner_url:"",clear_btn_url:"",search=
_url:"",visible:true,query:"",results:null,clear_key:27},initialize:functio=
n(){this.on("change:query",this.do_search)},do_search:function(){var v=3Dth=
is.attributes.query;if(v.length<this.attributes.min_chars_for_search){this.=
set("results",null);return}var u=3Dv+"*";if(this.timer){clearTimeout(this.t=
imer)}$("#search-clear-btn").hide();$("#search-spinner").show();var t=3Dthi=
s;this.timer=3DsetTimeout(function(){$.get(t.attributes.search_url,{query:u=
},function(w){t.set("results",w);$("#search-spinner").hide();$("#search-cle=
ar-btn").show()},"json")},200)},clear_search:function(){this.set("query",""=
);this.set("results",null)}});var j=3DBackbone.Collection.extend({url:"/too=
ls",tools:new i(),parse:function(t){var u=3Dfunction(x){var w=3Dx.type;if(w=
=3D=3D=3D"tool"){return new e(x)}else{if(w=3D=3D=3D"section"){var v=3Dq.map=
(x.elems,u);x.elems=3Dv;return new p(x)}else{if(w=3D=3D=3D"label"){return n=
ew m(x)}}}};return q.map(t,u)},initialize:function(t){this.tool_search=3Dt.=
tool_search;this.tool_search.on("change:results",this.apply_search_results,=
this);this.on("reset",this.populate_tools,this)},populate_tools:function(){=
var t=3Dthis;t.tools=3Dnew i();this.each(function(u){if(u instanceof p){q.e=
ach(u.attributes.elems,function(v){if(v instanceof e){t.tools.push(v)}})}el=
se{if(u instanceof e){t.tools.push(u)}}})},clear_search_results:function(){=
this.each(function(t){if(t instanceof p){t.clear_search_results()}else{t.sh=
ow()}})},apply_search_results:function(){var u=3Dthis.tool_search.attribute=
s.results;if(u=3D=3D=3Dnull){this.clear_search_results();return}var t=3Dnul=
l;this.each(function(v){if(v instanceof m){t=3Dv;t.hide()}else{if(v instanc=
eof e){if(v.apply_search_results(u)){if(t){t.show()}}}else{t=3Dnull;v.apply=
_search_results(u)}}})}});var n=3DBackbone.View.extend({initialize:function=
(){this.model.on("change:hidden",this.update_visible,this);this.update_visi=
ble()},update_visible:function(){(this.model.attributes.hidden?this.$el.hid=
e():this.$el.show())}});var h=3Dn.extend({tagName:"div",template:Handlebars=
.templates.tool_link,render:function(){this.$el.append(this.template(this.m=
odel.toJSON()));return this}});var c=3Dn.extend({tagName:"div",className:"t=
oolPanelLabel",render:function(){this.$el.append($("<span/>").text(this.mod=
el.attributes.name));return this}});var g=3Dn.extend({tagName:"div",classNa=
me:"toolSectionWrapper",template:Handlebars.templates.panel_section,initial=
ize:function(){n.prototype.initialize.call(this);this.model.on("change:open=
",this.update_open,this)},render:function(){this.$el.append(this.template(t=
his.model.toJSON()));var t=3Dthis.$el.find(".toolSectionBody");q.each(this.=
model.attributes.elems,function(u){if(u instanceof e){var v=3Dnew h({model:=
u,className:"toolTitle"});v.render();t.append(v.$el)}else{if(u instanceof m=
){var w=3Dnew c({model:u});w.render();t.append(w.$el)}else{}}});return this=
},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.mo=
del.set("open",!this.model.attributes.open)},update_open:function(){(this.m=
odel.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"=
):this.$el.children(".toolSectionBody").slideUp("fast"))}});var l=3DBackbon=
e.View.extend({tagName:"div",id:"tool-search",className:"bar",template:Hand=
lebars.templates.tool_search,events:{click:"focus_and_select","keyup :input=
":"query_changed","click #search-clear-btn":"clear"},render:function(){this=
.$el.append(this.template(this.model.toJSON()));if(!this.model.is_visible()=
){this.$el.hide()}this.$el.find(".tooltip").tooltip();return this},focus_an=
d_select:function(){this.$el.find(":input").focus().select()},clear:functio=
n(){this.model.clear_search();this.$el.find(":input").val(this.model.attrib=
utes.search_hint_string);this.focus_and_select();return false},query_change=
d:function(t){if((this.model.attributes.clear_key)&&(this.model.attributes.=
clear_key=3D=3D=3Dt.which)){this.clear();return false}this.model.set("query=
",this.$el.find(":input").val())}});var s=3DBackbone.View.extend({tagName:"=
div",className:"toolMenu",initialize:function(){this.collection.tool_search=
.on("change:results",this.handle_search_results,this)},render:function(){va=
r t=3Dthis;var u=3Dnew l({model:this.collection.tool_search});u.render();t.=
$el.append(u.$el);this.collection.each(function(w){if(w instanceof p){var v=
=3Dnew g({model:w});v.render();t.$el.append(v.$el)}else{if(w instanceof e){=
var x=3Dnew h({model:w,className:"toolTitleNoSection"});x.render();t.$el.ap=
pend(x.$el)}else{if(w instanceof m){var y=3Dnew c({model:w});y.render();t.$=
el.append(y.$el)}}}});t.$el.find("a.tool-link").click(function(x){var w=3D$=
(this).attr("class").split(/\s+/)[0],v=3Dt.collection.tools.get(w);t.trigge=
r("tool_link_click",x,v)});return this},handle_search_results:function(){va=
r t=3Dthis.collection.tool_search.attributes.results;if(t&&t.length=3D=3D=
=3D0){$("#search-no-results").show()}else{$("#search-no-results").hide()}}}=
);var o=3DBackbone.View.extend({className:"toolForm",template:Handlebars.te=
mplates.tool_form,render:function(){this.$el.children().remove();this.$el.a=
ppend(this.template(this.model.toJSON()))}});var d=3DBackbone.View.extend({=
className:"toolMenuAndView",initialize:function(){this.tool_panel_view=3Dne=
w s({collection:this.collection});this.tool_form_view=3Dnew o()},render:fun=
ction(){this.tool_panel_view.render();this.tool_panel_view.$el.css("float",=
"left");this.$el.append(this.tool_panel_view.$el);this.tool_form_view.$el.h=
ide();this.$el.append(this.tool_form_view.$el);var t=3Dthis;this.tool_panel=
_view.on("tool_link_click",function(v,u){v.preventDefault();t.show_tool(u)}=
)},show_tool:function(u){var t=3Dthis;u.fetch().done(function(){t.tool_form=
_view.model=3Du;t.tool_form_view.render();t.tool_form_view.$el.show();$("#l=
eft").width("650px")})}});return{Tool:e,ToolSearch:b,ToolPanel:j,ToolPanelV=
iew:s,ToolFormView:o}});
\ No newline at end of file
+define(["libs/underscore","viz/trackster/util","mvc/data","libs/backbone/b=
ackbone-relational"],function(q,a,r){var g=3DBackbone.RelationalModel.exten=
d({defaults:{name:null,hidden:false},show:function(){this.set("hidden",fals=
e)},hide:function(){this.set("hidden",true)},is_visible:function(){return !=
this.attributes.hidden}});var c=3DBackbone.RelationalModel.extend({defaults=
:{name:null,label:null,type:null,value:null,num_samples:5},initialize:funct=
ion(){this.attributes.html=3Dunescape(this.attributes.html)},copy:function(=
){return new c(this.toJSON())},get_samples:function(){var u=3Dthis.get("typ=
e"),t=3Dnull;if(u=3D=3D=3D"number"){t=3Dd3.scale.linear().domain([this.get(=
"min"),this.get("max")]).ticks(this.get("num_samples"))}else{if(u=3D=3D=3D"=
select"){t=3Dq.map(this.get("options"),function(v){return v[0]})}}return t}=
});var f=3Dg.extend({defaults:{description:null,target:null,inputs:[]},rela=
tions:[{type:Backbone.HasMany,key:"inputs",relatedModel:c,reverseRelation:{=
key:"tool",includeInJSON:false}}],urlRoot:galaxy_paths.get("tool_url"),copy=
:function(u){var v=3Dnew f(this.toJSON());if(u){var t=3Dnew Backbone.Collec=
tion();v.get("inputs").each(function(w){if(w.get_samples()){t.push(w)}});v.=
set("inputs",t)}return v},apply_search_results:function(t){(q.indexOf(t,thi=
s.attributes.id)!=3D=3D-1?this.show():this.hide());return this.is_visible()=
},set_input_value:function(t,u){this.get("inputs").find(function(v){return =
v.get("name")=3D=3D=3Dt}).set("value",u)},set_input_values:function(u){var =
t=3Dthis;q.each(q.keys(u),function(v){t.set_input_value(v,u[v])})},run:func=
tion(){return this._run()},rerun:function(u,t){return this._run({action:"re=
run",target_dataset_id:u.id,regions:t})},get_inputs_dict:function(){var t=
=3D{};this.get("inputs").each(function(u){t[u.get("name")]=3Du.get("value")=
});return t},_run:function(v){var w=3Dq.extend({tool_id:this.id,inputs:this=
.get_inputs_dict()},v);var u=3D$.Deferred(),t=3Dnew a.ServerStateDeferred({=
ajax_settings:{url:this.urlRoot,data:JSON.stringify(w),dataType:"json",cont=
entType:"application/json",type:"POST"},interval:2000,success_fn:function(x=
){return x!=3D=3D"pending"}});$.when(t.go()).then(function(x){u.resolve(new=
r.DatasetCollection().reset(x))});return u}});var j=3DBackbone.Collection.=
extend({model:f});var m=3Dg.extend({});var p=3Dg.extend({defaults:{elems:[]=
,open:false},clear_search_results:function(){q.each(this.attributes.elems,f=
unction(t){t.show()});this.show();this.set("open",false)},apply_search_resu=
lts:function(u){var v=3Dtrue,t;q.each(this.attributes.elems,function(w){if(=
w instanceof m){t=3Dw;t.hide()}else{if(w instanceof f){if(w.apply_search_re=
sults(u)){v=3Dfalse;if(t){t.show()}}}}});if(v){this.hide()}else{this.show()=
;this.set("open",true)}}});var b=3Dg.extend({defaults:{search_hint_string:"=
search tools",min_chars_for_search:3,spinner_url:"",clear_btn_url:"",search=
_url:"",visible:true,query:"",results:null,clear_key:27},initialize:functio=
n(){this.on("change:query",this.do_search)},do_search:function(){var v=3Dth=
is.attributes.query;if(v.length<this.attributes.min_chars_for_search){this.=
set("results",null);return}var u=3Dv+"*";if(this.timer){clearTimeout(this.t=
imer)}$("#search-clear-btn").hide();$("#search-spinner").show();var t=3Dthi=
s;this.timer=3DsetTimeout(function(){$.get(t.attributes.search_url,{query:u=
},function(w){t.set("results",w);$("#search-spinner").hide();$("#search-cle=
ar-btn").show()},"json")},200)},clear_search:function(){this.set("query",""=
);this.set("results",null)}});var k=3DBackbone.Collection.extend({url:"/too=
ls",tools:new j(),parse:function(t){var u=3Dfunction(x){var w=3Dx.type;if(w=
=3D=3D=3D"tool"){return new f(x)}else{if(w=3D=3D=3D"section"){var v=3Dq.map=
(x.elems,u);x.elems=3Dv;return new p(x)}else{if(w=3D=3D=3D"label"){return n=
ew m(x)}}}};return q.map(t,u)},initialize:function(t){this.tool_search=3Dt.=
tool_search;this.tool_search.on("change:results",this.apply_search_results,=
this);this.on("reset",this.populate_tools,this)},populate_tools:function(){=
var t=3Dthis;t.tools=3Dnew j();this.each(function(u){if(u instanceof p){q.e=
ach(u.attributes.elems,function(v){if(v instanceof f){t.tools.push(v)}})}el=
se{if(u instanceof f){t.tools.push(u)}}})},clear_search_results:function(){=
this.each(function(t){if(t instanceof p){t.clear_search_results()}else{t.sh=
ow()}})},apply_search_results:function(){var u=3Dthis.tool_search.attribute=
s.results;if(u=3D=3D=3Dnull){this.clear_search_results();return}var t=3Dnul=
l;this.each(function(v){if(v instanceof m){t=3Dv;t.hide()}else{if(v instanc=
eof f){if(v.apply_search_results(u)){if(t){t.show()}}}else{t=3Dnull;v.apply=
_search_results(u)}}})}});var n=3DBackbone.View.extend({initialize:function=
(){this.model.on("change:hidden",this.update_visible,this);this.update_visi=
ble()},update_visible:function(){(this.model.attributes.hidden?this.$el.hid=
e():this.$el.show())}});var i=3Dn.extend({tagName:"div",template:Handlebars=
.templates.tool_link,render:function(){this.$el.append(this.template(this.m=
odel.toJSON()));return this}});var d=3Dn.extend({tagName:"div",className:"t=
oolPanelLabel",render:function(){this.$el.append($("<span/>").text(this.mod=
el.attributes.name));return this}});var h=3Dn.extend({tagName:"div",classNa=
me:"toolSectionWrapper",template:Handlebars.templates.panel_section,initial=
ize:function(){n.prototype.initialize.call(this);this.model.on("change:open=
",this.update_open,this)},render:function(){this.$el.append(this.template(t=
his.model.toJSON()));var t=3Dthis.$el.find(".toolSectionBody");q.each(this.=
model.attributes.elems,function(u){if(u instanceof f){var v=3Dnew i({model:=
u,className:"toolTitle"});v.render();t.append(v.$el)}else{if(u instanceof m=
){var w=3Dnew d({model:u});w.render();t.append(w.$el)}else{}}});return this=
},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.mo=
del.set("open",!this.model.attributes.open)},update_open:function(){(this.m=
odel.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"=
):this.$el.children(".toolSectionBody").slideUp("fast"))}});var l=3DBackbon=
e.View.extend({tagName:"div",id:"tool-search",className:"bar",template:Hand=
lebars.templates.tool_search,events:{click:"focus_and_select","keyup :input=
":"query_changed","click #search-clear-btn":"clear"},render:function(){this=
.$el.append(this.template(this.model.toJSON()));if(!this.model.is_visible()=
){this.$el.hide()}this.$el.find(".tooltip").tooltip();return this},focus_an=
d_select:function(){this.$el.find(":input").focus().select()},clear:functio=
n(){this.model.clear_search();this.$el.find(":input").val(this.model.attrib=
utes.search_hint_string);this.focus_and_select();return false},query_change=
d:function(t){if((this.model.attributes.clear_key)&&(this.model.attributes.=
clear_key=3D=3D=3Dt.which)){this.clear();return false}this.model.set("query=
",this.$el.find(":input").val())}});var s=3DBackbone.View.extend({tagName:"=
div",className:"toolMenu",initialize:function(){this.collection.tool_search=
.on("change:results",this.handle_search_results,this)},render:function(){va=
r t=3Dthis;var u=3Dnew l({model:this.collection.tool_search});u.render();t.=
$el.append(u.$el);this.collection.each(function(w){if(w instanceof p){var v=
=3Dnew h({model:w});v.render();t.$el.append(v.$el)}else{if(w instanceof f){=
var x=3Dnew i({model:w,className:"toolTitleNoSection"});x.render();t.$el.ap=
pend(x.$el)}else{if(w instanceof m){var y=3Dnew d({model:w});y.render();t.$=
el.append(y.$el)}}}});t.$el.find("a.tool-link").click(function(x){var w=3D$=
(this).attr("class").split(/\s+/)[0],v=3Dt.collection.tools.get(w);t.trigge=
r("tool_link_click",x,v)});return this},handle_search_results:function(){va=
r t=3Dthis.collection.tool_search.attributes.results;if(t&&t.length=3D=3D=
=3D0){$("#search-no-results").show()}else{$("#search-no-results").hide()}}}=
);var o=3DBackbone.View.extend({className:"toolForm",template:Handlebars.te=
mplates.tool_form,render:function(){this.$el.children().remove();this.$el.a=
ppend(this.template(this.model.toJSON()))}});var e=3DBackbone.View.extend({=
className:"toolMenuAndView",initialize:function(){this.tool_panel_view=3Dne=
w s({collection:this.collection});this.tool_form_view=3Dnew o()},render:fun=
ction(){this.tool_panel_view.render();this.tool_panel_view.$el.css("float",=
"left");this.$el.append(this.tool_panel_view.$el);this.tool_form_view.$el.h=
ide();this.$el.append(this.tool_form_view.$el);var t=3Dthis;this.tool_panel=
_view.on("tool_link_click",function(v,u){v.preventDefault();t.show_tool(u)}=
)},show_tool:function(u){var t=3Dthis;u.fetch().done(function(){t.tool_form=
_view.model=3Du;t.tool_form_view.render();t.tool_form_view.$el.show();$("#l=
eft").width("650px")})}});return{Tool:f,ToolSearch:b,ToolPanel:k,ToolPanelV=
iew:s,ToolFormView:o}});
\ No newline at end of file
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c templates/webapps/tool_shed/repository/tool_form.mako
--- a/templates/webapps/tool_shed/repository/tool_form.mako
+++ b/templates/webapps/tool_shed/repository/tool_form.mako
@@ -70,6 +70,8 @@
=20
<%def name=3D"row_for_param( prefix, param, parent_state, other_va=
lues )"><%
+ # Disable refresh_on_change for select lists displayed in =
the tool shed.=20
+ param.refresh_on_change =3D False
label =3D param.get_label()
if isinstance( param, DataToolParameter ) or isinstance( p=
aram, ColumnListParameter ) or isinstance( param, GenomeBuildParameter ):
field =3D SelectField( param.name )
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c test/install_and_test_tool_shed_repositories/functional_t=
ests.py
--- a/test/install_and_test_tool_shed_repositories/functional_tests.py
+++ b/test/install_and_test_tool_shed_repositories/functional_tests.py
@@ -6,6 +6,7 @@
=20
import os, sys, shutil, tempfile, re, string, urllib, platform
from time import strftime
+from ConfigParser import SafeConfigParser
=20
# Assume we are run from the galaxy root directory, add lib to the python =
path
cwd =3D os.getcwd()
@@ -73,6 +74,40 @@
default_galaxy_test_port_max =3D 10999
default_galaxy_test_host =3D '127.0.0.1'
=20
+# should this serve static resources (scripts, images, styles, etc.)
+STATIC_ENABLED =3D True
+
+def get_static_settings():
+ """Returns dictionary of the settings necessary for a galaxy App
+ to be wrapped in the static middleware.
+
+ This mainly consists of the filesystem locations of url-mapped
+ static resources.
+ """
+ cwd =3D os.getcwd()
+ static_dir =3D os.path.join( cwd, 'static' )
+ #TODO: these should be copied from universe_wsgi.ini
+ return dict(
+ #TODO: static_enabled needed here?
+ static_enabled =3D True,
+ static_cache_time =3D 360,
+ static_dir =3D static_dir,
+ static_images_dir =3D os.path.join( static_dir, 'images', '' ),
+ static_favicon_dir =3D os.path.join( static_dir, 'favicon.ico' ),
+ static_scripts_dir =3D os.path.join( static_dir, 'scripts', '' ),
+ static_style_dir =3D os.path.join( static_dir, 'june_2007_style=
', 'blue' ),
+ static_robots_txt =3D os.path.join( static_dir, 'robots.txt' ),
+ )
+
+def get_webapp_global_conf():
+ """Get the global_conf dictionary sent as the first argument to app_fa=
ctory.
+ """
+ # (was originally sent 'dict()') - nothing here for now except static =
settings
+ global_conf =3D dict()
+ if STATIC_ENABLED:
+ global_conf.update( get_static_settings() )
+ return global_conf
+
# Optionally, set the environment variable GALAXY_INSTALL_TEST_TOOL_SHEDS_=
CONF
# to the location of a tool sheds configuration file that includes the too=
l shed
# that repositories will be installed from.
@@ -219,6 +254,36 @@
success =3D result.wasSuccessful()
return success
=20
+def generate_config_file( input_filename, output_filename, config_items ):
+ '''
+ Generate a config file with the configuration that has been defined fo=
r the embedded web application.
+ This is mostly relevant when setting metadata externally, since the sc=
ript for doing that does not
+ have access to app.config.
+ '''=20
+ cp =3D SafeConfigParser()
+ cp.read( input_filename )
+ config_items_by_section =3D []
+ for label, value in config_items:
+ found =3D False
+ # Attempt to determine the correct section for this configuration =
option.
+ for section in cp.sections():
+ if cp.has_option( section, label ):
+ config_tuple =3D section, label, value
+ config_items_by_section.append( config_tuple )
+ found =3D True
+ continue
+ # Default to app:main if no section was found.
+ if not found:
+ config_tuple =3D 'app:main', label, value
+ config_items_by_section.append( config_tuple )
+ # Replace the default values with the provided configuration.
+ for section, label, value in config_items_by_section:
+ cp.remove_option( section, label )
+ cp.set( section, label, str( value ) )
+ fh =3D open( output_filename, 'w' )
+ cp.write( fh )
+ fh.close()
+
def get_api_url( base, parts=3D[], params=3DNone, key=3DNone ):
if 'api' in parts and parts.index( 'api' ) !=3D 0:
parts.pop( parts.index( 'api' ) )
@@ -554,48 +619,64 @@
# Generate the migrated_tool_conf.xml file.
migrated_tool_conf_xml =3D tool_conf_template_parser.safe_substitute( =
shed_tool_path=3Dgalaxy_migrated_tool_path )
file( galaxy_migrated_tool_conf_file, 'w' ).write( migrated_tool_conf_=
xml )
-
+ # Write the embedded web application's specific configuration to a tem=
porary file. This is necessary in order for
+ # the external metadata script to find the right datasets.
+ kwargs =3D dict( admin_users =3D 'test(a)bx.psu.edu',
+ allow_user_creation =3D True,
+ allow_user_deletion =3D True,
+ allow_library_path_paste =3D True,
+ database_connection =3D database_connection,
+ datatype_converters_config_file =3D "datatype_converter=
s_conf.xml.sample",
+ file_path =3D galaxy_file_path,
+ id_secret =3D galaxy_encode_secret,
+ job_queue_workers =3D 5,
+ log_destination =3D "stdout",
+ migrated_tools_config =3D galaxy_migrated_tool_conf_fil=
e,
+ new_file_path =3D galaxy_tempfiles,
+ running_functional_tests =3D True,
+ shed_tool_data_table_config =3D shed_tool_data_table_co=
nf_file,
+ shed_tool_path =3D galaxy_shed_tool_path,
+ template_path =3D "templates",
+ tool_config_file =3D ','.join( [ galaxy_tool_conf_file,=
galaxy_shed_tool_conf_file ] ),
+ tool_data_path =3D tool_data_path,
+ tool_data_table_config_path =3D galaxy_tool_data_table_=
conf_file,
+ tool_dependency_dir =3D tool_dependency_dir,
+ tool_path =3D tool_path,
+ tool_parse_help =3D False,
+ tool_sheds_config_file =3D galaxy_tool_sheds_conf_file,
+ update_integrated_tool_panel =3D False,
+ use_heartbeat =3D False )
+ galaxy_config_file =3D os.environ.get( 'GALAXY_INSTALL_TEST_INI_FILE',=
None )
+ # If the user has passed in a path for the .ini file, do not overwrite=
it.
+ if not galaxy_config_file:
+ galaxy_config_file =3D os.path.join( galaxy_test_tmp_dir, 'install=
_test_tool_shed_repositories_wsgi.ini' )
+ config_items =3D []
+ for label in kwargs:
+ config_tuple =3D label, kwargs[ label ]
+ config_items.append( config_tuple )
+ # Write a temporary file, based on universe_wsgi.ini.sample, using=
the configuration options defined above.
+ generate_config_file( 'universe_wsgi.ini.sample', galaxy_config_fi=
le, config_items )
+ kwargs[ 'tool_config_file' ] =3D [ galaxy_tool_conf_file, galaxy_shed_=
tool_conf_file ]
+ # Set the global_conf[ '__file__' ] option to the location of the temp=
orary .ini file, which gets passed to set_metadata.sh.
+ kwargs[ 'global_conf' ] =3D get_webapp_global_conf()
+ kwargs[ 'global_conf' ][ '__file__' ] =3D galaxy_config_file
# ---- Build Galaxy Application --------------------------------------=
------------=20
- global_conf =3D { '__file__' : 'universe_wsgi.ini.sample' }
if not database_connection.startswith( 'sqlite://' ):
kwargs[ 'database_engine_option_max_overflow' ] =3D '20'
kwargs[ 'database_engine_option_pool_size' ] =3D '10'
- app =3D UniverseApplication( admin_users =3D 'test(a)bx.psu.edu',
- allow_user_creation =3D True,
- allow_user_deletion =3D True,
- allow_library_path_paste =3D True,
- database_connection =3D database_connection,
- datatype_converters_config_file =3D "dataty=
pe_converters_conf.xml.sample",
- file_path =3D galaxy_file_path,
- global_conf =3D global_conf,
- id_secret =3D galaxy_encode_secret,
- job_queue_workers =3D 5,
- log_destination =3D "stdout",
- migrated_tools_config =3D galaxy_migrated_t=
ool_conf_file,
- new_file_path =3D galaxy_tempfiles,
- running_functional_tests=3DTrue,
- shed_tool_data_table_config =3D shed_tool_d=
ata_table_conf_file,
- shed_tool_path =3D galaxy_shed_tool_path,
- template_path =3D "templates",
- tool_config_file =3D [ galaxy_tool_conf_fil=
e, galaxy_shed_tool_conf_file ],
- tool_data_path =3D tool_data_path,
- tool_data_table_config_path =3D galaxy_tool=
_data_table_conf_file,
- tool_dependency_dir =3D tool_dependency_dir,
- tool_path =3D tool_path,
- tool_parse_help =3D False,
- tool_sheds_config_file =3D galaxy_tool_shed=
s_conf_file,
- update_integrated_tool_panel =3D False,
- use_heartbeat =3D False,
- **kwargs )
+ kwargs[ 'config_file' ] =3D galaxy_config_file
+ app =3D UniverseApplication( **kwargs )
=20
log.info( "Embedded Galaxy application started" )
=20
# ---- Run galaxy webserver ------------------------------------------=
------------
server =3D None
- webapp =3D buildapp.app_factory( dict( database_file=3Ddatabase_connec=
tion ),
- use_translogger=3DFalse,
- static_enabled=3DFalse,
- app=3Dapp )
+ global_conf =3D get_webapp_global_conf()
+ global_conf[ 'database_file' ] =3D database_connection
+ webapp =3D buildapp.app_factory( global_conf,
+ use_translogger=3DFalse,
+ static_enabled=3DSTATIC_ENABLED,
+ app=3Dapp )
=20
# Serve the app on a specified or random port.
if galaxy_test_port is not None:
@@ -976,6 +1057,7 @@
repositories_passed.append( dict( name=3Dname, own=
er=3Downer, changeset_revision=3Dchangeset_revision ) )
params[ 'tools_functionally_correct' ] =3D True
params[ 'do_not_test' ] =3D False
+ params[ 'test_install_error' ] =3D False
register_test_result( galaxy_tool_shed_url,=20
metadata_revision_id,=20
repository_status,=20
@@ -1027,6 +1109,7 @@
repositories_failed.append( dict( name=3Dname, own=
er=3Downer, changeset_revision=3Dchangeset_revision ) )
set_do_not_test =3D not is_latest_downloadable_rev=
ision( galaxy_tool_shed_url, repository_info_dict )
params[ 'tools_functionally_correct' ] =3D False
+ params[ 'test_install_error' ] =3D False
params[ 'do_not_test' ] =3D str( set_do_not_test )
register_test_result( galaxy_tool_shed_url,=20
metadata_revision_id,=20
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c test/unit/datatypes/dataproviders/tempfilecache.py
--- /dev/null
+++ b/test/unit/datatypes/dataproviders/tempfilecache.py
@@ -0,0 +1,47 @@
+
+import os
+import tempfile
+
+import logging
+logging.getLogger( __name__ )
+log =3D logging
+
+class TempFileCache( object ):
+ """
+ Creates and caches tempfiles with/based-on the given contents.
+ """
+ def __init__( self, logger=3DNone ):
+ if logger:
+ global log
+ log =3D logger
+ super( TempFileCache, self ).__init__()
+ self.clear()
+
+ def clear( self ):
+ self.delete_tmpfiles()
+ self._content_dict =3D {}
+
+ def create_tmpfile( self, contents ):
+ if not hasattr( self, '_content_dict' ):
+ self.set_up_tmpfiles()
+
+ if contents not in self._content_dict:
+ # create a named tmp and write contents to it, return filename
+ tmpfile =3D tempfile.NamedTemporaryFile( delete=3DFalse )
+ tmpfile.write( contents )
+ tmpfile.close()
+ log.debug( 'created tmpfile.name: %s', tmpfile.name )
+ self._content_dict[ contents ] =3D tmpfile.name
+
+ else:
+ log.debug( '(cached): %s', self._content_dict[ contents ] )
+ return self._content_dict[ contents ]
+
+ def delete_tmpfiles( self ):
+ if not hasattr( self, '_content_dict' ) or not self._content_dict:
+ return
+ for tmpfile_contents in self._content_dict:
+ tmpfile =3D self._content_dict[ tmpfile_contents ]
+ if os.path.exists( tmpfile ):
+ log.debug( 'unlinking tmpfile: %s', tmpfile )
+ os.unlink( tmpfile )
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c test/unit/datatypes/dataproviders/test_base_dataproviders=
.py
--- /dev/null
+++ b/test/unit/datatypes/dataproviders/test_base_dataproviders.py
@@ -0,0 +1,370 @@
+"""
+Unit tests for base DataProviders.
+.. seealso:: galaxy.datatypes.dataproviders.base
+"""
+# currently because of dataproviders.dataset importing galaxy.model this d=
oesn't work
+#TODO: fix imports there after dist and retry
+
+#TODO: fix off by ones in FilteredDataProvider counters
+
+import unittest
+import StringIO
+
+import tempfilecache
+import utility
+
+log =3D utility.set_up_filelogger( __name__ + '.log' )
+
+utility.add_galaxy_lib_to_path( '/test/unit/datatypes/dataproviders' )
+from galaxy.datatypes import dataproviders
+
+
+class BaseTestCase( unittest.TestCase ):
+ default_file_contents =3D """
+ One
+ Two
+ Three
+ """
+
+ @classmethod
+ def setUpClass( cls ):
+ log.debug( 'CLASS %s %s', ( '_' * 40 ), cls.__name__ )
+
+ @classmethod
+ def tearDownClass( cls ):
+ log.debug( 'CLASS %s %s\n\n', ( '_' * 40 ), cls.__name__ )
+
+ def __init__( self, *args ):
+ unittest.TestCase.__init__( self, *args )
+ self.tmpfiles =3D tempfilecache.TempFileCache( log )
+
+ def setUp( self ):
+ log.debug( 'BEGIN %s %s', ( '.' * 40 ), self._testMethodName )
+ if self._testMethodDoc:
+ log.debug( ' """%s"""', self._testMethodDoc.strip() )
+
+ def tearDown( self ):
+ self.tmpfiles.clear()
+ log.debug( 'END\n' )
+
+ def format_tmpfile_contents( self, contents=3DNone ):
+ contents =3D contents or self.default_file_contents
+ contents =3D utility.clean_multiline_string( contents )
+ log.debug( 'file contents:\n%s', contents )
+ return contents
+
+
+class Test_BaseDataProvider( BaseTestCase ):
+ provider_class =3D dataproviders.base.DataProvider
+
+ def contents_provider_and_data( self,
+ filename=3DNone, contents=3DNone, source=3DNone, *provider_arg=
s, **provider_kwargs ):
+ # to remove boiler plate
+ # returns file content string, provider used, and data list
+ if not filename:
+ contents =3D self.format_tmpfile_contents( contents )
+ filename =3D self.tmpfiles.create_tmpfile( contents )
+ #TODO: if filename, contents =3D=3D None
+ if not source:
+ source =3D open( filename )
+ provider =3D self.provider_class( source, *provider_args, **provid=
er_kwargs )
+ log.debug( 'provider: %s', provider )
+ data =3D list( provider )
+ log.debug( 'data: %s', str( data ) )
+ return ( contents, provider, data )
+
+ def test_iterators( self ):
+ source =3D ( x for x in xrange( 1, 10 ) )
+ provider =3D self.provider_class( source )
+ data =3D list( provider )
+ log.debug( 'data: %s', str( data ) )
+ self.assertEqual( data, [ x for x in xrange( 1, 10 ) ] )
+
+ source =3D [ x for x in xrange( 1, 10 ) ]
+ provider =3D self.provider_class( source )
+ data =3D list( provider )
+ log.debug( 'data: %s', str( data ) )
+ self.assertEqual( data, [ x for x in xrange( 1, 10 ) ] )
+
+ source =3D ( x for x in xrange( 1, 10 ) )
+ provider =3D self.provider_class( source )
+ data =3D list( provider )
+ log.debug( 'data: %s', str( data ) )
+ self.assertEqual( data, [ x for x in xrange( 1, 10 ) ] )
+
+ def test_validate_source( self ):
+ """validate_source should throw an error if the source doesn't hav=
e attr '__iter__'
+ """
+ def non_iterator_dprov( source ):
+ return self.provider_class( source )
+ self.assertRaises( dataproviders.exceptions.InvalidDataProviderSou=
rce,
+ non_iterator_dprov, 'one two three' )
+ self.assertRaises( dataproviders.exceptions.InvalidDataProviderSou=
rce,
+ non_iterator_dprov, 40 )
+
+ def test_writemethods( self ):
+ """should throw an error if any write methods are called
+ """
+ source =3D ( x for x in xrange( 1, 10 ) )
+ provider =3D self.provider_class( source )
+ # should throw error
+ def call_method( provider, method_name, *args ):
+ method =3D getattr( provider, method_name )
+ return method( *args )
+ self.assertRaises( NotImplementedError, call_method, provider, 'tr=
uncate', 20 )
+ self.assertRaises( NotImplementedError, call_method, provider, 'wr=
ite', 'bler' )
+ self.assertRaises( NotImplementedError, call_method, provider, 'wr=
itelines', [ 'one', 'two' ] )
+
+ def test_readlines( self ):
+ """readlines should return all the data in list form
+ """
+ source =3D ( x for x in xrange( 1, 10 ) )
+ provider =3D self.provider_class( source )
+ data =3D provider.readlines()
+ log.debug( 'data: %s', str( data ) )
+ self.assertEqual( data, [ x for x in xrange( 1, 10 ) ] )
+
+ def test_stringio( self ):
+ """should work with StringIO
+ """
+ contents =3D utility.clean_multiline_string( """
+ One
+ Two
+ Three
+ """ )
+ source =3D StringIO.StringIO( contents )
+ provider =3D self.provider_class( source )
+ data =3D list( provider )
+ log.debug( 'data: %s', str( data ) )
+ # provider should call close on file
+ self.assertEqual( ''.join( data ), contents )
+ self.assertTrue( source.closed )
+
+ def test_file( self ):
+ """should work with files
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data()
+ self.assertEqual( ''.join( data ), contents )
+ # provider should call close on file
+ self.assertTrue( isinstance( provider.source, file ) )
+ self.assertTrue( provider.source.closed )
+
+
+class Test_FilteredDataProvider( Test_BaseDataProvider ):
+ provider_class =3D dataproviders.base.FilteredDataProvider
+
+ def assertCounters( self, provider, read, valid, returned ):
+ self.assertEqual( provider.num_data_read, read )
+ self.assertEqual( provider.num_valid_data_read, valid )
+ self.assertEqual( provider.num_data_returned, returned )
+
+ def test_counters( self ):
+ """should count: lines read, lines that passed the filter, lines r=
eturned
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data()
+ self.assertCounters( provider, 3, 3, 3 )
+
+ def test_filter_fn( self ):
+ """should filter out lines using filter_fn and set counters proper=
ly
+ based on filter
+ """
+ def filter_ts( string ):
+ if string.lower().startswith( 't' ):
+ return None
+ return string
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
filter_fn=3Dfilter_ts )
+ self.assertCounters( provider, 3, 1, 1 )
+
+
+class Test_LimitedOffsetDataProvider( Test_FilteredDataProvider ):
+ provider_class =3D dataproviders.base.LimitedOffsetDataProvider
+
+ def test_offset_1( self ):
+ """when offset is 1, should skip first
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
offset=3D1 )
+ self.assertEqual( data, [ 'Two\n', 'Three\n' ] )
+ self.assertCounters( provider, 3, 3, 2 )
+
+ def test_offset_all( self ):
+ """when offset >=3D num lines, should return empty list
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
offset=3D4 )
+ self.assertEqual( data, [] )
+ self.assertCounters( provider, 3, 3, 0 )
+
+ def test_offset_none( self ):
+ """when offset is 0, should return all
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
offset=3D0 )
+ self.assertEqual( ''.join( data ), contents )
+ self.assertCounters( provider, 3, 3, 3 )
+
+ def test_offset_negative( self ):
+ """when offset is negative, should return all
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
offset=3D-1 )
+ self.assertEqual( ''.join( data ), contents )
+ self.assertCounters( provider, 3, 3, 3 )
+
+ def test_limit_1( self ):
+ """when limit is one, should return first
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
limit=3D1 )
+ self.assertEqual( data, [ 'One\n' ] )
+ #TODO: currently reads 2 in all counters before ending
+ #self.assertCounters( provider, 1, 1, 1 )
+
+ def test_limit_all( self ):
+ """when limit >=3D num lines, should return all
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
limit=3D4 )
+ self.assertEqual( ''.join( data ), contents )
+ self.assertCounters( provider, 3, 3, 3 )
+
+ def test_limit_zero( self ):
+ """when limit >=3D num lines, should return empty list
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
limit=3D0 )
+ self.assertEqual( data, [] )
+ #TODO: currently reads 1 before ending
+ self.assertCounters( provider, 3, 0, 0 )
+
+ def test_limit_zero( self ):
+ """when limit is None, should return all
+ """
+ ( contents, provider, data ) =3D self.contents_provider_and_data( =
limit=3DNone )
+ self.assertEqual( ''.join( data ), contents )
+ self.assertCounters( provider, 3, 3, 3 )
+
+ #TODO: somehow re-use tmpfile here
+ def test_limit_with_offset( self ):
+ def limit_offset_combo( limit, offset, data_should_be, read, valid=
, returned ):
+ ( contents, provider, data ) =3D self.contents_provider_and_da=
ta( limit=3Dlimit, offset=3Doffset )
+ self.assertEqual( data, data_should_be )
+ #self.assertCounters( provider, read, valid, returned )
+ test_data =3D [
+ ( 0, 0, [], 0, 0, 0 ),
+ ( 1, 0, [ 'One\n' ], 1, 1, 1 ),
+ ( 2, 0, [ 'One\n', 'Two\n' ], 2, 2, 2 ),
+ ( 3, 0, [ 'One\n', 'Two\n', 'Three\n' ], 3, 3, 3 ),
+ ( 1, 1, [ 'Two\n' ], 1, 1, 1 ),
+ ( 2, 1, [ 'Two\n', 'Three\n' ], 2, 2, 2 ),
+ ( 3, 1, [ 'Two\n', 'Three\n' ], 2, 2, 2 ),
+ ( 1, 2, [ 'Three\n' ], 1, 1, 1 ),
+ ( 2, 2, [ 'Three\n' ], 1, 1, 1 ),
+ ( 3, 2, [ 'Three\n' ], 1, 1, 1 ),
+ ]
+ for test in test_data:
+ log.debug( 'limit_offset_combo: %s', ', '.join([ str( e ) for =
e in test ]) )
+ limit_offset_combo( *test )
+
+ def test_limit_with_offset_and_filter( self ):
+ def limit_offset_combo( limit, offset, data_should_be, read, valid=
, returned ):
+ def only_ts( string ):
+ if not string.lower().startswith( 't' ):
+ return None
+ return string
+ ( contents, provider, data ) =3D self.contents_provider_and_da=
ta(
+ limit=3Dlimit, offset=3Doffset, filter_fn=3Donly_ts )
+ self.assertEqual( data, data_should_be )
+ #self.assertCounters( provider, read, valid, returned )
+ test_data =3D [
+ ( 0, 0, [], 0, 0, 0 ),
+ ( 1, 0, [ 'Two\n' ], 1, 1, 1 ),
+ ( 2, 0, [ 'Two\n', 'Three\n' ], 2, 2, 2 ),
+ ( 3, 0, [ 'Two\n', 'Three\n' ], 2, 2, 2 ),
+ ( 1, 1, [ 'Three\n' ], 1, 1, 1 ),
+ ( 2, 1, [ 'Three\n' ], 1, 1, 1 ),
+ ( 1, 2, [], 0, 0, 0 ),
+ ]
+ for test in test_data:
+ log.debug( 'limit_offset_combo: %s', ', '.join([ str( e ) for =
e in test ]) )
+ limit_offset_combo( *test )
+
+
+class Test_MultiSourceDataProvider( BaseTestCase ):
+ provider_class =3D dataproviders.base.MultiSourceDataProvider
+
+ def contents_and_tmpfile( self, contents=3DNone ):
+ #TODO: hmmmm...
+ contents =3D contents or self.default_file_contents
+ contents =3D utility.clean_multiline_string( contents )
+ return ( contents, self.tmpfiles.create_tmpfile( contents ) )
+
+ def test_multiple_sources( self ):
+ # clean the following contents, write them to tmpfiles, open them,
+ # and pass as a list to the provider
+ contents =3D [
+ """
+ One
+ Two
+ Three
+ Four
+ Five
+ """,
+ """
+ Six
+ Seven
+ Eight
+ Nine
+ Ten
+ """,
+ """
+ Eleven
+ Twelve! (<-- http://youtu.be/JZshZp-cxKg)
+ """
+ ]
+ contents =3D [ utility.clean_multiline_string( c ) for c in conten=
ts ]
+ source_list =3D [ open( self.tmpfiles.create_tmpfile( c ) ) for c =
in contents ]
+
+ provider =3D self.provider_class( source_list )
+ log.debug( 'provider: %s', provider )
+ data =3D list( provider )
+ log.debug( 'data: %s', str( data ) )
+ self.assertEqual( ''.join( data ), ''.join( contents) )
+
+ def test_multiple_compound_sources( self ):
+ # clean the following contents, write them to tmpfiles, open them,
+ # and pass as a list to the provider
+ contents =3D [
+ """
+ One
+ Two
+ Three
+ Four
+ Five
+ """,
+ """
+ Six
+ Seven
+ Eight
+ Nine
+ Ten
+ """,
+ """
+ Eleven
+ Twelve! (<-- http://youtu.be/JZshZp-cxKg)
+ """
+ ]
+ contents =3D [ utility.clean_multiline_string( c ) for c in conten=
ts ]
+ source_list =3D [ open( self.tmpfiles.create_tmpfile( c ) ) for c =
in contents ]
+
+ def no_Fs( string ):
+ return None if string.startswith( 'F' ) else string
+ def no_youtube( string ):
+ return None if ( 'youtu.be' in string ) else string
+ source_list =3D [
+ dataproviders.base.LimitedOffsetDataProvider( source_list[0], =
filter_fn=3Dno_Fs, limit=3D2, offset=3D1 ),
+ dataproviders.base.LimitedOffsetDataProvider( source_list[1], =
limit=3D1, offset=3D3 ),
+ dataproviders.base.FilteredDataProvider( source_list[2], filte=
r_fn=3Dno_youtube ),
+ ]
+ provider =3D self.provider_class( source_list )
+ log.debug( 'provider: %s', provider )
+ data =3D list( provider )
+ log.debug( 'data: %s', str( data ) )
+ self.assertEqual( ''.join( data ), 'Two\nThree\nNine\nEleven\n' )
+
+
+if __name__ =3D=3D '__main__':
+ unittest.main()
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c test/unit/datatypes/dataproviders/utility.py
--- /dev/null
+++ b/test/unit/datatypes/dataproviders/utility.py
@@ -0,0 +1,45 @@
+"""
+Unit test utilities.
+"""
+
+import os
+import sys
+import logging
+import textwrap
+
+def set_up_filelogger( logname, level=3Dlogging.DEBUG ):
+ """
+ Sets up logging to a file named `logname`
+ (removing it first if it already exists).
+
+ Usable with 'nosetests' to get logging msgs from failed tests
+ (no logfile created).
+ Usable with 'nosetests --nologcapture' to get logging msgs for all tes=
ts
+ (in logfile).
+ """
+ if os.path.exists( logname ): os.unlink( logname )
+ logging.basicConfig( filename=3Dlogname, level=3Dlogging.DEBUG )
+ return logging
+
+def add_galaxy_lib_to_path( this_dir_relative_to_root ):
+ """
+ Adds `<galaxy>/lib` to `sys.path` given the scripts directory relative
+ to `<galaxy>`.
+ .. example::
+ utility.add_galaxy_lib_to_path( '/test/unit/datatypes/dataprovider=
s' )
+ """
+ glx_lib =3D os.path.join( os.getcwd().replace( this_dir_relative_to_ro=
ot, '' ), 'lib' )
+ sys.path.append( glx_lib )
+
+def clean_multiline_string( multiline_string, sep=3D'\n' ):
+ """
+ Dedent, split, remove first and last empty lines, rejoin.
+ """
+ multiline_string =3D textwrap.dedent( multiline_string )
+ string_list =3D multiline_string.split( sep )
+ if not string_list[0]:
+ string_list =3D string_list[1:]
+ if not string_list[-1]:
+ string_list =3D string_list[:-1]
+ #return '\n'.join( docstrings )
+ return ''.join([ ( s + '\n' ) for s in string_list ])
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c test/unit/test_dataproviders.pyc
Binary file test/unit/test_dataproviders.pyc has changed
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c test/unit/test_tool_loader.pyc
Binary file test/unit/test_tool_loader.pyc has changed
diff -r a360e1b7b506450385be74b2c6b7762d3e794bbd -r 79ae7df72fba2e141791bdb=
8fdf2bb372fa3787c tools/ngs_rna/cuffdiff_wrapper.py
--- a/tools/ngs_rna/cuffdiff_wrapper.py
+++ /dev/null
@@ -1,241 +0,0 @@
-#!/usr/bin/env python
-
-# Wrapper supports Cuffdiff versions v1.3.0-v2.0
-
-import optparse, os, shutil, subprocess, sys, tempfile
-
-def group_callback( option, op_str, value, parser ):
- groups =3D []
- flist =3D []
- for arg in parser.rargs:
- arg =3D arg.strip()
- if arg[0] is "-":
- break
- elif arg[0] is ",":
- groups.append(flist)
- flist =3D []
- else:
- flist.append(arg)
- groups.append(flist)
-
- setattr(parser.values, option.dest, groups)
- =20
-def label_callback( option, op_str, value, parser ):
- labels =3D []
- for arg in parser.rargs:
- arg =3D arg.strip()
- if arg[0] is "-":
- break
- else:
- labels.append(arg)
-
- setattr(parser.values, option.dest, labels)
-
-def stop_err( msg ):
- sys.stderr.write( "%s\n" % msg )
- sys.exit()
- =20
-# Copied from sam_to_bam.py:
-def check_seq_file( dbkey, cached_seqs_pointer_file ):
- seq_path =3D ''
- for line in open( cached_seqs_pointer_file ):
- line =3D line.rstrip( '\r\n' )
- if line and not line.startswith( '#' ) and line.startswith( 'index=
' ):
- fields =3D line.split( '\t' )
- if len( fields ) < 3:
- continue
- if fields[1] =3D=3D dbkey:
- seq_path =3D fields[2].strip()
- break
- return seq_path
-
-def __main__():
- #Parse Command Line
- parser =3D optparse.OptionParser()
- =20
- # Cuffdiff options.
- parser.add_option( '-s', '--inner-dist-std-dev', dest=3D'inner_dist_st=
d_dev', help=3D'The standard deviation for the distribution on inner distan=
ces between mate pairs. The default is 20bp.' )
- parser.add_option( '-p', '--num-threads', dest=3D'num_threads', help=
=3D'Use this many threads to align reads. The default is 1.' )
- parser.add_option( '-m', '--inner-mean-dist', dest=3D'inner_mean_dist'=
, help=3D'This is the expected (mean) inner distance between mate pairs. \
- =
For, example, for paired end runs with fragments selected at 300bp, \
- =
where each end is 50bp, you should set -r to be 200. The default is 4=
5bp.')
- parser.add_option( '-c', '--min-alignment-count', dest=3D'min_alignmen=
t_count', help=3D'The minimum number of alignments in a locus for needed to=
conduct significance testing on changes in that locus observed between sam=
ples. If no testing is performed, changes in the locus are deemed not signf=
icant, and the locus\' observed changes don\'t contribute to correction for=
multiple testing. The default is 1,000 fragment alignments (up to 2,000 pa=
ired reads).' )
- parser.add_option( '--FDR', dest=3D'FDR', help=3D'The allowed false di=
scovery rate. The default is 0.05.' )
- parser.add_option( '-u', '--multi-read-correct', dest=3D'multi_read_co=
rrect', action=3D"store_true", help=3D'Tells Cufflinks to do an initial est=
imation procedure to more accurately weight reads mapping to multiple locat=
ions in the genome')
- parser.add_option( '--library-norm-method', dest=3D'library_norm_metho=
d' )
- parser.add_option( '--dispersion-method', dest=3D'dispersion_method' )
-
- # Advanced Options:=09
- parser.add_option( '--num-importance-samples', dest=3D'num_importance_=
samples', help=3D'Sets the number of importance samples generated for each =
locus during abundance estimation. Default: 1000' )
- parser.add_option( '--max-mle-iterations', dest=3D'max_mle_iterations'=
, help=3D'Sets the number of iterations allowed during maximum likelihood e=
stimation of abundances. Default: 5000' )
- =20
- # Wrapper / Galaxy options.
- parser.add_option( '-f', '--files', dest=3D'groups', action=3D"callbac=
k", callback=3Dgroup_callback, help=3D"Groups to be processed, groups are s=
eparated by spaces, replicates in a group comma separated. group1_rep1,grou=
p1_rep2 group2_rep1,group2_rep2, ..., groupN_rep1, groupN_rep2" )
- parser.add_option( '-A', '--inputA', dest=3D'inputA', help=3D'A transc=
ript GTF file produced by cufflinks, cuffcompare, or other source.')
- parser.add_option( '-1', '--input1', dest=3D'input1', help=3D'File of =
RNA-Seq read alignments in the SAM format. SAM is a standard short read ali=
gnment, that allows aligners to attach custom tags to individual alignments=
, and Cufflinks requires that the alignments you supply have some of these =
tags. Please see Input formats for more details.' )
- parser.add_option( '-2', '--input2', dest=3D'input2', help=3D'File of =
RNA-Seq read alignments in the SAM format. SAM is a standard short read ali=
gnment, that allows aligners to attach custom tags to individual alignments=
, and Cufflinks requires that the alignments you supply have some of these =
tags. Please see Input formats for more details.' )
-
- # Label options
- parser.add_option('-L', '--labels', dest=3D'labels', action=3D"callbac=
k", callback=3Dlabel_callback, help=3D"Labels for the groups the replicates=
are in.")
- =20
- # Normalization options.
- parser.add_option( "-N", "--quartile-normalization", dest=3D"do_normal=
ization", action=3D"store_true" )
-
- # Bias correction options.
- parser.add_option( '-b', dest=3D'do_bias_correction', action=3D"store_=
true", help=3D'Providing Cufflinks with a multifasta file via this option i=
nstructs it to run our new bias detection and correction algorithm which ca=
n significantly improve accuracy of transcript abundance estimates.')
- parser.add_option( '', '--dbkey', dest=3D'dbkey', help=3D'The build of=
the reference dataset' )
- parser.add_option( '', '--index_dir', dest=3D'index_dir', help=3D'GALA=
XY_DATA_INDEX_DIR' )
- parser.add_option( '', '--ref_file', dest=3D'ref_file', help=3D'The re=
ference dataset from the history' )
-
- # Outputs.
- parser.add_option( "--isoforms_fpkm_tracking_output", dest=3D"isoforms=
_fpkm_tracking_output" )
- parser.add_option( "--genes_fpkm_tracking_output", dest=3D"genes_fpkm_=
tracking_output" )
- parser.add_option( "--cds_fpkm_tracking_output", dest=3D"cds_fpkm_trac=
king_output" )
- parser.add_option( "--tss_groups_fpkm_tracking_output", dest=3D"tss_gr=
oups_fpkm_tracking_output" )
- parser.add_option( "--isoforms_exp_output", dest=3D"isoforms_exp_outpu=
t" )
- parser.add_option( "--genes_exp_output", dest=3D"genes_exp_output" )
- parser.add_option( "--tss_groups_exp_output", dest=3D"tss_groups_exp_o=
utput" )
- parser.add_option( "--cds_exp_fpkm_tracking_output", dest=3D"cds_exp_f=
pkm_tracking_output" )
- parser.add_option( "--splicing_diff_output", dest=3D"splicing_diff_out=
put" )
- parser.add_option( "--cds_diff_output", dest=3D"cds_diff_output" )
- parser.add_option( "--promoters_diff_output", dest=3D"promoters_diff_o=
utput" )
- =20
- (options, args) =3D parser.parse_args()
- =20
- # output version # of tool
- try:
- tmp =3D tempfile.NamedTemporaryFile().name
- tmp_stdout =3D open( tmp, 'wb' )
- proc =3D subprocess.Popen( args=3D'cuffdiff --no-update-check 2>&1=
', shell=3DTrue, stdout=3Dtmp_stdout )
- tmp_stdout.close()
- returncode =3D proc.wait()
- stdout =3D None
- for line in open( tmp_stdout.name, 'rb' ):
- if line.lower().find( 'cuffdiff v' ) >=3D 0:
- stdout =3D line.strip()
- break
- if stdout:
- sys.stdout.write( '%s\n' % stdout )
- else:
- raise Exception
- except:
- sys.stdout.write( 'Could not determine Cuffdiff version\n' )
- =20
- # If doing bias correction, set/link to sequence file.
- if options.do_bias_correction:
- if options.ref_file !=3D 'None':
- # Sequence data from history.
- # Create symbolic link to ref_file so that index will be creat=
ed in working directory.
- seq_path =3D "ref.fa"
- os.symlink( options.ref_file, seq_path )
- else:
- # Sequence data from loc file.
- cached_seqs_pointer_file =3D os.path.join( options.index_dir, =
'sam_fa_indices.loc' )
- if not os.path.exists( cached_seqs_pointer_file ):
- stop_err( 'The required file (%s) does not exist.' % cache=
d_seqs_pointer_file )
- # If found for the dbkey, seq_path will look something like /g=
alaxy/data/equCab2/sam_index/equCab2.fa,
- # and the equCab2.fa file will contain fasta sequences.
- seq_path =3D check_seq_file( options.dbkey, cached_seqs_pointe=
r_file )
- if seq_path =3D=3D '':
- stop_err( 'No sequence data found for dbkey %s, so bias co=
rrection cannot be used.' % options.dbkey ) =20
- =20
- # Build command.
- =20
- # Base; always use quiet mode to avoid problems with storing log outpu=
t.
- cmd =3D "cuffdiff --no-update-check -q"
- =20
- # Add options.
- if options.library_norm_method:
- cmd +=3D ( " --library-norm-method %s" % options.library_norm_meth=
od )
- if options.dispersion_method:
- cmd +=3D ( " --dispersion-method %s" % options.dispersion_method )
- if options.inner_dist_std_dev:
- cmd +=3D ( " -s %i" % int ( options.inner_dist_std_dev ) )
- if options.num_threads:
- cmd +=3D ( " -p %i" % int ( options.num_threads ) )
- if options.inner_mean_dist:
- cmd +=3D ( " -m %i" % int ( options.inner_mean_dist ) )
- if options.min_alignment_count:
- cmd +=3D ( " -c %i" % int ( options.min_alignment_count ) )
- if options.FDR:
- cmd +=3D ( " --FDR %f" % float( options.FDR ) )
- if options.multi_read_correct:
- cmd +=3D ( " -u" )
- if options.num_importance_samples:
- cmd +=3D ( " --num-importance-samples %i" % int ( options.num_impo=
rtance_samples ) )
- if options.max_mle_iterations:
- cmd +=3D ( " --max-mle-iterations %i" % int ( options.max_mle_iter=
ations ) )
- if options.do_normalization:
- cmd +=3D ( " -N" )
- if options.do_bias_correction:
- cmd +=3D ( " -b %s" % seq_path )
- =20
- # Add inputs.
- # For replicate analysis: group1_rep1,group1_rep2 groupN_rep1,groupN_r=
ep2
- if options.groups:
- cmd +=3D " --labels "
- for label in options.labels:
- cmd +=3D '"%s",' % label
- cmd =3D cmd[:-1]
-
- cmd +=3D " " + options.inputA + " "
-
- for group in options.groups:
- for filename in group:
- cmd +=3D filename + ","
- cmd =3D cmd[:-1] + " "
- else:=20
- cmd +=3D " " + options.inputA + " " + options.input1 + " " + optio=
ns.input2
- =20
- # Debugging.
- print cmd
-
- # Run command.
- try:
- tmp_name =3D tempfile.NamedTemporaryFile().name
- tmp_stderr =3D open( tmp_name, 'wb' )
- proc =3D subprocess.Popen( args=3Dcmd, shell=3DTrue, stderr=3Dtmp_=
stderr.fileno() )
- returncode =3D proc.wait()
- tmp_stderr.close()
- =20
- # Get stderr, allowing for case where it's very large.
- tmp_stderr =3D open( tmp_name, 'rb' )
- stderr =3D ''
- buffsize =3D 1048576
- try:
- while True:
- stderr +=3D tmp_stderr.read( buffsize )
- if not stderr or len( stderr ) % buffsize !=3D 0:
- break
- except OverflowError:
- pass
- tmp_stderr.close()
- =20
- # Error checking.
- if returncode !=3D 0:
- raise Exception, stderr
- =20
- # check that there are results in the output file
- if len( open( "isoforms.fpkm_tracking", 'rb' ).read().strip() ) =
=3D=3D 0:
- raise Exception, 'The main output file is empty, there may be =
an error with your input file or settings.'
- except Exception, e:
- stop_err( 'Error running cuffdiff. ' + str( e ) )
-
- =20
- # Copy output files to specified files.
- try:
- shutil.copyfile( "isoforms.fpkm_tracking", options.isoforms_fpkm_t=
racking_output )
- shutil.copyfile( "genes.fpkm_tracking", options.genes_fpkm_trackin=
g_output )
- shutil.copyfile( "cds.fpkm_tracking", options.cds_fpkm_tracking_ou=
tput )
- shutil.copyfile( "tss_groups.fpkm_tracking", options.tss_groups_fp=
km_tracking_output )
- shutil.copyfile( "isoform_exp.diff", options.isoforms_exp_output )
- shutil.copyfile( "gene_exp.diff", options.genes_exp_output )
- shutil.copyfile( "tss_group_exp.diff", options.tss_groups_exp_outp=
ut )
- shutil.copyfile( "splicing.diff", options.splicing_diff_output )
- shutil.copyfile( "cds.diff", options.cds_diff_output )
- shutil.copyfile( "cds_exp.diff", options.cds_exp_fpkm_tracking_out=
put )
- shutil.copyfile( "promoters.diff", options.promoters_diff_output )=
=20
- except Exception, e:
- stop_err( 'Error in cuffdiff:\n' + str( e ) )
-
-if __name__=3D=3D"__main__": __main__()
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/galaxy/galaxy-central/commits/40c9834811eb/
Changeset: 40c9834811eb
User: saketkc
Date: 2013-08-06 09:31:21
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r cf53a00bcf1d279072ec279e6531f211992b4f3e -r 40c9834811ebfbefb423155=
3c922ff4c44905c63 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/d33f8c5396a8/
Changeset: d33f8c5396a8
User: saketkc
Date: 2013-08-07 15:21:51
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r f33c054d6d5b75ae545248d71ec559d74b4fa636 -r d33f8c5396a8825b450432a=
8c443e1592a360885 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/a968c0cae563/
Changeset: a968c0cae563
User: saketkc
Date: 2013-08-28 19:15:32
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 22a4f03c1fe40dedcb7e6f11510d58ada8e9c458 -r a968c0cae5639f3be5ffdd9=
31df909c215f43a43 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/4c1eb0c91fc6/
Changeset: 4c1eb0c91fc6
User: saketkc
Date: 2013-08-31 18:30:53
Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central
Affected #: 1 file
diff -r 0470feeb593f9797fa9fd19dfdac4751a7ca788b -r 4c1eb0c91fc6e3085948ef1=
6eb88d18ea626e7d3 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
https://bitbucket.org/galaxy/galaxy-central/commits/dcd9809d0239/
Changeset: dcd9809d0239
User: jgoecks
Date: 2013-09-11 18:16:14
Summary: Merged in saketkc/galaxy-central (pull request #184)
VCFTools Incompatible with VCF4.1
Affected #: 1 file
diff -r 228f1b4066be9fc49f6f07ff6867566836134c67 -r dcd9809d0239c7dc80cec3b=
2a01d7bded4a8c088 tools/vcf_tools/vcfClass.py
--- a/tools/vcf_tools/vcfClass.py
+++ b/tools/vcf_tools/vcfClass.py
@@ -12,12 +12,13 @@
self.hasHeader =3D True
self.headerText =3D ""
self.headerTitles =3D ""
+ self.vcfFormat =3D ""
#self.headerInfoText =3D ""
#self.headerFormatText =3D ""
=20
# Store the info and format tags as well as the lines that describe
# them in a dictionary.
- self.numberDataSets =3D 0=20
+ self.numberDataSets =3D 0
self.includedDataSets =3D {}
self.infoHeaderTags =3D {}
self.infoHeaderString =3D {}
@@ -63,6 +64,7 @@
# Determine the type of information in the header line.
def getHeaderLine(self, filename, writeOut):
self.headerLine =3D self.filehandle.readline().rstrip("\n")
+ if self.headerLine.startswith("##fileformat"): success =3D self.getvcf=
Format()
if self.headerLine.startswith("##INFO"): success =3D self.headerInfo(w=
riteOut, "info")
elif self.headerLine.startswith("##FORMAT"): success =3D self.headerIn=
fo(writeOut, "format")
elif self.headerLine.startswith("##FILE"): success =3D self.headerFile=
s(writeOut)
@@ -72,6 +74,18 @@
=20
return success
=20
+# Read VCF format
+ def getvcfFormat(self):
+ try:
+ self.vcfFormat =3D self.headerLine.split("=3D",1)[1]
+ self.vcfFormat =3D float( self.vcfFormat.split("VCFv",1)[1] )## =
Extract the version number rather than the whole string
+ except IndexError:
+ print >> sys.stderr, "\nError parsing the fileformat"
+ print >> sys.stderr, "The following fileformat header is wrongly=
formatted: ", self.headerLine
+ exit(1)
+ return True
+
+
# Read information on an info field from the header line.
def headerInfo(self, writeOut, lineType):
tag =3D self.headerLine.split("=3D",1)
@@ -93,11 +107,15 @@
# an integer or a '.' to indicate variable number of entries.
if tagNumber =3D=3D ".": tagNumber =3D "variable"
else:
- try: tagNumber =3D int(tagNumber)
- except ValueError:
- print >> sys.stderr, "\nError parsing header. Problem with info t=
ag:", tagID
- print >> sys.stderr, "Number of fields associated with this tag is=
not an integer or '.'"
- exit(1)
+ if self.vcfFormat<4.1:
+
+ try:
+ tagNumber =3D int(tagNumber)
+
+ except ValueError:
+ print >> sys.stderr, "\nError parsing header. Problem with in=
fo tag:", tagID
+ print >> sys.stderr, "Number of fields associated with this ta=
g is not an integer or '.'"
+ exit(1)
=20
if lineType =3D=3D "info":
self.infoHeaderTags[tagID] =3D tagNumber, tagType, tagDescription
@@ -161,7 +179,7 @@
return False
=20
# If there is no header in the vcf file, close and reopen the
-# file so that the first line is avaiable for parsing as a=20
+# file so that the first line is avaiable for parsing as a
# vcf record.
def noHeader(self, filename, writeOut):
if writeOut: print >> sys.stdout, "No header lines present in", filena=
me
@@ -216,7 +234,7 @@
else: self.hasGenotypes =3D False
=20
# Add the reference sequence to the dictionary. If it didn't previously
-# exist append the reference sequence to the end of the list as well.=20
+# exist append the reference sequence to the end of the list as well.
# This ensures that the order in which the reference sequences appeared
# in the header can be preserved.
if self.referenceSequence not in self.referenceSequences:
@@ -274,7 +292,7 @@
# Check that there are as many fields as in the format field. If not, thi=
s must
# be because the information is not known. In this case, it is permitted =
that
# the genotype information is either . or ./.
- if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):=20
+ if genotypeInfo[0] =3D=3D "./." or genotypeInfo[0] =3D=3D "." and le=
n(self.genotypeFormats) !=3D len(genotypeInfo):
self.genotypeFields[ self.samplesList[i] ] =3D "."
else:
if len(self.genotypeFormats) !=3D len(genotypeInfo):
@@ -381,7 +399,7 @@
=20
# First check that the variant class (VC) is listed as SNP.
vc =3D self.info.split("VC=3D",1)
- if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)=20
+ if vc[1].find(";") !=3D -1: snp =3D vc[1].split(";",1)
else:
snp =3D []
snp.append(vc[1])
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