Search in sources :

Example 1 with FormalCompound

use of cbit.vcell.dictionary.FormalCompound in project vcell by virtualcell.

the class XmlReader method getDBSpecies.

/**
 * This method reads a DBSpecies from a XML representation.
 * Creation date: (6/3/2003 8:20:54 PM)
 * @return cbit.vcell.dictionary.DBSpecies
 * @param dbSpeciesElement org.jdom.Element
 */
private DBSpecies getDBSpecies(Element dbSpeciesElement) throws XmlParseException {
    // Read the key
    String keystring = dbSpeciesElement.getAttributeValue(XMLTags.KeyValueAttrTag);
    KeyValue key = new KeyValue(keystring);
    DBSpecies dbSpecies = null;
    // read the type
    String type = dbSpeciesElement.getAttributeValue(XMLTags.TypeAttrTag);
    // Read the DBFormalSpecies
    org.jdom.Element formalSpeciesElement = dbSpeciesElement.getChild(XMLTags.DBFormalSpeciesTag, vcNamespace);
    if (type.equalsIgnoreCase(XMLTags.CompoundTypeTag)) {
        // Create a BoundCompound
        dbSpecies = new BoundCompound(key, (FormalCompound) getDBFormalSpecies(formalSpeciesElement));
    } else if (type.equalsIgnoreCase(XMLTags.EnzymeTypeTag)) {
        // Create a BoundEnzyme
        dbSpecies = new BoundEnzyme(key, (FormalEnzyme) getDBFormalSpecies(formalSpeciesElement));
    } else if (type.equalsIgnoreCase(XMLTags.ProteinTypeTag)) {
        // Create a BoundProtein
        dbSpecies = new BoundProtein(key, (FormalProtein) getDBFormalSpecies(formalSpeciesElement));
    } else {
        throw new XmlParseException("DBSpecies type: " + type + ", not supported yet!");
    }
    return dbSpecies;
}
Also used : DBSpecies(cbit.vcell.model.DBSpecies) KeyValue(org.vcell.util.document.KeyValue) BoundProtein(cbit.vcell.dictionary.BoundProtein) BoundEnzyme(cbit.vcell.dictionary.BoundEnzyme) FormalProtein(cbit.vcell.dictionary.FormalProtein) BoundCompound(cbit.vcell.dictionary.BoundCompound) Element(org.jdom.Element) FormalCompound(cbit.vcell.dictionary.FormalCompound)

Example 2 with FormalCompound

use of cbit.vcell.dictionary.FormalCompound in project vcell by virtualcell.

the class DictionaryDbDriver method getCompoundFromKeggID.

/**
 * Returns the compound referenced by the keggID
 * @return Compound
 * @param con Connection
 * @param dbLink DBLink
 */
public FormalCompound getCompoundFromKeggID(Connection con, String keggID) throws SQLException {
    FormalCompound result = null;
    DBFormalSpecies[] dbfsArr = getDatabaseSpecies(con, null, keggID, false, FormalSpeciesType.compound, FormalSpeciesType.COMPOUND_KEGGID, -1, false);
    if (dbfsArr != null && dbfsArr.length == 1) {
        result = (FormalCompound) dbfsArr[0];
    } else {
        throw new RuntimeException("Expecting only 1 result");
    }
    return result;
}
Also used : DBFormalSpecies(cbit.vcell.model.DBFormalSpecies) FormalCompound(cbit.vcell.dictionary.FormalCompound)

Example 3 with FormalCompound

use of cbit.vcell.dictionary.FormalCompound in project vcell by virtualcell.

the class CompoundTable method getCompounds.

/**
 * returns a Compound object from the ResultSet
 * @return cbit.vcell.dictionary.Compound
 * @param rset java.sql.ResultSet
 */
