Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow color function for alignment #1512

Merged
merged 1 commit into from
May 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions js/bam/bamTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ class CoverageTrack {
let color
if (this.parent.coverageColor) {
color = this.parent.coverageColor
} else if (this.parent.color !== undefined) {
} else if (this.parent.color !== undefined && typeof this.parent.color !== "function") {
color = IGVColor.darkenLighten(this.parent.color, -35)
} else {
color = DEFAULT_COVERAGE_COLOR
Expand Down Expand Up @@ -1367,7 +1367,10 @@ class AlignmentTrack {
case "firstOfPairStrand":
case "pairOrientation":
case "tag":
return this.parent.color || DEFAULT_CONNECTOR_COLOR
if (this.parent.color) {
return (typeof this.parent.color === "function") ? this.parent.color(alignment) : this.parent.color
}
return DEFAULT_CONNECTOR_COLOR
default:
return this.getAlignmentColor(alignment)

Expand All @@ -1376,7 +1379,10 @@ class AlignmentTrack {

getAlignmentColor(alignment) {

let color = this.parent.color || DEFAULT_ALIGNMENT_COLOR // The default color if nothing else applies
let color = DEFAULT_ALIGNMENT_COLOR // The default color if nothing else applies
if (this.parent.color) {
color = (typeof this.parent.color === "function") ? this.parent.color(alignment) : this.parent.color
}
const option = this.colorBy
switch (option) {
case "strand":
Expand Down Expand Up @@ -1445,9 +1451,6 @@ class AlignmentTrack {
}
}
break

default:
color = this.parent.color || DEFAULT_ALIGNMENT_COLOR
}

return color
Expand Down