@datagrok/bio 2.10.23 → 2.10.24
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/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/files/samples/HELM-non-linear.csv +8 -0
- package/package.json +1 -1
- package/src/demo/bio03-atomic-level.ts +1 -1
- package/src/package.ts +9 -17
- package/src/tests/to-atomic-level-tests.ts +1 -1
- package/src/utils/helm-to-molfile.ts +904 -0
- package/src/utils/sequence-to-mol.ts +37 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* Do not change these import lines to match external modules in webpack configuration */
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import * as ui from 'datagrok-api/ui';
|
|
4
|
+
import * as DG from 'datagrok-api/dg';
|
|
5
|
+
|
|
6
|
+
import {_toAtomicLevel} from '@datagrok-libraries/bio/src/monomer-works/to-atomic-level';
|
|
7
|
+
import {helm2mol} from './helm-to-molfile';
|
|
8
|
+
import {IMonomerLib} from '@datagrok-libraries/bio/src/types';
|
|
9
|
+
import {checkInputColumnUI} from './check-input-column';
|
|
10
|
+
import {getMonomerLibHelper} from '../package';
|
|
11
|
+
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
|
|
12
|
+
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
13
|
+
|
|
14
|
+
export async function sequenceToMolfile(df: DG.DataFrame, macroMolecule: DG.Column, nonlinear: boolean): Promise<void> {
|
|
15
|
+
if (DG.Func.find({package: 'Chem', name: 'getRdKitModule'}).length === 0) {
|
|
16
|
+
grok.shell.warning('Transformation to atomic level requires package "Chem" installed.');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (nonlinear) {
|
|
20
|
+
const seqUh = UnitsHandler.getOrCreate(macroMolecule);
|
|
21
|
+
if (!seqUh.isHelm())
|
|
22
|
+
macroMolecule = seqUh.convert(NOTATION.HELM);
|
|
23
|
+
helm2mol(df, macroMolecule);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!checkInputColumnUI(macroMolecule, 'To Atomic Level'))
|
|
27
|
+
return;
|
|
28
|
+
const monomerLib: IMonomerLib = getMonomerLibHelper().getBioLib();
|
|
29
|
+
const atomicLevelRes = await _toAtomicLevel(df, macroMolecule, monomerLib);
|
|
30
|
+
if (atomicLevelRes.col !== null) {
|
|
31
|
+
df.columns.add(atomicLevelRes.col, true);
|
|
32
|
+
await grok.data.detectSemanticTypes(df);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (atomicLevelRes.warnings && atomicLevelRes.warnings.length > 0)
|
|
36
|
+
grok.shell.warning(ui.list(atomicLevelRes.warnings));
|
|
37
|
+
}
|