Skip to content
Snippets Groups Projects
Commit 9c8784da authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '246-add-doi-in-miriam-types' into 'master'

Resolve "add doi in miriam types"

Closes #246

See merge request piotr.gawron/minerva!165
parents 9b2f3fd2 53e1c40d
No related branches found
No related tags found
1 merge request!165Resolve "add doi in miriam types"
Pipeline #
......@@ -208,6 +208,21 @@ public class MiriamConnectorTest extends AnnotationTestFunctions {
}
}
@Test
public void testGetUrlForDoi() throws Exception {
try {
// exclude first cached value
MiriamData md = new MiriamData(MiriamType.DOI, "10.1038/npjsba.2016.20");
String url = miriamConnector.getUrlString(md);
assertNotNull(url);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testMiriamDataToUri() throws Exception {
try {
......
......@@ -14,6 +14,8 @@ log4j.appender.R.File=${catalina.home}/logs/MapViewer.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n
#Silence miriam debug logs
log4j.logger.uk.ac.ebi.miriam.lib=warn
log4j.logger.org.springframework=warn
log4j.logger.org.hibernate=warn
......
......@@ -119,7 +119,8 @@ GuiUtils.prototype.createAnnotationLink = function (annotation, showType) {
type = "PUBMED";
name = article.getId();
} else {
name = annotation.getResource();
//replace encoded parts of uri (like %2F - > "/")
name = decodeURIComponent(annotation.getResource());
var miriamType = self.getConfiguration().getMiriamTypeByName(annotation.getType());
if (miriamType === null) {
logger.warn("Unknown miriam type: " + annotation.getType());
......
......@@ -3,6 +3,7 @@
require('../../mocha-config.js');
var Alias = require('../../../../main/js/map/data/Alias');
var Annotation = require('../../../../main/js/map/data/Annotation');
var GuiUtils = require('../../../../main/js/gui/leftPanel/GuiUtils');
var chai = require('chai');
......@@ -11,7 +12,7 @@ var logger = require('../../logger');
describe('GuiUtils', function () {
it('constructor', function() {
it('constructor', function () {
var map = helper.createCustomMap();
helper.createSearchDbOverlay(map);
......@@ -21,19 +22,19 @@ describe('GuiUtils', function () {
it('default', function () {
var aliasObj = {
symbol : "S1_SYMBOL",
formerSymbols : [],
modelId : 15781,
synonyms : [ "syn44" ],
description : "DESCRIPTION",
type : "Simple molecule",
abbreviation : "ABBREVIATION",
name : "s1",
bounds : {
x : 170.0,
y : 171.5,
width : 70.0,
height : 25.0
symbol: "S1_SYMBOL",
formerSymbols: [],
modelId: 15781,
synonyms: ["syn44"],
description: "DESCRIPTION",
type: "Simple molecule",
abbreviation: "ABBREVIATION",
name: "s1",
bounds: {
x: 170.0,
y: 171.5,
width: 70.0,
height: 25.0
},
formula: "FORMULA",
id: 380217,
......@@ -152,5 +153,21 @@ describe('GuiUtils', function () {
assert.ok(logger.getWarnings().length > 0);
});
});
describe('createAnnotationLink', function () {
it('with encoded part in resource', function () {
// noinspection SpellCheckingInspection
var annotation = new Annotation({
resource: "10.1038%2Fnpjsba.2016.20",
link: "http://doi.org/10.1038%2Fnpjsba.2016.20",
id: 1116748,
type: "DOI"
});
var guiUtils = new GuiUtils(helper.getConfiguration());
var link = guiUtils.createAnnotationLink(annotation);
assert.ok(link);
assert.equal(0, logger.getWarnings().length);
assert.ok(link.innerHTML.indexOf("%2F") < 0, "url contains encoded %2F part of id");
});
});
});
......@@ -33,3 +33,6 @@ log4j.logger.lcsb.mapviewer.db.model.map.reaction.ReactionComparator=warn
log4j.logger.lcsb.mapviewer.db.model.map.species.ProteinComparator=warn
log4j.logger.lcsb.mapviewer.db.model.map.layout.alias.ComplexAliasComparator=warn
log4j.logger.lcsb.mapviewer.db.model.map.Element=info
#Silence miriam debug logs
log4j.logger.uk.ac.ebi.miriam.lib=warn
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment