@datagrok/bio 2.15.2 → 2.15.3
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 +4 -0
- package/dist/package-test.js +3 -3
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/package.json +2 -2
- package/src/package-test.ts +6 -1
- package/src/utils/monomer-cell-renderer.ts +8 -4
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Aleksandr Tanas",
|
|
6
6
|
"email": "atanas@datagrok.ai"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.15.
|
|
8
|
+
"version": "2.15.3",
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@biowasm/aioli": "^3.1.0",
|
|
40
|
-
"@datagrok-libraries/bio": "^5.43.
|
|
40
|
+
"@datagrok-libraries/bio": "^5.43.1",
|
|
41
41
|
"@datagrok-libraries/chem-meta": "^1.2.5",
|
|
42
42
|
"@datagrok-libraries/math": "^1.2.0",
|
|
43
43
|
"@datagrok-libraries/ml": "^6.7.1",
|
package/src/package-test.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as grok from 'datagrok-api/grok';
|
|
|
2
2
|
import * as ui from 'datagrok-api/ui';
|
|
3
3
|
import * as DG from 'datagrok-api/dg';
|
|
4
4
|
|
|
5
|
-
import {runTests, TestContext, tests} from '@datagrok-libraries/utils/src/test';
|
|
5
|
+
import {runTests, TestContext, tests, initAutoTests as initTests } from '@datagrok-libraries/utils/src/test';
|
|
6
6
|
|
|
7
7
|
import './tests/_first-tests';
|
|
8
8
|
import './tests/Palettes-test';
|
|
@@ -52,3 +52,8 @@ export async function test(category: string, test: string, testContext: TestCont
|
|
|
52
52
|
const data = await runTests({category, test, testContext, stressTest});
|
|
53
53
|
return DG.DataFrame.fromObjects(data)!;
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
//name: initAutoTests
|
|
57
|
+
export async function initAutoTests() {
|
|
58
|
+
await initTests(_package, _package.getModule('package-test.js'));
|
|
59
|
+
}
|
|
@@ -4,7 +4,8 @@ import * as ui from 'datagrok-api/ui';
|
|
|
4
4
|
|
|
5
5
|
import {PolymerType} from '@datagrok-libraries/bio/src/helm/types';
|
|
6
6
|
import {ALPHABET, getPaletteByType, monomerToShort} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
7
|
-
import {TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
|
|
7
|
+
import {TAGS as bioTAGS, } from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
|
|
8
|
+
import {MONOMER_RENDERER_TAGS} from '@datagrok-libraries/bio/src/utils/cell-renderer';
|
|
8
9
|
import {MonomerWorks} from '@datagrok-libraries/bio/src/monomer-works/monomer-works';
|
|
9
10
|
|
|
10
11
|
import * as C from './constants';
|
|
@@ -92,7 +93,7 @@ export class MonomerCellRenderer extends DG.GridCellRenderer {
|
|
|
92
93
|
): void {
|
|
93
94
|
if (gridCell.gridRow < 0) return;
|
|
94
95
|
MonomerTooltipHandler.getOrCreate(gridCell.gridColumn);
|
|
95
|
-
|
|
96
|
+
const applyToBackground = gridCell.cell?.column && gridCell.cell.column.getTag(MONOMER_RENDERER_TAGS.applyToBackground) === 'true';
|
|
96
97
|
|
|
97
98
|
g.font = `12px monospace`;
|
|
98
99
|
g.textBaseline = 'middle';
|
|
@@ -103,11 +104,14 @@ export class MonomerCellRenderer extends DG.GridCellRenderer {
|
|
|
103
104
|
if (!s)
|
|
104
105
|
return;
|
|
105
106
|
const color = palette.get(s);
|
|
106
|
-
|
|
107
|
-
g.fillStyle = color;
|
|
108
107
|
//cell width of monomer should dictate how many characters can be displayed
|
|
109
108
|
// for width 40, 6 characters can be displayed (0.15 is 6 / 40)
|
|
110
109
|
const maxChars = Math.max(2, Math.floor(w * 0.15));
|
|
110
|
+
g.fillStyle = color;
|
|
111
|
+
if (applyToBackground) {
|
|
112
|
+
g.fillRect(x, y, w, h);
|
|
113
|
+
g.fillStyle = DG.Color.toHtml(DG.Color.getContrastColor(DG.Color.fromHtml(color)));
|
|
114
|
+
}
|
|
111
115
|
g.fillText(monomerToShort(s, maxChars), x + (w / 2), y + (h / 2), w);
|
|
112
116
|
}
|
|
113
117
|
}
|