Example #1
0
        public IMoleculeBuilder GetMoleculeBySBMLId(string sbmlSpeciesId)
        {
            var moleculeInformation = MoleculeInformation.FirstOrDefault(info => info.SpeciesIds.Exists(s => s == sbmlSpeciesId));

            if (moleculeInformation == null)
            {
                return(null);
            }
            var molecule = moleculeInformation.GetMoleculeBuilder();

            return(molecule);
        }
Example #2
0
        /// <summary>
        ///     Creates a Molecule.
        /// </summary>
        private void CreateMolecule(Species species, string name, bool existant)
        {
            if (existant)
            {
                name = name + _counter;
                _counter++;
            }

            var mbuilder = _moleculeBuilderFactory.Create(MoleculeBuildingBlock.FormulaCache)
                           .WithName(name)
                           .WithDescription(SBMLConstants.SBML_NOTES + species.getNotesString() + species.getId());

            var molInfo = new MoleculeInformation(species, mbuilder);

            _sbmlInformation.MoleculeInformation.Add(molInfo);

            var container = GetContainerFromCompartment_(species.getCompartment());

            if (container != null)
            {
                molInfo.AddContainer(container);
            }
            MoleculeBuildingBlock.Add(mbuilder);
        }