@datagrok/bio 2.4.11 → 2.4.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/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Leonid Stolbov",
|
|
6
6
|
"email": "lstolbov@datagrok.ai"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.4.
|
|
8
|
+
"version": "2.4.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",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@biowasm/aioli": "^3.1.0",
|
|
17
|
-
"@datagrok-libraries/bio": "^5.28.
|
|
17
|
+
"@datagrok-libraries/bio": "^5.28.4",
|
|
18
18
|
"@datagrok-libraries/chem-meta": "^1.0.1",
|
|
19
19
|
"@datagrok-libraries/ml": "^6.3.16",
|
|
20
20
|
"@datagrok-libraries/utils": "^2.1.3",
|
package/src/package-test.ts
CHANGED
|
@@ -21,6 +21,7 @@ import './tests/similarity-diversity-tests';
|
|
|
21
21
|
import './tests/substructure-filters-tests';
|
|
22
22
|
import './tests/pepsea-tests';
|
|
23
23
|
import './tests/viewers';
|
|
24
|
+
import './tests/units-handler-tests';
|
|
24
25
|
|
|
25
26
|
// Tests hanging github CI
|
|
26
27
|
import './tests/activity-cliffs-tests';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as grok from 'datagrok-api/grok';
|
|
2
|
+
import * as ui from 'datagrok-api/ui';
|
|
3
|
+
import * as DG from 'datagrok-api/dg';
|
|
4
|
+
|
|
5
|
+
import {after, before, category, test, expect, expectObject} from '@datagrok-libraries/utils/src/test';
|
|
6
|
+
import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
|
|
7
|
+
import {ALPHABET, NOTATION, TAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
8
|
+
|
|
9
|
+
const seqDna = `seq
|
|
10
|
+
ACGTC
|
|
11
|
+
CAGTGT
|
|
12
|
+
TTCAAC
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const seqDnaMsa = `seq
|
|
16
|
+
AC-GT-CT
|
|
17
|
+
CAC-T-GT
|
|
18
|
+
ACCGTACT
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
const seqUn = `seq
|
|
22
|
+
abc-dfgg-abc1-cfr3-rty-wert
|
|
23
|
+
rut12-her2-rty-wert-abc-abc1-dfgg
|
|
24
|
+
rut12-rty-her2-abc-cfr3-wert-rut12
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const seqHelm = `seq
|
|
28
|
+
PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$$
|
|
29
|
+
PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$
|
|
30
|
+
PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$
|
|
31
|
+
PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
category('UnitsHandler', () =>{
|
|
35
|
+
test('Seq-Fasta', async () =>{
|
|
36
|
+
const [df, uh] = await loadCsvWithDetection(seqDna);
|
|
37
|
+
expect(uh.notation, NOTATION.FASTA);
|
|
38
|
+
expect(uh.isMsa(), false);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('Seq-Fasta-MSA', async () =>{
|
|
42
|
+
const [df, uh] = await loadCsvWithDetection(seqDnaMsa);
|
|
43
|
+
expect(uh.notation, NOTATION.FASTA);
|
|
44
|
+
expect(uh.isMsa(), true);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('Seq-Fasta-units', async () =>{
|
|
48
|
+
const [df, uh] = await loadCsvWithTag(seqDna, DG.TAGS.UNITS, NOTATION.FASTA);
|
|
49
|
+
expect(uh.notation, NOTATION.FASTA);
|
|
50
|
+
expect(uh.isMsa(), false);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('Seq-Fasta-MSA-units', async () =>{
|
|
54
|
+
const [df, uh] = await loadCsvWithTag(seqDnaMsa, DG.TAGS.UNITS, NOTATION.FASTA);
|
|
55
|
+
expect(uh.notation, NOTATION.FASTA);
|
|
56
|
+
expect(uh.isMsa(), true);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('Seq-Helm', async () =>{
|
|
60
|
+
const [df, uh] = await loadCsvWithTag(seqHelm, DG.TAGS.UNITS, NOTATION.HELM);
|
|
61
|
+
expect(uh.notation, NOTATION.HELM);
|
|
62
|
+
expect(uh.isHelm(), true);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('Seq-UN', async () =>{
|
|
66
|
+
const [df, uh] = await loadCsvWithTag(seqUn, DG.TAGS.UNITS, NOTATION.SEPARATOR);
|
|
67
|
+
expect(uh.notation, NOTATION.SEPARATOR);
|
|
68
|
+
expect(uh.separator, '-');
|
|
69
|
+
expect(uh.alphabet, ALPHABET.UN);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('Seq-UN-auto', async () =>{
|
|
73
|
+
const [df, uh] = await loadCsvWithDetection(seqUn);
|
|
74
|
+
expect(uh.notation, NOTATION.SEPARATOR);
|
|
75
|
+
expect(uh.separator, '-');
|
|
76
|
+
expect(uh.alphabet, ALPHABET.UN);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
async function loadCsvWithDetection(csv: string): Promise<[df: DG.DataFrame, uh: UnitsHandler]> {
|
|
80
|
+
const df = DG.DataFrame.fromCsv(csv);
|
|
81
|
+
await grok.data.detectSemanticTypes(df);
|
|
82
|
+
const uh = new UnitsHandler(df.getCol('seq'));
|
|
83
|
+
return [df, uh];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function loadCsvWithTag(csv: string, tag: string, value: string):
|
|
87
|
+
Promise<[df: DG.DataFrame, uh: UnitsHandler]> {
|
|
88
|
+
const df = DG.DataFrame.fromCsv(csv);
|
|
89
|
+
const col = df.getCol('seq');
|
|
90
|
+
col.setTag(tag, value);
|
|
91
|
+
col.semType = DG.SEMTYPE.MACROMOLECULE;
|
|
92
|
+
if (value === NOTATION.SEPARATOR)
|
|
93
|
+
col.setTag(TAGS.separator, '-');
|
|
94
|
+
const uh = new UnitsHandler(df.getCol('seq'));
|
|
95
|
+
return [df, uh];
|
|
96
|
+
}
|
|
97
|
+
});
|