@datagrok/bio 2.4.39 → 2.4.41

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.4.39",
8
+ "version": "2.4.41",
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",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@biowasm/aioli": "^3.1.0",
17
- "@datagrok-libraries/bio": "^5.32.1",
17
+ "@datagrok-libraries/bio": "^5.32.2",
18
18
  "@datagrok-libraries/chem-meta": "^1.0.1",
19
19
  "@datagrok-libraries/ml": "^6.3.37",
20
20
  "@datagrok-libraries/tutorials": "^1.3.2",
@@ -17,13 +17,12 @@ let convertDialogSubs: Subscription[] = [];
17
17
  * @param {DG.column} col Column with 'Macromolecule' semantic type
18
18
  */
19
19
  export function convert(col?: DG.Column): void {
20
-
21
20
  let tgtCol = col ?? grok.shell.t.columns.bySemType('Macromolecule')!;
22
21
  if (!tgtCol)
23
22
  throw new Error('No column with Macromolecule semantic type found');
24
23
  let converter = new NotationConverter(tgtCol);
25
24
  let currentNotation: NOTATION = converter.notation;
26
- const dialogHeader = ui.divText(
25
+ const dialogHeader = ui.divText(
27
26
  'Current notation: ' + currentNotation,
28
27
  {
29
28
  style: {
@@ -48,9 +47,11 @@ export function convert(col?: DG.Column): void {
48
47
  tgtCol = newCol;
49
48
  converter = new NotationConverter(tgtCol);
50
49
  currentNotation = converter.notation;
50
+ if (currentNotation === NOTATION.HELM)
51
+ separatorInput.value = '/'; // helm monomers can have - in the name like D-aThr;
51
52
  dialogHeader.textContent = 'Current notation: ' + currentNotation;
52
53
  filteredNotations = notations.filter((e) => e !== currentNotation);
53
- targetNotationInput = ui.choiceInput('Convert to', filteredNotations[0], filteredNotations);
54
+ targetNotationInput = ui.choiceInput('Convert to', filteredNotations[0], filteredNotations, toggleSeparator);
54
55
  toggleSeparator();
55
56
  convertDialog?.clear();
56
57
  convertDialog?.add(ui.div([
@@ -58,14 +59,13 @@ export function convert(col?: DG.Column): void {
58
59
  targetColumnInput.root,
59
60
  targetNotationInput.root,
60
61
  separatorInput.root
61
- ]))
62
+ ]));
62
63
  };
63
64
 
64
65
  const targetColumnInput = ui.columnInput('Column', grok.shell.t, tgtCol, toggleColumn);
65
66
 
66
67
  const separatorArray = ['-', '.', '/'];
67
68
  let filteredNotations = notations.filter((e) => e !== currentNotation);
68
- let targetNotationInput = ui.choiceInput('Convert to', filteredNotations[0], filteredNotations);
69
69
 
70
70
  const separatorInput = ui.choiceInput('Separator', separatorArray[0], separatorArray);
71
71
 
@@ -76,6 +76,7 @@ export function convert(col?: DG.Column): void {
76
76
  else
77
77
  $(separatorInput.root).show();
78
78
  };
79
+ let targetNotationInput = ui.choiceInput('Convert to', filteredNotations[0], filteredNotations, toggleSeparator);
79
80
 
80
81
  // set correct visibility on init
81
82
  toggleSeparator();
@@ -11,7 +11,7 @@ import {_package} from '../package';
11
11
  import {multipleSequenceAlginmentUIOptions} from './types';
12
12
  import {kalignVersion, msaDefaultOptions} from './constants';
13
13
  import '../../css/msa.css';
14
- import { ColumnInputOptions } from '@datagrok-libraries/utils/src/type-declarations';
14
+ import {ColumnInputOptions} from '@datagrok-libraries/utils/src/type-declarations';
15
15
  export class MsaWarning extends Error {
16
16
  constructor(message: string, options?: ErrorOptions) {
17
17
  super(message, options);
@@ -41,7 +41,7 @@ export async function multipleSequenceAlignmentUI(
41
41
  methodInput.setTooltip('Alignment method');
42
42
 
43
43
  // UI for Kalign alignment
44
- const terminalGapInput = ui.floatInput('Terminal gap', options?.kalign?.terminalGap ?? msaDefaultOptions.kalign.terminalGap);
44
+ const terminalGapInput = ui.floatInput('Terminal gap', options?.kalign?.terminalGap ?? null);
45
45
  terminalGapInput.setTooltip('Penalty for opening a gap at the beginning or end of the sequence');
46
46
  const kalignVersionDiv = ui.p(`Kalign version: ${kalignVersion}`, 'kalign-version');
47
47
 
@@ -51,6 +51,13 @@ export async function multipleSequenceAlignmentUI(
51
51
  const gapExtendInput = ui.floatInput('Gap extend', options.pepsea.gapExtend);
52
52
  gapExtendInput.setTooltip('Gap extension penalty to skip the alignment');
53
53
 
54
+ const msaParamsDiv = ui.inputs([gapOpenInput, gapExtendInput, terminalGapInput]);
55
+ const msaParamsButton = ui.button('Alignment parameters', () => {
56
+ msaParamsDiv.hidden = !msaParamsDiv.hidden;
57
+ }, 'Adjust alignment parameters such as penalties for opening and extending gaps');
58
+ msaParamsButton.classList.add('msa-params-button');
59
+ msaParamsDiv.hidden = true;
60
+ msaParamsButton.prepend(ui.icons.settings(() => null));
54
61
  const pepseaInputRootStyles: CSSStyleDeclaration[] = [methodInput.root.style];
55
62
  const kalignInputRootStyles: CSSStyleDeclaration[] = [terminalGapInput.root.style, kalignVersionDiv.style];
56
63
 
@@ -84,9 +91,8 @@ export async function multipleSequenceAlignmentUI(
84
91
  .add(colInput)
85
92
  .add(clustersColInput)
86
93
  .add(methodInput)
87
- .add(gapOpenInput)
88
- .add(gapExtendInput)
89
- .add(terminalGapInput)
94
+ .add(msaParamsDiv)
95
+ .add(msaParamsButton)
90
96
  .add(kalignVersionDiv)
91
97
  .onOK(async () => { await onDialogOk(colInput, table, performAlignment, resolve, reject); })
92
98
  .show();
@@ -142,9 +148,9 @@ async function onColInputChange(
142
148
  [NOTATION.FASTA, NOTATION.SEPARATOR], [ALPHABET.DNA, ALPHABET.RNA, ALPHABET.PT], false)
143
149
  ) { // Kalign - natural alphabets. if the notation is separator, convert to fasta and then run kalign
144
150
  switchDialog(pepseaInputRootStyles, kalignInputRootStyles, 'kalign');
145
- gapOpenInput.value ??= msaDefaultOptions.kalign.gapOpen;
146
- gapExtendInput.value ??= msaDefaultOptions.kalign.gapExtend;
147
- terminalGapInput.value ??= msaDefaultOptions.kalign.terminalGap;
151
+ gapOpenInput.value = null;
152
+ gapExtendInput.value = null;
153
+ terminalGapInput.value = null;
148
154
  const potentialColNC = new NotationConverter(col);
149
155
  const performCol: DG.Column<string> = potentialColNC.isFasta() ? col :
150
156
  potentialColNC.convert(NOTATION.FASTA);
@@ -161,8 +167,10 @@ async function onColInputChange(
161
167
  } else if (checkInputColumnUI(col, col.name, [NOTATION.SEPARATOR], [ALPHABET.UN], false)) {
162
168
  //if the column is separator with unknown alphabet, it might be helm. check if it can be converted to helm
163
169
  const potentialColNC = new NotationConverter(col);
164
- if (!await potentialColNC.checkHelmCompatibility())
170
+ if (!await potentialColNC.checkHelmCompatibility()) {
171
+ switchDialog(pepseaInputRootStyles, kalignInputRootStyles, 'pepsea');
165
172
  return;
173
+ }
166
174
  const helmCol = potentialColNC.convert(NOTATION.HELM);
167
175
  switchDialog(pepseaInputRootStyles, kalignInputRootStyles, 'pepsea');
168
176
  gapOpenInput.value ??= msaDefaultOptions.pepsea.gapOpen;
@@ -172,6 +180,9 @@ async function onColInputChange(
172
180
  return async () => await runPepsea(helmCol, unusedName, methodInput.value!,
173
181
  gapOpenInput.value!, gapExtendInput.value!, clustersColInput.value);
174
182
  } else {
183
+ gapOpenInput.value = null;
184
+ gapExtendInput.value = null;
185
+ terminalGapInput.value = null;
175
186
  switchDialog(pepseaInputRootStyles, kalignInputRootStyles, 'kalign');
176
187
  return;
177
188
  }