Skip to content

Commit 10ff224

Browse files
authored
Merge pull request #108 from sanctuuary/cwl_output
Improve CWL support + refactor
2 parents 6ad74cf + 57dbe4a commit 10ff224

File tree

23 files changed

+199
-294
lines changed

23 files changed

+199
-294
lines changed

.github/workflows/mvnbuild.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
cd domain-annotations/WombatP_tools
4040
java -jar ../../target/APE-*-executable.jar ./config.json
4141
cd ./CWL
42-
cwltool --enable-dev --validate candidate_solution_1.cwl
42+
cwltool --enable-dev --validate candidate_workflow_1.cwl
4343
4444
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
4545
- name: Update dependency graph

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,6 @@ nb-configuration.xml
8484
##############################
8585
.DS_Store
8686
/lib/
87+
solutions.txt
88+
CWL/*
89+
Figures/*

pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>io.github.sanctuuary</groupId>
66
<artifactId>APE</artifactId>
7-
<version>2.2.6</version>
7+
<version>2.3.0</version>
88
<packaging>jar</packaging>
99
<name>io.github.sanctuuary:APE</name>
1010
<description>APE is a command line tool and an API for the automated exploration of possible computational pipelines (workflows) from large collections of computational tools.</description>
@@ -164,12 +164,12 @@
164164
<dependency>
165165
<groupId>org.apache.commons</groupId>
166166
<artifactId>commons-lang3</artifactId>
167-
<version>3.13.0</version>
167+
<version>3.14.0</version>
168168
</dependency>
169169
<dependency>
170170
<groupId>org.apache.logging.log4j</groupId>
171171
<artifactId>log4j-core</artifactId>
172-
<version>2.20.0</version>
172+
<version>2.22.1</version>
173173
</dependency>
174174
<dependency>
175175
<groupId>guru.nidi</groupId>
@@ -180,7 +180,7 @@
180180
<dependency>
181181
<groupId>org.json</groupId>
182182
<artifactId>json</artifactId>
183-
<version>20231013</version>
183+
<version>20240205</version>
184184
</dependency>
185185
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
186186
<dependency>
@@ -192,12 +192,12 @@
192192
<dependency>
193193
<groupId>org.slf4j</groupId>
194194
<artifactId>slf4j-api</artifactId>
195-
<version>2.0.9</version>
195+
<version>2.0.12</version>
196196
</dependency>
197197
<dependency>
198198
<groupId>org.slf4j</groupId>
199199
<artifactId>slf4j-simple</artifactId>
200-
<version>2.0.9</version>
200+
<version>2.0.12</version>
201201
</dependency>
202202
<!-- https://mvnrepository.com/artifact/org.antlr/antlr4-runtime -->
203203
<dependency>
@@ -214,7 +214,7 @@
214214
<dependency>
215215
<groupId>commons-io</groupId>
216216
<artifactId>commons-io</artifactId>
217-
<version>2.14.0</version>
217+
<version>2.15.1</version>
218218
</dependency>
219219
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
220220
<dependency>

src/main/java/nl/uu/cs/ape/APE.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -137,21 +137,7 @@ private boolean setupDomain() throws APEDimensionsException, IOException, OWLOnt
137137

138138
// Update allModules and allTypes sets based on the tool annotations
139139
succRun &= apeDomainSetup
140-
.updateToolAnnotationsFromJson(APEFiles.readFileToJSONObject(config.getToolAnnotationsFile()));
141-
142-
// Update allModules with CWL annotations, if CWL annotations file is given
143-
if (config.getCwlAnnotationsFile().isPresent()) {
144-
try {
145-
Yaml yaml = new Yaml();
146-
File file = config.getCwlAnnotationsFile().get();
147-
Map<String, Object> cwlAnnotations = yaml.load(new FileInputStream(file));
148-
succRun &= apeDomainSetup
149-
.updateCWLAnnotationsFromYaml(cwlAnnotations);
150-
} catch (FileNotFoundException e) {
151-
log.error("Could not find CWL yaml configuration file!");
152-
e.printStackTrace();
153-
}
154-
}
140+
.annotateToolFromJson(APEFiles.readFileToJSONObject(config.getToolAnnotationsFile()));
155141

156142
succRun &= apeDomainSetup.trimTaxonomy();
157143

src/main/java/nl/uu/cs/ape/automaton/Block.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Block {
2727
* @param blockNumber The block number.
2828
*/
2929
public Block(int blockNumber) {
30-
typeStates = new ArrayList<State>();
30+
typeStates = new ArrayList<>();
3131
this.blockNumber = blockNumber;
3232
}
3333

