From e6a0555667da6a865b0428ff0484f696874ad731 Mon Sep 17 00:00:00 2001 From: Jim Robinson Date: Thu, 19 Nov 2020 09:10:58 -0800 Subject: [PATCH] Bug fix -- annotation tracks not searchable. See issue #1227 --- js/bigwig/bwSource.js | 4 ++-- js/feature/featureSource.js | 8 ++++---- js/feature/featureTrack.js | 9 ++++----- js/feature/textFeatureSource.js | 8 +++++--- js/tdf/tdfSource.js | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/js/bigwig/bwSource.js b/js/bigwig/bwSource.js index b5f60179a..bc6a19ffb 100755 --- a/js/bigwig/bwSource.js +++ b/js/bigwig/bwSource.js @@ -28,9 +28,9 @@ import pack from "../feature/featurePacker.js"; class BWSource { - constructor(config, genome) { + constructor(config, browser) { this.reader = new BWReader(config, genome); - this.genome = genome; + this.genome = browser.genome; this.format = config.format || "bigwig"; this.wgValues = {}; } diff --git a/js/feature/featureSource.js b/js/feature/featureSource.js index 0fe8b7865..8a755594a 100755 --- a/js/feature/featureSource.js +++ b/js/feature/featureSource.js @@ -28,15 +28,15 @@ import BWSource from "../bigwig/bwSource.js" import TDFSource from "../tdf/tdfSource.js" -function FeatureSource(config, genome) { +function FeatureSource(config, browser) { const format = config.format ? config.format.toLowerCase() : undefined; if ('bigwig' === format || 'bigbed' === format || 'bb' === format) { - return new BWSource(config, genome); + return new BWSource(config, browser); } else if ("tdf" === format) { - return new TDFSource(config, genome); + return new TDFSource(config, browser); } else { - return new TextFeatureSource(config, genome); + return new TextFeatureSource(config, browser); } } diff --git a/js/feature/featureTrack.js b/js/feature/featureTrack.js index 263744ccc..9fcfbe8a1 100755 --- a/js/feature/featureTrack.js +++ b/js/feature/featureTrack.js @@ -61,7 +61,7 @@ class FeatureTrack extends TrackBase { } else { this.featureSource = config.featureSource ? config.featureSource : - FeatureSource(config, browser.genome); + FeatureSource(config, browser); } // Set default heights @@ -144,8 +144,7 @@ class FeatureTrack extends TrackBase { async getFeatures(chr, start, end, bpPerPixel) { const visibilityWindow = this.visibilityWindow; return this.featureSource.getFeatures({chr, start, end, bpPerPixel, visibilityWindow}); - }; - + } /** * The required height in pixels required for the track content. This is not the visible track height, which @@ -175,7 +174,7 @@ class FeatureTrack extends TrackBase { } - }; + } draw(options) { @@ -237,7 +236,7 @@ class FeatureTrack extends TrackBase { console.log("No feature list"); } - }; + } clickedFeatures(clickState) { diff --git a/js/feature/textFeatureSource.js b/js/feature/textFeatureSource.js index 2fafe5933..345630940 100644 --- a/js/feature/textFeatureSource.js +++ b/js/feature/textFeatureSource.js @@ -45,9 +45,11 @@ import pack from "../feature/featurePacker.js"; */ class TextFeatureSource { - constructor(config, genome) { + constructor(config, browser) { + const genome = browser.genome; this.config = config || {}; + this.browser = browser; this.genome = genome; this.sourceType = (config.sourceType === undefined ? "file" : config.sourceType); this.visibilityWindow = config.visibilityWindow; @@ -232,10 +234,10 @@ class TextFeatureSource { for (let feature of featureList) { if (feature.name) { //TODO igv.browser => igv.Globals or igv.FeatureDB - this.config.browser.featureDB[feature.name.toUpperCase()] = feature; + this.browser.featureDB[feature.name.toUpperCase()] = feature; } if (feature.gene && feature.gene.name) { - this.config.browser.featureDB[feature.gene.name.toUpperCase()] = feature; + this.browser.featureDB[feature.gene.name.toUpperCase()] = feature; } } } diff --git a/js/tdf/tdfSource.js b/js/tdf/tdfSource.js index 5fa71b159..46d6193de 100644 --- a/js/tdf/tdfSource.js +++ b/js/tdf/tdfSource.js @@ -29,9 +29,9 @@ import GenomicInterval from "../genome/genomicInterval.js"; class TDFSource { - constructor(config, genome) { + constructor(config, browser) { - this.genome = genome; + this.genome = browser.genome; this.windowFunction = config.windowFunction || "mean"; this.reader = new TDFReader(config, genome); }