diff --git a/pom.xml b/pom.xml index e1c29e8..e2ccf39 100644 --- a/pom.xml +++ b/pom.xml @@ -1,170 +1,171 @@ - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.2.2 - - + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + + - org.molgenis - vip-decision-tree - 4.1.1 + org.molgenis + vip-decision-tree + 4.1.2 - vip-decision-tree - Decision tree module for filtering and labelling VCF files + vip-decision-tree + Decision tree module for filtering and labelling VCF files - - - The GNU Lesser General Public License, Version 3.0 - http://www.gnu.org/licenses/lgpl-3.0.txt - repo - - + + + The GNU Lesser General Public License, Version 3.0 + http://www.gnu.org/licenses/lgpl-3.0.txt + repo + + - - scm:git:git://github.com/molgenis/vip-decision-tree.git - scm:git:ssh://git@github.com/molgenis/vip-decision-tree.git - - https://github.com/molgenis/vip-decision-tree - + + scm:git:git://github.com/molgenis/vip-decision-tree.git + scm:git:ssh://git@github.com/molgenis/vip-decision-tree.git + + https://github.com/molgenis/vip-decision-tree + - - GitHub - https://github.com/molgenis/vip-decision-tree/issues - + + GitHub + https://github.com/molgenis/vip-decision-tree/issues + - - 17 - 1.6.0 - 4.1.0 - 0.8.11 - 2.0.0 - + + 17 + 1.6.0 + 4.1.0 + 0.8.11 + 2.0.0 + - - - coverage - - - - org.jacoco - jacoco-maven-plugin - ${jacoco-maven-plugin.version} - - - prepare-agent - - prepare-agent - - - - report - - report - - - - - - - - + + + coverage + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + prepare-agent + + prepare-agent + + + + report + + report + + + + + + + + + + + + + org.molgenis + vip-utils + ${vip.utils.version} + + + commons-cli + commons-cli + ${commons.cli.version} + + + com.github.samtools + htsjdk + ${samtools.htsjdk.version} + + + - - - org.molgenis - vip-utils - ${vip.utils.version} - - - commons-cli - commons-cli - ${commons.cli.version} - - - com.github.samtools - htsjdk - ${samtools.htsjdk.version} - + + org.molgenis + vip-utils + + + org.springframework.boot + spring-boot-starter + + + org.projectlombok + lombok + provided + + + commons-cli + commons-cli + + + com.fasterxml.jackson.core + jackson-databind + + + com.github.samtools + htsjdk + + + org.springframework.boot + spring-boot-starter-test + test + - - - - org.molgenis - vip-utils - - - org.springframework.boot - spring-boot-starter - - - org.projectlombok - lombok - provided - - - commons-cli - commons-cli - - - com.fasterxml.jackson.core - jackson-databind - - - com.github.samtools - htsjdk - - - org.springframework.boot - spring-boot-starter-test - test - - + + vcf-decision-tree - - vcf-decision-tree + + + + org.apache.maven.plugins + maven-compiler-plugin + + + -Xlint + -Xlint:-processing + + + + + + - - - - org.apache.maven.plugins - maven-compiler-plugin - - - -Xlint - -Xlint:-processing - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - org.projectlombok - lombok - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - + + + org.springframework.boot + spring-boot-maven-plugin + + + + + org.projectlombok + lombok + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + diff --git a/src/main/java/org/molgenis/vcf/decisiontree/loader/ConfigDecisionTreeLoaderImpl.java b/src/main/java/org/molgenis/vcf/decisiontree/loader/ConfigDecisionTreeLoaderImpl.java index 56ac46d..fc76972 100644 --- a/src/main/java/org/molgenis/vcf/decisiontree/loader/ConfigDecisionTreeLoaderImpl.java +++ b/src/main/java/org/molgenis/vcf/decisiontree/loader/ConfigDecisionTreeLoaderImpl.java @@ -23,7 +23,7 @@ public ConfigDecisionTree load(Path decisionTreeConfigPath) { ObjectMapper mapper = new ObjectMapper(); SimpleModule module = new SimpleModule(); module.addDeserializer(ConfigNode.class, new ConfigNodeDeserializer()); - module.addDeserializer(Path.class, new PathDeserializer()); + module.addDeserializer(Path.class, new PathDeserializer(decisionTreeConfigPath)); mapper.registerModule(module); ConfigDecisionTree configDecisionTree; diff --git a/src/main/java/org/molgenis/vcf/decisiontree/loader/PathDeserializer.java b/src/main/java/org/molgenis/vcf/decisiontree/loader/PathDeserializer.java index df1e5ab..2d4204e 100644 --- a/src/main/java/org/molgenis/vcf/decisiontree/loader/PathDeserializer.java +++ b/src/main/java/org/molgenis/vcf/decisiontree/loader/PathDeserializer.java @@ -8,12 +8,24 @@ import java.io.IOException; import java.nio.file.Path; +import static java.util.Objects.requireNonNull; + public class PathDeserializer extends JsonDeserializer { + private final Path rootPath; + + public PathDeserializer(Path decisionTreeConfigPath) { + this.rootPath = requireNonNull(decisionTreeConfigPath); + } + @Override public Path deserialize(JsonParser jp, DeserializationContext context) throws IOException { ObjectCodec objectCodec = jp.getCodec(); ObjectNode root = objectCodec.readTree(jp); String pathString = root.get("path").asText(); - return Path.of(pathString); + Path path = Path.of(pathString); + if (!path.isAbsolute()) { + path = Path.of(rootPath.getParent().toString(), pathString).normalize(); + } + return path; } } diff --git a/src/test/resources/example.json b/src/test/resources/example.json index 1eafa6f..1b5c29d 100644 --- a/src/test/resources/example.json +++ b/src/test/resources/example.json @@ -1,7 +1,7 @@ { "files": { "clinvar" : { - "path" : "src/test/resources/clinvar.txt" + "path" : "clinvar.txt" } }, "rootNode": "filter",