Skip to content

Commit

Permalink
Merge pull request #17 from iobio/yang_bam2_add_custom_color_for_mapp…
Browse files Browse the repository at this point in the history
…ed_reads_chart

Reset back the color when bam file changes
  • Loading branch information
anderspitman authored Nov 26, 2024
2 parents 2dba166 + b34a97c commit d91f2d8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,18 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>

const broker_ = getDataBroker(broker);
broker_.addEventListener('mapped-reads-from-index-file', (event) => {
const chart = document.querySelector('#mapped-reads-chart');
// Determine the number of mapped reads and unmapped reads from the index file
if (event.detail.mappedReads && event.detail.unmappedReads) {
const val = event.detail.mappedReads;
const total = event.detail.mappedReads + event.detail.unmappedReads;
const data = [ val, total - val ];

const chart = document.querySelector('#mapped-reads-chart');
chart.update(data);
chart.style.setProperty('--iobio-data-color', 'rgb(9,176,135)');
chart.style.setProperty('--iobio-data-color-secondary', 'rgba(9,176,135,0.5)');
} else {
chart.style.setProperty('--iobio-data-color', 'unset');
chart.style.setProperty('--iobio-data-color-secondary', 'unset');
}
});
</script>
Expand Down

0 comments on commit d91f2d8

Please sign in to comment.