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

Merge branch '1520-drug-suggested-list' into 'devel_16.0.x'

Resolve "Autocomplete does not work"

See merge request !1384
parents 016faf10 7c81e666
Pipeline #49922 passed with stage
in 26 minutes and 4 seconds
......@@ -20,8 +20,10 @@ minerva (16.0.1) stable; urgency=medium
were projects with a lot of log entries (#1588)
* Bug fix: complex target of chembl compounds (like ME-344) were not
highligted on map (#1579)
* Bug fix: chembl drugs targeting RNA (like BEVASIRANIB) prevented providing
list of suggested drug queries (#1520)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 2 Nov 2021 15:00:00 +0200
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 9 Nov 2021 15:00:00 +0200
minerva (16.0.0) stable; urgency=medium
* Backward incompatibility: debian package cannot be upgraded from version
......
package lcsb.mapviewer.annotation.services.annotators;
import java.io.IOException;
import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import lcsb.mapviewer.annotation.cache.GeneralCacheInterface;
import lcsb.mapviewer.annotation.cache.WebPageDownloader;
import lcsb.mapviewer.annotation.services.*;
import lcsb.mapviewer.annotation.services.ExternalServiceStatus;
import lcsb.mapviewer.annotation.services.ExternalServiceStatusType;
import lcsb.mapviewer.annotation.services.IExternalService;
import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.common.exception.NotImplementedException;
import lcsb.mapviewer.model.ProjectLogEntryType;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.species.*;
import lcsb.mapviewer.model.user.annotator.*;
import lcsb.mapviewer.model.map.species.Gene;
import lcsb.mapviewer.model.map.species.Protein;
import lcsb.mapviewer.model.map.species.Rna;
import lcsb.mapviewer.model.user.annotator.AnnotatorData;
import lcsb.mapviewer.model.user.annotator.AnnotatorInputParameter;
import lcsb.mapviewer.model.user.annotator.AnnotatorOutputParameter;
import lcsb.mapviewer.model.user.annotator.BioEntityField;
/**
* This is a class that implements a backend to uniprot restfull API.
......@@ -164,8 +177,8 @@ public class UniprotAnnotator extends ElementAnnotator implements IExternalServi
}
/**
* Returns URL to UniProt result containing mapped UniProtIds for submitted TAIR
* entry.
* Returns URL to UniProt result containing mapped UniProtIds for submitted
* TAIR entry.
*
* @param tairId
* TAIR identifier
......@@ -177,8 +190,8 @@ public class UniprotAnnotator extends ElementAnnotator implements IExternalServi
}
/**
* Parse uniprot webpage to find information about {@link MiriamType#ENTREZ} and
* returns them.
* Parse uniprot webpage to find information about {@link MiriamType#ENTREZ}
* and returns them.
*
* @param pageContent
* uniprot info page
......@@ -254,6 +267,13 @@ public class UniprotAnnotator extends ElementAnnotator implements IExternalServi
} else {
return null;
}
} catch (WrongResponseCodeIOException e) {
if (e.getResponseCode() == HttpStatus.NOT_FOUND.value()) {
logger.warn("Unknown uniprot id: " + uniprot.getResource());
return null;
} else {
throw new UniprotSearchException("Problem with accessing uniprot webpage", e);
}
} catch (IOException e) {
throw new UniprotSearchException("Problem with accessing uniprot webpage", e);
}
......
......@@ -125,6 +125,11 @@ public class UniprotAnnotatorTest extends AnnotationTestFunctions {
uniprotAnnotator.uniProtToHgnc(new MiriamData(MiriamType.WIKIPEDIA, "bla"));
}
@Test
public void testUnknownUniprotId() throws Exception {
assertNull(uniprotAnnotator.uniProtToHgnc(new MiriamData(MiriamType.UNIPROT, "bla")));
}
@Test
public void testAnnotate2() throws Exception {
Species protein = new GenericProtein("id");
......
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