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