HpoAnnotationEntry { public static HpoAnnotationEntry fromLine(String line, Ontology ontology) throws PhenolException { String [] A= line.split("\t"); if (A.length!= NUMBER_OF_FIELDS) { throw new HpoAnnotationModelException(String.format("We were expecting %d expectedFields but got %d for line %s",NUMBER_OF_FIELDS,A.length,line )); } String diseaseID=A[0]; String diseaseName=A[1]; TermId phenotypeId = TermId.of(A[2]); String phenotypeName=A[3]; String ageOfOnsetId=A[4]; String ageOfOnsetName=A[5]; String frequencyString=A[6]; String sex=A[7]; String negation=A[8]; String modifier=A[9]; String description=A[10]; String publication=A[11]; String evidenceCode=A[12]; String biocuration=A[13]; HpoAnnotationEntry entry = new HpoAnnotationEntry(diseaseID, diseaseName, phenotypeId, phenotypeName, ageOfOnsetId, ageOfOnsetName, frequencyString, sex, negation, modifier, description, publication, evidenceCode, biocuration); performQualityControl(entry, ontology); return entry; } HpoAnnotationEntry(String disID,
                               String diseaseName,
                               TermId phenotypeId,
                               String phenotypeName,
                               String ageOfOnsetId,
                               String ageOfOnsetName,
                               String frequencyString,
                               String sex,
                               String negation,
                               String modifier,
                               String description,
                               String publication,
                               String evidenceCode,
                               String biocuration); String getDiseaseID(); String getDB(); String getDB_Object_ID(); String getDiseaseName(); TermId getPhenotypeId(); String getPhenotypeLabel(); String getAgeOfOnsetId(); String getAgeOfOnsetLabel(); String getEvidenceCode(); String getFrequencyModifier(); String getSex(); String getNegation(); String getModifier(); String getDescription(); String getPublication(); String getBiocuration(); @Override String toString(); String getLineNoTabs(); String getRow(); static HpoAnnotationEntry fromLine(String line, Ontology ontology); static Optional<HpoAnnotationEntry> fromLineReplaceObsoletePhenotypeData(String line, Ontology ontology); static HpoAnnotationEntry fromOrphaData(String diseaseID,
                                                   String diseaseName,
                                                   String hpoId,
                                                   String hpoLabel,
                                                   TermId frequency,
                                                   Ontology ontology,
                                                   String biocuration,
                                                   boolean replaceObsoleteTermId); static HpoAnnotationEntry fromOrphaInheritanceData(String diseaseID,
                                                 String diseaseName,
                                                 TermId hpoInheritanceId,
                                                 String hpoLabel,
                                                 String biocuration); String toBigFileLine(Ontology ontology);  }
@Test void testEvidenceCodeValid() { String[] fields={ "OMIM:123456", "MADE-UP SYNDROME", "HP:0000528", "Anophthalmia", "", "", "76.3%", "FEMALE", "", "", "", "PMID:9843983", "PC", "HPO:probinson[2013-01-09]"}; String line = String.join("\t",fields); Assertions.assertThrows(PhenolException.class, () -> { HpoAnnotationEntry entry = HpoAnnotationEntry.fromLine(line,ontology); }); }
@Test void testMissingDiseaseName() { String[] fields={ "OMIM:123456", "", "HP:0000528", "Anophthalmia", "", "", "76.3%", "FEMALE", "", "", "", "PMID:9843983", "PCS", "HPO:probinson[2013-01-09]"}; String line = String.join("\t",fields); Assertions.assertThrows(HpoAnnotationModelException.class, () -> { HpoAnnotationEntry entry = HpoAnnotationEntry.fromLine(line, ontology); }); }
@Test void testRecognizeBadHPOId() { String[] fields={ "123456", "MADE-UP SYNDROME", "HP:1230528", "Anophthalmia", "", "", "76.3%", "FEMALE", "", "", "", "PMID:9843983", "PCS", "HPO:probinson[2013-01-09]"}; String line = String.join("\t",fields); Assertions.assertThrows(PhenolException.class, () -> { HpoAnnotationEntry entry = HpoAnnotationEntry.fromLine(line,ontology); }); }
@Test void testRecognizeBadDatabaseId() { String[] fields={ "123456", "MADE-UP SYNDROME", "HP:0000528", "Anophthalmia", "", "", "76.3%", "FEMALE", "", "", "", "PMID:9843983", "PCS", "HPO:probinson[2013-01-09]"}; String line = String.join("\t",fields); Assertions.assertThrows(HpoAnnotationModelException.class, () -> { HpoAnnotationEntry entry = HpoAnnotationEntry.fromLine(line,ontology); }); }