本文整理汇总了Java中org.sbml.jsbml.Species.setHasOnlySubstanceUnits方法的典型用法代码示例。如果您正苦于以下问题:Java Species.setHasOnlySubstanceUnits方法的具体用法?Java Species.setHasOnlySubstanceUnits怎么用?Java Species.setHasOnlySubstanceUnits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sbml.jsbml.Species
的用法示例。
在下文中一共展示了Species.setHasOnlySubstanceUnits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: completeSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
/**
* Complete species.
*
* @param species
* the species
* @return ListOf<Species>
* TODO
*/
public static ListOf<Species> completeSpecies(ListOf<Species> species) {
int i = 0;
for (Species s : species) {
if (!s.isSetId()) {
s.setId(s.getClass().getSimpleName() + i++);
}
if (!s.isSetCompartment()) {
s.setCompartment(model.getCompartment(0));
}
if (!s.isSetHasOnlySubstanceUnits()) {
s.setHasOnlySubstanceUnits(true);
}
if (!s.isSetBoundaryCondition()) {
s.setBoundaryCondition(true);
}
if (!s.isSetConstant()) {
s.setConstant(true);
}
}
return species;
}
示例2: printRNAP
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
/**
* Prints the RNAP molecule to the document
*
* @param document
* the SBML document
*/
private void printRNAP(SBMLDocument document) {
double rnap = 30;
if (properties != null) {
rnap = Double.parseDouble(properties.getParameter(GlobalConstants.RNAP_STRING));
}
Species s = Utility.makeSpecies("RNAP", document.getModel().getCompartment(0).getId(), rnap, -1);
s.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, s);
//Adds RNA polymerase for compartments other than default
this.compartments = new HashMap<String,Properties>();
for (int i=0; i < document.getModel().getCompartmentCount(); i++) {
compartments.put(document.getModel().getCompartment(i).getId(), null);
}
for (String compartment : compartments.keySet()) {
Properties prop = compartments.get(compartment);
if (prop != null && prop.containsKey(GlobalConstants.RNAP_STRING)) {
rnap = Double.parseDouble((String)prop.get(GlobalConstants.RNAP_STRING));
}
Species sc = Utility.makeSpecies(compartment + "__RNAP", compartment, rnap, -1);
sc.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, sc);
}
}
示例3: visitSpasticSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
@Override
public void visitSpasticSpecies(SpasticSpecies specie) {
loadValues(specie);
String compartment = checkCompartments(specie.getId());
Species s = Utility.makeSpecies(specie.getId(), compartment, amount, concentration);
s.setName(specie.getName());
s.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, s);
r = new org.sbml.jsbml.Reaction(GlobalConstants.SBML_LEVEL, GlobalConstants.SBML_VERSION);
r.setId("Constitutive_production_" + s.getId());
r.setCompartment(compartment);
r.addProduct(Utility.SpeciesReference(s.getId(), specie.getnp()));
r.setReversible(false);
//r.setFast(false);
kl = r.createKineticLaw();
Utility.Parameter(kl, "kp", specie.getKo());
kl.setMath(SBMLutilities.myParseFormula("kp"));
Utility.addReaction(document, r);
}
示例4: visitDiffusibleConstitutiveSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
@Override
public void visitDiffusibleConstitutiveSpecies(DiffusibleConstitutiveSpecies specie) {
loadValues(specie);
String compartment = checkCompartments(specie.getId());
Species s = Utility.makeSpecies(specie.getId(), compartment, amount, concentration);
s.setName(specie.getName());
s.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, s);
r = new org.sbml.jsbml.Reaction(GlobalConstants.SBML_LEVEL, GlobalConstants.SBML_VERSION);
r.setId("Constitutive_production_" + s.getId());
r.setCompartment(compartment);
r.addProduct(Utility.SpeciesReference(s.getId(), Double.parseDouble(parameters.getParameter(GlobalConstants.STOICHIOMETRY_STRING))));
r.setReversible(false);
//r.setFast(false);
kl = r.createKineticLaw();
Utility.Parameter(kl, "kp", Double.parseDouble(parameters
.getParameter((GlobalConstants.OCR_STRING))));
kl.setMath(SBMLutilities.myParseFormula("kp"));
Utility.addReaction(document, r);
}
示例5: copySpeciesContents
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
/**
* Copy contents of Species from src to dst.
* @param src
* @param dst
* @return
*/
public static Species copySpeciesContents(Species src, Species dst) {
if (src.isSetInitialAmount()) dst.setInitialAmount(src.getInitialAmount());
if (src.isSetInitialConcentration()) dst.setInitialConcentration(src.getInitialConcentration());
dst.setCompartment(src.getCompartment());
dst.setUnits(src.getUnits());
dst.setBoundaryCondition(src.getBoundaryCondition());
dst.setConstant(src.getConstant());
dst.setHasOnlySubstanceUnits(src.getHasOnlySubstanceUnits());
return dst;
}
示例6: createPromoterFromGCM
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
public void createPromoterFromGCM(String s,Properties property) {
Species promoter = sbml.getModel().getSpecies(s);
if (promoter==null) {
promoter = sbml.getModel().createSpecies();
promoter.setId(s);
}
if (property != null && property.containsKey(GlobalConstants.PROMOTER_COUNT_STRING)) {
promoter.setInitialAmount(Double.parseDouble(property.getProperty(GlobalConstants.PROMOTER_COUNT_STRING)));
} else {
promoter.setInitialAmount(sbml.getModel().getParameter(GlobalConstants.PROMOTER_COUNT_STRING).getValue());
}
promoter.setCompartment(getDefaultCompartment());
promoter.setBoundaryCondition(false);
promoter.setConstant(false);
promoter.setHasOnlySubstanceUnits(true);
promoter.setSBOTerm(GlobalConstants.SBO_PROMOTER_BINDING_REGION);
if (property==null) {
createProductionReaction(s,GlobalConstants.ACTIVATED_STRING,
GlobalConstants.STOICHIOMETRY_STRING,
GlobalConstants.OCR_STRING,
GlobalConstants.KBASAL_STRING,
GlobalConstants.RNAP_BINDING_STRING,
GlobalConstants.ACTIVATED_RNAP_BINDING_STRING,false,null);
} else {
createProductionReaction(s,property.getProperty(GlobalConstants.ACTIVATED_STRING),
property.getProperty(GlobalConstants.STOICHIOMETRY_STRING),
property.getProperty(GlobalConstants.OCR_STRING),
property.getProperty(GlobalConstants.KBASAL_STRING),
property.getProperty(GlobalConstants.RNAP_BINDING_STRING),
property.getProperty(GlobalConstants.ACTIVATED_RNAP_BINDING_STRING),false,null);
}
}
示例7: printOnlyPromoters
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
/**
* Prints the promoters in the network
*
* @param document
* the SBML document
*/
private void printOnlyPromoters(SBMLDocument document) {
for (Promoter p : promoters.values()) {
Species s = Utility.makeSpecies(p.getId(), document.getModel().getCompartment(0).getId(), p.getInitialAmount(), -1);
s.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, s);
}
}
示例8: visitComplex
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
@Override
public void visitComplex(ComplexSpecies specie) {
if (!complexAbstraction || (!specie.isAbstractable() && !specie.isSequesterAbstractable())) {
loadValues(specie);
String compartment = checkCompartments(specie.getId());
Species s = Utility.makeSpecies(specie.getId(), compartment, amount, concentration);
// s.setName(specie.getName()); this causes things to break...specie lacks name for some reason
s.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, s);
} else
document.getModel().removeSpecies(specie.getId());
}
示例9: visitBaseSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
@Override
public void visitBaseSpecies(BaseSpecies specie) {
loadValues(specie);
String compartment = checkCompartments(specie.getId());
Species s = Utility.makeSpecies(specie.getId(), compartment, amount, concentration);
s.setName(specie.getName());
s.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, s);
}
示例10: visitConstantSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
@Override
public void visitConstantSpecies(ConstantSpecies specie) {
loadValues(specie);
String compartment = checkCompartments(specie.getId());
Species s = Utility.makeSpecies(specie.getId(), compartment, amount, concentration);
s.setName(specie.getName());
s.setHasOnlySubstanceUnits(true);
s.setBoundaryCondition(true);
//s.setConstant(true);
Utility.addSpecies(document, s);
}
示例11: visitDiffusibleSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
@Override
public void visitDiffusibleSpecies(DiffusibleSpecies species) {
loadValues(species);
String compartment = checkCompartments(species.getId());
Species s = Utility.makeSpecies(species.getId(), compartment, amount, concentration);
s.setName(species.getName());
s.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, s);
}
示例12: makeSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
public static Species makeSpecies(String id, String compartment, double amount, double concentration) {
Species specie = new Species(GlobalConstants.SBML_LEVEL, GlobalConstants.SBML_VERSION);
specie.setId(id);
specie.setName(id);
specie.setCompartment(compartment);
if (amount < 0) {
specie.setInitialConcentration(concentration);
} else{
specie.setInitialAmount(amount);
}
specie.setHasOnlySubstanceUnits(true);
specie.setConstant(false);
specie.setBoundaryCondition(false);
return specie;
}
示例13: createSpeciesFromGCM
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
public void createSpeciesFromGCM(String s,Properties property) {
Species species = sbml.getModel().getSpecies(s);
if (species==null) {
species = sbml.getModel().createSpecies();
species.setId(s);
species.setCompartment(getDefaultCompartment());
species.setBoundaryCondition(false);
species.setConstant(false);
species.setInitialAmount(0);
species.setHasOnlySubstanceUnits(true);
}
if (property.containsKey(GlobalConstants.INITIAL_STRING)) {
String initialString = property.getProperty(GlobalConstants.INITIAL_STRING);
if (Utility.isValid(initialString, Utility.NUMstring)) {
species.setInitialAmount(Double.parseDouble(initialString));
}
else if (Utility.isValid(initialString, Utility.CONCstring)) {
species.setInitialConcentration(Double.parseDouble(initialString.substring(1,initialString.length()-1)));
}
}
boolean onPort = false;
if (property.containsKey(GlobalConstants.TYPE)) {
String type = property.getProperty(GlobalConstants.TYPE).replace("diffusible","").replace("constitutive","");
createDirPort(species.getId(),type);
if (type.equals(GlobalConstants.INPUT)) {
species.setBoundaryCondition(true);
}
onPort = (type.equals(GlobalConstants.INPUT)||type.equals(GlobalConstants.OUTPUT));
}
double kd = -1;
if (property.containsKey(GlobalConstants.KDECAY_STRING)) {
kd = Double.parseDouble(property.getProperty(GlobalConstants.KDECAY_STRING));
}
if (kd != 0) {
createDegradationReaction(s,kd,null,onPort,null);
}
if (property.containsKey(GlobalConstants.TYPE) &&
property.getProperty(GlobalConstants.TYPE).contains("diffusible")) {
createDiffusionReaction(s,property.getProperty(GlobalConstants.MEMDIFF_STRING),onPort,null);
}
if (property.containsKey(GlobalConstants.TYPE) &&
property.getProperty(GlobalConstants.TYPE).contains("constitutive")) {
createConstitutiveReaction(s,null, null, onPort, null);
}
}
示例14: createSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
public String createSpecies(String id, float x, float y) {
String compartment;
if (x >= 0 && y >= 0) {
compartment = getCompartmentByLocation(x,y, GlobalConstants.DEFAULT_SPECIES_WIDTH,
GlobalConstants.DEFAULT_SPECIES_HEIGHT);
if (compartment.equals("")) {
message.setErrorDialog("Compartment Required", "Species must be placed within a compartment.");
this.notifyObservers(message);
return null;
}
} else {
if (sbml.getModel().getCompartmentCount()==0) {
message.setErrorDialog("Compartment Required", "Species must be placed within a compartment.");
this.notifyObservers(message);
return null;
}
compartment = sbml.getModel().getCompartment(0).getId();
}
if (id == null) {
do {
creatingSpeciesID++;
id = "S" + String.valueOf(creatingSpeciesID);
} while (SBMLutilities.getElementBySId(sbml, id)!=null);
}
if (sbml != null && sbml.getModel().getSpecies(id)==null) {
Model m = sbml.getModel();
Species species = m.createSpecies();
species.setId(id);
// Set default species metaID
metaIDIndex = SBMLutilities.setDefaultMetaID(sbml, species, metaIDIndex);
species.setCompartment(compartment);
SBMLutilities.cloneDimensionAddIndex(sbml.getModel().getCompartment(compartment),species,"compartment");
species.setBoundaryCondition(false);
species.setConstant(false);
species.setInitialAmount(0);
species.setHasOnlySubstanceUnits(true);
if (x >= 0 && y >= 0) {
Layout layout = getLayout();
SpeciesGlyph speciesGlyph = null;
if (layout.getSpeciesGlyph(GlobalConstants.GLYPH+"__"+id)!=null) {
speciesGlyph = layout.getSpeciesGlyph(GlobalConstants.GLYPH+"__"+id);
} else {
speciesGlyph = layout.createSpeciesGlyph(GlobalConstants.GLYPH+"__"+id);
speciesGlyph.createBoundingBox();
speciesGlyph.getBoundingBox().createDimensions();
speciesGlyph.getBoundingBox().createPosition();
speciesGlyph.setSpecies(id);
}
speciesGlyph.getBoundingBox().getPosition().setX(x);
speciesGlyph.getBoundingBox().getPosition().setY(y);
speciesGlyph.getBoundingBox().getDimensions().setWidth(GlobalConstants.DEFAULT_SPECIES_WIDTH);
speciesGlyph.getBoundingBox().getDimensions().setHeight(GlobalConstants.DEFAULT_SPECIES_HEIGHT);
TextGlyph textGlyph = layout.createTextGlyph(GlobalConstants.TEXT_GLYPH+"__"+id);
textGlyph.createBoundingBox();
textGlyph.getBoundingBox().createDimensions();
textGlyph.getBoundingBox().createPosition();
textGlyph.setGraphicalObject(GlobalConstants.GLYPH+"__"+id);
textGlyph.setText(SBMLutilities.getArrayId(sbml,id));
textGlyph.setBoundingBox(speciesGlyph.getBoundingBox().clone());
}
}
return id;
}
示例15: createPromoter
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
public String createPromoter(String promoterId, float x, float y, boolean isExplicit,
boolean createProduction, String reactionId) {
createProductionDefaultParameters();
String compartment;
compartment = getCompartmentByLocation(x,y,GlobalConstants.DEFAULT_SPECIES_WIDTH,GlobalConstants.DEFAULT_SPECIES_HEIGHT);
if (compartment.equals("")) {
if (sbml.getModel().getCompartmentCount()==0) {
message.setErrorDialog("Compartment Required", "Species must be placed within a compartment.");
this.notifyObservers(message);
return "";
}
compartment = sbml.getModel().getCompartment(0).getId();
}
Species promoter = sbml.getModel().createSpecies();
// Set default species ID
if (promoterId == null) {
do {
creatingPromoterID++;
promoterId = "P" + String.valueOf(creatingPromoterID);
}
while (SBMLutilities.getElementBySId(sbml, promoterId)!=null);
}
promoter.setId(promoterId);
// Set default promoter metaID
metaIDIndex = SBMLutilities.setDefaultMetaID(sbml, promoter, metaIDIndex);
promoter.setSBOTerm(GlobalConstants.SBO_PROMOTER_BINDING_REGION);
promoter.setInitialAmount(sbml.getModel().getParameter(GlobalConstants.PROMOTER_COUNT_STRING).getValue());
promoter.setCompartment(compartment);
SBMLutilities.cloneDimensionAddIndex(sbml.getModel().getCompartment(compartment),promoter,"compartment");
promoter.setBoundaryCondition(false);
promoter.setConstant(false);
promoter.setHasOnlySubstanceUnits(true);
if (createProduction)
createProductionReaction(promoterId, reactionId, null, null, null, null, null, null, false, null);
if (isExplicit) {
Layout layout = getLayout();
SpeciesGlyph speciesGlyph = null;
if (layout.getSpeciesGlyph(GlobalConstants.GLYPH+"__"+promoterId)!=null) {
speciesGlyph = layout.getSpeciesGlyph(GlobalConstants.GLYPH+"__"+promoterId);
} else {
speciesGlyph = layout.createSpeciesGlyph(GlobalConstants.GLYPH+"__"+promoterId);
speciesGlyph.createBoundingBox();
speciesGlyph.getBoundingBox().createDimensions();
speciesGlyph.getBoundingBox().createPosition();
speciesGlyph.setSpecies(promoterId);
}
speciesGlyph.getBoundingBox().getPosition().setX(x);
speciesGlyph.getBoundingBox().getPosition().setY(y);
speciesGlyph.getBoundingBox().getDimensions().setWidth(GlobalConstants.DEFAULT_SPECIES_WIDTH);
speciesGlyph.getBoundingBox().getDimensions().setHeight(GlobalConstants.DEFAULT_SPECIES_HEIGHT);
TextGlyph textGlyph = layout.createTextGlyph(GlobalConstants.TEXT_GLYPH+"__"+promoterId);
textGlyph.createBoundingBox();
textGlyph.getBoundingBox().createDimensions();
textGlyph.getBoundingBox().createPosition();
textGlyph.setGraphicalObject(GlobalConstants.GLYPH+"__"+promoterId);
textGlyph.setText(SBMLutilities.getArrayId(sbml,promoterId));
textGlyph.setBoundingBox(speciesGlyph.getBoundingBox().clone());
}
return promoterId;
}