Skip to content

Commit

Permalink
blatTrack -- fetch features (blat) before track creation to prevent e…
Browse files Browse the repository at this point in the history
…mpty tracks on error
  • Loading branch information
jrobinso committed Jul 31, 2024
1 parent b2bf7d0 commit aef1a5c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion js/blat/blatTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ class BlatTrack extends FeatureTrack {
}
this.sequence = config.sequence
this.table = undefined

// On initial creation features are fetched before track construction
if(config.features) {
this._features = config.features
this.featureSource = new StaticFeatureSource({features: config.features}, this.browser.genome)
delete config.features
}
}

async postInit() {
if(!this.featureSource) {
// This will be the case when restoring from a session
const db = this.browser.genome.id // TODO -- blat specific property
const url = this.browser.config["blatServerURL"]
const features = await blat({url, userSeq: this.sequence, db})
Expand Down Expand Up @@ -106,14 +114,19 @@ async function createBlatTrack({sequence, browser, name, title}) {

try {

const db = browser.genome.id // TODO -- blat specific property
const url = browser.config["blatServerURL"]
const features = await blat({url, userSeq: this.sequence, db})

const trackConfig = {
type: 'blat',
name: name || 'blat results',
title: title || 'blat results',
sequence: sequence,
altColor: 'rgb(176, 176, 236)',
color: 'rgb(236, 176, 176)',
searchable: false
searchable: false,
features
}

const track = await browser.loadTrack(trackConfig)
Expand Down

0 comments on commit aef1a5c

Please sign in to comment.