forked from intermine/intermine
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redesign the gene disease pair displayer
- Loading branch information
1 parent
dbd3726
commit fc7408e
Showing
3 changed files
with
275 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 158 additions & 0 deletions
158
targetmine/webapp/resources/webapp/model/altGeneDiseasePairDisplayer.jsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | ||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> | ||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> | ||
<%@ taglib tagdir="/WEB-INF/tags" prefix="im"%> | ||
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> | ||
|
||
<div class="collection-table"> | ||
|
||
<c:choose> | ||
<c:when test="${empty geneticDiseaseList}"> | ||
<h3>No genetic disease association.</h3> | ||
</c:when> | ||
<c:otherwise> | ||
<h3> | ||
${numOfAssociations} Genetic disease association<c:if test="${numOfAssociations > 1}">s</c:if> | ||
</h3> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th style="min-width: 390px;"><b>GWAS catalog</b></th> | ||
<th style="min-width: 150px;"> | ||
<c:if test="${!empty geneticDiseaseList['gwas']}">p-value</c:if> | ||
</th> | ||
<th style="min-width: 82px;">Number of publications</th> | ||
<th style="min-width: 82px;">Number of SNPs</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<c:choose> | ||
<c:when test="${empty geneticDiseaseList['gwas']}"> | ||
<tr> | ||
<td class="smallnote" colspan="4"><i>No items in this category.</i></td> | ||
</tr> | ||
</c:when> | ||
<c:otherwise> | ||
<c:forEach var="entryInfo" items="${geneticDiseaseList['gwas']}"> | ||
<tr> | ||
<td>${entryInfo['diseaseColumn']}</td> | ||
<td>${entryInfo['gwasColumn']}</td> | ||
<td>${entryInfo['pubCountColumn']}</td> | ||
<td>${entryInfo['snpCountColumn']}</td> | ||
</tr> | ||
</c:forEach> | ||
</c:otherwise> | ||
</c:choose> | ||
</tbody> | ||
<thead> | ||
<tr> | ||
<th><b>ClinVar</b></th> | ||
<th colspan="3"> | ||
<c:if test="${!empty geneticDiseaseList['clinvar']}">Clinical significant</c:if> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<c:choose> | ||
<c:when test="${empty geneticDiseaseList['clinvar']}"> | ||
<tr> | ||
<td class="smallnote" colspan="4"><i>No items in this category.</i></td> | ||
</tr> | ||
</c:when> | ||
<c:otherwise> | ||
<c:forEach var="entryInfo" items="${geneticDiseaseList['clinvar']}"> | ||
<tr> | ||
<td>${entryInfo['diseaseColumn']}</td> | ||
<td>${entryInfo['clinvarColumn']}</td> | ||
<td>${entryInfo['pubCountColumn']}</td> | ||
<td>${entryInfo['snpCountColumn']}</td> | ||
</tr> | ||
</c:forEach> | ||
</c:otherwise> | ||
</c:choose> | ||
</tbody> | ||
<thead> | ||
<tr><th colspan="4"><b>dbSNP-PubMed-MeSH</b></th></tr> | ||
</thead> | ||
<tbody> | ||
<c:choose> | ||
<c:when test="${empty geneticDiseaseList['dbsnpMesh']}"> | ||
<tr> | ||
<td class="smallnote" colspan="4"><i>No items in this category.</i></td> | ||
</tr> | ||
</c:when> | ||
<c:otherwise> | ||
<c:forEach var="entryInfo" items="${geneticDiseaseList['dbsnpMesh']}"> | ||
<tr> | ||
<td>${entryInfo['diseaseColumn']}</td> | ||
<td> </td> | ||
<td>${entryInfo['pubCountColumn']}</td> | ||
<td>${entryInfo['snpCountColumn']}</td> | ||
</tr> | ||
</c:forEach> | ||
</c:otherwise> | ||
</c:choose> | ||
</tbody> | ||
</table> | ||
|
||
</c:otherwise> | ||
</c:choose> | ||
</div> | ||
|
||
<c:choose> | ||
<c:when test="${empty disgenet}"> | ||
<!-- show nothing?--> | ||
</c:when> | ||
<c:otherwise> | ||
<div class="collection-table"> | ||
<h3> | ||
${fn:length(disgenet)} Disease association<c:if test="${fn:length(disgenet) > 1}">s</c:if> from DisGeNet | ||
</h3> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Disease</th> | ||
<th>Number of publications</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<c:forEach var="disease" items="${disgenet}"> | ||
<tr> | ||
<td><a href="report.do?id=${disease.id}">${disease.diseaseTerm.name}</a></td> | ||
<td><a href="report.do?id=${disease.id}">${fn:length(disease.publications)}</a></td> | ||
</tr> | ||
</c:forEach> | ||
</tbody> | ||
</table> | ||
</div> | ||
</c:otherwise> | ||
</c:choose> | ||
|
||
<c:choose> | ||
<c:when test="${empty others}"> | ||
<!-- show nothing?--> | ||
</c:when> | ||
<c:otherwise> | ||
<div class="collection-table"> | ||
<h3> | ||
${fn:length(others)} Other disease association<c:if test="${fn:length(others) > 1}">s</c:if> | ||
</h3> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Disease</th> | ||
<th>Source</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<c:forEach var="disease" items="${others}"> | ||
<tr> | ||
<td><a href="report.do?id=${disease.id}">${disease.diseaseTerm.name}</a></td> | ||
<td>${disease.dataSet.name}</td> | ||
</tr> | ||
</c:forEach> | ||
</tbody> | ||
</table> | ||
</div> | ||
</c:otherwise> | ||
</c:choose> |
115 changes: 115 additions & 0 deletions
115
targetmine/webapp/src/org/intermine/bio/web/displayer/AltGeneDiseasePairDisplayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package org.intermine.bio.web.displayer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.apache.log4j.Logger; | ||
import org.intermine.api.InterMineAPI; | ||
import org.intermine.model.InterMineObject; | ||
import org.intermine.web.displayer.ReportDisplayer; | ||
import org.intermine.web.logic.config.ReportDisplayerConfig; | ||
import org.intermine.web.logic.results.ReportObject; | ||
|
||
/** | ||
* An alternative GeneDiseasePair displayer | ||
* | ||
* @author chenyian | ||
* | ||
*/ | ||
public class AltGeneDiseasePairDisplayer extends ReportDisplayer { | ||
protected static final Logger LOG = Logger.getLogger(AltGeneDiseasePairDisplayer.class); | ||
|
||
public AltGeneDiseasePairDisplayer(ReportDisplayerConfig config, InterMineAPI im) { | ||
super(config, im); | ||
// TODO Auto-generated constructor stub | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public void display(HttpServletRequest request, ReportObject reportObject) { | ||
InterMineObject gene = (InterMineObject) reportObject.getObject(); | ||
|
||
Map<String, List<Map<String, String>>> ret = new HashMap<String, List<Map<String,String>>>(); | ||
ret.put("gwas", new ArrayList<Map<String, String>>()); | ||
ret.put("clinvar", new ArrayList<Map<String, String>>()); | ||
ret.put("dbsnpMesh", new ArrayList<Map<String, String>>()); | ||
List<InterMineObject> disgenet = new ArrayList<InterMineObject>(); | ||
List<InterMineObject> others = new ArrayList<InterMineObject>(); // so far only OMIM? | ||
|
||
try { | ||
String geneSymbol = (String) gene.getFieldValue("symbol"); | ||
|
||
Set<InterMineObject> geneDiseasePairs = (Set<InterMineObject>) gene.getFieldValue("geneDiseasePairs"); | ||
for (InterMineObject gdItem : geneDiseasePairs) { | ||
Map<String,String> entryInfo = new HashMap<String, String>(); | ||
InterMineObject diseaseTerm = (InterMineObject) gdItem.getFieldValue("diseaseTerm"); | ||
String name = (String) diseaseTerm.getFieldValue("name"); | ||
entryInfo.put("diseaseColumn", String.format("<a href=\"report.do?id=%s\">%s - %s</a>", gdItem.getId().toString(), name, geneSymbol)); | ||
|
||
Set<InterMineObject> publications = (Set<InterMineObject>) gdItem.getFieldValue("publications"); | ||
if (publications != null) { | ||
entryInfo.put("pubCountColumn", String.valueOf(publications.size())); | ||
} else { | ||
entryInfo.put("pubCountColumn", "0"); | ||
} | ||
|
||
Set<InterMineObject> snps = (Set<InterMineObject>) gdItem.getFieldValue("snps"); | ||
entryInfo.put("snpCountColumn", String.valueOf(snps.size())); | ||
|
||
Set<InterMineObject> gwasItems = (Set<InterMineObject>) gdItem.getFieldValue("gwas"); | ||
Set<InterMineObject> alleles = (Set<InterMineObject>) gdItem.getFieldValue("alleles"); | ||
if (gwasItems != null && !gwasItems.isEmpty()) { | ||
List<String> list = new ArrayList<String>(); | ||
for (InterMineObject gwas : gwasItems) { | ||
Double pvalue = (Double) gwas.getFieldValue("pvalue"); | ||
list.add(String.format("<a href=\"report.do?id=%s\">%s</a>", gwas.getId().toString(), pvalue.toString())); | ||
} | ||
entryInfo.put("gwasColumn", StringUtils.join(list, ", ")); | ||
ret.get("gwas").add(entryInfo); | ||
} else if (alleles != null && !alleles.isEmpty()) { | ||
Set<String> csSet = new HashSet<String>(); | ||
for (InterMineObject allele : alleles) { | ||
csSet.add((String) allele.getFieldValue("clinicalSignificance")); | ||
} | ||
List<String> list = new ArrayList<String>(csSet); | ||
Collections.sort(list); | ||
entryInfo.put("clinvarColumn", StringUtils.join(list, ", ")); | ||
ret.get("clinvar").add(entryInfo); | ||
} else { | ||
ret.get("dbsnpMesh").add(entryInfo); | ||
} | ||
} | ||
|
||
// process diseases | ||
Set<InterMineObject> diseases = (Set<InterMineObject>) gene.getFieldValue("diseases"); | ||
for (InterMineObject disease : diseases) { | ||
InterMineObject dataSet = (InterMineObject) disease.getFieldValue("dataSet"); | ||
String dataSetName = (String) dataSet.getFieldValue("name"); | ||
if (dataSetName.equals("DisGeNET")) { | ||
disgenet.add(disease); | ||
} else { | ||
others.add(disease); | ||
} | ||
} | ||
|
||
} catch (IllegalAccessException e) { | ||
LOG.error(e.getMessage()); | ||
} | ||
|
||
request.setAttribute("geneticDiseaseList", ret); | ||
request.setAttribute("numOfAssociations", Integer.valueOf( | ||
ret.get("gwas").size() + ret.get("clinvar").size() + ret.get("dbsnpMesh").size())); | ||
request.setAttribute("disgenet", disgenet); | ||
request.setAttribute("others", others); | ||
|
||
} | ||
|
||
} |