@datagrok/sequence-translator 1.10.9 → 1.10.11
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/dist/455.js +1 -1
- package/dist/455.js.map +1 -1
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +3 -2
- package/src/polytool/pt-enumerate-seq-dialog.ts +53 -3
- package/test-console-output-1.log +207 -98
- package/test-record-1.mp4 +0 -0
- package/webpack.config.js +1 -22
- package/src/polytool/pt-monomer-selection-dialog.ts +0 -352
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/sequence-translator",
|
|
3
3
|
"friendlyName": "Sequence Translator",
|
|
4
|
-
"version": "1.10.
|
|
4
|
+
"version": "1.10.11",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Davit Rizhinashvili",
|
|
7
7
|
"email": "drizhinashvili@datagrok.ai"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@datagrok-libraries/bio": "^5.62.
|
|
25
|
+
"@datagrok-libraries/bio": "^5.62.1",
|
|
26
26
|
"@datagrok-libraries/chem-meta": "^1.2.8",
|
|
27
27
|
"@datagrok-libraries/tutorials": "^1.6.1",
|
|
28
28
|
"@datagrok-libraries/utils": "^4.6.5",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
56
56
|
"@typescript-eslint/parser": "^7.2.0",
|
|
57
57
|
"css-loader": "^6.7.3",
|
|
58
|
+
"datagrok-tools": "^5.0.0",
|
|
58
59
|
"eslint": "^8.57.0",
|
|
59
60
|
"eslint-config-google": "^0.14.0",
|
|
60
61
|
"style-loader": "^3.3.1",
|
|
@@ -24,7 +24,7 @@ import {SeqTemps} from '@datagrok-libraries/bio/src/utils/macromolecule/seq-hand
|
|
|
24
24
|
import {PolyToolEnumeratorParams, PolyToolEnumeratorType, PolyToolEnumeratorTypes} from './types';
|
|
25
25
|
import {doPolyToolEnumerateHelm, PT_HELM_EXAMPLE} from './pt-enumeration-helm';
|
|
26
26
|
import {PolyToolPlaceholdersInput} from './pt-placeholders-input';
|
|
27
|
-
import {showMonomerSelectionDialog} from '
|
|
27
|
+
import {showMonomerSelectionDialog} from '@datagrok-libraries/bio/src/utils/monomer-selection-dialog';
|
|
28
28
|
import {defaultErrorHandler} from '../utils/err-info';
|
|
29
29
|
import {PolyToolPlaceholdersBreadthInput} from './pt-placeholders-breadth-input';
|
|
30
30
|
import {PT_ENUM_TYPE_TOOLTIPS, PT_UI_DIALOG_ENUMERATION, PT_UI_GET_HELM, PT_UI_HIGHLIGHT_MONOMERS, PT_UI_RULES_USED, PT_UI_USE_CHIRALITY} from './const';
|
|
@@ -218,6 +218,9 @@ async function getPolyToolEnumerateDialog(
|
|
|
218
218
|
let ruleInputs: RuleInputs;
|
|
219
219
|
const trivialNameSampleDiv = ui.divText('', {style: {marginLeft: '8px', marginTop: '2px'}});
|
|
220
220
|
const warningsTextDiv = ui.divText('', {style: {color: 'red'}});
|
|
221
|
+
const resultCountDiv = ui.divText('', {style: {
|
|
222
|
+
fontSize: '11px', color: 'var(--grey-4)', marginTop: '2px', marginLeft: '4px', whiteSpace: 'nowrap',
|
|
223
|
+
}});
|
|
221
224
|
|
|
222
225
|
// === INPUT DEFINITIONS ===
|
|
223
226
|
inputs = {
|
|
@@ -511,7 +514,9 @@ async function getPolyToolEnumerateDialog(
|
|
|
511
514
|
defaultErrorHandler(err);
|
|
512
515
|
}
|
|
513
516
|
}));
|
|
514
|
-
subs.push(inputs.placeholders.onChanged.subscribe(() => { updateViewMol(); }));
|
|
517
|
+
subs.push(inputs.placeholders.onChanged.subscribe(() => { updateViewMol(); updateResultCount(); }));
|
|
518
|
+
subs.push(inputs.placeholdersBreadth.onChanged.subscribe(() => { updateResultCount(); }));
|
|
519
|
+
subs.push(inputs.keepOriginal.onChanged.subscribe(() => { updateResultCount(); }));
|
|
515
520
|
|
|
516
521
|
// TODO: suspect
|
|
517
522
|
subs.push(ui.onSizeChanged(inputs.placeholders.root).subscribe(() => {
|
|
@@ -587,6 +592,48 @@ async function getPolyToolEnumerateDialog(
|
|
|
587
592
|
//resizeInputs();
|
|
588
593
|
};
|
|
589
594
|
|
|
595
|
+
// Computes expected result count from current placeholders, breadth, and enumeration type
|
|
596
|
+
const updateResultCount = () => {
|
|
597
|
+
try {
|
|
598
|
+
const phs = inputs.placeholders.placeholdersValue.filter((ph) => ph.monomers.length > 0);
|
|
599
|
+
const bphs = inputs.placeholdersBreadth.placeholdersBreadthValue
|
|
600
|
+
.filter((ph) => ph.monomers.length > 0 && ph.start != null && ph.end != null);
|
|
601
|
+
|
|
602
|
+
let regularCount = 0;
|
|
603
|
+
switch (inputs.enumeratorType.value) {
|
|
604
|
+
case PolyToolEnumeratorTypes.Single:
|
|
605
|
+
regularCount = phs.reduce((sum, ph) => sum + ph.monomers.length, 0);
|
|
606
|
+
break;
|
|
607
|
+
case PolyToolEnumeratorTypes.Parallel: {
|
|
608
|
+
if (phs.length > 0) {
|
|
609
|
+
const allEqual = phs.every((ph) => ph.monomers.length === phs[0].monomers.length);
|
|
610
|
+
regularCount = allEqual ? phs[0].monomers.length : 0;
|
|
611
|
+
}
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
case PolyToolEnumeratorTypes.Matrix:
|
|
615
|
+
regularCount = phs.length > 0 ? phs.reduce((prod, ph) => prod * ph.monomers.length, 1) : 0;
|
|
616
|
+
break;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
let breadthCount = 0;
|
|
620
|
+
if (bphs.length > 0) {
|
|
621
|
+
breadthCount = bphs.reduce((prod, ph) => {
|
|
622
|
+
const rangeSize = Math.abs(ph.end - ph.start) + 1;
|
|
623
|
+
return prod * (ph.monomers.length * rangeSize);
|
|
624
|
+
}, 1);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
let total = regularCount + breadthCount;
|
|
628
|
+
if (inputs.keepOriginal.value && total > 0)
|
|
629
|
+
total += 1;
|
|
630
|
+
|
|
631
|
+
resultCountDiv.textContent = total > 0 ? `${total} sequence${total !== 1 ? 's' : ''} will be generated` : '';
|
|
632
|
+
} catch (_) {
|
|
633
|
+
resultCountDiv.textContent = '';
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
|
|
590
637
|
const fillTrivialNameList = (table?: DG.DataFrame) => {
|
|
591
638
|
if (table) {
|
|
592
639
|
inputs.trivialNameCol.setColumnInputTable(table);
|
|
@@ -607,6 +654,7 @@ async function getPolyToolEnumerateDialog(
|
|
|
607
654
|
|
|
608
655
|
fillForCurrentCell(seqValue, dataRole, cell);
|
|
609
656
|
updateViewRules();
|
|
657
|
+
updateResultCount();
|
|
610
658
|
|
|
611
659
|
// === EXECUTION (OK button handler) ===
|
|
612
660
|
// Pre-flight validates inputs, builds params, and runs enumeration.
|
|
@@ -677,7 +725,8 @@ async function getPolyToolEnumerateDialog(
|
|
|
677
725
|
.add(ui.divH([
|
|
678
726
|
ui.divV([
|
|
679
727
|
inputs.placeholders.root,
|
|
680
|
-
inputs.enumeratorType.root],
|
|
728
|
+
ui.divH([inputs.enumeratorType.root, resultCountDiv],
|
|
729
|
+
{style: {alignItems: 'center'}})],
|
|
681
730
|
{style: {width: '50%'}}
|
|
682
731
|
),
|
|
683
732
|
ui.divV([
|
|
@@ -742,6 +791,7 @@ async function getPolyToolEnumerateDialog(
|
|
|
742
791
|
setTimeout(() => {
|
|
743
792
|
inputs.placeholders.invalidateGrid();
|
|
744
793
|
inputs.placeholdersBreadth.invalidateGrid();
|
|
794
|
+
updateResultCount();
|
|
745
795
|
}, 100);
|
|
746
796
|
});
|
|
747
797
|
return dialog;
|