Skip to content

Commit dd32754

Browse files
committed
Had speed issue when launching EM directly from GSEA because command tool printed out task status updates to command tool. Got rid of all all iterative status update statements and changed it to one statement at the top so that the user can still see the progress of the build from the command tool (They can’t see them anymore when being built from the interface but the progress bar is still being updated.
1 parent f2d8955 commit dd32754

13 files changed

+61
-42
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/ExpressionFileReaderTask.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ public GeneExpressionMatrix parse() throws IOException {
112112
//expression
113113

114114
boolean twoColumns = false;
115-
115+
116+
116117

117118
HashSet<Integer> datasetGenes = dataset.getDatasetGenes();
118119
HashMap genes = dataset.getMap().getGenes();
@@ -126,6 +127,9 @@ public GeneExpressionMatrix parse() throws IOException {
126127
maxValue = lines.length;
127128
int expressionUniverse = 0;
128129

130+
if (taskMonitor != null)
131+
taskMonitor.setStatusMessage("Parsing GCT file - " + maxValue + " rows");
132+
129133
GeneExpressionMatrix expressionMatrix = dataset.getExpressionSets();
130134
//GeneExpressionMatrix expressionMatrix = new GeneExpressionMatrix(lines[0].split("\t"));
131135
//HashMap<Integer,GeneExpression> expression = new HashMap<Integer, GeneExpression>();
@@ -241,7 +245,6 @@ public GeneExpressionMatrix parse() throws IOException {
241245
// Calculate Percentage. This must be a value between 0..100.
242246
int percentComplete = (int) (((double) currentProgress / maxValue) * 100);
243247
taskMonitor.setProgress(percentComplete);
244-
taskMonitor.setStatusMessage("Parsing GCT file " + currentProgress + " of " + maxValue);
245248
}
246249
currentProgress++;
247250

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/GMTFileReaderTask.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ public void parse(TaskMonitor taskMonitor) throws IOException {
153153

154154
int currentProgress = 0;
155155
int maxValue = lines.length;
156+
157+
taskMonitor.setStatusMessage("Parsing GMT file - " + maxValue + " rows");
156158
try {
157159
for (int i = 0; i < lines.length; i++) {
158160
if (cancelled)
@@ -179,8 +181,7 @@ public void parse(TaskMonitor taskMonitor) throws IOException {
179181

180182
// Calculate Percentage. This must be a value between 0..100.
181183
int percentComplete = (int) (((double) currentProgress / maxValue) * 100);
182-
taskMonitor.setProgress(percentComplete);
183-
taskMonitor.setStatusMessage("Parsing GMT file " + currentProgress + " of " + maxValue);
184+
taskMonitor.setProgress(percentComplete);
184185
currentProgress++;
185186

186187
//All subsequent fields in the list are the geneset associated with this geneset.

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/ParseBingoEnrichmentResults.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ public void parseBingoFile(String [] lines){
128128
int currentProgress = 0;
129129
int maxValue = lines.length;
130130
boolean FDR = true;
131-
131+
if(taskMonitor != null)
132+
taskMonitor.setStatusMessage("Parsing Generic Results file -" + maxValue + " rows");
132133
//skip the first l9 which just has the field names (start i=1)
133134
//check to see how many columns the data has
134135

@@ -245,8 +246,7 @@ public void parseBingoFile(String [] lines){
245246
// Estimate Time Remaining
246247
long timeRemaining = maxValue - currentProgress;
247248
if (taskMonitor != null) {
248-
taskMonitor.setProgress(percentComplete);
249-
taskMonitor.setStatusMessage("Parsing Generic Results file " + currentProgress + " of " + maxValue);
249+
taskMonitor.setProgress(percentComplete);
250250
}
251251
currentProgress++;
252252

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/ParseDavidEnrichmentResults.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public void parseDavidFile(String [] lines){
124124

125125
int currentProgress = 0;
126126
int maxValue = lines.length;
127+
if(taskMonitor != null)
128+
taskMonitor.setStatusMessage("Parsing Generic Results file - " + maxValue + " rows");
129+
127130
boolean FDR = true;
128131

129132
//skip the first line which just has the field names (start i=1)
@@ -229,8 +232,7 @@ public void parseDavidFile(String [] lines){
229232
// Estimate Time Remaining
230233
long timeRemaining = maxValue - currentProgress;
231234
if (taskMonitor != null) {
232-
taskMonitor.setProgress(percentComplete);
233-
taskMonitor.setStatusMessage("Parsing Generic Results file " + currentProgress + " of " + maxValue);
235+
taskMonitor.setProgress(percentComplete);
234236
}
235237
currentProgress++;
236238

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/ParseGREATEnrichmentResults.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ public void parseGreatFile(String [] lines){
118118

119119
int currentProgress = 0;
120120
int maxValue = lines.length;
121+
if(taskMonitor != null)
122+
taskMonitor.setStatusMessage("Parsing Great Results file - " + maxValue + " rows");
121123
//for great files there is an FDR
122124
dataset.getMap().getParams().setFDR(true);
123125

@@ -287,10 +289,9 @@ else if ((hasBackground) && (!tokens[15].equalsIgnoreCase("")))
287289
int percentComplete = (int) (((double) currentProgress / maxValue) * 100);
288290
// Estimate Time Remaining
289291
long timeRemaining = maxValue - currentProgress;
290-
if (taskMonitor != null) {
292+
if (taskMonitor != null)
291293
taskMonitor.setProgress(percentComplete);
292-
taskMonitor.setStatusMessage("Parsing Great Results file " + currentProgress + " of " + maxValue);
293-
}
294+
294295
currentProgress++;
295296

296297
//check to see if the gene set has already been entered in the results

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/ParseGSEAEnrichmentResults.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public void parseGSEAFile(String[] lines){
103103

104104
int currentProgress = 0;
105105
int maxValue = lines.length;
106+
if(taskMonitor!=null)
107+
taskMonitor.setStatusMessage("Parsing Enrichment Results file - " + maxValue + " rows");
108+
106109
for (int i = 1; i < lines.length; i++) {
107110
String line = lines[i];
108111

@@ -172,11 +175,9 @@ public void parseGSEAFile(String[] lines){
172175
int percentComplete = (int) (((double) currentProgress / maxValue) * 100);
173176
// Estimate Time Remaining
174177
long timeRemaining = maxValue - currentProgress;
175-
if (taskMonitor != null) {
178+
if (taskMonitor != null)
176179
taskMonitor.setProgress(percentComplete);
177-
taskMonitor.setStatusMessage("Parsing Enrichment Results file " + currentProgress + " of " + maxValue);
178-
179-
}
180+
180181
currentProgress++;
181182

182183
results.put(Name, result);

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/ParseGenericEnrichmentResults.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ public void parseGenericFile(String [] lines){
106106

107107
int currentProgress = 0;
108108
int maxValue = lines.length;
109+
if(taskMonitor != null)
110+
taskMonitor.setStatusMessage("Parsing Generic Results file - " + maxValue + " rows");
109111
boolean FDR = false;
110112

111113
//skip the first line which just has the field names (start i=1)
@@ -295,10 +297,9 @@ else if(tokens[4].equalsIgnoreCase(downPhenotype))
295297
int percentComplete = (int) (((double) currentProgress / maxValue) * 100);
296298
// Estimate Time Remaining
297299
long timeRemaining = maxValue - currentProgress;
298-
if (taskMonitor != null) {
300+
if (taskMonitor != null)
299301
taskMonitor.setProgress(percentComplete);
300-
taskMonitor.setStatusMessage("Parsing Generic Results file " + currentProgress + " of " + maxValue);
301-
}
302+
302303
currentProgress++;
303304

304305
//check to see if the gene set has already been entered in the results

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/RanksFileReaderTask.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ public void parse(TaskMonitor taskMonitor) throws IOException {
152152
String[] lines = fullText.split("\r\n?|\n");
153153
int currentProgress = 0;
154154
maxValue = lines.length;
155+
if(taskMonitor != null)
156+
taskMonitor.setStatusMessage("Parsing Rank file - " + maxValue + " rows");
155157

156158
HashMap<String,Integer> genes = dataset.getMap().getGenes();
157159
// we don't know the number of scores in the rank file yet, but it can't be more than the number of lines.
@@ -266,8 +268,7 @@ else if(tokens.length == 2){
266268
// Calculate Percentage. This must be a value between 0..100.
267269
if (taskMonitor != null) {
268270
int percentComplete = (int) (((double) currentProgress / maxValue) * 100);
269-
taskMonitor.setProgress(percentComplete);
270-
taskMonitor.setStatusMessage("Parsing Rank file " + currentProgress + " of " + maxValue);
271+
taskMonitor.setProgress(percentComplete);
271272
}
272273
currentProgress++;
273274

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/BuildDiseaseSignatureTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ public void buildDiseaseSignature(TaskMonitor taskMonitor) {
180180
* and Enrichment Genesets. *
181181
****************************************************/
182182
int maxValue = SelectedSignatureGenesets.size() * EnrichmentGenesets.size();
183+
if(taskMonitor != null)
184+
taskMonitor.setStatusMessage("Computing Geneset similarity - " + maxValue + " rows");
183185
int currentProgress = 0;
184186
double currentNodeY_offset = paParams.getCurrentNodePlacementY_Offset();
185187
double currentNodeY_increment = 150.0;
@@ -240,7 +242,6 @@ public void buildDiseaseSignature(TaskMonitor taskMonitor) {
240242
// Estimate Time Remaining
241243
if (taskMonitor != null) {
242244
taskMonitor.setProgress(percentComplete);
243-
taskMonitor.setStatusMessage("Computing Geneset similarity " + currentProgress + " of " + maxValue);
244245
taskMonitor.setTitle("Post Analysis");
245246
}
246247
currentProgress++;

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/ComputeSimilarityTask.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ else if (type == SIGNATURE ){
136136

137137
int currentProgress = 0;
138138
int maxValue = genesetsOfInterest.size();
139+
if(taskMonitor != null)
140+
taskMonitor.setStatusMessage("Computing Geneset similarity - " + maxValue + " similarities");
139141

140142
//figure out if we need to compute edges for two different expression sets or one.
141143
int enrichment_set =0;
@@ -153,10 +155,9 @@ else if (type == SIGNATURE ){
153155
//int percentComplete = (int) (((double) currentProgress / maxValue) * 100);
154156
// Estimate Time Remaining
155157
long timeRemaining = maxValue - currentProgress;
156-
if (taskMonitor != null) {
157-
taskMonitor.setProgress((double) currentProgress / maxValue);
158-
taskMonitor.setStatusMessage("Computing Geneset similarity " + currentProgress + " of " + maxValue);
159-
}
158+
if (taskMonitor != null)
159+
taskMonitor.setProgress((double) currentProgress / maxValue);
160+
160161
currentProgress++;
161162

162163
String geneset1_name = i.next().toString();
@@ -239,18 +240,18 @@ else if(geneset_similarities.containsKey(similarity_key1) || geneset_similaritie
239240
genesetsInnerLoop = genesetsOfInterest_set2;
240241

241242
maxValue = genesetsOfInterest.size() + genesetsOfInterest_set2.size();
242-
243+
if(taskMonitor != null)
244+
taskMonitor.setStatusMessage("Computing Geneset similarity - " + maxValue + " similarities");
243245
//iterate through the each of the GSEA Results of interest - for the second set.
244246
for(Iterator i = genesetsOfInterest_set2.keySet().iterator(); i.hasNext(); ){
245247

246248
// Calculate Percentage. This must be a value between 0..100.
247249
int percentComplete = (int) (((double) currentProgress / maxValue) * 100);
248250
// Estimate Time Remaining
249251
long timeRemaining = maxValue - currentProgress;
250-
if (taskMonitor != null) {
251-
taskMonitor.setProgress((double) currentProgress / maxValue);
252-
taskMonitor.setStatusMessage("Computing Geneset similarity " + currentProgress + " of " + maxValue);
253-
}
252+
if (taskMonitor != null)
253+
taskMonitor.setProgress((double) currentProgress / maxValue);
254+
254255
currentProgress++;
255256

256257
String geneset1_name = i.next().toString();

0 commit comments

Comments
 (0)