@weng-lab/genomebrowser 0.0.1 → 0.0.3
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 +115 -40
- package/dist/components/browser/browser.d.ts +9 -0
- package/dist/components/browser/gqltracks.d.ts +13 -0
- package/dist/components/browser/index.d.ts +2 -0
- package/dist/components/browser/menuWrapper.d.ts +16 -0
- package/dist/components/browser/selectRegion.d.ts +12 -0
- package/dist/components/browser/stacked.d.ts +8 -0
- package/dist/components/browser/stackedtracks.d.ts +8 -0
- package/dist/components/browser/svgWrapper.d.ts +8 -0
- package/dist/components/browser/types.d.ts +55 -0
- package/dist/components/browser/utils.d.ts +1 -0
- package/dist/components/clipPath/clipPath.d.ts +14 -0
- package/dist/components/context/browserContext.d.ts +113 -0
- package/dist/components/context/domainContext.d.ts +9 -0
- package/dist/components/context/providers.d.ts +21 -0
- package/dist/components/controls/custombigwig.d.ts +4 -0
- package/dist/components/controls/index.d.ts +6 -0
- package/dist/components/controls/inputregion.d.ts +4 -0
- package/dist/components/controls/shiftbutton.d.ts +4 -0
- package/dist/components/controls/types.d.ts +33 -0
- package/dist/components/controls/ucsc.d.ts +4 -0
- package/dist/components/controls/zoombutton.d.ts +4 -0
- package/dist/components/cytobands/centromere.d.ts +4 -0
- package/dist/components/cytobands/cytoband.d.ts +4 -0
- package/dist/components/cytobands/cytobands.d.ts +4 -0
- package/dist/components/cytobands/highlight.d.ts +4 -0
- package/dist/components/cytobands/index.d.ts +3 -0
- package/dist/components/cytobands/shorthighlight.d.ts +4 -0
- package/dist/components/cytobands/types.d.ts +61 -0
- package/dist/components/icons/error.d.ts +9 -0
- package/dist/components/icons/index.d.ts +3 -0
- package/dist/components/icons/settings.d.ts +3 -0
- package/dist/components/icons/spinner.d.ts +9 -0
- package/dist/components/icons/top.d.ts +2 -0
- package/dist/components/icons/types.d.ts +12 -0
- package/dist/components/magnification/index.d.ts +2 -0
- package/dist/components/magnification/magnification.d.ts +13 -0
- package/dist/components/menu/browserContextMenu.d.ts +10 -0
- package/dist/components/menu/contextMenu.d.ts +6 -0
- package/dist/components/menu/types.d.ts +22 -0
- package/dist/components/modal/forms/form.d.ts +3 -0
- package/dist/components/modal/forms/heightForm.d.ts +4 -0
- package/dist/components/modal/forms/rangeForm.d.ts +5 -0
- package/dist/components/modal/forms/transcriptForm.d.ts +4 -0
- package/dist/components/modal/forms/universalForm.d.ts +4 -0
- package/dist/components/modal/modal.d.ts +1 -0
- package/dist/components/modal/styles.d.ts +25 -0
- package/dist/components/tooltip/tooltip.d.ts +4 -0
- package/dist/components/tooltip/tooltipcontext.d.ts +4 -0
- package/dist/components/tooltip/types.d.ts +20 -0
- package/dist/components/tracks/bam/bam.d.ts +23 -0
- package/dist/components/tracks/bam/dense.d.ts +4 -0
- package/dist/components/tracks/bam/index.d.ts +4 -0
- package/dist/components/tracks/bam/squish.d.ts +9 -0
- package/dist/components/tracks/bam/types.d.ts +37 -0
- package/dist/components/tracks/bam/utils.d.ts +9 -0
- package/dist/components/tracks/bigbed/bigbed.d.ts +37 -0
- package/dist/components/tracks/bigbed/dense.d.ts +22 -0
- package/dist/components/tracks/bigbed/index.d.ts +4 -0
- package/dist/components/tracks/bigbed/squish.d.ts +27 -0
- package/dist/components/tracks/bigbed/tooltip.d.ts +4 -0
- package/dist/components/tracks/bigbed/types.d.ts +14 -0
- package/dist/components/tracks/bigbed/utils.d.ts +8 -0
- package/dist/components/tracks/bigwig/bigwig.d.ts +37 -0
- package/dist/components/tracks/bigwig/dense.d.ts +8 -0
- package/dist/components/tracks/bigwig/full.d.ts +8 -0
- package/dist/components/tracks/bigwig/index.d.ts +4 -0
- package/dist/components/tracks/bigwig/types.d.ts +34 -0
- package/dist/components/tracks/bigwig/utils.d.ts +50 -0
- package/dist/components/tracks/empty/empty.d.ts +4 -0
- package/dist/components/tracks/empty/index.d.ts +2 -0
- package/dist/components/tracks/empty/types.d.ts +11 -0
- package/dist/components/tracks/index.d.ts +9 -0
- package/dist/components/tracks/ld/graphqlldtrack.d.ts +4 -0
- package/dist/components/tracks/ld/index.d.ts +4 -0
- package/dist/components/tracks/ld/ldtrack.d.ts +4 -0
- package/dist/components/tracks/ld/queries.d.ts +3 -0
- package/dist/components/tracks/ld/types.d.ts +66 -0
- package/dist/components/tracks/ld/utils.d.ts +3 -0
- package/dist/components/tracks/link/index.d.ts +4 -0
- package/dist/components/tracks/link/linktrack.d.ts +9 -0
- package/dist/components/tracks/link/simplelinktrack.d.ts +9 -0
- package/dist/components/tracks/link/types.d.ts +38 -0
- package/dist/components/tracks/link/utils.d.ts +5 -0
- package/dist/components/tracks/manhattan/full.d.ts +25 -0
- package/dist/components/tracks/manhattan/index.d.ts +3 -0
- package/dist/components/tracks/manhattan/tooltip.d.ts +4 -0
- package/dist/components/tracks/manhattan/types.d.ts +14 -0
- package/dist/components/tracks/manhattan/utils.d.ts +8 -0
- package/dist/components/tracks/motif/dense.d.ts +4 -0
- package/dist/components/tracks/motif/index.d.ts +4 -0
- package/dist/components/tracks/motif/squish.d.ts +4 -0
- package/dist/components/tracks/motif/types.d.ts +32 -0
- package/dist/components/tracks/motif/utils.d.ts +9 -0
- package/dist/components/tracks/ruler/index.d.ts +5 -0
- package/dist/components/tracks/ruler/ruler.d.ts +9 -0
- package/dist/components/tracks/ruler/types.d.ts +7 -0
- package/dist/components/tracks/ruler/wrapped.d.ts +15 -0
- package/dist/components/tracks/trackset/bamtrack.d.ts +4 -0
- package/dist/components/tracks/trackset/customtrack.d.ts +1 -0
- package/dist/components/tracks/trackset/deducetype.d.ts +6 -0
- package/dist/components/tracks/trackset/graphqlset.d.ts +4 -0
- package/dist/components/tracks/trackset/index.d.ts +6 -0
- package/dist/components/tracks/trackset/motiftrack.d.ts +4 -0
- package/dist/components/tracks/trackset/queries.d.ts +2 -0
- package/dist/components/tracks/trackset/resttrackset.d.ts +4 -0
- package/dist/components/tracks/trackset/types.d.ts +107 -0
- package/dist/components/tracks/trackset/utils.d.ts +4 -0
- package/dist/components/tracks/transcripts/index.d.ts +4 -0
- package/dist/components/tracks/transcripts/pack.d.ts +8 -0
- package/dist/components/tracks/transcripts/queries.d.ts +3 -0
- package/dist/components/tracks/transcripts/squish.d.ts +9 -0
- package/dist/components/tracks/transcripts/transcript.d.ts +35 -0
- package/dist/components/tracks/transcripts/types.d.ts +74 -0
- package/dist/components/tracks/transcripts/utils.d.ts +38 -0
- package/dist/components/tracks/types.d.ts +71 -0
- package/dist/components/tracks/wrapped/dragTrack.d.ts +7 -0
- package/dist/components/tracks/wrapped/index.d.ts +3 -0
- package/dist/components/tracks/wrapped/ld/index.d.ts +3 -0
- package/dist/components/tracks/wrapped/ld/ldtrack.d.ts +4 -0
- package/dist/components/tracks/wrapped/ld/types.d.ts +3 -0
- package/dist/components/tracks/wrapped/margin.d.ts +5 -0
- package/dist/components/tracks/wrapped/motif/dense.d.ts +4 -0
- package/dist/components/tracks/wrapped/motif/index.d.ts +4 -0
- package/dist/components/tracks/wrapped/motif/squish.d.ts +4 -0
- package/dist/components/tracks/wrapped/motif/types.d.ts +4 -0
- package/dist/components/tracks/wrapped/swapTrack.d.ts +9 -0
- package/dist/components/tracks/wrapped/types.d.ts +42 -0
- package/dist/components/tracks/wrapped/wrapped.d.ts +10 -0
- package/dist/gbc.cjs.js +220 -0
- package/dist/gbc.es.js +13058 -0
- package/dist/gbc.umd.js +220 -0
- package/dist/hooks/useBrowserState.d.ts +2 -0
- package/dist/hooks/useInput.d.ts +5 -0
- package/dist/hooks/useModal.d.ts +10 -0
- package/dist/hooks/useTooltip.d.ts +6 -0
- package/dist/lib.d.ts +14 -0
- package/dist/pages/main.d.ts +1 -0
- package/dist/pages/trackExamples.d.ts +4 -0
- package/dist/utils/colors.d.ts +14 -0
- package/dist/utils/coordinates.d.ts +39 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/react.d.ts +2 -0
- package/dist/utils/svg.d.ts +2 -0
- package/dist/utils/types.d.ts +19 -0
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -1,50 +1,125 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Genome Browser Component Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Installation
|
|
4
|
+
`yarn add @weng-lab/genomebrowser`
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
`npm install @weng-lab/genomebrowser`
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
8
|
+
## Usage
|
|
9
9
|
|
|
10
|
-
|
|
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
11
|
|
|
12
|
-
|
|
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
|
+
zoomLevel: 148,
|
|
26
|
+
delta: 0,
|
|
27
|
+
tracks: []
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
There are a few ways to add tracks to the browser.
|
|
32
|
+
1. You can add a track by dispatching the `ADD_TRACK` action:
|
|
33
|
+
```tsx
|
|
34
|
+
import { BigWigTrackProps } from '@weng-lab/genomebrowser';
|
|
35
|
+
const myBigWig: BigWigTrackProps = { ... }
|
|
36
|
+
browserDispatch({ type: BrowserActionType.ADD_TRACK, track: myBigWig });
|
|
37
|
+
```
|
|
38
|
+
2. You can add a track by passing a track component as a child to the GenomeBrowser component:
|
|
39
|
+
```tsx
|
|
40
|
+
import { BigBedTrack } from '@weng-lab/genomebrowser';
|
|
41
|
+
<GenomeBrowser browserState={browserState} browserDispatch={browserDispatch}>
|
|
42
|
+
<BigBedTrack ... />
|
|
43
|
+
</GenomeBrowser>
|
|
44
|
+
```
|
|
45
|
+
3. You can also add a track by appending it to the 'tracks' array in the browser state:
|
|
46
|
+
```tsx
|
|
47
|
+
import { BigWigTrackProps, BrowserState } from '@weng-lab/genomebrowser';
|
|
48
|
+
const myBigWig: BigWigTrackProps = { ... }
|
|
49
|
+
const myState: BrowserState = {
|
|
50
|
+
domain: { chromosome: "chr11", start: 5220000, end: 5420000 },
|
|
51
|
+
... // initialize the rest of the state
|
|
52
|
+
tracks: [myBigWig] // add the track to the state
|
|
53
|
+
}
|
|
54
|
+
```
|
|
13
55
|
|
|
14
|
-
|
|
56
|
+
## Full Example
|
|
15
57
|
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
58
|
+
```tsx
|
|
59
|
+
// in trackExamples.ts
|
|
60
|
+
export const bigWigExample: BigWigTrackProps = {
|
|
61
|
+
...DefaultBigWig,
|
|
62
|
+
id: "1",
|
|
63
|
+
title: "bigwig",
|
|
64
|
+
height: 100,
|
|
65
|
+
url: "https://downloads.wenglab.org/DNAse_All_ENCODE_MAR20_2024_merged.bw",
|
|
66
|
+
color: "blue"
|
|
67
|
+
}
|
|
68
|
+
export const bigBedExample: BigBedTrackProps = {
|
|
69
|
+
...DefaultBigBed,
|
|
70
|
+
id: "2",
|
|
71
|
+
title: "bigbed",
|
|
72
|
+
height: 75,
|
|
73
|
+
rowHeight: 12,
|
|
74
|
+
color: "red",
|
|
75
|
+
url: "https://downloads.wenglab.org/GRCh38-cCREs.DCC.bigBed"
|
|
76
|
+
}
|
|
77
|
+
export const transcriptExample: TranscriptTrackProps = {
|
|
78
|
+
...DefaultTranscript,
|
|
79
|
+
id: "3",
|
|
80
|
+
title: "transcript",
|
|
81
|
+
rowHeight: 12,
|
|
82
|
+
assembly: "GRCh38",
|
|
83
|
+
queryType: "gene",
|
|
84
|
+
version: TranscriptHumanVersion.V47,
|
|
85
|
+
height: 100,
|
|
86
|
+
color: "green"
|
|
87
|
+
}
|
|
26
88
|
```
|
|
27
89
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
90
|
+
```tsx
|
|
91
|
+
// in main.tsx
|
|
92
|
+
import { useEffect } from 'react'
|
|
93
|
+
import {
|
|
94
|
+
GenomeBrowser, BrowserState, BrowserActionType, useBrowserState,
|
|
95
|
+
BigBedTrack
|
|
96
|
+
} from '../lib'
|
|
97
|
+
import { bigWigExample, bigBedExample, transcriptExample } from './trackExamples'
|
|
98
|
+
|
|
99
|
+
const defaultState: BrowserState = {
|
|
100
|
+
domain: { chromosome: "chr11", start: 5220000, end: 5420000 },
|
|
101
|
+
preRenderedWidth: 1350,
|
|
102
|
+
width: 1500,
|
|
103
|
+
zoomLevel: 148,
|
|
104
|
+
delta: 0,
|
|
105
|
+
tracks: [bigWigExample] // addS a BigWig track to the state
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function Main() {
|
|
109
|
+
const [browserState, browserDispatch] = useBrowserState(defaultState)
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
// add a Transcript track to the state
|
|
113
|
+
browserDispatch({ type: BrowserActionType.ADD_TRACK, track: transcriptExample })
|
|
114
|
+
}, [])
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<GenomeBrowser browserState={browserState} browserDispatch={browserDispatch}>
|
|
118
|
+
<BigBedTrack {...bigBedExample} /> // add a BigBed track to the browser
|
|
119
|
+
</GenomeBrowser>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
50
122
|
```
|
|
123
|
+
|
|
124
|
+
The browser will look something like this:
|
|
125
|
+