public DBFormalSpecies[] getCompounds(java.sql.ResultSet rset, boolean createBound) throws java.sql.SQLException {
    Vector compounds = new Vector();
    Vector aliasNames = new Vector();
    String currentAliasName = null;
    String currentCASID = null;
    String currentFormula = null;
    String currentKeggID = null;
    String currentPreferred = null;
    org.vcell.util.document.KeyValue currentCompoundID = null;
    org.vcell.util.document.KeyValue currentDBSpeciesID = null;
    while (rset.next() || rset.isAfterLast()) {
        KeyValue compoundID = null;
        if (!rset.isAfterLast()) {
            compoundID = new KeyValue(rset.getBigDecimal(CompoundTable.table.id.toString()));
        }
        if (!rset.isFirst() && (!currentCompoundID.equals(compoundID))) {
            if (currentCompoundID != null) {
                if (aliasNames.size() > 0) {
                    String[] aliasNamesArr = new String[aliasNames.size()];
                    aliasNames.copyInto(aliasNamesArr);
                    CompoundInfo compoundInfo = new CompoundInfo(currentKeggID, aliasNamesArr, currentFormula, currentCASID, null);
                    FormalCompound formalCompound = new FormalCompound(currentCompoundID, compoundInfo);
                    Object compound = formalCompound;
                    if (createBound) {
                        BoundCompound boundCompound = new BoundCompound(currentDBSpeciesID, formalCompound);
                        compound = boundCompound;
                    }
                    compounds.add(compound);
                }
            }
            aliasNames.clear();
            if (rset.isAfterLast()) {
                break;
            }
        }
        if (aliasNames.size() == 0) {
            currentCompoundID = compoundID;
            currentKeggID = rset.getString(CompoundTable.table.keggID.toString());
            currentCASID = rset.getString(CompoundTable.table.casID.toString());
            currentFormula = rset.getString(CompoundTable.table.formula.toString());
            currentFormula = (currentFormula != null ? org.vcell.util.TokenMangler.getSQLRestoredString(currentFormula) : null);
            if (createBound) {
                currentDBSpeciesID = new KeyValue(rset.getBigDecimal("dbspecies_id"));
            }
        }
        currentPreferred = rset.getString(CompoundAliasTable.table.preferred.toString());
        currentAliasName = org.vcell.util.TokenMangler.getSQLRestoredString(rset.getString(CompoundAliasTable.table.name.toString()));
        if (currentPreferred.compareToIgnoreCase("T") == 0) {
            aliasNames.add(0, currentAliasName);
        } else {
            aliasNames.add(currentAliasName);
        }
    }
    DBFormalSpecies[] compoundsArr = null;
    if (compounds.size() > 0) {
        if (createBound) {
            BoundCompound[] boundCompoundsArr = null;
            boundCompoundsArr = new BoundCompound[compounds.size()];
            compounds.copyInto(boundCompoundsArr);
            compoundsArr = boundCompoundsArr;
        } else {
            FormalCompound[] formalCompoundsArr = null;
            formalCompoundsArr = new FormalCompound[compounds.size()];
            compounds.copyInto(formalCompoundsArr);
            compoundsArr = formalCompoundsArr;
        }
    }
    return compoundsArr;
}
Also used : KeyValue(org.vcell.util.document.KeyValue) CompoundInfo(cbit.vcell.dictionary.CompoundInfo) DBFormalSpecies(cbit.vcell.model.DBFormalSpecies) KeyValue(org.vcell.util.document.KeyValue) BoundCompound(cbit.vcell.dictionary.BoundCompound) Vector(java.util.Vector) FormalCompound(cbit.vcell.dictionary.FormalCompound)

Example 4 with FormalCompound

use of cbit.vcell.dictionary.FormalCompound in project vcell by virtualcell.

the class XmlReader method getDBFormalSpecies.

/**
 * This method returns a DBFormalSpecies from a XML representation.
 * Creation date: (6/3/2003 8:46:44 PM)
 * @return cbit.vcell.dictionary.DBFormalSpecies
 * @param formalSpeciesElement org.jdom.Element
 */
