Skip to content

Commit 3532743

Browse files
authored
Fix for blank filter bug (#111)
1 parent f3d589c commit 3532743

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/ExtendedVariantRenderer/components/SvgFeatureRendering.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import React, { useEffect, useRef, useState, useCallback } from 'react'
1010
import FeatureGlyph from './FeatureGlyph' // FeatureGlyph copied over. Referencing original produces errors. Compare to line 11
1111
import SvgOverlay from '@jbrowse/plugin-svg/src/SvgFeatureRenderer/components/SvgOverlay' // NEW: Updated SvgOverlay to reference original file in @jbrowse. No errors produced.
1212
import { chooseGlyphComponent, layOut } from './util' // NEW: chooseGlyphComponent() in util updated to render SNVs as a diamond
13-
import { expandFilters, expandedFilterStringToObj } from '../../FilterWidget/filterUtil' // NOTE: Now dependent on FilterWidget plugin
13+
import { expandFilters, expandedFilterStringToObj, isFilterStringExpanded } from '../../FilterWidget/filterUtil' // NOTE: Now dependent on FilterWidget plugin
1414
import jexl from 'jexl'
1515

1616
const renderingStyle = {
@@ -132,9 +132,13 @@ function isDisplayed(feature, filters){
132132
}
133133
for(const filter in filters){
134134
try {
135-
const filterObj = expandedFilterStringToObj(filters[filter])
136-
if(!jexl.evalSync(filterObj["expression"], feature)){
137-
return false
135+
if(isFilterStringExpanded(filters[filter])){
136+
const filterObj = expandedFilterStringToObj(filters[filter])
137+
if(!jexl.evalSync(filterObj["expression"], feature)){
138+
return false
139+
}
140+
} else {
141+
continue
138142
}
139143
} catch (e){
140144
console.error("Error in filter execution: "+e)

jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/FilterWidget/filterUtil.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ export function expandFilters(filters) {
134134
const field = filterProps[0]
135135
const rawOperator = filterProps[1]
136136
const value = filterProps[2]
137+
if(rawOperator == "" || value == ""){
138+
filterList.push(filter)
139+
continue
140+
}
137141
const fieldLocation = fields[field].baseLocation;
138142
const operator = operators[rawOperator];
139143
const jexlExpression = "variant.INFO." + fieldLocation + operator + value

0 commit comments

Comments
 (0)