@datagrok-libraries/bio 5.32.3 → 5.32.5
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/.eslintrc.json +17 -12
- package/package.json +1 -1
- package/src/aminoacids.js +3 -4
- package/src/aminoacids.js.map +1 -1
- package/src/monomer-works/consts.d.ts +27 -0
- package/src/monomer-works/consts.d.ts.map +1 -0
- package/src/monomer-works/consts.js +30 -0
- package/src/monomer-works/consts.js.map +1 -0
- package/src/monomer-works/monomer-utils.js +6 -17
- package/src/monomer-works/monomer-utils.js.map +1 -1
- package/src/monomer-works/seq-to-molfile-worker.d.ts +2 -0
- package/src/monomer-works/seq-to-molfile-worker.d.ts.map +1 -0
- package/src/monomer-works/seq-to-molfile-worker.js +19 -0
- package/src/monomer-works/seq-to-molfile-worker.js.map +1 -0
- package/src/monomer-works/seq-to-molfile.d.ts +9 -0
- package/src/monomer-works/seq-to-molfile.d.ts.map +1 -0
- package/src/monomer-works/seq-to-molfile.js +31 -0
- package/src/monomer-works/seq-to-molfile.js.map +1 -0
- package/src/monomer-works/to-atomic-level-utils.d.ts +23 -0
- package/src/monomer-works/to-atomic-level-utils.d.ts.map +1 -0
- package/src/monomer-works/to-atomic-level-utils.js +284 -0
- package/src/monomer-works/to-atomic-level-utils.js.map +1 -0
- package/src/monomer-works/to-atomic-level.d.ts +48 -4
- package/src/monomer-works/to-atomic-level.d.ts.map +1 -1
- package/src/monomer-works/to-atomic-level.js +273 -503
- package/src/monomer-works/to-atomic-level.js.map +1 -1
- package/src/monomer-works/types.d.ts +71 -0
- package/src/monomer-works/types.d.ts.map +1 -0
- package/src/monomer-works/types.js +2 -0
- package/src/monomer-works/types.js.map +1 -0
- package/src/pdb/pdb-helper.js +7 -18
- package/src/pdb/pdb-helper.js.map +1 -1
- package/src/tests/palettes-tests.js +20 -33
- package/src/tests/palettes-tests.js.map +1 -1
- package/src/trees/dendrogram.js +2 -13
- package/src/trees/dendrogram.js.map +1 -1
- package/src/trees/tree-helper.js +7 -18
- package/src/trees/tree-helper.js.map +1 -1
- package/src/utils/cell-renderer.d.ts +1 -1
- package/src/utils/cell-renderer.d.ts.map +1 -1
- package/src/utils/cell-renderer.js +5 -7
- package/src/utils/cell-renderer.js.map +1 -1
- package/src/utils/macromolecule/utils.js +4 -6
- package/src/utils/macromolecule/utils.js.map +1 -1
- package/src/utils/splitter.js +1 -1
- package/src/utils/splitter.js.map +1 -1
- package/src/utils/units-handler.js +26 -38
- package/src/utils/units-handler.js.map +1 -1
- package/src/utils.js +1 -1
- package/src/utils.js.map +1 -1
- package/src/viewers/ngl-gl-viewer.js +6 -17
- package/src/viewers/ngl-gl-viewer.js.map +1 -1
- package/src/viewers/phylocanvas-gl-viewer.js +7 -18
- package/src/viewers/phylocanvas-gl-viewer.js.map +1 -1
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { monomerWorksConsts as C } from './consts';
|
|
2
|
+
import { HELM_CORE_FIELDS, } from '../utils/const';
|
|
3
|
+
/** Get a mapping of peptide symbols to HELM monomer library objects with selected fields.
|
|
4
|
+
* @param {IMonomerLib} monomerLib - Monomer library
|
|
5
|
+
* @param {HELM_POLYMER_TYPE} polymerType - Polymer type
|
|
6
|
+
* @param {ALPHABET} alphabet - Alphabet of the column
|
|
7
|
+
* @return {Map<string, any>} - Mapping of peptide symbols to HELM monomer library objects with selected fields*/
|
|
8
|
+
export function getFormattedMonomerLib(monomerLib, polymerType, alphabet) {
|
|
9
|
+
const map = new Map();
|
|
10
|
+
for (const monomerSymbol of monomerLib.getMonomerSymbolsByType(polymerType)) {
|
|
11
|
+
const it = monomerLib.getMonomer(polymerType, monomerSymbol);
|
|
12
|
+
if (polymerType === "RNA" /* HELM_POLYMER_TYPE.RNA */ &&
|
|
13
|
+
(it["monomerType" /* HELM_FIELDS.MONOMER_TYPE */] === "Branch" /* HELM_MONOMER_TYPE.BRANCH */ ||
|
|
14
|
+
alphabet === "DNA" /* ALPHABET.DNA */ && it["symbol" /* HELM_FIELDS.SYMBOL */] === C.DEOXYRIBOSE ||
|
|
15
|
+
alphabet === "RNA" /* ALPHABET.RNA */ && it["symbol" /* HELM_FIELDS.SYMBOL */] === C.RIBOSE ||
|
|
16
|
+
it["symbol" /* HELM_FIELDS.SYMBOL */] === C.PHOSPHATE) ||
|
|
17
|
+
polymerType === "PEPTIDE" /* HELM_POLYMER_TYPE.PEPTIDE */ &&
|
|
18
|
+
it["monomerType" /* HELM_FIELDS.MONOMER_TYPE */] !== "Branch" /* HELM_MONOMER_TYPE.BRANCH */) {
|
|
19
|
+
const monomerObject = {};
|
|
20
|
+
HELM_CORE_FIELDS.forEach((field) => {
|
|
21
|
+
//@ts-ignore
|
|
22
|
+
monomerObject[field] = it[field];
|
|
23
|
+
});
|
|
24
|
+
map.set(it["symbol" /* HELM_FIELDS.SYMBOL */], monomerObject);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return map;
|
|
28
|
+
}
|
|
29
|
+
/** Translate a sequence of monomer symbols into Molfile V3000
|
|
30
|
+
* @param {string[]} monomerSeq - Sequence of monomer symbols
|
|
31
|
+
* @param {Map<string, MolGraph>} monomersDict - Mapping of monomer symbols to MolGraph objects
|
|
32
|
+
* @param {ALPHABET} alphabet - Alphabet of the column
|
|
33
|
+
* @param {HELM_POLYMER_TYPE} polymerType - Polymer type
|
|
34
|
+
* @return {string} - Molfile V3000*/
|
|
35
|
+
export function monomerSeqToMolfile(monomerSeq, monomersDict, alphabet, polymerType) {
|
|
36
|
+
if (monomerSeq.length === 0) {
|
|
37
|
+
// throw new Error('monomerSeq is empty');
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
// define atom and bond counts, taking into account the bond type
|
|
41
|
+
const getAtomAndBondCounts = getResultingAtomBondCounts;
|
|
42
|
+
const { atomCount, bondCount } = getAtomAndBondCounts(monomerSeq, monomersDict, alphabet, polymerType);
|
|
43
|
+
// create arrays to store lines of the resulting molfile
|
|
44
|
+
const molfileAtomBlock = new Array(atomCount);
|
|
45
|
+
const molfileBondBlock = new Array(bondCount);
|
|
46
|
+
let addMonomerToMolblock; // todo: types?
|
|
47
|
+
let sugar = null;
|
|
48
|
+
let phosphate = null;
|
|
49
|
+
if (polymerType === "PEPTIDE" /* HELM_POLYMER_TYPE.PEPTIDE */) {
|
|
50
|
+
addMonomerToMolblock = addAminoAcidToMolblock;
|
|
51
|
+
}
|
|
52
|
+
else { // nucleotides
|
|
53
|
+
addMonomerToMolblock = addNucleotideToMolblock;
|
|
54
|
+
sugar = (alphabet === "DNA" /* ALPHABET.DNA */) ? monomersDict.get(C.DEOXYRIBOSE) : monomersDict.get(C.RIBOSE);
|
|
55
|
+
phosphate = monomersDict.get(C.PHOSPHATE);
|
|
56
|
+
}
|
|
57
|
+
const v = {
|
|
58
|
+
i: 0,
|
|
59
|
+
nodeShift: 0,
|
|
60
|
+
bondShift: 0,
|
|
61
|
+
backbonePositionShift: new Array(2).fill(0),
|
|
62
|
+
branchPositionShift: new Array(2).fill(0),
|
|
63
|
+
backboneAttachNode: 0,
|
|
64
|
+
branchAttachNode: 0,
|
|
65
|
+
flipFactor: 1,
|
|
66
|
+
};
|
|
67
|
+
const LC = {
|
|
68
|
+
sugar: sugar,
|
|
69
|
+
phosphate: phosphate,
|
|
70
|
+
seqLength: monomerSeq.length,
|
|
71
|
+
atomCount: atomCount,
|
|
72
|
+
bondCount: bondCount,
|
|
73
|
+
};
|
|
74
|
+
for (v.i = 0; v.i < LC.seqLength; ++v.i) {
|
|
75
|
+
const monomer = monomersDict.get(monomerSeq[v.i]);
|
|
76
|
+
addMonomerToMolblock(monomer, molfileAtomBlock, molfileBondBlock, v, LC);
|
|
77
|
+
}
|
|
78
|
+
capResultingMolblock(molfileAtomBlock, molfileBondBlock, v, LC);
|
|
79
|
+
const molfileCountsLine = C.V3K_BEGIN_COUNTS_LINE + atomCount + ' ' + bondCount + C.V3K_COUNTS_LINE_ENDING;
|
|
80
|
+
// todo: possible optimization may be achieved by replacing .join('') with +=
|
|
81
|
+
// since counterintuitively joining an array into a new string is reportedly
|
|
82
|
+
// slower than using += as below
|
|
83
|
+
let result = '';
|
|
84
|
+
result += C.V3K_HEADER_FIRST_LINE;
|
|
85
|
+
result += C.V3K_HEADER_SECOND_LINE;
|
|
86
|
+
result += C.V3K_BEGIN_CTAB_BLOCK;
|
|
87
|
+
result += molfileCountsLine;
|
|
88
|
+
result += C.V3K_BEGIN_ATOM_BLOCK;
|
|
89
|
+
result += molfileAtomBlock.join('');
|
|
90
|
+
result += C.V3K_END_ATOM_BLOCK;
|
|
91
|
+
result += C.V3K_BEGIN_BOND_BLOCK;
|
|
92
|
+
result += molfileBondBlock.join('');
|
|
93
|
+
result += C.V3K_END_BOND_BLOCK;
|
|
94
|
+
result += C.V3K_END_CTAB_BLOCK;
|
|
95
|
+
result += C.V3K_END;
|
|
96
|
+
// return molfileParts.join('');
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
/** Cap the resulting (after sewing up all the monomers) molfile with 'O'
|
|
100
|
+
* @param {string[]} molfileAtomBlock - Array of lines of the resulting molfile atom block
|
|
101
|
+
* @param {string[]} molfileBondBlock - Array of lines of the resulting molfile bond block
|
|
102
|
+
* @param {LoopVariables} v - Loop variables
|
|
103
|
+
* @param {LoopConstants} LC - Loop constants*/
|
|
104
|
+
function capResultingMolblock(molfileAtomBlock, molfileBondBlock, v, LC) {
|
|
105
|
+
// add terminal oxygen
|
|
106
|
+
const atomIdx = v.nodeShift + 1;
|
|
107
|
+
molfileAtomBlock[LC.atomCount] = C.V3K_BEGIN_DATA_LINE + atomIdx + ' ' +
|
|
108
|
+
C.OXYGEN + ' ' + keepPrecision(v.backbonePositionShift[0]) + ' ' +
|
|
109
|
+
v.flipFactor * keepPrecision(v.backbonePositionShift[1]) + ' ' + '0.000000 0' + '\n';
|
|
110
|
+
// add terminal bond
|
|
111
|
+
const firstAtom = v.backboneAttachNode;
|
|
112
|
+
const secondAtom = atomIdx;
|
|
113
|
+
molfileBondBlock[LC.bondCount] = C.V3K_BEGIN_DATA_LINE + v.bondShift + ' ' +
|
|
114
|
+
1 + ' ' + firstAtom + ' ' + secondAtom + '\n';
|
|
115
|
+
}
|
|
116
|
+
function addAminoAcidToMolblock(monomer, molfileAtomBlock, molfileBondBlock, v) {
|
|
117
|
+
v.flipFactor = (-1) ** (v.i % 2); // to flip every even monomer over OX
|
|
118
|
+
addBackboneMonomerToMolblock(monomer, molfileAtomBlock, molfileBondBlock, v);
|
|
119
|
+
}
|
|
120
|
+
function addBackboneMonomerToMolblock(monomer, molfileAtomBlock, molfileBondBlock, v) {
|
|
121
|
+
// todo: remove these comments to the docstrings of the corr. functions
|
|
122
|
+
// construnct the lines of V3K molfile atom block
|
|
123
|
+
fillAtomLines(monomer, molfileAtomBlock, v);
|
|
124
|
+
// construct the lines of V3K molfile bond block
|
|
125
|
+
fillBondLines(monomer, molfileBondBlock, v);
|
|
126
|
+
// peptide bond
|
|
127
|
+
fillChainExtendingBond(monomer, molfileBondBlock, v);
|
|
128
|
+
// update branch variables if necessary
|
|
129
|
+
if (monomer.meta.branchShift !== null && monomer.meta.terminalNodes.length > 2)
|
|
130
|
+
updateBranchVariables(monomer, v);
|
|
131
|
+
// update loop variables
|
|
132
|
+
updateChainExtendingVariables(monomer, v);
|
|
133
|
+
}
|
|
134
|
+
function addNucleotideToMolblock(nucleobase, molfileAtomBlock, molfileBondBlock, v, LC) {
|
|
135
|
+
// construnct the lines of V3K molfile atom block corresponding to phosphate
|
|
136
|
+
// and sugar
|
|
137
|
+
if (v.i === 0) {
|
|
138
|
+
addBackboneMonomerToMolblock(LC.sugar, molfileAtomBlock, molfileBondBlock, v);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
for (const monomer of [LC.phosphate, LC.sugar])
|
|
142
|
+
addBackboneMonomerToMolblock(monomer, molfileAtomBlock, molfileBondBlock, v);
|
|
143
|
+
}
|
|
144
|
+
addBranchMonomerToMolblock(nucleobase, molfileAtomBlock, molfileBondBlock, v);
|
|
145
|
+
}
|
|
146
|
+
function addBranchMonomerToMolblock(monomer, molfileAtomBlock, molfileBondBlock, v) {
|
|
147
|
+
fillBranchAtomLines(monomer, molfileAtomBlock, v);
|
|
148
|
+
fillBondLines(monomer, molfileBondBlock, v);
|
|
149
|
+
fillBackboneToBranchBond(monomer, molfileBondBlock, v);
|
|
150
|
+
// C-N bond
|
|
151
|
+
const bondIdx = v.bondShift;
|
|
152
|
+
const firstAtom = v.branchAttachNode;
|
|
153
|
+
const secondAtom = monomer.meta.terminalNodes[0] + v.nodeShift;
|
|
154
|
+
molfileBondBlock[bondIdx - 1] = C.V3K_BEGIN_DATA_LINE + bondIdx + ' ' +
|
|
155
|
+
1 + ' ' + firstAtom + ' ' + secondAtom + '\n';
|
|
156
|
+
// update loop variables
|
|
157
|
+
v.bondShift += monomer.bonds.atomPairs.length + 1;
|
|
158
|
+
v.nodeShift += monomer.atoms.atomTypes.length;
|
|
159
|
+
}
|
|
160
|
+
function updateChainExtendingVariables(monomer, v) {
|
|
161
|
+
v.backboneAttachNode = v.nodeShift + monomer.meta.terminalNodes[1];
|
|
162
|
+
v.bondShift += monomer.bonds.atomPairs.length + 1;
|
|
163
|
+
v.nodeShift += monomer.atoms.atomTypes.length;
|
|
164
|
+
v.backbonePositionShift[0] += monomer.meta.backboneShift[0]; // todo: non-null check
|
|
165
|
+
v.backbonePositionShift[1] += v.flipFactor * monomer.meta.backboneShift[1];
|
|
166
|
+
}
|
|
167
|
+
function updateBranchVariables(monomer, v) {
|
|
168
|
+
v.branchAttachNode = v.nodeShift + monomer.meta.terminalNodes[2];
|
|
169
|
+
for (let i = 0; i < 2; ++i)
|
|
170
|
+
v.branchPositionShift[i] = v.backbonePositionShift[i] + monomer.meta.branchShift[i];
|
|
171
|
+
}
|
|
172
|
+
function fillAtomLines(monomer, molfileAtomBlock, v) {
|
|
173
|
+
for (let j = 0; j < monomer.atoms.atomTypes.length; ++j) {
|
|
174
|
+
const atomIdx = v.nodeShift + j + 1;
|
|
175
|
+
molfileAtomBlock[v.nodeShift + j] = C.V3K_BEGIN_DATA_LINE + atomIdx + ' ' +
|
|
176
|
+
monomer.atoms.atomTypes[j] + ' ' +
|
|
177
|
+
keepPrecision(v.backbonePositionShift[0] + monomer.atoms.x[j]) + ' ' +
|
|
178
|
+
keepPrecision(v.backbonePositionShift[1] + v.flipFactor * monomer.atoms.y[j]) +
|
|
179
|
+
' ' + monomer.atoms.kwargs[j];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// todo: remove as quickfix
|
|
183
|
+
function fillBranchAtomLines(monomer, molfileAtomBlock, v) {
|
|
184
|
+
for (let j = 0; j < monomer.atoms.atomTypes.length; ++j) {
|
|
185
|
+
const atomIdx = v.nodeShift + j + 1;
|
|
186
|
+
molfileAtomBlock[v.nodeShift + j] = C.V3K_BEGIN_DATA_LINE + atomIdx + ' ' +
|
|
187
|
+
monomer.atoms.atomTypes[j] + ' ' +
|
|
188
|
+
keepPrecision(v.branchPositionShift[0] + monomer.atoms.x[j]) + ' ' +
|
|
189
|
+
keepPrecision(v.branchPositionShift[1] + v.flipFactor * monomer.atoms.y[j]) +
|
|
190
|
+
' ' + monomer.atoms.kwargs[j];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function fillBondLines(monomer, molfileBondBlock, v) {
|
|
194
|
+
// construct the lines of V3K molfile bond block
|
|
195
|
+
for (let j = 0; j < monomer.bonds.atomPairs.length; ++j) {
|
|
196
|
+
const bondIdx = v.bondShift + j + 1;
|
|
197
|
+
const firstAtom = monomer.bonds.atomPairs[j][0] + v.nodeShift;
|
|
198
|
+
const secondAtom = monomer.bonds.atomPairs[j][1] + v.nodeShift;
|
|
199
|
+
let bondCfg = '';
|
|
200
|
+
if (monomer.bonds.bondConfiguration.has(j)) {
|
|
201
|
+
// flip orientation when necessary
|
|
202
|
+
let orientation = monomer.bonds.bondConfiguration.get(j);
|
|
203
|
+
if (v.flipFactor < 0)
|
|
204
|
+
orientation = (orientation === 1) ? 3 : 1;
|
|
205
|
+
bondCfg = ' CFG=' + orientation;
|
|
206
|
+
}
|
|
207
|
+
const kwargs = monomer.bonds.kwargs.has(j) ?
|
|
208
|
+
' ' + monomer.bonds.kwargs.get(j) : '';
|
|
209
|
+
molfileBondBlock[v.bondShift + j] = C.V3K_BEGIN_DATA_LINE + bondIdx + ' ' +
|
|
210
|
+
monomer.bonds.bondTypes[j] + ' ' +
|
|
211
|
+
firstAtom + ' ' + secondAtom + bondCfg + kwargs + '\n';
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function fillChainExtendingBond(monomer, molfileBondBlock, v) {
|
|
215
|
+
if (v.backboneAttachNode !== 0) {
|
|
216
|
+
const bondIdx = v.bondShift;
|
|
217
|
+
const firstAtom = v.backboneAttachNode;
|
|
218
|
+
const secondAtom = monomer.meta.terminalNodes[0] + v.nodeShift;
|
|
219
|
+
molfileBondBlock[v.bondShift - 1] = C.V3K_BEGIN_DATA_LINE + bondIdx + ' ' +
|
|
220
|
+
1 + ' ' + firstAtom + ' ' + secondAtom + '\n';
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// todo: remove
|
|
224
|
+
function fillBackboneToBranchBond(branchMonomer, molfileBondBlock, v) {
|
|
225
|
+
const bondIdx = v.bondShift;
|
|
226
|
+
const firstAtom = v.branchAttachNode;
|
|
227
|
+
const secondAtom = branchMonomer.meta.terminalNodes[0] + v.nodeShift;
|
|
228
|
+
molfileBondBlock[bondIdx - 1] = C.V3K_BEGIN_DATA_LINE + bondIdx + ' ' +
|
|
229
|
+
1 + ' ' + firstAtom + ' ' + secondAtom + '\n';
|
|
230
|
+
}
|
|
231
|
+
/** Compute the atom/bond counts for the resulting molfile, depending on the
|
|
232
|
+
* type of polymer (peptide/nucleotide)
|
|
233
|
+
* @param {string[]}monomerSeq - the sequence of monomers
|
|
234
|
+
* @param {Map<string, MolGraph>}monomersDict - the dictionary of monomers
|
|
235
|
+
* @param {ALPHABET}alphabet - the alphabet of the monomers
|
|
236
|
+
* @param {HELM_POLYMER_TYPE}polymerType - the type of polymer
|
|
237
|
+
* @return {{atomCount: number, bondCount: number}} - the atom/bond counts*/
|
|
238
|
+
function getResultingAtomBondCounts(monomerSeq, monomersDict, alphabet, polymerType) {
|
|
239
|
+
let atomCount = 0;
|
|
240
|
+
let bondCount = 0;
|
|
241
|
+
// sum up all the atoms/nodes provided by the sequence
|
|
242
|
+
for (const monomerSymbol of monomerSeq) {
|
|
243
|
+
if (monomerSymbol === '')
|
|
244
|
+
continue; // Skip for gap/empty monomer in MSA
|
|
245
|
+
const monomer = monomersDict.get(monomerSymbol);
|
|
246
|
+
atomCount += monomer.atoms.x.length;
|
|
247
|
+
bondCount += monomer.bonds.bondTypes.length;
|
|
248
|
+
}
|
|
249
|
+
// add extra values depending on the polymer type
|
|
250
|
+
if (polymerType === "PEPTIDE" /* HELM_POLYMER_TYPE.PEPTIDE */) {
|
|
251
|
+
// add the rightmost/terminating cap group 'OH' (i.e. 'O')
|
|
252
|
+
atomCount += 1;
|
|
253
|
+
// add chain-extending bonds (C-NH per each monomer pair and terminal C-OH)
|
|
254
|
+
bondCount += monomerSeq.length;
|
|
255
|
+
}
|
|
256
|
+
else { // nucleotides
|
|
257
|
+
const sugar = (alphabet === "DNA" /* ALPHABET.DNA */) ?
|
|
258
|
+
monomersDict.get(C.DEOXYRIBOSE) : monomersDict.get(C.RIBOSE);
|
|
259
|
+
const phosphate = monomersDict.get(C.PHOSPHATE);
|
|
260
|
+
// add phosphate per each pair of nucleobase symbols
|
|
261
|
+
atomCount += (monomerSeq.length - 1) * phosphate.atoms.x.length;
|
|
262
|
+
// add sugar per each nucleobase symbol
|
|
263
|
+
atomCount += monomerSeq.length * sugar.atoms.x.length;
|
|
264
|
+
// add the leftmost cap group 'OH' (i.e. 'O')
|
|
265
|
+
atomCount += 1;
|
|
266
|
+
// add bonds from phosphate monomers
|
|
267
|
+
bondCount += (monomerSeq.length - 1) * phosphate.bonds.bondTypes.length;
|
|
268
|
+
// add bonds from sugar monomers
|
|
269
|
+
bondCount += monomerSeq.length * sugar.bonds.bondTypes.length;
|
|
270
|
+
// exclude the first chain-extending bond O-P (absent, no 'leftmost' phosphate)
|
|
271
|
+
bondCount -= 1;
|
|
272
|
+
// add chain-extending and branch bonds (O-P, C-O and C-N per each nucleotide)
|
|
273
|
+
bondCount += monomerSeq.length * 3;
|
|
274
|
+
}
|
|
275
|
+
return { atomCount, bondCount };
|
|
276
|
+
}
|
|
277
|
+
/** Keep precision upon floating point operations over atom coordinates
|
|
278
|
+
* @param {number}x - the floating point number
|
|
279
|
+
* @return {number} - the floating point number with the same precision
|
|
280
|
+
*/
|
|
281
|
+
export function keepPrecision(x) {
|
|
282
|
+
return Math.round(C.PRECISION_FACTOR * x) / C.PRECISION_FACTOR;
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=to-atomic-level-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-atomic-level-utils.js","sourceRoot":"","sources":["to-atomic-level-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,IAAI,CAAC,EAAC,MAAM,UAAU,CAAC;AAGjD,OAAO,EACQ,gBAAgB,GAC9B,MAAM,gBAAgB,CAAC;AAKxB;;;;iHAIiH;AACjH,MAAM,UAAU,sBAAsB,CACpC,UAAuB,EAAE,WAA8B,EAAE,QAAkB;IAE3E,MAAM,GAAG,GAAG,IAAI,GAAG,EAAe,CAAC;IACnC,KAAK,MAAM,aAAa,IAAI,UAAU,CAAC,uBAAuB,CAAC,WAAW,CAAC,EAAE;QAC3E,MAAM,EAAE,GAAY,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,aAAa,CAAE,CAAC;QACvE,IACE,WAAW,sCAA0B;YACnC,CAAC,EAAE,8CAA0B,4CAA6B;gBACxD,QAAQ,6BAAiB,IAAI,EAAE,mCAAoB,KAAK,CAAC,CAAC,WAAW;gBACrE,QAAQ,6B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AAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAEtD,6CAA6C;QAC7C,SAAS,IAAI,CAAC,CAAC;QAEf,oCAAoC;QACpC,SAAS,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAExE,gCAAgC;QAChC,SAAS,IAAI,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAE9D,+EAA+E;QAC/E,SAAS,IAAI,CAAC,CAAC;QAEf,8EAA8E;QAC9E,SAAS,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;KACpC;IAED,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,CAAC;AAChC,CAAC;AAED;;;EAGE;AACF,MAAM,UAAU,aAAa,CAAC,CAAS;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,gBAAgB,CAAC;AACjE,CAAC"}
|
|
@@ -1,14 +1,58 @@
|
|
|
1
1
|
import * as DG from 'datagrok-api/dg';
|
|
2
|
+
import { HELM_POLYMER_TYPE } from '../utils/const';
|
|
3
|
+
import { ALPHABET } from '../utils/macromolecule/consts';
|
|
2
4
|
import { IMonomerLib, Monomer } from '../types';
|
|
3
|
-
|
|
5
|
+
import { Bonds, MolGraph } from './types';
|
|
6
|
+
/** Convert Macromolecule column into Molecule column storing molfile V3000 with the help of a monomer library
|
|
7
|
+
* @param {DG.DataFrame} df - DataFrame containing the column to be converted
|
|
8
|
+
* @param {DG.Column} seqCol - Column containing the macromolecule sequence
|
|
9
|
+
* @param {IMonomerLib} monomerLib - Monomer library
|
|
10
|
+
*/
|
|
4
11
|
export declare function _toAtomicLevel(df: DG.DataFrame, seqCol: DG.Column<string>, monomerLib: IMonomerLib): Promise<{
|
|
5
12
|
col: DG.Column | null;
|
|
6
13
|
warnings: string[];
|
|
7
14
|
}>;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
15
|
+
/** Get jagged array of monomer symbols for the dataframe
|
|
16
|
+
* @param {DG.Column} macroMolCol - Column with macro-molecules
|
|
17
|
+
* @return {string[]} - Jagged array of monomer symbols for the dataframe */
|
|
18
|
+
export declare function getMonomerSequencesArray(macroMolCol: DG.Column<string>): string[][];
|
|
19
|
+
/** Get a mapping of monomer symbols to MolGraph objects. Notice, the
|
|
20
|
+
* transformation from molfile V2000 to V3000 takes place,
|
|
21
|
+
* with the help of async function call from Chem (RdKit module)
|
|
22
|
+
* @param {string[]} monomerSequencesArray - Jagged array of monomer symbols for the dataframe
|
|
23
|
+
* @param {IMonomerLib} monomerLib - Monomer library
|
|
24
|
+
* @param {HELM_POLYMER_TYPE} polymerType - Polymer type
|
|
25
|
+
* @param {ALPHABET} alphabet - Alphabet
|
|
26
|
+
* @return {Map<string, MolGraph>} - Mapping of monomer symbols to MolGraph objects*/
|
|
27
|
+
export declare function getMonomersDictFromLib(monomerSequencesArray: string[][], monomerLib: IMonomerLib, polymerType: HELM_POLYMER_TYPE, alphabet: ALPHABET): Promise<Map<string, MolGraph>>;
|
|
28
|
+
/** Parse element symbols for R-groups from the HELM monomer library R-group field
|
|
29
|
+
* @param {any[]} rGroupObjList - R-group object list
|
|
30
|
+
* @return {Map<number, number>} - Cap group index map*/
|
|
10
31
|
export declare function parseCapGroups(rGroupObjList: any[]): string[];
|
|
32
|
+
/** V2000 to V3000 converter
|
|
33
|
+
* @param {string} molfileV2K - V2000 molfile
|
|
34
|
+
* @param {any} moduleRdkit - RDKit module
|
|
35
|
+
* @return {string} - V3000 molfile*/
|
|
36
|
+
export declare function convertMolfileToV3K(molfileV2K: string, moduleRdkit: any): string;
|
|
37
|
+
/** Parse V3000 bond block and construct the Bonds object
|
|
38
|
+
* @param {string} molfileV3K - V3000 molfile
|
|
39
|
+
* @param {number} bondCount - Number of bonds
|
|
40
|
+
* @return {Bonds} - Bonds object*/
|
|
41
|
+
export declare function parseBondBlock(molfileV3K: string, bondCount: number): Bonds;
|
|
42
|
+
/** Constructs mapping of r-group nodes to default capGroups, all numeration starting from 1.
|
|
43
|
+
* According to https://pubs.acs.org/doi/10.1021/ci3001925, R1 and R2 are the chain extending attachment points,
|
|
44
|
+
* while R3 is the branching attachment point.
|
|
45
|
+
* @param {string} molfileV2K - V2000 molfile
|
|
46
|
+
* @return {Map<number, number>} - Map of r-group nodes to default capGroups*/
|
|
47
|
+
export declare function parseCapGroupIdxMap(molfileV2K: string): Map<number, number>;
|
|
48
|
+
export declare function parseAtomAndBondCounts(molfileV3K: string): {
|
|
49
|
+
atomCount: number;
|
|
50
|
+
bondCount: number;
|
|
51
|
+
};
|
|
52
|
+
export declare function convertMolGraphToMolfileV3K(molGraph: MolGraph): string;
|
|
11
53
|
export declare function getSymbolToCappedMolfileMap(monomersLibList: any[]): Promise<Map<string, string> | undefined>;
|
|
12
|
-
/** Get the V3K molfile corresponding to the capped Monomer (default cap groups)
|
|
54
|
+
/** Get the V3K molfile corresponding to the capped Monomer (default cap groups)
|
|
55
|
+
* @param {Monomer} monomer
|
|
56
|
+
* @return {string} V3K molfile*/
|
|
13
57
|
export declare function capPeptideMonomer(monomer: Monomer): string;
|
|
14
58
|
//# sourceMappingURL=to-atomic-level.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-atomic-level.d.ts","sourceRoot":"","sources":["to-atomic-level.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"to-atomic-level.d.ts","sourceRoot":"","sources":["to-atomic-level.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAc,iBAAiB,EAAqB,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAC,QAAQ,EAAiB,MAAM,+BAA+B,CAAC;AAEvE,OA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