Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dk gene table #173

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ portal.data.versionDesignator = [ new PortalVersionBean("t2d", // label for
"",
'5010306206573083521',
1, // do we have parent level associations to show
0, // Do we have gene level associations to show?
1, // Do we have gene level associations to show?
1, // add a link to the GRS module into the headers. Note that the GRS module is available whether or not the link is in place
1, // no longer used?
0, // if true then entering a gene takes you to a region page around that chain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class HomeController {
for (org.broadinstitute.mpg.diabetes.metadata.PhenotypeBean phenotype in phenotypeList.sort{it.sortOrder}) {
JSONObject phenoRecord = new JSONObject()
phenoRecord['systemId'] = phenotype.parent.systemId
phenoRecord['technology'] = phenotype.parent.parent.technology
phenoRecord['translatedSystemId'] = g.message(code: "metadata." + phenotype.parent.systemId, default: phenotype.parent.systemId)
phenoRecord['name'] = phenotype.name
phenoRecord['translatedPhenotype'] = g.message(code: "metadata." + phenotype.name, default: phenotype.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2054,13 +2054,22 @@ time required=${(afterCall.time - beforeCall.time) / 1000} seconds
GetDataQueryHolder getDataQueryHolder = GetDataQueryHolder.createGetDataQueryHolder(filters, searchBuilderService, metaDataService,MetaDataService.METADATA_GENE)

// for now let's make the assumption that we always want to look at case and control counts for this phenotype. We can manufacture those if we cut some corners
List <String> piecesOfThePropertyName = propertyName.split("_")
// List <String> piecesOfThePropertyName = propertyName.split("_")

//HACK EXPERIMENT - checking if given property for Exeq shows data or not.

List <String> piecesOfThePropertyName = []
piecesOfThePropertyName.add("MINA")
piecesOfThePropertyName.add("NS_STRICT")

String propertyNameForCaseCount = "ACA_PH_"+piecesOfThePropertyName[1]
String propertyNameForControlCount = "ACU_PH_"+piecesOfThePropertyName[1]
String propertyNameForOddsRatio = "OR_"+piecesOfThePropertyName[1]
String propertyNameForMINARatio = "MINA_"+piecesOfThePropertyName[1]
addColumnsForPProperties(resultColumnsToDisplay, phenotypeName, dataSetName, propertyName)
addColumnsForPProperties(resultColumnsToDisplay, phenotypeName, dataSetName, propertyNameForOddsRatio)
addColumnsForPProperties(resultColumnsToDisplay, phenotypeName, dataSetName, propertyNameForCaseCount)
addColumnsForPProperties(resultColumnsToDisplay, phenotypeName, dataSetName, propertyNameForMINARatio)
addColumnsForPProperties(resultColumnsToDisplay, phenotypeName, dataSetName, propertyNameForControlCount)

getDataQueryHolder.addProperties(resultColumnsToDisplay)
Expand Down
35 changes: 24 additions & 11 deletions grails-app/views/home/portalHome.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,40 @@
</a>
</div>
<div class="traits-filter-wrapper">
<h2 style="font-size:20px; font-weight:300;"><g:message code="trait.search.header" default="View full GWAS results for a phenotype" /></h2>

<g:if test="${portalVersionBean.variantAssociationsExists} && ${portalVersionBean.geneLevelDataExists}">

<div class="radio-inline">
<label><input type="radio" name="radio-gene-association" class="radio" onchange="mpgSoftware.homePage.switchVisibility(['variant-association-ui-wrapper'],['gene-association-ui-wrapper']);" checked> View variant association</label>
</div>
<div class="radio-inline">
<label><input type="radio" name="radio-gene-association" class="radio" onchange="mpgSoftware.homePage.switchVisibility(['gene-association-ui-wrapper'], ['variant-association-ui-wrapper']);" > View gene association</label>
</div>

</g:if>

<g:if test="${portalVersionBean.variantAssociationsExists}">
<h2 style="font-size:20px; font-weight:300;"><g:message code="trait.search.header" default="View full GWAS results for a phenotype" /></h2>
<div class="form-inline" style="padding-top: 10px;">
<div class="traits-filter-ui">
<div class="form-inline variant-association-ui-wrapper">
<!--<div class="traits-filter-ui" style="display:none;">
<span style="display:block; margin: -20px 0 8px 0; font-size:13px;">(ex: bmi, glycemic; '=phenotype' for exact match)</span>
<input id="traits-filter" onfocus="mpgSoftware.traitsFilter.filterOnFocus()" oninput="mpgSoftware.traitsFilter.filterTraitsTable('#traits-list-table')" placeholder="Filter phenotypes" type="text" class="form-control input-sm" style="clear: left; float:left; width: 89%; height: 35px; background-color:#fff; border:none; border-bottom-left-radius: 5px; border-top-left-radius: 5px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; margin:0 0 5px 0; font-size: 16px;">
<div style="float: right; font-size: 20px; padding: 5px 0 1px 0; color: #666; background-color: #fff; width: 10%; height: 35px; border-bottom-right-radius: 5px; border-top-right-radius: 5px; text-align: center; margin-right: 1%" onclick="mpgSoftware.traitsFilter.clearTraitsSearch()" onmouseover="mpgSoftware.traitsFilter.setBtnOver(this)" onmouseout="mpgSoftware.traitsFilter.setBtnOut(this)" ><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></div>
</div>
<div class="traits-select-ui" style="display:none;">
<select name="" id="trait-input" class="form-control input-sm" style="width: 83%; height: 35px; background-color:#fff; border:none; border-radius: 0; border-top-left-radius: 3px; border-bottom-left-radius: 3px; margin:0; font-size: 16px;">
</div>-->
<div class="traits-select-ui variant-association-ui" style="">
<select name="" id="trait-input" class="form-control input-sm selectpicker" data-live-search="true" style="width: 83%; height: 35px; background-color:#fff; border:none; border-radius: 0; border-top-left-radius: 3px; border-bottom-left-radius: 3px; margin:0; font-size: 16px;">
</select>
<button id="traitSearchLaunch" class="btn btn-primary btn-sm" type="button" style="width:15%; height: 35px; background-color:#fff; color: #000; border:none; border-radius: 5px; margin:0; background-image:url(${resource(dir: 'images', file: 'button_arrow.svg')}); background-repeat: no-repeat; background-position: center right;"><g:message code="mainpage.button.imperative"/>&nbsp;&nbsp;&nbsp;</button>
</div>
</div>
</g:if>
<g:if test="${portalVersionBean.geneLevelDataExists}">
<h2 style="font-size:20px; font-weight:300;"><g:message code="gene.search.header" default="View full GWAS results for a phenotype" /></h2>
<div class="form-inline" style="padding-top: 10px;">
<select name="" id="gene-trait-input" class="form-control input-sm" style="width: 83%; height: 35px; background-color:#fff; border:none; border-radius: 0; border-top-left-radius: 3px; border-bottom-left-radius: 3px; margin:0; font-size: 16px;">
</select>
<button id="geneTraitSearchLaunch" class="btn btn-primary btn-sm" type="button" style="width:15%; height: 35px; background-color:#fff; color: #000; border:none; border-radius: 5px; margin:0; background-image:url(${resource(dir: 'images', file: 'button_arrow.svg')}); background-repeat: no-repeat; background-position: center right;"><g:message code="mainpage.button.imperative"/>&nbsp;&nbsp;&nbsp;</button>
<div class="form-inline gene-association-ui-wrapper" style="display:none;">
<div class="gene-association-ui">
<select name="" id="gene-trait-input" class="form-control input-sm selectpicker" data-live-search="true" style="width: 83%; height: 35px; background-color:#fff; border:none; border-radius: 0; border-top-left-radius: 3px; border-bottom-left-radius: 3px; margin:0; font-size: 16px;">
</select>
<button id="geneTraitSearchLaunch" class="btn btn-primary btn-sm" type="button" style="width:15%; height: 35px; background-color:#fff; color: #000; border:none; border-radius: 5px; margin:0; background-image:url(${resource(dir: 'images', file: 'button_arrow.svg')}); background-repeat: no-repeat; background-position: center right;"><g:message code="mainpage.button.imperative"/>&nbsp;&nbsp;&nbsp;</button>
</div>
</div>
</g:if>
</div>
Expand Down
8 changes: 8 additions & 0 deletions web-app/css/lib/dkstyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -1226,4 +1226,12 @@ span.new-dataset-flag {

.analysis-modules-btn:hover ul {
display: block;
}

.variant-association-ui > .btn-group, .gene-association-ui > .btn-group {
width: 84% !important; height: 35px;
}

.variant-association-ui > .btn-group > button, .gene-association-ui > .btn-group > button {
height: 35px; border-radius: 5px; border: none;
}
117 changes: 62 additions & 55 deletions web-app/js/lib/dport/genePrioritization.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ var mpgSoftware = mpgSoftware || {};
var dataSetRecordsForPhenotype = _.uniqBy(matchingPhenotypeRecords,'systemId');
if (dataSetRecordsForPhenotype.length > 0){
_.forEach (dataSetRecordsForPhenotype, function (oneElement){
options.append($("<option />").val(oneElement.systemId)
.html(oneElement.translatedSystemId));
if(oneElement.technology == "ExSeq"){
options.append($("<option />").val(oneElement.systemId)
.html(oneElement.translatedSystemId));
}

});
}

Expand Down Expand Up @@ -203,9 +206,9 @@ var mpgSoftware = mpgSoftware || {};
}

}
if (!skipIt){
collector.push(d);
}

collector.push(d);


}

Expand All @@ -217,57 +220,61 @@ var mpgSoftware = mpgSoftware || {};
$('#manhattanSampleGroupChooser').val(data.variant.dataset);
}

var margin = {top: 0, right: 20, bottom: 0, left: 70},
width = 1050 - margin.left - margin.right,
height = 600 - margin.top - margin.bottom;

var manhattan = baget.manhattan()
.width(width)
.height(height)
.dataHanger("#manhattanPlot1", collector)
.crossChromosomePlot(true)
// .overrideYMinimum (0)
// .overrideYMaximum (10)
// .overrideXMinimum (0)
// .overrideXMaximum (1000000000)
.dotRadius(3)
//.blockColoringThreshold(0.5)
.significanceThreshold(undefined)
.xAxisAccessor(function (d) {
return d.POS
})
.yAxisAccessor(function (d) {
var retVal;
// if (d.P_VALUE > 0) {
// return (0 - Math.log10(d.P_VALUE));
// } else {
// return 0
// }
if (d.P_VALUE > 0) {
retVal = (0 - Math.log10(d.P_VALUE));
} else {
retVal = 0;
}
if (isNaN(retVal)){
console.log('isNaN=true for Manhattan data!');
return 0;
} else {
return retVal;
}
//HACK - Do this only when the portal type is T2D - you can create a portalVersionBean


// var margin = {top: 0, right: 20, bottom: 0, left: 70},
// width = 1050 - margin.left - margin.right,
// height = 600 - margin.top - margin.bottom;
//
// var manhattan = baget.manhattan()
// .width(width)
// .height(height)
// .dataHanger("#manhattanPlot1", collector)
// .crossChromosomePlot(true)
// // .overrideYMinimum (0)
// // .overrideYMaximum (10)
// // .overrideXMinimum (0)
// // .overrideXMaximum (1000000000)
// .dotRadius(3)
// //.blockColoringThreshold(0.5)
// .significanceThreshold(undefined)
// .xAxisAccessor(function (d) {
// return d.POS
// })
// .yAxisAccessor(function (d) {
// var retVal;
// // if (d.P_VALUE > 0) {
// // return (0 - Math.log10(d.P_VALUE));
// // } else {
// // return 0
// // }
// if (d.P_VALUE > 0) {
// retVal = (0 - Math.log10(d.P_VALUE));
// } else {
// retVal = 0;
// }
// if (isNaN(retVal)){
// console.log('isNaN=true for Manhattan data!');
// return 0;
// } else {
// return retVal;
// }
//
// })
// .nameAccessor(function (d) {
// return d.GENE
// })
// .chromosomeAccessor(function (d) {
// return d.CHROM
// })
// .includeXChromosome(true)
// .includeYChromosome(false)
// .dotClickLink(savedVar.variantInfoUrl)
// ;

//d3.select("#manhattanPlot1").call(manhattan.render);

})
.nameAccessor(function (d) {
return d.GENE
})
.chromosomeAccessor(function (d) {
return d.CHROM
})
.includeXChromosome(true)
.includeYChromosome(false)
.dotClickLink(savedVar.variantInfoUrl)
;

d3.select("#manhattanPlot1").call(manhattan.render);
var mySavedVariables = getMySavedVariables();
iterativeTableFiller(collector,
effectType,
Expand Down
27 changes: 21 additions & 6 deletions web-app/js/lib/dport/portalHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ var mpgSoftware = mpgSoftware || {};
}
}

