MpAnnotationParser { public static Map<TermId, MpSimpleModel> loadIndividualModels(String genePhenoPath) { ImmutableMap.Builder<TermId, MpGeneModel> builder = new ImmutableMap.Builder<>(); MpAnnotationParser annotParser = new MpAnnotationParser(genePhenoPath); if (annotParser.genotypeAccessionToMpSimpleModelMap.isEmpty()) { for (String e : annotParser.parseErrors) { System.err.println(e); } throw new PhenolRuntimeException("Could not parse " + genePhenoPath); } return annotParser.genotypeAccessionToMpSimpleModelMap; } private  MpAnnotationParser(String path); private  MpAnnotationParser(String genePhenoPath, String phenoSexPath); static Map<TermId, MpSimpleModel> loadIndividualModels(String genePhenoPath); static Map<TermId, MpSimpleModel> loadIndividualModelsWithSexSpecificPhenotypes(String genePhenoPath, String phenoSexPath); static Map<TermId, MpGeneModel> loadMpGeneModels(String genePhenoPath); static Map<TermId, MpGeneModel> loadMpGeneModelsWithSexSpecificPhenotypes(String genePhenoPath, String phenoSexPath);  }
@Test void testRetrieveCorrectNumberOfModels() { Map<TermId, MpSimpleModel> modelmap = MpAnnotationParser.loadIndividualModels(genePhenoPath); int expected_number_of_models=5; assertEquals(expected_number_of_models,modelmap.size()); }
@Test void testParseModelMgi5306347() { Map<TermId, MpSimpleModel> modelmap = MpAnnotationParser.loadIndividualModels(genePhenoPath); TermId kit = TermId.of("MGI:5306347"); MpSimpleModel model = modelmap.get(kit); assertNotNull(model); List<MpAnnotation> annots = model.getPhenotypicAbnormalities(); int expected_number_of_MP_terms=5; assertEquals(expected_number_of_MP_terms,annots.size()); assertFalse(model.hasSexSpecificAnnotation()); }
@Test void getMultiplePmid() { Map<TermId, MpSimpleModel> modelmap = MpAnnotationParser.loadIndividualModels(genePhenoPath); TermId kit = TermId.of("MGI:5433360"); MpSimpleModel model = modelmap.get(kit); assertNotNull(model); List<MpAnnotation> annots = model.getPhenotypicAbnormalities(); int expected_number_of_MP_terms=2; assertEquals(expected_number_of_MP_terms,annots.size()); assertFalse(model.hasSexSpecificAnnotation()); MpAnnotation annot = annots.get(0); Set<String> pmids = annot.getPmidSet(); assertEquals(2,pmids.size()); }
@Test void testGetCorrectMarker() { Map<TermId, MpSimpleModel> modelmap = MpAnnotationParser.loadIndividualModels(genePhenoPath); TermId kitlGenotype = TermId.of("MGI:5306347"); MpSimpleModel model = modelmap.get(kitlGenotype); assertNotNull(model); TermId Kitl = TermId.of("MGI:96974"); assertEquals(Kitl,model.getMarkerId()); }