|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BrowserAction, BrowserState } from '../context/browserContext';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
declare function GenomeBrowser({ children, browserState, browserDispatch, externalFetch }: {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
browserState: BrowserState;
|
|
6
|
+
browserDispatch: React.Dispatch<BrowserAction>;
|
|
7
|
+
externalFetch?: boolean;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default GenomeBrowser;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BrowserAction, BrowserState } from '../context/browserContext';
|
|
2
|
+
export type TranscriptRequest = {
|
|
3
|
+
chromosome: string;
|
|
4
|
+
assembly: string;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
version: number;
|
|
8
|
+
};
|
|
9
|
+
declare function GQLTracks({ browserState, browserDispatch }: {
|
|
10
|
+
browserState: BrowserState;
|
|
11
|
+
browserDispatch: React.Dispatch<BrowserAction>;
|
|
12
|
+
}): null;
|
|
13
|
+
export default GQLTracks;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ToolTipData, ContextMenuData } from './types';
|
|
3
|
+
import { DisplayMode } from '../tracks/types';
|
|
4
|
+
export type MenuWrapperProps = {
|
|
5
|
+
onModeChange?: (id: string, displayMode: DisplayMode) => void;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type MenuState = {
|
|
9
|
+
tooltip: ToolTipData;
|
|
10
|
+
contextmenu: ContextMenuData;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Provides a genome browser container which wraps children in an SVG
|
|
14
|
+
* element and provides a mechanism for dragging to select regions.
|
|
15
|
+
*/
|
|
16
|
+
export default function MenuWrapper({ children, onModeChange }: MenuWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Domain } from '../../utils/types';
|
|
3
|
+
export type SelectRegionProps = {
|
|
4
|
+
domain: Domain;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
dragRegionHeight: number;
|
|
8
|
+
leftMargin: number;
|
|
9
|
+
onSelectionEnd: (domain: Domain) => void;
|
|
10
|
+
};
|
|
11
|
+
declare const SelectRegion: React.FC<SelectRegionProps>;
|
|
12
|
+
export default SelectRegion;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BrowserState } from '../context/browserContext';
|
|
3
|
+
declare function Stacked({ children, browserState, rulerHeight }: {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
browserState: BrowserState;
|
|
6
|
+
rulerHeight: number;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default Stacked;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React, PropsWithChildren } from 'react';
|
|
2
|
+
import { StackedTrackProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Automatically stacks a number of child tracks on top of each other, updating y-coordinates
|
|
5
|
+
* appropriately as the tracks render themselves and update their heights.
|
|
6
|
+
*/
|
|
7
|
+
declare const StackedTracks: React.FC<PropsWithChildren<StackedTrackProps>>;
|
|
8
|
+
export default StackedTracks;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface SvgWrapperProps {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
svgRef?: React.RefObject<SVGSVGElement>;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export default function SvgWrapper({ width, height, svgRef, children }: SvgWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Domain } from '../../utils/types';
|
|
2
|
+
export type GenomeBrowserDomainChangedAction = {
|
|
3
|
+
type: "domainChanged";
|
|
4
|
+
newDomain: Domain;
|
|
5
|
+
};
|
|
6
|
+
export type GenomeBrowserHeightChangedAction = {
|
|
7
|
+
type: "heightChanged";
|
|
8
|
+
newHeight: number;
|
|
9
|
+
};
|
|
10
|
+
export type GenomeBrowserTooltipChangedAction = {
|
|
11
|
+
type: "tooltipChanged";
|
|
12
|
+
tooltip: ToolTipData;
|
|
13
|
+
};
|
|
14
|
+
export type GenomeBrowserContextMenuChangedAction = {
|
|
15
|
+
type: "contextMenuChanged";
|
|
16
|
+
contextmenu: ContextMenuData;
|
|
17
|
+
};
|
|
18
|
+
export type ToolTipData = {
|
|
19
|
+
show: boolean;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
content?: React.ReactElement;
|
|
25
|
+
};
|
|
26
|
+
export type ContextMenuData = {
|
|
27
|
+
show: boolean;
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
id: string;
|
|
31
|
+
displayMode?: string;
|
|
32
|
+
displayModeOptions?: string[];
|
|
33
|
+
downloadSVG?: () => void;
|
|
34
|
+
};
|
|
35
|
+
export type GenomeBrowserAction = GenomeBrowserDomainChangedAction | GenomeBrowserHeightChangedAction | GenomeBrowserTooltipChangedAction | GenomeBrowserContextMenuChangedAction;
|
|
36
|
+
export type StackedTrackProps = {
|
|
37
|
+
id: string;
|
|
38
|
+
transform?: string;
|
|
39
|
+
height?: number;
|
|
40
|
+
onHeightChanged?: (height: number) => void;
|
|
41
|
+
svgRef?: React.RefObject<SVGSVGElement>;
|
|
42
|
+
};
|
|
43
|
+
export type StackedTrackState = {
|
|
44
|
+
heights: number[];
|
|
45
|
+
};
|
|
46
|
+
export type StackedTrackChildHeightChangedAction = {
|
|
47
|
+
type: "childHeightChanged";
|
|
48
|
+
index: number;
|
|
49
|
+
height: number;
|
|
50
|
+
};
|
|
51
|
+
export type StackedTrackChildrenAddedAction = {
|
|
52
|
+
type: "childrenAdded";
|
|
53
|
+
heights: number[];
|
|
54
|
+
};
|
|
55
|
+
export type StackedTrackAction = StackedTrackChildHeightChangedAction | StackedTrackChildrenAddedAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useEvent: (event: any, handler: (e: KeyboardEvent) => void, passive?: boolean) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ClipPathProps = {
|
|
3
|
+
height: number;
|
|
4
|
+
width: number;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Creates an SVG clipPath element with a unique ID.
|
|
9
|
+
* @param width the width of the element relative to the SVG.
|
|
10
|
+
* @param height the height of the element relative to the SVG.
|
|
11
|
+
* @param id the unqiue ID of the element, used to refer to it in properties of clipped elements.
|
|
12
|
+
*/
|
|
13
|
+
declare const ClipPath: React.FC<ClipPathProps>;
|
|
14
|
+
export default ClipPath;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Domain, YRange } from '../../utils/types';
|
|
2
|
+
import { TrackProps } from '../tracks/types';
|
|
3
|
+
import { TranscriptOptions } from '../tracks/transcripts/transcript';
|
|
4
|
+
import { BigWigOptions } from '../tracks/bigwig/bigwig';
|
|
5
|
+
import { BigBedOptions } from '../tracks/bigbed/bigbed';
|
|
6
|
+
export declare const BrowserStateContext: import('react').Context<BrowserState>;
|
|
7
|
+
export declare const BrowserDispatchContext: import('react').Context<import('react').Dispatch<BrowserAction>>;
|
|
8
|
+
export type BrowserState = {
|
|
9
|
+
domain: Domain;
|
|
10
|
+
preRenderedWidth: number;
|
|
11
|
+
width: number;
|
|
12
|
+
zoomLevel: number;
|
|
13
|
+
delta: number;
|
|
14
|
+
tracks: TrackProps[];
|
|
15
|
+
};
|
|
16
|
+
export declare enum BrowserActionType {
|
|
17
|
+
SET_DOMAIN = "setDomain",
|
|
18
|
+
SHIFT_DOMAIN = "shiftDomain",
|
|
19
|
+
ADD_TRACK = "addTrack",
|
|
20
|
+
UPDATE_TRACK = "updateTrack",
|
|
21
|
+
SET_TRACK_HEIGHT = "setTrackHeight",
|
|
22
|
+
SET_TRACK_DATA = "setTrackData",
|
|
23
|
+
SET_LOADING = "setLoading",
|
|
24
|
+
SWAP_TRACKS = "swapTracks",
|
|
25
|
+
RELOAD_TRACKS = "reloadTracks",
|
|
26
|
+
SHIFT_TRACK = "shiftTrack",
|
|
27
|
+
REMOVE_TRANSLATION = "removeTranslation",
|
|
28
|
+
INSERT_TRACK = "insertTrack",
|
|
29
|
+
DELETE_TRACK = "deleteTrack",
|
|
30
|
+
TRANSLATE_TRACK = "translateTrack",
|
|
31
|
+
SET_RANGE = "setRange",
|
|
32
|
+
UPDATE_PROPS = "updateProps",
|
|
33
|
+
BRING_TO_TOP = "bringToTop",
|
|
34
|
+
SET_DELTA = "setDelta"
|
|
35
|
+
}
|
|
36
|
+
export type BrowserAction = SetDomain | AddTrack | UpdateTrack | SetTrackHeight | SetTrackData | SwapTracks | ShiftDomain | SetLoading | ShiftTrack | RemoveTranslation | InsertTrack | DeleteTrack | TranslateTrack | SetRange | UpdateProps | BringToTop | SetDelta;
|
|
37
|
+
export type SetDelta = {
|
|
38
|
+
type: BrowserActionType.SET_DELTA;
|
|
39
|
+
delta: number;
|
|
40
|
+
};
|
|
41
|
+
export type SetDomain = {
|
|
42
|
+
type: BrowserActionType.SET_DOMAIN;
|
|
43
|
+
domain: Domain;
|
|
44
|
+
};
|
|
45
|
+
export type AddTrack = {
|
|
46
|
+
type: BrowserActionType.ADD_TRACK;
|
|
47
|
+
track: TrackProps;
|
|
48
|
+
};
|
|
49
|
+
export type UpdateTrack = {
|
|
50
|
+
type: BrowserActionType.UPDATE_TRACK;
|
|
51
|
+
id: string;
|
|
52
|
+
track: Partial<TrackProps>;
|
|
53
|
+
};
|
|
54
|
+
export type SetTrackHeight = {
|
|
55
|
+
type: BrowserActionType.SET_TRACK_HEIGHT;
|
|
56
|
+
id: string;
|
|
57
|
+
height: number;
|
|
58
|
+
};
|
|
59
|
+
export type SetTrackData = {
|
|
60
|
+
type: BrowserActionType.SET_TRACK_DATA;
|
|
61
|
+
id: string;
|
|
62
|
+
data: any;
|
|
63
|
+
};
|
|
64
|
+
export type SwapTracks = {
|
|
65
|
+
type: BrowserActionType.SWAP_TRACKS;
|
|
66
|
+
id1: string;
|
|
67
|
+
id2: string;
|
|
68
|
+
};
|
|
69
|
+
export type ShiftDomain = {
|
|
70
|
+
type: BrowserActionType.SHIFT_DOMAIN;
|
|
71
|
+
delta: number;
|
|
72
|
+
};
|
|
73
|
+
export type SetLoading = {
|
|
74
|
+
type: BrowserActionType.SET_LOADING;
|
|
75
|
+
};
|
|
76
|
+
export type ShiftTrack = {
|
|
77
|
+
type: BrowserActionType.SHIFT_TRACK;
|
|
78
|
+
id1: string;
|
|
79
|
+
id2: string;
|
|
80
|
+
};
|
|
81
|
+
export type RemoveTranslation = {
|
|
82
|
+
type: BrowserActionType.REMOVE_TRANSLATION;
|
|
83
|
+
id: string;
|
|
84
|
+
};
|
|
85
|
+
export type InsertTrack = {
|
|
86
|
+
type: BrowserActionType.INSERT_TRACK;
|
|
87
|
+
index: number;
|
|
88
|
+
track: TrackProps;
|
|
89
|
+
};
|
|
90
|
+
export type DeleteTrack = {
|
|
91
|
+
type: BrowserActionType.DELETE_TRACK;
|
|
92
|
+
id: string;
|
|
93
|
+
};
|
|
94
|
+
export type TranslateTrack = {
|
|
95
|
+
type: BrowserActionType.TRANSLATE_TRACK;
|
|
96
|
+
id: string;
|
|
97
|
+
dist: number;
|
|
98
|
+
};
|
|
99
|
+
export type SetRange = {
|
|
100
|
+
type: BrowserActionType.SET_RANGE;
|
|
101
|
+
id: string;
|
|
102
|
+
range: YRange;
|
|
103
|
+
};
|
|
104
|
+
export type UpdateProps = {
|
|
105
|
+
type: BrowserActionType.UPDATE_PROPS;
|
|
106
|
+
id: string;
|
|
107
|
+
props: TranscriptOptions | BigWigOptions | BigBedOptions;
|
|
108
|
+
};
|
|
109
|
+
export type BringToTop = {
|
|
110
|
+
type: BrowserActionType.BRING_TO_TOP;
|
|
111
|
+
id: string;
|
|
112
|
+
};
|
|
113
|
+
export declare function BrowserReducer(state: BrowserState, action: BrowserAction): BrowserState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Domain } from '../../utils/types';
|
|
2
|
+
type stateContext<T> = [
|
|
3
|
+
T,
|
|
4
|
+
React.Dispatch<React.SetStateAction<T>>
|
|
5
|
+
];
|
|
6
|
+
export declare const DomainContext: import('react').Context<Domain>;
|
|
7
|
+
export declare const DomainDispatchContext: import('react').Context<any>;
|
|
8
|
+
export declare const DeltaContext: import('react').Context<stateContext<number>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BrowserState, BrowserAction } from './browserContext';
|
|
3
|
+
import { TrackModalInfo } from '../../hooks/useModal';
|
|
4
|
+
export declare const ModalContext: import('react').Context<{
|
|
5
|
+
openModal: TrackModalInfo | null;
|
|
6
|
+
showModal: (trackId: string, mouseX: number, mouseY: number) => void;
|
|
7
|
+
closeModal: () => void;
|
|
8
|
+
}>;
|
|
9
|
+
interface ContextObjects {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
browserState: BrowserState;
|
|
12
|
+
browserDispatch: React.Dispatch<BrowserAction>;
|
|
13
|
+
deltaContext: [number, React.Dispatch<React.SetStateAction<number>>];
|
|
14
|
+
modalState: {
|
|
15
|
+
openModal: TrackModalInfo | null;
|
|
16
|
+
showModal: (trackId: string, mouseX: number, mouseY: number) => void;
|
|
17
|
+
closeModal: () => void;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default function ContextProvider({ children, browserState, browserDispatch, modalState, deltaContext }: ContextObjects): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as ShiftButton } from './shiftbutton';
|
|
2
|
+
import { default as ZoomButton } from './zoombutton';
|
|
3
|
+
import { default as InputRegion } from './inputregion';
|
|
4
|
+
import { default as UCSCControls } from './ucsc';
|
|
5
|
+
import { default as CustomBigWig } from './custombigwig';
|
|
6
|
+
export { ShiftButton, ZoomButton, InputRegion, CustomBigWig, UCSCControls };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Domain } from '../../utils/types';
|
|
2
|
+
export type CustomBigWigProps = {
|
|
3
|
+
text: string;
|
|
4
|
+
onSubmit: (value: CustomBigWig) => void;
|
|
5
|
+
};
|
|
6
|
+
export type CustomBigWig = {
|
|
7
|
+
url: string;
|
|
8
|
+
title: string;
|
|
9
|
+
};
|
|
10
|
+
export type InputRegionProps = {
|
|
11
|
+
text?: string;
|
|
12
|
+
domain: Domain;
|
|
13
|
+
chromosome?: string;
|
|
14
|
+
size: number;
|
|
15
|
+
onSubmit: (domain: Domain) => void;
|
|
16
|
+
};
|
|
17
|
+
export type ShiftButtonProps = {
|
|
18
|
+
text: string;
|
|
19
|
+
shift: number;
|
|
20
|
+
domain: Domain;
|
|
21
|
+
onClick: (domain: Domain) => void;
|
|
22
|
+
};
|
|
23
|
+
export type ZoomButtonProps = {
|
|
24
|
+
text: string;
|
|
25
|
+
factor: number;
|
|
26
|
+
domain: Domain;
|
|
27
|
+
onClick: (domain: Domain) => void;
|
|
28
|
+
};
|
|
29
|
+
export type UCSCControlProps = {
|
|
30
|
+
domain: Domain;
|
|
31
|
+
onDomainChanged: (domain: Domain) => void;
|
|
32
|
+
withInput: boolean;
|
|
33
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Domain } from '../../utils/types';
|
|
3
|
+
export type Highlight = {
|
|
4
|
+
color: string;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
};
|
|
8
|
+
export type ShortHighlightProps = {
|
|
9
|
+
highlight: Highlight;
|
|
10
|
+
x: (value: number) => number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
export type Cytoband = {
|
|
14
|
+
stain: string;
|
|
15
|
+
coordinates: Domain;
|
|
16
|
+
};
|
|
17
|
+
export type CytobandColors = {
|
|
18
|
+
default: string;
|
|
19
|
+
centromere: string;
|
|
20
|
+
stalk: string;
|
|
21
|
+
};
|
|
22
|
+
export type CytobandsProps = {
|
|
23
|
+
data: Cytoband[];
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
id: string;
|
|
27
|
+
colors?: CytobandColors;
|
|
28
|
+
transform?: string;
|
|
29
|
+
highlight?: Highlight;
|
|
30
|
+
highlights?: Highlight[];
|
|
31
|
+
onHighlightMouseOver?: (highlight: Highlight, x: number, i: number) => void;
|
|
32
|
+
onHighlightMouseOut?: () => void;
|
|
33
|
+
onHighlightClick?: (highlight: Highlight, x: number, i: number) => void;
|
|
34
|
+
domain: Domain;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
opacity?: number;
|
|
37
|
+
};
|
|
38
|
+
export type CytobandProps = {
|
|
39
|
+
colors: CytobandColors;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
type: string;
|
|
43
|
+
x: number;
|
|
44
|
+
opacity?: number;
|
|
45
|
+
};
|
|
46
|
+
export type CentromereProps = {
|
|
47
|
+
color: string;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
x: number;
|
|
51
|
+
opening: boolean;
|
|
52
|
+
};
|
|
53
|
+
export type CytobandHighlightProps = {
|
|
54
|
+
x: (value: number) => number;
|
|
55
|
+
height: number;
|
|
56
|
+
width: number;
|
|
57
|
+
highlight: Highlight;
|
|
58
|
+
onMouseOver?: () => void;
|
|
59
|
+
onMouseOut?: () => void;
|
|
60
|
+
onClick?: () => void;
|
|
61
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ErrorIconProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* An error icon, consisting of a red exclamation point inside a triangle.
|
|
5
|
+
* @param width the width of the icon relative to the containing SVG.
|
|
6
|
+
* @param height the height of the icon relative to the containing SVG.
|
|
7
|
+
*/
|
|
8
|
+
declare const ErrorIcon: React.FC<ErrorIconProps>;
|
|
9
|
+
export default ErrorIcon;
|