MorbidMapParser implements ResourceParser { protected OmimDisease parseLine(String line) { String[] fields = line.split("\\t"); if (fields.length != 4) { logger.error("Malformed morbid map line: {}", line); logger.error("Expected 4 fields per line but got {}", fields.length); throw new IllegalArgumentException("Malformed morbid map line:" + line); } String diseaseToken = fields[0]; int diseaseId = parseDiseaseId(diseaseToken); String diseaseName = parseDiseaseName(diseaseToken, diseaseId); DiseaseType diseaseType = parseDiseaseType(diseaseToken); Integer geneMim = Integer.valueOf(fields[2]); Integer entrezGeneId = mim2geneMap.getOrDefault(geneMim, 0); if (entrezGeneId.equals(0)) { logger.debug("No associated geneId for {}", line); } InheritanceMode inheritanceMode = diseaseInheritanceCache.getInheritanceMode(diseaseId); return new OmimDisease(diseaseId, geneMim, diseaseName, entrezGeneId, diseaseType, inheritanceMode); } MorbidMapParser(DiseaseInheritanceCache diseaseInheritanceCache, Map<Integer, Integer> mim2geneMap); @Override void parseResource(Resource resource, Path inDir, Path outDir);  }
@Test void parseDiseaseWithKnownInheritance() { OmimDisease output = instance.parseLine("Pfeiffer syndrome, 101600 (3)\tFGFR1, FLT2, OGD, KAL2, HH2, HRTFDS, ECCL\t136350\t8p11.23"); System.out.println(output); OmimDisease expected = new OmimDisease(101600, 136350, "Pfeiffer syndrome",2260, DiseaseType.DISEASE, InheritanceMode.AUTOSOMAL_DOMINANT); assertThat(output, equalTo(expected)); }
@Test void parseDiseaseNoDiseaseId() { OmimDisease output = instance.parseLine("Leukemia, acute T-cell (2)\tLMO2, RBTNL1, RHOM2, TTG2\t180385\t11p13"); System.out.println(output); OmimDisease expected = new OmimDisease(-10, 180385, "Leukemia, acute T-cell",4005, DiseaseType.DISEASE, InheritanceMode.UNKNOWN); assertThat(output, equalTo(expected)); }
@Test void parseDiseaseNotRealDiseaseId() { OmimDisease output = instance.parseLine("Myoclonic epilepsy, juvenile, 4 (2)\tEJM4\t611364\t5q12-q14"); System.out.println(output); OmimDisease expected = new OmimDisease(-10, 611364, "Myoclonic epilepsy, juvenile, 4",0, DiseaseType.DISEASE, InheritanceMode.UNKNOWN); assertThat(output, equalTo(expected)); }
@Test void parseUnconfirmedDiseaseWithKnownInheritance() { OmimDisease output = instance.parseLine("?Mental retardation, X-linked 100, 300923 (3)\tKIF4A, KIF4, MRX100\t300521\tXq13.1"); System.out.println(output); OmimDisease expected = new OmimDisease(300923, 300521, "?Mental retardation, X-linked 100",24137, DiseaseType.UNCONFIRMED, InheritanceMode.X_RECESSIVE); assertThat(output, equalTo(expected)); }
@Test void parseSusceptibilityWithDiseaseId() { OmimDisease output = instance.parseLine("{Bone mineral density QTL 12, osteoporosis}, 612560 (3)\tUGT2B17, BMND12\t601903\t4q13.2"); System.out.println(output); OmimDisease expected = new OmimDisease(612560, 601903, "Bone mineral density QTL 12, osteoporosis",7367, DiseaseType.SUSCEPTIBILITY, InheritanceMode.UNKNOWN); assertThat(output, equalTo(expected)); }
@Test void parseUnconfirmedSusceptibilityWithDiseaseId() { OmimDisease output = instance.parseLine("{?Breast cancer susceptibility}, 114480 (1)\tNQO2, NMOR2\t160998\t6p25.2"); System.out.println(output); OmimDisease expected = new OmimDisease(114480, 160998, "?Breast cancer susceptibility",4835, DiseaseType.SUSCEPTIBILITY, InheritanceMode.AUTOSOMAL_DOMINANT); assertThat(output, equalTo(expected)); }
@Test void parseNonDiseaseWithDiseaseId() { OmimDisease output = instance.parseLine("[Blood group, Scianna system], 111750 (3)\tERMAP, SC, RD\t609017\t1p34.2"); System.out.println(output); OmimDisease expected = new OmimDisease(111750, 609017, "Blood group, Scianna system",114625, DiseaseType.NON_DISEASE, InheritanceMode.UNKNOWN); assertThat(output, equalTo(expected)); }
@Test void parseUnconfirmedNonDiseaseWithDiseaseId() { OmimDisease output = instance.parseLine("[?Phosphohydroxylysinuria], 615011 (3)\tPHYKPL, AGXT2L2, PHLU\t614683\t5q35.3"); System.out.println(output); OmimDisease expected = new OmimDisease(615011, 614683, "?Phosphohydroxylysinuria",85007, DiseaseType.NON_DISEASE, InheritanceMode.UNKNOWN); assertThat(output, equalTo(expected)); }
@Test void parseNonDiseaseNoDiseaseId() { OmimDisease output = instance.parseLine("[Blood group, Rhesus] (3)\tRHCE, RHNA\t111700\t1p36.11"); System.out.println(output); OmimDisease expected = new OmimDisease(-10, 111700, "Blood group, Rhesus",6006, DiseaseType.NON_DISEASE, InheritanceMode.UNKNOWN); assertThat(output, equalTo(expected)); }
@Test void parseCnvWithDiseaseId() { OmimDisease output = instance.parseLine("Silver-Russell syndrome (4)\tSRS, RSS\t180860\t7p11.2"); System.out.println(output); OmimDisease expected = new OmimDisease(-10, 180860, "Silver-Russell syndrome",0, DiseaseType.CNV, InheritanceMode.UNKNOWN); assertThat(output, equalTo(expected)); }