Skip to content

Commit

Permalink
Merge pull request #61 from molgenis/feat/utils3.0.0
Browse files Browse the repository at this point in the history
Fix inheritance matcher broken when running as jar
  • Loading branch information
dennishendriksen authored Nov 27, 2024
2 parents af87e42 + ab0f516 commit 613bfb5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.molgenis</groupId>
<artifactId>vip-inheritance-matcher</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>

<name>vip-inheritance-matcher</name>
<description>Annotates VCF samples with mendelian violation and possible compound flags and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,41 @@
import org.molgenis.vcf.utils.metadata.FieldMetadataService;
import org.molgenis.vcf.utils.metadata.FieldMetadataServiceImpl;
import org.springframework.stereotype.Component;
import org.springframework.util.ResourceUtils;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

/**
* Quirky class to enable reuse of {@link FieldMetadataService} from vip-utils
*/
@Component
public class VepMetadataServiceFactoryImpl implements VepMetadataServiceFactory {
private static final String EMPTY_METADATA_JSON = """
{
"format": {
},
"info": {
"CSQ": {
"nestedFields": {
}
}
}
}
""";

@Override
@SuppressWarnings("java:S5443")
public FieldMetadataService create() {
File json;
try {
json = ResourceUtils.getFile("classpath:metadata.json");
} catch (FileNotFoundException e) {
Path path = Files.createTempFile("metadata", ".json");
byte[] buf = EMPTY_METADATA_JSON.getBytes(StandardCharsets.UTF_8);
Files.write(path, buf);
json = path.toFile();
json.deleteOnExit();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return new FieldMetadataServiceImpl(json);
Expand Down
10 changes: 0 additions & 10 deletions src/main/resources/metadata.json

This file was deleted.

0 comments on commit 613bfb5

Please sign in to comment.