File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
boqa-core/src/main/java/org/p2gx/boqa/core Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,10 @@ public Set<TermId> initLayer(Set<TermId> hpoTerms) {
122122 public static TermId getPrimaryTermId (TermId t ){
123123 TermId primaryTermId = hpo .getPrimaryTermId (t );
124124 if (primaryTermId == null ) {
125- LOGGER .warn ("Invalid HPO term {}! Skipping..." , primaryTermId );
125+ if (LOGGED_REPLACEMENTS .add (t )) { // only log once per term
126+ LOGGER .warn ("Invalid HPO term {}! Skipping it, this may negatively affect performance. " +
127+ "Are you using the latest HPO build? Consider running `download -w` to fetch the latest HPO release." , t );
128+ }
126129 } else {
127130 if (!t .equals (primaryTermId ) && LOGGED_REPLACEMENTS .add (t )) {
128131 LOGGER .info ("Replacing {} with primary term {}" , t , primaryTermId );
Original file line number Diff line number Diff line change 1212
1313import java .nio .file .Path ;
1414import java .util .List ;
15+ import java .util .Objects ;
1516import java .util .Set ;
1617import java .util .function .Predicate ;
1718import java .util .stream .Collectors ;
@@ -49,6 +50,7 @@ public PhenopacketData(Phenopacket phenopacket) {
4950 .map (OntologyClass ::getId )
5051 .map (TermId ::of )
5152 .map (OntologyTraverser ::getPrimaryTermId )
53+ .filter (Objects ::nonNull ) // If old HPO is used without a term, avoids the program crashing
5254 .collect (Collectors .toSet ());
5355 if (this .observedTerms .isEmpty ()) {
5456 LOGGER .warn ("Phenopacket {} has no observed phenotypic features!" , phenopacket .getId ());
@@ -58,6 +60,7 @@ public PhenopacketData(Phenopacket phenopacket) {
5860 .map (OntologyClass ::getId )
5961 .map (TermId ::of )
6062 .map (OntologyTraverser ::getPrimaryTermId )
63+ .filter (Objects ::nonNull ) // If old HPO is used without a term, avoids the program crashing
6164 .collect (Collectors .toSet ());
6265 this .diseases = phenopacket .getDiseasesList ().stream ().map (d ->
6366 new DiseaseDTO (d .getTerm ().getId (), d .getTerm ().getLabel ())).toList ();
You can’t perform that action at this time.
0 commit comments