Skip to content

Commit

Permalink
termid string to value
Browse files Browse the repository at this point in the history
  • Loading branch information
iimpulse committed Oct 24, 2023
1 parent 581c54e commit b2974a9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static void diseaseToPhenotype(Session session, HpoaDiseaseDataContainer disease
try(Transaction tx = session.beginTransaction()) {
logger.info("Loading Disease to Phenotype Relationships...");
diseases.diseaseData().stream().flatMap(d -> d.annotationLines().stream()).forEach(line -> {
String onset = line.onset().map(HpoOnset::id).map(TermId::toString).orElse("");
String onset = line.onset().map(HpoOnset::id).map(TermId::getValue).orElse("");
String frequency = formatFrequency(line.frequency(), ontology);
String sources = formatSources(line.annotationReferences());
String sex;
Expand All @@ -116,7 +116,7 @@ static void diseaseToPhenotype(Session session, HpoaDiseaseDataContainer disease
"sources: $sources})",
parameters(
"diseaseId", line.diseaseId().toString(),
"phenotypeId", line.phenotypeTermId().toString(),
"phenotypeId", line.phenotypeTermId().getValue(),
"onset", onset, "frequency", frequency, "sex", sex,
"sources", sources
)
Expand All @@ -133,7 +133,7 @@ static void phenotypes(Session session, List<TermId> termIds, Ontology ontology)
for (TermId termId : termIds) {
Optional<String> label = ontology.getTermLabel(termId);
label.ifPresent(s -> tx.run("CREATE (p:Phenotype {id: $id, name: $name})",
parameters("id", termId.toString(), "name", s)));
parameters("id", termId.getValue(), "name", s)));
}
logger.info("Done.");
tx.commit();
Expand Down Expand Up @@ -165,7 +165,7 @@ static void diseases(Session session, HpoaDiseaseDataContainer diseases){
}

static String formatSources(List<AnnotationReference> sources){
final String joinedSources = sources.stream().map(AnnotationReference::id).map(TermId::toString).collect(Collectors.joining(","));
final String joinedSources = sources.stream().map(AnnotationReference::id).map(TermId::getValue).collect(Collectors.joining(","));
return joinedSources.length() > 1 ? joinedSources : "UNKNOWN";
}

Expand Down

0 comments on commit b2974a9

Please sign in to comment.