@datagrok/bio 2.18.2 → 2.18.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
@@ -5,7 +5,7 @@
5
5
  "name": "Leonid Stolbov",
6
6
  "email": "lstolbov@datagrok.ai"
7
7
  },
8
- "version": "2.18.2",
8
+ "version": "2.18.3",
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",
@@ -97,6 +97,8 @@ export class DuplicateMonomerManager {
97
97
  DuplicateMonomerManager._instance = new DuplicateMonomerManager();
98
98
  await DuplicateMonomerManager._instance.refresh();
99
99
  const libManager = await MonomerLibManager.getInstance();
100
+ // reason: subscription happens only once, and is needed throught the lifetime of the app
101
+ // eslint-disable-next-line rxjs/no-async-subscribe, rxjs/no-ignored-subscription
100
102
  libManager.getMonomerLib().onChanged.subscribe(async () => await DuplicateMonomerManager._instance.refresh());
101
103
  }
102
104
  DuplicateMonomerManager._instance.refresh();
@@ -1087,12 +1087,24 @@ function monomerFromDfRow(dfRow: DG.Row): Monomer {
1087
1087
  if (typeof metaJSON[key] === 'object')
1088
1088
  metaJSON[key] = JSON.stringify(metaJSON[key]);
1089
1089
  }
1090
+ const smiles = dfRow.get(MONOMER_DF_COLUMN_NAMES.MONOMER);
1091
+ if (!smiles)
1092
+ throw new Error('Monomer SMILES is empty');
1093
+ let molfile = '';
1094
+
1095
+ try {
1096
+ molfile = grok.chem.convert(smiles, DG.chem.Notation.Smiles, DG.chem.Notation.MolBlock);
1097
+ molfile = getCorrectedMolBlock(molfile);
1098
+ } catch (e) {
1099
+ grok.shell.error(`Error converting SMILES to molfile, \n ${smiles}`);
1100
+ console.error(e);
1101
+ }
1090
1102
 
1091
1103
  return {
1092
1104
  symbol: dfRow.get(MONOMER_DF_COLUMN_NAMES.SYMBOL),
1093
1105
  name: dfRow.get(MONOMER_DF_COLUMN_NAMES.NAME),
1094
- molfile: '',
1095
- smiles: dfRow.get(MONOMER_DF_COLUMN_NAMES.MONOMER),
1106
+ molfile: molfile,
1107
+ smiles: smiles,
1096
1108
  polymerType: dfRow.get(MONOMER_DF_COLUMN_NAMES.POLYMER_TYPE),
1097
1109
  monomerType: dfRow.get(MONOMER_DF_COLUMN_NAMES.MONOMER_TYPE),
1098
1110
  naturalAnalog: dfRow.get(MONOMER_DF_COLUMN_NAMES.NATURAL_ANALOG),