-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dev/api/getUserDefinedROIs.html. Cull unneeded async/await keyw…
…ords for ROI objects
- Loading branch information
Showing
3 changed files
with
96 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta content="IE=edge" http-equiv="X-UA-Compatible"> | ||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> | ||
<meta content="" name="description"> | ||
<meta content="" name="author"> | ||
<link href=https://igv.org/web/img/favicon.ico rel="shortcut icon"> | ||
<title>Test - browser.getUserDefinedROIs() </title> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<h2>Example illustrating browser region-of-interest API functions</h2> | ||
|
||
<p> | ||
<button id='roi-clear-button'>Clear All ROI Sets</button> | ||
<button id='roi-get-button'>Get User-Defined ROIs</button> | ||
</p> | ||
|
||
|
||
<div id="myDiv" style="padding-top: 50px;padding-bottom: 20px; height: auto"></div> | ||
|
||
<div> | ||
<h3>User defined ROIs:</h3> | ||
<div id="user-defined-rois"></div> | ||
</div> | ||
|
||
<script type="module"> | ||
|
||
import igv from "../../js/index.js" | ||
|
||
let browser | ||
|
||
(async () => { | ||
|
||
const config = | ||
{ | ||
locus: "chr1:67,646,911-67,676,107", | ||
genome: "hg19", | ||
|
||
doShowROITableButton: true, | ||
|
||
tracks: | ||
[ | ||
|
||
] | ||
} | ||
|
||
browser = await igv.createBrowser(document.getElementById('myDiv'), config) | ||
|
||
document.getElementById("roi-clear-button").addEventListener('click', () => { | ||
const div = document.getElementById('user-defined-rois') | ||
div.innerHTML = '' | ||
browser.clearROIs() | ||
}) | ||
document.getElementById("roi-get-button").addEventListener('click', async () => { | ||
|
||
const rois = browser.getUserDefinedROIs() | ||
if (rois) { | ||
|
||
const div = document.getElementById('user-defined-rois') | ||
div.innerHTML = '' | ||
|
||
const list = document.createElement('ul') | ||
div.appendChild(list) | ||
|
||
for (const roi of rois) { | ||
const li = document.createElement('li') | ||
li.innerText = `${roi.chr}:${roi.start + 1}-${roi.end}` | ||
list.appendChild(li) | ||
} | ||
} | ||
}) | ||
})() | ||
|
||
</script> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters