Search in sources :

Example 1 with ProteinInfo

use of cbit.vcell.dictionary.ProteinInfo 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 2 with ProteinInfo

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

the class XmlReader method getFormalSpeciesInfo.

/**
 * This method creates a FormalSpeciesInfo from a XML representation.
 * Creation date: (6/3/2003 9:11:26 PM)
 * @return cbit.vcell.dictionary.FormalSpeciesInfo
 * @param speciesInfoElement org.jdom.Element
 */
private FormalSpeciesInfo getFormalSpeciesInfo(Element speciesInfoElement) throws XmlParseException {
    // get formalID
    String formalID = unMangle(speciesInfoElement.getAttributeValue(XMLTags.FormalIDTag));
    // get names
    List<Element> namesList = speciesInfoElement.getChildren(XMLTags.NameTag, vcNamespace);
    String[] namesArray = new String[namesList.size()];
    int nameCounter = 0;
    for (Element nameElement : namesList) {
        namesArray[nameCounter] = unMangle(nameElement.getText());
        nameCounter++;
    }
    String tempstring;
    // get type
    String type = speciesInfoElement.getAttributeValue(XMLTags.TypeAttrTag);
    FormalSpeciesInfo formalSpeciesInfo = null;
    if (type.equalsIgnoreCase(XMLTags.CompoundTypeTag)) {
        // get formula
        String formula = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.FormulaTag);
        if (tempstring != null) {
            formula = unMangle(tempstring);
        }
        // get CASID
        String casid = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.CasIDTag);
        if (tempstring != null) {
            casid = unMangle(tempstring);
        }
        // get Enzymes
        List<Element> enzymelist = speciesInfoElement.getChildren(XMLTags.EnzymeTag, vcNamespace);
        EnzymeRef[] enzymeArray = null;
        if (enzymelist != null && enzymelist.size() > 0) {
            enzymeArray = new EnzymeRef[enzymelist.size()];
            int enzymeCounter = 0;
            for (Element enzymeElement : enzymelist) {
                // get ECNumber
                String ecnumber = unMangle(enzymeElement.getAttributeValue(XMLTags.ECNumberTag));
                // get Enzymetype
                String enztypestr = enzymeElement.getAttributeValue(XMLTags.TypeAttrTag);
                char enzymetype = enztypestr.charAt(0);
                enzymeArray[enzymeCounter] = new EnzymeRef(ecnumber, enzymetype);
                enzymeCounter++;
            }
        }
        // create new CompoundInfo
        formalSpeciesInfo = new CompoundInfo(formalID, namesArray, formula, casid, enzymeArray);
    } else if (type.equalsIgnoreCase(XMLTags.EnzymeTypeTag)) {
        // get reaction
        String reaction = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.ExpressionAttrTag);
        if (tempstring != null) {
            reaction = unMangle(tempstring);
        }
        // get sysname
        String sysname = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.SysNameTag);
        if (tempstring != null) {
            sysname = unMangle(tempstring);
        }
        // get argcasID
        String casid = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.CasIDTag);
        if (tempstring != null) {
            casid = unMangle(tempstring);
        }
        // create new EnzymeInfo
        formalSpeciesInfo = new EnzymeInfo(formalID, namesArray, reaction, sysname, casid);
    } else if (type.equalsIgnoreCase(XMLTags.ProteinTypeTag)) {
        // get organism
        String organism = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.OrganismTag);
        if (tempstring != null) {
            organism = unMangle(tempstring);
        }
        // get accession
        String accession = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.AccessionTag);
        if (tempstring != null) {
            accession = unMangle(tempstring);
        }
        // get keywords
        String keywords = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.KeywordsTag);
        if (tempstring != null) {
            keywords = unMangle(tempstring);
        }
        // get description
        String description = null;
        tempstring = speciesInfoElement.getAttributeValue(XMLTags.DescriptionTag);
        if (tempstring != null) {
            description = unMangle(tempstring);
        }
        // create new ProteinInfo
        formalSpeciesInfo = new ProteinInfo(formalID, namesArray, organism, accession, keywords, description);
    } else {
        throw new XmlParseException("FormalSpeciesInfo type " + type + ", not supported yet!");
    }
    return formalSpeciesInfo;
}
Also used : ProteinInfo(cbit.vcell.dictionary.ProteinInfo) Element(org.jdom.Element) EnzymeRef(cbit.vcell.dictionary.EnzymeRef) EnzymeInfo(cbit.vcell.dictionary.EnzymeInfo) CompoundInfo(cbit.vcell.dictionary.CompoundInfo) FormalSpeciesInfo(cbit.vcell.model.FormalSpeciesInfo)

