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

parse sbgn notes

parent 0c8dafc8
......@@ -27,6 +27,7 @@ minerva (15.1.0) unstable; urgency=medium
clickable (#1314)
* Small improvement: Modifier Reaction from CellDesigner are exported properly
to SBGN-ML PD (#1320)
* Small improvement: SBGN notes are imported properly
* 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
......
......@@ -3,15 +3,20 @@ package lcsb.mapviewer.converter.model.sbgnml;
import java.awt.Color;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.sbgn.*;
import org.sbgn.bindings.*;
import org.sbgn.bindings.Arc.*;
import org.sbgn.bindings.Map;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import lcsb.mapviewer.common.Configuration;
......@@ -25,6 +30,7 @@ import lcsb.mapviewer.converter.InvalidInputDataExecption;
import lcsb.mapviewer.converter.ZIndexPopulator;
import lcsb.mapviewer.converter.annotation.XmlAnnotationParser;
import lcsb.mapviewer.converter.graphics.bioEntity.element.species.SpeciesConverter;
import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser;
import lcsb.mapviewer.converter.model.celldesigner.geometry.CellDesignerAliasConverter;
import lcsb.mapviewer.converter.model.celldesigner.geometry.ReactionCellDesignerConverter;
import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.PolylineDataFactory;
......@@ -115,7 +121,7 @@ public class SbgnmlXmlParser {
model.setIdModel(filename);
Sbgn sbgnData;
Map map;
Map map = null;
// Check if input file has valid SBGN-ML data
try {
if (!SbgnUtil.isValid(inputSbgnmlFile)) {
......@@ -134,6 +140,23 @@ public class SbgnmlXmlParser {
} catch (Exception ex) {
throw new InvalidInputDataExecption("Unable to read given file.", ex);
}
RestAnnotationParser rap = new RestAnnotationParser();
if (map.getNotes() != null && map.getNotes().getAny().size() > 0) {
try {
String notes = "<notes>" + XmlParser.nodeToString(map.getNotes().getAny().get(0).getParentNode(), true)
+ "</notes>";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db;
db = dbf.newDocumentBuilder();
Document doc = db.parse(new ByteArrayInputStream(notes.getBytes()));
model.setNotes(rap.getNotes(doc.getFirstChild()));
} catch (Exception e) {
logger.warn("Problem with extracting map notes", e);
}
}
adjustSizeOfElements(map);
......@@ -372,6 +395,15 @@ public class SbgnmlXmlParser {
}
}
if (minX > maxX) {
minX = maxX;
maxX = 1;
}
if (minY > maxY) {
minY = maxY;
maxY = 1;
}
model.setWidth(maxX + minX);
model.setHeight(maxY + minY);
}
......
......@@ -318,4 +318,14 @@ public class SbgnmlXmlParserTest2 extends SbgnmlTestFunctions {
assertEquals(0, model.getReactions().size());
}
@Test
public void parseModelNotes() throws Exception {
Converter converter = new SbgnmlXmlConverter();
Model model = converter.createModel(new ConverterParams().filename("testFiles/sbgnmlParserTestFiles/sbgnmlFiles/model_notes.sbgn"));
assertFalse(model.getNotes().isEmpty());
}
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sbgn xmlns="http://sbgn.org/libsbgn/0.2">
<map language="process description">
<notes>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:celldesigner="http://www.sbml.org/2001/ns/celldesigner">
<head>
<title/>
</head>
<body>Vidisha Singh, Genhotel laboratory, University of Evry-paris saclay, Evry, France
Apoptosis pathway for Covid-19 maps project is constructed by using the review paper of Fung&amp;Liu,2019,Annu rev micro (PMID=31226023).
KEGG pathway database is used to add reactions between the elements.
Map is constructed in the form of a cell including plasma membrane, cytoplasm in addition to extracellular space.
Ligands are present in the extracellular space which interacts with receptors in the plasma membrane to initiate signaling cascade in the cytoplasm.
All the map elements are named according to HGNC naming scheme.
All map reactions are annotated with PubMed Ids, KEGG pathway Ids using MIRIAM add relation'bqbiol:isDescribedby'.
MESH Id is provided for the phenotype 'Apoptosis'.
</body>
</html>
</notes>
</map>
</sbgn>
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