Search in sources :

Example 46 with DynamicEntity

use of org.molgenis.data.support.DynamicEntity in project molgenis by molgenis.

the class GoNLAnnotatorTest method testAnnotate14.

@Test
public void testAnnotate14() {
    Entity entity14 = new DynamicEntity(emd);
    entity14.set(VcfAttributes.CHROM, "21");
    entity14.set(VcfAttributes.POS, 45650009);
    entity14.set(VcfAttributes.REF, "T");
    entity14.set(VcfAttributes.ALT, "TG, A, G");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity14));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertEquals(resultEntity.get(GONL_GENOME_AF), "0.22188755020080322,.,.");
    assertEquals(resultEntity.get(GONL_GENOME_GTC), "306|163|29,.,.");
}
Also used : DynamicEntity(org.molgenis.data.support.DynamicEntity) Entity(org.molgenis.data.Entity) DynamicEntity(org.molgenis.data.support.DynamicEntity) Test(org.testng.annotations.Test) AbstractMolgenisSpringTest(org.molgenis.data.AbstractMolgenisSpringTest)

Example 47 with DynamicEntity

use of org.molgenis.data.support.DynamicEntity in project molgenis by molgenis.

the class GoNLAnnotatorTest method testAnnotate10.

@Test
public void testAnnotate10() {
    Entity entity10 = new DynamicEntity(emd);
    entity10.set(VcfAttributes.CHROM, "2");
    entity10.set(VcfAttributes.POS, 191904021);
    entity10.set(VcfAttributes.REF, "G");
    entity10.set(VcfAttributes.ALT, "T");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity10));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertEquals(resultEntity.get(GONL_GENOME_AF), "0.0030120481927710845");
    assertEquals(resultEntity.get(GONL_GENOME_GTC), "495|3|0");
}
Also used : DynamicEntity(org.molgenis.data.support.DynamicEntity) Entity(org.molgenis.data.Entity) DynamicEntity(org.molgenis.data.support.DynamicEntity) Test(org.testng.annotations.Test) AbstractMolgenisSpringTest(org.molgenis.data.AbstractMolgenisSpringTest)

Example 48 with DynamicEntity

use of org.molgenis.data.support.DynamicEntity in project molgenis by molgenis.

the class GoNLAnnotatorTest method testAnnotate5.

@Test
public void testAnnotate5() {
    Entity entity5 = new DynamicEntity(emd);
    entity5.set(VcfAttributes.CHROM, "2");
    entity5.set(VcfAttributes.POS, 171570151);
    entity5.set(VcfAttributes.REF, "C");
    entity5.set(VcfAttributes.ALT, "T");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity5));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertEquals(resultEntity.get(GONL_GENOME_AF), "0.30823293172690763");
    assertEquals(resultEntity.get(GONL_GENOME_GTC), "241|207|50");
}
Also used : DynamicEntity(org.molgenis.data.support.DynamicEntity) Entity(org.molgenis.data.Entity) DynamicEntity(org.molgenis.data.support.DynamicEntity) Test(org.testng.annotations.Test) AbstractMolgenisSpringTest(org.molgenis.data.AbstractMolgenisSpringTest)

Example 49 with DynamicEntity

use of org.molgenis.data.support.DynamicEntity in project molgenis by molgenis.

the class GoNLAnnotatorTest method testAnnotate4.

@Test
public void testAnnotate4() {
    Entity entity4 = new DynamicEntity(emd);
    entity4.set(VcfAttributes.CHROM, "1");
    entity4.set(VcfAttributes.POS, 231094050);
    entity4.set(VcfAttributes.REF, "GAA");
    entity4.set(VcfAttributes.ALT, "G,GAAA,GA");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity4));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertNull(resultEntity.get(GONL_GENOME_AF));
    assertNull(resultEntity.get(GONL_GENOME_GTC));
}
Also used : DynamicEntity(org.molgenis.data.support.DynamicEntity) Entity(org.molgenis.data.Entity) DynamicEntity(org.molgenis.data.support.DynamicEntity) Test(org.testng.annotations.Test) AbstractMolgenisSpringTest(org.molgenis.data.AbstractMolgenisSpringTest)

Example 50 with DynamicEntity

use of org.molgenis.data.support.DynamicEntity in project molgenis by molgenis.

the class ThousandGenomesAnnotatorTest method testAnnotate.

@Test
public void testAnnotate() {
    EntityType emdIn = entityTypeFactory.create("test");
    emdIn.addAttribute(vcfAttributes.getChromAttribute(), ROLE_ID);
    emdIn.addAttribute(vcfAttributes.getPosAttribute());
    emdIn.addAttribute(vcfAttributes.getRefAttribute());
    emdIn.addAttribute(vcfAttributes.getAltAttribute());
    emdIn.addAttribute(attributeFactory.create().setName(THOUSAND_GENOME_AF).setDataType(STRING).setDescription("The allele frequency for variants seen in the population used for the thousand genomes project").setLabel(THOUSAND_GENOME_AF_LABEL));
    Entity inputEntity = new DynamicEntity(emdIn);
    inputEntity.set(VcfAttributes.CHROM, "1");
    inputEntity.set(VcfAttributes.POS, 249240543);
    inputEntity.set(VcfAttributes.REF, "AGG");
    inputEntity.set(VcfAttributes.ALT, "A");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(inputEntity));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertEquals(resultEntity.get(VcfAttributes.CHROM), "1");
    assertEquals(resultEntity.get(VcfAttributes.POS), 249240543);
    assertEquals(resultEntity.get(VcfAttributes.REF), "AGG");
    assertEquals(resultEntity.get(VcfAttributes.ALT), "A");
    assertEquals(resultEntity.get(THOUSAND_GENOME_AF), "0.61861");
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) DynamicEntity(org.molgenis.data.support.DynamicEntity) Entity(org.molgenis.data.Entity) DynamicEntity(org.molgenis.data.support.DynamicEntity) Test(org.testng.annotations.Test) AbstractMolgenisSpringTest(org.molgenis.data.AbstractMolgenisSpringTest)

Aggregations

DynamicEntity (org.molgenis.data.support.DynamicEntity)161 Entity (org.molgenis.data.Entity)123 Test (org.testng.annotations.Test)104 AbstractMolgenisSpringTest (org.molgenis.data.AbstractMolgenisSpringTest)50 EntityType (org.molgenis.data.meta.model.EntityType)48 Attribute (org.molgenis.data.meta.model.Attribute)38 AttributeMapping (org.molgenis.semanticmapper.mapping.model.AttributeMapping)14 BeforeMethod (org.testng.annotations.BeforeMethod)14 ExplainedAttribute (org.molgenis.semanticsearch.explain.bean.ExplainedAttribute)7 EntityMapping (org.molgenis.semanticmapper.mapping.model.EntityMapping)5 BeforeClass (org.testng.annotations.BeforeClass)5 ArrayList (java.util.ArrayList)4 MolgenisDataException (org.molgenis.data.MolgenisDataException)4 EntityWithComputedAttributes (org.molgenis.data.support.EntityWithComputedAttributes)4 ExplainedQueryString (org.molgenis.semanticsearch.explain.bean.ExplainedQueryString)4 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)4 StringWriter (java.io.StringWriter)3 List (java.util.List)3 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)3 QueryBuilder (org.elasticsearch.index.query.QueryBuilder)3