private DBFormalSpecies getDBFormalSpecies(Element formalSpeciesElement) throws XmlParseException {
    // read key
    String keystring = formalSpeciesElement.getAttributeValue(XMLTags.KeyValueAttrTag);
    KeyValue key = new KeyValue(keystring);
    // read type
    String typestring = formalSpeciesElement.getAttributeValue(XMLTags.TypeAttrTag);
    // read the FormalSpeciesInfo
    Element speciesInfoElement = formalSpeciesElement.getChild(XMLTags.FormalSpeciesInfoTag, vcNamespace);
    // create the DBFormalSpecies upon the type
    DBFormalSpecies formalSpecies = null;
    if (typestring.equalsIgnoreCase(XMLTags.CompoundTypeTag)) {
        formalSpecies = new FormalCompound(key, (CompoundInfo) getFormalSpeciesInfo(speciesInfoElement));
    } else if (typestring.equalsIgnoreCase(XMLTags.EnzymeTypeTag)) {
        formalSpecies = new FormalEnzyme(key, (EnzymeInfo) getFormalSpeciesInfo(speciesInfoElement));
    } else if (typestring.equalsIgnoreCase(XMLTags.ProteinTypeTag)) {
        formalSpecies = new FormalProtein(key, (ProteinInfo) getFormalSpeciesInfo(speciesInfoElement));
    } else {
        throw new XmlParseException("DBFormalSpecies type:" + typestring + ", not supported yet!");
    }
    return formalSpecies;
}
Also used : FormalEnzyme(cbit.vcell.dictionary.FormalEnzyme) ProteinInfo(cbit.vcell.dictionary.ProteinInfo) KeyValue(org.vcell.util.document.KeyValue) DBFormalSpecies(cbit.vcell.model.DBFormalSpecies) FormalProtein(cbit.vcell.dictionary.FormalProtein) Element(org.jdom.Element) CompoundInfo(cbit.vcell.dictionary.CompoundInfo) FormalCompound(cbit.vcell.dictionary.FormalCompound)

Example 5 with FormalCompound

use of cbit.vcell.dictionary.FormalCompound in project vcell by virtualcell.

the class ModelTest method getExample_Bound.

/**
 * This method was created by a SmartGuide.
 */
