Search in sources :

Example 6 with SBMeasurable

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);
                }
            }
        }
    }
}
Also used : SBVocabulary(org.vcell.pathway.sbpax.SBVocabulary) ArrayList(java.util.ArrayList) SBOTerm(org.vcell.pathway.sbo.SBOTerm) SBEntity(org.vcell.pathway.sbpax.SBEntity) SBOParam(org.vcell.pathway.sbo.SBOParam) SBMeasurable(org.vcell.pathway.sbpax.SBMeasurable)

Example 7 with SBMeasurable

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;
}
Also used : SBEntityImpl(org.vcell.pathway.sbpax.SBEntityImpl) Element(org.jdom.Element) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) SBEntity(org.vcell.pathway.sbpax.SBEntity) SBEntityProxy(org.vcell.pathway.persistence.BiopaxProxy.SBEntityProxy) SBState(org.vcell.pathway.sbpax.SBState) SBMeasurable(org.vcell.pathway.sbpax.SBMeasurable)

Aggregations

SBMeasurable (org.vcell.pathway.sbpax.SBMeasurable)7 SBEntity (org.vcell.pathway.sbpax.SBEntity)5 SBVocabulary (org.vcell.pathway.sbpax.SBVocabulary)4 ArrayList (java.util.ArrayList)3 Element (org.jdom.Element)3 BioPaxObject (org.vcell.pathway.BioPaxObject)3 Control (org.vcell.pathway.Control)3 GroupObject (org.vcell.pathway.GroupObject)3 SBOTerm (org.vcell.pathway.sbo.SBOTerm)3 HashSet (java.util.HashSet)2 SBOParam (org.vcell.pathway.sbo.SBOParam)2 BioModelEntityObject (cbit.vcell.model.BioModelEntityObject)1 HMM_IRRKinetics (cbit.vcell.model.HMM_IRRKinetics)1 HMM_REVKinetics (cbit.vcell.model.HMM_REVKinetics)1 Kinetics (cbit.vcell.model.Kinetics)1 MassActionKinetics (cbit.vcell.model.MassActionKinetics)1 SimpleReaction (cbit.vcell.model.SimpleReaction)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 CellularLocationVocabulary (org.vcell.pathway.CellularLocationVocabulary)1