-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLinearGWASDisplayComponent.tsx
More file actions
47 lines (41 loc) · 1.38 KB
/
LinearGWASDisplayComponent.tsx
File metadata and controls
47 lines (41 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from 'react'
import { getContainingView, getEnv } from '@jbrowse/core/util'
import { observer } from 'mobx-react'
import type { LinearManhattanDisplayModel } from './model'
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
import type WigglePlugin from '@jbrowse/plugin-wiggle'
const LinearGWASDisplayComponent = observer(function ({
model,
}: {
model: LinearManhattanDisplayModel
}) {
const { pluginManager } = getEnv(model)
const WigglePlugin = pluginManager.getPlugin('WigglePlugin') as WigglePlugin
const { LinearWiggleDisplayReactComponent } = WigglePlugin.exports
const { highScoringFeatures } = model
const view = getContainingView(model) as LinearGenomeViewModel
return (
<div style={{ position: 'relative' }}>
{highScoringFeatures.map(({ feature, y }) => {
const ret = view.bpToPx({
refName: feature.get('refName'),
coord: feature.get('start'),
})
return ret ? (
<div
key={feature.id()}
style={{
position: 'absolute',
left: ret.offsetPx - view.offsetPx,
top: y,
}}
>
{feature.get('name') || feature.get('rsid')}
</div>
) : null
})}
<LinearWiggleDisplayReactComponent model={model} />
</div>
)
})
export default LinearGWASDisplayComponent