@datagrok/helm 2.1.19 → 2.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -13,6 +13,8 @@
13
13
  * Prevent display tooltip by fallback cell renderer while WebEditor renders.
14
14
  * Reset monomer placer on monomer lib changed.
15
15
  * Fix Pistoia Helm WebEditor settings for case-sensitive monomer libs.
16
+ * Fix cell renderer monomer tooltip for polymer type
17
+ * Patch WebEditor hanging on getTextWidth
16
18
 
17
19
  ## 2.1.16 (2023-07-21)
18
20
 
@@ -1,2 +1,2 @@
1
- var helm_test;(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{_package:()=>B,test:()=>J,tests:()=>i});const n=DG,r=grok;var s=function(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};const o=3e4,i={},a="Auto Tests",l={};let c;var u;!function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(u||(u={}));class g{constructor(e,t){this.catchUnhandled=!0,this.report=!1,void 0!==e&&(this.catchUnhandled=e),void 0!==t&&(this.report=t)}}class d{constructor(e,t,n,r){var i;this.category=e,this.name=t,null!=r||(r={}),null!==(i=r.timeout)&&void 0!==i||(r.timeout=o),this.options=r,this.test=()=>s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>s(this,void 0,void 0,(function*(){let r="";try{r=yield n()}catch(e){t(e)}e(r)}))))}))}}function C(e,t,n){null==i[c]&&(i[c]={}),null==i[c].tests&&(i[c].tests=[]),i[c].tests.push(new d(c,e,t,n))}function f(e,t=!0,n){if(n=n?`${n}, `:"",e!==t)throw new Error(`${n}Expected "${t}", got "${e}"`)}function h(e,t,n=.001,r){if(e===Number.POSITIVE_INFINITY&&t===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY&&t===Number.NEGATIVE_INFINITY||e===Number.NaN&&t===Number.NaN||isNaN(e)&&isNaN(t))return;const s=Math.abs(e-t)<n;if(f(s,!0,`${null!=r?r:""} (tolerance = ${n})`),!s)throw new Error(`Expected ${t}, got ${e} (tolerance = ${n})`)}function p(e,t){for(const[n,r]of Object.entries(t)){if(!e.hasOwnProperty(n))throw new Error(`Expected property "${n}" not found`);const t=e[n];if(t instanceof Array&&r instanceof Array)m(t,r);else if(t instanceof Object&&r instanceof Object)p(t,r);else if(Number.isFinite(t)&&Number.isFinite(r))h(t,r);else if(t!=r)throw new Error(`Expected (${r}) for key '${n}', got (${t})`)}}function m(e,t){const n=e.length,r=t.length;if(n!=r)throw new Error(`Arrays are of different length: actual array length is ${n} and expected array length is ${r}`);for(let r=0;r<n;r++)if(e[r]instanceof Array&&t[r]instanceof Array)m(e[r],t[r]);else if(e[r]instanceof Object&&t[r]instanceof Object)p(e[r],t[r]);else if(e[r]!=t[r])throw new Error(`Expected ${t[r]} at position ${r}, got ${e[r]}`)}function b(e,t,n){var r;c=e,t(),i[c]&&(i[c].clear=null===(r=null==n?void 0:n.clear)||void 0===r||r,i[c].timeout=null==n?void 0:n.timeout)}function E(e){null==i[c]&&(i[c]={}),i[c].before=e}function A(e){null==i[c]&&(i[c]={}),i[c].after=e}function y(e,t){return e.replace(new RegExp(t.name,"gi"),t.nqName)}function N(e,t,i,a){var l,c,u,g,d;return s(this,void 0,void 0,(function*(){let s;const C=null!=t&&e.name.toLowerCase()!==t.toLowerCase(),f=(null===(l=e.options)||void 0===l?void 0:l.skipReason)||C,h=C?"skipped":null===(c=e.options)||void 0===c?void 0:c.skipReason;f||console.log(`Started ${e.category} ${e.name}`);const p=new Date;try{if(f)s={success:!0,result:h,ms:0,skipped:!0};else{let t=(null===(u=e.options)||void 0===u?void 0:u.timeout)===o&&i?i:null===(g=e.options)||void 0===g?void 0:g.timeout;t=n.Test.isInBenchmark&&t===o?108e5:t,s={success:!0,result:null!==(d=yield O(e.test,t))&&void 0!==d?d:"OK",ms:0,skipped:!1}}}catch(e){s={success:!1,result:e.toString(),ms:0,skipped:!1}}const m=new Date;if(s.ms=m-p,f||console.log(`Finished ${e.category} ${e.name} for ${s.ms} ms`),s.category=e.category,s.name=e.name,!C){let t={success:s.success,result:s.result,ms:s.ms,skipped:s.skipped,type:"package",packageName:a,category:e.category,test:e.name};if(s.result.constructor==Object){const e=Object.keys(s.result).reduce(((e,t)=>Object.assign(Object.assign({},e),{["result."+t]:s.result[t]})),{});t=Object.assign(Object.assign({},t),e)}r.log.usage(`${a}: ${e.category}: ${e.name}`,t,`test-package ${a}: ${e.category}: ${e.name}`)}return s}))}function v(e){return s(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}function O(e,t){return s(this,void 0,void 0,(function*(){let n=null;const r=new Promise(((e,r)=>{n=setTimeout((()=>{r("EXECUTION TIMEOUT")}),t)}));try{return yield Promise.race([e(),r])}finally{n&&clearTimeout(n)}}))}function T(e){e=w(e,"$")[0];const t=[];if(!scil.Utils.isNullOrEmpty(e)){const n=w(e,"|");for(let r=0;r<n.length;++r){let s=(e=P(n[r]).str).indexOf("{");s=(e=e.substring(s+1)).indexOf("}");const o=w(e=e.substring(0,s),".");for(const e of o)if(e&&""!==e)if(e.startsWith("[")&&e.includes("]")){const n=e.substring(1,e.indexOf("]"));t.push(n);const r=e.substring(e.indexOf("]")+1);o.push(r)}else if(e.includes("[")&&e.endsWith("]")){const n=e.substring(e.lastIndexOf("[")+1,e.length-1);t.push(n);const r=e.substring(0,e.lastIndexOf("["));o.push(r)}else if(e.includes("(")&&e.includes(")")){const t=e.substring(0,e.indexOf("(")),n=e.substring(e.lastIndexOf(")")+1),r=[t,e.substring(t.length+1,e.length-n.length-1),n];for(const e of r)o.push(e)}else t.push(e)}}return t}function w(e,t){const n=[];let r="",s=0,o=0,i=0,a=0;for(let l=0;l<e.length;++l){let c=e.substring(l,l+1);if(c==t&&0==o&&0==s&&0==i&&0==a)n.push(r),r="";else{if(r+=c,a>0&&"\\"==c&&l+1<e.length){++l;const t=e.substring(l,l+1);r+=t,c+=t}'"'==c?l>0&&"\\"==e.substring(l-1,l)||(a=0==a?1:0):"["==c?++o:"]"==c?--o:"("==c?++s:")"==c?--s:"{"==c?++i:"}"==c&&--i}}return n.push(r),n}function P(e){const t=S(e,'"');if(null!=t.tag)return t;const n=S(e,"'");return{tag:t.tag,repeat:n.tag,str:n.str}}function S(e,t){let n=null;if(scil.Utils.endswith(e,t)){let r=e.length-1;for(;r>0&&(r=e.lastIndexOf(t,r-1),!(r<=0||"\\"!=e.substring(r-1,r))););r>0&&r<e.length-1&&(n=e.substring(r+1,e.length-1),e=e.substring(0,r))}return null!=n&&(n=function(e){return scil.Utils.isNullOrEmpty(e)?e:e.replace(/[\\]./g,(function(e){switch(e){case"\\r":return"\r";case"\\n":return"\n";case"\\t":return"\t";default:return e.substring(1)}}))}(n.replace(new RegExp("\\"+t,"g"),t))),{tag:n,str:e}}var I,k,H=function(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};b("Helm",(()=>{const e=[["L-hArg(Et,Et)","E","F","G","C","E"],["L-hArg(Et,Et)","L-hArg(Et,Et)","E","F","G"],["dhp","m1A","p","r","T","p","r","T","p","r","G","p"],["r","mo6pur","p","r","T","p","r","T","p","r","G","p"],["afhna","mo6pur","36SS","r","T","p"]],t=["comples-monomer","complex-monomer+side-chain","complex-monomer+side-chain-RNA","complex-side-chain","complex+side-chain+linker"];C("parseHelm",(()=>H(void 0,void 0,void 0,(function*(){const e=[["meI","hHis","Aca","N","T","dK","Thr_PO3H2","D-Tyr_Et","Aze","dV","E","Phe_4Me"],["A","C","T","G","W","E","Q"],["R","U","P","T","A"],["A","*","G","C"]],t=["PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.Aze.dV.E.N.dV.Phe_4Me}$$$","PEPTIDE1{A.C.T.G.C.T.W.G.T.W.E.C.W.C.Q.W}|PEPTIDE2{A.C.T.G.C.T.W.G.T.W.E.Q}$PEPTIDE1,PEPTIDE1,5:R3-14:R3|PEPTIDE2,PEPTIDE1,2:R3-12:R3$$$","RNA1{R(U)P.R(T)P}|RNA2{P.R(A)P.R(A)}$RNA1,RNA2,2:pair-6:pair|RNA1,RNA2,5:pair-3:pair$$$","PEPTIDE1{A.*.G.C}$$$$V2.0"];for(let n=0;n<t.length;++n){const r=new Set(T(t[n])),s=Array.from(r);f(JSON.stringify(s),JSON.stringify(e[n]))}})))),["PEPTIDE1{[L-hArg(Et,Et)].E.F.G}|PEPTIDE2{C.E}$PEPTIDE1,PEPTIDE2,2:R3-1:R1$$$V2.0","PEPTIDE1{[L-hArg(Et,Et)]([L-hArg(Et,Et)]).E.F.G}$$$$","RNA1{[dhp]([m1A])p.r(T)p.r(T)p.r(G)p}$$$$V2.0","RNA1{r([mo6pur])p.r(T)p.r(T)p.r(G)p}$$$$V2.0","RNA1{[afhna]([mo6pur])[36SS].r(T)p}$$$$V2.0"].forEach(((n,r)=>{C(t[r],(()=>H(void 0,void 0,void 0,(function*(){const t=T(n);t.sort();const s=e[r];s.sort(),m(t,s)}))))}))})),wu;class M{constructor(e,t,n){this.name=e,this.alphabet=t,this.cutoff=n}}(k=I||(I={})).FASTA="fasta",k.SEPARATOR="separator",k.HELM="helm";const L=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}};new M("PT",L.fasta.peptide,.5),new M("DNA",L.fasta.dna,.55),new M("RNA",L.fasta.rna,.55),Float32Array;class G{static makePalette(e,t=!1,n=G){const r={};return e.forEach((e=>{const n=e[0],s=e[1];n.forEach(((e,n)=>{r[e]=this.colourPalette[s][t?0:n]}))})),new n(r)}constructor(e){this._palette=e}get(e){return this._palette[e]}}G.undefinedColor="rgb(100,100,100)",G.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]};class R extends G{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,R)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,R)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new R({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(e){const t=e in R.aaSynonyms?R.aaSynonyms[e]:e;return super.get(t)}}R.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class D{static getPalette(e="grok"){switch(e){case"grok":return R.GrokGroups;case"lesk":return R.Lesk;default:throw new Error(`ChemPalette: scheme \`${e}\` does not exist`)}}static getInnerOuter(e){let t=0,n="",r="";for(const s of e)"("==s?t++:")"==s?t--:t?n+=s:r+=s;return isNaN(parseInt(n))?[r,n]:[r,""]}static getColorAAPivot(e="",t="grok"){const n=this.getPalette(t);let[r,s]=this.getInnerOuter(e);if(r=r.length>6?`${r.slice(0,3)}...`:r,s=s.length>6?`${s.slice(0,3)}...`:s,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in n?[n.get(t),t,s,1]:[this.undefinedColor,r,s,1]}if("d"==e[0]&&e[1]in n&&(2==e.length||"("==e[2])){const t=e[1]?.toUpperCase();return t in n?[n.get(t),t,s,2]:[this.undefinedColor,r,s,2]}if(e.substring(0,3)in this.AAFullNames&&(3==e.length||"("==e[3])){const t=this.AAFullNames[e.substring(0,3)];return t in n?[n.get(t),t,s,3]:[this.undefinedColor,r,s,3]}if(e[0]?.toLowerCase()==e[0]&&e.substring(1,3)in this.AAFullNames&&(4==e.length||"("==e[4])){const t=this.AAFullNames[e.substring(1,3)];return t in n?[n.get(t),t,s,4]:[this.undefinedColor,r,s,4]}return[this.undefinedColor,r,s,0]}}D.SemType="Aminoacids",D.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",D.undefinedColor="rgb(100,100,100)",D.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},D.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},D.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},D.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"};class x{}x.SemType="Nucleotides",x.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",x.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};class F extends class{}{static buildPalette(){return[].concat(...Object.values(G.colourPalette))}get(e){const t=class{static hashCode(e){let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}}.hashCode(e)%F.palette.length;return function(e){if(null==e)return"rgb(100,100,100)";const t=n.Color.fromHtml(e),r=n.Color.g(t),s=n.Color.r(t),o=n.Color.b(t),i=Math.sqrt(Math.pow(0-s,2)+Math.pow(0-r,2)+Math.pow(0-o,2));return i>210?`rgb(${s/i*210},${r/i*210},${o/i*210})`:n.Color.toRgb(t)}(F.palette[t])}}F.palette=F.buildPalette();new Uint32Array(65536);var _,V;(V=_||(_={})).HAMMING="Hamming",V.LEVENSHTEIN="Levenshtein",V.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",_.HAMMING,_.LEVENSHTEIN,_.NEEDLEMANN_WUNSCH,new class{constructor(){this.uhTemp=`units-handler.${n.SEMTYPE.MACROMOLECULE}`}},I.FASTA,I.SEPARATOR,I.HELM;var j=function(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};const W="Libraries",U={"HELMCoreLibrary.json":"HELMCoreLibrary.json"};b("findMonomers",(()=>{let e,t=null;E((()=>j(void 0,void 0,void 0,(function*(){e=yield async function(){const e=n.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===e.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await e[0].prepare().call()).getOutputParamValue()}(),t=yield r.dapi.userDataStorage.get(W,!0),yield r.dapi.userDataStorage.post(W,U,!0),yield e.loadLibraries(!0)})))),A((()=>j(void 0,void 0,void 0,(function*(){yield r.dapi.userDataStorage.put(W,t,!0)}))));const s={withoutMissed:{test:"PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et}$$$$",tgt:new Set},withMissed:{test:"PEPTIDE1{meI.missed2.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et}$$$$",tgt:new Set(["missed2"])}};for(const[e,t]of Object.entries(s))C(e,(()=>j(void 0,void 0,void 0,(function*(){o(t.test,t.tgt)}))));function o(e,t){p(function(e){const t=Object.keys(org.helm.webeditor.monomerTypeList()),n=[],r=[];for(let e=0;e<t.length;e++)n.push(new scil.helm.Monomers.getMonomerSet(t[e])),Object.keys(n[e]).forEach((t=>{r.push(n[e][t].id)}));return new Set(e.filter((e=>!r.includes(e))))}(T(e)),t)}}));const Y=$;var K=e.n(Y),Q=function(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};b("renderers",(()=>{C("missedInLib",(()=>Q(void 0,void 0,void 0,(function*(){yield function(){return Q(this,void 0,void 0,(function*(){const e=yield r.dapi.files.readCsv("System:AppData/Helm/tests/sample_HELM-missedInLib.csv"),t=e.getCol("HELM"),o=r.shell.addTableView(e);yield function(e,t="Timeout exceeded",n=500,r=50){return s(this,void 0,void 0,(function*(){return new Promise(((s,o)=>{setTimeout((()=>{clearInterval(i),o(new Error(t))}),n);const i=setInterval((()=>{e()&&(clearInterval(i),s())}),r)}))}))}((()=>K()(o.root).find(".d4-grid canvas").length>0),"Table view canvas not found",100),f(t.semType,n.SEMTYPE.MACROMOLECULE),f(t.getTag(n.TAGS.UNITS),I.HELM),f(t.getTag(n.TAGS.CELL_RENDERER),"helm");const i=t.getTag(".cell-renderer.render.error");if(i){const e=JSON.parse(i),t=new Error(e.message);throw t.stack=e.stack,t}}))}()}))))}));const B=new n.Package;function J(e,t,o){return c=this,u=void 0,f=function*(){const c=yield function(e){var t,o,c,u,C;return s(this,void 0,void 0,(function*(){const f=null===(o=null===(t=r.functions.getCurrentCall())||void 0===t?void 0:t.func)||void 0===o?void 0:o.package;yield function(e,t){return s(this,void 0,void 0,(function*(){if(l[e])return;const t=i;if(void 0!==t["Auto Tests"]||Object.keys(t).find((e=>e.startsWith(a))))return void(l[e]=!0);const n=[],o=yield r.dapi.functions.filter(`package.id = "${e}"`).list(),c=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)/g);for(const e of o){const o=e.options.test;if(o&&Array.isArray(o)&&o.length)for(let i=0;i<o.length;i++){const l=o[i].matchAll(c),u={};Array.from(l).forEach((e=>{e[0].startsWith("skip")?u.skip=e[1]:e[0].startsWith("wait")?u.wait=parseInt(e[2]):e[0].startsWith("cat")&&(u.cat=e[3])}));const g=new d(a,1===o.length?e.name:`${e.name} ${i+1}`,(()=>s(this,void 0,void 0,(function*(){const t=yield r.functions.eval(y(o[i],e));if(u.wait&&(yield v(u.wait)),"boolean"==typeof t&&!t)throw`Failed: ${o[i]}, expected true, got ${t}`}))),{skipReason:u.skip});if(u.cat){const e="Auto Tests: "+u.cat;g.category=e,void 0===t[e]&&(t[e]={tests:[],clear:!0}),t[e].tests.push(g)}else n.push(g)}}l[e]=!0,n.length&&(t["Auto Tests"]={tests:n,clear:!0})}))}(f.id);const h=[];console.log("Running tests"),null!=e||(e={}),null!==(c=(C=e).testContext)&&void 0!==c||(C.testContext=new g),r.shell.lastError="";for(const[t,s]of Object.entries(i)){if(null!=(null==e?void 0:e.category)&&!t.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase()))continue;console.log(`Started ${t} category`);try{s.before&&(yield s.before())}catch(e){s.beforeStatus=e.toString()}const o=null!==(u=s.tests)&&void 0!==u?u:[],i=[];if(s.clear)for(let t=0;t<o.length;t++)i.push(yield N(o[t],null==e?void 0:e.test,s.timeout,f.name)),r.shell.closeAll(),n.Balloon.closeAll();else for(let t=0;t<o.length;t++)i.push(yield N(o[t],null==e?void 0:e.test,s.timeout,f.name));const a=(yield Promise.all(i)).filter((e=>"skipped"!=e.result));try{s.after&&(yield s.after())}catch(e){s.afterStatus=e.toString()}s.afterStatus&&a.push({category:t,name:"init",result:s.afterStatus,success:!1,ms:0,skipped:!1}),s.beforeStatus&&a.push({category:t,name:"init",result:s.beforeStatus,success:!1,ms:0,skipped:!1}),h.push(...a)}if(e.testContext.catchUnhandled&&(yield v(1e3),r.shell.lastError.length>0&&h.push({category:"Unhandled exceptions",name:"exceptions",result:r.shell.lastError,success:!1,ms:0,skipped:!1})),e.testContext.report){const e=new n.Logger,t=h.filter((e=>e.success)).length,r=h.filter((e=>e.skipped)).length,s=h.filter((e=>!e.success)),o="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",i={successful:t,skipped:r,failed:s.length,package:f};for(const e of s)Object.assign(i,{[`${e.category} | ${e.name}`]:e.result});e.log(o,i,"package-tested")}return h}))}({category:e,test:t,testContext:o});return n.DataFrame.fromObjects(c)},new((C=void 0)||(C=Promise))((function(e,t){function n(e){try{s(f.next(e))}catch(e){t(e)}}function r(e){try{s(f.throw(e))}catch(e){t(e)}}function s(t){var s;t.done?e(t.value):(s=t.value,s instanceof C?s:new C((function(e){e(s)}))).then(n,r)}s((f=f.apply(c,u||[])).next())}));var c,u,C,f}helm_test=t})();
1
+ var helm_test;(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{_package:()=>B,test:()=>J,tests:()=>i});const n=DG,r=grok;var s=function(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};const o=3e4,i={},a="Auto Tests",l={};let c;var u;!function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(u||(u={}));class g{constructor(e,t){this.catchUnhandled=!0,this.report=!1,void 0!==e&&(this.catchUnhandled=e),void 0!==t&&(this.report=t)}}class d{constructor(e,t,n,r){var i;this.category=e,this.name=t,null!=r||(r={}),null!==(i=r.timeout)&&void 0!==i||(r.timeout=o),this.options=r,this.test=()=>s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>s(this,void 0,void 0,(function*(){let r="";try{r=yield n()}catch(e){t(e)}e(r)}))))}))}}function C(e,t,n){null==i[c]&&(i[c]={}),null==i[c].tests&&(i[c].tests=[]),i[c].tests.push(new d(c,e,t,n))}function f(e,t=!0,n){if(n=n?`${n}, `:"",e!==t)throw new Error(`${n}Expected "${t}", got "${e}"`)}function h(e,t,n=.001,r){if(e===Number.POSITIVE_INFINITY&&t===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY&&t===Number.NEGATIVE_INFINITY||e===Number.NaN&&t===Number.NaN||isNaN(e)&&isNaN(t))return;const s=Math.abs(e-t)<n;if(f(s,!0,`${null!=r?r:""} (tolerance = ${n})`),!s)throw new Error(`Expected ${t}, got ${e} (tolerance = ${n})`)}function p(e,t){for(const[n,r]of Object.entries(t)){if(!e.hasOwnProperty(n))throw new Error(`Expected property "${n}" not found`);const t=e[n];if(t instanceof Array&&r instanceof Array)m(t,r);else if(t instanceof Object&&r instanceof Object)p(t,r);else if(Number.isFinite(t)&&Number.isFinite(r))h(t,r);else if(t!=r)throw new Error(`Expected (${r}) for key '${n}', got (${t})`)}}function m(e,t){const n=e.length,r=t.length;if(n!=r)throw new Error(`Arrays are of different length: actual array length is ${n} and expected array length is ${r}`);for(let r=0;r<n;r++)if(e[r]instanceof Array&&t[r]instanceof Array)m(e[r],t[r]);else if(e[r]instanceof Object&&t[r]instanceof Object)p(e[r],t[r]);else if(e[r]!=t[r])throw new Error(`Expected ${t[r]} at position ${r}, got ${e[r]}`)}function E(e,t,n){var r;c=e,t(),i[c]&&(i[c].clear=null===(r=null==n?void 0:n.clear)||void 0===r||r,i[c].timeout=null==n?void 0:n.timeout)}function b(e){null==i[c]&&(i[c]={}),i[c].before=e}function A(e){null==i[c]&&(i[c]={}),i[c].after=e}function y(e,t){return e.replace(new RegExp(t.name,"gi"),t.nqName)}function N(e,t,i,a){var l,c,u,g,d;return s(this,void 0,void 0,(function*(){let s;const C=null!=t&&e.name.toLowerCase()!==t.toLowerCase(),f=(null===(l=e.options)||void 0===l?void 0:l.skipReason)||C,h=C?"skipped":null===(c=e.options)||void 0===c?void 0:c.skipReason;f||console.log(`Started ${e.category} ${e.name}`);const p=new Date;try{if(f)s={success:!0,result:h,ms:0,skipped:!0};else{let t=(null===(u=e.options)||void 0===u?void 0:u.timeout)===o&&i?i:null===(g=e.options)||void 0===g?void 0:g.timeout;t=n.Test.isInBenchmark&&t===o?108e5:t,s={success:!0,result:null!==(d=yield v(e.test,t))&&void 0!==d?d:"OK",ms:0,skipped:!1}}}catch(e){s={success:!1,result:e.toString(),ms:0,skipped:!1}}const m=new Date;if(s.ms=m-p,f||console.log(`Finished ${e.category} ${e.name} for ${s.ms} ms`),s.category=e.category,s.name=e.name,!C){let t={success:s.success,result:s.result,ms:s.ms,skipped:s.skipped,type:"package",packageName:a,category:e.category,test:e.name};if(s.result.constructor==Object){const e=Object.keys(s.result).reduce(((e,t)=>Object.assign(Object.assign({},e),{["result."+t]:s.result[t]})),{});t=Object.assign(Object.assign({},t),e)}r.log.usage(`${a}: ${e.category}: ${e.name}`,t,`test-package ${a}: ${e.category}: ${e.name}`)}return s}))}function O(e){return s(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}function v(e,t){return s(this,void 0,void 0,(function*(){let n=null;const r=new Promise(((e,r)=>{n=setTimeout((()=>{r("EXECUTION TIMEOUT")}),t)}));try{return yield Promise.race([e(),r])}finally{n&&clearTimeout(n)}}))}function T(e){e=w(e,"$")[0];const t=[];if(!scil.Utils.isNullOrEmpty(e)){const n=w(e,"|");for(let r=0;r<n.length;++r){let s=(e=P(n[r]).str).indexOf("{");s=(e=e.substring(s+1)).indexOf("}");const o=w(e=e.substring(0,s),".");for(const e of o)if(e&&""!==e)if(e.startsWith("[")&&e.includes("]")){const n=e.substring(1,e.indexOf("]"));t.push(n);const r=e.substring(e.indexOf("]")+1);o.push(r)}else if(e.includes("[")&&e.endsWith("]")){const n=e.substring(e.lastIndexOf("[")+1,e.length-1);t.push(n);const r=e.substring(0,e.lastIndexOf("["));o.push(r)}else if(e.includes("(")&&e.includes(")")){const t=e.substring(0,e.indexOf("(")),n=e.substring(e.lastIndexOf(")")+1),r=[t,e.substring(t.length+1,e.length-n.length-1),n];for(const e of r)o.push(e)}else t.push(e)}}return t}function w(e,t){const n=[];let r="",s=0,o=0,i=0,a=0;for(let l=0;l<e.length;++l){let c=e.substring(l,l+1);if(c==t&&0==o&&0==s&&0==i&&0==a)n.push(r),r="";else{if(r+=c,a>0&&"\\"==c&&l+1<e.length){++l;const t=e.substring(l,l+1);r+=t,c+=t}'"'==c?l>0&&"\\"==e.substring(l-1,l)||(a=0==a?1:0):"["==c?++o:"]"==c?--o:"("==c?++s:")"==c?--s:"{"==c?++i:"}"==c&&--i}}return n.push(r),n}function P(e){const t=S(e,'"');if(null!=t.tag)return t;const n=S(e,"'");return{tag:t.tag,repeat:n.tag,str:n.str}}function S(e,t){let n=null;if(scil.Utils.endswith(e,t)){let r=e.length-1;for(;r>0&&(r=e.lastIndexOf(t,r-1),!(r<=0||"\\"!=e.substring(r-1,r))););r>0&&r<e.length-1&&(n=e.substring(r+1,e.length-1),e=e.substring(0,r))}return null!=n&&(n=function(e){return scil.Utils.isNullOrEmpty(e)?e:e.replace(/[\\]./g,(function(e){switch(e){case"\\r":return"\r";case"\\n":return"\n";case"\\t":return"\t";default:return e.substring(1)}}))}(n.replace(new RegExp("\\"+t,"g"),t))),{tag:n,str:e}}var I,M,k=function(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};E("Helm",(()=>{const e=[["L-hArg(Et,Et)","E","F","G","C","E"],["L-hArg(Et,Et)","L-hArg(Et,Et)","E","F","G"],["dhp","m1A","p","r","T","p","r","T","p","r","G","p"],["r","mo6pur","p","r","T","p","r","T","p","r","G","p"],["afhna","mo6pur","36SS","r","T","p"]],t=["comples-monomer","complex-monomer+side-chain","complex-monomer+side-chain-RNA","complex-side-chain","complex+side-chain+linker"];C("parseHelm",(()=>k(void 0,void 0,void 0,(function*(){const e=[["meI","hHis","Aca","N","T","dK","Thr_PO3H2","D-Tyr_Et","Aze","dV","E","Phe_4Me"],["A","C","T","G","W","E","Q"],["R","U","P","T","A"],["A","*","G","C"]],t=["PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.Aze.dV.E.N.dV.Phe_4Me}$$$","PEPTIDE1{A.C.T.G.C.T.W.G.T.W.E.C.W.C.Q.W}|PEPTIDE2{A.C.T.G.C.T.W.G.T.W.E.Q}$PEPTIDE1,PEPTIDE1,5:R3-14:R3|PEPTIDE2,PEPTIDE1,2:R3-12:R3$$$","RNA1{R(U)P.R(T)P}|RNA2{P.R(A)P.R(A)}$RNA1,RNA2,2:pair-6:pair|RNA1,RNA2,5:pair-3:pair$$$","PEPTIDE1{A.*.G.C}$$$$V2.0"];for(let n=0;n<t.length;++n){const r=new Set(T(t[n])),s=Array.from(r);f(JSON.stringify(s),JSON.stringify(e[n]))}})))),["PEPTIDE1{[L-hArg(Et,Et)].E.F.G}|PEPTIDE2{C.E}$PEPTIDE1,PEPTIDE2,2:R3-1:R1$$$V2.0","PEPTIDE1{[L-hArg(Et,Et)]([L-hArg(Et,Et)]).E.F.G}$$$$","RNA1{[dhp]([m1A])p.r(T)p.r(T)p.r(G)p}$$$$V2.0","RNA1{r([mo6pur])p.r(T)p.r(T)p.r(G)p}$$$$V2.0","RNA1{[afhna]([mo6pur])[36SS].r(T)p}$$$$V2.0"].forEach(((n,r)=>{C(t[r],(()=>k(void 0,void 0,void 0,(function*(){const t=T(n);t.sort();const s=e[r];s.sort(),m(t,s)}))))}))})),new RegExp("[rd]\\((\\w)\\)p?","g"),wu;class H{constructor(e,t,n){this.name=e,this.alphabet=t,this.cutoff=n}}(M=I||(I={})).FASTA="fasta",M.SEPARATOR="separator",M.HELM="helm";const L=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}};new H("PT",L.fasta.peptide,.5),new H("DNA",L.fasta.dna,.55),new H("RNA",L.fasta.rna,.55),Float32Array;class R{static makePalette(e,t=!1,n=R){const r={};return e.forEach((e=>{const n=e[0],s=e[1];n.forEach(((e,n)=>{r[e]=this.colourPalette[s][t?0:n]}))})),new n(r)}constructor(e){this._palette=e}get(e){return this._palette[e]}}R.undefinedColor="rgb(100,100,100)",R.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]};class G extends R{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,G)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,G)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new G({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(e){const t=e in G.aaSynonyms?G.aaSynonyms[e]:e;return super.get(t)}}G.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class D{static getPalette(e="grok"){switch(e){case"grok":return G.GrokGroups;case"lesk":return G.Lesk;default:throw new Error(`ChemPalette: scheme \`${e}\` does not exist`)}}static getInnerOuter(e){let t=0,n="",r="";for(const s of e)"("==s?t++:")"==s?t--:t?n+=s:r+=s;return isNaN(parseInt(n))?[r,n]:[r,""]}static getColorAAPivot(e="",t="grok"){const n=this.getPalette(t);let[r,s]=this.getInnerOuter(e);if(r=r.length>6?`${r.slice(0,3)}...`:r,s=s.length>6?`${s.slice(0,3)}...`:s,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in n?[n.get(t),t,s,1]:[this.undefinedColor,r,s,1]}if("d"==e[0]&&e[1]in n&&(2==e.length||"("==e[2])){const t=e[1]?.toUpperCase();return t in n?[n.get(t),t,s,2]:[this.undefinedColor,r,s,2]}if(e.substring(0,3)in this.AAFullNames&&(3==e.length||"("==e[3])){const t=this.AAFullNames[e.substring(0,3)];return t in n?[n.get(t),t,s,3]:[this.undefinedColor,r,s,3]}if(e[0]?.toLowerCase()==e[0]&&e.substring(1,3)in this.AAFullNames&&(4==e.length||"("==e[4])){const t=this.AAFullNames[e.substring(1,3)];return t in n?[n.get(t),t,s,4]:[this.undefinedColor,r,s,4]}return[this.undefinedColor,r,s,0]}}D.SemType="Aminoacids",D.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",D.undefinedColor="rgb(100,100,100)",D.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},D.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},D.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},D.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"};class x{}x.SemType="Nucleotides",x.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",x.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};class _ extends class{}{static buildPalette(){return[].concat(...Object.values(R.colourPalette))}get(e){const t=class{static hashCode(e){let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}}.hashCode(e)%_.palette.length;return function(e){if(null==e)return"rgb(100,100,100)";const t=n.Color.fromHtml(e),r=n.Color.g(t),s=n.Color.r(t),o=n.Color.b(t),i=Math.sqrt(Math.pow(0-s,2)+Math.pow(0-r,2)+Math.pow(0-o,2));return i>210?`rgb(${s/i*210},${r/i*210},${o/i*210})`:n.Color.toRgb(t)}(_.palette[t])}}_.palette=_.buildPalette();new Uint32Array(65536);var F,V;(V=F||(F={})).HAMMING="Hamming",V.LEVENSHTEIN="Levenshtein",V.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",V.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",F.HAMMING,F.LEVENSHTEIN,F.NEEDLEMANN_WUNSCH,F.MONOMER_CHEMICAL_DISTANCE,new class{constructor(){this.uhTemp=`units-handler.${n.SEMTYPE.MACROMOLECULE}`}},I.FASTA,I.SEPARATOR,I.HELM;var j=function(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};const W="Libraries",U={"HELMCoreLibrary.json":"HELMCoreLibrary.json"};E("findMonomers",(()=>{let e,t=null;b((()=>j(void 0,void 0,void 0,(function*(){e=yield async function(){const e=n.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===e.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await e[0].prepare().call()).getOutputParamValue()}(),t=yield r.dapi.userDataStorage.get(W,!0),yield r.dapi.userDataStorage.post(W,U,!0),yield e.loadLibraries(!0)})))),A((()=>j(void 0,void 0,void 0,(function*(){yield r.dapi.userDataStorage.put(W,t,!0)}))));const s={withoutMissed:{test:"PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et}$$$$",tgt:new Set},withMissed:{test:"PEPTIDE1{meI.missed2.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et}$$$$",tgt:new Set(["missed2"])}};for(const[e,t]of Object.entries(s))C(e,(()=>j(void 0,void 0,void 0,(function*(){o(t.test,t.tgt)}))));function o(e,t){p(function(e){const t=Object.keys(org.helm.webeditor.monomerTypeList()),n=[],r=[];for(let e=0;e<t.length;e++)n.push(new scil.helm.Monomers.getMonomerSet(t[e])),Object.keys(n[e]).forEach((t=>{r.push(n[e][t].id)}));return new Set(e.filter((e=>!r.includes(e))))}(T(e)),t)}}));const Y=$;var K=e.n(Y),Q=function(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};E("renderers",(()=>{C("missedInLib",(()=>Q(void 0,void 0,void 0,(function*(){yield function(){return Q(this,void 0,void 0,(function*(){const e=yield r.dapi.files.readCsv("System:AppData/Helm/tests/sample_HELM-missedInLib.csv"),t=e.getCol("HELM"),o=r.shell.addTableView(e);yield function(e,t="Timeout exceeded",n=500,r=50){return s(this,void 0,void 0,(function*(){return new Promise(((s,o)=>{setTimeout((()=>{clearInterval(i),o(new Error(t))}),n);const i=setInterval((()=>{e()&&(clearInterval(i),s())}),r)}))}))}((()=>K()(o.root).find(".d4-grid canvas").length>0),"Table view canvas not found",100),f(t.semType,n.SEMTYPE.MACROMOLECULE),f(t.getTag(n.TAGS.UNITS),I.HELM),f(t.getTag(n.TAGS.CELL_RENDERER),"helm");const i=t.getTag(".cell-renderer.render.error");if(i){const e=JSON.parse(i),t=new Error(e.message);throw t.stack=e.stack,t}}))}()}))))}));const B=new n.Package;function J(e,t,o){return c=this,u=void 0,f=function*(){const c=yield function(e){var t,o,c,u,C;return s(this,void 0,void 0,(function*(){const f=null===(o=null===(t=r.functions.getCurrentCall())||void 0===t?void 0:t.func)||void 0===o?void 0:o.package;yield function(e,t){return s(this,void 0,void 0,(function*(){if(l[e])return;const t=i;if(void 0!==t["Auto Tests"]||Object.keys(t).find((e=>e.startsWith(a))))return void(l[e]=!0);const n=[],o=yield r.dapi.functions.filter(`package.id = "${e}"`).list(),c=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)/g);for(const e of o){const o=e.options.test;if(o&&Array.isArray(o)&&o.length)for(let i=0;i<o.length;i++){const l=o[i].matchAll(c),u={};Array.from(l).forEach((e=>{e[0].startsWith("skip")?u.skip=e[1]:e[0].startsWith("wait")?u.wait=parseInt(e[2]):e[0].startsWith("cat")&&(u.cat=e[3])}));const g=new d(a,1===o.length?e.name:`${e.name} ${i+1}`,(()=>s(this,void 0,void 0,(function*(){const t=yield r.functions.eval(y(o[i],e));if(u.wait&&(yield O(u.wait)),"boolean"==typeof t&&!t)throw`Failed: ${o[i]}, expected true, got ${t}`}))),{skipReason:u.skip});if(u.cat){const e="Auto Tests: "+u.cat;g.category=e,void 0===t[e]&&(t[e]={tests:[],clear:!0}),t[e].tests.push(g)}else n.push(g)}}l[e]=!0,n.length&&(t["Auto Tests"]={tests:n,clear:!0})}))}(f.id);const h=[];console.log("Running tests"),null!=e||(e={}),null!==(c=(C=e).testContext)&&void 0!==c||(C.testContext=new g),r.shell.lastError="";for(const[t,s]of Object.entries(i)){if(null!=(null==e?void 0:e.category)&&!t.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase()))continue;console.log(`Started ${t} category`);try{s.before&&(yield s.before())}catch(e){s.beforeStatus=e.toString()}const o=null!==(u=s.tests)&&void 0!==u?u:[],i=[];if(s.clear)for(let t=0;t<o.length;t++)i.push(yield N(o[t],null==e?void 0:e.test,s.timeout,f.name)),r.shell.closeAll(),n.Balloon.closeAll();else for(let t=0;t<o.length;t++)i.push(yield N(o[t],null==e?void 0:e.test,s.timeout,f.name));const a=(yield Promise.all(i)).filter((e=>"skipped"!=e.result));try{s.after&&(yield s.after())}catch(e){s.afterStatus=e.toString()}s.afterStatus&&a.push({category:t,name:"init",result:s.afterStatus,success:!1,ms:0,skipped:!1}),s.beforeStatus&&a.push({category:t,name:"init",result:s.beforeStatus,success:!1,ms:0,skipped:!1}),h.push(...a)}if(e.testContext.catchUnhandled&&(yield O(1e3),r.shell.lastError.length>0&&h.push({category:"Unhandled exceptions",name:"exceptions",result:r.shell.lastError,success:!1,ms:0,skipped:!1})),e.testContext.report){const e=new n.Logger,t=h.filter((e=>e.success)).length,r=h.filter((e=>e.skipped)).length,s=h.filter((e=>!e.success)),o="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",i={successful:t,skipped:r,failed:s.length,package:f};for(const e of s)Object.assign(i,{[`${e.category} | ${e.name}`]:e.result});e.log(o,i,"package-tested")}return h}))}({category:e,test:t,testContext:o});return n.DataFrame.fromObjects(c)},new((C=void 0)||(C=Promise))((function(e,t){function n(e){try{s(f.next(e))}catch(e){t(e)}}function r(e){try{s(f.throw(e))}catch(e){t(e)}}function s(t){var s;t.done?e(t.value):(s=t.value,s instanceof C?s:new C((function(e){e(s)}))).then(n,r)}s((f=f.apply(c,u||[])).next())}));var c,u,C,f}helm_test=t})();
2
2
  //# sourceMappingURL=package-test.js.map