@Test public void createFamilyMissingMember() throws CatalogException { Phenotype phenotype1 = new Phenotype("dis1", "Phenotype 1", "HPO"); Phenotype phenotype2 = new Phenotype("dis2", "Phenotype 2", "HPO"); Individual father = new Individual().setId("father").setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))); Individual mother = new Individual().setId("mother").setPhenotypes(Arrays.asList(new Phenotype("dis2", "dis2", "OT"))); // We create a new father and mother with the same information to mimic the behaviour of the webservices. Otherwise, we would be // ingesting references to exactly the same object and this test would not work exactly the same way. Individual relFather = new Individual().setId("father").setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))); Individual relChild1 = new Individual().setId("child1") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"), new Phenotype("dis2", "dis2", "OT"))) .setFather(father) .setMother(mother) .setParentalConsanguinity(true); Individual relChild2 = new Individual().setId("child2") .setPhenotypes(Collections.singletonList(new Phenotype("dis1", "dis1", "OT"))) .setFather(father) .setMother(mother) .setParentalConsanguinity(true); Family family = new Family("Martinez-Martinez", "Martinez-Martinez", Arrays.asList(phenotype1, phenotype2), null, Arrays.asList(relFather, relChild1, relChild2), "", 3, Collections.emptyList(), Collections.emptyMap()); thrown.expect(CatalogException.class); thrown.expectMessage("not present in the members list"); familyManager.create(STUDY, family, QueryOptions.empty(), sessionIdUser); }
.setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child2", "child3"))) .setParentalConsanguinity(true); Individual relChild2 = new Individual().setId("child2") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child1", "child3"))) .setParentalConsanguinity(true); Individual relChild3 = new Individual().setId("child3") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child1", "child2"))) .setParentalConsanguinity(true);
@Test public void createFamilyRepeatedMember() throws CatalogException { Phenotype phenotype1 = new Phenotype("dis1", "Phenotype 1", "HPO"); Phenotype phenotype2 = new Phenotype("dis2", "Phenotype 2", "HPO"); Individual father = new Individual().setId("father").setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))); Individual mother = new Individual().setId("mother").setPhenotypes(Arrays.asList(new Phenotype("dis2", "dis2", "OT"))); // We create a new father and mother with the same information to mimic the behaviour of the webservices. Otherwise, we would be // ingesting references to exactly the same object and this test would not work exactly the same way. Individual relFather = new Individual().setId("father").setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))); Individual relMother = new Individual().setId("mother").setPhenotypes(Arrays.asList(new Phenotype("dis2", "dis2", "OT"))); Individual relChild1 = new Individual().setId("child1") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"), new Phenotype("dis2", "dis2", "OT"))) .setFather(father) .setMother(mother) .setParentalConsanguinity(true); Individual relChild2 = new Individual().setId("child2") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setFather(father) .setMother(mother) .setParentalConsanguinity(true); Family family = new Family("Martinez-Martinez", "Martinez-Martinez", Arrays.asList(phenotype1, phenotype2), null, Arrays.asList(relFather, relMother, relChild1, relChild2, relChild1), "", -1, Collections.emptyList(), Collections.emptyMap ()); QueryResult<Family> familyQueryResult = familyManager.create(STUDY, family, QueryOptions.empty(), sessionIdUser); assertEquals(4, familyQueryResult.first().getMembers().size()); }
.setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child2", "child3"))) .setParentalConsanguinity(true); Individual relChild2 = new Individual().setId("child2") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child1", "child3"))) .setParentalConsanguinity(true); Individual relChild3 = new Individual().setId("child3") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child1", "child20"))) .setParentalConsanguinity(true);
@Test public void createFamilyPhenotypeNotPassed() throws CatalogException { Phenotype phenotype1 = new Phenotype("dis1", "Phenotype 1", "HPO"); Phenotype phenotype2 = new Phenotype("dis2", "Phenotype 2", "HPO"); Individual father = new Individual().setId("father").setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))); Individual mother = new Individual().setId("mother").setPhenotypes(Arrays.asList(new Phenotype("dis2", "dis2", "OT"))); // We create a new father and mother with the same information to mimic the behaviour of the webservices. Otherwise, we would be // ingesting references to exactly the same object and this test would not work exactly the same way. Individual relFather = new Individual().setId("father").setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))); Individual relMother = new Individual().setId("mother").setPhenotypes(Arrays.asList(new Phenotype("dis2", "dis2", "OT"))); Individual relChild1 = new Individual().setId("child1") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"), new Phenotype("dis3", "dis3", "OT"))) .setFather(father) .setMother(mother) .setParentalConsanguinity(true); Individual relChild2 = new Individual().setId("child2") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setFather(father) .setMother(mother) .setParentalConsanguinity(true); Family family = new Family("Martinez-Martinez", "Martinez-Martinez", Arrays.asList(phenotype1, phenotype2), null, Arrays.asList(relFather, relMother, relChild1, relChild2), "", 4, Collections.emptyList(), Collections.emptyMap()); thrown.expect(CatalogException.class); thrown.expectMessage("not present in any member of the family"); familyManager.create(STUDY, family, QueryOptions.empty(), sessionIdUser); }
.setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child2", "child3"))) .setParentalConsanguinity(true); Individual relChild2 = new Individual().setId("child2") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child1", "child3"))) .setParentalConsanguinity(true); Individual relChild3 = new Individual().setId("child3") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child1"))) .setParentalConsanguinity(true);
)) .setMultiples(new Multiples("multiples", Arrays.asList("child2", "child3"))) .setParentalConsanguinity(true); Individual relChild2 = new Individual().setId("child2") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child1", "child3"))) .setParentalConsanguinity(true); Individual relChild3 = new Individual().setId("child3") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))) .setMother(mother) .setMultiples(new Multiples("multiples", Arrays.asList("child1", "child2"))) .setParentalConsanguinity(true);
@Test public void updateFamilyMissingMember() throws CatalogException, JsonProcessingException { QueryResult<Family> originalFamily = createDummyFamily("Martinez-Martinez"); Individual father = new Individual().setId("father"); Individual mother = new Individual().setId("mother2"); // We create a new father and mother with the same information to mimic the behaviour of the webservices. Otherwise, we would be // ingesting references to exactly the same object and this test would not work exactly the same way. Individual relFather = new Individual().setId("father").setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"))); Individual relChild1 = new Individual().setId("child3") .setPhenotypes(Arrays.asList(new Phenotype("dis1", "dis1", "OT"), new Phenotype("dis2", "dis2", "OT"))) .setFather(father) .setMother(mother) .setParentalConsanguinity(true); Family family = new Family(); family.setMembers(Arrays.asList(relChild1, relFather)); ObjectMapper jsonObjectMapper = catalogManagerResource.generateNewObjectMapper(); ObjectMap params = new ObjectMap(jsonObjectMapper.writeValueAsString(family)); params = new ObjectMap(FamilyDBAdaptor.QueryParams.MEMBERS.key(), params.get(FamilyDBAdaptor.QueryParams.MEMBERS.key())); thrown.expect(CatalogException.class); thrown.expectMessage("not present in the members list"); familyManager.update(STUDY, originalFamily.first().getName(), params, QueryOptions.empty(), sessionIdUser); }
.setKaryotypicSex(IndividualProperty.KaryotypicSex.XX).setVersion(4).setStatus(new Status("READY")). setLifeStatus(IndividualProperty.LifeStatus.ABORTED).setAffectationStatus(IndividualProperty.AffectationStatus.AFFECTED). setSamples(Arrays.asList(new Sample().setId("1"), new Sample().setId("2"))).setParentalConsanguinity(true);