@datagrok/sequence-translator 1.10.1 → 1.10.3

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/sequence-translator",
3
3
  "friendlyName": "Sequence Translator",
4
- "version": "1.10.1",
4
+ "version": "1.10.3",
5
5
  "author": {
6
6
  "name": "Davit Rizhinashvili",
7
7
  "email": "drizhinashvili@datagrok.ai"
@@ -22,7 +22,7 @@
22
22
  }
23
23
  ],
24
24
  "dependencies": {
25
- "@datagrok-libraries/bio": "^5.60.1",
25
+ "@datagrok-libraries/bio": "^5.60.2",
26
26
  "@datagrok-libraries/chem-meta": "^1.2.8",
27
27
  "@datagrok-libraries/tutorials": "^1.6.1",
28
28
  "@datagrok-libraries/utils": "^4.6.5",
@@ -90,13 +90,15 @@ export function getNewMonomers(rdkit: RDModule, mLib: IMonomerLib, rule: RuleRea
90
90
  // const monomer1 = mLib.getMonomer('PEPTIDE', rule.firstMonomers[0]);
91
91
  // const monomer2 = mLib.getMonomer('PEPTIDE', rule.secondMonomers[0]);
92
92
  let mol: RDMol | null = null;
93
+ reactionMembers[1] = reactionMembers[1].replace('[C:1]', '[1*]').replace('[C:2]', '[2*]').replace('[C:3]', '[3*]');
94
+
93
95
  let pMolblock = '';
94
96
  try {
95
97
  mol = rdkit.get_mol(reactionMembers[1]);
96
98
  pMolblock = mol?.get_molblock();//molP?.get_v3Kmolblock();//
97
99
  } catch (err: any) {
98
100
  const [errMsg, _errStack] = errInfo(err);
99
- grok.shell.error(`Can not assemble monomer '${monomerName}': ${errMsg}.`);
101
+ console.error(`Can not assemble monomer '${monomerName}': ${errMsg}.`);
100
102
  throw err;
101
103
  } finally {
102
104
  mol?.delete();
@@ -146,16 +148,18 @@ export function getNewMonomers(rdkit: RDModule, mLib: IMonomerLib, rule: RuleRea
146
148
  }
147
149
 
148
150
  function modProduct(product: string): string {
149
- const fullMol = product.replace('M RAD', 'M RGP');
151
+ const fullMol = product.replace('M RAD', 'M RGP').replace('M ISO', 'M RGP');
150
152
  const lines = fullMol.split('\n');
151
- const natoms = Number(lines[3].substring(0, 3));
152
- const nbonds = Number(lines[3].substring(3, 6));
153
- const rgpShift = 4 + natoms + nbonds;
153
+ // const natoms = Number(lines[3].substring(0, 3));
154
+ // const nbonds = Number(lines[3].substring(3, 6));
155
+ const rgpShift = lines.findIndex((line) => line.startsWith('M RGP'));
154
156
 
155
157
  const fAtom = Number(lines[rgpShift].substring(9, 13));
156
158
  const sAtom = Number(lines[rgpShift].substring(17, 21));
159
+ const firstRgroupIndex = Number(lines[rgpShift].substring(13, 17));
160
+ const secondRgroupIndex = Number(lines[rgpShift].substring(21, 25));
157
161
 
158
- lines[rgpShift] = lines[rgpShift].substring(0, 13) + ' 1' + lines[rgpShift].substring(17, 21) + ' 2';
162
+ lines[rgpShift] = lines[rgpShift].substring(0, 13) + ` ${firstRgroupIndex}` + lines[rgpShift].substring(17, 21) + ` ${secondRgroupIndex}`;
159
163
 
160
164
  lines[3 + fAtom] = lines[3 + fAtom].substring(0, 30) + ' R# 0 0 0 0 0 0 0 0 0 0 0 0';
161
165
  lines[3 + sAtom] = lines[3 + sAtom].substring(0, 30) + ' R# 0 0 0 0 0 0 0 0 0 0 0 0';
@@ -185,7 +189,7 @@ function cutReactant(rdkit: RDModule, reactant: string, rxn: RDReaction, monomer
185
189
  molBlock = molP?.get_molblock();//molP?.get_v3Kmolblock();//
186
190
  } catch (err: any) {
187
191
  const [errMsg, _errStack] = errInfo(err);
188
- grok.shell.error(`Can not assemble monomer '${monomerName}': ${errMsg}.`);
192
+ console.error(`Can not assemble monomer '${monomerName}': ${errMsg}.`);
189
193
  throw err;
190
194
  } finally {
191
195
  mols?.delete();
@@ -205,7 +209,7 @@ function getReactionSmirks(rdkit: RDModule, smirks: string): RDReaction {
205
209
  } catch (err: any) {
206
210
  rxn?.delete();
207
211
  const [errMsg, _errStack] = errInfo(err);
208
- grok.shell.error(`Can not assemble monomer '${smirks}': ${errMsg}.`);
212
+ console.error(`Can not assemble monomer '${smirks}': ${errMsg}.`);
209
213
  throw err;
210
214
  } finally {
211
215
 
@@ -275,7 +279,7 @@ function getSyntheticMolBlock(rdkit: RDModule, reaction: string,
275
279
  molBlock = molP?.get_molblock();//molP?.get_v3Kmolblock();//
276
280
  } catch (err: any) {
277
281
  const [errMsg, _errStack] = errInfo(err);
278
- grok.shell.error(`Can not assemble monomer '${monomerName}': ${errMsg}.`);
282
+ console.error(`Can not assemble monomer '${monomerName}': ${errMsg}.`);
279
283
  throw err;
280
284
  } finally {
281
285
  rxn?.delete();