diff options
Diffstat (limited to 'web')
-rwxr-xr-x | web/css/general_flask.css | 266 | ||||
-rwxr-xr-x | web/javascript/header.js | 122 | ||||
-rwxr-xr-x[-rw-r--r--] | web/javascript/jqueryFunction.js | 2041 | ||||
-rw-r--r--[-rwxr-xr-x] | web/javascript/selectDatasetMenu.js | 0 | ||||
-rwxr-xr-x | web/javascript/webqtl.js | 184 | ||||
-rwxr-xr-x | web/webqtl/base/webqtlConfigLocal.py | 10 | ||||
-rw-r--r-- | web/webqtl/base/webqtlTrait.py | 9 | ||||
-rwxr-xr-x | web/webqtl/basicStatistics/updatedBasicStatisticsPage.py | 54 | ||||
-rwxr-xr-x | web/webqtl/collection/ExportSelectionDetailInfoPage.py | 5 | ||||
-rwxr-xr-x | web/webqtl/correlation/CorrelationPage.py | 171 | ||||
-rwxr-xr-x | web/webqtl/maintainance/genSelectDatasetJS.py | 3 | ||||
-rwxr-xr-x | web/webqtl/search/SearchResultPage.py | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | web/webqtl/showTrait/DataEditingPage.py | 49 |
13 files changed, 1599 insertions, 1321 deletions
diff --git a/web/css/general_flask.css b/web/css/general_flask.css new file mode 100755 index 00000000..d40fa267 --- /dev/null +++ b/web/css/general_flask.css @@ -0,0 +1,266 @@ +@import url(import.css); + +body +{ + font-family : verdana, geneva, lucida, 'lucida grande', arial, helvetica; + font-weight : Normal; +} + +Blockquote { + margin : 14px 18px 14px 18px; +} + +/********** All this font size stuff, etc. needs to be replaced/removed ********** / + +/*Font size*/ +.fs10 {font-size : 10px} +.fs11 {font-size : 11px} +.fs12 {font-size : 12px} +.fs13 {font-size : 13px} +.fs14 {font-size : 14px} +.fs15 {font-size : 15px} +.fs16 {font-size : 16px} +.fs17 {font-size : 17px} + +/*Font Weight*/ +.fwb {font-weight : Bold} +.fwn {font-weight : Normal} + +/*Font Style*/ +.fsI {font-style : Italic} + +/*Font family*/ +.ffv {font-family : verdana, geneva, lucida, 'lucida grande', arial, helvetica;} +.ffl {font-family : lucida, verdana, 'lucida grande', helvetica, arial, geneva;} +.ffmono {font-family : "CourierNew", Courier, mono;} + +/*Color*/ +.cr {color : #f00} +.cg {color : #0f0} +.cdg {color : darkgreen} +.cb {color : #00f} +.c222 {color : #222} +.c999 {color : #999} +.c00d {color : #00d} +.cori {color : #CC9933} +.crb {color : royalblue} +.cw {color : #fff} +.cbl {color : #000000} +.cydull {color : #cfcf32} +.cdefault {color : #503A7D} + +/*backColor*/ +.cbr {background-color : #f00} +.cbg {background-color : #0f0} +.cbdg {background-color : darkgreen} +.cbb {background-color : #00f} +.cb222 {background-color : #222} +.cbg22t {background-color : #FF6} +.cbg22c {background-color : #5CB3FF} +.cbg2C {background-color : #1569C7} +.cbg22a {background-color : #F66} +.cbg22g {background-color : #CF9} +.cb00d {background-color : #00d} +.cb222 {background-color : #222} +.cbeee {background-color : #eee} +.cbori {background-color : #CC9933} +.cbrb {background-color : royalblue} +.cbdb {background-color : #2D2DB5} +.cbw {background-color : #fff} +.cbydull {background-color : #cfcf32} +.cbrdull {background-color : #c33232} +.cbgdull {background-color : #32c332} +.cbbdull {background-color : #1569C7} +.cbpdull {background-color : #c332c3} +.cbccc {background-color : #ccc} +.cbddf {background-color : #ddf} + +.nowrap {white-space: nowrap;} + +/*Table Cell*/ +.collap {border-collapse : collapse;} + +TH.header { + background-image: url(/images/bg.gif); + background-color: #4169E1; + cursor: pointer; + background-repeat: no-repeat; + background-position: center left; + padding-left: 20px; + margin-left: -1px; +} +TH.headerSortUp { + background-image: url(/images/desc.gif); + background-color: #4169E1; +} +TH.headerSortDown { + background-image: url(/images/asc.gif); + background-color: #4169E1; +} + +TD, P {color : #222222; font-size : 13px} +TD.b1 {border : 1px solid #999999; padding : 3px;} +TH.b1 {border : 1px solid #999999; padding : 3px;} +TD.bt1 {border-top : 1px solid #999999; padding : 3px;} +TD.bb1 {border-bottom : 1px solid #999999; padding : 3px;} + +.b2 {border : 2px solid royalblue; padding : 3px;} + +.bd1 {border : 1px dashed #999999; padding : 6px;} + +TR.outlier, TD.outlier {background-color : yellow;} + +TR.alt td { + background: #e6e8fa; +} + +TR.over td { + background: #82CFFD; +} + +/*Table Row*/ +.toggleShowHide { color : #0000DD; cursor: pointer;} +.invisible {display: none;} + +/*Link*/ +A.font_black:link {color: #000000; text-decoration : None} +A.font_black:active {color: #000000; text-decoration : None} +A.font_black:hover {color: #000000; text-decoration : None} +A.font_black:visited {color: #000000; text-decoration : None} + +A {font-family : lucida, 'lucida grande', verdana, helvetica, arial, geneva; + font-weight : Bold; font-size : 13px; text-decoration : None} + +A:link, A:visited {color : #0000DD; text-decoration : None} + +A:active {color : #FF0000; text-decoration : None} + +A:hover {color : #FF0000; text-decoration : None} + +A.background_grey {background:#dddddd;padding:2;} + +A.non_bold {font-weight : Normal; color : #0000DD;} + +/*Border Style*/ +.solidBorder {border : 1px solid #CCCCCC; padding : 2px;} +.doubleBorder {border : double #AAAAAA; padding : 2px;} + +/*Title style*/ +.title {font-weight:Bold; color:#222222; font-size:16px} + +.subtitle {font-family : lucida, verdana, 'lucida grande', helvetica, arial, geneva; + font-weight:Bold; font-size:14px; color:#000082} + +.sectionheader {font-family : arial, verdana, 'lucida grande', helvetica, lucida, geneva; + font-weight:Bold; font-size:14px; vertical-align: middle; display:block; color:#000000; background-color:#DDDDDD; line-height:24px; height:24px;} + +/*drop shadow*/ +#v3 .wrap1 {background:url(/images/shadow/shadow.gif) right bottom no-repeat;} +#v3 .wrap2 {background:url(/images/shadow/corner_bl.gif) -12px 100% no-repeat;} +#v3 .wrap3 { + padding:0 9px 9px 0; + background:url(/images/shadow/corner_tr.gif) 100% -12px no-repeat;} + + +/*steal from google*/ + + .tabsTableBox { + width:100%; + border-spacing:0; + border-collapse:collapse; + margin-top:5px; + font-size:smaller; + text-align:center; + } + .tabsTableBox td { + padding-right:5px; + padding-left:5px; + padding-bottom:3px; + } + +/*For making the Custom Strain box in snpBrowser.py a default width, instead of looking weird always*/ +.customBoxWidth { + width: 143px; +} + .selectedBox { + border-top:1px solid #676767; + border-right:1px solid #676767; + border-left:1px solid #676767; + width:80; + font-weight:bolder; + color:#3366cc; + font-size:12px; + } + .unselectedBox { + background-color:#dddddd; + border-top:1px solid #aaaaaa; + width:80; + border-right:1px solid #aaaaaa; + border-left:1px solid #aaaaaa; + border-bottom:1px solid #676767; + font-size:12px; + } + + .spacerTabBox { + border-bottom:1px solid #676767; + width:5px; + } + + .emptyTabBox { + border-bottom:1px solid #676767; + } + +/*For font color of 'Get Any' and 'Combined' in the main page*/ +.searchtip +{ +color: #999999; +} + + +/*For font style and color of commands and keywords in the scriptable interface page*/ +.keywords +{ + font-family : "CourierNew", Courier, mono; + font-size : 15px; + color : #0000FF; + font-weight : Normal +} + +/*For RIsample.html page*/ +.strains +{ + border:1px solid #999999; + border-top:1px solid #940; + border-bottom:1px solid #940; + padding:5; + background-color:#ddf; + font-family:verdana; +} + +.values +{ + border:1px solid #999999; + border-top:1px solid #940; + border-bottom:1px solid #940; + padding:5; + background-color:#eee; + font-family:courier; +} + +/*****************************************/ + +/* Standard table cell */ +.std_cell +{ + border : 1px solid #999999; + color : #222; + font-size : 13px; + padding : 3px; +} + +/*Input field used to enter sample values, SE, etc.*/ +.trait_value_input +{ + font-style : Italic +} + diff --git a/web/javascript/header.js b/web/javascript/header.js index 59fcacd8..65ba1bd6 100755 --- a/web/javascript/header.js +++ b/web/javascript/header.js @@ -1,62 +1,62 @@ -ctext = ''
-ctext += '<TD width=30 rowSpan=5> </TD>'
-ctext += '<TD bgColor=#ffffff NOWRAP="yes" width="100%" class="solidBorder">'
-ctext += ' <Table width= "100%" cellSpacing=0 cellPadding=0>'
-ctext += ' <TR>'
-ctext += ' <TD width= "100%" id="smallsize">'
-ctext += ' <a href="/">'
-ctext += ' <IMG src="/images/upload/GeneNet_Banner2009c.png" border="0">'
-ctext += ' </a>'
-ctext += ' </TD>'
-ctext += ' <TD valign="bottom">'
-ctext += ' <A HREF="http://www.touchgraph.com/TGGoogleBrowser.php?start=genenetwork.org&signed=false" target="_blank">'
-ctext += ' <IMG SRC="/images/upload/NetworkLogo.png" width="101" height="73" border="0">'
-ctext += ' </a>'
-ctext += ' </td>'
-ctext += ' <TD valign="bottom">'
-ctext += ' <IMG src="/images/webqtllogo2.gif" alt="WebQTL" border="0">'
-ctext += ' </TD>'
-ctext += ' </TR>'
-ctext += ' </Table>'
-ctext += '</TD>'
-ctext += '<TD width="30" rowSpan=5> </TD>'
-ctext += '</TR>'
-ctext += '<TR>'
-ctext += '<!--Home Help Search News Papers Policies Accounts Links-->'
-ctext += '<TD bgColor=#ddddff NOWRAP="yes" class="solidBorder">'
-ctext += '<table width="100%" cellSpacing=0 cellPadding=0 border=0>'
-ctext += '<tr>'
-ctext += '<td aligh=left NOWRAP="yes">'
-ctext += ' | '
-ctext += '<Span Id= "menu_grp1" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp1\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp1\'])" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<Strong>Home</Strong></Span>'
-ctext += ' | '
-ctext += '<Span Id= "menu_grp2" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp2\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp2\'])" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<Strong>Search</Strong></Span>'
-ctext += ' | '
-ctext += '<Span Id= "menu_grp3" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp3\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp3\'])" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<Strong>Help</Strong></Span>'
-ctext += ' | '
-ctext += '<Span Id= "menu_grp4" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp4\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp4\'])" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<A Href="/whats_new.html" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<Strong>News</Strong></A></Span>'
-ctext += ' | '
-ctext += '<Span Id= "menu_grp5" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp5\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp5\'])" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<A Href="/reference.html" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<Strong>References</Strong></A></Span>'
-ctext += ' | '
-ctext += '<Span Id= "menu_grp6" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp6\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp6\'])" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<Strong>Policies</Strong></Span>'
-ctext += ' | '
-ctext += '<Span Id= "menu_grp8" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp8\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp8\'])" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<A Href="/links.html" style="font-size:12px;font-family:verdana;color:#0000ae">'
-ctext += '<Strong>Links</Strong></A></Span>'
-ctext += ' | '
-ctext += '</td>'
-ctext += '<td align="right" NOWRAP="yes">'
-ctext += '<!-- %s --> '
-ctext += '</td>'
-ctext += '</tr>'
-ctext += '</table>'
-ctext += '</TD>'
+ctext = '' +ctext += '<TD width=30 rowSpan=5> </TD>' +ctext += '<TD bgColor=#ffffff NOWRAP="yes" width="100%" class="solidBorder">' +ctext += ' <Table width= "100%" cellSpacing=0 cellPadding=0>' +ctext += ' <TR>' +ctext += ' <TD width= "100%" id="smallsize">' +ctext += ' <a href="/">' +ctext += ' <IMG src="/images/upload/GeneNet_Banner2009c.png" border="0">' +ctext += ' </a>' +ctext += ' </TD>' +ctext += ' <TD valign="bottom">' +ctext += ' <A HREF="http://www.touchgraph.com/TGGoogleBrowser.php?start=genenetwork.org&signed=false" target="_blank">' +ctext += ' <IMG SRC="/images/upload/NetworkLogo.png" width="101" height="73" border="0">' +ctext += ' </a>' +ctext += ' </td>' +ctext += ' <TD valign="bottom">' +ctext += ' <IMG src="/images/webqtllogo2.gif" alt="WebQTL" border="0">' +ctext += ' </TD>' +ctext += ' </TR>' +ctext += ' </Table>' +ctext += '</TD>' +ctext += '<TD width="30" rowSpan=5> </TD>' +ctext += '</TR>' +ctext += '<TR>' +ctext += '<!--Home Help Search News Papers Policies Accounts Links-->' +ctext += '<TD bgColor=#ddddff NOWRAP="yes" class="solidBorder">' +ctext += '<table width="100%" cellSpacing=0 cellPadding=0 border=0>' +ctext += '<tr>' +ctext += '<td aligh=left NOWRAP="yes">' +ctext += ' | ' +ctext += '<Span Id= "menu_grp1" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp1\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp1\'])" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<Strong>Home</Strong></Span>' +ctext += ' | ' +ctext += '<Span Id= "menu_grp2" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp2\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp2\'])" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<Strong>Search</Strong></Span>' +ctext += ' | ' +ctext += '<Span Id= "menu_grp3" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp3\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp3\'])" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<Strong>Help</Strong></Span>' +ctext += ' | ' +ctext += '<Span Id= "menu_grp4" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp4\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp4\'])" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<A Href="/whats_new.html" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<Strong>News</Strong></A></Span>' +ctext += ' | ' +ctext += '<Span Id= "menu_grp5" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp5\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp5\'])" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<A Href="/reference.html" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<Strong>References</Strong></A></Span>' +ctext += ' | ' +ctext += '<Span Id= "menu_grp6" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp6\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp6\'])" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<Strong>Policies</Strong></Span>' +ctext += ' | ' +ctext += '<Span Id= "menu_grp8" onmouseover="A_MENUS[0].onmouseover(grpObj[\'menu_grp8\'])" onmouseout="A_MENUS[0].onmouseout(grpObj[\'menu_grp8\'])" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<A Href="/links.html" style="font-size:12px;font-family:verdana;color:#0000ae">' +ctext += '<Strong>Links</Strong></A></Span>' +ctext += ' | ' +ctext += '</td>' +ctext += '<td align="right" NOWRAP="yes">' +ctext += '<!-- %s --> ' +ctext += '</td>' +ctext += '</tr>' +ctext += '</table>' +ctext += '</TD>' document.write(ctext)
\ No newline at end of file diff --git a/web/javascript/jqueryFunction.js b/web/javascript/jqueryFunction.js index 5e6641cd..e612098b 100644..100755 --- a/web/javascript/jqueryFunction.js +++ b/web/javascript/jqueryFunction.js @@ -1,80 +1,75 @@ /* jquery part */ - /* used by index (base/indexBody.py) */ - -$(document).ready(function(){ +$(document).ready(function () { options_visible = 0; //Whether advanced options are being shown - $('tr .advanced_option').hide(); - $('.toggle_advanced').click(function(){ + $('.toggle_advanced').click(function () { $('tr .advanced_option').toggle(); - - if (options_visible = 0) { - $('.full_search_td').css('display','none;'); - $('.search_td').css('display','inline'); - options_visible = 1; - } - else { - if ($('#type_menu.type_menu').val() = 'Hippocampus'){ - $('.search_td').css('display','none;'); - $('.full_search_td').css('display','inline'); - } - options_visible = 0; - } + + if (options_visible = 0) { + $('.full_search_td').css('display', 'none;'); + $('.search_td').css('display', 'inline'); + options_visible = 1; + } else { + if ($('#type_menu.type_menu').val() = 'Hippocampus') { + $('.search_td').css('display', 'none;'); + $('.full_search_td').css('display', 'inline'); + } + options_visible = 0; + } }); - $('#full_search').click(function(){ + $('#full_search').click(function () { gene_symbol = $('input[name=keyword]').val(); scriptable_interface_url = 'http://alexandria.uthsc.edu:89/webqtl/main.py?cmd=sch&gene=' + gene_symbol; - window.open(scriptable_interface_url,'_self'); + window.open(scriptable_interface_url, '_self'); }); }); -$('select.type_menu').live('change', function() { +$('select.type_menu').live('change', function () { var trait_type = $('select.type_menu option:selected').val(); - $('#tissue').val(trait_type); - $('#tissue').trigger('change'); + $('#tissue').val(trait_type); + $('#tissue').trigger('change'); }); /* used by CorrelationPage.py, AddToSelectionPage.py, and SearchResultPage.py */ -$(document).ready(function(){ - $('img[name=addselect], img[name=networkgraph], img[name=corrmatrix], img[name=partialCorr], img[name=comparecorr], img[name=mintmap], img[name=heatmap]').click(function(){ - if ($('input[name=searchResult]:checked').length < 1){ - for (i=0; i<10; i++){ - $('input[name=searchResult]:eq('+i+')').attr('checked',true); +$(document).ready(function () { + $('img[name=addselect], img[name=networkgraph], img[name=corrmatrix], img[name=partialCorr], img[name=comparecorr], img[name=mintmap], img[name=heatmap]').click(function () { + if ($('input[name=searchResult]:checked').length < 1) { + for (i = 0; i < 10; i++) { + $('input[name=searchResult]:eq(' + i + ')').attr('checked', true); } } }); - $('img[name=addselect]').click(function(){ - addRmvSelection($('input[name=RISet]').val(), document.getElementsByName('showDatabase'+ $('input[name=RISet]').val())[0], 'addToSelection'); + $('img[name=addselect]').click(function () { + addRmvSelection($('input[name=RISet]').val(), document.getElementsByName('showDatabase' + $('input[name=RISet]').val())[0], 'addToSelection'); }); - $('.toggleShowHide').click(function(){ + $('.toggleShowHide').click(function () { var className = '.extra_options'; - if ($(className).css('display') == 'none'){ - var less = 'less'; - $('input[name=showHideOptions]').val(less); + if ($(className).css('display') == 'none') { + var less = 'less'; + $('input[name=showHideOptions]').val(less); $(className).show(); $('input[name=options]').val('Fewer Options'); var display = $('input[name=options]').css('display') - $(display).val('block'); - } - else { - var more = 'more'; - $('input[name=showHideOptions]').val(more); - $(className).hide(); - $('input[name=options]').val('More Options'); - var display = $('input[name=showHideOptions]').css('display') - $(display).val('block'); + $(display).val('block'); + } else { + var more = 'more'; + $('input[name=showHideOptions]').val(more); + $(className).hide(); + $('input[name=options]').val('More Options'); + var display = $('input[name=showHideOptions]').css('display') + $(display).val('block'); } }); }); @@ -83,82 +78,91 @@ $(document).ready(function(){ used by AddToSelectionPage.py */ function validateTraitNumber() { - var checkBoxes = $('.checkallbox'); - if (checkBoxes.filter(":checked").length < 2) { - alert("Please select at least two traits."); - return false; - } - else { - return true; - } + var checkBoxes = $('.checkallbox'); + if (checkBoxes.filter(":checked").length < 2) { + alert("Please select at least two traits."); + return false; + } else { + return true; + } } /* used by TextSearchPage.py */ -$(document).ready(function(){ - - $('.add_traits').click(function(){ - $('input[name=searchResult]').each(function(){ - if ($(this).is(':checked')){ - groupName = $(this).parents().next().next().children('[href]').text(); - addORrmv = 'addToSelection'; - thisForm = $('form[name=showDatabase]'); - addRmvSelection_allGroups(groupName, thisForm, addORrmv); - } - }); - }); - - function addRmvSelection_allGroups(groupName, thisForm, addORrmv){ - thisForm.attr('target',groupName); - thisForm.children('input[name=FormID]:hidden').val(addORrmv); - thisForm.children('input[name=RISet]:hidden').val(groupName); - var newWindow = open("",thisForm.attr('target'),"menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900"); - thisForm.submit(); - } - - $('.tab_content').hide(); //Hide all tab content - $('div.tab_container').each(function(){ - $(this).parent('td').find('div.tab_container:first').find('div.tab_content:first').show(); - }); - $('ul.tabs').each(function(){ - $(this).find('li:first').addClass('active'); - }); - $('ul.tabs:first').find('li:first').show(); - $('.tab_container:first').find('.tab_content:first').show(); - - //On Click Event - $('ul.tabs li').click(function() { - $('ul.tabs').find('li').removeClass('last_viewed'); - if($(this).parent('ul.tabs').next('div.tab_container').attr('id').indexOf('stats') != 1){ - $(this).addClass('last_viewed'); - } - $(this).parent('ul.tabs').find('li').removeClass('active'); - $(this).addClass('active'); - $(this).parent('ul.tabs').next('div.tab_container').find('.tab_content').hide(); - var activeTab = $(this).find('a').attr('href'); - if ($.browser.msie) - {$(activeTab).show();} - else - {$(activeTab).fadeIn();} //Fade in the active ID content - - return false; - }); +$(document).ready(function () { + + $('.add_traits').click(function () { + $('input[name=searchResult]').each(function () { + if ($(this).is(':checked')) { + groupName = $(this).parents().next().next().children('[href]').text(); + addORrmv = 'addToSelection'; + thisForm = $('form[name=showDatabase]'); + addRmvSelection_allGroups(groupName, thisForm, addORrmv); + } + }); + }); + + function addRmvSelection_allGroups(groupName, thisForm, addORrmv) { + thisForm.attr('target', groupName); + thisForm.children('input[name=FormID]:hidden').val(addORrmv); + thisForm.children('input[name=RISet]:hidden').val(groupName); + var newWindow = open("", thisForm.attr('target'), "menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900"); + thisForm.submit(); + } + + $('.tab_content').hide(); //Hide all tab content + $('div.tab_container').each(function () { + $(this).parent('td').find('div.tab_container:first').find('div.tab_content:first').show(); + }); + $('ul.tabs').each(function () { + $(this).find('li:first').addClass('active'); + }); + $('ul.tabs:first').find('li:first').show(); + $('.tab_container:first').find('.tab_content:first').show(); + + //On Click Event + $('ul.tabs li').click(function () { + $('ul.tabs').find('li').removeClass('last_viewed'); + if ($(this).parent('ul.tabs').next('div.tab_container').attr('id').indexOf('stats') != 1) { + $(this).addClass('last_viewed'); + } + $(this).parent('ul.tabs').find('li').removeClass('active'); + $(this).addClass('active'); + $(this).parent('ul.tabs').next('div.tab_container').find('.tab_content').hide(); + var activeTab = $(this).find('a').attr('href'); + if ($.browser.msie) { + $(activeTab).show(); + } else { + $(activeTab).fadeIn(); + } //Fade in the active ID content + return false; + }); }); /* used by DataEditingPage.py */ -$(document).ready(function() { +$(document).ready(function () { + + // ZS: This checks the number of columns in order to determine which column to not sort; in this case the plus-minus symbol shouldn't be sortable + $('#sortable1,#sortable2').find('th').each(function () { + if ($(this).text() == 'SE') { + $.tablesorter.defaults.headers = { + 3: { + sorter: false + } + }; + return false; + } + }); + + if ($('#sortable1,#sortable2').find('.outlier').size() > 0) { + $('input[name=sample_method]:eq(1)').attr('checked','checked'); + $('input[name=tissue_method]:eq(1)').attr('checked','checked'); + } - // ZS: This checks the number of columns in order to determine which column to not sort; in this case the plus-minus symbol shouldn't be sortable - $('#sortable1,#sortable2').find('th').each(function() { - if ($(this).text() == 'SE'){ - $.tablesorter.defaults.headers = { 3: {sorter: false} }; - return false; - } - }); /* ZS: This segment is called by tablesorter.js; it determines where to get the text used when sorting, based on the type of cell. @@ -167,949 +171,922 @@ $(document).ready(function() { This segment is repeated twice. Ideally this wouldn't be the case, but I can't find a way to reuse the inner textExtraction function. */ - //ZS: Defining these here, so they don't need to be searched for in the DOM for every single node - primaryTable = $("#sortable1"); - otherTable = $("#sortable2"); - - primaryValueHeader = primaryTable.find('th:contains("Value"):eq(0)'); - primarySEHeader = primaryTable.find('th:contains("SE"):eq(0)'); - otherValueHeader = otherTable.find('th:contains("Value"):eq(1)'); - otherSEHeader = otherTable.find('th:contains("SE"):eq(1)'); - - $("#sortable1").tablesorter({ - textExtraction: function(node) { - if ((node.children[0] == "[object HTMLInputElement]" && node.children[0].type == "text") || (/\S/.test(node.id))) { - cellId = node.id; - thisCell = $('#'+cellId).children(':eq(0)') - valueClassNames = thisCell.attr('class').split(/\s+/); - capitalized_column_name = cellId.split('_')[0].charAt(0).toUpperCase() + cellId.split('_')[0].slice(1); - value = valueClassNames[valueClassNames.length - 1]; - newValue = thisCell.val(); - - if (newValue == 'x' || value == '9999' || value == '-9999') { - valueType = cellId.split('_')[0]; - if (valueType == 'value'){ - header = primaryValueHeader; - } else { - header = primarySEHeader; - } - - if (header.hasClass('headerSortUp')){ - sort_order = 'desc'; - } else if (header.hasClass('headerSortDown')){ - sort_order = 'asc'; - } else { - sort_order = 'desc'; - } - - if (sort_order == 'desc') { - value = 9999; - thisCell.removeClass(value).addClass('9999'); - } else if (sort_order == 'asc'){ - value = -9999; - thisCell.removeClass(value).addClass('-9999'); - } else { - value = 9999; - thisCell.removeClass(value).addClass('9999'); - } - } - - text = value; - } - - else { - if (node.textContent) { - text = node.textContent; - } else { - if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) { - text = node.childNodes[0].innerHTML; - } else { - text = node.innerText; - } - } - } - return text - } - }); - - $("#sortable2").tablesorter({ - textExtraction: function(node) { - if ((node.children[0] == "[object HTMLInputElement]" && node.children[0].type == "text") || (/\S/.test(node.id))) { - cellId = node.id; - thisCell = $('#'+cellId).children(':eq(0)') - valueClassNames = thisCell.attr('class').split(/\s+/); - capitalized_column_name = cellId.split('_')[0].charAt(0).toUpperCase() + cellId.split('_')[0].slice(1); - value = valueClassNames[valueClassNames.length - 1]; - newValue = thisCell.val(); - - if (newValue == 'x' || value == '9999' || value == '-9999') { - valueType = cellId.split('_')[0]; - if (valueType == 'value'){ - header = otherValueHeader; - } else { - header = otherSEHeader; - } - - if (header.hasClass('headerSortUp')){ - sort_order = 'desc'; - } else if (header.hasClass('headerSortDown')){ - sort_order = 'asc'; - } else { - sort_order = 'desc'; - } - - if (sort_order == 'desc') { - value = 9999; - thisCell.removeClass(value).addClass('9999'); - } else if (sort_order == 'asc'){ - value = -9999; - thisCell.removeClass(value).addClass('-9999'); - } else { - value = 9999; - thisCell.removeClass(value).addClass('9999'); - } - } - - text = value; - } - - else { - if (node.textContent) { - text = node.textContent; - } else { - if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) { - text = node.childNodes[0].innerHTML; - } else { - text = node.innerText; - } - } - } - return text - } - }); + //ZS: Defining these here, so they don't need to be searched for in the DOM for every single node + primaryTable = $("#sortable1"); + otherTable = $("#sortable2"); + + primaryValueHeader = primaryTable.find('th:contains("Value"):eq(0)'); + primarySEHeader = primaryTable.find('th:contains("SE"):eq(0)'); + otherValueHeader = otherTable.find('th:contains("Value"):eq(1)'); + otherSEHeader = otherTable.find('th:contains("SE"):eq(1)'); + + $("#sortable1").tablesorter({ + textExtraction: function (node) { + if ((node.children[0] == "[object HTMLInputElement]" && node.children[0].type == "text") || (/\S/.test(node.id))) { + cellId = node.id; + thisCell = $('#' + cellId).children(':eq(0)') + valueClassNames = thisCell.attr('class').split(/\s+/); + capitalized_column_name = cellId.split('_')[0].charAt(0).toUpperCase() + cellId.split('_')[0].slice(1); + value = valueClassNames[valueClassNames.length - 1]; + newValue = thisCell.val(); + + if (newValue == 'x' || value == '9999' || value == '-9999') { + valueType = cellId.split('_')[0]; + if (valueType == 'value') { + header = primaryValueHeader; + } else { + header = primarySEHeader; + } + + if (header.hasClass('headerSortUp')) { + sort_order = 'desc'; + } else if (header.hasClass('headerSortDown')) { + sort_order = 'asc'; + } else { + sort_order = 'desc'; + } + + if (sort_order == 'desc') { + value = 9999; + thisCell.removeClass(value).addClass('9999'); + } else if (sort_order == 'asc') { + value = -9999; + thisCell.removeClass(value).addClass('-9999'); + } else { + value = 9999; + thisCell.removeClass(value).addClass('9999'); + } + } -/* + text = value; + } else { + if (node.textContent) { + text = node.textContent; + } else { + if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) { + text = node.childNodes[0].innerHTML; + } else { + text = node.innerText; + } + } + } + return text + } + }); + + $("#sortable2").tablesorter({ + textExtraction: function (node) { + if ((node.children[0] == "[object HTMLInputElement]" && node.children[0].type == "text") || (/\S/.test(node.id))) { + cellId = node.id; + thisCell = $('#' + cellId).children(':eq(0)') + valueClassNames = thisCell.attr('class').split(/\s+/); + capitalized_column_name = cellId.split('_')[0].charAt(0).toUpperCase() + cellId.split('_')[0].slice(1); + value = valueClassNames[valueClassNames.length - 1]; + newValue = thisCell.val(); + + if (newValue == 'x' || value == '9999' || value == '-9999') { + valueType = cellId.split('_')[0]; + if (valueType == 'value') { + header = otherValueHeader; + } else { + header = otherSEHeader; + } + + if (header.hasClass('headerSortUp')) { + sort_order = 'desc'; + } else if (header.hasClass('headerSortDown')) { + sort_order = 'asc'; + } else { + sort_order = 'desc'; + } + + if (sort_order == 'desc') { + value = 9999; + thisCell.removeClass(value).addClass('9999'); + } else if (sort_order == 'asc') { + value = -9999; + thisCell.removeClass(value).addClass('-9999'); + } else { + value = 9999; + thisCell.removeClass(value).addClass('9999'); + } + } + + text = value; + } else { + if (node.textContent) { + text = node.textContent; + } else { + if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) { + text = node.childNodes[0].innerHTML; + } else { + text = node.innerText; + } + } + } + return text + } + }); + + /* ZS: When the user changes the value in the text field, the new value is added as a class. This is because $('input[type=text]').val() gets the value attribute, which is always the default value, instead of the value property (which can be changed) */ - var thisTable = $('#sortable1,#sortable2'); - - thisTable.bind("update propertychange keyup input paste", function(e){ - - var target = e.target; - $target = $(target); - - if (target.nodeName.toLowerCase() == 'input'){ - thisClassNames = $target.attr('class').split(/\s+/); - valueClass = thisClassNames[thisClassNames.length - 1]; - newValue = $target.val(); - thisParent = $target.parent('td'); - thisParentId = thisParent.attr('id'); - - $target.removeClass(valueClass); - - if (newValue == 'x'){ - thisParent.parent('tr').addClass('blocked'); - } else { - $('#'+thisParentId).children('input.valueField:eq(0)').addClass(newValue); - } - } - }); - - //////////////////////////////////// - // Initially close tabs - //////////////////////////////////// - - thisForm = $('form[name="dataInput"]'); - - $('#sectionbody2').hide(); - $('#sectionbody3').hide(); - $('#sectionbody4').hide(); - - $('#title1').click(function() { - $('#sectionbody1').toggle(); - return false; - }); - $('#title2').click(function() { - $('#sectionbody2').toggle(); - return false; - }); - $('#title3').click(function() { - $('#sectionbody3').toggle(); - return false; - }); - $('#title4').click(function() { - $('#sectionbody4').toggle(); - return false; - }); - $('#title5').click(function() { - $('#sectionbody5').toggle(); - return false; - }); - - - - ////////////////////////////////////////////////////////////// - // Switch out + and - icon when you click each section header - ////////////////////////////////////////////////////////////// - - var expand_html = "<span class=\"expand_container\"> <IMG src=\"/images/Expand.gif\" alt=\"Expand\"></span>"; - var contract_html = "<span class=\"contract_container\"> <IMG src=\"/images/Contract.gif\" alt=\"Contract\"></span>"; - - $('#title2, #title3, #title4').prepend(expand_html).addClass('1'); - - $('#title1, #title5').prepend(contract_html).addClass('0'); - - for(i=1;i<=5;i++){ - $('#title'+i).click(function(){ - if ($(this).hasClass('0')) { - $(this).find('span').replaceWith(expand_html); - $(this).removeClass('0'); - $(this).addClass('1'); - } - else { - $(this).find('span').replaceWith(contract_html); - $(this).removeClass('1'); - $(this).addClass('0'); - } - }); - } - - // Exclude cases by attributes - - $('div.attribute_values:first').css('display', 'inline'); //Display the dropdown menu with the first attribute's distinct values - - $('select[name=exclude_menu]').change(function(){ - $('div.attribute_values').css('display', 'none'); //clear all other menus when a new attribute is selected - attribute = $(this).val(); - //attribute = $('select[name=exclude_menu]').val(); - menu = $('div.attribute_values').find('[name=\''+attribute+'\']'); - menu.parent().css('display', 'inline'); - }); - - primary_row_count = $('#primary').find('tr').length - 1; - other_row_count = $('#other').find('tr').length - 1; - - if (primary_row_count >= other_row_count) { - row_count = primary_row_count; - } - else { - row_count = other_row_count; - } - - $('div.attribute_values').children('select').change(function(){ - exclude_value = $(this).val(); - }); -}); - -$(window).load(function(){ - - //ZS: These are needed in a few places; looping through rows by index is faster than doing a "find" search - numPrimaryRows = $('#sortable1').find('tr').length; - numOtherRows = $('#sortable2').find('tr').length; - - -/////////////////////////////// -//Basic Statistics -/////////////////////////////// - - ///////////////////////////////////////////////////////////////// - // Hide unselected Basic Statistics tabs (when just BXD strains - // are selected, hide the results for all strains/non-BXD) - ///////////////////////////////////////////////////////////////// - - $('#stats_tabs1').hide(); - $('#stats_tabs2').hide(); - - $('#sectionbody2').find('select[name=stats_mdp]').change(function(){ - selected = $('#sectionbody2').find('select[name=stats_mdp] option:selected').val(); - for (i=0;i<=2;i++){ - $('#stats_tabs'+i).hide(); - } - $('#stats_tabs'+selected).show(); - }); - - //////////////////////////////////////////////////////////////////////// - // Select the same tab across each sample group (when a Box Plot is - // selected for BXD, switching to Non-BXD will also display a Box Plot) - ////////////./////////////////////////////////////////////////////////// - - var $tabs1 = $('#stats_tabs0').tabs(); - var $tabs2 = $('#stats_tabs1').tabs(); - var $tabs3 = $('#stats_tabs2').tabs(); - - $tabs1.tabs({ - show: function(event, ui) { - var selected = $tabs1.tabs('option','selected'); - $tabs2.tabs('select',selected); - $tabs3.tabs('select',selected); - } - }); - $tabs2.tabs({ - show: function(event, ui) { - var selected = $tabs2.tabs('option','selected'); - $tabs1.tabs('select',selected); - $tabs3.tabs('select',selected); - } - }); - $tabs3.tabs({ - show: function(event, ui) { - var selected = $tabs3.tabs('option','selected'); - $tabs1.tabs('select',selected); - $tabs2.tabs('select',selected); - } - }); - - -/////////////////////////////// -//Calculate Correlations -/////////////////////////////// - - $('#sectionbody3').find('input[name="sample_corr"]').click(function() { - dbValue = $('select[name=database1] option:selected').val(); - $('input[name=database]').val(dbValue); - criteriaValue = $('select[name=criteria1] option:selected').val(); - $('input[name=criteria]').val(criteriaValue); - MDPValue = $('select[name=MDPChoice1] option:selected').val(); - $('input[name=MDPChoice]').val(MDPValue); - - methodValue = $('input[name=sample_method]:checked').val(); - - //This simple method can be used now that 'method' is defaulted to None instead of '' - if (methodValue == "1"){ - $('input[name=method]').val('1'); - } - else{ - $('input[name=method]').val('2'); - } - - dataEditingFunc(this.form,'correlation'); - }); - - $('#sectionbody3').find('input[name="lit_corr"]').click(function() { - dbValue = $('select[name=database2] option:selected').val(); - $('input[name=database]').val(dbValue); - criteriaValue = $('select[name=criteria2] option:selected').val(); - $('input[name=criteria]').val(criteriaValue); - MDPValue = $('select[name=MDPChoice2] option:selected').val(); - $('input[name=MDPChoice]').val(MDPValue); - - $('input[name=method]').val('3'); - - dataEditingFunc(this.form,'correlation'); - }); - - $('#sectionbody3').find('input[name="tiss_corr"]').click(function() { - dbValue = $('select[name=database3] option:selected').val(); - $('input[name=database]').val(dbValue); - criteriaValue = $('select[name=criteria3] option:selected').val(); - $('input[name=criteria]').val(criteriaValue); - MDPValue = $('select[name=MDPChoice3] option:selected').val(); - $('input[name=MDPChoice]').val(MDPValue); - - methodValue = $('input[name=tissue_method]:checked').val(); - - if (methodValue == "4"){ - $('input[name=method]').val('4'); - } - else{ - $('input[name=method]').val('5'); - } - dataEditingFunc(this.form,'correlation'); - }); - -/////////////////////////////// -//Mapping Tools -/////////////////////////////// - - $('#sectionbody4').find('input[name=interval]').click(function() { - chrValue = $('select[name=chromosomes1] option:selected').val(); - $('input[name=chromosomes]').val(chrValue); - scaleValue = $('select[name=scale1] option:selected').val(); - $('input[name=scale]').val(scaleValue); - $('input[name=controlLocus]').val(''); - - //Changed the way permValue, bootValue, and parentsValue are acquired; before it was $(____).is(':checked'); - permValue = $('input[name=permCheck1]:checked').val(); - $('input[name=permCheck]').val(permValue); - - bootValue = $('input[name=bootCheck1]:checked').val(); - $('input[name=bootCheck]').val(bootValue); - - if ($('input[name=parentsf14regression1]:checked').length > 0){ - $('input[name=parentsf14regression]').val('on'); - } else { - $('input[name=parentsf14regression]').val('off'); - } - - varValue = $('input[name=applyVarianceSE1]:checked').val(); - $('input[name=applyVarianceSE]').val(varValue); - - dataEditingFunc(this.form,'intervalMap'); - }); - - var tiptext = "e.g., rs12345"; - controlLocus = $('#sectionbody4').find('input[name=controlLocus]'); - - if(controlLocus.val() == '' || controlLocus == tiptext) { - controlLocus.addClass('searchtip').val(tiptext); - } - - controlLocus.focus(function(e) { - if(controlLocus.val() == tiptext) { - controlLocus.val(''); - } - controlLocus.removeClass('searchtip'); - }); - - controlLocus.blur(function(e) { - if(controlLocus.val() == '') { - controlLocus.addClass('searchtip').val(tiptext); - } else if(controlLocus.val() == tiptext) { - controlLocus.addClass('searchtip'); - } else { - controlLocus.removeClass('searchtip'); - } - }); - - $('#sectionbody4').find('input[name=composite]').click(function() { - chrValue = $('select[name=chromosomes2] option:selected').val(); - $('input[name=chromosomes]').val(chrValue); - scaleValue = $('select[name=scale2] option:selected').val(); - $('input[name=scale]').val(scaleValue); - controlValue = controlLocus.val(); - if (controlValue != tiptext){ - controlLocus.val(controlValue); - } - else{ - controlLocus.val(''); - } - - //Changed the way permValue, bootValue, and parentsValue are acquired; before it was $(____).is(':checked'); - permValue = $('input[name=permCheck2]:checked').val(); - $('input[name=permCheck]').val(permValue); - - bootValue = $('input[name=bootCheck2]:checked').val(); - $('input[name=bootCheck]').val(bootValue); - - if ($('input[name=parentsf14regression3]:checked').length > 0){ - $('input[name=parentsf14regression]').val('on'); - } else { - $('input[name=parentsf14regression]').val('off'); - } - - dataEditingFunc(this.form,'intervalMap'); - - }); - - $('#sectionbody4').find('input[name=marker]').click(function() { - //Changed the way parentsValue is acquired; before it was $(____).is(':checked'); - if ($('input[name=parentsf14regression2]:checked').length > 0){ - $('input[name=parentsf14regression]').val('on'); - } else { - $('input[name=parentsf14regression]').val('off'); - } - - varValue = $('input[name=applyVarianceSE2]:checked').val(); - $('input[name=applyVarianceSE]').val(varValue); - - dataEditingFunc(this.form,'markerRegression'); - }); - -/////////////////////////////// -//Review and Edit Data -/////////////////////////////// - - $('input[name=excludeGroup]').click(function(){ - for (i = 1;i <= Math.max(primary_row_count,other_row_count)-1; i++){ - valueExists = 0; - $('#Primary_'+i+',#Other_'+i).children().each(function(){ - if ($(this).text() == exclude_value) { - $('#Primary_'+i+',#Other_'+i).addClass('blocked').find('input[type=text]').val('x'); - valueExists = 1; - return false; - } - }); - } - }); - - $('.update').click(function(){ - windowName = 'formTarget' + (new Date().getTime()); - newWindow = open("",windowName,"menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=0,directories=1,width=900"); - document.dataInput.target = windowName; - document.dataInput.submitID.value = "basicStatistics"; - - primaryData = getTraitData()[0]; - otherData = getTraitData()[1]; - allData = getTraitData()[2]; - - if (otherData[0].length > 0) { - if ($('select[name="stats_mdp"] option:selected').val() == 0) { - document.dataInput.strainNames.value = allData[0].toString(); - document.dataInput.strainVals.value = allData[1].toString(); - document.dataInput.strainVars.value = allData[2].toString(); - } - else if ($('select[name="stats_mdp"] option:selected').val() == 1) { - document.dataInput.strainNames.value = primaryData[0].toString(); - document.dataInput.strainVals.value = primaryData[1].toString(); - document.dataInput.strainVars.value = primaryData[2].toString(); - } - else { - document.dataInput.strainNames.value = otherData[0].toString(); - document.dataInput.strainVals.value = otherData[1].toString(); - document.dataInput.strainVars.value = otherData[2].toString(); - } - } - else { - document.dataInput.strainNames.value = allData[0].toString(); - document.dataInput.strainVals.value = allData[1].toString(); - document.dataInput.strainVars.value = allData[2].toString(); - } - - document.dataInput.submit(); - }); - - $('input[name="export"]').click(function(){ - windowName = 'formTarget' + (new Date().getTime()); - newWindow = open("",windowName,"menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=0,directories=1,width=900"); - document.dataInput.target = windowName; - document.dataInput.submitID.value = "exportData"; - - primaryData = getTraitData()[0]; - otherData = getTraitData()[1]; - - document.dataInput.strainNames.value = primaryData[0].toString(); - document.dataInput.strainVals.value = primaryData[1].toString(); - document.dataInput.strainVars.value = primaryData[2].toString(); - - document.dataInput.otherStrainNames.value = otherData[0].toString(); - document.dataInput.otherStrainVals.value = otherData[1].toString(); - document.dataInput.otherStrainVars.value = otherData[2].toString(); - - attribute_names = new Array(); - $('#primary,#other').find('th.attribute_name').each(function(){ - attribute_names.push($(this).val().toString()); - }); - - primary_attribute_values = ""; //This string will be structured as a dictionary with a set of values for each attribute; it will be parsed in the ExportPage class - other_attribute_values = ""; - - attr_counter = 1; // Counter for each different attribute - row_counter = 1; // Counter for each value for each attribute - while (attr_counter <= attribute_names.length){ - attribute_name = $('#primary,#other').find('th.attribute_name:eq('+ (attr_counter-1).toString() + ')').text(); - primary_row_count = $('#primary').find('tr').length - 1; - other_row_count = $('#other').find('tr').length - 1; - - primary_attribute_values += attribute_name + " : "; - other_attribute_values += attribute_name + " : "; - - primary_value_string = ""; //This string of values (in the format 'a,b,c', etc) will be appended to the primary_attribute_values string - for (row_counter = 1;row_counter <= numPrimaryRows; row_counter++){ - value = $('#primary_attribute'+attr_counter.toString()+'_sample'+row_counter.toString()).text(); - if (row_counter == primary_row_count) { - primary_value_string += (value + " / "); - } - else{ - primary_value_string += (value + ","); - } - } - - primary_attribute_values += primary_value_string; - - other_value_string = ""; //This string of values (in the format 'a,b,c', etc) will be appended to the other_attribute_values string - for (row_counter = 1;row_counter <= numOtherRows; row_counter++){ - value = $('#other_attribute'+attr_counter.toString()+'_sample'+row_counter.toString()).text(); - if (row_counter == other_row_count) { - other_value_string += (value + " / "); - } - else{ - other_value_string += (value + ","); - } - } - other_attribute_values += other_value_string; - attr_counter += 1 - } - - document.dataInput.extra_attributes.value = primary_attribute_values; - document.dataInput.other_extra_attributes.value = other_attribute_values; - - document.dataInput.submit(); - }); - - var thisTable = $('#sortable1,#sortable2'); //ZS: variable representing each table, because it's used often - - thisTable.find('input[name="selectCheck"]').click(function(){ - if($(this).is(':checked')){ - $(this).parent("").parent("").children("td").css("background-color", "yellow"); - } - else{ - if(!($(this).parent().parent().hasClass('outlier'))){ - $(this).parent().parent().children("td").css("background-color", "white"); - } - } - }); - - $('input[name=resetButton]').click(function(){ - - //ZS: Reset "hide no value" and "hide outliers" - $('#showHideOptions').find('input[name=showHideNoValue]').val(' Hide No Value '); - $('#showHideOptions').find('input[name=showHideOutliers]').val(' Hide Outliers '); - noValShown = 1; - outliersShown = 1; - - for (i=1;i<=numPrimaryRows-1;i++){ - var thisRow = $('#Primary_'+i); - if (thisRow.is('.invisible')){ - thisRow.removeClass('invisible'); - } - if (thisRow.is('.blocked')){ - thisRow.removeClass('blocked'); - } - if (thisRow.is(':not(.outlier)')){ - thisRow.css("background-color", "white"); - } - - var thisValueField = thisRow.find('.valueField'); - - var originalValue = thisValueField[0].defaultValue; - var thisClassNames = thisRow.find('input:eq(1)').attr('class').split(/\s+/); - var valueClass = thisClassNames[thisClassNames.length-1]; - thisRow.find('input:eq(1)').removeClass(valueClass).addClass(originalValue).val(originalValue); - - if (thisValueField.length > 1){ - var originalValue = thisValueField[1].defaultValue; - var thisClassNames = thisRow.find('input:eq(2)').attr('class').split(/\s+/); - var valueClass = thisClassNames[thisClassNames.length-1]; - thisRow.find('input:eq(2)').removeClass(valueClass).addClass(originalValue).val(originalValue); - } - } - for (i=1;i<=numOtherRows-1;i++){ - var thisRow = $('#Other_'+i); - if (thisRow.is('.invisible')){ - thisRow.removeClass('invisible') - } - if (thisRow.is('.blocked')){ - thisRow.removeClass('blocked'); - } - if (thisRow.is(':not(.outlier)')){ - thisRow.css("background-color", "white"); - } - - var thisValueField = thisRow.find('.valueField'); - - var originalValue = thisValueField[0].defaultValue; - var thisClassNames = thisRow.find('input:eq(1)').attr('class').split(/\s+/); - var valueClass = thisClassNames[thisClassNames.length-1]; - thisRow.find('input:eq(1)').removeClass(valueClass).addClass(originalValue).val(originalValue); - - if (thisValueField.length > 1){ - var originalValue = thisValueField[1].defaultValue; - var thisClassNames = thisRow.find('input:eq(2)').attr('class').split(/\s+/); - var valueClass = thisClassNames[thisClassNames.length-1]; - thisRow.find('input:eq(2)').removeClass(valueClass).addClass(originalValue).val(originalValue); - } - } - }); - - var tiptext2 = "e.g., 4, 6-30, 43"; - var blockField = $('#showHideOptions').find('input[name=removeField]'); //ZS: Field where user inputs the index of the samples he/she wants to block; created variable because it's used often - - if(blockField.val() == '' || blockField.val() == tiptext2) { - blockField.addClass('searchtip'); - blockField.val(tiptext2); - } - - blockField.focus(function(e) { - if(blockField.val() == tiptext2) { - blockField.val(''); - } - blockField.removeClass('searchtip'); - }); - - blockField.blur(function(e) { - if(blockField.val() == '') { - blockField.addClass('searchtip'); - blockField.val(tiptext2); - } else if(blockField.val() == tiptext2) { - blockField.addClass('searchtip'); - } else { - blockField.removeClass('searchtip'); - } - }); - - var noValShown = new Boolean(1); - var outliersShown = new Boolean(1); - - $('#showHideOptions').bind('click', function(e){ - var target = e.target; - $target = $(target); - - if (target.name === 'blockSamples'){ - if (blockField.val() == tiptext2){ - blockField.val('') - } - blockedText = blockField.val(); - blockedTextSplit = new Array(); - blockedItems = new Array(); - - blockedTextSplit = blockedText.split(/\,/); - - for (i=0;i<=blockedTextSplit.length-1;i++) { - var item = blockedTextSplit[i]; - if(item.indexOf('-') != -1){ - subArray = new Array(); - subArray = item.split('-'); - num1 = parseInt(subArray[0]); - num2 = parseInt(subArray[1]); - for (j=num1;j<=num2;j=j+1){ - blockedItems.push(j); - } - } - else if(!(isNaN(item))) { - blockedItems.push(item); - } - } - - for (i=0;i<=blockedItems.length-1;i++) { - item = blockedItems[i]; - if ($('select[name=block_method]').val() == '0') { - var thisRow = $('#Other_'+item); - } - else { - var thisRow = $('#Primary_'+item); - } - - if (thisRow.is('.novalue')) { - continue; - } - else { - thisRow.addClass('blocked').find('input.valueField').val('x'); - } - - //First look at value cell - var thisCell = thisRow.find('input:eq(1)'); - var thisClassNames = thisCell.attr('class').split(/\s+/); - var valueClass = thisClassNames[thisClassNames.length-1]; - var header = thisRow.parents('table.tablesorter').find('th.header:contains("Value"):eq(0)'); - if (header.hasClass('headerSortUp')){ - thisCell.removeClass(valueClass).addClass('-9999'); - } else if (header.hasClass('headerSortDown')){ - thisCell.removeClass(valueClass).addClass('9999'); - } else { - thisCell.removeClass(valueClass).addClass('-9999'); - } - - //Check if there is an SE column - if (thisRow.find('input.valueField').length > 1) { - var thisCell = thisRow.find('input:eq(2)'); - var thisClassNames = thisCell.attr('class').split(/\s+/); - var valueClass = thisClassNames[thisClassNames.length-1]; - var header = thisRow.parents('table.tablesorter').find('th.header:contains("SE"):eq(0)'); - if (header.hasClass('headerSortUp')){ - thisCell.removeClass(valueClass).addClass('-9999'); - } else if (header.hasClass('headerSortDown')){ - thisCell.removeClass(valueClass).addClass('9999'); - } else { - thisCell.removeClass(valueClass).addClass('-9999'); - } - } - } - } - - else if (target.name === 'showHideNoValue'){ - if (noValShown) { - $('#showHideOptions').find('input[name=showHideNoValue]').val(' Show No Value '); - for (i=1;i<=Math.max(numPrimaryRows,numOtherRows)-1;i++) { - if (i<=numPrimaryRows-1) { - var thisRow = $('#Primary_'+i); - if (thisRow.is('.novalue:visible') || thisRow.is('.blocked:visible')){ - jQuery(thisRow).addClass('invisible'); - } - } - if (i<=numOtherRows-1){ - var thisOtherRow = $('#Other_'+i); - if (thisOtherRow.is('.novalue:visible') || thisOtherRow.is('.blocked:visible')){ - if (thisOtherRow.is(':visible')){ - jQuery(thisOtherRow).addClass('invisible'); - } - } - } - } - noValShown = 0; - } - else { - $('#showHideOptions').find('input[name=showHideNoValue]').val(' Hide No Value '); - for (i=1;i<=Math.max(numPrimaryRows,numOtherRows)-1;i++) { - if (i<=numPrimaryRows-1) { - var thisRow = $('#Primary_'+i); - if (thisRow.is('.novalue') || thisRow.is('.blocked')){ - jQuery(thisRow).removeClass('invisible'); - if (!(outliersShown)) { - if (thisRow.is('.outlier:visible')){ - jQuery(thisRow).addClass('invisible'); - } - } - } - } - if (i<=numOtherRows-1){ - var thisOtherRow = $('#Other_'+i); - if (thisOtherRow.is('.novalue') || thisOtherRow.is('.blocked')){ - jQuery(thisOtherRow).removeClass('invisible'); - if (!(outliersShown)) { - if (thisOtherRow.is('.outlier:visible')){ - jQuery(thisOtherRow).addClass('invisible'); - } - } - } - } - } - noValShown = 1; - } - } - - else if (target.name === 'showHideOutliers'){ - if (outliersShown){ - $('#showHideOptions').find('input[name=showHideOutliers]').val(' Show Outliers '); - for (i=1;i<=Math.max(numPrimaryRows,numOtherRows)-1;i++) { - if (i<=numPrimaryRows-1) { - thisRow = $('#Primary_'+i); - if (thisRow.is('.outlier:visible') && (!(thisRow.is('.invisible')))) { - thisRow.addClass('invisible') - } - } - if (i<=numOtherRows-1) { - thisOtherRow = $('#Other_'+i); - if (thisOtherRow.is('.outlier:visible') && (!(thisOtherRow.is('.invisible')))) { - thisOtherRow.addClass('invisible') - } - } - } - outliersShown = 0; - } - else { - $('#showHideOptions').find('input[name=showHideOutliers]').val(' Hide Outliers '); - for (i=1;i<=Math.max(numPrimaryRows,numOtherRows)-1;i++) { - if (i<=numPrimaryRows-1) { - thisRow = $('#Primary_'+i); - if (thisRow.is('.outlier') && (!(thisRow.is(':visible')))) { - if (!(noValShown)) { - if (thisRow.is('.blocked')){ - continue; - } - } - jQuery(thisRow).removeClass('invisible') - } - } - if (i<=numOtherRows-1) { - thisOtherRow = $('#Other_'+i); - if (thisOtherRow.is('.outlier') && (!(thisOtherRow.is(':visible')))) { - if (!(noValShown)) { - if (thisOtherRow.is('.blocked')){ - continue; - } - } - jQuery(thisOtherRow).removeClass('invisible') - } - } - } - outliersShown = 1; - } - } - return false; - }); -}); - -function getTraitData(){ - primary_row_count = $('#sortable1').find('tr').length - 1; - other_row_count = $('#sortable2').find('tr').length - 1; - - primaryStrainNames = new Array(); - primaryVals = new Array(); - primaryVars = new Array(); - - allStrainNames = new Array(); - allVals = new Array(); - allVars = new Array(); - - for (i = 1;i <= primary_row_count; i++){ - thisRow = $('#Primary_'+i); - strainName = thisRow.find('span:first').text(); - primaryStrainNames.push(strainName); - allStrainNames.push(strainName); - strainVal = thisRow.find('input:eq(1)').val(); - primaryVals.push(strainVal); - allVals.push(strainVal); - strainVar = ''; // Just to initialize it in case there is no var - strainVar = thisRow.find('input:eq(2)').val(); - primaryVars.push(strainVar); - allVars.push(strainVar); - } - - otherStrainNames = new Array(); - otherVals = new Array(); - otherVars = new Array(); - - for (j = 1;j <= other_row_count; j++){ - thisRow = $('#Other_'+j) - strainName = thisRow.find('span:first').text(); - otherStrainNames.push(strainName); - strainVal = thisRow.find('input:eq(1)').val(); - otherVals.push(strainVal); - strainVar = ''; // Just to initialize it in case there is no var - strainVar = thisRow.find('input:eq(2)').val(); - otherVars.push(strainVar); - - if (jQuery.inArray(strainName, allStrainNames) == -1) { - allStrainNames.push(strainName); - allVals.push(strainVal); - allVars.push(strainVar); - } - } - - primaryData = [primaryStrainNames, primaryVals, primaryVars]; - otherData = [otherStrainNames, otherVals, otherVars]; - allData = [allStrainNames, allVals, allVars]; - - return [primaryData, otherData, allData]; -} + var thisTable = $('#sortable1,#sortable2'); + thisTable.bind("update propertychange keyup input paste", function (e) { -/* -used by networkGraphPageBody.py -*/ + var target = e.target; + $target = $(target); -//Default to plain text + symbol for the "Export Graph File" button -$('input[name=exportGraphFile]').live('click', function() { window.open($('input[name=exportFilename]').val() + "_plain_symbol.txt") }); + if (target.nodeName.toLowerCase() == 'input') { + thisClassNames = $target.attr('class').split(/\s+/); + valueClass = thisClassNames[thisClassNames.length - 1]; + newValue = $target.val(); + thisParent = $target.parent('td'); + thisParentId = thisParent.attr('id'); + + $target.removeClass(valueClass); + + if (newValue == 'x') { + thisParent.parent('tr').addClass('blocked'); + } else { + $('#' + thisParentId).children('input.valueField:eq(0)').addClass(newValue); + } + } + }); + + //////////////////////////////////// + // Initially close tabs + //////////////////////////////////// + thisForm = $('form[name="dataInput"]'); + + $('#sectionbody2').hide(); + $('#sectionbody3').hide(); + $('#sectionbody4').hide(); + + $('#title1').click(function () { + $('#sectionbody1').toggle(); + return false; + }); + $('#title2').click(function () { + $('#sectionbody2').toggle(); + return false; + }); + $('#title3').click(function () { + $('#sectionbody3').toggle(); + return false; + }); + $('#title4').click(function () { + $('#sectionbody4').toggle(); + return false; + }); + $('#title5').click(function () { + $('#sectionbody5').toggle(); + return false; + }); -function changeFormat(graphName){ - var graphFormat = $('#exportFormat').val(); - var traitType = $('#traitType').val(); - $('input[name=exportGraphFile]').die('click'); - if (graphFormat=="xgmml"){ - if (traitType=="symbol"){ - var graphFile = graphName+ "_xgmml_symbol.txt"; - $('input[name=exportGraphFile]').live('click', function() { window.open(graphFile) }); + ////////////////////////////////////////////////////////////// + // Switch out + and - icon when you click each section header + ////////////////////////////////////////////////////////////// + var expand_html = "<span class=\"expand_container\"> <IMG src=\"/images/Expand.gif\" alt=\"Expand\"></span>"; + var contract_html = "<span class=\"contract_container\"> <IMG src=\"/images/Contract.gif\" alt=\"Contract\"></span>"; + + $('#title2, #title3, #title4').prepend(expand_html).addClass('1'); + + $('#title1, #title5').prepend(contract_html).addClass('0'); + + for (i = 1; i <= 5; i++) { + $('#title' + i).click(function () { + if ($(this).hasClass('0')) { + $(this).find('span').replaceWith(expand_html); + $(this).removeClass('0'); + $(this).addClass('1'); + } else { + $(this).find('span').replaceWith(contract_html); + $(this).removeClass('1'); + $(this).addClass('0'); + } + }); + } + + // Exclude cases by attributes + $('div.attribute_values:first').css('display', 'inline'); //Display the dropdown menu with the first attribute's distinct values + $('select[name=exclude_menu]').change(function () { + $('div.attribute_values').css('display', 'none'); //clear all other menus when a new attribute is selected + attribute = $(this).val(); + //attribute = $('select[name=exclude_menu]').val(); + menu = $('div.attribute_values').find('[name=\'' + attribute + '\']'); + menu.parent().css('display', 'inline'); + }); + + primary_row_count = $('#primary').find('tr').length - 1; + other_row_count = $('#other').find('tr').length - 1; + + if (primary_row_count >= other_row_count) { + row_count = primary_row_count; + } else { + row_count = other_row_count; + } + + $('div.attribute_values').children('select').change(function () { + exclude_value = $(this).val(); + }); +}); + +$(window).load(function () { + + //ZS: These are needed in a few places; looping through rows by index is faster than doing a "find" search + numPrimaryRows = $('#sortable1').find('tr').length; + numOtherRows = $('#sortable2').find('tr').length; + + + /////////////////////////////// + //Basic Statistics + /////////////////////////////// + ///////////////////////////////////////////////////////////////// + // Hide unselected Basic Statistics tabs (when just BXD strains + // are selected, hide the results for all strains/non-BXD) + ///////////////////////////////////////////////////////////////// + $('#stats_tabs1').hide(); + $('#stats_tabs2').hide(); + + $('#sectionbody2').find('select[name=stats_mdp]').change(function () { + selected = $('#sectionbody2').find('select[name=stats_mdp] option:selected').val(); + for (i = 0; i <= 2; i++) { + $('#stats_tabs' + i).hide(); + } + $('#stats_tabs' + selected).show(); + }); + + //////////////////////////////////////////////////////////////////////// + // Select the same tab across each sample group (when a Box Plot is + // selected for BXD, switching to Non-BXD will also display a Box Plot) + ////////////./////////////////////////////////////////////////////////// + var $tabs1 = $('#stats_tabs0').tabs(); + var $tabs2 = $('#stats_tabs1').tabs(); + var $tabs3 = $('#stats_tabs2').tabs(); + + $tabs1.tabs({ + show: function (event, ui) { + var selected = $tabs1.tabs('option', 'selected'); + $tabs2.tabs('select', selected); + $tabs3.tabs('select', selected); + } + }); + $tabs2.tabs({ + show: function (event, ui) { + var selected = $tabs2.tabs('option', 'selected'); + $tabs1.tabs('select', selected); + $tabs3.tabs('select', selected); + } + }); + $tabs3.tabs({ + show: function (event, ui) { + var selected = $tabs3.tabs('option', 'selected'); + $tabs1.tabs('select', selected); + $tabs2.tabs('select', selected); + } + }); + + + /////////////////////////////// + //Calculate Correlations + /////////////////////////////// + $('#sectionbody3').find('input[name="sample_corr"]').click(function () { + dbValue = $('select[name=database1] option:selected').val(); + $('input[name=database]').val(dbValue); + criteriaValue = $('select[name=criteria1] option:selected').val(); + $('input[name=criteria]').val(criteriaValue); + MDPValue = $('select[name=MDPChoice1] option:selected').val(); + $('input[name=MDPChoice]').val(MDPValue); + + methodValue = $('input[name=sample_method]:checked').val(); + + //This simple method can be used now that 'method' is defaulted to None instead of '' + if (methodValue == "1") { + $('input[name=method]').val('1'); + } else { + $('input[name=method]').val('2'); + } + + dataEditingFunc(this.form, 'correlation'); + }); + + $('#sectionbody3').find('input[name="lit_corr"]').click(function () { + dbValue = $('select[name=database2] option:selected').val(); + $('input[name=database]').val(dbValue); + criteriaValue = $('select[name=criteria2] option:selected').val(); + $('input[name=criteria]').val(criteriaValue); + MDPValue = $('select[name=MDPChoice2] option:selected').val(); + $('input[name=MDPChoice]').val(MDPValue); + + $('input[name=method]').val('3'); + + dataEditingFunc(this.form, 'correlation'); + }); + + $('#sectionbody3').find('input[name="tiss_corr"]').click(function () { + dbValue = $('select[name=database3] option:selected').val(); + $('input[name=database]').val(dbValue); + criteriaValue = $('select[name=criteria3] option:selected').val(); + $('input[name=criteria]').val(criteriaValue); + MDPValue = $('select[name=MDPChoice3] option:selected').val(); + $('input[name=MDPChoice]').val(MDPValue); + + methodValue = $('input[name=tissue_method]:checked').val(); + + if (methodValue == "4") { + $('input[name=method]').val('4'); + } else { + $('input[name=method]').val('5'); + } + dataEditingFunc(this.form, 'correlation'); + }); + + /////////////////////////////// + //Mapping Tools + /////////////////////////////// + $('#sectionbody4').find('input[name=interval]').click(function () { + chrValue = $('select[name=chromosomes1] option:selected').val(); + $('input[name=chromosomes]').val(chrValue); + scaleValue = $('select[name=scale1] option:selected').val(); + $('input[name=scale]').val(scaleValue); + $('input[name=controlLocus]').val(''); + + //Changed the way permValue, bootValue, and parentsValue are acquired; before it was $(____).is(':checked'); + permValue = $('input[name=permCheck1]:checked').val(); + $('input[name=permCheck]').val(permValue); + + bootValue = $('input[name=bootCheck1]:checked').val(); + $('input[name=bootCheck]').val(bootValue); + + if ($('input[name=parentsf14regression1]:checked').length > 0) { + $('input[name=parentsf14regression]').val('on'); + } else { + $('input[name=parentsf14regression]').val('off'); + } + + varValue = $('input[name=applyVarianceSE1]:checked').val(); + $('input[name=applyVarianceSE]').val(varValue); + + dataEditingFunc(this.form, 'intervalMap'); + }); + + var tiptext = "e.g., rs12345"; + controlLocus = $('#sectionbody4').find('input[name=controlLocus]'); + + if (controlLocus.val() == '' || controlLocus == tiptext) { + controlLocus.addClass('searchtip').val(tiptext); + } + + controlLocus.focus(function (e) { + if (controlLocus.val() == tiptext) { + controlLocus.val(''); + } + controlLocus.removeClass('searchtip'); + }); + + controlLocus.blur(function (e) { + if (controlLocus.val() == '') { + controlLocus.addClass('searchtip').val(tiptext); + } else if (controlLocus.val() == tiptext) { + controlLocus.addClass('searchtip'); + } else { + controlLocus.removeClass('searchtip'); + } + }); + + $('#sectionbody4').find('input[name=composite]').click(function () { + chrValue = $('select[name=chromosomes2] option:selected').val(); + $('input[name=chromosomes]').val(chrValue); + scaleValue = $('select[name=scale2] option:selected').val(); + $('input[name=scale]').val(scaleValue); + controlValue = controlLocus.val(); + if (controlValue != tiptext) { + controlLocus.val(controlValue); + } else { + controlLocus.val(''); + } + + //Changed the way permValue, bootValue, and parentsValue are acquired; before it was $(____).is(':checked'); + permValue = $('input[name=permCheck2]:checked').val(); + $('input[name=permCheck]').val(permValue); + + bootValue = $('input[name=bootCheck2]:checked').val(); + $('input[name=bootCheck]').val(bootValue); + + if ($('input[name=parentsf14regression3]:checked').length > 0) { + $('input[name=parentsf14regression]').val('on'); + } else { + $('input[name=parentsf14regression]').val('off'); + } + + dataEditingFunc(this.form, 'intervalMap'); + + }); + + $('#sectionbody4').find('input[name=marker]').click(function () { + //Changed the way parentsValue is acquired; before it was $(____).is(':checked'); + if ($('input[name=parentsf14regression2]:checked').length > 0) { + $('input[name=parentsf14regression]').val('on'); + } else { + $('input[name=parentsf14regression]').val('off'); + } + + varValue = $('input[name=applyVarianceSE2]:checked').val(); + $('input[name=applyVarianceSE]').val(varValue); + + dataEditingFunc(this.form, 'markerRegression'); + }); + + /////////////////////////////// + //Review and Edit Data + /////////////////////////////// + $('input[name=excludeGroup]').click(function () { + for (i = 1; i <= Math.max(primary_row_count, other_row_count) - 1; i++) { + valueExists = 0; + $('#Primary_' + i + ',#Other_' + i).children().each(function () { + if ($(this).text() == exclude_value) { + $('#Primary_' + i + ',#Other_' + i).addClass('blocked').find('input[type=text]').val('x'); + valueExists = 1; + return false; } - else if (traitType=="name"){ - var graphFile = graphName+ "_xgmml_name.txt"; - $('input[name=exportGraphFile]').live('click', function() { window.open(graphFile) }); + }); + } + }); + + $('.update').click(function () { + windowName = 'formTarget' + (new Date().getTime()); + var windowHeight; // windowHeight and windowWidth are used to place the window in the center of the screen + var windowWidth; + windowHeight = (window.screen.height/2) - (350 + 10) + windowWidth = (window.screen.width/2) - (450 + 50) + newWindow = open("",windowName,"menubar=1,toolbar=1,resizable=1,left=" + windowWidth + ",top=" + windowHeight + ",screenX=" + windowWidth + ",screenY=" + windowHeight + ",status=1,scrollbars=0,directories=1"); + + document.dataInput.target = windowName; + document.dataInput.submitID.value = "basicStatistics"; + + primaryData = getTraitData()[0]; + otherData = getTraitData()[1]; + allData = getTraitData()[2]; + + if (otherData[0].length > 0) { + if ($('select[name="stats_mdp"] option:selected').val() == 0) { + document.dataInput.strainNames.value = allData[0].toString(); + document.dataInput.strainVals.value = allData[1].toString(); + document.dataInput.strainVars.value = allData[2].toString(); + } else if ($('select[name="stats_mdp"] option:selected').val() == 1) { + document.dataInput.strainNames.value = primaryData[0].toString(); + document.dataInput.strainVals.value = primaryData[1].toString(); + document.dataInput.strainVars.value = primaryData[2].toString(); + } else { + document.dataInput.strainNames.value = otherData[0].toString(); + document.dataInput.strainVals.value = otherData[1].toString(); + document.dataInput.strainVars.value = otherData[2].toString(); + } + } else { + document.dataInput.strainNames.value = allData[0].toString(); + document.dataInput.strainVals.value = allData[1].toString(); + document.dataInput.strainVars.value = allData[2].toString(); + } + + document.dataInput.submit(); + }); + + $('input[name="export"]').click(function () { + windowName = 'formTarget' + (new Date().getTime()); + newWindow = open("", windowName, "menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=0,directories=1,width=900"); + document.dataInput.target = windowName; + document.dataInput.submitID.value = "exportData"; + + primaryData = getTraitData()[0]; + otherData = getTraitData()[1]; + + document.dataInput.strainNames.value = primaryData[0].toString(); + document.dataInput.strainVals.value = primaryData[1].toString(); + document.dataInput.strainVars.value = primaryData[2].toString(); + + document.dataInput.otherStrainNames.value = otherData[0].toString(); + document.dataInput.otherStrainVals.value = otherData[1].toString(); + document.dataInput.otherStrainVars.value = otherData[2].toString(); + + attribute_names = new Array(); + $('#primary,#other').find('th.attribute_name').each(function () { + attribute_names.push($(this).val().toString()); + }); + + primary_attribute_values = ""; //This string will be structured as a dictionary with a set of values for each attribute; it will be parsed in the ExportPage class + other_attribute_values = ""; + + attr_counter = 1; // Counter for each different attribute + row_counter = 1; // Counter for each value for each attribute + while (attr_counter <= attribute_names.length) { + attribute_name = $('#primary,#other').find('th.attribute_name:eq(' + (attr_counter - 1).toString() + ')').text(); + primary_row_count = $('#primary').find('tr').length - 1; + other_row_count = $('#other').find('tr').length - 1; + + primary_attribute_values += attribute_name + " : "; + other_attribute_values += attribute_name + " : "; + + primary_value_string = ""; //This string of values (in the format 'a,b,c', etc) will be appended to the primary_attribute_values string + for (row_counter = 1; row_counter <= numPrimaryRows; row_counter++) { + value = $('#primary_attribute' + attr_counter.toString() + '_sample' + row_counter.toString()).text(); + if (row_counter == primary_row_count) { + primary_value_string += (value + " / "); + } else { + primary_value_string += (value + ","); } + } + + primary_attribute_values += primary_value_string; + + other_value_string = ""; //This string of values (in the format 'a,b,c', etc) will be appended to the other_attribute_values string + for (row_counter = 1; row_counter <= numOtherRows; row_counter++) { + value = $('#other_attribute' + attr_counter.toString() + '_sample' + row_counter.toString()).text(); + if (row_counter == other_row_count) { + other_value_string += (value + " / "); + } else { + other_value_string += (value + ","); + } + } + other_attribute_values += other_value_string; + attr_counter += 1 + } + + document.dataInput.extra_attributes.value = primary_attribute_values; + document.dataInput.other_extra_attributes.value = other_attribute_values; + + document.dataInput.submit(); + }); + + var thisTable = $('#sortable1,#sortable2'); //ZS: variable representing each table, because it's used often + thisTable.find('input[name="selectCheck"]').click(function () { + if ($(this).is(':checked')) { + $(this).parent("").parent("").children("td").css("background-color", "yellow"); + } else { + if (!($(this).parent().parent().hasClass('outlier'))) { + $(this).parent().parent().children("td").css("background-color", "white"); + } } + }); - else if (graphFormat=="plain"){ - if (traitType=="symbol"){ - var graphFile = graphName+ "_plain_symbol.txt"; - $('input[name=exportGraphFile]').live('click', function() { window.open(graphFile) }); + $('input[name=resetButton]').click(function () { + + //ZS: Reset "hide no value" and "hide outliers" + $('#showHideOptions').find('input[name=showHideNoValue]').val(' Hide No Value '); + $('#showHideOptions').find('input[name=showHideOutliers]').val(' Hide Outliers '); + noValShown = 1; + outliersShown = 1; + + for (i = 1; i <= numPrimaryRows - 1; i++) { + var thisRow = $('#Primary_' + i); + if (thisRow.is('.invisible')) { + thisRow.removeClass('invisible'); + } + if (thisRow.is('.blocked')) { + thisRow.removeClass('blocked'); + } + if (thisRow.is(':not(.outlier)')) { + thisRow.css("background-color", "white"); + } + + var thisValueField = thisRow.find('.valueField'); + + var originalValue = thisValueField[0].defaultValue; + var thisClassNames = thisRow.find('input:eq(1)').attr('class').split(/\s+/); + var valueClass = thisClassNames[thisClassNames.length - 1]; + thisRow.find('input:eq(1)').removeClass(valueClass).addClass(originalValue).val(originalValue); + + if (thisValueField.length > 1) { + var originalValue = thisValueField[1].defaultValue; + var thisClassNames = thisRow.find('input:eq(2)').attr('class').split(/\s+/); + var valueClass = thisClassNames[thisClassNames.length - 1]; + thisRow.find('input:eq(2)').removeClass(valueClass).addClass(originalValue).val(originalValue); + } + } + for (i = 1; i <= numOtherRows - 1; i++) { + var thisRow = $('#Other_' + i); + if (thisRow.is('.invisible')) { + thisRow.removeClass('invisible') + } + if (thisRow.is('.blocked')) { + thisRow.removeClass('blocked'); + } + if (thisRow.is(':not(.outlier)')) { + thisRow.css("background-color", "white"); + } + + var thisValueField = thisRow.find('.valueField'); + + var originalValue = thisValueField[0].defaultValue; + var thisClassNames = thisRow.find('input:eq(1)').attr('class').split(/\s+/); + var valueClass = thisClassNames[thisClassNames.length - 1]; + thisRow.find('input:eq(1)').removeClass(valueClass).addClass(originalValue).val(originalValue); + + if (thisValueField.length > 1) { + var originalValue = thisValueField[1].defaultValue; + var thisClassNames = thisRow.find('input:eq(2)').attr('class').split(/\s+/); + var valueClass = thisClassNames[thisClassNames.length - 1]; + thisRow.find('input:eq(2)').removeClass(valueClass).addClass(originalValue).val(originalValue); + } + } + }); + + var tiptext2 = "e.g., 4, 6-30, 43"; + var blockField = $('#showHideOptions').find('input[name=removeField]'); //ZS: Field where user inputs the index of the samples he/she wants to block; created variable because it's used often + if (blockField.val() == '' || blockField.val() == tiptext2) { + blockField.addClass('searchtip'); + blockField.val(tiptext2); + } + + blockField.focus(function (e) { + if (blockField.val() == tiptext2) { + blockField.val(''); + } + blockField.removeClass('searchtip'); + }); + + blockField.blur(function (e) { + if (blockField.val() == '') { + blockField.addClass('searchtip'); + blockField.val(tiptext2); + } else if (blockField.val() == tiptext2) { + blockField.addClass('searchtip'); + } else { + blockField.removeClass('searchtip'); + } + }); + + var noValShown = new Boolean(1); + var outliersShown = new Boolean(1); + + $('#showHideOptions').bind('click', function (e) { + var target = e.target; + $target = $(target); + + if (target.name === 'blockSamples') { + if (blockField.val() == tiptext2) { + blockField.val('') + } + blockedText = blockField.val(); + blockedTextSplit = new Array(); + blockedItems = new Array(); + + blockedTextSplit = blockedText.split(/\,/); + + for (i = 0; i <= blockedTextSplit.length - 1; i++) { + var item = blockedTextSplit[i]; + if (item.indexOf('-') != -1) { + subArray = new Array(); + subArray = item.split('-'); + num1 = parseInt(subArray[0]); + num2 = parseInt(subArray[1]); + for (j = num1; j <= num2; j = j + 1) { + blockedItems.push(j); + } + } else if (!(isNaN(item))) { + blockedItems.push(item); + } + } + + for (i = 0; i <= blockedItems.length - 1; i++) { + item = blockedItems[i]; + if ($('select[name=block_method]').val() == '0') { + var thisRow = $('#Other_' + item); + } else { + var thisRow = $('#Primary_' + item); + } + + if (thisRow.is('.novalue')) { + continue; + } else { + thisRow.addClass('blocked').find('input.valueField').val('x'); + } + + //First look at value cell + var thisCell = thisRow.find('input:eq(1)'); + var thisClassNames = thisCell.attr('class').split(/\s+/); + var valueClass = thisClassNames[thisClassNames.length - 1]; + var header = thisRow.parents('table.tablesorter').find('th.header:contains("Value"):eq(0)'); + if (header.hasClass('headerSortUp')) { + thisCell.removeClass(valueClass).addClass('-9999'); + } else if (header.hasClass('headerSortDown')) { + thisCell.removeClass(valueClass).addClass('9999'); + } else { + thisCell.removeClass(valueClass).addClass('-9999'); + } + + //Check if there is an SE column + if (thisRow.find('input.valueField').length > 1) { + var thisCell = thisRow.find('input:eq(2)'); + var thisClassNames = thisCell.attr('class').split(/\s+/); + var valueClass = thisClassNames[thisClassNames.length - 1]; + var header = thisRow.parents('table.tablesorter').find('th.header:contains("SE"):eq(0)'); + if (header.hasClass('headerSortUp')) { + thisCell.removeClass(valueClass).addClass('-9999'); + } else if (header.hasClass('headerSortDown')) { + thisCell.removeClass(valueClass).addClass('9999'); + } else { + thisCell.removeClass(valueClass).addClass('-9999'); + } + } + } + } else if (target.name === 'showHideNoValue') { + if (noValShown) { + $('#showHideOptions').find('input[name=showHideNoValue]').val(' Show No Value '); + for (i = 1; i <= Math.max(numPrimaryRows, numOtherRows) - 1; i++) { + if (i <= numPrimaryRows - 1) { + var thisRow = $('#Primary_' + i); + if (thisRow.is('.novalue:visible') || thisRow.is('.blocked:visible')) { + jQuery(thisRow).addClass('invisible'); + } + } + if (i <= numOtherRows - 1) { + var thisOtherRow = $('#Other_' + i); + if (thisOtherRow.is('.novalue:visible') || thisOtherRow.is('.blocked:visible')) { + if (thisOtherRow.is(':visible')) { + jQuery(thisOtherRow).addClass('invisible'); + } + } + } + } + noValShown = 0; + } else { + $('#showHideOptions').find('input[name=showHideNoValue]').val(' Hide No Value '); + for (i = 1; i <= Math.max(numPrimaryRows, numOtherRows) - 1; i++) { + if (i <= numPrimaryRows - 1) { + var thisRow = $('#Primary_' + i); + if (thisRow.is('.novalue') || thisRow.is('.blocked')) { + jQuery(thisRow).removeClass('invisible'); + if (!(outliersShown)) { + if (thisRow.is('.outlier:visible')) { + jQuery(thisRow).addClass('invisible'); + } + } + } + } + if (i <= numOtherRows - 1) { + var thisOtherRow = $('#Other_' + i); + if (thisOtherRow.is('.novalue') || thisOtherRow.is('.blocked')) { + jQuery(thisOtherRow).removeClass('invisible'); + if (!(outliersShown)) { + if (thisOtherRow.is('.outlier:visible')) { + jQuery(thisOtherRow).addClass('invisible'); + } + } + } + } } - else if (traitType=="name"){ - var graphFile = graphName+ "_plain_name.txt"; - $('input[name=exportGraphFile]').live('click', function() { window.open(graphFile) }); + noValShown = 1; + } + } else if (target.name === 'showHideOutliers') { + if (outliersShown) { + $('#showHideOptions').find('input[name=showHideOutliers]').val(' Show Outliers '); + for (i = 1; i <= Math.max(numPrimaryRows, numOtherRows) - 1; i++) { + if (i <= numPrimaryRows - 1) { + thisRow = $('#Primary_' + i); + if (thisRow.is('.outlier:visible') && (!(thisRow.is('.invisible')))) { + thisRow.addClass('invisible') + } + } + if (i <= numOtherRows - 1) { + thisOtherRow = $('#Other_' + i); + if (thisOtherRow.is('.outlier:visible') && (!(thisOtherRow.is('.invisible')))) { + thisOtherRow.addClass('invisible') + } + } + } + outliersShown = 0; + } else { + $('#showHideOptions').find('input[name=showHideOutliers]').val(' Hide Outliers '); + for (i = 1; i <= Math.max(numPrimaryRows, numOtherRows) - 1; i++) { + if (i <= numPrimaryRows - 1) { + thisRow = $('#Primary_' + i); + if (thisRow.is('.outlier') && (!(thisRow.is(':visible')))) { + if (!(noValShown)) { + if (thisRow.is('.blocked')) { + continue; + } + } + jQuery(thisRow).removeClass('invisible') + } + } + if (i <= numOtherRows - 1) { + thisOtherRow = $('#Other_' + i); + if (thisOtherRow.is('.outlier') && (!(thisOtherRow.is(':visible')))) { + if (!(noValShown)) { + if (thisOtherRow.is('.blocked')) { + continue; + } + } + jQuery(thisOtherRow).removeClass('invisible') + } + } } + outliersShown = 1; + } + } + return false; + }); +}); + +function getTraitData() { + primary_row_count = $('#sortable1').find('tr').length - 1; + other_row_count = $('#sortable2').find('tr').length - 1; + + primaryStrainNames = new Array(); + primaryVals = new Array(); + primaryVars = new Array(); + + allStrainNames = new Array(); + allVals = new Array(); + allVars = new Array(); + + for (i = 1; i <= primary_row_count; i++) { + thisRow = $('#Primary_' + i); + strainName = thisRow.find('span:first').text(); + primaryStrainNames.push(strainName); + allStrainNames.push(strainName); + strainVal = thisRow.find('input:eq(1)').val(); + primaryVals.push(strainVal); + allVals.push(strainVal); + strainVar = ''; // Just to initialize it in case there is no var + strainVar = thisRow.find('input:eq(2)').val(); + primaryVars.push(strainVar); + allVars.push(strainVar); + } + + otherStrainNames = new Array(); + otherVals = new Array(); + otherVars = new Array(); + + for (j = 1; j <= other_row_count; j++) { + thisRow = $('#Other_' + j) + strainName = thisRow.find('span:first').text(); + otherStrainNames.push(strainName); + strainVal = thisRow.find('input:eq(1)').val(); + otherVals.push(strainVal); + strainVar = ''; // Just to initialize it in case there is no var + strainVar = thisRow.find('input:eq(2)').val(); + otherVars.push(strainVar); + + if (jQuery.inArray(strainName, allStrainNames) == -1) { + allStrainNames.push(strainName); + allVals.push(strainVal); + allVars.push(strainVar); } + } + + primaryData = [primaryStrainNames, primaryVals, primaryVars]; + otherData = [otherStrainNames, otherVals, otherVars]; + allData = [allStrainNames, allVals, allVars]; + + return [primaryData, otherData, allData]; } +/* +used by networkGraphPageBody.py +*/ + +//Default to plain text + symbol for the "Export Graph File" button +$('input[name=exportGraphFile]').live('click', function () { + window.open($('input[name=exportFilename]').val() + "_plain_symbol.txt") +}); + +function changeFormat(graphName) { + var graphFormat = $('#exportFormat').val(); + var traitType = $('#traitType').val(); + + $('input[name=exportGraphFile]').die('click'); + + if (graphFormat == "xgmml") { + if (traitType == "symbol") { + var graphFile = graphName + "_xgmml_symbol.txt"; + $('input[name=exportGraphFile]').live('click', function () { + window.open(graphFile) + }); + } else if (traitType == "name") { + var graphFile = graphName + "_xgmml_name.txt"; + $('input[name=exportGraphFile]').live('click', function () { + window.open(graphFile) + }); + } + } else if (graphFormat == "plain") { + if (traitType == "symbol") { + var graphFile = graphName + "_plain_symbol.txt"; + $('input[name=exportGraphFile]').live('click', function () { + window.open(graphFile) + }); + } else if (traitType == "name") { + var graphFile = graphName + "_plain_name.txt"; + $('input[name=exportGraphFile]').live('click', function () { + window.open(graphFile) + }); + } + } +}
\ No newline at end of file diff --git a/web/javascript/selectDatasetMenu.js b/web/javascript/selectDatasetMenu.js index bb910a5b..bb910a5b 100755..100644 --- a/web/javascript/selectDatasetMenu.js +++ b/web/javascript/selectDatasetMenu.js diff --git a/web/javascript/webqtl.js b/web/javascript/webqtl.js index 19ecf3b7..536e7d26 100755 --- a/web/javascript/webqtl.js +++ b/web/javascript/webqtl.js @@ -38,16 +38,16 @@ function makeTree(thisForm, nnn){ j += 1; } } - + var windowName = 'formTarget' + (new Date().getTime()); var newWindow = open("", windowName,"width=900,menubar=0,toolbar=1,resizable=1,status=1,scrollbars=1"); var html = ""; if (j > 0) - { + { var waithtml1 ="<Blockquote class='title' id='red'>Your list of "+j+" transcripts is being exported to the Gene Ontology Tree Machine for analysis. This window will soon be replaced with the main GOTM results.</Blockquote>"; } else - { + { var waithtml1 ="<Blockquote class='title' id='red'>Your should select at least one transcript to export to the Gene Ontology Tree Machine for analysis.</Blockquote>"; } html += waithtml1; @@ -152,7 +152,11 @@ function showDatabase3(formName, Database,ProbeSetID,CellID){ document[formName].database.value = Database; document[formName].ProbeSetID.value = ProbeSetID; document[formName].CellID.value = CellID; - document[formName].submit(); + console.log("formName:", formName) + console.log("document[formName]:", document[formName]) + console.log("submit turned off for debugging") + console.log("showDatabase3 is deprecated for the flask version of this site") + //document[formName].submit(); } @@ -188,10 +192,10 @@ function showTrait(fmName){ var thisForm = getForm(fmName); if (thisForm == null || showTrait.arguments.length < 2) return; - + windowName = genNewWin(); thisForm.target = windowName; - + thisForm.FormID.value = "showDatabase"; thisForm.ProbeSetID.value = showTrait.arguments[1]; if (showTrait.arguments.length > 2) @@ -205,10 +209,10 @@ function showCateGraph(fmName){ var thisForm = getForm(fmName); if (thisForm == null || showCateGraph.arguments.length < 2) return; - + windowName = genNewWin(); thisForm.target = windowName; - + thisForm.FormID.value = "showCategoryGraph"; thisForm.interval1.value = showCateGraph.arguments[1]; thisForm.interval2.value = showCateGraph.arguments[2]; @@ -219,22 +223,22 @@ function showCorrPlot(fmName){ var thisForm = getForm(fmName); if (thisForm == null || showCorrPlot.arguments.length < 2) return; - + windowName = genNewWin(); thisForm.target = windowName; - + thisForm.FormID.value = "showCorrelationPlot"; thisForm.ProbeSetID.value = showCorrPlot.arguments[1]; if (showCorrPlot.arguments.length > 2) thisForm.CellID.value = showCorrPlot.arguments[2]; else thisForm.CellID.value = ""; - + thisForm.X_geneSymbol.value = null; thisForm.Y_geneSymbol.value = null; thisForm.submit(); - + } @@ -242,12 +246,12 @@ function showCorrPlotThird(fmName){ var thisForm = getForm(fmName); if (thisForm == null || showCorrPlotThird.arguments.length < 3) return; - + windowName = genNewWin(); thisForm.target = windowName; - + var olddb = thisForm.database.value; - + thisForm.FormID.value = "showCorrelationPlot"; thisForm.database.value = showCorrPlotThird.arguments[1]; thisForm.ProbeSetID.value = showCorrPlotThird.arguments[2]; @@ -284,15 +288,15 @@ function ODE(thisForm, script){ var windowName = 'formTarget' + (new Date().getTime()); var newWindow = open("", windowName, "width=900,menubar=0,toolbar=1,resizable=1,status=1,scrollbars=1"); var html = ""; - if (j == 0){ + if (j == 0){ j = length; trait_list2 = trait_list_all; correlation2 = correlation_all; llid_list2 = llid_list_all; } - + var waithtml1 ="<Blockquote class='title' id='red'>Your list of "+j+" transcripts is being exported to the ODE for analysis. This window will soon be replaced with the results.</Blockquote>"; - + html += waithtml1; newWindow.document.write(html); newWindow.document.close(); @@ -302,14 +306,14 @@ function ODE(thisForm, script){ thisForm.correlation.value = correlation2.join(','); thisForm.id_value.value = thisForm.correlation.value; thisForm.llid_list.value = llid_list2.join(','); - + // ODE - + thisForm.idtype.value = thisForm.id_type.value; thisForm.species.value = thisForm.org.value; thisForm.list.value = thisForm.id_list.value; thisForm.client.value = "genenetwork"; - + thisForm.target = windowName; var oldaction = thisForm.action; thisForm.action = script; @@ -318,13 +322,13 @@ function ODE(thisForm, script){ } } */ -// 02/12/2009 +// 02/12/2009 // Lei Yan /*scripts in the Dataediting form*/ function dataEditingFunc(thisForm,submitIdValue){ - + windowName = 'formTarget' + (new Date().getTime()); if (thisForm.FormID.value!='secondRegression'){ @@ -336,7 +340,7 @@ function dataEditingFunc(thisForm,submitIdValue){ } else if (submitIdValue == "addRecord"){ - windowName = thisForm.RISet.value; + windowName = thisForm.RISet.value; var name = thisForm.identification.value; if (name != ""){ } @@ -352,7 +356,7 @@ function dataEditingFunc(thisForm,submitIdValue){ newWindow = open("",windowName,"menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900"); thisForm.target = windowName; - newWindow.focus(); + newWindow.focus(); thisForm.submitID.value = submitIdValue; thisForm.submit(); } @@ -394,7 +398,7 @@ function addRmvSelection(windowName, thisForm, addORrmv){ thisForm.target = windowName; thisForm.FormID.value = addORrmv; thisForm.submit(); - newWindow.focus(); + newWindow.focus(); } function batchSelection(thisForm){ @@ -424,7 +428,7 @@ function showTop10(formName, submitIdValue){ if ((submitIdValue == "markerRegression")||(submitIdValue == "compositeRegression")){ thisForm.topten.value = "topten"; } - + thisForm.submitID.value = submitIdValue; thisForm.submit(); } @@ -441,12 +445,12 @@ function showIndividualChromosome(formName, submitIdValue, ii){ } if (match == 0) return; - + windowName = 'formTarget' + (new Date().getTime()); newWindow = open("",windowName,"menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900"); newWindow.focus(); thisForm.target = windowName; - + if (submitIdValue == "showIntMap"){ thisForm.chromosomes.value = ii; } @@ -529,10 +533,10 @@ function dataWindow(form){ } -function xchange() { +function xchange() { var select = document.crossChoice.RISet; var value = select.options[select.selectedIndex].value; - + if (value !="BDAI") return; document.crossChoice.variance.checked = false; } @@ -580,97 +584,97 @@ function crossinfo2(){ function checkWidth(){ var width = document.getElementsByName('plotSize')[0].value - + if (width < 600) { alert("Plot size is too small - setting size to 600") document.getElementsByName('plotSize')[0].value = 600 - } + } } function changeLineColor(){ var lineColor = document.getElementsByName('lineColorSel')[0].value - + document.getElementsByName('lineColor')[0].value = lineColor } function changeLineSize(){ var lineSize = document.getElementsByName('lineSizeSel')[0].value - + document.getElementsByName('lineSize')[0].value = lineSize } function changeIdColor(){ var idColor = document.getElementsByName('idColorSel')[0].value - + document.getElementsByName('idColor')[0].value = idColor } function changeIdFont(){ var idFont = document.getElementsByName('idFontSel')[0].value - + document.getElementsByName('idFont')[0].value = idFont } function changeIdSize(){ var idSize = document.getElementsByName('idSizeSel')[0].value - + document.getElementsByName('idSize')[0].value = idSize } function changeSymbolColor(){ var symbolColor = document.getElementsByName('colorSel')[0].value - + document.getElementsByName('symbolColor')[0].value = symbolColor } function changeSymbol(){ var symbol = document.getElementsByName('symbolSel')[0].value - + document.getElementsByName('symbol')[0].value = symbol } function changeFilled(){ var filled = document.getElementsByName('fillSel')[0].value - + document.getElementsByName('filled')[0].value = filled } function changeSize(){ var symbolSize = document.getElementsByName('sizeSel')[0].value - + document.getElementsByName('symbolSize')[0].value = symbolSize } -function checkAll(thisForm){ +function checkAll(thisForm){ var length = thisForm.searchResult.length; for(var i = 0; i < length; i++) { thisForm.searchResult[i].checked = true; highlight(thisForm.searchResult[i]); } -} +} -function checkNone(thisForm){ +function checkNone(thisForm){ var length = thisForm.searchResult.length; for(var i = 0; i < length; i++) { thisForm.searchResult[i].checked = false; highlight(thisForm.searchResult[i]); } -} +} -function checkInvert(thisForm){ +function checkInvert(thisForm){ var length = thisForm.searchResult.length; for(var i = 0; i < length; i++) { thisForm.searchResult[i].checked = !(thisForm.searchResult[i].checked); highlight(thisForm.searchResult[i]); } -} +} /*Not used anymore*/ -function checkTraits2(thisForm){ +function checkTraits2(thisForm){ var length = thisForm.searchResult.length; var category = thisForm.selectmenu.value; for(var i = 0; i < length; i++) @@ -720,18 +724,18 @@ function checkTraits2(thisForm){ else {} } -} +} function checkNumeric(field,limit,resetvalue,compares,fdname) { - pattern = /^-?[0-9]*\.?[0-9]*$/; + pattern = /^-?[0-9]*\.?[0-9]*$/; if(pattern.test(field.value)==false) { alert("Not numeric in " + fdname); field.value = resetvalue; } - else + else { if (compares == 'gthan') { if(field.value > limit) @@ -748,7 +752,7 @@ function checkNumeric(field,limit,resetvalue,compares,fdname) } } -function checkTraits(thisForm){ +function checkTraits(thisForm){ var length = thisForm.searchResult.length; var andor = thisForm.selectandor.value; var gthan = parseFloat(thisForm.selectgt.value); @@ -780,7 +784,7 @@ function checkTraits(thisForm){ } -function checkPM(thisForm){ +function checkPM(thisForm){ var length = thisForm.searchResult.length; for(var i = 0; i < length; i++) { @@ -792,8 +796,8 @@ function checkPM(thisForm){ {thisForm.searchResult[i].checked = false;} highlight(thisForm.searchResult[i]); } -} -function checkMM(thisForm){ +} +function checkMM(thisForm){ var length = thisForm.searchResult.length; for(var i = 0; i < length; i++) { @@ -804,14 +808,14 @@ function checkMM(thisForm){ {thisForm.searchResult[i].checked = false;} highlight(thisForm.searchResult[i]); } -} +} -function directPermuAlert(thisForm){ - if (thisForm.directPermuCheckbox.checked){ - alert("Interaction permutation will take long time to compute.\n Check this box only when necessary."); +function directPermuAlert(thisForm){ + if (thisForm.directPermuCheckbox.checked){ + alert("Interaction permutation will take long time to compute.\n Check this box only when necessary."); } -} +} function cliqueDatabase(pid){ var windowName = 'clique'; @@ -869,7 +873,7 @@ function snpbrowser_function_refresh() { for (var i=1; i<document.newSNPPadding.exonfunction.length; i++) { document.newSNPPadding.exonfunction.options[i].selected=false; } - } + } } function snpbrowser_domain_refresh() { @@ -889,7 +893,7 @@ function showHideOptions() { var options = document.getElementById("options"); var showOptions = document.getElementsByName("showOptions")[0]; var optionsButton = document.getElementsByName("optionsButton")[0]; - + if (showOptions.value == '0') { showOptions.value = '1'; optionsButton.value = "Hide Options"; @@ -898,22 +902,22 @@ function showHideOptions() { showOptions.value = '0'; optionsButton.value = "Show Options"; } - - options.style.display = (options.style.display != 'none' ? 'none' : '' ); + + options.style.display = (options.style.display != 'none' ? 'none' : '' ); } function editPCAName(thisForm) { var pcaTraits = document.getElementsByName("searchResult"); - + var nameArray = new Array(); - + for (j=1; j<=pcaTraits.length; j++){ var traitName = "pcaTrait" + String(j); var pcaTrait = document.getElementById(traitName).childNodes[0].innerHTML; var editID = "editName" + String(j); var editName = document.getElementsByName(editID)[0].value; var originalName = pcaTrait.split(":")[3]; - + if (editName.length < 1) { nameArray.push(originalName); } @@ -921,13 +925,13 @@ function editPCAName(thisForm) { nameArray.push(editName); } } - + var newNames = nameArray.join(","); - + thisForm.newNames.value = newNames; thisForm.searchResult = thisForm.oldSearchResult; thisForm.FormID.value = "corMatrix"; - + thisForm.submit(); } @@ -950,7 +954,7 @@ function unknownChipError(chipName){ } /* -Used by PartialCorrInputPage.py, +Used by PartialCorrInputPage.py, */ function validateTrait(thisForm, inputRadioNames, type, method) { @@ -1029,7 +1033,7 @@ function validateTrait(thisForm, inputRadioNames, type, method) } } - + } /* @@ -1044,7 +1048,7 @@ function changeView(i, Chr_Mb_list){ newWindow = open('',windowName,'menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900'); document.changeViewForm.target = windowName; document.changeViewForm.chromosomes.selectedIndex = i+1; - document.changeViewForm.startMb.value = '0.000000'; + document.changeViewForm.startMb.value = '0.000000'; document.changeViewForm.endMb.value = Chr_Mb_list[i]; document.changeViewForm.graphWidth.value = 1280; document.changeViewForm.submit(); @@ -1076,7 +1080,7 @@ used by networkGraphPageBody.py function changeFormat(graphName){ var graphFormat = document.getElementById('exportFormat').value; var traitType = document.getElementById('traitType').value; - + if (graphFormat=="xgmml"){ if (traitType=="symbol"){ var graphname = graphName+ "_xgmml_symbol.txt"; @@ -1087,7 +1091,7 @@ function changeFormat(graphName){ document.getElementById('exportGraphFile').onclick = function() { window.open(graphname) }; } } - + else if (graphFormat=="plain") { if (traitType=="symbol") @@ -1102,7 +1106,7 @@ function changeFormat(graphName){ } } -} +} /* @@ -1126,13 +1130,13 @@ function set_customStrains_cookie() { } /* -* moved from beta2.js -*/ +* moved from beta2.js +*/ function centerIntervalMapOnRange2(chr, start, stop, form) { var oldindex = form.chromosomes.selectedIndex; var oldstart = form.startMb.value; var oldend = form.endMb.value; - + for (var i = 1; i < form.chromosomes.length; i++){ if(form.chromosomes.options[i].text == chr){ form.chromosomes.selectedIndex = i; @@ -1145,12 +1149,12 @@ function centerIntervalMapOnRange2(chr, start, stop, form) { form.chromosomes.selectedIndex = oldindex; form.startMb.value = oldstart; form.endMb.value = oldend; - + } /* -* moved from index3.html -*/ +* moved from index3.html +*/ String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); @@ -1282,13 +1286,13 @@ function showTissueCorrPlot(fmName,geneSymbol1, geneSymbol2,rank){ var thisForm = getForm(fmName); if (thisForm == null || showTissueCorrPlot.arguments.length < 3) return; - + if (rank){ thisForm.rankOrder.value = rank; }else{ thisForm.rankOrder.value = 0; } - + windowName = genNewWin(); thisForm.target = windowName; @@ -1302,7 +1306,7 @@ function showTissueCorrPlot(fmName,geneSymbol1, geneSymbol2,rank){ if(typeof(thisForm.ProbeSetID2) !== 'undefined'){ thisForm.ProbeSetID2.value = 'none'; } - thisForm.submit(); + thisForm.submit(); } /* Used by MarkerRegressionPage.py */ @@ -1317,7 +1321,7 @@ function validatePvalue(thisForm){ { alert("Please enter numeric value."); thisForm.pValue.focus(); - } + } else if (pValue <0){ alert("Please enter the valid P-Value."); thisForm.pValue.focus(); @@ -1327,7 +1331,7 @@ function validatePvalue(thisForm){ } - + } @@ -1338,9 +1342,9 @@ function showTissueAbbr(fmName,shortname, fullname){ thisForm.FormID.value = 'tissueAbbreviation'; thisForm.shortTissueName.value=shortname; thisForm.fullTissueName.value=fullname; - + thisForm.submit(); thisForm.FormID.value = 'showCorrelationPlot'; thisForm.target ='' - + } diff --git a/web/webqtl/base/webqtlConfigLocal.py b/web/webqtl/base/webqtlConfigLocal.py index dc86bb10..1f986aa7 100755 --- a/web/webqtl/base/webqtlConfigLocal.py +++ b/web/webqtl/base/webqtlConfigLocal.py @@ -3,15 +3,15 @@ ######################################### MYSQL_SERVER = 'localhost' -DB_NAME = 'db_webqtl' -DB_USER = 'webqtl' +DB_NAME = 'db_webqtl_zas1024' +DB_USER = 'webqtlupd' DB_PASSWD = 'webqtl' MYSQL_UPDSERVER = 'localhost' -DB_UPDNAME = 'db_webqtl' -DB_UPDUSER = 'webqtl' +DB_UPDNAME = 'db_webqtl_zas1024' +DB_UPDUSER = 'webqtlupd' DB_UPDPASSWD = 'webqtl' -GNROOT = '/gnshare/gn/' +GNROOT = '/home/zas1024/gn/' PythonPath = '/usr/bin/python' PIDDLE_FONT_PATH = '/usr/lib/python2.4/site-packages/piddle/truetypefonts/' diff --git a/web/webqtl/base/webqtlTrait.py b/web/webqtl/base/webqtlTrait.py index f5051e45..2469504f 100644 --- a/web/webqtl/base/webqtlTrait.py +++ b/web/webqtl/base/webqtlTrait.py @@ -9,6 +9,10 @@ from dbFunction import webqtlDatabaseFunction from utility import webqtlUtil +from __future__ import print_function, division + +from pprint import pformat as pf + class webqtlTrait: """ Trait class defines a trait in webqtl, can be either Microarray, @@ -215,6 +219,9 @@ class webqtlTrait: def retrieveData(self, strainlist=[]): assert self.db and self.cursor + debug_file = open("/home/zas1024/gn/web/traitlist_debug.txt", "w") + debug_file.write("strianlist is:" + strainlist + "\n") + if self.db.type == 'Temp': query = ''' SELECT @@ -341,6 +348,8 @@ class webqtlTrait: #end if else: pass + + debug_file.write("self.data is:", pf(self.data) + "\n") def keys(self): return self.__dict__.keys() diff --git a/web/webqtl/basicStatistics/updatedBasicStatisticsPage.py b/web/webqtl/basicStatistics/updatedBasicStatisticsPage.py index 156dafe7..ab7ed07d 100755 --- a/web/webqtl/basicStatistics/updatedBasicStatisticsPage.py +++ b/web/webqtl/basicStatistics/updatedBasicStatisticsPage.py @@ -63,9 +63,9 @@ class updatedBasicStatisticsPage(templatePage): thisValFull = [strain_names[i], this_strain_val, this_strain_var] vals.append(thisValFull) - stats_tab_list = [HT.Href(text="Basic Table", url="#statstabs-1", Class="stats_tab"),HT.Href(text="Probability Plot", url="#statstabs-5", Class="stats_tab"), + stats_tab_list = [HT.Href(text="Basic Table", url="#statstabs-1", Class="stats_tab"),HT.Href(text="Probability Plot", url="#statstabs-2", Class="stats_tab"), HT.Href(text="Bar Graph (by name)", url="#statstabs-3", Class="stats_tab"), HT.Href(text="Bar Graph (by rank)", url="#statstabs-4", Class="stats_tab"), - HT.Href(text="Box Plot", url="#statstabs-2", Class="stats_tab")] + HT.Href(text="Box Plot", url="#statstabs-5", Class="stats_tab")] stats_tabs = HT.List(stats_tab_list) stats_container = HT.Div(id="stats_tabs", Class="ui-tabs") @@ -73,7 +73,7 @@ class updatedBasicStatisticsPage(templatePage): stats_script_text = """$(function() { $("#stats_tabs").tabs();});""" #Javascript enabling tabs - table_div = HT.Div(id="statstabs-1") + table_div = HT.Div(id="statstabs-1", style="height:320px;width:740px;overflow:scroll;") table_container = HT.Paragraph() statsTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") @@ -86,16 +86,21 @@ class updatedBasicStatisticsPage(templatePage): table_div.append(table_container) stats_container.append(table_div) - boxplot_div = HT.Div(id="statstabs-2") - boxplot_container = HT.Paragraph() - boxplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - boxplot_img, boxplot_link = BasicStatisticsFunctions.plotBoxPlot(vals) - boxplot.append(HT.TR(HT.TD(boxplot_img, HT.P(), boxplot_link, align="left"))) - boxplot_container.append(boxplot) - boxplot_div.append(boxplot_container) - stats_container.append(boxplot_div) + normalplot_div = HT.Div(id="statstabs-2", style="height:540px;width:740px;overflow:scroll;") + normalplot_container = HT.Paragraph() + normalplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + plotTitle = fd.formdata.getvalue("normalPlotTitle","") + normalplot_img = BasicStatisticsFunctions.plotNormalProbability(vals=vals, RISet=fd.RISet, title=plotTitle, specialStrains=specialStrains) + normalplot.append(HT.TR(HT.TD(normalplot_img))) + normalplot.append(HT.TR(HT.TD(HT.BR(),HT.BR(),"This plot evaluates whether data are \ + normally distributed. Different symbols represent different groups.",HT.BR(),HT.BR(), + "More about ", HT.Href(url="http://en.wikipedia.org/wiki/Normal_probability_plot", + target="_blank", text="Normal Probability Plots"), " and more about interpreting these plots from the ", HT.Href(url="/glossary.html#normal_probability", target="_blank", text="glossary")))) + normalplot_container.append(normalplot) + normalplot_div.append(normalplot_container) + stats_container.append(normalplot_div) - barName_div = HT.Div(id="statstabs-3") + barName_div = HT.Div(id="statstabs-3", style="height:540px;width:740px;overflow:scroll;") barName_container = HT.Paragraph() barName = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") barName_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, RISet=fd.RISet, vals=vals, type="name") @@ -104,7 +109,7 @@ class updatedBasicStatisticsPage(templatePage): barName_div.append(barName_container) stats_container.append(barName_div) - barRank_div = HT.Div(id="statstabs-4") + barRank_div = HT.Div(id="statstabs-4", style="height:540px;width:740px;overflow:scroll;") barRank_container = HT.Paragraph() barRank = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") barRank_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, RISet=fd.RISet, vals=vals, type="rank") @@ -112,20 +117,15 @@ class updatedBasicStatisticsPage(templatePage): barRank_container.append(barRank) barRank_div.append(barRank_container) stats_container.append(barRank_div) - - normalplot_div = HT.Div(id="statstabs-5") - normalplot_container = HT.Paragraph() - normalplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - plotTitle = fd.formdata.getvalue("normalPlotTitle","") - normalplot_img = BasicStatisticsFunctions.plotNormalProbability(vals=vals, RISet=fd.RISet, title=plotTitle, specialStrains=specialStrains) - normalplot.append(HT.TR(HT.TD(normalplot_img))) - normalplot.append(HT.TR(HT.TD(HT.BR(),HT.BR(),"This plot evaluates whether data are \ - normally distributed. Different symbols represent different groups.",HT.BR(),HT.BR(), - "More about ", HT.Href(url="http://en.wikipedia.org/wiki/Normal_probability_plot", - target="_blank", text="Normal Probability Plots"), " and more about interpreting these plots from the ", HT.Href(url="/glossary.html#normal_probability", target="_blank", text="glossary")))) - normalplot_container.append(normalplot) - normalplot_div.append(normalplot_container) - stats_container.append(normalplot_div) + + boxplot_div = HT.Div(id="statstabs-5", style="height:540px;width:740px;overflow:scroll;") + boxplot_container = HT.Paragraph() + boxplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + boxplot_img, boxplot_link = BasicStatisticsFunctions.plotBoxPlot(vals) + boxplot.append(HT.TR(HT.TD(boxplot_img, HT.P(), boxplot_link, align="left"))) + boxplot_container.append(boxplot) + boxplot_div.append(boxplot_container) + stats_container.append(boxplot_div) stats_cell.append(stats_container) stats_script.append(stats_script_text) diff --git a/web/webqtl/collection/ExportSelectionDetailInfoPage.py b/web/webqtl/collection/ExportSelectionDetailInfoPage.py index 69f293b2..7238c797 100755 --- a/web/webqtl/collection/ExportSelectionDetailInfoPage.py +++ b/web/webqtl/collection/ExportSelectionDetailInfoPage.py @@ -128,7 +128,10 @@ class ExportSelectionDetailInfoPage(templatePage): count = count + 1 except: pass - mean = sum/count + if count == 0: + mean = 0 + else: + mean = sum/count text[-1].append(mean) text[-1] += testval if len(text[0]) < 255 or len(text) < 255: diff --git a/web/webqtl/correlation/CorrelationPage.py b/web/webqtl/correlation/CorrelationPage.py index ce8b8165..72e53f1d 100755 --- a/web/webqtl/correlation/CorrelationPage.py +++ b/web/webqtl/correlation/CorrelationPage.py @@ -91,7 +91,7 @@ class Trait(object): #ZS: This takes the list of values of the trait our selected trait is being correlated against and removes the values of the samples our trait has no value for #There's probably a better way of dealing with this, but I'll have to ask Christian - updated_raw_values = [] + updated_raw_values = [] updated_values = [] for i in range(len(values)): if values[i] != "None": @@ -120,7 +120,7 @@ class Trait(object): ZValue = ZValue*sqrt(self.overlap-3) self.p_value = 2.0*(1.0 - reaper.normp(abs(ZValue))) - + #XZ, 01/14/2009: This method is for parallel computing only. #XZ: It is supposed to be called when "Genetic Correlation, Pearson's r" (method 1) @@ -151,7 +151,7 @@ def get_correlation_method_key(form_data): #XZ, 09/28/2008: if user select "2", then display 2, 3 and 5. #XZ, 09/28/2008: if user select "3", then display 1, 3 and 4. #XZ, 09/28/2008: if user select "4", then display 1, 3 and 4. - #XZ, 09/28/2008: if user select "5", then display 2, 3 and 5. + #XZ, 09/28/2008: if user select "5", then display 2, 3 and 5. method = form_data.formdata.getvalue("method") if method not in ["1", "2", "3" ,"4", "5"]: @@ -172,7 +172,7 @@ def get_custom_trait(form_data, cursor): return None -#XZ, 09/18/2008: get the information such as value, variance of the input strain names from the form. +#XZ, 09/18/2008: get the information such as value, variance of the input strain names from the form. def get_sample_data(form_data): if form_data.allstrainlist: mdpchoice = form_data.formdata.getvalue('MDPChoice') @@ -194,8 +194,8 @@ def get_sample_data(form_data): strainlist = form_data.allstrainlist #XZ, 09/18/2008: put the trait data into dictionary form_data.allTraitData form_data.readData(form_data.allstrainlist) - else: - mdpchoice = None + else: + mdpchoice = None strainlist = form_data.strainlist #XZ, 09/18/2008: put the trait data into dictionary form_data.allTraitData form_data.readData() @@ -267,7 +267,7 @@ class CorrelationPage(templatePage): CORRELATION_METHODS = {"1" : "Genetic Correlation (Pearson's r)", "2" : "Genetic Correlation (Spearman's rho)", "3" : "SGO Literature Correlation", - "4" : "Tissue Correlation (Pearson's r)", + "4" : "Tissue Correlation (Pearson's r)", "5" : "Tissue Correlation (Spearman's rho)"} RANK_ORDERS = {"1": 0, "2": 1, "3": 0, "4": 0, "5": 1} @@ -338,7 +338,7 @@ class CorrelationPage(templatePage): # We will not get Tissue Correlations if there is no gene symbol because there is nothing to look against self.trait_symbol = myTrait.symbol - + #XZ, 12/12/2008: if the species is rat or human, translate the geneid to mouse geneid self.input_trait_mouse_gene_id = self.translateToMouseGeneID(self.species, self.gene_id) @@ -347,7 +347,7 @@ class CorrelationPage(templatePage): self.tissue_probeset_freeze_id = 1 traitList = self.correlate(vals) - + _log.info("Done doing correlation calculation") ############################################################################################################################################ @@ -356,12 +356,12 @@ class CorrelationPage(templatePage): mainfmName = webqtlUtil.genRandStr("fm_") form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name= mainfmName, submit=HT.Input(type='hidden')) - hddn = {'FormID': 'showDatabase', + hddn = {'FormID': 'showDatabase', 'ProbeSetID': '_', - 'database': self.target_db_name, - 'databaseFull': self.db.fullname, - 'CellID': '_', - 'RISet': fd.RISet, + 'database': self.target_db_name, + 'databaseFull': self.db.fullname, + 'CellID': '_', + 'RISet': fd.RISet, 'identification': fd.identification} if myTrait: @@ -400,7 +400,7 @@ class CorrelationPage(templatePage): ############## # Excel file # - ############## + ############## filename= webqtlUtil.genRandStr("Corr_") xlsUrl = HT.Input(type='button', value = 'Download Table', onClick= "location.href='/tmp/%s.xls'" % filename, Class='button') # Create a new Excel workbook @@ -432,7 +432,7 @@ class CorrelationPage(templatePage): heatmap = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('%s')[0], 'heatmap');" % mainfmName) heatmap_img = HT.Image("/images/heatmap2_final.jpg", name='mintmap', alt="QTL Heat Map and Clustering", title="QTL Heatmap and Clustering", style="border:none;") heatmap.append(heatmap_img) - partialCorr = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('%s')[0], 'partialCorrInput');" % mainfmName) + partialCorr = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('%s')[0], 'partialCorrInput');" % mainfmName) partialCorr_img = HT.Image("/images/partial_correlation_final.jpg", name='partialCorr', alt="Partial Correlation", title="Partial Correlation", style="border:none;") partialCorr.append(partialCorr_img) addselect = HT.Href(url="#redirect", onClick="addRmvSelection('%s', document.getElementsByName('%s')[0], 'addToSelection');" % (fd.RISet, mainfmName)) @@ -454,7 +454,7 @@ class CorrelationPage(templatePage): selectandor.append(('AND','and')) selectandor.append(('OR','or')) selectandor.selected.append('AND') - + #External analysis tools GCATButton = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('%s')[0], 'GCAT');" % mainfmName) @@ -473,8 +473,8 @@ setTimeout('openWebGestalt()', 2000); function openWebGestalt(){ var thisForm = document['WebGestalt']; makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); -} - """ % (mainfmName, len(traitList))) +} + """ % (mainfmName, len(traitList))) ''' self.cursor.execute('SELECT GeneChip.GO_tree_value FROM GeneChip, ProbeFreeze, ProbeSetFreeze WHERE GeneChip.Id = ProbeFreeze.ChipId and ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and ProbeSetFreeze.Name = "%s"' % self.db.name) @@ -484,15 +484,15 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); GO_tree_value = result[0] if GO_tree_value: - + WebGestalt = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('%s')[0], 'GOTree');" % mainfmName) - WebGestalt_img = HT.Image("/images/webgestalt_icon_final.jpg", name="webgestalt", alt="Gene Set Analysis Toolkit", title="Gene Set Analysis Toolkit", style="border:none") - WebGestalt.append(WebGestalt_img) - + WebGestalt_img = HT.Image("/images/webgestalt_icon_final.jpg", name="webgestalt", alt="Gene Set Analysis Toolkit", title="Gene Set Analysis Toolkit", style="border:none") + WebGestalt.append(WebGestalt_img) + hddnWebGestalt = { 'id_list':'', 'correlation':'', - 'id_value':'', + 'id_value':'', 'llid_list':'', 'id_type':GO_tree_value, 'idtype':'', @@ -512,7 +512,7 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); hddnWebGestalt['org'] = 'Mus musculus' else: hddnWebGestalt['org'] = '' - + for key in hddnWebGestalt.keys(): form.append(HT.Input(name=key, value=hddnWebGestalt[key], type='hidden')) @@ -523,11 +523,11 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); containerTable = HT.TableLite(cellSpacing=0,cellPadding=0,width="90%",border=0, align="Left") - + if not GO_tree_value: optionsTable = HT.TableLite(cellSpacing=2, cellPadding=0,width="480", height="80", border=0, align="Left") optionsTable.append(HT.TR(HT.TD(selectall), HT.TD(reset), HT.TD(selectinvert), HT.TD(addselect), HT.TD(GCATButton), HT.TD(ODE), align="left")) - optionsTable.append(HT.TR(HT.TD(" "*1,"Select"), HT.TD("Deselect"), HT.TD(" "*1,"Invert"), HT.TD(" "*3,"Add"), HT.TD("Gene Set"), HT.TD(" "*2,"GCAT"))) + optionsTable.append(HT.TR(HT.TD(" "*1,"Select"), HT.TD("Deselect"), HT.TD(" "*1,"Invert"), HT.TD(" "*3,"Add"), HT.TD("Gene Set"), HT.TD(" "*2,"GCAT"))) else: optionsTable = HT.TableLite(cellSpacing=2, cellPadding=0,width="560", height="80", border=0, align="Left") optionsTable.append(HT.TR(HT.TD(selectall), HT.TD(reset), HT.TD(selectinvert), HT.TD(addselect), HT.TD(GCATButton), HT.TD(ODE), HT.TD(WebGestalt), align="left")) @@ -548,11 +548,11 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); fewerOptions = HT.Input(type='button',name='options',value='Fewer Options', onClick="",Class="toggle") """ - if (fd.formdata.getvalue('showHideOptions') == 'less'): + if (fd.formdata.getvalue('showHideOptions') == 'less'): containerTable.append(HT.TR(HT.TD(" "), height="10"), HT.TR(HT.TD(HT.Div(fewerOptions, Class="toggleShowHide")))) containerTable.append(HT.TR(HT.TD(" "))) - else: - containerTable.append(HT.TR(HT.TD(" "), height="10"), HT.TR(HT.TD(HT.Div(moreOptions, Class="toggleShowHide")))) + else: + containerTable.append(HT.TR(HT.TD(" "), height="10"), HT.TR(HT.TD(HT.Div(moreOptions, Class="toggleShowHide")))) containerTable.append(HT.TR(HT.TD(" "))) """ @@ -566,8 +566,7 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); tblobj = {} if self.db.type=="Geno": - - containerTable.append(HT.TR(HT.TD(xlsUrl, height=40))) + containerTable.append(HT.TR(HT.TD(xlsUrl, height=60))) pageTable.append(HT.TR(HT.TD(containerTable))) @@ -579,7 +578,7 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); corrScript = HT.Script(language="Javascript") corrScript.append("var corrArray = new Array();") - tblobj['body'], worksheet, corrScript = self.getTableBodyForGeno(traitList=traitList, formName=mainfmName, worksheet=worksheet, newrow=newrow, corrScript=corrScript) + tblobj['body'], worksheet, corrScript = self.getTableBodyForGeno(traitList=traitList, formName=mainfmName, worksheet=worksheet, newrow=newrow, corrScript=corrScript) workbook.close() objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb') @@ -604,15 +603,15 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); containerTable.append(HT.TR(HT.TD(xlsUrl, height=40))) pageTable.append(HT.TR(HT.TD(containerTable))) - + tblobj['header'], worksheet = self.getTableHeaderForPublish(method=self.method, worksheet=worksheet, newrow=newrow, headingStyle=headingStyle) newrow += 1 sortby = self.getSortByValue( calculationMethod = self.method ) - + corrScript = HT.Script(language="Javascript") corrScript.append("var corrArray = new Array();") - + tblobj['body'], worksheet, corrScript = self.getTableBodyForPublish(traitList=traitList, formName=mainfmName, worksheet=worksheet, newrow=newrow, corrScript=corrScript, species=self.species) workbook.close() @@ -650,7 +649,7 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); workbook.close() objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb') cPickle.dump(tblobj, objfile) - objfile.close() + objfile.close() #XZ: here is the table of traits div = HT.Div(webqtlUtil.genTableObj(tblobj=tblobj, file=filename, sortby=sortby, tableID = "sortable", addIndex = "1", hiddenColumns=["Gene ID","Homologene ID"]), corrScript, Id="sortable") @@ -708,11 +707,11 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); if self.species == 'human': heatmap = "" - + form.append(HT.Input(name='ShowStrains',type='hidden', value =1), HT.Input(name='ShowLine',type='hidden', value =1), info, HT.BR(), pageTable, HT.BR()) - + TD_LR.append(corrHeading, form, HT.P()) @@ -745,7 +744,7 @@ makeWebGestaltTree(thisForm, '%s', %d, 'edag_only.php'); sortby = ("Tissue r", "down") elif calculationMethod == "5": sortby = ("Tissue rho", "down") - + return sortby @@ -808,7 +807,7 @@ Resorting this table <br> def getStrainIds(self, species=None, strains=[]): StrainIds = [] for item in strains: - self.cursor.execute('''SELECT Strain.Id FROM Strain, Species WHERE + self.cursor.execute('''SELECT Strain.Id FROM Strain, Species WHERE Strain.Name="%s" and Strain.SpeciesId=Species.Id and Species.name = "%s" ''' % (item, species)) Id = self.cursor.fetchone()[0] StrainIds.append(Id) @@ -855,16 +854,16 @@ Resorting this table <br> #XZ, 12/16/2008: the input geneid is of mouse type def checkSymbolForTissueCorr(self, tissueProbeSetFreezeId=0, symbol=""): - q = "SELECT 1 FROM TissueProbeSetXRef WHERE TissueProbeSetFreezeId=%s and Symbol='%s' LIMIT 1" % (tissueProbeSetFreezeId,symbol) + q = "SELECT 1 FROM TissueProbeSetXRef WHERE TissueProbeSetFreezeId=%s and Symbol='%s' LIMIT 1" % (tissueProbeSetFreezeId,symbol) self.cursor.execute(q) try: x = self.cursor.fetchone() if x: return True else: raise except: return False - - + + def fetchAllDatabaseData(self, species, GeneId, GeneSymbol, strains, db, method, returnNumber, tissueProbeSetFreezeId): StrainIds = [] @@ -879,9 +878,9 @@ Resorting this table <br> nnn += 1 oridata = [] - #XZ, 09/24/2008: build one temporary table that only contains the records associated with the input GeneId + #XZ, 09/24/2008: build one temporary table that only contains the records associated with the input GeneId tempTable = None - if GeneId and db.type == "ProbeSet": + if GeneId and db.type == "ProbeSet": if method == "3": tempTable = self.getTempLiteratureTable(species=species, input_species_geneid=GeneId, returnNumber=returnNumber) @@ -892,7 +891,7 @@ Resorting this table <br> temp = [] StrainIdstep = StrainIds[step*25:min(len(StrainIds), (step+1)*25)] for item in StrainIdstep: temp.append('T%s.value' % item) - + if db.type == "Publish": query = "SELECT PublishXRef.Id, " dataStartPos = 1 @@ -910,12 +909,12 @@ Resorting this table <br> # as we would not have litCorr data. if method == "3": - query = "SELECT %s.Name, %s.value," % (db.type,tempTable) - dataStartPos = 2 + query = "SELECT %s.Name, %s.value," % (db.type,tempTable) + dataStartPos = 2 if method == "4" or method == "5": - query = "SELECT %s.Name, %s.Correlation, %s.PValue," % (db.type,tempTable, tempTable) - dataStartPos = 3 - + query = "SELECT %s.Name, %s.Correlation, %s.PValue," % (db.type,tempTable, tempTable) + dataStartPos = 3 + query += string.join(temp,', ') query += ' FROM (%s, %sXRef, %sFreeze)' % (db.type, db.type, db.type) if method == "3": @@ -925,8 +924,8 @@ Resorting this table <br> #XZ, 03/04/2009: Xiaodong changed Data to %sData and changed parameters from %(item,item, db.type,item,item) to %(db.type, item,item, db.type,item,item) for item in StrainIdstep: query += 'left join %sData as T%s on T%s.Id = %sXRef.DataId and T%s.StrainId=%s\n' %(db.type, item,item, db.type,item,item) - - if method == "3": + + if method == "3": query += "WHERE ProbeSet.GeneId IS NOT NULL AND %s.value IS NOT NULL AND %sXRef.%sFreezeId = %sFreeze.Id and %sFreeze.Name = '%s' and %s.Id = %sXRef.%sId order by %s.Id" % (tempTable,db.type, db.type, db.type, db.type, db.name, db.type, db.type, db.type, db.type) if method == "4" or method == "5": query += "WHERE ProbeSet.Symbol IS NOT NULL AND %s.Correlation IS NOT NULL AND %sXRef.%sFreezeId = %sFreeze.Id and %sFreeze.Name = '%s' and %s.Id = %sXRef.%sId order by %s.Id" % (tempTable,db.type, db.type, db.type, db.type, db.name, db.type, db.type, db.type, db.type) @@ -939,7 +938,7 @@ Resorting this table <br> for item in StrainIdstep: query += 'left join %sData as T%s on T%s.Id = %sXRef.DataId and T%s.StrainId=%s\n' %(db.type, item,item, db.type,item,item) query += "WHERE %sXRef.%sFreezeId = %sFreeze.Id and %sFreeze.Name = '%s' and %s.Id = %sXRef.%sId order by %s.Id" % (db.type, db.type, db.type, db.type, db.name, db.type, db.type, db.type, db.type) - + self.cursor.execute(query) results = self.cursor.fetchall() oridata.append(results) @@ -971,17 +970,17 @@ Resorting this table <br> - # XZ, 09/20/2008: This function creates TEMPORARY TABLE tmpTableName_2 and return its name. + # XZ, 09/20/2008: This function creates TEMPORARY TABLE tmpTableName_2 and return its name. # XZ, 09/20/2008: It stores top literature correlation values associated with the input geneId. # XZ, 09/20/2008: Attention: In each row, the input geneId is always in column GeneId1. #XZ, 12/16/2008: the input geneid can be of mouse, rat or human type def getTempLiteratureTable(self, species, input_species_geneid, returnNumber): # according to mysql the TEMPORARY TABLE name should not have to be unique because - # it is only available to the current connection. This program will be invoked via command line, but if it + # it is only available to the current connection. This program will be invoked via command line, but if it # were to be invoked over mod_python this could cuase problems. mod_python will keep the connection alive # in its executing threads ( i think) so there is a potential for the table not being dropped between users. #XZ, 01/29/2009: To prevent the potential risk, I generate random table names and drop the tables after use them. - + # the 'input_species_geneid' could be rat or human geneid, need to translate it to mouse geneid translated_mouse_geneid = self.translateToMouseGeneID (species, input_species_geneid) @@ -1022,7 +1021,7 @@ Resorting this table <br> translated_species_geneid = record[0] if translated_species_geneid: - self.cursor.execute( 'INSERT INTO %s (GeneId1, GeneId2, value) VALUES (%d,%d,%f)' % (tmpTableName_2, int(input_species_geneid),int(translated_species_geneid), float(lit_corr_alue)) ) + self.cursor.execute( 'INSERT INTO %s (GeneId1, GeneId2, value) VALUES (%d,%d,%f)' % (tmpTableName_2, int(input_species_geneid),int(translated_species_geneid), float(lit_corr_alue)) ) counter = counter + 1 #pay attention to the number @@ -1054,9 +1053,9 @@ Resorting this table <br> symbolCorrList.sort(cmpTissCorrAbsoluteValue) symbolCorrList = symbolCorrList[0 : 2*returnNumber] - + tmpTableName = webqtlUtil.genRandStr(prefix="TOPTISSUE") - + q1 = 'CREATE TEMPORARY TABLE %s (Symbol varchar(100) PRIMARY KEY, Correlation float, PValue float)' % tmpTableName self.cursor.execute(q1) @@ -1166,7 +1165,7 @@ Resorting this table <br> return traitList def get_trait(self, cached, vals): - + if cached: _log.info("Using the fast method because the file exists") lit_corrs = {} @@ -1194,7 +1193,7 @@ Resorting this table <br> #XZ: The new method uses all strains stored in variable dataset_strains to create a new variable #XZ: _newvals. _newvals has the same length as dataset_strains. The items in _newvals is in #XZ: the same order of items in dataset_strains. The value of each item in _newvals is either - #XZ: the value of correspinding strain in _vals or 'None'. + #XZ: the value of correspinding strain in _vals or 'None'. new_vals = [] for name in cached_sample_names: if name in self.sample_names: @@ -1211,13 +1210,13 @@ Resorting this table <br> data_start = 1 for line in datasetFile: raw_trait = webqtlUtil.readLineCSV(line) - trait = Trait.from_csv(raw_trait, data_start) + trait = Trait.from_csv(raw_trait, data_start) trait.lit_corr = lit_corrs.get(trait.name) trait.tissue_corr, trait.p_tissue = tissue_corrs.get(trait.name, (None, None)) traits.append(trait) return traits, new_vals - + else: _log.info("Using the slow method for correlation") @@ -1318,7 +1317,7 @@ Resorting this table <br> #the top ones always have p value 0. So comparing p values actually does nothing. #In addition, for the tissue data in our database, the N is always the same. #So it's safe to compare with tissue corr statistic value. - #That's the same as literature corr. + #That's the same as literature corr. #if self.method in [METHOD_LIT, METHOD_TISSUE_PEARSON, METHOD_TISSUE_RANK] and self.gene_id: # traits.sort(webqtlUtil.cmpLitCorr) #else: @@ -1348,13 +1347,13 @@ Resorting this table <br> # NL, 07/19/2010 # js function changed, add a new parameter rankOrder for js function 'showTissueCorrPlot' db_trait.RANK_ORDER = self.RANK_ORDERS[self.method] - + #XZ, 26/09/2008: Method is 4 or 5. Have fetched tissue corr, but no literature correlation yet. if self.method in TISSUE_METHODS: db_trait.tissueCorr = trait.tissue_corr db_trait.tissuePValue = trait.p_tissue addTissueCorr = True - + #XZ, 26/09/2008: Method is 3, Have fetched literature corr, but no tissue corr yet. elif self.method == METHOD_LIT: @@ -1374,13 +1373,13 @@ Resorting this table <br> trait_list.append(db_trait) if addLiteratureCorr: - trait_list = self.getLiteratureCorrelationByList(self.input_trait_mouse_gene_id, + trait_list = self.getLiteratureCorrelationByList(self.input_trait_mouse_gene_id, self.species, trait_list) if addTissueCorr: trait_list = self.getTissueCorrelationByList( - primaryTraitSymbol = self.trait_symbol, + primaryTraitSymbol = self.trait_symbol, traitList = trait_list, - TissueProbeSetFreezeId = TISSUE_MOUSE_DB, + TissueProbeSetFreezeId = TISSUE_MOUSE_DB, method=self.method) return trait_list @@ -1446,7 +1445,7 @@ Resorting this table <br> if myTrait: if method in ["1","2"]: #genetic correlation - info = HT.Paragraph("Values of Record %s in the " % myTrait.getGivenName(), HT.Href(text=myTrait.db.fullname,url=webqtlConfig.INFOPAGEHREF % myTrait.db.name,target="_blank", Class="fwn"), + info = HT.Paragraph("Values of Record %s in the " % myTrait.getGivenName(), HT.Href(text=myTrait.db.fullname,url=webqtlConfig.INFOPAGEHREF % myTrait.db.name,target="_blank", Class="fwn"), " database were compared to all %d records in the " % self.record_count, HT.Href(text=db.fullname,url=webqtlConfig.INFOPAGEHREF % target_db_name,target="_blank", Class="fwn"), ' database. The top %d correlations ranked by the %s are displayed.' % (returnNumber,methodDict[method]), ' You can resort this list using the small arrowheads in the top row.') @@ -1498,7 +1497,7 @@ Resorting this table <br> titleStyle = workbook.add_format(align = 'left', bold = 0, size=14, border = 1, border_color="gray") ##Write title Info - # Modified by Hongqiang Li + # Modified by Hongqiang Li worksheet.write([1, 0], "Citations: Please see %s/reference.html" % webqtlConfig.PORTADDR, titleStyle) worksheet.write([1, 0], "Citations: Please see %s/reference.html" % webqtlConfig.PORTADDR, titleStyle) worksheet.write([2, 0], "Trait : %s" % identification, titleStyle) @@ -1568,7 +1567,7 @@ Resorting this table <br> tr = [] trId = str(thisTrait) - + corrScript.append('corrArray["%s"] = {corr:%1.4f};' % (trId, thisTrait.corr)) tr.append(TDCell(HT.TD(HT.Input(type="checkbox", Class="checkbox", name="searchResult",value=trId, onClick="highlight(this)"), nowrap="on", Class="fs12 fwn ffl b1 c222"), text=trId)) @@ -1616,7 +1615,7 @@ Resorting this table <br> tblobj_header = [] if method in ["1","3","4"]: - tblobj_header = [[THCell(HT.TD(' ', Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), sort=0), + tblobj_header = [[THCell(HT.TD(' ', Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), sort=0), THCell(HT.TD('Record',HT.BR(), 'ID',HT.BR(), Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), text="Record ID", idx=1), THCell(HT.TD('Phenotype', HT.BR(),HT.BR(), Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), text="Phenotype", idx=2), THCell(HT.TD('Authors', HT.BR(),HT.BR(), Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), text="Authors", idx=3), @@ -1626,7 +1625,7 @@ Resorting this table <br> THCell(HT.TD(HT.Href( text = HT.Span('Sample',HT.BR(), 'r', HT.Sup(' ?', style="color:#f00"),HT.BR(), Class="fs13 fwb ffl cw"), target = '_blank', - url = "/correlationAnnotation.html#genetic_r"), + url = "/correlationAnnotation.html#genetic_r"), Class="fs13 fwb ffl b1 cw cbrb", nowrap='ON'), text="Sample r", idx=7), THCell(HT.TD('N',HT.BR(),'Cases',HT.BR(), Class="fs13 fwb ffl b1 cw cbrb"), text="N Cases", idx=8), THCell(HT.TD(HT.Href( @@ -1639,7 +1638,7 @@ Resorting this table <br> worksheet.write([newrow, ncol], item, headingStyle) worksheet.set_column([ncol, ncol], 2*len(item)) else: - tblobj_header = [[THCell(HT.TD(' ', Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), sort=0), + tblobj_header = [[THCell(HT.TD(' ', Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), sort=0), THCell(HT.TD('Record',HT.BR(), 'ID',HT.BR(), Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), text="Record ID", idx=1), THCell(HT.TD('Phenotype', HT.BR(),HT.BR(), Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), text="Phenotype", idx=2), THCell(HT.TD('Authors', HT.BR(),HT.BR(), Class="fs13 fwb ffl b1 cw cbrb", nowrap="on"), text="Authors", idx=3), @@ -1649,7 +1648,7 @@ Resorting this table <br> THCell(HT.TD(HT.Href( text = HT.Span('Sample',HT.BR(), 'rho', HT.Sup(' ?', style="color:#f00"),HT.BR(), Class="fs13 fwb ffl cw"), target = '_blank', - url = "/correlationAnnotation.html#genetic_rho"), + url = "/correlationAnnotation.html#genetic_rho"), Class="fs13 fwb ffl b1 cw cbrb", nowrap='ON'), text="Sample rho", idx=7), THCell(HT.TD('N',HT.BR(),'Cases',HT.BR(), Class="fs13 fwb ffl b1 cw cbrb"), text="N Cases", idx=8), THCell(HT.TD(HT.Href( @@ -1674,7 +1673,7 @@ Resorting this table <br> tr = [] trId = str(thisTrait) - + corrScript.append('corrArray["%s"] = {corr:%1.4f};' % (trId, thisTrait.corr)) tr.append(TDCell(HT.TD(HT.Input(type="checkbox", Class="checkbox", name="searchResult",value=trId, onClick="highlight(this)"), nowrap="on", Class="fs12 fwn ffl b1 c222"), text=trId)) @@ -1757,7 +1756,7 @@ Resorting this table <br> tr.append(TDCell(HT.TD(repr,nowrap='ON', Class="fs12 fwn ffl b1 c222", align='right'),repr,thisTrait.corrPValue)) tblobj_body.append(tr) - + for ncol, item in enumerate([thisTrait.name, PhenotypeString, thisTrait.authors, thisTrait.year, thisTrait.pubmed_id, LRS_score_repr, LRS_location_repr, thisTrait.corr, thisTrait.nOverlap, thisTrait.corrPValue]): worksheet.write([newrow, ncol], item) newrow += 1 @@ -1783,7 +1782,7 @@ Resorting this table <br> THCell(HT.TD(HT.Href( text = HT.Span('Sample',HT.BR(), 'r', HT.Sup(' ?', style="color:#f00"),HT.BR(), Class="fs13 fwb ffl cw"), target = '_blank', - url = "/correlationAnnotation.html#genetic_r"), + url = "/correlationAnnotation.html#genetic_r"), Class="fs13 fwb ffl b1 cw cbrb", nowrap='ON'), text="Sample r", idx=10), THCell(HT.TD('N',HT.BR(),'Cases',HT.BR(), Class="fs13 fwb ffl b1 cw cbrb"), text="N Cases", idx=11), THCell(HT.TD(HT.Href( @@ -1825,7 +1824,7 @@ Resorting this table <br> THCell(HT.TD(HT.Href( text = HT.Span('Sample',HT.BR(), 'rho', HT.Sup(' ?', style="color:#f00"),HT.BR(), Class="fs13 fwb ffl cw"), target = '_blank', - url = "/correlationAnnotation.html#genetic_rho"), + url = "/correlationAnnotation.html#genetic_rho"), Class="fs13 fwb ffl b1 cw cbrb", nowrap='ON'), text="Sample rho", idx=10), THCell(HT.TD('N',HT.BR(),'Cases',HT.BR(), Class="fs13 fwb ffl b1 cw cbrb"), text="N Cases", idx=11), THCell(HT.TD(HT.Href( @@ -1885,17 +1884,17 @@ Resorting this table <br> #XZ, 12/08/2008: probeset name tr.append(TDCell(HT.TD(HT.Href(text=thisTrait.name,url="javascript:showTrait('%s', '%s')" % (formName,thisTrait.name), Class="fs12 fwn"), Class="fs12 fwn b1 c222"), thisTrait.name, thisTrait.name.upper())) - #XZ, 12/08/2008: gene id + #XZ, 12/08/2008: gene id if thisTrait.geneid: tr.append(TDCell(None, thisTrait.geneid, val=999)) else: - tr.append(TDCell(None, thisTrait.geneid, val=999)) - + tr.append(TDCell(None, thisTrait.geneid, val=999)) + #XZ, 12/08/2008: homologene id if thisTrait.homologeneid: tr.append(TDCell("", thisTrait.homologeneid, val=999)) else: - tr.append(TDCell("", thisTrait.homologeneid, val=999)) + tr.append(TDCell("", thisTrait.homologeneid, val=999)) #XZ, 12/08/2008: gene symbol tr.append(TDCell(HT.TD(symbolurl, Class="fs12 fwn b1 c222 fsI"),thisTrait.symbol, thisTrait.symbol.upper())) diff --git a/web/webqtl/maintainance/genSelectDatasetJS.py b/web/webqtl/maintainance/genSelectDatasetJS.py index bc88beec..d03cc7af 100755 --- a/web/webqtl/maintainance/genSelectDatasetJS.py +++ b/web/webqtl/maintainance/genSelectDatasetJS.py @@ -27,6 +27,9 @@ # created by Ning Liu 07/01/2010 # This script is to generate selectDatasetMenu.js file for cascade menu in the main search page http://www.genenetwork.org/. # This script will be run automatically every one hour or manually when database has been changed . + +from __future__ import print_function, division + import sys, os current_file_name = __file__ diff --git a/web/webqtl/search/SearchResultPage.py b/web/webqtl/search/SearchResultPage.py index 029a54c4..d62bb449 100755 --- a/web/webqtl/search/SearchResultPage.py +++ b/web/webqtl/search/SearchResultPage.py @@ -14,7 +14,7 @@ from htmlgen import HTMLgen2 as HT from base import webqtlConfig from utility.THCell import THCell from utility.TDCell import TDCell -from base.webqtlDataset import webqtlDataset +from base.data_set import DataSet from base.webqtlTrait import webqtlTrait from base.templatePage import templatePage from utility import webqtlUtil @@ -65,12 +65,12 @@ class SearchResultPage(templatePage): InbredSet where PublishFreeze.Name not like 'BXD300%' and InbredSet.Id = PublishFreeze.InbredSetId""") results = self.cursor.fetchall() - self.database = map(lambda x: webqtlDataset(x[0], self.cursor), results) + self.database = map(lambda x: DataSet(x[0], self.cursor), results) self.databaseCrosses = map(lambda x: x[1], results) self.databaseCrossIds = map(lambda x: x[2], results) self.singleCross = False else: - self.database = map(lambda x: webqtlDataset(x, self.cursor), self.database) + self.database = map(lambda x: DataSet(x, self.cursor), self.database) #currently, webqtl wouldn't allow multiple crosses #for other than multiple publish db search #so we can use the first database as example diff --git a/web/webqtl/showTrait/DataEditingPage.py b/web/webqtl/showTrait/DataEditingPage.py index f38b9880..c240d8a0 100644..100755 --- a/web/webqtl/showTrait/DataEditingPage.py +++ b/web/webqtl/showTrait/DataEditingPage.py @@ -280,13 +280,13 @@ class DataEditingPage(templatePage): if snpurl: snpBrowserButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % snpurl) - snpBrowserButton_img = HT.Image("/images/snp_icon.jpg", name="addselect", alt=" View SNPs and Indels ", title=" View SNPs and Indels ", style="border:none;") + snpBrowserButton_img = HT.Image("/images/snp_icon.jpg", name="snpbrowser", alt=" View SNPs and Indels ", title=" View SNPs and Indels ", style="border:none;") snpBrowserButton.append(snpBrowserButton_img) snpBrowserText = "SNPs" #XZ: Show GeneWiki for all species geneWikiButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE) + "?FormID=geneWiki&symbol=%s" % thisTrait.symbol)) - geneWikiButton_img = HT.Image("/images/genewiki_icon.jpg", name="addselect", alt=" Write or review comments about this gene ", title=" Write or review comments about this gene ", style="border:none;") + geneWikiButton_img = HT.Image("/images/genewiki_icon.jpg", name="genewiki", alt=" Write or review comments about this gene ", title=" Write or review comments about this gene ", style="border:none;") geneWikiButton.append(geneWikiButton_img) geneWikiText = 'GeneWiki' @@ -295,7 +295,7 @@ class DataEditingPage(templatePage): if _Species in ("mouse", "rat", "human"): similarUrl = "%s?cmd=sch&gene=%s&alias=1&species=%s" % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), thisTrait.symbol, _Species) similarButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % similarUrl) - similarButton_img = HT.Image("/images/find_icon.jpg", name="addselect", alt=" Find similar expression data ", title=" Find similar expression data ", style="border:none;") + similarButton_img = HT.Image("/images/find_icon.jpg", name="similar", alt=" Find similar expression data ", title=" Find similar expression data ", style="border:none;") similarButton.append(similarButton_img) similarText = "Find" else: @@ -416,13 +416,15 @@ class DataEditingPage(templatePage): UTHSC_BLAT_URL = "" if UCSC_BLAT_URL: - verifyButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % UCSC_BLAT_URL) - verifyButtonImg = HT.Image("/images/verify_icon.jpg", name="addselect", alt=" Check probe locations at UCSC ", title=" Check probe locations at UCSC ", style="border:none;") + verifyButton = HT.Href(url="#", onClick="javascript:openNewWin('%s'); return false;" % UCSC_BLAT_URL) + verifyButtonImg = HT.Image("/images/verify_icon.jpg", name="verify", alt=" Check probe locations at UCSC ", + title=" Check probe locations at UCSC ", style="border:none;") verifyButton.append(verifyButtonImg) verifyText = 'Verify' if UTHSC_BLAT_URL: - rnaseqButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % UTHSC_BLAT_URL) - rnaseqButtonImg = HT.Image("/images/rnaseq_icon.jpg", name="addselect", alt=" View probes, SNPs, and RNA-seq at UTHSC ", title=" View probes, SNPs, and RNA-seq at UTHSC ", style="border:none;") + rnaseqButton = HT.Href(url="#", onClick="javascript:openNewWin('%s'); return false;" % UTHSC_BLAT_URL) + rnaseqButtonImg = HT.Image("/images/rnaseq_icon.jpg", name="rnaseq", alt=" View probes, SNPs, and RNA-seq at UTHSC ", + title=" View probes, SNPs, and RNA-seq at UTHSC ", style="border:none;") rnaseqButton.append(rnaseqButtonImg) rnaseqText = 'RNA-seq' tSpan.append(HT.BR()) @@ -442,8 +444,8 @@ class DataEditingPage(templatePage): if probeResult[0] > 0: probeurl = "%s?FormID=showProbeInfo&database=%s&ProbeSetID=%s&CellID=%s&RISet=%s&incparentsf1=ON" \ % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), thisTrait.db, thisTrait.name, thisTrait.cellid, fd.RISet) - probeButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % probeurl) - probeButton_img = HT.Image("/images/probe_icon.jpg", name="addselect", alt=" Check sequence of probes ", title=" Check sequence of probes ", style="border:none;") + probeButton = HT.Href(url="#", onClick="javascript:openNewWin('%s'); return false;" % probeurl) + probeButton_img = HT.Image("/images/probe_icon.jpg", name="probe", alt=" Check sequence of probes ", title=" Check sequence of probes ", style="border:none;") probeButton.append(probeButton_img) probeText = "Probes" @@ -590,10 +592,24 @@ class DataEditingPage(templatePage): url="http://string.embl.de/newstring_cgi/show_link_summary.pl?identifier=%s" \ % thisTrait.symbol,Class="fs14 fwn", \ title="Protein interactions: known and inferred"), style=linkStyle), " "*2) - if thisTrait.geneid: + if thisTrait.symbol: + #ZS: The "species scientific" converts the plain English species names we're using to their scientific names, which are needed for PANTHER's input + #We should probably use the scientific name along with the English name (if not instead of) elsewhere as well, given potential non-English speaking users + if _Species == "mouse": + species_scientific = "Mus%20musculus" + elif _Species == "rat": + species_scientific = "Rattus%20norvegicus" + elif _Species == "human": + species_scientific = "Homo%20sapiens" + elif _Species == "drosophila": + species_scientific = "Drosophila%20melanogaster" + else: + species_scientific = "all" + + species_scientific tSpan.append(HT.Span(HT.Href(text= 'PANTHER',target="mainFrame", \ - url="http://www.pantherdb.org/genes/gene.do?acc=%s" \ - % thisTrait.geneid,Class="fs14 fwn", \ + url="http://www.pantherdb.org/genes/geneList.do?searchType=basic&fieldName=all&organism=%s&listType=1&fieldValue=%s" \ + % (species_scientific, thisTrait.symbol),Class="fs14 fwn", \ title="Gene and protein data resources from Celera-ABI"), style=linkStyle), " "*2) else: pass @@ -755,12 +771,13 @@ class DataEditingPage(templatePage): UCSC_BLAT_URL = "" UTHSC_BLAT_URL = "" if UCSC_BLAT_URL: - verifyButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % UCSC_BLAT_URL) - verifyButtonImg = HT.Image("/images/verify_icon.jpg", name="addselect", alt=" Check probe locations at UCSC ", title=" Check probe locations at UCSC ", style="border:none;") + #verifyButton = HT.Href(url="#", onClick="openNewWin('%s')" % UCSC_BLAT_URL) + verifyButton = HT.Href(url="#") + verifyButtonImg = HT.Image("/images/verify_icon.jpg", name="verify", alt=" Check probe locations at UCSC ", title=" Check probe locations at UCSC ", style="border:none;") verifyButton.append(verifyButtonImg) verifyText = "Verify" - rnaseqButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % UTHSC_BLAT_URL) - rnaseqButtonImg = HT.Image("/images/rnaseq_icon.jpg", name="addselect", alt=" View probes, SNPs, and RNA-seq at UTHSC ", title=" View probes, SNPs, and RNA-seq at UTHSC ", style="border:none;") + rnaseqButton = HT.Href(url="#", onClick="openNewWin('%s')" % UTHSC_BLAT_URL) + rnaseqButtonImg = HT.Image("/images/rnaseq_icon.jpg", name="rnaseq", alt=" View probes, SNPs, and RNA-seq at UTHSC ", title=" View probes, SNPs, and RNA-seq at UTHSC ", style="border:none;") rnaseqButton.append(rnaseqButtonImg) rnaseqText = "RNA-seq" |