annotate Blast output page example trimmed_files/formatRes.js @ 4:34211f5b83fd

trim everything that can be without breaking the graphics summary
author Jan Kanis <jan.code@jankanis.nl>
date Tue, 06 May 2014 17:52:14 +0200
parents ffe82516a83c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1 // JScript source code
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
2 /*************************new code begin *******************************************************/
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
3
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
4 function getHiddenFieldVal(elemName) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
5 var val;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
6 var elem = document.getElementsByName(elemName);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
7 if (elem) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
8 val = (elem.length > 1) ? elem[0].value : elem.value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
9 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
10 return val;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
11 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
12
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
13 function getHiddenFieldParamString(elemName) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
14 var ret = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
15 var val = getHiddenFieldVal(elemName);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
16 if (val) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
17 ret = "&" + elemName + "=" + val;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
18 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
19 return ret;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
20 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
21
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
22 function elementInViewport(el) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
23 if (!el) return;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
24 var rect = el.getBoundingClientRect();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
25
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
26 var myWidth = 0, myHeight = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
27 if (typeof (window.innerWidth) == 'number') {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
28 //Non-IE
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
29 myWidth = window.innerWidth;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
30 myHeight = window.innerHeight;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
31 } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
32 //IE 6+ in 'standards compliant mode'
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
33 myWidth = document.documentElement.clientWidth;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
34 myHeight = document.documentElement.clientHeight;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
35 } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
36 //IE 4 compatible
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
37 myWidth = document.body.clientWidth;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
38 myHeight = document.body.clientHeight;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
39 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
40 //window.alert('Width = ' + myWidth);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
41 //window.alert('Height = ' + myHeight);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
42
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
43
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
44 //return (rect.top >= 0 && rect.left >= 0 && rect.bottom <= window.innerHeight && rect.right <= window.innerWidth)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
45 //return (rect.top >= 0 && rect.left >= 0 && rect.bottom <= myHeight && rect.right <= myWidth)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
46 return (rect.top >= 0 && rect.bottom <= myHeight);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
47 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
48
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
49 function DisplayAlignFromDescription(elem) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
50 var alignView = $("FormatForm").ALIGNMENT_VIEW;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
51 if (alignView[alignView.selectedIndex].value == "Pairwise" || alignView[alignView.selectedIndex].value == "PairwiseWithIdentities") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
52 DisplayDynamicAlign(elem);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
53 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
54 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
55 location.href = "#" + elem.getAttribute("seqID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
56 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
57 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
58
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
59 //<a class="deflnDesc" hsp=<hsp_num> ind="<index>" gi="<gi>" id="deflnDesc_gi" href="#AlnHdrgi">desc</a>
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
60 //<div class="alnHdr" gi="<gi>" id="alnHdr_<index>">
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
61 function DisplayDynamicAlign(elem) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
62 var currGi = elem.getAttribute("gi");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
63 var currInd = elem.getAttribute("ind");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
64 var stat = elem.getAttribute("stat");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
65 if (!currInd || !currGi) return;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
66
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
67 if (!stat || stat == "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
68 //Get 4(5) aligns before currInd and 4(5) aligns after
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
69 ReadCurrentSeqAligns(currInd, 5);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
70 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
71 else if (stat == "read") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
72 var indexes = getCurrIndexRange(currInd);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
73 if (indexes) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
74 var msgID = "alnShow_" + indexes[0];
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
75 location.href = "#" + msgID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
76 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
77 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
78 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
79 //error status handling
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
80 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
81 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
82
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
83
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
84 function goToNextAlign(dtrID, next) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
85 var currInd = parseInt($(dtrID).getAttribute("ind"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
86 var rid = $("Rid").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
87 nextInd = (next) ? currInd + 1 : currInd - 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
88
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
89 if ($("deflnDesc_" + nextInd)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
90 currGi = $("deflnDesc_" + nextInd).getAttribute("seqID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
91 scrollToGI = currGi;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
92 if (!$("deflnDesc_" + nextInd).getAttribute("stat") || $("deflnDesc_" + nextInd).getAttribute("stat") == "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
93
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
94 if (!next) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
95 ReadPrevSeqAligns(currInd, 5, scrollToGI);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
96 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
97 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
98 //Use this indexes = wasAlignRead(nextInd); to determine insertAfterID in ReadNextAligns!!!
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
99 ReadNextSeqAligns(currInd, 5, scrollToGI);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
100 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
101
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
102 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
103 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
104 location.href = "#" + scrollToGI;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
105 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
106 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
107 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
108
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
109 function goToDefLine(dtrID) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
110 if ($("psiInp")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
111 var tbl = jQuery($(dtrID)).parents(".jig-ncbigrid"); //parent table
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
112 togglerID = PsiBelowThresh(tbl[0].id) ? "showDescB1" : "showDescG1";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
113 jQuery($(togglerID)).ncbitoggler("open");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
114 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
115 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
116
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
117 /*
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
118 readAln.rid = rid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
119 readAln.startIndex = parseInt(currInd);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
120 readAln.numSeq = parseInt(maxNumAligns);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
121
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
122 readAln.insertAfterID = insertAfterID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
123 readAln.seqList = giList;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
124 readAln.scrollToSeqID = scrollToGI;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
125 */
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
126 function ReadNextSeqAligns(currInd, maxNumAligns, scrollToGI) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
127 var lastDispIdx = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
128 var rid = $("Rid").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
129
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
130 var readAln = new Object();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
131 readAln.seqList = ""; //giList
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
132 readAln.rid = rid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
133
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
134 currInd = parseInt(currInd);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
135
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
136 if (currInd != 0 && $("deflnDesc_" + currInd)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
137 var par = utils.getParent($("aln_" + $("deflnDesc_" + currInd).getAttribute("seqID"))); //"alnShowReal_<ind>
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
138 //alert(par.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
139 if (par) par = utils.getParent(par); //"alnShow_<ind>
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
140 //alert(par.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
141 if (par) readAln.insertAfterID = par.id;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
142 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
143 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
144 readAln.insertAfterID = "alnStart";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
145 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
146
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
147
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
148
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
149 readAln.startIndex = currInd + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
150 readAln.numSeq = maxNumAligns;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
151
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
152 checkIfAlnExceedsThreshold(readAln, currInd, maxNumAligns, "next");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
153
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
154 readAln.scrollToSeqID = (scrollToGI && scrollToGI != "") ? scrollToGI : "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
155 readAln.hspSort = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
156 ReadSeqAlignByIndex(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
157 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
158
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
159 function ReadPrevSeqAligns(currInd, maxNumAligns, scrollToGI) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
160 var lastDispIdx = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
161 var rid = $("Rid").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
162
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
163 var readAln = new Object();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
164 readAln.seqList = ""; //giList
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
165 readAln.rid = rid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
166
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
167 currInd = parseInt(currInd);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
168
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
169
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
170 //sets readAln.insertAfterID and returns lastDispIdx;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
171 //Find the index of the previously displayed alignment
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
172 lastDispIdx = getPrevDisplyedAlignInfo(currInd, readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
173
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
174 readAln.startIndex = (currInd - lastDispIdx > maxNumAligns) ? (currInd - maxNumAligns) : lastDispIdx + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
175 readAln.numSeq = currInd - readAln.startIndex; //stopIndex = currInd
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
176
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
177 checkIfAlnExceedsThreshold(readAln, currInd, readAln.numSeq, "prev");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
178
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
179 readAln.scrollToSeqID = (scrollToGI && scrollToGI != "") ? scrollToGI : $("deflnDesc_" + (currInd)).getAttribute("seqID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
180 readAln.hspSort = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
181 ReadSeqAlignByIndex(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
182 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
183
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
184 //When descriptions is clicked - display maxNumAligns before currInd and maxNumAligns after currInd
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
185 function ReadCurrentSeqAligns(currInd, maxNumAligns) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
186 var rid = $("Rid").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
187 var readAln = new Object();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
188 readAln.seqList = ""; //giList
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
189 readAln.rid = rid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
190
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
191 currInd = parseInt(currInd);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
192
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
193
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
194 //sets readAln.insertAfterID and returns lastDispIdx;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
195 //Find the index of the previously displayed alignment
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
196 var lastDispIdx = getPrevDisplyedAlignInfo(currInd, readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
197
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
198 //lastDispIdx = parseInt(lastDispIdx);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
199 readAln.startIndex = (currInd - lastDispIdx > maxNumAligns) ? (currInd - maxNumAligns) : lastDispIdx + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
200 readAln.numSeq = parseInt(maxNumAligns * 2);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
201
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
202 checkIfAlnExceedsThreshold(readAln, currInd, maxNumAligns, "curr");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
203
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
204 readAln.scrollToSeqID = $("deflnDesc_" + currInd).getAttribute("seqID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
205 readAln.hspSort = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
206 ReadSeqAlignByIndex(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
207 g_DisableAutoCheck = true;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
208 location.href = "#alnShow_" + readAln.startIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
209 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
210
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
211
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
212
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
213
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
214 function setupDynHSPParams(readAln)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
215 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
216 var currSeqInd = readAln.startIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
217 hspNum = parseInt($("deflnDesc_" + currSeqInd).getAttribute("hsp"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
218 alnLen = parseInt($("deflnDesc_" + currSeqInd).getAttribute("len"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
219 var maxDispLen = parseInt($("maxDispAlnLen").value);//20000
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
220 var minDispLen = parseInt($("minDispAlnLen").value);//2000
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
221 if (alnLen > maxDispLen) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
222 var lenPerMatch = alnLen / hspNum;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
223 readAln.AlignDbPageSize = (lenPerMatch > minDispLen) ? 1 : Math.floor(minDispLen / lenPerMatch);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
224 readAln.AlignDbPageNum = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
225 $("deflnDesc_" + currSeqInd).setAttribute("dynHsps", readAln.AlignDbPageSize);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
226 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
227 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
228
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
229
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
230
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
231 function getCurrSeqsAlnLen(currSeqInd)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
232 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
233 var alnLen = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
234 if ($("deflnDesc_" + currSeqInd) && (!$("deflnDesc_" + currSeqInd).getAttribute("stat") || $("deflnDesc_" + currSeqInd).getAttribute("stat") == "")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
235 alnLen = $("deflnDesc_" + currSeqInd).getAttribute("len");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
236 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
237 alnLen = (alnLen) ? parseInt(alnLen) : 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
238 return alnLen;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
239 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
240
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
241 function checkTotalAlignLen(startIndex,stopIndex)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
242 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
243 var dispAlnLen = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
244 var maxDispLen = parseInt($("maxDispAlnLen").value);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
245 for (var i = startIndex; i <= stopIndex; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
246 alnLen = getCurrSeqsAlnLen(i);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
247 if (alnLen == 0) break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
248 dispAlnLen += alnLen;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
249 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
250 return dispAlnLen;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
251 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
252 //Get total align length for seq currSeqInd and
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
253 //"curr" surrounding countSeqs seqs + current, "prev" - previous countSeqs seqs, "next" - next countSeqs seqs
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
254 function getTotalAlignLen(readAln, currSeqInd, countSeqs, dispType)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
255 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
256 var startIndex = readAln.startIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
257 var stopIndex = readAln.startIndex + readAln.numSeq - 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
258 if (dispType == "curr") {//checks countSeqs before and countSeqs after current, including current
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
259 startIndex = Math.max(startIndex, currSeqInd - countSeqs);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
260 stopIndex = Math.min(stopIndex, currSeqInd + countSeqs);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
261 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
262 else if(dispType == "prev") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
263 startIndex = Math.max(startIndex, currSeqInd - 1 - countSeqs);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
264 stopIndex = currSeqInd - 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
265 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
266 else {//next
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
267 stopIndex = Math.min(stopIndex, currSeqInd + countSeqs + 1);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
268 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
269 var totAlnLen = checkTotalAlignLen(startIndex,stopIndex);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
270 return totAlnLen;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
271 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
272
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
273 function checkIfAlnExceedsThreshold(readAln,currSeqInd,maxNumAligns, dispType)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
274 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
275 var maxDispLen = parseInt($("maxDispAlnLen").value);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
276 var totAlnLen = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
277 var exc = false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
278 for (var numSeq = 0; numSeq <= maxNumAligns; numSeq++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
279 totAlnLen = getTotalAlignLen(readAln, currSeqInd, numSeq, dispType);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
280 if(totAlnLen > maxDispLen) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
281 break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
282 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
283 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
284 if (totAlnLen > maxDispLen) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
285 if (numSeq != 0) numSeq--;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
286 if (dispType == "curr") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
287 readAln.startIndex = Math.max(readAln.startIndex, currSeqInd - numSeq);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
288 //prev + 1(curr) + next
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
289 readAln.numSeq = (currSeqInd - readAln.startIndex) + 1 + numSeq;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
290 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
291 else if (dispType == "prev") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
292 readAln.startIndex = Math.max(readAln.startIndex, currSeqInd - 1 - numSeq);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
293 readAln.numSeq = numSeq + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
294 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
295 else { //"next" - readAln.startIndex stays
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
296 readAln.numSeq = numSeq + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
297 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
298
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
299 if (readAln.numSeq == 1 && $("useAlignDB") && $("useAlignDB").value == "true") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
300 setupDynHSPParams(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
301 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
302
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
303 exc = true;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
304 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
305 return exc;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
306 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
307
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
308
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
309 //readAln.startIndex, readAln.numSeq, readAln.scrollToSeqID,readAln.insertAfterID should be set
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
310 function ReadSeqAlignByIndex(readAln) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
311 var numAligns = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
312 for (var i = readAln.startIndex; i < readAln.startIndex + readAln.numSeq; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
313
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
314 if (!$("deflnDesc_" + i)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
315 break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
316 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
317 if (!$("deflnDesc_" + i).getAttribute("stat") || $("deflnDesc_" + i).getAttribute("stat") == "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
318 currGi = $("deflnDesc_" + i).getAttribute("seqFSTA");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
319 if (readAln.seqList != "") readAln.seqList += ",";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
320 readAln.seqList += currGi;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
321 numAligns++;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
322 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
323 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
324 break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
325 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
326 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
327 if (readAln.seqList != "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
328 readAln.numSeq = parseInt(numAligns);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
329 ReadSeqAlignForSeqList(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
330 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
331 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
332
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
333
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
334 var g_DisplayeAlignsRanges = ""; //String in the format start1-stop1,start2-stop2...
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
335 //Find the range of indexes of displayed alignments for currAlnInd
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
336 //Returns array of 2 startIndex, stopIndex
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
337 function getCurrIndexRange(currAlinInd) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
338 var currRange;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
339 var ranges = g_DisplayeAlignsRanges.split(",");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
340 for (var i = 0; i < ranges.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
341 var indexes = ranges[i].split("-");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
342 if (currAlinInd >= parseInt(indexes[0]) && currAlinInd <= parseInt(indexes[1])) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
343 currRange = indexes;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
344 break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
345 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
346 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
347 return currRange;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
348 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
349
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
350
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
351 //Find the index of the previous displayed alignment
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
352 function getPrevDisplyedAlignInfo(currInd, readAln) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
353 readAln.insertAfterID = "alnStart";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
354 lastDispIdx = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
355 for (var i = currInd - 1; i >= 1; i--) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
356 indexes = getCurrIndexRange(i);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
357 if (indexes) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
358 lastDispIdx = indexes[1];
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
359 readAln.insertAfterID = "alnShow_" + indexes[0];
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
360 break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
361 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
362 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
363 return parseInt(lastDispIdx);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
364 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
365
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
366
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
367 //setReadStatus
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
368 function setSeqAlnReadStatus(readAln, status) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
369 for (var i = readAln.startIndex; i < readAln.startIndex + readAln.numSeq; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
370 if ($("deflnDesc_" + i)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
371 jQuery($($("deflnDesc_" + i))).attr("stat", status);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
372 if (status == "disp") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
373 g_MaxDisplayedIndex = (i > g_MaxDisplayedIndex) ? i : g_MaxDisplayedIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
374 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
375 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
376 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
377 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
378
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
379 /*
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
380 readAln.rid = rid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
381 readAln.seqList = giList;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
382 readAln.startIndex = parseInt(idx);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
383 readAln.insertAfterID = insertAfterID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
384 readAln.numSeq = parseInt(numSeq);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
385 readAln.scrollToSeqID = scrollToGI;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
386 */
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
387 function SendReadSeqAlinRequest(readAln) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
388 blastUrl = "t2g.cgi";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
389
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
390 var rp = new RemoteDataProvider(blastUrl);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
391
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
392
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
393 rp.onSuccess = function(obj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
394 if ($("alignView")) utils.removeClass($("alignView"), "hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
395
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
396 if ($("alnShow_" + readAln.startIndex)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
397 var moreHspsLink = getNextHspsLink(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
398 jQuery($($("alnShowReal_" + readAln.startIndex))).html(obj.responseText + moreHspsLink, {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
399 'widgets': ['ncbipopper', 'ncbitoggler'],
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
400 'configs': {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
401 'ncbipopper': { hasArrow: true, arrowDirection: 'top' }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
402 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
403 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
404 setSeqAlnReadStatus(readAln, "disp");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
405 jQuery($("alnMsg_" + readAln.startIndex)).addClass("hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
406 //Saves start and stop indexes of loaded alignments in global variables
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
407 saveIdxesForAutomaticLoad(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
408 jQuery($($("alnShowReal_" + readAln.startIndex))).find(".alnHdr").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
409 var seqID = this.getAttribute("seqID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
410 if(seqID) initAlignBatch(seqID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
411 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
412
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
413 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
414
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
415 if (readAln.scrollToSeqID) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
416 location.href = "#" + readAln.scrollToSeqID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
417 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
418
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
419 };
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
420 rp.onError = function(obj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
421 if ($("alignView")) utils.removeClass($("alignView"), "hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
422 jQuery($("alnMsg_" + readAln.startIndex)).addClass("hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
423 $("alnShowReal_" + readAln.startIndex).innerHTML = "<div class=\"erm\" id=\"erm_" + readAln.startIndex + "\">Error loading alignment ...<span class=\"db\">requests:" + this.iActiveRequests + " status:" + obj.status +
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
424 "</span><a class=\"gbd\" href=\"#\" onclick=\"ReSubmitReadSeqAligns(event," + readAln.startIndex + ")\">Try again<\a></div>";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
425 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
426 var params = constructURLParams(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
427 if (readAln.numSeq == 1) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
428 params += "&TOTAL_HSPS=" + $("deflnDesc_" + readAln.startIndex).getAttribute("hsp");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
429 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
430 params += "&SEQ_LIST_START=" + readAln.startIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
431
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
432 var formatParams = constructFormatParams();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
433 params += formatParams;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
434
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
435 //alert(params);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
436 rp.Request(params);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
437 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
438
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
439
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
440 function constructURLParams(readAln) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
441 var params;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
442
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
443 if ($("useAlignDB") && $("useAlignDB").value == "true") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
444
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
445 var alignDbParams = "&USE_ALIGNDB=true";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
446 var batchID = document.getElementsByName("ALIGNDB_BATCH_ID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
447 if (batchID) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
448 alignDbParams += getHiddenFieldParamString("ALIGNDB_BATCH_ID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
449 alignDbParams += getHiddenFieldParamString("ALIGNDB_MASTER_ALIAS");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
450 alignDbParams += getHiddenFieldParamString("ALIGNDB_CGI_HOST");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
451 alignDbParams += getHiddenFieldParamString("ALIGNDB_CGI_PATH");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
452 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
453 alignDbParams += "&ALIGN_SEQ_LIST=" + readAln.seqList;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
454 alignDbParams += "&HSP_SORT=" + readAln.hspSort;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
455
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
456 if (readAln.hasOwnProperty("AlignDbPageNum")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
457 alignDbParams += "&ALIGNDB_PAGE_NUM=" + readAln.AlignDbPageNum;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
458 alignDbParams += "&ALIGNDB_PAGE_SIZE=" + readAln.AlignDbPageSize;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
459 alignDbParams += "&HSP_START=" + readAln.AlignDbPageSize * readAln.AlignDbPageNum;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
460 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
461
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
462 params = "CMD=Get&RID=" + readAln.rid + "&OLD_BLAST=false&DESCRIPTIONS=0&NUM_OVERVIEW=0&DYNAMIC_FORMAT=on" + alignDbParams;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
463 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
464 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
465 params = "CMD=Get&RID=" + readAln.rid + "&OLD_BLAST=false&DESCRIPTIONS=0&NUM_OVERVIEW=0&GET_SEQUENCE=on&DYNAMIC_FORMAT=on&ALIGN_SEQ_LIST=" + readAln.seqList + "&HSP_SORT=" + readAln.hspSort;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
466 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
467 if ($("phiPtInd")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
468 params += "&PHI_PTTRN_INDEX=" + $("phiPtInd")[$("phiPtInd").selectedIndex].value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
469 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
470 return params;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
471 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
472
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
473 /*
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
474 readAln.rid = rid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
475 readAln.seqList = giList;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
476 readAln.startIndex = parseInt(idx);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
477 readAln.insertAfterID = insertAfterID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
478 readAln.numSeq = parseInt(numSeq);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
479 readAln.scrollToSeqID = scrollToGI;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
480 */
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
481 /*1. Draw div with id="alnShow_index" class ="alnMsg" with the message listing gis nad indexes
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
482 2. Insert another div with id="alnShowReal_index and class="alnMsgR"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
483 3. For "alnShow_index" set atrr indexes="startInd-stopInd"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
484 4. Set global g_MaxReadMessageIndex - max index of displayed seqalign ??? - check this
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
485 5. Add string "startInd-stopInd" to g_DisplayeAlignsRanges - comma separated indexes
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
486 6. Send read request
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
487 */
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
488
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
489 function ReadSeqAlignForSeqList(readAln) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
490 var text = "<div id=\"alnShow_" + readAln.startIndex + "\" class=\"alnMsg\"><div class=\"alnMsgS\" id=\"alnMsg_" + readAln.startIndex + "\">Loading alignment...<span class=\"db\"> for sequences " + readAln.seqList;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
491 var stopIndex = readAln.startIndex + readAln.numSeq - 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
492 var useAlignDB = ($("useAlignDB") && $("useAlignDB").value == "true") ? "AlignDB=on " : "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
493 text += " " + useAlignDB + "Reading indexes " + readAln.startIndex + "-" + stopIndex + "</span></div>";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
494 text += "<div id=\"alnShowReal_" + readAln.startIndex + "\" class=\"alnMsgR\"></div></div>";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
495 var debugControl = "<div id=\"debug\"></div>";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
496 if (!$("debug")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
497 jQuery($($("descriptions"))).before(debugControl);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
498 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
499 if (!$("alnShow_" + readAln.startIndex)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
500 jQuery($($(readAln.insertAfterID))).after(text);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
501 jQuery($($("alnShow_" + readAln.startIndex))).attr("indexes", readAln.startIndex + "-" + stopIndex);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
502 jQuery($($("alnShow_" + readAln.startIndex))).attr("seqlist", readAln.seqList);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
503 g_MaxReadMessageIndex = (readAln.startIndex > g_MaxReadMessageIndex) ? readAln.startIndex : g_MaxReadMessageIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
504 setSeqAlnReadStatus(readAln, "read");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
505 $("debug").innerHTML += ", " + useAlignDB + "Reading indexes " + readAln.startIndex + "-" + stopIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
506
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
507 if (g_DisplayeAlignsRanges != "") g_DisplayeAlignsRanges += ",";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
508 g_DisplayeAlignsRanges += readAln.startIndex + "-" + stopIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
509
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
510 SendReadSeqAlinRequest(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
511 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
512 else if ($("alnShowReal_" + readAln.startIndex).innerHTML.indexOf("Error") != -1) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
513 jQuery($("alnMsg_" + readAln.startIndex)).removeClass("hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
514 jQuery($("erm_" + readAln.startIndex)).remove();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
515 SendReadSeqAlinRequest(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
516 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
517 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
518
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
519
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
520 function ReSubmitReadSeqAligns(e,currInd) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
521 var rid = $("Rid").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
522 if ($("alnShow_" + currInd)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
523 var indexRange = jQuery($("alnShow_" + currInd)).attr("indexes");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
524 var range = indexRange.split("-");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
525
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
526
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
527 var readAln = new Object();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
528 readAln.seqList = ""; //giList
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
529 readAln.rid = rid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
530 readAln.seqList = jQuery($("alnShow_" + currInd)).attr("seqlist");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
531 readAln.startIndex = parseInt(range[0]);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
532 readAln.numSeq = parseInt(range[1]) - parseInt(range[0]) + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
533 readAln.hspSort = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
534 ReadSeqAlignForSeqList(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
535 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
536 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
537 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
538
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
539
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
540 var g_MaxReadMessageIndex = 0; //alnShow_idx with the message, deflnDesc_idx with stat="read"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
541 var g_MaxDisplayedIndex = 0; //deflnDesc_idx with stat="disp" - last one in the set of N
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
542 var g_DisableAutoCheck = false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
543
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
544 var g_autoStartIdx = new Array();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
545 var g_autoStopIdx = new Array();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
546
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
547 function saveIdxesForAutomaticLoad(readAln) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
548 var stopIndex = readAln.startIndex + readAln.numSeq - 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
549 g_autoStartIdx.push(readAln.startIndex); //1,20,25
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
550 g_autoStopIdx.push(stopIndex); //4,24,29
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
551 $("debug").innerHTML += ", displaying indexes " + readAln.startIndex + "-" + stopIndex;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
552 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
553
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
554 function getNextHspsLink(readAln)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
555 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
556 var moreHspsLink = ""
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
557 if (readAln.hasOwnProperty("AlignDbPageNum")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
558 var nextPageNum = readAln.AlignDbPageNum + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
559 var currHspInd = readAln.AlignDbPageSize * nextPageNum;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
560 var argstring = readAln.startIndex + "," + currHspInd;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
561 var currGi = $("deflnDesc_" + readAln.startIndex).getAttribute("seqId");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
562 var accs = $("deflnDesc_" + readAln.startIndex).getAttribute("accs");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
563 var totalHsps = $("deflnDesc_" + readAln.startIndex).getAttribute("hsp");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
564 var prevHspInd = readAln.AlignDbPageSize * nextPageNum;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
565 var segs = (prevHspInd + 1) + "-" + (prevHspInd + readAln.AlignDbPageSize);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
566 var moreHspsID = "nxHsp" + currGi + "_" + (prevHspInd + 1);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
567
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
568 moreHspsLink = $("dynHspTmpl").innerHTML.replace("@moreHspsID@", moreHspsID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
569 moreHspsLink = moreHspsLink.replace(/@accs@/g, accs);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
570 moreHspsLink = moreHspsLink.replace("@argstring@", argstring);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
571 moreHspsLink = moreHspsLink.replace(/@segs@/g, segs);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
572 moreHspsLink = moreHspsLink.replace("@totalHSP@", totalHsps);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
573 moreHspsLink = moreHspsLink.replace(/@alignDbPageSize@/g, readAln.AlignDbPageSize);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
574 moreHspsLink = moreHspsLink.replace("@aln_prev_num@", prevHspInd);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
575 moreHspsLink = moreHspsLink.replace("@alnSeqGi@", currGi);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
576 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
577 return moreHspsLink;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
578 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
579
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
580
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
581 function ReadNextHSPSet(currSeqInd, currHSPNum) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
582 var readAln = new Object();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
583
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
584 readAln.rid = $("Rid").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
585 readAln.seqList = $("deflnDesc_" + currSeqInd).getAttribute("seqFSTA");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
586 readAln.gi = $("deflnDesc_" + currSeqInd).getAttribute("seqId");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
587 dynHsps = $("deflnDesc_" + currSeqInd).getAttribute("dynHsps");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
588 readAln.startIndex = currSeqInd;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
589 readAln.numSeq = 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
590 if (dynHsps) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
591 readAln.AlignDbPageNum = parseInt(currHSPNum) / parseInt(dynHsps);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
592 readAln.AlignDbPageSize = parseInt(dynHsps); //number of HSps to retrieve
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
593 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
594 if (currHSPNum != 0) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
595 readAln.scrollToSeqID = "hsp" + +readAln.gi + "_" + (parseInt(currHSPNum) + 1);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
596 readAln.insertAfterID = "ar_" + readAln.gi + "_" + currHSPNum;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
597 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
598 var sortLink = $("sa_" + readAln.gi);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
599 readAln.hspSort = (sortLink) ? parseInt(sortLink[sortLink.selectedIndex].value) : 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
600 SendReadSeqAlinSortHSPRequest(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
601 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
602
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
603 function ReadNextHSPSetEvt(e, currSeqInd, currHSPNum) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
604 ReadNextHSPSet(currSeqInd, currHSPNum);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
605 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
606 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
607
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
608
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
609
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
610 function checkAutoAlignArray() {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
611 var stop = false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
612 var start = false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
613 var currAlignViewPos = $("alignView").getBoundingClientRect().top;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
614 if (currAlignViewPos < g_alignViewPos) {//scrolling down
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
615 g_alignViewPos = currAlignViewPos;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
616 if (g_DisableAutoCheck) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
617 g_DisableAutoCheck = false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
618 return;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
619 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
620 for (i = 0; i < g_autoStopIdx.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
621 if (elementInViewport($("alnHdr_" + $("deflnDesc_" + g_autoStopIdx[i]).getAttribute("seqID")))) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
622 //alert("Reading more aligns scrolling down!");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
623 var nextInd = parseInt(g_autoStopIdx[i] + 1);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
624 var currInd = g_autoStopIdx[i];
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
625 if ($("deflnDesc_" + nextInd) && (!$("deflnDesc_" + nextInd).getAttribute("stat") || $("deflnDesc_" + nextInd).getAttribute("stat") == "")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
626 ReadNextSeqAligns(currInd, 5);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
627 stop = true;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
628 break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
629 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
630 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
631 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
632 if (stop) g_autoStopIdx.splice(i, 1); //delete index from the array
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
633 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
634 else if (currAlignViewPos > g_alignViewPos) {//scrolling up
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
635 g_alignViewPos = currAlignViewPos;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
636 //here maybe return if autoStop found!!!
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
637 /* commenting automic read when scroll up */
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
638 for (i = 0; i < g_autoStartIdx.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
639 if (elementInViewport($("alnHdr_" + $("deflnDesc_" + g_autoStartIdx[i]).getAttribute("seqID")))) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
640 //alert("Reading more aligns scrolling up!");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
641 var currInd = g_autoStartIdx[i];
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
642 //Check for condition here if go there at all!!! Check if do the same thing as for ReadNext!!!!
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
643 if (currInd > 1) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
644 ReadPrevSeqAligns(currInd, 5);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
645 start = true;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
646 break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
647 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
648 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
649 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
650 if (start) g_autoStartIdx.splice(i, 1);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
651 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
652 /*end of comment*/
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
653 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
654
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
655 var g_alignViewPos = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
656
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
657 function checkAutoAlignLoad() {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
658
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
659
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
660 checkAutoAlignArray();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
661
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
662 if (jQuery($($(window))).scrollTop() + jQuery($($(window))).height() >= jQuery($($(document))).height() - 100) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
663 //alert("bottom!");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
664
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
665 if ($("alnShowReal_" + g_MaxReadMessageIndex) && $("alnShowReal_" + g_MaxReadMessageIndex).innerHTML != "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
666 //if(!$("alnShow_" + maxReadMessageIndex)) {//g_MaxReadMessageIndex
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
667 ReadNextSeqAligns(g_MaxDisplayedIndex, 5);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
668 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
669 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
670 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
671
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
672
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
673 function GetPatternLocResults()
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
674 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
675 form = $("results");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
676 if (!form.PHI_PTTRN_INDEX) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
677 var el = document.createElement("input");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
678 el.name = "PHI_PTTRN_INDEX";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
679 el.value = $("phiPtInd")[$("phiPtInd").selectedIndex].value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
680 form.appendChild(el);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
681 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
682 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
683 form.PHI_PTTRN_INDEX.value = $("phiPtInd")[$("phiPtInd").selectedIndex].value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
684 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
685 form.submit();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
686 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
687
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
688 function goToNextHSP(elem, next) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
689 var par = jQuery(elem).parent(); //parent span with class="alnParLinks"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
690 var parts = par[0].id.split("_"); //"hsp<seqid>_hspnum "hsp207524544_2"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
691 if (parts[0].indexOf("nxHsp") != -1) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
692 parts[0] = parts[0].replace("nxHsp", "hsp");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
693 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
694 nextID = (next) ? parts[0] + "_" + (parseInt(parts[1]) + 1) : parts[0] + "_" + (parseInt(parts[1]) - 1)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
695
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
696 gotoElem = jQuery($(nextID));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
697 if (gotoElem[0]) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
698 a = jQuery(gotoElem).offset();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
699 window.scroll(0, a.top);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
700 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
701
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
702 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
703 retrieveNextHSP(parts[0],parts[1]);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
704 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
705
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
706 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
707
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
708
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
709 //parts[0]//hsp<seqid>, parts[1] hspnum
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
710 function retrieveNextHSP(currLinkID, currHSPNum)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
711 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
712 var desLineID = currLinkID.replace("hsp", "dtr_"); //tr id
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
713 var currSeqInd, totalHsps;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
714 jQuery($($(desLineID))).find(".deflnDesc").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
715 currSeqInd = parseInt(this.getAttribute("ind"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
716 totalHsps = parseInt(this.getAttribute("hsp"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
717 dynHsps = this.getAttribute("dynHsps");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
718 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
719 currHSPNum = parseInt(currHSPNum);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
720 if (currHSPNum < totalHsps && dynHsps) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
721 ReadNextHSPSet(currSeqInd, currHSPNum);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
722 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
723 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
724 /********Adding those functions back to formatRes.js to identify Uncaught ReferenceError: getUrlCompForCheckedField is not defined error********************************/
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
725 function getUrlCompForEntryField(elem) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
726 var url = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
727 if (elem && elem.value != "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
728 url = "&" + elem.name + "=" + escape(elem.value);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
729 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
730 return url;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
731 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
732
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
733
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
734 function getUrlCompForCheckedField(elem) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
735 var url = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
736 if (elem && elem.checked) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
737 url = "&" + elem.name + "=" + elem.value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
738 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
739 return url;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
740
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
741 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
742
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
743 function getUrlCompForOptionsField(elem) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
744 var url = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
745 if (elem) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
746 url = "&" + elem.name + "=" + elem[elem.selectedIndex].value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
747 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
748 return url;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
749 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
750 /****************************************/
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
751
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
752 function constructFormatParams() {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
753 var formatParams = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
754
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
755 if ($("queryList")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
756 formatParams += "&QUERY_INDEX=" + $("queryList")[$("queryList").selectedIndex].value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
757 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
758
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
759
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
760 formatParams += getUrlCompForCheckedField($("FormatForm").SHOW_LINKOUT);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
761 formatParams += getUrlCompForCheckedField($("FormatForm").SHOW_CDS_FEATURE);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
762 formatParams += getUrlCompForCheckedField($("FormatForm").NCBI_GI);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
763 formatParams += getUrlCompForOptionsField($("FormatForm").ALIGNMENT_VIEW);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
764 formatParams += getUrlCompForOptionsField($("FormatForm").MASK_CHAR);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
765 formatParams += getUrlCompForOptionsField($("FormatForm").MASK_COLOR);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
766 formatParams += getUrlCompForEntryField($("FormatForm").EXPECT_LOW);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
767 formatParams += getUrlCompForEntryField($("FormatForm").EXPECT_HIGH);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
768 formatParams += getUrlCompForEntryField($("FormatForm").PERC_IDENT_LOW);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
769 formatParams += getUrlCompForEntryField($("FormatForm").PERC_IDENT_HIGH);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
770 formatParams += getUrlCompForEntryField($("FormatForm").LINE_LENGTH);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
771
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
772
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
773 formatParams += getHiddenFieldParamString("BUILD_NAME");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
774
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
775 var serviceType = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
776 if ($("serviceType").value == "sra") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
777 serviceType = "sra";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
778 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
779 else if ($("clientType").value == "TMSmart_restricted") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
780 serviceType = "restricted";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
781 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
782 if (serviceType != "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
783 formatParams += "&BOBJSRVC=" + serviceType;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
784 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
785 if ($("currQuery").value != "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
786 formatParams += "&CURR_QUERY_ID=" + $("currQuery").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
787 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
788
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
789 return formatParams;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
790 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
791
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
792 //readAln.seqList contains one gi only for this
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
793 function SendReadSeqAlinSortHSPRequest(readAln) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
794 blastUrl = "t2g.cgi";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
795 var rp = new RemoteDataProvider(blastUrl);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
796
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
797
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
798 rp.onSuccess = function(obj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
799 var moreHspsLink = (readAln.hasOwnProperty("AlignDbPageNum")) ? getNextHspsLink(readAln) : "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
800 var alnHtml = obj.responseText + moreHspsLink;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
801 initHSPRequest(readAln, obj.responseText + moreHspsLink,false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
802 if (readAln.scrollToSeqID) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
803 location.href = "#" + readAln.scrollToSeqID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
804 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
805 };
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
806 rp.onError = function(obj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
807 var currHspInd = (readAln.hasOwnProperty("AlignDbPageNum")) ? readAln.AlignDbPageSize * readAln.AlignDbPageNum : 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
808 var msgID = "erm_" + readAln.gi + "_" + (currHspInd + 1);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
809 if (!$(msgID)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
810 var msg = "<div class=\"erm\" att=\"1\" id=\"" + msgID + "\">Error loading alignment ...<span class=\"db\">status:" + obj.status +
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
811 "</span><a class=\"gbd\" href=\"#\" onclick=\"ReadNextHSPSetEvt(event," + readAln.startIndex + "," + currHspInd +
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
812 ")\">Try again <span class=\"attmt\"></span> <\a></div>";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
813 initHSPRequest(readAln, msg, true);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
814 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
815 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
816 var attNum = parseInt($(msgID).getAttribute("att")) + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
817 $(msgID).setAttribute("att", attNum);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
818 jQuery($(msgID)).find(".attmt").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
819 jQuery(this).html(", attempt " + attNum);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
820 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
821 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
822 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
823
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
824 var params = constructURLParams(readAln);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
825 if (readAln.AlignDbPageSize) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
826 params += "&TOTAL_HSPS=" + $("deflnDesc_" + readAln.startIndex).getAttribute("hsp");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
827 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
828 params += "&SORT_ONE_ALN=on";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
829 var formatParams = constructFormatParams();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
830
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
831 params += formatParams;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
832
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
833 //alert(params);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
834 rp.Request(params);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
835 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
836 function initHSPRequest(readAln, alnHtml, err) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
837 var currHspInd = (readAln.hasOwnProperty("AlignDbPageNum")) ? readAln.AlignDbPageSize * readAln.AlignDbPageNum : 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
838 if (currHspInd != 0) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
839 readAln.insertAfterID = "ar_" + readAln.gi + "_" + currHspInd;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
840 jQuery($(readAln.insertAfterID)).after(alnHtml);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
841 moreHspsID = "nxHsp" + readAln.gi + "_" + (currHspInd + 1);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
842 jQuery($(moreHspsID)).remove();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
843 if (!err) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
844 errMsgID = "erm_" + readAln.gi + "_" + (currHspInd + 1);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
845 jQuery($(errMsgID)).remove();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
846 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
847 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
848 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
849 jQuery($("alnAll_" + readAln.gi)).html(alnHtml);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
850 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
851 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
852
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
853 function SortHSPAlnSel(e, sortLink) {//example id="sa_207524544"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
854 var readAln = new Object();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
855
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
856
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
857 var desLineID = sortLink.id.replace("sa", "dtr"); //tr id
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
858 var seqInd;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
859
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
860 jQuery($($(desLineID))).find(".deflnDesc").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
861 seqInd = this.getAttribute("ind");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
862 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
863
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
864 ReadNextHSPSet(parseInt(seqInd), 0);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
865 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
866
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
867
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
868 function configDescriptions(e,btn,dlgId)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
869 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
870 var suffix = PsiBelowThresh(dlgId);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
871 var colmnsInfId = "cfcDsInf" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
872 var tblID = "dscTable" + suffix; //"dscTable[_psiw]"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
873 var showAllColId = "shcl" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
874 var chkBoxes = $C("checkbox", "type", $(dlgId), "input");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
875 if (!utils.hasClass(btn, "cnc")) $(colmnsInfId).value = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
876 for (i = 0; i < chkBoxes.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
877 var check;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
878 if (utils.hasClass(btn, "cnc")) {//cancel
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
879 if ($(colmnsInfId).value.indexOf(chkBoxes[i].value) != -1 && !chkBoxes[i].checked) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
880 check = true;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
881 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
882 else if ($(colmnsInfId).value.indexOf(chkBoxes[i].value) == -1 && chkBoxes[i].checked) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
883 check = false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
884 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
885 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
886 else if (utils.hasClass(btn, "rdf") && !chkBoxes[i].checked) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
887 check = true;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
888 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
889 if (typeof (check) != 'undefined') {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
890 chkBoxes[i].checked = check;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
891 showHideCol(tblID,parseInt(chkBoxes[i].value), !check);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
892 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
893 if (!utils.hasClass(btn, "cnc")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
894 if (chkBoxes[i].checked) { //OK
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
895 if ($(colmnsInfId).value != "") $(colmnsInfId).value += ",";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
896 $(colmnsInfId).value += chkBoxes[i].value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
897 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
898 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
899 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
900 if ($(colmnsInfId).value != $(colmnsInfId).getAttribute("defval")) {//defval = "2,3,4,5,6,7,8"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
901 jQuery($(showAllColId)).removeClass("hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
902 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
903 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
904 jQuery($(showAllColId)).addClass("hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
905 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
906
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
907 var chConfig = $("cfcDsSave").value != $(colmnsInfId).value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
908
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
909 var cfds = document.getElementsByName("CONFIG_DESCR");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
910 if (cfds) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
911 for (i = 0; i < cfds.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
912 cfds[i].value = $(colmnsInfId).value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
913 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
914 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
915 $("cfcDsSave").value = $(colmnsInfId).value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
916 if (chConfig) SaveConfigTable();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
917 jQuery(document.body).click();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
918 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
919 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
920
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
921
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
922
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
923 function initDescConfig()
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
924 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
925 initConfigColumns("dsConfig");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
926 if ($("psiw") && utils.hasClass($("psiw"), "shown")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
927 initConfigColumns("dsConfig_psiw");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
928 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
929 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
930
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
931
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
932 function initConfigColumns(cnfDlgID)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
933 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
934 var suffix = PsiBelowThresh(cnfDlgID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
935 //cnfDlgID is "dsConfig[_psiw]"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
936 var colmnsInfId = "cfcDsInf" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
937 var tblID = "dscTable" + suffix; //"dscTable[_psiw]"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
938 var showAllColId = "shcl" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
939
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
940 if (navigator.userAgent.match(/ie/i)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
941 if ($("FormatForm").NCBI_GI.checked || $("serviceType").value == "sra") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
942 jQuery($(tblID)).find("th.c1").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
943 db = getHiddenFieldVal("DATABASE");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
944 var width = (db.match(/WGS/i) || db.match(/Whole_Genome_Shotgun_contigs/i)) ? "16em" : "14em";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
945 jQuery(this).css("width", width);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
946 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
947 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
948 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
949
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
950 jQuery($(tblID)).find("tr.first").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
951 jQuery(this).find("a.dcs").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
952 jQuery(this).bind("click", function(e) { checkConfig(this); });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
953 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
954 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
955
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
956 jQuery($(cnfDlgID)).find("button").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
957 jQuery(this).bind("click", function(e) { configDescriptions(e, this, cnfDlgID); });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
958 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
959
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
960
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
961 jQuery($(cnfDlgID)).bind("click", function(e) { e.stopPropagation(); });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
962
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
963 $(colmnsInfId).value = getHiddenFieldVal("CONFIG_DESCR");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
964 if ($(colmnsInfId).value == "" || $(colmnsInfId).value == "undefined") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
965 $(colmnsInfId).value = $(colmnsInfId).getAttribute("defval");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
966 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
967 if ($(colmnsInfId).value != $(colmnsInfId).getAttribute("defval")) {//defval = "2,3,4,5,6,7,8"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
968 jQuery($(showAllColId)).removeClass("hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
969 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
970 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
971 jQuery($(showAllColId)).addClass("hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
972 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
973 var chkBoxes = $C("checkbox", "type", $(cnfDlgID), "input")
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
974 for (i = 0; i < chkBoxes.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
975 jQuery(chkBoxes[i]).bind("click", configColumn);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
976 if ($(colmnsInfId).value.indexOf(chkBoxes[i].value) != -1) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
977 chkBoxes[i].checked = true;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
978 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
979 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
980 //jQuery($(tblID)).ncbigrid("hideColumn", chkBoxes[i].value);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
981 showHideCol($(tblID), chkBoxes[i].value, true);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
982 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
983 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
984 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
985 function showAllCol(e,elem)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
986 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
987 var suffix = PsiBelowThresh(elem.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
988 var rdf = "dscRsDf" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
989 jQuery($(rdf)).click();//click "restore defaults'
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
990 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
991 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
992
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
993
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
994 function configColumn() {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
995 var suffix = PsiBelowThresh(this.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
996 var tblID = "dscTable" + suffix; //"dscTable[_psiw]"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
997
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
998 cCls = "c" + this.value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
999 if (this.checked) {//show
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1000 showHideCol(tblID,parseInt(this.value), false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1001 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1002 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1003 showHideCol(tblID,parseInt(this.value), true);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1004 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1005 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1006
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1007 function showHideCol(tblID, columnIndex, hide) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1008
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1009 if ($("Transcr")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1010 colHidden = utils.hasClass($("c" + columnIndex), "ui-ncbigrid-column-hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1011 hide = hide && !colHidden;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1012 show = !hide && colHidden;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1013 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1014 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1015 show = !hide;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1016 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1017 if (hide) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1018 jQuery($(tblID)).ncbigrid("hideColumn", columnIndex);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1019 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1020 else if (show) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1021 jQuery($(tblID)).ncbigrid("showColumn", columnIndex);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1022 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1023 if ($("Transcr") && (hide || show) ) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1024 var colsp = parseInt($("Transcr").getAttribute("colspan"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1025 colsp = (hide) ? colsp - 1 : colsp + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1026 $("Transcr").setAttribute("colSpan", colsp);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1027 if ($("GnmSeq")) $("GnmSeq").setAttribute("colSpan", colsp);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1028 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1029 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1030
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1031 function checkConfig(lnk) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1032 var cnfCol = "&CONFIG_DESCR=" + $("cfcDsSave").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1033 lnk.href = lnk.href + cnfCol + "#sort_mark";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1034 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1035
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1036 function DisplayAlignFromGraphics(seqID,e) //SeqID = gi if exists
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1037 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1038 var dflLineLinks = $C(seqID, "gi", document, "a");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1039 for (i = 0; i < dflLineLinks.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1040 jQuery(dflLineLinks[i]).click();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1041 break;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1042 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1043 location.href = dflLineLinks[i].href;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1044 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1045
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1046
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1047
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1048 function initDescSelect()
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1049 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1050
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1051 jQuery("#cntDesc").find("a").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1052 jQuery(this).bind("click", configDescrSelect);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1053 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1054 jQuery("#cntSelN").click();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1055 jQuery("#descTblCtrl").find("a[view]").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1056 jQuery(this).bind("click", DisplaySelectedView);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1057 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1058 if ($("psiw") && utils.hasClass($("psiw"), "shown")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1059 jQuery("#cntDesc_psiw").find("a").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1060 jQuery(this).bind("click", configDescrSelect);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1061 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1062 jQuery("#cntSelN_psiw").click();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1063 jQuery("#descTblCtrl_psiw").find("a[view]").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1064 jQuery(this).bind("click", DisplaySelectedView);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1065 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1066 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1067
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1068
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1069 //jQuery("#dsConfig").bind("click", function(e) { e.stopPropagation(); });??
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1070
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1071 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1072
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1073 function DisplaySelectedView(e) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1074 if (this.getAttribute("view") == "graph") { //seqviewer
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1075 ViewSelectedSeqViewer(e,this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1076 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1077 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1078 if (this.getAttribute("view") == "tree") { //seqviewer
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1079 $("scrWidth").value = screen.width;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1080 $("scrHeight").value = screen.height;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1081 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1082 ViewSelectedSeqsEx(e, this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1083 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1084 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1085
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1086 function PsiBelowThresh(elemID)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1087 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1088 var suffix = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1089 if (elemID.indexOf("_psiw") != -1) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1090 suffix = "_psiw";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1091 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1092 return suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1093 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1094
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1095 function ViewSelectedSeqsEx(e,elem) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1096 var sbmForm = elem.getAttribute("frm");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1097 var seqList = elem.getAttribute("seqList");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1098
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1099 var cnfElem = utils.getParent(elem); //.cnf div
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1100 var suffix = PsiBelowThresh(cnfElem.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1101 var tblID = "dscTable" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1102
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1103 $(seqList).value = createSelseqString(tblID,true);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1104 $(seqList).value = $(seqList).value.replace(/ti:/g, ""); //For traces
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1105 if ($(seqList).value.indexOf("dbSNP") != -1) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1106 $(seqList).value = $(seqList).value.replace(/dbSNP:rs/g, ""); //For snp
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1107 elem.href = $(sbmForm).action + $(seqList).value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1108 elem.target = "new";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1109 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1110 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1111 $(sbmForm).submit();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1112 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1113 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1114 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1115
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1116 function ViewSelectedSeqsTree(e) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1117 $("scrWidth").value = screen.width;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1118 $("scrHeight").value = screen.height;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1119 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1120
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1121 function initSeqViewerGet(seqList) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1122 if (seqList.length >= 2000) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1123 seqList = seqList.substr(0,2000);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1124 lastComma = seqList.lastIndexOf(",");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1125 seqList = seqList.substr(0,lastComma);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1126 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1127 $("seqViewParams").name = "RID";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1128 $("seqViewParams").value = $("ridParam").value + "[" + seqList + "]";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1129 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1130
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1131 function ViewSelectedSeqViewer(e, elem)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1132 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1133 var cnfElem = utils.getParent(elem); //.cnf div
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1134 var suffix = PsiBelowThresh(cnfElem.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1135 var tblID = "dscTable" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1136
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1137 //change to false when new verison of seqVier is installed in production
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1138 var seqList = createSelseqString(tblID, false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1139 $("sbmtGraphics").action = $("seqViewUrl").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1140
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1141 var rp = new RemoteDataProvider("url2nc.cgi");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1142 rp.onSuccess = function(obj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1143 var jsnResp = JSON.parse(obj.responseText);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1144 ncid = jsnResp.ncid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1145
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1146 if (ncid != "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1147 $("seqViewParams").name = "rkey";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1148 $("seqViewParams").value = ncid;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1149 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1150 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1151 initSeqViewerGet(seqList);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1152 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1153 $("sbmtGraphics").submit();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1154 };
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1155 rp.onError = function(obj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1156 initSeqViewerGet(seqList);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1157 $("sbmtGraphics").submit();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1158 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1159 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1160 var params = $("ridParam").value + "[" + seqList + "]";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1161 rp.Request(params, "POST");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1162 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1163 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1164
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1165 function configDescrSelect(e) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1166 var sel = this.getAttribute("sel");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1167 if (sel) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1168 var selNum = 0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1169 var check = (sel == "all") ? true : false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1170
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1171 var suffix = PsiBelowThresh(this.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1172 var tblID = "dscTable" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1173 var toolbarID = "descTblCtrl" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1174 var selElID = "slcNum" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1175
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1176 jQuery($(tblID)).find("input[type='checkbox'].cb").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1177 jQuery(this)[0].checked = check;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1178 if (check) selNum++;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1179 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1180 enableDescrLinks(selNum, toolbarID, selElID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1181 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1182 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1183 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1184
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1185
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1186
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1187 function enableDescrLinks(selNum, toolbarID, selElID) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1188 jQuery($(toolbarID)).find("a[minSlct]").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1189 var minSelected = this.getAttribute("minSlct");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1190 minSelected = parseInt(minSelected);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1191 if (selNum >= minSelected) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1192 this.removeAttribute("disabled");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1193 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1194 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1195 this.setAttribute("disabled", "disabled");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1196 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1197 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1198 $(selElID).innerHTML = selNum;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1199 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1200
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1201
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1202
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1203 function configDescrLinks(e, elem)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1204 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1205
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1206 ncbi.sg.ping(elem, "click", elem.checked ? "checked=true" : "checked=false");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1207 var par = jQuery(elem).parents(".jig-ncbigrid");//parent table
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1208 if (par) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1209 var suffix = PsiBelowThresh(par[0].id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1210 var tblID = "dscTable" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1211 var toolbarID = "descTblCtrl" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1212 var selElID = "slcNum" + suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1213
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1214 var currSelNum = parseInt($(selElID).innerHTML);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1215 var selNum = elem.checked ? currSelNum + 1 : currSelNum - 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1216 enableDescrLinks(selNum, toolbarID, selElID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1217 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1218 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1219 /***Download code begin****/
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1220
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1221 function initDownLoadPopup(dwnDialog) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1222
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1223 jQuery(dwnDialog).find("button").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1224 jQuery(this).bind("click", execDownLoad);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1225 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1226
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1227 jQuery(dwnDialog).bind("click", function(e) { e.stopPropagation(); });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1228 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1229
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1230 function initDescDownLoad() {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1231 initDownLoadPopup($("dsDownload"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1232
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1233 if ($("psiw") && utils.hasClass($("psiw"), "shown")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1234 initDownLoadPopup($("dsDownload_psiw"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1235 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1236 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1237
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1238 function initAlignDownLoad(navObj)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1239 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1240 var seqID = navObj.seqID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1241 var dwnDialog = $("dlgDwnl_" + seqID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1242 jQuery(dwnDialog).find("button").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1243 jQuery(this).bind("click", execDownLoad);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1244 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1245
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1246 var dwnFSTW = $("dwFST_" + seqID);//whole seq
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1247 var dwnFSTAl = $("dwFSTAl_" + seqID);//aligned regions
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1248
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1249 if(dwnFSTW) dwnFSTW.setAttribute("seqfsta", navObj.currSeqID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1250 if(dwnFSTAl) dwnFSTAl.setAttribute("seqfsta", navObj.currSeqID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1251
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1252 jQuery(dwnDialog).bind("click", function(e) { e.stopPropagation(); });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1253 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1254
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1255
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1256 function execDownLoad(e) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1257 if (!utils.hasClass(this, "cnc")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1258 par = utils.getParent(this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1259 dwnDialog = utils.getParent(par); //parent dialog with popDl class
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1260 var descr = (this.id == "dw_cont" || this.id == "dw_cont_psiw") ? true : false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1261 jQuery(dwnDialog).find("input").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1262 if (this.checked) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1263 submitDownLoad(this, descr);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1264 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1265 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1266 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1267 jQuery(document.body).click();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1268 utils.preventDefault(e);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1269 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1270
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1271 function submitDownLoad(radioElem, descr) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1272 var toolURL = radioElem.getAttribute("url");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1273 if (toolURL) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1274 if (descr) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1275 var getGi = radioElem.getAttribute("getGi");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1276 getGi = (getGi) ? true : false;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1277
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1278 var tblID = "dscTable";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1279 var suffix = PsiBelowThresh(radioElem.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1280 tblID += suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1281
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1282 $("selDnSeqs").value = createSelseqString(tblID,getGi);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1283 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1284 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1285 var seqfsta = radioElem.getAttribute("seqfsta");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1286 $("selDnSeqs").value = (seqfsta) ? seqfsta : radioElem.getAttribute("getGi");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1287 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1288 var addParams = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1289 if (radioElem.getAttribute("addParam")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1290 addParams = addDwnlParams();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1291 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1292 var submitName = radioElem.getAttribute("sbName")
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1293 $("selDnSeqs").name = (submitName) ? submitName : "ALIGN_SEQ_LIST";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1294 $("dwdlSubmit").action = toolURL + addParams;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1295 $("dwdlSubmit").submit();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1296 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1297 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1298 var sbFunction = radioElem.getAttribute("sbFunc");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1299 if (sbFunction) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1300 eval(sbFunction + "(radioElem, descr)");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1301 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1302 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1303 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1304
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1305
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1306 function initDownLoadFSTA(radioElem, descr)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1307 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1308 if (descr) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1309
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1310 var tblID = "dscTable";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1311 var suffix = PsiBelowThresh(radioElem.id);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1312 tblID += suffix;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1313
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1314 $("sbmtFASTA").ALIGN_SEQ_LIST.value = createSelseqString(tblID,false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1315 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1316 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1317 $("sbmtFASTA").ALIGN_SEQ_LIST.value = radioElem.getAttribute("seqfsta");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1318 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1319 $("sbmtFASTA").DOWNLOAD_TYPE.value = radioElem.getAttribute("fstaDWType");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1320
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1321 $("sbmtFASTA").DATABASE.value = getHiddenFieldVal("DATABASE");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1322 if ($("useAlignDB") && $("useAlignDB").value == "true") {//temp checkbox
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1323 var batchID = document.getElementsByName("ALIGNDB_BATCH_ID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1324 if (batchID) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1325 $("sbmtFASTA").ALIGNDB_BATCH_ID.value = getHiddenFieldVal("ALIGNDB_BATCH_ID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1326 $("sbmtFASTA").ALIGNDB_MASTER_ALIAS.value = getHiddenFieldVal("ALIGNDB_MASTER_ALIAS");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1327 $("sbmtFASTA").ALIGNDB_CGI_HOST.value = getHiddenFieldVal("ALIGNDB_CGI_HOST");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1328 $("sbmtFASTA").ALIGNDB_CGI_PATH.value = getHiddenFieldVal("ALIGNDB_CGI_PATH");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1329 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1330 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1331 $("sbmtFASTA").submit();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1332 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1333
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1334 function createSelseqString(tblID,getGi) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1335 var selSeqs = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1336 jQuery($(tblID)).find("input[type='checkbox'].cb").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1337 if (jQuery(this)[0].checked) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1338 if (selSeqs != "") selSeqs += ",";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1339 if (getGi) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1340 selSeqs += jQuery(this)[0].value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1341 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1342 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1343 var linkID = jQuery(this)[0].id.replace("chk", "deflnDesc");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1344 selSeqs += $(linkID).getAttribute("seqFSTA");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1345 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1346 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1347 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1348 return selSeqs;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1349 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1350
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1351 /***Download code end****/
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1352
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1353 /***Init navigation code begin **/
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1354
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1355 function initNavigation(navObj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1356 initNextAlnLink(navObj, true);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1357 initNextAlnLink(navObj, false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1358 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1359
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1360
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1361 function initNavInfo(navObj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1362 var currInd = parseInt($("dtr_" + navObj.seqID).getAttribute("ind"));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1363 nextInd = currInd + 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1364 prevInd = currInd - 1;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1365
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1366 navObj.currSeqID = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1367 navObj.nextSeqID = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1368 navObj.prevSeqID = "";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1369
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1370 if ($("deflnDesc_" + nextInd)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1371 navObj.nextSeqID = $("deflnDesc_" + nextInd).getAttribute("accs");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1372 if(navObj.nextSeqID =="") navObj.nextSeqID = $("deflnDesc_" + nextInd).getAttribute("seqFSTA");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1373 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1374 if ($("deflnDesc_" + prevInd)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1375 navObj.prevSeqID = $("deflnDesc_" + prevInd).getAttribute("accs");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1376 if (navObj.prevSeqID == "") navObj.prevSeqID = $("deflnDesc_" + prevInd).getAttribute("seqFSTA");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1377 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1378 if ($("deflnDesc_" + currInd)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1379 navObj.currSeqID = $("deflnDesc_" + currInd).getAttribute("seqFSTA");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1380 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1381 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1382
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1383
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1384 function initNextAlnLink(navObj, next) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1385
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1386 var nextLinkEl = (next) ? $("alnNxt_" + navObj.seqID) : $("alnPrv_" + navObj.seqID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1387 var nextSeqid = (next) ? navObj.nextSeqID : navObj.prevSeqID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1388
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1389 if (nextLinkEl) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1390 if (nextSeqid != "") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1391 var text = (next) ? "next" : "previous";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1392 nextLinkEl.setAttribute("title", "Go to " + text + " alignment for " + nextSeqid);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1393 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1394 else {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1395 nextLinkEl.setAttribute("disabled", "disabled");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1396 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1397 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1398 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1399 function scan(link) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1400 var init = link.getAttribute("init");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1401 if (!init) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1402 ncbi.sg.scanLinks(link);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1403 link.setAttribute("init","on");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1404 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1405 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1406
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1407 function initWidth(seqID) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1408 var lineLengthElem = $("FormatForm").LINE_LENGTH;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1409 var lineLength = parseInt(lineLengthElem[lineLengthElem.selectedIndex].value);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1410 if (parseInt(lineLengthElem.getAttribute("defval")) == lineLength) return;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1411
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1412 var relWidth = (lineLength > 90) ? "12%" : "15%";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1413 var charWidth = (navigator.userAgent.match(/ie/i)) ? 8 : 7;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1414 lineLength = (lineLength + parseInt(17)) * charWidth;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1415 var width = lineLength + "px";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1416 jQuery($("alnAll_" + seqID)).find("div.dflLnk").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1417 jQuery(this).css("width", width);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1418 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1419 jQuery($("alnAll_" + seqID)).find("table.alnParams").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1420 jQuery(this).css("width", width);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1421 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1422 jQuery($("relInf_" + seqID)).css("width", relWidth);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1423 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1424
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1425
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1426 /***Init navigation code end **/
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1427 function initAlignBatch(seqID)
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1428 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1429 var navObj = new Object();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1430 navObj.seqID = seqID;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1431 initNavInfo(navObj);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1432
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1433 initAlignDownLoad(navObj);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1434 initNavigation(navObj);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1435 ncbi.sg.scanLinks($("alnNxt_" + seqID));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1436 ncbi.sg.scanLinks($("alnPrv_" + seqID));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1437 if ($("serviceType").value == "vecscreen") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1438 utils.addClass($("alnDsc_" + seqID), "hidden");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1439 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1440 ncbi.sg.scanLinks($("alnDwnld_" + seqID));
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1441 jQuery($("csLinks_" + seqID)).find("a").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1442 ncbi.sg.scanLinks(this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1443 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1444 jQuery($("relInf_" + seqID)).find("a").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1445 ncbi.sg.scanLinks(this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1446 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1447 jQuery($("rng_" + seqID)).find("a").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1448 ncbi.sg.scanLinks(this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1449 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1450 jQuery($("dln_" + seqID)).find("a").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1451 ncbi.sg.scanLinks(this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1452 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1453 initWidth(seqID);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1454 /*
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1455 jQuery($("alnHdr_" + seqID)).find("a").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1456 ncbi.sg.scanLinks(this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1457 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1458 jQuery($("aln_" + seqID)).find("a").each(function(index) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1459 ncbi.sg.scanLinks(this);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1460 });
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1461 */
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1462 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1463
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1464 function SaveConfigTable() {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1465 blastUrl = "fmtsave.cgi";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1466
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1467
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1468 var rp = new RemoteDataProvider(blastUrl);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1469
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1470
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1471 rp.onSuccess = function(obj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1472 //alert("success");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1473 };
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1474 rp.onError = function(obj) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1475 //alert("error");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1476 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1477
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1478 var program = getHiddenFieldVal("PROGRAM");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1479 var rid = getHiddenFieldVal("RID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1480 var blastSpec = getHiddenFieldVal("BLAST_SPEC");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1481 var params = "CMD=Get&RID=" + rid + "&ViewReport=on&PROGRAM=" + program + "&SAVE_INDV_FRM_OPTION=on&CONFIG_DESCR=" + $("cfcDsSave").value;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1482 if(blastSpec) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1483 params += "&BLAST_SPEC=" + blastSpec;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1484 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1485 rp.Request(params,"POST");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1486 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1487
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1488 function removeRID() {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1489 var rid = document.getElementsByName("RID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1490 for (var i = 0; i <= rid.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1491 jQuery(rid[i]).remove();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1492 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1493 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1494
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1495 function initAdvancedView()
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1496 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1497 if ($("dsConfig")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1498
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1499 var alnView = getHiddenFieldVal("ALIGNMENT_VIEW");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1500 if (alnView == "Pairwise" || alnView == "PairwiseWithIdentities") {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1501 var rid = getHiddenFieldVal("RID");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1502 ReadNextSeqAligns(0, 5);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1503 g_alignViewPos = $("alignView").getBoundingClientRect().top;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1504 utils.addEvent(window, "scroll", checkAutoAlignLoad, false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1505 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1506 list = $("phiPtInd");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1507 if (list) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1508 utils.addEvent(list, "change", GetPatternLocResults, false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1509 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1510 initDescConfig();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1511 initDescSelect();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1512 initDescDownLoad();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1513 if ($("psiInp")) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1514 var nextIter = document.getElementsByName("NEXT_I");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1515 for (var i = 0; i < nextIter.length; i++) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1516 utils.addEvent(nextIter[i], "click", removeRID, false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1517 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1518 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1519 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1520 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1521
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1522 //takes care of jQuery calls to elements that have dots in id like id= "SRA34456.3.4"
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1523 function initjQry()
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1524 {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1525 var oldCreate = jQuery.ui.ncbipopper.prototype._create;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1526 jQuery.ui.ncbipopper.prototype._create = function() {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1527 var destSelector = this.options.destSelector || this.options.sourceSelector || this.element.prop("hash");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1528 this.options.destSelector = destSelector.replace(/\./g, "\\.");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1529 oldCreate.apply(this, arguments);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1530 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1531 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1532 utils.addEvent(window,
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1533 "load", initAdvancedView,
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1534 false);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1535
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1536 initjQry()
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1537
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1538 /* If user agent has "safari" in it, include safari-specific stylesheet. */
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1539 if (navigator.userAgent.match(/ie/i)) {
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1540 document.write("<link rel='stylesheet' type='text/css' href='css/ie-descriptions.css' media='screen'/>");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1541 }
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1542 /*****************************new code end*********************************************************************/