Commit 19e27c2d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

fix on chembl api connector (new chembl api)

parent 243751d7
......@@ -68,7 +68,8 @@ public class ChEMBLParser extends DrugAnnotation implements IExternalService {
/**
* Url that list of all child nodes for chembl ontology term.
*/
private static final String PARENT_CHILD_API_URL = "https://www.ebi.ac.uk/chembl/api/data/molecule_form?parent=";
private static final String PARENT_CHILD_API_URL = "https://www.ebi.ac.uk/chembl/api/data/molecule_form/";
private static final String PARENT_CHILD_API_URL_SUFFIX = ".xml";
/**
* Url used for finding targets containing uniprot identifiers. Important -
......@@ -420,7 +421,7 @@ public class ChEMBLParser extends DrugAnnotation implements IExternalService {
List<Target> targets = new ArrayList<>();
try {
String id = drugId.getResource();
String query = PARENT_CHILD_API_URL + id;
String query = PARENT_CHILD_API_URL + id + PARENT_CHILD_API_URL_SUFFIX;
String page = getWebPageContent(query);
Document document = super.getXmlDocumentFromString(page);
......
......@@ -213,11 +213,11 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
@Test
public void test9FindDrug() throws Exception {
try {
String n = "PONATINIB";
Drug test = chemblParser.findDrug(n);
String name = "PONATINIB";
Drug test = chemblParser.findDrug(name);
assertEquals("CHEMBL1171837", test.getSources().get(0).getResource());
assertEquals("PONATINIB", test.getName());
assertEquals(name, test.getName());
assertNull(test.getDescription());
assertEquals(3, test.getTargets().size());
} catch (Exception e) {
......
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