Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.1 regression introduces invalid compartment and parameter references #137

Open
Schmoho opened this issue Dec 1, 2024 · 0 comments
Open
Labels
2.1 Issue in the 2.1 branch bug urgent Severe issue that needs to be fixed asap

Comments

@Schmoho
Copy link
Collaborator

Schmoho commented Dec 1, 2024

This occurs on model https://www.ebi.ac.uk/biomodels/BIOMD0000000807

The error is very serious since it changes the mathematical interpretation of the model.

This method

private void ensureCompartmentCodeFromBiggIdReferencesCompartment(Species species, BiGGId biggId) {
Model model = species.getModel();
String cId = biggId.getCompartmentCode();
SBase candidate = model.findUniqueNamedSBase(cId);
if(candidate != null && !(candidate instanceof Compartment)) {
// TODO: this is not graceful
candidate.setId(candidate.getId() + "_non_compartment");
}
if (candidate == null && cId != null && !cId.isEmpty()) {
logger.debug(format(MESSAGES.getString("CREATE_MISSING_COMP"),
cId, species.getId(), species.getElementName()));
var compartment = model.createCompartment(cId);
compartment.setConstant(true); // required attribute
new CompartmentPolisher(polishingParameters, registry, getObservers()).polish(compartment);
}

has two errors:

  1. It interprets the species ids normalized_cancer_cell_a, normalized_cancer_cell_n and normalized_cancer_cell_g as BiGG IDs and tries to create compartments a, n and g.
    This behaviour was preexisting. However, this is actually unwanted here, as the IDs do not in fact represent BiGG IDs.

i.e.

<species compartment="compartment" id="normalized_cancer_cell_a" [...]>
	 [...]
</species>

becomes

<species compartment="a" id="normalized_cancer_cell_a" [...]>
	 [...]
</species>
  1. Since a global parameter with id a exists on the model, the method changes its id to a_non_compartment, but references to the parameter in variable attributes on assignmentRules are not updated. This behaviour is reckless and a regression that I introduced in the 2.1 branch.

i.e.

<parameter constant="false" id="a" metaid="COPASI32" name="a'" value="0">
        [...]
</parameter>

becomes

<parameter constant="false" id="a_non_compartment" metaid="COPASI32" name="a'" value="0">
        [...]
</parameter>

So two fixes are required here:

  1. we need to do better in detecting BiGG IDs
  2. we cannot change the IDs of non-compartment objects if a new compartment is created from a BiGG ID, but need to adapt the name of the new compartment instead
@Schmoho Schmoho added bug urgent Severe issue that needs to be fixed asap 2.1 Issue in the 2.1 branch labels Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.1 Issue in the 2.1 branch bug urgent Severe issue that needs to be fixed asap
Projects
None yet
Development

No branches or pull requests

1 participant