Mercurial > repos > jankanis > blast2html
comparison Blast output page example trimmed_files/format.js @ 1:ffe82516a83c
add trimmed down html example
author | Jan Kanis <jan.code@jankanis.nl> |
---|---|
date | Tue, 06 May 2014 17:36:10 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:bad241dc701f | 1:ffe82516a83c |
---|---|
1 | |
2 function UpdateDisplayTypes(displayTypes) { | |
3 dispMenu = displayTypes.options; | |
4 for(i=0; i < dispMenu.length; i++) { | |
5 //if(!utils.hasClass(displayTypes,"psiBlast") && !utils.hasClass(displayTypes,"phiBlast") || | |
6 if($("stepNumber").value == "" || $("stepNumber").value < 2) { | |
7 if(dispMenu[i].value.indexOf("PSSM") != -1) { | |
8 dispMenu[i--] = null; | |
9 //break; | |
10 } | |
11 } | |
12 } | |
13 } | |
14 | |
15 function GetIndexByValue(selectElem,val) { | |
16 var idx = 0; | |
17 var opts = selectElem.options; | |
18 for(i=0; i < opts.length; i++) { | |
19 if(opts[i].value == val) { | |
20 idx = i; | |
21 break; | |
22 } | |
23 } | |
24 return idx; | |
25 } | |
26 | |
27 function resetAdvView(show) | |
28 { | |
29 var advView = $("advView"); | |
30 if(show) { | |
31 if(utils.hasClass(advView, "hidden")) { | |
32 utils.removeClass(advView, "hidden"); | |
33 } | |
34 } | |
35 else { | |
36 utils.addClass(advView, "hidden"); | |
37 } | |
38 } | |
39 | |
40 | |
41 function ShowOrHide(hide,elem) | |
42 { | |
43 if(hide) { | |
44 if(!utils.hasClass(elem, "hidden")) { | |
45 utils.addClass(elem, "hidden"); | |
46 } | |
47 } | |
48 else { | |
49 if(utils.hasClass(elem, "hidden")) { | |
50 utils.removeClass(elem, "hidden"); | |
51 } | |
52 } | |
53 } | |
54 | |
55 function UpdateFormatTypes(form) { | |
56 var selectedObjType = form.FORMAT_OBJECT[form.FORMAT_OBJECT.selectedIndex].value; | |
57 var hideAdvView = false; | |
58 bioseqFormatHide = true; | |
59 pssmFormatHide = true; | |
60 pssmScFormatHide = true; | |
61 formatTypeHide = true; | |
62 if (selectedObjType == "Alignment") { | |
63 formatObjectSelectedIndex = 0; //HTML | |
64 formatTypeHide = false; | |
65 hideAdvView = true; | |
66 } | |
67 if (selectedObjType == "PSSM") { | |
68 formatObjectSelectedIndex = GetIndexByValue(form.FORMAT_TYPE,"Text"); | |
69 pssmFormatHide = false; | |
70 } | |
71 if (selectedObjType == "PSSM_Scoremat") { | |
72 formatObjectSelectedIndex = GetIndexByValue(form.FORMAT_TYPE,"ASN.1"); | |
73 pssmScFormatHide = false; | |
74 } | |
75 else if (selectedObjType == "Bioseq") { | |
76 formatObjectSelectedIndex = GetIndexByValue(form.FORMAT_TYPE,"ASN.1"); | |
77 bioseqFormatHide = false; | |
78 } | |
79 form.FORMAT_TYPE.selectedIndex = formatObjectSelectedIndex; | |
80 ShowOrHide(formatTypeHide,form.FORMAT_TYPE); | |
81 if ($("bioseqFormat")) { | |
82 ShowOrHide(bioseqFormatHide,$("bioseqFormat")); | |
83 $("bioseqFormat").readOnly=true; | |
84 } | |
85 if ($("pssmFormat")) { | |
86 ShowOrHide(pssmFormatHide,$("pssmFormat")); | |
87 $("pssmFormat").readOnly=true; | |
88 } | |
89 if ($("pssmScFormat")) { | |
90 ShowOrHide(pssmScFormatHide,$("pssmScFormat")); | |
91 $("pssmScFormat").readOnly=true; | |
92 } | |
93 resetAdvView(hideAdvView); | |
94 } | |
95 | |
96 function ResetForm() | |
97 { | |
98 //var defValNodes = cssQuery(".reset"); | |
99 defValNodes = $("FormatForm").elements; | |
100 for(i=0; i < defValNodes.length; i++) { | |
101 if(utils.hasClass(defValNodes[i],"reset")) | |
102 setDefalValue(defValNodes[i]); | |
103 } | |
104 if ($("FormatForm").FORMAT_OBJECT.type == "select-one") { | |
105 UpdateFormatTypes($("FormatForm")); | |
106 UpdateDisplayTypes($("FormatForm").FORMAT_OBJECT); | |
107 } | |
108 if($("FormatForm").RUN_PSIBLAST.checked) setDefalValue($("FormatForm").I_THRESH) | |
109 else $("FormatForm").I_THRESH.value=""; | |
110 //resetOrganismSuggest($("FormatForm").FORMAT_ORGANISM); | |
111 resetOrganismControls($("FormatForm").FORMAT_ORGANISM); | |
112 //TO DO: add threshold | |
113 } | |
114 | |
115 function LimitByHitlistSize(list) | |
116 { | |
117 var listBreak = false; | |
118 var optSel = false; | |
119 for(i=0; i < list.options.length; i++) { | |
120 var optVal = parseInt(list.options[i].value ,10); | |
121 var hitListSize = parseInt($("maxNumSeq").value ,10); | |
122 if(list.options[i].selected) optSel = true; | |
123 if(optVal >= hitListSize) { | |
124 if(!optSel) {list.options[i].selected = true;} | |
125 list.options.length = i + 1; | |
126 break; | |
127 } | |
128 } | |
129 } | |
130 | |
131 function AddFormatOrgField(e) { | |
132 AddOrgRow(e, "FORMAT_ORGANISM", "FORMAT_ORG_EXCLUDE"); | |
133 } | |
134 | |
135 function initSubmit() { | |
136 | |
137 | |
138 } | |
139 | |
140 function adjustFormatOptions() | |
141 { | |
142 var alignView = $("FormatForm").ALIGNMENT_VIEW; | |
143 var formatType = $("FormatForm").FORMAT_TYPE; | |
144 var queryAnch = formatType[formatType.selectedIndex].value == "HTML" && (alignView[alignView.selectedIndex].value != "Pairwise" && alignView[alignView.selectedIndex].value != "PairwiseWithIdentities"); | |
145 var dynFormatQA = !$("FormatForm").OLD_VIEW.checked && queryAnch; | |
146 dynFormatPW = !$("FormatForm").OLD_VIEW.checked && formatType[formatType.selectedIndex].value == "HTML" && (alignView[alignView.selectedIndex].value == "Pairwise" || alignView[alignView.selectedIndex].value == "PairwiseWithIdentities"); | |
147 | |
148 UpdateDescriptions(dynFormatPW); | |
149 if (dynFormatPW) { | |
150 jQuery("#frmAln").addClass("hidden"); | |
151 if (!utils.hasClass($("shl"), "hidden")) jQuery("#shl").addClass("hidden"); //hide SHOW_LINKOUT | |
152 jQuery("#gts").addClass("hidden"); //hide GET_SEQUENCE | |
153 jQuery("#scf").removeClass("hidden");//show CDS_FEAT | |
154 $("FormatForm").SHOW_LINKOUT.checked = true; | |
155 } | |
156 else { | |
157 if(dynFormatQA) $("FRM_ALIGNMENTS").selectedIndex = $("FRM_DESCRIPTIONS").selectedIndex; | |
158 | |
159 jQuery("#frmAln").removeClass("hidden"); | |
160 if (dynFormatQA) { | |
161 if (!utils.hasClass($("shl"), "hidden")) jQuery("#shl").addClass("hidden"); //hide SHOW_LINKOUT | |
162 } | |
163 else { | |
164 jQuery("#shl").removeClass("hidden"); | |
165 } | |
166 if (queryAnch) { | |
167 jQuery("#scf").addClass("hidden"); //hide CDS_FEAT | |
168 } | |
169 else {//pairwise old_view=false | |
170 jQuery("#scf").removeClass("hidden"); //hide CDS_FEAT | |
171 } | |
172 jQuery("#gts").removeClass("hidden"); //GET_SEQUENCE | |
173 } | |
174 if ($("blastSpec").value == "VecScreen") { | |
175 adjustVecscreen(dynFormatPW); | |
176 } | |
177 } | |
178 | |
179 function adjustVecscreen(dynFormatPW) | |
180 { | |
181 var dfltDescrInd = 0; //0 | |
182 var dfltDynDescrInd = 5; //1000 | |
183 var dfltAlnInd = 6; //1000 | |
184 if (dynFormatPW) { | |
185 utils.addClass($("lr"), "hidden"); | |
186 $("FRM_DESCRIPTIONS").selectedIndex = dfltDynDescrInd; | |
187 } | |
188 else { | |
189 utils.removeClass($("lr"), "hidden"); | |
190 $("FRM_DESCRIPTIONS").selectedIndex = dfltDescrInd; | |
191 } | |
192 $("FRM_ALIGNMENTS").selectedIndex = dfltAlnInd; | |
193 } | |
194 | |
195 | |
196 function UpdateDescriptions(removeZero) | |
197 { | |
198 if (removeZero) { | |
199 dispMenu = $("FormatForm").DESCRIPTIONS; | |
200 dispMenu.remove(0); | |
201 } | |
202 else { | |
203 dispMenu = $("FormatForm").DESCRIPTIONS; | |
204 if (dispMenu.options[0].value != "0") { | |
205 if (navigator.userAgent.match(/ie/i)) { | |
206 dispMenu.add(new Option("0", "0"), 0); | |
207 } | |
208 else { | |
209 dispMenu.add(new Option("0", "0"), dispMenu[0]); | |
210 } | |
211 } | |
212 } | |
213 } | |
214 | |
215 function InitDynFormatOptions() | |
216 { | |
217 if ($("OLD_VIEW")) { | |
218 utils.addEvent($("FormatForm").OLD_VIEW, "click", adjustFormatOptions, false); | |
219 utils.addEvent($("FormatForm").ALIGNMENT_VIEW,"change", adjustFormatOptions, false); | |
220 utils.addEvent($("FormatForm").FORMAT_TYPE, "change", adjustFormatOptions, false); | |
221 adjustFormatOptions(); | |
222 } | |
223 } | |
224 | |
225 function InitFormatPage() | |
226 { | |
227 if ($("FormatForm").FORMAT_OBJECT.type == "select-one") { | |
228 UpdateDisplayTypes($("FormatForm").FORMAT_OBJECT); | |
229 UpdateFormatTypes($("FormatForm")); | |
230 list = $("FormatForm").FORMAT_OBJECT; | |
231 utils.addEvent(list, "change", function() { | |
232 UpdateFormatTypes($("FormatForm")); | |
233 }, | |
234 false); | |
235 } | |
236 utils.addEvent($("resetAll"), "click", ResetForm, false); | |
237 if($("maxNumSeq") != null) { | |
238 if($("maxNumSeq").value != "") { | |
239 LimitByHitlistSize($("FormatForm").DESCRIPTIONS); | |
240 LimitByHitlistSize($("FormatForm").ALIGNMENTS); | |
241 LimitByHitlistSize($("FormatForm").NUM_OVERVIEW); | |
242 } | |
243 } | |
244 setupOrganismSuggest($("FormatForm").FORMAT_ORGANISM); | |
245 utils.addEvent($("FormatForm"), "submit", function() { | |
246 adjustOrgVal($("FormatForm").FORMAT_ORGANISM);}, | |
247 false); | |
248 | |
249 if ($("addOrg")) utils.addEvent($("addOrg"), "click", AddFormatOrgField, false); | |
250 InitDynFormatOptions(); | |
251 /* add this code if decide image for View Report | |
252 var imgButtons = jQuery("[class='viewReport']"); | |
253 for (var i = 0; i < imgButtons.length; i++) { | |
254 var l = imgButtons[i]; | |
255 utils.addEvent(l, "click", function() {$("FormatForm").submit();}, false); | |
256 utils.addEvent(l, "mouseover", function() {l.src = l.getAttribute("mouseovImg");}, false); | |
257 utils.addEvent(l, "mouseout", function() {l.src = l.getAttribute("mouseoutImg");}, false); | |
258 utils.addEvent(l, "mousedown", function() {l.src = l.getAttribute("mousedownImg");}, false); | |
259 utils.addEvent(l, "mouseup", function() {l.src = l.getAttribute("mouseupImg");}, false); | |
260 } | |
261 */ | |
262 } | |
263 | |
264 utils.addEvent(window, 'load', InitFormatPage, false); | |
265 | |
266 | |
267 | |
268 | |
269 | |
270 |