From ca1acf43def461864e34e3c36ee571bbd8457290 Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 09:42:05 +0100 Subject: [PATCH 1/9] typo --- hicbrowser/runBrowser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hicbrowser/runBrowser.py b/hicbrowser/runBrowser.py index 721ba56..a6fee90 100644 --- a/hicbrowser/runBrowser.py +++ b/hicbrowser/runBrowser.py @@ -22,7 +22,7 @@ def parse_arguments(args=None): parser.add_argument('--htmlFolder', help='File where the template index.html file is located. The default is' - 'fine unless the contents wants to be personalized. The full path ' + ' fine unless the contents wants to be personalized. The full path ' 'has to be given.', default=None) From 022aa992423548edbbbf6181ef26363278c1fb94 Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 10:45:12 +0100 Subject: [PATCH 2/9] use pgt instead of hicexplorer in the browser part --- hicbrowser/client/js/templates.js | 2 +- hicbrowser/client/templates/index.hbs | 2 +- hicbrowser/static/js/App.js | 2 +- hicbrowser/static/js/App.min.js | 2 +- hicbrowser/tracks2json.py | 11 ++-- hicbrowser/views.py | 80 ++++++++------------------- setup.py | 2 +- 7 files changed, 33 insertions(+), 68 deletions(-) diff --git a/hicbrowser/client/js/templates.js b/hicbrowser/client/js/templates.js index c9dbf78..b728f4d 100644 --- a/hicbrowser/client/js/templates.js +++ b/hicbrowser/client/js/templates.js @@ -57,7 +57,7 @@ this["Templates"]["gene"] = Handlebars.template({"1":function(container,depth0,h },"useData":true}); this["Templates"]["index"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { - return "
\n
\n
\n

HiCBrowser is a simple web browser to visualize Hi-C and other genomic tracks. \n

It is based on HiCExplorer, a set of programs that enable you to process, normalize, analyze and visualize Hi-C data.

\n
\n
\n \n \"\"\n \n
\n
\n
\n
\n"; + return "
\n
\n
\n

HiCBrowser is a simple web browser to visualize Hi-C and other genomic tracks. \n

It is based on pyGenomeTracks, a program and library to plot beautiful genome browser tracks.

\n
\n
\n \n \"\"\n \n
\n
\n
\n
\n"; },"useData":true}); this["Templates"]["loading"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { diff --git a/hicbrowser/client/templates/index.hbs b/hicbrowser/client/templates/index.hbs index c830842..554bb89 100644 --- a/hicbrowser/client/templates/index.hbs +++ b/hicbrowser/client/templates/index.hbs @@ -2,7 +2,7 @@

HiCBrowser is a simple web browser to visualize Hi-C and other genomic tracks. -

It is based on HiCExplorer, a set of programs that enable you to process, normalize, analyze and visualize Hi-C data.

+

It is based on pyGenomeTracks, a program and library to plot beautiful genome browser tracks.

diff --git a/hicbrowser/static/js/App.js b/hicbrowser/static/js/App.js index 4a40052..314d7d1 100644 --- a/hicbrowser/static/js/App.js +++ b/hicbrowser/static/js/App.js @@ -275,7 +275,7 @@ this["Templates"]["gene"] = Handlebars.template({"1":function(container,depth0,h },"useData":true}); this["Templates"]["index"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { - return "
\n
\n
\n

HiCBrowser is a simple web browser to visualize Hi-C and other genomic tracks. \n

It is based on HiCExplorer, a set of programs that enable you to process, normalize, analyze and visualize Hi-C data.

\n
\n
\n \n \"\"\n \n
\n
\n
\n
\n"; + return "
\n
\n
\n

HiCBrowser is a simple web browser to visualize Hi-C and other genomic tracks. \n

It is based on pyGenomeTracks, a program and library to plot beautiful genome browser tracks.

\n
\n
\n \n \"\"\n \n
\n
\n
\n
\n"; },"useData":true}); this["Templates"]["loading"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { diff --git a/hicbrowser/static/js/App.min.js b/hicbrowser/static/js/App.min.js index 771565e..ec5cb46 100644 --- a/hicbrowser/static/js/App.min.js +++ b/hicbrowser/static/js/App.min.js @@ -1,4 +1,4 @@ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g did not match any gene. Check the browser for examples of valid gene names as they may be an id.";App.views.search.renderError(e),d()}})}),j.on("route:getBrowser",function(){return g.isUndefined(i.browser)?(App.views.search.showBrowserView(),void d()):(App.router.navigate("/browser/"+i.browser.id,{trigger:!1}),void f(i.browser))}),j.on("route:getBrowserId",function(a){if(!g.isUndefined(i.browser)&&i.browser.id===a)return void f(i.browser);var b=new App.models.Browser({id:a}),c="Your search - "+a+" - did not match any region.";b.fetch({success:function(a){a=a.toJSON();var b=g.flatten(a.tracks);0===b.length?(App.views.search.renderError(c),d()):$.ajax({url:b[0],success:function(){i.browser=a,f(a)},error:function(){App.views.search.renderError(c),d()}})},error:function(a,b){App.views.search.renderError(c),d()}})}),j.on("route:defaultRoute",d),Backbone.history.start(),b.exports=j},{underscore:82}],6:[function(a,b,c){(function(d){var e="undefined"==typeof window?d:window,f=e.Handlebars||a("handlebars");this.Templates=this.Templates||{},this.Templates.browser=f.template({1:function(a,b,c,d,e){var f=a.lambda,g=a.escapeExpression;return'
\n \n \n
\n'},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f;return'
\n
\n'+(null!=(f=c.each.call(null!=b?b:{},null!=b?b.tracks:b,{name:"each",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:"")+"
\n
\n"},useData:!0}),this.Templates.gene=f.template({1:function(a,b,c,d,e){var f,g=null!=b?b:{},h=c.helperMissing,i="function",j=a.escapeExpression;return'

\n '+j((f=null!=(f=c.name||(null!=b?b.name:b))?f:h,typeof f===i?f.call(g,{name:"name",hash:{},data:e}):f))+"\n \n chromosome "+j((f=null!=(f=c.chromosome||(null!=b?b.chromosome:b))?f:h,typeof f===i?f.call(g,{name:"chromosome",hash:{},data:e}):f))+" (start: "+j((f=null!=(f=c.start||(null!=b?b.start:b))?f:h,typeof f===i?f.call(g,{name:"start",hash:{},data:e}):f))+", end: "+j((f=null!=(f=c.end||(null!=b?b.end:b))?f:h,typeof f===i?f.call(g,{name:"end",hash:{},data:e}):f))+')\n \n

\n
\n\n \n'},3:function(a,b,c,d,e){var f;return'
\n \n
\n"},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g=null!=b?b:{};return'
\n\n'+(null!=(f=c["if"].call(g,null!=b?b.name:b,{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:"")+"\n"+(null!=(f=c["if"].call(g,null!=b?b.error:b,{name:"if",hash:{},fn:a.program(3,e,0),inverse:a.noop,data:e}))?f:"")+"
\n
\n"},useData:!0}),this.Templates.index=f.template({compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){return'
\n
\n
\n

HiCBrowser is a simple web browser to visualize Hi-C and other genomic tracks. \n

It is based on HiCExplorer, a set of programs that enable you to process, normalize, analyze and visualize Hi-C data.

\n
\n
\n \n \n \n
\n
\n
\n
\n'},useData:!0}),this.Templates.loading=f.template({compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f;return''},useData:!0}),this.Templates.search=f.template({1:function(a,b,c,d,e){var f;return' example\n'},3:function(a,b,c,d,e){var f;return' example\n'},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g,h=null!=b?b:{},i=c.helperMissing,j="function",k=a.escapeExpression;return'\n\n
\n\n
\n\n
\n
\n \n \n \n \n
\n\n'+(null!=(f=c["if"].call(h,null!=b?b.gene_example:b,{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:"")+'
\n\n
\n
\n \n \n \n \n
\n\n'+(null!=(f=c["if"].call(h,null!=b?b.browser_example:b,{name:"if",hash:{},fn:a.program(3,e,0),inverse:a.noop,data:e}))?f:"")+'
\n\n
\n
\n\n
\n \n \n \n \n \n \n \n \n \n
\n\n
\n
\n
\n\n
\n\n
\n
\n'},useData:!0}),"object"==typeof c&&c&&(b.exports=this.Templates)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{handlebars:65}],7:[function(a,b,c){function d(a,b){b||(b=window.location.href),a=a.replace(/[\[\]]/g,"\\$&");var c=new RegExp("[?&]"+a+"(=([^&#]*)|&|#|$)","i"),d=c.exec(b);return d?d[2]?decodeURIComponent(d[2].replace(/\+/g," ")):"":null}function e(a){var b=a.target,c=b.parentNode;c.className+=c.className?" loaded":"loaded"}function f(a){var b=a.target;b.src="/static/img/not_found.png";var c=b.parentNode;c.className+=c.className?" loaded":"loaded"}function g(a,b,c){for(var d=c||0,h=0;d
").hide().append(b),$(this.el).append(h),g(document.getElementsByTagName("img"),6)}},setVisible:function(){h.show().siblings().hide(),$(this.el).css({opacity:0,visibility:"visible"}).animate({opacity:1},800)}})},{"../templates":6,underscore:82}],8:[function(a,b,c){function d(a){var b=a.toString(16);return 1==b.length?"0"+b:b}function e(a,b,c){return"#"+d(a)+d(b)+d(c)}function f(a){var b={};return b.tracks=h.compact(h.map(a.tracks,function(a,c){var d;return"boundaries"===a.file_type?(b.extent=i.extent(a.x_values),d=h.map(a.x_values,function(b,c){return{x:b,y:a.y_values[c]}}),{type:"line",name:a.section_name,className:"tads",color:"#008B8D",height:"5",data:d,interpolation:"linear"}):"bed"===a.file_type?(d=h.map(a.intervals,function(b,c){var d={x:b.bed[1],y:b.bed[2]};return"genes"===a.title&&(d.description=b.bed[3]),h.isArray(b.bed[8])&&(d.color=e.apply(null,b.bed[8])),d}),{type:"rect",name:a.title,data:d,color:"steelblue"}):void 0})),b}var g,h=a("underscore"),i=a("d3"),j=a("feature-viewer"),k=a("../templates"),l={},m=h.uniqueId("feat_viewer_");b.exports=Backbone.View.extend({initialize:function(a){this.options=a},render:function(a){if(a=h.isUndefined(a)?{}:a,a.feature_viewer=m,a.id!==l.id){$(this.el).css({opacity:0,visibility:"hidden"});var b=k.gene(a);h.isUndefined(g)||g.remove(),g=$("
").hide().append(b),$(this.el).append(g),this.renderViewer(a.tracks),$('[data-toggle="tooltip"]').tooltip()}},setVisible:function(){g.show().siblings().hide(),$(this.el).css({opacity:0,visibility:"visible"}).animate({opacity:1},800)},renderViewer:function(a){data=f(a);var b=new j(data.extent[1],"#"+m,{showAxis:!1,showSequence:!1,brushActive:!0,toolbar:!1,bubbleHelp:!1,zoomMax:10,offset:{start:data.extent[0],end:data.extent[1]}});h.each(data.tracks,b.addFeature)}})},{"../templates":6,d3:31,"feature-viewer":32,underscore:82}],9:[function(a,b,c){var d,e=a("underscore"),f=a("../templates");b.exports=Backbone.View.extend({initialize:function(a){this.options=a},render:function(a){a=e.isUndefined(a)?{}:a,$(this.el).css({opacity:0,visibility:"hidden"});var b=f.index(a);d=$("
").hide().append(b),$(this.el).empty().append(d),this.rendered=!0},rendered:!1,setVisible:function(){d.show().siblings().hide(),$(this.el).css({opacity:0,visibility:"visible"}).animate({opacity:1},800)}})},{"../templates":6,underscore:82}],10:[function(a,b,c){var d=a("underscore"),e=a("../templates"),f=d.uniqueId("loading_");b.exports=Backbone.View.extend({initialize:function(a){this.options=a},render:function(a){a=d.isUndefined(a)?{}:a,a.id=f;var b=e.loading(a);$(this.options.el).append(b)},show:function(){$("#"+f).modal({show:!0,backdrop:"static",keyboard:!1})},hide:function(){$("#"+f).modal("hide")}})},{"../templates":6,underscore:82}],11:[function(a,b,c){var d,e=a("underscore"),f=a("../templates"),g=e.uniqueId("prev_id_"),h=e.uniqueId("next_id_"),i=e.uniqueId("zoomout_id_"),j=e.uniqueId("search_input_"),k=e.uniqueId("search_input_"),l=(e.uniqueId("search_btn_"),e.uniqueId("gene_btn_")),m=e.uniqueId("browser_btn_"),n=e.uniqueId("gene_example_"),o=e.uniqueId("browser_example_"),p=!0;b.exports=Backbone.View.extend({initialize:function(a){this.options=a},events:{"click li":"onLiClick","click button":"search","keydown input":"keyAction","click a":"linkClick"},render:function(a){a=e.isUndefined(a)?{}:a.attributes,a.prev_id=g,a.next_id=h,a.zoomout_id=i,a.gene_search_input=k,a.browser_search_input=j,a.gene_btn=l,a.browser_btn=m,a.browser_example_id=o,a.gene_example_id=n;var b=f.search(a);$(this.options.el).html(b)},renderError:function(a){$("#error").html(a).show()},update:function(a){e.isUndefined(a.name)?onGeneButton():(onBrowserButton(),updateButtons(a))},search:function(){var a=p?$("#"+k).val():$("#"+j).val();if($("#error").hide(),a.length>0){var b=p?"/gene/"+a:"/browser/"+a;App.router.navigate(b,{trigger:!0})}},onLiClick:function(a){a.preventDefault();var b=$(a.currentTarget).data("id");b===l?(p=!0,this.showGeneView(),App.router.navigate("/gene",{trigger:!0,replace:!0})):b===m&&(p=!1,this.showBrowserView(),App.router.navigate("/browser",{trigger:!0,replace:!0}))},linkClick:function(a){a.preventDefault();var b=$(a.currentTarget).data("id");b===n?App.router.navigate("/gene/"+App.config.attributes.gene_example,{trigger:!0}):b===o?App.router.navigate("/browser/"+App.config.attributes.browser_example,{trigger:!0}):e.isUndefined(d)||(b===g?App.router.navigate("/browser/"+d.previous,{trigger:!0}):b===h?App.router.navigate("/browser/"+d.next,{trigger:!0}):b===i&&App.router.navigate("/browser/"+d.out,{trigger:!0}))},keyAction:function(a){13===a.which&&this.search()},showGeneView:function(a){e.isUndefined(a)||$("#"+k).val(a),$("#"+m).removeClass("active"),$("#"+l).addClass("active"),$("#"+j).parent().parent().css({opacity:0,display:"none"}),$("#"+k).parent().parent().css({opacity:0,display:"block"}).animate({opacity:1},800)},showBrowserView:function(a){d=a,e.isUndefined(a)||$("#"+j).val(a.id),$("#"+l).removeClass("active"),$("#"+m).addClass("active"),$("#"+k).parent().parent().css({opacity:0,display:"none"}),$("#"+j).parent().parent().css({opacity:0,display:"block"}).animate({opacity:1},800)}})},{"../templates":6,underscore:82}],12:[function(a,b,c){(function(c,d){"use strict";function e(b,e){function f(a){var b,c;for(b=0;a[b];b+=1)if(c=a[b],"."===c)a.splice(b,1),b-=1;else if(".."===c){if(1===b&&(".."===a[2]||".."===a[0]))break;b>0&&(a.splice(b-1,2),b-=2)}}function g(a,b){var c;return a&&"."===a.charAt(0)&&b&&(c=b.split("/"),c=c.slice(0,c.length-1),c=c.concat(a.split("/")),f(c),a=c.join("/")),a}function h(a){return function(b){return g(b,a)}}function i(a){function b(b){o[a]=b}return b.fromText=function(a,b){throw new Error("amdefine does not implement load.fromText")},b}function j(a,c,f){var g,h,i,j;if(a)h=o[a]={},i={id:a,uri:d,exports:h},g=l(e,h,i,a);else{if(p)throw new Error("amdefine with no module ID cannot be called more than once per file.");p=!0,h=b.exports,i=b,g=l(e,h,i,b.id)}c&&(c=c.map(function(a){return g(a)})),j="function"==typeof f?f.apply(i.exports,c):f,void 0!==j&&(i.exports=j,a&&(o[a]=i.exports))}function k(a,b,c){Array.isArray(a)?(c=b,b=a,a=void 0):"string"!=typeof a&&(c=a,a=b=void 0),b&&!Array.isArray(b)&&(c=b,b=void 0),b||(b=["require","exports","module"]),a?n[a]=[a,b,c]:j(a,b,c)}var l,m,n={},o={},p=!1,q=a("path");return l=function(a,b,d,e){function f(f,g){return"string"==typeof f?m(a,b,d,f,e):(f=f.map(function(c){return m(a,b,d,c,e)}),void(g&&c.nextTick(function(){g.apply(null,f)})))}return f.toUrl=function(a){return 0===a.indexOf(".")?g(a,q.dirname(d.filename)):a},f},e=e||function(){return b.require.apply(b,arguments)},m=function(a,b,c,d,e){var f,k,p=d.indexOf("!"),q=d;if(p===-1){if(d=g(d,e),"require"===d)return l(a,b,c,e);if("exports"===d)return b;if("module"===d)return c;if(o.hasOwnProperty(d))return o[d];if(n[d])return j.apply(null,n[d]),o[d];if(a)return a(q);throw new Error("No module with ID: "+d)}return f=d.substring(0,p),d=d.substring(p+1,d.length),k=m(a,b,c,f,e),d=k.normalize?k.normalize(d,h(e)):g(d,e),o[d]?o[d]:(k.load(d,l(a,b,c,e),i(d),{}),o[d])},k.require=function(a){return o[a]?o[a]:n[a]?(j.apply(null,n[a]),o[a]):void 0},k.amd={},k}b.exports=e}).call(this,a("_process"),"/node_modules/amdefine/amdefine.js")},{_process:81,path:80}],13:[function(a,b,c){!function(){function a(){return{keys:Object.keys||function(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("keys() called on a non-object");var b,c=[];for(b in a)a.hasOwnProperty(b)&&(c[c.length]=b);return c},uniqueId:function(a){var b=++i+"";return a?a+b:b},has:function(a,b){return g.call(a,b)},each:function(a,b,c){if(null!=a)if(f&&a.forEach===f)a.forEach(b,c);else if(a.length===+a.length)for(var d=0,e=a.length;d did not match any gene. Check the browser for examples of valid gene names as they may be an id.";App.views.search.renderError(e),d()}})}),j.on("route:getBrowser",function(){return g.isUndefined(i.browser)?(App.views.search.showBrowserView(),void d()):(App.router.navigate("/browser/"+i.browser.id,{trigger:!1}),void f(i.browser))}),j.on("route:getBrowserId",function(a){if(!g.isUndefined(i.browser)&&i.browser.id===a)return void f(i.browser);var b=new App.models.Browser({id:a}),c="Your search - "+a+" - did not match any region.";b.fetch({success:function(a){a=a.toJSON();var b=g.flatten(a.tracks);0===b.length?(App.views.search.renderError(c),d()):$.ajax({url:b[0],success:function(){i.browser=a,f(a)},error:function(){App.views.search.renderError(c),d()}})},error:function(a,b){App.views.search.renderError(c),d()}})}),j.on("route:defaultRoute",d),Backbone.history.start(),b.exports=j},{underscore:82}],6:[function(a,b,c){(function(d){var e="undefined"==typeof window?d:window,f=e.Handlebars||a("handlebars");this.Templates=this.Templates||{},this.Templates.browser=f.template({1:function(a,b,c,d,e){var f=a.lambda,g=a.escapeExpression;return'
\n \n \n
\n'},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f;return'
\n
\n'+(null!=(f=c.each.call(null!=b?b:{},null!=b?b.tracks:b,{name:"each",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:"")+"
\n
\n"},useData:!0}),this.Templates.gene=f.template({1:function(a,b,c,d,e){var f,g=null!=b?b:{},h=c.helperMissing,i="function",j=a.escapeExpression;return'

\n '+j((f=null!=(f=c.name||(null!=b?b.name:b))?f:h,typeof f===i?f.call(g,{name:"name",hash:{},data:e}):f))+"\n \n chromosome "+j((f=null!=(f=c.chromosome||(null!=b?b.chromosome:b))?f:h,typeof f===i?f.call(g,{name:"chromosome",hash:{},data:e}):f))+" (start: "+j((f=null!=(f=c.start||(null!=b?b.start:b))?f:h,typeof f===i?f.call(g,{name:"start",hash:{},data:e}):f))+", end: "+j((f=null!=(f=c.end||(null!=b?b.end:b))?f:h,typeof f===i?f.call(g,{name:"end",hash:{},data:e}):f))+')\n \n

\n
\n\n \n'},3:function(a,b,c,d,e){var f;return'
\n \n
\n"},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g=null!=b?b:{};return'
\n\n'+(null!=(f=c["if"].call(g,null!=b?b.name:b,{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:"")+"\n"+(null!=(f=c["if"].call(g,null!=b?b.error:b,{name:"if",hash:{},fn:a.program(3,e,0),inverse:a.noop,data:e}))?f:"")+"
\n
\n"},useData:!0}),this.Templates.index=f.template({compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){return'
\n
\n
\n

HiCBrowser is a simple web browser to visualize Hi-C and other genomic tracks. \n

It is based on pyGenomeTracks, a program and library to plot beautiful genome browser tracks.

\n
\n
\n \n \n \n
\n
\n
\n
\n'},useData:!0}),this.Templates.loading=f.template({compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f;return''},useData:!0}),this.Templates.search=f.template({1:function(a,b,c,d,e){var f;return' example\n'},3:function(a,b,c,d,e){var f;return' example\n'},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g,h=null!=b?b:{},i=c.helperMissing,j="function",k=a.escapeExpression;return'\n\n
\n\n
\n\n
\n
\n \n \n \n \n
\n\n'+(null!=(f=c["if"].call(h,null!=b?b.gene_example:b,{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:"")+'
\n\n
\n
\n \n \n \n \n
\n\n'+(null!=(f=c["if"].call(h,null!=b?b.browser_example:b,{name:"if",hash:{},fn:a.program(3,e,0),inverse:a.noop,data:e}))?f:"")+'
\n\n
\n
\n\n
\n \n \n \n \n \n \n \n \n \n
\n\n
\n
\n
\n\n
\n\n
\n
\n'},useData:!0}),"object"==typeof c&&c&&(b.exports=this.Templates)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{handlebars:65}],7:[function(a,b,c){function d(a,b){b||(b=window.location.href),a=a.replace(/[\[\]]/g,"\\$&");var c=new RegExp("[?&]"+a+"(=([^&#]*)|&|#|$)","i"),d=c.exec(b);return d?d[2]?decodeURIComponent(d[2].replace(/\+/g," ")):"":null}function e(a){var b=a.target,c=b.parentNode;c.className+=c.className?" loaded":"loaded"}function f(a){var b=a.target;b.src="/static/img/not_found.png";var c=b.parentNode;c.className+=c.className?" loaded":"loaded"}function g(a,b,c){for(var d=c||0,h=0;d
").hide().append(b),$(this.el).append(h),g(document.getElementsByTagName("img"),6)}},setVisible:function(){h.show().siblings().hide(),$(this.el).css({opacity:0,visibility:"visible"}).animate({opacity:1},800)}})},{"../templates":6,underscore:82}],8:[function(a,b,c){function d(a){var b=a.toString(16);return 1==b.length?"0"+b:b}function e(a,b,c){return"#"+d(a)+d(b)+d(c)}function f(a){var b={};return b.tracks=h.compact(h.map(a.tracks,function(a,c){var d;return"boundaries"===a.file_type?(b.extent=i.extent(a.x_values),d=h.map(a.x_values,function(b,c){return{x:b,y:a.y_values[c]}}),{type:"line",name:a.section_name,className:"tads",color:"#008B8D",height:"5",data:d,interpolation:"linear"}):"bed"===a.file_type?(d=h.map(a.intervals,function(b,c){var d={x:b.bed[1],y:b.bed[2]};return"genes"===a.title&&(d.description=b.bed[3]),h.isArray(b.bed[8])&&(d.color=e.apply(null,b.bed[8])),d}),{type:"rect",name:a.title,data:d,color:"steelblue"}):void 0})),b}var g,h=a("underscore"),i=a("d3"),j=a("feature-viewer"),k=a("../templates"),l={},m=h.uniqueId("feat_viewer_");b.exports=Backbone.View.extend({initialize:function(a){this.options=a},render:function(a){if(a=h.isUndefined(a)?{}:a,a.feature_viewer=m,a.id!==l.id){$(this.el).css({opacity:0,visibility:"hidden"});var b=k.gene(a);h.isUndefined(g)||g.remove(),g=$("
").hide().append(b),$(this.el).append(g),this.renderViewer(a.tracks),$('[data-toggle="tooltip"]').tooltip()}},setVisible:function(){g.show().siblings().hide(),$(this.el).css({opacity:0,visibility:"visible"}).animate({opacity:1},800)},renderViewer:function(a){data=f(a);var b=new j(data.extent[1],"#"+m,{showAxis:!1,showSequence:!1,brushActive:!0,toolbar:!1,bubbleHelp:!1,zoomMax:10,offset:{start:data.extent[0],end:data.extent[1]}});h.each(data.tracks,b.addFeature)}})},{"../templates":6,d3:31,"feature-viewer":32,underscore:82}],9:[function(a,b,c){var d,e=a("underscore"),f=a("../templates");b.exports=Backbone.View.extend({initialize:function(a){this.options=a},render:function(a){a=e.isUndefined(a)?{}:a,$(this.el).css({opacity:0,visibility:"hidden"});var b=f.index(a);d=$("
").hide().append(b),$(this.el).empty().append(d),this.rendered=!0},rendered:!1,setVisible:function(){d.show().siblings().hide(),$(this.el).css({opacity:0,visibility:"visible"}).animate({opacity:1},800)}})},{"../templates":6,underscore:82}],10:[function(a,b,c){var d=a("underscore"),e=a("../templates"),f=d.uniqueId("loading_");b.exports=Backbone.View.extend({initialize:function(a){this.options=a},render:function(a){a=d.isUndefined(a)?{}:a,a.id=f;var b=e.loading(a);$(this.options.el).append(b)},show:function(){$("#"+f).modal({show:!0,backdrop:"static",keyboard:!1})},hide:function(){$("#"+f).modal("hide")}})},{"../templates":6,underscore:82}],11:[function(a,b,c){var d,e=a("underscore"),f=a("../templates"),g=e.uniqueId("prev_id_"),h=e.uniqueId("next_id_"),i=e.uniqueId("zoomout_id_"),j=e.uniqueId("search_input_"),k=e.uniqueId("search_input_"),l=(e.uniqueId("search_btn_"),e.uniqueId("gene_btn_")),m=e.uniqueId("browser_btn_"),n=e.uniqueId("gene_example_"),o=e.uniqueId("browser_example_"),p=!0;b.exports=Backbone.View.extend({initialize:function(a){this.options=a},events:{"click li":"onLiClick","click button":"search","keydown input":"keyAction","click a":"linkClick"},render:function(a){a=e.isUndefined(a)?{}:a.attributes,a.prev_id=g,a.next_id=h,a.zoomout_id=i,a.gene_search_input=k,a.browser_search_input=j,a.gene_btn=l,a.browser_btn=m,a.browser_example_id=o,a.gene_example_id=n;var b=f.search(a);$(this.options.el).html(b)},renderError:function(a){$("#error").html(a).show()},update:function(a){e.isUndefined(a.name)?onGeneButton():(onBrowserButton(),updateButtons(a))},search:function(){var a=p?$("#"+k).val():$("#"+j).val();if($("#error").hide(),a.length>0){var b=p?"/gene/"+a:"/browser/"+a;App.router.navigate(b,{trigger:!0})}},onLiClick:function(a){a.preventDefault();var b=$(a.currentTarget).data("id");b===l?(p=!0,this.showGeneView(),App.router.navigate("/gene",{trigger:!0,replace:!0})):b===m&&(p=!1,this.showBrowserView(),App.router.navigate("/browser",{trigger:!0,replace:!0}))},linkClick:function(a){a.preventDefault();var b=$(a.currentTarget).data("id");b===n?App.router.navigate("/gene/"+App.config.attributes.gene_example,{trigger:!0}):b===o?App.router.navigate("/browser/"+App.config.attributes.browser_example,{trigger:!0}):e.isUndefined(d)||(b===g?App.router.navigate("/browser/"+d.previous,{trigger:!0}):b===h?App.router.navigate("/browser/"+d.next,{trigger:!0}):b===i&&App.router.navigate("/browser/"+d.out,{trigger:!0}))},keyAction:function(a){13===a.which&&this.search()},showGeneView:function(a){e.isUndefined(a)||$("#"+k).val(a),$("#"+m).removeClass("active"),$("#"+l).addClass("active"),$("#"+j).parent().parent().css({opacity:0,display:"none"}),$("#"+k).parent().parent().css({opacity:0,display:"block"}).animate({opacity:1},800)},showBrowserView:function(a){d=a,e.isUndefined(a)||$("#"+j).val(a.id),$("#"+l).removeClass("active"),$("#"+m).addClass("active"),$("#"+k).parent().parent().css({opacity:0,display:"none"}),$("#"+j).parent().parent().css({opacity:0,display:"block"}).animate({opacity:1},800)}})},{"../templates":6,underscore:82}],12:[function(a,b,c){(function(c,d){"use strict";function e(b,e){function f(a){var b,c;for(b=0;a[b];b+=1)if(c=a[b],"."===c)a.splice(b,1),b-=1;else if(".."===c){if(1===b&&(".."===a[2]||".."===a[0]))break;b>0&&(a.splice(b-1,2),b-=2)}}function g(a,b){var c;return a&&"."===a.charAt(0)&&b&&(c=b.split("/"),c=c.slice(0,c.length-1),c=c.concat(a.split("/")),f(c),a=c.join("/")),a}function h(a){return function(b){return g(b,a)}}function i(a){function b(b){o[a]=b}return b.fromText=function(a,b){throw new Error("amdefine does not implement load.fromText")},b}function j(a,c,f){var g,h,i,j;if(a)h=o[a]={},i={id:a,uri:d,exports:h},g=l(e,h,i,a);else{if(p)throw new Error("amdefine with no module ID cannot be called more than once per file.");p=!0,h=b.exports,i=b,g=l(e,h,i,b.id)}c&&(c=c.map(function(a){return g(a)})),j="function"==typeof f?f.apply(i.exports,c):f,void 0!==j&&(i.exports=j,a&&(o[a]=i.exports))}function k(a,b,c){Array.isArray(a)?(c=b,b=a,a=void 0):"string"!=typeof a&&(c=a,a=b=void 0),b&&!Array.isArray(b)&&(c=b,b=void 0),b||(b=["require","exports","module"]),a?n[a]=[a,b,c]:j(a,b,c)}var l,m,n={},o={},p=!1,q=a("path");return l=function(a,b,d,e){function f(f,g){return"string"==typeof f?m(a,b,d,f,e):(f=f.map(function(c){return m(a,b,d,c,e)}),void(g&&c.nextTick(function(){g.apply(null,f)})))}return f.toUrl=function(a){return 0===a.indexOf(".")?g(a,q.dirname(d.filename)):a},f},e=e||function(){return b.require.apply(b,arguments)},m=function(a,b,c,d,e){var f,k,p=d.indexOf("!"),q=d;if(p===-1){if(d=g(d,e),"require"===d)return l(a,b,c,e);if("exports"===d)return b;if("module"===d)return c;if(o.hasOwnProperty(d))return o[d];if(n[d])return j.apply(null,n[d]),o[d];if(a)return a(q);throw new Error("No module with ID: "+d)}return f=d.substring(0,p),d=d.substring(p+1,d.length),k=m(a,b,c,f,e),d=k.normalize?k.normalize(d,h(e)):g(d,e),o[d]?o[d]:(k.load(d,l(a,b,c,e),i(d),{}),o[d])},k.require=function(a){return o[a]?o[a]:n[a]?(j.apply(null,n[a]),o[a]):void 0},k.amd={},k}b.exports=e}).call(this,a("_process"),"/node_modules/amdefine/amdefine.js")},{_process:81,path:80}],13:[function(a,b,c){!function(){function a(){return{keys:Object.keys||function(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("keys() called on a non-object");var b,c=[];for(b in a)a.hasOwnProperty(b)&&(c[c.length]=b);return c},uniqueId:function(a){var b=++i+"";return a?a+b:b},has:function(a,b){return g.call(a,b)},each:function(a,b,c){if(null!=a)if(f&&a.forEach===f)a.forEach(b,c);else if(a.length===+a.length)for(var d=0,e=a.length;dthis.length&&(e=this.length),e<0&&(e+=this.length+1);var f,g,h=[],i=[],j=[],k=[],l={},m=b.add,n=b.merge,o=b.remove,p=!1,q=this.comparator&&null==e&&b.sort!==!1,r=c.isString(this.comparator)?this.comparator:null;for(g=0;g7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(L,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var b=this.root.slice(0,-1)||"/";return this.location.replace(b+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var d=document.body,e=d.insertBefore(this.iframe,d.firstChild).contentWindow;e.document.open(),e.document.close(),e.location.hash="#"+this.fragment}var f=window.addEventListener||function(a,b){return attachEvent("on"+a,b)};if(this._usePushState?f("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?f("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var a=window.removeEventListener||function(a,b){return detachEvent("on"+a,b)};this._usePushState?a("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&a("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),J.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(a){var b=this.getFragment();return b===this.fragment&&this.iframe&&(b=this.getHash(this.iframe.contentWindow)),b!==this.fragment&&(this.iframe&&this.navigate(b),void this.loadUrl())},loadUrl:function(a){return!!this.matchRoot()&&(a=this.fragment=this.getFragment(a),c.some(this.handlers,function(b){if(b.route.test(a))return b.callback(a),!0}))},navigate:function(a,b){if(!J.started)return!1;b&&b!==!0||(b={trigger:!!b}),a=this.getFragment(a||"");var c=this.root;""!==a&&"?"!==a.charAt(0)||(c=c.slice(0,-1)||"/");var d=c+a;if(a=this.decodeFragment(a.replace(M,"")),this.fragment!==a){if(this.fragment=a,this._usePushState)this.history[b.replace?"replaceState":"pushState"]({},document.title,d);else{if(!this._wantsHashChange)return this.location.assign(d);if(this._updateHash(this.location,a,b.replace),this.iframe&&a!==this.getHash(this.iframe.contentWindow)){var e=this.iframe.contentWindow;b.replace||(e.document.open(),e.document.close()),this._updateHash(e.location,a,b.replace)}}return b.trigger?this.loadUrl(a):void 0}},_updateHash:function(a,b,c){if(c){var d=a.href.replace(/(javascript:|#).*$/,"");a.replace(d+"#"+b)}else a.hash="#"+b}}),b.history=new J;var N=function(a,b){var d,e=this;return d=a&&c.has(a,"constructor")?a.constructor:function(){return e.apply(this,arguments)},c.extend(d,e,b),d.prototype=c.create(e.prototype,a),d.prototype.constructor=d,d.__super__=e.prototype,d};t.extend=v.extend=E.extend=A.extend=J.extend=N;var O=function(){throw new Error('A "url" property or function must be specified')},P=function(a,b){var c=b.error;b.error=function(d){c&&c.call(b.context,a,d,b),a.trigger("error",a,d,b)}};return b})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{jquery:77,underscore:82}],16:[function(a,b,c){var d=a("backbone-events-standalone");d.onAll=function(a,b){return this.on("all",a,b),this},d.oldMixin=d.mixin,d.mixin=function(a){d.oldMixin(a);for(var b=["onAll"],c=0;c=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery)},{}],19:[function(a,b,c){+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery)},{}],20:[function(a,b,c){+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery)},{}],21:[function(a,b,c){+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery)},{}],22:[function(a,b,c){+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery)},{}],23:[function(a,b,c){+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth

'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery)},{}],26:[function(a,b,c){+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery)},{}],28:[function(a,b,c){+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery)},{}],29:[function(a,b,c){+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery)},{}],30:[function(a,b,c){},{}],31:[function(a,b,c){!function(){function a(a){return a&&(a.ownerDocument||a.document||a).documentElement}function c(a){return a&&(a.ownerDocument&&a.ownerDocument.defaultView||a.document&&a||a.defaultView)}function d(a,b){return ab?1:a>=b?0:NaN}function e(a){return null===a?NaN:+a}function f(a){return!isNaN(a)}function g(a){return{left:function(b,c,d,e){for(arguments.length<3&&(d=0),arguments.length<4&&(e=b.length);d>>1;a(b[f],c)<0?d=f+1:e=f}return d},right:function(b,c,d,e){for(arguments.length<3&&(d=0),arguments.length<4&&(e=b.length);d>>1;a(b[f],c)>0?e=f:d=f+1}return d}}}function h(a){return a.length}function i(a){for(var b=1;a*b%1;)b*=10;return b}function j(a,b){for(var c in b)Object.defineProperty(a.prototype,c,{value:b[c],enumerable:!1})}function k(){this._=Object.create(null)}function l(a){return(a+="")===vg||a[0]===wg?wg+a:a}function m(a){return(a+="")[0]===wg?a.slice(1):a}function n(a){return l(a)in this._}function o(a){return(a=l(a))in this._&&delete this._[a]}function p(){var a=[];for(var b in this._)a.push(m(b));return a}function q(){var a=0;for(var b in this._)++a;return a}function r(){for(var a in this._)return!1;return!0}function s(){this._=Object.create(null)}function t(a){return a}function u(a,b,c){return function(){var d=c.apply(b,arguments);return d===b?a:d}}function v(a,b){if(b in a)return b;b=b.charAt(0).toUpperCase()+b.slice(1);for(var c=0,d=xg.length;c=b&&(b=e+1);!(g=h[b])&&++b0&&(a=a.slice(0,h));var j=Hg.get(a);return j&&(a=j,i=X),h?b?e:d:b?w:f}function W(a,b){return function(c){var d=ig.event;ig.event=c,b[0]=this.__data__;try{a.apply(this,b)}finally{ig.event=d}}}function X(a,b){var c=W(a,b);return function(a){var b=this,d=a.relatedTarget;d&&(d===b||8&d.compareDocumentPosition(b))||c.call(b,a)}}function Y(b){var d=".dragsuppress-"+ ++Jg,e="click"+d,f=ig.select(c(b)).on("touchmove"+d,z).on("dragstart"+d,z).on("selectstart"+d,z);if(null==Ig&&(Ig=!("onselectstart"in b)&&v(b.style,"userSelect")),Ig){var g=a(b).style,h=g[Ig];g[Ig]="none"}return function(a){if(f.on(d,null),Ig&&(g[Ig]=h),a){var b=function(){f.on(e,null)};f.on(e,function(){z(),b()},!0),setTimeout(b,0)}}}function Z(a,b){b.changedTouches&&(b=b.changedTouches[0]);var d=a.ownerSVGElement||a;if(d.createSVGPoint){var e=d.createSVGPoint();if(Kg<0){var f=c(a);if(f.scrollX||f.scrollY){d=ig.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var g=d[0][0].getScreenCTM();Kg=!(g.f||g.e),d.remove()}}return Kg?(e.x=b.pageX,e.y=b.pageY):(e.x=b.clientX,e.y=b.clientY),e=e.matrixTransform(a.getScreenCTM().inverse()),[e.x,e.y]}var h=a.getBoundingClientRect();return[b.clientX-h.left-a.clientLeft,b.clientY-h.top-a.clientTop]}function $(){return ig.event.changedTouches[0].identifier}function _(a){return a>0?1:a<0?-1:0}function aa(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(b[1]-a[1])*(c[0]-a[0])}function ba(a){return a>1?0:a<-1?Ng:Math.acos(a)}function ca(a){return a>1?Qg:a<-1?-Qg:Math.asin(a)}function da(a){return((a=Math.exp(a))-1/a)/2}function ea(a){return((a=Math.exp(a))+1/a)/2}function fa(a){return((a=Math.exp(2*a))-1)/(a+1)}function ga(a){return(a=Math.sin(a/2))*a}function ha(){}function ia(a,b,c){return this instanceof ia?(this.h=+a,this.s=+b,void(this.l=+c)):arguments.length<2?a instanceof ia?new ia(a.h,a.s,a.l):wa(""+a,xa,ia):new ia(a,b,c)}function ja(a,b,c){function d(a){return a>360?a-=360:a<0&&(a+=360),a<60?f+(g-f)*a/60:a<180?g:a<240?f+(g-f)*(240-a)/60:f}function e(a){return Math.round(255*d(a))}var f,g;return a=isNaN(a)?0:(a%=360)<0?a+360:a,b=isNaN(b)?0:b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,g=c<=.5?c*(1+b):c+b-c*b,f=2*c-g,new sa(e(a+120),e(a),e(a-120))}function ka(a,b,c){return this instanceof ka?(this.h=+a,this.c=+b,void(this.l=+c)):arguments.length<2?a instanceof ka?new ka(a.h,a.c,a.l):a instanceof ma?oa(a.l,a.a,a.b):oa((a=ya((a=ig.rgb(a)).r,a.g,a.b)).l,a.a,a.b):new ka(a,b,c)}function la(a,b,c){return isNaN(a)&&(a=0),isNaN(b)&&(b=0),new ma(c,Math.cos(a*=Rg)*b,Math.sin(a)*b)}function ma(a,b,c){return this instanceof ma?(this.l=+a,this.a=+b,void(this.b=+c)):arguments.length<2?a instanceof ma?new ma(a.l,a.a,a.b):a instanceof ka?la(a.h,a.c,a.l):ya((a=sa(a)).r,a.g,a.b):new ma(a,b,c)}function na(a,b,c){var d=(a+16)/116,e=d+b/500,f=d-c/200;return e=pa(e)*ah,d=pa(d)*bh,f=pa(f)*ch,new sa(ra(3.2404542*e-1.5371385*d-.4985314*f),ra(-.969266*e+1.8760108*d+.041556*f),ra(.0556434*e-.2040259*d+1.0572252*f))}function oa(a,b,c){return a>0?new ka(Math.atan2(c,b)*Sg,Math.sqrt(b*b+c*c),a):new ka(NaN,NaN,a)}function pa(a){return a>.206893034?a*a*a:(a-4/29)/7.787037}function qa(a){return a>.008856?Math.pow(a,1/3):7.787037*a+4/29}function ra(a){return Math.round(255*(a<=.00304?12.92*a:1.055*Math.pow(a,1/2.4)-.055))}function sa(a,b,c){return this instanceof sa?(this.r=~~a,this.g=~~b,void(this.b=~~c)):arguments.length<2?a instanceof sa?new sa(a.r,a.g,a.b):wa(""+a,sa,ja):new sa(a,b,c)}function ta(a){return new sa(a>>16,a>>8&255,255&a)}function ua(a){return ta(a)+""}function va(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function wa(a,b,c){var d,e,f,g=0,h=0,i=0;if(d=/([a-z]+)\((.*)\)/.exec(a=a.toLowerCase()))switch(e=d[2].split(","),d[1]){case"hsl":return c(parseFloat(e[0]),parseFloat(e[1])/100,parseFloat(e[2])/100);case"rgb":return b(Aa(e[0]),Aa(e[1]),Aa(e[2]))}return(f=fh.get(a))?b(f.r,f.g,f.b):(null==a||"#"!==a.charAt(0)||isNaN(f=parseInt(a.slice(1),16))||(4===a.length?(g=(3840&f)>>4,g=g>>4|g,h=240&f,h=h>>4|h,i=15&f,i=i<<4|i):7===a.length&&(g=(16711680&f)>>16,h=(65280&f)>>8,i=255&f)),b(g,h,i))}function xa(a,b,c){var d,e,f=Math.min(a/=255,b/=255,c/=255),g=Math.max(a,b,c),h=g-f,i=(g+f)/2;return h?(e=i<.5?h/(g+f):h/(2-g-f),d=a==g?(b-c)/h+(b0&&i<1?0:d),new ia(d,e,i)}function ya(a,b,c){a=za(a),b=za(b),c=za(c);var d=qa((.4124564*a+.3575761*b+.1804375*c)/ah),e=qa((.2126729*a+.7151522*b+.072175*c)/bh),f=qa((.0193339*a+.119192*b+.9503041*c)/ch);return ma(116*e-16,500*(d-e),200*(e-f))}function za(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function Aa(a){var b=parseFloat(a);return"%"===a.charAt(a.length-1)?Math.round(2.55*b):b}function Ba(a){return"function"==typeof a?a:function(){return a}}function Ca(a){return function(b,c,d){return 2===arguments.length&&"function"==typeof c&&(d=c,c=null),Da(b,c,a,d)}}function Da(a,b,c,d){function e(){var a,b=i.status;if(!b&&Fa(i)||b>=200&&b<300||304===b){try{a=c.call(f,i)}catch(d){return void g.error.call(f,d)}g.load.call(f,a)}else g.error.call(f,i)}var f={},g=ig.dispatch("beforesend","progress","load","error"),h={},i=new XMLHttpRequest,j=null;return!this.XDomainRequest||"withCredentials"in i||!/^(http(s)?:)?\/\//.test(a)||(i=new XDomainRequest),"onload"in i?i.onload=i.onerror=e:i.onreadystatechange=function(){i.readyState>3&&e()},i.onprogress=function(a){var b=ig.event;ig.event=a;try{g.progress.call(f,i)}finally{ig.event=b}},f.header=function(a,b){return a=(a+"").toLowerCase(),arguments.length<2?h[a]:(null==b?delete h[a]:h[a]=b+"",f)},f.mimeType=function(a){ return arguments.length?(b=null==a?null:a+"",f):b},f.responseType=function(a){return arguments.length?(j=a,f):j},f.response=function(a){return c=a,f},["get","post"].forEach(function(a){f[a]=function(){return f.send.apply(f,[a].concat(kg(arguments)))}}),f.send=function(c,d,e){if(2===arguments.length&&"function"==typeof d&&(e=d,d=null),i.open(c,a,!0),null==b||"accept"in h||(h.accept=b+",*/*"),i.setRequestHeader)for(var k in h)i.setRequestHeader(k,h[k]);return null!=b&&i.overrideMimeType&&i.overrideMimeType(b),null!=j&&(i.responseType=j),null!=e&&f.on("error",e).on("load",function(a){e(null,a)}),g.beforesend.call(f,i),i.send(null==d?null:d),f},f.abort=function(){return i.abort(),f},ig.rebind(f,g,"on"),null==d?f:f.get(Ea(d))}function Ea(a){return 1===a.length?function(b,c){a(null==b?c:null)}:a}function Fa(a){var b=a.responseType;return b&&"text"!==b?a.response:a.responseText}function Ga(a,b,c){var d=arguments.length;d<2&&(b=0),d<3&&(c=Date.now());var e=c+b,f={c:a,t:e,n:null};return hh?hh.n=f:gh=f,hh=f,ih||(jh=clearTimeout(jh),ih=1,kh(Ha)),f}function Ha(){var a=Ia(),b=Ja()-a;b>24?(isFinite(b)&&(clearTimeout(jh),jh=setTimeout(Ha,b)),ih=0):(ih=1,kh(Ha))}function Ia(){for(var a=Date.now(),b=gh;b;)a>=b.t&&b.c(a-b.t)&&(b.c=null),b=b.n;return a}function Ja(){for(var a,b=gh,c=1/0;b;)b.c?(b.t8?function(a){return a/c}:function(a){return a*c},symbol:a}}function Ma(a){var b=a.decimal,c=a.thousands,d=a.grouping,e=a.currency,f=d&&c?function(a,b){for(var e=a.length,f=[],g=0,h=d[0],i=0;e>0&&h>0&&(i+h+1>b&&(h=Math.max(1,b-i)),f.push(a.substring(e-=h,e+h)),!((i+=h+1)>b));)h=d[g=(g+1)%d.length];return f.reverse().join(c)}:t;return function(a){var c=mh.exec(a),d=c[1]||" ",g=c[2]||">",h=c[3]||"-",i=c[4]||"",j=c[5],k=+c[6],l=c[7],m=c[8],n=c[9],o=1,p="",q="",r=!1,s=!0;switch(m&&(m=+m.substring(1)),(j||"0"===d&&"="===g)&&(j=d="0",g="="),n){case"n":l=!0,n="g";break;case"%":o=100,q="%",n="f";break;case"p":o=100,q="%",n="r";break;case"b":case"o":case"x":case"X":"#"===i&&(p="0"+n.toLowerCase());case"c":s=!1;case"d":r=!0,m=0;break;case"s":o=-1,n="r"}"$"===i&&(p=e[0],q=e[1]),"r"!=n||m||(n="g"),null!=m&&("g"==n?m=Math.max(1,Math.min(21,m)):"e"!=n&&"f"!=n||(m=Math.max(0,Math.min(20,m)))),n=nh.get(n)||Na;var t=j&&l;return function(a){var c=q;if(r&&a%1)return"";var e=a<0||0===a&&1/a<0?(a=-a,"-"):"-"===h?"":h;if(o<0){var i=ig.formatPrefix(a,m);a=i.scale(a),c=i.symbol+q}else a*=o;a=n(a,m);var u,v,w=a.lastIndexOf(".");if(w<0){var x=s?a.lastIndexOf("e"):-1;x<0?(u=a,v=""):(u=a.substring(0,x),v=a.substring(x))}else u=a.substring(0,w),v=b+a.substring(w+1);!j&&l&&(u=f(u,1/0));var y=p.length+u.length+v.length+(t?0:e.length),z=y"===g?z+e+a:"^"===g?z.substring(0,y>>=1)+e+a+z.substring(y):e+(t?a:z+a))+c}}}function Na(a){return a+""}function Oa(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Pa(a,b,c){function d(b){var c=a(b),d=f(c,1);return b-c1)for(;g=j)return-1;if(e=b.charCodeAt(h++),37===e){if(g=b.charAt(h++),f=D[g in rh?b.charAt(h++):g],!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function d(a,b,c){w.lastIndex=0;var d=w.exec(b.slice(c));return d?(a.w=x.get(d[0].toLowerCase()),c+d[0].length):-1}function e(a,b,c){u.lastIndex=0;var d=u.exec(b.slice(c));return d?(a.w=v.get(d[0].toLowerCase()),c+d[0].length):-1}function f(a,b,c){A.lastIndex=0;var d=A.exec(b.slice(c));return d?(a.m=B.get(d[0].toLowerCase()),c+d[0].length):-1}function g(a,b,c){y.lastIndex=0;var d=y.exec(b.slice(c));return d?(a.m=z.get(d[0].toLowerCase()),c+d[0].length):-1}function h(a,b,d){return c(a,C.c.toString(),b,d)}function i(a,b,d){return c(a,C.x.toString(),b,d)}function j(a,b,d){return c(a,C.X.toString(),b,d)}function k(a,b,c){var d=t.get(b.slice(c,c+=2).toLowerCase());return null==d?-1:(a.p=d,c)}var l=a.dateTime,m=a.date,n=a.time,o=a.periods,p=a.days,q=a.shortDays,r=a.months,s=a.shortMonths;b.utc=function(a){function c(a){try{ph=Oa;var b=new ph;return b._=a,d(b)}finally{ph=Date}}var d=b(a);return c.parse=function(a){try{ph=Oa;var b=d.parse(a);return b&&b._}finally{ph=Date}},c.toString=d.toString,c},b.multi=b.utc.multi=jb;var t=ig.map(),u=Ta(p),v=Ua(p),w=Ta(q),x=Ua(q),y=Ta(r),z=Ua(r),A=Ta(s),B=Ua(s);o.forEach(function(a,b){t.set(a.toLowerCase(),b)});var C={a:function(a){return q[a.getDay()]},A:function(a){return p[a.getDay()]},b:function(a){return s[a.getMonth()]},B:function(a){return r[a.getMonth()]},c:b(l),d:function(a,b){return Sa(a.getDate(),b,2)},e:function(a,b){return Sa(a.getDate(),b,2)},H:function(a,b){return Sa(a.getHours(),b,2)},I:function(a,b){return Sa(a.getHours()%12||12,b,2)},j:function(a,b){return Sa(1+oh.dayOfYear(a),b,3)},L:function(a,b){return Sa(a.getMilliseconds(),b,3)},m:function(a,b){return Sa(a.getMonth()+1,b,2)},M:function(a,b){return Sa(a.getMinutes(),b,2)},p:function(a){return o[+(a.getHours()>=12)]},S:function(a,b){return Sa(a.getSeconds(),b,2)},U:function(a,b){return Sa(oh.sundayOfYear(a),b,2)},w:function(a){return a.getDay()},W:function(a,b){return Sa(oh.mondayOfYear(a),b,2)},x:b(m),X:b(n),y:function(a,b){return Sa(a.getFullYear()%100,b,2)},Y:function(a,b){return Sa(a.getFullYear()%1e4,b,4)},Z:hb,"%":function(){return"%"}},D={a:d,A:e,b:f,B:g,c:h,d:bb,e:bb,H:db,I:db,j:cb,L:gb,m:ab,M:eb,p:k,S:fb,U:Wa,w:Va,W:Xa,x:i,X:j,y:Za,Y:Ya,Z:$a,"%":ib};return b}function Sa(a,b,c){var d=a<0?"-":"",e=(d?-a:a)+"",f=e.length;return d+(f68?1900:2e3)}function ab(a,b,c){sh.lastIndex=0;var d=sh.exec(b.slice(c,c+2));return d?(a.m=d[0]-1,c+d[0].length):-1}function bb(a,b,c){sh.lastIndex=0;var d=sh.exec(b.slice(c,c+2));return d?(a.d=+d[0],c+d[0].length):-1}function cb(a,b,c){sh.lastIndex=0;var d=sh.exec(b.slice(c,c+3));return d?(a.j=+d[0],c+d[0].length):-1}function db(a,b,c){sh.lastIndex=0;var d=sh.exec(b.slice(c,c+2));return d?(a.H=+d[0],c+d[0].length):-1}function eb(a,b,c){sh.lastIndex=0;var d=sh.exec(b.slice(c,c+2));return d?(a.M=+d[0],c+d[0].length):-1}function fb(a,b,c){sh.lastIndex=0;var d=sh.exec(b.slice(c,c+2));return d?(a.S=+d[0],c+d[0].length):-1}function gb(a,b,c){sh.lastIndex=0;var d=sh.exec(b.slice(c,c+3));return d?(a.L=+d[0],c+d[0].length):-1}function hb(a){var b=a.getTimezoneOffset(),c=b>0?"-":"+",d=ug(b)/60|0,e=ug(b)%60;return c+Sa(d,"0",2)+Sa(e,"0",2)}function ib(a,b,c){th.lastIndex=0;var d=th.exec(b.slice(c,c+1));return d?c+d[0].length:-1}function jb(a){for(var b=a.length,c=-1;++c=0?1:-1,h=g*c,i=Math.cos(b),j=Math.sin(b),k=f*j,l=e*i+k*Math.cos(h),m=k*g*Math.sin(h);zh.add(Math.atan2(m,l)),d=a,e=i,f=j}var b,c,d,e,f;Ah.point=function(g,h){Ah.point=a,d=(b=g)*Rg,e=Math.cos(h=(c=h)*Rg/2+Ng/4),f=Math.sin(h)},Ah.lineEnd=function(){a(b,c)}}function qb(a){var b=a[0],c=a[1],d=Math.cos(c);return[d*Math.cos(b),d*Math.sin(b),Math.sin(c)]}function rb(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function sb(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]}function tb(a,b){a[0]+=b[0],a[1]+=b[1],a[2]+=b[2]}function ub(a,b){return[a[0]*b,a[1]*b,a[2]*b]}function vb(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);a[0]/=b,a[1]/=b,a[2]/=b}function wb(a){return[Math.atan2(a[1],a[0]),ca(a[2])]}function xb(a,b){return ug(a[0]-b[0])=0;--h)e.point((l=k[h])[0],l[1])}else d(n.x,n.p.x,-1,e);n=n.p}n=n.o,k=n.z,o=!o}while(!n.v);e.lineEnd()}}}function Gb(a){if(b=a.length){for(var b,c,d=0,e=a[0];++d0){for(v||(f.polygonStart(),v=!0),f.lineStart();++g1&&2&b&&c.push(c.pop().concat(c.shift())),n.push(c.filter(Jb))}var n,o,p,q=b(f),r=e.invert(d[0],d[1]),s={point:g,lineStart:i,lineEnd:j,polygonStart:function(){s.point=k,s.lineStart=l,s.lineEnd=m,n=[],o=[]},polygonEnd:function(){s.point=g,s.lineStart=i,s.lineEnd=j,n=ig.merge(n);var a=Pb(r,o);n.length?(v||(f.polygonStart(),v=!0),Fb(n,Lb,a,c,f)):a&&(v||(f.polygonStart(),v=!0),f.lineStart(),c(null,null,1,f),f.lineEnd()),v&&(f.polygonEnd(),v=!1),n=o=null},sphere:function(){f.polygonStart(),f.lineStart(),c(null,null,1,f),f.lineEnd(),f.polygonEnd()}},t=Kb(),u=b(t),v=!1;return s}}function Jb(a){return a.length>1}function Kb(){var a,b=[];return{lineStart:function(){b.push(a=[])},point:function(b,c){a.push([b,c])},lineEnd:w,buffer:function(){var c=b;return b=[],a=null,c},rejoin:function(){b.length>1&&b.push(b.pop().concat(b.shift()))}}}function Lb(a,b){return((a=a.x)[0]<0?a[1]-Qg-Lg:Qg-a[1])-((b=b.x)[0]<0?b[1]-Qg-Lg:Qg-b[1])}function Mb(a){var b,c=NaN,d=NaN,e=NaN;return{lineStart:function(){a.lineStart(),b=1},point:function(f,g){var h=f>0?Ng:-Ng,i=ug(f-c);ug(i-Ng)0?Qg:-Qg),a.point(e,d),a.lineEnd(),a.lineStart(),a.point(h,d),a.point(f,d),b=0):e!==h&&i>=Ng&&(ug(c-e)Lg?Math.atan((Math.sin(b)*(f=Math.cos(d))*Math.sin(c)-Math.sin(d)*(e=Math.cos(b))*Math.sin(a))/(e*f*g)):(b+d)/2}function Ob(a,b,c,d){var e;if(null==a)e=c*Qg,d.point(-Ng,e),d.point(0,e),d.point(Ng,e),d.point(Ng,0),d.point(Ng,-e),d.point(0,-e),d.point(-Ng,-e),d.point(-Ng,0),d.point(-Ng,e);else if(ug(a[0]-b[0])>Lg){var f=a[0]=0?1:-1,x=w*v,y=x>Ng,z=o*t;if(zh.add(Math.atan2(z*w*Math.sin(x),p*u+z*Math.cos(x))),f+=y?v+w*Og:v,y^m>=c^r>=c){var A=sb(qb(l),qb(a));vb(A);var B=sb(e,A);vb(B);var C=(y^v>=0?-1:1)*ca(B[2]);(d>C||d===C&&(A[0]||A[1]))&&(g+=y^v>=0?1:-1)}if(!q++)break;m=r,o=t,p=u,l=a}}return(f<-Lg||ff}function c(a){var c,f,i,j,k;return{lineStart:function(){j=i=!1,k=1},point:function(l,m){var n,o=[l,m],p=b(l,m),q=g?p?0:e(l,m):p?e(l+(l<0?Ng:-Ng),m):0;if(!c&&(j=i=p)&&a.lineStart(),p!==i&&(n=d(c,o),(xb(c,n)||xb(o,n))&&(o[0]+=Lg,o[1]+=Lg,p=b(o[0],o[1]))),p!==i)k=0,p?(a.lineStart(),n=d(o,c),a.point(n[0],n[1])):(n=d(c,o),a.point(n[0],n[1]),a.lineEnd()),c=n;else if(h&&c&&g^p){var r;q&f||!(r=d(o,c,!0))||(k=0,g?(a.lineStart(),a.point(r[0][0],r[0][1]),a.point(r[1][0],r[1][1]),a.lineEnd()):(a.point(r[1][0],r[1][1]),a.lineEnd(),a.lineStart(),a.point(r[0][0],r[0][1])))}!p||c&&xb(c,o)||a.point(o[0],o[1]),c=o,i=p,f=q},lineEnd:function(){i&&a.lineEnd(),c=null},clean:function(){return k|(j&&i)<<1}}}function d(a,b,c){var d=qb(a),e=qb(b),g=[1,0,0],h=sb(d,e),i=rb(h,h),j=h[0],k=i-j*j;if(!k)return!c&&a;var l=f*i/k,m=-f*j/k,n=sb(g,h),o=ub(g,l),p=ub(h,m);tb(o,p);var q=n,r=rb(o,q),s=rb(q,q),t=r*r-s*(rb(o,o)-1);if(!(t<0)){var u=Math.sqrt(t),v=ub(q,(-r-u)/s);if(tb(v,o),v=wb(v),!c)return v;var w,x=a[0],y=b[0],z=a[1],A=b[1];y0^v[1]<(ug(v[0]-x)Ng^(x<=v[0]&&v[0]<=y)){var E=ub(q,(-r+u)/s);return tb(E,o),[v,wb(E)]}}}function e(b,c){var d=g?a:Ng-a,e=0;return b<-d?e|=1:b>d&&(e|=2),c<-d?e|=4:c>d&&(e|=8),e}var f=Math.cos(a),g=f>0,h=ug(f)>Lg,i=pc(a,6*Rg);return Ib(b,c,i,g?[0,-a]:[-Ng,a-Ng])}function Rb(a,b,c,d){return function(e){var f,g=e.a,h=e.b,i=g.x,j=g.y,k=h.x,l=h.y,m=0,n=1,o=k-i,p=l-j;if(f=a-i,o||!(f>0)){if(f/=o,o<0){if(f0){if(f>n)return;f>m&&(m=f)}if(f=c-i,o||!(f<0)){if(f/=o,o<0){if(f>n)return;f>m&&(m=f)}else if(o>0){if(f0)){if(f/=p,p<0){if(f0){if(f>n)return;f>m&&(m=f)}if(f=d-j,p||!(f<0)){if(f/=p,p<0){if(f>n)return;f>m&&(m=f)}else if(p>0){if(f0&&(e.a={x:i+m*o,y:j+m*p}),n<1&&(e.b={x:i+n*o,y:j+n*p}),e}}}}}}function Sb(a,b,c,d){function e(d,e){return ug(d[0]-a)0?0:3:ug(d[0]-c)0?2:1:ug(d[1]-b)0?1:0:e>0?3:2}function f(a,b){return g(a.x,b.x)}function g(a,b){var c=e(a,1),d=e(b,1);return c!==d?c-d:0===c?b[1]-a[1]:1===c?a[0]-b[0]:2===c?a[1]-b[1]:b[0]-a[0]}return function(h){function i(a){for(var b=0,c=q.length,d=a[1],e=0;ed&&aa(j,f,a)>0&&++b:f[1]<=d&&aa(j,f,a)<0&&--b,j=f;return 0!==b}function j(f,h,i,j){var k=0,l=0;if(null==f||(k=e(f,i))!==(l=e(h,i))||g(f,h)<0^i>0){do j.point(0===k||3===k?a:c,k>1?d:b);while((k=(k+i+4)%4)!==l)}else j.point(h[0],h[1])}function k(e,f){return a<=e&&e<=c&&b<=f&&f<=d}function l(a,b){k(a,b)&&h.point(a,b)}function m(){D.point=o,q&&q.push(r=[]),y=!0,x=!1,v=w=NaN}function n(){p&&(o(s,t),u&&x&&B.rejoin(),p.push(B.buffer())),D.point=l,x&&h.lineEnd()}function o(a,b){a=Math.max(-Oh,Math.min(Oh,a)),b=Math.max(-Oh,Math.min(Oh,b));var c=k(a,b);if(q&&r.push([a,b]),y)s=a,t=b,u=c,y=!1,c&&(h.lineStart(),h.point(a,b));else if(c&&x)h.point(a,b);else{var d={a:{x:v,y:w},b:{x:a,y:b}};C(d)?(x||(h.lineStart(),h.point(d.a.x,d.a.y)),h.point(d.b.x,d.b.y),c||h.lineEnd(),z=!1):c&&(h.lineStart(),h.point(a,b),z=!1)}v=a,w=b,x=c}var p,q,r,s,t,u,v,w,x,y,z,A=h,B=Kb(),C=Rb(a,b,c,d),D={point:l,lineStart:m,lineEnd:n,polygonStart:function(){h=B,p=[],q=[],z=!0},polygonEnd:function(){h=A,p=ig.merge(p);var b=i([a,d]),c=z&&b,e=p.length;(c||e)&&(h.polygonStart(),c&&(h.lineStart(),j(null,null,1,h),h.lineEnd()),e&&Fb(p,f,b,j,h),h.polygonEnd()),p=q=r=null}};return D}}function Tb(a){var b=0,c=Ng/3,d=hc(a),e=d(b,c);return e.parallels=function(a){return arguments.length?d(b=a[0]*Ng/180,c=a[1]*Ng/180):[b/Ng*180,c/Ng*180]},e}function Ub(a,b){function c(a,b){var c=Math.sqrt(f-2*e*Math.sin(b))/e;return[c*Math.sin(a*=e),g-c*Math.cos(a)]}var d=Math.sin(a),e=(d+Math.sin(b))/2,f=1+d*(2*e-d),g=Math.sqrt(f)/e;return c.invert=function(a,b){var c=g-b;return[Math.atan2(a,c)/e,ca((f-(a*a+c*c)*e*e)/(2*e))]},c}function Vb(){function a(a,b){Qh+=e*a-d*b,d=a,e=b}var b,c,d,e;Vh.point=function(f,g){Vh.point=a,b=d=f,c=e=g},Vh.lineEnd=function(){a(b,c)}}function Wb(a,b){aTh&&(Th=a),bUh&&(Uh=b)}function Xb(){function a(a,b){g.push("M",a,",",b,f)}function b(a,b){g.push("M",a,",",b),h.point=c}function c(a,b){g.push("L",a,",",b)}function d(){h.point=a}function e(){g.push("Z")}var f=Yb(4.5),g=[],h={point:a,lineStart:function(){h.point=b},lineEnd:d,polygonStart:function(){h.lineEnd=e},polygonEnd:function(){h.lineEnd=d,h.point=a},pointRadius:function(a){return f=Yb(a),h},result:function(){if(g.length){var a=g.join("");return g=[],a}}};return h}function Yb(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+-2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}function Zb(a,b){Dh+=a,Eh+=b,++Fh}function $b(){function a(a,d){var e=a-b,f=d-c,g=Math.sqrt(e*e+f*f);Gh+=g*(b+a)/2,Hh+=g*(c+d)/2,Ih+=g,Zb(b=a,c=d)}var b,c;Xh.point=function(d,e){Xh.point=a,Zb(b=d,c=e)}}function _b(){Xh.point=Zb}function ac(){function a(a,b){var c=a-d,f=b-e,g=Math.sqrt(c*c+f*f);Gh+=g*(d+a)/2,Hh+=g*(e+b)/2,Ih+=g,g=e*a-d*b,Jh+=g*(d+a),Kh+=g*(e+b),Lh+=3*g,Zb(d=a,e=b)}var b,c,d,e;Xh.point=function(f,g){Xh.point=a,Zb(b=d=f,c=e=g)},Xh.lineEnd=function(){a(b,c)}}function bc(a){function b(b,c){a.moveTo(b+g,c),a.arc(b,c,g,0,Og)}function c(b,c){a.moveTo(b,c),h.point=d}function d(b,c){a.lineTo(b,c)}function e(){h.point=b}function f(){a.closePath()}var g=4.5,h={point:b,lineStart:function(){h.point=c},lineEnd:e,polygonStart:function(){h.lineEnd=f},polygonEnd:function(){h.lineEnd=e,h.point=b},pointRadius:function(a){return g=a,h},result:w};return h}function cc(a){function b(a){return(h?d:c)(a)}function c(b){return fc(b,function(c,d){c=a(c,d),b.point(c[0],c[1])})}function d(b){function c(c,d){c=a(c,d),b.point(c[0],c[1])}function d(){t=NaN,y.point=f,b.lineStart()}function f(c,d){var f=qb([c,d]),g=a(c,d);e(t,u,s,v,w,x,t=g[0],u=g[1],s=c,v=f[0],w=f[1],x=f[2],h,b),b.point(t,u)}function g(){y.point=c,b.lineEnd()}function i(){d(),y.point=j,y.lineEnd=k}function j(a,b){f(l=a,m=b),n=t,o=u,p=v,q=w,r=x,y.point=f}function k(){e(t,u,s,v,w,x,n,o,l,p,q,r,h,b),y.lineEnd=g,g()}var l,m,n,o,p,q,r,s,t,u,v,w,x,y={point:c,lineStart:d,lineEnd:g,polygonStart:function(){b.polygonStart(),y.lineStart=i},polygonEnd:function(){b.polygonEnd(),y.lineStart=d}};return y}function e(b,c,d,h,i,j,k,l,m,n,o,p,q,r){var s=k-b,t=l-c,u=s*s+t*t;if(u>4*f&&q--){var v=h+n,w=i+o,x=j+p,y=Math.sqrt(v*v+w*w+x*x),z=Math.asin(x/=y),A=ug(ug(x)-1)f||ug((s*E+t*F)/u-.5)>.3||h*n+i*o+j*p0&&16,b):Math.sqrt(f)},b}function dc(a){var b=cc(function(b,c){return a([b*Sg,c*Sg])});return function(a){return ic(b(a))}}function ec(a){this.stream=a}function fc(a,b){return{point:b,sphere:function(){a.sphere()},lineStart:function(){a.lineStart()},lineEnd:function(){a.lineEnd()},polygonStart:function(){a.polygonStart()},polygonEnd:function(){a.polygonEnd()}}}function gc(a){return hc(function(){return a})()}function hc(a){function b(a){return a=h(a[0]*Rg,a[1]*Rg),[a[0]*m+i,j-a[1]*m]}function c(a){return a=h.invert((a[0]-i)/m,(j-a[1])/m),a&&[a[0]*Sg,a[1]*Sg]}function d(){h=Db(g=lc(r,s,u),f);var a=f(p,q);return i=n-a[0]*m,j=o+a[1]*m,e()}function e(){return k&&(k.valid=!1,k=null),b}var f,g,h,i,j,k,l=cc(function(a,b){return a=f(a,b),[a[0]*m+i,j-a[1]*m]}),m=150,n=480,o=250,p=0,q=0,r=0,s=0,u=0,v=Nh,w=t,x=null,y=null;return b.stream=function(a){return k&&(k.valid=!1),k=ic(v(g,l(w(a)))),k.valid=!0,k},b.clipAngle=function(a){return arguments.length?(v=null==a?(x=a,Nh):Qb((x=+a)*Rg),e()):x},b.clipExtent=function(a){return arguments.length?(y=a,w=a?Sb(a[0][0],a[0][1],a[1][0],a[1][1]):t,e()):y},b.scale=function(a){return arguments.length?(m=+a,d()):m},b.translate=function(a){return arguments.length?(n=+a[0],o=+a[1],d()):[n,o]},b.center=function(a){return arguments.length?(p=a[0]%360*Rg,q=a[1]%360*Rg,d()):[p*Sg,q*Sg]},b.rotate=function(a){return arguments.length?(r=a[0]%360*Rg,s=a[1]%360*Rg,u=a.length>2?a[2]%360*Rg:0,d()):[r*Sg,s*Sg,u*Sg]},ig.rebind(b,l,"precision"),function(){return f=a.apply(this,arguments),b.invert=f.invert&&c,d()}}function ic(a){return fc(a,function(b,c){a.point(b*Rg,c*Rg)})}function jc(a,b){return[a,b]}function kc(a,b){return[a>Ng?a-Og:a<-Ng?a+Og:a,b]}function lc(a,b,c){return a?b||c?Db(nc(a),oc(b,c)):nc(a):b||c?oc(b,c):kc}function mc(a){return function(b,c){return b+=a,[b>Ng?b-Og:b<-Ng?b+Og:b,c]}}function nc(a){var b=mc(a);return b.invert=mc(-a),b}function oc(a,b){function c(a,b){var c=Math.cos(b),h=Math.cos(a)*c,i=Math.sin(a)*c,j=Math.sin(b),k=j*d+h*e;return[Math.atan2(i*f-k*g,h*d-j*e),ca(k*f+i*g)]}var d=Math.cos(a),e=Math.sin(a),f=Math.cos(b),g=Math.sin(b);return c.invert=function(a,b){var c=Math.cos(b),h=Math.cos(a)*c,i=Math.sin(a)*c,j=Math.sin(b),k=j*f-i*g;return[Math.atan2(i*f+j*g,h*d+k*e),ca(k*d-h*e)]},c}function pc(a,b){var c=Math.cos(a),d=Math.sin(a);return function(e,f,g,h){var i=g*b;null!=e?(e=qc(c,e),f=qc(c,f),(g>0?ef)&&(e+=g*Og)):(e=a+g*Og,f=a-.5*i);for(var j,k=e;g>0?k>f:k0?b<-Qg+Lg&&(b=-Qg+Lg):b>Qg-Lg&&(b=Qg-Lg);var c=g/Math.pow(e(b),f);return[c*Math.sin(f*a),g-c*Math.cos(f*a)]}var d=Math.cos(a),e=function(a){return Math.tan(Ng/4+a/2)},f=a===b?Math.sin(a):Math.log(d/Math.cos(b))/Math.log(e(b)/e(a)),g=d*Math.pow(e(a),f)/f;return f?(c.invert=function(a,b){var c=g-b,d=_(f)*Math.sqrt(a*a+c*c);return[Math.atan2(a,c)/f,2*Math.atan(Math.pow(g/d,1/f))-Qg]},c):Ac}function zc(a,b){function c(a,b){var c=f-b;return[c*Math.sin(e*a),f-c*Math.cos(e*a)]}var d=Math.cos(a),e=a===b?Math.sin(a):(d-Math.cos(b))/(b-a),f=d/e+a;return ug(e)1&&aa(a[c[d-2]],a[c[d-1]],a[e])<=0;)--d;c[d++]=e}return c.slice(0,d)}function Gc(a,b){return a[0]-b[0]||a[1]-b[1]}function Hc(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function Ic(a,b,c,d){var e=a[0],f=c[0],g=b[0]-e,h=d[0]-f,i=a[1],j=c[1],k=b[1]-i,l=d[1]-j,m=(h*(i-j)-l*(e-f))/(l*g-h*k);return[e+m*g,i+m*k]}function Jc(a){var b=a[0],c=a[a.length-1];return!(b[0]-c[0]||b[1]-c[1])}function Kc(){dd(this),this.edge=this.site=this.circle=null}function Lc(a){var b=ji.pop()||new Kc;return b.site=a,b}function Mc(a){Wc(a),gi.remove(a),ji.push(a),dd(a)}function Nc(a){var b=a.circle,c=b.x,d=b.cy,e={x:c,y:d},f=a.P,g=a.N,h=[a];Mc(a);for(var i=f;i.circle&&ug(c-i.circle.x)Lg)h=h.L;else{if(e=f-Qc(h,g),!(e>Lg)){d>-Lg?(b=h.P,c=h):e>-Lg?(b=h,c=h.N):b=c=h;break}if(!h.R){b=h;break}h=h.R}var i=Lc(a);if(gi.insert(b,i),b||c){if(b===c)return Wc(b),c=Lc(b.site),gi.insert(i,c),i.edge=c.edge=$c(b.site,i.site),Vc(b),void Vc(c);if(!c)return void(i.edge=$c(b.site,i.site));Wc(b),Wc(c);var j=b.site,k=j.x,l=j.y,m=a.x-k,n=a.y-l,o=c.site,p=o.x-k,q=o.y-l,r=2*(m*q-n*p),s=m*m+n*n,t=p*p+q*q,u={x:(q*s-n*t)/r+k,y:(m*t-p*s)/r+l};ad(c.edge,j,o,u),i.edge=$c(j,a,null,u),c.edge=$c(a,o,null,u),Vc(b),Vc(c)}}function Pc(a,b){var c=a.site,d=c.x,e=c.y,f=e-b;if(!f)return d;var g=a.P;if(!g)return-(1/0);c=g.site;var h=c.x,i=c.y,j=i-b;if(!j)return h;var k=h-d,l=1/f-1/j,m=k/j;return l?(-m+Math.sqrt(m*m-2*l*(k*k/(-2*j)-i+j/2+e-f/2)))/l+d:(d+h)/2}function Qc(a,b){var c=a.N;if(c)return Pc(c,b);var d=a.site;return d.y===b?d.x:1/0}function Rc(a){this.site=a,this.edges=[]}function Sc(a){for(var b,c,d,e,f,g,h,i,j,k,l=a[0][0],m=a[1][0],n=a[0][1],o=a[1][1],p=fi,q=p.length;q--;)if(f=p[q],f&&f.prepare())for(h=f.edges,i=h.length,g=0;gLg||ug(e-c)>Lg)&&(h.splice(g,0,new bd(_c(f.site,k,ug(d-l)Lg?{x:l,y:ug(b-l)Lg?{x:ug(c-o)Lg?{x:m,y:ug(b-m)Lg?{x:ug(c-n)=-Mg)){var n=i*i+j*j,o=k*k+l*l,p=(l*n-j*o)/m,q=(i*o-k*n)/m,l=q+h,r=ki.pop()||new Uc;r.arc=a,r.site=e,r.x=p+g,r.y=l+Math.sqrt(p*p+q*q),r.cy=l,a.circle=r;for(var s=null,t=ii._;t;)if(r.y=h)return;if(m>o){if(f){if(f.y>=j)return}else f={x:q,y:i};c={x:q,y:j}}else{if(f){if(f.y1)if(m>o){if(f){if(f.y>=j)return}else f={x:(i-e)/d,y:i};c={x:(j-e)/d,y:j}}else{if(f){if(f.y=h)return}else f={x:g,y:d*g+e};c={x:h,y:d*h+e}}else{if(f){if(f.x=3", "bx-python" ], cmdclass={'sdist': sdist} From bb4d3df8e90bf9fd9e72672c455dac3fdb54b15c Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 10:46:26 +0100 Subject: [PATCH 3/9] update print syntax to work with python 3 --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index f908a60..ebb9644 100755 --- a/setup.py +++ b/setup.py @@ -19,24 +19,24 @@ def update_version_py(): if not os.path.isdir(".git"): - print "This does not appear to be a Git repository." + print("This does not appear to be a Git repository.") return try: p = subprocess.Popen(["git", "describe", "--tags", "--always"], stdout=subprocess.PIPE) except EnvironmentError: - print "unable to run git, leaving hicbrowser/_version.py alone" + print("unable to run git, leaving hicbrowser/_version.py alone") return stdout = p.communicate()[0] if p.returncode != 0: - print "unable to run git, leaving hicbrowser/_version.py alone" + print("unable to run git, leaving hicbrowser/_version.py alone") return ver = stdout.strip() f = open("hicbrowser/_version.py", "w") f.write(VERSION_PY % ver) f.close() - print "set hicbrowser/_version.py to '%s'" % ver + print("set hicbrowser/_version.py to '%s'" % ver) def get_version(): From 16eeae8f3d71dce79b2519091fc4bd79bb9be977 Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 11:58:10 +0100 Subject: [PATCH 4/9] updated to pgt3.2 style --- example_browser/browser_tracks.ini | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/example_browser/browser_tracks.ini b/example_browser/browser_tracks.ini index d3b9b4e..5c7f855 100644 --- a/example_browser/browser_tracks.ini +++ b/example_browser/browser_tracks.ini @@ -7,32 +7,37 @@ title = Kc DpnII (Li et al. 2015) colormap = RdYlBu_r depth = 200000 transform = log1p -x labels = yes -boundaries_file = domains.bed + +[boundaries] +file = domains.bed +file_type = domains +overlay_previous = share-y +color = None [spacer] -width = 0.05 +height = 0.05 [tad state] file = tad_classification.bed -width = 0.5 +height = 0.5 title = TAD state display = collapsed -labels = off +labels = false [tad-separation score] file = tad_score.gz -width = 10 +height = 10 type = lines title= TAD separation score (Ramirez et al.) file_type = bedgraph_matrix [genes] file = dm3_genes.bed.gz -width = 20 +height = 20 title = genes fontsize = 12 -global max row = yes +global_max_row = true +labels = true [vlines] file = domains.bed From 7ec0ad313a1ffa1b09e80d5757464b3c7ce39c37 Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 12:01:04 +0100 Subject: [PATCH 5/9] adjust to make it work with python3 --- hicbrowser/views.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/hicbrowser/views.py b/hicbrowser/views.py index a350793..428dba9 100644 --- a/hicbrowser/views.py +++ b/hicbrowser/views.py @@ -10,16 +10,24 @@ import pygenometracks.plotTracks from pygenometracks.tracks.GenomeTrack import GenomeTrack import pygenometracks.tracksClass as pgttc -from pygenometracks.utilities import file_to_intervaltree, opener -import hicbrowser.utilities +from pygenometracks.utilities import file_to_intervaltree, opener, to_string import hicbrowser.tracks2json -from ConfigParser import SafeConfigParser +from configparser import ConfigParser pgttc.DEFAULT_WIDTH_RATIOS = (0.01, 0.89, 0.11) pgttc.DEFAULT_MARGINS = {'left': 0.02, 'right': 0.98, 'bottom': 0, 'top': 1} +def default(o): + """ + Transform np.integers to integers as np.integers are + not compatible with json dump + """ + if isinstance(o, np.integer): + return int(o) + else: + return o def get_TAD_for_gene(gene_name): """ @@ -101,7 +109,7 @@ def check_static_img_folders(): def main(config_file, port, numProc, template_folder=None, debug=False): - config = SafeConfigParser() + config = ConfigParser() config.readfp(open(config_file, 'r')) kwargs = {} @@ -155,6 +163,7 @@ def main(config_file, port, numProc, template_folder=None, debug=False): with opener(genes) as fh: for line in fh.readlines(): + line = to_string(line) if line.startswith('browser') or line.startswith('track') or line.startswith('#'): continue gene_chrom, gene_start, gene_end, gene_name = line.strip().split("\t")[0:4] @@ -202,7 +211,7 @@ def get_tad(gene_name): data['tracks'] = d res = json.dumps(data) - + res = None return res @app.route('/browser/', methods=['GET']) @@ -212,10 +221,11 @@ def browser(query): # check if the query is a valid gene name if gene_name in gene2pos: chromosome, start, end = gene2pos[gene_name] - start -= 50000 + start -= 50000 if start > 50000 else 0 end += 50000 else: chromosome, start, end = pygenometracks.plotTracks.get_region(query.strip()) + print("chr:{}".format(chromosome)) if end - start < 10000: sys.stderr.write("region to small ({}bp), enlarging it.".format(end - start)) start -= 5000 @@ -304,7 +314,7 @@ def browser(query): 'content': content, 'start': start, 'end': end} - json_data = json.dumps(data) + json_data = json.dumps(data, default=default) return json_data From 9d2e3c30f8bdbabde9cf2ff549d8d60d3b6f1858 Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 12:04:44 +0100 Subject: [PATCH 6/9] print syntax python3 --- hicbrowser/tracks2json.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hicbrowser/tracks2json.py b/hicbrowser/tracks2json.py index 41a670d..71174ae 100644 --- a/hicbrowser/tracks2json.py +++ b/hicbrowser/tracks2json.py @@ -45,7 +45,7 @@ def __init__(self, tracks_file, fig_width=DEFAULT_FIGURE_WIDTH, fig_height=None) # initialize each track self.track_obj_list = [] for idx, properties in enumerate(self.track_list): - print properties + print(properties) if 'spacer' in properties: self.track_obj_list.append(PlotSpacer(properties)) continue @@ -470,7 +470,7 @@ def process_bed(self, region_start, region_end): bp_per_inch = region_len / self.fig_width font_in_bp = font_in_inches * bp_per_inch self.len_w = font_in_bp - print "len of w set to: {} bp".format(self.len_w) + print("len of w set to: {} bp".format(self.len_w)) else: self.len_w = 1 @@ -543,7 +543,7 @@ def process_bed(self, region_start, region_end): if free_row > self.max_num_row[bed.chromosome]: self.max_num_row[bed.chromosome] = free_row - print self.max_num_row + print(self.max_num_row) if valid_intervals == 0: sys.stderr.write("No valid intervals were found in file {}".format(self.properties['file_name'])) From a29f0879edb0b9883e138a4744b62515c208bd5e Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 12:08:39 +0100 Subject: [PATCH 7/9] changed configparser --- hicbrowser/tracks2json.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hicbrowser/tracks2json.py b/hicbrowser/tracks2json.py index 71174ae..50fc657 100644 --- a/hicbrowser/tracks2json.py +++ b/hicbrowser/tracks2json.py @@ -154,9 +154,9 @@ def parse_tracks(self, tracks_file): :param tracks_file: file path containing the track configuration :return: array of dictionaries and vlines_file. One dictionary per track """ - from ConfigParser import SafeConfigParser + from configparser import ConfigParser from ast import literal_eval - parser = SafeConfigParser(None, MultiDict) + parser = ConfigParser(None, MultiDict) parser.readfp(open(tracks_file, 'r')) track_list = [] From 77cf084382df3be59983ee952196378bce04b320 Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 12:09:02 +0100 Subject: [PATCH 8/9] interval_tree syntax changed --- hicbrowser/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hicbrowser/views.py b/hicbrowser/views.py index 428dba9..ca1aea5 100644 --- a/hicbrowser/views.py +++ b/hicbrowser/views.py @@ -42,7 +42,7 @@ def get_TAD_for_gene(gene_name): chrom_, start_, end_ = gene2pos[gene_name] if chrom_ not in tads_intval_tree: chrom_ = GenomeTrack.change_chrom_names(chrom_) - tad_pos = sorted(tads_intval_tree[chrom_].search(start_, end_))[0] + tad_pos = sorted(tads_intval_tree[chrom_][start_:end_])[0] return chrom_, tad_pos.begin, tad_pos.end else: return None From cef52774ed5cd0d7cc39185deeca6f2637621e1a Mon Sep 17 00:00:00 2001 From: Lucille Delisle Date: Thu, 12 Dec 2019 12:15:32 +0100 Subject: [PATCH 9/9] undo mistake --- hicbrowser/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hicbrowser/views.py b/hicbrowser/views.py index ca1aea5..47db63c 100644 --- a/hicbrowser/views.py +++ b/hicbrowser/views.py @@ -174,7 +174,7 @@ def main(config_file, port, numProc, template_folder=None, debug=False): sys.stderr.write("Problem with line {}".format(line)) pass gene2pos[gene_name.lower()] = (gene_chrom, gene_start, gene_end) - + @app.route('/', methods=['GET']) def index(): return render_template("index.html") @@ -211,7 +211,6 @@ def get_tad(gene_name): data['tracks'] = d res = json.dumps(data) - res = None return res @app.route('/browser/', methods=['GET'])