From c2e74f517378501c25b26033a196cd298a8baf90 Mon Sep 17 00:00:00 2001 From: turner Date: Tue, 26 Nov 2024 09:46:26 -0500 Subject: [PATCH] Set initial color for all track types --- dev/multi-select/multi-select.html | 12 +++++++++++- js/blat/blatTrack.js | 4 ++++ js/feature/featureTrack.js | 3 +++ js/feature/interactionTrack.js | 3 +++ js/feature/segTrack.js | 4 ++++ js/feature/spliceJunctionTrack.js | 3 +++ js/feature/wigTrack.js | 4 ++++ js/gcnv/gcnvTrack.js | 4 ++++ js/gwas/gwasTrack.js | 3 +++ js/shoebox/shoeboxTrack.js | 3 +++ js/trackBase.js | 14 ++++++++++++-- js/variant/variantTrack.js | 3 +++ 12 files changed, 57 insertions(+), 3 deletions(-) diff --git a/dev/multi-select/multi-select.html b/dev/multi-select/multi-select.html index cb470ece7..06624a28b 100644 --- a/dev/multi-select/multi-select.html +++ b/dev/multi-select/multi-select.html @@ -297,8 +297,18 @@ "aliasURL": "https://s3.amazonaws.com/igv.org.genomes/hg19/hg19_alias.tab", "chromosomeOrder": "chr1, chr2, chr3, chr4, chr5, chr6, chr7, chr8, chr9, chr10, chr11, chr12, chr13, chr14, chr15, chr16, chr17, chr18, chr19, chr20, chr21, chr22, chrX, chrY" }, - "locus": "chr8:128,746,680-128,756,197", + "locus": "chr10:1-120,250,001", "tracks": [ + { + "url": "https://www.dropbox.com/scl/fi/yczvlb961oh77sgv9syc6/MP_skin_CRUSH_Loxafr3.0_HiC.bedgraph?rlkey=e2j6wm62gxoiiyhh0m3bems7q&dl=0", + "name": "MP_skin_CRUSH_Loxafr3.0_HiC.bedgraph", + "format": "bedgraph", + "type": "wig", + "color": "rgb(255, 114, 110)", + "altColor": "rgb(106, 207, 255)", + "min": -100, + "max": 100 + }, { "name": "Homo sapiens A549 treated with 0.02% ethanol for 1 hour EP300 ", "url": "https://www.encodeproject.org/files/ENCFF000NDX/@@download/ENCFF000NDX.bigWig", diff --git a/js/blat/blatTrack.js b/js/blat/blatTrack.js index 3ae8b96cb..3f881a9da 100644 --- a/js/blat/blatTrack.js +++ b/js/blat/blatTrack.js @@ -35,6 +35,10 @@ class BlatTrack extends FeatureTrack { this._features = features; this.featureSource = new StaticFeatureSource({features}, this.browser.genome) } + + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + } openTableView() { diff --git a/js/feature/featureTrack.js b/js/feature/featureTrack.js index 802daa46f..f2d3e4e50 100755 --- a/js/feature/featureTrack.js +++ b/js/feature/featureTrack.js @@ -99,6 +99,9 @@ class FeatureTrack extends TrackBase { this.visibilityWindow = await this.featureSource.defaultVisibilityWindow() } + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + return this } diff --git a/js/feature/interactionTrack.js b/js/feature/interactionTrack.js index cf00a53e2..7284c9743 100644 --- a/js/feature/interactionTrack.js +++ b/js/feature/interactionTrack.js @@ -135,6 +135,9 @@ class InteractionTrack extends TrackBase { this.featureSource.visibilityWindow = this.visibilityWindow // <- this looks odd } + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + return this } diff --git a/js/feature/segTrack.js b/js/feature/segTrack.js index 7ea44b622..837c9d989 100755 --- a/js/feature/segTrack.js +++ b/js/feature/segTrack.js @@ -93,6 +93,10 @@ class SegTrack extends TrackBase { if (this.header) { this.setTrackProperties(this.header) } + + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + } diff --git a/js/feature/spliceJunctionTrack.js b/js/feature/spliceJunctionTrack.js index 7d03078ab..c7542ea37 100755 --- a/js/feature/spliceJunctionTrack.js +++ b/js/feature/spliceJunctionTrack.js @@ -84,6 +84,9 @@ class SpliceJunctionTrack extends TrackBase { this.visibilityWindow = await this.featureSource.defaultVisibilityWindow() } + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + return this } diff --git a/js/feature/wigTrack.js b/js/feature/wigTrack.js index 588ac213a..75577d5ff 100755 --- a/js/feature/wigTrack.js +++ b/js/feature/wigTrack.js @@ -77,6 +77,10 @@ class WigTrack extends TrackBase { const header = await this.getHeader() if (this.disposed) return // This track was removed during async load if (header) this.setTrackProperties(header) + + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + } get supportsWholeGenome() { diff --git a/js/gcnv/gcnvTrack.js b/js/gcnv/gcnvTrack.js index b6f4c1c72..c779eba25 100755 --- a/js/gcnv/gcnvTrack.js +++ b/js/gcnv/gcnvTrack.js @@ -78,6 +78,10 @@ class GCNVTrack extends TrackBase { } } } + + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + } menuItemList() { diff --git a/js/gwas/gwasTrack.js b/js/gwas/gwasTrack.js index 1eda88bbf..5a3337f50 100644 --- a/js/gwas/gwasTrack.js +++ b/js/gwas/gwasTrack.js @@ -103,6 +103,9 @@ class GWASTrack extends TrackBase { } } + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + return this } diff --git a/js/shoebox/shoeboxTrack.js b/js/shoebox/shoeboxTrack.js index 21ba837e6..cadf31ea8 100755 --- a/js/shoebox/shoeboxTrack.js +++ b/js/shoebox/shoeboxTrack.js @@ -77,6 +77,9 @@ class ShoeboxTrack extends TrackBase { // This shouldn't be neccessary if (!this.scale) this.scale = 1.0 + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + } get color() { diff --git a/js/trackBase.js b/js/trackBase.js index 70632187f..fb4368cc4 100644 --- a/js/trackBase.js +++ b/js/trackBase.js @@ -95,8 +95,8 @@ class TrackBase { } } - this._initialColor = this.color || this.constructor.defaultColor - this._initialAltColor = this.altColor || this.constructor.defaultColor + // this._initialColor = this.color || this.constructor.defaultColor + // this._initialAltColor = this.altColor || this.constructor.defaultColor if (config.name || config.label) { this.name = config.name || config.label @@ -138,6 +138,16 @@ class TrackBase { } } + async postInit(){ + + console.log(`TrackBase - track(${ this.type }) - postInit()`) + + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + + return this + } + get name() { return this._name } diff --git a/js/variant/variantTrack.js b/js/variant/variantTrack.js index 68a824407..405c309f2 100644 --- a/js/variant/variantTrack.js +++ b/js/variant/variantTrack.js @@ -168,6 +168,9 @@ class VariantTrack extends TrackBase { } } + this._initialColor = this.color || this.constructor.defaultColor + this._initialAltColor = this.altColor || this.constructor.defaultColor + return this }