Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working PoC of VCF import API #4498

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

joerivandervelde
Copy link
Member

Started writing VCF import API, got very minimal PoC working using

curl -X POST --data-binary @/Users/joeri/git/molgenis-emx2/backend/molgenis-emx2-beacon-v2/src/test/resources/sample.vcf http://localhost:8080/beacon/api/vcf

But many things still to do

Copy link
Member

@mswertz mswertz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.

I suppose this depends on the data model behind how to handle the VCF contents. So we either should standardize or we should make a map of 'adapters' that can choose how to translate the VCF in the backend (based on the profile that was used to create the schema).

@@ -0,0 +1,78 @@
package org.molgenis.emx2.beaconv2.vcfimport;

import htsjdk.variant.variantcontext.VariantContext;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what VIP uses?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly

private Table individuals;

public VcfImport(File vcfTmpFile, Table genomicVariations, Table individuals) {
this.vcfTmpFile = vcfTmpFile;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would call it 'vcfFile' (might or might not be tempfile, doesn't matter here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

for (VariantContext variant : vcfFileReader) {

Row row = new Row();
row.set("variantInternalId", UUID.randomUUID());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this would then need to be an adapter. I.e. using the 'strategy' design pattern where the way on how to handle rows from the VCF file can have different implementations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but this needs to be fully transparant to the user so I think we need to make https://github.com/molgenis/GCC/issues/775 into a more general GUI tool


public static void main(String[] args) {
String vcfFilePath =
"/Users/joeri/git/molgenis-emx2/backend/molgenis-emx2-beacon-v2/src/test/resources/sample.vcf";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to a test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ofcourse, this was just for playing around with HTSJDK

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
3.4% Coverage on New Code (required ≥ 80%)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants