Open pnrobinson opened 5 years ago
This seems to happen because the end of this term is 304 but the start is 311, and thus we get the -7 string index error. Now we need to find where that comes from.
The minimum string that causes this error is "HPOs: Myopathic facies" The text miner gets back two hits from the API, Myopathic facies AND Myopathy. Myopathy is shorter than Myopathic facies and in the second time in the loop (Present.java) we have start=22 but end-15 (from myopathy) This line (226) causes the error:
query.substring(start, term.getEnd()),
@ielis If I add the line with the ***** the error seems to be solved -- can you confirm that this is OK?
start = Math.min(start,term.getBegin()); ************
// THIS IS LINE 221 in Present.java in HpoTextMining
htmlBuilder.append(
// highlighted text
String.format(HIGHLIGHTED_TEMPLATE,
term.getTerm().getId().getValue(),
query.substring(start, term.getEnd()),
// tooltip text -> HPO id & label
String.format(TOOLTIP_TEMPLATE, term.getTerm().getId().getValue(), term.getTerm().getName())));
offset = term.getEnd();
}
@pnrobinson - looks good, please merge it into the develop
branch. I'll write some tests to make sure this won't happen in future.
Thanks!
Thanks -- would you mind if I made a release of HpoCaseAnnotator with this update? I need this for a new comp without Java 8
Actually, we can also add the --longestOnly option -- that would take care of the bug, probably. https://github.com/SciGraph/SciGraph/issues/272#issuecomment-513911261
With Hpo Case Annotator v1.0.13
I get
This is the text: