Skip to content

Commit

Permalink
Resove #29: enrichment tool tweaks
Browse files Browse the repository at this point in the history
- BP is default
- Add links to gene symbols
- Reorganize elements
- Add a genes backing top terms section
- Clicking similarity chart now changes table data
- Fix tooltips and dialog sigfigs in stab. chart
- Add more contextual help to stability chart
- Easier to see when buttons are selected
  • Loading branch information
JacobsonMT committed Mar 22, 2018
1 parent 6d807f1 commit 52af450
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public class EnrichmentAnalysisOptions {
private int maxAnnotatedPopulation = 200; // maximum geneset size a specific term must have to be included in results
private MultipleTestCorrection multipleTestCorrection = MultipleTestCorrection.BH; // method of multiple tests correction
private double threshold = 0.05; // tEither p-value cutoff if using Bonferroni or FDR level if using BH step-up
private List<Aspect> aspects = Lists.newArrayList( Aspect.values() ); // Aspect restriction
private List<Aspect> aspects = Lists.newArrayList( Aspect.BP ); // Aspect restriction
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,17 @@

package ubc.pavlab.gotrack.analysis;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.log4j.Logger;

import com.google.common.collect.Iterables;

import org.apache.log4j.Logger;
import ubc.pavlab.gotrack.beans.Cache;
import ubc.pavlab.gotrack.model.Edition;
import ubc.pavlab.gotrack.model.Gene;
import ubc.pavlab.gotrack.model.go.GeneOntologyTerm;
import ubc.pavlab.gotrack.utilities.Jaccard;
import ubc.pavlab.gotrack.utilities.Tversky;

import java.util.*;

/**
* Calculates scores which attempt to explore the impact that annotation similarity has on the performance of
* gene set enrichment analyses. The methods of exploration for similarity compare previous annotations for each gene
Expand Down Expand Up @@ -185,7 +177,7 @@ public Map<Edition, SimilarityScore> getSimilarityScores() {
return similarityScores;
}

public SimilarityScore getSimilarityScores( Edition ed ) {
public SimilarityScore getSimilarityScore( Edition ed ) {
if ( ed == null ) return null;
return similarityScores.get( ed );
}
Expand Down
18 changes: 7 additions & 11 deletions gotrack/src/main/java/ubc/pavlab/gotrack/beans/EnrichmentView.java
Original file line number Diff line number Diff line change
Expand Up @@ -736,15 +736,6 @@ private Map<Edition, Map<GeneOntologyTerm, EnrichmentResult>> filter( Set<GeneOn

}

/**
* Entry point for retrieving data on click of similarity chart
*/
public void fetchSimilarityInformation() {
Integer edition = Integer.valueOf(
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get( "edition" ) );
Edition ed = cache.getEdition( selectedSpecies, edition );
selectedSimilarityScore = combinedAnalysis.getSimilarityAnalysis().getSimilarityScores( ed );
}

/**
* Used for clicks on data points in enrichment/stability chart
Expand Down Expand Up @@ -792,15 +783,20 @@ private void resetFetchTermInformation() {
selectedValueName = null;
}

// Enrichment Table ---------------------------------------------------------------------------------------

public void loadEnrichmentTableData() {
/**
* Used for clicks on data points in term/similarity charts
*/
public void loadTableData() {
Integer edition = Integer.valueOf(
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get( "edition" ) );
Edition ed = cache.getEdition( selectedSpecies, edition );
loadEnrichmentTableData( ed );
selectedSimilarityScore = combinedAnalysis.getSimilarityAnalysis().getSimilarityScore( ed );
}

// Enrichment Table ---------------------------------------------------------------------------------------

/**
* Prepares data for enrichment table
*/
Expand Down
229 changes: 107 additions & 122 deletions gotrack/src/main/webapp/enrichment.xhtml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<composite:implementation>
<p:dataTable id="enrichmentTable" widgetVar="tableEnrichmentWdg"
var="entry" value="#{cc.attrs.value}"
sortMode="multiple" style="margin-bottom:0"
sortMode="multiple" style="margin-bottom:0;max-height: 225px;"
emptyMessage="No enrichment data found for selected edition"
filteredValue="#{cc.attrs.filteredValue}"
rowStyleClass="#{entry.significant == true ? 'significant' : 'not-significant'}"
styleClass="ui-table-exporter-align-right ui-table-graph-float-left"
scrollable="true" scrollHeight="300"
scrollable="true"
selectionMode="multiple"
selection="#{cc.attrs.selection}"
rowKey="#{entry.term.goId}"
Expand All @@ -37,23 +37,6 @@
<p:ajax event="filter"
oncomplete="postAjaxSortTable(PF('tableEnrichmentWdg'))"/>

<f:facet name="header">
<p:overlayPanel for="tableHelpBtn" hideEffect="fade" appendToBody="true">
<div class="overlay-help">
<p>This table shows enrichment data for those terms that were significantly enriched in this edition as well as those that were significant at some point in their history.</p>
<p>
This means that not every term in the table is significant at the currently chosen edition, but it was necessarily significant as some point.
</p>
</div>
</p:overlayPanel>
<p:commandButton id="tableHelpBtn" value=""
styleClass="no-value no-background fa-fix noupdate"
icon="fa fa-question-circle" type="button"
style="vertical-align: text-top;float: left;"/>
<p:outputPanel id="headerPanel" rendered="#{cc.attrs.header != null}">
<h:outputText value="#{cc.attrs.header}"/>
</p:outputPanel>
</f:facet>

<f:facet name="footer">
<!-- &#8203 is a zero-width space so that the div container leaves space for the status text -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<composite:implementation>

<p:dataTable var="gene" value="#{cc.attrs.value}" emptyMessage="No genes found." style="width:100%;" scrollable="true">
<p:dataTable var="gene" value="#{cc.attrs.value}" emptyMessage="No genes found." style="width:100%;max-height: 200px;" scrollable="true" scrollRows="25">
<p:column headerText="Symbol" style="width:120px;">
<a href="http://www.uniprot.org/uniprot/#{gene.accession.accession}"
target="_blank" style="margin-right: 5px; text-decoration: none;">
Expand Down
7 changes: 7 additions & 0 deletions gotrack/src/main/webapp/resources/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,11 @@ div.inline {
.ui-rowgroup-header.ui-datatable-headerrow.ui-widget-header > td {
padding-top: 10px;
padding-bottom: 10px;
}
/* Easier to see when button is selected */
div.ui-selectmanybutton > div.ui-button.ui-widget.ui-state-default.ui-button-text-only {
color: rgba(0, 0, 0, 0.4);
}
div.ui-selectmanybutton > div.ui-button.ui-widget.ui-state-default.ui-button-text-only.ui-state-active {
color: inherit;
}
4 changes: 2 additions & 2 deletions gotrack/src/main/webapp/resources/css/enrichment.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ table.no-border, table.no-border tr, table.no-border td {
line-height: 16px;
}

#left li.ui-datalist-item > span {
#left li.ui-datalist-item > span, #left li.ui-datalist-item > a {
display: inline-block;
vertical-align: middle;
}

#left li.ui-datalist-item > a {
#left li.ui-datalist-item > a.ui-icon {
display: inline-block;
vertical-align: sub;
margin-right: 10px;
Expand Down
38 changes: 16 additions & 22 deletions gotrack/src/main/webapp/resources/js/enrichment.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ function createTermsChart(xhr, status, args) {
var options = plotting.defaultHCOptions('hc_terms_container', args.HC_terms.chart);
commonOptions(options, args.HC);

options.xAxis.crosshair = {
width: 1,
color: 'red',
dashStyle: 'shortdot'
};

options.subtitle = {
text: "<b>&lt;Click&gt;</b> to view enrichment results at a specific date.",
style: {"font-size": "10px"}
Expand All @@ -180,20 +174,6 @@ function createSimilarityChart(xhr, status, args) {

// options.yAxis.minorTickInterval = 0.05;

options.chart.events = {
click: function (event) {
fetchSimilarityInformation([{name: 'edition', value: GLOBALS.dateToEdition[this.hoverPoint.x]}]);
}
};

options.plotOptions.series.point = {
events: {
click: function () {
fetchSimilarityInformation([{name: 'edition', value: GLOBALS.dateToEdition[this.x]}]);
}
}
};

options.tooltip.pointFormatter = function () {
return '<span style="color:' + this.color + '">\u25CF</span> ' + this.series.name + ': <b>' + utility.sigFigs(this.y, 2) + '</b><br/>';
}
Expand Down Expand Up @@ -255,6 +235,12 @@ function commonOptions(options, config) {
clickBehaviour(event, p);
}
};

options.xAxis.crosshair = {
width: 1,
color: 'red',
dashStyle: 'shortdot'
};
}

function handleGraphSelected(xhr, status, args) {
Expand Down Expand Up @@ -584,7 +570,15 @@ function handleGraphSelected(xhr, status, args) {
// We bypass this via a string type adaptor for Infinity and NaN
for (var key in dateToStabilityScore) {
if (dateToStabilityScore.hasOwnProperty(key)) {
dateToStabilityScore[key] = Number(dateToStabilityScore[key]);
var stabilityScore = dateToStabilityScore[key];
if (stabilityScore === 'Infinity') {
stabilityScore = 'No Change';
} else if (stabilityScore === 'NaN') {
stabilityScore = 'No Data';
} else {
stabilityScore = utility.sigFigs(stabilityScore, 3)
}
dateToStabilityScore[key] = stabilityScore;
}
}

Expand All @@ -598,7 +592,7 @@ function handleGraphSelected(xhr, status, args) {
'</p><p>Date: ' + new Date(this.x).toLocaleDateString() +
"</p><p>Edition: " + GLOBALS.dateToEdition[this.x] +
"</p><p>P-value: " + utility.sigFigs(this.y, 3) +
"</p><p>Stability Score: " + utility.sigFigs(dateToStabilityScore[this.x], 3) +
"</p><p>Stability Score: " + dateToStabilityScore[this.x] +
"</p>";
}
}
Expand Down

0 comments on commit 52af450

Please sign in to comment.