getId() public method

public getId ( ) : string
return string
Ejemplo n.º 1
0
        /// <summary>
        ///     Creates a "standard" MoBi reaction by a given one compartment reaction.
        /// </summary>
        private void CreateStandardReaction(Reaction sbmlReaction, Model model)
        {
            var reactionBuilder = ObjectBaseFactory.Create <IReactionBuilder>()
                                  .WithName(sbmlReaction.getId())
                                  .WithDescription(sbmlReaction.getNotesString());

            CreateModifiers(sbmlReaction, reactionBuilder, String.Empty, model);
            var parameters = CreateLocalParameters(sbmlReaction);

            if (parameters != null)
            {
                parameters.ForEach(reactionBuilder.AddParameter);
            }

            if (sbmlReaction.isSetKineticLaw())
            {
                CreateKineticLaw(sbmlReaction.getKineticLaw(), reactionBuilder, false);
            }
            CreateProducts(sbmlReaction, reactionBuilder, model);
            CreateEducts(sbmlReaction, reactionBuilder, model);

            if (reactionBuilder != null)
            {
                ReactionBuilderList.Add(reactionBuilder);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Creates the Kinetic Formula for a passive Transport.
        /// </summary>
        private void CreateKinetic(Reaction sbmlReaction, ITransportBuilder passiveTransport)
        {
            _astHandler.NeedAbsolutePath = true;
            var formula = sbmlReaction.getKineticLaw() == null
             ? ObjectBaseFactory.Create <ExplicitFormula>().WithFormulaString(String.Empty)
             : _astHandler.Parse(sbmlReaction.getKineticLaw().getMath(), sbmlReaction.getId(), _sbmlProject, _sbmlInformation);

            if (formula == null)
            {
                passiveTransport.Formula = ObjectBaseFactory.Create <ExplicitFormula>()
                                           .WithFormulaString(String.Empty)
                                           .WithName(SBMLConstants.DEFAULT_FORMULA_NAME);
            }
            else
            {
                passiveTransport.Formula = formula;
                _passiveTransportBuildingBlock.FormulaCache.Add(formula);
            }
        }
Ejemplo n.º 3
0
 public void test_L3_Reaction_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(3,1);
       sbmlns.addNamespaces(xmlns);
       Reaction r = new  Reaction(sbmlns);
       assertTrue( r.getTypeCode() == libsbml.SBML_REACTION );
       assertTrue( r.getMetaId() == "" );
       assertTrue( r.getNotes() == null );
       assertTrue( r.getAnnotation() == null );
       assertTrue( r.getLevel() == 3 );
       assertTrue( r.getVersion() == 1 );
       assertTrue( r.getNamespaces() != null );
       assertTrue( r.getNamespaces().getLength() == 2 );
       assertTrue( r.getId() == "" );
       assertTrue( r.getName() == "" );
       assertTrue( r.getCompartment() == "" );
       assertTrue( r.getFast() == false );
       assertTrue( r.getReversible() == true );
       assertEquals( false, r.isSetId() );
       assertEquals( false, r.isSetName() );
       assertEquals( false, r.isSetCompartment() );
       assertEquals( false, r.isSetFast() );
       assertEquals( false, r.isSetReversible() );
       r = null;
 }
Ejemplo n.º 4
0
        /// <summary>
        ///     Imports a SBML Reaction by creating a passive Transport.
        /// </summary>
        private void CreatePassiveTransport(Reaction sbmlReaction, Model model)
        {
            var reactant        = sbmlReaction.getReactant(0).getSpecies();
            var product         = sbmlReaction.getProduct(0).getSpecies();
            var reactantSpecies = GetSpeciesById(reactant, model);
            var productSpecies  = GetSpeciesById(product, model);

            if (_sbmlInformation.MoleculeInformation.All(info => info.SpeciesIds.TrueForAll(s => s != reactant)))
            {
                return;
            }
            if (_sbmlInformation.MoleculeInformation.All(info => info.SpeciesIds.TrueForAll(s => s != product)))
            {
                return;
            }
            var molInfoReactant = _sbmlInformation.MoleculeInformation.FirstOrDefault(info => info.SpeciesIds.Contains(reactant));
            var molInfoProduct  = _sbmlInformation.MoleculeInformation.FirstOrDefault(info => info.SpeciesIds.Contains(product));

            if (molInfoProduct == null)
            {
                return;
            }
            if (molInfoReactant == null)
            {
                return;
            }

            //must be the same Molecule
            if (molInfoReactant.GetMoleculeBuilder() != molInfoProduct.GetMoleculeBuilder())
            {
                CreateErrorMessage();
            }

            var passiveTransport = ObjectBaseFactory.Create <ITransportBuilder>().WithName(sbmlReaction.getId());

            passiveTransport.ForAll = false;
            if (molInfoReactant.GetMoleculeBuilderName() == null)
            {
                return;
            }
            passiveTransport.MoleculeList.AddMoleculeName(molInfoReactant.GetMoleculeBuilderName());

            var reactantCompartment = GetContainerFromCompartment_(molInfoReactant.GetCompartment(reactantSpecies));
            var productCompartment  = GetContainerFromCompartment_(molInfoProduct.GetCompartment(productSpecies));

            if (reactantCompartment != null && productCompartment != null)
            {
                var reactantMatchTag = new MatchTagCondition(reactantCompartment.Name);
                var productMatchTag  = new MatchTagCondition(productCompartment.Name);
                passiveTransport.SourceCriteria.Add(reactantMatchTag);
                passiveTransport.TargetCriteria.Add(productMatchTag);
            }

            var parameters = CreateLocalParameters(sbmlReaction);

            if (parameters != null)
            {
                parameters.ForEach(passiveTransport.AddParameter);
            }
            CreateKinetic(sbmlReaction, passiveTransport);
            AddNeighbourhood(reactantCompartment, productCompartment, model);

            _passiveTransportBuildingBlock.Add(passiveTransport);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Creates for each compartment of the SBML Reaction one "Ghostreaction" to import multicompartment reactions.
        /// </summary>
        private void CreateGhostReactions(Reaction sbmlReaction, Dictionary <string, List <SpeciesReference> > eductCompartmentMoleculeDictionary, Dictionary <string, List <SpeciesReference> > productCompartmentMoleculeDictionary, Model model)
        {
            var usedProducts = new List <string>();

            foreach (var keyValuePair in eductCompartmentMoleculeDictionary)
            {
                var reactionBuilder = ObjectBaseFactory.Create <IReactionBuilder>()
                                      .WithName(sbmlReaction.getId() + "_" + keyValuePair.Key + "_ghostReaction")
                                      .WithDescription(sbmlReaction.getNotesString());

                CreateModifiers(sbmlReaction, reactionBuilder, keyValuePair.Key, model);
                var parameters = CreateLocalParameters(sbmlReaction);
                if (parameters != null)
                {
                    parameters.ForEach(reactionBuilder.AddParameter);
                }
                CreateKineticLaw(sbmlReaction.getKineticLaw(), reactionBuilder, true);

                var compartmentName = keyValuePair.Key;
                if (!_sbmlInformation.DummyNameContainerDictionary.ContainsValue(compartmentName))
                {
                    return;
                }
                var dummyMolecule = _sbmlInformation.DummyNameContainerDictionary.FirstOrDefault(x => x.Value == compartmentName).Key;

                reactionBuilder.AddModifier(dummyMolecule);

                foreach (var species in keyValuePair.Value)
                {
                    var reactionPartner = CreateReactionPartner(species, model);
                    if (reactionPartner != null)
                    {
                        reactionBuilder.AddEduct(reactionPartner);
                    }
                }

                if (productCompartmentMoleculeDictionary.ContainsKey(keyValuePair.Key))
                {
                    usedProducts.Add(keyValuePair.Key);
                    var productsInThisCompartment = productCompartmentMoleculeDictionary[keyValuePair.Key];
                    foreach (var product in productsInThisCompartment)
                    {
                        var reactionPartner = CreateReactionPartner(product, model);
                        if (reactionPartner != null)
                        {
                            reactionBuilder.AddProduct(reactionPartner);
                        }
                    }
                }
                ReactionBuilderList.Add(reactionBuilder);
            }


            foreach (var keyValuePair in productCompartmentMoleculeDictionary)
            {
                if (usedProducts.Contains(keyValuePair.Key))
                {
                    continue;
                }

                var reactionBuilder = ObjectBaseFactory.Create <IReactionBuilder>()
                                      .WithName(sbmlReaction.getId() + "_" + keyValuePair.Key + "_ghostReaction")
                                      .WithDescription(sbmlReaction.getNotesString());

                CreateModifiers(sbmlReaction, reactionBuilder, keyValuePair.Key, model);
                var parameters = CreateLocalParameters(sbmlReaction);
                if (parameters != null)
                {
                    parameters.ForEach(reactionBuilder.AddParameter);
                }
                CreateKineticLaw(sbmlReaction.getKineticLaw(), reactionBuilder, true);

                var compartmentName = keyValuePair.Key;
                if (!_sbmlInformation.DummyNameContainerDictionary.ContainsValue(compartmentName))
                {
                    return;
                }
                var dummyMolecule = _sbmlInformation.DummyNameContainerDictionary.FirstOrDefault(x => x.Value == compartmentName).Key;

                reactionBuilder.AddModifier(dummyMolecule);

                foreach (var species in keyValuePair.Value)
                {
                    var reactionPartner = CreateReactionPartner(species, model);
                    if (reactionPartner != null)
                    {
                        reactionBuilder.AddProduct(reactionPartner);
                    }
                }
                ReactionBuilderList.Add(reactionBuilder);
            }
        }
Ejemplo n.º 6
0
 public void test_Model_getReaction()
 {
     Reaction r1 = new  Reaction(2,4);
       Reaction r2 = new  Reaction(2,4);
       r1.setId( "reaction_1");
       r2.setId( "reaction_2");
       M.addReaction(r1);
       M.addReaction(r2);
       assertTrue( M.getNumReactions() == 2 );
       r1 = M.getReaction(0);
       r2 = M.getReaction(1);
       assertTrue((  "reaction_1" == r1.getId() ));
       assertTrue((  "reaction_2" == r2.getId() ));
 }
Ejemplo n.º 7
0
 public void test_Reaction_copyConstructor()
 {
     Reaction o1 = new Reaction(2,4);
       o1.setId("c");
       assertTrue( o1.getId() ==  "c" );
       KineticLaw kl = new KineticLaw(2,4);
       kl.setMath(libsbml.parseFormula("1"));
       o1.setKineticLaw(kl);
       kl = null;
       assertTrue( o1.isSetKineticLaw() == true );
       assertNotEquals(o1.getKineticLaw(),null);
       Reaction o2 = new Reaction(o1);
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.isSetKineticLaw() == true );
       assertNotEquals(o2.getKineticLaw(),null);
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 public void test_Reaction_clone()
 {
     Reaction o1 = new Reaction(2,4);
       o1.setId("c");
       assertTrue( o1.getId() ==  "c" );
       KineticLaw kl = new KineticLaw(2,4);
       o1.setKineticLaw(kl);
       kl = null;
       assertTrue( o1.isSetKineticLaw() == true );
       assertNotEquals(o1.getKineticLaw(),null);
       Reaction o2 = o1.clone();
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.isSetKineticLaw() == true );
       assertNotEquals(o2.getKineticLaw(),null);
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }