@datagrok/sequence-translator 1.2.0 → 1.2.2

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.2.0",
4
+ "version": "1.2.2",
5
5
  "author": {
6
6
  "name": "Alexey Choposky",
7
7
  "email": "achopovsky@datagrok.ai"
@@ -6,7 +6,7 @@ import * as DG from 'datagrok-api/dg';
6
6
  import {ExternalPluginUI} from '../view/app-ui';
7
7
  import {ColoredTextInput} from '../view/utils/colored-input/colored-text-input';
8
8
  import {highlightInvalidSubsequence} from '../view/utils/colored-input/input-painters';
9
- import {codesToHelmDictionary} from '../model/data-loading-utils/json-loader';
9
+ import {codesToSymbolsDictionary} from '../model/data-loading-utils/json-loader';
10
10
  import {MERMADE} from './const';
11
11
 
12
12
  export async function getExternalAppViewFactories(): Promise<{[name: string]: () => DG.View} | undefined> {
@@ -23,16 +23,16 @@ export async function getExternalAppViewFactories(): Promise<{[name: string]: ()
23
23
  let div: HTMLDivElement;
24
24
  try {
25
25
  div = await grok.functions.call(pluginName, data.parameters);
26
- } catch (err) {
27
- console.error(`Plugin ${pluginName} not loaded, error:`, err)
28
- div = ui.divText('error loading');
29
- }
30
- const pluginUI = new ExternalPluginUI(data.tabName, div);
26
+ const pluginUI = new ExternalPluginUI(data.tabName, div);
31
27
 
32
- // intentonally don't await for the promise
33
- pluginUI.initView();
28
+ // intentonally don't await for the promise
29
+ pluginUI.initView();
34
30
 
35
- result[data.tabName] = () => pluginUI.getView();
31
+ result[data.tabName] = () => pluginUI.getView();
32
+ } catch (err) {
33
+ console.warn(`Plugin ${pluginName} not loaded, reason:`, err)
34
+ continue;
35
+ }
36
36
  }
37
37
  return result;
38
38
  }
@@ -43,6 +43,6 @@ function getMerMadeParameters(): {[name: string]: any} {
43
43
 
44
44
  return {
45
45
  coloredInput: input,
46
- codes: codesToHelmDictionary
46
+ codes: codesToSymbolsDictionary
47
47
  }
48
48
  }
@@ -5,7 +5,6 @@ import * as DG from 'datagrok-api/dg';
5
5
 
6
6
  import {before, category, expect, test} from '@datagrok-libraries/utils/src/test';
7
7
  import {DEFAULT_FORMATS} from '../model/const';
8
- import {FormatConverter} from '../model/format-translation/format-converter';
9
8
  import {getJsonData} from '../model/data-loading-utils/json-loader';
10
9
  import {formatsToHelm} from './const';
11
10
  import {SequenceValidator} from '../model/parsing-validation/sequence-validator';
@@ -34,7 +33,7 @@ category('Formats support', () => {
34
33
  const result = Object.keys(output).length;
35
34
  // +1 due to nucleotides
36
35
  const expected = Object.keys(formatsToHelm).length + 1;
37
- expect(result, expected);
36
+ expect(true, expected <= result);
38
37
  });
39
38
  });
40
39
  });
@@ -4,8 +4,6 @@ import * as ui from 'datagrok-api/ui';
4
4
  import * as DG from 'datagrok-api/dg';
5
5
 
6
6
  import {before, category, expect, test} from '@datagrok-libraries/utils/src/test';
7
- import {DEFAULT_FORMATS} from '../model/const';
8
- import {FormatConverter} from '../model/format-translation/format-converter';
9
7
  import {getNucleotidesSequence} from '../model/format-translation/conversion-utils';
10
8
  import {getJsonData} from '../model/data-loading-utils/json-loader';
11
9
  import {helmToNucleotides} from './const';
@@ -9,7 +9,6 @@ import $ from 'cash-dom';
9
9
 
10
10
  import {errorToConsole} from '@datagrok-libraries/utils/src/to-console';
11
11
 
12
- // import {drawMolecule} from '../../utils/structures-works/draw-molecule';
13
12
  import {highlightInvalidSubsequence} from '../utils/colored-input/input-painters';
14
13
  import {getLinkedMolfile, saveSdf} from '../../model/sequence-to-structure-utils/sdf-tab';
15
14
  import {ColoredTextInput} from '../utils/colored-input/colored-text-input';
@@ -176,7 +175,8 @@ export class StructureLayoutHandler {
176
175
  let molfile = '';
177
176
  try {
178
177
  const strandData = this.getStrandData();
179
- molfile = this.getMolfile(strandData.ss, strandData.as, strandData.as2);
178
+ if (Object.values(strandData).some((data) => data.strand !== ''))
179
+ molfile = this.getMolfile(strandData.ss, strandData.as, strandData.as2);
180
180
  } catch (err) {
181
181
  const errStr = errorToConsole(err);
182
182
  console.error(errStr);
@@ -21,6 +21,11 @@ export class MoleculeImage {
21
21
  get molblock(): string { return this._validMolBlock; }
22
22
 
23
23
  set molblock(value: string) {
24
+ if (value === '') {
25
+ this._validMolBlock = value;
26
+ return;
27
+ }
28
+
24
29
  try {
25
30
  this.validateMolBlock(value);
26
31
  } catch (error) {