Skip to content

Commit 7948e54

Browse files
committed
add clearGenomeStatsCache function and clear and reload the statistisc when the chromosome is changed
1 parent c1ccbd9 commit 7948e54

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/main/java/at/gmi/nordborglab/widgets/geneviewer/client/GeneViewer.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ public enum SHOW_RANGE_SELECTOR {None,Bottom,Top};
112112
protected DataTable stackableGenomeStatsCache = null;
113113
protected HashMap<GenomeStat,DataTable> nonstackableGenomeStatsCache = new HashMap<GenomeStat,DataTable>();
114114
protected Dygraphs.Options options = Dygraphs.Options.create();
115-
protected DataTable statisticsDataTable;
116115
protected int width_offset = 31;
117116

118117
private final ScheduledCommand layoutCmd = new ScheduledCommand() {
@@ -194,6 +193,8 @@ public void setViewRegion(int start, int end) {
194193
this.viewEnd = end;
195194
if (processing.isLoaded()) {
196195
processing.getInstance().setViewRegion(start, end);
196+
if (showStatsBand)
197+
drawStatistics();
197198
}
198199
}
199200

@@ -213,7 +214,14 @@ public void setRangeSelectorPosition(SHOW_RANGE_SELECTOR show_range_selector) {
213214

214215

215216
public void setChromosome(String chromosome) {
217+
boolean redrawStats = false;
218+
if (chromosome != null && !chromosome.equals(this.chromosome))
219+
redrawStats = true;
216220
this.chromosome = chromosome;
221+
if (redrawStats) {
222+
clearGenomeStatsCache();
223+
loadAndDisplayGenomeStats(true);
224+
}
217225
}
218226

219227
public void updateZoom(Integer start,Integer end) {
@@ -756,4 +764,9 @@ private void scheduledLayout() {
756764
Scheduler.get().scheduleDeferred(layoutCmd);
757765
}
758766
}
767+
768+
private void clearGenomeStatsCache() {
769+
stackableGenomeStatsCache = null;
770+
nonstackableGenomeStatsCache.clear();
771+
}
759772
}

0 commit comments

Comments
 (0)