Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
turner committed Aug 6, 2024
1 parent 7abefb0 commit 8f67e1b
Show file tree
Hide file tree
Showing 3 changed files with 320 additions and 318 deletions.
92 changes: 41 additions & 51 deletions dev/issues/blocking-load.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,84 +8,74 @@
<meta name="author" content="">
<link rel="shortcut icon" href="https://igv.org/web/https://igv.org/web/img/favicon.ico">
<title>await demo</title>
<script src="https://code.jquery.com/jquery-3.4.0.min.js"></script>
</head>
<body>
<div id="controlDiv" style="border: 1px solid red; padding: 20px;">
<button id="loadButton" style="font-size: 24px" >Add Track, list names</button>
<button id="loadButton" style="font-size: 24px">Add Track, list names</button>
</div>
<div id="igvDiv" style="padding-top: 50px;padding-bottom: 20px; height: auto"></div>


<script type="module">

import igv from "../../js";
$(document).ready(async () => {
console.log("ready")
window.igvBrowser = await igv.createBrowser(document.getElementById('igvDiv'), { genome: "hg19", locus: "chr8:128,306,385-129,129,504" })
import igv from "../../js/index.js"; // Assuming this is the correct path

// Use the DOMContentLoaded event to ensure the DOM is fully loaded
document.addEventListener('DOMContentLoaded', async () => {
console.log("DOM fully loaded and parsed");
window.igvBrowser = await igv.createBrowser(
document.getElementById('igvDiv'),
{ genome: "hg19", locus: "chr8:128,306,385-129,129,504" }
);
});

document.getElementById('loadButton').onclick = () => {

document.getElementById('loadButton').addEventListener('click', () => {
displayAlignmentTrackFromUrl({
trackHeight: 500,
dataURL: 'https://s3.amazonaws.com/1000genomes/phase3/data/HG00096/exome_alignment/HG00096.mapped.ILLUMINA.bwa.GBR.exome.20120522.bam',
indexURL: 'https://s3.amazonaws.com/1000genomes/phase3/data/HG00096/exome_alignment/HG00096.mapped.ILLUMINA.bwa.GBR.exome.20120522.bam.bai',
name: 'HG00096_' + Math.random(),
visibilityWindow: 1000000,
color: 'blue'
}
)
return "doTest returns"
}

function displayAlignmentTrackFromUrl({ trackHeight, dataURL, indexURL, name, visibilityWindow, color }) {
trackHeight: 500,
dataURL: 'https://s3.amazonaws.com/1000genomes/phase3/data/HG00096/exome_alignment/HG00096.mapped.ILLUMINA.bwa.GBR.exome.20120522.bam',
indexURL: 'https://s3.amazonaws.com/1000genomes/phase3/data/HG00096/exome_alignment/HG00096.mapped.ILLUMINA.bwa.GBR.exome.20120522.bam.bai',
name: 'HG00096_' + Math.random(),
visibilityWindow: 1000000,
color: 'blue'
});
return "doTest returns";
});

function displayAlignmentTrackFromUrl({ trackHeight, dataURL, indexURL, name, visibilityWindow, color }) {
console.log("==== bam visibilityWindow: " + visibilityWindow);
console.log("==== bam height: " + trackHeight);
console.log("dataURL: " + dataURL);

const config =
{
name,
type: "alignment",
format: "bam",
url: dataURL,
indexURL,
sync: true,
order: Number.MAX_VALUE,
visibilityWindow,
height: trackHeight,
color
}
const config = {
name,
type: "alignment",
format: "bam",
url: dataURL,
indexURL,
sync: true,
order: Number.MAX_VALUE,
visibilityWindow,
height: trackHeight,
color
};

console.log(JSON.stringify(config));

console.log(" about to call 'await loadTrack(config)'");

(async () => {

try {
await window.igvBrowser.loadTrack(config)
await window.igvBrowser.loadTrack(config);
} catch (error) {
console.log("=== load bed track error")
console.log(error)
return
console.log("=== load bed track error");
console.log(error);
return;
}

console.log(" 'await loadTrack(config)' returned")
console.log(" 'await loadTrack(config)' returned");

for (let { track } of window.igvBrowser.trackViews) {
console.log(track.name)
for (const { track } of window.igvBrowser.trackViews) {
console.log(track.name);
}

})()
})();
}


</script>


</body>

</html>
Loading

0 comments on commit 8f67e1b

Please sign in to comment.