/** * Sets the speciesID to the id of the {@link Species} 'species'. * * @param species */ public void setSpecies(Species species) { setSpecies((species != null) && (species.isSetId()) ? species.getId() : null); }
/** * Creates a new {@link SpeciesReferenceFilter} that only accepts instances of * {@link SpeciesReference} pointing to the id of the given {@link Species}. * * @param species * the {@link Species} of interest. */ public SpeciesReferenceFilter(Species species) { this(species.getId(), species.getName()); setFilterForSpecies(true); }
/** * Creates a SimpleSpeciesReference instance from a given Species. * * @param species */ public SimpleSpeciesReference(Species species) { this(species.getLevel(), species.getVersion()); speciesID = species.isSetId() ? new String(species.getId()) : null; }
@Override public boolean check(ValidationContext ctx, SpeciesReference sr) { Species s = sr.getSpeciesInstance(); // if the species is constant and 'boundaryCondition = false', it cannot be a reactant or product if (s != null && !s.isBoundaryCondition() && s.isConstant()) { ValidationConstraint.logError(ctx, CORE_20611, sr, s.getId()); return false; } return true; } };
@Override public boolean check(ValidationContext ctx, Species s) { if (s.isSetSpeciesType() && s.getSpeciesTypeInstance() == null) { ValidationConstraint.logError(ctx, CORE_20612, s, s.getId(), s.getSpeciesType()); return false; } return true; } };
@Override public boolean check(ValidationContext ctx, Species s) { if (s.isSetConversionFactor() && s.getConversionFactorInstance() == null) { ValidationConstraint.logError(ctx, CORE_20617, s, s.getId(), s.getConversionFactor()); return false; } return true; } };
String speciesId = species.getId(); boolean thisSpeciesSelected = false;
@Override public boolean check(ValidationContext ctx, Species s) { // TODO - change the way we report the error, to report the error per compartment, only once. // And we should be able to avoid a loop over the full listofSpecies for each species Model m = s.getModel(); if (s.isSetSpeciesType() && m != null) { String st = s.getSpeciesType(); for (Species spec: m.getListOfSpecies()) { // Are species in same compartment but not the same? if (spec.isSetSpeciesType() && spec.getCompartment().equals(s.getCompartment()) && !spec.getId().equals(s.getId())) { // Must have different Types if (spec.getSpeciesType().equals(st)) { return false; } } } } return true; } };
private void processSpecies(ListOf<Species> list) { // process all species for (Species s : list) { String id = s.getId(); ONDEXConcept concept = null; // treat enzymes differently if (id.startsWith("enz_")) { concept = graph.getFactory().createConcept(id, dataSourceBrenda, ccEnzyme, evidence); // EC number is an ambiguous accession for an enzyme String ec = id.substring(7); ec = ec.replaceAll("_", "."); concept.createConceptAccession(ec, dataSourceEC, true); } else { concept = graph.getFactory().createConcept(id, dataSourceBrenda, ccComp, evidence); } // add preferred concept name String name = s.getName(); concept.createConceptName(name, true); concepts.put(id, concept); } }
@Override public boolean check(ValidationContext ctx, Species s) { Model m = s.getModel(); if (m != null && !s.isSetInitialAmount() && !s.isSetInitialConcentration()) { boolean setByAssignment = false; if (s.isSetId()) { setByAssignment = m.getInitialAssignmentBySymbol(s.getId()) != null; if (!setByAssignment) { Rule r = m.getRuleByVariable(s.getId()); setByAssignment = r != null && r.isAssignment(); } } if (!setByAssignment) { // TODO - build a nice error message } return setByAssignment; } return true; } };
@Override public boolean check(ValidationContext ctx, Species s) { Compartment c = s.getCompartmentInstance(); if (c != null && c.getSpatialDimensions() == 0 && s.isSetInitialConcentration()) { ValidationConstraint.logError(ctx, CORE_20604, s, s.getId(), s.getCompartment()); return false; } return true; } };
@Override public boolean check(ValidationContext ctx, Species s) { /* * Invalid value found for Species 'compartment' attribute */ if (s.isSetCompartment() && s.getModel() != null && s.getCompartmentInstance() == null) { ValidationConstraint.logError(ctx, CORE_20601, s, s.getId(), s.getCompartment()); return false; } return true; } };
@Override public boolean check(ValidationContext ctx, Species s) { if (s.getModel() != null) { Compartment c = s.getCompartmentInstance(); if (c != null && c.getSpatialDimensions() == 0 && s.isSetSpatialSizeUnits()) { ValidationConstraint.logError(ctx, CORE_20603, s, s.getId(), s.getCompartment()); return false; } } return true; } };
if (er.getVariable().equals(s.getId())) for (SpeciesReference sr: r.getListOfProducts()) if (sr.getSpecies().equals(s.getId())) ValidationConstraint.logError(ctx, CORE_20610, s, s.getId(), r.getId()); return false; for (SpeciesReference sr: r.getListOfReactants()) if (sr.getSpecies().equals(s.getId())) ValidationConstraint.logError(ctx, CORE_20610, s, s.getId(), r.getId()); return false;
ONDEXConcept speciesC = graph.getFactory().createConcept(species.getId(), dataSourceSBML, cc, etSBML); speciesById.put(species.getId(), speciesC); speciesC.createAttribute(boundaryCondition, species.getBoundaryCondition(), false); } else { logFail("Unable to determine concept class for species " + species.getId());
ONDEXConcept speciesC = graph.getFactory().createConcept(species.getId(), dataSourceSBML, cc, etSBML); speciesById.put(species.getId(), speciesC); speciesC.createAttribute(boundaryCondition, species.getBoundaryCondition(), false); } else { logFail("Unable to determine concept class for species " + species.getId());
ValidationConstraint.logError(ctx, CORE_20608, s, s.getId(), s.getSubstanceUnits());
@Override public boolean check(ValidationContext ctx, Species s) { Compartment c = s.getCompartmentInstance(); boolean checkResult = true; if (c != null && c.getSpatialDimensions() == 3 && s.isSetSpatialSizeUnits()) { UnitDefinition def = s.getSpatialSizeUnitsInstance(); if (def == null) { checkResult = false; } boolean isVolume = checkResult && def.isVariantOfVolume(); if (checkResult && ctx.getLevel() == 2 && ctx.getLevel() == 1 && !isVolume) { checkResult = false; } if (checkResult && ctx.getLevel() >= 2 && (! (def.isVariantOfDimensionless() || isVolume))) { checkResult = false; } } if (!checkResult) { // report error ValidationConstraint.logError(ctx, CORE_20607, s, s.getId(), s.getCompartment(), s.getSpatialSizeUnits()); } return checkResult; } };
@Override public boolean check(ValidationContext ctx, Species s) { Compartment c = s.getCompartmentInstance(); boolean checkResult = true; if (c != null && c.getSpatialDimensions() == 1 && s.isSetSpatialSizeUnits()) { UnitDefinition def = s.getSpatialSizeUnitsInstance(); if (def == null) { checkResult = false; } boolean isLength = checkResult && def.isVariantOfLength(); if (ctx.getLevel() == 2 && ctx.getLevel() == 1 && !isLength) { checkResult = false; } if (ctx.getLevel() >= 2 && (! (def.isVariantOfDimensionless() || isLength)) ) { checkResult = false; } } if (!checkResult) { // report error ValidationConstraint.logError(ctx, CORE_20605, s, s.getId(), s.getCompartment(), s.getSpatialSizeUnits()); } return checkResult; } };
@Override public boolean check(ValidationContext ctx, Species s) { Compartment c = s.getCompartmentInstance(); boolean checkResult = true; if (c != null && c.getSpatialDimensions() == 2 && s.isSetSpatialSizeUnits()) { UnitDefinition def = s.getSpatialSizeUnitsInstance(); if (def == null) { checkResult = false; } boolean isArea = checkResult && def.isVariantOfArea(); if (ctx.getLevel() == 2 && ctx.getLevel() == 1 && !isArea) { checkResult = false; } if (ctx.getLevel() >= 2 && (! (def.isVariantOfDimensionless() || isArea))) { checkResult = false; } } if (!checkResult) { // report error ValidationConstraint.logError(ctx, CORE_20606, s, s.getId(), s.getCompartment(), s.getSpatialSizeUnits()); } return checkResult; } };