Skip to content

Commit 94edca3

Browse files
committed
added support for a generic class file (need to add class file to documentation)
1 parent 7118d00 commit 94edca3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/EnrichmentMapInputPanel.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1848,9 +1848,24 @@ private String[] setClasses(String classFile){
18481848
String fullText2 = new Scanner(reader,"UTF-8").useDelimiter("\\A").next();
18491849

18501850
String[] lines2 = fullText2.split("\r\n?|\n");
1851+
1852+
/*
1853+
* GSEA class files will have 3 lines in the following format:
1854+
* 6 2 1
1855+
# R9C_8W WT_8W
1856+
R9C_8W R9C_8W R9C_8W WT_8W WT_8W WT_8W
1857+
1858+
If the file has 3 lines assume it is a GSEA and get the phenotypes from the third line.
1859+
If the file only has 1 line assume that it is a generic class file and get the phenotypes from the single line
1860+
1861+
*/
18511862

18521863
//the class file can be split by a space or a tab
1853-
String[] classes = lines2[2].split("\\s");
1864+
String[] classes=null;
1865+
if(lines2.length >= 3)
1866+
classes = lines2[2].split("\\s");
1867+
else if(lines2.length == 1)
1868+
classes = lines2[0].split("\\s");
18541869

18551870

18561871
//the third line of the class file defines the classes

0 commit comments

Comments
 (0)