From 67c456b07377f6229374d412696e8fefa87148a2 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Mon, 15 Jan 2018 19:07:54 +0100 Subject: [PATCH] chemical contains synonyms --- .../lcsb/mapviewer/annotation/data/Chemical.java | 4 ++++ .../annotation/services/ChemicalParser.java | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/data/Chemical.java b/annotation/src/main/java/lcsb/mapviewer/annotation/data/Chemical.java index 651cecb2df..89186f8b2c 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/data/Chemical.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/data/Chemical.java @@ -304,4 +304,8 @@ public class Chemical implements Serializable, TargettingStructure { return getInferenceNetwork(); } + public void addSynonyms(List<String> synonyms) { + this.synonyms.addAll(synonyms); + } + } diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java index c6d51b90ab..20f97ebc08 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java @@ -26,6 +26,7 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader; import lcsb.mapviewer.annotation.cache.XmlSerializer; import lcsb.mapviewer.annotation.data.Chemical; import lcsb.mapviewer.annotation.data.ChemicalDirectEvidence; +import lcsb.mapviewer.annotation.data.MeSH; import lcsb.mapviewer.annotation.data.Target; import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; @@ -168,6 +169,9 @@ public class ChemicalParser extends CachableInterface implements IExternalServic @Autowired private ProjectDao projectDao; + @Autowired + private MeSHParser meshParser; + /** * */ @@ -349,7 +353,7 @@ public class ChemicalParser extends CachableInterface implements IExternalServic } List<String> list = getSuggestedQueryListWithoutCache(project, diseaseId); result = StringUtils.join(list, "\n"); - } else { + } else { result = super.refreshCacheQuery(query); } } else { @@ -396,8 +400,15 @@ public class ChemicalParser extends CachableInterface implements IExternalServic result = getChemicalFromChemicalLine(lineValues, chemID); } } + if (result != null) { + MeSH mesh = meshParser.getMeSH(result.getChemicalId()); + result.addSynonyms(mesh.getSynonyms()); + } + } catch (IOException e) { throw new ChemicalSearchException("ctdbase service unavailable", e); + } catch (AnnotatorException e) { + throw new ChemicalSearchException("problem with accessing mesh db", e); } // put them in cache -- GitLab