Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conflicts:
	.classpath
	ivy.xml
	src/hpoweb/HpowebUI.java
  • Loading branch information
koehlers committed Feb 26, 2018
2 parents c5177e9 + 5805a14 commit 499f828
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 8 [1.8.0_161]">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
Expand Down
1 change: 0 additions & 1 deletion ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@
<dependency org="com.github.vaadin4qbanos" name="jsclipboard" rev="1.0.2" />
<dependency org="com.sebworks" name="vaadstrap" rev="0.1.2" />
<dependency org="net.sourceforge.owlapi" name="owlapi-distribution" rev="4.1.3"/>

</dependencies>
</ivy-module>
7 changes: 4 additions & 3 deletions src/hpoweb/HpowebUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.jsclipboard.JSClipboard;
import com.vaadin.server.ExternalResource;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
Expand Down Expand Up @@ -168,9 +169,9 @@ protected void init(VaadinRequest request) {
* Bottom part
*/
Label version = new Label("Ontology version: " + ontologyVersion);
Label copyright = new Label("Copyright 2017 - Sebastian Köhler & The Human Phenotype Ontology Project");
Link feedback = new Link("Question, Comments, Feedback: [email protected]",
new com.vaadin.server.ExternalResource("http:https://drseb.github.io/"));
Label copyright = new Label("Copyright 2018 - Sebastian Köhler & The Phenomics Group Berlin");
Link feedback = new Link("Contact: [email protected]",
new ExternalResource("http:https://phenomics.github.io/"));
addLabelRow(gridContainer, version);
addLabelRow(gridContainer, copyright);
addLabelRow(gridContainer, feedback);
Expand Down
88 changes: 51 additions & 37 deletions src/hpoweb/uicontent/tabs/hpoclass/HpoClassTabFactory.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
package hpoweb.uicontent.tabs.hpoclass;

import hpoweb.data.HpData;
import hpoweb.data.dataprovider.IHpClassDataProvider;
import hpoweb.uicontent.graph.GraphtestUI;
import hpoweb.uicontent.table.DiseaseGeneTableEntry;
import hpoweb.uicontent.table.GeneDiseaseTableEntry;
import hpoweb.uicontent.table.TableLabel;
import hpoweb.util.CONSTANTS;
import hpoweb.util.TableUtils;

import java.util.Collection;
import java.util.HashSet;
import java.util.List;

import org.apache.commons.lang3.RandomStringUtils;
import org.semanticweb.owlapi.model.OWLClass;

import com.google.common.base.Joiner;
import com.sebworks.vaadstrap.Col;
import com.sebworks.vaadstrap.ColMod;
Expand All @@ -28,7 +16,18 @@
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;

import org.apache.commons.lang3.RandomStringUtils;
import org.semanticweb.owlapi.model.OWLClass;

import de.charite.phenowl.hpowl.util.OboUtil;
import hpoweb.data.HpData;
import hpoweb.data.dataprovider.IHpClassDataProvider;
import hpoweb.uicontent.graph.GraphtestUI;
import hpoweb.uicontent.table.DiseaseGeneTableEntry;
import hpoweb.uicontent.table.GeneDiseaseTableEntry;
import hpoweb.uicontent.table.TableLabel;
import hpoweb.util.CONSTANTS;
import hpoweb.util.TableUtils;

public class HpoClassTabFactory {

Expand Down Expand Up @@ -92,7 +91,12 @@ private VerticalLayout getAssociatedGenesTab(IHpClassDataProvider dataProvider)
VerticalLayout tableVL = new VerticalLayout();
tableVL.setSizeFull();

Label lab1 = new Label("Associated genes");
List<GeneDiseaseTableEntry> tableContent = dataProvider.getGeneDiseaseTableContent();

int numberOfDiseases = tableContent.size();

Label lab1 = new Label(numberOfDiseases + " associated genes");

lab1.addStyleName(ValoTheme.LABEL_LIGHT);
lab1.addStyleName("tab-content-header");
tableVL.addComponent(lab1);
Expand All @@ -103,17 +107,15 @@ private VerticalLayout getAssociatedGenesTab(IHpClassDataProvider dataProvider)
table.setSizeFull();
table.setHeight("275px");

List<GeneDiseaseTableEntry> tableContent = dataProvider.getGeneDiseaseTableContent();

int id = 0;
for (GeneDiseaseTableEntry entry : tableContent) {
TableLabel geneEntry = new TableLabel(entry.getGeneSymbol() + " (<a href='" + CONSTANTS.rootLocation + "?" + CONSTANTS.geneRequestId
+ "=" + entry.getGeneId() + "'>" + entry.getGeneId() + "</a>)", ContentMode.HTML);
TableLabel geneEntry = new TableLabel(entry.getGeneSymbol() + " (<a href='" + CONSTANTS.rootLocation + "?" + CONSTANTS.geneRequestId + "="
+ entry.getGeneId() + "'>" + entry.getGeneId() + "</a>)", ContentMode.HTML);

String diseasesString = tableUtils.getDiseasesAsHtmlString(entry.getAssociatedDiseases(), CONSTANTS.rootLocation);

TableLabel diseases = new TableLabel(diseasesString, ContentMode.HTML);
Integer itemId = new Integer(id++);
Integer itemId = Integer.valueOf(id++);
table.addItem(new Object[] { geneEntry, diseases }, itemId);
}

Expand All @@ -134,8 +136,12 @@ private VerticalLayout getAssociatedGenesTab(IHpClassDataProvider dataProvider)
private VerticalLayout getAssociatedDiseasesTab(IHpClassDataProvider dataProvider) {
VerticalLayout tableVL = new VerticalLayout();
tableVL.setSizeFull();
List<DiseaseGeneTableEntry> tableContent = dataProvider.getDiseaseGeneTableContent();

int numberOfDiseases = tableContent.size();

Label lab1 = new Label(numberOfDiseases + " associated diseases");

Label lab1 = new Label("Associated diseases");
lab1.addStyleName(ValoTheme.LABEL_LIGHT);
lab1.addStyleName("tab-content-header");
tableVL.addComponent(lab1);
Expand All @@ -147,18 +153,16 @@ private VerticalLayout getAssociatedDiseasesTab(IHpClassDataProvider dataProvide
table.setSizeFull();
table.setHeight("275px");

List<DiseaseGeneTableEntry> tableContent = dataProvider.getDiseaseGeneTableContent();

int id = 0;
for (DiseaseGeneTableEntry entry : tableContent) {
TableLabel diseaseid = new TableLabel("<a href='" + CONSTANTS.rootLocation + "?" + CONSTANTS.diseaseRequestId + "="
+ entry.getDiseaseId() + "'>" + entry.getDiseaseId() + "</a>", ContentMode.HTML);
TableLabel diseaseid = new TableLabel("<a href='" + CONSTANTS.rootLocation + "?" + CONSTANTS.diseaseRequestId + "=" + entry.getDiseaseId()
+ "'>" + entry.getDiseaseId() + "</a>", ContentMode.HTML);
TableLabel diseasename = new TableLabel(entry.getDiseaseName(), ContentMode.HTML);

String genesString = tableUtils.getGenesAsHtmlString(entry.getAssociatedGenes(), CONSTANTS.rootLocation);

TableLabel genes = new TableLabel(genesString, ContentMode.HTML);
Integer itemId = new Integer(id++);
Integer itemId = Integer.valueOf(id++);
table.addItem(new Object[] { diseaseid, diseasename, genes }, itemId);
}

Expand Down Expand Up @@ -186,9 +190,8 @@ private VerticalLayout getSynonymsVl(IHpClassDataProvider dataProvider) {

Collection<String> synonyms = dataProvider.getSynonyms();
if (synonyms.size() < 1) {
Label suggestSyn = new Label(
"Currently the HPO does not have any synonyms for this class. "
+ "Suggest a synonym at our <a href='https://github.com/obophenotype/human-phenotype-ontology/issues/' target='_new'>github tracker</a>",
Label suggestSyn = new Label("Currently the HPO does not have any synonyms for this class. "
+ "Suggest a synonym at our <a href='https://github.com/obophenotype/human-phenotype-ontology/issues/' target='_new'>github tracker</a>",
ContentMode.HTML);
suggestSyn.addStyleName("tab-content-content");
vl_syns.addComponent(suggestSyn);
Expand Down Expand Up @@ -223,8 +226,8 @@ private VerticalLayout getIdentifiersVl(IHpClassDataProvider dataProvider) {
* Secondary ID
*/
Label lab2 = new Label("Alternative IDs");
lab2.setDescription("These are other identifiers which are referring to the same HPO class. "
+ "These are introduced when classes are merged.");
lab2.setDescription(
"These are other identifiers which are referring to the same HPO class. " + "These are introduced when classes are merged.");
lab2.addStyleName(ValoTheme.LABEL_LIGHT);
lab2.addStyleName("tab-content-header");

Expand All @@ -240,8 +243,9 @@ private VerticalLayout getIdentifiersVl(IHpClassDataProvider dataProvider) {
* PURLs
*/
Label lab3 = new Label("PURL");
lab3.setDescription("This is a persistent URL. Please see <a href='https://en.wikipedia.org/wiki/Persistent_uniform_resource_locator' target='_new'>"
+ "this wikipedia article</a> for more information on PURLs.");
lab3.setDescription(
"This is a persistent URL. Please see <a href='https://en.wikipedia.org/wiki/Persistent_uniform_resource_locator' target='_new'>"
+ "this wikipedia article</a> for more information on PURLs.");
lab3.addStyleName(ValoTheme.LABEL_LIGHT);
lab3.addStyleName("tab-content-header");
Label iriLabel = new Label("<a href='" + dataProvider.getIRI() + "' target='_new'>" + dataProvider.getIRI() + "</a>", ContentMode.HTML);
Expand Down Expand Up @@ -282,7 +286,8 @@ private VerticalLayout getDefinitionsVl(IHpClassDataProvider dataProvider) {
* Logical def
*/
Label lab2 = new Label("Logical definition");
lab2.setDescription("This is a computer readable logical definition of the HPO class. If you want to learn more about this please see <a href='http:https://nar.oxfordjournals.org/content/42/D1/D966.full' target='_new'>http:https://nar.oxfordjournals.org/content/42/D1/D966.full</a>.");
lab2.setDescription(
"This is a computer readable logical definition of the HPO class. If you want to learn more about this please see <a href='http:https://nar.oxfordjournals.org/content/42/D1/D966.full' target='_new'>http:https://nar.oxfordjournals.org/content/42/D1/D966.full</a>.");
lab2.addStyleName(ValoTheme.LABEL_LIGHT);
lab2.addStyleName("tab-content-header");

Expand Down Expand Up @@ -317,8 +322,8 @@ private VerticalLayout getSubSuperClassesVl(IHpClassDataProvider dataProvider) {
Collection<String> superClassesHtmlString = convertToHtml(superClasses, CONSTANTS.rootLocation);
Collection<String> subClassesHtmlString = convertToHtml(subClasses, CONSTANTS.rootLocation);

addLabelsSupSub(superClassesHtmlString, "Superclasses", vlSubSuperClasses);
addLabelsSupSub(subClassesHtmlString, "Subclasses", vlSubSuperClasses);
addLabelsSupSub(superClassesHtmlString, "Superclasses", vlSubSuperClasses, superClasses);
addLabelsSupSub(subClassesHtmlString, "Subclasses", vlSubSuperClasses, subClasses);

vlSubSuperClasses.addStyleName("tab-content-vl");
return vlSubSuperClasses;
Expand All @@ -328,7 +333,7 @@ private VerticalLayout getSuperClassesVl(IHpClassDataProvider dataProvider) {
VerticalLayout vlSubSuperClasses = new VerticalLayout();
Collection<OWLClass> superClasses = dataProvider.getSuperClasses();
Collection<String> superClassesHtmlString = convertToHtml(superClasses, CONSTANTS.rootLocation);
addLabelsSupSub(superClassesHtmlString, "Superclasses", vlSubSuperClasses);
addLabelsSupSub(superClassesHtmlString, "Superclasses", vlSubSuperClasses, superClasses);
vlSubSuperClasses.addStyleName("tab-content-vl");
return vlSubSuperClasses;
}
Expand All @@ -337,12 +342,13 @@ private VerticalLayout getSubClassesVl(IHpClassDataProvider dataProvider) {
VerticalLayout vlSubSuperClasses = new VerticalLayout();
Collection<OWLClass> subClasses = dataProvider.getSubClasses();
Collection<String> subClassesHtmlString = convertToHtml(subClasses, CONSTANTS.rootLocation);
addLabelsSupSub(subClassesHtmlString, "Subclasses", vlSubSuperClasses);
addLabelsSupSub(subClassesHtmlString, "Subclasses", vlSubSuperClasses, subClasses);
vlSubSuperClasses.addStyleName("tab-content-vl");
return vlSubSuperClasses;
}

private void addLabelsSupSub(Collection<String> superClassesHtmlString, String string, VerticalLayout vlSubSuperClasses) {
private void addLabelsSupSub(Collection<String> superClassesHtmlString, String string, VerticalLayout vlSubSuperClasses,
Collection<OWLClass> classes) {
/*
* Super or sub classes
*/
Expand All @@ -356,6 +362,14 @@ private void addLabelsSupSub(Collection<String> superClassesHtmlString, String s
vlSubSuperClasses.addComponent(labelSuperclasses);
}

// for (OWLClass c : classes) {
// String id = OboUtil.IRI2ID(c.getIRI());
// String label = hpData.getExtOwlOntology().getLabel(c.getIRI());
// Button b = new Button(label);
// b.addClickListener(new UpdatePageClickListener(id, label));
// vlSubSuperClasses.addComponent(b);
// }

}

private Collection<String> convertToHtml(Collection<OWLClass> classes, String oldLocation) {
Expand Down
23 changes: 23 additions & 0 deletions src/hpoweb/util/UpdatePageClickListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package hpoweb.util;

import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Notification;

public class UpdatePageClickListener implements ClickListener {

private String id;
private String label;

public UpdatePageClickListener(String id, String label) {
this.id = id;
this.label = label;

}

@Override
public void buttonClick(ClickEvent event) {
Notification.show(id + " " + label);
}

}

0 comments on commit 499f828

Please sign in to comment.