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

prefixing should be done only on unprefixed reactions

parent 526c96e9
Pipeline #20015 failed with stage
in 11 minutes and 47 seconds
......@@ -4,6 +4,8 @@ minerva (14.0.8) stable; urgency=medium
* Bug fix: upload of data overlay with two entries having different uniprot
identifier but pointing to the same gene crashed (#1083)
* Bug fix: don't allow to remove plugin twice (#1081)
* Bug fix: upload of SBML file with very short reaction length could produce
a map that couldn't be exported to SBML anymore (#1078)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 23 Jan 2020 12:00:00 +0200
......
......@@ -633,9 +633,8 @@ public class SbmlReactionParser extends SbmlBioEntityParser {
}
protected Reaction parse(org.sbml.jsbml.Reaction sbmlReaction) throws InvalidInputDataExecption {
Reaction reaction = new Reaction();
Reaction reaction = new Reaction(sbmlReaction.getId());
assignBioEntityData(sbmlReaction, reaction);
reaction.setIdReaction(sbmlReaction.getId());
reaction.setReversible(sbmlReaction.isReversible());
if (sbmlReaction.getKineticLaw() != null) {
if (sbmlReaction.getKineticLaw().getMath() == null) {
......
......@@ -12,8 +12,7 @@ import org.junit.Test;
import lcsb.mapviewer.commands.CreateHierarchyCommand;
import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.InvalidInputDataExecption;
import lcsb.mapviewer.converter.*;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.reaction.*;
......@@ -232,4 +231,11 @@ public class SbmlParserTest extends SbmlTestFunctions {
reactant.getLine().getBeginPoint().distance(120, 40), Configuration.EPSILON);
}
@Test
public void xxx() throws FileNotFoundException, InvalidInputDataExecption, ConverterException {
Model m = parser.createModel(new ConverterParams().filename("testFiles/problematic_layout.xml"));
String xml = parser.model2String(m);
assertNotNull(xml);
}
}
This diff is collapsed.
......@@ -109,10 +109,6 @@ public abstract class ApplyLayoutModelCommand extends ModelCommand {
return addReactionPrefixes;
}
public void setAddReactionPrefixes(boolean addReactionPrefixes) {
this.addReactionPrefixes = addReactionPrefixes;
}
protected String getNextId() {
return (idCounter++) + "";
}
......
......@@ -5,6 +5,7 @@ import java.util.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.hibernate.sql.ordering.antlr.GeneratedOrderByLexer;
import lcsb.mapviewer.commands.CommandExecutionException;
import lcsb.mapviewer.common.Configuration;
......@@ -23,6 +24,7 @@ import lcsb.mapviewer.model.map.reaction.type.*;
import lcsb.mapviewer.model.map.species.*;
import lcsb.mapviewer.model.map.species.field.ModificationResidue;
import lcsb.mapviewer.model.map.species.field.SpeciesWithModificationResidue;
import lcsb.mapviewer.modelutils.map.ElementUtils;
public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
......@@ -218,9 +220,13 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
modifyModifiers(reaction, middle);
if (super.isAddReactionPrefixes()) {
super.getModel().removeReaction(reaction);
reaction.setIdReaction("reaction_glyph_" + getNextId() + "__" + reaction.getIdReaction());
super.getModel().addReaction(reaction);
if (reaction.getIdReaction().contains("__")) {
logger.warn(new ElementUtils().getElementTag(reaction) + "Reaction identifier already prefixed");
} else {
super.getModel().removeReaction(reaction);
reaction.setIdReaction("reaction_glyph_" + getNextId() + "__" + reaction.getIdReaction());
super.getModel().addReaction(reaction);
}
}
}
......
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