src/main/java/nl/uu/cs/ape/automaton/ModuleAutomaton.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class ModuleAutomaton implements Automaton {
3131
* modules).
3232
*/
3333
public ModuleAutomaton(int automataBound, int inputBranching, int outputBranching) {
34-
moduleStates = new ArrayList<State>();
34+
moduleStates = new ArrayList<>();
3535
automataBound = Math.max(automataBound, 1);
3636

3737
for (int i = 1; i <= automataBound; i++) {

src/main/java/nl/uu/cs/ape/automaton/TypeAutomaton.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public class TypeAutomaton implements Automaton {
5454
* modules)
5555
*/
5656
public TypeAutomaton(int automataBound, int inputBranching, int outputBranching) {
57-
memoryTypesAutomaton = new ArrayList<Block>();
58-
usedTypesAutomaton = new ArrayList<Block>();
57+
memoryTypesAutomaton = new ArrayList<>();
58+
usedTypesAutomaton = new ArrayList<>();
5959
nullState = new State(null, null, -1, inputBranching, outputBranching);
6060

6161
automataBound = automataBound < 1 ? 1 : automataBound;
@@ -105,7 +105,7 @@ public List<Block> getMemoryTypesBlocks() {
105105
* @return Blocks of data types used by tools.
106106
*/
107107
public List<Block> getAllBlocks() {
108-
List<Block> allBlocks = new ArrayList<Block>(usedTypesAutomaton);
108+
List<Block> allBlocks = new ArrayList<>(usedTypesAutomaton);
109109
allBlocks.addAll(memoryTypesAutomaton);
110110
return allBlocks;
111111
}
@@ -224,7 +224,7 @@ public Block getMemoryTypesBlock(int i) {
224224
* @return List of memory States.
225225
*/
226226
public List<State> getMemoryStatesUntilBlockNo(int maxBlockNo) {
227-
List<State> untilStates = new ArrayList<State>();
227+
List<State> untilStates = new ArrayList<>();
228228
for (int i = 0; i <= maxBlockNo && i < this.usedTypesAutomaton.size(); i++) {
229229
Block currBlock = this.getMemoryTypesBlock(i);
230230
for (State currState : currBlock.getStates()) {
@@ -244,7 +244,7 @@ public List<State> getMemoryStatesUntilBlockNo(int maxBlockNo) {
244244
* @return List of Type States.
245245
*/
246246
public List<State> getAllStatesUntilBlockNo(int maxBlockNo) {
247-
List<State> untilStates = new ArrayList<State>();
247+
List<State> untilStates = new ArrayList<>();
248248
for (int i = 0; i <= maxBlockNo && i < this.usedTypesAutomaton.size(); i++) {
249249
Block currBlock = this.usedTypesAutomaton.get(i);
250250
for (State currState : currBlock.getStates()) {
@@ -268,7 +268,7 @@ public List<State> getAllStatesUntilBlockNo(int maxBlockNo) {
268268
* @return List of Memory Type States.
269269
*/
270270
public List<State> getAllMemoryStatesUntilBlockNo(int maxBlockNo) {
271-
List<State> untilStates = new ArrayList<State>();
271+
List<State> untilStates = new ArrayList<>();
272272
for (int i = 0; i <= maxBlockNo && i < this.usedTypesAutomaton.size(); i++) {
273273
Block currBlock = this.memoryTypesAutomaton.get(i);
274274
for (State currState : currBlock.getStates()) {
@@ -287,7 +287,7 @@ public List<State> getAllMemoryStatesUntilBlockNo(int maxBlockNo) {
287287
* @return List of memory States.
288288
*/
289289
public List<State> getMemoryStatesAfterBlockNo(int minBlockNo) {
290-
List<State> afterStates = new ArrayList<State>();
290+
List<State> afterStates = new ArrayList<>();
291291
for (int i = minBlockNo + 1; i < this.memoryTypesAutomaton.size(); i++) {
292292
Block currBlock = this.getMemoryTypesBlock(i);
293293
for (State currState : currBlock.getStates()) {
@@ -307,7 +307,7 @@ public List<State> getMemoryStatesAfterBlockNo(int minBlockNo) {
307307
* @return List of Used States.
308308
*/
309309
public List<State> getUsedStatesAfterBlockNo(int minBlockNo) {
310-
List<State> afterStates = new ArrayList<State>();
310+
List<State> afterStates = new ArrayList<>();
311311
for (int i = minBlockNo + 1; i < this.usedTypesAutomaton.size(); i++) {
312312
Block currBlock = this.usedTypesAutomaton.get(i);
313313
for (State currState : currBlock.getStates()) {
@@ -324,7 +324,7 @@ public List<State> getUsedStatesAfterBlockNo(int minBlockNo) {
324324
*/
325325
@Override
326326
public List<State> getAllStates() {
327-
List<State> allStates = new ArrayList<State>();
327+
List<State> allStates = new ArrayList<>();
328328
for (Block currBlock : getAllBlocks()) {
329329
for (State currState : currBlock.getStates()) {
330330
allStates.add(currState);
@@ -339,7 +339,7 @@ public List<State> getAllStates() {
339339
* @return List of memory type states.
340340
*/
341341
public List<State> getAllMemoryTypesStates() {
342-
List<State> allMemoryStates = new ArrayList<State>();
342+
List<State> allMemoryStates = new ArrayList<>();
343343
for (Block currBlock : getMemoryTypesBlocks()) {
344344
for (State currState : currBlock.getStates()) {
345345
allMemoryStates.add(currState);
@@ -354,7 +354,7 @@ public List<State> getAllMemoryTypesStates() {
354354
* @return List of used type states.
355355
*/
356356
public List<State> getAllUsedTypesStates() {
357-
List<State> allUsedStates = new ArrayList<State>();
357+
List<State> allUsedStates = new ArrayList<>();
358358
for (Block currBlock : getUsedTypesBlocks()) {
359359
for (State currState : currBlock.getStates()) {
360360
allUsedStates.add(currState);

src/main/java/nl/uu/cs/ape/configuration/APECoreConfig.java

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ public class APECoreConfig {
6060
* restrictive message passing structure.
6161
*/
6262
public final APEConfigTag<Boolean> STRICT_TOOL_ANNOTATIONS = new APEConfigTagFactory.TAGS.STRICT_TOOL_ANNOTATIONS();
63-
/**
64-
* The CWL file with all CWL annotations.
65-
*/
66-
public final APEConfigTag<File> CWL_ANNOTATIONS = new APEConfigTagFactory.TAGS.CWL_ANNOTATIONS();
6763

6864
/**
6965
* All the Tags specified in this class. Should be in correct order of
@@ -75,8 +71,7 @@ public class APECoreConfig {
7571
this.TOOL_ONTOLOGY_ROOT,
7672
this.DIMENSIONS_ONTOLOGY,
7773
this.TOOL_ANNOTATIONS,
78-
this.STRICT_TOOL_ANNOTATIONS,
79-
this.CWL_ANNOTATIONS
74+
this.STRICT_TOOL_ANNOTATIONS
8075
};
8176

8277
/**
@@ -89,8 +84,7 @@ public class APECoreConfig {
8984
new TOOL_ONTOLOGY_ROOT(null),
9085
new DIMENSIONS_ONTOLOGY(null),
9186
new TOOL_ANNOTATIONS(),
92-
new STRICT_TOOL_ANNOTATIONS(),
93-
new CWL_ANNOTATIONS());
87+
new STRICT_TOOL_ANNOTATIONS());
9488

9589
/**
9690
* Initialize the configuration of the project.
@@ -317,19 +311,6 @@ public void setToolAnnotationsFile(File toolAnnotations) {
317311
TOOL_ANNOTATIONS.setValue(toolAnnotations);
318312
}
319313

320-
/**
321-
* Gets CWL annotations path.
322-
*
323-
* @return the value of tag {@link #TOOL_ANNOTATIONS}
324-
*/
325-
public Optional<File> getCwlAnnotationsFile() {
326-
if (CWL_ANNOTATIONS.getValue() == null) {
327-
return Optional.empty();
328-
} else {
329-
return Optional.of(CWL_ANNOTATIONS.getValue());
330-
}
331-
}
332-
333314
/**
334315
* Get information whether the domain was annotated under the strict rules of
335316
* the output dependency.

src/main/java/nl/uu/cs/ape/configuration/ToolAnnotationTag.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ public enum ToolAnnotationTag {
3535
*/
3636
OUTPUTS("outputs"),
3737

38+
/**
39+
* Represents the implementation details of a tool.
40+
*/
41+
CWL_REFERENCE("cwl_reference"),
42+
43+
3844
/**
3945
* Represents the implementation details of a tool.
4046
*/

src/main/java/nl/uu/cs/ape/configuration/tags/APEConfigTagFactory.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -656,37 +656,6 @@ public APEConfigDefaultValue<File> getDefault() {
656656
}
657657
}
658658

659-
/**
660-
* Configuration field.
661-
*/
662-
public static class CWL_ANNOTATIONS extends TYPES.ExistingFile {
663-
664-
@Override
665-
protected APEFiles.Permission[] getRequiredPermissions() {
666-
return new APEFiles.Permission[] { APEFiles.Permission.READ };
667-
}
668-
669-
@Override
670-
public String getTagName() {
671-
return "cwl_annotations_path";
672-
}
673-
674-
@Override
675-
public String getLabel() {
676-
return "CWL annotations";
677-
}
678-
679-
@Override
680-
public String getDescription() {
681-
return "This tag should be a path to an existing .yaml file.";
682-
}
683-
684-
@Override
685-
public APEConfigDefaultValue<File> getDefault() {
686-
return APEConfigDefaultValue.withDefault(null);
687-
}
688-
}
689-
690659
/**
691660
* Configuration field.
692661
*/

0 commit comments

Comments
 (0)