diff options
author | Sam Ockman | 2012-06-02 01:58:18 -0400 |
---|---|---|
committer | Sam Ockman | 2012-06-02 01:58:18 -0400 |
commit | 5017110bcb52c59df2e619de76e8106936cecb31 (patch) | |
tree | 0108ffb6149da2e7c3700256fb99925f7dd613c8 /web | |
parent | d75bdd01bc43c8db62dc38af52fa4d811d408645 (diff) | |
parent | e03be38427b6fcb64a567e345c96fc2a6ee99d60 (diff) | |
download | genenetwork2-5017110bcb52c59df2e619de76e8106936cecb31.tar.gz |
Merge and file additions
Diffstat (limited to 'web')
-rwxr-xr-x[-rw-r--r--] | web/javascript/jqueryFunction.js | 2041 | ||||
-rwxr-xr-x | web/webqtl/basicStatistics/updatedBasicStatisticsPage.py | 54 | ||||
-rwxr-xr-x | web/webqtl/correlation/CorrelationPage.py | 171 | ||||
-rwxr-xr-x[-rw-r--r--] | web/webqtl/showTrait/DataEditingPage.py | 49 |
4 files changed, 1154 insertions, 1161 deletions
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/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/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/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" |