|
8 | 8 | import java.nio.file.Paths;
|
9 | 9 | import java.util.ArrayList;
|
10 | 10 | import java.util.Arrays;
|
| 11 | +import java.util.Collection; |
11 | 12 | import java.util.Collections;
|
12 | 13 | import java.util.Comparator;
|
13 | 14 | import java.util.EnumMap;
|
@@ -103,22 +104,34 @@ private static List<DataSetParameters> createDataSets(Map<Type,List<Path>> types
|
103 | 104 |
|
104 | 105 | // All GSEA results are fine
|
105 | 106 | for(Path gseaFolder : types.get(Type.GSEA_FOLDER)) {
|
106 |
| - Optional<DataSetParameters> gseaDataSet = GSEAResolver.resolveGSEAResultsFolder(gseaFolder); |
107 |
| - if(gseaDataSet.isPresent()) |
108 |
| - dataSets.add(gseaDataSet.get()); |
| 107 | + GSEAResolver.resolveGSEAResultsFolder(gseaFolder).ifPresent(dataSets::add); |
109 | 108 | }
|
110 | 109 |
|
111 |
| - // Now, iterate over Enrichments, and try to pair up with Ranks and Expressions |
112 |
| - // MKTODO add other enrichment types |
| 110 | + // Now, process Enrichments, and try to pair up with Ranks and Expressions |
113 | 111 | List<Path> exprFiles = new ArrayList<>(types.get(Type.EXPRESSION));
|
114 | 112 | List<Path> rankFiles = new ArrayList<>(types.get(Type.RANKS));
|
115 | 113 | List<Path> clasFiles = new ArrayList<>(types.get(Type.CLASS));
|
116 | 114 | List<Path> gmtFiles = new ArrayList<>(types.get(Type.GENE_SETS));
|
117 | 115 |
|
118 |
| - // MKTODO what about other enrichment types? |
119 |
| - List<Path> enrichments = new ArrayList<>(); |
120 |
| - enrichments.addAll(types.get(Type.ENRICHMENT_GENERIC)); |
121 |
| - enrichments.addAll(types.get(Type.ENRICHMENT_ENRICHR)); |
| 116 | + dataSets.addAll(processEnrichments(types.get(Type.ENRICHMENT_GENERIC), Method.Generic, exprFiles, rankFiles, clasFiles, gmtFiles)); |
| 117 | + dataSets.addAll(processEnrichments(types.get(Type.ENRICHMENT_ENRICHR), Method.Generic, exprFiles, rankFiles, clasFiles, gmtFiles)); |
| 118 | + dataSets.addAll(processEnrichments(types.get(Type.ENRICHMENT_DAVID), Method.Specialized, exprFiles, rankFiles, clasFiles, gmtFiles)); |
| 119 | + dataSets.addAll(processEnrichments(types.get(Type.ENRICHMENT_BINGO), Method.Specialized, exprFiles, rankFiles, clasFiles, gmtFiles)); |
| 120 | + dataSets.addAll(processEnrichments(types.get(Type.ENRICHMENT_GREAT), Method.Specialized, exprFiles, rankFiles, clasFiles, gmtFiles)); |
| 121 | + |
| 122 | + return dataSets; |
| 123 | + } |
| 124 | + |
| 125 | + |
| 126 | + private static List<DataSetParameters> processEnrichments( |
| 127 | + Collection<Path> enrichments, |
| 128 | + Method method, |
| 129 | + List<Path> exprFiles, |
| 130 | + List<Path> rankFiles, |
| 131 | + List<Path> clasFiles, |
| 132 | + List<Path> gmtFiles |
| 133 | + ) { |
| 134 | + List<DataSetParameters> dataSets = new ArrayList<>(); |
122 | 135 |
|
123 | 136 | for(Path enrichment : enrichments) {
|
124 | 137 | Optional<Path> closestExpr = findClosestMatch(enrichment, exprFiles);
|
@@ -151,7 +164,7 @@ private static List<DataSetParameters> createDataSets(Map<Type,List<Path>> types
|
151 | 164 | });
|
152 | 165 |
|
153 | 166 | String name = getDatasetNameGeneric(enrichment.getFileName());
|
154 |
| - dataSets.add(new DataSetParameters(name, Method.Generic, files)); |
| 167 | + dataSets.add(new DataSetParameters(name, method, files)); |
155 | 168 | }
|
156 | 169 |
|
157 | 170 | return dataSets;
|
|
0 commit comments