Commit 17fda2cf authored by Piotr Gawron's avatar Piotr Gawron
Browse files

escpae modificationresidue name

parent ad574875
......@@ -628,7 +628,7 @@ public class ModelToGPML {
stateString = mr.getName();
}
}
result.append("TextLabel=\"" + stateString + "\" ");
result.append("TextLabel=\"" + XmlParser.escapeXml(stateString) + "\" ");
result.append(">");
double relX = ((mr.getPosition().getX() - mr.getSpecies().getX()) / mr.getSpecies().getWidth() - 0.5) * 2;
double relY = ((mr.getPosition().getY() - mr.getSpecies().getY()) / mr.getSpecies().getHeight() - 0.5) * 2;
......
......@@ -23,8 +23,7 @@ import lcsb.mapviewer.model.map.model.*;
import lcsb.mapviewer.model.map.reaction.*;
import lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction;
import lcsb.mapviewer.model.map.species.*;
import lcsb.mapviewer.model.map.species.field.ModificationState;
import lcsb.mapviewer.model.map.species.field.Residue;
import lcsb.mapviewer.model.map.species.field.*;
import lcsb.mapviewer.wikipathway.WikipathwaysTestFunctions;
public class ModelToGPMLTest extends WikipathwaysTestFunctions {
......@@ -453,6 +452,7 @@ public class ModelToGPMLTest extends WikipathwaysTestFunctions {
assertEquals(0, new ModelComparator().compare(model, model2));
}
@Test
public void specialCharacterInProteinName() throws Exception {
Model model = createModel();
......@@ -464,4 +464,24 @@ public class ModelToGPMLTest extends WikipathwaysTestFunctions {
assertEquals(0, new ModelComparator().compare(model, model2));
}
@Test
public void specialCharacterInModificationName() throws Exception {
Model model = createModel();
Protein element = createProtein();
BindingRegion mr = createBindingRegion(element);
mr.setName("hello&by");
element.addBindingRegion(mr);
model.addElement(element);
serializeOverGpml(model);
}
private BindingRegion createBindingRegion(Protein p1) {
BindingRegion residue = new BindingRegion();
residue.setIdModificationResidue("mr" + speciesCounter++);
residue.setPosition(new Point2D.Double(p1.getCenterX(), p1.getY()));
residue.setName("m");
return residue;
}
}
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