Commit 8ff78540 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1191-problem-with-annotations' into 'devel_14.0.x'

Resolve "annotations are not parsed properly"

See merge request !1086
parents 61cc3462 51e39c43
Pipeline #22713 passed with stage
in 12 minutes and 33 seconds
minerva (14.0.10) stable; urgency=medium minerva (14.0.10) stable; urgency=medium
* Bug fix: reaction without ports in SBGN crashed upload (#1065) * Bug fix: reaction without ports in SBGN crashed upload (#1065)
* Bug fix: annotations using newer identifiers.org uri schema were truncated
by one character (#1191)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 27 Feb 2020 10:00:00 +0200 -- Piotr Gawron <piotr.gawron@uni.lu> Tue, 27 Feb 2020 10:00:00 +0200
......
...@@ -137,17 +137,6 @@ public class ChEMBLParserTest extends AnnotationTestFunctions { ...@@ -137,17 +137,6 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
assertNull(test); assertNull(test);
} }
@Test
public void test9FindDrug() throws Exception {
String name = "PONATINIB";
Drug test = chemblParser.findDrug(name);
assertEquals("CHEMBL1171837", test.getSources().get(0).getResource());
assertEquals(name, test.getName());
assertNull(test.getDescription());
assertEquals(3, test.getTargets().size());
}
@Test @Test
public void test10FindDrug() throws Exception { public void test10FindDrug() throws Exception {
String n = "DEXAMETHASONE"; String n = "DEXAMETHASONE";
......
...@@ -36,17 +36,16 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions { ...@@ -36,17 +36,16 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
private PermanentDatabaseLevelCacheInterface permanentDatabaseLevelCache; private PermanentDatabaseLevelCacheInterface permanentDatabaseLevelCache;
@Test @Test
public void test1FindDrug() throws Exception { public void testFindUrokinase() throws Exception {
Drug test = drugBankHTMLParser.findDrug("Urokinase"); Drug test = drugBankHTMLParser.findDrug("Urokinase");
assertNotNull(test); assertNotNull(test);
assertEquals(MiriamType.DRUGBANK, test.getSources().get(0).getDataType()); assertEquals(MiriamType.DRUGBANK, test.getSources().get(0).getDataType());
assertEquals("DB00013", test.getSources().get(0).getResource()); assertEquals("DB00013", test.getSources().get(0).getResource());
assertEquals("Urokinase", test.getName()); assertEquals("Urokinase", test.getName());
assertTrue(test.getBloodBrainBarrier().equalsIgnoreCase("N/A")); assertTrue(test.getBloodBrainBarrier().equalsIgnoreCase("N/A"));
boolean res = test.getDescription().contains( boolean res = test.getDescription().contains("Urokinase is an endogenous peptide that is cleaved");
"Low molecular weight form of human urokinase, that consists of an A chain of 2,000 daltons linked by a sulfhydryl bond to a B chain of 30,400 daltons. Recombinant urokinase plasminogen activator");
assertTrue(res); assertTrue(res);
assertEquals(10, test.getTargets().size()); assertEquals(8, test.getTargets().size());
assertNull(test.getApproved()); assertNull(test.getApproved());
} }
......
...@@ -907,7 +907,11 @@ public enum MiriamType { ...@@ -907,7 +907,11 @@ public enum MiriamType {
if (foundUri.length() >= miriamUri.length()) { if (foundUri.length() >= miriamUri.length()) {
throw new InvalidArgumentException("Invalid miriam uri: " + miriamUri); throw new InvalidArgumentException("Invalid miriam uri: " + miriamUri);
} }
return new MiriamData(foundType, miriamUri.substring(foundUri.length() + 1)); int uriLength = foundUri.length();
if (!foundUri.endsWith("/")) { // add one character for separator
uriLength++;
}
return new MiriamData(foundType, miriamUri.substring(uriLength));
} }
throw new InvalidArgumentException("Invalid miriam uri: " + miriamUri); throw new InvalidArgumentException("Invalid miriam uri: " + miriamUri);
} }
......
...@@ -93,6 +93,12 @@ public class MiriamTypeTest extends ModelTestFunctions { ...@@ -93,6 +93,12 @@ public class MiriamTypeTest extends ModelTestFunctions {
assertTrue(new MiriamData(MiriamType.PANTHER, "PTHR19384:SF5").equals(md)); assertTrue(new MiriamData(MiriamType.PANTHER, "PTHR19384:SF5").equals(md));
} }
@Test
public void testGetMiriamByIdentifiersOrgUri() throws Exception {
MiriamData md = MiriamType.getMiriamByUri("http://identifiers.org/uniprot/P42224");
assertEquals(new MiriamData(MiriamType.UNIPROT, "P42224"), md);
}
@Test(expected = InvalidArgumentException.class) @Test(expected = InvalidArgumentException.class)
public void testGetMiriamByInvalidUri() throws Exception { public void testGetMiriamByInvalidUri() throws Exception {
MiriamType.getMiriamByUri("invalid_uri"); MiriamType.getMiriamByUri("invalid_uri");
......
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