forked from igvteam/igv.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocalGenome.html
84 lines (60 loc) · 1.99 KB
/
localGenome.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!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=../img/favicon.ico rel="shortcut icon">
<title>IGV - Dev</title>
<!-- IGV CSS -->
<link href="css/dev.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div>
<label>Fasta file: <input id="fasta" type="file"/></label>
<label>Index file: <input id="index" type="file"/></label>
<button id="submitGenomeBtn">Load genome</button>
</div>
<div>
<select id="selectGenomeBtn">
<option value="hg19">hg19</option>
<option value="danRer10">danRer10</option>
</select>
</div>
<div id="myDiv" style="padding-top: 50px;padding-bottom: 20px; height: auto">
</div>
<script type="text/javascript">
</script>
<script type="module">
import igv from "../js/api.js";
const div = document.getElementById("myDiv");
const options = {
genome: "hg19"
};
let browser;
igv.createBrowser(div, options)
.then(function (b) {
browser = b;
})
function submitGenome() {
var fasta = document.getElementById('fasta').files[0];
var index = document.getElementById('index').files[0];
browser.loadGenome({
fastaURL: fasta,
indexURL: index
});
}
function selectGenome() {
console.log(document.getElementById("selectGenomeBtn").value);
browser.loadGenome(document.getElementById("selectGenomeBtn").value)
.then(function (genome) {
console.log("genome " + genome.id + " loaded");
})
}
document.getElementById("selectGenomeBtn").addEventListener("change", selectGenome);
document.getElementById("submitGenomeBtn").addEventListener("click", submitGenome);
</script>
</body>
</html>