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

export map notes to gpml

parent 48f4a169
minerva (15.0.2) stable; urgency=medium
* Bug fix: annotations using identifiers.org urls sometimes required http and
sometimes required https url (#1297)
* Bug fix: map notes were not exported to GPML
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 29 Jun 2020 11:00:00 +0200
......
......@@ -805,6 +805,9 @@ public class ModelToGPML {
StringBuilder gpml = new StringBuilder("");
gpml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
gpml.append("<Pathway xmlns=\"http://pathvisio.org/GPML/2013a\" Name=\"Generated\">\n");
if (model.getNotes() != null) {
gpml.append(" <Comment>" + model.getNotes().trim() + "</Comment>\n");
}
gpml.append(" <Graphics BoardWidth=\"" + model.getWidth() + "\" BoardHeight=\"" + model.getHeight() + "\"/>\n");
gpml.append(getDataNodes(model));
......
......@@ -200,7 +200,7 @@ public class ModelToGPMLTest extends WikipathwaysTestFunctions {
assertEquals(reaction.isReversible(), newReaction.isReversible());
}
private Reaction createReaction(Protein p1, Protein p2) {
private Reaction createReaction(Species p1, Species p2) {
Reaction reaction = new TransportReaction("re" + (speciesCounter++));
Reactant reactant = new Reactant(p1);
Product product = new Product(p2);
......@@ -396,4 +396,18 @@ public class ModelToGPMLTest extends WikipathwaysTestFunctions {
assertEquals(0, new ModelComparator().compare(model, model2));
}
@Test
public void testMapNotes() throws Exception {
Model model = new ModelFullIndexed(null);
model.setWidth(1000);
model.setHeight(1000);
model.setNotes("xyz");
lcsb.mapviewer.wikipathway.GpmlParser parser = new lcsb.mapviewer.wikipathway.GpmlParser();
String xml = parser.model2String(model);
Model model2 = parser.createModel(new ConverterParams().inputStream(new ByteArrayInputStream(xml.getBytes())));
assertEquals(0, new ModelComparator().compare(model, model2));
}
}
Supports Markdown
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