Skip to content

Commit 95a3d4a

Browse files
committed
Resolve GSEA time-series files. Fixes #135.
1 parent 0792f7a commit 95a3d4a

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/SetOfGeneSets.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,8 @@ public int size() {
119119
public void clear() {
120120
geneSets.clear();
121121
}
122+
123+
public boolean isEmpty() {
124+
return geneSets.isEmpty();
125+
}
122126
}

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/resolver/GSEAResolver.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,21 +193,25 @@ private static String[] getRptPhenotypes(Map<String, String> params) {
193193
String phenotype1 = "na";
194194
String phenotype2 = "na";
195195

196-
if (classes != null && method.equalsIgnoreCase("Gsea")) {
196+
if(classes != null && method.equalsIgnoreCase("Gsea")) {
197197
String[] classes_split = classes.split("#");
198198
// only and try parse classes out of label if they are there
199-
if (classes_split.length >= 2) {
199+
if(classes_split.length >= 2) {
200200
String phenotypes = classes_split[1];
201201
String[] phenotypes_split = phenotypes.split("_versus_");
202-
if (phenotypes_split.length >= 2) {
202+
if(phenotypes_split.length >= 2) {
203203
phenotype1 = phenotypes_split[0];
204204
phenotype2 = phenotypes_split[1];
205205
}
206+
else if(phenotypes_split.length == 1) {
207+
phenotype1 = phenotypes_split[0] + "_pos";
208+
phenotype2 = phenotypes_split[0] + "_neg";
209+
}
206210
}
207-
} else if (method.equalsIgnoreCase("GseaPreranked")) {
211+
} else if(method.equalsIgnoreCase("GseaPreranked")) {
208212
phenotype1 = "na_pos";
209213
phenotype2 = "na_neg";
210-
if (params.containsKey("param phenotypes")) {
214+
if(params.containsKey("param phenotypes")) {
211215
String phenotypes = params.get("param phenotypes");
212216
String[] phenotypes_split = phenotypes.split("_versus_");
213217
if (phenotypes_split.length >= 2) {

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.baderlab.csplugins.enrichmentmap.model.GSEAResult;
5757
import org.baderlab.csplugins.enrichmentmap.model.GeneSet;
5858
import org.baderlab.csplugins.enrichmentmap.model.Ranking;
59+
import org.baderlab.csplugins.enrichmentmap.model.SetOfGeneSets;
5960
import org.baderlab.csplugins.enrichmentmap.util.DiscreteTaskMonitor;
6061
import org.baderlab.csplugins.enrichmentmap.util.NullTaskMonitor;
6162
import org.cytoscape.work.AbstractTask;
@@ -90,7 +91,7 @@ public void setThrowIfMissing(boolean throwIfMissing) {
9091
*
9192
* @return true if successful and false otherwise.
9293
*/
93-
public boolean initializeSets(TaskMonitor tm) {
94+
public void initializeSets(TaskMonitor tm) {
9495
if(tm == null)
9596
tm = new NullTaskMonitor();
9697
DiscreteTaskMonitor taskMonitor = new DiscreteTaskMonitor(tm, map.getDataSetCount());
@@ -120,7 +121,7 @@ public boolean initializeSets(TaskMonitor tm) {
120121

121122
//if there are no enrichment Results then do nothing
122123
if(enrichmentResults == null || enrichmentResults.isEmpty()) {
123-
return false;
124+
continue;
124125
}
125126

126127
//iterate through the GSEA Results to figure out which genesets we want to use
@@ -161,9 +162,12 @@ else if(throwIfMissing) {
161162
}
162163
}
163164

164-
// MKTODO clear all the genesets that are not "of interest" just to free up memory
165+
boolean empty = datasets.values().stream().map(EMDataSet::getGeneSetsOfInterest).allMatch(SetOfGeneSets::isEmpty);
166+
if(empty) {
167+
throw new IllegalArgumentException("None of the gene sets have passed the filter. Try relaxing the gene set filter parameters.");
168+
}
165169

166-
return true;
170+
// MKTODO clear all the genesets that are not "of interest" just to free up memory
167171
}
168172

169173
private void updateRankAtMax(GSEAResult current_result, Ranking ranks) {

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/MasterDetailDialogPage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public void finish() {
147147
}
148148
}
149149

150-
System.out.println(params);
150+
// System.out.println(params);
151151

152152
CreateEnrichmentMapTaskFactory taskFactory = taskFactoryFactory.create(params, dataSets);
153153
TaskIterator tasks = taskFactory.createTaskIterator();

0 commit comments

Comments
 (0)