public static Model getExample_Bound() throws Exception {
    double FRACTIONAL_VOLUME_ER = 0.15;
    double SURFACE_TO_VOLUME_ER = 6;
    double FRACTIONAL_VOLUME_CYTOSOL = 0.15;
    double SURFACE_TO_VOLUME_CYTOSOL = 0.25;
    org.vcell.util.document.Version version = new org.vcell.util.document.Version("boundModel", new org.vcell.util.document.User("frm", new org.vcell.util.document.KeyValue("227")));
    Model model = new Model(version);
    FormalSpeciesInfo fsi = null;
    DBFormalSpecies dbfs = null;
    DBSpecies dbs = null;
    String[] names1 = new String[1];
    names1[0] = "IP3";
    fsi = new CompoundInfo(names1[0] + "_KeggID", names1, names1[0] + "_Formula", names1[0] + "_casID", null);
    dbfs = new FormalCompound(new org.vcell.util.document.KeyValue("0"), (CompoundInfo) fsi);
    dbs = new BoundCompound(new org.vcell.util.document.KeyValue("1"), (FormalCompound) dbfs);
    model.addSpecies(new Species(names1[0], null, dbs));
    String[] names2 = new String[1];
    names2[0] = "Calcium";
    fsi = new CompoundInfo(names2[0] + "_KeggID", names2, names2[0] + "_Formula", names2[0] + "_casID", null);
    dbfs = new FormalCompound(new org.vcell.util.document.KeyValue("2"), (CompoundInfo) fsi);
    dbs = new BoundCompound(new org.vcell.util.document.KeyValue("3"), (FormalCompound) dbfs);
    model.addSpecies(new Species(names2[0], null, dbs));
    String keywords = "keword1,keyword2";
    String descr = "Decription Text";
    String[] names3 = new String[1];
    names3[0] = "IP3_Receptor";
    fsi = new ProteinInfo(names3[0] + "_SwissProtID", names3, names3[0] + "_Organism", names3[0] + "_Accession", keywords, descr);
    dbfs = new FormalProtein(new org.vcell.util.document.KeyValue("4"), (ProteinInfo) fsi);
    dbs = new BoundProtein(new org.vcell.util.document.KeyValue("5"), (FormalProtein) dbfs);
    model.addSpecies(new Species(names3[0], null, dbs));
    // names[0] = "IP3_Receptor_Activated";
    // fsi = new ProteinInfo(names[0]+"_SwissProtID",names,names[0]+"_Organism",names[0]+"_Accession",keywords,descr);
    // dbfs = new FormalProtein(new cbit.sql.KeyValue("6"),(ProteinInfo)fsi);
    // dbs = new BoundProtein(new cbit.sql.KeyValue("7"),(FormalProtein)dbfs);
    // make 1 unbound
    model.addSpecies(new Species("IP3_Receptor_Activated", null));
    model.addFeature("Extracellular");
    Feature extracellular = (Feature) model.getStructure("Extracellular");
    model.addFeature("Cytosol");
    Feature cytosol = (Feature) model.getStructure("Cytosol");
    Membrane plasmaMembrane = (Membrane) model.getStructure("PlasmaMembrane");
    model.addFeature("ER");
    Feature er = (Feature) model.getStructure("ER");
    Membrane erMembrane = (Membrane) model.getStructure("ER_Membrane");
    Species calcium = model.getSpecies("Calcium");
    Species ip3 = model.getSpecies("IP3");
    Species r = model.getSpecies("IP3_Receptor");
    Species ri = model.getSpecies("IP3_Receptor_Activated");
    model.addSpeciesContext(calcium, er);
    model.addSpeciesContext(calcium, cytosol);
    model.addSpeciesContext(calcium, extracellular);
    model.addSpeciesContext(ip3, cytosol);
    model.addSpeciesContext(ip3, extracellular);
    model.addSpeciesContext(r, erMembrane);
    model.addSpeciesContext(ri, erMembrane);
    SpeciesContext ip3_cytosol = model.getSpeciesContext(ip3, cytosol);
    SpeciesContext ip3_extracellular = model.getSpeciesContext(ip3, extracellular);
    SpeciesContext calcium_cytosol = model.getSpeciesContext(calcium, cytosol);
    SpeciesContext calcium_extracellular = model.getSpeciesContext(calcium, extracellular);
    SpeciesContext calcium_er = model.getSpeciesContext(calcium, er);
    SpeciesContext r_erMembrane = model.getSpeciesContext(r, erMembrane);
    SpeciesContext ri_erMembrane = model.getSpeciesContext(ri, erMembrane);
    SimpleReaction sr;
    SimpleReaction sr1;
    FluxReaction fr;
    // 
    // CYTOSOL REACTIONS
    // 
    // 1.0/12.0;
    double IP3_DEGRADATION = 0.5;
    double IP3_DESIRED_INITIAL = 0.01;
    double IP3_DESIRED_FINAL = 0.03;
    double PLASMA_MEM_SURFACE_TO_VOLUME_ER = 0.25;
    double IP3_FLUX_TIME_CONSTANT = 0.050;
    double IP3_FLUX_FINAL = IP3_DEGRADATION * (IP3_DESIRED_FINAL - IP3_DESIRED_INITIAL) * (1 - FRACTIONAL_VOLUME_ER) / PLASMA_MEM_SURFACE_TO_VOLUME_ER;
    // 
    // IP3_DEGRADATION
    // IP3 ----------------->
    // 
    // 
    // source(IP3) = IP3_DEGRADATION * IP3_DESIRED_INITIAL
    // 
    // model.addReaction("IP3_Volume");
    // reaction = model.getReaction("IP3_Volume");
    sr = new SimpleReaction(model, cytosol, "IP3_DEGRADATION", true);
    sr.addReactant(ip3_cytosol, 1);
    sr.setKinetics(new MassActionKinetics(sr));
    MassActionKinetics massAct = (MassActionKinetics) sr.getKinetics();
    massAct.setParameterValue(massAct.getForwardRateParameter(), new Expression("Kdegr1;"));
    massAct.setParameterValue(massAct.getKineticsParameter("Kdegr1"), new Expression(IP3_DEGRADATION));
    model.addReactionStep(sr);
    sr = new SimpleReaction(model, cytosol, "IP3_BASAL_CREATION", true);
    sr.addProduct(ip3_cytosol, 1);
    massAct = new MassActionKinetics(sr);
    sr.setKinetics(massAct);
    massAct.setParameterValue(massAct.getForwardRateParameter(), new Expression("Kdegr2 * IP3i;"));
    massAct.setParameterValue(massAct.getKineticsParameter("Kdegr2"), new Expression(IP3_DEGRADATION));
    massAct.setParameterValue(massAct.getKineticsParameter("IP3i"), new Expression(IP3_DESIRED_INITIAL));
    model.addReactionStep(sr);
    sr1 = new SimpleReaction(model, cytosol, "IP3_DEGRADATION2", true);
    sr1.addReactant(ip3_cytosol, 1);
    sr1.setKinetics(new HMM_IRRKinetics(sr1));
    HMM_IRRKinetics hmmKinetics = (HMM_IRRKinetics) sr1.getKinetics();
    hmmKinetics.setParameterValue(hmmKinetics.getVmaxParameter(), new Expression("10.0"));
    hmmKinetics.setParameterValue(hmmKinetics.getKmParameter(), new Expression("12.0"));
    model.addReactionStep(sr1);
    // 
    // flux(IP3) = IP3_FLUX_FINAL * (1 - exp(-t/IP3_FLUX_TIME_CONSTANT))
    // 
    // model.addReaction("IP3_generation");
    // reaction = model.getReaction("IP3_generation");
    fr = new FluxReaction(model, plasmaMembrane, null, "IP3_FLUX", true);
    GeneralKinetics genKinetics = new GeneralKinetics(fr);
    fr.setKinetics(genKinetics);
    genKinetics.setParameterValue(genKinetics.getReactionRateParameter(), new Expression("Jfinal * (1 - exp(-t/TAU));"));
    genKinetics.setParameterValue(genKinetics.getKineticsParameter("Jfinal"), new Expression(0.034));
    genKinetics.setParameterValue(genKinetics.getKineticsParameter("TAU"), new Expression(IP3_FLUX_TIME_CONSTANT));
    model.addReactionStep(fr);
    // 
    // ER REACTIONS
    // 
    // 
    // IP3 Receptor
    // 
    double I1 = 3.33333333;
    double ii1 = 100;
    double i1 = ii1 / I1;
    double channel_density = 25;
    // channel_density / (1 + IP3_DESIRED_INITIAL * I1);
    double R = 19.35;
    // channel_density * IP3_DESIRED_INITIAL * I1 * R;
    double RI = 0.65;
    double TOTAL_CHANNEL = R + RI;
    double channel_flux = 143.7;
    double CALCIUM_DIFFUSION = 180.0;
    double IP3_DIFFUSION = 250;
    double CALCIUM_CYTOSOL = 0.050;
    double CALCIUM_ER = 2500.0;
    double CALCIUM_EXTRACELLULAR_INITIAL = 1000;
    double IP3_EXTRACELLULAR_INITIAL = 10;
    // model.addReaction("IP3_Receptor");
    // reaction = model.getReaction("IP3_Receptor");
    sr = new SimpleReaction(model, erMembrane, "IP3_BINDING", true);
    sr.addReactant(r_erMembrane, 2);
    sr.addReactant(ip3_cytosol, 3);
    sr.addProduct(ri_erMembrane, 1);
    massAct = new MassActionKinetics(sr);
    sr.setKinetics(massAct);
    massAct.setParameterValue(massAct.getForwardRateParameter(), new Expression("ii1;"));
    massAct.setParameterValue(massAct.getReverseRateParameter(), new Expression("i1;"));
    massAct.setParameterValue(massAct.getKineticsParameter("ii1"), new Expression(ii1));
    massAct.setParameterValue(massAct.getKineticsParameter("i1"), new Expression("ii1/I1"));
    massAct.setParameterValue(massAct.getKineticsParameter("I1"), new Expression(I1));
    model.addReactionStep(sr);
    fr = new FluxReaction(model, erMembrane, null, "IP3R_FLUX", true);
    fr.addCatalyst(ri_erMembrane);
    // fr.addCatalyst(calcium_cytosol);
    // fr.addCatalyst(calcium_er);
    // fr.setInwardFlux(-channel_flux+" * "+ (4/(channel_density*channel_density))+" * pow(RI,3);");
    genKinetics = (GeneralKinetics) fr.getKinetics();
    genKinetics.setParameterValue(genKinetics.getReactionRateParameter(), new Expression("Jchan * (" + calcium_cytosol.getName() + " - " + calcium_er.getName() + ") * pow(" + ri_erMembrane.getName() + "/Rtotal,3);"));
    genKinetics.setParameterValue(genKinetics.getKineticsParameter("Rtotal"), new Expression(TOTAL_CHANNEL));
    genKinetics.setParameterValue(genKinetics.getKineticsParameter("Jchan"), new Expression(4.6));
    model.addReactionStep(fr);
    // 
    // SERCA pump
    // 
    double K_serca = 0.270;
    double pump_coef = (K_serca * K_serca + CALCIUM_CYTOSOL * CALCIUM_CYTOSOL) * channel_flux * 4 * RI * RI * RI / (channel_density * channel_density * CALCIUM_CYTOSOL * CALCIUM_CYTOSOL);
    // model.addReaction("Serca_Pump");
    // reaction = model.getReaction("Serca_Pump");
    fr = new FluxReaction(model, erMembrane, null, "SERCA_FLUX", true);
    genKinetics = (GeneralKinetics) fr.getKinetics();
    genKinetics.setParameterValue(genKinetics.getReactionRateParameter(), new Expression("Vmax * pow(" + calcium_cytosol.getName() + ",2) / (pow(Kd,2) + pow(" + calcium_er.getName() + ",2));"));
    genKinetics.setParameterValue(genKinetics.getKineticsParameter("Kd"), new Expression(0.7));
    genKinetics.setParameterValue(genKinetics.getKineticsParameter("Vmax"), new Expression(77.77));
    model.addReactionStep(fr);
    SpeciesContext sc = model.getSpeciesContext(r, erMembrane);
    // sc.setInitialValue(R);
    sc = model.getSpeciesContext(ri, erMembrane);
    // sc.setInitialValue(RI);
    sc = model.getSpeciesContext(calcium, er);
    // sc.setInitialValue(CALCIUM_ER);
    sc = model.getSpeciesContext(calcium, cytosol);
    // sc.setInitialValue(CALCIUM_CYTOSOL);
    // sc.setDiffusionRate(CALCIUM_DIFFUSION);
    sc = model.getSpeciesContext(calcium, extracellular);
    // sc.setDiffusionRate(CALCIUM_DIFFUSION);
    // sc.setInitialValue(CALCIUM_EXTRACELLULAR_INITIAL);
    sc = model.getSpeciesContext(ip3, cytosol);
    // sc.setInitialValue(IP3_DESIRED_INITIAL);
    // sc.setDiffusionRate(IP3_DIFFUSION);
    sc = model.getSpeciesContext(ip3, extracellular);
    return model;
}
Also used : FormalProtein(cbit.vcell.dictionary.FormalProtein) CompoundInfo(cbit.vcell.dictionary.CompoundInfo) BoundCompound(cbit.vcell.dictionary.BoundCompound) FormalCompound(cbit.vcell.dictionary.FormalCompound) ProteinInfo(cbit.vcell.dictionary.ProteinInfo) BoundProtein(cbit.vcell.dictionary.BoundProtein) Expression(cbit.vcell.parser.Expression)

Aggregations

FormalCompound (cbit.vcell.dictionary.FormalCompound)8 CompoundInfo (cbit.vcell.dictionary.CompoundInfo)4 DBFormalSpecies (cbit.vcell.model.DBFormalSpecies)4 KeyValue (org.vcell.util.document.KeyValue)4 BoundCompound (cbit.vcell.dictionary.BoundCompound)3 FormalProtein (cbit.vcell.dictionary.FormalProtein)3 BoundProtein (cbit.vcell.dictionary.BoundProtein)2 FormalEnzyme (cbit.vcell.dictionary.FormalEnzyme)2 ProteinInfo (cbit.vcell.dictionary.ProteinInfo)2 Vector (java.util.Vector)2 Element (org.jdom.Element)2 BoundEnzyme (cbit.vcell.dictionary.BoundEnzyme)1 DBNonFormalUnboundSpecies (cbit.vcell.dictionary.DBNonFormalUnboundSpecies)1 EnzymeInfo (cbit.vcell.dictionary.EnzymeInfo)1 DBSpecies (cbit.vcell.model.DBSpecies)1 ReactionDescription (cbit.vcell.model.ReactionDescription)1 Expression (cbit.vcell.parser.Expression)1 Connection (java.sql.Connection)1