Search in sources :

Example 1 with BoundProtein

use of cbit.vcell.dictionary.BoundProtein 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 BoundProtein

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

the class ProteinTable method getProteins.

/**
 * returns a protein object from the ResultSet
 * @return cbit.vcell.dictionary.protein
 * @param rset java.sql.ResultSet
 */
public DBFormalSpecies[] getProteins(java.sql.ResultSet rset, boolean createBound) throws java.sql.SQLException {
    Vector proteins = new Vector();
    Vector aliasNames = new Vector();
    String currentAliasName = null;
    String currentKeywords = null;
    String currentSwissProtId = null;
    String currentAccession = null;
    String currentOrganism = null;
    String currentPreferred = null;
    String currentDescription = null;
    double currentMolWeight = ProteinInfo.UNKNOWN_MW;
    org.vcell.util.document.KeyValue currentProteinID = null;
    org.vcell.util.document.KeyValue currentDBSpeciesID = null;
    while (rset.next() || rset.isAfterLast()) {
        KeyValue proteinID = null;
        if (!rset.isAfterLast()) {
            proteinID = new KeyValue(rset.getBigDecimal(ProteinTable.table.id.toString()));
        }
        if (!rset.isFirst() && (!currentProteinID.equals(proteinID))) {
            if (currentProteinID != null) {
                if (aliasNames.size() > 0) {
                    String[] aliasNamesArr = new String[aliasNames.size()];
                    aliasNames.copyInto(aliasNamesArr);
                    String[] keywordsArr = null;
                    ProteinInfo proteinInfo = new ProteinInfo(currentSwissProtId, aliasNamesArr, currentOrganism, currentAccession, currentKeywords, currentDescription, currentMolWeight);
                    FormalProtein formalProtein = new FormalProtein(currentProteinID, proteinInfo);
                    Object protein = formalProtein;
                    if (createBound) {
                        BoundProtein boundProtein = new BoundProtein(currentDBSpeciesID, formalProtein);
                        protein = boundProtein;
                    }
                    proteins.add(protein);
                }
            }
            aliasNames.clear();
            if (rset.isAfterLast()) {
                break;
            }
        }
        if (aliasNames.size() == 0) {
            currentProteinID = proteinID;
            currentSwissProtId = rset.getString(ProteinTable.table.swissProtEntryName.toString());
            currentAccession = rset.getString(ProteinTable.table.accessionNumber.toString());
            currentOrganism = rset.getString(ProteinTable.table.organism.toString());
            currentOrganism = (currentOrganism != null ? org.vcell.util.TokenMangler.getSQLRestoredString(currentOrganism) : null);
            currentKeywords = rset.getString(ProteinTable.table.keywords.toString());
            currentKeywords = (currentKeywords != null ? org.vcell.util.TokenMangler.getSQLRestoredString(currentKeywords) : null);
            currentDescription = rset.getString(ProteinTable.table.description.toString());
            currentDescription = (currentDescription != null ? org.vcell.util.TokenMangler.getSQLRestoredString(currentDescription) : null);
            currentMolWeight = rset.getDouble(ProteinTable.table.molWeight.toString());
            if (rset.wasNull()) {
                currentMolWeight = ProteinInfo.UNKNOWN_MW;
            }
            if (createBound) {
                currentDBSpeciesID = new KeyValue(rset.getBigDecimal("dbspecies_id"));
            }
        }
        currentAliasName = org.vcell.util.TokenMangler.getSQLRestoredString(rset.getString(ProteinAliasTable.table.name.toString()));
        if (!aliasNames.contains(currentAliasName)) {
            currentPreferred = rset.getString(ProteinAliasTable.table.preferred.toString());
            if (currentPreferred.compareToIgnoreCase("true") == 0) {
                aliasNames.add(0, currentAliasName);
            } else {
                aliasNames.add(currentAliasName);
            }
        }
    }
    DBFormalSpecies[] proteinsArr = null;
    if (proteins.size() > 0) {
        if (createBound) {
            BoundProtein[] boundProteinsArr = null;
            boundProteinsArr = new BoundProtein[proteins.size()];
            proteins.copyInto(boundProteinsArr);
            proteinsArr = boundProteinsArr;
        } else {
            FormalProtein[] formalProteinsArr = null;
            formalProteinsArr = new FormalProtein[proteins.size()];
            proteins.copyInto(formalProteinsArr);
            proteinsArr = formalProteinsArr;
        }
    }
    return proteinsArr;
}
Also used : ProteinInfo(cbit.vcell.dictionary.ProteinInfo) KeyValue(org.vcell.util.document.KeyValue) FormalProtein(cbit.vcell.dictionary.FormalProtein) DBFormalSpecies(cbit.vcell.model.DBFormalSpecies) KeyValue(org.vcell.util.document.KeyValue) BoundProtein(cbit.vcell.dictionary.BoundProtein) Vector(java.util.Vector)

Example 3 with BoundProtein

use of cbit.vcell.dictionary.BoundProtein 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)

Example 4 with BoundProtein

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

the class Xmlproducer method getXML.

/**
 * This method returns the XML representation of a DBSpecies.
 * Creation date: (6/3/2003 4:36:40 PM)
 * @return Element
 * @param dbSpecies cbit.vcell.dictionary.DBSpecies
 */
private Element getXML(DBSpecies dbSpecies) throws XmlParseException {
    // create xml node
    Element dbSpeciesElement = new Element(XMLTags.DBSpeciesTag);
    if (this.printKeysFlag) {
        // add the DBSpecieKey (IT ALWAYS NEED THE KEY!)
        dbSpeciesElement.setAttribute(XMLTags.KeyValueAttrTag, dbSpecies.getDBSpeciesKey().toString());
    }
    // detect the type of DBSpecie
    if (dbSpecies instanceof BoundCompound) {
        // add type
        dbSpeciesElement.setAttribute(XMLTags.TypeAttrTag, XMLTags.CompoundTypeTag);
        // add FormalCompound
        dbSpeciesElement.addContent(getXML(((BoundCompound) dbSpecies).getFormalCompound()));
    } else if (dbSpecies instanceof BoundEnzyme) {
        // add type
        dbSpeciesElement.setAttribute(XMLTags.TypeAttrTag, XMLTags.EnzymeTypeTag);
        // add FormalEnzyme
        dbSpeciesElement.addContent(getXML(((BoundEnzyme) dbSpecies).getFormalEnzyme()));
    } else if (dbSpecies instanceof BoundProtein) {
        // add type
        dbSpeciesElement.setAttribute(XMLTags.TypeAttrTag, XMLTags.ProteinTypeTag);
        // add FormalProtein
        dbSpeciesElement.addContent(getXML(((BoundProtein) dbSpecies).getProteinEnzyme()));
    } else {
        throw new XmlParseException("DBSpecies type " + dbSpecies.getClass().getName() + " not supported yet!");
    }
    return dbSpeciesElement;
}
Also used : BoundProtein(cbit.vcell.dictionary.BoundProtein) BoundEnzyme(cbit.vcell.dictionary.BoundEnzyme) BoundCompound(cbit.vcell.dictionary.BoundCompound) Element(org.jdom.Element)

Aggregations

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