Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@datagrok/bio

Package Overview
Dependencies
Maintainers
5
Versions
281
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datagrok/bio - npm Package Compare versions

Comparing version 2.11.20 to 2.11.21

dist/378.js

2

dist/23.js

@@ -1,2 +0,2 @@

var bio;(()=>{"use strict";var e,r,t={5023:(e,r,t)=>{const o=e=>null==e;var n=t(6361),a=t(9657);onmessage=async e=>{const{values:r,startIdx:t,endIdx:s,threshold:i,fnName:c,opts:l}=e.data;try{const e=[],p=[],h=[],f=s-t;if((0,n.sQ)(c))for(let e=0;e<r.length;++e)o(r[e])||(r[e]=new a.Z(r[e]._data,r[e]._length));let u=0;const g=new n.UH(c).getMeasure(l),v=r.length-2-Math.floor(Math.sqrt(-8*t+4*r.length*(r.length-1)-7)/2-.5),b=t-r.length*v+Math.floor((v+1)*(v+2)/2);let d=v,w=b;for(;u<f;){const t=o(r[d])||o(r[w])?1:g(r[d],r[w]);1-t>=i&&(e.push(d),p.push(w),h.push(t)),u++,w++,w===r.length&&(d++,w=d+1)}const y=new Int32Array(e),m=new Int32Array(p),x=new Float32Array(h);postMessage({i:y,j:m,distance:x})}catch(e){postMessage({error:e})}}}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,n.x=()=>{var e=n.O(void 0,[562,44,361],(()=>n(5023)));return n.O(e)},e=[],n.O=(r,t,o,a)=>{if(!t){var s=1/0;for(p=0;p<e.length;p++){for(var[t,o,a]=e[p],i=!0,c=0;c<t.length;c++)(!1&a||s>=a)&&Object.keys(n.O).every((e=>n.O[e](t[c])))?t.splice(c--,1):(i=!1,a<s&&(s=a));if(i){e.splice(p--,1);var l=o();void 0!==l&&(r=l)}}return r}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[t,o,a]},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((r,t)=>(n.f[t](e,r),r)),[])),n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var r=n.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&!e;)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={23:1};n.f.i=(r,t)=>{e[r]||importScripts(n.p+n.u(r))};var r=self.webpackChunkbio=self.webpackChunkbio||[],t=r.push.bind(r);r.push=r=>{var[o,a,s]=r;for(var i in a)n.o(a,i)&&(n.m[i]=a[i]);for(s&&s(n);o.length;)e[o.pop()]=1;t(r)}})(),r=n.x,n.x=()=>Promise.all([562,44,361].map(n.e,n)).then(r);var a=n.x();bio=a})();
var bio;(()=>{"use strict";var e,r,t={5023:(e,r,t)=>{const o=e=>null==e;var n=t(6361),a=t(9657);onmessage=async e=>{const{values:r,startIdx:t,endIdx:s,threshold:i,fnName:c,opts:l}=e.data;try{const e=[],p=[],h=[],f=s-t;if((0,n.sQ)(c))for(let e=0;e<r.length;++e)o(r[e])||(r[e]=new a.Z(r[e]._data,r[e]._length));let u=0;const g=new n.UH(c).getMeasure(l),v=r.length-2-Math.floor(Math.sqrt(-8*t+4*r.length*(r.length-1)-7)/2-.5),b=t-r.length*v+Math.floor((v+1)*(v+2)/2);let d=v,w=b;for(;u<f;){const t=o(r[d])||o(r[w])?1:g(r[d],r[w]);1-t>=i&&(e.push(d),p.push(w),h.push(t)),u++,w++,w===r.length&&(d++,w=d+1)}const y=new Int32Array(e),m=new Int32Array(p),x=new Float32Array(h);postMessage({i:y,j:m,distance:x})}catch(e){postMessage({error:e})}}}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,n.x=()=>{var e=n.O(void 0,[378,361],(()=>n(5023)));return n.O(e)},e=[],n.O=(r,t,o,a)=>{if(!t){var s=1/0;for(p=0;p<e.length;p++){for(var[t,o,a]=e[p],i=!0,c=0;c<t.length;c++)(!1&a||s>=a)&&Object.keys(n.O).every((e=>n.O[e](t[c])))?t.splice(c--,1):(i=!1,a<s&&(s=a));if(i){e.splice(p--,1);var l=o();void 0!==l&&(r=l)}}return r}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[t,o,a]},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((r,t)=>(n.f[t](e,r),r)),[])),n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var r=n.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&!e;)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={23:1};n.f.i=(r,t)=>{e[r]||importScripts(n.p+n.u(r))};var r=self.webpackChunkbio=self.webpackChunkbio||[],t=r.push.bind(r);r.push=r=>{var[o,a,s]=r;for(var i in a)n.o(a,i)&&(n.m[i]=a[i]);for(s&&s(n);o.length;)e[o.pop()]=1;t(r)}})(),r=n.x,n.x=()=>Promise.all([n.e(378),n.e(361)]).then(r);var a=n.x();bio=a})();
//# sourceMappingURL=23.js.map

@@ -1,2 +0,2 @@

