@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.
Files changed (206) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +181 -94
  3. package/dist/api/DataFetcher.d.ts +2 -0
  4. package/dist/api/apiTypes.d.ts +61 -0
  5. package/dist/{components/tracks/ld → api}/queries.d.ts +6 -2
  6. package/dist/api/queryExecutor.d.ts +14 -0
  7. package/dist/api/requestBuilder.d.ts +40 -0
  8. package/dist/api/resultsProcessor.d.ts +26 -0
  9. package/dist/components/browser/browser.d.ts +8 -9
  10. package/dist/components/browser/svgWrapper.d.ts +2 -8
  11. package/dist/components/contextMenu/contextMenu.d.ts +1 -0
  12. package/dist/components/highlight/highlights.d.ts +1 -0
  13. package/dist/components/highlight/types.d.ts +9 -0
  14. package/dist/components/modal/bigWig/range.d.ts +6 -0
  15. package/dist/components/modal/bulkbed/datasetList.d.ts +4 -0
  16. package/dist/components/modal/bulkbed/gap.d.ts +4 -0
  17. package/dist/components/modal/modal.d.ts +3 -1
  18. package/dist/components/modal/{forms/universalForm.d.ts → shared/base.d.ts} +2 -2
  19. package/dist/components/modal/shared/display.d.ts +5 -0
  20. package/dist/components/modal/shared/download.d.ts +15 -0
  21. package/dist/components/modal/{forms → shared}/form.d.ts +2 -1
  22. package/dist/components/modal/shared/height.d.ts +4 -0
  23. package/dist/components/modal/shared/value.d.ts +5 -0
  24. package/dist/components/modal/transcript/geneName.d.ts +4 -0
  25. package/dist/components/modal/transcript/version.d.ts +13 -0
  26. package/dist/components/tooltip/defaultTooltip.d.ts +3 -0
  27. package/dist/components/tooltip/tooltip.d.ts +1 -4
  28. package/dist/components/tracks/bigbed/dense.d.ts +2 -22
  29. package/dist/components/tracks/bigbed/{utils.d.ts → helpers.d.ts} +7 -0
  30. package/dist/components/tracks/bigbed/squish.d.ts +2 -28
  31. package/dist/components/tracks/bigbed/types.d.ts +20 -0
  32. package/dist/components/tracks/bigwig/dense.d.ts +1 -7
  33. package/dist/components/tracks/bigwig/full.d.ts +1 -7
  34. package/dist/components/tracks/bigwig/helpers.d.ts +26 -0
  35. package/dist/components/tracks/bigwig/types.d.ts +59 -29
  36. package/dist/components/tracks/bulkbed/bulkbed.d.ts +2 -0
  37. package/dist/components/tracks/bulkbed/types.d.ts +34 -0
  38. package/dist/components/tracks/displayTrack.d.ts +5 -0
  39. package/dist/components/tracks/importance/{utils.d.ts → helpers.d.ts} +11 -15
  40. package/dist/components/tracks/importance/importance.d.ts +2 -32
  41. package/dist/components/tracks/importance/letter.d.ts +2 -3
  42. package/dist/components/tracks/importance/types.d.ts +29 -0
  43. package/dist/components/tracks/ldtrack/types.d.ts +6 -0
  44. package/dist/components/tracks/motif/defaultMotifTooltip.d.ts +3 -0
  45. package/dist/components/tracks/motif/dense.d.ts +1 -3
  46. package/dist/components/tracks/motif/helpers.d.ts +3 -0
  47. package/dist/components/tracks/motif/squish.d.ts +1 -3
  48. package/dist/components/tracks/motif/types.d.ts +26 -30
  49. package/dist/components/tracks/ruler/ruler.d.ts +2 -9
  50. package/dist/components/tracks/ruler/selectRegion.d.ts +1 -0
  51. package/dist/components/tracks/transcript/helper.d.ts +25 -0
  52. package/dist/components/tracks/transcript/pack.d.ts +2 -0
  53. package/dist/components/tracks/transcript/squish.d.ts +3 -0
  54. package/dist/components/tracks/transcript/types.d.ts +68 -0
  55. package/dist/components/tracks/types.d.ts +30 -106
  56. package/dist/components/{gqlWrapper.d.ts → tracks/wrapper/dragTrack.d.ts} +2 -2
  57. package/dist/components/tracks/wrapper/margin.d.ts +10 -0
  58. package/dist/components/tracks/wrapper/swapTrack.d.ts +7 -0
  59. package/dist/components/tracks/wrapper/wrapper.d.ts +8 -0
  60. package/dist/genomebrowser.es.js +15124 -0
  61. package/dist/genomebrowser.es.js.map +1 -0
  62. package/dist/hooks/useBrowserScale.d.ts +2 -0
  63. package/dist/hooks/useDebounce.d.ts +2 -0
  64. package/dist/hooks/useInteraction.d.ts +21 -0
  65. package/dist/hooks/useRowHeight.d.ts +1 -0
  66. package/dist/hooks/useXTransform.d.ts +4 -0
  67. package/dist/{components/icons/error.d.ts → icons/errorIcon.d.ts} +6 -4
  68. package/dist/icons/loadingSpinner.d.ts +10 -0
  69. package/dist/icons/refresh.d.ts +1 -0
  70. package/dist/lib.d.ts +26 -27
  71. package/dist/store/BrowserContext.d.ts +30 -0
  72. package/dist/store/browserStore.d.ts +38 -0
  73. package/dist/store/contextMenuStore.d.ts +13 -0
  74. package/dist/store/dataStore.d.ts +12 -0
  75. package/dist/store/modalStore.d.ts +16 -0
  76. package/dist/store/themeStore.d.ts +11 -0
  77. package/dist/store/tooltipStore.d.ts +17 -0
  78. package/dist/store/trackStore.d.ts +34 -0
  79. package/dist/utils/{colors.d.ts → color.d.ts} +2 -8
  80. package/dist/utils/coordinates.d.ts +8 -38
  81. package/dist/utils/download.d.ts +10 -11
  82. package/dist/utils/svg.d.ts +3 -2
  83. package/dist/utils/types.d.ts +3 -16
  84. package/package.json +44 -75
  85. package/dist/components/browser/domainHighlight.d.ts +0 -5
  86. package/dist/components/browser/gqltracks.d.ts +0 -13
  87. package/dist/components/browser/index.d.ts +0 -2
  88. package/dist/components/browser/menuWrapper.d.ts +0 -16
  89. package/dist/components/browser/selectRegion.d.ts +0 -12
  90. package/dist/components/browser/stacked.d.ts +0 -8
  91. package/dist/components/browser/stackedtracks.d.ts +0 -8
  92. package/dist/components/browser/types.d.ts +0 -55
  93. package/dist/components/browser/utils.d.ts +0 -1
  94. package/dist/components/context/browserContext.d.ts +0 -153
  95. package/dist/components/context/domainContext.d.ts +0 -8
  96. package/dist/components/context/providers.d.ts +0 -22
  97. package/dist/components/controls/controls.d.ts +0 -14
  98. package/dist/components/controls/index.d.ts +0 -4
  99. package/dist/components/controls/inputregion.d.ts +0 -13
  100. package/dist/components/controls/shiftbutton.d.ts +0 -11
  101. package/dist/components/controls/types.d.ts +0 -16
  102. package/dist/components/controls/zoombutton.d.ts +0 -13
  103. package/dist/components/cytobands/centromere.d.ts +0 -4
  104. package/dist/components/cytobands/cytoband.d.ts +0 -4
  105. package/dist/components/cytobands/cytobands.d.ts +0 -4
  106. package/dist/components/cytobands/gqlcytoband.d.ts +0 -7
  107. package/dist/components/cytobands/highlight.d.ts +0 -4
  108. package/dist/components/cytobands/index.d.ts +0 -3
  109. package/dist/components/cytobands/shorthighlight.d.ts +0 -4
  110. package/dist/components/cytobands/types.d.ts +0 -61
  111. package/dist/components/icons/index.d.ts +0 -3
  112. package/dist/components/icons/spinner.d.ts +0 -9
  113. package/dist/components/icons/types.d.ts +0 -12
  114. package/dist/components/magnification/index.d.ts +0 -2
  115. package/dist/components/magnification/magnification.d.ts +0 -13
  116. package/dist/components/menu/browserContextMenu.d.ts +0 -10
  117. package/dist/components/menu/contextMenu.d.ts +0 -6
  118. package/dist/components/menu/types.d.ts +0 -22
  119. package/dist/components/modal/forms/downloadForm.d.ts +0 -4
  120. package/dist/components/modal/forms/heightForm.d.ts +0 -4
  121. package/dist/components/modal/forms/rangeForm.d.ts +0 -5
  122. package/dist/components/modal/forms/transcriptForm.d.ts +0 -4
  123. package/dist/components/modal/styles.d.ts +0 -38
  124. package/dist/components/tooltip/tooltipcontext.d.ts +0 -4
  125. package/dist/components/tooltip/types.d.ts +0 -20
  126. package/dist/components/tracks/bam/bam.d.ts +0 -23
  127. package/dist/components/tracks/bam/dense.d.ts +0 -4
  128. package/dist/components/tracks/bam/index.d.ts +0 -4
  129. package/dist/components/tracks/bam/squish.d.ts +0 -9
  130. package/dist/components/tracks/bam/types.d.ts +0 -37
  131. package/dist/components/tracks/bam/utils.d.ts +0 -9
  132. package/dist/components/tracks/bigbed/bigbed.d.ts +0 -37
  133. package/dist/components/tracks/bigbed/index.d.ts +0 -4
  134. package/dist/components/tracks/bigbed/tooltip.d.ts +0 -4
  135. package/dist/components/tracks/bigwig/bigwig.d.ts +0 -38
  136. package/dist/components/tracks/bigwig/index.d.ts +0 -4
  137. package/dist/components/tracks/bigwig/utils.d.ts +0 -50
  138. package/dist/components/tracks/empty/empty.d.ts +0 -4
  139. package/dist/components/tracks/empty/index.d.ts +0 -2
  140. package/dist/components/tracks/empty/types.d.ts +0 -11
  141. package/dist/components/tracks/importance/importanceTrack.d.ts +0 -62
  142. package/dist/components/tracks/importance/index.d.ts +0 -4
  143. package/dist/components/tracks/index.d.ts +0 -9
  144. package/dist/components/tracks/ld/graphqlldtrack.d.ts +0 -4
  145. package/dist/components/tracks/ld/index.d.ts +0 -4
  146. package/dist/components/tracks/ld/ld.d.ts +0 -33
  147. package/dist/components/tracks/ld/ldtrack.d.ts +0 -4
  148. package/dist/components/tracks/ld/types.d.ts +0 -76
  149. package/dist/components/tracks/ld/utils.d.ts +0 -3
  150. package/dist/components/tracks/link/index.d.ts +0 -4
  151. package/dist/components/tracks/link/linktrack.d.ts +0 -9
  152. package/dist/components/tracks/link/simplelinktrack.d.ts +0 -9
  153. package/dist/components/tracks/link/types.d.ts +0 -38
  154. package/dist/components/tracks/link/utils.d.ts +0 -5
  155. package/dist/components/tracks/manhattan/full.d.ts +0 -25
  156. package/dist/components/tracks/manhattan/index.d.ts +0 -3
  157. package/dist/components/tracks/manhattan/tooltip.d.ts +0 -4
  158. package/dist/components/tracks/manhattan/types.d.ts +0 -14
  159. package/dist/components/tracks/manhattan/utils.d.ts +0 -8
  160. package/dist/components/tracks/motif/index.d.ts +0 -4
  161. package/dist/components/tracks/motif/motif.d.ts +0 -33
  162. package/dist/components/tracks/motif/utils.d.ts +0 -9
  163. package/dist/components/tracks/ruler/index.d.ts +0 -5
  164. package/dist/components/tracks/ruler/types.d.ts +0 -7
  165. package/dist/components/tracks/ruler/wrapped.d.ts +0 -15
  166. package/dist/components/tracks/trackset/bamtrack.d.ts +0 -4
  167. package/dist/components/tracks/trackset/customtrack.d.ts +0 -1
  168. package/dist/components/tracks/trackset/deducetype.d.ts +0 -6
  169. package/dist/components/tracks/trackset/graphqlset.d.ts +0 -4
  170. package/dist/components/tracks/trackset/index.d.ts +0 -6
  171. package/dist/components/tracks/trackset/motiftrack.d.ts +0 -4
  172. package/dist/components/tracks/trackset/queries.d.ts +0 -2
  173. package/dist/components/tracks/trackset/resttrackset.d.ts +0 -4
  174. package/dist/components/tracks/trackset/types.d.ts +0 -107
  175. package/dist/components/tracks/trackset/utils.d.ts +0 -4
  176. package/dist/components/tracks/transcripts/index.d.ts +0 -4
  177. package/dist/components/tracks/transcripts/pack.d.ts +0 -8
  178. package/dist/components/tracks/transcripts/queries.d.ts +0 -3
  179. package/dist/components/tracks/transcripts/squish.d.ts +0 -9
  180. package/dist/components/tracks/transcripts/transcript.d.ts +0 -36
  181. package/dist/components/tracks/transcripts/types.d.ts +0 -75
  182. package/dist/components/tracks/transcripts/utils.d.ts +0 -38
  183. package/dist/components/tracks/wrapped/dragTrack.d.ts +0 -7
  184. package/dist/components/tracks/wrapped/hoverRect.d.ts +0 -5
  185. package/dist/components/tracks/wrapped/index.d.ts +0 -3
  186. package/dist/components/tracks/wrapped/margin.d.ts +0 -5
  187. package/dist/components/tracks/wrapped/swapTrack.d.ts +0 -9
  188. package/dist/components/tracks/wrapped/types.d.ts +0 -44
  189. package/dist/components/tracks/wrapped/wrapped.d.ts +0 -10
  190. package/dist/gbc.cjs.js +0 -327
  191. package/dist/gbc.cjs.js.map +0 -1
  192. package/dist/gbc.es.js +0 -16826
  193. package/dist/gbc.es.js.map +0 -1
  194. package/dist/gbc.umd.js +0 -327
  195. package/dist/gbc.umd.js.map +0 -1
  196. package/dist/hooks/useBrowserState.d.ts +0 -10
  197. package/dist/hooks/useInput.d.ts +0 -5
  198. package/dist/hooks/useModal.d.ts +0 -10
  199. package/dist/hooks/useTooltip.d.ts +0 -6
  200. package/dist/pages/main.d.ts +0 -1
  201. package/dist/pages/trackExamples.d.ts +0 -7
  202. package/dist/utils/index.d.ts +0 -2
  203. package/dist/utils/react.d.ts +0 -2
  204. /package/dist/components/{clipPath → svg}/clipPath.d.ts +0 -0
  205. /package/dist/{components/icons/settings.d.ts → icons/settingsIcon.d.ts} +0 -0
  206. /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 Component Library
