@populationgenomics/gene-glyph 0.0.0-stage → 1.1.0
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 +21 -0
- package/README.md +58 -2
- package/dist/adapters/clinvar.d.ts +34 -0
- package/dist/adapters/clinvar.d.ts.map +1 -0
- package/dist/adapters/clinvar.test.d.ts +2 -0
- package/dist/adapters/clinvar.test.d.ts.map +1 -0
- package/dist/adapters/rmc.d.ts +31 -0
- package/dist/adapters/rmc.d.ts.map +1 -0
- package/dist/adapters/rmc.test.d.ts +2 -0
- package/dist/adapters/rmc.test.d.ts.map +1 -0
- package/dist/chrome/default-minimap.d.ts +26 -0
- package/dist/chrome/default-minimap.d.ts.map +1 -0
- package/dist/chrome/default-minimap.test.d.ts +2 -0
- package/dist/chrome/default-minimap.test.d.ts.map +1 -0
- package/dist/chrome/default-track-chevron.d.ts +37 -0
- package/dist/chrome/default-track-chevron.d.ts.map +1 -0
- package/dist/chrome/default-track-chevron.test.d.ts +2 -0
- package/dist/chrome/default-track-chevron.test.d.ts.map +1 -0
- package/dist/coordinate-mapper.d.ts +13 -0
- package/dist/coordinate-mapper.d.ts.map +1 -0
- package/dist/coordinate-mapper.test.d.ts +2 -0
- package/dist/coordinate-mapper.test.d.ts.map +1 -0
- package/dist/data-source.d.ts +24 -0
- package/dist/data-source.d.ts.map +1 -0
- package/dist/data-source.test.d.ts +2 -0
- package/dist/data-source.test.d.ts.map +1 -0
- package/dist/debug-leash.d.ts +73 -0
- package/dist/debug-leash.d.ts.map +1 -0
- package/dist/export.d.ts +69 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.test.d.ts +2 -0
- package/dist/export.test.d.ts.map +1 -0
- package/dist/feature-id-hash.d.ts +26 -0
- package/dist/feature-id-hash.d.ts.map +1 -0
- package/dist/feature-id-hash.test.d.ts +2 -0
- package/dist/feature-id-hash.test.d.ts.map +1 -0
- package/dist/figure-scale.d.ts +145 -0
- package/dist/figure-scale.d.ts.map +1 -0
- package/dist/figure-scale.test.d.ts +2 -0
- package/dist/figure-scale.test.d.ts.map +1 -0
- package/dist/gutter.test.d.ts +2 -0
- package/dist/gutter.test.d.ts.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7910 -0
- package/dist/index.js.map +1 -0
- package/dist/layout-engine.d.ts +52 -0
- package/dist/layout-engine.d.ts.map +1 -0
- package/dist/layout-engine.test.d.ts +2 -0
- package/dist/layout-engine.test.d.ts.map +1 -0
- package/dist/pack-lanes.d.ts +27 -0
- package/dist/pack-lanes.d.ts.map +1 -0
- package/dist/pack-lanes.test.d.ts +2 -0
- package/dist/pack-lanes.test.d.ts.map +1 -0
- package/dist/painter/index.d.ts +4 -0
- package/dist/painter/index.d.ts.map +1 -0
- package/dist/painter/svg-painter.d.ts +6 -0
- package/dist/painter/svg-painter.d.ts.map +1 -0
- package/dist/painter/svg-painter.test.d.ts +2 -0
- package/dist/painter/svg-painter.test.d.ts.map +1 -0
- package/dist/projection-frame.d.ts +92 -0
- package/dist/projection-frame.d.ts.map +1 -0
- package/dist/projection-frame.test.d.ts +2 -0
- package/dist/projection-frame.test.d.ts.map +1 -0
- package/dist/segments.d.ts +86 -0
- package/dist/segments.d.ts.map +1 -0
- package/dist/slots.test.d.ts +2 -0
- package/dist/slots.test.d.ts.map +1 -0
- package/dist/styles.css +1127 -0
- package/dist/symbol-encoding.d.ts +103 -0
- package/dist/symbol-encoding.d.ts.map +1 -0
- package/dist/symbol-encoding.test.d.ts +2 -0
- package/dist/symbol-encoding.test.d.ts.map +1 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/tracks/aa-track.d.ts +67 -0
- package/dist/tracks/aa-track.d.ts.map +1 -0
- package/dist/tracks/aa-track.test.d.ts +2 -0
- package/dist/tracks/aa-track.test.d.ts.map +1 -0
- package/dist/tracks/clinvar-summary-track.d.ts +29 -0
- package/dist/tracks/clinvar-summary-track.d.ts.map +1 -0
- package/dist/tracks/clinvar-summary-track.test.d.ts +2 -0
- package/dist/tracks/clinvar-summary-track.test.d.ts.map +1 -0
- package/dist/tracks/clinvar-track.d.ts +161 -0
- package/dist/tracks/clinvar-track.d.ts.map +1 -0
- package/dist/tracks/clinvar-track.test.d.ts +2 -0
- package/dist/tracks/clinvar-track.test.d.ts.map +1 -0
- package/dist/tracks/exon-track.d.ts +25 -0
- package/dist/tracks/exon-track.d.ts.map +1 -0
- package/dist/tracks/exon-track.test.d.ts +2 -0
- package/dist/tracks/exon-track.test.d.ts.map +1 -0
- package/dist/tracks/interpro-track.d.ts +69 -0
- package/dist/tracks/interpro-track.d.ts.map +1 -0
- package/dist/tracks/interpro-track.test.d.ts +2 -0
- package/dist/tracks/interpro-track.test.d.ts.map +1 -0
- package/dist/tracks/nucleotide-track.d.ts +84 -0
- package/dist/tracks/nucleotide-track.d.ts.map +1 -0
- package/dist/tracks/nucleotide-track.test.d.ts +2 -0
- package/dist/tracks/nucleotide-track.test.d.ts.map +1 -0
- package/dist/tracks/overview-track.d.ts +50 -0
- package/dist/tracks/overview-track.d.ts.map +1 -0
- package/dist/tracks/overview-track.test.d.ts +2 -0
- package/dist/tracks/overview-track.test.d.ts.map +1 -0
- package/dist/tracks/parse-user-variants.d.ts +55 -0
- package/dist/tracks/parse-user-variants.d.ts.map +1 -0
- package/dist/tracks/parse-user-variants.test.d.ts +2 -0
- package/dist/tracks/parse-user-variants.test.d.ts.map +1 -0
- package/dist/tracks/pfam-track.d.ts +33 -0
- package/dist/tracks/pfam-track.d.ts.map +1 -0
- package/dist/tracks/pfam-track.test.d.ts +2 -0
- package/dist/tracks/pfam-track.test.d.ts.map +1 -0
- package/dist/tracks/profile-track.d.ts +133 -0
- package/dist/tracks/profile-track.d.ts.map +1 -0
- package/dist/tracks/profile-track.test.d.ts +2 -0
- package/dist/tracks/profile-track.test.d.ts.map +1 -0
- package/dist/tracks/scale-track.d.ts +70 -0
- package/dist/tracks/scale-track.d.ts.map +1 -0
- package/dist/tracks/scale-track.test.d.ts +2 -0
- package/dist/tracks/scale-track.test.d.ts.map +1 -0
- package/dist/tracks/segment-band-track.d.ts +86 -0
- package/dist/tracks/segment-band-track.d.ts.map +1 -0
- package/dist/tracks/segment-band-track.test.d.ts +2 -0
- package/dist/tracks/segment-band-track.test.d.ts.map +1 -0
- package/dist/tracks/user-variant-track.d.ts +50 -0
- package/dist/tracks/user-variant-track.d.ts.map +1 -0
- package/dist/tracks/user-variant-track.test.d.ts +2 -0
- package/dist/tracks/user-variant-track.test.d.ts.map +1 -0
- package/dist/tracks/variant-summary-track.d.ts +24 -0
- package/dist/tracks/variant-summary-track.d.ts.map +1 -0
- package/dist/tracks/variant-summary-track.test.d.ts +2 -0
- package/dist/tracks/variant-summary-track.test.d.ts.map +1 -0
- package/dist/tracks/variant-track.d.ts +89 -0
- package/dist/tracks/variant-track.d.ts.map +1 -0
- package/dist/tracks/variant-track.test.d.ts +2 -0
- package/dist/tracks/variant-track.test.d.ts.map +1 -0
- package/dist/types.d.ts +671 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/use-viewport-interactions.d.ts +49 -0
- package/dist/use-viewport-interactions.d.ts.map +1 -0
- package/dist/viewer-interactions.test.d.ts +2 -0
- package/dist/viewer-interactions.test.d.ts.map +1 -0
- package/dist/viewer-overlay.test.d.ts +2 -0
- package/dist/viewer-overlay.test.d.ts.map +1 -0
- package/dist/viewer-selection-range.test.d.ts +2 -0
- package/dist/viewer-selection-range.test.d.ts.map +1 -0
- package/dist/viewer.d.ts +319 -0
- package/dist/viewer.d.ts.map +1 -0
- package/dist/viewer.test.d.ts +2 -0
- package/dist/viewer.test.d.ts.map +1 -0
- package/dist/viewport.d.ts +352 -0
- package/dist/viewport.d.ts.map +1 -0
- package/dist/viewport.test.d.ts +2 -0
- package/dist/viewport.test.d.ts.map +1 -0
- package/package.json +65 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nucleotide-track.test.d.ts","sourceRoot":"","sources":["../../src/tracks/nucleotide-track.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { Track } from '../types.js';
|
|
3
|
+
import type { GeneGlyphRef } from '../viewer.js';
|
|
4
|
+
export interface OverviewTrackConfig {
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Ref handed to `<GeneGlyph>`. The overview polls the live viewport
|
|
7
|
+
* via `getViewportInfo()` for the bounds rectangle, and writes pan /
|
|
8
|
+
* zoom back via `fitTo`. */
|
|
9
|
+
viewerRef: RefObject<GeneGlyphRef | null>;
|
|
10
|
+
/** Tracks whose `renderMinimap` outputs should appear inside the
|
|
11
|
+
* overview, stacked vertically. The host typically passes the same
|
|
12
|
+
* list it threads into `<GeneGlyph tracks={…}>` (or a subset). Tracks
|
|
13
|
+
* without a `renderMinimap` hook are skipped silently. */
|
|
14
|
+
tracks?: Track[];
|
|
15
|
+
/** Per-track minimap row height in pixels. Default 16. The overview's
|
|
16
|
+
* total height is `tracks.length × rowHeight + 2 × verticalPadding`,
|
|
17
|
+
* or {@link OverviewTrackConfig.height} when supplied. */
|
|
18
|
+
rowHeight?: number;
|
|
19
|
+
/** Vertical breathing room above + below the stacked rows. Default 4. */
|
|
20
|
+
verticalPadding?: number;
|
|
21
|
+
/** Override the auto-computed track height. When omitted, the height
|
|
22
|
+
* is derived from the number of rows + padding. */
|
|
23
|
+
height?: number;
|
|
24
|
+
/** Half-width of the draggable edge handles. Default 6. */
|
|
25
|
+
handlePx?: number;
|
|
26
|
+
}
|
|
27
|
+
interface OverviewTrackData {
|
|
28
|
+
ready: true;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Slice 26 — overview track. A wholly display-space minimap rendered
|
|
32
|
+
* inside the figure SVG. Operates on its own mini-viewport pinned to
|
|
33
|
+
* fit-gene at the figure's width; the live figure viewport is consulted
|
|
34
|
+
* only to read the current visible CDS range for the bounds rectangle
|
|
35
|
+
* and to write pan/zoom commands back via the imperative ref.
|
|
36
|
+
*
|
|
37
|
+
* Each upstream track passed via {@link OverviewTrackConfig.tracks} that
|
|
38
|
+
* implements `Track.renderMinimap` contributes one row of content inside
|
|
39
|
+
* the overview. Tracks without the hook (overlay-only, the overview
|
|
40
|
+
* itself) are skipped. The bounds rectangle overlays every row so the
|
|
41
|
+
* user can see which slice of the gene is currently in view across the
|
|
42
|
+
* whole stack at a glance.
|
|
43
|
+
*
|
|
44
|
+
* Trade-off vs. {@link DefaultMinimap}: the overview lives inside the
|
|
45
|
+
* figure SVG and therefore rides along on `exportSVG()` / `exportPNG()`;
|
|
46
|
+
* the default minimap is React DOM chrome that's dropped on export.
|
|
47
|
+
*/
|
|
48
|
+
export declare function overviewTrack(config: OverviewTrackConfig): Track<OverviewTrackConfig, OverviewTrackData>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=overview-track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overview-track.d.ts","sourceRoot":"","sources":["../../src/tracks/overview-track.tsx"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAKV,KAAK,EAMN,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;iCAE6B;IAC7B,SAAS,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC1C;;;+DAG2D;IAC3D,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB;;+DAE2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;wDACoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,IAAI,CAAC;CACb;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,mBAAmB,GAC1B,KAAK,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAoD/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overview-track.test.d.ts","sourceRoot":"","sources":["../../src/tracks/overview-track.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Slice 34 — local parser for user-supplied variants.
|
|
2
|
+
*
|
|
3
|
+
* Accepts the common genomic spellings clinicians paste from VCF / gnomAD
|
|
4
|
+
* / IGV / their own pipelines:
|
|
5
|
+
*
|
|
6
|
+
* chr:pos REF>ALT e.g. `17:7674212C>T`
|
|
7
|
+
* chr:pos-REF-ALT e.g. `chr1:12345-C-T`
|
|
8
|
+
* chr-pos-REF-ALT e.g. `17-7674212-C-A` (gnomAD canonical)
|
|
9
|
+
*
|
|
10
|
+
* Tolerant of: an optional `chr` prefix, mixed-case REF/ALT, leading /
|
|
11
|
+
* trailing whitespace, and stray internal whitespace (the "chr1:12345C >G"
|
|
12
|
+
* shape a paste from a status bar often grows). Strict about everything
|
|
13
|
+
* else — anything we can't reduce to `<chr>-<pos>-<REF>-<ALT>` returns
|
|
14
|
+
* null and the entry surfaces in the embed's parse-error footer.
|
|
15
|
+
*
|
|
16
|
+
* HGVS forms (`c.`, `p.`, `g.`, `n.`) are *not* handled here; Slice 36
|
|
17
|
+
* routes them through VariantValidator. */
|
|
18
|
+
export interface ParsedUserVariant {
|
|
19
|
+
/** Canonical gnomAD-style id — `<chr>-<pos>-<REF>-<ALT>`, no `chr` prefix.
|
|
20
|
+
* Shared with ClinVar's id space so selection / lookup logic doesn't
|
|
21
|
+
* need to know which surface produced the record. */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Chromosome with `chr` prefix (matches the form transcripts use for
|
|
24
|
+
* exon.chr — `chr17`, `chrX`). */
|
|
25
|
+
chr: string;
|
|
26
|
+
pos: number;
|
|
27
|
+
ref: string;
|
|
28
|
+
alt: string;
|
|
29
|
+
/** Raw input as the user typed it; surfaced in tooltips / detail cards
|
|
30
|
+
* so they recognise their own paste. */
|
|
31
|
+
raw: string;
|
|
32
|
+
}
|
|
33
|
+
/** Parse one entry. Returns `null` if the string isn't a recognised
|
|
34
|
+
* genomic-form variant. */
|
|
35
|
+
export declare function parseUserVariant(raw: string): ParsedUserVariant | null;
|
|
36
|
+
export interface ParseUserVariantsResult {
|
|
37
|
+
parsed: ParsedUserVariant[];
|
|
38
|
+
/** Tokens that look like HGVS (start with `c.`, `p.`, `g.`, `n.`,
|
|
39
|
+
* `r.`, `m.`). The local parser doesn't resolve these — Slice 36
|
|
40
|
+
* routes them through VariantValidator. Deduplicated case-
|
|
41
|
+
* insensitively so a paste of the same HGVS twice only fires one
|
|
42
|
+
* network call. */
|
|
43
|
+
hgvsTokens: string[];
|
|
44
|
+
/** Tokens that matched neither the local genomic forms nor an HGVS
|
|
45
|
+
* prefix — the user typed something unparseable. Surfaces in the
|
|
46
|
+
* embed's parse-error footer verbatim. */
|
|
47
|
+
errors: string[];
|
|
48
|
+
}
|
|
49
|
+
/** Parse a CSV / line-broken list of user variants.
|
|
50
|
+
* Splits on commas and newlines, ignores empty tokens, deduplicates
|
|
51
|
+
* parsed entries by canonical id and hgvs tokens by their lower-
|
|
52
|
+
* cased text (first occurrence wins so the raw form the user typed
|
|
53
|
+
* stays in the record). */
|
|
54
|
+
export declare function parseUserVariants(input: string): ParseUserVariantsResult;
|
|
55
|
+
//# sourceMappingURL=parse-user-variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-user-variants.d.ts","sourceRoot":"","sources":["../../src/tracks/parse-user-variants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;4CAgB4C;AAE5C,MAAM,WAAW,iBAAiB;IAChC;;0DAEsD;IACtD,EAAE,EAAE,MAAM,CAAC;IACX;uCACmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ;6CACyC;IACzC,GAAG,EAAE,MAAM,CAAC;CACb;AAED;4BAC4B;AAC5B,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAiCtE;AAYD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B;;;;wBAIoB;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;+CAE2C;IAC3C,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID;;;;4BAI4B;AAC5B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,uBAAuB,CA0BxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-user-variants.test.d.ts","sourceRoot":"","sources":["../../src/tracks/parse-user-variants.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ProteinDomain, Track } from '../types.js';
|
|
2
|
+
export interface PfamTrackConfig {
|
|
3
|
+
id?: string;
|
|
4
|
+
/** Total track height in pixels. */
|
|
5
|
+
height?: number;
|
|
6
|
+
/** Half-thickness of the rounded rect drawn for each domain segment. */
|
|
7
|
+
rectHalfHeight?: number;
|
|
8
|
+
/** Pixel gap between a label's bounding box and the neighbouring domain's
|
|
9
|
+
* midpoint; widens the no-overlap budget. */
|
|
10
|
+
labelGutter?: number;
|
|
11
|
+
/** Font size used both for the label and the half-distance label budget. */
|
|
12
|
+
labelFontSize?: number;
|
|
13
|
+
/** Vertical offset of the label above the rectangle's top edge. */
|
|
14
|
+
labelOffset?: number;
|
|
15
|
+
/** Override the default `source.toLowerCase() === 'pfam'` filter. Useful for
|
|
16
|
+
* tests, and for hosts whose ProteinAnnotations carries multiple sources
|
|
17
|
+
* through the same record. */
|
|
18
|
+
domainFilter?: (domain: ProteinDomain) => boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface PfamTrackData {
|
|
21
|
+
domains: ProteinDomain[];
|
|
22
|
+
}
|
|
23
|
+
/** Stable HSL fill keyed off a domain identifier so a given Pfam family gets
|
|
24
|
+
* the same colour across the page (and across genes). Ported from
|
|
25
|
+
* lit-manager's `domainHue`. */
|
|
26
|
+
export declare function domainHue(key: string): string;
|
|
27
|
+
/** Truncate `text` to fit inside `maxW` at `fontSize`, appending an ellipsis
|
|
28
|
+
* if shortened. Returns an empty string when there's not room for even two
|
|
29
|
+
* characters — hosts use the tooltip for the full name in that case.
|
|
30
|
+
* Ported from lit-manager's `fitText` so cross-page label behaviour matches. */
|
|
31
|
+
export declare function fitText(text: string, maxW: number, fontSize: number): string;
|
|
32
|
+
export declare function pfamTrack(config?: PfamTrackConfig): Track<PfamTrackConfig, PfamTrackData>;
|
|
33
|
+
//# sourceMappingURL=pfam-track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pfam-track.d.ts","sourceRoot":"","sources":["../../src/tracks/pfam-track.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,aAAa,EAEb,KAAK,EAON,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;kDAC8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;mCAE+B;IAC/B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AA0BD;;iCAEiC;AACjC,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ7C;AAED;;;iFAGiF;AACjF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO5E;AAED,wBAAgB,SAAS,CAAC,MAAM,GAAE,eAAoB,GAAG,KAAK,CAAC,eAAe,EAAE,aAAa,CAAC,CAmK7F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pfam-track.test.d.ts","sourceRoot":"","sources":["../../src/tracks/pfam-track.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { CoordSystem, Track } from '../types.js';
|
|
2
|
+
/** One sample on the position axis. `position` is in the track's
|
|
3
|
+
* declared `coordSystem` (1-indexed CDS bp or aa); `value` is the raw
|
|
4
|
+
* signal at that position. */
|
|
5
|
+
export interface ProfileDatum {
|
|
6
|
+
position: number;
|
|
7
|
+
value: number;
|
|
8
|
+
}
|
|
9
|
+
/** Source can be an eager array (best for dense fixtures the host has
|
|
10
|
+
* already in hand) or a callable for sparse / on-demand signals.
|
|
11
|
+
* Callables return `null` when a position has no sample — those
|
|
12
|
+
* positions are skipped by aggregation. */
|
|
13
|
+
export type ProfileSource = ReadonlyArray<ProfileDatum> | ((position: number) => number | null);
|
|
14
|
+
/** Maps a value into a CSS colour. `domain` is the [min, max] of the
|
|
15
|
+
* resolved yScale so hosts can build palette functions without
|
|
16
|
+
* threading the domain through separately. */
|
|
17
|
+
export type ColorRamp = (value: number, domain: readonly [number, number]) => string;
|
|
18
|
+
export type ProfileRender = 'histogram' | 'heatmap';
|
|
19
|
+
export type ProfileAggregate = 'max' | 'mean' | 'sum';
|
|
20
|
+
export type ProfileYScale = 'linear' | 'log' | {
|
|
21
|
+
domain: readonly [number, number];
|
|
22
|
+
scale?: 'linear' | 'log';
|
|
23
|
+
};
|
|
24
|
+
export interface ProfileTrackConfig {
|
|
25
|
+
id?: string;
|
|
26
|
+
/** Per-position samples in `coordSystem` units. */
|
|
27
|
+
source: ProfileSource;
|
|
28
|
+
/** `'cds'` (positions = CDS bp, 1-indexed) or `'protein'` (positions
|
|
29
|
+
* = aa, 1-indexed). The track maps positions to baseline-x via the
|
|
30
|
+
* active viewport mode, so a protein-coord source still renders
|
|
31
|
+
* correctly in CDS modes (mapped to codon-centre bp). */
|
|
32
|
+
coordSystem: CoordSystem;
|
|
33
|
+
/** Visual primitive. Histogram = area-fill on the position axis.
|
|
34
|
+
* Heatmap = full-height colour bands. */
|
|
35
|
+
render: ProfileRender;
|
|
36
|
+
/** Track band height in pixels. Default 24. */
|
|
37
|
+
heightPx?: number;
|
|
38
|
+
/** Vertical pixels reserved above the track during layout. Stacked
|
|
39
|
+
* profile tracks otherwise share an edge — a histogram whose
|
|
40
|
+
* tallest bars reach the band top visually merges into a heatmap
|
|
41
|
+
* directly above it. Default 0. */
|
|
42
|
+
gapAbove?: number;
|
|
43
|
+
/** Colour ramp. Required for `'heatmap'` (a viridis-shaped default
|
|
44
|
+
* ships if omitted). Ignored for `'histogram'` unless the host wants
|
|
45
|
+
* per-bar colour — pass a function that returns the bar fill. */
|
|
46
|
+
colorRamp?: ColorRamp;
|
|
47
|
+
/** Histogram bar-height mapping. Heatmap mode uses the resolved
|
|
48
|
+
* domain only for the colour ramp; bar geometry is full-height. */
|
|
49
|
+
yScale?: ProfileYScale;
|
|
50
|
+
/** Aggregation when several positions land in one display pixel.
|
|
51
|
+
* Defaults: `'max'` for heatmap (preserves peaks in the silhouette),
|
|
52
|
+
* `'sum'` for histogram (preserves total density). */
|
|
53
|
+
aggregate?: ProfileAggregate;
|
|
54
|
+
/** Position-axis length hint. For array sources this is inferred
|
|
55
|
+
* from the data's max position; for callable sources the host MUST
|
|
56
|
+
* provide it (otherwise we'd have to iterate every CDS bp to find
|
|
57
|
+
* the end). */
|
|
58
|
+
length?: number;
|
|
59
|
+
/** Histogram-only: stroke colour for the area outline. Default
|
|
60
|
+
* `null` (no stroke; just the fill). */
|
|
61
|
+
histogramStroke?: string;
|
|
62
|
+
/** Histogram-only: fill colour for the area. Defaults to a muted
|
|
63
|
+
* slate. Ignored when `colorRamp` is set (bars are then keyed by
|
|
64
|
+
* their aggregated value instead). */
|
|
65
|
+
histogramFill?: string;
|
|
66
|
+
/** Optional stroke colour for a thin frame rect drawn around the
|
|
67
|
+
* track band. Spans the full figure width (sits outside the per-
|
|
68
|
+
* exon transform groups so it doesn't slide with pan / zoom).
|
|
69
|
+
* Default `null` (no frame). */
|
|
70
|
+
borderColor?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ProfileTrackData {
|
|
73
|
+
/** Realised samples keyed by integer position. Empty for callable
|
|
74
|
+
* sources (the track looks them up at render time so the underlying
|
|
75
|
+
* callable can return live data). */
|
|
76
|
+
byPosition: ReadonlyMap<number, number>;
|
|
77
|
+
/** Maximum position seen — for array sources this is the data's max
|
|
78
|
+
* position; for callable sources this comes from `config.length`. */
|
|
79
|
+
maxPosition: number;
|
|
80
|
+
/** Auto-derived `[min, max]` over all observed values; used when the
|
|
81
|
+
* yScale config is `'linear'` or `'log'`. */
|
|
82
|
+
autoDomain: readonly [number, number];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Slice 31 — per-position numeric signal as either a histogram (area-fill
|
|
86
|
+
* keyed to a `yScale`) or a heatmap (colour bands keyed to a `colorRamp`).
|
|
87
|
+
* Both visuals share one primitive: an aggregated bucket per visible
|
|
88
|
+
* display pixel, so the silhouette of the underlying signal stays
|
|
89
|
+
* faithful at every zoom level instead of aliasing into spikes.
|
|
90
|
+
*
|
|
91
|
+
* The aggregator picks an integer position step from the live
|
|
92
|
+
* pixels-per-unit at render time — at deep zoom (≥ 1 px/unit) each
|
|
93
|
+
* bucket is a single sample; at fit-gene zoom the bucket spans however
|
|
94
|
+
* many positions land in one pixel column.
|
|
95
|
+
*/
|
|
96
|
+
export declare function profileTrack(config: ProfileTrackConfig): Track<ProfileTrackConfig, ProfileTrackData>;
|
|
97
|
+
interface Bucket {
|
|
98
|
+
start: number;
|
|
99
|
+
end: number;
|
|
100
|
+
center: number;
|
|
101
|
+
value: number;
|
|
102
|
+
}
|
|
103
|
+
interface BucketiseArgs {
|
|
104
|
+
posLo: number;
|
|
105
|
+
posHi: number;
|
|
106
|
+
step: number;
|
|
107
|
+
sampleAt: (pos: number) => number | null;
|
|
108
|
+
aggregate: ProfileAggregate;
|
|
109
|
+
}
|
|
110
|
+
/** Walk integer positions in [posLo, posHi], grouping every `step`
|
|
111
|
+
* positions into one bucket. Buckets are emitted only when at least
|
|
112
|
+
* one position in their span has a sample. Exported for tests. */
|
|
113
|
+
export declare function bucketise({ posLo, posHi, step, sampleAt, aggregate }: BucketiseArgs): Bucket[];
|
|
114
|
+
/** Pick the smallest integer step whose buckets average ≥ 1 display
|
|
115
|
+
* pixel of width. Below 1 px/unit (zoomed-out) we aggregate; at or
|
|
116
|
+
* above 1 px/unit each position renders as its own bucket. Exported
|
|
117
|
+
* for tests. */
|
|
118
|
+
export declare function pickStep(pxPerTrackUnit: number): number;
|
|
119
|
+
/** Build an area-fill SVG `d` attribute walking the bucket silhouette.
|
|
120
|
+
* Adjacent buckets share an edge so the polyline runs continuously;
|
|
121
|
+
* a gap (e.g. a missing-sample run inside an exon) closes the current
|
|
122
|
+
* sub-path and opens a new one. Exported for tests. */
|
|
123
|
+
export declare function buildAreaPath(buckets: ReadonlyArray<{
|
|
124
|
+
xLocal0: number;
|
|
125
|
+
xLocal1: number;
|
|
126
|
+
value: number;
|
|
127
|
+
}>, yBaseline: number, scaleY: (value: number) => number): string;
|
|
128
|
+
/** Reference six-stop viridis-ish ramp. Hosts who want a stricter ramp
|
|
129
|
+
* pass their own `colorRamp`. Exported for tests + so hosts can opt
|
|
130
|
+
* into the default explicitly. */
|
|
131
|
+
export declare function defaultViridis(value: number, domain: readonly [number, number]): string;
|
|
132
|
+
export {};
|
|
133
|
+
//# sourceMappingURL=profile-track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-track.d.ts","sourceRoot":"","sources":["../../src/tracks/profile-track.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-track.test.d.ts","sourceRoot":"","sources":["../../src/tracks/profile-track.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Track } from '../types.js';
|
|
2
|
+
export interface ScaleTrackConfig {
|
|
3
|
+
id?: string;
|
|
4
|
+
/** Total track height in pixels. Ticks hang from the band's baseline;
|
|
5
|
+
* labels sit above the major-tick height. Default 18. */
|
|
6
|
+
height?: number;
|
|
7
|
+
/** Tick step selection. `'auto'` runs a nice-number ladder against
|
|
8
|
+
* the baseline px-per-unit (deliberately not the live zoom) so the
|
|
9
|
+
* step stays stable as the user pans + zooms. Passing a number
|
|
10
|
+
* forces every major tick to that step. Default `'auto'`. */
|
|
11
|
+
majorStep?: number | 'auto';
|
|
12
|
+
/** Minor ticks per major step. `0` disables minor ticks. Default 5
|
|
13
|
+
* (so a step of 100 emits minor ticks every 20 units). */
|
|
14
|
+
minorSubdivisions?: number;
|
|
15
|
+
/** Minimum on-screen gap between consecutive major labels before the
|
|
16
|
+
* auto-step picker promotes to the next ladder rung. Default 32 px. */
|
|
17
|
+
minLabelSpacingPx?: number;
|
|
18
|
+
/** Major-tick label font size. Default 10. */
|
|
19
|
+
labelFontSize?: number;
|
|
20
|
+
/** `'last'` (default) appends the active unit (`bp` / `aa`) to the
|
|
21
|
+
* highest visible label so the ruler reads as `… 1,000 bp` /
|
|
22
|
+
* `… 393 aa`. `'never'` omits the suffix. */
|
|
23
|
+
unitSuffix?: 'never' | 'last';
|
|
24
|
+
/** Extra padding between adjacent label edges in baseline-x pixels.
|
|
25
|
+
* Bumping this makes the first-pass skip more conservative — labels
|
|
26
|
+
* get clear breathing room and the suffix-promotion re-check rarely
|
|
27
|
+
* has to drop a tick. Default 16. */
|
|
28
|
+
labelPadPx?: number;
|
|
29
|
+
/** Rotate major-tick labels in degrees. `0` (default) keeps text
|
|
30
|
+
* horizontal above the tick; `90` rotates the text counter-clockwise
|
|
31
|
+
* so labels read bottom-to-top stacked above their tick mark. Useful
|
|
32
|
+
* for dense scales where horizontal text would crash even after
|
|
33
|
+
* skipping: rotated labels' horizontal footprint shrinks to the
|
|
34
|
+
* font's height (~10 px) instead of the text's natural width
|
|
35
|
+
* (~30–50 px), so far more labels fit per inch of ruler.
|
|
36
|
+
*
|
|
37
|
+
* When rotated, the track defaults to a taller `height` to fit the
|
|
38
|
+
* rotated text vertically. The host can override `height` directly. */
|
|
39
|
+
labelRotation?: 0 | 90;
|
|
40
|
+
/** Coordinate label format. `'c-notation'` (default) renders
|
|
41
|
+
* positions in HGVS c. coords (`c.100`, `c.1,000 bp`). `'genomic'`
|
|
42
|
+
* resolves each label through `mapper.cdsToGenomic` and renders
|
|
43
|
+
* the chromosomal position (`chr1:1,234,567`). The option applies
|
|
44
|
+
* in `genome` and `transcript` modes; `protein` mode is unaffected
|
|
45
|
+
* (always shows aa). Phase 4. */
|
|
46
|
+
labelFormat?: 'c-notation' | 'genomic';
|
|
47
|
+
}
|
|
48
|
+
interface ScaleTrackData {
|
|
49
|
+
ready: true;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Slice 28 — coordinate ruler above the gene body. Renders major +
|
|
53
|
+
* minor tick marks labelled in the viewer's active coord system
|
|
54
|
+
* (CDS bp in `genome` / `transcript` modes, aa in
|
|
55
|
+
* `protein`). The ruler rides per-exon CSS transforms exactly like
|
|
56
|
+
* the exon track underneath, so it pans, zooms, and mode-transitions
|
|
57
|
+
* in lock-step with the figure without any React re-render flicker.
|
|
58
|
+
*
|
|
59
|
+
* Tick step is picked against the *baseline* px-per-unit (fit-gene
|
|
60
|
+
* geometry) rather than the live zoom; the step stays the same as
|
|
61
|
+
* the user zooms in/out, so labels don't repop in / out of view at
|
|
62
|
+
* every wheel tick.
|
|
63
|
+
*/
|
|
64
|
+
export declare function scaleTrack(config?: ScaleTrackConfig): Track<ScaleTrackConfig, ScaleTrackData>;
|
|
65
|
+
/** Pick the smallest ladder step whose label spacing meets the
|
|
66
|
+
* minimum pixel gap. Pathological short genes demote one rung at a
|
|
67
|
+
* time so the ruler still shows ≥ 1 tick. */
|
|
68
|
+
export declare function pickAutoStep(pxPerUnit: number, minSpacingPx: number, rulerLength: number): number;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=scale-track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale-track.d.ts","sourceRoot":"","sources":["../../src/tracks/scale-track.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,KAAK,EAON,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;8DAC0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;kEAG8D;IAC9D,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B;+DAC2D;IAC3D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;4EACwE;IACxE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;kDAE8C;IAC9C,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B;;;0CAGsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;4EASwE;IACxE,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;IACvB;;;;;sCAKkC;IAClC,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,IAAI,CAAC;CACb;AAcD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,gBAAqB,GAAG,KAAK,CAAC,gBAAgB,EAAE,cAAc,CAAC,CA4TjG;AA2BD;;8CAE8C;AAC9C,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CASjG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale-track.test.d.ts","sourceRoot":"","sources":["../../src/tracks/scale-track.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Track } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Slice 30 — categorical / boolean colour-band track.
|
|
4
|
+
*
|
|
5
|
+
* Renders a non-overlapping series of `{start, end, category}` intervals
|
|
6
|
+
* as a single row of coloured rectangles keyed by a host-supplied
|
|
7
|
+
* palette. Used for KIF21A-style annotations (NMD escape, Regional
|
|
8
|
+
* Missense Constraint, secondary structure) where each position carries
|
|
9
|
+
* one categorical attribute and the visual is a continuous strip rather
|
|
10
|
+
* than a glyph per item.
|
|
11
|
+
*/
|
|
12
|
+
export interface SegmentBandDatum<C extends string = string> {
|
|
13
|
+
/** Feature id reported to hover / click callbacks. Defaults to one
|
|
14
|
+
* built from the span and category. */
|
|
15
|
+
id?: string;
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
category: C;
|
|
19
|
+
label?: string;
|
|
20
|
+
}
|
|
21
|
+
/** A band datum in genomic coordinates. `[start, end]` are 1-based
|
|
22
|
+
* inclusive positions on `chr`, in genomic order (`start <= end`) on
|
|
23
|
+
* either strand. `chr` must equal the transcript's `Exon.chr` string
|
|
24
|
+
* exactly; a span on any other chromosome (or under another name for
|
|
25
|
+
* the same one) draws nothing and is listed as unplaced. */
|
|
26
|
+
export interface GenomicSegmentBandDatum<C extends string = string> extends SegmentBandDatum<C> {
|
|
27
|
+
chr: string;
|
|
28
|
+
}
|
|
29
|
+
export type SegmentBandSource<C extends string = string, D extends SegmentBandDatum<C> = SegmentBandDatum<C>> = ReadonlyArray<D> | ((args: {
|
|
30
|
+
signal: AbortSignal;
|
|
31
|
+
}) => Promise<ReadonlyArray<D>>);
|
|
32
|
+
/** Options shared by every {@link SegmentBandTrackConfig} variant. */
|
|
33
|
+
export interface SegmentBandTrackOptions<C extends string = string, D extends SegmentBandDatum<C> = SegmentBandDatum<C>> {
|
|
34
|
+
id?: string;
|
|
35
|
+
/** Eager array or async loader. Each datum's `[start, end]` is in the
|
|
36
|
+
* track's declared `coordSystem` units (1-indexed, inclusive). */
|
|
37
|
+
source: SegmentBandSource<C, D>;
|
|
38
|
+
/** Category → CSS colour. Compile-time exhaustiveness comes from the
|
|
39
|
+
* source datum's literal-union `category` field — passing a record
|
|
40
|
+
* keyed on the same literal union makes an unknown category a
|
|
41
|
+
* compile error rather than a render fallback. */
|
|
42
|
+
palette: Record<C, string>;
|
|
43
|
+
/** Band height in pixels. Default 14. */
|
|
44
|
+
heightPx?: number;
|
|
45
|
+
/** Show inline labels centred inside each segment when the segment is
|
|
46
|
+
* wider than {@link minLabelWidthPx}. Default `false`. */
|
|
47
|
+
showLabels?: boolean;
|
|
48
|
+
/** Threshold (display pixels) below which inline labels are
|
|
49
|
+
* suppressed. Default 28 — roughly three characters of the default
|
|
50
|
+
* 11px font. */
|
|
51
|
+
minLabelWidthPx?: number;
|
|
52
|
+
/** Label font size. Default 10. */
|
|
53
|
+
labelFontSize?: number;
|
|
54
|
+
/** Vertical pixels reserved above this track during layout. */
|
|
55
|
+
gapAbove?: number;
|
|
56
|
+
/** Fires when the input contains overlapping segments. Overlaps are
|
|
57
|
+
* treated as a host data error — the track keeps rendering (every
|
|
58
|
+
* segment still paints) but surfaces the offending pair so the host
|
|
59
|
+
* can log / repair upstream. */
|
|
60
|
+
onOverlapWarning?: (a: D, b: D) => void;
|
|
61
|
+
}
|
|
62
|
+
/** Band track over CDS bp (`'cds'`) or amino acids (`'protein'`). The
|
|
63
|
+
* track maps endpoints to baseline-x via the active viewport so it
|
|
64
|
+
* stays correctly aligned in every mode. */
|
|
65
|
+
export interface CodingSegmentBandTrackConfig<C extends string = string> extends SegmentBandTrackOptions<C, SegmentBandDatum<C>> {
|
|
66
|
+
coordSystem: 'cds' | 'protein';
|
|
67
|
+
}
|
|
68
|
+
/** Band track over genomic positions ({@link GenomicSegmentBandDatum}).
|
|
69
|
+
* A span draws over the coding exon bases it covers, one piece per
|
|
70
|
+
* exon, in every view mode. Its intronic parts, and any part outside
|
|
71
|
+
* the transcript's coding exons (UTR, flanking sequence), are not
|
|
72
|
+
* drawn. */
|
|
73
|
+
export interface GenomicSegmentBandTrackConfig<C extends string = string> extends SegmentBandTrackOptions<C, GenomicSegmentBandDatum<C>> {
|
|
74
|
+
coordSystem: 'genomic';
|
|
75
|
+
}
|
|
76
|
+
export type SegmentBandTrackConfig<C extends string = string> = CodingSegmentBandTrackConfig<C> | GenomicSegmentBandTrackConfig<C>;
|
|
77
|
+
/** Loaded band data, sorted by span start. Spans that draw nothing in
|
|
78
|
+
* the current view are listed below the figure as unplaced chips. */
|
|
79
|
+
export interface SegmentBandTrackData<C extends string = string, D extends SegmentBandDatum<C> = SegmentBandDatum<C>> {
|
|
80
|
+
segments: ReadonlyArray<D>;
|
|
81
|
+
}
|
|
82
|
+
/** Build a {@link Track} that renders a non-overlapping series of
|
|
83
|
+
* categorical intervals as full-height colour bands. */
|
|
84
|
+
export declare function segmentBandTrack<C extends string = string>(config: GenomicSegmentBandTrackConfig<C>): Track<SegmentBandTrackConfig<C>, SegmentBandTrackData<C, GenomicSegmentBandDatum<C>>>;
|
|
85
|
+
export declare function segmentBandTrack<C extends string = string>(config: SegmentBandTrackConfig<C>): Track<SegmentBandTrackConfig<C>, SegmentBandTrackData<C>>;
|
|
86
|
+
//# sourceMappingURL=segment-band-track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-band-track.d.ts","sourceRoot":"","sources":["../../src/tracks/segment-band-track.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-band-track.test.d.ts","sourceRoot":"","sources":["../../src/tracks/segment-band-track.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { DataSource, Track, ViewportQuery } from '../types.js';
|
|
2
|
+
import { type ClinVarRecord, type ClinVarTrackData } from './clinvar-track.js';
|
|
3
|
+
/** Slice 34 — a user-supplied genomic variant. The minimum surface
|
|
4
|
+
* needed to project onto the figure: a stable id, a chromosome / pos
|
|
5
|
+
* pair (matching `exon.chr`'s `chrN` form), and an optional refLen for
|
|
6
|
+
* multi-bp deletions / MNVs. `label` is what the host shows in
|
|
7
|
+
* tooltips and detail cards — defaults to the id when omitted. */
|
|
8
|
+
export interface UserVariantRecord {
|
|
9
|
+
id: string;
|
|
10
|
+
chr: string;
|
|
11
|
+
pos: number;
|
|
12
|
+
label?: string;
|
|
13
|
+
/** Reference allele length in bp; defaults to 1 (SNV). Multi-bp
|
|
14
|
+
* variants span a horizontal line from the anchor marker to the
|
|
15
|
+
* far end of the affected range, same as ClinVar deletions. */
|
|
16
|
+
refLen?: number;
|
|
17
|
+
/** Free-form metadata; surfaced verbatim in host tooltips / detail
|
|
18
|
+
* cards (e.g. the raw input string, REF/ALT, codon impact). */
|
|
19
|
+
meta?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export type UserVariantSource = UserVariantRecord[] | DataSource<ViewportQuery, UserVariantRecord[]>;
|
|
22
|
+
export interface UserVariantTrackConfig {
|
|
23
|
+
id?: string;
|
|
24
|
+
source: UserVariantSource;
|
|
25
|
+
markRadius?: number;
|
|
26
|
+
stackLanePx?: number;
|
|
27
|
+
/** Display label surfaced to the host gutter (and `GutterItem.label`).
|
|
28
|
+
* Defaults to `"User variants"`. */
|
|
29
|
+
label?: string;
|
|
30
|
+
/** Pixels of empty space reserved above the track row in layout.
|
|
31
|
+
* Mirrors {@link Track.gapAbove}; useful when the user-variants
|
|
32
|
+
* row would otherwise sit flush against the track above. */
|
|
33
|
+
gapAbove?: number;
|
|
34
|
+
}
|
|
35
|
+
/** Build a track that renders user-supplied variants as purple crosses
|
|
36
|
+
* along the figure. Internally delegates to {@link clinVarTrack} —
|
|
37
|
+
* same `placeClinVarRecords` projection, same multi-bp span line,
|
|
38
|
+
* same intron-flank-aware truncation, same negative-strand handling.
|
|
39
|
+
* The thin wrapper adapts the data shape at the source boundary and
|
|
40
|
+
* overrides surface methods (`featureLabel`, `resolveFeature`,
|
|
41
|
+
* `toJSON`) so the public API speaks {@link UserVariantRecord}.
|
|
42
|
+
*
|
|
43
|
+
* Slice 34. */
|
|
44
|
+
export declare function userVariantTrack(config: UserVariantTrackConfig): Track<UserVariantTrackConfig, ClinVarTrackData>;
|
|
45
|
+
/** Recover the host-facing record from one loaded by
|
|
46
|
+
* {@link userVariantTrack}. Useful for host renderers (tooltips,
|
|
47
|
+
* detail cards) that consume the track's `data.records` directly
|
|
48
|
+
* rather than going through `resolveFeature`. */
|
|
49
|
+
export declare function userVariantFromRecord(r: ClinVarRecord): UserVariantRecord;
|
|
50
|
+
//# sourceMappingURL=user-variant-track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-variant-track.d.ts","sourceRoot":"","sources":["../../src/tracks/user-variant-track.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B;;;;mEAImE;AACnE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;oEAEgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;oEACgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,iBAAiB,GAC3B,iBAAiB,EAAE,GAAG,UAAU,CAAC,aAAa,EAAE,iBAAiB,EAAE,CAAC,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;yCACqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;iEAE6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAiDD;;;;;;;;gBAQgB;AAChB,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,sBAAsB,GAC7B,KAAK,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CA6CjD;AAED;;;kDAGkD;AAClD,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,aAAa,GAAG,iBAAiB,CAEzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-variant-track.test.d.ts","sourceRoot":"","sources":["../../src/tracks/user-variant-track.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Track, type ViewerVariant } from '../types.js';
|
|
2
|
+
import { type VariantSource } from './variant-track.js';
|
|
3
|
+
export interface VariantSummaryTrackConfig {
|
|
4
|
+
id?: string;
|
|
5
|
+
source: VariantSource;
|
|
6
|
+
/** Track height in px. Default 16. */
|
|
7
|
+
height?: number;
|
|
8
|
+
/** Tick stroke width. Default 1.5 (rendered with non-scaling-stroke). */
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface VariantSummaryTrackData {
|
|
12
|
+
variants: ViewerVariant[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One-row rug-plot summary of a variant set. Each placed variant emits a
|
|
16
|
+
* single short vertical tick in its host exon, coloured by category via the
|
|
17
|
+
* existing {@link variantCategoryColor}. No clustering, no lane packing —
|
|
18
|
+
* dense regions read as a coloured rug at fit-gene, ticks separate at
|
|
19
|
+
* deeper zoom. Designed to slot into a folded `TrackGroup.summaryTrack`
|
|
20
|
+
* so a stacked variant detail track can recover its vertical real estate
|
|
21
|
+
* without losing the "there are variants here" signal. RD-1110.
|
|
22
|
+
*/
|
|
23
|
+
export declare function variantSummaryTrack(config: VariantSummaryTrackConfig): Track<VariantSummaryTrackConfig, VariantSummaryTrackData>;
|
|
24
|
+
//# sourceMappingURL=variant-summary-track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant-summary-track.d.ts","sourceRoot":"","sources":["../../src/tracks/variant-summary-track.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,KAAK,EAKV,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE3E,MAAM,WAAW,yBAAyB;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,CAAC;IACtB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAKD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,yBAAyB,GAChC,KAAK,CAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAyF3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant-summary-track.test.d.ts","sourceRoot":"","sources":["../../src/tracks/variant-summary-track.test.tsx"],"names":[],"mappings":""}
|