@jbrowse/plugin-wiggle 1.5.0 → 1.5.4
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/dist/BigWigAdapter/BigWigAdapter.d.ts +2 -2
- package/dist/LinearWiggleDisplay/components/Tooltip.d.ts +7 -2
- package/dist/LinearWiggleDisplay/models/model.d.ts +2 -2
- package/dist/WiggleRendering.d.ts +1 -0
- package/dist/index.d.ts +14 -13
- package/dist/plugin-wiggle.cjs.development.js +56 -38
- package/dist/plugin-wiggle.cjs.development.js.map +1 -1
- package/dist/plugin-wiggle.cjs.production.min.js +1 -1
- package/dist/plugin-wiggle.cjs.production.min.js.map +1 -1
- package/dist/plugin-wiggle.esm.js +57 -39
- package/dist/plugin-wiggle.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/BigWigAdapter/BigWigAdapter.test.ts +1 -0
- package/src/BigWigAdapter/BigWigAdapter.ts +4 -4
- package/src/LinearWiggleDisplay/components/Tooltip.tsx +12 -10
- package/src/WiggleRendering.tsx +1 -0
- package/src/index.ts +38 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-wiggle",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "JBrowse 2 wiggle adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"useSrc": "node ../../scripts/useSrc.js"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@gmod/bbi": "^1.0.
|
|
38
|
+
"@gmod/bbi": "^1.0.31",
|
|
39
39
|
"@material-ui/icons": "^4.11.2",
|
|
40
|
-
"@popperjs/core": "^2.
|
|
40
|
+
"@popperjs/core": "^2.11.0",
|
|
41
41
|
"abortable-promise-cache": "^1.1.3",
|
|
42
42
|
"color": "^3.1.1",
|
|
43
43
|
"d3-scale": "^3.2.3",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "0c398214590969168694b4ed8e20b595178b9efd"
|
|
64
64
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BigWig
|
|
1
|
+
import { BigWig } from '@gmod/bbi'
|
|
2
2
|
import {
|
|
3
3
|
BaseFeatureDataAdapter,
|
|
4
4
|
BaseOptions,
|
|
5
5
|
} from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
6
|
-
import {
|
|
6
|
+
import { AugmentedRegion as Region } from '@jbrowse/core/util/types'
|
|
7
7
|
import { openLocation } from '@jbrowse/core/util/io'
|
|
8
8
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
9
9
|
import SimpleFeature, { Feature } from '@jbrowse/core/util/simpleFeature'
|
|
@@ -66,7 +66,7 @@ export default class BigWigAdapter extends BaseFeatureDataAdapter {
|
|
|
66
66
|
return rectifyStats(header.totalSummary as UnrectifiedFeatureStats)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
public getFeatures(region:
|
|
69
|
+
public getFeatures(region: Region, opts: WiggleOptions = {}) {
|
|
70
70
|
const { refName, start, end } = region
|
|
71
71
|
const {
|
|
72
72
|
bpPerPx = 0,
|
|
@@ -82,7 +82,7 @@ export default class BigWigAdapter extends BaseFeatureDataAdapter {
|
|
|
82
82
|
})
|
|
83
83
|
ob.pipe(
|
|
84
84
|
mergeAll(),
|
|
85
|
-
map(
|
|
85
|
+
map(record => {
|
|
86
86
|
return new SimpleFeature({
|
|
87
87
|
id: `${refName}:${record.start}-${record.end}`,
|
|
88
88
|
data: { ...record, refName },
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
1
|
import React, { useMemo, useState } from 'react'
|
|
3
2
|
import { observer } from 'mobx-react'
|
|
4
3
|
import { makeStyles, alpha, Portal } from '@material-ui/core'
|
|
5
4
|
import { Feature } from '@jbrowse/core/util/simpleFeature'
|
|
5
|
+
|
|
6
|
+
// locals
|
|
6
7
|
import { YSCALEBAR_LABEL_OFFSET } from '../models/model'
|
|
7
8
|
import { usePopper } from 'react-popper'
|
|
8
9
|
|
|
10
|
+
// convert to number, apply shortened precision, and render
|
|
9
11
|
function toP(s = 0) {
|
|
10
|
-
return
|
|
12
|
+
return +(+s).toPrecision(6)
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
function round(value: number) {
|
|
@@ -31,7 +33,6 @@ const useStyles = makeStyles(theme => ({
|
|
|
31
33
|
lineHeight: `${round(14 / 10)}em`,
|
|
32
34
|
maxWidth: 300,
|
|
33
35
|
wordWrap: 'break-word',
|
|
34
|
-
fontWeight: theme.typography.fontWeightMedium,
|
|
35
36
|
},
|
|
36
37
|
|
|
37
38
|
hoverVertical: {
|
|
@@ -86,18 +87,19 @@ const Tooltip = observer(
|
|
|
86
87
|
clientRect,
|
|
87
88
|
TooltipContents,
|
|
88
89
|
}: {
|
|
89
|
-
model:
|
|
90
|
+
model: { featureUnderMouse: Feature }
|
|
90
91
|
height: number
|
|
91
92
|
clientMouseCoord: Coord
|
|
92
93
|
offsetMouseCoord: Coord
|
|
93
94
|
clientRect?: ClientRect
|
|
95
|
+
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
97
|
TooltipContents: React.FC<any>
|
|
95
98
|
}) => {
|
|
96
99
|
const { featureUnderMouse } = model
|
|
97
|
-
const classes = useStyles()
|
|
98
100
|
const [width, setWidth] = useState(0)
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
+
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null)
|
|
102
|
+
const classes = useStyles()
|
|
101
103
|
|
|
102
104
|
// must be memoized a la https://github.com/popperjs/react-popper/issues/391
|
|
103
105
|
const virtElement = useMemo(
|
|
@@ -120,13 +122,13 @@ const Tooltip = observer(
|
|
|
120
122
|
}),
|
|
121
123
|
[clientRect?.top, clientMouseCoord, width],
|
|
122
124
|
)
|
|
123
|
-
const { styles, attributes } = usePopper(virtElement,
|
|
125
|
+
const { styles, attributes } = usePopper(virtElement, anchorEl)
|
|
124
126
|
|
|
125
127
|
return featureUnderMouse ? (
|
|
126
128
|
<>
|
|
127
129
|
<Portal>
|
|
128
130
|
<div
|
|
129
|
-
ref={
|
|
131
|
+
ref={setAnchorEl}
|
|
130
132
|
className={classes.tooltip}
|
|
131
133
|
// zIndex needed to go over widget drawer
|
|
132
134
|
style={{ ...styles.popper, zIndex: 100000 }}
|
|
@@ -155,7 +157,7 @@ const Tooltip = observer(
|
|
|
155
157
|
|
|
156
158
|
const WiggleTooltip = observer(
|
|
157
159
|
(props: {
|
|
158
|
-
model:
|
|
160
|
+
model: { featureUnderMouse: Feature }
|
|
159
161
|
height: number
|
|
160
162
|
offsetMouseCoord: Coord
|
|
161
163
|
clientMouseCoord: Coord
|
package/src/WiggleRendering.tsx
CHANGED
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
createBaseTrackModel,
|
|
10
10
|
} from '@jbrowse/core/pluggableElementTypes/models'
|
|
11
11
|
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
|
|
12
|
+
import { FileLocation } from '@jbrowse/core/util/types'
|
|
12
13
|
import WiggleBaseRenderer from './WiggleBaseRenderer'
|
|
13
14
|
import WiggleRendering from './WiggleRendering'
|
|
14
15
|
import { configSchema as bigWigAdapterConfigSchema } from './BigWigAdapter'
|
|
@@ -35,6 +36,11 @@ import {
|
|
|
35
36
|
WiggleGetGlobalStats,
|
|
36
37
|
WiggleGetMultiRegionStats,
|
|
37
38
|
} from './WiggleRPC/rpcMethods'
|
|
39
|
+
import {
|
|
40
|
+
AdapterGuesser,
|
|
41
|
+
getFileName,
|
|
42
|
+
TrackTypeGuesser,
|
|
43
|
+
} from '@jbrowse/core/util/tracks'
|
|
38
44
|
|
|
39
45
|
export default class WigglePlugin extends Plugin {
|
|
40
46
|
name = 'WigglePlugin'
|
|
@@ -86,6 +92,38 @@ export default class WigglePlugin extends Plugin {
|
|
|
86
92
|
import('./BigWigAdapter/BigWigAdapter').then(r => r.default),
|
|
87
93
|
}),
|
|
88
94
|
)
|
|
95
|
+
pluginManager.addToExtensionPoint(
|
|
96
|
+
'Core-guessAdapterForLocation',
|
|
97
|
+
(adapterGuesser: AdapterGuesser) => {
|
|
98
|
+
return (
|
|
99
|
+
file: FileLocation,
|
|
100
|
+
index?: FileLocation,
|
|
101
|
+
adapterHint?: string,
|
|
102
|
+
) => {
|
|
103
|
+
const regexGuess = /\.(bw|bigwig)$/i
|
|
104
|
+
const adapterName = 'BigWigAdapter'
|
|
105
|
+
const fileName = getFileName(file)
|
|
106
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
107
|
+
return {
|
|
108
|
+
type: adapterName,
|
|
109
|
+
bigWigLocation: file,
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return adapterGuesser(file, index, adapterHint)
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
)
|
|
116
|
+
pluginManager.addToExtensionPoint(
|
|
117
|
+
'Core-guessTrackTypeForLocation',
|
|
118
|
+
(trackTypeGuesser: TrackTypeGuesser) => {
|
|
119
|
+
return (adapterName: string) => {
|
|
120
|
+
if (adapterName === 'BigWigAdapter') {
|
|
121
|
+
return 'QuantitativeTrack'
|
|
122
|
+
}
|
|
123
|
+
return trackTypeGuesser(adapterName)
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
)
|
|
89
127
|
|
|
90
128
|
pluginManager.addRendererType(
|
|
91
129
|
() =>
|