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

Merge branch 'hsql implementation' into 1016-refactor-test-framework

parents 24334724 8bc2ff6d
......@@ -5,10 +5,20 @@ stages:
- packaging
- test
cache:
paths:
- maven.repository/
variables:
POSTGRES_DB: map_viewer
POSTGRES_USER: map_viewer
POSTGRES_PASSWORD: "123qweasdzxc"
MAVEN_OPTS: "-Dmaven.repo.local=maven.repository"
before_script:
#by default we configure postgres database
- mkdir /etc/minerva/
- cp test-postgres-db-ci.properties /etc/minerva/db.properties
test:frontend:
stage: test
......@@ -32,6 +42,16 @@ test:frontend:
stage: test
coverage: '/(\d+.\d+) \% covered/'
.hsql_template: &hsql_definition
image: maven:3.6.0-jdk-11
stage: test
coverage: '/(\d+.\d+) \% covered/'
before_script:
#by default we configure postgres database
- rm -rf /etc/minerva/
- mkdir /etc/minerva/
- cp test-hsql-db-ci.properties /etc/minerva/db.properties
.test_backend_commons_template:
script: &test_backend_commons_definition
#xvfb is for X11 connection used by some parts of the java code: https://stackoverflow.com/a/47575851/1127920
......@@ -46,9 +66,6 @@ test:frontend:
.test_backend_annotation_template:
script: &test_backend_annotation_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl annotation -am
- mvn test -pl annotation
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' annotation/target/site/jacoco/jacoco.csv
......@@ -86,8 +103,6 @@ test:frontend:
.test_backend_converter_SBGNML_template:
script: &test_backend_converter_SBGNML_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl converter-SBGNML -am
- mvn test -pl converter-SBGNML
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-SBGNML/target/site/jacoco/jacoco.csv
......@@ -118,16 +133,12 @@ test:frontend:
.test_backend_persist_template:
script: &test_backend_persist_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl persist -am
- mvn test -pl persist
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' persist/target/site/jacoco/jacoco.csv
.test_backend_rest_template:
script: &test_backend_rest_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl rest-api -am
- mvn test -pl rest-api
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' rest-api/target/site/jacoco/jacoco.csv
......@@ -138,16 +149,12 @@ test:frontend:
- DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant
- curl -sL https://deb.nodesource.com/setup_9.x | bash -
- DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl web -am
- mvn test -pl web
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' web/target/site/jacoco/jacoco.csv
.test_backend_service_template:
script: &test_backend_service_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl service -am
- mvn test -pl service
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' service/target/site/jacoco/jacoco.csv
......@@ -169,6 +176,10 @@ test:backend:annotation:jdk-11:
<<: *jdk_11_definition
script: *test_backend_annotation_definition
test:backend:annotation:jdk-11-hsql:
<<: *hsql_definition
script: *test_backend_annotation_definition
test:backend:CellDesigner_plugin:jdk-8:
<<: *jdk_8_definition
script: *test_backend_CellDesigner_plugin_definition
......@@ -202,6 +213,10 @@ test:backend:converter_SBGNML:jdk-11:
<<: *jdk_11_definition
script: *test_backend_converter_SBGNML_definition
test:backend:converter_SBGNML:jdk-11-hsql:
<<: *hsql_definition
script: *test_backend_converter_SBGNML_definition
test:backend:converter_SBML:jdk-8:
<<: *jdk_8_definition
script: *test_backend_converter_SBML_definition
......@@ -242,6 +257,10 @@ test:backend:persist:jdk-11:
<<: *jdk_11_definition
script: *test_backend_persist_definition
test:backend:persist:hsql:
<<: *hsql_definition
script: *test_backend_persist_definition
test:backend:rest:jdk-8:
<<: *jdk_8_definition
script: *test_backend_rest_definition
......@@ -250,6 +269,10 @@ test:backend:rest:jdk-11:
<<: *jdk_11_definition
script: *test_backend_rest_definition
test:backend:rest:hsql:
<<: *hsql_definition
script: *test_backend_rest_definition
test:backend:service:jdk-8:
<<: *jdk_8_definition
script: *test_backend_service_definition
......@@ -258,6 +281,10 @@ test:backend:service:jdk-11:
<<: *jdk_11_definition
script: *test_backend_service_definition
test:backend:service:hsql:
<<: *hsql_definition
script: *test_backend_service_definition
test:backend:web:jdk-8:
<<: *jdk_8_definition
script: *test_backend_web_definition
......@@ -266,6 +293,10 @@ test:backend:web:jdk-11:
<<: *jdk_11_definition
script: *test_backend_web_definition
test:backend:web:hsql:
<<: *jdk_11_definition
script: *test_backend_web_definition
build_war:
image: maven:3.6.0-jdk-8
stage: build
......@@ -313,6 +344,8 @@ build_debian_package:
dependencies:
- build_war
artifacts:
# you cannot enforce never here yet
expire_in: 1000 yrs
paths:
- "debian/*.deb"
script:
......@@ -427,6 +460,8 @@ build_rpm:
tags:
- privileged
artifacts:
# you cannot enforce never here yet
expire_in: 1000 yrs
paths:
- "rpm/rpmbuildtemp/RPMS/noarch/minerva-*.rpm"
script:
......@@ -479,8 +514,6 @@ test_deploy_with_db_without_superadmin_rights:
image: maven:3.6.0-jdk-8
stage: test
script:
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl persist -am
- mvn test -pl persist
......
minerva (15.0.0~beta.0) stable; urgency=medium
* Feature removal: old connection to CTD is removed and replaced with
new Data-API interface that closely check license compliance
* Feature removal: some custom fields (like transparency zoom level) are not
exported to CellDesigner file (#1071)
* Improvement: export to SBGN/SBML/GPML format provides popup with list of
warnings occurred in the translation process (#713)
* Small improvement: autocomplete for chemical searches is enabled (#841)
* Small improvement: import/export to SBML of unit of information obtained
from SBGN source is supported (#1088)
* Small improvement: rounded rectangle is used to visualize Simple chemicals
in SBGN-like view according to the newest SBGN specification (#1094)
* Small improvement: after removing project is confirmed the system enforce
waiting until remove status is confirmed (#1106)
* Bug fix: import from SBGN assigned invalid name to species that didn't have
label defined (#1093)
* Bug fix: drawing protein in SBGN-like style didn't handle properly
dimension of the species for multimers bigger than 2 (#1091)
* Bug fix: drawing of structural state in SBGN-like style uses
RoundedRectangle insetad of Ellipse which was not SBGN-compliant (#1095)
* Bug fix: export to GPML provided invalid font size and pathviosio could not
open it (#1108)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 28 Jan 2020 13:00:00 +0200
minerva (15.0.0~alpha.2) stable; urgency=medium
* Feature removal: old connection to DrugBank is removed and replaced with
new Data-API interface that closely check license compliance
* Small improvement: when typing drug, list of autocomplete drugs should be
available limited to the drugs targetting something on the map (#641)
* Small improvement: data not compliant with database constraints (for
instance too long species identifiers) will be automatically adjust instead
of crashing project upload (#1041)
......@@ -7,8 +36,10 @@ minerva (15.0.0~alpha.2) stable; urgency=medium
* Bug fix: import from CellDesigner rounded alias dimension to integer
* Bug fix: old project with structural state couldn't be removed (regression
15.0.0~alpha.1, #1021)
* Bug fix: procseing sbgn file with render information was breaking sometimes
(regresion 15.0.0~alpha.1, #1020)
* Bug fix: processing sbgn file with render information was breaking sometimes
(regression 15.0.0~alpha.1, #1020)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 22 Jan 2020 13:00:00 +0200
minerva (15.0.0~alpha.1) stable; urgency=medium
* Feature removal: when uploading complex map with submap there is no
......@@ -72,6 +103,43 @@ minerva (15.0.0~alpha.0) stable; urgency=medium
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 4 Nov 2019 11:00:00 +0200
minerva (14.0.9) stable; urgency=medium
* Bug fix: simultanous export to SBML of more than one file could result in
500 Internal Server Error (#1110)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 3 Feb 2020 15:00:00 +0200
minerva (14.0.8) stable; urgency=medium
* Bug fix: API didn't allow to upload plugins with local url (#1084,
regression 14.0.7)
* Bug fix: upload of data overlay with two entries having different uniprot
identifier but pointing to the same gene crashed (#1083)
* Bug fix: don't allow to remove plugin twice (#1081)
* Bug fix: upload of SBML file with very short reaction length could produce
a map that couldn't be exported to SBML anymore (#1078)
* Bug fix: import of structural state from SBGN-ML PD that cannot be
normalized to residue is changed into structural state without losing
information (#1062)
* Bug fix: import of stimulation modifiers from SBGN-ML crashed converter
(#1063)
* Bug fix: export to SBGN files created from newt source produced corrupted
disconnected reactions
* Bug fix: upload from zip file allowed empty overlay name (#1065)
* Bug fix: genome browser slider didn't work properly in Safari on
non-default Browser zoom level (#1048)
* Bug fix: project without background overlay but with some custom data
overlays crashed with an error (#1066)
* Bug fix: when session expires updating options in configuration panel threw
unhandled error (#1068)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 28 Jan 2020 11:00:00 +0200
minerva (14.0.7) stable; urgency=high
* Bug fix: API allowed to provide malformed plugin url that could be used for
xss attack (#1073)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 14 Jan 2020 17:00:00 +0200
minerva (14.0.6) stable; urgency=medium
* Bug fix: opening map with no background overlays and search request in url
provides proper error message (#1046)
......
......@@ -11,11 +11,6 @@
<!-- dependency from the MapViewer model -->
<repositories>
<repository>
<id>central</id>
<url>http://repo.maven.apache.org/maven2/</url>
</repository>
<repository>
<id>repo</id>
<releases>
......
......@@ -11,28 +11,6 @@
<name>Annotation module</name>
<description>Module used for preparing annotations for model and connect to external resources.</description>
<repositories>
<!-- Main repository of ebi -->
<repository>
<id>central</id>
<url>http://repo.maven.apache.org/maven2/</url>
</repository>
<!-- Repository used for chebi -->
<repository>
<id>ebi-repo</id>
<name>The EBI internal repository</name>
<url>http://www.ebi.ac.uk/~maven/m2repo</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<!-- dependency from the MapViewer model -->
......@@ -253,6 +231,37 @@
<version>${commons-codec.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven/maven-artifact -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.6.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-validator/commons-validator -->
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${commons-validator.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- mockito used for testing -->
<dependency>
<groupId>org.mockito</groupId>
......@@ -268,5 +277,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -124,6 +124,12 @@ public abstract class CachableInterface {
}
}
protected final void removeCacheValue(String key) {
if (cache != null) {
cache.removeByQuery(key, getCacheType());
}
}
/**
* @return the cacheType
* @see #cacheType
......
......@@ -292,6 +292,10 @@ public class Chemical implements Serializable, TargettingStructure {
this.synonyms.addAll(synonyms);
}
public void addTarget(Target target) {
this.getTargets().add(target);
}
/**
* Comparator of the objects by their name.
*
......@@ -311,4 +315,8 @@ public class Chemical implements Serializable, TargettingStructure {
}
public void removeTargets(Set<Target> targetsToRemove) {
this.getTargets().removeAll(targetsToRemove);
}
}
......@@ -270,15 +270,6 @@ public class Drug implements Serializable, TargettingStructure {
return targets;
}
/**
* @param targets
* the targets to set
* @see #targets
*/
public void setTargets(List<Target> targets) {
this.targets = targets;
}
/**
* @param sources
* the sources to set
......@@ -333,4 +324,12 @@ public class Drug implements Serializable, TargettingStructure {
}
}
public void addBrandNames(List<String> brandNames) {
this.brandNames.addAll(brandNames);
}
public void addSynonyms(List<String> synonyms) {
this.synonyms.addAll(synonyms);
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ public class Target implements Serializable {
/**
* Default class logger.
*/
private static transient Logger logger = LogManager.getLogger(Target.class);
private static transient Logger logger = LogManager.getLogger();
/**
* Database from which target was received.
......@@ -45,6 +45,8 @@ public class Target implements Serializable {
*/
private MiriamData organism;
private MiriamData associatedDisease;
/**
* List of genes located in a target.
*/
......@@ -223,7 +225,15 @@ public class Target implements Serializable {
@Override
public String toString() {
return "[" + this.getClass().getSimpleName() + "]: " + name + ", source: " + source + ", organism: " + organism
+ "; ";
+ "; disease: " + associatedDisease;
}
public MiriamData getAssociatedDisease() {
return associatedDisease;
}
public void setAssociatedDisease(MiriamData associatedDisease) {
this.associatedDisease = associatedDisease;
}
}
......@@ -5,7 +5,6 @@ import org.apache.logging.log4j.Marker;
import lcsb.mapviewer.model.LogMarker;
import lcsb.mapviewer.model.ProjectLogEntryType;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.modelutils.map.ElementUtils;
/**
* Defines annotation problem with element when there are no annotations for the
......
......@@ -8,7 +8,6 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.model.LogMarker;
import lcsb.mapviewer.model.ProjectLogEntryType;
import lcsb.mapviewer.model.map.*;
import lcsb.mapviewer.modelutils.map.ElementUtils;
/**
* Defines problem with element annotation when there are some required
......
......@@ -36,7 +36,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi
/**
* Version of the rest API that is supported by this annotator.
*/
static final String SUPPORTED_VERSION = "11.1";
static final String SUPPORTED_VERSION = "11.2";
/**
* Url address of ensembl restful service.
......
package lcsb.mapviewer.annotation.services.dapi;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import lcsb.mapviewer.annotation.data.Chemical;
import lcsb.mapviewer.annotation.data.Target;
import lcsb.mapviewer.annotation.services.dapi.dto.*;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.map.*;
import lcsb.mapviewer.model.map.model.ModelData;
import lcsb.mapviewer.model.map.model.ModelSubmodelConnection;
@Service
public class ChemicalParser {
private static final String DAPI_DATABASE_NAME = "CTD";
private Logger logger = LogManager.getLogger();
private DapiConnector dapiConnector;
private ChemicalEntityDtoConverter chemicalEntityDtoConverter;
ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
@Autowired
public ChemicalParser(DapiConnector dapiConnector, ChemicalEntityDtoConverter chemicalEntityDtoConverter) {
this.dapiConnector = dapiConnector;
this.chemicalEntityDtoConverter = chemicalEntityDtoConverter;
}
/**
* @param disease
* the MESH Id for the disease
* @return list of chemicals id, name pairs
* @throws ChemicalSearchException
* thrown when there is problem with accessing ctd database
*/
public List<Chemical> getChemicalsForDisease(MiriamData disease) throws ChemicalSearchException {
if (disease == null || disease.getResource() == null) {
throw new InvalidArgumentException("disease cannot be null");
}
if (!dapiConnector.isValidConnection()) {
return new ArrayList<>();
}
try {
String url = dapiConnector.getLatestReleaseUrl(DAPI_DATABASE_NAME);
if (url == null) {
return null;
}
String content = dapiConnector
.getAuthenticatedContent(
url + "/drugs/?size=1000&columns=sourceIdentifier&target_disease_identifier="
+ URLEncoder.encode(disease.getPrefixedIdentifier(), "UTF-8"));
ListChemicalEntityDto dto = objectMapper.readValue(content, ListChemicalEntityDto.class);
return fetchChemicals(dto, disease);
} catch (DapiConnectionException | IOException e) {
throw new ChemicalSearchException("Problem with accessing DAPI", e);
}
}
/**
* Returns list of chemicals for given set of target genes related to the
* disease.
*
* @param targets
* set of target genes
* @param disease
* identifier of the disease
* @return list of chemicals for given set of target genes related to the
* disease
* @throws ChemicalSearchException
* thrown when there is a problem with accessing ctd database
*/
public List<Chemical> getChemicalListByTarget(Collection<MiriamData> targets, MiriamData disease)
throws ChemicalSearchException {
Map<MiriamData, Chemical> chemicals = new HashMap<>();
for (MiriamData miriamData : targets) {
for (Chemical chemical : getChemicalListByTarget(miriamData, disease)) {
chemicals.put(chemical.getChemicalId(), chemical);
}
}
return new ArrayList<>(chemicals.values());
}
/**
* Returns list of chemicals that interact with a target.
*
* @param target
* target for which we are looking for chemicals
* @param disease
* we want to get chemicals in context of the disease
* @return list of chemicals that interact with a target
* @throws ChemicalSearchException
* thrown when there is a problem with accessing chemical database
*/
public List<Chemical> getChemicalListByTarget(MiriamData target, MiriamData disease) throws ChemicalSearchException {
if (target == null) {
return new ArrayList<>();
}
if (!dapiConnector.isValidConnection()) {
return new ArrayList<>();
}
List<MiriamData> targets = extractHgncTargets(target);
try {