Search in sources :

Example 1 with SBase

use of org.sbml.jsbml.SBase in project vcell by virtualcell.

the class SBMLImporter method checkIdentifiersNameLength.

private void checkIdentifiersNameLength() throws Exception {
    // Check compartment name lengths
    ListOf listofIds = sbmlModel.getListOfCompartments();
    boolean bLongCompartmentName = false;
    SBase issueSource = null;
    for (int i = 0; i < sbmlModel.getNumCompartments(); i++) {
        Compartment compartment = (Compartment) listofIds.get(i);
        String compartmentName = compartment.getId();
        if (compartmentName.length() > 64) {
            bLongCompartmentName = true;
            issueSource = compartment;
        }
    }
    // Check species name lengths
    listofIds = sbmlModel.getListOfSpecies();
    boolean bLongSpeciesName = false;
    for (int i = 0; i < sbmlModel.getNumSpecies(); i++) {
        org.sbml.jsbml.Species species = (org.sbml.jsbml.Species) listofIds.get(i);
        String speciesName = species.getId();
        if (speciesName.length() > 64) {
            bLongSpeciesName = true;
            issueSource = species;
        }
    }
    // Check parameter name lengths
    listofIds = sbmlModel.getListOfParameters();
    boolean bLongParameterName = false;
    for (int i = 0; i < sbmlModel.getNumParameters(); i++) {
        Parameter param = (Parameter) listofIds.get(i);
        String paramName = param.getId();
        if (paramName.length() > 64) {
            bLongParameterName = true;
            issueSource = param;
        }
    }
    // Check reaction name lengths
    listofIds = sbmlModel.getListOfReactions();
    boolean bLongReactionName = false;
    for (int i = 0; i < sbmlModel.getNumReactions(); i++) {
        Reaction rxn = (Reaction) listofIds.get(i);
        String rxnName = rxn.getId();
        if (rxnName.length() > 64) {
            bLongReactionName = true;
            issueSource = rxn;
        }
    }
    if (bLongCompartmentName || bLongSpeciesName || bLongParameterName || bLongReactionName) {
        String warningMsg = "WARNING: The imported model has one or more ";
        if (bLongCompartmentName) {
            warningMsg = warningMsg + "compartments, ";
        }
        if (bLongSpeciesName) {
            warningMsg = warningMsg + "species, ";
        }
        if (bLongParameterName) {
            warningMsg = warningMsg + "global parameters, ";
        }
        if (bLongReactionName) {
            warningMsg = warningMsg + "reactions ";
        }
        warningMsg = warningMsg + "that have ids/names that are longer than 64 characters. \n\nUser is STRONGLY recommeded to shorten " + "the names to avoid problems with the length of expressions these names might be used in.";
        localIssueList.add(new Issue(new SBMLIssueSource(issueSource), issueContext, IssueCategory.SBMLImport_UnsupportedAttributeOrElement, warningMsg, Issue.SEVERITY_WARNING));
    // logger.sendMessage(VCLogger.Priority.MediumPriority,
    // VCLogger.ErrorType.UnsupportedConstruct, warningMsg);
    }
}
Also used : Issue(org.vcell.util.Issue) Compartment(org.sbml.jsbml.Compartment) Reaction(org.sbml.jsbml.Reaction) SimpleReaction(cbit.vcell.model.SimpleReaction) FluxReaction(cbit.vcell.model.FluxReaction) InteriorPoint(org.sbml.jsbml.ext.spatial.InteriorPoint) SpatialNamedSBase(org.sbml.jsbml.ext.spatial.SpatialNamedSBase) SBase(org.sbml.jsbml.SBase) ListOf(org.sbml.jsbml.ListOf) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) Parameter(org.sbml.jsbml.Parameter) ModelParameter(cbit.vcell.model.Model.ModelParameter) SpeciesContextSpecParameter(cbit.vcell.mapping.SpeciesContextSpec.SpeciesContextSpecParameter) LocalParameter(org.sbml.jsbml.LocalParameter) KineticsProxyParameter(cbit.vcell.model.Kinetics.KineticsProxyParameter) UnresolvedParameter(cbit.vcell.model.Kinetics.UnresolvedParameter) Species(cbit.vcell.model.Species)

Aggregations

SpeciesContextSpecParameter (cbit.vcell.mapping.SpeciesContextSpec.SpeciesContextSpecParameter)1 FluxReaction (cbit.vcell.model.FluxReaction)1 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)1 KineticsProxyParameter (cbit.vcell.model.Kinetics.KineticsProxyParameter)1 UnresolvedParameter (cbit.vcell.model.Kinetics.UnresolvedParameter)1 ModelParameter (cbit.vcell.model.Model.ModelParameter)1 SimpleReaction (cbit.vcell.model.SimpleReaction)1 Species (cbit.vcell.model.Species)1 Compartment (org.sbml.jsbml.Compartment)1 ListOf (org.sbml.jsbml.ListOf)1 LocalParameter (org.sbml.jsbml.LocalParameter)1 Parameter (org.sbml.jsbml.Parameter)1 Reaction (org.sbml.jsbml.Reaction)1 SBase (org.sbml.jsbml.SBase)1 InteriorPoint (org.sbml.jsbml.ext.spatial.InteriorPoint)1 SpatialNamedSBase (org.sbml.jsbml.ext.spatial.SpatialNamedSBase)1 Issue (org.vcell.util.Issue)1