Search in sources :

Example 41 with DynamicEntity

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

the class GoNLAnnotatorTest method testAnnotate3.

@Test
public void testAnnotate3() {
    Entity entity3 = new DynamicEntity(emd);
    entity3.set(VcfAttributes.CHROM, "1");
    entity3.set(VcfAttributes.POS, 78383467);
    entity3.set(VcfAttributes.REF, "G");
    entity3.set(VcfAttributes.ALT, "A");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity3));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertEquals(resultEntity.get(GONL_GENOME_AF), "0.8674698795180723");
    assertEquals(resultEntity.get(GONL_GENOME_GTC), "6|120|372");
}
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 42 with DynamicEntity

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

the class GoNLAnnotatorTest method testAnnotate7.

@Test
public void testAnnotate7() {
    Entity entity7 = new DynamicEntity(emd);
    entity7.set(VcfAttributes.CHROM, "15");
    entity7.set(VcfAttributes.POS, 66641732);
    entity7.set(VcfAttributes.REF, "G");
    entity7.set(VcfAttributes.ALT, "A,C,T");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity7));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertEquals(resultEntity.get(GONL_GENOME_AF), ".,0.09538152610441768,.");
    assertEquals(resultEntity.get(GONL_GENOME_GTC), ".,412|77|9,.");
}
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 43 with DynamicEntity

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

the class GoNLAnnotatorTest method testAnnotate12.

@Test
public void testAnnotate12() {
    Entity entity12 = new DynamicEntity(emd);
    entity12.set(VcfAttributes.CHROM, "2");
    entity12.set(VcfAttributes.POS, 219142023);
    entity12.set(VcfAttributes.REF, "G");
    entity12.set(VcfAttributes.ALT, "A");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity12));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertEquals(resultEntity.get(GONL_GENOME_AF), "0.9969879518072289");
    assertEquals(resultEntity.get(GONL_GENOME_GTC), "0|3|495");
}
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 44 with DynamicEntity

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

the class GoNLAnnotatorTest method testAnnotate15.

/**
 * Test for bugfix where alt allele in resource was trimmed too much causing index out of bounds.
 */
@Test
public void testAnnotate15() {
    Entity entity14 = new DynamicEntity(emd);
    entity14.set(VcfAttributes.CHROM, "1");
    entity14.set(VcfAttributes.POS, 28227207);
    entity14.set(VcfAttributes.REF, "A");
    entity14.set(VcfAttributes.ALT, "G");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity14));
    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 45 with DynamicEntity

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

the class GoNLAnnotatorTest method testAnnotate9.

@Test
public void testAnnotate9() {
    Entity entity9 = new DynamicEntity(emd);
    entity9.set(VcfAttributes.CHROM, "X");
    entity9.set(VcfAttributes.POS, 79943569);
    entity9.set(VcfAttributes.REF, "T");
    entity9.set(VcfAttributes.ALT, "C");
    Iterator<Entity> results = annotator.annotate(Collections.singletonList(entity9));
    assertTrue(results.hasNext());
    Entity resultEntity = results.next();
    assertFalse(results.hasNext());
    assertEquals(resultEntity.get(GONL_GENOME_AF), "0.9989939637826962");
    assertEquals(resultEntity.get(GONL_GENOME_GTC), "0|1|496");
}
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)

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