@datagrok/sequence-translator 0.0.5 → 0.0.6

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": "SequenceTranslator",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "description": "",
6
6
  "dependencies": {
7
7
  "@datagrok-libraries/utils": "^0.1.0",
@@ -5,14 +5,21 @@ import * as OCL from 'openchemlib/full.js';
5
5
  export function saveSenseAntiSense() {
6
6
  const ssInput = ui.textInput('Sense Strand 5\' ->3\'', '');
7
7
  const asInput = ui.textInput('Anti Sense 3\' ->5\'', '');
8
+ const saveOption = ui.switchInput('save as one entity', false);
8
9
  const saveBtn = ui.button('Save SDF', () => {
9
10
  const smiSS = sequenceToSmiles(ssInput.value);
10
11
  const smiAS = sequenceToSmiles(asInput.value, true);
11
- const result =
12
+ let result: string;
13
+ if (saveOption.value)
14
+ result = `${OCL.Molecule.fromSmiles(smiSS + '.' + smiAS).toMolfile()}\n\n$$$$\n`;
15
+ else {
16
+ result =
12
17
  `${OCL.Molecule.fromSmiles(smiSS).toMolfile()}\n` +
13
18
  `> <Sequence>\nSense Strand\n\n$$$$\n` +
14
19
  `${OCL.Molecule.fromSmiles(smiAS).toMolfile()}\n` +
15
20
  `> <Sequence>\nAnti Sense\n\n$$$$\n`;
21
+ }
22
+
16
23
  const element = document.createElement('a');
17
24
  element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(result));
18
25
  element.setAttribute('download', ssInput.value.replace(/\s/g, '') + '.sdf');
@@ -26,6 +33,7 @@ export function saveSenseAntiSense() {
26
33
  ui.divV([
27
34
  ui.div([ssInput.root]),
28
35
  ui.div([asInput.root]),
36
+ saveOption,
29
37
  ui.buttonsInput([saveBtn]),
30
38
  ], 'ui-form'),
31
39
  ], 'ui-form'),