diff --git a/pom.xml b/pom.xml index c43e402..41ddb1a 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.molgenis vip-inheritance-matcher - 3.3.0 + 3.3.1 vip-inheritance-matcher Annotates VCF samples with mendelian violation and possible compound flags and diff --git a/src/main/java/org/molgenis/vcf/inheritance/matcher/util/VepMetadataServiceFactoryImpl.java b/src/main/java/org/molgenis/vcf/inheritance/matcher/util/VepMetadataServiceFactoryImpl.java index 89eee2a..35f847d 100644 --- a/src/main/java/org/molgenis/vcf/inheritance/matcher/util/VepMetadataServiceFactoryImpl.java +++ b/src/main/java/org/molgenis/vcf/inheritance/matcher/util/VepMetadataServiceFactoryImpl.java @@ -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); diff --git a/src/main/resources/metadata.json b/src/main/resources/metadata.json deleted file mode 100644 index 7d0e490..0000000 --- a/src/main/resources/metadata.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "format": { - }, - "info": { - "CSQ": { - "nestedFields": { - } - } - } -} \ No newline at end of file