Commit 6d66fda4 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'master' into 100-export-should-use-api

parents 3d571a4b 7a63db68
Pipeline #2313 passed with stage
in 37 seconds
image: node
before_script:
- cd frontend-js
- npm install
- cd ..
test_frontend:
script:
- cd frontend-js
- npm test
\ No newline at end of file
minerva (11.0.1) stable; urgency=medium
* Bug fix: logout caused issues with session data
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 08 Sep 2017 12:00:00 +0200
minerva (11.0.0) stable; urgency=medium
* Bug fix: security issue - access to specific map can be restricted
by the userlogin
* Bug fix: sbgn import
* Bug fix: mesh connector
* Rest API (documentation can be found here:
https://git-r3lab.uni.lu/piotr.gawron/minerva/blob/master/README.md)
* Selecting an element on the map shows info about it in the bottom left
corner (when Search tab is not open)
* Upload of data overlays allows to upload just names of the proteins
(or other elements), it can be done via file or just by typing in the
proper text box
* Layout changes: the main one is that there are only 3 tab panels
(search, overlay, info), so it should be easier to navigate
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 28 Aug 2017 12:00:00 +0200
minerva (10.0.5) stable; urgency=medium
* Bug fix: interacting drugs can be found for RNAs
......
[![build status](https://git-r3lab.uni.lu/piotr.gawron/minerva/badges/207-continous-integration-tests/build.svg)](https://git-r3lab.uni.lu/piotr.gawron/minerva/commits/207-continous-integration-tests)
# Rest API (version 11)
## Introduction
......
......@@ -19,9 +19,9 @@ import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.Species;
/**
* Interface that allows to annotate {@link BioEntity elements} in the
* system. Different implementation use different resources to perform
* annotation. They can annotate different types of elements.
* Interface that allows to annotate {@link BioEntity elements} in the system.
* Different implementation use different resources to perform annotation. They
* can annotate different types of elements.
*
* @author Piotr Gawron
*
......@@ -31,7 +31,7 @@ public abstract class ElementAnnotator extends CachableInterface {
/**
* Default class logger.
*/
private final Logger logger = Logger.getLogger(ElementAnnotator.class);
private final Logger logger = Logger.getLogger(ElementAnnotator.class);
/**
* List of classes that can be annotated by this {@link IElementAnnotator
......@@ -42,7 +42,7 @@ public abstract class ElementAnnotator extends CachableInterface {
/**
* Should be this annotator used as a default annotatior.
*/
private boolean isDefault = false;
private boolean isDefault = false;
/**
* Default constructor.
......@@ -61,8 +61,7 @@ public abstract class ElementAnnotator extends CachableInterface {
if (BioEntity.class.isAssignableFrom(validClass)) {
addValidClass((Class<? extends BioEntity>) validClass);
} else {
throw new InvalidArgumentException(
"Cannot pass class of type: " + validClass + ". Only classes extending " + BioEntity.class + " are accepted.");
throw new InvalidArgumentException("Cannot pass class of type: " + validClass + ". Only classes extending " + BioEntity.class + " are accepted.");
}
}
this.isDefault = isDefault;
......@@ -193,7 +192,7 @@ public abstract class ElementAnnotator extends CachableInterface {
List<String> sortedSynonyms = new ArrayList<>();
sortedSynonyms.addAll(synonyms);
Collections.sort(sortedSynonyms);
element.setSynonyms(sortedSynonyms);
} else {
logger.warn(prefix + "Synonyms don't match: \"" + synonyms + "\", \"" + element.getSynonyms() + "\"");
......@@ -227,10 +226,12 @@ public abstract class ElementAnnotator extends CachableInterface {
* value to set
*/
protected void setDescription(BioEntity element, String description) {
if (element.getNotes() == null || element.getNotes().equals("") || element.getNotes().equals(description)) {
element.setNotes(description);
} else if (!element.getNotes().toLowerCase().contains(description.toLowerCase())) {
element.setNotes(element.getNotes() + "\n" + description);
if (description != null) {
if (element.getNotes() == null || element.getNotes().equals("") || element.getNotes().equals(description)) {
element.setNotes(description);
} else if (!element.getNotes().toLowerCase().contains(description.toLowerCase())) {
element.setNotes(element.getNotes() + "\n" + description);
}
}
}
......
......@@ -41,7 +41,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi
/**
* Version of the rest API that is supported by this annotator.
*/
static final String SUPPORTED_VERSION = "6.0";
static final String SUPPORTED_VERSION = "6.1";
/**
* Url address of ensembl restfull service.
......
......@@ -92,7 +92,7 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
}
@Test
public void test3FindDrug() throws Exception {
public void testFindRapamycin() throws Exception {
try {
// finding synonym
Drug rapamycinDrug = drugBankHTMLParser.findDrug("Rapamycin");
......@@ -100,8 +100,7 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
assertEquals("Sirolimus", rapamycinDrug.getName());
assertEquals("DB00877", rapamycinDrug.getSources().get(0).getResource());
assertTrue(rapamycinDrug.getBloodBrainBarrier().equalsIgnoreCase("NO"));
boolean res = rapamycinDrug.getDescription().contains(
"A macrolide compound obtained from Streptomyces hygroscopicus that acts by selectively blocking the transcriptional activation of cytokines thereby inhibiting cytokine production. It is bioactive only when bound to immunophilins. Sirolimus is a potent immunosuppressant and possesses both antifungal and antineoplastic properties. [PubChem]");
boolean res = rapamycinDrug.getDescription().contains("A macrolide compound obtained from Streptomyces");
assertTrue(res);
assertEquals(3, rapamycinDrug.getTargets().size());
......
......@@ -85,6 +85,14 @@ public class ElementAnnotatorTest extends AnnotationTestFunctions {
assertEquals(0, getWarnings().size());
}
@Test
public void testSetEmptyDescription() {
GenericProtein species = new GenericProtein("id");
species.setNotes("X");
annotator.setDescription(species, null);
assertEquals("X", species.getNotes());
}
@Test
public void testSetNotMatchingIchi() {
Ion species = new Ion("id");
......
package lcsb.mapviewer.converter.graphics;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import lcsb.mapviewer.commands.ColorExtractor;
......@@ -37,4 +45,42 @@ public class ConverterTest {
}
}
@Test
@Ignore("it's just code for generating scale")
public void testX() throws IOException {
BufferedImage tmpBI = new BufferedImage(900, 100, BufferedImage.TYPE_INT_ARGB);
Graphics2D tmpGraphics = tmpBI.createGraphics();
int startX = 10;
int startY = 15;
int stepSize = 40;
int height = 25;
tmpGraphics.setColor(Color.BLACK);
for (int i = 0; i < 21; i++) {
tmpGraphics.drawLine(startX + i * stepSize, height+startY, startX + i * stepSize, height*2);
String str = ""+((double)(i-10))/((double)(10));
tmpGraphics.drawString(str, startX + i * stepSize, height*2+startY);
}
for (int i = 0; i < 10 * stepSize; i++) {
double ratio = ((double) i) / ((double) (10 * stepSize));
tmpGraphics.setBackground(getColor(ratio, Color.BLUE, Color.WHITE));
tmpGraphics.setColor(getColor(ratio, Color.BLUE, Color.WHITE));
tmpGraphics.drawRect(startX + i, startY , 1, height);
}
for (int i = 0; i < 10 * stepSize; i++) {
double ratio = ((double) i) / ((double) (10 * stepSize));
tmpGraphics.setBackground(getColor(ratio, Color.WHITE, Color.RED));
tmpGraphics.setColor(getColor(ratio, Color.WHITE, Color.RED));
tmpGraphics.drawRect(10 * stepSize + startX + i, startY , 1, height);
}
ImageIO.write(tmpBI, "PNG", new File("tmp.png"));
Desktop.getDesktop().open(new File("tmp.png"));
}
private Color getColor(double d, Color startColor, Color endColor) {
return new Color((int) (startColor.getRed() + d * (endColor.getRed() - startColor.getRed())), //
(int) (startColor.getGreen() + d * (endColor.getGreen() - startColor.getGreen())), //
(int) (startColor.getBlue() + d * (endColor.getBlue() - startColor.getBlue())));
}
}
......@@ -49,6 +49,8 @@ gzip $SRC_DIR/minerva.txt
#copy configuration of logrotate
cp debian/logrotate/* $SRC_DIR/
cp debian/scripts/common.sh $SRC_DIR/
#copy changelog file
cp CHANGELOG $ROOT_DIR/debian/template/changelog
......@@ -150,22 +152,17 @@ find -name '*.ex' ! -name 'minerva*' -type f -exec rm -f {} +
#our pre/post inst/rm scripts use __CURRENT_VERSION__ as a version of currently
#installed package
sed -i "s/__CURRENT_VERSION__/$current_version/g" debian/preinst
sed -i "s/__CURRENT_VERSION__/$current_version/g" debian/postinst
sed -i "s/__CURRENT_VERSION__/$current_version/g" debian/prerm
sed -i "s/__CURRENT_VERSION__/$current_version/g" debian/postrm
sed -i "s/__LOG_FILE__/$LOG_FILE/g" debian/preinst
sed -i "s/__LOG_FILE__/$LOG_FILE/g" debian/postinst
sed -i "s/__LOG_FILE__/$LOG_FILE/g" debian/prerm
sed -i "s/__LOG_FILE__/$LOG_FILE/g" debian/postrm
sed -i "s/__CURRENT_VERSION__/$current_version/g" common.sh
sed -i "s/__LOG_FILE__/$LOG_FILE/g" common.sh
#__DB_SCRIPT_DIR__ in our scripts points to place where db schema files are placed
#in the filesystem where package is installed
sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" debian/postinst
sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" debian/postrm
sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" debian/prerm
sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" debian/preinst
sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" common.sh
sed -i -e "1r common.sh" debian/postinst
sed -i -e "1r common.sh" debian/postrm
sed -i -e "1r common.sh" debian/preinst
sed -i -e "1r common.sh" debian/prerm
#put scripts into $DB_SCRIPT_DIR (it's a bit different than varaiable because it's not
#escaped
......
#file with common script functions for postrm/prerm/postinst/preinst
log(){
echo "[" $CURRENT_VERSION "]" "$@" >>__LOG_FILE__
}
LOG_FILE="__LOG_FILE__"
DB_SCRIPT_DIR="__DB_SCRIPT_DIR__"
#new (current) version of the package
CURRENT_VERSION="__CURRENT_VERSION__"
#if we update package then this will be the old version of the package
OLD_VERSION=$2
if [ "$OLD_VERSION" = "$CURRENT_VERSION" ]
then
OLD_VERSION="";
fi
TOMCAT_PACKAGE="";
TOMCAT7_OK=$(dpkg-query -W --showformat='${Status}\n' tomcat7|grep "install ok installed")
TOMCAT8_OK=$(dpkg-query -W --showformat='${Status}\n' tomcat8|grep "install ok installed")
if [ "$TOMCAT7_OK" != "" ];
then
TOMCAT_PACKAGE='tomcat7'
fi
if [ "$TOMCAT8_OK" != "" ];
then
TOMCAT_PACKAGE='tomcat8'
fi
......@@ -13,4 +13,4 @@ Description: Standalone web application for visualization, exploration and
Tomcat server later to change the address.
Section: science
Homepage: http://r3lab.uni.lu/web/minerva-website/
Depends: ${misc:Depends}, tomcat7, oracle-java8-set-default, postgresql (>=9.3)
Depends: ${misc:Depends}, tomcat7 | tomcat8, oracle-java8-set-default, postgresql (>=9.3)
minerva.war /var/lib/tomcat7/webapps
minerva.war /usr/share/minerva/
......@@ -13,28 +13,12 @@
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
log(){
echo "$@" >>__LOG_FILE__
}
log "Running postinst" $1 $2;
invoke-rc.d $TOMCAT_PACKAGE status >> $LOG_FILE
# we execute it here because if some packages are missing then dpkg will return non-zero exit code
set -e
#new (current) version of the package
CURRENT_VERSION="__CURRENT_VERSION__"
#if we update package then this will be the old version of the package
OLD_VERSION=$2
DB_SCRIPT_DIR="__DB_SCRIPT_DIR__"
if [ "$OLD_VERSION" = "$CURRENT_VERSION" ]
then
OLD_VERSION="";
fi
case "$1" in
configure)
invoke-rc.d postgresql start
......@@ -42,9 +26,9 @@ case "$1" in
#if we install
if [ "$OLD_VERSION" = "" ]
then
su - postgres -c "createuser -d -r -s map_viewer" >>__LOG_FILE__ 2>>__LOG_FILE__
su - postgres -c "echo \"ALTER USER map_viewer WITH PASSWORD '123qweasdzxc';\"| psql" >>__LOG_FILE__ 2>>__LOG_FILE__
su - postgres -c "createdb -O map_viewer map_viewer" >>__LOG_FILE__ 2>>__LOG_FILE__
su - postgres -c "createuser -d -r -s map_viewer" >>$LOG_FILE 2>>$LOG_FILE
su - postgres -c "echo \"ALTER USER map_viewer WITH PASSWORD '123qweasdzxc';\"| psql" >>$LOG_FILE 2>>$LOG_FILE
su - postgres -c "createdb -O map_viewer map_viewer" >>$LOG_FILE 2>>$LOG_FILE
hba_conf=`su - postgres -c "psql -t -P format=unaligned -c 'show hba_file';"`;
cp $hba_conf $hba_conf".bac"
......@@ -53,13 +37,13 @@ case "$1" in
invoke-rc.d postgresql restart
#install base version of the framework
su - postgres -c "psql map_viewer -f $DB_SCRIPT_DIR/db_0.sql" >>__LOG_FILE__ 2>>__LOG_FILE__
su - postgres -c "psql map_viewer -f $DB_SCRIPT_DIR/db_0.sql" >>$LOG_FILE 2>>$LOG_FILE
#install patch to current version
su - postgres -c "psql map_viewer -f $DB_SCRIPT_DIR/db_0_to_$CURRENT_VERSION\".sql\"" >>__LOG_FILE__ 2>>__LOG_FILE__
su - postgres -c "psql map_viewer -f $DB_SCRIPT_DIR/db_0_to_$CURRENT_VERSION\".sql\"" >>$LOG_FILE 2>>$LOG_FILE
else
#if we update the package
su - postgres -c "psql map_viewer -f $DB_SCRIPT_DIR/db_$OLD_VERSION\"_to_\"$CURRENT_VERSION\".sql\"" >>__LOG_FILE__ 2>>__LOG_FILE__
su - postgres -c "psql map_viewer -f $DB_SCRIPT_DIR/db_$OLD_VERSION\"_to_\"$CURRENT_VERSION\".sql\"" >>$LOG_FILE 2>>$LOG_FILE
fi
#print a disclaimer
......@@ -78,7 +62,10 @@ case "$1" in
#we have to restart tomcat, because application was started on the old database and it might crash during deplyment
#for instance in the new war file there was init script that uses some new database features, but they are not
#availble when new war is deployed from debian package, so tomcat will catch SQL exception and stop deployment
invoke-rc.d tomcat7 restart
invoke-rc.d $TOMCAT_PACKAGE stop || true
rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva
ln -s /usr/share/minerva/minerva.war /var/lib/$TOMCAT_PACKAGE/webapps/minerva.war
invoke-rc.d $TOMCAT_PACKAGE start
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
......
......@@ -7,9 +7,6 @@
# * <old-postrm> `upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
log(){
echo "$@" >>__LOG_FILE__
}
log "Running postrm" $1 $2;
......@@ -27,13 +24,15 @@ set -e
case "$1" in
upgrade)
rm -rf /var/lib/tomcat7/webapps/minerva
invoke-rc.d tomcat7 start || true
invoke-rc.d postgresql start || true
rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva
rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva.war
# invoke-rc.d $TOMCAT_PACKAGE start || true
# invoke-rc.d postgresql start || true
;;
remove)
rm -rf /var/lib/tomcat7/webapps/minerva
invoke-rc.d tomcat7 start || true
rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva
rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva.war
invoke-rc.d $TOMCAT_PACKAGE start || true
if [ "" = "$POSTGRES_OK" ]
then
log "No postgresql package found.";
......@@ -44,7 +43,7 @@ case "$1" in
fi
;;
abort-install)
invoke-rc.d tomcat7 start || true
invoke-rc.d $TOMCAT_PACKAGE start || true
if [ "" = "$POSTGRES_OK" ];
then
......
......@@ -9,11 +9,6 @@
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
log(){
echo "$@" >>__LOG_FILE__
}
log "Running preinst" $1 $2;
# we execute it here because if some packages are missing then dpkg will return non-zero exit code
......@@ -29,11 +24,11 @@ ln -s $path $DEFAULT_JAVA_SYMLINK
case "$1" in
install|upgrade)
invoke-rc.d tomcat7 stop || true
invoke-rc.d $TOMCAT_PACKAGE stop || true
invoke-rc.d postgresql stop || true
;;
abort-upgrade)
invoke-rc.d tomcat7 stop || true
invoke-rc.d $TOMCAT_PACKAGE stop || true
invoke-rc.d postgresql stop || true
;;
*)
......
......@@ -8,14 +8,9 @@ set -e
# * <new-preinst> `upgrade' <old-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
log(){
echo "$@" >>__LOG_FILE__
}
log "Running preinst" $1 $2;
DB_SCRIPT_DIR="__DB_SCRIPT_DIR__"
# we execute it here because if some packages are missing then dpkg will return non-zero exit code
set -e
......@@ -30,11 +25,11 @@ su - postgres -c "pg_dump map_viewer" | gzip > "$DUMP_FILE".gz
case "$1" in
upgrade)
invoke-rc.d tomcat7 stop || true
invoke-rc.d $TOMCAT_PACKAGE stop || true
invoke-rc.d postgresql stop || true
;;
remove)
invoke-rc.d tomcat7 stop || true
invoke-rc.d $TOMCAT_PACKAGE stop || true
invoke-rc.d postgresql stop || true
;;
*)
......
.idea/workspace.xml
/dist/
/coverage/
/node_modules/
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value />
</option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</component>
</project>
\ No newline at end of file
<component name="ProjectDictionaryState">
<dictionary name="piotr.gawron">
<words>
<w>mailto</w>
</words>
</dictionary>
</component>
\ No newline at end of file
......@@ -4,6 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
......
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