@weng-lab/genomebrowser 0.0.22 → 0.0.24
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/README.md +124 -124
- package/dist/components/modal/forms/downloadForm.d.ts +4 -0
- package/dist/components/modal/modal.d.ts +1 -0
- package/dist/components/modal/styles.d.ts +10 -1
- package/dist/components/tracks/types.d.ts +2 -0
- package/dist/gbc.cjs.js +76 -72
- package/dist/gbc.cjs.js.map +1 -1
- package/dist/gbc.es.js +4270 -3835
- package/dist/gbc.es.js.map +1 -1
- package/dist/gbc.umd.js +86 -82
- package/dist/gbc.umd.js.map +1 -1
- package/dist/lib.d.ts +1 -0
- package/dist/utils/download.d.ts +21 -0
- package/package.json +92 -92
package/README.md
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
# Genome Browser Component Library
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
`yarn add @weng-lab/genomebrowser`
|
|
5
|
-
|
|
6
|
-
`npm install @weng-lab/genomebrowser`
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
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.
|
|
11
|
-
|
|
12
|
-
### Walkthrough
|
|
13
|
-
First, import the Genome Browser component:
|
|
14
|
-
```tsx
|
|
15
|
-
import { GenomeBrowser } from '@weng-lab/genomebrowser';
|
|
16
|
-
```
|
|
17
|
-
Then you create the browser state and dispatch function with the `useBrowserState` hook:
|
|
18
|
-
|
|
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
|
-
});
|
|
28
|
-
```
|
|
29
|
-
|
|
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:
|
|
32
|
-
```tsx
|
|
33
|
-
import { BigWigTrackProps } from '@weng-lab/genomebrowser';
|
|
34
|
-
const myBigWig: BigWigTrackProps = { ... }
|
|
35
|
-
browserDispatch({ type: BrowserActionType.ADD_TRACK, track: myBigWig });
|
|
36
|
-
```
|
|
37
|
-
2. You can add a track by passing a track component as a child to the GenomeBrowser component:
|
|
38
|
-
```tsx
|
|
39
|
-
import { BigBedTrack } from '@weng-lab/genomebrowser';
|
|
40
|
-
<GenomeBrowser browserState={browserState} browserDispatch={browserDispatch}>
|
|
41
|
-
<BigBedTrack ... />
|
|
42
|
-
</GenomeBrowser>
|
|
43
|
-
```
|
|
44
|
-
3. You can also add a track by appending it to the 'tracks' array in the browser state:
|
|
45
|
-
```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
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Full Example
|
|
56
|
-
|
|
57
|
-
```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"
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
```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
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function Main() {
|
|
108
|
-
const [browserState, browserDispatch] = useBrowserState(defaultState)
|
|
109
|
-
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
// add a Transcript track to the state
|
|
112
|
-
browserDispatch({ type: BrowserActionType.ADD_TRACK, track: transcriptExample })
|
|
113
|
-
}, [])
|
|
114
|
-
|
|
115
|
-
return (
|
|
116
|
-
<GenomeBrowser browserState={browserState} browserDispatch={browserDispatch}>
|
|
117
|
-
<BigBedTrack {...bigBedExample} /> // add a BigBed track to the browser
|
|
118
|
-
</GenomeBrowser>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
The browser will look something like this:
|
|
124
|
-

|
|
1
|
+
# Genome Browser Component Library
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
`yarn add @weng-lab/genomebrowser`
|
|
5
|
+
|
|
6
|
+
`npm install @weng-lab/genomebrowser`
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
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.
|
|
11
|
+
|
|
12
|
+
### Walkthrough
|
|
13
|
+
First, import the Genome Browser component:
|
|
14
|
+
```tsx
|
|
15
|
+
import { GenomeBrowser } from '@weng-lab/genomebrowser';
|
|
16
|
+
```
|
|
17
|
+
Then you create the browser state and dispatch function with the `useBrowserState` hook:
|
|
18
|
+
|
|
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
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
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:
|
|
32
|
+
```tsx
|
|
33
|
+
import { BigWigTrackProps } from '@weng-lab/genomebrowser';
|
|
34
|
+
const myBigWig: BigWigTrackProps = { ... }
|
|
35
|
+
browserDispatch({ type: BrowserActionType.ADD_TRACK, track: myBigWig });
|
|
36
|
+
```
|
|
37
|
+
2. You can add a track by passing a track component as a child to the GenomeBrowser component:
|
|
38
|
+
```tsx
|
|
39
|
+
import { BigBedTrack } from '@weng-lab/genomebrowser';
|
|
40
|
+
<GenomeBrowser browserState={browserState} browserDispatch={browserDispatch}>
|
|
41
|
+
<BigBedTrack ... />
|
|
42
|
+
</GenomeBrowser>
|
|
43
|
+
```
|
|
44
|
+
3. You can also add a track by appending it to the 'tracks' array in the browser state:
|
|
45
|
+
```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
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Full Example
|
|
56
|
+
|
|
57
|
+
```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"
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```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
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function Main() {
|
|
108
|
+
const [browserState, browserDispatch] = useBrowserState(defaultState)
|
|
109
|
+
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
// add a Transcript track to the state
|
|
112
|
+
browserDispatch({ type: BrowserActionType.ADD_TRACK, track: transcriptExample })
|
|
113
|
+
}, [])
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<GenomeBrowser browserState={browserState} browserDispatch={browserDispatch}>
|
|
117
|
+
<BigBedTrack {...bigBedExample} /> // add a BigBed track to the browser
|
|
118
|
+
</GenomeBrowser>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The browser will look something like this:
|
|
124
|
+

|
|
@@ -17,7 +17,6 @@ export declare const inputStyle: {
|
|
|
17
17
|
export declare const labelStyle: {
|
|
18
18
|
display: string;
|
|
19
19
|
flexDirection: "column";
|
|
20
|
-
paddingInline: string;
|
|
21
20
|
};
|
|
22
21
|
export declare const inputNumberWebkitStyle: {
|
|
23
22
|
WebkitAppearance: "none";
|
|
@@ -27,3 +26,13 @@ export declare const inputNumberFirefoxStyle: {
|
|
|
27
26
|
MozAppearance: "textfield";
|
|
28
27
|
appearance: "textfield";
|
|
29
28
|
};
|
|
29
|
+
export declare const downloadButtonStyle: {
|
|
30
|
+
cursor: string;
|
|
31
|
+
outline: number;
|
|
32
|
+
color: string;
|
|
33
|
+
borderColor: string;
|
|
34
|
+
display: string;
|
|
35
|
+
textAlign: "center";
|
|
36
|
+
border: string;
|
|
37
|
+
padding: string;
|
|
38
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OperationVariables, LazyQueryExecFunction } from '@apollo/client';
|
|
2
2
|
import { BigBedOptions, BigWigOptions } from '../../lib';
|
|
3
3
|
import { TranscriptOptions } from './transcripts';
|
|
4
|
+
import { Transcript as Ts } from './transcripts/types';
|
|
4
5
|
import { Rect } from './bigbed/types';
|
|
5
6
|
import { ImportanceTrackAnnotation, ImportanceTrackDataPoint } from './importance/importanceTrack';
|
|
6
7
|
import { Rect as MotifRect } from './motif/types';
|
|
@@ -81,6 +82,7 @@ export type TranscriptTrackProps = {
|
|
|
81
82
|
queryType: string;
|
|
82
83
|
version: TranscriptHumanVersion | TranscriptMouseVersion;
|
|
83
84
|
props?: TranscriptOptions;
|
|
85
|
+
onTranscriptClick?: (transcript: Ts) => void;
|
|
84
86
|
} & BaseTrack;
|
|
85
87
|
export type ImportanceTrackProps = {
|
|
86
88
|
signalURL: string;
|