var bio;(()=>{"use strict";var e,r,t={1282:(e,r,t)=>{const n=e=>null==e;function o(e,r,t,n){if(t>e[e.length-1])return;const o=e.findIndex((e=>t>e))+1;e.pop(),e.splice(o,0,t),r.pop(),r.splice(o,0,n)}var a=t(6361),i=t(9657);onmessage=async e=>{const{values:r,startIdx:t,endIdx:l,fnName:s,opts:c,nNeighbours:p}=e.data;try{const e=new Array(r.length).fill(null).map((()=>new Array(p).fill(-1))),f=new Array(r.length).fill(null).map((()=>new Array(p).fill(999999))),h=l-t;if((0,a.sQ)(s))for(let e=0;e<r.length;++e)n(r[e])||(r[e]=new i.Z(r[e]._data,r[e]._length));let u=0;const g=new a.UH(s).getMeasure(c),v=r.length-2-Math.floor(Math.sqrt(-8*t+4*r.length*(r.length-1)-7)/2-.5),b=t-r.length*v+Math.floor((v+1)*(v+2)/2);let d=v,w=b;for(;u<h;){const t=n(r[d])||n(r[w])?1:g(r[d],r[w]);o(f[d],e[d],t,w),o(f[w],e[w],t,d),u++,w++,w===r.length&&(d++,w=d+1)}postMessage({knnDistances:f,knnIndexes:e})}catch(e){postMessage({error:e})}}}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.x=()=>{var e=o.O(void 0,[562,44,361],(()=>o(1282)));return o.O(e)},e=[],o.O=(r,t,n,a)=>{if(!t){var i=1/0;for(p=0;p<e.length;p++){for(var[t,n,a]=e[p],l=!0,s=0;s<t.length;s++)(!1&a||i>=a)&&Object.keys(o.O).every((e=>o.O[e](t[s])))?t.splice(s--,1):(l=!1,a<i&&(i=a));if(l){e.splice(p--,1);var c=n();void 0!==c&&(r=c)}}return r}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[t,n,a]},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((r,t)=>(o.f[t](e,r),r)),[])),o.u=e=>e+".js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&!e;)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={282:1};o.f.i=(r,t)=>{e[r]||importScripts(o.p+o.u(r))};var r=self.webpackChunkbio=self.webpackChunkbio||[],t=r.push.bind(r);r.push=r=>{var[n,a,i]=r;for(var l in a)o.o(a,l)&&(o.m[l]=a[l]);for(i&&i(o);n.length;)e[n.pop()]=1;t(r)}})(),r=o.x,o.x=()=>Promise.all([562,44,361].map(o.e,o)).then(r);var a=o.x();bio=a})();
var bio;(()=>{"use strict";var e,r,t={1282:(e,r,t)=>{const n=e=>null==e;function o(e,r,t,n){if(t>e[e.length-1])return;const o=e.findIndex((e=>t<e));e.pop(),e.splice(o,0,t),r.pop(),r.splice(o,0,n)}var a=t(6361),i=t(9657);onmessage=async e=>{const{values:r,startIdx:t,endIdx:l,fnName:s,opts:c,nNeighbours:p}=e.data;try{const e=new Array(r.length).fill(null).map((()=>new Array(p).fill(-1))),f=new Array(r.length).fill(null).map((()=>new Array(p).fill(999999))),h=l-t;if((0,a.sQ)(s))for(let e=0;e<r.length;++e)n(r[e])||(r[e]=new i.Z(r[e]._data,r[e]._length));let u=0;const g=new a.UH(s).getMeasure(c),v=r.length-2-Math.floor(Math.sqrt(-8*t+4*r.length*(r.length-1)-7)/2-.5),b=t-r.length*v+Math.floor((v+1)*(v+2)/2);let d=v,w=b;for(;u<h;){const t=n(r[d])||n(r[w])?1:g(r[d],r[w]);o(f[d],e[d],t,w),o(f[w],e[w],t,d),u++,w++,w===r.length&&(d++,w=d+1)}postMessage({knnDistances:f,knnIndexes:e})}catch(e){postMessage({error:e})}}}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.x=()=>{var e=o.O(void 0,[378,361],(()=>o(1282)));return o.O(e)},e=[],o.O=(r,t,n,a)=>{if(!t){var i=1/0;for(p=0;p<e.length;p++){for(var[t,n,a]=e[p],l=!0,s=0;s<t.length;s++)(!1&a||i>=a)&&Object.keys(o.O).every((e=>o.O[e](t[s])))?t.splice(s--,1):(l=!1,a<i&&(i=a));if(l){e.splice(p--,1);var c=n();void 0!==c&&(r=c)}}return r}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[t,n,a]},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((r,t)=>(o.f[t](e,r),r)),[])),o.u=e=>e+".js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&!e;)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={282:1};o.f.i=(r,t)=>{e[r]||importScripts(o.p+o.u(r))};var r=self.webpackChunkbio=self.webpackChunkbio||[],t=r.push.bind(r);r.push=r=>{var[n,a,i]=r;for(var l in a)o.o(a,l)&&(o.m[l]=a[l]);for(i&&i(o);n.length;)e[n.pop()]=1;t(r)}})(),r=o.x,o.x=()=>Promise.all([o.e(378),o.e(361)]).then(r);var a=o.x();bio=a})();
//# sourceMappingURL=282.js.map

@@ -1,2 +0,2 @@

"use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[361],{5697:(t,n,e)=>{e.d(n,{Dz:()=>m,FV:()=>c,KR:()=>a,MI:()=>M,NB:()=>h,UX:()=>l,WI:()=>k,Zd:()=>g,_h:()=>s,aW:()=>f,bX:()=>B,fX:()=>y,s:()=>C,yU:()=>d});var o=e(9657),r=e(1040),u=e(489);function i(t,n){const e=t.trueCount()+n.trueCount();if(0==e)return 1;const o=t.andWithCountBits(n,!0);return o/(e-o)}function a(t,n){return E(i(t,n))}function c(t,n){return E(i(new o.Z(t,32*t.length),new o.Z(n,32*n.length)))}function s(t,n){return E(function(t,n){const e=t.trueCount()+n.trueCount();return 0==e?0:2*t.andWithCountBits(n,!0)/e}(t,n))}function g(t,n){return E(function(t,n){const e=t.trueCount()*n.trueCount();return 0==e?0:t.andWithCountBits(n,!0)/Math.sqrt(e)}(t,n))}function k(t,n){return Math.sqrt(t.trueCount()+n.trueCount()-2*t.andWithCountBits(n,!0))}function l(t,n){return t.trueCount()+n.trueCount()-2*t.andWithCountBits(n,!0)}function h(t,n){return E(function(t,n){const e=t.trueCount()+n.trueCount(),o=t.andWithCountBits(n,!0);return o/(2*e-3*o)}(t,n))}function C(t,n){return E(function(t,n){const e=t.trueCount()+n.trueCount(),o=t.trueCount()*n.trueCount();return 0==o?0:t.andWithCountBits(n,!0)*e/(2*o)}(t,n))}function f(t,n){return E(function(t,n){const e=t.trueCount()+n.trueCount(),o=t.trueCount()*n.trueCount();return 0==o?0:(t.andWithCountBits(n,!0)*e-o)/o}(t,n))}function d(t,n){return E(function(t,n){const e=Math.min(t.trueCount(),n.trueCount());return 0==e?0:t.andWithCountBits(n,!0)/e}(t,n))}function m(t,n){return E(function(t,n){const e=Math.max(t.trueCount(),n.trueCount());return 0==e?0:t.andWithCountBits(n,!0)/e}(t,n))}function y(t,n){return E(function(t,n){return 0==t.length?0:t.andWithCountBits(n,!0)/t.length}(t,n))}function M(t,n){return E(function(t,n){const e=t.andWithCountBits(n,!0),o=t.countBits(!0)+n.countBits(!0),r=t.length,u=r-o+e;return e==r||u==r?1:e/o+u/(2*r-o)}(t,n))}function E(t){return 0===t?3402823e32:1/t-1}function B(t,n){return Math.abs(t-n)}r.gk.Tanimoto,r.gk.Dice,r.gk.Asymmetric,r.gk.BraunBlanquet,r.gk.Cosine,r.gk.Kulczynski,r.gk.McConnaughey,r.gk.RogotGoldberg,r.gk.Russel,r.gk.Sokal,r.gk.Hamming,r.gk.Euclidean,r.gk.Tanimoto,r.gk.Dice,r.gk.Asymmetric,r.gk.BraunBlanquet,r.gk.Cosine,r.gk.Kulczynski,r.gk.McConnaughey,r.gk.RogotGoldberg,r.gk.Russel,r.gk.Sokal,r.gk.Hamming,r.gk.Euclidean,r.gk.Tanimoto,r.gk.Dice,r.gk.Cosine,r.gk.Tanimoto,r.gk.Asymmetric,r.gk.Cosine,r.gk.Sokal,u.U.HAMMING,u.U.LEVENSHTEIN,u.U.MONOMER_CHEMICAL_DISTANCE,u.U.NEEDLEMANN_WUNSCH},1040:(t,n,e)=>{var o,r,u,i,a,c;e.d(n,{CF:()=>r,Qe:()=>a,W:()=>o,Yc:()=>c,gd:()=>i,gk:()=>u}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan"}(o||(o={})),function(t){t.Euclidean="Euclidean"}(r||(r={})),function(t){t.Tanimoto="Tanimoto",t.Dice="Dice",t.Asymmetric="Asymmetric",t.BraunBlanquet="Braun-Blanquet",t.Cosine="Cosine",t.Kulczynski="Kulczynski",t.McConnaughey="Mc-Connaughey",t.RogotGoldberg="Rogot-Goldberg",t.Russel="Russel",t.Sokal="Sokal",t.Hamming="Hamming",t.Euclidean="Euclidean"}(u||(u={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(i||(i={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray"}(a||(a={})),function(t){t.Difference="Difference"}(c||(c={}))},6361:(t,n,e)=>{e.d(n,{UH:()=>o.UH,sQ:()=>o.sQ}),e(1040);var o=e(7861)},7861:(t,n,e)=>{e.d(n,{UH:()=>m,sQ:()=>d});var o=e(1811),r=e(3979),u=e(5697),i=e(850),a=e(489),c=e(1040);const s={[c.CF.Euclidean]:i.dP},g={[c.W.Levenshtein]:o.T,[c.W.JaroWinkler]:r.H$,[c.W.Manhattan]:function(t,n){if(t.length!==n.length)return 1;{let e=0;for(let o=1;o<t.length;o++)e+=t[o]==n[o]?0:1;return e/t.length}}},k={[c.gk.Tanimoto]:u.KR,[c.gk.Dice]:u._h,[c.gk.Asymmetric]:u.yU,[c.gk.BraunBlanquet]:u.Dz,[c.gk.Cosine]:u.Zd,[c.gk.Kulczynski]:u.s,[c.gk.McConnaughey]:u.aW,[c.gk.RogotGoldberg]:u.MI,[c.gk.Russel]:u.fX,[c.gk.Sokal]:u.NB,[c.gk.Hamming]:u.UX,[c.gk.Euclidean]:u.WI},l={[c.gd.TanimotoIntArray]:u.FV},h={[c.Yc.Difference]:u.bX},C={[c.Qe.Vector]:{[c.CF.Euclidean]:s[c.CF.Euclidean]},[c.Qe.String]:{[c.W.Levenshtein]:g[c.W.Levenshtein],[c.W.JaroWinkler]:g[c.W.JaroWinkler],[c.W.Manhattan]:g[c.W.Manhattan]},[c.Qe.BitArray]:{[c.gk.Tanimoto]:k[c.gk.Tanimoto],[c.gk.Dice]:k[c.gk.Dice],[c.gk.Asymmetric]:k[c.gk.Asymmetric],[c.gk.BraunBlanquet]:k[c.gk.BraunBlanquet],[c.gk.Cosine]:k[c.gk.Cosine],[c.gk.Kulczynski]:k[c.gk.Kulczynski],[c.gk.McConnaughey]:k[c.gk.McConnaughey],[c.gk.RogotGoldberg]:k[c.gk.RogotGoldberg],[c.gk.Russel]:k[c.gk.Russel],[c.gk.Sokal]:k[c.gk.Sokal]},[c.Qe.MacroMolecule]:{[a.U.HAMMING]:a.o[a.U.HAMMING],[a.U.LEVENSHTEIN]:a.o[a.U.LEVENSHTEIN],[a.U.NEEDLEMANN_WUNSCH]:a.o[a.U.NEEDLEMANN_WUNSCH],[a.U.MONOMER_CHEMICAL_DISTANCE]:a.o[a.U.MONOMER_CHEMICAL_DISTANCE]},[c.Qe.Number]:{[c.Yc.Difference]:h[c.Yc.Difference]},[c.Qe.IntArray]:{[c.gd.TanimotoIntArray]:l[c.gd.TanimotoIntArray]}},f=Object.keys(C).reduce(((t,n)=>{for(const e of Object.keys(C[n]))t[e]=n;return t}),{});function d(t){return"BitArray"==f[t]}class m{constructor(t){this.method=t,this.dataType=f[t]}getMeasure(t){const n=C;if(!n.hasOwnProperty(this.dataType)||!n[this.dataType].hasOwnProperty(this.method))throw new Error(`Unknown measure ${this.method} for data type ${this.dataType}`);return e=this.method,f[e]==c.Qe.MacroMolecule.toString()?n[this.dataType][this.method](t):n[this.dataType][this.method];var e}static getMetricByDataType(t){return Object.keys(C[t])}static get availableMeasures(){return Object.keys(C)}}},850:(t,n,e)=>{function o(t,n){let e=0;const o=t.length;if(o!==n.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<o;++r)e+=Math.pow(t[r]-n[r],2);return Math.sqrt(e)}e.d(n,{dP:()=>o})}}]);
"use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[361],{5697:(t,n,e)=>{e.d(n,{Dz:()=>m,FV:()=>c,KR:()=>a,MI:()=>M,NB:()=>h,UX:()=>l,WI:()=>k,Zd:()=>g,_h:()=>s,aW:()=>f,bX:()=>B,fX:()=>y,s:()=>C,yU:()=>d});var o=e(9657),r=e(1040),u=e(708);function i(t,n){const e=t.trueCount()+n.trueCount();if(0==e)return 1;const o=t.andWithCountBits(n,!0);return o/(e-o)}function a(t,n){return E(i(t,n))}function c(t,n){return E(i(new o.Z(t,32*t.length),new o.Z(n,32*n.length)))}function s(t,n){return E(function(t,n){const e=t.trueCount()+n.trueCount();return 0==e?0:2*t.andWithCountBits(n,!0)/e}(t,n))}function g(t,n){return E(function(t,n){const e=t.trueCount()*n.trueCount();return 0==e?0:t.andWithCountBits(n,!0)/Math.sqrt(e)}(t,n))}function k(t,n){return Math.sqrt(t.trueCount()+n.trueCount()-2*t.andWithCountBits(n,!0))}function l(t,n){return t.trueCount()+n.trueCount()-2*t.andWithCountBits(n,!0)}function h(t,n){return E(function(t,n){const e=t.trueCount()+n.trueCount(),o=t.andWithCountBits(n,!0);return o/(2*e-3*o)}(t,n))}function C(t,n){return E(function(t,n){const e=t.trueCount()+n.trueCount(),o=t.trueCount()*n.trueCount();return 0==o?0:t.andWithCountBits(n,!0)*e/(2*o)}(t,n))}function f(t,n){return E(function(t,n){const e=t.trueCount()+n.trueCount(),o=t.trueCount()*n.trueCount();return 0==o?0:(t.andWithCountBits(n,!0)*e-o)/o}(t,n))}function d(t,n){return E(function(t,n){const e=Math.min(t.trueCount(),n.trueCount());return 0==e?0:t.andWithCountBits(n,!0)/e}(t,n))}function m(t,n){return E(function(t,n){const e=Math.max(t.trueCount(),n.trueCount());return 0==e?0:t.andWithCountBits(n,!0)/e}(t,n))}function y(t,n){return E(function(t,n){return 0==t.length?0:t.andWithCountBits(n,!0)/t.length}(t,n))}function M(t,n){return E(function(t,n){const e=t.andWithCountBits(n,!0),o=t.countBits(!0)+n.countBits(!0),r=t.length,u=r-o+e;return e==r||u==r?1:e/o+u/(2*r-o)}(t,n))}function E(t){return 0===t?3402823e32:1/t-1}function B(t,n){return Math.abs(t-n)}r.gk.Tanimoto,r.gk.Dice,r.gk.Asymmetric,r.gk.BraunBlanquet,r.gk.Cosine,r.gk.Kulczynski,r.gk.McConnaughey,r.gk.RogotGoldberg,r.gk.Russel,r.gk.Sokal,r.gk.Hamming,r.gk.Euclidean,r.gk.Tanimoto,r.gk.Dice,r.gk.Asymmetric,r.gk.BraunBlanquet,r.gk.Cosine,r.gk.Kulczynski,r.gk.McConnaughey,r.gk.RogotGoldberg,r.gk.Russel,r.gk.Sokal,r.gk.Hamming,r.gk.Euclidean,r.gk.Tanimoto,r.gk.Dice,r.gk.Cosine,r.gk.Tanimoto,r.gk.Asymmetric,r.gk.Cosine,r.gk.Sokal,u.U.HAMMING,u.U.LEVENSHTEIN,u.U.MONOMER_CHEMICAL_DISTANCE,u.U.NEEDLEMANN_WUNSCH},1040:(t,n,e)=>{var o,r,u,i,a,c;e.d(n,{CF:()=>r,Qe:()=>a,W:()=>o,Yc:()=>c,gd:()=>i,gk:()=>u}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan"}(o||(o={})),function(t){t.Euclidean="Euclidean"}(r||(r={})),function(t){t.Tanimoto="Tanimoto",t.Dice="Dice",t.Asymmetric="Asymmetric",t.BraunBlanquet="Braun-Blanquet",t.Cosine="Cosine",t.Kulczynski="Kulczynski",t.McConnaughey="Mc-Connaughey",t.RogotGoldberg="Rogot-Goldberg",t.Russel="Russel",t.Sokal="Sokal",t.Hamming="Hamming",t.Euclidean="Euclidean"}(u||(u={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(i||(i={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray"}(a||(a={})),function(t){t.Difference="Difference"}(c||(c={}))},6361:(t,n,e)=>{e.d(n,{UH:()=>o.UH,sQ:()=>o.sQ}),e(1040);var o=e(7861)},7861:(t,n,e)=>{e.d(n,{UH:()=>m,sQ:()=>d});var o=e(1811),r=e(3979),u=e(5697),i=e(850),a=e(708),c=e(1040);const s={[c.CF.Euclidean]:i.dP},g={[c.W.Levenshtein]:o.T,[c.W.JaroWinkler]:r.H$,[c.W.Manhattan]:function(t,n){if(t.length!==n.length)return 1;{let e=0;for(let o=1;o<t.length;o++)e+=t[o]==n[o]?0:1;return e/t.length}}},k={[c.gk.Tanimoto]:u.KR,[c.gk.Dice]:u._h,[c.gk.Asymmetric]:u.yU,[c.gk.BraunBlanquet]:u.Dz,[c.gk.Cosine]:u.Zd,[c.gk.Kulczynski]:u.s,[c.gk.McConnaughey]:u.aW,[c.gk.RogotGoldberg]:u.MI,[c.gk.Russel]:u.fX,[c.gk.Sokal]:u.NB,[c.gk.Hamming]:u.UX,[c.gk.Euclidean]:u.WI},l={[c.gd.TanimotoIntArray]:u.FV},h={[c.Yc.Difference]:u.bX},C={[c.Qe.Vector]:{[c.CF.Euclidean]:s[c.CF.Euclidean]},[c.Qe.String]:{[c.W.Levenshtein]:g[c.W.Levenshtein],[c.W.JaroWinkler]:g[c.W.JaroWinkler],[c.W.Manhattan]:g[c.W.Manhattan]},[c.Qe.BitArray]:{[c.gk.Tanimoto]:k[c.gk.Tanimoto],[c.gk.Dice]:k[c.gk.Dice],[c.gk.Asymmetric]:k[c.gk.Asymmetric],[c.gk.BraunBlanquet]:k[c.gk.BraunBlanquet],[c.gk.Cosine]:k[c.gk.Cosine],[c.gk.Kulczynski]:k[c.gk.Kulczynski],[c.gk.McConnaughey]:k[c.gk.McConnaughey],[c.gk.RogotGoldberg]:k[c.gk.RogotGoldberg],[c.gk.Russel]:k[c.gk.Russel],[c.gk.Sokal]:k[c.gk.Sokal]},[c.Qe.MacroMolecule]:{[a.U.HAMMING]:a.o[a.U.HAMMING],[a.U.LEVENSHTEIN]:a.o[a.U.LEVENSHTEIN],[a.U.NEEDLEMANN_WUNSCH]:a.o[a.U.NEEDLEMANN_WUNSCH],[a.U.MONOMER_CHEMICAL_DISTANCE]:a.o[a.U.MONOMER_CHEMICAL_DISTANCE]},[c.Qe.Number]:{[c.Yc.Difference]:h[c.Yc.Difference]},[c.Qe.IntArray]:{[c.gd.TanimotoIntArray]:l[c.gd.TanimotoIntArray]}},f=Object.keys(C).reduce(((t,n)=>{for(const e of Object.keys(C[n]))t[e]=n;return t}),{});function d(t){return"BitArray"==f[t]}class m{constructor(t){this.method=t,this.dataType=f[t]}getMeasure(t){const n=C;if(!n.hasOwnProperty(this.dataType)||!n[this.dataType].hasOwnProperty(this.method))throw new Error(`Unknown measure ${this.method} for data type ${this.dataType}`);return e=this.method,f[e]==c.Qe.MacroMolecule.toString()?n[this.dataType][this.method](t):n[this.dataType][this.method];var e}static getMetricByDataType(t){return Object.keys(C[t])}static get availableMeasures(){return Object.keys(C)}}},850:(t,n,e)=>{function o(t,n){let e=0;const o=t.length;if(o!==n.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<o;++r)e+=Math.pow(t[r]-n[r],2);return Math.sqrt(e)}e.d(n,{dP:()=>o})}}]);
//# sourceMappingURL=361.js.map

@@ -1,2 +0,2 @@

var bio;(()=>{"use strict";var e,r,t={9040:(e,r,t)=>{const o=e=>null==e;var n=t(6361),a=t(9657);onmessage=async e=>{const{values:r,startIdx:t,endIdx:s,sampleLength:i,fnName:l,opts:c}=e.data;try{let e=new Float32Array(i);const p=s-t;if((0,n.sQ)(l))for(let e=0;e<r.length;++e)o(r[e])||(r[e]=new a.Z(r[e]._data,r[e]._length));let f=0;const h=Math.floor(p/i),u=new n.UH(l).getMeasure(c),g=r.length-2-Math.floor(Math.sqrt(-8*t+4*r.length*(r.length-1)-7)/2-.5),v=t-r.length*g+Math.floor((g+1)*(g+2)/2);let b=g,d=v,m=0;for(;f<p&&m<i;){const t=o(r[b])||o(r[d])?1:u(r[b],r[d]);for(e[m]=t,m++,f+=h,d+=h;d>=r.length&&f<p;)b++,d=b+1+(d-r.length)}m<i&&(e=e.slice(0,m)),postMessage({distance:e})}catch(e){postMessage({error:e})}}}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,n.x=()=>{var e=n.O(void 0,[562,44,361],(()=>n(9040)));return n.O(e)},e=[],n.O=(r,t,o,a)=>{if(!t){var s=1/0;for(p=0;p<e.length;p++){for(var[t,o,a]=e[p],i=!0,l=0;l<t.length;l++)(!1&a||s>=a)&&Object.keys(n.O).every((e=>n.O[e](t[l])))?t.splice(l--,1):(i=!1,a<s&&(s=a));if(i){e.splice(p--,1);var c=o();void 0!==c&&(r=c)}}return r}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[t,o,a]},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((r,t)=>(n.f[t](e,r),r)),[])),n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var r=n.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&!e;)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={40:1};n.f.i=(r,t)=>{e[r]||importScripts(n.p+n.u(r))};var r=self.webpackChunkbio=self.webpackChunkbio||[],t=r.push.bind(r);r.push=r=>{var[o,a,s]=r;for(var i in a)n.o(a,i)&&(n.m[i]=a[i]);for(s&&s(n);o.length;)e[o.pop()]=1;t(r)}})(),r=n.x,n.x=()=>Promise.all([562,44,361].map(n.e,n)).then(r);var a=n.x();bio=a})();
var bio;(()=>{"use strict";var e,r,t={9040:(e,r,t)=>{const o=e=>null==e;var n=t(6361),a=t(9657);onmessage=async e=>{const{values:r,startIdx:t,endIdx:s,sampleLength:i,fnName:l,opts:c}=e.data;try{let e=new Float32Array(i);const p=s-t;if((0,n.sQ)(l))for(let e=0;e<r.length;++e)o(r[e])||(r[e]=new a.Z(r[e]._data,r[e]._length));let f=0;const h=Math.floor(p/i),u=new n.UH(l).getMeasure(c),g=r.length-2-Math.floor(Math.sqrt(-8*t+4*r.length*(r.length-1)-7)/2-.5),v=t-r.length*g+Math.floor((g+1)*(g+2)/2);let b=g,d=v,m=0;for(;f<p&&m<i;){const t=o(r[b])||o(r[d])?1:u(r[b],r[d]);for(e[m]=t,m++,f+=h,d+=h;d>=r.length&&f<p;)b++,d=b+1+(d-r.length)}m<i&&(e=e.slice(0,m)),postMessage({distance:e})}catch(e){postMessage({error:e})}}}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,n.x=()=>{var e=n.O(void 0,[378,361],(()=>n(9040)));return n.O(e)},e=[],n.O=(r,t,o,a)=>{if(!t){var s=1/0;for(p=0;p<e.length;p++){for(var[t,o,a]=e[p],i=!0,l=0;l<t.length;l++)(!1&a||s>=a)&&Object.keys(n.O).every((e=>n.O[e](t[l])))?t.splice(l--,1):(i=!1,a<s&&(s=a));if(i){e.splice(p--,1);var c=o();void 0!==c&&(r=c)}}return r}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[t,o,a]},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((r,t)=>(n.f[t](e,r),r)),[])),n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var r=n.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&!e;)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={40:1};n.f.i=(r,t)=>{e[r]||importScripts(n.p+n.u(r))};var r=self.webpackChunkbio=self.webpackChunkbio||[],t=r.push.bind(r);r.push=r=>{var[o,a,s]=r;for(var i in a)n.o(a,i)&&(n.m[i]=a[i]);for(s&&s(n);o.length;)e[o.pop()]=1;t(r)}})(),r=n.x,n.x=()=>Promise.all([n.e(378),n.e(361)]).then(r);var a=n.x();bio=a})();
//# sourceMappingURL=40.js.map

@@ -1,2 +0,2 @@

var bio;(()=>{"use strict";var r,e,t={3065:(r,e,t)=>{const o=r=>null==r;var a=t(6361),n=t(9657);onmessage=r=>{const{values:e,fnName:t,startRow:i,startCol:s,chunckSize:c,opts:l}=r.data,p={};try{let r=i,u=s,f=0,h=0,v=Number.MIN_VALUE;if((0,a.sQ)(t))for(let r=0;r<e.length;++r)o(e[r])||(e[r]=new n.Z(e[r]._data,e[r]._length));const g=new Float32Array(c),b=new a.UH(t).getMeasure(l);for(;f<c;){const t=o(e[r])||o(e[u])?1:b(e[r],e[u]);g[f]=t,t<h&&(h=t),t>v&&(v=t),f++,u++,u===e.length&&(r++,u=r+1)}p.distanceMatrixData=g,p.min=h,p.max=v}catch(r){p.error=r}postMessage(p)}}},o={};function a(r){var e=o[r];if(void 0!==e)return e.exports;var n=o[r]={exports:{}};return t[r](n,n.exports,a),n.exports}a.m=t,a.x=()=>{var r=a.O(void 0,[562,44,361],(()=>a(3065)));return a.O(r)},r=[],a.O=(e,t,o,n)=>{if(!t){var i=1/0;for(p=0;p<r.length;p++){for(var[t,o,n]=r[p],s=!0,c=0;c<t.length;c++)(!1&n||i>=n)&&Object.keys(a.O).every((r=>a.O[r](t[c])))?t.splice(c--,1):(s=!1,n<i&&(i=n));if(s){r.splice(p--,1);var l=o();void 0!==l&&(e=l)}}return e}n=n||0;for(var p=r.length;p>0&&r[p-1][2]>n;p--)r[p]=r[p-1];r[p]=[t,o,n]},a.d=(r,e)=>{for(var t in e)a.o(e,t)&&!a.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},a.f={},a.e=r=>Promise.all(Object.keys(a.f).reduce(((e,t)=>(a.f[t](r,e),e)),[])),a.u=r=>r+".js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(r){if("object"==typeof window)return window}}(),a.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r;a.g.importScripts&&(r=a.g.location+"");var e=a.g.document;if(!r&&e&&(e.currentScript&&(r=e.currentScript.src),!r)){var t=e.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&!r;)r=t[o--].src}if(!r)throw new Error("Automatic publicPath is not supported in this browser");r=r.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=r})(),(()=>{var r={65:1};a.f.i=(e,t)=>{r[e]||importScripts(a.p+a.u(e))};var e=self.webpackChunkbio=self.webpackChunkbio||[],t=e.push.bind(e);e.push=e=>{var[o,n,i]=e;for(var s in n)a.o(n,s)&&(a.m[s]=n[s]);for(i&&i(a);o.length;)r[o.pop()]=1;t(e)}})(),e=a.x,a.x=()=>Promise.all([562,44,361].map(a.e,a)).then(e);var n=a.x();bio=n})();
var bio;(()=>{"use strict";var r,e,t={3065:(r,e,t)=>{const o=r=>null==r;var a=t(6361),n=t(9657);onmessage=r=>{const{values:e,fnName:t,startRow:i,startCol:s,chunckSize:c,opts:l}=r.data,p={};try{let r=i,u=s,f=0,h=0,v=Number.MIN_VALUE;if((0,a.sQ)(t))for(let r=0;r<e.length;++r)o(e[r])||(e[r]=new n.Z(e[r]._data,e[r]._length));const g=new Float32Array(c),b=new a.UH(t).getMeasure(l);for(;f<c;){const t=o(e[r])||o(e[u])?1:b(e[r],e[u]);g[f]=t,t<h&&(h=t),t>v&&(v=t),f++,u++,u===e.length&&(r++,u=r+1)}p.distanceMatrixData=g,p.min=h,p.max=v}catch(r){p.error=r}postMessage(p)}}},o={};function a(r){var e=o[r];if(void 0!==e)return e.exports;var n=o[r]={exports:{}};return t[r](n,n.exports,a),n.exports}a.m=t,a.x=()=>{var r=a.O(void 0,[378,361],(()=>a(3065)));return a.O(r)},r=[],a.O=(e,t,o,n)=>{if(!t){var i=1/0;for(p=0;p<r.length;p++){for(var[t,o,n]=r[p],s=!0,c=0;c<t.length;c++)(!1&n||i>=n)&&Object.keys(a.O).every((r=>a.O[r](t[c])))?t.splice(c--,1):(s=!1,n<i&&(i=n));if(s){r.splice(p--,1);var l=o();void 0!==l&&(e=l)}}return e}n=n||0;for(var p=r.length;p>0&&r[p-1][2]>n;p--)r[p]=r[p-1];r[p]=[t,o,n]},a.d=(r,e)=>{for(var t in e)a.o(e,t)&&!a.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},a.f={},a.e=r=>Promise.all(Object.keys(a.f).reduce(((e,t)=>(a.f[t](r,e),e)),[])),a.u=r=>r+".js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(r){if("object"==typeof window)return window}}(),a.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r;a.g.importScripts&&(r=a.g.location+"");var e=a.g.document;if(!r&&e&&(e.currentScript&&(r=e.currentScript.src),!r)){var t=e.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&!r;)r=t[o--].src}if(!r)throw new Error("Automatic publicPath is not supported in this browser");r=r.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=r})(),(()=>{var r={65:1};a.f.i=(e,t)=>{r[e]||importScripts(a.p+a.u(e))};var e=self.webpackChunkbio=self.webpackChunkbio||[],t=e.push.bind(e);e.push=e=>{var[o,n,i]=e;for(var s in n)a.o(n,s)&&(a.m[s]=n[s]);for(i&&i(a);o.length;)r[o.pop()]=1;t(e)}})(),e=a.x,a.x=()=>Promise.all([a.e(378),a.e(361)]).then(e);var n=a.x();bio=n})();
//# sourceMappingURL=65.js.map

@@ -8,3 +8,3 @@ {

},
"version": "2.11.20",
"version": "2.11.21",
"description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",

@@ -38,5 +38,5 @@ "repository": {

"@biowasm/aioli": "^3.1.0",
"@datagrok-libraries/bio": "^5.39.14",
"@datagrok-libraries/bio": "^5.39.16",
"@datagrok-libraries/chem-meta": "^1.2.1",
"@datagrok-libraries/ml": "^6.3.67",
"@datagrok-libraries/ml": "^6.3.68",
"@datagrok-libraries/tutorials": "^1.3.11",

@@ -43,0 +43,0 @@ "@datagrok-libraries/utils": "^4.1.36",

@@ -10,4 +10,6 @@ import * as ui from 'datagrok-api/ui';

import {Subject} from 'rxjs';
import {calcMmDistanceMatrix, dmLinearIndex} from './workers/mm-distance-worker-creator';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {getEncodedSeqSpaceCol} from './sequence-space';
import {MmDistanceFunctionsNames} from '@datagrok-libraries/ml/src/macromolecule-distance-functions';
import {DistanceMatrixService, dmLinearIndex} from '@datagrok-libraries/ml/src/distance-matrix';

@@ -62,3 +64,7 @@ export class SequenceDiversityViewer extends SequenceSearchBaseViewer {

private async computeByMM() {
const distanceMatrixData = await calcMmDistanceMatrix(this.moleculeColumn!);
const encodedSequences =
(await getEncodedSeqSpaceCol(this.moleculeColumn!, MmDistanceFunctionsNames.LEVENSHTEIN)).seqList;
const distanceMatrixService = new DistanceMatrixService(true, false);
const distanceMatrixData = await distanceMatrixService.calc(encodedSequences, MmDistanceFunctionsNames.LEVENSHTEIN);
distanceMatrixService.terminate();
const len = this.moleculeColumn!.length;

@@ -65,0 +71,0 @@ const linearizeFunc = dmLinearIndex(len);

@@ -11,4 +11,6 @@ import * as grok from 'datagrok-api/grok';

import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {calcMmDistanceMatrix, dmLinearIndex} from './workers/mm-distance-worker-creator';
import {calculateMMDistancesArray} from './workers/mm-distance-array-service';
import {alignSequencePair} from '@datagrok-libraries/bio/src/utils/macromolecule/alignment';
import {KnnResult, SparseMatrixService} from '@datagrok-libraries/ml/src/distance-matrix/sparse-matrix-service';
import {getEncodedSeqSpaceCol} from './sequence-space';
import {MmDistanceFunctionsNames} from '@datagrok-libraries/ml/src/macromolecule-distance-functions';

@@ -30,2 +32,4 @@ export class SequenceSimilarityViewer extends SequenceSearchBaseViewer {

mmDistanceMatrix: Float32Array;
knn?: KnnResult;
kPrevNeighbors: number = 0;

@@ -53,3 +57,3 @@ constructor() {

await (uh.isFasta() ? this.computeByMM() : this.computeByChem());
await (!uh.isHelm() ? this.computeByMM() : this.computeByChem());
const similarColumnName: string = this.similarColumnLabel != null ? this.similarColumnLabel :

@@ -99,25 +103,20 @@ `similar (${this.moleculeColumnName})`;

private async computeByMM() {
let distanceArray = new Float32Array();
if (!this.distanceMatrixComputed && this.preComputeDistanceMatrix) {
this.mmDistanceMatrix = await calcMmDistanceMatrix(this.moleculeColumn!);
this.distanceMatrixComputed = true;
} else if (!this.preComputeDistanceMatrix) {
// use fast distance array calculation if matrix will take too much space
distanceArray = await calculateMMDistancesArray(this.moleculeColumn!, this.targetMoleculeIdx);
const len = this.moleculeColumn!.length;
const actualLimit = Math.min(this.limit, len - 1);
if (!this.knn || this.kPrevNeighbors !== actualLimit) {
const encodedSequences =
(await getEncodedSeqSpaceCol(this.moleculeColumn!, MmDistanceFunctionsNames.LEVENSHTEIN)).seqList;
this.kPrevNeighbors = actualLimit;
this.knn = await (new SparseMatrixService()
.getKNN(encodedSequences, MmDistanceFunctionsNames.LEVENSHTEIN, Math.min(this.limit, len - 1)));
}
const len = this.moleculeColumn!.length;
const linearizeFunc = dmLinearIndex(len);
// array that keeps track of the indexes and scores together
const indexWScore = Array(len).fill(0)
.map((_, i) => ({
idx: i, score: i === this.targetMoleculeIdx ? 1 :
this.preComputeDistanceMatrix ? 1 - this.mmDistanceMatrix[linearizeFunc(this.targetMoleculeIdx, i)] :
1 - distanceArray[i]
}));
const indexWScore = new Array(actualLimit).fill(0).map((_, i) => ({
idx: this.knn!.knnIndexes[this.targetMoleculeIdx][i],
score: 1 - this.knn!.knnDistances[this.targetMoleculeIdx][i],
}));
indexWScore.sort((a, b) => b.score - a.score);
// get the most similar molecules
const actualLimit = Math.min(this.limit, len);
const mostSimilar = indexWScore.slice(0, actualLimit);
this.idxs = DG.Column.int('indexes', actualLimit).init((i) => mostSimilar[i].idx);
this.scores = DG.Column.float('score', actualLimit).init((i) => mostSimilar[i].score);
indexWScore.unshift({idx: this.targetMoleculeIdx, score: DG.FLOAT_NULL});
this.idxs = DG.Column.int('indexes', actualLimit + 1).init((i) => indexWScore[i].idx);
this.scores = DG.Column.float('score', actualLimit + 1).init((i) => indexWScore[i].score);
}

@@ -134,3 +133,4 @@

const subParts2 = splitter(resDf.get(molColName, resDf.currentRowIdx));
const canvas = createDifferenceCanvas(subParts1, subParts2, uh.units, molDifferences);
const alignment = alignSequencePair(Array.from(subParts1), Array.from(subParts2));
const canvas = createDifferenceCanvas(alignment.seq1Splitted, alignment.seq2Splitted, uh.units, molDifferences);
propPanel.append(ui.div(canvas, {style: {width: '300px', overflow: 'scroll'}}));

@@ -137,0 +137,0 @@ if (subParts1.length !== subParts2.length) {

@@ -51,3 +51,3 @@ import * as DG from 'datagrok-api/dg';

const str0: string = 'D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me';
const str1: string = 'meI/hHis//Aca/meM/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me';
const str1: string = 'Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/Chg/N/D-Orn/D-aThr//Phe_4Me';
const simStr1: string = 'meI/hHis/Aca/Cys_SEt/T/dK/Thr_PO3H2/Aca/Tyr_PO3H2/D-Chg/dV/Phe_ab-dehydro/N/D-Orn/D-aThr//Phe_4Me';

@@ -61,4 +61,4 @@ /* eslint-enable max-len */

expect(similaritySearchViewer.molCol!.get(0), str0);
expect(similaritySearchViewer.scores!.get(1), 0.4722222089767456);
expect(similaritySearchViewer.idxs!.get(1), 11);
expect((similaritySearchViewer.scores!.get(1) as number).toFixed(2), '0.73');
expect(similaritySearchViewer.idxs!.get(1), 4);
expect(similaritySearchViewer.molCol!.get(1), str1);

@@ -65,0 +65,0 @@ moleculesView.dataFrame.currentRowIdx = 1;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc