@datagrok/bio 2.12.1 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Aleksandr Tanas",
6
6
  "email": "atanas@datagrok.ai"
7
7
  },
8
- "version": "2.12.1",
8
+ "version": "2.12.2",
9
9
  "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.",
10
10
  "repository": {
11
11
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  "@biowasm/aioli": "^3.1.0",
37
37
  "@datagrok-libraries/bio": "5.40.0",
38
38
  "@datagrok-libraries/chem-meta": "^1.2.3",
39
- "@datagrok-libraries/ml": "^6.4.12",
39
+ "@datagrok-libraries/ml": "^6.4.13",
40
40
  "@datagrok-libraries/tutorials": "^1.3.12",
41
41
  "ajv": "^8.12.0",
42
42
  "ajv-errors": "^3.0.0",
@@ -20,7 +20,7 @@ export async function getEncodedSeqSpaceCol(
20
20
  const rowCount = seqCol.length;
21
21
  const sh = SeqHandler.forColumn(seqCol);
22
22
  const encList = Array<string>(rowCount);
23
- let charCodeCounter = 36;
23
+ let charCodeCounter = 1; // start at 1, 0 is reserved for null.
24
24
  const charCodeMap = new Map<string, string>();
25
25
  const seqColCats = seqCol.categories;
26
26
  const seqColRawData = seqCol.getRawData();
@@ -28,7 +28,7 @@ export async function getEncodedSeqSpaceCol(
28
28
  const catI = seqColRawData[rowIdx];
29
29
  const seq = seqColCats[catI];
30
30
  if (seq === null || seqCol.isNone(rowIdx)) {
31
- // @ts-ignore
31
+ //@ts-ignore
32
32
  encList[rowIdx] = null;
33
33
  continue;
34
34
  }
@@ -44,30 +44,13 @@ export async function getEncodedSeqSpaceCol(
44
44
  }
45
45
  }
46
46
  let options = {} as mmDistanceFunctionArgs;
47
- if (similarityMetric === MmDistanceFunctionsNames.MONOMER_CHEMICAL_DISTANCE) {
47
+ if (
48
+ similarityMetric === MmDistanceFunctionsNames.MONOMER_CHEMICAL_DISTANCE ||
49
+ similarityMetric === MmDistanceFunctionsNames.NEEDLEMANN_WUNSCH
50
+ ) {
48
51
  const monomers = Array.from(charCodeMap.keys());
49
52
  const monomerRes = await getMonomerSubstitutionMatrix(monomers, fingerprintType);
50
- // the susbstitution matrix contains similarity, but we need distances
51
- monomerRes.scoringMatrix.forEach((row, i) => {
52
- row.forEach((val, j) => {
53
- monomerRes.scoringMatrix[i][j] = 1 - val;
54
- });
55
- });
56
- const monomerHashToMatrixMap: { [_: string]: number } = {};
57
- Object.entries(monomerRes.alphabetIndexes).forEach(([key, value]) => {
58
- monomerHashToMatrixMap[charCodeMap.get(key)!] = value;
59
- });
60
- // sets distance function args in place.
61
- options = {scoringMatrix: monomerRes.scoringMatrix, alphabetIndexes: monomerHashToMatrixMap};
62
- } else if (similarityMetric === MmDistanceFunctionsNames.NEEDLEMANN_WUNSCH) {
63
- const monomers = Array.from(charCodeMap.keys());
64
- const monomerRes = await getMonomerSubstitutionMatrix(monomers, fingerprintType);
65
- // the susbstitution matrix contains similarity, but we need distances
66
- // monomerRes.scoringMatrix.forEach((row, i) => {
67
- // row.forEach((val, j) => {
68
- // monomerRes.scoringMatrix[i][j] = 1 - val;
69
- // });
70
- // });
53
+
71
54
  const monomerHashToMatrixMap: { [_: string]: number } = {};
72
55
  Object.entries(monomerRes.alphabetIndexes).forEach(([key, value]) => {
73
56
  monomerHashToMatrixMap[charCodeMap.get(key)!] = value;