Commit f6e94c4f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

chembl provide taxonomy id - we don't need to translate name to id

parent 3e814ee6
Pipeline #2583 passed with stage
in 43 seconds
......@@ -170,8 +170,14 @@ public class ChEMBLParser extends DrugAnnotation implements IExternalService {
Node node = list.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (node.getNodeName().equalsIgnoreCase("organism")) {
// node with information abou organism
target.setOrganism(getTaxonomyBackend().getByName(node.getTextContent()));
// nothing to do here, we use taxonomy id
} else if (node.getNodeName().equalsIgnoreCase("tax_id")) {
String value = node.getTextContent();
MiriamData taxonomy = new MiriamData(MiriamType.TAXONOMY, value);
String organismName = getTaxonomyBackend().getNameForTaxonomy(taxonomy);
if (organismName != null) {
target.setOrganism(taxonomy);
}
} else if (node.getNodeName().equalsIgnoreCase("pref_name")) {
// node with information about name
target.setName(node.getTextContent());
......@@ -210,7 +216,7 @@ public class ChEMBLParser extends DrugAnnotation implements IExternalService {
// nothing to do here
continue;
} else {
logger.warn("Unknown node: " + node.getNodeName());
logger.warn("Unknown node: " + node.getNodeName() + ";" + node.getTextContent());
}
}
}
......
......@@ -167,7 +167,7 @@ public class TaxonomyBackend extends CachableInterface implements IExternalServi
* object representing taxonomy id
* @return name for given taxonomy id
* @throws TaxonomySearchException
* thrown when there is a problem with accessing external dadatabse
* thrown when there is a problem with accessing external database
*/
public String getNameForTaxonomy(MiriamData miriamData) throws TaxonomySearchException {
if (miriamData == null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment