diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d8e6c4..33ef903b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/) - Display viewed chromosome region in cytogenetic ideogram figure ### Changed ### Fixed + - Can now display samples that doesnt have data on all chromosomes ## [2.0.1] ### Added diff --git a/assets/js/overview.js b/assets/js/overview.js index 5e6dbc65..18db17af 100644 --- a/assets/js/overview.js +++ b/assets/js/overview.js @@ -22,6 +22,23 @@ export class OverviewCanvas extends BaseScatterTrack { this.topBottomPadding = 8 // Padding for top and bottom in graph this.leftmostPoint = this.x + 10 // Draw y-values for graph left of this point + // Setup canvas for repeated patterns + this.patternCanvas = document.createElement('canvas') + const size = 20 + this.patternCanvas.width = size + this.patternCanvas.height = size + const patternCtx = this.patternCanvas.getContext('2d') + patternCtx.fillStyle = "#E6E9ED" + patternCtx.strokeStyle = "#4C6D94" + patternCtx.lineWidth = Math.round(size / 10) + patternCtx.lineCap = 'square' + patternCtx.fillRect(0, 0, size, size) + patternCtx.moveTo(size / 2, 0) + patternCtx.lineTo(size, size / 2) + patternCtx.moveTo(0, size / 2) + patternCtx.lineTo(size / 2, size) + patternCtx.stroke() + // BAF values this.baf = { yStart: 1.0, // Start value for y axis @@ -39,6 +56,7 @@ export class OverviewCanvas extends BaseScatterTrack { } // Canvas variables + this.disabledChroms = [] this.width = document.body.clientWidth // Canvas width this.height = this.y + 2 * this.plotHeight + 2 * this.topBottomPadding // Canvas height this.drawCanvas.width = parseInt(this.width) @@ -58,14 +76,16 @@ export class OverviewCanvas extends BaseScatterTrack { this.staticCanvas.addEventListener('mousedown', event => { event.stopPropagation() const selectedChrom = this.pixelPosToGenomicLoc(event.x) - // Dont update if chrom previously selected - // Move interactive view to selected region - const chrom = selectedChrom.chrom - const start = 1 - const end = this.dims[chrom].size - 1 - // Mark region - this.markRegion({ chrom, start, end }) - drawTrack({ chrom, start, end }) // redraw canvas + if (!this.disabledChroms.includes(selectedChrom.chrom)) { + // Dont update if chrom previously selected + // Move interactive view to selected region + const chrom = selectedChrom.chrom + const start = 1 + const end = this.dims[chrom].size - 1 + // Mark region + this.markRegion({ chrom, start, end }) + drawTrack({ chrom, start, end }) // redraw canvas + } }) this.staticCanvas.parentElement.addEventListener('mark-region', event => { this.markRegion({ ...event.detail.region }) @@ -182,16 +202,23 @@ export class OverviewCanvas extends BaseScatterTrack { height: this.plotHeight }) // Plot scatter data - drawPoints({ - ctx, - data: chromCovData.baf, - color: this.baf.color - }) - drawPoints({ - ctx, - data: chromCovData.data, - color: this.log2.color - }) + if ( chromCovData.baf.length > 0 || chromCovData.data.length > 0 ) { + drawPoints({ + ctx, + data: chromCovData.baf, + color: this.baf.color + }) + drawPoints({ + ctx, + data: chromCovData.data, + color: this.log2.color + }) + } else { + const pattern = ctx.createPattern(this.patternCanvas, 'repeat') + ctx.fillStyle = pattern + ctx.fillRect(chromCovData.x_pos, chromCovData.y_pos + 1, width - 2, (this.plotHeight * 2) - 2) + this.disabledChroms.push(chrom) + } } async drawOverviewContent (printing) { diff --git a/assets/js/track/variant.js b/assets/js/track/variant.js index e9e40742..81ebbff3 100644 --- a/assets/js/track/variant.js +++ b/assets/js/track/variant.js @@ -139,7 +139,8 @@ export class VariantTrack extends BaseAnnotationTrack { { title: 'Ref', value: `${variant.reference}` }, { title: 'Alt', value: `${variant.alternative}` }, { title: 'Cytoband start/end', value: `${variant.cytoband_start}/${variant.cytoband_end}` }, - { title: 'Quality', value: `${variant.quality}` } + { title: 'Quality', value: `${variant.quality}` }, + { title: 'Rank score', value: `${variant.rank_score}` } ] }) this.trackContainer.appendChild(tooltip) diff --git a/gens/graph.py b/gens/graph.py index d0ffea7a..345abc20 100644 --- a/gens/graph.py +++ b/gens/graph.py @@ -308,5 +308,5 @@ def get_cov(req, x_ampl, json_data=None, cov_fh=None, baf_fh=None): data_type=data_type, ) if not new_start_pos and not log2_records and not baf_records: - raise NoRecordsException("No records") + LOG.warning("No records for region") return region, new_start_pos, new_end_pos, log2_records, baf_records