1
+ # Genome Browser
2
2
 
3
- ## Installation
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
- `npm install @weng-lab/genomebrowser`
5
+ ## Features
7
6
 
8
- ## Usage
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
- The library revolves around creating tracks and adding them to the browser. To do this, first you import the Genome Browser component, creating the browser state and dispatch function, and adding your tracks to the state. Then you pass the state and dispatch function to the GenomeBrowser component as props.
17
+ ## Installation
11
18
 
12
- ### Walkthrough
13
- First, import the Genome Browser component:
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
- ```tsx
20
- import { useBrowserState } from '@weng-lab/genomebrowser';
21
- const [browserState, browserDispatch] = useBrowserState({
22
- domain: { chromosome: "chr11", start: 5220000, end: 5420000 },
23
- preRenderedWidth: 1350,
24
- width: 1500,
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
- There are a few ways to add tracks to the browser.
31
- 1. You can add a track by dispatching the `ADD_TRACK` action:
31
+ ## Quick Start
32
+
32
33
  ```tsx
33
- import { BigWigTrackProps } from '@weng-lab/genomebrowser';
34
- const myBigWig: BigWigTrackProps = { ... }
35
- browserDispatch({ type: BrowserActionType.ADD_TRACK, track: myBigWig });
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
- 2. You can add a track by passing a track component as a child to the GenomeBrowser component:
76
+
77
+ ## Browser Configuration
78
+
79
+ ### State Example
80
+
38
81
  ```tsx
39
- import { BigBedTrack } from '@weng-lab/genomebrowser';
40
- <GenomeBrowser browserState={browserState} browserDispatch={browserDispatch}>
41
- <BigBedTrack ... />
42
- </GenomeBrowser>
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
- 3. You can also add a track by appending it to the 'tracks' array in the browser state:
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
- import { BigWigTrackProps, BrowserState } from '@weng-lab/genomebrowser';
47
- const myBigWig: BigWigTrackProps = { ... }
48
- const myState: BrowserState = {
49
- domain: { chromosome: "chr11", start: 5220000, end: 5420000 },
50
- ... // initialize the rest of the state
51
- tracks: [myBigWig] // add the track to the state
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
- ## Full Example
120
+ ### BigBed Tracks
121
+
122
+ Display discrete genomic regions (e.g., peaks, annotations).
56
123
 
57
124
  ```tsx
58
- // in trackExamples.ts
59
- export const bigWigExample: BigWigTrackProps = {
60
- ...DefaultBigWig,
61
- id: "1",
62
- title: "bigwig",
63
- height: 100,
64
- url: "https://downloads.wenglab.org/DNAse_All_ENCODE_MAR20_2024_merged.bw",
65
- color: "blue"
66
- }
67
- export const bigBedExample: BigBedTrackProps = {
68
- ...DefaultBigBed,
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
- // in main.tsx
91
- import { useEffect } from 'react'
92
- import {
93
- GenomeBrowser, BrowserState, BrowserActionType, useBrowserState,
94
- BigBedTrack
95
- } from '../lib'
96
- import { bigWigExample, bigBedExample, transcriptExample } from './trackExamples'
97
-
98
- const defaultState: BrowserState = {
99
- domain: { chromosome: "chr11", start: 5220000, end: 5420000 },
100
- preRenderedWidth: 1350,
101
- width: 1500,
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
- function Main() {
108
- const [browserState, browserDispatch] = useBrowserState(defaultState)
159
+ ### Transcript Tracks
109
160
 
110
- useEffect(() => {
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
- return (
116
- <GenomeBrowser browserState={browserState} browserDispatch={browserDispatch}>
117
- <BigBedTrack {...bigBedExample} /> // add a BigBed track to the browser
118
- </GenomeBrowser>
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
- The browser will look something like this:
124
- ![Browser Example](https://github.com/weng-lab/genomebrowser-components/blob/master/image.png)
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,2 @@
1
+ declare function DataFetcher(): null;
2
+ export default DataFetcher;
@@ -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
- import { Population } from './types';
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 { BrowserAction, BrowserState } from '../context/browserContext';
2
- import { default as React } from 'react';
3
- declare function GenomeBrowser({ children, width, browserState, browserDispatch }: {
4
- children?: React.ReactNode;
5
- width: number | string;
6
- browserState: BrowserState;
7
- browserDispatch: React.Dispatch<BrowserAction>;
8
- }): import("react/jsx-runtime").JSX.Element;
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
- interface SvgWrapperProps {
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;
@@ -0,0 +1,9 @@
1
+ export interface Highlight {
2
+ id: string;
3
+ domain: {
4
+ chromosome?: string;
5
+ start: number;
6
+ end: number;
7
+ };
8
+ color: string;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { YRange } from '../../tracks/bigwig/types';
2
+ export default function Range({ id, defaultRange, customRange, }: {
3
+ id: string;
4
+ defaultRange: YRange | undefined;
5
+ customRange: YRange | undefined;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { BulkBedDataset } from '../../tracks/bulkbed/types';
2
+ export default function DatasetList({ datasets }: {
3
+ datasets: BulkBedDataset[];
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function Gap({ id, defaultGap }: {
2
+ id: string;
3
+ defaultGap: number;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,4 @@
1
- export default function TrackModal(): import('react').ReactPortal | null;
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;
@@ -1,4 +1,4 @@
1
- import { TrackProps } from '../../tracks/types';
1
+ import { Track } from '../../../store/trackStore';
2
2
  export default function UniversalForm({ track }: {
3
- track: TrackProps;
3
+ track: Track;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { TrackType } from '../../tracks/types';
2
+ export default function Display({ id, trackType }: {
3
+ id: string;
4
+ trackType: TrackType;
5
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -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;
@@ -1,3 +1,4 @@
1
- export default function Form({ children }: {
1
+ export default function Form({ title, children }: {
2
+ title: string;
2
3
  children: React.ReactNode;
3
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function Height({ id, defaultHeight }: {
2
+ id: string;
3
+ defaultHeight: number;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export default function Value({ defaultValue, validate, callback, }: {
2
+ defaultValue: number;
3
+ validate: (value: string) => string | undefined;
4
+ callback: (value: string) => void;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function GeneName({ id, name }: {
2
+ id: string;
3
+ name: string;
4
+ }): 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;
@@ -0,0 +1,3 @@
1
+ export default function DefaultTooltip({ value }: {
2
+ value: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1 @@
1
- import { default as React, PropsWithChildren } from 'react';
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;