Skip to content

Commit 928cfce

Browse files
author
Sebastian Benjamin
committed
Fix SNP clicking and Feature Details panel sections
1 parent 355e1c3 commit 928cfce

4 files changed

Lines changed: 38 additions & 7 deletions

File tree

jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/ExtendedVariantDisplay/model.tsx

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
1+
import { ConfigurationReference, getConf, readConfObject } from '@jbrowse/core/configuration';
22
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
33
import { getContainingTrack, getContainingView, getSession } from '@jbrowse/core/util';
44
import FilterListIcon from '@mui/icons-material/FilterList';
@@ -58,7 +58,7 @@ export default jbrowse => {
5858

5959
// @ts-ignore
6060
const trackId = getConf(track, ['trackId'])
61-
const detailsConfig = getConf(track, ['displays', '0', 'detailsConfig'])
61+
const detailsConfig = readConfObject(self.configuration, 'detailsConfig')
6262

6363
const widgetId = 'Variant-' + trackId;
6464
const featureWidget = session.addWidget(
@@ -78,7 +78,10 @@ export default jbrowse => {
7878
}))
7979

8080
.views(self => {
81-
const { renderProps: superRenderProps } = self
81+
const {
82+
renderProps: superRenderProps,
83+
renderingProps: superRenderingProps,
84+
} = self
8285
const filterMenu = {
8386
label: 'Filter By Attributes',
8487
icon: FilterListIcon,
@@ -140,6 +143,28 @@ export default jbrowse => {
140143
}
141144
},
142145

146+
renderingProps() {
147+
const superProps = superRenderingProps()
148+
return {
149+
...superProps,
150+
async onFeatureClick(_, featureId) {
151+
const session = getSession(self)
152+
try {
153+
const f = featureId || self.featureIdUnderMouse
154+
if (!f) {
155+
self.clearFeatureSelection()
156+
}
157+
else {
158+
await self.selectFeatureById(f)
159+
}
160+
} catch (e) {
161+
console.error(e)
162+
session.notifyError(`${e}`, e)
163+
}
164+
},
165+
}
166+
},
167+
143168
activeFilters() {
144169
const staticJexlFilters = (getConf(self, 'jexlFilters') || []).map((f: string) =>
145170
f?.startsWith('jexl:') ? f : `jexl:${f}`,

jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/ExtendedVariantWidget/ExtendedVariantWidget.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ export default jbrowse => {
105105
for (let display of displays){
106106
const tempProp = []
107107
for (let propertyName of display.properties){
108-
// This value is not in the header, and is probably injected programmatically, so skip:
109-
if (!featureInfoFields[propertyName]) {
108+
// This value is not in the header, and is probably injected programmatically, so skip.
109+
// Only apply this guard when featureInfoFields is actually populated (non-empty);
110+
// when metadata is unavailable we still want to render configured sections.
111+
if (Object.keys(featureInfoFields).length > 0 && !featureInfoFields[propertyName]) {
110112
continue
111113
}
112114

@@ -377,7 +379,7 @@ export default jbrowse => {
377379
delete feat["INFO"]["ANN"]
378380
}
379381

380-
const sections = detailsConfig.sections || inferSections(feat, infoFields)
382+
const sections = detailsConfig.sections?.length > 0 ? detailsConfig.sections : inferSections(feat, infoFields)
381383
const displays = makeDisplays(feat, sections, featureInfoFields, infoFields)
382384

383385
// If a given INFO field is used in a specific section, dont include in the catch-all INFO section:

jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import ExtendedVariantDisplay from './ExtendedVariantDisplay';
66
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
77
import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
88

9-
import CanvasFeatureRenderer from "@jbrowse/plugin-canvas";
109
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
1110
import { configSchema as EVAdapterConfigSchema, EVAdapterClass } from './ExtendedVariantAdapter';
1211

jbrowse/src/org/labkey/jbrowse/model/JsonFile.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,11 @@ private JSONObject getVcfTrack(Logger log, ExpData targetFile, ReferenceGenome r
552552
put("maxFeatureScreenDensity", 100);
553553
put("mouseover", "jexl:'Position: ' + formatWithCommas(get(feature,'POS'))");
554554

555+
if (shouldHaveFreeTextSearch())
556+
{
557+
put("supportsLuceneIndex", true);
558+
}
559+
555560
JSONObject json = getExtraTrackConfig();
556561
if (json != null && json.has("additionalFeatureMsg"))
557562
{

0 commit comments

Comments
 (0)