Skip to content

Commit

Permalink
* don't try to infer file format for webservices
Browse files Browse the repository at this point in the history
* don't show pulldown menu for track hubs -- in general too many sequences
  • Loading branch information
jrobinso committed Jul 23, 2024
1 parent 9f0b2d8 commit ad0bf5d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
55 changes: 24 additions & 31 deletions js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {loadGenbank} from "./gbk/genbankParser.js"
import igvCss from "./embedCss.js"
import {sampleInfoTileWidth, sampleInfoTileXShim} from "./sample/sampleInfoConstants.js"
import QTLSelections from "./qtl/qtlSelections.js"
import {inferFileFormat, inferFileFormatFromContents} from "./util/fileFormatUtils.js"
import {inferFileFormat} from "./util/fileFormatUtils.js"


// css - $igv-scrollbar-outer-width: 14px;
Expand Down Expand Up @@ -819,6 +819,7 @@ class Browser {
// chromosome select widget -- Show this IFF its not explicitly hidden AND the genome has pre-loaded chromosomes
const showChromosomeWidget =
this.config.showChromosomeWidget !== false &&
this.genome.showChromosomeWidget !== false &&
genome.chromosomeNames &&
genome.chromosomeNames.length > 1

Expand Down Expand Up @@ -1206,15 +1207,14 @@ class Browser {
} else if (config.fastaURL) {
config.format = "fasta" // by definition
} else if (!config.sourceType) {
// If not a webservice, see if we can infer a format from the URL
const format = await inferFileFormat(config)
if (format) {
config.format = format
} else {
if (config.sourceType === "htsget") {
// Check for htsget URL. This is a longshot
await HtsgetReader.inferFormat(config)
}
}
} else if (config.sourceType === "htsget") {
// Finally check for htsget URL. This is a longshot
await HtsgetReader.inferFormat(config)
}
}

Expand All @@ -1226,10 +1226,9 @@ class Browser {

if (!type) {

// If neither format nor type is known assume a sample information file. We should do some validation here
// If neither format nor type are known throw an error
if (!config.format) {
// type = "sampleinfo"
throw Error(`Attempt to load unrecognized track type`)
throw Error(`Unrecognized track: ${JSON.stringify(config)}`)
} else if (config.format === "hic") {
const hicFile = new HicFile(config)
await hicFile.readHeaderAndFooter()
Expand Down Expand Up @@ -1257,34 +1256,28 @@ class Browser {
config.type = type
}

if ("sampleinfo" === type) {
// Deprecated option
await this.loadSampleInfo(config)
return undefined
} else {
// Set defaults if specified
if (this.trackDefaults && type) {
const settings = this.trackDefaults[type]
if (settings) {
for (let property in settings) {
if (settings.hasOwnProperty(property) && config[property] === undefined) {
config[property] = settings[property]
}
// Set defaults if specified
if (this.trackDefaults && type) {
const settings = this.trackDefaults[type]
if (settings) {
for (let property in settings) {
if (settings.hasOwnProperty(property) && config[property] === undefined) {
config[property] = settings[property]
}
}
}
}

const track = getTrack(type, config, this)
if (undefined === track) {
this.alert.present(new Error(`Error creating track. Could not determine track type for file: ${config.url || config}`), undefined)
} else {

if (config.roi && config.roi.length > 0) {
track.roiSets = config.roi.map(r => new TrackROISet(r, this.genome))
}
const track = getTrack(type, config, this)
if (undefined === track) {
this.alert.present(new Error(`Error creating track. Could not determine track type for file: ${config.url || config}`), undefined)
} else {

return track
if (config.roi && config.roi.length > 0) {
track.roiSets = config.roi.map(r => new TrackROISet(r, this.genome))
}

return track
}
}

Expand Down
4 changes: 4 additions & 0 deletions js/genome/genome.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ class Genome {
return this.#wgChromosomeNames ? this.#wgChromosomeNames.slice() : undefined
}

get showChromosomeWidget() {
return this.config.showChromosomeWidget
}

/**
* Return the genome coordinate in kb for the give chromosome and position.
* NOTE: This might return undefined if the chr is filtered from whole genome view.
Expand Down
1 change: 1 addition & 0 deletions js/ucsc/ucscHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ isPcr dynablat-01.soe.ucsc.edu 4040 dynamic GCF/000/186/305/GCF_000186305.1
twoBitURL: this.baseURL + this.genomeStanza.getProperty("twoBitPath"),
nameSet: "ucsc",
wholeGenomeView: false,
showChromosomeWidget: false
}

if (this.genomeStanza.hasProperty("defaultPos")) {
Expand Down

0 comments on commit ad0bf5d

Please sign in to comment.