diff --git a/CHANGELOG b/CHANGELOG index 1061d679327176adcda3861d98ead19ed0b84ae0..c2676d95aba4ed7e0ebf37528b679ace16e4272e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,8 +4,11 @@ minerva (10.0.5) stable; urgency=medium * Bug fix: interacting drugs can be found for RNAs * Bug fix: error handling improved on map upload + * Bug fix: taxonomy ncbi server switched to https + * Overlay presents description field if possible + - -- Piotr Gawron <piotr.gawron@uni.lu> Tue, 31 Jan 2017 12:00:00 +0200 + -- Piotr Gawron <piotr.gawron@uni.lu> Sat, 04 Mar 2017 12:00:00 +0200 minerva (10.0.4) stable; urgency=medium diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/cache/WebPageDownloader.java b/annotation/src/main/java/lcsb/mapviewer/annotation/cache/WebPageDownloader.java index dead2af17742c681b7107b134a97b835f645417b..9a7e8d6fe33c600b4c321c5af9e2ed88da9654b8 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/cache/WebPageDownloader.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/cache/WebPageDownloader.java @@ -1,9 +1,10 @@ package lcsb.mapviewer.annotation.cache; import java.io.BufferedReader; -import java.io.FileNotFoundException; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; +import java.net.ConnectException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; @@ -79,23 +80,23 @@ public class WebPageDownloader { // connect to the server, if HTTP_INTERNAL_ERROR occurres then try to // reconnect HTTP_INTERNAL_ERROR_RECONNECT_TIMES times - while (code == HttpURLConnection.HTTP_INTERNAL_ERROR || code == HttpURLConnection.HTTP_NOT_FOUND) { + while (code == HttpURLConnection.HTTP_INTERNAL_ERROR || code == HttpURLConnection.HTTP_NOT_FOUND) { urlConn = openConnection(accessUrl); urlConn.setRequestMethod("GET"); urlConn.addRequestProperty("User-Agent", "minerva-framework"); + try { urlConn.connect(); - try { code = urlConn.getResponseCode(); - } catch (FileNotFoundException e) { - code = HttpURLConnection.HTTP_NOT_FOUND; - } catch (IOException e) { - code = HttpURLConnection.HTTP_INTERNAL_ERROR; - } + } catch (FileNotFoundException e) { + code = HttpURLConnection.HTTP_NOT_FOUND; + } catch (IOException e) { + code = HttpURLConnection.HTTP_INTERNAL_ERROR; + } tries++; if (tries > HTTP_INTERNAL_ERROR_RECONNECT_TIMES) { break; } - if (code == HttpURLConnection.HTTP_INTERNAL_ERROR || code == HttpURLConnection.HTTP_NOT_FOUND) { + if (code == HttpURLConnection.HTTP_INTERNAL_ERROR || code == HttpURLConnection.HTTP_NOT_FOUND) { logger.debug("Problem with webpage: " + accessUrl); logger.debug("Retrying: " + accessUrl); try { @@ -108,7 +109,7 @@ public class WebPageDownloader { BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream())); result = IOUtils.toString(in); } catch (IOException e) { - if (e.getClass().equals(IOException.class) || e.getClass().equals(FileNotFoundException.class)) { + if (e.getClass().equals(IOException.class) || e.getClass().equals(FileNotFoundException.class)) { throw new WrongResponseCodeIOException(e, code); } else { throw e; diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java index b95922a2ba5f1559b0b1521954c0721e119e6b35..3a7d65c3169f06a0da280f4e0f2f1621c0f068bc 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java @@ -54,7 +54,7 @@ public class PubmedParser extends CachableInterface implements IExternalService /** * Version of the remote API thnat is supported by this connecting class. */ - static final String SUPPORTED_VERSION = "4.5.3.2"; + static final String SUPPORTED_VERSION = "5.0"; /** * Connector used for accessing data from miriam registry. diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/TaxonomyBackend.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/TaxonomyBackend.java index a0f44718f29b991165e5547e018467886d7cd3d0..e6d3655a19c8da6a8ed2a98aebaed3c3cef0e9b9 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/TaxonomyBackend.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/TaxonomyBackend.java @@ -179,7 +179,8 @@ public class TaxonomyBackend extends CachableInterface implements IExternalServi } try { - String url = "http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=" + miriamData.getResource(); + String url = "https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=" + miriamData.getResource(); + logger.debug(url); String page = getWebPageContent(url); Pattern idPattern = Pattern.compile("<h2>([A-Za-z0-9\\ \\.]+)</h2>"); Matcher matcher = idPattern.matcher(page); diff --git a/frontend-js/src/main/js/map/data/LayoutAlias.js b/frontend-js/src/main/js/map/data/LayoutAlias.js index b59ea9cd9bab63408df2cbcbaa6bad7305744a78..f8404122aa75161a684153d997a61fafde9f555a 100644 --- a/frontend-js/src/main/js/map/data/LayoutAlias.js +++ b/frontend-js/src/main/js/map/data/LayoutAlias.js @@ -13,6 +13,7 @@ function LayoutAlias(javaObject) { this.setValue(javaObject.value); this.setColor(javaObject.color); this.setModelId(javaObject.modelId); + this.setDescription(javaObject.description); if (javaObject.type === undefined) { this.setType(LayoutAlias.LIGTH); } else if (javaObject.type === LayoutAlias.GENETIC_VARIANT) { @@ -92,10 +93,19 @@ LayoutAlias.prototype.update = function(alias) { this.setColor(alias.getColor()); this.setGeneVariants(alias.getGeneVariants()); this.setType(alias.getType()); + this.setDescription(alias.getDescription()); }; LayoutAlias.prototype.addGeneVariant = function(geneVariant) { this._geneVariants.push(geneVariant); }; +LayoutAlias.prototype.getDescription = function() { + return this._description; +}; + +LayoutAlias.prototype.setDescription = function(description) { + this._description = description; +}; + module.exports = LayoutAlias; diff --git a/frontend-js/src/main/js/map/window/AliasInfoWindow.js b/frontend-js/src/main/js/map/window/AliasInfoWindow.js index 917279f0f4e7e92e31ea28a86be974cca0e4db4d..f59286e9ca2b09eae4c7ab32a43eee13a4a33aec 100644 --- a/frontend-js/src/main/js/map/window/AliasInfoWindow.js +++ b/frontend-js/src/main/js/map/window/AliasInfoWindow.js @@ -58,10 +58,10 @@ AliasInfoWindow.prototype.init = function() { var self = this; var alias = self.getAlias(); self.open(); - return self.getCustomMap().getTopMap().getSubmapById(alias.getModelId()).getModel().getAliasById(alias.getId(), - true).then(function(alias) { - return self.update(alias); - }); + return self.getCustomMap().getTopMap().getSubmapById(alias.getModelId()).getModel().getAliasById(alias.getId(), true) + .then(function(alias) { + return self.update(alias); + }); }; /** @@ -82,16 +82,23 @@ AliasInfoWindow.prototype.createChartDiv = function() { } else { rowDiv.className = "mapChartRowOddDiv"; } - + rowDiv.style.position = "relative"; var nameDiv = document.createElement("div"); nameDiv.className = "mapChartNameDiv"; - nameDiv.innerHTML = self.layoutNames[i]; + nameDiv.innerHTML = self.layoutNames[i] + " "; rowDiv.appendChild(nameDiv); rows[i] = rowDiv; if (data !== undefined && data !== null) { return functions.overlayToColor(data).then(function(color) { var value = parseFloat(data.value); + var description = data.description; + if (description == null || description == undefined || description == "") { + description = ""; + if (!isNaN(value)) { + description = value.toFixed(2); + } + } var leftMarginDiv = document.createElement("div"); leftMarginDiv.innerHTML = " "; leftMarginDiv.style.float = "left"; @@ -107,8 +114,13 @@ AliasInfoWindow.prototype.createChartDiv = function() { rightBarDiv.style.background = color; rightBarDiv.style.width = Math.abs(value * 100) + "px"; var offset = 100; + var descDiv = document.createElement("div"); + descDiv.style.float = "right"; + descDiv.style.textAlign = "right"; + descDiv.style.position = "absolute"; + descDiv.style.right = "0"; + descDiv.innerHTML = "<span>" + description + "</span>"; if (!isNaN(value)) { - rightBarDiv.innerHTML = value.toFixed(2); if (value > 0) { offset = 100; leftMarginDiv.style.width = offset + "px"; @@ -133,10 +145,12 @@ AliasInfoWindow.prototype.createChartDiv = function() { leftMarginDiv.style.background = color; rightBarDiv.style.width = offset + "px"; rightBarDiv.style.background = color; + rightBarDiv.style.textAlign = "right"; rowDiv.appendChild(leftMarginDiv); rowDiv.appendChild(centerBarDiv); rowDiv.appendChild(rightBarDiv); } + rowDiv.appendChild(descDiv); }); } else { var emptyDiv = document.createElement("div"); @@ -175,9 +189,9 @@ AliasInfoWindow.prototype.createContentDiv = function() { return self.getCustomMap().getAliasVisibleLayoutsData(alias.getId()).then(function(layoutAliases) { self.layoutAliases = layoutAliases; return self.getCustomMap().getTopMap().getVisibleDataOverlays(); - }).then(function(dataOverlays){ + }).then(function(dataOverlays) { self.layoutNames = []; - for (var i=0;i<dataOverlays.length;i++) { + for (var i = 0; i < dataOverlays.length; i++) { logger.debug(dataOverlays[i]); self.layoutNames.push(dataOverlays[i].getName()); } diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/cache/CacheTypeDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/cache/CacheTypeDaoTest.java index 6503a44c5afc8427867d345bedd3771e5e02f702..7560b89213747774262df2772003c4a57f59f10f 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/cache/CacheTypeDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/cache/CacheTypeDaoTest.java @@ -72,7 +72,6 @@ public class CacheTypeDaoTest extends PersistTestFunctions { try { CacheType cacheType = cacheTypeDao.getByClassName("lcsb.mapviewer.annotation.services.PubmedParser"); assertNotNull(cacheType); - assertEquals(3,cacheType.getId()); } catch (Exception e) { e.printStackTrace(); throw e; @@ -84,7 +83,6 @@ public class CacheTypeDaoTest extends PersistTestFunctions { try { CacheType cacheType = cacheTypeDao.getByClassName("lcsb.mapviewer.annotation.services.DrugbankHTMLParser"); assertNotNull(cacheType); - assertEquals(4,cacheType.getId()); } catch (Exception e) { e.printStackTrace(); throw e; @@ -96,7 +94,6 @@ public class CacheTypeDaoTest extends PersistTestFunctions { try { CacheType cacheType = cacheTypeDao.getByClassName("lcsb.mapviewer.annotation.cache.MockCacheInterface"); assertNotNull(cacheType); - assertEquals(6,cacheType.getId()); } catch (Exception e) { e.printStackTrace(); throw e; @@ -108,7 +105,6 @@ public class CacheTypeDaoTest extends PersistTestFunctions { try { CacheType cacheType = cacheTypeDao.getByClassName("lcsb.mapviewer.annotation.services.annotators.ChebiAnnotator"); assertNotNull(cacheType); - assertEquals(7,cacheType.getId()); } catch (Exception e) { e.printStackTrace(); throw e; @@ -120,7 +116,6 @@ public class CacheTypeDaoTest extends PersistTestFunctions { try { CacheType cacheType = cacheTypeDao.getByClassName("lcsb.mapviewer.annotation.services.annotators.GoAnnotator"); assertNotNull(cacheType); - assertEquals(8,cacheType.getId()); } catch (Exception e) { e.printStackTrace(); throw e; diff --git a/service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaReader.java b/service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaReader.java index 1d59bc9127d17416136204f696e6601f3fad8afe..bd87924864d6d0f5bfac073ffae510e762183308 100644 --- a/service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaReader.java +++ b/service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaReader.java @@ -453,6 +453,7 @@ public class ColorSchemaReader { Integer typeColumn = schemaColumns.get(ColorSchemaColumn.TYPE); Integer lineWidthColumn = schemaColumns.get(ColorSchemaColumn.LINE_WIDTH); Integer reverseReactionColumn = schemaColumns.get(ColorSchemaColumn.REVERSE_REACTION); + Integer descriptionColumn = schemaColumns.get(ColorSchemaColumn.DESCRIPTION); if (valueColumn != null && colorColumn != null) { throw new InvalidColorSchemaException("Schema can contain only one of these two columns: " + columns[valueColumn] + ", " + columns[colorColumn]); @@ -512,6 +513,9 @@ public class ColorSchemaReader { if (colorColumn != null) { schema.setColor(colorParser.parse(values[colorColumn])); } + if (descriptionColumn != null) { + schema.setDescription(values[descriptionColumn]); + } if (reactionIdentifierColumn != null) { processReactionIdentifier(schema, values[reactionIdentifierColumn]); }