Commit 94ce9fcd authored by Piotr Gawron's avatar Piotr Gawron
Browse files

don't override with empty structural state

parent 5c1f879c
Pipeline #20050 passed with stage
in 11 minutes and 39 seconds
......@@ -612,30 +612,36 @@ public class SbgnmlXmlParser {
((Protein) newSpecies).addResidue(residue);
} else if (newSpecies instanceof Complex) {
String state = createStructuralState(child);
Complex complex = (Complex) newSpecies;
complex.setStructuralState(state);
if (state != null) {
Complex complex = (Complex) newSpecies;
complex.setStructuralState(state);
}
} else {
logger.warn("Only macromolecule elements can have state variables.");
}
} else {
String state = createStructuralState(child);
if (newSpecies instanceof Protein) {
((Protein) newSpecies).setStructuralState(state);
} else if (newSpecies instanceof Complex) {
Complex complex = (Complex) newSpecies;
complex.setStructuralState(state);
} else {
logger.warn("Only macromolecule elements can have state.");
if (state != null) {
if (newSpecies instanceof Protein) {
((Protein) newSpecies).setStructuralState(state);
} else if (newSpecies instanceof Complex) {
Complex complex = (Complex) newSpecies;
complex.setStructuralState(state);
} else {
logger.warn("Only macromolecule elements can have state.");
}
}
}
} else {
String structuralState = createStructuralState(child);
if (newSpecies instanceof Protein) {
Protein protein = (Protein) newSpecies;
protein.setStructuralState(structuralState);
} else if (newSpecies instanceof Complex) {
Complex complex = (Complex) newSpecies;
complex.setStructuralState(structuralState);
if (structuralState != null) {
if (newSpecies instanceof Protein) {
Protein protein = (Protein) newSpecies;
protein.setStructuralState(structuralState);
} else if (newSpecies instanceof Complex) {
Complex complex = (Complex) newSpecies;
complex.setStructuralState(structuralState);
}
}
}
}
......@@ -691,7 +697,6 @@ public class SbgnmlXmlParser {
private String createStructuralState(Glyph glyph) {
if (glyph.getState() == null) {
logger.warn("Invalid structural state");
return null;
}
String result = "";
......
......@@ -114,7 +114,6 @@ public class SbgnmlXmlParserTest2 extends SbgnmlTestFunctions {
new ConverterParams().filename("testFiles/sbgnmlParserTestFiles/sbgnmlFiles/state_with_variable.sbgn"));
String sbgn = converter.model2String(model);
logger.debug(sbgn);
assertTrue("State variable is missing", sbgn.contains("state variable"));
assertTrue("State variable doesn't contain variable", sbgn.contains("variable=\"g\""));
......
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