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.42 to 2.12.0

6

CHANGELOG.md
# Bio changelog
## 2.12.0 (WIP)
### Features
* #2707: Add original and canonical to monomer
## 2.11.42 (2024-03-27)

@@ -4,0 +10,0 @@

22

detectors.js

@@ -34,3 +34,3 @@ /**

/** Class for handling notation units in Macromolecule columns */
const UnitsHandler = {
const SeqHandler = {
TAGS: {

@@ -167,4 +167,4 @@ aligned: 'aligned',

const alphabetIsMultichar = Object.keys(statsAsHelm.freq).some((m) => m.length > 1);
// col.setTag(UnitsHandler.TAGS.alphabetSize, alphabetSize.toString());
col.setTag(UnitsHandler.TAGS.alphabetIsMultichar, alphabetIsMultichar ? 'true' : 'false');
// col.setTag(SeqHandler.TAGS.alphabetSize, alphabetSize.toString());
col.setTag(SeqHandler.TAGS.alphabetIsMultichar, alphabetIsMultichar ? 'true' : 'false');

@@ -241,8 +241,8 @@ return DG.SEMTYPE.MACROMOLECULE;

col.setTag(DG.TAGS.UNITS, units);
if (separator) col.setTag(UnitsHandler.TAGS.separator, separator);
col.setTag(UnitsHandler.TAGS.aligned, ALIGNMENT.SEQ_MSA);
col.setTag(UnitsHandler.TAGS.alphabet, alphabet);
if (separator) col.setTag(SeqHandler.TAGS.separator, separator);
col.setTag(SeqHandler.TAGS.aligned, ALIGNMENT.SEQ_MSA);
col.setTag(SeqHandler.TAGS.alphabet, alphabet);
if (alphabet === ALPHABET.UN) {
const alphabetIsMultichar = Object.keys(stats.freq).some((m) => m.length > 1);
col.setTag(UnitsHandler.TAGS.alphabetIsMultichar, alphabetIsMultichar ? 'true' : 'false');
col.setTag(SeqHandler.TAGS.alphabetIsMultichar, alphabetIsMultichar ? 'true' : 'false');
}

@@ -289,9 +289,9 @@ return DG.SEMTYPE.MACROMOLECULE;

col.setTag(DG.TAGS.UNITS, units);
if (separator) col.setTag(UnitsHandler.TAGS.separator, separator);
col.setTag(UnitsHandler.TAGS.aligned, aligned);
col.setTag(UnitsHandler.TAGS.alphabet, alphabet);
if (separator) col.setTag(SeqHandler.TAGS.separator, separator);
col.setTag(SeqHandler.TAGS.aligned, aligned);
col.setTag(SeqHandler.TAGS.alphabet, alphabet);
if (alphabet === ALPHABET.UN) {
// alphabetSize calculated on (sub)sample of data is incorrect
const alphabetIsMultichar = Object.keys(stats.freq).some((m) => m.length > 1);
col.setTag(UnitsHandler.TAGS.alphabetIsMultichar, alphabetIsMultichar ? 'true' : 'false');
col.setTag(SeqHandler.TAGS.alphabetIsMultichar, alphabetIsMultichar ? 'true' : 'false');
}

@@ -298,0 +298,0 @@ return DG.SEMTYPE.MACROMOLECULE;

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

"use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[36],{5697:(t,e,n)=>{n.d(e,{Dz:()=>C,FV:()=>a,KR:()=>o,MI:()=>M,NB:()=>c,UX:()=>f,WI:()=>g,Zd:()=>u,_h:()=>l,aW:()=>d,bX:()=>B,fX:()=>A,s:()=>_,yU:()=>m});var r=n(9657),i=n(1040),s=n(708);function h(t,e){const n=t.trueCount()+e.trueCount();if(0==n)return 1;const r=t.andWithCountBits(e,!0);return r/(n-r)}function o(t,e){return 1-h(t,e)}function a(t,e){return I(h(new r.Z(t,32*t.length),new r.Z(e,32*e.length)))}function l(t,e){return 1-function(t,e){const n=t.trueCount()+e.trueCount();return 0==n?0:2*t.andWithCountBits(e,!0)/n}(t,e)}function u(t,e){return 1-function(t,e){const n=t.trueCount()*e.trueCount();return 0==n?0:t.andWithCountBits(e,!0)/Math.sqrt(n)}(t,e)}function g(t,e){return Math.sqrt(t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0))}function f(t,e){return t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0)}function c(t,e){return 1-function(t,e){const n=t.trueCount()+e.trueCount(),r=t.andWithCountBits(e,!0);return r/(2*n-3*r)}(t,e)}function _(t,e){return I(function(t,e){const n=t.trueCount()+e.trueCount(),r=t.trueCount()*e.trueCount();return 0==r?0:t.andWithCountBits(e,!0)*n/(2*r)}(t,e))}function d(t,e){return I(function(t,e){const n=t.trueCount()+e.trueCount(),r=t.trueCount()*e.trueCount();return 0==r?0:(t.andWithCountBits(e,!0)*n-r)/r}(t,e))}function m(t,e){return 1-function(t,e){const n=Math.min(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e)}function C(t,e){return I(function(t,e){const n=Math.max(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e))}function A(t,e){return I(function(t,e){return 0==t.length?0:t.andWithCountBits(e,!0)/t.length}(t,e))}function M(t,e){return I(function(t,e){const n=t.andWithCountBits(e,!0),r=t.countBits(!0)+e.countBits(!0),i=t.length,s=i-r+n;return n==i||s==i?1:n/r+s/(2*i-r)}(t,e))}function I(t){return 0===t?3402823e32:1/t-1}function B(t){if(t&&null!=t.range&&t.range>0){const e=t.range;return(t,n)=>Math.abs(t-n)/e}return(t,e)=>Math.abs(t-e)}i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean,i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean,i.gk.Tanimoto,i.gk.Dice,i.gk.Cosine,i.gk.Tanimoto,i.gk.Asymmetric,i.gk.Cosine,i.gk.Sokal,s.U.HAMMING,s.U.LEVENSHTEIN,s.U.MONOMER_CHEMICAL_DISTANCE,s.U.NEEDLEMANN_WUNSCH},708:(t,e,n)=>{function r(t={}){const e=function(){if(!t||!t.scoringMatrix||!t.alphabetIndexes)return(t,e)=>t===e?0:1;if(t.scoringMatrix.length!==Object.keys(t.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const e=t.alphabetIndexes,n=t.scoringMatrix,r=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,i=new Float32Array((n.length+r)*(n.length+r));return Object.entries(e).forEach((([t,r])=>{const s=n[r];Object.entries(e).forEach((([e,r])=>{i[t.charCodeAt(0)*n.length+e.charCodeAt(0)]=s[r]}))})),(t,e)=>i[t.charCodeAt(0)*n.length+e.charCodeAt(0)]}(),n=t?.threshold??0;return(t,r)=>{let i=0;const s=t.length,h=r.length,o=Math.max(s,h)*(1-n);s!==h&&(i=Math.abs(s-h));let a=0;for(let n=0;n<Math.min(s,h);n++)if(t[n]!==r[n]&&(a+=e(t[n],r[n]),a>o))return 1;return a+=i,a/=Math.max(s,h),a}}n.d(e,{U:()=>h,o:()=>o});var i=n(1811);const s={gapOpen:1,gapExtend:.6,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],alphabetIndexes:{A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};var h;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(h||(h={}));const o={[h.HAMMING]:r,[h.LEVENSHTEIN]:function(){return(t,e)=>(0,i.T)(t,e)/Math.max(t.length,e.length)},[h.NEEDLEMANN_WUNSCH]:function(t){const e=new Uint16Array(65536),{gapOpen:n,gapExtend:r,scoringMatrix:i,alphabetIndexes:h}={...s,...t};Object.entries(h).forEach((([t,n])=>e[t.charCodeAt(0)]=n));const o=[new Float32Array(1e4),new Float32Array(1e4)];return(t,s)=>{const h=new Array(t.length+1).fill(!1),a=new Array(t.length+1).fill(!1);let l=0,u=1;for(let e=1;e<t.length+1;e++)o[0][e]=-n-(e-1)*r,o[1][e]=0;o[0][0]=0;for(let g=1;g<s.length+1;g++){o[u][0]=-n-(g-1)*r;for(let f=1;f<t.length+1;f++){const c=o[l][f-1]+i[e[t.charCodeAt(f-1)]][e[s.charCodeAt(g-1)]],_=o[l][f]-(h[f]?r:n),d=o[u][f-1]-(a[f-1]?r:n);o[u][f]=Math.max(c,d,_),o[u][f]===c?(h[f]=!1,a[f]=!1):o[u][f]===d?(h[f]=!1,a[f]=!0):(h[f]=!0,a[f]=!1)}l=u,u=(u+1)%2}const g=Math.max(t.length,s.length);return(g-o[l][t.length])/g}},[h.MONOMER_CHEMICAL_DISTANCE]:r}},1040:(t,e,n)=>{var r,i,s,h,o,a;n.d(e,{CF:()=>i,Qe:()=>o,W:()=>r,Yc:()=>a,gd:()=>h,gk:()=>s}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(r||(r={})),function(t){t.Euclidean="Euclidean"}(i||(i={})),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"}(s||(s={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(h||(h={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray"}(o||(o={})),function(t){t.Difference="Difference"}(a||(a={}))},9657:(t,e,n)=>{n.d(e,{Z:()=>r});class r{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,i=r._createBuffer(n);if(e)for(let t=0;t<i.length;t++)i[t]=-1;this._data=i,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,r){if(t<e||t>n)throw new Error(`Argument ${r} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let r=0;r<n;r++)e[r]=t[r]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new r(t._length);n._length=t._length,n._data=r._createBuffer(n._length),n._version=0;const i=t.lengthInInts;for(let r=0;r<i;r++)n._data[r]=t._data[r]&e._data[r];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new r(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new r(t);for(let r=0;r<t;++r)n.setBit(r,e(r));return n._version=0,n}static fromString(t){return r.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new r(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new r(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let i=0,s=0;for(;e-s>=4;)n._data[i++]=255&t[s]|(255&t[s+1])<<8|(255&t[s+2])<<16|(255&t[s+3])<<24,s+=4;return e-s==3&&(n._data[i]=(255&t[s+2])<<16),e-s==2&&(n._data[i]|=(255&t[s+1])<<8),e-s==1&&(n._data[i]|=255&t[s]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new r(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,r=this.lengthInInts;for(let t=0;t<r;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,r=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(r)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,r=!0,i=!0){if(n&&i&&this.setAll(!e,!1),i)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(r)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let r=t;r<e;++r)n.push(this.getBit(r));return r.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let r=t;r<e;++r)n.push(this.getBit(r));return n}setRange(t,e,n,r=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const i=Math.min(t,e),s=Math.max(t,e);if(n)for(let t=i;t<=s;t++)this.setTrue(t);else for(let t=i;t<=s;t++)this.setFalse(t);return this.incrementVersion(r),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const r=this._length;this.setLength(this._length+e);for(let n=r-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let r=t;r<t+e;r++)this.setBit(r,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let r=-1;-1!=(r=t.findNext(r,!e));)this.setFast(n++,this.getBit(r));this._length=n,this._version++}return this}getBit(t){return 0!=(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=r._onBitCount[255&t];let n=this._data[e];const i=31&this._length;for(0!=i&&(n&=~(4294967295<<i));0!=n;n>>>=8)this._selectedCount+=r._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const i=this.lengthInInts;let s=0;for(;s<i-1;s++)for(let e=this._data[s]&t._data[s];0!=e;e>>>=8)n+=r._onBitCount[255&e];let h=this._data[s]&t._data[s];const o=31&this._length;for(0!=o&&(h&=~(4294967295<<o));0!=h;h>>>=8)n+=r._onBitCount[255&h];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const i=this.lengthInInts;for(let s=Math.floor(t/32);s<i;s++){let i=e?this._data[s]:~this._data[s];if(0!=n)i&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==i)continue;for(let e=0;0!=i;e+=8,i>>>=8){const n=r._firstOnBit[255&i];if(n>=0)return(t=n+32*s+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let i=Math.floor(t/32);i>=0;i--){let t=e?this._data[i]:~this._data[i];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=r._lastOnBit[t>>>24];if(n>=0)return n+32*i+e}}return-1}}r._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),r._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),r._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},1811:(t,e,n)=>{n.d(e,{T:()=>i});const r=new Uint32Array(65536),i=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,i=e.length,s=1<<n-1;let h=-1,o=0,a=n,l=n;for(;l--;)r[t.charCodeAt(l)]|=1<<l;for(l=0;l<i;l++){let t=r[e.charCodeAt(l)];const n=t|o;t|=(t&h)+h^h,o|=~(t|h),h&=t,o&s&&a++,h&s&&a--,o=o<<1|1,h=h<<1|~(n|o),o&=n}for(l=n;l--;)r[t.charCodeAt(l)]=0;return a})(t,e):((t,e)=>{const n=e.length,i=t.length,s=[],h=[],o=Math.ceil(n/32),a=Math.ceil(i/32);for(let t=0;t<o;t++)h[t]=-1,s[t]=0;let l=0;for(;l<a-1;l++){let o=0,a=-1;const u=32*l,g=Math.min(32,i)+u;for(let e=u;e<g;e++)r[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=r[e.charCodeAt(t)],i=h[t/32|0]>>>t&1,l=s[t/32|0]>>>t&1,u=n|o,g=((n|l)&a)+a^a|n|l;let f=o|~(g|a),c=a&g;f>>>31^i&&(h[t/32|0]^=1<<t),c>>>31^l&&(s[t/32|0]^=1<<t),f=f<<1|i,c=c<<1|l,a=c|~(u|f),o=f&u}for(let e=u;e<g;e++)r[t.charCodeAt(e)]=0}let u=0,g=-1;const f=32*l,c=Math.min(32,i-f)+f;for(let e=f;e<c;e++)r[t.charCodeAt(e)]|=1<<e;let _=i;for(let t=0;t<n;t++){const n=r[e.charCodeAt(t)],o=h[t/32|0]>>>t&1,a=s[t/32|0]>>>t&1,l=n|u,f=((n|a)&g)+g^g|n|a;let c=u|~(f|g),d=g&f;_+=c>>>i-1&1,_-=d>>>i-1&1,c>>>31^o&&(h[t/32|0]^=1<<t),d>>>31^a&&(s[t/32|0]^=1<<t),c=c<<1|o,d=d<<1|a,g=d|~(l|c),u=c&l}for(let e=f;e<c;e++)r[t.charCodeAt(e)]=0;return _})(t,e)}},3979:(t,e)=>{e.H$=void 0,e.H$=function(t,e,n){var r=function(t,e,n){if(0===t.length||0===e.length)return 0;if(n&&!n.caseSensitive&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e)return 1;for(var r=0,i=t.length,s=e.length,h=Math.floor(Math.max(i,s)/2)-1,o=new Array(i),a=new Array(s),l=0;l<i;l++)for(var u=Math.max(0,l-h);u<=Math.min(s,l+h+1);u++)if(!o[l]&&!a[u]&&t[l]===e[u]){++r,o[l]=a[u]=!0;break}if(0===r)return 0;var g=0,f=0;for(l=0;l<i;l++)if(o[l]){for(;!a[f];)f++;t.charAt(l)!==e.charAt(f++)&&g++}return(r/i+r/s+(r-(g/=2))/r)/3}(t,e,n),i=0;if(r>.7){for(var s=Math.min(t.length,e.length),h=0;t[h]===e[h]&&h<4&&h<s;)++i,h++;r+=.1*i*(1-r)}return r}}}]);
"use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[36],{5697:(t,e,n)=>{n.d(e,{Dz:()=>C,FV:()=>a,Jv:()=>y,KR:()=>o,MI:()=>M,NB:()=>f,UX:()=>c,WI:()=>g,Zd:()=>u,_h:()=>l,aW:()=>d,bX:()=>B,fX:()=>A,s:()=>_,yU:()=>m});var r=n(9657),i=n(1040),s=n(708);function h(t,e){const n=t.trueCount()+e.trueCount();if(0==n)return 1;const r=t.andWithCountBits(e,!0);return r/(n-r)}function o(t,e){return 1-h(t,e)}function a(t,e){return I(h(new r.Z(t,32*t.length),new r.Z(e,32*e.length)))}function l(t,e){return 1-function(t,e){const n=t.trueCount()+e.trueCount();return 0==n?0:2*t.andWithCountBits(e,!0)/n}(t,e)}function u(t,e){return 1-function(t,e){const n=t.trueCount()*e.trueCount();return 0==n?0:t.andWithCountBits(e,!0)/Math.sqrt(n)}(t,e)}function g(t,e){return Math.sqrt(t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0))}function c(t,e){return t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0)}function f(t,e){return 1-function(t,e){const n=t.trueCount()+e.trueCount(),r=t.andWithCountBits(e,!0);return r/(2*n-3*r)}(t,e)}function _(t,e){return I(function(t,e){const n=t.trueCount()+e.trueCount(),r=t.trueCount()*e.trueCount();return 0==r?0:t.andWithCountBits(e,!0)*n/(2*r)}(t,e))}function d(t,e){return I(function(t,e){const n=t.trueCount()+e.trueCount(),r=t.trueCount()*e.trueCount();return 0==r?0:(t.andWithCountBits(e,!0)*n-r)/r}(t,e))}function m(t,e){return 1-function(t,e){const n=Math.min(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e)}function C(t,e){return I(function(t,e){const n=Math.max(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e))}function A(t,e){return I(function(t,e){return 0==t.length?0:t.andWithCountBits(e,!0)/t.length}(t,e))}function M(t,e){return I(function(t,e){const n=t.andWithCountBits(e,!0),r=t.countBits(!0)+e.countBits(!0),i=t.length,s=i-r+n;return n==i||s==i?1:n/r+s/(2*i-r)}(t,e))}function I(t){return 0===t?3402823e32:1/t-1}function B(t){if(t&&null!=t.range&&t.range>0){const e=t.range;return(t,n)=>Math.abs(t-n)/e}return(t,e)=>Math.abs(t-e)}function y(t){const e=function(t){const e=t?.mostCommon??new Set;return(t,n)=>{const r=t.length,i=n.length;let s=0,h=0,o=0;for(;h<r&&o<i;)t[h]===n[o]?(e?.has(t[h])||++s,++h,++o):t[h]<n[o]?++h:++o;return s}}(t);return(t,n)=>0===n.length||0===t.length?1e4:Math.min(t.length,n.length)/(e(t,n)+1e-4)}i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean,i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean,i.gk.Tanimoto,i.gk.Dice,i.gk.Cosine,i.gk.Tanimoto,i.gk.Asymmetric,i.gk.Cosine,i.gk.Sokal,s.U.HAMMING,s.U.LEVENSHTEIN,s.U.MONOMER_CHEMICAL_DISTANCE,s.U.NEEDLEMANN_WUNSCH},708:(t,e,n)=>{function r(t={}){const e=function(){if(!t||!t.scoringMatrix||!t.alphabetIndexes)return(t,e)=>t===e?0:1;if(t.scoringMatrix.length!==Object.keys(t.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const e=t.alphabetIndexes,n=t.scoringMatrix,r=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,i=new Float32Array((n.length+r)*(n.length+r));return Object.entries(e).forEach((([t,r])=>{const s=n[r];Object.entries(e).forEach((([e,r])=>{i[t.charCodeAt(0)*n.length+e.charCodeAt(0)]=s[r]}))})),(t,e)=>i[t.charCodeAt(0)*n.length+e.charCodeAt(0)]}(),n=t?.threshold??0;return(t,r)=>{let i=0;const s=t.length,h=r.length,o=Math.max(s,h)*(1-n);s!==h&&(i=Math.abs(s-h));let a=0;for(let n=0;n<Math.min(s,h);n++)if(t[n]!==r[n]&&(a+=e(t[n],r[n]),a>o))return 1;return a+=i,a/=Math.max(s,h),a}}n.d(e,{U:()=>h,o:()=>o});var i=n(1811);const s={gapOpen:1,gapExtend:.6,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],alphabetIndexes:{A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};var h;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(h||(h={}));const o={[h.HAMMING]:r,[h.LEVENSHTEIN]:function(){return(t,e)=>(0,i.T)(t,e)/Math.max(t.length,e.length)},[h.NEEDLEMANN_WUNSCH]:function(t){const e=new Uint16Array(65536),{gapOpen:n,gapExtend:r,scoringMatrix:i,alphabetIndexes:h}={...s,...t};Object.entries(h).forEach((([t,n])=>e[t.charCodeAt(0)]=n));const o=[new Float32Array(1e4),new Float32Array(1e4)];return(t,s)=>{const h=new Array(t.length+1).fill(!1),a=new Array(t.length+1).fill(!1);let l=0,u=1;for(let e=1;e<t.length+1;e++)o[0][e]=-n-(e-1)*r,o[1][e]=0;o[0][0]=0;for(let g=1;g<s.length+1;g++){o[u][0]=-n-(g-1)*r;for(let c=1;c<t.length+1;c++){const f=o[l][c-1]+i[e[t.charCodeAt(c-1)]][e[s.charCodeAt(g-1)]],_=o[l][c]-(h[c]?r:n),d=o[u][c-1]-(a[c-1]?r:n);o[u][c]=Math.max(f,d,_),o[u][c]===f?(h[c]=!1,a[c]=!1):o[u][c]===d?(h[c]=!1,a[c]=!0):(h[c]=!0,a[c]=!1)}l=u,u=(u+1)%2}const g=Math.max(t.length,s.length);return(g-o[l][t.length])/g}},[h.MONOMER_CHEMICAL_DISTANCE]:r}},1040:(t,e,n)=>{var r,i,s,h,o,a,l;n.d(e,{CF:()=>i,Qe:()=>o,W:()=>r,Yc:()=>a,gd:()=>h,gj:()=>l,gk:()=>s}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(r||(r={})),function(t){t.Euclidean="Euclidean"}(i||(i={})),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"}(s||(s={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(h||(h={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray",t.NumberArray="NumberArray"}(o||(o={})),function(t){t.Difference="Difference"}(a||(a={})),function(t){t.CommonItems="Common Items"}(l||(l={}))},9657:(t,e,n)=>{n.d(e,{Z:()=>r});class r{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,i=r._createBuffer(n);if(e)for(let t=0;t<i.length;t++)i[t]=-1;this._data=i,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,r){if(t<e||t>n)throw new Error(`Argument ${r} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let r=0;r<n;r++)e[r]=t[r]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new r(t._length);n._length=t._length,n._data=r._createBuffer(n._length),n._version=0;const i=t.lengthInInts;for(let r=0;r<i;r++)n._data[r]=t._data[r]&e._data[r];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new r(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new r(t);for(let r=0;r<t;++r)n.setBit(r,e(r));return n._version=0,n}static fromString(t){return r.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new r(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new r(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let i=0,s=0;for(;e-s>=4;)n._data[i++]=255&t[s]|(255&t[s+1])<<8|(255&t[s+2])<<16|(255&t[s+3])<<24,s+=4;return e-s==3&&(n._data[i]=(255&t[s+2])<<16),e-s==2&&(n._data[i]|=(255&t[s+1])<<8),e-s==1&&(n._data[i]|=255&t[s]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new r(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,r=this.lengthInInts;for(let t=0;t<r;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,r=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(r)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,r=!0,i=!0){if(n&&i&&this.setAll(!e,!1),i)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(r)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let r=t;r<e;++r)n.push(this.getBit(r));return r.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let r=t;r<e;++r)n.push(this.getBit(r));return n}setRange(t,e,n,r=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const i=Math.min(t,e),s=Math.max(t,e);if(n)for(let t=i;t<=s;t++)this.setTrue(t);else for(let t=i;t<=s;t++)this.setFalse(t);return this.incrementVersion(r),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const r=this._length;this.setLength(this._length+e);for(let n=r-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let r=t;r<t+e;r++)this.setBit(r,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let r=-1;-1!=(r=t.findNext(r,!e));)this.setFast(n++,this.getBit(r));this._length=n,this._version++}return this}getBit(t){return 0!=(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=r._onBitCount[255&t];let n=this._data[e];const i=31&this._length;for(0!=i&&(n&=~(4294967295<<i));0!=n;n>>>=8)this._selectedCount+=r._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const i=this.lengthInInts;let s=0;for(;s<i-1;s++)for(let e=this._data[s]&t._data[s];0!=e;e>>>=8)n+=r._onBitCount[255&e];let h=this._data[s]&t._data[s];const o=31&this._length;for(0!=o&&(h&=~(4294967295<<o));0!=h;h>>>=8)n+=r._onBitCount[255&h];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const i=this.lengthInInts;for(let s=Math.floor(t/32);s<i;s++){let i=e?this._data[s]:~this._data[s];if(0!=n)i&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==i)continue;for(let e=0;0!=i;e+=8,i>>>=8){const n=r._firstOnBit[255&i];if(n>=0)return(t=n+32*s+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let i=Math.floor(t/32);i>=0;i--){let t=e?this._data[i]:~this._data[i];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=r._lastOnBit[t>>>24];if(n>=0)return n+32*i+e}}return-1}}r._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),r._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),r._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},1811:(t,e,n)=>{n.d(e,{T:()=>i});const r=new Uint32Array(65536),i=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,i=e.length,s=1<<n-1;let h=-1,o=0,a=n,l=n;for(;l--;)r[t.charCodeAt(l)]|=1<<l;for(l=0;l<i;l++){let t=r[e.charCodeAt(l)];const n=t|o;t|=(t&h)+h^h,o|=~(t|h),h&=t,o&s&&a++,h&s&&a--,o=o<<1|1,h=h<<1|~(n|o),o&=n}for(l=n;l--;)r[t.charCodeAt(l)]=0;return a})(t,e):((t,e)=>{const n=e.length,i=t.length,s=[],h=[],o=Math.ceil(n/32),a=Math.ceil(i/32);for(let t=0;t<o;t++)h[t]=-1,s[t]=0;let l=0;for(;l<a-1;l++){let o=0,a=-1;const u=32*l,g=Math.min(32,i)+u;for(let e=u;e<g;e++)r[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=r[e.charCodeAt(t)],i=h[t/32|0]>>>t&1,l=s[t/32|0]>>>t&1,u=n|o,g=((n|l)&a)+a^a|n|l;let c=o|~(g|a),f=a&g;c>>>31^i&&(h[t/32|0]^=1<<t),f>>>31^l&&(s[t/32|0]^=1<<t),c=c<<1|i,f=f<<1|l,a=f|~(u|c),o=c&u}for(let e=u;e<g;e++)r[t.charCodeAt(e)]=0}let u=0,g=-1;const c=32*l,f=Math.min(32,i-c)+c;for(let e=c;e<f;e++)r[t.charCodeAt(e)]|=1<<e;let _=i;for(let t=0;t<n;t++){const n=r[e.charCodeAt(t)],o=h[t/32|0]>>>t&1,a=s[t/32|0]>>>t&1,l=n|u,c=((n|a)&g)+g^g|n|a;let f=u|~(c|g),d=g&c;_+=f>>>i-1&1,_-=d>>>i-1&1,f>>>31^o&&(h[t/32|0]^=1<<t),d>>>31^a&&(s[t/32|0]^=1<<t),f=f<<1|o,d=d<<1|a,g=d|~(l|f),u=f&l}for(let e=c;e<f;e++)r[t.charCodeAt(e)]=0;return _})(t,e)}},3979:(t,e)=>{e.H$=void 0,e.H$=function(t,e,n){var r=function(t,e,n){if(0===t.length||0===e.length)return 0;if(n&&!n.caseSensitive&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e)return 1;for(var r=0,i=t.length,s=e.length,h=Math.floor(Math.max(i,s)/2)-1,o=new Array(i),a=new Array(s),l=0;l<i;l++)for(var u=Math.max(0,l-h);u<=Math.min(s,l+h+1);u++)if(!o[l]&&!a[u]&&t[l]===e[u]){++r,o[l]=a[u]=!0;break}if(0===r)return 0;var g=0,c=0;for(l=0;l<i;l++)if(o[l]){for(;!a[c];)c++;t.charAt(l)!==e.charAt(c++)&&g++}return(r/i+r/s+(r-(g/=2))/r)/3}(t,e,n),i=0;if(r>.7){for(var s=Math.min(t.length,e.length),h=0;t[h]===e[h]&&h<4&&h<s;)++i,h++;r+=.1*i*(1-r)}return r}}}]);
//# sourceMappingURL=36.js.map

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

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

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

"use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[590],{2590:(n,e,t)=>{t.d(e,{_:()=>a});var r=t(7862),s=t(6814);class a{_workerCount;constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(n,e,s,a=[{}],o=[1],l=r.y.EUCLIDEAN){const h=n[0].length*(n[0].length-1)/2,i=Math.floor(h/this._workerCount),c=n[0].length>2e4?await this.getMinimalThreshold(n,e,a,o,l):0;s<c&&(console.log(`using threshold ${c}`),s=c),a.forEach(((n,e)=>a[e].threshold=s));const w=new Array(this._workerCount),g=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(t.p+t.u(23),t.b))));for(let t=0;t<this._workerCount;t++)w[t]=new Promise(((r,c)=>{const w=t*i,u=t===this._workerCount-1?h:(t+1)*i;u<=w&&r({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:t}),g[t].postMessage({values:n,startIdx:w,endIdx:u,threshold:s,fnNames:e,opts:a,weights:o,aggregationMethod:l}),g[t].onmessage=({data:{error:n,i:e,j:s,distance:a}})=>{n?(g[t].terminate(),c(n)):(g[t].terminate(),r({i:e,j:s,distance:a,idx:t}))}}));const u=await Promise.all(w),d=u.reduce(((n,e)=>n+e.i.length),0),k=new Int32Array(d),m=new Int32Array(d),y=new Float32Array(d);let f=0;for(const n of u)k.set(n.i,f),m.set(n.j,f),y.set(n.distance,f),f+=n.i.length;return{i:k,j:m,distance:y}}async calc(n,e,t,r={}){return await this.calcMultiColumn([n],[e],t,[r],[1])}async getKNN(n,e,t=15,r={}){return await this.multiColumnKNN([n],[e],t,[r],[1])}async getThresholdKNN(n,e,t=.8,r={}){return await this.multiColumnThresholdKnn([n],[e],t,[r],[1])}async multiColumnThresholdKnn(n,e,s=.8,a,o,l=r.y.EUCLIDEAN){if(n.length!==e.length||n.length!==a.length||n.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(n.some((e=>e.length!==n[0].length)))throw new Error("all values arrays should have the same length");const h=n[0].length*(n[0].length-1)/2,i=Math.floor(h/this._workerCount),c=new Array(this._workerCount),w=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(t.p+t.u(427),t.b))));for(let t=0;t<this._workerCount;t++)c[t]=new Promise(((r,c)=>{const g=t*i,u=t===this._workerCount-1?h:(t+1)*i;u<=g&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),w[t].postMessage({values:n,startIdx:g,endIdx:u,fnNames:e,opts:a,threshold:s,weights:o,aggregationMethod:l}),w[t].onmessage=({data:{error:n,knnDistances:e,knnIndexes:s}})=>{n?(w[t].terminate(),c(n)):(w[t].terminate(),r({knnDistances:e,knnIndexes:s}))}}));const g=await Promise.all(c),u=new Int32Array(n[0].length);for(const e of g)for(let t=0;t<n[0].length;++t)u[t]+=e.knnIndexes[t]?.length??0;const d={knnDistances:new Array(n[0].length).fill(null).map(((n,e)=>new Array(u[e]))),knnIndexes:new Array(n[0].length).fill(null).map(((n,e)=>new Array(u[e])))};for(const e of g)for(let t=0;t<n[0].length;++t)for(let n=0;n<e.knnDistances[t]?.length;++n)d.knnDistances[t][u[t]-1]=e.knnDistances[t][n],d.knnIndexes[t][u[t]-1]=e.knnIndexes[t][n],u[t]-=1;return d}async multiColumnKNN(n,e,a=15,o,l,h=r.y.EUCLIDEAN){if(n.length!==e.length||n.length!==o.length||n.length!==l.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(n.some((e=>e.length!==n[0].length)))throw new Error("all values arrays should have the same length");const i=n[0].length*(n[0].length-1)/2,c=Math.floor(i/this._workerCount),w=new Array(this._workerCount),g=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(t.p+t.u(282),t.b))));for(let t=0;t<this._workerCount;t++)w[t]=new Promise(((r,s)=>{const w=t*c,u=t===this._workerCount-1?i:(t+1)*c;u<=w&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),g[t].postMessage({values:n,startIdx:w,endIdx:u,fnNames:e,opts:o,nNeighbours:a,weights:l,aggregationMethod:h}),g[t].onmessage=({data:{error:n,knnDistances:e,knnIndexes:a}})=>{n?(g[t].terminate(),s(n)):(g[t].terminate(),r({knnDistances:e,knnIndexes:a}))}}));const u=await Promise.all(w),d={knnDistances:new Array(n[0].length).fill(null).map((()=>new Array(a).fill(99999))),knnIndexes:new Array(n[0].length).fill(null).map((()=>new Array(a).fill(-1)))};for(const e of u)for(let t=0;t<n[0].length;++t)for(let n=0;n<e.knnDistances[t]?.length;++n)(0,s.cZ)(d.knnDistances[t],d.knnIndexes[t],e.knnDistances[t][n],e.knnIndexes[t][n]);return d}async getSampleDistances(n,e,s=[],a,o=r.y.EUCLIDEAN){const l=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(t.p+t.u(40),t.b))));try{const t=n[0].length*(n[0].length-1)/2,r=Math.floor(t/this._workerCount),h=1e6,i=Math.max(Math.min(t/1e3,h),Math.min(t,h)),c=Math.floor(i/this._workerCount),w=new Array(this._workerCount);for(let h=0;h<this._workerCount;h++)w[h]=new Promise(((i,w)=>{const g=h*r,u=h===this._workerCount-1?t:(h+1)*r;l[h].postMessage({values:n,startIdx:g,endIdx:u,sampleLength:c,fnNames:e,opts:s,weights:a,aggregationMethod:o}),l[h].onmessage=({data:{error:n,distance:e}})=>{l[h].terminate(),n?w(n):i({distance:e})}}));const g=await Promise.all(w),u=g.reduce(((n,e)=>n+e.distance.length),0),d=new Float32Array(u);let k=0;for(const n of g)d.set(n.distance,k),k+=n.distance.length;return d.sort(),d}catch(n){return l?.forEach((n=>n?.terminate())),console.error(n),new Float32Array(1).fill(.5)}}async getMinimalThreshold(n,e,t=[],s,a=r.y.EUCLIDEAN){try{const r=n.length*(n.length-1)/2,o=await this.getSampleDistances(n,e,t,s,a);return 1-o[Math.floor(7e7/r*o.length)]}catch(n){return console.error(n),.5}}static calcSync(n,e,t,r){const a=[],o=[],l=[];let h=0,i=0,c=0;const w=n.length*(n.length-1)/2;for(;h<w;){const e=(0,s.kK)(n[i])||(0,s.kK)(n[c])?1:t(n[i],n[c]);1-e>=r&&(a.push(i),o.push(c),l.push(e)),h++,c++,c===n.length&&(i++,c=i+1)}return{i:new Int32Array(a),j:new Int32Array(o),distance:new Float32Array(l)}}}},7862:(n,e,t)=>{var r;t.d(e,{y:()=>r}),function(n){n.EUCLIDEAN="EUCLIDEAN",n.MANHATTAN="MANHATTAN"}(r||(r={}))}}]);
"use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[590],{2590:(n,e,t)=>{t.d(e,{_:()=>a});var r=t(7862),s=t(6814);class a{constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(n,e,s,a=[{}],o=[1],l=r.y.EUCLIDEAN){const h=n[0].length*(n[0].length-1)/2,i=Math.floor(h/this._workerCount),c=n[0].length>2e4?await this.getMinimalThreshold(n,e,a,o,l):0;s<c&&(console.log(`using threshold ${c}`),s=c),a.forEach(((n,e)=>a[e].threshold=s));const w=new Array(this._workerCount),g=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(t.p+t.u(23),t.b))));for(let t=0;t<this._workerCount;t++)w[t]=new Promise(((r,c)=>{const w=t*i,u=t===this._workerCount-1?h:(t+1)*i;u<=w&&r({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:t}),g[t].postMessage({values:n,startIdx:w,endIdx:u,threshold:s,fnNames:e,opts:a,weights:o,aggregationMethod:l}),g[t].onmessage=({data:{error:n,i:e,j:s,distance:a}})=>{n?(g[t].terminate(),c(n)):(g[t].terminate(),r({i:e,j:s,distance:a,idx:t}))}}));const u=await Promise.all(w),d=u.reduce(((n,e)=>n+e.i.length),0),k=new Int32Array(d),m=new Int32Array(d),y=new Float32Array(d);let f=0;for(const n of u)k.set(n.i,f),m.set(n.j,f),y.set(n.distance,f),f+=n.i.length;return{i:k,j:m,distance:y}}async calc(n,e,t,r={}){return await this.calcMultiColumn([n],[e],t,[r],[1])}async getKNN(n,e,t=15,r={}){return await this.multiColumnKNN([n],[e],t,[r],[1])}async getThresholdKNN(n,e,t=.8,r={}){return await this.multiColumnThresholdKnn([n],[e],t,[r],[1])}async multiColumnThresholdKnn(n,e,s=.8,a,o,l=r.y.EUCLIDEAN){if(n.length!==e.length||n.length!==a.length||n.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(n.some((e=>e.length!==n[0].length)))throw new Error("all values arrays should have the same length");const h=n[0].length*(n[0].length-1)/2,i=Math.floor(h/this._workerCount),c=new Array(this._workerCount),w=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(t.p+t.u(427),t.b))));for(let t=0;t<this._workerCount;t++)c[t]=new Promise(((r,c)=>{const g=t*i,u=t===this._workerCount-1?h:(t+1)*i;u<=g&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),w[t].postMessage({values:n,startIdx:g,endIdx:u,fnNames:e,opts:a,threshold:s,weights:o,aggregationMethod:l}),w[t].onmessage=({data:{error:n,knnDistances:e,knnIndexes:s}})=>{n?(w[t].terminate(),c(n)):(w[t].terminate(),r({knnDistances:e,knnIndexes:s}))}}));const g=await Promise.all(c),u=new Int32Array(n[0].length);for(const e of g)for(let t=0;t<n[0].length;++t)u[t]+=e.knnIndexes[t]?.length??0;const d={knnDistances:new Array(n[0].length).fill(null).map(((n,e)=>new Array(u[e]))),knnIndexes:new Array(n[0].length).fill(null).map(((n,e)=>new Array(u[e])))};for(const e of g)for(let t=0;t<n[0].length;++t)for(let n=0;n<e.knnDistances[t]?.length;++n)d.knnDistances[t][u[t]-1]=e.knnDistances[t][n],d.knnIndexes[t][u[t]-1]=e.knnIndexes[t][n],u[t]-=1;return d}async multiColumnKNN(n,e,a=15,o,l,h=r.y.EUCLIDEAN){if(n.length!==e.length||n.length!==o.length||n.length!==l.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(n.some((e=>e.length!==n[0].length)))throw new Error("all values arrays should have the same length");const i=n[0].length*(n[0].length-1)/2,c=Math.floor(i/this._workerCount),w=new Array(this._workerCount),g=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(t.p+t.u(282),t.b))));for(let t=0;t<this._workerCount;t++)w[t]=new Promise(((r,s)=>{const w=t*c,u=t===this._workerCount-1?i:(t+1)*c;u<=w&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),g[t].postMessage({values:n,startIdx:w,endIdx:u,fnNames:e,opts:o,nNeighbours:a,weights:l,aggregationMethod:h}),g[t].onmessage=({data:{error:n,knnDistances:e,knnIndexes:a}})=>{n?(g[t].terminate(),s(n)):(g[t].terminate(),r({knnDistances:e,knnIndexes:a}))}}));const u=await Promise.all(w),d={knnDistances:new Array(n[0].length).fill(null).map((()=>new Array(a).fill(99999))),knnIndexes:new Array(n[0].length).fill(null).map((()=>new Array(a).fill(-1)))};for(const e of u)for(let t=0;t<n[0].length;++t)for(let n=0;n<e.knnDistances[t]?.length;++n)(0,s.cZ)(d.knnDistances[t],d.knnIndexes[t],e.knnDistances[t][n],e.knnIndexes[t][n]);return d}async getSampleDistances(n,e,s=[],a,o=r.y.EUCLIDEAN){const l=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(t.p+t.u(40),t.b))));try{const t=n[0].length*(n[0].length-1)/2,r=Math.floor(t/this._workerCount),h=1e6,i=Math.max(Math.min(t/1e3,h),Math.min(t,h)),c=Math.floor(i/this._workerCount),w=new Array(this._workerCount);for(let h=0;h<this._workerCount;h++)w[h]=new Promise(((i,w)=>{const g=h*r,u=h===this._workerCount-1?t:(h+1)*r;l[h].postMessage({values:n,startIdx:g,endIdx:u,sampleLength:c,fnNames:e,opts:s,weights:a,aggregationMethod:o}),l[h].onmessage=({data:{error:n,distance:e}})=>{l[h].terminate(),n?w(n):i({distance:e})}}));const g=await Promise.all(w),u=g.reduce(((n,e)=>n+e.distance.length),0),d=new Float32Array(u);let k=0;for(const n of g)d.set(n.distance,k),k+=n.distance.length;return d.sort(),d}catch(n){return l?.forEach((n=>n?.terminate())),console.error(n),new Float32Array(1).fill(.5)}}async getMinimalThreshold(n,e,t=[],s,a=r.y.EUCLIDEAN){try{const r=n.length*(n.length-1)/2,o=await this.getSampleDistances(n,e,t,s,a);return 1-o[Math.floor(7e7/r*o.length)]}catch(n){return console.error(n),.5}}static calcSync(n,e,t,r){const a=[],o=[],l=[];let h=0,i=0,c=0;const w=n.length*(n.length-1)/2;for(;h<w;){const e=(0,s.kK)(n[i])||(0,s.kK)(n[c])?1:t(n[i],n[c]);1-e>=r&&(a.push(i),o.push(c),l.push(e)),h++,c++,c===n.length&&(i++,c=i+1)}return{i:new Int32Array(a),j:new Int32Array(o),distance:new Float32Array(l)}}}},7862:(n,e,t)=>{var r;t.d(e,{y:()=>r}),function(n){n.EUCLIDEAN="EUCLIDEAN",n.MANHATTAN="MANHATTAN"}(r||(r={}))}}]);
//# sourceMappingURL=590.js.map

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

var bio;(()=>{"use strict";var t,e,r={2357:(t,e,r)=>{var o=r(2590);async function n(t,e,r){const o=t.length,n=[],s=[];for(let a=0;a<o;a++)for(let l=a+1;l<o;l++){const o=t[a],i=t[l];e[o]?.[i]>=r&&(n.push(a),s.push(l))}return function(t,e,r){const o=new Float32Array(r.length).fill(0).map((()=>10*Math.random())),n=new Float32Array(r.length).fill(0).map((()=>10*Math.random())),s=new Float32Array(r.length).fill(0),a=new Float32Array(r.length).fill(0);for(let l=0;l<100;l++){const i=1-l/100;s.fill(0),a.fill(0);for(let r=0;r<t.length;r++){const l=t[r],c=e[r],f=o[l]-o[c],h=n[l]-n[c];Math.abs(f)>=1&&(s[l]-=i*f,s[c]+=i*f),Math.abs(h)>=1&&(a[l]-=i*h,a[c]+=i*h)}for(let t=0;t<r.length;t++){const e=Math.sqrt(s[t]*s[t]+a[t]*a[t]);e>0&&(o[t]+=s[t]/e*i,n[t]+=a[t]/e*i)}}let l=o[0],i=n[0],c=o[0],f=n[0];for(let t=1;t<r.length;t++)l=Math.min(l,o[t]),i=Math.min(i,n[t]),c=Math.max(c,o[t]),f=Math.max(f,n[t]);let h=c-l,u=f-i;0===h&&(h=c);for(let t=0;t<r.length;t++)o[t]=(o[t]-l)/h/2+.5;0===u&&(u=f);for(let t=0;t<r.length;t++)n[t]=(n[t]-i)/u/2+.5;return{embedX:o,embedY:n}}(n,s,t)}const s={expandFactor:2,maxIterations:5,inflateFactor:2,multFactor:1};class a{_options;constructor(t={}){this._options={...s,...t}}async transform(t,e){let r=this.toObjectForm(t);if(this._options.maxIterations>0){this.addLoops(r,e),this.normalize(r);for(let t=0;t<this._options.maxIterations;t++)r=this.expand(r,e),this.inflate(r),this.normalize(r)}const{clusters:o,is:n,js:s}=this.assignClusters(r,e);this.correctClusters(o);const a=await this.layout(o,r,e);return{clusters:o,embedX:a.embedX,embedY:a.embedY,is:n,js:s}}correctClusters(t){const e={};for(const r of t)e[r]||(e[r]=0),e[r]++;const r=Object.keys(e).map(Number).sort(((t,r)=>e[t]-e[r])),o={};r.forEach(((t,e)=>o[t]=e+1));for(let e=0;e<t.length;e++)t[e]=o[t[e]]}async layout(t,e,r){const o=new Float32Array(r).fill(0),s=new Float32Array(r).fill(0),a={};t.forEach(((t,e)=>{a[t]||(a[t]=[]),a[t].push(e)}));let l=0;const i=Object.keys(a);i.sort(((t,e)=>a[e].length-a[t].length));let c=6,f=0;for(const t of i){const r=a[t],i=await n(r,e,.001);l===Math.ceil(c/1.5)&&(l=0,f+=5/c,c=Math.ceil(1.5*c));const h=l%c*5/c*1.5;for(let t=0;t<i.embedX.length;t++)o[r[t]]=5*i.embedX[t]/c+h,s[r[t]]=5*i.embedY[t]/c+f;l++}return{embedX:o,embedY:s}}mergeClusters(t,e,r){const o=t[e],n=t[r];for(let e=0;e<t.length;e++)t[e]===n&&(t[e]=o)}assignClusters(t,e){let r=0;const o=[],n=[],s=Math.floor(Math.max(Math.log10(e),2))+1,a=Math.pow(10,s),l=new Array(e).fill(-1);for(const e of Object.keys(t))for(const s of Object.keys(t[e]))Math.round(t[e][s]*a)/a>0&&t[e][s]!==Number(e)&&Number(s)>Number(e)&&(o.push(Number(e)),n.push(Number(s)),-1!==l[Number(e)]&&-1!==l[Number(s)]?l[Number(e)]!==l[Number(s)]&&this.mergeClusters(l,Number(e),Number(s)):-1!==l[Number(e)]?l[Number(s)]=l[Number(e)]:-1!==l[Number(s)]?l[Number(e)]=l[Number(s)]:(r++,l[Number(e)]=r,l[Number(s)]=r));for(let t=0;t<l.length;t++)-1===l[t]&&(r++,l[t]=r);return{clusters:l,is:o,js:n}}toObjectForm(t){const e={};for(let r=0;r<t.i.length;r++)e[t.i[r]]||(e[t.i[r]]={}),e[t.i[r]][t.j[r]]=1-t.distance[r],e[t.j[r]]||(e[t.j[r]]={}),e[t.j[r]][t.i[r]]=1-t.distance[r];return e}addLoops(t,e){for(let r=0;r<e;r++)t[r]||(t[r]={}),t[r][r]=this._options.multFactor}normalize(t){for(const e of Object.keys(t)){const r=t[e];let o=0;for(const t of Object.keys(r))o+=r[t];if(0!==o)for(const n of Object.keys(r))t[e][n]/=o}}expand(t,e){const r={},o=Math.floor(Math.max(Math.log10(e),2))+1,n=Math.pow(10,o);for(let o=0;o<e;o++)if(t[o]){r[o]={};for(let s=o;s<e;s++){if(!t[o]?.[s])continue;const e=this.getExpandValue(t,o,s);Math.round(e*n)/n>0&&(r[o][s]=e,r[s]||(r[s]={}),r[s][o]=e)}}return r}inflate(t){for(const e of Object.keys(t)){const r=t[e];for(const o of Object.keys(r))t[e][o]=Math.pow(t[e][o],this._options.inflateFactor)}}getExpandValue(t,e,r){let o=0;const n=Object.keys(t[e]??{}),s=Object.keys(t[r]??{});for(const a of n)s.includes(a)&&(o+=t[e][a]*t[r][a]);return o}}onmessage=async t=>{const{data:e,threshold:r,weights:n,aggregationMethod:s,distanceFnArgs:l,distanceFns:i,maxIterations:c}=t.data,f=await(new o._).calcMultiColumn(e,i,r/100,l,n,s),h=await new a({maxIterations:c??5}).transform(f,e[0].length);postMessage({res:h})}},6814:(t,e,r)=>{r.d(e,{cZ:()=>n,kK:()=>o}),r(7862);const o=t=>null==t;function n(t,e,r,o){if(r>t[t.length-1])return;const n=t.findIndex((t=>r<t));t.pop(),t.splice(n,0,r),e.pop(),e.splice(n,0,o)}}},o={};function n(t){var e=o[t];if(void 0!==e)return e.exports;var s=o[t]={exports:{}};return r[t](s,s.exports,n),s.exports}n.m=r,n.x=()=>{var t=n.O(void 0,[590],(()=>n(2357)));return n.O(t)},t=[],n.O=(e,r,o,s)=>{if(!r){var a=1/0;for(f=0;f<t.length;f++){for(var[r,o,s]=t[f],l=!0,i=0;i<r.length;i++)(!1&s||a>=s)&&Object.keys(n.O).every((t=>n.O[t](r[i])))?r.splice(i--,1):(l=!1,s<a&&(a=s));if(l){t.splice(f--,1);var c=o();void 0!==c&&(e=c)}}return e}s=s||0;for(var f=t.length;f>0&&t[f-1][2]>s;f--)t[f]=t[f-1];t[f]=[r,o,s]},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.f={},n.e=t=>Promise.all(Object.keys(n.f).reduce(((e,r)=>(n.f[r](t,e),e)),[])),n.u=t=>t+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&!t;)t=r[o--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),(()=>{n.b=self.location+"";var t={709:1};n.f.i=(e,r)=>{t[e]||importScripts(n.p+n.u(e))};var e=self.webpackChunkbio=self.webpackChunkbio||[],r=e.push.bind(e);e.push=e=>{var[o,s,a]=e;for(var l in s)n.o(s,l)&&(n.m[l]=s[l]);for(a&&a(n);o.length;)t[o.pop()]=1;r(e)}})(),e=n.x,n.x=()=>n.e(590).then(e);var s=n.x();bio=s})();
var bio;(()=>{"use strict";var t,e,r={2357:(t,e,r)=>{var o=r(2590);async function n(t,e,r){const o=t.length,n=[],s=[];for(let a=0;a<o;a++)for(let l=a+1;l<o;l++){const o=t[a],i=t[l];e[o]?.[i]>=r&&(n.push(a),s.push(l))}return function(t,e,r){const o=new Float32Array(r.length).fill(0).map((()=>10*Math.random())),n=new Float32Array(r.length).fill(0).map((()=>10*Math.random())),s=new Float32Array(r.length).fill(0),a=new Float32Array(r.length).fill(0);for(let l=0;l<100;l++){const i=1-l/100;s.fill(0),a.fill(0);for(let r=0;r<t.length;r++){const l=t[r],c=e[r],f=o[l]-o[c],h=n[l]-n[c];Math.abs(f)>=1&&(s[l]-=i*f,s[c]+=i*f),Math.abs(h)>=1&&(a[l]-=i*h,a[c]+=i*h)}for(let t=0;t<r.length;t++){const e=Math.sqrt(s[t]*s[t]+a[t]*a[t]);e>0&&(o[t]+=s[t]/e*i,n[t]+=a[t]/e*i)}}let l=o[0],i=n[0],c=o[0],f=n[0];for(let t=1;t<r.length;t++)l=Math.min(l,o[t]),i=Math.min(i,n[t]),c=Math.max(c,o[t]),f=Math.max(f,n[t]);let h=c-l,u=f-i;0===h&&(h=c);for(let t=0;t<r.length;t++)o[t]=(o[t]-l)/h/2+.5;0===u&&(u=f);for(let t=0;t<r.length;t++)n[t]=(n[t]-i)/u/2+.5;return{embedX:o,embedY:n}}(n,s,t)}const s={expandFactor:2,maxIterations:5,inflateFactor:2,multFactor:1};class a{constructor(t={}){this._options={...s,...t}}async transform(t,e){let r=this.toObjectForm(t);if(this._options.maxIterations>0){this.addLoops(r,e),this.normalize(r);for(let t=0;t<this._options.maxIterations;t++)r=this.expand(r,e),this.inflate(r),this.normalize(r)}const{clusters:o,is:n,js:s}=this.assignClusters(r,e);this.correctClusters(o);const a=await this.layout(o,r,e);return{clusters:o,embedX:a.embedX,embedY:a.embedY,is:n,js:s}}correctClusters(t){const e={};for(const r of t)e[r]||(e[r]=0),e[r]++;const r=Object.keys(e).map(Number).sort(((t,r)=>e[t]-e[r])),o={};r.forEach(((t,e)=>o[t]=e+1));for(let e=0;e<t.length;e++)t[e]=o[t[e]]}async layout(t,e,r){const o=new Float32Array(r).fill(0),s=new Float32Array(r).fill(0),a={};t.forEach(((t,e)=>{a[t]||(a[t]=[]),a[t].push(e)}));let l=0;const i=Object.keys(a);i.sort(((t,e)=>a[e].length-a[t].length));let c=6,f=0;for(const t of i){const r=a[t],i=await n(r,e,.001);l===Math.ceil(c/1.5)&&(l=0,f+=5/c,c=Math.ceil(1.5*c));const h=l%c*5/c*1.5;for(let t=0;t<i.embedX.length;t++)o[r[t]]=5*i.embedX[t]/c+h,s[r[t]]=5*i.embedY[t]/c+f;l++}return{embedX:o,embedY:s}}mergeClusters(t,e,r){const o=t[e],n=t[r];for(let e=0;e<t.length;e++)t[e]===n&&(t[e]=o)}assignClusters(t,e){let r=0;const o=[],n=[],s=Math.floor(Math.max(Math.log10(e),2))+1,a=Math.pow(10,s),l=new Array(e).fill(-1);for(const e of Object.keys(t))for(const s of Object.keys(t[e]))Math.round(t[e][s]*a)/a>0&&t[e][s]!==Number(e)&&Number(s)>Number(e)&&(o.push(Number(e)),n.push(Number(s)),-1!==l[Number(e)]&&-1!==l[Number(s)]?l[Number(e)]!==l[Number(s)]&&this.mergeClusters(l,Number(e),Number(s)):-1!==l[Number(e)]?l[Number(s)]=l[Number(e)]:-1!==l[Number(s)]?l[Number(e)]=l[Number(s)]:(r++,l[Number(e)]=r,l[Number(s)]=r));for(let t=0;t<l.length;t++)-1===l[t]&&(r++,l[t]=r);return{clusters:l,is:o,js:n}}toObjectForm(t){const e={};for(let r=0;r<t.i.length;r++)e[t.i[r]]||(e[t.i[r]]={}),e[t.i[r]][t.j[r]]=1-t.distance[r],e[t.j[r]]||(e[t.j[r]]={}),e[t.j[r]][t.i[r]]=1-t.distance[r];return e}addLoops(t,e){for(let r=0;r<e;r++)t[r]||(t[r]={}),t[r][r]=this._options.multFactor}normalize(t){for(const e of Object.keys(t)){const r=t[e];let o=0;for(const t of Object.keys(r))o+=r[t];if(0!==o)for(const n of Object.keys(r))t[e][n]/=o}}expand(t,e){const r={},o=Math.floor(Math.max(Math.log10(e),2))+1,n=Math.pow(10,o);for(let o=0;o<e;o++)if(t[o]){r[o]={};for(let s=o;s<e;s++){if(!t[o]?.[s])continue;const e=this.getExpandValue(t,o,s);Math.round(e*n)/n>0&&(r[o][s]=e,r[s]||(r[s]={}),r[s][o]=e)}}return r}inflate(t){for(const e of Object.keys(t)){const r=t[e];for(const o of Object.keys(r))t[e][o]=Math.pow(t[e][o],this._options.inflateFactor)}}getExpandValue(t,e,r){let o=0;const n=Object.keys(t[e]??{}),s=Object.keys(t[r]??{});for(const a of n)s.includes(a)&&(o+=t[e][a]*t[r][a]);return o}}onmessage=async t=>{const{data:e,threshold:r,weights:n,aggregationMethod:s,distanceFnArgs:l,distanceFns:i,maxIterations:c}=t.data,f=await(new o._).calcMultiColumn(e,i,r/100,l,n,s),h=await new a({maxIterations:c??5}).transform(f,e[0].length);postMessage({res:h})}},6814:(t,e,r)=>{r.d(e,{cZ:()=>n,kK:()=>o}),r(7862);const o=t=>null==t;function n(t,e,r,o){if(r>t[t.length-1])return;const n=t.findIndex((t=>r<t));t.pop(),t.splice(n,0,r),e.pop(),e.splice(n,0,o)}}},o={};function n(t){var e=o[t];if(void 0!==e)return e.exports;var s=o[t]={exports:{}};return r[t](s,s.exports,n),s.exports}n.m=r,n.x=()=>{var t=n.O(void 0,[590],(()=>n(2357)));return n.O(t)},t=[],n.O=(e,r,o,s)=>{if(!r){var a=1/0;for(f=0;f<t.length;f++){for(var[r,o,s]=t[f],l=!0,i=0;i<r.length;i++)(!1&s||a>=s)&&Object.keys(n.O).every((t=>n.O[t](r[i])))?r.splice(i--,1):(l=!1,s<a&&(a=s));if(l){t.splice(f--,1);var c=o();void 0!==c&&(e=c)}}return e}s=s||0;for(var f=t.length;f>0&&t[f-1][2]>s;f--)t[f]=t[f-1];t[f]=[r,o,s]},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.f={},n.e=t=>Promise.all(Object.keys(n.f).reduce(((e,r)=>(n.f[r](t,e),e)),[])),n.u=t=>t+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&!t;)t=r[o--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),(()=>{n.b=self.location+"";var t={709:1};n.f.i=(e,r)=>{t[e]||importScripts(n.p+n.u(e))};var e=self.webpackChunkbio=self.webpackChunkbio||[],r=e.push.bind(e);e.push=e=>{var[o,s,a]=e;for(var l in s)n.o(s,l)&&(n.m[l]=s[l]);for(a&&a(n);o.length;)t[o.pop()]=1;r(e)}})(),e=n.x,n.x=()=>n.e(590).then(e);var s=n.x();bio=s})();
//# sourceMappingURL=709.js.map

@@ -5,6 +5,6 @@ {

"author": {
"name": "Leonid Stolbov",
"email": "lstolbov@datagrok.ai"
"name": "Aleksandr Tanas",
"email": "atanas@datagrok.ai"
},
"version": "2.11.42",
"version": "2.12.0",
"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,6 +38,6 @@ "repository": {

"@biowasm/aioli": "^3.1.0",
"@datagrok-libraries/bio": "5.39.29",
"@datagrok-libraries/chem-meta": "^1.2.1",
"@datagrok-libraries/ml": "^6.4.10",
"@datagrok-libraries/tutorials": "^1.3.11",
"@datagrok-libraries/bio": "5.40.0",
"@datagrok-libraries/chem-meta": "^1.2.3",
"@datagrok-libraries/ml": "^6.4.12",
"@datagrok-libraries/tutorials": "^1.3.12",
"ajv": "^8.12.0",

@@ -59,5 +59,5 @@ "ajv-errors": "^3.0.0",

"devDependencies": {
"@datagrok/chem": "^1.8.11",
"@datagrok/dendrogram": "^1.2.22",
"@datagrok/helm": "^2.1.27",
"@datagrok/chem": "^1.9.0",
"@datagrok/dendrogram": "^1.2.27",
"@datagrok/helm": "^2.1.30",
"@types/node": "^17.0.24",

@@ -64,0 +64,0 @@ "@types/wu": "latest",

@@ -19,3 +19,3 @@ # Bio

* [detectMacromolecule()](../Bio/detectors.js)
* [class UnitsHandler](../../libraries/bio/src/utils/units-handler.ts)
* [class SeqHandler](../../libraries/bio/src/utils/seq-handler.ts)

@@ -22,0 +22,0 @@ ## Atomic-Level structures from sequences

@@ -5,2 +5,4 @@ import * as grok from 'datagrok-api/grok';

import wu from 'wu';
import {ITooltipAndPanelParams} from '@datagrok-libraries/ml/src/viewers/activity-cliffs';

@@ -12,3 +14,3 @@ import {getSimilarityFromDistance} from '@datagrok-libraries/ml/src/distance-metrics-methods';

import {TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';

@@ -102,6 +104,4 @@

const sequencesArray = new Array<string>(2);
const activitiesArray = new Array<number>(2);
params.points.forEach((molIdx, idx) => {
sequencesArray[idx] = params.seqCol.get(molIdx);
activitiesArray[idx] = params.activityCol.get(molIdx);

@@ -111,7 +111,6 @@ });

const molDifferences: { [key: number]: HTMLCanvasElement } = {};
const uh = UnitsHandler.getOrCreate(params.seqCol);
const splitter = uh.getSplitter();
const subParts1 = splitter(sequencesArray[0]);
const subParts2 = splitter(sequencesArray[1]);
const canvas = createDifferenceCanvas(subParts1, subParts2, uh.units, molDifferences);
const sh = SeqHandler.forColumn(params.seqCol);
const subParts1 = sh.getSplitted(params.points[0]); // splitter(sequencesArray[0], {uh, rowIdx: -1});
const subParts2 = sh.getSplitted(params.points[1]); // splitter(sequencesArray[1], {uh, rowIdx: -1});
const canvas = createDifferenceCanvas(subParts1, subParts2, sh.units, molDifferences);
propPanel.append(ui.div(canvas, {style: {width: '300px', overflow: 'scroll'}}));

@@ -142,3 +141,4 @@

canvas.height = 30;
drawMoleculeDifferenceOnCanvas(context!, 0, 0, 0, 30, subParts1, subParts2, units, true, molDifferences);
drawMoleculeDifferenceOnCanvas(context!, 0, 0, 0, 30,
wu(subParts1.canonicals).toArray(), wu(subParts2.canonicals).toArray(), units, true, molDifferences);
return canvas;

@@ -145,0 +145,0 @@ }

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

import {Subject} from 'rxjs';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {getEncodedSeqSpaceCol} from './sequence-space';

@@ -33,4 +33,4 @@ import {MmDistanceFunctionsNames} from '@datagrok-libraries/ml/src/macromolecule-distance-functions';

if (computeData && this.moleculeColumn) {
const uh = UnitsHandler.getOrCreate(this.moleculeColumn);
await (uh.isFasta() ? this.computeByMM() : this.computeByChem());
const sh = SeqHandler.forColumn(this.moleculeColumn);
await (sh.isFasta() ? this.computeByMM() : this.computeByChem());

@@ -37,0 +37,0 @@ const diverseColumnName: string = this.diverseColumnLabel != null ? this.diverseColumnLabel :

@@ -17,3 +17,3 @@ import * as ui from 'datagrok-api/ui';

fingerprintChoices = ['Morgan', 'Pattern'];
moleculeColumn?: DG.Column | null;
moleculeColumn?: DG.Column<string>;
moleculeColumnName: string;

@@ -55,3 +55,3 @@ initialized: boolean = false;

.subscribe((_: any) => this.render(false)));
this.moleculeColumn = this.dataFrame.columns.bySemType(DG.SEMTYPE.MACROMOLECULE);
this.moleculeColumn = this.dataFrame.columns.bySemType(DG.SEMTYPE.MACROMOLECULE) as DG.Column<string>;
this.moleculeColumnName = this.moleculeColumn?.name!;

@@ -58,0 +58,0 @@ this.getProperty('limit')!.fromOptions({min: 1, max: this.dataFrame.rowCount});

@@ -10,3 +10,3 @@ import * as grok from 'datagrok-api/grok';

import {Subject} from 'rxjs';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {alignSequencePair} from '@datagrok-libraries/bio/src/utils/macromolecule/alignment';

@@ -54,5 +54,5 @@ import {KnnResult, SparseMatrixService} from '@datagrok-libraries/ml/src/distance-matrix/sparse-matrix-service';

this.targetMoleculeIdx = this.dataFrame!.currentRowIdx == -1 ? 0 : this.dataFrame!.currentRowIdx;
const uh = UnitsHandler.getOrCreate(this.moleculeColumn!);
const sh = SeqHandler.forColumn(this.moleculeColumn!);
await (!uh.isHelm() ? this.computeByMM() : this.computeByChem());
await (!sh.isHelm() ? this.computeByMM() : this.computeByChem());
const similarColumnName: string = this.similarColumnLabel != null ? this.similarColumnLabel :

@@ -126,9 +126,9 @@ `similar (${this.moleculeColumnName})`;

const molColName = this.molCol?.name!;
const col = resDf.col(molColName)!;
const uh = UnitsHandler.getOrCreate(col);
const splitter = uh.getSplitter();
const subParts1 = splitter(this.moleculeColumn!.get(this.targetMoleculeIdx));
const subParts2 = splitter(resDf.get(molColName, resDf.currentRowIdx));
const alignment = alignSequencePair(Array.from(subParts1), Array.from(subParts2));
const canvas = createDifferenceCanvas(alignment.seq1Splitted, alignment.seq2Splitted, uh.units, molDifferences);
const resCol: DG.Column<string> = resDf.col(molColName)!;
const molColSh = SeqHandler.forColumn(this.moleculeColumn!);
const resSh = SeqHandler.forColumn(resCol);
const subParts1 = molColSh.getSplitted(this.targetMoleculeIdx);
const subParts2 = resSh.getSplitted(resDf.currentRowIdx);
const alignment = alignSequencePair(subParts1, subParts2);
const canvas = createDifferenceCanvas(alignment.seq1Splitted, alignment.seq2Splitted, resSh.units, molDifferences);
propPanel.append(ui.div(canvas, {style: {width: '300px', overflow: 'scroll'}}));

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

@@ -0,6 +1,8 @@

import * as ui from 'datagrok-api/ui';
import * as DG from 'datagrok-api/dg';
import * as grok from 'datagrok-api/grok';
import {BitArrayMetrics} from '@datagrok-libraries/ml/src/typed-metrics';
import {mmDistanceFunctionArgs} from '@datagrok-libraries/ml/src/macromolecule-distance-functions/types';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {getMonomerSubstitutionMatrix} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';

@@ -16,20 +18,23 @@ import {MmDistanceFunctionsNames} from '@datagrok-libraries/ml/src/macromolecule-distance-functions';

seqCol: DG.Column, similarityMetric: BitArrayMetrics | MmDistanceFunctionsNames, fingerprintType: string = 'Morgan'
): Promise<{seqList:string[], options: {[_:string]: any}}> {
// encodes sequences using utf charachters to also support multichar and non fasta sequences
const ncUH = UnitsHandler.getOrCreate(seqCol);
const seqList = seqCol.toList();
const splitter = ncUH.getSplitter();
const seqColLength = seqList.length;
): Promise<{ seqList: string[], options: { [_: string]: any } }> {
// encodes sequences using utf characters to also support multichar and non fasta sequences
const rowCount = seqCol.length;
const sh = SeqHandler.forColumn(seqCol);
const encList = Array<string>(rowCount);
let charCodeCounter = 36;
const charCodeMap = new Map<string, string>();
for (let i = 0; i < seqColLength; i++) {
const seq = seqList[i];
if (seqList[i] === null || seqCol.isNone(i)) {
seqList[i] = null;
const seqColCats = seqCol.categories;
const seqColRawData = seqCol.getRawData();
for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
const catI = seqColRawData[rowIdx];
const seq = seqColCats[catI];
if (seq === null || seqCol.isNone(rowIdx)) {
// @ts-ignore
encList[rowIdx] = null;
continue;
}
seqList[i] = '';
const splittedSeq = splitter(seq);
encList[rowIdx] = '';
const splittedSeq = sh.getSplitted(rowIdx);
for (let j = 0; j < splittedSeq.length; j++) {
const char = splittedSeq[j];
const char = splittedSeq.getCanonical(j);
if (!charCodeMap.has(char)) {

@@ -39,6 +44,6 @@ charCodeMap.set(char, String.fromCharCode(charCodeCounter));

}
seqList[i] += charCodeMap.get(char)!;
encList[rowIdx] += charCodeMap.get(char)!;
}
}
let options = {};
let options = {} as mmDistanceFunctionArgs;
if (similarityMetric === MmDistanceFunctionsNames.MONOMER_CHEMICAL_DISTANCE) {

@@ -53,3 +58,3 @@ const monomers = Array.from(charCodeMap.keys());

});
const monomerHashToMatrixMap: {[_: string]: number} = {};
const monomerHashToMatrixMap: { [_: string]: number } = {};
Object.entries(monomerRes.alphabetIndexes).forEach(([key, value]) => {

@@ -59,4 +64,3 @@ monomerHashToMatrixMap[charCodeMap.get(key)!] = value;

// sets distance function args in place.
options = {scoringMatrix: monomerRes.scoringMatrix,
alphabetIndexes: monomerHashToMatrixMap} satisfies mmDistanceFunctionArgs;
options = {scoringMatrix: monomerRes.scoringMatrix, alphabetIndexes: monomerHashToMatrixMap};
} else if (similarityMetric === MmDistanceFunctionsNames.NEEDLEMANN_WUNSCH) {

@@ -71,3 +75,3 @@ const monomers = Array.from(charCodeMap.keys());

// });
const monomerHashToMatrixMap: {[_: string]: number} = {};
const monomerHashToMatrixMap: { [_: string]: number } = {};
Object.entries(monomerRes.alphabetIndexes).forEach(([key, value]) => {

@@ -77,6 +81,5 @@ monomerHashToMatrixMap[charCodeMap.get(key)!] = value;

// sets distance function args in place.
options = {scoringMatrix: monomerRes.scoringMatrix,
alphabetIndexes: monomerHashToMatrixMap} satisfies mmDistanceFunctionArgs;
options = {scoringMatrix: monomerRes.scoringMatrix, alphabetIndexes: monomerHashToMatrixMap};
}
return {seqList, options};
return {seqList: encList, options};
}

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

import {getHelmMonomers} from '../package';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {GAP_SYMBOL, ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';

@@ -17,7 +17,7 @@ const V2000_ATOM_NAME_POS = 31;

): Promise<DG.Column> {
const uh = UnitsHandler.getOrCreate(mcol);
const sh = SeqHandler.forColumn(mcol);
let molV3000Array;
monomersDict ??= new Map();
const monomers = uh.isHelm() ?
getHelmMonomers(mcol) : Object.keys(uh.stats.freq).filter((it) => it !== '');
const monomers = sh.isHelm() ?
getHelmMonomers(mcol) : Object.keys(sh.stats.freq).filter((it) => it !== '');

@@ -29,3 +29,3 @@ for (let i = 0; i < monomers.length; i++) {

if (uh.isHelm()) {
if (sh.isHelm()) {
molV3000Array = await grok.functions.call('HELM:getMolFiles', {col: mcol});

@@ -36,4 +36,3 @@ molV3000Array = changeV2000ToV3000(molV3000Array, monomersDict, pattern);

for (let i = 0; i < mcol.length; i++) {
const sequenceMonomers = wu(uh.splitted[i]).filter((it) => it !== '').toArray();
const molV3000 = molV3000FromNonHelmSequence(sequenceMonomers, monomersDict, pattern);
const molV3000 = molV3000FromNonHelmSequence(sh.getSplitted(i), monomersDict, pattern);
molV3000Array[i] = molV3000;

@@ -58,5 +57,8 @@ }

for (let atomRowI = 0; atomRowI < monomers.length; atomRowI++) {
molV3000 += pattern ?
`M V30 ${atomRowI + 1} R${monomersDict.get(monomers[atomRowI])} 0.000 0.000 0 0\n` :
`M V30 ${atomRowI + 1} At 0.000 0.000 0 0 MASS=${monomersDict.get(monomers[atomRowI])}\n`;
const cm: string = monomers.getCanonical(atomRowI);
if (cm !== GAP_SYMBOL) {
molV3000 += pattern ?
`M V30 ${atomRowI + 1} R${monomersDict.get(cm)} 0.000 0.000 0 0\n` :
`M V30 ${atomRowI + 1} At 0.000 0.000 0 0 MASS=${monomersDict.get(cm)}\n`;
}
}

@@ -63,0 +65,0 @@

@@ -15,3 +15,3 @@ /* Do not change these import lines to match external modules in webpack configuration */

} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {IMonomerLib} from '@datagrok-libraries/bio/src/types';

@@ -169,7 +169,7 @@ import {SeqPalette} from '@datagrok-libraries/bio/src/seq-palettes';

//name: getUnitsHandler
//name: getSeqHandler
//input: column sequence { semType: Macromolecule }
//output: object result
export function getUnitsHandler(sequence: DG.Column<string>): UnitsHandler {
return UnitsHandler.getOrCreate(sequence);
export function getSeqHandler(sequence: DG.Column<string>): SeqHandler {
return SeqHandler.forColumn(sequence);
}

@@ -616,3 +616,3 @@

const _colUH = UnitsHandler.getOrCreate(col);
const _colSh = SeqHandler.forColumn(col);
// TODO: prevent for cyclic, branched or multiple chains in Helm

@@ -636,3 +636,3 @@ return true;

const colListNames: string [] = colList.map((col) => col.name);
const selectedCol = colList.find((c) => { return UnitsHandler.getOrCreate(c).isMsa(); });
const selectedCol = colList.find((c) => { return SeqHandler.forColumn(c).isMsa(); });
const colInput: DG.InputBase = ui.choiceInput(

@@ -780,4 +780,4 @@ 'Column', selectedCol ? selectedCol.name : colListNames[0], colListNames);

export function getHelmMonomers(sequence: DG.Column<string>): string[] {
const uh = UnitsHandler.getOrCreate(sequence);
const stats = uh.stats;
const sh = SeqHandler.forColumn(sequence);
const stats = sh.stats;
return Object.keys(stats.freq);

@@ -784,0 +784,0 @@ }

@@ -7,7 +7,3 @@ import * as grok from 'datagrok-api/grok';

import {
getAlphabetSimilarity,
monomerToShort,
pickUpPalette,
splitterAsFasta,
splitterAsHelm,
NOTATION, getAlphabetSimilarity, monomerToShort, pickUpPalette, splitterAsFasta, splitterAsHelm,
} from '@datagrok-libraries/bio/src/utils/macromolecule';

@@ -17,3 +13,2 @@ import {Nucleotides, NucleotidesPalettes} from '@datagrok-libraries/bio/src/nucleotides';

import {UnknownSeqPalette} from '@datagrok-libraries/bio/src/unknown';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {getStatsForCol} from '@datagrok-libraries/bio/src/utils/macromolecule/utils';

@@ -68,2 +63,4 @@

const seqCol: DG.Column = df.getCol('seq')!;
seqCol.semType = DG.SEMTYPE.MACROMOLECULE;
seqCol.setTag(DG.TAGS.UNITS, NOTATION.HELM);
const stats = getStatsForCol(seqCol, 1, splitterAsHelm);

@@ -138,2 +135,4 @@

const seqCol: DG.Column = dfN1.col('seq')!;
seqCol.semType = DG.SEMTYPE.MACROMOLECULE;
seqCol.setTag(DG.TAGS.UNITS, NOTATION.FASTA);
const stats = getStatsForCol(seqCol, 5, splitterAsFasta);

@@ -167,2 +166,4 @@

const col: DG.Column = df.col('seq')!;
col.semType = DG.SEMTYPE.MACROMOLECULE;
col.setTag(DG.TAGS.UNITS, NOTATION.FASTA);
const cp = pickUpPalette(col);

@@ -176,2 +177,4 @@

const col: DG.Column = df.col('seq')!;
col.semType = DG.SEMTYPE.MACROMOLECULE;
col.setTag(DG.TAGS.UNITS, NOTATION.FASTA);
const cp = pickUpPalette(col);

@@ -185,2 +188,4 @@

const col: DG.Column = df.col('seq')!;
col.semType = DG.SEMTYPE.MACROMOLECULE;
col.setTag(DG.TAGS.UNITS, NOTATION.FASTA);
const cp = pickUpPalette(col);

@@ -194,2 +199,4 @@

const col: DG.Column = df.col('seq')!;
col.semType = DG.SEMTYPE.MACROMOLECULE;
col.setTag(DG.TAGS.UNITS, NOTATION.FASTA);
const cp = pickUpPalette(col);

@@ -196,0 +203,0 @@

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

import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';

@@ -137,4 +137,4 @@ // import {mmSemType} from '../const';

return function(srcCol: DG.Column): DG.Column {
const converterUH = UnitsHandler.getOrCreate(srcCol);
const resCol = converterUH.convert(tgtNotation, tgtSeparator);
const converterSh = SeqHandler.forColumn(srcCol);
const resCol = converterSh.convert(tgtNotation, tgtSeparator);
expect(resCol.getTag(DG.TAGS.UNITS), tgtNotation);

@@ -157,3 +157,3 @@ return resCol;

expectArray(resCol.toList(), tgtCol.toList());
const _uh: UnitsHandler = UnitsHandler.getOrCreate(resCol);
const _sh: SeqHandler = SeqHandler.forColumn(resCol);
}

@@ -160,0 +160,0 @@

@@ -7,3 +7,3 @@ import * as grok from 'datagrok-api/grok';

import {ALPHABET, getAlphabet, NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';

@@ -128,7 +128,7 @@ category('detectorsBenchmark', () => {

function checkDetectorRes(col: DG.Column, tgt: TgtType): void {
const uh = UnitsHandler.getOrCreate(col);
const sh = SeqHandler.forColumn(col);
expect(col.semType === tgt.semType, true);
expect(uh.notation === tgt.notation, true);
expect(uh.alphabet === tgt.alphabet, true);
expect(uh.separator === tgt.separator, true);
expect(sh.notation === tgt.notation, true);
expect(sh.alphabet === tgt.alphabet, true);
expect(sh.separator === tgt.separator, true);
}

@@ -135,0 +135,0 @@ });

@@ -9,3 +9,3 @@ import * as grok from 'datagrok-api/grok';

import {ALIGNMENT, ALPHABET, NOTATION, TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';

@@ -437,8 +437,8 @@ /*

const uh = UnitsHandler.getOrCreate(col);
expect(uh.getAlphabetSize(), alphabetSize);
expect(uh.getAlphabetIsMultichar(), alphabetIsMultichar);
if (!uh.isHelm()) {
expect(uh.aligned, aligned);
expect(uh.alphabet, alphabet);
const sh = SeqHandler.forColumn(col);
expect(sh.getAlphabetSize(), alphabetSize);
expect(sh.getAlphabetIsMultichar(), alphabetIsMultichar);
if (!sh.isHelm()) {
expect(sh.aligned, aligned);
expect(sh.alphabet, alphabet);
}

@@ -466,8 +466,8 @@ }

const uh = UnitsHandler.getOrCreate(col);
expect(uh.getAlphabetSize(), alphabetSize);
expect(uh.getAlphabetIsMultichar(), alphabetIsMultichar);
if (!uh.isHelm()) {
expect(uh.aligned, aligned);
expect(uh.alphabet, alphabet);
const sh = SeqHandler.forColumn(col);
expect(sh.getAlphabetSize(), alphabetSize);
expect(sh.getAlphabetIsMultichar(), alphabetIsMultichar);
if (!sh.isHelm()) {
expect(sh.aligned, aligned);
expect(sh.alphabet, alphabet);
}

@@ -474,0 +474,0 @@ }

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

import {saveAsFastaDo, wrapSequence} from '../utils/save-as-fasta';
import {splitterAsFasta} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {NOTATION, splitterAsFasta} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';

@@ -91,6 +92,9 @@ type SaveAsFastaTestArgs = { srcCsv: string, idCols: string [], seqCol: string, lineWidth: number, tgtFasta: string };

function _testWrapSequence(testKey: string, lineWidth: number = 10) {
const splitter = splitterAsFasta;
const srcSeq: string = wrapData[testKey].src;
const wrapRes: string[] = wrapSequence(srcSeq, splitter, lineWidth);
const col = DG.Column.fromStrings('src', [srcSeq]);
col.semType = DG.SEMTYPE.MACROMOLECULE;
col.setTag(DG.TAGS.UNITS, NOTATION.FASTA);
const sh = SeqHandler.forColumn(col);
const srcSS = sh.getSplitted(0);
const wrapRes: string[] = wrapSequence(srcSS, lineWidth);
const wrapTgt: string[] = wrapData[testKey].tgt;

@@ -105,2 +109,4 @@

const seqCol: DG.Column = df.getCol(args.seqCol);
seqCol.semType = DG.SEMTYPE.MACROMOLECULE;
seqCol.setTag(DG.TAGS.UNITS, NOTATION.FASTA);
const idCols: DG.Column[] = args.idCols.map((colName) => df.getCol(colName));

@@ -107,0 +113,0 @@

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

import {category, expect, test} from '@datagrok-libraries/utils/src/test';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {MmDistanceFunctionsNames, mmDistanceFunctions}

@@ -46,4 +46,4 @@ from '@datagrok-libraries/ml/src/macromolecule-distance-functions';

test('protein-distance-function', async () => {
const uh = await _initMacromoleculeColumn(protTable);
const distFunc = uh.getDistanceFunctionName();
const sh = await _initMacromoleculeColumn(protTable);
const distFunc = sh.getDistanceFunctionName();
expect(distFunc, MmDistanceFunctionsNames.LEVENSHTEIN);

@@ -53,4 +53,4 @@ });

test('DNA-distance-function', async () => {
const uh = await _initMacromoleculeColumn(DNATable);
const distFunc = uh.getDistanceFunctionName();
const sh = await _initMacromoleculeColumn(DNATable);
const distFunc = sh.getDistanceFunctionName();
expect(distFunc, MmDistanceFunctionsNames.LEVENSHTEIN);

@@ -60,4 +60,4 @@ });

test('MSA-distance-function', async () => {
const uh = await _initMacromoleculeColumn(MSATable);
const distFunc = uh.getDistanceFunctionName();
const sh = await _initMacromoleculeColumn(MSATable);
const distFunc = sh.getDistanceFunctionName();
expect(distFunc, MmDistanceFunctionsNames.HAMMING);

@@ -132,3 +132,3 @@ });

async function _initMacromoleculeColumn(csv: string): Promise<UnitsHandler> {
async function _initMacromoleculeColumn(csv: string): Promise<SeqHandler> {
const srcDf: DG.DataFrame = DG.DataFrame.fromCsv(csv);

@@ -141,4 +141,4 @@ const seqCol = srcDf.col('seq')!;

await grok.data.detectSemanticTypes(srcDf);
const uh = UnitsHandler.getOrCreate(seqCol);
return uh;
const sh = SeqHandler.forColumn(seqCol);
return sh;
}

@@ -145,0 +145,0 @@

@@ -106,9 +106,7 @@ import * as grok from 'datagrok-api/grok';

const srcDf: DG.DataFrame = DG.DataFrame.fromCsv(srcCsv);
await grok.data.detectSemanticTypes(srcDf);
const tgtDf: DG.DataFrame = DG.DataFrame.fromCsv(tgtCsv);
const srcCol: DG.Column = srcDf.getCol('seq')!;
const semType: string = await grok.functions
.call('Bio:detectMacromolecule', {col: srcCol}) as unknown as string;
if (semType)
srcCol.semType = semType;
expect(srcCol.semType, DG.SEMTYPE.MACROMOLECULE);

@@ -125,20 +123,15 @@ const tgtCol: DG.Column = tgtDf.getCol('seq')!;

const srcDf: DG.DataFrame = DG.DataFrame.fromCsv(srcCsv);
await grok.data.detectSemanticTypes(srcDf);
const tgtDf: DG.DataFrame = DG.DataFrame.fromCsv(tgtCsv);
const srcSeqCol = srcDf.getCol('seq')!;
const tgtCol = tgtDf.getCol('seq')!;
const srcCol: DG.Column = srcDf.getCol('seq')!;
const semType: string = await grok.functions
.call('Bio:detectMacromolecule', {col: srcCol}) as unknown as string;
if (semType)
srcCol.semType = semType;
await grok.data.detectSemanticTypes(srcDf);
expect(srcSeqCol.semType, DG.SEMTYPE.MACROMOLECULE);
expect(srcSeqCol.getTag(DG.TAGS.UNITS), srcNotation);
expect(srcCol.semType, DG.SEMTYPE.MACROMOLECULE);
expect(srcCol.getTag(DG.TAGS.UNITS), srcNotation);
if (alphabet)
expect(srcSeqCol.getTag(bioTAGS.alphabet), alphabet);
expect(srcCol.getTag(bioTAGS.alphabet), alphabet);
const msaSeqCol = await multipleSequenceAlignmentUI({col: srcSeqCol, pepsea: {method: pepseaMethod}});
const msaSeqCol = await multipleSequenceAlignmentUI({col: srcCol, pepsea: {method: pepseaMethod}});
expect(msaSeqCol.semType, DG.SEMTYPE.MACROMOLECULE);
expect(msaSeqCol.semType, DG.SEMTYPE.MACROMOLECULE);
expect(msaSeqCol.getTag(DG.TAGS.UNITS), tgtNotation);

@@ -145,0 +138,0 @@ expect(msaSeqCol.getTag(bioTAGS.aligned), ALIGNMENT.SEQ_MSA);

@@ -9,3 +9,3 @@ import * as grok from 'datagrok-api/grok';

import {monomerToShort} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';

@@ -97,5 +97,5 @@ import {_package} from '../package-test';

const colTemp: MonomerPlacer = new MonomerPlacer(null, seqCol, () => {
const uh = UnitsHandler.getOrCreate(seqCol);
const sh = SeqHandler.forColumn(seqCol);
return {
unitsHandler: uh,
seqHandler: sh,
monomerCharWidth: charWidth,

@@ -102,0 +102,0 @@ separatorWidth: sepWidth,

import * as grok from 'datagrok-api/grok';
import * as DG from 'datagrok-api/dg';
import $ from 'cash-dom';
import {category, expect, test, awaitCheck, delay} from '@datagrok-libraries/utils/src/test';
import {category, expect, test, delay} from '@datagrok-libraries/utils/src/test';
import {ALIGNMENT, ALPHABET, NOTATION, TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';

@@ -151,4 +149,4 @@ import {importFasta} from '../package';

// check newColumn with UnitsHandler constructor
const _uh: UnitsHandler = UnitsHandler.getOrCreate(msaSeqCol);
// check newColumn with SeqHandler constructor
const _sh: SeqHandler = SeqHandler.forColumn(msaSeqCol);
}

@@ -176,4 +174,4 @@

// check tgtCol with UnitsHandler constructor
const _uh: UnitsHandler = UnitsHandler.getOrCreate(tgtCol);
// check tgtCol with SeqHandler constructor
const _sh: SeqHandler = SeqHandler.forColumn(tgtCol);
}

@@ -180,0 +178,0 @@

@@ -5,11 +5,8 @@ import * as grok from 'datagrok-api/grok';

import wu from 'wu';
import {
after, before, category, test, expect, expectArray, delay, awaitCheck
after, before, category, test, expect, expectArray
} from '@datagrok-libraries/utils/src/test';
import {
TAGS as bioTAGS,
splitterAsFasta,
splitterAsHelm,
NOTATION
} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {TAGS as bioTAGS, splitterAsFasta} from '@datagrok-libraries/bio/src/utils/macromolecule';

@@ -19,5 +16,9 @@ import {splitToMonomersUI} from '../utils/split-to-monomers';

import * as C from '../utils/constants';
import {getHelmMonomers} from '../package';
import {splitterAsHelm} from '@datagrok-libraries/bio/src/utils/macromolecule/utils';
import {ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';
import {_package} from '../package-test';
category('splitters', async () => {

@@ -137,3 +138,3 @@ before(async () => {

// test('helmAsFasta', async () => {
// // The columns can't be empty for UnitsHandler
// // The columns can't be empty for SeqHandler
// /* eslint-disable max-len */

@@ -149,11 +150,11 @@ // const srcSeq = '[meI][Pip][dK][Thr_PO3H2][L-hArg(Et,Et)][D-Tyr_Et][Tyr_ab-dehydroMe][dV]EN[D-Orn][D-aThr][Phe_4Me]';

export async function _testFastaSplitter(src: string, tgt: string[]) {
const res: string[] = splitterAsFasta(src);
const res: ISeqSplitted = splitterAsFasta(src);
console.debug(`Bio: tests: splitters: src=${JSON.stringify(src)}, res=${JSON.stringify(res)} .`);
expectArray(res, tgt);
expectArray(wu(res.originals).toArray(), tgt);
}
export async function _testHelmSplitter(src: string, tgt: string[]) {
const res: string[] = splitterAsHelm(src);
const res: ISeqSplitted = splitterAsHelm(src);
console.debug(`Bio: tests: splitters: src=${JSON.stringify(src)}, res=${JSON.stringify(res)} .`);
expectArray(res, tgt);
expectArray(wu(res.originals).toArray(), tgt);
}

@@ -17,3 +17,3 @@ /* Do not change these import lines to match external modules in webpack configuration */

import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';

@@ -202,3 +202,3 @@ import {toAtomicLevel} from '../package';

seqCol.setTag(bioTAGS.alphabet, ALPHABET.PT);
const uh = UnitsHandler.getOrCreate(seqCol);
const sh = SeqHandler.forColumn(seqCol);
const resCol = (await _testToAtomicLevel(srcDf, 'seq', monomerLibHelper))!;

@@ -205,0 +205,0 @@ expect(polishMolfile(resCol.get(0)), polishMolfile(tgtMol));

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

import {category, expect, expectArray, test} from '@datagrok-libraries/utils/src/test';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {ALPHABET, NOTATION, TAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
category('UnitsHandler: getRegion', () => {
category('SeqHandler: getRegion', () => {
const data: {

@@ -80,4 +80,4 @@ [testName: string]: {

const srcUh = UnitsHandler.getOrCreate(srcSeqCol);
const resSeqCol = srcUh.getRegion(testData.startIdx, testData.endIdx, 'regSeq');
const srcSh = SeqHandler.forColumn(srcSeqCol);
const resSeqCol = srcSh.getRegion(testData.startIdx, testData.endIdx, 'regSeq');

@@ -84,0 +84,0 @@ const tgtDf = DG.DataFrame.fromCsv(testData.tgtCsv);

import * as grok from 'datagrok-api/grok';
import * as DG from 'datagrok-api/dg';
import wu from 'wu';
import {category, expect, expectArray, test} from '@datagrok-libraries/utils/src/test';
import {GapSymbols, UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {GapOriginals, SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';

@@ -17,6 +18,6 @@ enum Tests {

category('UnitsHandler', () => {
const fG = GapSymbols[NOTATION.FASTA];
const hG = GapSymbols[NOTATION.HELM];
const sG = GapSymbols[NOTATION.SEPARATOR];
category('SeqHandler', () => {
const fG = GapOriginals[NOTATION.FASTA];
const hG = GapOriginals[NOTATION.HELM];
const sG = GapOriginals[NOTATION.SEPARATOR];
const data: {

@@ -38,5 +39,5 @@ [testName: string]: {

splitted: [
'ACGTCACGTC',
'CAGTGTCAGTGT',
'TTCAACTTCAAC',
['A', 'C', 'G', 'T', 'C', 'A', 'C', 'G', 'T', 'C'],
['C', 'A', 'G', 'T', 'G', 'T', 'C', 'A', 'G', 'T', 'G', 'T'],
['T', 'T', 'C', 'A', 'A', 'C', 'T', 'T', 'C', 'A', 'A', 'C'],
]

@@ -56,5 +57,5 @@ }

//@formatter:off
'AC-GT-CTAC-GT-CT',
'CAC-T-GTCAC-T-GT',
'ACCGTACTACCGTACT',
['A', 'C', '-', 'G', 'T', '-', 'C', 'T', 'A', 'C', '-', 'G', 'T', '-', 'C', 'T'],
['C', 'A', 'C', '-', 'T', '-', 'G', 'T', 'C', 'A', 'C', '-', 'T', '-', 'G', 'T'],
['A', 'C', 'C', 'G', 'T', 'A', 'C', 'T', 'A', 'C', 'C', 'G', 'T', 'A', 'C', 'T'],
//@formatter:on

@@ -135,10 +136,11 @@ ]

const uh = UnitsHandler.getOrCreate(col);
expect(uh.notation, testData.tgt.notation);
expect(uh.separator === testData.tgt.separator, true);
const sh = SeqHandler.forColumn(col);
expect(sh.notation, testData.tgt.notation);
expect(sh.separator === testData.tgt.separator, true);
const resSplitted: ISeqSplitted[] = uh.splitted;
const resSplitted: string[][] = wu.count(0).take(sh.length)
.map((rowIdx) => wu(sh.getSplitted(rowIdx).originals).toArray()).toArray();
expectArray(resSplitted, testData.tgt.splitted);
}, testName == Tests.separatorMsa ? {skipReason: '#2468 CSV row starting with the quote character'} : undefined);
});
}
});

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

import {category, test, expect} from '@datagrok-libraries/utils/src/test';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {ALPHABET, NOTATION, TAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {ALPHABET, NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';

@@ -31,56 +31,56 @@ const seqDna = `seq

category('UnitsHandler', () => {
category('SeqHandler', () => {
test('Seq-Fasta', async () => {
const [_df, uh] = await loadCsvWithDetection(seqDna);
expect(uh.notation, NOTATION.FASTA);
expect(uh.isMsa(), false);
const [_df, sh] = await loadCsvWithDetection(seqDna);
expect(sh.notation, NOTATION.FASTA);
expect(sh.isMsa(), false);
});
test('Seq-Fasta-MSA', async () => {
const [_df, uh] = await loadCsvWithDetection(seqDnaMsa);
expect(uh.notation, NOTATION.FASTA);
expect(uh.isMsa(), true);
const [_df, sh] = await loadCsvWithDetection(seqDnaMsa);
expect(sh.notation, NOTATION.FASTA);
expect(sh.isMsa(), true);
});
test('Seq-Fasta-units', async () => {
const [_df, uh] = await loadCsvWithDetection(seqDna);
expect(uh.notation, NOTATION.FASTA);
expect(uh.isMsa(), false);
const [_df, sh] = await loadCsvWithDetection(seqDna);
expect(sh.notation, NOTATION.FASTA);
expect(sh.isMsa(), false);
});
test('Seq-Fasta-MSA-units', async () => {
const [_df, uh] = await loadCsvWithDetection(seqDnaMsa);
expect(uh.notation, NOTATION.FASTA);
expect(uh.isMsa(), true);
const [_df, sh] = await loadCsvWithDetection(seqDnaMsa);
expect(sh.notation, NOTATION.FASTA);
expect(sh.isMsa(), true);
});
test('Seq-Helm', async () => {
const [_df, uh] = await loadCsvWithDetection(seqHelm);
expect(uh.notation, NOTATION.HELM);
expect(uh.isHelm(), true);
const [_df, sh] = await loadCsvWithDetection(seqHelm);
expect(sh.notation, NOTATION.HELM);
expect(sh.isHelm(), true);
});
test('Seq-UN', async () => {
const [_df, uh] = await loadCsvWithDetection(seqUn);
expect(uh.notation, NOTATION.SEPARATOR);
expect(uh.separator, '-');
expect(uh.alphabet, ALPHABET.UN);
const [_df, sh] = await loadCsvWithDetection(seqUn);
expect(sh.notation, NOTATION.SEPARATOR);
expect(sh.separator, '-');
expect(sh.alphabet, ALPHABET.UN);
});
test('Seq-UN-auto', async () => {
const [_df, uh] = await loadCsvWithDetection(seqUn);
expect(uh.notation, NOTATION.SEPARATOR);
expect(uh.separator, '-');
expect(uh.alphabet, ALPHABET.UN);
const [_df, sh] = await loadCsvWithDetection(seqUn);
expect(sh.notation, NOTATION.SEPARATOR);
expect(sh.separator, '-');
expect(sh.alphabet, ALPHABET.UN);
});
async function loadCsvWithDetection(csv: string): Promise<[df: DG.DataFrame, uh: UnitsHandler]> {
async function loadCsvWithDetection(csv: string): Promise<[df: DG.DataFrame, sh: SeqHandler]> {
const df = DG.DataFrame.fromCsv(csv);
await grok.data.detectSemanticTypes(df);
const uh = UnitsHandler.getOrCreate(df.getCol('seq'));
return [df, uh];
const sh = SeqHandler.forColumn(df.getCol('seq'));
return [df, sh];
}
// async function loadCsvWithTag(csv: string, tag: string, value: string):
// Promise<[df: DG.DataFrame, uh: UnitsHandler]> {
// Promise<[df: DG.DataFrame, uh: SeqHandler]> {
// const df = DG.DataFrame.fromCsv(csv);

@@ -92,5 +92,5 @@ // const col = df.getCol('seq');

// col.setTag(TAGS.separator, '-');
// const uh = UnitsHandler.getOrCreate(df.getCol('seq'));
// return [df, uh];
// const sh = SeqHandler.forColumn(df.getCol('seq'));
// return [df, sh];
// }
});

@@ -7,6 +7,6 @@ import * as DG from 'datagrok-api/dg';

import {category, expect, test, testViewer} from '@datagrok-libraries/utils/src/test';
import {category, delay, expect, test} from '@datagrok-libraries/utils/src/test';
import {awaitGrid} from './utils';
import {WebLogoViewer} from '../viewers/web-logo-viewer';
import {Debounces, WebLogoViewer} from '../viewers/web-logo-viewer';

@@ -24,2 +24,4 @@ import {_package} from '../package-test';

view.dockManager.dock(wlViewer);
await delay(Debounces.render * 2);
await wlViewer.awaitRendered();

@@ -31,2 +33,3 @@ await awaitGrid(view.grid);

view.loadLayout(viewLayout);
await delay(Debounces.render * 2);
await wlViewer.awaitRendered();

@@ -33,0 +36,0 @@ await awaitGrid(view.grid);

@@ -6,2 +6,5 @@ import * as grok from 'datagrok-api/grok';

import {ALPHABET, NOTATION, TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {GAP_SYMBOL} from '@datagrok-libraries/bio/src/utils/macromolecule/types';
import {

@@ -13,6 +16,3 @@ countForMonomerAtPosition,

} from '../viewers/web-logo-viewer';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {GAP_SYMBOL} from '../const';
const g: string = GAP_SYMBOL;

@@ -187,4 +187,4 @@

const atPI1: PI = resPosList[1];
const uh = UnitsHandler.getOrCreate(seqCol);
const countAt1 = countForMonomerAtPosition(df, uh, df.filter, 'G', atPI1);
const sh = SeqHandler.forColumn(seqCol);
const countAt1 = countForMonomerAtPosition(df, sh, df.filter, 'G', atPI1);
expect(countAt1, 5);

@@ -191,0 +191,0 @@ await wlViewer.awaitRendered();

@@ -19,3 +19,6 @@ import * as grok from 'datagrok-api/grok';

import {UnknownSeqPalettes} from '@datagrok-libraries/bio/src/unknown';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {GapOriginals, SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';
import {getSplitter} from '@datagrok-libraries/bio/src/utils/macromolecule/utils';
import {errInfo} from '@datagrok-libraries/bio/src/utils/err-info';

@@ -29,7 +32,3 @@ import {

import {_package, getBioLib} from '../package';
import {ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';
import {getSplitter} from '@datagrok-libraries/bio/src/utils/macromolecule/utils';
import {errInfo} from '@datagrok-libraries/bio/src/utils/err-info';
type TempType = { [tagName: string]: any };

@@ -44,3 +43,3 @@

export function processSequence(subParts: ISeqSplitted): [string[], boolean] {
export function processSequence(subParts: string[]): [string[], boolean] {
const simplified = !wu.enumerate(subParts).some(([amino, index]) =>

@@ -105,2 +104,3 @@ amino.length > 1 &&

if (seqColTemp._monomerStructureMap[monomerSymbol]) {
//
tooltipElements.push(seqColTemp._monomerStructureMap[monomerSymbol]);

@@ -118,2 +118,3 @@ } else {

} else {
//
ui.tooltip.hide();

@@ -171,6 +172,6 @@ }

() => {
const uh = UnitsHandler.getOrCreate(tableCol);
const sh = SeqHandler.forColumn(tableCol);
return {
unitsHandler: uh,
monomerCharWidth: 7, separatorWidth: !uh.isMsa() ? gapLength : msaGapLength,
seqHandler: sh,
monomerCharWidth: 7, separatorWidth: !sh.isMsa() ? gapLength : msaGapLength,
monomerToShort: monomerToShortFunction, monomerLengthLimit: maxLengthOfMonomer,

@@ -202,2 +203,3 @@ monomerLib: getBioLib()

const value: any = gridCell.cell.value;
const rowIdx = gridCell.cell.rowIndex;
const paletteType = tableCol.getTag(bioTAGS.alphabet);

@@ -220,4 +222,3 @@ const minDistanceRenderer = 50;

const splitLimit = w / 5;
const uh = UnitsHandler.getOrCreate(tableCol);
const splitterFunc: SplitterFunc = uh.getSplitter(splitLimit);
const sh = SeqHandler.forColumn(tableCol);

@@ -228,7 +229,12 @@ const tempReferenceSequence: string | null = tableColTemp[tempTAGS.referenceSequence];

tableColTemp[tempTAGS.currentWord] = null;
const referenceSequence: ISeqSplitted = splitterFunc(
((tempReferenceSequence != null) && (tempReferenceSequence != '')) ?
tempReferenceSequence : tempCurrentWord ?? '');
const subParts: ISeqSplitted = splitterFunc(value);
const referenceSequence: string[] = (() => {
// @ts-ignore
const splitterFunc: SplitterFunc = sh.getSplitter(splitLimit);
return wu(splitterFunc(
((tempReferenceSequence != null) && (tempReferenceSequence != '')) ?
tempReferenceSequence : tempCurrentWord ?? '').originals).toArray();
})();
const subParts: ISeqSplitted = sh.getSplitted(rowIdx);
/* let x1 = x; */

@@ -241,10 +247,11 @@ let color = undefinedColor;

for (const [amino, index] of wu.enumerate(subParts)) {
for (let posIdx: number = 0; posIdx < subParts.length; ++posIdx) {
const amino: string = subParts.getOriginal(posIdx);
color = palette.get(amino);
g.fillStyle = undefinedColor;
const last = index === subParts.length - 1;
const last = posIdx === subParts.length - 1;
/*x1 = */
printLeftOrCentered(x + this.padding, y, w, h,
g, amino, color, 0, true, 1.0, separator, last, drawStyle,
maxLengthWordsSum, index, gridCell, referenceSequence, maxLengthOfMonomer, seqColTemp._monomerLengthMap);
maxLengthWordsSum, posIdx, gridCell, referenceSequence, maxLengthOfMonomer, seqColTemp._monomerLengthMap);
if (minDistanceRenderer > w) break;

@@ -298,4 +305,4 @@ }

const splitter = getSplitter(units, separator);
const subParts1 = splitter(s1);
const subParts2 = splitter(s2);
const subParts1 = wu(splitter(s1).canonicals).toArray();
const subParts2 = wu(splitter(s2).canonicals).toArray();
drawMoleculeDifferenceOnCanvas(g, x, y, w, h, subParts1, subParts2, units);

@@ -311,4 +318,4 @@ }

h: number,
subParts1: ISeqSplitted,
subParts2: ISeqSplitted,
subParts1: string[],
subParts2: string[],
units: string,

@@ -319,3 +326,3 @@ fullStringLength?: boolean,

if (subParts1.length !== subParts2.length) {
const sequences: IComparedSequences = fillShorterSequence(wu(subParts1).toArray(), wu(subParts2).toArray());
const sequences: IComparedSequences = fillShorterSequence(subParts1, subParts2);
subParts1 = sequences.subParts1;

@@ -359,3 +366,6 @@ subParts2 = sequences.subParts2;

molDifferences[i] = createDifferenceCanvas(amino1, amino2, color1, color2, updatedY, vShift, h);
} else { updatedX = printLeftOrCentered(updatedX, updatedY, w, h, g, amino1, color1, 0, true, 0.5); }
} else {
//
updatedX = printLeftOrCentered(updatedX, updatedY, w, h, g, amino1, color1, 0, true, 0.5);
}
updatedX += 4;

@@ -371,10 +381,5 @@ }

function createDifferenceCanvas(
amino1: string,
amino2: string,
color1: string,
color2: string,
y: number,
shift: number,
h: number): HTMLCanvasElement {
function createDifferenceCanvas(amino1: string, amino2: string, color1: string, color2: string,
y: number, shift: number, h: number
): HTMLCanvasElement {
const canvas = document.createElement('canvas');

@@ -412,3 +417,4 @@ const context = canvas.getContext('2d')!;

const emptyMonomersArray = new Array<string>(Math.abs(subParts1.length - subParts2.length)).fill('');
const emptyMonomersArray = new Array<string>(Math.abs(subParts1.length - subParts2.length))
.fill(GapOriginals[NOTATION.FASTA]);

@@ -421,4 +427,4 @@ function concatWithEmptyVals(subparts: string[]): string[] {

subParts1.length > subParts2.length ?
subParts2 = concatWithEmptyVals(subParts2) : subParts1 = concatWithEmptyVals(subParts1);
subParts2 = concatWithEmptyVals(wu(subParts2).toArray()) : subParts1 = concatWithEmptyVals(wu(subParts1).toArray());
return {subParts1: subParts1, subParts2: subParts2};
}

@@ -5,3 +5,3 @@ import * as grok from 'datagrok-api/grok';

import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';

@@ -39,3 +39,3 @@ /**

const uh = UnitsHandler.getOrCreate(col);
const sh = SeqHandler.forColumn(col);
if (col.semType !== DG.SEMTYPE.MACROMOLECULE) {

@@ -45,3 +45,3 @@ grok.shell.warning(name + ' analysis is allowed for Macromolecules semantic type');

} else {
const notation: string = uh.notation;
const notation: string = sh.notation;
if (allowedNotations.length > 0 &&

@@ -54,5 +54,5 @@ !allowedNotations.some((n) => notation.toUpperCase() == (n.toUpperCase()))

res = false;
} else if (!uh.isHelm()) {
} else if (!sh.isHelm()) {
// alphabet is not specified for 'helm' notation
const alphabet: string = uh.alphabet;
const alphabet: string = sh.alphabet;
if (

@@ -59,0 +59,0 @@ allowedAlphabets.length > 0 &&

@@ -5,3 +5,3 @@ import * as grok from 'datagrok-api/grok';

import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';

@@ -13,11 +13,14 @@

export function addCopyMenuUI(cell: DG.Cell, menu: DG.Menu): void {
const uh = UnitsHandler.getOrCreate(cell.column);
const tgtNotationList: string[] = Object.values(NOTATION).filter((v) => v !== uh.units);
const sh = SeqHandler.forColumn(cell.column);
const tgtNotationList: string[] = Object.values(NOTATION).filter((v) => v !== sh.units);
menu.group('Copy')
.items(tgtNotationList, (tgtNotation) => {
const ncUH = UnitsHandler.getOrCreate(cell.column);
const srcCol = cell.column;
const srcRowIdx = cell.rowIndex;
const srcSh = SeqHandler.forColumn(srcCol);
const separator = tgtNotation === NOTATION.SEPARATOR ? _package.properties.DefaultSeparator : undefined;
const converter = ncUH.getConverter(tgtNotation as NOTATION, separator);
const tgtSeq = converter(cell.value);
const joiner = srcSh.getJoiner({notation: tgtNotation as NOTATION, separator});
const srcSS = srcSh.getSplitted(srcRowIdx);
const tgtSeq = joiner(srcSS);

@@ -24,0 +27,0 @@ if (!navigator.clipboard) {

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

import {Subscription} from 'rxjs';
import {NOTATION, TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {expect} from '@datagrok-libraries/utils/src/test';
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
let convertDialog: DG.Dialog | null = null;

@@ -25,4 +25,4 @@ let convertDialogSubs: Subscription[] = [];

throw new Error('No column with Macromolecule semantic type found');
let converterUH = UnitsHandler.getOrCreate(tgtCol);
let currentNotation: NOTATION = converterUH.notation;
let converterSh = SeqHandler.forColumn(tgtCol);
let currentNotation: NOTATION = converterSh.notation;
const dialogHeader = ui.divText(

@@ -51,4 +51,4 @@ 'Current notation: ' + currentNotation,

tgtCol = newCol;
converterUH = UnitsHandler.getOrCreate(tgtCol);
currentNotation = converterUH.notation;
converterSh = SeqHandler.forColumn(tgtCol);
currentNotation = converterSh.notation;
if (currentNotation === NOTATION.HELM)

@@ -122,4 +122,4 @@ separatorInput.value = '/'; // helm monomers can have - in the name like D-aThr;

export async function convertDo(srcCol: DG.Column, targetNotation: NOTATION, separator?: string): Promise<DG.Column> {
const converterUH = UnitsHandler.getOrCreate(srcCol);
const newColumn = converterUH.convert(targetNotation, separator);
const converterSh = SeqHandler.forColumn(srcCol);
const newColumn = converterSh.convert(targetNotation, separator);
srcCol.dataFrame.columns.add(newColumn);

@@ -126,0 +126,0 @@

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

import {TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {_package} from '../package';
export interface GetRegionParams {

@@ -16,5 +19,2 @@ table: DG.DataFrame,

import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {_package} from '../package';
export interface SeqRegion {

@@ -75,3 +75,3 @@ name: string,

const seqCol = this.inputs.sequence.value;
const uh = seqCol ? UnitsHandler.getOrCreate(seqCol) : null;
const sh = seqCol ? SeqHandler.forColumn(seqCol) : null;
this.updateRegionItems();

@@ -95,5 +95,5 @@ this.updateStartEndInputItems();

} else {
const uh = UnitsHandler.getOrCreate(this.inputs.sequence.value!);
this.inputs.start.value = uh.posList[0];
this.inputs.end.value = uh.posList[uh.posList.length - 1];
const sh = SeqHandler.forColumn(this.inputs.sequence.value!);
this.inputs.start.value = sh.posList[0];
this.inputs.end.value = sh.posList[sh.posList.length - 1];
}

@@ -129,3 +129,3 @@ } finally {

const seqCol = this.inputs.sequence.value;
const uh = seqCol ? UnitsHandler.getOrCreate(seqCol) : null;
const sh = seqCol ? SeqHandler.forColumn(seqCol) : null;

@@ -136,3 +136,3 @@ const startSE = (this.inputs.start.input as HTMLSelectElement);

for (let i = endSE.options.length - 1; i >= 0; --i) endSE.options.remove(i);
for (const pos of uh?.posList ?? []) {
for (const pos of sh?.posList ?? []) {
const startPosOE = document.createElement('option');

@@ -145,4 +145,4 @@ const endPosOE = document.createElement('option');

}
startSE.value = uh?.posList[0] ?? '';
endSE.value = uh?.posList[uh?.posList.length - 1] ?? '';
startSE.value = sh?.posList[0] ?? '';
endSE.value = sh?.posList[sh?.posList.length - 1] ?? '';
}

@@ -149,0 +149,0 @@

@@ -5,14 +5,12 @@ import * as grok from 'datagrok-api/grok';

import {TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {getRegion} from '../package';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {TaskBarProgressIndicator} from 'datagrok-api/dg';
export function getRegionUI(col: DG.Column<string>): void {
const uh = UnitsHandler.getOrCreate(col);
const sh = SeqHandler.forColumn(col);
const nameInput = ui.stringInput('Name', '');
const startPositionInput = ui.choiceInput('Start Position', uh.posList[0], uh.posList,
const startPositionInput = ui.choiceInput('Start Position', sh.posList[0], sh.posList,
() => { /* TODO: update name placeholder with getDefaultName() */ });
const endPositionInput = ui.choiceInput('End Position', uh.posList[uh.posList.length], uh.posList,
const endPositionInput = ui.choiceInput('End Position', sh.posList[sh.posList.length], sh.posList,
() => { /* TODO: update name placeholder with getDefaultName() */ });

@@ -45,3 +43,3 @@

): DG.Column<string> {
const uh = UnitsHandler.getOrCreate(col);
const sh = SeqHandler.forColumn(col);

@@ -51,5 +49,5 @@ let startPosIdx: number | null = null;

for (let posJ: number = 0; posJ < uh.posList.length; ++posJ) {
if (uh.posList[posJ] == startPosName) startPosIdx = posJ;
if (uh.posList[posJ] == endPosName) endPosIdx = posJ;
for (let posJ: number = 0; posJ < sh.posList.length; ++posJ) {
if (sh.posList[posJ] == startPosName) startPosIdx = posJ;
if (sh.posList[posJ] == endPosName) endPosIdx = posJ;
}

@@ -61,3 +59,3 @@ if (startPosIdx === null && startPosName !== null)

if (uh.posList.length < endPosIdx!)
if (sh.posList.length < endPosIdx!)
throw new Error(`End position ${endPosIdx} exceeds positions length`);

@@ -67,4 +65,4 @@

const regCol = uh.getRegion(startPosIdx, endPosIdx, regColName);
const regCol = sh.getRegion(startPosIdx, endPosIdx, regColName);
return regCol;
}

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

import {TAGS as wlTAGS} from '@datagrok-libraries/bio/src/viewers/web-logo';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {WebLogoViewer} from '../viewers/web-logo-viewer';
import {_package} from '../package';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';

@@ -27,3 +28,3 @@ /** Used in Macromolecule column tooltip */

async init(): Promise<void> {
const uh = UnitsHandler.getOrCreate(this.seqCol);
const sh = SeqHandler.forColumn(this.seqCol);
const pkgTooltipWebLogo = _package.properties.TooltipWebLogo;

@@ -37,3 +38,3 @@ const colTooltipWebLogo = this.seqCol.getTag(wlTAGS.tooltipWebLogo);

positionHeight: 'Entropy',
positionWidth: (uh.getAlphabetIsMultichar() ? 24 : 16),
positionWidth: (sh.getAlphabetIsMultichar() ? 24 : 16),
fixWidth: true,

@@ -40,0 +41,0 @@ fitArea: false,

@@ -29,3 +29,3 @@ import * as rxjs from 'rxjs';

return new Promise((resolve) => {
this._libraryFilesUpdateSubject$.pipe(
this._libraryFilesUpdateSubject$.pipe<string[]>(
skip(1)

@@ -32,0 +32,0 @@ ).subscribe((fileNames) => {

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

import {ALPHABET, NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {ColumnInputOptions} from '@datagrok-libraries/utils/src/type-declarations';

@@ -164,5 +164,5 @@

terminalGapInput.value = null;
const potentialColUH = UnitsHandler.getOrCreate(col);
const performCol: DG.Column<string> = potentialColUH.isFasta() ? col :
potentialColUH.convert(NOTATION.FASTA);
const potentialColSh = SeqHandler.forColumn(col);
const performCol: DG.Column<string> = potentialColSh.isFasta() ? col :
potentialColSh.convert(NOTATION.FASTA);
return async () => await runKalign(performCol, false, unusedName, clustersColInput.value);

@@ -183,4 +183,4 @@ } else if (checkInputColumnUI(col, col.name,

//if the column is separator with unknown alphabet, it might be helm. check if it can be converted to helm
const potentialColUH = UnitsHandler.getOrCreate(col);
const helmCol = potentialColUH.convert(NOTATION.HELM);
const potentialColSh = SeqHandler.forColumn(col);
const helmCol = potentialColSh.convert(NOTATION.HELM);
switchDialog(pepseaInputRootStyles, kalignInputRootStyles, 'pepsea');

@@ -187,0 +187,0 @@ gapOpenInput.value ??= msaDefaultOptions.pepsea.gapOpen;

@@ -135,2 +135,3 @@ /* Do not change these import lines to match external modules in webpack configuration */

} else {
// @ts-ignore
const responseStr = await grok.dapi.docker.dockerContainers.request(dockerfileId, path, params)!;

@@ -137,0 +138,0 @@ if (!responseStr)

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

import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {ALIGNMENT, ALPHABET} from '@datagrok-libraries/bio/src/utils/macromolecule';

@@ -228,4 +228,4 @@

const df = molColumn.dataFrame;
const uh = UnitsHandler.getOrCreate(molColumn);
const sourceHelmCol = uh.convert(NOTATION.HELM);
const sh = SeqHandler.forColumn(molColumn);
const sourceHelmCol = sh.convert(NOTATION.HELM);
const pt = PolymerTransformation.getInstance(sourceHelmCol);

@@ -232,0 +232,0 @@ const fileSource = new DG.FileSource(RULES_PATH);

@@ -6,4 +6,4 @@ import * as DG from 'datagrok-api/dg';

import wu from 'wu';
import {splitterAsFasta, SplitterFunc} from '@datagrok-libraries/bio/src/utils/macromolecule';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';

@@ -32,4 +32,4 @@ const FASTA_LINE_WIDTH = 60;

if (col && col.semType === DG.SEMTYPE.MACROMOLECULE) {
const uh = UnitsHandler.getOrCreate(col);
return uh.isFasta();
const sh = SeqHandler.forColumn(col);
return sh.isFasta();
}

@@ -82,13 +82,12 @@ return false;

): string {
const splitter: SplitterFunc = splitterAsFasta;
const sh = SeqHandler.forColumn(seqCol);
const fastaLines: string[] = [];
for (let rowI: number = 0; rowI < seqCol.length; rowI++) {
for (let rowIdx: number = 0; rowIdx < seqCol.length; rowIdx++) {
// multiple identifiers separated by vertical bars
// https://en.wikipedia.org/wiki/FASTA_format
const seqId: string = idColList.map((col) => col.get(rowI).toString()).join('|');
const seq: string = seqCol.get(rowI);
const seqLineList: string[] = wrapSequence(seq, splitter, lineWidth);
const seqId: string = idColList.map((col) => col.get(rowIdx).toString()).join('|');
const srcSS = sh.getSplitted(rowIdx);
const seqLineList: string[] = wrapSequence(srcSS, lineWidth);

@@ -105,6 +104,5 @@ fastaLines.push(`>${seqId}${lineSeparator}`);

/* split sequence for monomers to prevent wrapping monomer partially */
export function wrapSequence(seq: string, splitter: SplitterFunc, lineWidth: number = FASTA_LINE_WIDTH): string[] {
const seqMonomerList = splitter(seq);
export function wrapSequence(srcSS: ISeqSplitted, lineWidth: number = FASTA_LINE_WIDTH): string[] {
let seqPos: number = 0;
const seqLength: number = seqMonomerList.length;
const seqLength: number = srcSS.length;

@@ -114,4 +112,5 @@ const seqLineList: string[] = [];

/* join sliced monomer into line */
const seqLine: string[] = wu(seqMonomerList).slice(seqPos, seqPos + lineWidth).toArray();
const seqLineTxt: string = seqLine.map((m) => m.length > 1 ? `[${m}]` : m).join('');
const seqLine = wu(srcSS.originals).slice(seqPos, seqPos + lineWidth).toArray();
const seqLineTxt: string = seqLine.map((om) => om.length > 1 ? `[${om}]` : om)
.reduce((a, b) => a + b, '');
seqLineList.push(seqLineTxt);

@@ -118,0 +117,0 @@ seqPos += seqLine.length;

@@ -11,3 +11,3 @@ /* Do not change these import lines to match external modules in webpack configuration */

import {getMonomerLibHelper} from '../package';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';

@@ -21,5 +21,5 @@

if (nonlinear) {
const seqUh = UnitsHandler.getOrCreate(macroMolecule);
if (!seqUh.isHelm())
macroMolecule = seqUh.convert(NOTATION.HELM);
const seqSh = SeqHandler.forColumn(macroMolecule);
if (!seqSh.isHelm())
macroMolecule = seqSh.convert(NOTATION.HELM);
helm2mol(df, macroMolecule);

@@ -26,0 +26,0 @@ return;

@@ -9,3 +9,3 @@ import * as grok from 'datagrok-api/grok';

import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {SeqPalette} from '@datagrok-libraries/bio/src/seq-palettes';

@@ -21,4 +21,3 @@ import {

import {intToHtmlA} from '@datagrok-libraries/utils/src/color';
import {ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';
import {errInfo} from '@datagrok-libraries/bio/src/utils/err-info';
import {GAP_SYMBOL, ISeqSplitted} from '@datagrok-libraries/bio/src/utils/macromolecule/types';
import {testEvent} from '@datagrok-libraries/utils/src/test';

@@ -31,3 +30,2 @@ import {PromiseSyncer} from '@datagrok-libraries/bio/src/utils/syncer';

import {_package} from '../package';
import {GAP_SYMBOL} from '../const';

@@ -174,4 +172,3 @@ declare global {

calcScreen(
isGap: (m: string) => boolean, posIdx: number, firstVisiblePosIdx: number,
calcScreen(posIdx: number, firstVisiblePosIdx: number,
absoluteMaxHeight: number, heightMode: PositionHeight, alphabetSizeLog: number,

@@ -187,9 +184,9 @@ positionWidthWithMargin: number, positionWidth: number, dpr: number, positionLabelsHeight: number

.sort((a, b) => {
if (!isGap(a[0]) && !isGap(b[0]))
if (a[0] !== GAP_SYMBOL && b[0] !== GAP_SYMBOL)
return b[1].value - a[1].value;
else if (isGap(a[0]) && isGap(b[0]))
else if (a[0] === GAP_SYMBOL && b[0] === GAP_SYMBOL)
return 0;
else if (isGap(a[0]))
else if (a[0] === GAP_SYMBOL)
return -1;
else /* (isGap(b[0])) */
else /* (b[0] === GAP_SYMBOL) */
return +1;

@@ -208,7 +205,6 @@ });

render(g: CanvasRenderingContext2D,
isGap: (m: string) => boolean,
fontStyle: string, uppercaseLetterAscent: number, uppercaseLetterHeight: number, cp: SeqPalette
) {
for (const [monomer, pmInfo] of Object.entries(this._freqs)) {
if (!isGap(monomer)) {
if (monomer !== GAP_SYMBOL) {
const monomerTxt = monomerToShort(monomer, 5);

@@ -312,3 +308,3 @@ const b = pmInfo.bounds!;

private unitsHandler: UnitsHandler | null;
private seqHandler: SeqHandler | null;
private initialized: boolean = false;

@@ -383,3 +379,3 @@

public get positionMarginValue(): number {
if (this.positionMarginState === PositionMarginStates.AUTO && this.unitsHandler!.getAlphabetIsMultichar() === true)
if (this.positionMarginState === PositionMarginStates.AUTO && this.seqHandler!.getAlphabetIsMultichar() === true)
return this.positionMargin;

@@ -396,3 +392,3 @@ else if (this.positionMarginState === PositionMarginStates.ON)

this.textBaseline = 'top';
this.unitsHandler = null;
this.seqHandler = null;

@@ -601,3 +597,3 @@ // -- Data --

try {
this.unitsHandler = UnitsHandler.getOrCreate(this.seqCol);
this.seqHandler = SeqHandler.forColumn(this.seqCol);

@@ -613,3 +609,3 @@ this.palette = pickUpPalette(this.seqCol);

if (!this.seqCol) {
this.unitsHandler = null;
this.seqHandler = null;
this.positionNames = [];

@@ -831,2 +827,3 @@ this.positionLabels = [];

break;
case PROPS.sequenceColumnName:
case PROPS.startPositionName:

@@ -971,5 +968,6 @@ case PROPS.endPositionName:

const dfFilter = this.getFilter();
const maxLength: number = dfFilter.trueCount === 0 ? this.unitsHandler!.maxLength :
wu.enumerate(this.unitsHandler!.splitted).map(([mList, rowI]) => {
return dfFilter.get(rowI) && !!mList ? mList.length : 0;
const maxLength: number = dfFilter.trueCount === 0 ? this.seqHandler!.maxLength :
wu.count(0).take(this.seqHandler!.length).map((rowIdx) => {
const mList = this.seqHandler!.getSplitted(rowIdx);
return dfFilter.get(rowIdx) && !!mList ? mList.length : 0;
}).reduce((max, l) => Math.max(max, l), 0);

@@ -995,3 +993,3 @@

const length: number = this.startPosition <= this.endPosition ? this.endPosition - this.startPosition + 1 : 0;
this.unitsHandler = UnitsHandler.getOrCreate(this.seqCol);
this.seqHandler = SeqHandler.forColumn(this.seqCol);
const posCount: number = this.startPosition <= this.endPosition ? this.endPosition - this.startPosition + 1 : 0;

@@ -1008,14 +1006,12 @@ this.positions = new Array(posCount);

const dfRowCount = this.dataFrame.rowCount;
const splitted = this.unitsHandler.splitted;
for (let jPos = 0; jPos < length; ++jPos) {
const pi = this.positions[jPos];
// Here we want to build lists of values for every monomer in position jPos
for (let rowI = 0; rowI < dfRowCount; ++rowI) {
if (dfFilter.get(rowI)) {
const seqMList: ISeqSplitted = splitted[rowI];
const om: string = seqMList[this.startPosition + jPos] || this.unitsHandler.defaultGapSymbol;
const cm: string = this.unitsHandler?.defaultGapSymbol === om ? GAP_SYMBOL : om;
const pi = this.positions[jPos];
++pi.sumRowCount;
const seqMList: ISeqSplitted = this.seqHandler.getSplitted(rowI);
const cm: string = seqMList.getCanonical(this.startPosition + jPos);
const pmi = pi.getFreq(cm);
++pi.sumRowCount;
pmi.value = ++pmi.rowCount;

@@ -1037,6 +1033,6 @@ }

if (dfFilter.get(rowI)) { // respect the filter
const seqMList: ISeqSplitted = splitted[rowI];
const m: string = seqMList[this.startPosition + jPos] || this.unitsHandler.defaultGapSymbol;
const seqMList: ISeqSplitted = this.seqHandler.getSplitted(rowI);
const cm: string = seqMList.getCanonical(this.startPosition + jPos);
const value: number | null = valueCol.get(rowI);
this.positions[jPos].getFreq(m).push(value);
this.positions[jPos].getFreq(cm).push(value);
}

@@ -1080,3 +1076,3 @@ }

}
this.positions[jPos].calcScreen((m) => { return this.unitsHandler!.isGap(m); },
this.positions[jPos].calcScreen(
jPos, this.slider.min, absoluteMaxHeight, this.positionHeight,

@@ -1137,6 +1133,4 @@ alphabetSizeLog, this._positionWidthWithMargin, this._positionWidth, dpr, positionLabelsHeight);

const uppercaseLetterHeight = 12.2;
for (let jPos = firstPos; jPos <= lastPos; jPos++) {
this.positions[jPos].render(g, (m) => { return this.unitsHandler!.isGap(m); },
fontStyle, uppercaseLetterAscent, uppercaseLetterHeight, this.palette);
}
for (let jPos = firstPos; jPos <= lastPos; jPos++)
this.positions[jPos].render(g, fontStyle, uppercaseLetterAscent, uppercaseLetterHeight, this.palette);
} finally {

@@ -1156,7 +1150,5 @@ g.restore();

this.requestedRenderLevel = WlRenderLevel.None;
this.renderInt(renderLevel)
.catch((err: any) => {
const [errMsg, errStack] = errInfo(err);
_package.logger.error(errMsg, undefined, errStack);
});
this.viewSyncer.sync(logPrefix, async () => {
await this.renderInt(renderLevel);
});
}

@@ -1168,3 +1160,3 @@

public getAlphabetSize(): number {
return this.unitsHandler?.getAlphabetSize() ?? 0;
return this.seqHandler?.getAlphabetSize() ?? 0;
}

@@ -1235,6 +1227,6 @@

ui.tooltip.show(tooltipEl, args.x + 16, args.y + 16);
} else if (pi !== null && monomer && this.dataFrame && this.seqCol && this.unitsHandler) {
} else if (pi !== null && monomer && this.dataFrame && this.seqCol && this.seqHandler) {
// Monomer at position tooltip
// const monomerAtPosSeqCount = countForMonomerAtPosition(
// this.dataFrame, this.unitsHandler!, this.getFilter(), monomer, atPI);
// this.dataFrame, this.seqHandler!, this.getFilter(), monomer, atPI);
const pmi = pi.getFreq(monomer);

@@ -1267,6 +1259,6 @@

// prevents deselect all rows if we miss monomer bounds
if (pi !== null && monomer !== null && this.dataFrame && this.seqCol && this.unitsHandler) {
if (pi !== null && monomer !== null && this.dataFrame && this.seqCol && this.seqHandler) {
// Calculate a new BitSet object for selection to prevent interfering with existing
const selBS: DG.BitSet = DG.BitSet.create(this.dataFrame.selection.length, (rowI: number) => {
return checkSeqForMonomerAtPos(this.dataFrame, this.unitsHandler!, this.getFilter(), rowI, monomer, pi);
return checkSeqForMonomerAtPos(this.dataFrame, this.seqHandler!, this.getFilter(), rowI, monomer, pi);
});

@@ -1306,4 +1298,4 @@ this.dataFrame.selection.init((i) => selBS.get(i));

// Put the event trigger in the tail of the synced calls queue.
this.render(WlRenderLevel.None, callLog); // Put render request to the syncer
this.viewSyncer.sync(`${logPrefix}`, async () => {
this.render(WlRenderLevel.None, callLog);
this._onRendered.next();

@@ -1359,11 +1351,11 @@ });

export function checkSeqForMonomerAtPos(
df: DG.DataFrame, unitsHandler: UnitsHandler, filter: DG.BitSet, rowI: number, monomer: string, at: PositionInfo,
df: DG.DataFrame, sh: SeqHandler, filter: DG.BitSet, rowI: number, monomer: string, at: PositionInfo,
): boolean {
const seqMList: ISeqSplitted = unitsHandler.splitted[rowI];
const seqM = at.pos < seqMList.length ? seqMList[at.pos] : null;
return ((seqM === monomer) || (seqM === '' && monomer === unitsHandler.defaultGapSymbol));
const seqMList: ISeqSplitted = sh.getSplitted(rowI);
const seqCM: string | null = at.pos < seqMList.length ? seqMList.getCanonical(at.pos) : null;
return seqCM !== null && seqCM === monomer;
}
export function countForMonomerAtPosition(
df: DG.DataFrame, uh: UnitsHandler, filter: DG.BitSet, monomer: string, at: PositionInfo
df: DG.DataFrame, sh: SeqHandler, filter: DG.BitSet, monomer: string, at: PositionInfo
): number {

@@ -1373,8 +1365,8 @@ let count = 0;

while ((rowI = filter.findNext(rowI, true)) != -1) {
const seqMList: ISeqSplitted = uh.splitted[rowI];
const seqMList: ISeqSplitted = sh.getSplitted(rowI);
const seqMPos: number = at.pos;
const seqM: string | null = seqMPos < seqMList.length ? seqMList[seqMPos] : null;
if (seqM === monomer) count++;
const seqCM: string | null = seqMPos < seqMList.length ? seqMList.getCanonical(seqMPos) : null;
if (seqCM !== null && seqCM === monomer) count++;
}
return count;
}

@@ -13,3 +13,3 @@ /**

import $ from 'cash-dom';
import {fromEvent, Observable, Subject, Subscription, Unsubscribable} from 'rxjs';
import {fromEvent, Observable, Subject, Unsubscribable} from 'rxjs';

@@ -21,3 +21,3 @@ import {TAGS as bioTAGS, NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';

import {IHelmWebEditor, IWebEditorApp} from '@datagrok-libraries/bio/src/helm/types';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {IRenderer} from '@datagrok-libraries/bio/src/types/renderer';

@@ -125,3 +125,3 @@ import {ILogger} from '@datagrok-libraries/bio/src/utils/logger';

this.column = dataFrame.columns.bySemType(DG.SEMTYPE.MACROMOLECULE);
const uh = UnitsHandler.getOrCreate(this.column!);
const sh = SeqHandler.forColumn(this.column!);
this.columnName ??= this.column?.name;

@@ -128,0 +128,0 @@ this.notation ??= this.column?.getTag(DG.TAGS.UNITS);

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

import '../../css/composition-analysis.css';
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
import {GAP_SYMBOL} from '../const';
import {SeqHandler} from '@datagrok-libraries/bio/src/utils/seq-handler';
import {GAP_SYMBOL} from '@datagrok-libraries/bio/src/utils/macromolecule/types';

@@ -34,8 +34,8 @@

const counts: { [m: string]: number } = {};
const uh = UnitsHandler.getOrCreate(val.cell.column);
const splitter = uh.getSplitter();
const parts = splitter(val.value);
wu(parts).filter((p) => !!p && p !== '').forEach((m: string) => {
const count = counts[m] || 0;
counts[m] = count + 1;
const sh = SeqHandler.forColumn(val.cell.column as DG.Column<string>);
const rowIdx = val.cell.rowIndex;
const parts = sh.getSplitted(rowIdx);
wu(parts.canonicals).filter((cm) => cm !== GAP_SYMBOL).forEach((cm) => {
const count = counts[cm] || 0;
counts[cm] = count + 1;
});

@@ -42,0 +42,0 @@ const table = buildCompositionTable(palette, counts);

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