@rtemis/draw 0.0.0-stage → 0.1.1
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/LICENSE.txt +30 -0
- package/README.md +50 -2
- package/dist/charts/a3/config.d.ts +97 -0
- package/dist/charts/a3/config.d.ts.map +1 -0
- package/dist/charts/a3/config.js +116 -0
- package/dist/charts/a3/config.js.map +1 -0
- package/dist/charts/a3/echarts.d.ts +6 -0
- package/dist/charts/a3/echarts.d.ts.map +1 -0
- package/dist/charts/a3/echarts.js +556 -0
- package/dist/charts/a3/echarts.js.map +1 -0
- package/dist/charts/a3/index.d.ts +4 -0
- package/dist/charts/a3/index.d.ts.map +1 -0
- package/dist/charts/a3/index.js +2 -0
- package/dist/charts/a3/index.js.map +1 -0
- package/dist/charts/a3/layout.d.ts +33 -0
- package/dist/charts/a3/layout.d.ts.map +1 -0
- package/dist/charts/a3/layout.js +192 -0
- package/dist/charts/a3/layout.js.map +1 -0
- package/dist/charts/a3/palette.d.ts +24 -0
- package/dist/charts/a3/palette.d.ts.map +1 -0
- package/dist/charts/a3/palette.js +129 -0
- package/dist/charts/a3/palette.js.map +1 -0
- package/dist/charts/a3/types.d.ts +164 -0
- package/dist/charts/a3/types.d.ts.map +1 -0
- package/dist/charts/a3/types.js +2 -0
- package/dist/charts/a3/types.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/rtemis-draw-builders.cjs +939 -0
- package/package.json +45 -4
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
const AMINO_ACID_NAMES = Object.freeze({
|
|
2
|
+
A: "Alanine",
|
|
3
|
+
R: "Arginine",
|
|
4
|
+
N: "Asparagine",
|
|
5
|
+
D: "Aspartate",
|
|
6
|
+
C: "Cysteine",
|
|
7
|
+
Q: "Glutamine",
|
|
8
|
+
E: "Glutamate",
|
|
9
|
+
G: "Glycine",
|
|
10
|
+
H: "Histidine",
|
|
11
|
+
I: "Isoleucine",
|
|
12
|
+
L: "Leucine",
|
|
13
|
+
K: "Lysine",
|
|
14
|
+
M: "Methionine",
|
|
15
|
+
F: "Phenylalanine",
|
|
16
|
+
P: "Proline",
|
|
17
|
+
S: "Serine",
|
|
18
|
+
T: "Threonine",
|
|
19
|
+
W: "Tryptophan",
|
|
20
|
+
Y: "Tyrosine",
|
|
21
|
+
V: "Valine",
|
|
22
|
+
B: "Aspartic acid or Asparagine",
|
|
23
|
+
Z: "Glutamine or Glutamic acid",
|
|
24
|
+
X: "(Any)",
|
|
25
|
+
"*": "Termination codon",
|
|
26
|
+
});
|
|
27
|
+
const DEFAULT_MARKER_SIZE = 28;
|
|
28
|
+
const DEFAULT_FONT_SIZE = 18;
|
|
29
|
+
const DEFAULT_MARGIN_TOP = 24;
|
|
30
|
+
const DEFAULT_MARGIN_TOP_WITH_TITLE = 64;
|
|
31
|
+
const DEFAULT_MARGIN_BOTTOM = 24;
|
|
32
|
+
const DEFAULT_TITLE_TOP = 32;
|
|
33
|
+
const DEFAULT_TITLE_BOTTOM_GAP = 14;
|
|
34
|
+
const DEFAULT_N_PER_ROW = 21;
|
|
35
|
+
const DEFAULT_RESIDUE_SPACING = 0.3;
|
|
36
|
+
/**
|
|
37
|
+
* Creates shared residue geometry that can be rendered by visualization backends.
|
|
38
|
+
* Accepts validated A3Data (plain object from a3.toData()).
|
|
39
|
+
*/
|
|
40
|
+
export function createA3LayoutModel(input, options = {}) {
|
|
41
|
+
const data = input;
|
|
42
|
+
const sequenceLength = data.sequence.length;
|
|
43
|
+
const nPerRow = normalizeNPerRow(options.nPerRow, sequenceLength);
|
|
44
|
+
const residueSpacing = normalizeResidueSpacing(options.residueSpacing);
|
|
45
|
+
const coordinates = createSequenceCoordinates(sequenceLength, nPerRow);
|
|
46
|
+
// Build residue points from the sequence string (replaces old A3.residues getter)
|
|
47
|
+
const residues = Array.from(data.sequence).map((residue, index) => Object.freeze({
|
|
48
|
+
position: index + 1,
|
|
49
|
+
residue,
|
|
50
|
+
residueName: AMINO_ACID_NAMES[residue] ?? residue,
|
|
51
|
+
x: scaleResidueXCoordinate(coordinates.xs[index] ?? 0, residueSpacing),
|
|
52
|
+
y: coordinates.ys[index] ?? 0,
|
|
53
|
+
}));
|
|
54
|
+
return Object.freeze({
|
|
55
|
+
data,
|
|
56
|
+
nPerRow,
|
|
57
|
+
residues: Object.freeze(residues),
|
|
58
|
+
bounds: computeBounds(residues),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Resolves the final chart height in pixels for a visualization. When the
|
|
63
|
+
* caller does not provide `options.height`, the value is derived from the
|
|
64
|
+
* layout bounds and marker size so row spacing stays visually balanced.
|
|
65
|
+
*/
|
|
66
|
+
export function resolveA3VisualizationHeight(input, options = {}) {
|
|
67
|
+
const model = createA3LayoutModel(input, options);
|
|
68
|
+
return resolveA3VisualizationHeightFromModel(model, options);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolves the vertical title inset in pixels.
|
|
72
|
+
*/
|
|
73
|
+
export function resolveA3TitleTop(options = {}) {
|
|
74
|
+
return options.titleTop ?? DEFAULT_TITLE_TOP;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolves the vertical space reserved for the title block.
|
|
78
|
+
*/
|
|
79
|
+
export function resolveA3TitleMarginTop(options = {}) {
|
|
80
|
+
if (options.title === undefined) {
|
|
81
|
+
return DEFAULT_MARGIN_TOP;
|
|
82
|
+
}
|
|
83
|
+
const fontSize = options.fontSize ?? DEFAULT_FONT_SIZE;
|
|
84
|
+
return Math.max(DEFAULT_MARGIN_TOP_WITH_TITLE, resolveA3TitleTop(options) + fontSize + DEFAULT_TITLE_BOTTOM_GAP);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns residue positions for the canonical wrapped sequence layout.
|
|
88
|
+
*/
|
|
89
|
+
export function createSequenceCoordinates(length, nPerRow) {
|
|
90
|
+
if (!Number.isInteger(length) || length <= 0) {
|
|
91
|
+
throw new RangeError("A3 layout length must be a positive integer.");
|
|
92
|
+
}
|
|
93
|
+
const xs = [];
|
|
94
|
+
const ys = [];
|
|
95
|
+
// The layout mirrors the R implementation, including the
|
|
96
|
+
// half-step edge adjustments that create the hex-like path around wraps.
|
|
97
|
+
const xPattern = [...range(1, nPerRow), ...range(nPerRow - 1, 2)];
|
|
98
|
+
const yPattern = [1];
|
|
99
|
+
// After the first residue, each additional wrapped band contributes
|
|
100
|
+
// `nPerRow - 1` coordinates before the path steps to the next y level.
|
|
101
|
+
// Using `length / nPerRow` undercounts long narrow layouts and causes the
|
|
102
|
+
// tail of the sequence to fall back to the default top-row coordinate.
|
|
103
|
+
const nRows = Math.ceil((length - 1) / (nPerRow - 1));
|
|
104
|
+
const repeated = repeatEach(stepSequence(1, nRows, 1), nPerRow - 1, Math.max(0, length - 1));
|
|
105
|
+
yPattern.push(...repeated);
|
|
106
|
+
for (let index = 0; index < length; index += 1) {
|
|
107
|
+
xs.push(xPattern[index % xPattern.length] ?? 1);
|
|
108
|
+
ys.push(yPattern[index] ?? 1);
|
|
109
|
+
}
|
|
110
|
+
const period = 2 * nPerRow - 2;
|
|
111
|
+
const borderOffset = 1 - Math.sqrt(3) / 2;
|
|
112
|
+
for (let index = nPerRow - 1; index < length; index += period) {
|
|
113
|
+
ys[index] = (ys[index] ?? 0) + 0.5;
|
|
114
|
+
xs[index] = (xs[index] ?? 0) - borderOffset;
|
|
115
|
+
}
|
|
116
|
+
for (let index = 2 * nPerRow - 2; index < length; index += period) {
|
|
117
|
+
ys[index] = (ys[index] ?? 0) + 0.5;
|
|
118
|
+
xs[index] = (xs[index] ?? 0) + borderOffset;
|
|
119
|
+
}
|
|
120
|
+
return Object.freeze({ xs: Object.freeze(xs), ys: Object.freeze(ys) });
|
|
121
|
+
}
|
|
122
|
+
function normalizeNPerRow(value, _length) {
|
|
123
|
+
const resolved = value ?? DEFAULT_N_PER_ROW;
|
|
124
|
+
if (!Number.isInteger(resolved) || resolved <= 1) {
|
|
125
|
+
throw new RangeError("A3 visualization nPerRow must be an integer > 1.");
|
|
126
|
+
}
|
|
127
|
+
return resolved;
|
|
128
|
+
}
|
|
129
|
+
function normalizeResidueSpacing(value) {
|
|
130
|
+
const resolved = value ?? DEFAULT_RESIDUE_SPACING;
|
|
131
|
+
if (!Number.isFinite(resolved) || resolved <= 0) {
|
|
132
|
+
throw new RangeError("A3 visualization residueSpacing must be > 0.");
|
|
133
|
+
}
|
|
134
|
+
return resolved;
|
|
135
|
+
}
|
|
136
|
+
function scaleResidueXCoordinate(x, residueSpacing) {
|
|
137
|
+
if (residueSpacing === 1) {
|
|
138
|
+
return x;
|
|
139
|
+
}
|
|
140
|
+
return 1 + (x - 1) * residueSpacing;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Resolves chart height from an existing layout model. This is mainly useful
|
|
144
|
+
* for renderers that already built the model and want to avoid recomputing it.
|
|
145
|
+
*/
|
|
146
|
+
export function resolveA3VisualizationHeightFromModel(model, options = {}) {
|
|
147
|
+
if (options.height !== undefined) {
|
|
148
|
+
return options.height;
|
|
149
|
+
}
|
|
150
|
+
const markerSize = options.markerSize ?? DEFAULT_MARKER_SIZE;
|
|
151
|
+
const topMargin = resolveA3TitleMarginTop(options);
|
|
152
|
+
const bottomMargin = DEFAULT_MARGIN_BOTTOM;
|
|
153
|
+
const verticalSpan = model.bounds.maxY - model.bounds.minY;
|
|
154
|
+
// Multiplier of 2 gives enough vertical room between rows so that position
|
|
155
|
+
// labels (every 10th residue, placed above the marker) don't overlap with
|
|
156
|
+
// the residue markers of the row above.
|
|
157
|
+
const bodyHeight = markerSize * (2 * verticalSpan + 1);
|
|
158
|
+
return Math.ceil(topMargin + bottomMargin + bodyHeight);
|
|
159
|
+
}
|
|
160
|
+
function computeBounds(residues) {
|
|
161
|
+
const xs = residues.map((residue) => residue.x);
|
|
162
|
+
const ys = residues.map((residue) => residue.y);
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
minX: Math.min(...xs),
|
|
165
|
+
maxX: Math.max(...xs),
|
|
166
|
+
minY: Math.min(...ys),
|
|
167
|
+
maxY: Math.max(...ys),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function range(start, end) {
|
|
171
|
+
if (start <= end) {
|
|
172
|
+
return Array.from({ length: end - start + 1 }, (_, index) => start + index);
|
|
173
|
+
}
|
|
174
|
+
return Array.from({ length: start - end + 1 }, (_, index) => start - index);
|
|
175
|
+
}
|
|
176
|
+
function stepSequence(start, end, step) {
|
|
177
|
+
const values = [];
|
|
178
|
+
for (let value = start; value <= end; value += step) {
|
|
179
|
+
values.push(value);
|
|
180
|
+
}
|
|
181
|
+
return values;
|
|
182
|
+
}
|
|
183
|
+
function repeatEach(values, repeatCount, outputLength) {
|
|
184
|
+
const output = [];
|
|
185
|
+
for (const value of values) {
|
|
186
|
+
for (let index = 0; index < repeatCount && output.length < outputLength; index += 1) {
|
|
187
|
+
output.push(value);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return output;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/charts/a3/layout.ts"],"names":[],"mappings":"AASA,MAAM,gBAAgB,GAAqC,MAAM,CAAC,MAAM,CAAC;IACvE,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,eAAe;IAClB,CAAC,EAAE,SAAS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AAC;QAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,WAAW,IAAI,MAAM,CAAC,MAAM,GAAG,YAAY,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YACpF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { A3VisualizationTheme } from "./types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Default (light) theme shared by visualization renderers.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_A3_VISUALIZATION_THEME: A3VisualizationTheme;
|
|
6
|
+
/**
|
|
7
|
+
* Dark theme for A3 visualizations. Uses transparent backgrounds so the
|
|
8
|
+
* app's own dark background shows through, with light text and adjusted
|
|
9
|
+
* marker colors for dark-mode contrast.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DARK_A3_VISUALIZATION_THEME: A3VisualizationTheme;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves a full theme by layering user overrides onto the package defaults.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveA3VisualizationTheme(overrides?: Partial<A3VisualizationTheme>): A3VisualizationTheme;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a recycled palette color for a zero-based index.
|
|
18
|
+
*/
|
|
19
|
+
export declare function paletteColorAt(palette: readonly string[], index: number): string;
|
|
20
|
+
/**
|
|
21
|
+
* Converts a hex color into an rgba string with the requested alpha value.
|
|
22
|
+
*/
|
|
23
|
+
export declare function withAlpha(color: string, alpha: number): string;
|
|
24
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../../src/charts/a3/palette.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAyCvD;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,oBAkB3C,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,oBAkBxC,CAAC;AAEH;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAC5C,oBAAoB,CAetB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhF;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAwB9D"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
const DEFAULT_REGION_PALETTE = Object.freeze([
|
|
2
|
+
"#0F766E",
|
|
3
|
+
"#2563EB",
|
|
4
|
+
"#D97706",
|
|
5
|
+
"#7C3AED",
|
|
6
|
+
"#DC2626",
|
|
7
|
+
"#0891B2",
|
|
8
|
+
]);
|
|
9
|
+
const DEFAULT_SITE_PALETTE = Object.freeze([
|
|
10
|
+
"#0EA5E9",
|
|
11
|
+
"#14B8A6",
|
|
12
|
+
"#E11D48",
|
|
13
|
+
"#A855F7",
|
|
14
|
+
"#F97316",
|
|
15
|
+
"#16A34A",
|
|
16
|
+
]);
|
|
17
|
+
const DEFAULT_PTM_PALETTE = Object.freeze([
|
|
18
|
+
"#0284C7",
|
|
19
|
+
"#F59E0B",
|
|
20
|
+
"#10B981",
|
|
21
|
+
"#8B5CF6",
|
|
22
|
+
"#EF4444",
|
|
23
|
+
"#14B8A6",
|
|
24
|
+
]);
|
|
25
|
+
const DEFAULT_PROCESSING_PALETTE = Object.freeze([
|
|
26
|
+
"#D97706",
|
|
27
|
+
"#DC2626",
|
|
28
|
+
"#0EA5E9",
|
|
29
|
+
"#9333EA",
|
|
30
|
+
"#16A34A",
|
|
31
|
+
"#DB2777",
|
|
32
|
+
]);
|
|
33
|
+
const DEFAULT_GEIST_FONT_STACK = "Geist, 'Geist Sans', 'Inter', 'Avenir Next', 'Segoe UI', sans-serif";
|
|
34
|
+
/**
|
|
35
|
+
* Default (light) theme shared by visualization renderers.
|
|
36
|
+
*/
|
|
37
|
+
export const DEFAULT_A3_VISUALIZATION_THEME = Object.freeze({
|
|
38
|
+
fontFamily: DEFAULT_GEIST_FONT_STACK,
|
|
39
|
+
annotationFontFamily: DEFAULT_GEIST_FONT_STACK,
|
|
40
|
+
legendFontFamily: DEFAULT_GEIST_FONT_STACK,
|
|
41
|
+
backgroundColor: "transparent",
|
|
42
|
+
plotBackgroundColor: "transparent",
|
|
43
|
+
residueFillColor: "#E7E5E4",
|
|
44
|
+
residueStrokeColor: "#44403C",
|
|
45
|
+
labelColor: "#1C1917",
|
|
46
|
+
positionLabelColor: "#78716C",
|
|
47
|
+
legendColor: "#1C1917",
|
|
48
|
+
gridColor: "#E7E5E4",
|
|
49
|
+
variantColor: "#FA6E1E",
|
|
50
|
+
diseaseVariantColor: "#E266AE",
|
|
51
|
+
regionPalette: DEFAULT_REGION_PALETTE,
|
|
52
|
+
sitePalette: DEFAULT_SITE_PALETTE,
|
|
53
|
+
ptmPalette: DEFAULT_PTM_PALETTE,
|
|
54
|
+
processingPalette: DEFAULT_PROCESSING_PALETTE,
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Dark theme for A3 visualizations. Uses transparent backgrounds so the
|
|
58
|
+
* app's own dark background shows through, with light text and adjusted
|
|
59
|
+
* marker colors for dark-mode contrast.
|
|
60
|
+
*/
|
|
61
|
+
export const DARK_A3_VISUALIZATION_THEME = Object.freeze({
|
|
62
|
+
fontFamily: DEFAULT_GEIST_FONT_STACK,
|
|
63
|
+
annotationFontFamily: DEFAULT_GEIST_FONT_STACK,
|
|
64
|
+
legendFontFamily: DEFAULT_GEIST_FONT_STACK,
|
|
65
|
+
backgroundColor: "transparent",
|
|
66
|
+
plotBackgroundColor: "transparent",
|
|
67
|
+
residueFillColor: "#3f3f46", // zinc-700
|
|
68
|
+
residueStrokeColor: "#a1a1aa", // zinc-400
|
|
69
|
+
labelColor: "#fafafa", // zinc-50
|
|
70
|
+
positionLabelColor: "#a1a1aa", // zinc-400
|
|
71
|
+
legendColor: "#e4e4e7", // zinc-200
|
|
72
|
+
gridColor: "#3f3f46", // zinc-700
|
|
73
|
+
variantColor: "#fb923c", // orange-400 (brighter for dark bg)
|
|
74
|
+
diseaseVariantColor: "#f472b6", // pink-400 (brighter for dark bg)
|
|
75
|
+
regionPalette: DEFAULT_REGION_PALETTE,
|
|
76
|
+
sitePalette: DEFAULT_SITE_PALETTE,
|
|
77
|
+
ptmPalette: DEFAULT_PTM_PALETTE,
|
|
78
|
+
processingPalette: DEFAULT_PROCESSING_PALETTE,
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* Resolves a full theme by layering user overrides onto the package defaults.
|
|
82
|
+
*/
|
|
83
|
+
export function resolveA3VisualizationTheme(overrides = {}) {
|
|
84
|
+
const fallbackFontFamily = overrides.fontFamily ?? DEFAULT_A3_VISUALIZATION_THEME.annotationFontFamily;
|
|
85
|
+
return Object.freeze({
|
|
86
|
+
...DEFAULT_A3_VISUALIZATION_THEME,
|
|
87
|
+
...overrides,
|
|
88
|
+
fontFamily: fallbackFontFamily,
|
|
89
|
+
annotationFontFamily: overrides.annotationFontFamily ?? fallbackFontFamily,
|
|
90
|
+
legendFontFamily: overrides.legendFontFamily ?? fallbackFontFamily,
|
|
91
|
+
regionPalette: overrides.regionPalette ?? DEFAULT_REGION_PALETTE,
|
|
92
|
+
sitePalette: overrides.sitePalette ?? DEFAULT_SITE_PALETTE,
|
|
93
|
+
ptmPalette: overrides.ptmPalette ?? DEFAULT_PTM_PALETTE,
|
|
94
|
+
processingPalette: overrides.processingPalette ?? DEFAULT_PROCESSING_PALETTE,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns a recycled palette color for a zero-based index.
|
|
99
|
+
*/
|
|
100
|
+
export function paletteColorAt(palette, index) {
|
|
101
|
+
if (palette.length === 0) {
|
|
102
|
+
throw new RangeError("A3 visualization palettes cannot be empty.");
|
|
103
|
+
}
|
|
104
|
+
return palette[index % palette.length] ?? palette[0] ?? "#000000";
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Converts a hex color into an rgba string with the requested alpha value.
|
|
108
|
+
*/
|
|
109
|
+
export function withAlpha(color, alpha) {
|
|
110
|
+
const normalized = color.trim();
|
|
111
|
+
if (!normalized.startsWith("#")) {
|
|
112
|
+
return normalized;
|
|
113
|
+
}
|
|
114
|
+
const hex = normalized.slice(1);
|
|
115
|
+
const expanded = hex.length === 3
|
|
116
|
+
? hex
|
|
117
|
+
.split("")
|
|
118
|
+
.map((character) => `${character}${character}`)
|
|
119
|
+
.join("")
|
|
120
|
+
: hex;
|
|
121
|
+
if (expanded.length !== 6) {
|
|
122
|
+
return normalized;
|
|
123
|
+
}
|
|
124
|
+
const red = Number.parseInt(expanded.slice(0, 2), 16);
|
|
125
|
+
const green = Number.parseInt(expanded.slice(2, 4), 16);
|
|
126
|
+
const blue = Number.parseInt(expanded.slice(4, 6), 16);
|
|
127
|
+
return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../../../src/charts/a3/palette.ts"],"names":[],"mappings":"AAEA,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,MAAM,CAAC,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EAAE,CAAC;IAChC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,QAAQ,GACZ,GAAG,CAAC,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,GAAG;aACA,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;aAC9C,IAAI,CAAC,EAAE,CAAC;QACb,CAAC,CAAC,GAAG,CAAC;IAEV,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEvD,OAAO,QAAQ,GAAG,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { A3Data } from "@rtemis/a3";
|
|
2
|
+
/**
|
|
3
|
+
* Supported PTM placement strategies for renderer overlays.
|
|
4
|
+
*/
|
|
5
|
+
export type A3PtmPlacement = "outerRadial" | "innerRadial" | "radial";
|
|
6
|
+
/**
|
|
7
|
+
* Shared visual theme values used by all renderers.
|
|
8
|
+
*/
|
|
9
|
+
export interface A3VisualizationTheme {
|
|
10
|
+
/** @deprecated Use `annotationFontFamily` and `legendFontFamily` instead. */
|
|
11
|
+
readonly fontFamily?: string;
|
|
12
|
+
/** Font family used for residue labels and numeric position annotations. */
|
|
13
|
+
readonly annotationFontFamily: string;
|
|
14
|
+
/** Font family used for titles and legends. */
|
|
15
|
+
readonly legendFontFamily: string;
|
|
16
|
+
/** Background color outside the plot area. */
|
|
17
|
+
readonly backgroundColor: string;
|
|
18
|
+
/** Background color inside the plot area. */
|
|
19
|
+
readonly plotBackgroundColor: string;
|
|
20
|
+
/** Primary residue marker fill. */
|
|
21
|
+
readonly residueFillColor: string;
|
|
22
|
+
/** Primary residue marker stroke and backbone line color. */
|
|
23
|
+
readonly residueStrokeColor: string;
|
|
24
|
+
/** Default residue text color. */
|
|
25
|
+
readonly labelColor: string;
|
|
26
|
+
/** Color used for numeric position labels. */
|
|
27
|
+
readonly positionLabelColor: string;
|
|
28
|
+
/** Legend text color. */
|
|
29
|
+
readonly legendColor: string;
|
|
30
|
+
/** Grid line color for value axes. */
|
|
31
|
+
readonly gridColor: string;
|
|
32
|
+
/** Variant label highlight color. */
|
|
33
|
+
readonly variantColor: string;
|
|
34
|
+
/** Disease-associated variant highlight color. */
|
|
35
|
+
readonly diseaseVariantColor: string;
|
|
36
|
+
/** Colors recycled for region overlays. */
|
|
37
|
+
readonly regionPalette: readonly string[];
|
|
38
|
+
/** Colors recycled for site overlays. */
|
|
39
|
+
readonly sitePalette: readonly string[];
|
|
40
|
+
/** Colors recycled for PTM overlays. */
|
|
41
|
+
readonly ptmPalette: readonly string[];
|
|
42
|
+
/** Colors recycled for processing annotation overlays. */
|
|
43
|
+
readonly processingPalette: readonly string[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* High-level options shared across all renderers.
|
|
47
|
+
*/
|
|
48
|
+
export interface A3VisualizationOptions {
|
|
49
|
+
/** Number of residues before the layout wraps. Defaults to `21`. */
|
|
50
|
+
readonly nPerRow?: number;
|
|
51
|
+
/** Horizontal spacing multiplier between consecutive residues. Defaults to `0.3`. */
|
|
52
|
+
readonly residueSpacing?: number;
|
|
53
|
+
/** Whether to render backbone markers and lines. Defaults to `true`. */
|
|
54
|
+
readonly showMarkers?: boolean;
|
|
55
|
+
/** Whether to render single-letter residue labels. Defaults to `true`. */
|
|
56
|
+
readonly showLabels?: boolean;
|
|
57
|
+
/** Frequency for numeric position labels. Set `null` to disable them. */
|
|
58
|
+
readonly positionEvery?: number | null;
|
|
59
|
+
/** Optional chart title. */
|
|
60
|
+
readonly title?: string;
|
|
61
|
+
/** Vertical inset in pixels for the title. */
|
|
62
|
+
readonly titleTop?: number;
|
|
63
|
+
/** Suggested output width in pixels. */
|
|
64
|
+
readonly width?: number;
|
|
65
|
+
/** Suggested output height in pixels. Also controls the effective vertical zoom. */
|
|
66
|
+
readonly height?: number;
|
|
67
|
+
/** Base font size in pixels. */
|
|
68
|
+
readonly fontSize?: number;
|
|
69
|
+
/** Base residue marker size in pixels. */
|
|
70
|
+
readonly markerSize?: number;
|
|
71
|
+
/** Backbone line width in pixels. */
|
|
72
|
+
readonly lineWidth?: number;
|
|
73
|
+
/** Gap in pixels between residue anchors and processing overlays. */
|
|
74
|
+
readonly annotationGap?: number;
|
|
75
|
+
/** PTM placement strategy for renderers that support multiple overlay modes. Defaults to `"radial"`. */
|
|
76
|
+
readonly ptmPlacement?: A3PtmPlacement;
|
|
77
|
+
/** Residue marker fill color. Defaults to `"#181818"`. */
|
|
78
|
+
readonly markerColor?: string;
|
|
79
|
+
/** Opacity used for region annotation bands. Must be between `0` and `1`. */
|
|
80
|
+
readonly regionOpacity?: number;
|
|
81
|
+
/** Gap in pixels between the chart area and the legend rail. Defaults to `90`. */
|
|
82
|
+
readonly legendGap?: number;
|
|
83
|
+
/** Gap in pixels between residue anchors and numeric position labels. */
|
|
84
|
+
readonly positionLabelGap?: number;
|
|
85
|
+
/** Animate the first render and updates. */
|
|
86
|
+
readonly enableAnimation?: boolean;
|
|
87
|
+
/** Initial animation duration in milliseconds for the ECharts renderer. */
|
|
88
|
+
readonly animationDuration?: number;
|
|
89
|
+
/** Update animation duration in milliseconds for the ECharts renderer. */
|
|
90
|
+
readonly animationDurationUpdate?: number;
|
|
91
|
+
/** Optional extra positions to treat as disease-associated variants. */
|
|
92
|
+
readonly diseaseVariants?: readonly number[];
|
|
93
|
+
/** Partial theme overrides. */
|
|
94
|
+
readonly theme?: Partial<A3VisualizationTheme>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Single amino acid placement in normalized chart coordinates.
|
|
98
|
+
*/
|
|
99
|
+
export interface A3ResiduePoint {
|
|
100
|
+
/** One-based residue position. */
|
|
101
|
+
readonly position: number;
|
|
102
|
+
/** One-letter amino acid code. */
|
|
103
|
+
readonly residue: string;
|
|
104
|
+
/** Expanded residue name for hover text. */
|
|
105
|
+
readonly residueName: string;
|
|
106
|
+
/** Layout x coordinate. */
|
|
107
|
+
readonly x: number;
|
|
108
|
+
/** Layout y coordinate. */
|
|
109
|
+
readonly y: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Bounding box of a layout in normalized coordinate space.
|
|
113
|
+
*/
|
|
114
|
+
export interface A3LayoutBounds {
|
|
115
|
+
readonly minX: number;
|
|
116
|
+
readonly maxX: number;
|
|
117
|
+
readonly minY: number;
|
|
118
|
+
readonly maxY: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Shared geometry model consumed by multiple renderers.
|
|
122
|
+
*/
|
|
123
|
+
export interface A3LayoutModel {
|
|
124
|
+
/** Validated A3 data object. */
|
|
125
|
+
readonly data: A3Data;
|
|
126
|
+
/** Number of residues per wrapped row. */
|
|
127
|
+
readonly nPerRow: number;
|
|
128
|
+
/** Residue placements in order. */
|
|
129
|
+
readonly residues: readonly A3ResiduePoint[];
|
|
130
|
+
/** Layout bounds for axis configuration. */
|
|
131
|
+
readonly bounds: A3LayoutBounds;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Minimal ECharts series shape emitted by this package.
|
|
135
|
+
*/
|
|
136
|
+
export interface A3EChartsSeries {
|
|
137
|
+
readonly type: string;
|
|
138
|
+
readonly name?: string;
|
|
139
|
+
readonly [key: string]: unknown;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Minimal option object consumed by Apache ECharts.
|
|
143
|
+
*/
|
|
144
|
+
export interface A3EChartsOption {
|
|
145
|
+
readonly backgroundColor: string;
|
|
146
|
+
readonly animation?: boolean;
|
|
147
|
+
readonly animationDuration?: number;
|
|
148
|
+
readonly animationDurationUpdate?: number;
|
|
149
|
+
readonly title?: Record<string, unknown>;
|
|
150
|
+
readonly grid: Record<string, unknown>;
|
|
151
|
+
readonly xAxis: Record<string, unknown>;
|
|
152
|
+
readonly yAxis: Record<string, unknown>;
|
|
153
|
+
readonly legend: Record<string, unknown>;
|
|
154
|
+
readonly tooltip: Record<string, unknown>;
|
|
155
|
+
readonly dataZoom?: readonly Record<string, unknown>[];
|
|
156
|
+
readonly series: readonly A3EChartsSeries[];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Inputs accepted by visualization helpers.
|
|
160
|
+
* Accepts validated A3Data (plain object from a3.toData()) or raw input
|
|
161
|
+
* that will be validated via the A3 constructor.
|
|
162
|
+
*/
|
|
163
|
+
export type A3VisualizationInput = A3Data;
|
|
164
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/charts/a3/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,C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C,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACvD,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/charts/a3/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECharts option builders shared by rtemis.draw and rtemislive. Each builder
|
|
3
|
+
* takes a chart's data and its `chart/<type>/v1` config and returns the
|
|
4
|
+
* ECharts option.
|
|
5
|
+
*
|
|
6
|
+
* spec: draw/shared-builders#package
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { buildA3Option } from "./charts/a3/index.ts";
|
|
11
|
+
export type { A3Appearance, A3ChartConfig, A3EChartsOption, A3PtmPlacement, A3SurfaceHints, } from "./charts/a3/index.ts";
|
|
12
|
+
export { A3_CHART_CONFIG_MEMBERS, a3SurfaceHints, buildA3Option } from "./charts/a3/index.ts";
|
|
13
|
+
/** The builder of each chart type, by `chart/<type>/v1` type name. */
|
|
14
|
+
export declare const builders: Readonly<{
|
|
15
|
+
a3: typeof buildA3Option;
|
|
16
|
+
}>;
|
|
17
|
+
/** A chart type with a builder in this package. */
|
|
18
|
+
export type ChartType = keyof typeof builders;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,YAAY,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE9F,sEAAsE;AACtE,eAAO,MAAM,QAAQ;;EAEnB,CAAC;AAEH,mDAAmD;AACnD,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,QAAQ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECharts option builders shared by rtemis.draw and rtemislive. Each builder
|
|
3
|
+
* takes a chart's data and its `chart/<type>/v1` config and returns the
|
|
4
|
+
* ECharts option.
|
|
5
|
+
*
|
|
6
|
+
* spec: draw/shared-builders#package
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { buildA3Option } from "./charts/a3/index.js";
|
|
11
|
+
export { A3_CHART_CONFIG_MEMBERS, a3SurfaceHints, buildA3Option } from "./charts/a3/index.js";
|
|
12
|
+
/** The builder of each chart type, by `chart/<type>/v1` type name. */
|
|
13
|
+
export const builders = Object.freeze({
|
|
14
|
+
a3: buildA3Option,
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AASrD,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE9F,sEAAsE;AACtE,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,aAAa;CAClB,CAAC,CAAC"}
|