-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalc.html
188 lines (174 loc) · 9.51 KB
/
calc.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KaKs_Calculator</title>
<style>
body,
html {
width: 100%;
height: 100%;
margin: 0;
display: flex;
flex-direction: column;
padding: 4px;
box-sizing: border-box;
}
.flex {
display: flex;
}
.flex.v {
flex-direction: column;
}
#content,
#output,
#select-panel,
#method {
flex: 1
}
#input,
#out-panel {
height: 50%;
}
select {
overflow-y: auto;
}
#model {
display: none;
}
#method:has(#GY:checked)+#model {
display: block;
}
#code {
width: 10em;
}
#output {
font-family: monospace;
overflow: auto;
}
#output>table {
text-wrap: nowrap;
border-collapse: collapse;
}
#output>table td {
border: 1px solid black;
}
</style>
</head>
<body>
<h1>KaKs_Calculator 3.0</h1>
<p>The javascript version of <a href="https://sourceforge.net/projects/kakscalculator2/">KaKs_Calculator 3.0</a>.
</p>
<div id="content" class="flex v">
<textarea id="input">NP_000006.1
ATGGACATTGAAGCATATTTTGAAAGAATTGGCTATAAGAACTCTAGGAACAAATTGGACTTGGAAACATTAACTGACATTCTTGAGCACCAGATCCGGGCTGTTCCCTTTGAGAACCTTAACATGCATTGTGGGCAAGCCATGGAGTTGGGCTTAGAGGCTATTTTTGATCACATTGTAAGAAGAAACCGGGGTGGGTGGTGTCTCCAGGTCAATCAACTTCTGTACTGGGCTCTGACCACAATCGGTTTTCAGACCACAATGTTAGGAGGGTATTTTTACATCCCTCCAGTTAACAAATACAGCACTGGCATGGTTCACCTTCTCCTGCAGGTGACCATTGACGGCAGGAATTACATTGTCGATGCTGGGTCTGGAAGCTCCTCCCAGATGTGGCAGCCTCTAGAATTAATTTCTGGGAAGGATCAGCCTCAGGTGCCTTGCATTTTCTGCTTGACAGAAGAGAGAGGAATCTGGTACCTGGACCAAATCAGGAGAGAGCAGTATATTACAAACAAAGAATTTCTTAATTCTCATCTCCTGCCAAAGAAGAAACACCAAAAAATATACTTATTTACGCTTGAACCTCGAACAATTGAAGATTTTGAGTCTATGAATACATACCTGCAGACGTCTCCAACATCTTCATTTATAACCACATCATTTTGTTCCTTGCAGACCCCAGAAGGGGTTTACTGTTTGGTGGGCTTCATCCTCACCTATAGAAAATTCAATTATAAAGACAATACAGATCTGGTCGAGTTTAAAACTCTCACTGAGGAAGAGGTTGAAGAAGTGCTGAAAAATATATTTAAGATTTCCTTGGGGAGAAATCTCGTGCCCAAACCTGGTGATGGATCCCTTACTATT
ATGGACATCGAAGCATACTTTGAAAGGATTGGTTACAAGAACTCAGTGAATAAATTGGACTTAGCCACATTAACTGAAGTTCTTCAGCACCAGATGCGAGCAGTTCCTTTTGAGAATCTTAACATGCATTGTGGAGAAGCCATGCATCTGGATTTACAGGACATTTTTGACCACATAGTAAGGAAGAAGAGAGGTGGATGGTGTCTCCAGGTTAATCATCTGCTGTACTGGGCTCTGACCAAAATGGGCTTTGAAACCACAATGTTGGGAGGATATGTTTACATAACTCCAGTCAGCAAATATAGCAGTGAAATGGTCCACCTTCTAGTACAGGTGACCATCAGTGACAGGAAGTACATTGTGGATTCCGCCTATGGAGGCTCCTACCAGATGTGGGAGCCTCTGGAATTAACATCTGGGAAGGATCAGCCTCAGGTGCCTGCCATCTTCCTTTTGACAGAGGAGAATGGAACCTGGTACTTGGACCAAATCAGAAGAGAGCAGTATGTTCCAAATGAAGAATTTGTTAACTCAGACCTCCTTGAAAAGAACAAATATCGAAAAATCTACTCCTTTACTCTTGAGCCCCGAGTTATCGAGGATTTTGAATATGTGAATAGCTATCTTCAGACATCGCCAGCATCTGTGTTTGTAAGCACATCGTTCTGTTCCTTGCAGACCTCGGAAGGGGTTCACTGTTTAGTGGGCTCCACCTTTACAAGTAGGAGATTCAGCTATAAGGACGATGTAGATCTGGTTGAGTTTAAATATGTGAATGAGGAAGAAATAGAAGATGTACTGAAAACCGCATTTGGCATTTCTTTGGAGAGAAAGTTTGTGCCCAAACATGGTGAACTAGTTTTTACTATT
</textarea>
<div class="flex" id="out-panel">
<div class="flex v">
<div class="flex" id="select-panel">
<select id="method" multiple>
<option selected value="NG">NG</option>
<option -selected value="LWL">LWL</option>
<option -selected value="MLWL">MLWL</option>
<option -selected value="LPB">LPB</option>
<option -selected value="MLPB">MLPB</option>
<option -selected value="YN">YN</option>
<option selected value="MYN">MYN</option>
<option selected value="GY" id="GY">GY</option>
<option -selected value="MA" id="MA">MA</option>
</select>
<select id="model" multiple>
<option -selected title="rTC==rAG==rTA==rCG==rTG==rCA; equal pi" value="JC">JC</option>
<option -selected title="rTC==rAG==rTA==rCG==rTG==rCA; unequal pi" value="F81">F81</option>
<option -selected title="rTC==rAG!=rTA==rCG==rTG==rCA; equal pi" value="K2P">K2P</option>
<option selected title="rTC==rAG!=rTA==rCG==rTG==rCA; unequal pi" value="HKY">HKY</option>
<option -selected title="rTC!=rAG!=rTA==rCG==rTG==rCA; equal pi" value="TNEF">TNEF</option>
<option -selected title="rTC!=rAG!=rTA==rCG==rTG==rCA; unequal pi" value="TN">TN</option>
<option -selected title="rTC==rAG!=rTA==rCG!=rTG==rCA; equal pi" value="K3P">K3P</option>
<option -selected title="rTC==rAG!=rTA==rCG!=rTG==rCA; unequal pi" value="K3PUF">K3PUF</option>
<option -selected title="rTC!=rAG!=rTA==rCG!=rTG==rCA; equal pi" value="TIMEF">TIMEF</option>
<option -selected title="rTC!=rAG!=rTA==rCG!=rTG==rCA; unequal pi" value="TIM">TIM</option>
<option -selected title="rTC==rAG!=rTA!=rCG!=rTG!=rCA; equal pi" value="TVMEF">TVMEF</option>
<option -selected title="rTC==rAG!=rTA!=rCG!=rTG!=rCA; unequal pi" value="TVM">TVM</option>
<option -selected title="rTC!=rAG!=rTA!=rCG!=rTG!=rCA; equal pi" value="SYM">SYM</option>
<option -selected title="rTC!=rAG!=rTA!=rCG!=rTG!=rCA; unequal pi" value="GTR">GTR</option>
</select>
</div>
<div class="flex">
<select id="code">
<option value="1">1-Standard</option>
<option value="2">2-Vertebrate Mitochondrial</option>
<option value="3">3-Yeast Mitochondrial</option>
<option value="4">4-Mold Mitochondrial</option>
<option value="5">5-Invertebrate Mitochondrial</option>
<option value="6">6-Ciliate, Dasycladacean and Hexamita</option>
<option value="9">9-Echinoderm and Flatworm Mitochondrial</option>
<option value="10">10-Euplotid Nuclear</option>
<option value="11">11-Bacterial and Plant Plastid</option>
<option value="12">12-Alternative Yeast Nuclear</option>
<option value="13">13-Ascidian Mitochondrial</option>
<option value="14">14-Alternative Flatworm Mitochondrial</option>
<option value="15">15-Blepharisma Nuclear</option>
<option value="16">16-Chlorophycean Mitochondrial</option>
<option value="21">21-Trematode Mitochondrial</option>
<option value="22">22-Scenedesmus obliquus mitochondrial</option>
<option value="23">23-Thraustochytrium Mitochondrial</option>
<option value="24">24-Rhabdopleuridae Mitochondrial</option>
<option value="25">25-Candidate Division SR1 and Gracilibacteria</option>
<option value="26">26-Pachysolen tannophilus Nuclear</option>
<option value="27">27-Karyorelict Nuclear</option>
<option value="28">28-Condylostoma Nuclear</option>
<option value="29">29-Mesodinium Nuclear</option>
<option value="30">30-Peritrich Nuclear</option>
<option value="31">31-Blastocrithidia Nuclear</option>
<option value="33">33-Cephalodiscidae Mitochondrial UAA-Tyr</option>
</select>
<button onclick="calc()">Calculate Ka/Ks</button>
</div>
</div>
<div id="output"></div>
</div>
</div>
<p>All calculations are done locally in your browser.</p>
</body>
<script src="src/base.js"></script>
<script src="src/KaKs.js"></script>
<script src="src/NG.js"></script>
<script src="src/LWL.js"></script>
<script src="src/YN.js"></script>
<script src="src/GY.js"></script>
<script src="src/MA.js"></script>
<script>
function createTable(data) {
let table = document.createElement("table")
table.append(...data.trim().split(/\n/).map(row => {
let tr = document.createElement("tr")
tr.append(...row.trimEnd().split("\t").map(x => {
let td = document.createElement("td")
td.innerText = x || ""
return td
}))
return tr
}))
return table
}
</script>
<script>
function calc() {
let kk = new KAKS(document.getElementById("code").value)
document.getElementById("output").replaceChildren(
createTable(
kk.Run(
document.getElementById("input").value,
[...document.getElementById("method").selectedOptions].map(x => x.value),
{
gy_models: [...document.getElementById("model").selectedOptions].map(x => x.value)
}
)
))
}
calc()
</script>
</html>