本文整理汇总了Java中org.sbml.jsbml.Species.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Species.getId方法的具体用法?Java Species.getId怎么用?Java Species.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sbml.jsbml.Species
的用法示例。
在下文中一共展示了Species.getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFunctionalComponent
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
/**
* For each species that exist in an SBML model, this function will create a FunctionalComponent instance for the corresponding
* ComponentDefinition existing in the specified ModuleDefinition.
*
* @param sbmlDoc - The SBML Document that contains the SBML species to be converted to SBOL FunctionalComponent.
* @param moduleDef - The SBOL ModuleDedfinition that the converted FunctionalComponent will be stored in.
* @param compDef - The ComponentDefinition that the FunctionalComponent will reference from.
* @param species - The SBML Species that will be converted to SBOL FunctionalComponent.
* @return The FunctionalComponent that was created.
* @throws SBOLValidationException - SBOL validation exception while creating an SBOL object for SBML2SBOL conversion.
*/
private static FunctionalComponent setFunctionalComponent(SBMLDocument sbmlDoc, Model model,
ModuleDefinition moduleDef, ComponentDefinition compDef, Species species) throws SBOLValidationException
{
AccessType access;
DirectionType direction;
// create FunctionalComponents for these within the module
String funcComp_identity = species.getId();
if (SBMLutilities.isInput(model,species.getId()))
{
access = AccessType.PUBLIC;
direction = DirectionType.IN;
}
else if (SBMLutilities.isOutput(model,species.getId()))
{
access = AccessType.PUBLIC;
direction = DirectionType.OUT;
}
else if (SBMLutilities.isOnPort(model,species.getId()))
{
access = AccessType.PUBLIC;
direction = DirectionType.NONE;
}
else
{
access = AccessType.PRIVATE;
direction = DirectionType.NONE;
}
FunctionalComponent fc = moduleDef.createFunctionalComponent(funcComp_identity, access, compDef.getIdentity(), direction);
fc.setName(species.getId());
return fc;
}
示例2: getTableModelWithSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
/**
* Gets the table model with species.
*
* @param los the los
* @return the table model with species
*/
private MyTableModel getTableModelWithSpecies(ListOf<Species> los){
int max = memberList.size();
Object[][] data = new Object[max][header.length];
for(int i = 0; i < max; i++){
Species s = (Species) memberList.get(i);
data[i][0] = s.getId();
if(s.isSetInitialAmount()){
data[i][1] = "amount";
data[i][2] = s.getInitialAmount();
} else if(s.isSetInitialConcentration()){
data[i][1] = "concentration";
data[i][2] = s.getInitialConcentration();
}
data[i][3] = s.getCompartment();
data[i][4] = s.getSubstanceUnits();
data[i][5] = s.getHasOnlySubstanceUnits();
data[i][6] = s.getBoundaryCondition();
data[i][7] = s.getConstant();
}
MyTableModel tm = new MyTableModel(data, header) {
private static final long serialVersionUID = 1L;
@Override
public Class<?> getColumnClass(int Column) {
switch (Column) {
case 0: // id
case 1: // initial
return String.class;
case 2: // quantity
return Double.class;
case 3: // Compartment
case 4: // substance unit
case 5: // hasOnlySubstanceUnits
case 6: // boundaryCondition
case 7: // constant
return String.class;
default:
return String.class;
}
}};
tm.setColumnIdentifiers(header);
return tm;
}
示例3: convertSpeciesToCD
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
/**
* Convert species to CD.
*
* @param sgList
* the sg list
*/
public void convertSpeciesToCD(List<SpeciesGlyph> sgList) {
HashMap<String, Integer> hashSpeciesCounter = new HashMap<String, Integer>();
for (SpeciesGlyph sg : sgList) {
if (sg.isSetSpecies()) {
Species s = (Species) sg.getSpeciesInstance();
SpeciesAliasWrapper saw = mWrapper.createSpeciesAliasWrapper(sg);
String cid = s.getCompartment();
String sid = s.getId() + "alias";
if (hashSpeciesCounter.isEmpty()
|| !hashSpeciesCounter.containsKey(sid)) {
hashSpeciesCounter.put(sid, 1);
} else {
hashSpeciesCounter.put(sid, hashSpeciesCounter.get(sid) + 1);
}
sid = sid + hashSpeciesCounter.get(sid);
saw.setId(sid);
if (!cid.equals("default")) {
saw.setCompartmentAlias(cid + "alias");
saw.setCompartmentAliasWrapper(cid + "alias");
}
int sboterm = SBMLUtil.intSBOTermForDEFAULT_SPECIES;
if (sg.isSetSBOTerm()) {
sboterm = sg.getSBOTerm();
} else if (s.isSetSBOTerm()) {
sboterm = s.getSBOTerm();
}
mWrapper.createSpeciesObjectFromSBOTerm(sg, sboterm);
String clazz = SBMLUtil.SBOTermToCDSpecies(sboterm);
SpeciesWrapper sw = mWrapper.getSpeciesWrapperById(s.getId());
sw.setClazz(clazz);
if (clazz.equals("PROTEIN")) {
sw.getSpeciesIdentity().setProteinReference(
mWrapper.getProteinBySpeciesId(s.getId()).getId());
} else if (clazz.equals("GENE")) {
sw.getSpeciesIdentity().setGeneReference(
mWrapper.getGeneBySpeciesId(s.getId()).getId());
} else if (clazz.equals("RNA")) {
sw.getSpeciesIdentity().setRnaReference(
mWrapper.getRNABySpeciesId(s.getId()).getId());
} else if (clazz.equals("ANTISENSE_RNA")) {
sw.getSpeciesIdentity().setAntisensernaReference(
mWrapper.getAntisenseRNABySpeciesId(s.getId()).getId());
} else {
sw.getSpeciesIdentity().setName(sw.getId());
}
// CompartmentGlyph cg =
// getCompartmentGlyphByCompartmentId(s.getCompartment());
// if(cg != null)
// sw.setPositionToCompartment(LayoutUtil.getPositionToCompartment(sg,
// cg));
// else
sw.setPositionToCompartment("inside");
} else {
// species glyph with no reference
}
}
}
示例4: createGridDegradationReaction
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
public void createGridDegradationReaction(Species species) {
String speciesID = species.getId();
Boolean speciesDegrades = false;
//Reaction degradation = BioModel.getDegradationReaction(speciesID, compModel);
//fix the sbo term/annotation stuff if it's not correct
//if (degradation != null)
speciesDegrades = true;
//only make grid degradation reactions if the species is degradable
if (speciesDegrades) {
//create array of grid degradation reactions
String decayString = GlobalConstants.KECDECAY_STRING;
double decayRate = sbml.getModel().getParameter("kecd").getValue();
String decayUnitString = "u_1_second_n1";
if (sbml.getModel().getUnitDefinition(decayUnitString) == null) {
UnitDefinition ud = sbml.getModel().createUnitDefinition();
Unit unit = ud.createUnit();
unit.setExponent(-1.0);
unit.setKind(Unit.Kind.valueOf("second".toUpperCase()));
unit.setScale(0);
unit.setMultiplier(1);
ud.setId(decayUnitString);
}
Reaction r = sbml.getModel().createReaction();
r.setId(GlobalConstants.DEGRADATION + "_" + speciesID);
SBMLutilities.setMetaId(r, r.getId());
r.setCompartment(sbml.getModel().getCompartment(0).getId());
SBMLutilities.cloneDimensionAddIndex(sbml.getModel().getCompartment(r.getCompartment()),r,"compartment");
r.setReversible(false);
//r.setFast(false);
r.setSBOTerm(GlobalConstants.SBO_DEGRADATION);
AnnotationUtility.setGridAnnotation(r, gridTable.getNumRows(), gridTable.getNumCols());
KineticLaw kl = r.createKineticLaw();
if (decayRate > 0) {
//this is the mathematical expression for the decay
String decayExpression = decayString + "* get2DArrayElement(" + speciesID + ", i, j)";
SpeciesReference reactant = r.createReactant();
reactant.setSpecies(speciesID);
reactant.setStoichiometry(1);
reactant.setConstant(false);
LocalParameter i = kl.createLocalParameter();
LocalParameter j = kl.createLocalParameter();
AnnotationUtility.setArraySizeAnnotation(i, gridTable.getNumRows());
AnnotationUtility.setArraySizeAnnotation(j, gridTable.getNumCols());
i.setId("i");
j.setId("j");
//parameter: id="kecd" value=(usually 0.005) units="u_1_second_n1" (inverse seconds)
Utility.Parameter(kl, decayString, decayRate, decayUnitString);
//formula: kecd * species
kl.setMath(SBMLutilities.myParseFormula(decayExpression));
Utility.addReaction(sbml, r);
}
}
}
示例5: setupSpecies
import org.sbml.jsbml.Species; //导入方法依赖的package包/类
/**
* puts species-related information into data structures
*
*/
private static void setupSpecies(HierarchicalSimulation sim, ModelContainer container, VectorWrapper wrapper)
{
Model model = container.getModel();
HierarchicalModel modelstate = container.getHierarchicalModel();
SpeciesNode node;
boolean isConcentration = false;
for (Species species : model.getListOfSpecies())
{
ReplacementSetup.setupReplacement(sim, species, wrapper,VariableType.SPECIES, container);
String printVariable = container.getPrefix() + species.getId();
node = (SpeciesNode) modelstate.getNode(species.getId());
if(sim.getPrintConcentrationSpecies().contains(printVariable))
{
isConcentration = true;
}
if(node == null)
{
node = new SpeciesNode(species.getId());
node.createState(sim.getAtomicType(), wrapper);
node.createSpeciesTemplate();
modelstate.addMappingNode(species.getId(), node);
}
if(sim.getInterestingSpecies() != null && sim.getInterestingSpecies().contains(printVariable))
{
sim.addPrintVariable(printVariable, node, modelstate.getIndex(), isConcentration);
}
if(sim.getInterestingSpecies() == null)
{
sim.addPrintVariable(printVariable, node, modelstate.getIndex(), isConcentration);
}
if (modelstate.isDeletedBySId(species.getId()))
{
continue;
}
if(!species.getConstant())
{
modelstate.addVariable(node);
}
boolean isBoundary = species.getBoundaryCondition();
boolean isOnlySubstance = species.getHasOnlySubstanceUnits();
node.setBoundaryCondition(isBoundary);
node.setHasOnlySubstance(isOnlySubstance);
VariableNode compartment = modelstate.getNode(species.getCompartment());
node.setCompartment(compartment);
if (species.isSetInitialAmount())
{
node.setValue(modelstate.getIndex(), species.getInitialAmount());
node.setIsSetInitialValue(true);
}
else if (species.isSetInitialConcentration())
{
HierarchicalNode initConcentration = new HierarchicalNode(Type.TIMES);
initConcentration.addChild(new HierarchicalNode(species.getInitialConcentration()));
initConcentration.addChild(compartment);
FunctionNode functionNode = new FunctionNode(node, initConcentration);
modelstate.addInitConcentration(functionNode);
node.setHasAmountUnits(false);
node.setIsSetInitialValue(true);
}
}
}