Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
f3278201
Commit
f3278201
authored
Apr 04, 2019
by
Piotr Gawron
Browse files
synonyms are escaped html strings
parent
d9cc78db
Changes
2
Hide whitespace changes
Inline
Side-by-side
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java
View file @
f3278201
package
lcsb.mapviewer.annotation.services.annotators
;
import
java.io.IOException
;
import
java.io.StringReader
;
import
java.net.HttpURLConnection
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -9,15 +8,11 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.Set
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
org.apache.commons.text.StringEscapeUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.stereotype.Service
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Node
;
import
org.w3c.dom.NodeList
;
import
org.xml.sax.InputSource
;
import
lcsb.mapviewer.annotation.cache.GeneralCacheInterface
;
import
lcsb.mapviewer.annotation.cache.SourceNotAvailable
;
...
...
@@ -300,7 +295,7 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic
Node
node
=
list
.
item
(
i
);
if
(
node
.
getNodeType
()
==
Node
.
ELEMENT_NODE
)
{
if
(
node
.
getNodeName
().
equals
(
"Gene-ref_syn_E"
))
{
synonyms
.
add
(
node
.
getTextContent
());
synonyms
.
add
(
StringEscapeUtils
.
unescapeHtml4
(
node
.
getTextContent
())
)
;
}
}
}
...
...
annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java
View file @
f3278201
...
...
@@ -343,6 +343,23 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
}
}
@Test
public
void
testAnnotateElementWithEncodedSynonyms
()
throws
Exception
{
try
{
Species
proteinAlias
=
new
GenericProtein
(
"id"
);
proteinAlias
.
addMiriamData
(
new
MiriamData
(
MiriamType
.
ENTREZ
,
"834106"
));
entrezAnnotator
.
annotateElement
(
proteinAlias
);
for
(
String
synonym
:
proteinAlias
.
getSynonyms
())
{
assertFalse
(
"Invalid character found in synonym: "
+
synonym
,
synonym
.
contains
(
"&"
));
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testParseEntrezResponse
()
throws
Exception
{
WebPageDownloader
downloader
=
entrezAnnotator
.
getWebPageDownloader
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment