Commit 3fb09925 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '487-custom-images-as-overlay-levels-or-background' into 'master'

Resolve "Custom images as overlay levels  or background"

Closes #487

See merge request minerva/core!768
parents 4c305a38 cd1ab9fd
...@@ -3,6 +3,9 @@ minerva (13.1.0~alpha.0) unstable; urgency=low ...@@ -3,6 +3,9 @@ minerva (13.1.0~alpha.0) unstable; urgency=low
outputs used by annotator (#617) outputs used by annotator (#617)
* Feature: changes in admin panel doesn't require saving - they are saved * Feature: changes in admin panel doesn't require saving - they are saved
automatically (#676) automatically (#676)
* Feature: elements can have custom glyphs used for visualization (#487)
* Small improvement: all bio entities have z-index associated with them
(#487)
* Small improvement: validation of the organism and disease id on map upload * Small improvement: validation of the organism and disease id on map upload
added (#618) added (#618)
* Small improvement: added current username next to logout button in admin * Small improvement: added current username next to logout button in admin
...@@ -48,6 +51,8 @@ minerva (13.1.0~alpha.0) unstable; urgency=low ...@@ -48,6 +51,8 @@ minerva (13.1.0~alpha.0) unstable; urgency=low
* Small improvement: allow admin to disable CORS check (#802) * Small improvement: allow admin to disable CORS check (#802)
* Small improvement: TransparencyZoomLevelVisibility parameter renamed to * Small improvement: TransparencyZoomLevelVisibility parameter renamed to
SemanticZoomLevelTransparency (#801) SemanticZoomLevelTransparency (#801)
* Small improvement: export/import from SBML support z-index in LAYOUT
extension
* Bug fix: progress bar of gene genome mapping upload is refreshing properly * Bug fix: progress bar of gene genome mapping upload is refreshing properly
(#728) (#728)
* Bug fix: when editing project Disease and Organism could not be removed * Bug fix: when editing project Disease and Organism could not be removed
......
...@@ -8,7 +8,10 @@ import org.apache.log4j.Logger; ...@@ -8,7 +8,10 @@ import org.apache.log4j.Logger;
import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.common.exception.NotImplementedException;
public abstract class Comparator<T extends Object> implements java.util.Comparator<T> { public abstract class Comparator<T extends Object> implements java.util.Comparator<T> {
Logger logger = Logger.getLogger(Comparator.class); /**
* Default class logger.
*/
private static Logger logger = Logger.getLogger(Comparator.class);
private Class<T> comparatorClazz; private Class<T> comparatorClazz;
private boolean exactClassMatch; private boolean exactClassMatch;
private List<Comparator<? extends T>> subClassComparatorList = new ArrayList<>(); private List<Comparator<? extends T>> subClassComparatorList = new ArrayList<>();
......
...@@ -10,18 +10,18 @@ import java.util.Comparator; ...@@ -10,18 +10,18 @@ import java.util.Comparator;
*/ */
public class IntegerComparator implements Comparator<Integer> { public class IntegerComparator implements Comparator<Integer> {
@Override @Override
public int compare(Integer arg0, Integer arg1) { public int compare(Integer arg0, Integer arg1) {
if (arg0 == null) { if (arg0 == null) {
if (arg1 == null) { if (arg1 == null) {
return 0; return 0;
} else { } else {
return 1; return 1;
} }
} else if (arg1 == null) { } else if (arg1 == null) {
return -1; return -1;
} }
return arg0.compareTo(arg1); return arg0.compareTo(arg1);
} }
} }
...@@ -22,6 +22,7 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; ...@@ -22,6 +22,7 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException;
import lcsb.mapviewer.converter.Converter; import lcsb.mapviewer.converter.Converter;
import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.InvalidInputDataExecption; import lcsb.mapviewer.converter.InvalidInputDataExecption;
import lcsb.mapviewer.converter.ZIndexPopulator;
import lcsb.mapviewer.converter.annotation.XmlAnnotationParser; import lcsb.mapviewer.converter.annotation.XmlAnnotationParser;
import lcsb.mapviewer.converter.model.celldesigner.alias.AliasCollectionXmlParser; import lcsb.mapviewer.converter.model.celldesigner.alias.AliasCollectionXmlParser;
import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser;
...@@ -144,7 +145,10 @@ public class CellDesignerXmlParser extends Converter { ...@@ -144,7 +145,10 @@ public class CellDesignerXmlParser extends Converter {
} }
// we ignore metaid - it's useless and obstruct data model // we ignore metaid - it's useless and obstruct data model
// model.setMetaId(XmlParser.getNodeAttr("metaId", modelNode)); // model.setMetaId(XmlParser.getNodeAttr("metaId", modelNode));
model.setIdModel(XmlParser.getNodeAttr("id", modelNode)); String modelId = XmlParser.getNodeAttr("id", modelNode);
if (modelId != null && !modelId.isEmpty()) {
model.setIdModel(modelId);
}
Node compartmentNode = XmlParser.getNode("listOfCompartments", modelNode.getChildNodes()); Node compartmentNode = XmlParser.getNode("listOfCompartments", modelNode.getChildNodes());
if (compartmentNode != null) { if (compartmentNode != null) {
...@@ -236,6 +240,7 @@ public class CellDesignerXmlParser extends Converter { ...@@ -236,6 +240,7 @@ public class CellDesignerXmlParser extends Converter {
model.setWidth(width); model.setWidth(width);
model.setHeight(height); model.setHeight(height);
} }
new ZIndexPopulator().populateZIndex(model);
} catch (InvalidXmlSchemaException e) { } catch (InvalidXmlSchemaException e) {
throw new InvalidInputDataExecption(e); throw new InvalidInputDataExecption(e);
} catch (CellDesignerParserException e) { } catch (CellDesignerParserException e) {
...@@ -610,7 +615,11 @@ public class CellDesignerXmlParser extends Converter { ...@@ -610,7 +615,11 @@ public class CellDesignerXmlParser extends Converter {
+ "xmlns:celldesigner=\"http://www.sbml.org/2001/ns/celldesigner\" level=\"2\" version=\"4\">\n"); + "xmlns:celldesigner=\"http://www.sbml.org/2001/ns/celldesigner\" level=\"2\" version=\"4\">\n");
// metaid is a string cell designer id, usually it's model id and as far as // metaid is a string cell designer id, usually it's model id and as far as
// we can tell it's not used at all // we can tell it's not used at all
result.append("<model metaid=\"" + model.getIdModel() + "\" id=\"" + model.getIdModel() + "\">\n"); result.append("<model ");
if (model.getIdModel() != null) {
result.append("metaid=\"" + model.getIdModel() + "\" id=\"" + model.getIdModel() + "\"");
}
result.append(">\n");
result.append(unitCollectionXmlParser.toXml(model.getUnits())); result.append(unitCollectionXmlParser.toXml(model.getUnits()));
result.append(functionCollectionXmlParser.toXml(model.getFunctions())); result.append(functionCollectionXmlParser.toXml(model.getFunctions()));
...@@ -697,7 +706,8 @@ public class CellDesignerXmlParser extends Converter { ...@@ -697,7 +706,8 @@ public class CellDesignerXmlParser extends Converter {
result.append("</celldesigner:extension>\n"); result.append("</celldesigner:extension>\n");
XmlAnnotationParser xmlAnnotationParser = new XmlAnnotationParser(); XmlAnnotationParser xmlAnnotationParser = new XmlAnnotationParser();
result.append(xmlAnnotationParser.dataSetToXmlString(model.getMiriamData(), model.getAuthors(), model.getCreationDate(), model.getModificationDates())); result.append(xmlAnnotationParser.dataSetToXmlString(model.getMiriamData(), model.getAuthors(),
model.getCreationDate(), model.getModificationDates()));
result.append("</annotation>\n"); result.append("</annotation>\n");
return result.toString(); return result.toString();
} }
......
...@@ -3,7 +3,7 @@ package lcsb.mapviewer.converter.model.celldesigner; ...@@ -3,7 +3,7 @@ package lcsb.mapviewer.converter.model.celldesigner;
import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException;
/** /**
* Exception that shold be thrown when the group in xml schema is invalid. * Exception that should be thrown when the group in xml schema is invalid.
* *
* @author Piotr Gawron * @author Piotr Gawron
* *
...@@ -20,7 +20,7 @@ public class InvalidGroupException extends InvalidXmlSchemaException { ...@@ -20,7 +20,7 @@ public class InvalidGroupException extends InvalidXmlSchemaException {
*/ */
public InvalidGroupException() { public InvalidGroupException() {
super(); // call superclass constructor super();
} }
/** /**
......
...@@ -13,6 +13,7 @@ import org.w3c.dom.NodeList; ...@@ -13,6 +13,7 @@ import org.w3c.dom.NodeList;
import lcsb.mapviewer.common.XmlParser; import lcsb.mapviewer.common.XmlParser;
import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException;
import lcsb.mapviewer.common.geometry.ColorParser; import lcsb.mapviewer.common.geometry.ColorParser;
import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser;
import lcsb.mapviewer.model.graphics.ArrowType; import lcsb.mapviewer.model.graphics.ArrowType;
import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.graphics.LineType;
import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.graphics.PolylineData;
...@@ -522,6 +523,7 @@ public class LayerXmlParser { ...@@ -522,6 +523,7 @@ public class LayerXmlParser {
} }
} }
} }
new RestAnnotationParser().processNotes(result.getNotes(), result);
return result; return result;
} }
......
package lcsb.mapviewer.converter.model.celldesigner.annotation;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(RUNTIME)
@Target(FIELD)
public @interface ImportOnly {
}
package lcsb.mapviewer.converter.model.celldesigner.annotation; package lcsb.mapviewer.converter.model.celldesigner.annotation;
import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerElement;
import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerSpecies;
import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.Drawable;
import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element; import lcsb.mapviewer.model.map.species.Element;
...@@ -15,193 +14,197 @@ import lcsb.mapviewer.model.map.species.Species; ...@@ -15,193 +14,197 @@ import lcsb.mapviewer.model.map.species.Species;
* *
*/ */
public enum NoteField { public enum NoteField {
/** /**
* List of {@link MiriamType#HGNC} identifiers. * List of {@link MiriamType#HGNC} identifiers.
*/ */
HGNC("HGNC_ID", BioEntity.class, MiriamType.HGNC), HGNC("HGNC_ID", BioEntity.class, MiriamType.HGNC),
/** /**
* List of {@link MiriamType#REFSEQ} identifiers. * List of {@link MiriamType#REFSEQ} identifiers.
*/ */
REFSEQ("RefSeq_ID", BioEntity.class, MiriamType.REFSEQ), REFSEQ("RefSeq_ID", BioEntity.class, MiriamType.REFSEQ),
/** /**
* List of {@link MiriamType#ENTREZ} identifiers. * List of {@link MiriamType#ENTREZ} identifiers.
*/ */
ENTREZ("EntrezGene_ID", BioEntity.class, MiriamType.ENTREZ), ENTREZ("EntrezGene_ID", BioEntity.class, MiriamType.ENTREZ),
/** /**
* List of {@link MiriamType#REACTOME} identifiers. * List of {@link MiriamType#REACTOME} identifiers.
*/ */
REACTOME("Reactome_ID", BioEntity.class, MiriamType.REACTOME), REACTOME("Reactome_ID", BioEntity.class, MiriamType.REACTOME),
/** /**
* List of {@link MiriamType#PUBMED} identifiers. * List of {@link MiriamType#PUBMED} identifiers.
*/ */
PUBMED("Pubmed_ID", BioEntity.class, MiriamType.PUBMED), PUBMED("Pubmed_ID", BioEntity.class, MiriamType.PUBMED),
/** /**
* List of {@link MiriamType#KEGG_GENES} identifiers. * List of {@link MiriamType#KEGG_GENES} identifiers.
*/ */
KEGG_GENES("KEGG_ID", BioEntity.class, MiriamType.KEGG_GENES), KEGG_GENES("KEGG_ID", BioEntity.class, MiriamType.KEGG_GENES),
/** /**
* List of {@link MiriamType#PANTHER} identifiers. * List of {@link MiriamType#PANTHER} identifiers.
*/ */
PANTHER("PANTHER", BioEntity.class, MiriamType.PANTHER), PANTHER("PANTHER", BioEntity.class, MiriamType.PANTHER),
/** /**
* {@link Element#symbol}. * {@link Element#symbol}.
*/ */
SYMBOL("Symbol", CellDesignerElement.class, null), SYMBOL("Symbol", BioEntity.class, null),
/** /**
* {@link Element#fullName}. * {@link Element#fullName}.
*/ */
NAME("Name", CellDesignerElement.class, null), NAME("Name", BioEntity.class, null),
/** /**
* {@link Element#notes} or {@link Reaction#notes} . * {@link Element#notes} or {@link Reaction#notes} .
*/ */
DESCRIPTION("Description", BioEntity.class, null), DESCRIPTION("Description", BioEntity.class, null),
/** /**
* {@link Element#formerSymbols}. * {@link Element#formerSymbols}.
*/ */
PREVIOUS_SYMBOLS("Previous Symbols", CellDesignerElement.class, null), PREVIOUS_SYMBOLS("Previous Symbols", Element.class, null),
/** /**
* {@link Element#synonyms} or {@link Reaction#synonyms}. * {@link Element#synonyms} or {@link Reaction#synonyms}.
*/ */
SYNONYMS("Synonyms", BioEntity.class, null), SYNONYMS("Synonyms", BioEntity.class, null),
/** /**
* {@link Element#abbreviation} or {@link Reaction#abbreviation}. * {@link Element#abbreviation} or {@link Reaction#abbreviation}.
*/ */
ABBREVIATION("Abbreviation", BioEntity.class, null), ABBREVIATION("Abbreviation", BioEntity.class, null),
/** /**
* {@link Reaction#formula}. * {@link Reaction#formula}.
*/ */
FORMULA("Formula", Reaction.class, null), FORMULA("Formula", Reaction.class, null),
/** /**
* {@link Reaction#mechanicalConfidenceScore}. * {@link Reaction#mechanicalConfidenceScore}.
*/ */
MECHANICAL_CONFIDENCE_SCORE("MechanicalConfidenceScore", Reaction.class, null), MECHANICAL_CONFIDENCE_SCORE("MechanicalConfidenceScore", Reaction.class, null),
/** /**
* {@link Reaction#lowerBound}. * {@link Reaction#lowerBound}.
*/ */
LOWER_BOUND("LowerBound", Reaction.class, null), LOWER_BOUND("LowerBound", Reaction.class, null),
/** /**
* {@link Reaction#upperBound}. * {@link Reaction#upperBound}.
*/ */
UPPER_BOUND("UpperBound", Reaction.class, null), UPPER_BOUND("UpperBound", Reaction.class, null),
/** /**
* {@link Reaction#subsystem}. * {@link Reaction#subsystem}.
*/ */
SUBSYSTEM("Subsystem", Reaction.class, null), SUBSYSTEM("Subsystem", Reaction.class, null),
/** /**
* {@link Reaction#geneProteinReaction}. * {@link Reaction#geneProteinReaction}.
*/ */
GENE_PROTEIN_REACTION("GeneProteinReaction", Reaction.class, null), GENE_PROTEIN_REACTION("GeneProteinReaction", Reaction.class, null),
/** /**
* {@link Element#formula}. * {@link Element#formula}.
*/ */
CHARGED_FORMULA("ChargedFormula", CellDesignerElement.class, null), CHARGED_FORMULA("ChargedFormula", Element.class, null),
/** /**
* {@link Species#charge}. * {@link Species#charge}.
*/ */
CHARGE("Charge", CellDesignerSpecies.class, null), CHARGE("Charge", Species.class, null),
/** /**
* {@link Element#getSemanticZoomLevelVisibility()}. * {@link Element#getSemanticZoomLevelVisibility()}.
*/ */
SEMANTIC_ZOOM_LEVEL_VISIBILITY("SemanticZoomLevelVisibility", BioEntity.class, null), SEMANTIC_ZOOM_LEVEL_VISIBILITY("SemanticZoomLevelVisibility", BioEntity.class, null),
/** /**
* {@link Element#getSemanticZoomLevelVisibility()}. * {@link Element#getSemanticZoomLevelVisibility()}.
*/ */
TRANSPARENCY_ZOOM_LEVEL_VISIBILITY("SemanticZoomLevelTransparency", Element.class, null), TRANSPARENCY_ZOOM_LEVEL_VISIBILITY("SemanticZoomLevelTransparency", Element.class, null),
/** /**
* {@link Element#getSemanticZoomLevelVisibility()}. * {@link Element#getSemanticZoomLevelVisibility()}.
*/ */
@Deprecated @Deprecated
TRANSPARENCY_ZOOM_LEVEL_VISIBILITY_OLD("TransparencyZoomLevelVisibility", Element.class, null), TRANSPARENCY_ZOOM_LEVEL_VISIBILITY_OLD("TransparencyZoomLevelVisibility", Element.class, null),
;
@ImportOnly
/** Z_INDEX("Z-Index", Drawable.class, null),
* Name used in the notes to distinguish fields.
*/ ;
private String commonName;
/**
/** * Name used in the notes to distinguish fields.
* What object class can have this field. */
*/ private String commonName;
private Class<?> clazz;
/**
/** * What object class can have this field.
* What {@link MiriamType} is associated with the field. */
*/ private Class<? extends Drawable> clazz;
private MiriamType miriamType;
/**
/** * What {@link MiriamType} is associated with the field.
* Default constructor. */
* private MiriamType miriamType;
* @param name
* {@link #commonName} /**
* @param clazz * Default constructor.
* {@link #clazz} *
*/ * @param name
NoteField(String name, Class<?> clazz) { * {@link #commonName}
this.commonName = name; * @param clazz
this.clazz = clazz; * {@link #clazz}
} */
NoteField(String name, Class<? extends Drawable> clazz) {
/** this.commonName = name;
* Default constructor. this.clazz = clazz;
* }
* @param name
* {@link #commonName} /**
* @param clazz * Default constructor.
* {@link #clazz} *
* @param type * @param name
* {@link #miriamType} * {@link #commonName}
*/ * @param clazz
NoteField(String name, Class<?> clazz, MiriamType type) { * {@link #clazz}
this(name, clazz); * @param type
this.miriamType = type; * {@link #miriamType}
} */
NoteField(String name, Class<? extends Drawable> clazz, MiriamType type) {
/** this(name, clazz);
* @return the miriamType this.miriamType = type;
* @see #miriamType }
*/
public MiriamType getMiriamType() { /**
return miriamType; * @return the miriamType
} * @see #miriamType
*/
/** public MiriamType getMiriamType() {
* @return the commonName return miriamType;