@datagrok/bio 2.18.4 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +2 -2
- package/dist/242.js +1 -1
- package/dist/242.js.map +1 -1
- package/dist/284.js +1 -1
- package/dist/284.js.map +1 -1
- package/dist/589.js +1 -1
- package/dist/589.js.map +1 -1
- package/dist/731.js +1 -1
- package/dist/731.js.map +1 -1
- package/dist/810.js +2 -0
- package/dist/810.js.map +1 -0
- package/dist/980.js +1 -1
- package/dist/980.js.map +1 -1
- package/dist/package-test.js +2 -2
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +3 -3
- package/dist/package.js.map +1 -1
- package/dockerfiles/container.json +1 -1
- package/files/monomer-libraries/HELMCoreLibrary.json +18926 -18215
- package/files/samples/HELM_BI_CYCLIC.csv +7 -0
- package/files/samples/peptides-non-natural.csv +1001 -0
- package/files/tests/to-atomic-level-dna-fasta-output.csv +15077 -15077
- package/files/tests/to-atomic-level-msa-fasta-output.csv +1903 -1903
- package/files/tests/to-atomic-level-msa-separator-output.csv +3236 -3236
- package/files/tests/to-atomic-level-peptides-fasta-output.csv +32262 -32262
- package/files/tests/to-atomic-level-pt-fasta-2.mol +29 -29
- package/package.json +7 -7
- package/projects/seq_space_demo.zip +0 -0
- package/src/analysis/sequence-diversity-viewer.ts +22 -14
- package/src/analysis/sequence-search-base-viewer.ts +6 -72
- package/src/analysis/sequence-similarity-viewer.ts +42 -23
- package/src/demo/bio01-similarity-diversity.ts +21 -2
- package/src/demo/bio01a-hierarchical-clustering-and-sequence-space.ts +7 -0
- package/src/demo/bio01b-hierarchical-clustering-and-activity-cliffs.ts +1 -1
- package/src/demo/bio03-atomic-level.ts +15 -0
- package/src/package.ts +29 -59
- package/src/tests/activity-cliffs-utils.ts +7 -6
- package/src/tests/scoring.ts +2 -2
- package/src/tests/similarity-diversity-tests.ts +2 -2
- package/src/utils/cell-renderer.ts +11 -1
- package/src/utils/helm-to-molfile/converter/converter.ts +21 -9
- package/src/utils/helm-to-molfile/converter/monomer-wrapper.ts +8 -4
- package/src/utils/helm-to-molfile/converter/simple-polymer.ts +18 -9
- package/src/utils/monomer-lib/monomer-lib-base.ts +4 -4
- package/src/utils/pepsea.ts +22 -39
- package/src/utils/seq-helper/seq-handler.ts +2 -2
- package/src/utils/seq-helper/seq-helper.ts +50 -34
- package/src/utils/sequence-to-mol.ts +1 -1
- package/src/utils/ui-utils.ts +23 -0
- package/test-console-output-1.log +0 -7387
- package/test-record-1.mp4 +0 -0
|
@@ -9,9 +9,8 @@ import {RDModule, RDMol} from '@datagrok-libraries/chem-meta/src/rdkit-api';
|
|
|
9
9
|
import {IMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
10
10
|
import {getHelmHelper, IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
11
11
|
import {MolfileWithMap} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
12
|
-
import {getMolColName
|
|
12
|
+
import {getMolColName} from '@datagrok-libraries/bio/src/monomer-works/utils';
|
|
13
13
|
import {ChemTags} from '@datagrok-libraries/chem-meta/src/consts';
|
|
14
|
-
import {getMolHighlight} from '@datagrok-libraries/bio/src/monomer-works/seq-to-molfile';
|
|
15
14
|
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types/index';
|
|
16
15
|
|
|
17
16
|
import {HelmToMolfileConverter} from '../helm-to-molfile/converter';
|
|
@@ -19,6 +18,8 @@ import {ISeqHandler} from '@datagrok-libraries/bio/src/utils/macromolecule/seq-h
|
|
|
19
18
|
import {SeqHandler} from './seq-handler';
|
|
20
19
|
import {Column} from 'datagrok-api/dg';
|
|
21
20
|
import {NOTATION, TAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
21
|
+
import {errInfo} from '@datagrok-libraries/bio/src/utils/err-info';
|
|
22
|
+
import {_package} from '../../package';
|
|
22
23
|
|
|
23
24
|
type SeqHelperWindowType = Window & { $seqHelperPromise?: Promise<SeqHelper> };
|
|
24
25
|
declare const window: SeqHelperWindowType;
|
|
@@ -44,6 +45,37 @@ export class SeqHelper implements ISeqHelper {
|
|
|
44
45
|
return new HelmToMolfileConverter(helmHelper, this.rdKitModule, monomerLib);
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
helmToAtomicLevelSingle(
|
|
49
|
+
helm: string, converter: HelmToMolfileConverter, chiralityEngine?: boolean, beautifyMol: boolean = true) {
|
|
50
|
+
if (!helm)
|
|
51
|
+
return MolfileWithMap.createEmpty();
|
|
52
|
+
const molfileV3k = converter.convertToMolfileV3K([helm])[0];
|
|
53
|
+
if (!molfileV3k || !molfileV3k.molfile)
|
|
54
|
+
return MolfileWithMap.createEmpty();
|
|
55
|
+
let mol: RDMol | null = null;
|
|
56
|
+
try {
|
|
57
|
+
let v3k = molfileV3k.molfile;
|
|
58
|
+
if (beautifyMol) {
|
|
59
|
+
mol = this.rdKitModule.get_mol(v3k);
|
|
60
|
+
if (!mol)
|
|
61
|
+
return MolfileWithMap.createEmpty();
|
|
62
|
+
mol.set_new_coords();
|
|
63
|
+
mol.normalize_depiction(1);
|
|
64
|
+
mol.straighten_depiction(true);
|
|
65
|
+
v3k = mol.get_v3Kmolblock();
|
|
66
|
+
}
|
|
67
|
+
if (chiralityEngine)
|
|
68
|
+
v3k = converter.molV3KtoMolV3KOCL(v3k);
|
|
69
|
+
return new MolfileWithMap(v3k, molfileV3k.monomers);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
const [errMsg, errStack] = errInfo(err);
|
|
72
|
+
_package.logger.error(errMsg, undefined, errStack);
|
|
73
|
+
return MolfileWithMap.createEmpty();
|
|
74
|
+
} finally {
|
|
75
|
+
mol?.delete();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
47
79
|
async helmToAtomicLevel(
|
|
48
80
|
helmCol: DG.Column<string>, chiralityEngine?: boolean, highlight?: boolean, overrideMonomerLib?: IMonomerLibBase
|
|
49
81
|
): Promise<ToAtomicLevelRes> {
|
|
@@ -54,39 +86,23 @@ export class SeqHelper implements ISeqHelper {
|
|
|
54
86
|
|
|
55
87
|
const converter = await this.getHelmToMolfileConverter(monomerLib);
|
|
56
88
|
|
|
57
|
-
//#region From HelmToMolfileConverter.convertToRdKitBeautifiedMolfileColumn
|
|
58
|
-
|
|
59
|
-
const molfilesV3K = converter.convertToMolfileV3K(helmCol.toList());
|
|
60
|
-
|
|
61
|
-
const beautifiedMolList: (RDMol | null)[] = molfilesV3K.map((item) => {
|
|
62
|
-
const molfile = item.molfile;
|
|
63
|
-
if (molfile === '')
|
|
64
|
-
return null;
|
|
65
|
-
const mol = this.rdKitModule.get_mol(molfile);
|
|
66
|
-
if (!mol)
|
|
67
|
-
return null;
|
|
68
|
-
mol.set_new_coords();
|
|
69
|
-
mol.normalize_depiction(1);
|
|
70
|
-
mol.straighten_depiction(true);
|
|
71
|
-
return mol;
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
let molList: string[];
|
|
75
|
-
if (chiralityEngine) {
|
|
76
|
-
molList = converter.getMolV3000ViaOCL(beautifiedMolList, molColName).toList();
|
|
77
|
-
// TODO: Cleanup mol objects
|
|
78
|
-
} else {
|
|
79
|
-
molList = beautifiedMolList.map((mol) => {
|
|
80
|
-
if (mol === null)
|
|
81
|
-
return '';
|
|
82
|
-
const molBlock = mol.get_v3Kmolblock();
|
|
83
|
-
mol!.delete();
|
|
84
|
-
return molBlock;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
89
|
//#endregion From HelmToMolfileConverter
|
|
89
|
-
|
|
90
|
+
const helmList = helmCol.toList();
|
|
91
|
+
const molList = new Array<string>(helmCol.length);
|
|
92
|
+
const beautifyMolsChemFunc = DG.Func.find({package: 'Chem', name: 'beautifyMols'})[0];
|
|
93
|
+
// both options set to false, ugly molfiles
|
|
94
|
+
for (let i = 0; i < helmCol.length; i++) {
|
|
95
|
+
molList[i] = (this.helmToAtomicLevelSingle(helmList[i], converter,
|
|
96
|
+
chiralityEngine, !beautifyMolsChemFunc)).molfile;
|
|
97
|
+
}
|
|
98
|
+
// need to beautify the molfiles
|
|
99
|
+
if (beautifyMolsChemFunc) {
|
|
100
|
+
const beautifiedMols = await beautifyMolsChemFunc.apply({mols: molList});
|
|
101
|
+
if (beautifiedMols && Array.isArray(beautifiedMols) && beautifiedMols.length === helmCol.length) {
|
|
102
|
+
for (let i = 0; i < helmCol.length; i++)
|
|
103
|
+
beautifiedMols[i] && (molList[i] = beautifiedMols[i]);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
90
106
|
//const molHlList = molfilesV3K.map((item: MolfileWithMap) => getMolHighlight(item.monomers.values(), monomerLib));
|
|
91
107
|
|
|
92
108
|
const molCol = DG.Column.fromStrings(molColName, molList);
|
|
@@ -53,7 +53,7 @@ export async function sequenceToMolfile(
|
|
|
53
53
|
res.molCol.name = molColName;
|
|
54
54
|
df.columns.add(res.molCol, true);
|
|
55
55
|
|
|
56
|
-
buildMonomerHoverLink(macroMolecule, res.molCol, monomerLib, seqHelper, rdKitModule);
|
|
56
|
+
await buildMonomerHoverLink(macroMolecule, res.molCol, monomerLib, seqHelper, rdKitModule, nonlinear);
|
|
57
57
|
res.molCol.setTag(ChemTags.SEQUENCE_SRC_HL_MONOMERS, String(highlight));
|
|
58
58
|
await grok.data.detectSemanticTypes(df);
|
|
59
59
|
}
|
package/src/utils/ui-utils.ts
CHANGED
|
@@ -14,3 +14,26 @@ export function updateDivInnerHTML(div: HTMLElement, content: string | Node): vo
|
|
|
14
14
|
div.innerHTML = '';
|
|
15
15
|
div.append(content);
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
export function adjustGridcolAfterRender(
|
|
19
|
+
grid: DG.Grid, colName: string, width: number, rowHeight?: number, dontWait?: boolean
|
|
20
|
+
) {
|
|
21
|
+
const update = () => {
|
|
22
|
+
const col = grid.col(colName);
|
|
23
|
+
if (col)
|
|
24
|
+
col.width = width;
|
|
25
|
+
if (rowHeight)
|
|
26
|
+
grid.props.rowHeight = rowHeight;
|
|
27
|
+
};
|
|
28
|
+
if (dontWait) {
|
|
29
|
+
update();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const sub = grid.onAfterDrawOverlay.subscribe(() => {
|
|
34
|
+
sub.unsubscribe();
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
update();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|