@weng-lab/genomebrowser 0.0.24 → 1.0.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 +7 -0
- package/README.md +181 -94
- package/dist/api/DataFetcher.d.ts +2 -0
- package/dist/api/apiTypes.d.ts +61 -0
- package/dist/{components/tracks/ld → api}/queries.d.ts +6 -2
- package/dist/api/queryExecutor.d.ts +14 -0
- package/dist/api/requestBuilder.d.ts +40 -0
- package/dist/api/resultsProcessor.d.ts +26 -0
- package/dist/components/browser/browser.d.ts +8 -9
- package/dist/components/browser/svgWrapper.d.ts +2 -8
- package/dist/components/contextMenu/contextMenu.d.ts +1 -0
- package/dist/components/highlight/highlights.d.ts +1 -0
- package/dist/components/highlight/types.d.ts +9 -0
- package/dist/components/modal/bigWig/range.d.ts +6 -0
- package/dist/components/modal/bulkbed/datasetList.d.ts +4 -0
- package/dist/components/modal/bulkbed/gap.d.ts +4 -0
- package/dist/components/modal/modal.d.ts +3 -1
- package/dist/components/modal/{forms/universalForm.d.ts → shared/base.d.ts} +2 -2
- package/dist/components/modal/shared/display.d.ts +5 -0
- package/dist/components/modal/shared/download.d.ts +15 -0
- package/dist/components/modal/{forms → shared}/form.d.ts +2 -1
- package/dist/components/modal/shared/height.d.ts +4 -0
- package/dist/components/modal/shared/value.d.ts +5 -0
- package/dist/components/modal/transcript/geneName.d.ts +4 -0
- package/dist/components/modal/transcript/version.d.ts +13 -0
- package/dist/components/tooltip/defaultTooltip.d.ts +3 -0
- package/dist/components/tooltip/tooltip.d.ts +1 -4
- package/dist/components/tracks/bigbed/dense.d.ts +2 -22
- package/dist/components/tracks/bigbed/{utils.d.ts → helpers.d.ts} +7 -0
- package/dist/components/tracks/bigbed/squish.d.ts +2 -28
- package/dist/components/tracks/bigbed/types.d.ts +20 -0
- package/dist/components/tracks/bigwig/dense.d.ts +1 -7
- package/dist/components/tracks/bigwig/full.d.ts +1 -7
- package/dist/components/tracks/bigwig/helpers.d.ts +26 -0
- package/dist/components/tracks/bigwig/types.d.ts +59 -29
- package/dist/components/tracks/bulkbed/bulkbed.d.ts +2 -0
- package/dist/components/tracks/bulkbed/types.d.ts +34 -0
- package/dist/components/tracks/displayTrack.d.ts +5 -0
- package/dist/components/tracks/importance/{utils.d.ts → helpers.d.ts} +11 -15
- package/dist/components/tracks/importance/importance.d.ts +2 -32
- package/dist/components/tracks/importance/letter.d.ts +2 -3
- package/dist/components/tracks/importance/types.d.ts +29 -0
- package/dist/components/tracks/ldtrack/types.d.ts +6 -0
- package/dist/components/tracks/motif/defaultMotifTooltip.d.ts +3 -0
- package/dist/components/tracks/motif/dense.d.ts +1 -3
- package/dist/components/tracks/motif/helpers.d.ts +3 -0
- package/dist/components/tracks/motif/squish.d.ts +1 -3
- package/dist/components/tracks/motif/types.d.ts +26 -30
- package/dist/components/tracks/ruler/ruler.d.ts +2 -9
- package/dist/components/tracks/ruler/selectRegion.d.ts +1 -0
- package/dist/components/tracks/transcript/helper.d.ts +25 -0
- package/dist/components/tracks/transcript/pack.d.ts +2 -0
- package/dist/components/tracks/transcript/squish.d.ts +3 -0
- package/dist/components/tracks/transcript/types.d.ts +68 -0
- package/dist/components/tracks/types.d.ts +30 -106
- package/dist/components/{gqlWrapper.d.ts → tracks/wrapper/dragTrack.d.ts} +2 -2
- package/dist/components/tracks/wrapper/margin.d.ts +10 -0
- package/dist/components/tracks/wrapper/swapTrack.d.ts +7 -0
- package/dist/components/tracks/wrapper/wrapper.d.ts +8 -0
- package/dist/genomebrowser.es.js +15124 -0
- package/dist/genomebrowser.es.js.map +1 -0
- package/dist/hooks/useBrowserScale.d.ts +2 -0
- package/dist/hooks/useDebounce.d.ts +2 -0
- package/dist/hooks/useInteraction.d.ts +21 -0
- package/dist/hooks/useRowHeight.d.ts +1 -0
- package/dist/hooks/useXTransform.d.ts +4 -0
- package/dist/{components/icons/error.d.ts → icons/errorIcon.d.ts} +6 -4
- package/dist/icons/loadingSpinner.d.ts +10 -0
- package/dist/icons/refresh.d.ts +1 -0
- package/dist/lib.d.ts +26 -27
- package/dist/store/BrowserContext.d.ts +30 -0
- package/dist/store/browserStore.d.ts +38 -0
- package/dist/store/contextMenuStore.d.ts +13 -0
- package/dist/store/dataStore.d.ts +12 -0
- package/dist/store/modalStore.d.ts +16 -0
- package/dist/store/themeStore.d.ts +11 -0
- package/dist/store/tooltipStore.d.ts +17 -0
- package/dist/store/trackStore.d.ts +34 -0
- package/dist/utils/{colors.d.ts → color.d.ts} +2 -8
- package/dist/utils/coordinates.d.ts +8 -38
- package/dist/utils/download.d.ts +10 -11
- package/dist/utils/svg.d.ts +3 -2
- package/dist/utils/types.d.ts +3 -16
- package/package.json +44 -75
- package/dist/components/browser/domainHighlight.d.ts +0 -5
- package/dist/components/browser/gqltracks.d.ts +0 -13
- package/dist/components/browser/index.d.ts +0 -2
- package/dist/components/browser/menuWrapper.d.ts +0 -16
- package/dist/components/browser/selectRegion.d.ts +0 -12
- package/dist/components/browser/stacked.d.ts +0 -8
- package/dist/components/browser/stackedtracks.d.ts +0 -8
- package/dist/components/browser/types.d.ts +0 -55
- package/dist/components/browser/utils.d.ts +0 -1
- package/dist/components/context/browserContext.d.ts +0 -153
- package/dist/components/context/domainContext.d.ts +0 -8
- package/dist/components/context/providers.d.ts +0 -22
- package/dist/components/controls/controls.d.ts +0 -14
- package/dist/components/controls/index.d.ts +0 -4
- package/dist/components/controls/inputregion.d.ts +0 -13
- package/dist/components/controls/shiftbutton.d.ts +0 -11
- package/dist/components/controls/types.d.ts +0 -16
- package/dist/components/controls/zoombutton.d.ts +0 -13
- package/dist/components/cytobands/centromere.d.ts +0 -4
- package/dist/components/cytobands/cytoband.d.ts +0 -4
- package/dist/components/cytobands/cytobands.d.ts +0 -4
- package/dist/components/cytobands/gqlcytoband.d.ts +0 -7
- package/dist/components/cytobands/highlight.d.ts +0 -4
- package/dist/components/cytobands/index.d.ts +0 -3
- package/dist/components/cytobands/shorthighlight.d.ts +0 -4
- package/dist/components/cytobands/types.d.ts +0 -61
- package/dist/components/icons/index.d.ts +0 -3
- package/dist/components/icons/spinner.d.ts +0 -9
- package/dist/components/icons/types.d.ts +0 -12
- package/dist/components/magnification/index.d.ts +0 -2
- package/dist/components/magnification/magnification.d.ts +0 -13
- package/dist/components/menu/browserContextMenu.d.ts +0 -10
- package/dist/components/menu/contextMenu.d.ts +0 -6
- package/dist/components/menu/types.d.ts +0 -22
- package/dist/components/modal/forms/downloadForm.d.ts +0 -4
- package/dist/components/modal/forms/heightForm.d.ts +0 -4
- package/dist/components/modal/forms/rangeForm.d.ts +0 -5
- package/dist/components/modal/forms/transcriptForm.d.ts +0 -4
- package/dist/components/modal/styles.d.ts +0 -38
- package/dist/components/tooltip/tooltipcontext.d.ts +0 -4
- package/dist/components/tooltip/types.d.ts +0 -20
- package/dist/components/tracks/bam/bam.d.ts +0 -23
- package/dist/components/tracks/bam/dense.d.ts +0 -4
- package/dist/components/tracks/bam/index.d.ts +0 -4
- package/dist/components/tracks/bam/squish.d.ts +0 -9
- package/dist/components/tracks/bam/types.d.ts +0 -37
- package/dist/components/tracks/bam/utils.d.ts +0 -9
- package/dist/components/tracks/bigbed/bigbed.d.ts +0 -37
- package/dist/components/tracks/bigbed/index.d.ts +0 -4
- package/dist/components/tracks/bigbed/tooltip.d.ts +0 -4
- package/dist/components/tracks/bigwig/bigwig.d.ts +0 -38
- package/dist/components/tracks/bigwig/index.d.ts +0 -4
- package/dist/components/tracks/bigwig/utils.d.ts +0 -50
- package/dist/components/tracks/empty/empty.d.ts +0 -4
- package/dist/components/tracks/empty/index.d.ts +0 -2
- package/dist/components/tracks/empty/types.d.ts +0 -11
- package/dist/components/tracks/importance/importanceTrack.d.ts +0 -62
- package/dist/components/tracks/importance/index.d.ts +0 -4
- package/dist/components/tracks/index.d.ts +0 -9
- package/dist/components/tracks/ld/graphqlldtrack.d.ts +0 -4
- package/dist/components/tracks/ld/index.d.ts +0 -4
- package/dist/components/tracks/ld/ld.d.ts +0 -33
- package/dist/components/tracks/ld/ldtrack.d.ts +0 -4
- package/dist/components/tracks/ld/types.d.ts +0 -76
- package/dist/components/tracks/ld/utils.d.ts +0 -3
- package/dist/components/tracks/link/index.d.ts +0 -4
- package/dist/components/tracks/link/linktrack.d.ts +0 -9
- package/dist/components/tracks/link/simplelinktrack.d.ts +0 -9
- package/dist/components/tracks/link/types.d.ts +0 -38
- package/dist/components/tracks/link/utils.d.ts +0 -5
- package/dist/components/tracks/manhattan/full.d.ts +0 -25
- package/dist/components/tracks/manhattan/index.d.ts +0 -3
- package/dist/components/tracks/manhattan/tooltip.d.ts +0 -4
- package/dist/components/tracks/manhattan/types.d.ts +0 -14
- package/dist/components/tracks/manhattan/utils.d.ts +0 -8
- package/dist/components/tracks/motif/index.d.ts +0 -4
- package/dist/components/tracks/motif/motif.d.ts +0 -33
- package/dist/components/tracks/motif/utils.d.ts +0 -9
- package/dist/components/tracks/ruler/index.d.ts +0 -5
- package/dist/components/tracks/ruler/types.d.ts +0 -7
- package/dist/components/tracks/ruler/wrapped.d.ts +0 -15
- package/dist/components/tracks/trackset/bamtrack.d.ts +0 -4
- package/dist/components/tracks/trackset/customtrack.d.ts +0 -1
- package/dist/components/tracks/trackset/deducetype.d.ts +0 -6
- package/dist/components/tracks/trackset/graphqlset.d.ts +0 -4
- package/dist/components/tracks/trackset/index.d.ts +0 -6
- package/dist/components/tracks/trackset/motiftrack.d.ts +0 -4
- package/dist/components/tracks/trackset/queries.d.ts +0 -2
- package/dist/components/tracks/trackset/resttrackset.d.ts +0 -4
- package/dist/components/tracks/trackset/types.d.ts +0 -107
- package/dist/components/tracks/trackset/utils.d.ts +0 -4
- package/dist/components/tracks/transcripts/index.d.ts +0 -4
- package/dist/components/tracks/transcripts/pack.d.ts +0 -8
- package/dist/components/tracks/transcripts/queries.d.ts +0 -3
- package/dist/components/tracks/transcripts/squish.d.ts +0 -9
- package/dist/components/tracks/transcripts/transcript.d.ts +0 -36
- package/dist/components/tracks/transcripts/types.d.ts +0 -75
- package/dist/components/tracks/transcripts/utils.d.ts +0 -38
- package/dist/components/tracks/wrapped/dragTrack.d.ts +0 -7
- package/dist/components/tracks/wrapped/hoverRect.d.ts +0 -5
- package/dist/components/tracks/wrapped/index.d.ts +0 -3
- package/dist/components/tracks/wrapped/margin.d.ts +0 -5
- package/dist/components/tracks/wrapped/swapTrack.d.ts +0 -9
- package/dist/components/tracks/wrapped/types.d.ts +0 -44
- package/dist/components/tracks/wrapped/wrapped.d.ts +0 -10
- package/dist/gbc.cjs.js +0 -327
- package/dist/gbc.cjs.js.map +0 -1
- package/dist/gbc.es.js +0 -16826
- package/dist/gbc.es.js.map +0 -1
- package/dist/gbc.umd.js +0 -327
- package/dist/gbc.umd.js.map +0 -1
- package/dist/hooks/useBrowserState.d.ts +0 -10
- package/dist/hooks/useInput.d.ts +0 -5
- package/dist/hooks/useModal.d.ts +0 -10
- package/dist/hooks/useTooltip.d.ts +0 -6
- package/dist/pages/main.d.ts +0 -1
- package/dist/pages/trackExamples.d.ts +0 -7
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/react.d.ts +0 -2
- /package/dist/components/{clipPath → svg}/clipPath.d.ts +0 -0
- /package/dist/{components/icons/settings.d.ts → icons/settingsIcon.d.ts} +0 -0
- /package/dist/{components/icons/top.d.ts → icons/topIcon.d.ts} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 Weng Lab
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,124 +1,211 @@
|
|
|
1
|
-
# Genome Browser
|
|
1
|
+
# Genome Browser
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`yarn add @weng-lab/genomebrowser`
|
|
3
|
+
A powerful, interactive React-based genome browser for visualizing genomic data. Built with TypeScript, Vite, and modern web technologies.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## Features
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- 🧬 **Multiple Track Types**: BigWig, BigBed, BulkBed, Transcript, Motif, and Importance tracks
|
|
8
|
+
- 🎛️ **Interactive Controls**: Smooth pan and zoom with crisp SVG graphics, drag-and-drop track reordering
|
|
9
|
+
- 🔧 **Customizable**: Configurable colors, heights, display modes, and styling
|
|
10
|
+
- 📊 **Efficient Data Loading**: GraphQL-based API with intelligent batching
|
|
11
|
+
- 🖱️ **Rich Interactions**: Click and hover on genomic features with tooltips and real-time updates
|
|
12
|
+
- 📱 **Responsive**: Works across different screen sizes with consistently sharp graphics
|
|
13
|
+
- ⚡ **Performance**: Optimized rendering with React and Zustand state management
|
|
14
|
+
- 🎨 **SVG-Based**: Uses Scalable Vector Graphics (SVG) for crisp, resolution-independent rendering that scales beautifully
|
|
15
|
+
- 🔍 **Publication Ready**: Export high-quality SVG images suitable for papers and presentations
|
|
9
16
|
|
|
10
|
-
|
|
17
|
+
## Installation
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
```tsx
|
|
15
|
-
import { GenomeBrowser } from '@weng-lab/genomebrowser';
|
|
19
|
+
```bash
|
|
20
|
+
npm install @weng-lab/genomebrowser
|
|
16
21
|
```
|
|
17
|
-
Then you create the browser state and dispatch function with the `useBrowserState` hook:
|
|
18
22
|
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
tracks: [],
|
|
26
|
-
highlights: []
|
|
27
|
-
});
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @weng-lab/genomebrowser
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm add @weng-lab/genomebrowser
|
|
28
29
|
```
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
32
33
|
```tsx
|
|
33
|
-
import
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
import React from "react";
|
|
35
|
+
import { Browser, Track, InitialBrowserState, createBrowserStore, createTrackStore, BrowserStoreInstance } from "@weng-lab/genomebrowser";
|
|
36
|
+
|
|
37
|
+
function GenomeBrowserExample() {
|
|
38
|
+
// Define your tracks
|
|
39
|
+
const initialTracks: Track[] = [...];
|
|
40
|
+
|
|
41
|
+
// Configure initial browser state
|
|
42
|
+
const initialState: InitialBrowserState = {
|
|
43
|
+
domain: {
|
|
44
|
+
chromosome: "chr12",
|
|
45
|
+
start: 53360037,
|
|
46
|
+
end: 53400206,
|
|
47
|
+
},
|
|
48
|
+
marginWidth: 150,
|
|
49
|
+
trackWidth: 1350,
|
|
50
|
+
multiplier: 3, // a multiplier to fetch more data for smooth panning
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Create stores to hold browser data
|
|
54
|
+
const browserStore = createBrowserStore(initialState)
|
|
55
|
+
const trackStore = createTrackStore(initialTracks)
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div style={{ width: "90%", margin: "0 auto" }}>
|
|
59
|
+
<h1>My Genome Browser</h1>
|
|
60
|
+
<DomainDisplay browserStore={browserStore} />
|
|
61
|
+
<Browser browserStore={browserStore} trackStore={trackStore} />
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Use the stores to access information
|
|
67
|
+
function DomainDisplay({browserStore} : {browserStore: BrowserStoreInstance}) {
|
|
68
|
+
// Zustand-like selectors for getting fields and functions
|
|
69
|
+
const domain = browserStore((state) => state.domain)
|
|
70
|
+
return (
|
|
71
|
+
<h1>{domain.chromosome}:{domain.start}-{domain.end}</h1>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
36
75
|
```
|
|
37
|
-
|
|
76
|
+
|
|
77
|
+
## Browser Configuration
|
|
78
|
+
|
|
79
|
+
### State Example
|
|
80
|
+
|
|
38
81
|
```tsx
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
82
|
+
const initialState: InitialBrowserState = {
|
|
83
|
+
domain: {
|
|
84
|
+
chromosome: "chr1",
|
|
85
|
+
start: 1000000,
|
|
86
|
+
end: 2000000,
|
|
87
|
+
},
|
|
88
|
+
marginWidth: 150, // Width of the track margins
|
|
89
|
+
trackWidth: 1350, // Width of the viewable track area
|
|
90
|
+
multiplier: 3, // Data fetching multiplier for smooth panning
|
|
91
|
+
highlights: [
|
|
92
|
+
// Optional: initial highlights
|
|
93
|
+
{
|
|
94
|
+
id: "highlight1",
|
|
95
|
+
color: "#ffaabb",
|
|
96
|
+
domain: { chromosome: "chr1", start: 1500000, end: 1600000 },
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
43
100
|
```
|
|
44
|
-
|
|
101
|
+
|
|
102
|
+
## Track Examples
|
|
103
|
+
|
|
104
|
+
### BigWig Tracks
|
|
105
|
+
|
|
106
|
+
Display continuous signal data (e.g., ChIP-seq, RNA-seq signals).
|
|
107
|
+
|
|
45
108
|
```tsx
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
109
|
+
{
|
|
110
|
+
id: "signal",
|
|
111
|
+
title: "Signal Data",
|
|
112
|
+
trackType: TrackType.BigWig,
|
|
113
|
+
displayMode: DisplayMode.Full, // Multiple display modes supported
|
|
114
|
+
height: 100,
|
|
115
|
+
color: "#3498db",
|
|
116
|
+
url: "https://example.com/signal.bw",
|
|
52
117
|
}
|
|
53
118
|
```
|
|
54
119
|
|
|
55
|
-
|
|
120
|
+
### BigBed Tracks
|
|
121
|
+
|
|
122
|
+
Display discrete genomic regions (e.g., peaks, annotations).
|
|
56
123
|
|
|
57
124
|
```tsx
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
id: "2",
|
|
70
|
-
title: "bigbed",
|
|
71
|
-
height: 75,
|
|
72
|
-
rowHeight: 12,
|
|
73
|
-
color: "red",
|
|
74
|
-
url: "https://downloads.wenglab.org/GRCh38-cCREs.DCC.bigBed"
|
|
75
|
-
}
|
|
76
|
-
export const transcriptExample: TranscriptTrackProps = {
|
|
77
|
-
...DefaultTranscript,
|
|
78
|
-
id: "3",
|
|
79
|
-
title: "transcript",
|
|
80
|
-
rowHeight: 12,
|
|
81
|
-
assembly: "GRCh38",
|
|
82
|
-
queryType: "gene",
|
|
83
|
-
version: TranscriptHumanVersion.V47,
|
|
84
|
-
height: 100,
|
|
85
|
-
color: "green"
|
|
125
|
+
{
|
|
126
|
+
id: "peaks",
|
|
127
|
+
title: "Peak Calls",
|
|
128
|
+
trackType: TrackType.BigBed,
|
|
129
|
+
displayMode: DisplayMode.Dense,
|
|
130
|
+
height: 20,
|
|
131
|
+
color: "#e74c3c",
|
|
132
|
+
url: "https://example.com/peaks.bigBed",
|
|
133
|
+
onClick: (rect) => console.log("Clicked:", rect), // Mouse interactivitiy
|
|
134
|
+
onHover: (rect) => console.log("Hovered:", rect),
|
|
135
|
+
tooltip: (rect) => <text>{rect.name}</text>, // Custom svg tooltips
|
|
86
136
|
}
|
|
87
137
|
```
|
|
88
138
|
|
|
139
|
+
### BulkBed Tracks
|
|
140
|
+
|
|
141
|
+
Display multiple BigBed datasets in a single track.
|
|
142
|
+
|
|
89
143
|
```tsx
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
zoomLevel: 148,
|
|
103
|
-
delta: 0,
|
|
104
|
-
tracks: [bigWigExample] // adds a BigWig track to the state
|
|
144
|
+
{
|
|
145
|
+
id: "bulk-data",
|
|
146
|
+
title: "Multiple Datasets",
|
|
147
|
+
trackType: TrackType.BulkBed,
|
|
148
|
+
displayMode: DisplayMode.Full,
|
|
149
|
+
height: 40,
|
|
150
|
+
gap: 2, // Gap between datasets
|
|
151
|
+
color: "#9b59b6",
|
|
152
|
+
datasets: [
|
|
153
|
+
{ name: "Dataset 1", url: "https://example.com/data1.bigBed" },
|
|
154
|
+
{ name: "Dataset 2", url: "https://example.com/data2.bigBed" },
|
|
155
|
+
],
|
|
105
156
|
}
|
|
157
|
+
```
|
|
106
158
|
|
|
107
|
-
|
|
108
|
-
const [browserState, browserDispatch] = useBrowserState(defaultState)
|
|
159
|
+
### Transcript Tracks
|
|
109
160
|
|
|
110
|
-
|
|
111
|
-
// add a Transcript track to the state
|
|
112
|
-
browserDispatch({ type: BrowserActionType.ADD_TRACK, track: transcriptExample })
|
|
113
|
-
}, [])
|
|
161
|
+
Display gene annotations and transcripts.
|
|
114
162
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
163
|
+
```tsx
|
|
164
|
+
{
|
|
165
|
+
id: "genes",
|
|
166
|
+
title: "Gene Annotations",
|
|
167
|
+
trackType: TrackType.Transcript,
|
|
168
|
+
displayMode: DisplayMode.Squish,
|
|
169
|
+
height: 50,
|
|
170
|
+
color: "#2ecc71",
|
|
171
|
+
assembly: "GRCh38", // "mm10" also supported
|
|
172
|
+
version: 47, // GENCODE version
|
|
120
173
|
}
|
|
121
174
|
```
|
|
122
175
|
|
|
123
|
-
|
|
124
|
-
|
|
176
|
+
Explore our comprehensive [Storybook]() documentation for detailed information about additional track types and their configuration options.
|
|
177
|
+
|
|
178
|
+
## Development
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Install dependencies
|
|
182
|
+
npm install
|
|
183
|
+
|
|
184
|
+
# Start development server
|
|
185
|
+
npm run dev
|
|
186
|
+
|
|
187
|
+
# Run Storybook for component development
|
|
188
|
+
npm run storybook
|
|
189
|
+
|
|
190
|
+
# Build for production
|
|
191
|
+
npm run build
|
|
192
|
+
|
|
193
|
+
# Run linting
|
|
194
|
+
npm run lint
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Contributing
|
|
198
|
+
|
|
199
|
+
1. Fork the repository
|
|
200
|
+
2. Create a feature branch
|
|
201
|
+
3. Make your changes
|
|
202
|
+
4. Add tests if applicable
|
|
203
|
+
5. Submit a pull request
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT License - see LICENSE file for details.
|
|
208
|
+
|
|
209
|
+
## Support
|
|
210
|
+
|
|
211
|
+
For questions and support, please open an issue on GitHub.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All request and response types for the genome browser API
|
|
3
|
+
*/
|
|
4
|
+
export interface BigRequest {
|
|
5
|
+
url: string;
|
|
6
|
+
chr1: string;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
}
|
|
10
|
+
export interface BigResponse {
|
|
11
|
+
bigRequests: {
|
|
12
|
+
data: any;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
export interface TranscriptRequest {
|
|
16
|
+
chromosome: string;
|
|
17
|
+
assembly: string;
|
|
18
|
+
start: number;
|
|
19
|
+
end: number;
|
|
20
|
+
version: number;
|
|
21
|
+
}
|
|
22
|
+
export interface TranscriptResponse {
|
|
23
|
+
gene: any;
|
|
24
|
+
}
|
|
25
|
+
export interface MotifRequest {
|
|
26
|
+
consensus_regex: string;
|
|
27
|
+
peaks_accession: string;
|
|
28
|
+
range: {
|
|
29
|
+
chromosome: string;
|
|
30
|
+
start: number;
|
|
31
|
+
end: number;
|
|
32
|
+
};
|
|
33
|
+
assembly: string;
|
|
34
|
+
prange: {
|
|
35
|
+
chrom: string;
|
|
36
|
+
chrom_start: number;
|
|
37
|
+
chrom_end: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface MotifResponse {
|
|
41
|
+
meme_occurrences: any[];
|
|
42
|
+
peaks: {
|
|
43
|
+
peaks: any[];
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface LDRequest {
|
|
47
|
+
assembly: string;
|
|
48
|
+
coordinates: {
|
|
49
|
+
chromosome: string;
|
|
50
|
+
start: number;
|
|
51
|
+
end: number;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface LDResponse {
|
|
55
|
+
snpQuery: any[];
|
|
56
|
+
}
|
|
57
|
+
export interface MotifRect {
|
|
58
|
+
start: number;
|
|
59
|
+
end: number;
|
|
60
|
+
pwm?: number[][];
|
|
61
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* All GraphQL queries for the genome browser
|
|
3
|
+
*/
|
|
4
|
+
export declare const BIGDATA_QUERY: import('graphql').DocumentNode;
|
|
5
|
+
export declare const TRANSCRIPT_GENES_QUERY: import('graphql').DocumentNode;
|
|
6
|
+
export declare const MOTIF_QUERY: import('graphql').DocumentNode;
|
|
2
7
|
export declare const VARIANT_QUERY = "\n query SNP($assembly: String!, $coordinates: [GenomicRangeInput]) {\n snpQuery(assembly: $assembly, coordinates: $coordinates, common: true) {\n id\n coordinates {\n chromosome\n start\n end\n }\n }\n }\n";
|
|
3
|
-
export declare const LD_QUERY: (populations: Population[]) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AllRequests } from './requestBuilder';
|
|
2
|
+
import { LazyQueryExecFunction, OperationVariables } from '@apollo/client';
|
|
3
|
+
export interface QueryExecutors {
|
|
4
|
+
fetchBigData: LazyQueryExecFunction<unknown, OperationVariables>;
|
|
5
|
+
fetchGene: LazyQueryExecFunction<unknown, OperationVariables>;
|
|
6
|
+
fetchMotif: LazyQueryExecFunction<unknown, OperationVariables>;
|
|
7
|
+
fetchImportance: LazyQueryExecFunction<unknown, OperationVariables>;
|
|
8
|
+
fetchBulkBed: LazyQueryExecFunction<unknown, OperationVariables>;
|
|
9
|
+
fetchSnps: LazyQueryExecFunction<unknown, OperationVariables>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Execute all queries concurrently based on built requests
|
|
13
|
+
*/
|
|
14
|
+
export declare function executeAllQueries(requests: AllRequests, executors: QueryExecutors): Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Domain } from '../utils/types';
|
|
2
|
+
import { Track } from '../store/trackStore';
|
|
3
|
+
import { BigRequest, TranscriptRequest, MotifRequest, LDRequest } from './apiTypes';
|
|
4
|
+
export interface AllRequests {
|
|
5
|
+
bigRequests: BigRequest[];
|
|
6
|
+
transcriptRequest?: TranscriptRequest;
|
|
7
|
+
motifRequest?: MotifRequest;
|
|
8
|
+
importanceRequests: BigRequest[];
|
|
9
|
+
bulkBedRequests: BigRequest[];
|
|
10
|
+
ldRequest?: LDRequest;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build BigWig/BigBed requests for given tracks
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildBigRequests(tracks: Track[], domain: Domain): BigRequest[];
|
|
16
|
+
/**
|
|
17
|
+
* Build BulkBed requests for given tracks
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildBulkBedRequests(tracks: Track[], domain: Domain): BigRequest[];
|
|
20
|
+
/**
|
|
21
|
+
* Build transcript request for given tracks (first transcript track found)
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildTranscriptRequest(tracks: Track[], domain: Domain): TranscriptRequest | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Build motif request for given tracks (first motif track found)
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildMotifRequest(tracks: Track[], domain: Domain): MotifRequest | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Build importance requests for given tracks (first importance track found)
|
|
30
|
+
* Use currentDomain to get only the viewable region (avoids large requests)
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildImportanceRequests(tracks: Track[], currentDomain: Domain): BigRequest[];
|
|
33
|
+
/**
|
|
34
|
+
* Build LD request for given tracks (first LD track found)
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildLDRequest(tracks: Track[], domain: Domain): LDRequest | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Build all requests for all track types in one coordinated call
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildAllRequests(tracks: Track[], expandedDomain: Domain, currentDomain: Domain): AllRequests;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ApolloError } from '@apollo/client';
|
|
2
|
+
import { Track } from '../store/trackStore';
|
|
3
|
+
import { BigResponse, TranscriptResponse, MotifResponse, LDResponse } from './apiTypes';
|
|
4
|
+
export interface QueryResults {
|
|
5
|
+
bigData?: BigResponse;
|
|
6
|
+
geneData?: TranscriptResponse;
|
|
7
|
+
motifData?: MotifResponse;
|
|
8
|
+
importanceData?: BigResponse;
|
|
9
|
+
bulkBedData?: BigResponse;
|
|
10
|
+
snpData?: LDResponse;
|
|
11
|
+
bigError?: ApolloError;
|
|
12
|
+
geneError?: ApolloError;
|
|
13
|
+
motifError?: ApolloError;
|
|
14
|
+
importanceError?: ApolloError;
|
|
15
|
+
bulkBedError?: ApolloError;
|
|
16
|
+
snpError?: ApolloError;
|
|
17
|
+
}
|
|
18
|
+
export interface ProcessedResult {
|
|
19
|
+
trackId: string;
|
|
20
|
+
data: unknown;
|
|
21
|
+
error?: ApolloError;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Process all query results and return organized data for each track
|
|
25
|
+
*/
|
|
26
|
+
export declare function processAllResults(tracks: Track[], results: QueryResults): ProcessedResult[];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export default GenomeBrowser;
|
|
1
|
+
import { BrowserStoreInstance } from '../../store/browserStore';
|
|
2
|
+
import { TrackStoreInstance } from '../../store/trackStore';
|
|
3
|
+
interface BrowserProps {
|
|
4
|
+
browserStore: BrowserStoreInstance;
|
|
5
|
+
trackStore: TrackStoreInstance;
|
|
6
|
+
}
|
|
7
|
+
export default function Browser({ browserStore, trackStore }: BrowserProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
width: number | string;
|
|
3
|
-
innerWidth: number;
|
|
4
|
-
height: number;
|
|
5
|
-
svgRef?: React.RefObject<SVGSVGElement>;
|
|
1
|
+
export default function SvgWrapper({ children }: {
|
|
6
2
|
children: React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export default function SvgWrapper({ width, innerWidth, height, svgRef, children }: SvgWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ContextMenu(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Highlights(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export default function
|
|
1
|
+
export default function Modal(): import("react/jsx-runtime").JSX.Element | null;
|
|
2
2
|
export declare function getTextColor(backgroundColor: string): string;
|
|
3
|
+
export declare function shadeColor(color: string, percent: number): string;
|
|
4
|
+
export declare const isDark: (color: string) => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Track } from '../../../store/trackStore';
|
|
2
|
+
export declare const downloadButtonStyle: {
|
|
3
|
+
cursor: string;
|
|
4
|
+
outline: number;
|
|
5
|
+
color: string;
|
|
6
|
+
borderColor: string;
|
|
7
|
+
border: string;
|
|
8
|
+
borderRadius: string;
|
|
9
|
+
display: string;
|
|
10
|
+
textAlign: "center";
|
|
11
|
+
padding: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function DownloadForm({ track }: {
|
|
14
|
+
track: Track;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TranscriptConfig } from '../../tracks/transcript/types';
|
|
2
|
+
export declare enum TranscriptHumanVersion {
|
|
3
|
+
V29 = 29,
|
|
4
|
+
V40 = 40,
|
|
5
|
+
V47 = 47
|
|
6
|
+
}
|
|
7
|
+
export declare enum TranscriptMouseVersion {
|
|
8
|
+
V21 = 21,
|
|
9
|
+
V25 = 25
|
|
10
|
+
}
|
|
11
|
+
export default function TranscriptForm({ track }: {
|
|
12
|
+
track: TranscriptConfig;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { TooltipProps } from './types';
|
|
3
|
-
declare const Tooltip: React.FC<PropsWithChildren<TooltipProps>>;
|
|
4
|
-
export default Tooltip;
|
|
1
|
+
export default function Tooltip(): import("react/jsx-runtime").JSX.Element | null;
|