Example 3 with ProteinInfo

use of cbit.vcell.dictionary.ProteinInfo 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 4 with ProteinInfo

use of cbit.vcell.dictionary.ProteinInfo 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 5 with ProteinInfo

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

the class Xmlproducer method getXML.

/**
 * This method returns a XML representation for a FormalSpeciesInfo.
 * Creation date: (6/3/2003 5:14:09 PM)
 * @return Element
 * @param speciesInfo cbit.vcell.dictionary.FormalSpeciesInfo
 * @exception cbit.vcell.xml.XmlParseException The exception description.
 */
private Element getXML(FormalSpeciesInfo speciesInfo) throws XmlParseException {
    // Create XML object
    Element speciesInfoElement = new Element(XMLTags.FormalSpeciesInfoTag);
    // add formalID
    speciesInfoElement.setAttribute(XMLTags.FormalIDTag, mangle(speciesInfo.getFormalID()));
    // add names
    String[] namesArray = speciesInfo.getNames();
    for (int i = 0; i < namesArray.length; i++) {
        Element nameElement = new Element(XMLTags.NameTag);
        nameElement.addContent(mangle(namesArray[i]));
        speciesInfoElement.addContent(nameElement);
    }
    String temp;
    // add type plus extra parameters
    if (speciesInfo instanceof CompoundInfo) {
        CompoundInfo info = (CompoundInfo) speciesInfo;
        // add formula
        temp = info.getFormula();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.FormulaTag, mangle(temp));
        }
        // add casID
        temp = info.getCasID();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.CasIDTag, mangle(temp));
        }
        // add enzymes
        if (info.getEnzymes() != null) {
            for (int i = 0; i < info.getEnzymes().length; i++) {
                Element enzymeElement = new Element(XMLTags.EnzymeTag);
                EnzymeRef ref = info.getEnzymes()[i];
                // add ECNumber
                enzymeElement.setAttribute(XMLTags.ECNumberTag, mangle(ref.getEcNumber()));
                // add EnzymeType
                enzymeElement.setAttribute(XMLTags.TypeAttrTag, String.valueOf(ref.getEnzymeType()));
                // add the enzymeElement to the speciesInfoElement
                speciesInfoElement.addContent(enzymeElement);
            }
        }
        // add type
        speciesInfoElement.setAttribute(XMLTags.TypeAttrTag, XMLTags.CompoundTypeTag);
    } else if (speciesInfo instanceof EnzymeInfo) {
        EnzymeInfo info = (EnzymeInfo) speciesInfo;
        // add reaction
        temp = info.getReaction();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.ExpressionAttrTag, mangle(temp));
        }
        // add sysname
        temp = info.getSysname();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.SysNameTag, mangle(temp));
        }
        // add argcasID
        temp = info.getCasID();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.CasIDTag, mangle(temp));
        }
        // addtype
        speciesInfoElement.setAttribute(XMLTags.TypeAttrTag, XMLTags.EnzymeTypeTag);
    } else if (speciesInfo instanceof ProteinInfo) {
        ProteinInfo info = (ProteinInfo) speciesInfo;
        // add Organism
        temp = info.getOrganism();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.OrganismTag, mangle(temp));
        }
        // add accession
        temp = info.getAccession();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.AccessionTag, mangle(temp));
        }
        // add KeyWords
        temp = info.getKeyWords();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.KeywordsTag, mangle(temp));
        }
        // add description
        temp = info.getDescription();
        if (temp != null) {
            speciesInfoElement.setAttribute(XMLTags.DescriptionTag, mangle(temp));
        }
        // add type
        speciesInfoElement.setAttribute(XMLTags.TypeAttrTag, XMLTags.ProteinTypeTag);
    } else {
        throw new XmlParseException("FormalSpeciesInfo type " + speciesInfo.getClass().getName() + ", not supported yet!");
    }
    return speciesInfoElement;
}
Also used : ProteinInfo(cbit.vcell.dictionary.ProteinInfo) Element(org.jdom.Element) EnzymeRef(cbit.vcell.dictionary.EnzymeRef) EnzymeInfo(cbit.vcell.dictionary.EnzymeInfo) CompoundInfo(cbit.vcell.dictionary.CompoundInfo)

Aggregations

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