Skip to content

Commit fcb7648

Browse files
committed
Added ability to open url when clicking on gene
1 parent 5131431 commit fcb7648

File tree

1 file changed

+16
-10
lines changed
  • gwasviewer/src/main/java/com/github/timeu/gwtlibs/gwasviewer/client

1 file changed

+16
-10
lines changed

gwasviewer/src/main/java/com/github/timeu/gwtlibs/gwasviewer/client/GWASViewer.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import com.google.gwt.canvas.dom.client.Context2d;
5353
import com.google.gwt.core.client.JsArrayMixed;
5454
import com.google.gwt.dom.client.NativeEvent;
55+
import com.google.gwt.user.client.Window;
5556
import com.google.gwt.user.client.ui.*;
5657

5758
import com.google.gwt.core.client.GWT;
@@ -78,19 +79,18 @@
7879
public class GWASViewer extends Composite implements RequiresResize {
7980

8081
private static Binder uiBinder = GWT.create(Binder.class);
81-
//private List<Track> tracks = new ArrayList<>();
82-
8382
interface Binder extends UiBinder<Widget, GWASViewer> { }
8483

8584
private static Logger logger = Logger.getLogger(GWASViewer.class.getCanonicalName());
8685

87-
8886
@UiField SimplePanel scatterChartContainer;
8987

90-
@UiField SimplePanel geneViewerContainer;
9188

89+
@UiField SimplePanel geneViewerContainer;
9290

9391
@UiField Label chromosomeLabel;
92+
93+
9494
@UiField GeneViewer geneViewer;
9595
@UiField LDViewer ldviewer;
9696
@UiField FlowPanel ldviewerContainer;
@@ -100,33 +100,35 @@ interface Binder extends UiBinder<Widget, GWASViewer> { }
100100
protected Dygraphs scatterChart;
101101
@UiField(provided=true) Resources mainRes;
102102
private DataView filteredView;
103-
104103
private final ScheduledCommand layoutCmd = new ScheduledCommand() {
105104
public void execute() {
106105
layoutScheduled = false;
107106
forceLayout();
108107
}
109108
};
110-
private boolean layoutScheduled = false;
111-
protected double maxValue;
112-
113109

110+
private boolean layoutScheduled = false;
111+
protected double maxValue;
114112
protected String[] color;
115113

114+
116115
protected String geneMarkerColor ="green";
117116

118117
protected int pointSize =3;
118+
119119
protected int highlightCircleSize = 4;
120120
protected int scatterChartHeight=200;
121121
protected DataTable dataTable;
122122
protected boolean isScatterChartLoaded = false;
123123
protected double pvalThreshold = -1 ;
124124
// use instance because getSelection() does not work in onUnderlay event, because date_graph is not properly initialized
125125
protected List<Integer> selections = new ArrayList<>();
126-
127126
//GenomeView settings
128127
protected Integer minZoomLevelForGenomeView = 1500000;
128+
129129
protected boolean isGeneViewerLoaded = false;
130+
//private List<Track> tracks = new ArrayList<>();
131+
private String geneInfoUrl;
130132

131133

132134
//LDViewer settings
@@ -429,6 +431,10 @@ public void onUnhighlightGene(UnhighlightGeneEvent event) {
429431
@Override
430432
public void onClickGene(ClickGeneEvent event) {
431433
fireEvent(event);
434+
if (geneInfoUrl != null) {
435+
Window.open(geneInfoUrl.replace("{0}",event.getGene().name),"Gene Info","");
436+
}
437+
432438
}
433439
});
434440
/*if (minZoomLevelForGenomeView >= (viewEnd- viewStart) && (viewEnd - viewStart) > 0) {
@@ -779,7 +785,7 @@ public void setGeneViewerHeight(int geneViewerHeight) {
779785
}
780786

781787
public void setGeneInfoUrl(String geneInfoUrl) {
782-
//geneViewer.setGeneInfoUrl(geneInfoUrl);
788+
this.geneInfoUrl = geneInfoUrl;
783789
}
784790

785791

0 commit comments

Comments
 (0)