# HG changeset patch # User fubar # Date 1690515866 0 # Node ID 449c918bc4cdaa5c577de8457236c4e106bc6544 # Parent 7c166107a2e23cde30ce9761db7d48a166fcfe39 Uploaded diff -r 7c166107a2e2 -r 449c918bc4cd plotly_tabular_tool/README.md --- a/plotly_tabular_tool/README.md Thu Jul 27 22:50:49 2023 +0000 +++ b/plotly_tabular_tool/README.md Fri Jul 28 03:44:26 2023 +0000 @@ -1,10 +1,7 @@ # plotly_tabular_tool -Galaxy tool to create plotly plots from user selected columns of any Galaxy tabular data - -A tailored version for blast outputs is described at https://lazarus.name/demo/ - -Same code really, but with a default header and transformation of the evalue column -log10(x) to make them more like the bitscore +Galaxy tool to create plotly plots from user selected columns of any Galaxy tabular data. +Example interactive plots at https://lazarus.name/demo/ Plotly.express makes a lot of clever design decisions. Unfortunately, it gets totally confused with evalue columns because it thinks scientific notation like 5.00e-204 is a string or something. @@ -12,3 +9,6 @@ Note that all columns used for colour (legend) and the x/y axis tickmarks are truncated because they can squish up the plot. .. is added at the end to show truncation. +A specialised version for 25 column Galaxy blastn search outputs is also available. It uses this code mostly, but adds a default header and auto-transformation of the evalue column -log10(x) to make them more like the bitscore + + diff -r 7c166107a2e2 -r 449c918bc4cd plotly_tabular_tool/iris.xls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plotly_tabular_tool/iris.xls Fri Jul 28 03:44:26 2023 +0000 @@ -0,0 +1,151 @@ + sepal_length sepal_width petal_length petal_width species species_id +0 5.1 3.5 1.4 0.2 setosa 1 +1 4.9 3.0 1.4 0.2 setosa 1 +2 4.7 3.2 1.3 0.2 setosa 1 +3 4.6 3.1 1.5 0.2 setosa 1 +4 5.0 3.6 1.4 0.2 setosa 1 +5 5.4 3.9 1.7 0.4 setosa 1 +6 4.6 3.4 1.4 0.3 setosa 1 +7 5.0 3.4 1.5 0.2 setosa 1 +8 4.4 2.9 1.4 0.2 setosa 1 +9 4.9 3.1 1.5 0.1 setosa 1 +10 5.4 3.7 1.5 0.2 setosa 1 +11 4.8 3.4 1.6 0.2 setosa 1 +12 4.8 3.0 1.4 0.1 setosa 1 +13 4.3 3.0 1.1 0.1 setosa 1 +14 5.8 4.0 1.2 0.2 setosa 1 +15 5.7 4.4 1.5 0.4 setosa 1 +16 5.4 3.9 1.3 0.4 setosa 1 +17 5.1 3.5 1.4 0.3 setosa 1 +18 5.7 3.8 1.7 0.3 setosa 1 +19 5.1 3.8 1.5 0.3 setosa 1 +20 5.4 3.4 1.7 0.2 setosa 1 +21 5.1 3.7 1.5 0.4 setosa 1 +22 4.6 3.6 1.0 0.2 setosa 1 +23 5.1 3.3 1.7 0.5 setosa 1 +24 4.8 3.4 1.9 0.2 setosa 1 +25 5.0 3.0 1.6 0.2 setosa 1 +26 5.0 3.4 1.6 0.4 setosa 1 +27 5.2 3.5 1.5 0.2 setosa 1 +28 5.2 3.4 1.4 0.2 setosa 1 +29 4.7 3.2 1.6 0.2 setosa 1 +30 4.8 3.1 1.6 0.2 setosa 1 +31 5.4 3.4 1.5 0.4 setosa 1 +32 5.2 4.1 1.5 0.1 setosa 1 +33 5.5 4.2 1.4 0.2 setosa 1 +34 4.9 3.1 1.5 0.1 setosa 1 +35 5.0 3.2 1.2 0.2 setosa 1 +36 5.5 3.5 1.3 0.2 setosa 1 +37 4.9 3.1 1.5 0.1 setosa 1 +38 4.4 3.0 1.3 0.2 setosa 1 +39 5.1 3.4 1.5 0.2 setosa 1 +40 5.0 3.5 1.3 0.3 setosa 1 +41 4.5 2.3 1.3 0.3 setosa 1 +42 4.4 3.2 1.3 0.2 setosa 1 +43 5.0 3.5 1.6 0.6 setosa 1 +44 5.1 3.8 1.9 0.4 setosa 1 +45 4.8 3.0 1.4 0.3 setosa 1 +46 5.1 3.8 1.6 0.2 setosa 1 +47 4.6 3.2 1.4 0.2 setosa 1 +48 5.3 3.7 1.5 0.2 setosa 1 +49 5.0 3.3 1.4 0.2 setosa 1 +50 7.0 3.2 4.7 1.4 versicolor 2 +51 6.4 3.2 4.5 1.5 versicolor 2 +52 6.9 3.1 4.9 1.5 versicolor 2 +53 5.5 2.3 4.0 1.3 versicolor 2 +54 6.5 2.8 4.6 1.5 versicolor 2 +55 5.7 2.8 4.5 1.3 versicolor 2 +56 6.3 3.3 4.7 1.6 versicolor 2 +57 4.9 2.4 3.3 1.0 versicolor 2 +58 6.6 2.9 4.6 1.3 versicolor 2 +59 5.2 2.7 3.9 1.4 versicolor 2 +60 5.0 2.0 3.5 1.0 versicolor 2 +61 5.9 3.0 4.2 1.5 versicolor 2 +62 6.0 2.2 4.0 1.0 versicolor 2 +63 6.1 2.9 4.7 1.4 versicolor 2 +64 5.6 2.9 3.6 1.3 versicolor 2 +65 6.7 3.1 4.4 1.4 versicolor 2 +66 5.6 3.0 4.5 1.5 versicolor 2 +67 5.8 2.7 4.1 1.0 versicolor 2 +68 6.2 2.2 4.5 1.5 versicolor 2 +69 5.6 2.5 3.9 1.1 versicolor 2 +70 5.9 3.2 4.8 1.8 versicolor 2 +71 6.1 2.8 4.0 1.3 versicolor 2 +72 6.3 2.5 4.9 1.5 versicolor 2 +73 6.1 2.8 4.7 1.2 versicolor 2 +74 6.4 2.9 4.3 1.3 versicolor 2 +75 6.6 3.0 4.4 1.4 versicolor 2 +76 6.8 2.8 4.8 1.4 versicolor 2 +77 6.7 3.0 5.0 1.7 versicolor 2 +78 6.0 2.9 4.5 1.5 versicolor 2 +79 5.7 2.6 3.5 1.0 versicolor 2 +80 5.5 2.4 3.8 1.1 versicolor 2 +81 5.5 2.4 3.7 1.0 versicolor 2 +82 5.8 2.7 3.9 1.2 versicolor 2 +83 6.0 2.7 5.1 1.6 versicolor 2 +84 5.4 3.0 4.5 1.5 versicolor 2 +85 6.0 3.4 4.5 1.6 versicolor 2 +86 6.7 3.1 4.7 1.5 versicolor 2 +87 6.3 2.3 4.4 1.3 versicolor 2 +88 5.6 3.0 4.1 1.3 versicolor 2 +89 5.5 2.5 4.0 1.3 versicolor 2 +90 5.5 2.6 4.4 1.2 versicolor 2 +91 6.1 3.0 4.6 1.4 versicolor 2 +92 5.8 2.6 4.0 1.2 versicolor 2 +93 5.0 2.3 3.3 1.0 versicolor 2 +94 5.6 2.7 4.2 1.3 versicolor 2 +95 5.7 3.0 4.2 1.2 versicolor 2 +96 5.7 2.9 4.2 1.3 versicolor 2 +97 6.2 2.9 4.3 1.3 versicolor 2 +98 5.1 2.5 3.0 1.1 versicolor 2 +99 5.7 2.8 4.1 1.3 versicolor 2 +100 6.3 3.3 6.0 2.5 virginica 3 +101 5.8 2.7 5.1 1.9 virginica 3 +102 7.1 3.0 5.9 2.1 virginica 3 +103 6.3 2.9 5.6 1.8 virginica 3 +104 6.5 3.0 5.8 2.2 virginica 3 +105 7.6 3.0 6.6 2.1 virginica 3 +106 4.9 2.5 4.5 1.7 virginica 3 +107 7.3 2.9 6.3 1.8 virginica 3 +108 6.7 2.5 5.8 1.8 virginica 3 +109 7.2 3.6 6.1 2.5 virginica 3 +110 6.5 3.2 5.1 2.0 virginica 3 +111 6.4 2.7 5.3 1.9 virginica 3 +112 6.8 3.0 5.5 2.1 virginica 3 +113 5.7 2.5 5.0 2.0 virginica 3 +114 5.8 2.8 5.1 2.4 virginica 3 +115 6.4 3.2 5.3 2.3 virginica 3 +116 6.5 3.0 5.5 1.8 virginica 3 +117 7.7 3.8 6.7 2.2 virginica 3 +118 7.7 2.6 6.9 2.3 virginica 3 +119 6.0 2.2 5.0 1.5 virginica 3 +120 6.9 3.2 5.7 2.3 virginica 3 +121 5.6 2.8 4.9 2.0 virginica 3 +122 7.7 2.8 6.7 2.0 virginica 3 +123 6.3 2.7 4.9 1.8 virginica 3 +124 6.7 3.3 5.7 2.1 virginica 3 +125 7.2 3.2 6.0 1.8 virginica 3 +126 6.2 2.8 4.8 1.8 virginica 3 +127 6.1 3.0 4.9 1.8 virginica 3 +128 6.4 2.8 5.6 2.1 virginica 3 +129 7.2 3.0 5.8 1.6 virginica 3 +130 7.4 2.8 6.1 1.9 virginica 3 +131 7.9 3.8 6.4 2.0 virginica 3 +132 6.4 2.8 5.6 2.2 virginica 3 +133 6.3 2.8 5.1 1.5 virginica 3 +134 6.1 2.6 5.6 1.4 virginica 3 +135 7.7 3.0 6.1 2.3 virginica 3 +136 6.3 3.4 5.6 2.4 virginica 3 +137 6.4 3.1 5.5 1.8 virginica 3 +138 6.0 3.0 4.8 1.8 virginica 3 +139 6.9 3.1 5.4 2.1 virginica 3 +140 6.7 3.1 5.6 2.4 virginica 3 +141 6.9 3.1 5.1 2.3 virginica 3 +142 5.8 2.7 5.1 1.9 virginica 3 +143 6.8 3.2 5.9 2.3 virginica 3 +144 6.7 3.3 5.7 2.5 virginica 3 +145 6.7 3.0 5.2 2.3 virginica 3 +146 6.3 2.5 5.0 1.9 virginica 3 +147 6.5 3.0 5.2 2.0 virginica 3 +148 6.2 3.4 5.4 2.3 virginica 3 +149 5.9 3.0 5.1 1.8 virginica 3 diff -r 7c166107a2e2 -r 449c918bc4cd plotly_tabular_tool/plotly_tabular_iris.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plotly_tabular_tool/plotly_tabular_iris.html Fri Jul 28 03:44:26 2023 +0000 @@ -0,0 +1,14 @@ + +
+ +0?[0]:[]);if(o.enter().append("g").classed(f.containerClassName,!0).style("cursor","pointer"),o.exit().each((function(){n.select(this).selectAll("g."+f.headerGroupClassName).each(a)})).remove(),0!==r.length){var l=o.selectAll("g."+f.headerGroupClassName).data(r,p);l.enter().append("g").classed(f.headerGroupClassName,!0);for(var u=s.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(t){t.style("pointer-events","all")})),c=0;c 90&&i.log("Long binary search..."),h-1},e.sorterAsc=function(t,e){return t-e},e.sorterDes=function(t,e){return e-t},e.distinctVals=function(t){var r,n=t.slice();for(n.sort(e.sorterAsc),r=n.length-1;r>-1&&n[r]===o;r--);for(var i,a=n[r]-n[0]||1,s=a/(r||1)/1e4,l=[],u=0;u<=r;u++){var c=n[u],f=c-i;void 0===i?(l.push(c),i=c):f>s&&(a=Math.min(a,f),l.push(c),i=c)}return{vals:l,minDiff:a}},e.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;i0&&(n=1),r&&n)return t.sort(e)}return n?t:t.reverse()},e.findIndexOfMin=function(t,e){e=e||a;for(var r,n=1/0,i=0;il?r.y-l:0;return Math.sqrt(u*u+f*f)}for(var p=h(u);p;){if((u+=p+r)>f)return;p=h(u)}for(p=h(f);p;){if(u>(f-=p+r))return;p=h(f)}return{min:u,max:f,len:f-u,total:c,isClosed:0===u&&f===c&&Math.abs(n.x-i.x)<.1&&Math.abs(n.y-i.y)<.1}},e.findPointOnPath=function(t,e,r,n){for(var i,a,o,s=(n=n||{}).pathLength||t.getTotalLength(),l=n.tolerance||.001,u=n.iterationLimit||30,c=t.getPointAtLength(0)[r]>t.getPointAtLength(s)[r]?-1:1,f=0,h=0,p=s;f0?p=i:h=i,f++}return a}},81697:function(t,e,r){"use strict";var n=r(92770),i=r(84267),a=r(25075),o=r(21081),s=r(22399).defaultLine,l=r(73627).isArrayOrTypedArray,u=a(s);function c(t,e){var r=t;return r[3]*=e,r}function f(t){if(n(t))return u;var e=a(t);return e.length?e:u}function h(t){return n(t)?t:1}t.exports={formatColor:function(t,e,r){var n,i,s,p,d,v=t.color,g=l(v),y=l(e),m=o.extractOpts(t),x=[];if(n=void 0!==m.colorscale?o.makeColorScaleFuncFromTrace(t):f,i=g?function(t,e){return void 0===t[e]?u:a(n(t[e]))}:f,s=y?function(t,e){return void 0===t[e]?1:h(t[e])}:h,g||y)for(var b=0;b
/i;e.BR_TAG_ALL=/
/gi;var _=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,w=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,T=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,k=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function A(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&L(n)}var M=/(^|;)\s*color:/;e.plainText=function(t,e){for(var r=void 0!==(e=e||{}).len&&-1!==e.len?e.len:1/0,n=void 0!==e.allowedTags?e.allowedTags:["br"],i=t.split(m),a=[],o="",s=0,l=0;l
"+l;e.text=u}(t,o,r,u):"log"===c?function(t,e,r,n,a){var o=t.dtick,l=e.x,u=t.tickformat,c="string"==typeof o&&o.charAt(0);if("never"===a&&(a=""),n&&"L"!==c&&(o="L3",c="L"),u||"L"===c)e.text=bt(Math.pow(10,l),t,a,n);else if(i(o)||"D"===c&&s.mod(l+.01,1)<.1){var f=Math.round(l),h=Math.abs(f),p=t.exponentformat;"power"===p||mt(p)&&xt(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":P)+h+"",e.fontSize*=1.25):("e"===p||"E"===p)&&h>2?e.text="1"+p+(f>0?"+":P)+h:(e.text=bt(Math.pow(10,l),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==c)throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,s.mod(l,1)))),e.fontSize*=.75}if("D1"===t.dtick){var d=String(e.text).charAt(0);"0"!==d&&"1"!==d||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(l<0?.5:.25)))}}(t,o,0,u,v):"category"===c?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}(t,o):"multicategory"===c?function(t,e,r){var n=Math.round(e.x),i=t._categories[n]||[],a=void 0===i[1]?"":String(i[1]),o=void 0===i[0]?"":String(i[0]);r?e.text=o+" - "+a:(e.text=a,e.text2=o)}(t,o,r):Dt(t)?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=bt(e.x,t,i,n);else{var a=e.x/180;if(0===a)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){for(var r=1;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,i=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/i),Math.round(r/i)]}(a);if(o[1]>=100)e.text=bt(s.deg2rad(e.x),t,i,n);else{var l=e.x<0;1===o[1]?1===o[0]?e.text="π":e.text=o[0]+"π":e.text=["",o[0],"","⁄","",o[1],"","π"].join(""),l&&(e.text=P+e.text)}}}}(t,o,r,u,v):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=bt(e.x,t,i,n)}(t,o,0,u,v),n||(t.tickprefix&&!d(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!d(t.showticksuffix)&&(o.text+=t.ticksuffix)),t.labelalias&&t.labelalias.hasOwnProperty(o.text)){var g=t.labelalias[o.text];"string"==typeof g&&(o.text=g)}if("boundaries"===t.tickson||t.showdividers){var y=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[y(o.x-.5),y(o.x+t.dtick-.5)]}return o},q.hoverLabelText=function(t,e,r){r&&(t=s.extendFlat({},t,{hoverformat:r}));var n=Array.isArray(e)?e[0]:e,i=Array.isArray(e)?e[1]:void 0;if(void 0!==i&&i!==n)return q.hoverLabelText(t,n,r)+" - "+q.hoverLabelText(t,i,r);var a="log"===t.type&&n<=0,o=q.tickText(t,t.c2l(a?-n:n),"hover").text;return a?0===n?"0":P+o:o};var yt=["f","p","n","μ","m","","k","M","G","T"];function mt(t){return"SI"===t||"B"===t}function xt(t){return t>14||t<-15}function bt(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=q.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,minexponent:e.minexponent,dtick:"none"===e.showexponent?e.dtick:i(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};vt(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,P);var p,d=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))
")):x=h.textLabel;var L={x:h.traceCoordinate[0],y:h.traceCoordinate[1],z:h.traceCoordinate[2],data:w._input,fullData:w,curveNumber:w.index,pointNumber:T};d.appendArrayPointValue(L,w,T),t._module.eventData&&(L=w._module.eventData(L,h,w,{},T));var C={points:[L]};if(e.fullSceneLayout.hovermode){var P=[];d.loneHover({trace:w,x:(.5+.5*m[0]/m[3])*s,y:(.5-.5*m[1]/m[3])*l,xLabel:k.xLabel,yLabel:k.yLabel,zLabel:k.zLabel,text:x,name:c.name,color:d.castHoverOption(w,T,"bgcolor")||c.color,borderColor:d.castHoverOption(w,T,"bordercolor"),fontFamily:d.castHoverOption(w,T,"font.family"),fontSize:d.castHoverOption(w,T,"font.size"),fontColor:d.castHoverOption(w,T,"font.color"),nameLength:d.castHoverOption(w,T,"namelength"),textAlign:d.castHoverOption(w,T,"align"),hovertemplate:f.castOption(w,T,"hovertemplate"),hovertemplateLabels:f.extendFlat({},L,k),eventData:[L]},{container:n,gd:r,inOut_bbox:P}),L.bbox=P[0]}h.distance<5&&(h.buttons||_)?r.emit("plotly_click",C):r.emit("plotly_hover",C),this.oldEventData=C}else d.loneUnhover(n),this.oldEventData&&r.emit("plotly_unhover",this.oldEventData),this.oldEventData=void 0;e.drawAnnotations(e)},T.recoverContext=function(){var t=this;t.glplot.dispose();var e=function(){t.glplot.gl.isContextLost()?requestAnimationFrame(e):t.initializeGLPlot()?t.plot.apply(t,t.plotArgs):f.error("Catastrophic and unrecoverable WebGL error. Context lost.")};requestAnimationFrame(e)};var A=["xaxis","yaxis","zaxis"];function M(t,e,r){for(var n=t.fullSceneLayout,i=0;i<3;i++){var a=A[i],o=a.charAt(0),s=n[a],l=e[o],u=e[o+"calendar"],c=e["_"+o+"length"];if(f.isArrayOrTypedArray(l))for(var h,p=0;p<(c||l.length);p++)if(f.isArrayOrTypedArray(l[p]))for(var d=0;d
");b.text(T).attr("data-unformatted",T).call(f.convertToTspans,t),_=c.bBox(b.node())}b.attr("transform",a(-3,8-_.height)),x.insert("rect",".static-attribution").attr({x:-_.width-6,y:-_.height-3,width:_.width+6,height:_.height+3,fill:"rgba(255, 255, 255, 0.75)"});var k=1;_.width+6>w&&(k=w/(_.width+6));var A=[n.l+n.w*h.x[1],n.t+n.h*(1-h.y[0])];x.attr("transform",a(A[0],A[1])+o(k))}},e.updateFx=function(t){for(var e=t._fullLayout,r=e._subplots[p],n=0;n
")}(e,r,n,i):v.getValue(s.text,r),v.coerceString(m,o)}(C,n,i,T,M);w=function(t,e){var r=v.getValue(t.textposition,e);return v.coerceEnumerated(x,r)}(O,i);var z="stack"===g.mode||"relative"===g.mode,R=n[i],F=!z||R._outmost;if(D&&"none"!==w&&(!R.isBlank&&s!==u&&f!==p||"auto"!==w&&"inside"!==w)){var B=C.font,N=d.getBarColor(n[i],O),j=d.getInsideTextFont(O,i,B,N),U=d.getOutsideTextFont(O,i,B),V=r.datum();I?"log"===T.type&&V.s0<=0&&(s=T.range[0]