-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
75 lines (68 loc) · 1.97 KB
/
script.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
67
68
69
70
71
72
73
74
75
(function(){
// Autoresize Textareas
$("textarea").autosize();
/*$("input").first().on("focus", function(){
$(this).trigger("keyup");
});*/
$("select").on("change", function(){
$("input").first().trigger("keyup");
});
// Update number of characters entered in sequence
$("input").first().on("keyup", function(){
var userInput = $(this).attr("value");
var charnum = userInput.length;
$(this).next().attr("value", charnum);
if(charnum==1){
var helper = "Just one nucleotide long sequence? Give me more.";
}
else if(charnum==0){
var helper = "Let's try another sequence.";
}
else if(charnum <5){
var helper = "This much won't do. I want more."
}
else if(charnum <10){
var helper = "Sorry, still very few nucleotides. Give me some more.";
}
else if(charnum <15){
var helper = "Still very less. Add some more bases.";
}
else if(charnum <20){
var helper = "Good, Just give me a few more bases.";
}
else {
var sequence = $(this).attr("value");
sequence = sequence.toUpperCase();
var result = sequid(sequence);
var helper = "Your sequence is "+result;
}
//Display result in help text.
$("h2#1").html(helper);
if (result == "DNA"){
$("div#main2").show();
$("textarea#21").html(complimentary(sequence)).trigger("oninput");
$("textarea#22").html(transcribe(sequence)).trigger("oninput");
len = $("select>option:selected").text();
$("textarea#hg").html(primers(sequence,len));
}
else{
$("div#main2").hide();
};
if(result == "RNA"){
var main3 = $("div#main3").show();
main3.children().first().children().html(protein(sequence, "NUM"));
$("textarea#31").html(protein(sequence,"NAME")).trigger("oninput");
}
else{
$("div#main3").hide();
};
if(result == "PROTEIN"){
var main4 = $("div#main4").show();
main4.children().first().children().html(protein(sequence, "NUM"));
$("textarea#41").html(protein(sequence,"NAME")).trigger("oninput");
}
else {
$("div#main4").hide();
};
});
})();