@@ -33,8 +33,7 @@ public void run(TaskMonitor taskMonitor) throws IOException {
33
33
34
34
List <String > lines = LineReader .readLines (dataset .getDataSetFiles ().getEnrichmentFileName1 ());
35
35
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
38
37
39
38
//parameters that can be extracted from David files:
40
39
//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 {
65
64
int length = tokens .length ;
66
65
if (length != 13 )
67
66
throw new IllegalThreadStateException ("David results file is missing data." );
68
- //not enough data in the file!!
69
67
70
68
for (int i = 1 ; i < lines .size (); i ++) {
71
69
line = lines .get (i );
72
-
73
70
tokens = line .split ("\t " );
74
71
75
72
double pvalue = 1.0 ;
@@ -78,7 +75,9 @@ public void run(TaskMonitor taskMonitor) throws IOException {
78
75
int gs_size = 0 ;
79
76
80
77
//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
+
82
81
String name = tokens [1 ].toUpperCase ().trim ();
83
82
84
83
//the first column of the file is the category
@@ -155,4 +154,17 @@ public void run(TaskMonitor taskMonitor) throws IOException {
155
154
}
156
155
}
157
156
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
+
158
170
}
0 commit comments