Skip to content
Snippets Groups Projects
Commit d25346ff authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when hgnc annotator uses element name, only first part before whitespace is...

when hgnc annotator uses element name, only first part before whitespace is processed as an identifier
parent 221341ba
No related branches found
No related tags found
1 merge request!345Resolve "Genes annotations don't show"
......@@ -237,17 +237,17 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
}
}
}
}
}
}
} catch (WrongResponseCodeIOException e) {
logger.warn(prefix + "Cannot find information for element.");
} catch (Exception e) {
throw new AnnotatorException(e);
}
}
}
}
}
}
}
} catch (WrongResponseCodeIOException e) {
logger.warn(prefix + "Cannot find information for element.");
} catch (Exception e) {
throw new AnnotatorException(e);
}
}
}
/**
* Creates query url for given {@link MiriamType#HGNC} identifier.
......@@ -265,10 +265,12 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
*
* @param name
* {@link MiriamType#HGNC_SYMBOL}
* @return url to restful api webpage for given hgnc symbol
* @return url to restful API web page for given HGNC symbol
*/
private String getHgncNameUrl(String name) {
return REST_API_URL + "symbol/" + name;
String hgncSymbol = "" + name;
hgncSymbol = hgncSymbol.split("\\s+")[0];
return REST_API_URL + "symbol/" + hgncSymbol;
}
/**
......@@ -304,34 +306,34 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
} else {
Node entry = getNode("doc", resultNode.getChildNodes());
NodeList list = entry.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (node.getNodeName().equals("arr")) {
String type = getNodeAttr("name", node);
if (type.equals("uniprot_ids")) {
NodeList uniprotList = node.getChildNodes();
for (int j = 0; j < uniprotList.getLength(); j++) {
Node uniprotNode = uniprotList.item(j);
if (uniprotNode.getNodeType() == Node.ELEMENT_NODE) {
if (uniprotNode.getNodeName().equals("str")) {
result.add(createMiriamData(MiriamType.UNIPROT, uniprotNode.getTextContent()));
}
}
}
}
}
}
}
}
return result;
} catch (WrongResponseCodeIOException e) {
logger.warn("No HGNC data found for id: "+miriamData);
return new ArrayList<>();
} catch (Exception e) {
throw new AnnotatorException(e);
}
NodeList list = entry.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (node.getNodeName().equals("arr")) {
String type = getNodeAttr("name", node);
if (type.equals("uniprot_ids")) {
NodeList uniprotList = node.getChildNodes();
for (int j = 0; j < uniprotList.getLength(); j++) {
Node uniprotNode = uniprotList.item(j);
if (uniprotNode.getNodeType() == Node.ELEMENT_NODE) {
if (uniprotNode.getNodeName().equals("str")) {
result.add(createMiriamData(MiriamType.UNIPROT, uniprotNode.getTextContent()));
}
}
}
}
}
}
}
}
return result;
} catch (WrongResponseCodeIOException e) {
logger.warn("No HGNC data found for id: " + miriamData);
return new ArrayList<>();
} catch (Exception e) {
throw new AnnotatorException(e);
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment