@weng-lab/genomebrowser 1.3.0 → 1.4.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 CHANGED
@@ -1,7 +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.
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,211 +1,211 @@
1
- # Genome Browser
2
-
3
- A powerful, interactive React-based genome browser for visualizing genomic data. Built with TypeScript, Vite, and modern web technologies.
4
-
5
- ## Features
6
-
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
16
-
17
- ## Installation
18
-
19
- ```bash
20
- npm install @weng-lab/genomebrowser
21
- ```
22
-
23
- ```bash
24
- yarn add @weng-lab/genomebrowser
25
- ```
26
-
27
- ```bash
28
- pnpm add @weng-lab/genomebrowser
29
- ```
30
-
31
- ## Quick Start
32
-
33
- ```tsx
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
-
75
- ```
76
-
77
- ## Browser Configuration
78
-
79
- ### State Example
80
-
81
- ```tsx
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
- };
100
- ```
101
-
102
- ## Track Examples
103
-
104
- ### BigWig Tracks
105
-
106
- Display continuous signal data (e.g., ChIP-seq, RNA-seq signals).
107
-
108
- ```tsx
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",
117
- }
118
- ```
119
-
120
- ### BigBed Tracks
121
-
122
- Display discrete genomic regions (e.g., peaks, annotations).
123
-
124
- ```tsx
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
136
- }
137
- ```
138
-
139
- ### BulkBed Tracks
140
-
141
- Display multiple BigBed datasets in a single track.
142
-
143
- ```tsx
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
- ],
156
- }
157
- ```
158
-
159
- ### Transcript Tracks
160
-
161
- Display gene annotations and transcripts.
162
-
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
173
- }
174
- ```
175
-
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.
1
+ # Genome Browser
2
+
3
+ A powerful, interactive React-based genome browser for visualizing genomic data. Built with TypeScript, Vite, and modern web technologies.
4
+
5
+ ## Features
6
+
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
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @weng-lab/genomebrowser
21
+ ```
22
+
23
+ ```bash
24
+ yarn add @weng-lab/genomebrowser
25
+ ```
26
+
27
+ ```bash
28
+ pnpm add @weng-lab/genomebrowser
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ```tsx
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
+
75
+ ```
76
+
77
+ ## Browser Configuration
78
+
79
+ ### State Example
80
+
81
+ ```tsx
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
+ };
100
+ ```
101
+
102
+ ## Track Examples
103
+
104
+ ### BigWig Tracks
105
+
106
+ Display continuous signal data (e.g., ChIP-seq, RNA-seq signals).
107
+
108
+ ```tsx
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",
117
+ }
118
+ ```
119
+
120
+ ### BigBed Tracks
121
+
122
+ Display discrete genomic regions (e.g., peaks, annotations).
123
+
124
+ ```tsx
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
136
+ }
137
+ ```
138
+
139
+ ### BulkBed Tracks
140
+
141
+ Display multiple BigBed datasets in a single track.
142
+
143
+ ```tsx
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
+ ],
156
+ }
157
+ ```
158
+
159
+ ### Transcript Tracks
160
+
161
+ Display gene annotations and transcripts.
162
+
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
173
+ }
174
+ ```
175
+
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.
@@ -7,7 +7,6 @@ export interface QueryExecutors {
7
7
  fetchImportance: LazyQueryExecFunction<unknown, OperationVariables>;
8
8
  fetchBulkBed: LazyQueryExecFunction<unknown, OperationVariables>;
9
9
  fetchMethylC: LazyQueryExecFunction<unknown, OperationVariables>;
10
- fetchLD: LazyQueryExecFunction<unknown, OperationVariables>;
11
10
  }
12
11
  /**
13
12
  * Execute all queries concurrently based on built requests
@@ -1,13 +1,12 @@
1
1
  import { Domain } from '../utils/types';
2
2
  import { Track } from '../store/trackStore';
3
- import { BigRequest, TranscriptRequest, MotifRequest, LDRequest } from './apiTypes';
3
+ import { BigRequest, TranscriptRequest, MotifRequest } from './apiTypes';
4
4
  export interface AllRequests {
5
5
  bigRequests: BigRequest[];
6
6
  transcriptRequest?: TranscriptRequest;
7
7
  motifRequest?: MotifRequest;
8
8
  importanceRequests: BigRequest[];
9
9
  bulkBedRequests: BigRequest[];
10
- ldRequest?: LDRequest;
11
10
  methylCRequest?: BigRequest[];
12
11
  }
13
12
  /**
@@ -34,7 +33,6 @@ export declare function buildImportanceRequests(tracks: Track[], currentDomain:
34
33
  /**
35
34
  * Build LD request for given tracks (first LD track found)
36
35
  */
37
- export declare function buildLDRequest(tracks: Track[], _: Domain): LDRequest | undefined;
38
36
  export declare function buildMethylCRequest(tracks: Track[], domain: Domain, preRenderedWidth: number): BigRequest[] | undefined;
39
37
  /**
40
38
  * Build all requests for all track types in one coordinated call
@@ -1,7 +1,6 @@
1
1
  import { Config, TrackDimensions, TrackType } from '../types';
2
2
  export interface LDTrackConfig extends Config<any> {
3
3
  trackType: TrackType.LDTrack;
4
- study: string[];
5
4
  show?: string[];
6
5
  }
7
6
  export type LDProps = {