@datagrok/sequence-translator 1.5.0 → 1.5.1

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.5.0",
4
+ "version": "1.5.1",
5
5
  "author": {
6
6
  "name": "Leonid Stolbov",
7
7
  "email": "lstolbov@datagrok.ai"
package/src/package.ts CHANGED
@@ -301,6 +301,9 @@ export async function ptEnumeratorChemApp(): Promise<void> {
301
301
  //input: column col
302
302
  //input: string separator
303
303
  export function applyNotationProviderForCyclized(col: DG.Column<string>, separator: string) {
304
+ col.setTag('aligned', 'SEQ');
305
+ col.setTag('alphabet', 'UN');
306
+ col.setTag('.alphabetIsMultichar', 'true');
304
307
  col.meta.units = NOTATION.CUSTOM;
305
308
  col.tags[PolyToolTags.dataRole] = 'template';
306
309
  col.temp[SeqTemps.notationProvider] = new CyclizedNotationProvider(separator, _package.helmHelper);
@@ -179,10 +179,20 @@ export async function getOverriddenLibrary(rules: Rules): Promise<IMonomerLibBas
179
179
  const rdkit = await getRdKitModule();
180
180
  const argLib: { [symbol: string]: Monomer } = {};
181
181
 
182
+ let names: string [] = [];
183
+ let monomers: Monomer [] = [];
184
+
182
185
  for (let i = 0; i < rules.reactionRules.length; i++) {
183
- const [names, monomers] = getNewMonomers(rdkit, systemMonomerLib, rules.reactionRules[i]);
184
- for (let j = 0; j < names.length; j ++)
185
- argLib[names[j]] = monomers[j];
186
+ try {
187
+ [names, monomers] = getNewMonomers(rdkit, systemMonomerLib, rules.reactionRules[i]);
188
+ } catch (e: any) {
189
+ names = [];
190
+ monomers = [];
191
+ console.error(e);
192
+ } finally {
193
+ for (let j = 0; j < names.length; j ++)
194
+ argLib[names[j]] = monomers[j];
195
+ }
186
196
  }
187
197
 
188
198
  const overrideMonomerLibData: MonomerLibData = {[PolymerTypes.PEPTIDE]: argLib};
@@ -37,6 +37,7 @@ export class RulesManager {
37
37
  async getView(): Promise<DG.ViewBase> {
38
38
  if (!this.v) {
39
39
  this.v = DG.View.create();
40
+ this.v.name = 'Manage Polytool Rules';
40
41
  this.v.append(await this.getForm());
41
42
  }
42
43
 
@@ -94,8 +95,8 @@ export class RulesManager {
94
95
  const initCol = DG.Column.fromStrings('monomers', seqs);
95
96
  const helmCol = DG.Column.fromStrings('helm', helms);
96
97
 
97
- initCol.semType = DG.SEMTYPE.MACROMOLECULE;
98
98
  applyNotationProviderForCyclized(initCol, '-');
99
+ initCol.semType = DG.SEMTYPE.MACROMOLECULE;
99
100
 
100
101
  helmCol.semType = DG.SEMTYPE.MACROMOLECULE;
101
102
  helmCol.meta.units = NOTATION.HELM;
@@ -112,7 +113,7 @@ export class RulesManager {
112
113
  const code = this.rules.reactionRules[i].code;
113
114
  const [firstMonomers, secondMonomers] = getMonomerPairs(this.rules.reactionRules[i]);
114
115
  for (let j = 0; j < firstMonomers.length; j++) {
115
- const seq = `${firstMonomers[j]}(${code})-A-A-A-A-${secondMonomers[j]}(${code})-A`;
116
+ const seq = `${firstMonomers[j]}(${code})-A-A-A-A-${secondMonomers[j]}(${code})`;
116
117
  seqs.push(seq);
117
118
  }
118
119
  }