Skip to content

Commit 16ec195

Browse files
committed
Improve labels for DAVID chart output.
Refs #265
1 parent f238065 commit 16ec195

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public void run(TaskMonitor taskMonitor) throws IOException {
3333

3434
List<String> lines = LineReader.readLines(dataset.getDataSetFiles().getEnrichmentFileName1());
3535

36-
//with David results there are no genesets defined. first pass through the file
37-
// needs to parse the genesets
36+
//with David results there are no genesets defined. first pass through the file needs to parse the genesets
3837

3938
//parameters that can be extracted from David files:
4039
//Category Term Count % PValue Genes List Total Pop Hits Pop Total Fold Enrichment Bonferroni Benjamini FDR
@@ -65,11 +64,9 @@ public void run(TaskMonitor taskMonitor) throws IOException {
6564
int length = tokens.length;
6665
if(length != 13)
6766
throw new IllegalThreadStateException("David results file is missing data.");
68-
//not enough data in the file!!
6967

7068
for(int i = 1; i < lines.size(); i++) {
7169
line = lines.get(i);
72-
7370
tokens = line.split("\t");
7471

7572
double pvalue = 1.0;
@@ -78,7 +75,9 @@ public void run(TaskMonitor taskMonitor) throws IOException {
7875
int gs_size = 0;
7976

8077
//The second column of the file is the name of the geneset
81-
String description = tokens[1].trim();
78+
String term = tokens[1].trim();
79+
String description = parseDescription(term);
80+
8281
String name = tokens[1].toUpperCase().trim();
8382

8483
//the first column of the file is the category
@@ -155,4 +154,17 @@ public void run(TaskMonitor taskMonitor) throws IOException {
155154
}
156155
}
157156

157+
158+
private static String parseDescription(String term) {
159+
int index = term.lastIndexOf('~');
160+
if(index >= 0) {
161+
term = term.substring(index+1);
162+
}
163+
index = term.lastIndexOf(':');
164+
if(index >= 0) {
165+
term = term.substring(index+1);
166+
}
167+
return term;
168+
}
169+
158170
}

0 commit comments

Comments
 (0)