-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjimmyUI.js
67 lines (56 loc) · 2.62 KB
/
jimmyUI.js
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
window.onload = initialize;
function initialize() {
// Set up the "help" button's event handler.
document.getElementById("information_sign_button").onclick = informationSign;
}
function informationSign(){
var b = document.getElementById("information_sign_button");
var c = document.getElementById("information_sign_content");
if (b.value == "What is DNA sequence alignment???") {
window.scrollTo(0,0);
c.style.display = "block";
b.value = "Hide Help";
}else{
c.style.display = "none";
b.value = "What is DNA sequence alignment???";
}
}
function do_align(){
var time_start = new Date().getTime();
var target = document.getElementById('target').value.replace(/\s+/g, '').replace('\n', '');
var query = document.getElementById('query').value.replace(/\s+/g, '').replace('\n', '');
var matchScore = parseInt(document.getElementById('match').value);
var mismatchScore = parseInt(document.getElementById('mismatch').value);
var gapOpen = parseInt(document.getElementById('gapOpen').value);
var gapExtent = parseInt(document.getElementById('gapExtent').value);
var rst = align(target, query, [matchScore, mismatchScore], [gapOpen, gapExtent]);
var str = 'alignment score: ' + rst[0] + '\n';
str += 'alignment:\n';
var fmt = printGaps(target, query, rst[1], rst[2]);
var linelen = 100, n_lines = 8;
for (var l = 0; l < fmt[0].length; l += linelen) {
str += fmt[0].substr(l, linelen) + '\n';
str += fmt[2].substr(l, linelen) + '\n';
str += fmt[1].substr(l, linelen) + '\n\n';
}
document.getElementById('out').value = str;
document.getElementById('out').rows = n_lines;
var elapse = (new Date().getTime() - time_start) / 1000.0;
document.getElementById('runtime').innerHTML = "in " + elapse.toFixed(3) + "s";
}
var humanDNA=`ATGGTGCTGTCTCCTGCCGACAAGACCAACGTCAAGGCCGCCTGGGGTAAGGTCGGCGCG\
CACGCTGGCGAGTATGGTGCGGAGGCCCTGGAGAGGATGTTCCTGTCCTTCCCCACCACC\
AAGACCTACTTCCCGCACTTCGACCTGAGCCACGGCTCTGCCCAGGTTAAGGGCCACGGC\
AAGAAGGTGGCCGACGCGCTGACCAACGCCGTGGCGCACGTGGACGACATGCCCAACGCG\
CTGTCCGCCCTGAGCGACCTGCACGCGCACAAGCTTCGGGTGGACCCGGTCAACTTCAAG\
CTCCTAAGCCACTGCCTGCTGGTGACCCTGGCCGCCCACCTCCCCGCCGAGTTCACCCCT\
GCGGTGCACGCCTCCCTGGACAAGTTCCTGGCTTCTGTGAGCACCGTGCTGACCTCCAAA\
TACCGTTAA`
var fishDNA=`ATGAGTCTCACTGCCAAGGACAAGGAAACAGTCAAAGCCTTCTGGGCTAAAGTGGCTCCC\
AAGGCTGAAGACATTGGCCAGGATGCTCTGTCCAGGATGCTGGCGGTTTACCCACAGACC\
AAGACCTACTTCTCCCACTGGAAGGACATGAGTGCCGGCTCTGCTCCAGTGAAGAAGCAC\
GGAGCTACGGTGATGGGTGGAGTAGCTGATGCTGTGACCAAAATCGATGATCTGACCTCA\
GGTCTCCTGAGCCTGAGTGAGCTGCATGCTTTCACTCTTAGAGTGGACCCTGCCAACTTC\
AAGATCCTGGCACACAACATCCTTGTGGTCTTCGCCATCAAGTTTCCCACCGACTTCACC\
CCTGAGGTCCATGTGTCTGTGGACAAGTTCTTGGCTGCTCTGGCCCGAGCCCTCTCCGAG\
AAGTACAGATAA`