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

Gait modules #182

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
9 changes: 6 additions & 3 deletions grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ environments {

// grails.serverURL = "http://demo52k.us-east-1.elasticbeanstalk.com"
// grails.serverURL = "http://ci-env.elasticbeanstalk.com"
// grails.serverURL = "http://type2diabetes-dev.elasticbeanstalk.com"
grails.serverURL = "http://type2diabetes-dev.elasticbeanstalk.com"

grails.serverURL = "http://type2diabetesgen-qasrvr.elasticbeanstalk.com"
// grails.serverURL = "http://type2diabetesgen-qasrvr.elasticbeanstalk.com"


// grails.serverURL = "http://ec2-54-175-211-21.compute-1.amazonaws.com/" // temp for now, will house new prdsrv1 URL
Expand Down Expand Up @@ -465,6 +465,7 @@ grails.plugin.springsecurity.interceptUrlMap = [
'/variant/**': ['ROLE_USER'],
'/variantInfo/**': ['ROLE_USER'],
'/grs/**': ['ROLE_USER'],
'/gait/**': ['ROLE_USER'],
'/variantSearch/retrieveGwasSpecificPhenotypesAjax': ['permitAll'],
'/variantSearch/**': ['ROLE_USER'],
'/beacon/*': ['permitAll'],
Expand Down Expand Up @@ -974,4 +975,6 @@ portal.data.versionDesignator = [ new PortalVersionBean("t2d", // label for




// Here the secret authentication strings
auth.providers.twitter.secret = 'l3dJBs3w9QraAuivcfaqdjVGkJ4cxQSMMNNkZ6v9bwz8nXBCXQ'
oauth.providers.google.secret = 'HKIxi3AOLAgyFV6lDJQCfEgY'
7 changes: 7 additions & 0 deletions grails-app/conf/portalResources.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ modules = {
resource url: 'css/dport/grsInfo.css'
}

gaitInfo {
dependsOn "core", "mbar", "bootstrapMultiselect", "burdenTest","boxwhisker"

resource url: 'js/lib/dport/gaitInfo.js'
resource url: 'css/dport/grsInfo.css'
}

regionInfo {
resource url: 'js/lib/dport/regionInfo.js'
resource url: 'css/dport/regionInfo.css'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package org.broadinstitute.mpg


import groovy.json.JsonSlurper
import org.broadinstitute.mpg.diabetes.util.PortalConstants
import org.broadinstitute.mpg.meta.UserQueryContext
import org.codehaus.groovy.grails.web.json.JSONObject

class GaitController {
RestServerService restServerService
WidgetService widgetService

def index() {
forward gaitInfo()
}

def gaitInfo(){
String uncharacterizedString = params.id
UserQueryContext userQueryContext = widgetService.generateUserQueryContext(uncharacterizedString)
if (userQueryContext.gene){
render (view: 'gaitInfo', model:[geneName: userQueryContext.originalRequest,allowExperimentChoice: false, allowPhenotypeChoice: true, allowStratificationChoice: true ])
}
if (userQueryContext.variant){
render (view: 'gaitInfo', model:[variantIdentifier: userQueryContext.originalRequest, variantSetId: userQueryContext.originalRequest,allowExperimentChoice: true, allowPhenotypeChoice: true, allowStratificationChoice: false])
}


}

def getGRSListOfVariantsAjax() {
String grsName = params.grsName

// TODO - eventually create new bean to hold all the options and have smarts for double checking validity
List <String> variantList = restServerService.getGrsVariants()//grsName should be passed in

if (variantList == null) {
render(status: 200, contentType: "application/json"){variantInfo:{results:[]}}
return
}

StringBuilder sb = new StringBuilder()
List <String> recordPerVariants = []
for (String varId in variantList){
List <String> idPieces = varId.split("_")
recordPerVariants << "{\"d\":1,\"dataset\":1,\"pVals\":[{\"count\":\"${idPieces[0]}\",\"level\":\"CHROM\"},"+
"{\"count\":\"${idPieces[1]}\",\"level\":\"POS\"},"+
"{\"count\":\"${idPieces[2]}\",\"level\":\"Reference_Allele\"},"+
"{\"count\":\"${varId}\",\"level\":\"VAR_ID\"},"+
"{\"count\":\"${idPieces[3]}\",\"level\":\"Effect_Allele\"}]}".toString()
}

JsonSlurper slurper = new JsonSlurper()
String codedVariantList = """{"results":[${recordPerVariants.join(",")}]}""".toString()
JSONObject sampleCallSpecifics = slurper.parseText(codedVariantList)

// send json response back
render(status: 200, contentType: "application/json") {sampleCallSpecifics}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class GrsController {
render (view: 'grsInfo', model:[])
}

def gaitInfo(){
render (view: 'gaitInfo', model:[])
}

def getGRSListOfVariantsAjax() {
String grsName = params.grsName

Expand Down
1 change: 1 addition & 0 deletions grails-app/i18n/informational.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2720,6 +2720,7 @@ informational.modules.VariantFinder.title=Variant Finder
informational.modules.VariantFinder.description=<p>This versatile tool lets you specify multiple search criteria to find genetic variants \
whose associations meet those criteria.
informational.modules.GAIT.title=GAIT
informational.modules.geneGAIT.title=Gene GAIT
informational.modules.GAIT.description=<p>The Genetic Association Interactive Tool allows you to compute custom association statistics by specifying the phenotype to test for association, a subset of samples to analyze based on specific phenotypic criteria, and a set of covariates to control for in the analysis. In order to protect patient privacy, GAIT will only allow visualization or analysis of data from more than 100 individuals.</p><div style="float: left; margin-top: 5px;" class="btn dk-t2d-green dk-reference-button dk-right-column-buttons-compact "><a href="https://s3.amazonaws.com/broad-portal-resources/tutorials/KP_GAIT_guide.pdf" target="_blank">GAIT guide</a></div>
informational.modules.GRS.title=Genetic Risk Score
informational.modules.GRS.description=The Genetic Risk Score (GRS) tool takes a defined set of T2D risk-associated variants and allows you \
Expand Down
2 changes: 2 additions & 0 deletions grails-app/i18n/portalHome.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ portal.header.nav.blog=blog
portal.header.nav.login=log in
portal.header.nav.downloads=downloads
portal.header.nav.grs=Genetic Risk Score
portal.header.nav.geneGait=Custom burden test
portal.header.nav.variantGait=Genetic Association Interactive Tool
portal.header.data_portal=Data portal
portal.header.tagline=Providing data and tools to promote understanding and treatment of type 2 diabetes and its complications
portal.home.collaborate=Click here to learn more
Expand Down
152 changes: 152 additions & 0 deletions grails-app/views/gait/gaitInfo.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<%--
Created by IntelliJ IDEA.
User: psingh
Date: 5/21/19
Time: 1:44 AM
--%>

<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="t2dGenesCore"/>
<r:require modules="core"/>
<r:require modules="datatables"/>
<r:require modules="gaitInfo"/>
<r:require modules="geneInfo"/>
<r:require modules="burdenTest"/>
<r:layoutResources/>


<link type="application/font-woff">
<link type="application/vnd.ms-fontobject">
<link type="application/x-font-ttf">
<link type="font/opentype">

</head>

<body>

<div id="rSpinner" class="dk-loading-wheel center-block" style="display:none">
<img src="${resource(dir: 'images', file: 'ajax-loader.gif')}" alt="Loading"/>
</div>
<script>

$( document ).ready(function() {
"use strict";

var drivingVariables = {
geneName: "${geneName}",
variantIdentifier: "${variantIdentifier}",
allowExperimentChoice:"${allowExperimentChoice}",
allowPhenotypeChoice:"${allowPhenotypeChoice}",
allowStratificationChoice:"${allowStratificationChoice}"

};

mpgSoftware.gaitInfo.setGaitInfoData(drivingVariables);
mpgSoftware.gaitInfo.buildGaitDisplay();


var pageTitle = $(".accordion-toggle").find("h2").text();
var textUnderTitle = $(".accordion-inner").find("h5").text();
$(".accordion-toggle").remove();
$(".accordion-inner").find("h5").remove();

var PageTitleDiv = '<div class="row">\n'+
'<div class="col-md-12">\n'+
'<h1 class="dk-page-title">' + pageTitle + '</h1>\n'+
'<div class="col-md-12">\n'+
'<h5 class="dk-under-header">' + textUnderTitle + '</h5>\n'+
'</div></div>';

$(PageTitleDiv).insertBefore(".gene-info-container");
$(".user-interaction").addClass("col-md-12");


/* end of DK's script */

});



</script>

<style>
ul.nav-tabs > li > a { background: none !important; }
ul.nav-tabs > li.active > a { background-color: #fff !important; }
#modeledPhenotypeTabs li.active > a { background-color: #9fd3df !important; }
</style>

<div id="main">

<div class="container">

<div class="gene-info-container row">

<em style="font-weight: 900;"><%=geneName%></em>


<em style="font-weight: 900;"><%=variantIdentifier%></em>


%{--If its gene Gait page then allowExperimentChoice = 0 and 'geneName':'geneName'--}%
%{--<g:if test="${geneName?.equals('')}">--}%

%{--<g:render template="/templates/burdenTestSharedTemplate" model="['variantIdentifier': variantIdentifier, 'accordionHeaderClass': 'accordion-heading']" />--}%

%{--<g:render template="/widgets/burdenTestShared" model="['variantIdentifier': variantIdentifier,--}%
%{--'accordionHeaderClass': 'accordion-heading',--}%
%{--'modifiedTitle': 'Variant Interactive burden test',--}%
%{--'modifiedGaitSummary': 'The Genetic Association Interactive Tool (GAIT) allows you to compute the disease or phenotype burden for this gene, using custom sets of variants, samples, and covariates. In order to protect patient privacy, GAIT will only allow visualization or analysis of data from more than 100 individuals.',--}%
%{--'allowExperimentChoice': 1,--}%
%{--'allowPhenotypeChoice': 1,--}%
%{--'allowStratificationChoice': 0,--}%
%{--'grsVariantSet':'',--}%
%{--'geneName':'']"/>--}%
%{--</g:if>--}%

%{--<g:else>--}%
%{--<g:render template="/templates/burdenTestSharedTemplate" model="['variantIdentifier': '', 'accordionHeaderClass': 'accordion-heading']" />--}%

%{--<g:render template="/widgets/burdenTestShared" model="['variantIdentifier': '',--}%
%{--'accordionHeaderClass': 'accordion-heading',--}%
%{--'modifiedTitle': 'Gene Interactive burden test',--}%
%{--'modifiedGaitSummary': 'The Genetic Association Interactive Tool (GAIT) allows you to compute the disease or phenotype burden for this gene, using custom sets of variants, samples, and covariates. In order to protect patient privacy, GAIT will only allow visualization or analysis of data from more than 100 individuals.',--}%
%{--'allowExperimentChoice': 1,--}%
%{--'allowPhenotypeChoice': 1,--}%
%{--'allowStratificationChoice': 1,--}%
%{--'grsVariantSet':'',--}%
%{--'geneName':geneName]"/>--}%

%{--</g:else>--}%


<g:render template="/templates/burdenTestSharedTemplate" model="['variantIdentifier': variantIdentifier, 'accordionHeaderClass': 'accordion-heading']" />



%{--If its gene Gait page then allowExperimentChoice = 0 and 'geneName':'geneName'--}%
<g:render template="/widgets/burdenTestShared" model="['variantIdentifier': '',
'accordionHeaderClass': 'accordion-heading',
'modifiedTitle': 'Genetic Association Interactive Tool',
'modifiedGaitSummary': 'The Genetic Association Interactive Tool (GAIT) allows you to compute the disease or phenotype burden for this gene, using custom sets of variants, samples, and covariates. In order to protect patient privacy, GAIT will only allow visualization or analysis of data from more than 100 individuals.',
'allowExperimentChoice': allowExperimentChoice,
'allowPhenotypeChoice': allowPhenotypeChoice,
'allowStratificationChoice': allowStratificationChoice,
'grsVariantSet':'',
'geneName':geneName]"/>







</div>
</div>

</div>

</body>
</html>

1 change: 1 addition & 0 deletions grails-app/views/gene/geneInfo.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
data: {geneName: '${geneName}'},
async: true
}).done(function (data) {
console.log(geneName);
mpgSoftware.geneInfo.fillTheGeneFields(data); // fills the uniprot summary
$('[data-toggle="popover"]').popover({
animation: true,
Expand Down
Loading