Skip to content

Commit e13fcc2

Browse files
authored
Create system for visualizing linkage disequilibrium from VCF and PLINK output files (#5420)
1 parent 52b2b52 commit e13fcc2

File tree

64 files changed

+5930
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+5930
-94
lines changed

.ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ plugins/variants/src/d3-hierarchy2
2525
benchmarks
2626
products/jbrowse-web/src/tests/__file_snapshots__/save_track_data.sam
2727
products/jbrowse-web/src/tests/__file_snapshots__/save_track_data.cram.sam
28+
plugins/variants/src/VariantRPC/getLDMatrix.ts

_typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ vview = "vview"
33
Wnt = "Wnt"
44
ome = "ome"
55
Shs = "Shs"
6+
hom = "hom"

packages/sv-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"prepack": "pnpm build"
3232
},
3333
"dependencies": {
34-
"@gmod/vcf": "^6.1.1",
34+
"@gmod/vcf": "^7.0.0",
3535
"@jbrowse/core": "workspace:^",
3636
"@jbrowse/mobx-state-tree": "^5.5.0",
3737
"@jbrowse/plugin-linear-genome-view": "workspace:^",

plugins/arc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"clean": "rimraf esm *.tsbuildinfo"
3030
},
3131
"dependencies": {
32-
"@gmod/vcf": "^6.1.1",
32+
"@gmod/vcf": "^7.0.0",
3333
"@jbrowse/core": "workspace:^",
3434
"@jbrowse/mobx-state-tree": "^5.5.0",
3535
"@jbrowse/plugin-linear-genome-view": "workspace:^",

plugins/breakpoint-split-view/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"clean": "rimraf esm *.tsbuildinfo"
3030
},
3131
"dependencies": {
32-
"@gmod/vcf": "^6.1.1",
32+
"@gmod/vcf": "^7.0.0",
3333
"@jbrowse/core": "workspace:^",
3434
"@jbrowse/mobx-state-tree": "^5.5.0",
3535
"@jbrowse/plugin-linear-genome-view": "workspace:^",

plugins/data-management/src/AddTrackWidget/components/ConfirmTrack.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ const ConfirmTrack = observer(function ConfirmTrack({
5353
warningMessage,
5454
adapterHint,
5555
textIndexTrack,
56+
adapterHintNotConfigurable,
5657
} = model
5758

5859
useEffect(() => {
59-
if (adapterHint === '' && trackAdapter) {
60+
if (adapterHint === '' && trackAdapter && trackAdapter.type !== UNKNOWN) {
6061
model.setAdapterHint(trackAdapter.type)
6162
}
6263
}, [adapterHint, trackAdapter, model])
@@ -65,6 +66,14 @@ const ConfirmTrack = observer(function ConfirmTrack({
6566
return <Unsupported />
6667
} else if (trackAdapter?.type === UNKNOWN) {
6768
return <UnknownAdapterPrompt model={model} />
69+
} else if (adapterHintNotConfigurable) {
70+
return (
71+
<Typography color="error">
72+
The &quot;{adapterHint}&quot; adapter cannot be configured for the
73+
provided file. This adapter may require a specific file extension or
74+
format. Please check the file or select a different adapter.
75+
</Typography>
76+
)
6877
} else if (!trackAdapter?.type) {
6978
return <Typography>Could not recognize this data type.</Typography>
7079
} else {

plugins/data-management/src/AddTrackWidget/components/TrackAdapterSelector.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,28 @@ const TrackAdapterSelector = observer(function ({
1111
}: {
1212
model: AddTrackModel
1313
}) {
14-
const { trackAdapter } = model
14+
const { trackAdapter, adapterHintNotConfigurable } = model
15+
const { adapterHint } = model
1516
const { pluginManager } = getEnv(model)
1617

18+
// Show the adapterHint if set (even if config couldn't be built),
19+
// otherwise show the resolved adapter type
20+
const displayValue =
21+
adapterHint || (trackAdapter?.type !== 'UNKNOWN' ? trackAdapter?.type : '')
22+
1723
return (
1824
<TextField
19-
value={trackAdapter?.type !== 'UNKNOWN' ? trackAdapter?.type : ''}
25+
value={displayValue}
2026
label="Adapter type"
2127
variant="outlined"
2228
select
2329
fullWidth
30+
error={adapterHintNotConfigurable}
31+
helperText={
32+
adapterHintNotConfigurable
33+
? `The "${adapterHint}" adapter cannot be configured for the provided file. This adapter may require a specific file extension or additional setup.`
34+
: undefined
35+
}
2436
onChange={event => {
2537
model.setAdapterHint(event.target.value)
2638
}}

plugins/data-management/src/AddTrackWidget/model.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,22 @@ export default function f(pluginManager: PluginManager) {
220220
return this.trackAdapter?.type === UNSUPPORTED
221221
},
222222

223+
/**
224+
* #getter
225+
* Returns true if the user selected an adapter from the dropdown
226+
* but the extension point couldn't build a config for it
227+
*/
228+
get adapterHintNotConfigurable() {
229+
const { adapterHint } = self
230+
const adapterType = this.trackAdapter?.type
231+
return !!(
232+
adapterHint &&
233+
(!adapterType ||
234+
adapterType === 'UNKNOWN' ||
235+
adapterType !== adapterHint)
236+
)
237+
},
238+
223239
/**
224240
* #getter
225241
*/

plugins/hic/src/LinearHicDisplay/afterAttach.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export function doAfterAttach(self: LinearHicDisplayModel) {
9999
if (result.imageData) {
100100
self.setRenderingImageData(result.imageData)
101101
self.setLastDrawnOffsetPx(view.offsetPx)
102+
self.setLastDrawnBpPerPx(view.bpPerPx)
102103
}
103104
// Store flatbush data for mouseover
104105
self.setFlatbushData(

plugins/linear-genome-view/src/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface NonBlockCanvasDisplayModel {
2424
drawn: boolean
2525
loading: boolean
2626
lastDrawnOffsetPx?: number
27+
lastDrawnBpPerPx?: number
2728
statusMessage?: string
2829
showLegend?: boolean
2930
legendItems?: () => LegendItem[]
@@ -86,15 +87,24 @@ const DataDisplay = observer(function DataDisplay({
8687
model: NonBlockCanvasDisplayModel
8788
children?: React.ReactNode
8889
}) {
89-
const { drawn, loading, showLegend, legendItems } = model
90+
const { drawn, loading, showLegend, legendItems, lastDrawnBpPerPx } = model
9091
const view = getContainingView(model) as LinearGenomeViewModel
9192
const items = legendItems?.() ?? []
9293

94+
// Check if the view has zoomed (bpPerPx changed) since the last render.
95+
// When zoomed, we don't show the old shifted content because it's at
96+
// the wrong scale.
97+
const hasZoomed =
98+
lastDrawnBpPerPx !== undefined && lastDrawnBpPerPx !== view.bpPerPx
99+
93100
// Calculate how much to shift the rendered canvas to account for scrolling.
94101
// When the user scrolls, view.offsetPx changes but the canvas content
95102
// stays the same until a new render completes. This shift keeps the
96103
// content aligned during that time.
97-
const calculatedLeft = (model.lastDrawnOffsetPx ?? 0) - view.offsetPx
104+
// Only apply the shift if we haven't zoomed.
105+
const calculatedLeft = hasZoomed
106+
? 0
107+
: (model.lastDrawnOffsetPx ?? 0) - view.offsetPx
98108

99109
return (
100110
// this data-testid is located here because changing props on the canvas
@@ -104,12 +114,16 @@ const DataDisplay = observer(function DataDisplay({
104114
style={{
105115
position: 'absolute',
106116
left: calculatedLeft,
117+
// Hide content when zoomed until new render completes
118+
visibility: hasZoomed ? 'hidden' : undefined,
107119
}}
108120
>
109121
{children}
110122
</div>
111123
{showLegend && items.length > 0 ? <FloatingLegend items={items} /> : null}
112-
{calculatedLeft !== 0 || loading ? <LoadingBar model={model} /> : null}
124+
{hasZoomed || calculatedLeft !== 0 || loading ? (
125+
<LoadingBar model={model} />
126+
) : null}
113127
</div>
114128
)
115129
})

0 commit comments

Comments
 (0)