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

search by target didn't work if target was annotated automatically

parent 89c320bf
......@@ -22,6 +22,8 @@ minerva (14.0.0~alpha.0) unstable; urgency=low
with SBML standard (#831)
* Bug fix: MiRNA targets are limited only to the organism associated with the
map (#66)
* Bug fix: Search drug by target element did not return values when this
element was annotated automatically (#216)
-- Sascha Herzinger <sascha.herzinger@uni.lu> Wed, 22 May 2019 10:30:00 +0200
......
......@@ -621,12 +621,13 @@ public class DrugbankHTMLParser extends DrugAnnotation implements IExternalServi
}
@Override
public List<Drug> getDrugListByTarget(MiriamData targetMiriamData, Collection<MiriamData> organisms)
public List<Drug> getDrugListByTarget(MiriamData target, Collection<MiriamData> organisms)
throws DrugSearchException {
List<Drug> result = new ArrayList<>();
if (targetMiriamData == null) {
if (target == null) {
return result;
}
MiriamData targetMiriamData = new MiriamData(target.getDataType(), target.getResource());
if (!(MiriamType.HGNC_SYMBOL.equals(targetMiriamData.getDataType()))) {
throw new InvalidArgumentException("Only " + MiriamType.HGNC_SYMBOL + " type is accepted");
}
......@@ -747,10 +748,13 @@ public class DrugbankHTMLParser extends DrugAnnotation implements IExternalServi
* the target and we need to filter it out (here is an example for TF targets:
* https://www.drugbank.ca/unearth/q?utf8=%E2%9C%93&searcher=targets&query=TF)
*
* @param page - target webpage content
* @param hgncTarget - HGNC identifier that should match the target
* @param page
* - target webpage content
* @param hgncTarget
* - HGNC identifier that should match the target
* @return
* @throws UniprotSearchException - when there is problem with translating HGNC<->uniprot
* @throws UniprotSearchException
* - when there is problem with translating HGNC<->uniprot
*/
boolean targetPageMatchTarget(String page, MiriamData hgncTarget) throws UniprotSearchException {
int protienLinkPosition = page.indexOf("/polypeptides/");
......
......@@ -470,8 +470,8 @@ public class MiRNAParser extends CachableInterface implements IExternalService {
* the parameter.
*
* @param targetsMiriam
* targets that should be targeted by resulting mir rnas
* @return list of mirnas that target elements identified by paramter
* targets that should be targeted by resulting mirnas
* @return list of mirnas that target elements identified by parameter
* @throws MiRNASearchException
* thrown when there is a problem with accessing mirna database
*/
......
......@@ -273,6 +273,23 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
}
}
@Test
public void testGetByTargetWithAnnotator() throws Exception {
try {
MiriamData target = new MiriamData(MiriamType.HGNC_SYMBOL, "GCH1", String.class);
List<MiriamData> targets = new ArrayList<>();
targets.add(target);
List<Chemical> list = chemicalParser.getChemicalListByTarget(targets, dystoniaDisease);
assertNotNull(list);
assertFalse(list.isEmpty());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testGetByInvalidTarget() throws Exception {
try {
......
......@@ -238,6 +238,19 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
}
}
@Test
public void testFindDrugByHgncTargetWithAnnotatorAssigned() throws Exception {
try {
List<Drug> drugs = drugBankHTMLParser.getDrugListByTarget(new MiriamData(MiriamType.HGNC_SYMBOL, "SIRT3", String.class));
assertNotNull(drugs);
assertTrue("At least 1 drug was expected", drugs.size() >= 1);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testTargetPageMatchTargetForTFProtein() throws Exception {
try {
......
......@@ -159,6 +159,31 @@ public class MiRNAParserTest extends AnnotationTestFunctions {
}
}
@Test
public void testFindByTargetWithAnnotator() throws Exception {
try {
Set<MiriamData> targets = new HashSet<>();
MiriamData hgncTarget = new MiriamData(MiriamType.HGNC_SYMBOL, "PLAG1", String.class);
targets.add(hgncTarget);
List<MiRNA> listFromDB = miRNAParser.getMiRnaListByTargets(targets);
assertTrue(listFromDB.size() > 0);
hgncTarget.setAnnotator(null);
for (MiRNA miRNA : listFromDB) {
boolean found = false;
for (Target targt : miRNA.getTargets()) {
if (targt.getGenes().contains(hgncTarget)) {
found = true;
}
}
assertTrue(found);
}
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test(timeout = 50000)
public void testCachableInterfaceInvalidateMiRNA() throws Exception {
try {
......
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