-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from molgenis/fix/require_metadata
Add metadata json as a required parameter
- Loading branch information
Showing
11 changed files
with
854 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/main/java/org/molgenis/vcf/inheritance/matcher/util/VepMetadataServiceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package org.molgenis.vcf.inheritance.matcher.util; | ||
|
||
import org.molgenis.vcf.inheritance.matcher.model.Settings; | ||
import org.molgenis.vcf.utils.metadata.FieldMetadataService; | ||
|
||
public interface VepMetadataServiceFactory { | ||
FieldMetadataService create(); | ||
FieldMetadataService create(Settings settings); | ||
} |
32 changes: 3 additions & 29 deletions
32
src/main/java/org/molgenis/vcf/inheritance/matcher/util/VepMetadataServiceFactoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,19 @@ | ||
package org.molgenis.vcf.inheritance.matcher.util; | ||
|
||
import org.molgenis.vcf.inheritance.matcher.model.Settings; | ||
import org.molgenis.vcf.utils.metadata.FieldMetadataService; | ||
import org.molgenis.vcf.utils.metadata.FieldMetadataServiceImpl; | ||
import org.springframework.stereotype.Component; | ||
|
||
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 { | ||
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); | ||
public FieldMetadataService create(Settings settings) { | ||
return new FieldMetadataServiceImpl(settings.getMetadataPath().toFile()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.