diff --git a/demo-no-ncolor-3ce77ba35d.tar.gz b/demo-no-ncolor-3ce77ba35d.tar.gz new file mode 100644 index 000000000..a3d7b4bd2 Binary files /dev/null and b/demo-no-ncolor-3ce77ba35d.tar.gz differ diff --git a/embed.html b/embed.html index 35843087b..de9414258 100644 --- a/embed.html +++ b/embed.html @@ -1,5 +1,6 @@ +
@@ -11,23 +12,45 @@ - - - - - + + + + + - + \ No newline at end of file diff --git a/js/bam/alignmentTrack.js b/js/bam/alignmentTrack.js index b67238d3d..b130799a0 100644 --- a/js/bam/alignmentTrack.js +++ b/js/bam/alignmentTrack.js @@ -1,18 +1,18 @@ import BaseModificationRenderer from "./mods/baseModificationRenderer.js" import IGVGraphics from "../igv-canvas.js" import PairedAlignment from "./pairedAlignment.js" -import {IGVColor, StringUtils} from "../../node_modules/igv-utils/src/index.js" -import {isSecureContext} from "../util/igvUtils.js" -import {createBlatTrack, maxSequenceSize} from "../blat/blatTrack.js" -import {reverseComplementSequence} from "../util/sequenceUtils.js" +import { IGVColor, StringUtils } from "../../node_modules/igv-utils/src/index.js" +import { isSecureContext } from "../util/igvUtils.js" +import { createBlatTrack, maxSequenceSize } from "../blat/blatTrack.js" +import { reverseComplementSequence } from "../util/sequenceUtils.js" import orientationTypes from "./orientationTypes.js" -import {ColorTable, PaletteColorTable} from "../util/colorPalletes.js" +import { ColorTable, PaletteColorTable } from "../util/colorPalletes.js" import TrackBase from "../trackBase.js" -import {getChrColor} from "../util/getChrColor.js" +import { getChrColor } from "../util/getChrColor.js" import $ from "../vendor/jquery-3.3.1.slim.js" -import {createCheckbox} from "../igv-icons.js" +import { createCheckbox } from "../igv-icons.js" import BaseModificationKey from "./mods/baseModificationKey.js" -import {modificationName} from "./mods/baseModificationUtils.js" +import { modificationName } from "./mods/baseModificationUtils.js" const alignmentStartGap = 5 @@ -232,7 +232,7 @@ class AlignmentTrack extends TrackBase { xBlockStart += 1 xBlockEnd -= 1 } - IGVGraphics.fillRect(ctx, xBlockStart, 2, (xBlockEnd - xBlockStart), downsampleRowHeight - 2, {fillStyle: "black"}) + IGVGraphics.fillRect(ctx, xBlockStart, 2, (xBlockEnd - xBlockStart), downsampleRowHeight - 2, { fillStyle: "black" }) }) } else { @@ -346,7 +346,7 @@ class AlignmentTrack extends TrackBase { if (alignment.mq <= 0) { connectorColor = IGVColor.addAlpha(connectorColor, 0.15) } - IGVGraphics.setProperties(ctx, {fillStyle: connectorColor, strokeStyle: connectorColor}) + IGVGraphics.setProperties(ctx, { fillStyle: connectorColor, strokeStyle: connectorColor }) IGVGraphics.strokeLine(ctx, xBlockStart, yStrokedLine, xBlockEnd, yStrokedLine) } @@ -365,7 +365,7 @@ class AlignmentTrack extends TrackBase { if (alignment.mq <= 0) { alignmentColor = IGVColor.addAlpha(alignmentColor, 0.15) } - IGVGraphics.setProperties(ctx, {fillStyle: alignmentColor, strokeStyle: outlineColor}) + IGVGraphics.setProperties(ctx, { fillStyle: alignmentColor, strokeStyle: outlineColor }) // Save bases to draw into an array for later drawing, so they can be overlaid on insertion blocks, // which is relevant if we have insertions with size label @@ -409,7 +409,7 @@ class AlignmentTrack extends TrackBase { // Add gap width as text like Java IGV if it fits nicely and is a multi-base gap if (this.showDeletionText && gap.len > 1 && lineWidth >= gapTextWidth + 8) { const textStart = gapCenter - (gapTextWidth / 2) - IGVGraphics.fillRect(ctx, textStart - 1, y - 1, gapTextWidth + 2, 12, {fillStyle: "white"}) + IGVGraphics.fillRect(ctx, textStart - 1, y - 1, gapTextWidth + 2, 12, { fillStyle: "white" }) IGVGraphics.fillText(ctx, gapLenText, textStart, y + 10, { 'font': 'normal 10px monospace', 'fillStyle': this.deletionTextColor, @@ -442,7 +442,7 @@ class AlignmentTrack extends TrackBase { const xBlockStart = (refOffset / bpPerPixel) - (widthBlock / 2) if ((xBlockStart - lastXBlockStart) > 2) { - const props = {fillStyle: this.insertionColor} + const props = { fillStyle: this.insertionColor } // Draw decorations like Java IGV to make an 'I' shape IGVGraphics.fillRect(ctx, xBlockStart - 2, y, widthBlock + 4, 2, props) @@ -463,18 +463,18 @@ class AlignmentTrack extends TrackBase { } } - for (let {bbox, baseColor, readChar} of basesToDraw) { + for (let { bbox, baseColor, readChar } of basesToDraw) { const threshold = 1.0 / 10.0 if (bpPerPixel <= threshold && bbox.height >= 8) { // render letter const fontHeight = Math.min(10, bbox.height) ctx.font = '' + fontHeight + 'px sans-serif' const center = bbox.x + (bbox.width / 2.0) - IGVGraphics.strokeText(ctx, readChar, center - (ctx.measureText(readChar).width / 2), fontHeight - 1 + bbox.y, {strokeStyle: baseColor}) + IGVGraphics.strokeText(ctx, readChar, center - (ctx.measureText(readChar).width / 2), fontHeight - 1 + bbox.y, { strokeStyle: baseColor }) } else { // render colored block - IGVGraphics.fillRect(ctx, bbox.x, bbox.y, bbox.width, bbox.height, {fillStyle: baseColor}) + IGVGraphics.fillRect(ctx, bbox.x, bbox.y, bbox.width, bbox.height, { fillStyle: baseColor }) } } @@ -564,16 +564,16 @@ class AlignmentTrack extends TrackBase { y] } - IGVGraphics.fillPolygon(ctx, xListPixel, yListPixel, {fillStyle: alignmentColor}) + IGVGraphics.fillPolygon(ctx, xListPixel, yListPixel, { fillStyle: alignmentColor }) if (strokeOutline) { - IGVGraphics.strokePolygon(ctx, xListPixel, yListPixel, {strokeStyle: blockOutlineColor}) + IGVGraphics.strokePolygon(ctx, xListPixel, yListPixel, { strokeStyle: blockOutlineColor }) } } // Internal block else { - IGVGraphics.fillRect(ctx, blockStartPixel, y, blockWidthPixel, alignmentHeight, {fillStyle: alignmentColor}) + IGVGraphics.fillRect(ctx, blockStartPixel, y, blockWidthPixel, alignmentHeight, { fillStyle: alignmentColor }) if (strokeOutline) { ctx.save() @@ -610,7 +610,7 @@ class AlignmentTrack extends TrackBase { readChar = refChar } if (readChar === "X" || refChar !== readChar || isSoftClip || showAllBases) { - + console.log(nucleotideColors) let baseColor = nucleotideColors[readChar] || "rgb(0,0,0)" if (!isSoftClip && qual !== undefined && qual.length > seqOffset + i) { const readQual = qual[seqOffset + i] @@ -646,11 +646,11 @@ class AlignmentTrack extends TrackBase { const fontHeight = Math.min(10, bbox.height) context.font = '' + fontHeight + 'px sans-serif' center = bbox.x + (bbox.width / 2.0) - IGVGraphics.strokeText(context, char, center - (context.measureText(char).width / 2), fontHeight - 1 + bbox.y, {strokeStyle: color}) + IGVGraphics.strokeText(context, char, center - (context.measureText(char).width / 2), fontHeight - 1 + bbox.y, { strokeStyle: color }) } else { // render colored block - IGVGraphics.fillRect(context, bbox.x, bbox.y, bbox.width, bbox.height, {fillStyle: color}) + IGVGraphics.fillRect(context, bbox.x, bbox.y, bbox.width, bbox.height, { fillStyle: color }) } } } @@ -679,18 +679,18 @@ class AlignmentTrack extends TrackBase { menuItems.push('