Skip to content

Commit

Permalink
Add genome change event
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Oct 27, 2023
1 parent d423f7b commit 1856d04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 5 additions & 8 deletions dev/ucsc/hub.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,17 @@
}

const hub = await Hub.loadHub("https://hgdownload.soe.ucsc.edu/hubs/GCA/009/914/755/GCA_009914755.4/hub.txt", hubOptions)
const ref = hub.getGenomeConfig()

const igvConfig = {
reference: ref
reference: hub.getGenomeConfig()
}

// for(let tc of hub.getTrackConfigurations()) {
// for(let t of tc.tracks) {
// if(t.url.endsWith("undefined")) console.log(`${tc.label} ${t.name} ${t.url}`)
// }
// }

const browser = await igv.createBrowser(document.getElementById('igvDiv'), igvConfig)

browser.on('genomechange', (genome) => {
console.log(genome.getTrackConfigurations())
})

const selector = document.getElementById("select")
selector.addEventListener("change", () => document.getElementById("hub-input").value = selector.value)

Expand Down
4 changes: 4 additions & 0 deletions js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ class Browser {
throw new Error(`Cannot set initial locus ${locus}`)
}

if(genomeChange) {
this.fireEvent('genomechange', [genome])
}

if (genomeChange && this.circularView) {
this.circularView.setAssembly({
name: this.genome.id,
Expand Down

0 comments on commit 1856d04

Please sign in to comment.