/*! \brief This function build a new EnzymeReaction based on the given EnzymeReactionProprieties \param props The proprities class \return This function return a new EnzymeReaction or null if props is null. */ public static IReaction buildEnzymeReactionFromProps(EnzymeReactionProprieties props) { if (props == null) return null; EnzymeReaction reaction = new EnzymeReaction(); reaction.setName(props.name); reaction.setSubstrate(props.substrate); reaction.setEnzyme(props.enzyme); reaction.setKcat(props.Kcat); reaction.setEffector(props.effector); reaction.setAlpha(props.alpha); reaction.setBeta(props.beta); reaction.setKm(props.Km); reaction.setKi(props.Ki); reaction.setEnergyCost(props.energyCost); Product newProd; foreach (Product p in props.products) { newProd = new Product(p); reaction.addProduct(newProd); } return reaction; }
/*! * \brief This function build a new EnzymeReaction based on the given EnzymeReactionProperties * \param props The proprities class * \return This function return a new EnzymeReaction or null if props is null. */ public static IReaction buildEnzymeReactionFromProps(EnzymeReactionProperties props) { if (props == null) { return(null); } EnzymeReaction reaction = new EnzymeReaction(); reaction.setName(props.name); reaction.setSubstrate(props.substrate); reaction.setEnzyme(props.enzyme); reaction.setKcat(props.Kcat); reaction.setEffector(props.effector); reaction.setAlpha(props.alpha); reaction.setBeta(props.beta); reaction.setKm(props.Km); reaction.setKi(props.Ki); reaction.setEnergyCost(props.energyCost); Product newProd; foreach (Product p in props.products) { newProd = new Product(p); reaction.addProduct(newProd); } return(reaction); }
//! Copy constructor public EnzymeReaction(EnzymeReaction r) : base(r) { _substrate = r._substrate; _enzyme = r._enzyme; _Kcat = r._Kcat; _effector = r._effector; _alpha = r._alpha; _beta = r._beta; _Km = r._Km; _Ki = r._Ki; }
/*! \brief Load all enzymatic reactions from an xml node \param node The xml node \param reactions The list of reactions \return Return true if succed, false otherwise */ public bool loadEnzymeReactions(XmlNode node, LinkedList<IReaction> reactions) { XmlNodeList EReactionsList = node.SelectNodes("enzyme"); bool b = true; foreach (XmlNode EReaction in EReactionsList) { EnzymeReaction er = new EnzymeReaction(); foreach (XmlNode attr in EReaction) { switch (attr.Name) { case "name": b = b && loadEnzymeString(attr.InnerText, er.setName); break; case "substrate": b = b && loadEnzymeString(attr.InnerText, er.setSubstrate); break; case "enzyme": b = b && loadEnzymeString(attr.InnerText, er.setEnzyme); break; case "Kcat": b = b && loadEnzymeFloat(attr.InnerText, er.setKcat); break; case "effector": b = b && loadEnzymeString(attr.InnerText, er.setEffector); break; case "alpha": b = b && loadEnzymeFloat(attr.InnerText, er.setAlpha); break; case "EnergyCost": b = b && loadEnzymeFloat(attr.InnerText, er.setEnergyCost); break; case "beta": b = b && loadEnzymeFloat(attr.InnerText, er.setBeta); break; case "Km": b = b && loadEnzymeFloat(attr.InnerText, er.setKm); break; case "Ki": b = b && loadEnzymeFloat(attr.InnerText, er.setKi); break; case "Products": b = b && loadEnzymeReactionProducts(attr, er); break; } } reactions.AddLast(er); } return b; }
private bool loadEnzymeReactionProducts(XmlNode node, EnzymeReaction er) { foreach (XmlNode attr in node) { if (attr.Name == "name") { if (String.IsNullOrEmpty(attr.InnerText)) Debug.Log("Warning : Empty name field in Enzyme Reaction definition"); Product prod = new Product(); prod.setName(node.InnerText); er.addProduct(prod); } } return true; }
/* ! * \brief Checks that two reactions have the same EnzymeReaction field values. * \param reaction The reaction that will be compared to 'this'. */ protected override bool PartialEquals(IReaction reaction) { EnzymeReaction enzyme = reaction as EnzymeReaction; return((enzyme != null) && base.PartialEquals(reaction) && (_substrate == enzyme._substrate) && (_enzyme == enzyme._enzyme) && (_Kcat == enzyme._Kcat) && (_effector == enzyme._effector) && (_alpha == enzyme._alpha) && (_beta == enzyme._beta) && (_Km == enzyme._Km) && (_Ki == enzyme._Ki)); }