-
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 #87 from molgenis/chore/refactor_metadata
CLI: add option -m / --metadata (rename -m / --mode to -t /--type)
- Loading branch information
Showing
16 changed files
with
651 additions
and
105 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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/org/molgenis/vcf/decisiontree/runner/VepHelper.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
7 changes: 7 additions & 0 deletions
7
src/main/java/org/molgenis/vcf/decisiontree/runner/info/VepMetadataMapperFactory.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.molgenis.vcf.decisiontree.runner.info; | ||
|
||
import org.molgenis.vcf.decisiontree.Settings; | ||
|
||
public interface VepMetadataMapperFactory { | ||
VepMetadataMapper create(Settings settings); | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/org/molgenis/vcf/decisiontree/runner/info/VepMetadataMapperFactoryImpl.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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.molgenis.vcf.decisiontree.runner.info; | ||
|
||
import htsjdk.variant.vcf.VCFInfoHeaderLine; | ||
import org.molgenis.vcf.decisiontree.Settings; | ||
import org.molgenis.vcf.utils.metadata.FieldMetadataService; | ||
import org.molgenis.vcf.utils.metadata.AbstractFieldMetadataService; | ||
import org.molgenis.vcf.utils.model.FieldMetadata; | ||
import org.molgenis.vcf.utils.vep.VepMetadataService; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.UncheckedIOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
@Component | ||
public class VepMetadataMapperFactoryImpl implements VepMetadataMapperFactory { | ||
@Override | ||
public VepMetadataMapper create(Settings settings) { | ||
Path metadataPath = settings.getMetadataPath(); | ||
FieldMetadataService fieldMetadataService = new CustomFieldMetadataService(metadataPath); | ||
VepMetadataService vepMetadataService = new VepMetadataService(fieldMetadataService); | ||
return new VepMetadataMapperImpl(vepMetadataService); | ||
} | ||
|
||
private static class CustomFieldMetadataService extends AbstractFieldMetadataService { | ||
private final Path metadataPath; | ||
|
||
public CustomFieldMetadataService(Path metadataPath) { | ||
this.metadataPath = requireNonNull(metadataPath); | ||
} | ||
|
||
@Override | ||
public FieldMetadata load(VCFInfoHeaderLine vcfInfoHeaderLine) { | ||
try(InputStream inputStream = Files.newInputStream(metadataPath)) { | ||
return this.load(inputStream, vcfInfoHeaderLine); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.