Commit 556546c9 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

check if the list of annotations doesn' break search by element

parent 4391c5d8
......@@ -91,11 +91,7 @@ public class ChemicalService extends DbSearchService implements IChemicalService
if (MiriamType.HGNC_SYMBOL.equals(md.getDataType())) {
targetsMiriam.add(md);
hgncFound = true;
} else if (MiriamType.ENTREZ.equals(md.getDataType())) {
// ad also entrez in case of mouse, rat, etc
targetsMiriam.add(md);
}
}
if (!hgncFound) {
MiriamData md = new MiriamData(MiriamType.HGNC_SYMBOL, element.getName());
......
......@@ -66,4 +66,24 @@ public class ChemicalServiceTest extends ServiceTestFunctions {
assertEquals("No warnings expected.", 0, getWarnings().size());
}
@Test
public void testSearchByElementWithWeirdAnnotations() throws Exception {
List<Element> elements = new ArrayList<>();
Rna protein = new Rna("id");
protein.setName("RAB40AL");
for (MiriamType mt: MiriamType.values()) {
protein.addMiriamData(new MiriamData(mt, "RAB40AL"));
}
MiriamData retardationSyndrome = new MiriamData(MiriamType.MESH_2012, "C564495");
elements.add(protein);
List<Chemical> chemicals = chemicalService.getForTargets(elements,
new DbSearchCriteria().disease(retardationSyndrome));
assertNotNull(chemicals);
assertTrue(chemicals.size() > 0);
assertEquals("No warnings expected.", 0, getWarnings().size());
}
}
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