console.log(data)
//console.log(data)

mpgSoftware.traitsFilter.setTraitsFilter(data.datasets,"home");
//mpgSoftware.traitsFilter.setTraitsFilter(data.datasets,"home");
},
error: function (jqXHR, exception) {
loading.hide();
Expand Down Expand Up @@ -233,8 +233,12 @@ var mpgSoftware = mpgSoftware || {};
if (groupContents.length > 0){
options.append("<optgroup label='"+key+"'>");
_.forEach (groupContents, function (oneElement){
options.append($("<option />").val(oneElement.name)
.html("&nbsp;&nbsp;&nbsp;" + oneElement.translatedPhenotype));
if(oneElement.technology == "GEN"){
options.append($("<option />").val(oneElement.name)
.html("&nbsp;&nbsp;&nbsp;" + oneElement.translatedPhenotype));
}
// options.append($("<option />").val(oneElement.name)
// .html("&nbsp;&nbsp;&nbsp;" + oneElement.translatedPhenotype));
});
options.append("</optgroup label='"+key+"'>");;
}
Expand All @@ -261,7 +265,6 @@ var mpgSoftware = mpgSoftware || {};
( typeof data !== 'undefined') &&
( typeof data.is_error !== 'undefined' ) &&
( !data.is_error ) ) {

fillGenePhenotypeCompoundDropdown(data,homePageVars.geneTraitInput,undefined,undefined,homePageVars.defaultPhenotype);
var availPhenotypes = [];
_.forEach( $("select"+homePageVars.geneTraitInput+" option"), function(a){
Expand Down Expand Up @@ -388,6 +391,17 @@ var mpgSoftware = mpgSoftware || {};

};

var switchVisibility = function( TOVISIBLE, TOINVISIBLE) {

$.each(TOVISIBLE, function(index, value) {
$("."+value).css("display","block");
})

$.each(TOINVISIBLE, function(index, value) {
$("."+value).css("display","none");
})
}


return {
initializeInputFields:initializeInputFields,
Expand All @@ -396,7 +410,8 @@ var mpgSoftware = mpgSoftware || {};
setSlideWindows: setSlideWindows,
setHomePageVariables:setHomePageVariables,
retrieveGenePhenotypes:retrieveGenePhenotypes,
retrievePhenotypes:retrievePhenotypes
retrievePhenotypes:retrievePhenotypes,
switchVisibility:switchVisibility,
}
})();
})();