Commit 6623863b authored by Piotr Gawron's avatar Piotr Gawron

Merge branch 'merge-15.1.2' into 'master'

Merge 15.1.2

See merge request !1267
parents 149b2fbf db2fb2bf
Pipeline #36686 passed with stage
in 24 minutes and 54 seconds
image: node
image: node:14
stages:
- build
......
......@@ -5,22 +5,44 @@ minerva (16.0.0~alpha.0) stable; urgency=medium
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 27 Aug 2020 13:00:00 +0200
minerva (15.1.0~beta.1) unstable; urgency=medium
minerva (15.1.2) stable; urgency=medium
* Bug fix: automatic annotations are sometimes missing after project upload
(#1434)
* Bug fix: export to SBML failed if reactant/product line had length=0
* Bug fix: downloading submap from big project as a map quite often resulted
in error (#1440)
* Bug fix: colors for values in exported image were incorrect for
intermediate values, like 0.5 (#1442)
* Bug fix: when there is a problem with updating sorting preferences no error
is raised but silent warning is reported in the console (#1426)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 11 Jan 2021 12:00:00 +0200
minerva (15.1.1) stable; urgency=medium
* Bug fix: export to CD maps with species containing ":" or "." in species id
generated files that could not be opened in CellDesigner (#1363)
* Bug fix: zoom level change was not reflected in the url when submap was
opened (#1338)
* Bug fix: API call returning list of overlays returned for non existing
project returned access denied status insted Not Found (#1370)
* Bug fix: results for chembl targetting uniprot without gene name (for
example P0C2L1) could crash caching (#1377)
* Bug fix: removing non-existing project results in warning not an error
message (#1367)
* Bug fix: opening map in google maps without background resulted in
unexpected error (#1416)
* Bug fix: normal user could not update tos information (#1419)
* Bug fix: and operator in SBGN-like view was not drawn (#1408)
* Bug fix: export of overlayed map as an image did not respect overlay colors
(#1417)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 23 Nov 2020 15:00:00 +0200
minerva (15.1.0) stable; urgency=medium
* Small improvement: information if species has activity, hypothetical flag
set is available over REST API for element (#1379)
* Small improvement: "Human Disease Ontology", "IUPHAR ligand" and "Protein
Modification Ontology" annotation types are handled (#1359)
* Bug fix: SBML import - label aligned to top of species was inproperly drawn
(#1354)
* Bug fix: SBML text labels that were referencing layout aliases using
layout:graphicalObject attribute were not handled properly (#1356)
* Bug fix: miriam urls in new format
(like: https://identifiers.org/kegg.compound:197020) are parsed properly for
all know identifier types (#1359)
* Bug fix: in SBGN-like view protein state should be drawn as stadium-shape
(#1357)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 18 Aug 2020 15:00:00 +0200
minerva (15.1.0~beta.0) unstable; urgency=medium
* Small improvement: annotations are exported in SBGN extension that can be
opened by newt (#1296)
* Small improvement: plugin API allows to add/remove data overlays (#1153)
......@@ -53,6 +75,16 @@ minerva (15.1.0~beta.0) unstable; urgency=medium
* Small improvement: SBGN notes are exported properly (#1319)
* Small improvement: possibility to customize request account email title
(#1330)
* Bug fix: SBML text labels that were referencing layout aliases using
layout:graphicalObject attribute were not handled properly (#1356)
* Bug fix: MolArt version upgraded to handle new protein API syntax (#1399)
* Bug fix: LDAP connection did not work properly where uid in LDAP/AD
contained upper case letters (#1404)
* Bug fix: miriam urls in new format
(like: https://identifiers.org/kegg.compound:197020) are parsed properly for
all know identifier types (#1359)
* Bug fix: in SBGN-like view protein state should be drawn as stadium-shape
(#1357)
* Bug fix: export to image from selected polygon contained all elements
inside rectangle bounded by the polygon coordinates (#1096)
* Bug fix: continuous refreshing list of project when uploading/removing
......@@ -61,13 +93,9 @@ minerva (15.1.0~beta.0) unstable; urgency=medium
SBML crashed
* Bug fix: when content of element popover is too wide the scrollbar is
visible (#1269)
* Bug fix: problem with accessing mirtarbase data on new instances fixed
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 13 Jul 2020 16:00:00 +0200
minerva (15.0.4) stable; urgency=medium
* Bug fix: problem with accessing mirtarbase data onnew instances fixed
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 13 Aug 2020 15:00:00 +0200
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 22 Oct 2020 15:00:00 +0200
minerva (15.0.3) stable; urgency=medium
* Bug fix: caching chemicals/drug data on big map could cause Out of Memory
......
......@@ -217,7 +217,7 @@ public class ChEMBLParser extends DrugAnnotation implements IExternalService {
* @throws DrugSearchException
* thrown when there is a problem with annotations
*/
private MiriamData targetComponentToMiriamData(Node targetComponent) throws DrugSearchException {
MiriamData targetComponentToMiriamData(Node targetComponent) throws DrugSearchException {
MiriamData result = null;
Node uniprotAccessionId = XmlParser.getNode("accession", targetComponent.getChildNodes());
if (uniprotAccessionId != null) {
......@@ -226,7 +226,9 @@ public class ChEMBLParser extends DrugAnnotation implements IExternalService {
try {
result = uniprotAnnotator
.uniProtToHgnc(new MiriamData(MiriamType.UNIPROT, uniprotId));
result.setAnnotator(null);
if (result != null) {
result.setAnnotator(null);
}
} catch (UniprotSearchException e) {
throw new DrugSearchException(e);
}
......
......@@ -43,7 +43,7 @@ public class PubmedParser extends CachableInterface implements IExternalService
/**
* Version of the remote API that is supported by this connecting class.
*/
static final String SUPPORTED_VERSION = "6.4";
static final String SUPPORTED_VERSION = "6.5";
static final String API_URL = "https://www.ebi.ac.uk/europepmc/webservices/rest/";
/**
* Length of {@link #PUBMED_PREFIX} string.
......
......@@ -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 = "13.0";
static final String SUPPORTED_VERSION = "13.1";
/**
* Url address of ensembl restful service.
......
......@@ -864,4 +864,12 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
assertNotNull(parser.findDrug("CABOZANTINIB"));
}
@Test
public void testTargetComponentToMiriamDataForNonHgncUniprotId() throws Exception {
ChEMBLParser parser = Mockito.spy(chemblParser);
Node node = getNodeFromXmlString("<xml><accession>P0C2L1</accession></xml>");
MiriamData result = parser.targetComponentToMiriamData(node);
assertNull(result);
}
}
......@@ -14,6 +14,8 @@ import lcsb.mapviewer.annotation.AnnotationTestFunctions;
import lcsb.mapviewer.annotation.services.annotators.ElementAnnotator;
import lcsb.mapviewer.common.IProgressUpdater;
import lcsb.mapviewer.model.map.*;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.compartment.SquareCompartment;
import lcsb.mapviewer.model.map.model.*;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.*;
......@@ -49,15 +51,15 @@ public class ModelAnnotatorTest extends AnnotationTestFunctions {
model.addReaction(new Reaction());
Species proteinAlias1 = new GenericProtein("a1");
proteinAlias1.setName("SNCA");
Species protein1 = new GenericProtein("a1");
protein1.setName("SNCA");
Species proteinAlias2 = new GenericProtein("a2");
proteinAlias2.setName("PDK1");
proteinAlias2.addMiriamData(new MiriamData(MiriamRelationType.BQ_BIOL_IS_DESCRIBED_BY, MiriamType.CAS, "c"));
Species protein2 = new GenericProtein("a2");
protein2.setName("PDK1");
protein2.addMiriamData(new MiriamData(MiriamRelationType.BQ_BIOL_IS_DESCRIBED_BY, MiriamType.CAS, "c"));
model.addElement(proteinAlias1);
model.addElement(proteinAlias2);
model.addElement(protein1);
model.addElement(protein2);
modelAnnotator.annotateModel(model, updater, modelAnnotator.createDefaultAnnotatorSchema());
......
......@@ -8,7 +8,10 @@ import org.apache.logging.log4j.Logger;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerElement;
import lcsb.mapviewer.converter.model.celldesigner.structure.fields.CellDesignerModificationResidue;
import lcsb.mapviewer.model.LogMarker;
import lcsb.mapviewer.model.ProjectLogEntryType;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.species.*;
import lcsb.mapviewer.model.map.species.field.AbstractSiteModification;
import lcsb.mapviewer.model.map.species.field.ModificationResidue;
......@@ -23,7 +26,6 @@ public class CellDesignerElementCollection {
/**
* Default class logger
*/
@SuppressWarnings("unused")
private static Logger logger = LogManager.getLogger();
/**
......@@ -66,7 +68,11 @@ public class CellDesignerElementCollection {
} else {
String sbmlId = getSbmlId(modelElement, true);
if (sbmlIdByElement.get(sbmlId) == null) {
String id = "s_id_" + modelElement.getElementId();
String normalizedId = normalizeIdToCellDesigner(modelElement.getElementId());
if (!Objects.equals(normalizedId, modelElement.getElementId())) {
logger.warn(new LogMarker(ProjectLogEntryType.EXPORT_ISSUE, modelElement), "Invalid element id");
}
String id = "s_id_" + normalizeIdToCellDesigner(modelElement.getElementId());
if (sbmlIdByElement.values().contains(id)) {
throw new InvalidArgumentException("id duplicates");
}
......@@ -277,9 +283,23 @@ public class CellDesignerElementCollection {
return null;
}
if (ca.getElementId().length() >= 2) {
return ca.getElementId();
return normalizeIdToCellDesigner(ca.getElementId());
}
return "ca_prefix_issue_" + normalizeIdToCellDesigner(ca.getElementId());
}
public String getModelId(Model model) {
if (model.getIdModel() == null) {
return null;
}
return normalizeIdToCellDesigner(model.getIdModel());
}
protected String normalizeIdToCellDesigner(String id) {
if (id == null) {
return null;
}
return "ca_prefix_issue_" + ca.getElementId();
return id.replaceAll("[:\\.-]", "_");
}
}
......@@ -393,7 +393,8 @@ public class CellDesignerXmlParser extends Converter {
}
private void processModelRdfNode(Model model, Node node) throws InvalidXmlSchemaException {
XmlAnnotationParser xmlAnnotationParser = new XmlAnnotationParser(CommonXmlParser.RELATION_TYPES_SUPPORTED_BY_CELL_DESIGNER);
XmlAnnotationParser xmlAnnotationParser = new XmlAnnotationParser(
CommonXmlParser.RELATION_TYPES_SUPPORTED_BY_CELL_DESIGNER);
model.addMiriamData(xmlAnnotationParser.parseRdfNode(node));
model.addAuthors(xmlAnnotationParser.getAuthorsFromRdf(node));
model.setCreationDate(xmlAnnotationParser.getCreateDateFromRdf(node));
......@@ -635,7 +636,11 @@ public class CellDesignerXmlParser extends Converter {
+ "xmlns:celldesigner=\"http://www.sbml.org/2001/ns/celldesigner\" level=\"2\" version=\"4\">\n");
result.append("<model ");
if (model.getIdModel() != null) {
result.append("metaid=\"" + model.getIdModel() + "\" id=\"" + model.getIdModel() + "\"");
String id = elements.getModelId(model);
if (!id.equals(model.getIdModel())) {
logger.warn("Invalid map id: '" + model.getIdModel() + "' changed to '" + id + "'");
}
result.append("metaid=\"" + id + "\" id=\"" + id + "\"");
}
result.append(">\n");
......@@ -729,7 +734,8 @@ public class CellDesignerXmlParser extends Converter {
result.append("</celldesigner:extension>\n");
XmlAnnotationParser xmlAnnotationParser = new XmlAnnotationParser(CommonXmlParser.RELATION_TYPES_SUPPORTED_BY_CELL_DESIGNER);
XmlAnnotationParser xmlAnnotationParser = new XmlAnnotationParser(
CommonXmlParser.RELATION_TYPES_SUPPORTED_BY_CELL_DESIGNER);
result.append(xmlAnnotationParser.dataSetToXmlString(model.getMiriamData(), model.getAuthors(),
model.getCreationDate(), model.getModificationDates(), model.getIdModel()));
result.append("</annotation>\n");
......
package lcsb.mapviewer.converter.model.celldesigner;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import org.apache.logging.log4j.LogManager;
......@@ -54,4 +55,11 @@ public class CellDesignerElementCollectionTest extends CellDesignerTestFunctions
assertNotEquals(collection.getElementId(p1), collection.getElementId(p2));
}
@Test
public void testNormalizeToCd() {
CellDesignerElementCollection collection = new CellDesignerElementCollection();
assertFalse(collection.normalizeIdToCellDesigner("a.b").contains("."));
assertFalse(collection.normalizeIdToCellDesigner("a_b").contains("."));
}
}
......@@ -49,6 +49,7 @@ public class SbmlValidationTests extends CellDesignerTestFunctions {
result.add(getTestSetFromFile("testFiles/reactions/modifier_with_operator.xml"));
result.add(getTestSetFromFile("testFiles/problematic/problematic_reaction_name.xml"));
result.add(getTestSetFromFile("testFiles/reactions/kinetics.xml"));
result.add(getTestSetFromFile("testFiles/problematic/invalid_sbml_id.xml"));
result.add(emptyProteinNameTest());
return result;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level2/version4" xmlns:celldesigner="http://www.sbml.org/2001/ns/celldesigner" level="2" version="4">
<model metaid="F007-inos.sbgn" id="F007-inos.sbgn">
<notes><html xmlns="http://www.w3.org/1999/xhtml"><head><title/></head><body></body></html></notes><annotation>
<celldesigner:extension>
<celldesigner:modelVersion>4.0</celldesigner:modelVersion>
<celldesigner:modelDisplay sizeX="1632" sizeY="1188"/>
<celldesigner:listOfIncludedSpecies>
</celldesigner:listOfIncludedSpecies>
<celldesigner:listOfCompartmentAliases>
<celldesigner:compartmentAlias id="n1" compartment="s_id_n1">
<celldesigner:class>SQUARE</celldesigner:class>
<celldesigner:bounds x="36.73581314086914" y="921.4197998046875" w="1559.26416015625" h="250.22767639160156"/>
<celldesigner:namePoint x="42.73581314086914" y="927.4197998046875"/>
<celldesigner:doubleLine thickness="3.0" outerWidth="2.0" innerWidth="1.0"/>
<celldesigner:paint color="72EDEBE4" scheme="Color"/>
</celldesigner:compartmentAlias>
</celldesigner:listOfCompartmentAliases>
<celldesigner:listOfComplexSpeciesAliases>
</celldesigner:listOfComplexSpeciesAliases>
<celldesigner:listOfSpeciesAliases>
<celldesigner:speciesAlias id="n1__.__n0" species="s_id_n1__.__n0" compartmentAlias="n1" >
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="65.0" y="966.6474609375" w="86.0" h="46.0" />
<celldesigner:font size="12"/><celldesigner:view state="usual"/>
<celldesigner:usualView><celldesigner:innerPosition x="0" y="0"/><celldesigner:boxSize width="86.0" height="46.0"/><celldesigner:singleLine width="1.0"/><celldesigner:paint color="FFC8D8EB" scheme="Color"/></celldesigner:usualView>
<celldesigner:briefView><celldesigner:innerPosition x="0" y="0"/><celldesigner:boxSize width="86.0" height="46.0"/><celldesigner:singleLine width="1.0"/><celldesigner:paint color="FFC8D8EB" scheme="Color"/></celldesigner:briefView>
</celldesigner:speciesAlias>
</celldesigner:listOfSpeciesAliases>
<celldesigner:listOfProteins><celldesigner:protein id="p_s_id_n1__.__n0" name="STAT1_alpha_" type="GENERIC">
<celldesigner:listOfModificationResidues><celldesigner:modificationResidue id="3" name="Y701" angle="1.5973482732763293"></celldesigner:modificationResidue><celldesigner:modificationResidue id="4" name="S727" angle="5.280262641519494"></celldesigner:modificationResidue></celldesigner:listOfModificationResidues>
</celldesigner:protein>
</celldesigner:listOfProteins>
<celldesigner:listOfGenes></celldesigner:listOfGenes>
<celldesigner:listOfRNAs></celldesigner:listOfRNAs>
<celldesigner:listOfAntisenseRNAs></celldesigner:listOfAntisenseRNAs>
<celldesigner:listOfLayers></celldesigner:listOfLayers>
</celldesigner:extension>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#F007-inos.sbgn">
<dcterms:modified rdf:parseType="Resource"></dcterms:modified>
</rdf:Description>
</rdf:RDF>
</annotation>
<listOfCompartments>
<compartment metaid="s_id_n1" id="s_id_n1" name="NUCLEUS" size="1" units="volume" outside="default" >
<notes><html xmlns="http://www.w3.org/1999/xhtml"><head><title/></head><body>
</body></html></notes>
<annotation>
<celldesigner:extension>
<celldesigner:name>NUCLEUS</celldesigner:name>
</celldesigner:extension>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#s_id_n1">
<dcterms:modified rdf:parseType="Resource"></dcterms:modified>
</rdf:Description>
</rdf:RDF>
</annotation>
</compartment>
<compartment metaid="default" id="default" name="" size="1" units="volume" >
<notes><html xmlns="http://www.w3.org/1999/xhtml"><head><title/></head><body>
</body></html></notes>
<annotation>
<celldesigner:extension>
</celldesigner:extension>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#default">
<dcterms:modified rdf:parseType="Resource"></dcterms:modified>
</rdf:Description>
</rdf:RDF>
</annotation>
</compartment>
</listOfCompartments>
<listOfSpecies><species name="STAT1_alpha_" id="s_id_n1__.__n0" metaid="s_id_n1__.__n0" initialConcentration="0.0" hasOnlySubstanceUnits="false" constant="false" boundaryCondition="false" compartment="s_id_n1"><annotation><celldesigner:extension><celldesigner:speciesIdentity><celldesigner:class>PROTEIN</celldesigner:class>
<celldesigner:proteinReference>p_s_id_n1__.__n0</celldesigner:proteinReference>
<celldesigner:state>
<celldesigner:homodimer>2</celldesigner:homodimer>
<celldesigner:listOfModifications>
<celldesigner:modification residue="3" state="phosphorylated"> </celldesigner:modification>
<celldesigner:modification residue="4" state="phosphorylated"> </celldesigner:modification>
</celldesigner:listOfModifications>
</celldesigner:state>
<celldesigner:name>STAT1_alpha_</celldesigner:name>
</celldesigner:speciesIdentity>
</celldesigner:extension>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#s_id_n1__.__n0">
<dcterms:modified rdf:parseType="Resource"></dcterms:modified>
</rdf:Description>
</rdf:RDF>
</annotation>
</species>
</listOfSpecies>
</model></sbml>
......@@ -10,6 +10,7 @@ import java.util.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.io.FilenameUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.sbgn.*;
......@@ -118,7 +119,9 @@ public class SbgnmlXmlParser {
public Model createModel(String filename, File inputSbgnmlFile) throws InvalidInputDataExecption {
model = new ModelFullIndexed(null);
model.setIdModel(filename);
if (filename != null) {
model.setIdModel(FilenameUtils.getBaseName(filename).replaceAll("-", "_"));
}
Sbgn sbgnData;
Map map = null;
......
......@@ -170,7 +170,7 @@ public abstract class AbstractImageGenerator {
this.level = params.getLevel();
this.scale = params.getScale();
colorExtractor = new ColorExtractor(params.getMinColor(), params.getMaxColor(), params.getSimpleColor());
colorExtractor = new ColorExtractor(params.getMinColor(), params.getMaxColor(), params.getSimpleColor(), params.getNeutralColor());
// set border frame extended by a margin
border = new Rectangle2D.Double(params.getX() - SINGLE_FRAME_MARGIN, params.getY() - SINGLE_FRAME_MARGIN,
......@@ -383,7 +383,7 @@ public abstract class AbstractImageGenerator {
this.graphics = graphics;
}
/**
/**
* Saves generated image into file.
*
* @param fileName
......@@ -400,7 +400,7 @@ public abstract class AbstractImageGenerator {
saveToFileImplementation(fileName);
}
/**
/**
* Saves generated image from {@link #getGraphics()} into file.
*
* @param fileName
......@@ -700,6 +700,8 @@ public abstract class AbstractImageGenerator {
private Color simpleColor = Color.BLACK;
private Color neutralColor = Color.WHITE;
/**
* @param scale
* scale to set
......@@ -1090,9 +1092,21 @@ public abstract class AbstractImageGenerator {
}
public Params colorExtractor(ColorExtractor colorExtractor) {
return minColor(colorExtractor.getMinColor()).maxColor(colorExtractor.getMaxColor())
.simpleColor(colorExtractor.getSimpleColor());
return minColor(colorExtractor.getMinColor())
.maxColor(colorExtractor.getMaxColor())
.simpleColor(colorExtractor.getSimpleColor())
.neutralColor(colorExtractor.getNeutralColor());
}
public Params neutralColor(Color neutralColor) {
this.neutralColor = neutralColor;
return this;
}
public Color getNeutralColor() {
return this.neutralColor;
}
}
}
\ No newline at end of file
......@@ -48,8 +48,10 @@ public class ImageGenerators {
try {
availableGenerators = new ArrayList<Pair<String, Class<? extends AbstractImageGenerator>>>();
Model model = new ModelFullIndexed(null);
AbstractImageGenerator.Params params = new AbstractImageGenerator.Params().model(model).width(1)
.minColor(Color.WHITE).maxColor(Color.WHITE).height(1);
AbstractImageGenerator.Params params = new AbstractImageGenerator.Params().model(model).width(1).height(1)
.minColor(Color.WHITE)
.maxColor(Color.WHITE)
.neutralColor(Color.WHITE);
generatorInstances = new ArrayList<>();
generatorInstances.add(new PngImageGenerator(params));
generatorInstances.add(new PdfImageGenerator(params));
......
......@@ -16,7 +16,8 @@ import lcsb.mapviewer.converter.graphics.ConverterParams;
import lcsb.mapviewer.converter.graphics.DrawingException;
import lcsb.mapviewer.converter.graphics.bioEntity.BioEntityConverter;
import lcsb.mapviewer.converter.graphics.geometry.ArrowTransformation;
import lcsb.mapviewer.model.graphics.*;
import lcsb.mapviewer.model.graphics.ArrowTypeData;
import lcsb.mapviewer.model.graphics.PolylineData;
import lcsb.mapviewer.model.map.layout.ColorSchema;
import lcsb.mapviewer.model.map.layout.GenericColorSchema;
import lcsb.mapviewer.model.map.reaction.*;
......@@ -357,41 +358,28 @@ public class ReactionConverter extends BioEntityConverter<Reaction> {
// draw line
arrowTransformation.drawLine(operator.getLine(), graphics);
// in SBGN view - draw connecting point only if it's not connected to
// reactants or products
if (!sbgnFormat || operator.getLine().getEndAtd().getArrowType() != ArrowType.NONE
|| (!operator.getOutputs().isEmpty() && operator.getOutputs().get(0) instanceof NodeOperator)) {
// and now connecting point
Point2D centerPoint = operator.getLine().getPoints().get(0);
Color fillColor = Color.WHITE;
double radius = DEFAULT_OPERATOR_RADIUS;
// bigger connecting point circles in SBGN view
if (sbgnFormat) {
radius *= SBGN_RADIUS_MULTIPLIER;
} else if (operator instanceof AndOperator || operator instanceof SplitOperator
|| operator instanceof DissociationOperator || operator instanceof AssociationOperator
|| operator instanceof TruncationOperator) {
radius = 1.5;
fillColor = operator.getLine().getColor();
}
// it's a circle
Ellipse2D cir = new Ellipse2D.Double(centerPoint.getX() - radius, centerPoint.getY() - radius, 2 * radius,
2 * radius);
graphics.setColor(fillColor);
graphics.fill(cir);
graphics.setColor(operator.getLine().getColor());
graphics.draw(cir);
// and text defined by operator
String text;
if (!sbgnFormat) {
text = operator.getOperatorText();
} else {
text = operator.getSBGNOperatorText();
}
Rectangle2D rect = graphics.getFontMetrics().getStringBounds(text, graphics);
graphics.drawString(text, (int) (centerPoint.getX() - rect.getWidth() / 2 + 1),
(int) (centerPoint.getY() + rect.getHeight() / 2) - 2);
Point2D centerPoint = operator.getLine().getPoints().get(0);
Color fillColor = Color.WHITE;
double radius = DEFAULT_OPERATOR_RADIUS;
// bigger connecting point circles in SBGN view
if (operator instanceof AndOperator || operator instanceof SplitOperator
|| operator instanceof DissociationOperator || operator instanceof AssociationOperator
|| operator instanceof TruncationOperator) {
radius = 1.5;
fillColor = operator.getLine().getColor();
}
// it's a circle
Ellipse2D cir = new Ellipse2D.Double(centerPoint.getX() - radius, centerPoint.getY() - radius, 2 * radius,
2 * radius);
graphics.setColor(fillColor);
graphics.fill(cir);
graphics.setColor(operator.getLine().getColor());
graphics.draw(cir);
// and text defined by operator
String text = operator.getOperatorText();
Rectangle2D rect = graphics.getFontMetrics().getStringBounds(text, graphics);
graphics.drawString(text, (int) (centerPoint.getX() - rect.getWidth() / 2 + 1),