Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
igv.createBrowser(igvContainer, igvOptions)
// Log igv.js initialization in Google Analytics
ga('send', 'event', 'igv', 'initialize')
log('igv:initialize')
}
// Monkey patch getKnownGenome to remove baked-in genes track.
// We use a different gene annotation source, in a different track order,
// so removing this default gives our genome browser instance a more
// polished feel.
const originalGetKnownGenomes = igv.GenomeUtils.getKnownGenomes
igv.GenomeUtils.getKnownGenomes = function() {
return originalGetKnownGenomes.apply(this).then(reference => {
const newRef = {}
newRef['GRCm38'] = reference['mm10'] // Fix name
Object.keys(reference).forEach(key => {
delete reference[key].tracks
newRef[key] = reference[key]
})
return newRef
})
}
igvOptions['search'] = searchOptions
}
igv.createBrowser(igvContainer, igvOptions)
// Log igv.js initialization in Google Analytics
ga('send', 'event', 'igv', 'initialize')
log('igv:initialize')
}
// Monkey patch getKnownGenome to remove baked-in genes track.
// We use a different gene annotation source, in a different track order,
// so removing this default gives our genome browser instance a more
// polished feel.
const originalGetKnownGenomes = igv.GenomeUtils.getKnownGenomes
igv.GenomeUtils.getKnownGenomes = function() {
return originalGetKnownGenomes.apply(this).then(reference => {
const newRef = {}
newRef['GRCm38'] = reference['mm10'] // Fix name
Object.keys(reference).forEach(key => {
delete reference[key].tracks
newRef[key] = reference[key]
})
return newRef
})
}
// that case.
locus = [fallbackLocus]
}
const genesTrackName = `Genes | ${bamAndBaiFiles[0].genomeAnnotation.name}`
const genesTrack = getGenesTrack(gtfFiles, genomeId, genesTrackName)
const bamTracks = getBamTracks(bamAndBaiFiles)
const tracks = [genesTrack].concat(bamTracks)
const igvOptions = { reference, locus, tracks }
if (typeof searchOptions !== 'undefined') {
igvOptions['search'] = searchOptions
}
igv.createBrowser(igvContainer, igvOptions)
// Log igv.js initialization in Google Analytics
ga('send', 'event', 'igv', 'initialize')
log('igv:initialize')
}
function initializeIgv(containerId, bamAndBaiFiles, gtfFiles, uniqueGenes) {
// Bail if already displayed
delete igv.browser
const igvContainer = document.getElementById(containerId)
igvContainer.innerHTML = ''
const genomeId = bamAndBaiFiles[0].genomeAssembly
let reference
let searchOptions
let fallbackLocus
if (genomeId === 'Macaca_fascicularis_5.0') {
fallbackLocus = 'chr1:1-2'
// To consider:
// - Update genomes pipeline to make such files automatically reproducible
const genomeAnnotationObj = bamAndBaiFiles[0].genomeAnnotation
const genomePath =