use of org.vcell.pathway.sbpax.SBMeasurable in project vcell by virtualcell.
the class PathwayModel method ProcessKineticLaws.
/*
* For each kinetic law verify whether the SBOTerm which defines the type of kinetic law exists
* If it doesn't exist try to guesstimate it based on the type of parameters
* For example, if Km is present we assume it's Michaelis-Menten rate law, otherwise it's mass action
*/
private void ProcessKineticLaws() {
Set<Control> controls = BioPAXUtil.getAllControls(this);
Iterator<Control> iterator = controls.iterator();
while (iterator.hasNext()) {
Control control = iterator.next();
ArrayList<SBEntity> sbEntities = control.getSBSubEntity();
for (SBEntity sbE : sbEntities) {
// the only SBSubEntities allowed in a control are kinetic laws
if (sbE.getID().contains("kineticLaw")) {
// build list of the parameters of this kinetic law in sboParams
// params of this kinetic law
ArrayList<SBOParam> sboParams = new ArrayList<SBOParam>();
ArrayList<SBEntity> subEntities = sbE.getSBSubEntity();
for (SBEntity subEntity : subEntities) {
if (subEntity instanceof SBMeasurable) {
SBMeasurable m = (SBMeasurable) subEntity;
if (!m.hasTerm()) {
// we don't know what to do with a measurable with no SBTerm
break;
}
String termName = m.extractSBOTermAsString();
SBOTerm sboT = SBOListEx.sboMap.get(termName);
System.out.println(" " + sboT.getIndex() + " " + sboT.getName());
SBOParam sboParam = SBPAXKineticsExtractor.matchSBOParam(sboT);
if (m.hasNumber()) {
double number = m.getNumber().get(0);
sboParam.setNumber(number);
}
if (m.hasUnit()) {
String unit = m.extractSBOUnitAsString();
sboParam.setUnit(unit);
}
sboParams.add(sboParam);
}
}
ArrayList<SBVocabulary> sbTerms = sbE.getSBTerm();
if (sbTerms.isEmpty()) {
// we try to guesstimate kinetic law type based on params found above
SBVocabularyEx sbTerm = new SBVocabularyEx();
ArrayList<String> termNames = new ArrayList<String>();
String id;
SBOParam kMichaelis = SBPAXKineticsExtractor.extractMichaelisForwardParam(sboParams);
if (kMichaelis == null) {
// mass action rate law
id = new String("SBO:0000012");
System.out.println(" --- matched kinetic law to Mass Action");
} else {
// irreversible Henri-Michaelis-Menten rate law
id = new String("SBO:0000029");
System.out.println(" --- matched kinetic law to Henri-Michaelis-Menten");
}
sbTerm.setInferred(true);
sbTerm.setID(id);
sbTerms.add(sbTerm);
}
}
}
}
}
use of org.vcell.pathway.sbpax.SBMeasurable in project vcell by virtualcell.
the class PathwayReaderBiopax3 method addObjectSBEntity.
// ---------------- addObject section ---------------------
//
private SBEntity addObjectSBEntity(Element element) {
if (element.getChildren().size() == 0) {
SBEntityProxy proxy = new SBEntityProxy();
addAttributes(proxy, element);
pathwayModel.add(proxy);
return proxy;
}
for (Object child : element.getChildren()) {
if (child instanceof Element) {
Element childElement = (Element) child;
if (childElement.getName().equals("SBMeasurable")) {
SBMeasurable thingie = addObjectSBMeasurable(childElement);
pathwayModel.add(thingie);
return thingie;
} else if (childElement.getName().equals("SBState")) {
SBState thingie = addObjectSBState(childElement);
pathwayModel.add(thingie);
return thingie;
}
}
}
SBEntity sbSubEntity = new SBEntityImpl();
if (element.getAttributes().size() > 0) {
addAttributes(sbSubEntity, element);
}
for (Object child : element.getChildren()) {
if (child instanceof Element) {
Element childElement = (Element) child;
if (!addContentSBEntity(sbSubEntity, element, childElement)) {
showUnexpected(childElement);
}
}
}
pathwayModel.add(sbSubEntity);
return sbSubEntity;
}
Aggregations