Skip to content

Commit

Permalink
Show genes
Browse files Browse the repository at this point in the history
  • Loading branch information
kvg committed May 5, 2024
1 parent 80f6e89 commit daa6caf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions html/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -587,20 +587,32 @@

const basesPerPixel = (window.locus_end - window.locus_start) / (main.offsetHeight - 20 - 20 - 35);

console.log(geneData);

for (let geneIdx = 0; geneIdx < geneData.columns[0].values.length; geneIdx++) {
let txStart = geneData.columns[4].values[geneIdx];
let txEnd = geneData.columns[5].values[geneIdx];
let geneName = geneData.columns[12].values[geneIdx];
let geneStrand = geneData.columns[3].values[geneIdx];

let geneBarEnd = (window.locus_end - txEnd) / basesPerPixel
let geneBarStart = (window.locus_end - txStart) / basesPerPixel

// Draw gene line
graphics.moveTo(130, geneBarEnd);
graphics.lineTo(130, geneBarStart);
graphics.stroke({ width: 1, color: 0x0000ff });

// Draw strand lines
for (let i = geneBarEnd + 20; i <= geneBarStart; i += 20) {
graphics.moveTo(130, i);
graphics.lineTo(127, geneStrand == '+' ? i+5 : i-5);
graphics.stroke({ width: 1, color: 0x0000ff });

graphics.moveTo(130, i);
graphics.lineTo(133, geneStrand == '+' ? i+5 : i-5);
graphics.stroke({ width: 1, color: 0x0000ff });
}

// Draw gene name
const geneNameLabel = new Text({
text: geneName,
style: {
Expand Down

0 comments on commit daa6caf

Please sign in to comment.