getNumReactants() публичный Метод

public getNumReactants ( ) : long
Результат long
Пример #1
0
        /// <summary>
        ///     Saves educts of a SBML reaction into a dictionary, containing their compartment and SpeciesReference.
        /// </summary>
        private Dictionary <string, List <SpeciesReference> > ComputeEducts(Reaction sbmlReaction, Model model)
        {
            var eductCompartmentMoleculeDictionary = new Dictionary <string, List <SpeciesReference> >();

            for (long i = 0; i < sbmlReaction.getNumReactants(); i++)
            {
                var reactant        = sbmlReaction.getReactant(i);
                var reactantSpecies = GetSpeciesById(reactant.getSpecies(), model);
                var compartment     = reactantSpecies.getCompartment();
                if (_sbmlInformation.MoleculeInformation.All(info => info.SpeciesIds.TrueForAll(s => s != reactantSpecies.getId())))
                {
                    continue;
                }

                if (!eductCompartmentMoleculeDictionary.ContainsKey(compartment))
                {
                    eductCompartmentMoleculeDictionary[compartment] = new List <SpeciesReference> {
                        reactant
                    }
                }
                ;
                else
                {
                    eductCompartmentMoleculeDictionary[compartment].Add(reactant);
                }
            }
            return(eductCompartmentMoleculeDictionary);
        }
Пример #2
0
 /// <summary>
 ///     Creates a multicompartment reaction.
 /// </summary>
 private void CreateMulticompartmentReaction(Reaction sbmlReaction, Model model)
 {
     if ((sbmlReaction.getNumReactants() + sbmlReaction.getNumProducts() == 2) && (IsPassiveTransport(sbmlReaction, model)))
     {
         CreatePassiveTransport(sbmlReaction, model);
     }
     else
     {
         CreateGhostReaction(sbmlReaction, model);
     }
 }
Пример #3
0
 /// <summary>
 ///     Creates the Educts of the MoBi reaction.
 /// </summary>
 private void CreateEducts(Reaction sbmlReaction, IReactionBuilder reactionBuilder, Model model)
 {
     for (long i = 0; i < sbmlReaction.getNumReactants(); i++)
     {
         var educt = CreateReactionPartner(sbmlReaction.getReactant(i), model);
         if (educt != null)
         {
             reactionBuilder.AddEduct(educt);
         }
     }
 }
Пример #4
0
        /// <summary>
        ///     Checks if all reaction partners are in the same compartment.
        /// </summary>
        private bool IsMultiCompartmentReaction(Reaction sbmlReaction, Model model)
        {
            var compartment = String.Empty;

            for (long i = 0; i < sbmlReaction.getNumReactants(); i++)
            {
                var x = sbmlReaction.getReactant(i).getSpecies();

                var species = GetSpeciesById(x, model);
                if (compartment == String.Empty)
                {
                    compartment = species.getCompartment();
                }
                else
                {
                    if (compartment != species.getCompartment())
                    {
                        return(true);
                    }
                }
            }

            for (long i = 0; i < sbmlReaction.getNumProducts(); i++)
            {
                var x       = sbmlReaction.getProduct(i).getSpecies();
                var species = GetSpeciesById(x, model);
                if (compartment == String.Empty)
                {
                    compartment = species.getCompartment();
                }
                else
                {
                    if (compartment != species.getCompartment())
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
 public void test_Reaction_createReactant()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = m.createReactant();
       assertTrue( m.getNumReactants() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
 public void test_Reaction_addReactant4()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = null;
       int i = m.addReactant(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( m.getNumReactants() == 0 );
       m = null;
 }
 public void test_Reaction_addReactant3()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = new  SpeciesReference(1,2);
       p.setSpecies( "k");
       int i = m.addReactant(p);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumReactants() == 0 );
       p = null;
       m = null;
 }
 public void test_Reaction_addReactant1()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = new  SpeciesReference(2,2);
       SpeciesReference p1 = new  SpeciesReference(2,2);
       p1.setSpecies( "k");
       p1.setId( "k1");
       int i = m.addReactant(p);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       p.setSpecies( "k");
       p.setId( "k1");
       i = m.addReactant(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumReactants() == 1 );
       i = m.addReactant(p1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumReactants() == 1 );
       p1 = null;
       p = null;
       m = null;
 }