monarch-initiative / phenol

phenol: Phenotype ontology library
https://phenol.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
23 stars 4 forks source link

Term to Disease Map Unreachable #294

Closed iimpulse closed 4 years ago

iimpulse commented 4 years ago

The use case for this class is by entry of the static method. There is no way to reach this public method. We have to manually get this map on hpo-web end.

https://github.com/monarch-initiative/phenol/blob/bfd56a257f7af10de8e33fcb5889af1d8a4d9a85/phenol-annotations/src/main/java/org/monarchinitiative/phenol/annotations/obo/hpo/HpoDiseaseAnnotationParser.java#L128

pnrobinson commented 4 years ago

@iimpulse so would be be good just to add another static loader method or do we simultaneously need multiple things? I think these classes have become a little too complicated and would love to simplify them as much as possible

iimpulse commented 4 years ago

Much of the process in loading hpo-web db is involved my parsing a few files but obtaining different data structures from them to create the mapping. Its totally fine how we have it now. My recommendation is most likely to just remove the function and associated class members. Maybe leave a comment related to this ticket of why its removed not sure?

pnrobinson commented 4 years ago

Just to keep things in one place, I added this new function and altered the other function to private

private ImmutableMultimap<TermId, TermId> getTermToDiseaseMap() {
    return this.phenotypeToDiseaseMap;
  }

  /**
   * Get a map from HPO terms to diseases. This function includes OMIM, ORPHA, and DECIPHER references.
   * @param annotationFile path to the the {@code phenotype.hpoa} file
   * @param ontology reference to HPO Ontology object
   * @return map with key being an HPO TermId object, and value being a list of TermIds representing diseases.
   */
  public static Multimap<TermId, TermId> loadTermToDiseaseMap(String annotationFile, Ontology ontology) {
    HpoDiseaseAnnotationParser parser = new HpoDiseaseAnnotationParser(annotationFile, ontology);
    try {
      parser.parse(); // ignore return value for this
      return parser.getTermToDiseaseMap();
    } catch (PhenolException e) {
      System.err.println("Could not load HPO annotations at " + annotationFile + ": " + e.getMessage());
    }
    throw new PhenolRuntimeException("Could not load HPO annotations at " + annotationFile);
  }
pnrobinson commented 4 years ago

addressed by https://github.com/monarch-initiative/phenol/pull/304

pnrobinson commented 4 years ago

done