@datagrok/bio 2.21.10 → 2.21.12
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/CHANGELOG.md +8 -0
- package/dist/package-test.js +2 -2
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +6 -6
- package/dist/package.js.map +1 -1
- package/package.json +3 -3
- package/src/package.ts +13 -4
- package/src/utils/seq-helper/seq-handler.ts +46 -3
- package/src/widgets/sequence-scrolling-widget.ts +488 -89
- package/test-console-output-1.log +323 -330
- package/test-record-1.mp4 +0 -0
- package/src/package.js +0 -529
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Leonid Stolbov",
|
|
6
6
|
"email": "lstolbov@datagrok.ai"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.21.
|
|
8
|
+
"version": "2.21.12",
|
|
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",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@biowasm/aioli": "^3.1.0",
|
|
47
|
-
"@datagrok-libraries/bio": "^5.53.
|
|
47
|
+
"@datagrok-libraries/bio": "^5.53.3",
|
|
48
48
|
"@datagrok-libraries/chem-meta": "^1.2.7",
|
|
49
49
|
"@datagrok-libraries/math": "^1.2.4",
|
|
50
|
-
"@datagrok-libraries/ml": "^6.10.
|
|
50
|
+
"@datagrok-libraries/ml": "^6.10.2",
|
|
51
51
|
"@datagrok-libraries/tutorials": "^1.6.1",
|
|
52
52
|
"@datagrok-libraries/utils": "^4.5.7",
|
|
53
53
|
"datagrok-api": "^1.25.0",
|
package/src/package.ts
CHANGED
|
@@ -82,7 +82,7 @@ export const _package = new BioPackage(/*{debug: true}/**/);
|
|
|
82
82
|
// let monomerLib: MonomerLib | null = null;
|
|
83
83
|
|
|
84
84
|
//name: getMonomerLibHelper
|
|
85
|
-
//description:
|
|
85
|
+
//description: Returns an instance of the monomer library helper
|
|
86
86
|
//output: object result
|
|
87
87
|
export async function getMonomerLibHelper(): Promise<IMonomerLibHelper> {
|
|
88
88
|
return await MonomerLibManager.getInstance();
|
|
@@ -377,7 +377,6 @@ export function macromoleculeDifferenceCellRenderer(): MacromoleculeDifferenceCe
|
|
|
377
377
|
|
|
378
378
|
//name: sequenceAlignment
|
|
379
379
|
//input: string alignType {choices: ['Local alignment', 'Global alignment']}
|
|
380
|
-
// eslint-disable-next-line max-len
|
|
381
380
|
//input: string alignTable {choices: ['AUTO', 'NUCLEOTIDES', 'BLOSUM45', 'BLOSUM50', 'BLOSUM62','BLOSUM80','BLOSUM90','PAM30','PAM70','PAM250','SCHNEIDER','TRANS']}
|
|
382
381
|
//input: double gap
|
|
383
382
|
//input: string seq1
|
|
@@ -462,6 +461,11 @@ export async function activityCliffs(table: DG.DataFrame, molecules: DG.Column<s
|
|
|
462
461
|
similarity: number, methodName: DimReductionMethods,
|
|
463
462
|
similarityMetric: MmDistanceFunctionsNames | BitArrayMetrics, preprocessingFunction: DG.Func,
|
|
464
463
|
options?: (IUMAPOptions | ITSNEOptions) & Options, demo?: boolean): Promise<DG.Viewer | undefined> {
|
|
464
|
+
//workaround for functions which add viewers to tableView (can be run only on active table view)
|
|
465
|
+
if (table.name !== grok.shell.tv.dataFrame.name) {
|
|
466
|
+
grok.shell.error(`Table ${table.name} is not an current table view`);
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
465
469
|
if (!checkInputColumnUI(molecules, 'Activity Cliffs'))
|
|
466
470
|
return;
|
|
467
471
|
const axesNames = getEmbeddingColsNames(table);
|
|
@@ -588,6 +592,11 @@ export async function sequenceSpaceTopMenu(table: DG.DataFrame, molecules: DG.Co
|
|
|
588
592
|
plotEmbeddings: boolean, preprocessingFunction?: DG.Func, options?: (IUMAPOptions | ITSNEOptions) & Options,
|
|
589
593
|
clusterEmbeddings?: boolean, isDemo?: boolean
|
|
590
594
|
): Promise<DG.ScatterPlotViewer | undefined> {
|
|
595
|
+
//workaround for functions which add viewers to tableView (can be run only on active table view)
|
|
596
|
+
if (table.name !== grok.shell.tv.dataFrame.name) {
|
|
597
|
+
grok.shell.error(`Table ${table.name} is not an current table view`);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
591
600
|
const tableView =
|
|
592
601
|
grok.shell.tv.dataFrame == table ? grok.shell.tv : undefined;
|
|
593
602
|
if (!checkInputColumnUI(molecules, 'Sequence Space'))
|
|
@@ -965,12 +974,12 @@ export async function manageMonomersView() {
|
|
|
965
974
|
await monomerManager.getViewRoot();
|
|
966
975
|
}
|
|
967
976
|
|
|
968
|
-
//name:
|
|
977
|
+
//name: Manage Monomer Libraries
|
|
969
978
|
//tags: app
|
|
970
979
|
//meta.browsePath: Peptides
|
|
971
980
|
//meta.icon: files/icons/monomers.png
|
|
972
981
|
//output: view v
|
|
973
|
-
export async function
|
|
982
|
+
export async function manageMonomerLibrariesView(): Promise<DG.View> {
|
|
974
983
|
return await showManageLibrariesView(false);
|
|
975
984
|
}
|
|
976
985
|
|
|
@@ -20,8 +20,6 @@ import {ConvertFunc, ISeqHandler, JoinerFunc, SeqTemps, SeqValueBase} from '@dat
|
|
|
20
20
|
|
|
21
21
|
import {SeqHelper} from './seq-helper';
|
|
22
22
|
|
|
23
|
-
/* eslint-enable max-len */
|
|
24
|
-
|
|
25
23
|
/** Class for handling notation units in Macromolecule columns and
|
|
26
24
|
* conversion of notation systems in Macromolecule columns
|
|
27
25
|
*/
|
|
@@ -322,6 +320,44 @@ export class SeqHandler implements ISeqHandler {
|
|
|
322
320
|
}
|
|
323
321
|
}
|
|
324
322
|
|
|
323
|
+
/// Faster method to get monomers at certain position.
|
|
324
|
+
/// for canonical sequences in fasta (large proteins/nucleotides)
|
|
325
|
+
/// will be faster than getSplitted(rowIdx).getCanonical(posIdx)
|
|
326
|
+
getMonomerAtPosition(rowIdx: number, posIdx: number, canonical: boolean): string {
|
|
327
|
+
if (this.isCanonicalAlphabet && this.isFasta() && !this.getAlphabetIsMultichar()) {
|
|
328
|
+
const seq = this.column.get(rowIdx) ?? '';
|
|
329
|
+
const res = seq[posIdx];
|
|
330
|
+
return canonical ? (res === GapOriginals[NOTATION.FASTA] ? GAP_SYMBOL : (res ?? GAP_SYMBOL)) : (res ?? '');
|
|
331
|
+
}
|
|
332
|
+
const mSeq: ISeqSplitted = this.getSplitted(rowIdx);
|
|
333
|
+
if (posIdx < 0 || posIdx >= mSeq.length)
|
|
334
|
+
return this.defaultGapOriginal;
|
|
335
|
+
return canonical ? mSeq.getCanonical(posIdx) : mSeq.getOriginal(posIdx);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
getMonomersAtPosition(position: number, canonical: boolean): string[] {
|
|
339
|
+
const length = this.column.length;
|
|
340
|
+
const res: string[] = new Array(length).fill(GAP_SYMBOL);
|
|
341
|
+
if (this.isCanonicalAlphabet && this.isFasta() && !this.getAlphabetIsMultichar()) {
|
|
342
|
+
const colCategories = this.column.categories;
|
|
343
|
+
const colIndexes = this.column.getRawData();
|
|
344
|
+
for (let i = 0; i < length; i++) {
|
|
345
|
+
const seq = colCategories[colIndexes[i]] ?? '';
|
|
346
|
+
if (position < seq.length) {
|
|
347
|
+
const resChar = seq[position];
|
|
348
|
+
res[i] = canonical ? (resChar === GapOriginals[NOTATION.FASTA] ? GAP_SYMBOL : (resChar ?? GAP_SYMBOL)) : (resChar ?? '');
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
} else {
|
|
352
|
+
for (let i = 0; i < length; i++) {
|
|
353
|
+
const mSeq: ISeqSplitted = this.getSplitted(i);
|
|
354
|
+
if (position >= 0 && position < mSeq.length)
|
|
355
|
+
res[i] = canonical ? mSeq.getCanonical(position) : mSeq.getOriginal(position);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return res;
|
|
359
|
+
}
|
|
360
|
+
|
|
325
361
|
/** Any Macromolecule can be represented on Helm format. The reverse is not always possible. */
|
|
326
362
|
public getValue(rowIdx: number, options?: any): SeqValueBase {
|
|
327
363
|
const seq: string = this.column.get(rowIdx);
|
|
@@ -344,6 +380,11 @@ export class SeqHandler implements ISeqHandler {
|
|
|
344
380
|
|
|
345
381
|
private _stats: SeqColStats | null = null;
|
|
346
382
|
|
|
383
|
+
public get isCanonicalAlphabet(): boolean {
|
|
384
|
+
const alphabet = this.alphabet;
|
|
385
|
+
return alphabet === ALPHABET.DNA || alphabet === ALPHABET.RNA || alphabet === ALPHABET.PT;
|
|
386
|
+
}
|
|
387
|
+
|
|
347
388
|
public get stats(): SeqColStats {
|
|
348
389
|
if (this._stats === null) {
|
|
349
390
|
const freq: { [m: string]: number } = {};
|
|
@@ -374,7 +415,7 @@ export class SeqHandler implements ISeqHandler {
|
|
|
374
415
|
public get maxLength(): number {
|
|
375
416
|
if (this._maxLength === null) {
|
|
376
417
|
this._maxLength = this.column.length === 0 ? 0 :
|
|
377
|
-
|
|
418
|
+
wu.count(0).take(this.column.length).map((rowIdx) => this.getSplitted(rowIdx).length).reduce((a, b) => a > b ? a : b, 0);
|
|
378
419
|
}
|
|
379
420
|
return this._maxLength!;
|
|
380
421
|
}
|
|
@@ -393,6 +434,8 @@ export class SeqHandler implements ISeqHandler {
|
|
|
393
434
|
|
|
394
435
|
public isSeparator(): boolean { return this.notation === NOTATION.SEPARATOR || !!this.separator; }
|
|
395
436
|
|
|
437
|
+
public isFastaOrSeparator(): boolean { return this.isFasta() || this.isSeparator(); }
|
|
438
|
+
|
|
396
439
|
public isHelm(): boolean { return this.notation === NOTATION.HELM; }
|
|
397
440
|
|
|
398
441
|
public isCustom(): boolean { return this.notation === NOTATION.CUSTOM; }
|