protected override void Context()
        {
            base.Context();
            var transportbuilder = new TransportBuilder().WithName("Trans");

            transportbuilder.AddMoleculeNameToExclude(_oldName);
            var transportbuilder2 = new TransportBuilder().WithName("Trans2");

            transportbuilder2.AddMoleculeName(_oldName);
            _test = new PassiveTransportBuildingBlock().WithName("Test");
            _test.Add(transportbuilder);
            _test.Add(transportbuilder2);
        }
        protected override void Context()
        {
            base.Context();
            _passiveTransportBuildingBlock = new PassiveTransportBuildingBlock();
            var pt1 = new TransportBuilder().WithName("T1");

            new Parameter().WithName("LP").WithMode(ParameterBuildMode.Local).WithParentContainer(pt1);
            new Parameter().WithName("PP").WithMode(ParameterBuildMode.Property).WithParentContainer(pt1);
            new Parameter().WithName("GP").WithMode(ParameterBuildMode.Global).WithParentContainer(pt1);
            _passiveTransportBuildingBlock.Add(pt1);
            var pt2 = new TransportBuilder().WithName("T2");

            new Parameter().WithName("LP").WithMode(ParameterBuildMode.Local).WithParentContainer(pt2);
            new Parameter().WithName("PP").WithMode(ParameterBuildMode.Property).WithParentContainer(pt2);
            new Parameter().WithName("GP").WithMode(ParameterBuildMode.Global).WithParentContainer(pt2);
            _passiveTransportBuildingBlock.Add(pt2);
        }
Пример #3
0
 protected override void Context()
 {
     base.Context();
     _project          = A.Fake <IMoBiProject>();
     _kinetic          = new ExplicitFormula("GallbladderEmptyingRate");
     _transportBuilder = new TransportBuilder().WithName("GallbladderEmptying").WithKinetic(_kinetic);
     _buildingBlock    = new PassiveTransportBuildingBlock();
     _buildingBlock.Add(_transportBuilder);
 }
        protected override void Context()
        {
            _buildConfiguration           = new MoBiBuildConfiguration();
            _moleculeBuidingBlock         = new MoleculeBuildingBlock().WithName("M");
            _buildConfiguration.Molecules = _moleculeBuidingBlock;

            _reactionBuildingBlock = new MoBiReactionBuildingBlock().WithName("R");
            _reactionBuildingBlock.Add(new ReactionBuilder().WithName("R1"));
            _buildConfiguration.Reactions = _reactionBuildingBlock;

            _passiveTransportBuildingBlock = new PassiveTransportBuildingBlock().WithName("PT");
            _passiveTransportBuildingBlock.Add(new TransportBuilder().WithName("PT2"));
            _passiveTransportBuildingBlock.Add(new TransportBuilder().WithName("PT1"));
            _buildConfiguration.PassiveTransports = _passiveTransportBuildingBlock;

            _eventGroupBuildingBlock        = new EventGroupBuildingBlock().WithName("EG");
            _buildConfiguration.EventGroups = _eventGroupBuildingBlock;

            _msvBuildingBlock = new MoleculeStartValuesBuildingBlock().WithName("MSV");
            _buildConfiguration.MoleculeStartValues = _msvBuildingBlock;

            _psvBuildingBlock = new ParameterStartValuesBuildingBlock().WithName("PSV");
            _buildConfiguration.ParameterStartValues = _psvBuildingBlock;

            _spatialStructure = new MoBiSpatialStructure().WithName("SPST");
            _buildConfiguration.SpatialStructure = _spatialStructure;

            _observerBuildingBlock        = new ObserverBuildingBlock().WithName("O");
            _buildConfiguration.Observers = _observerBuildingBlock;

            _objectPathFactory  = new ObjectPathFactory(new AliasCreator());
            _entityPathResolver = new EntityPathResolver(_objectPathFactory);
            sut = new AffectedBuildingBlockRetriever(_entityPathResolver);

            //common setup
            _simulation = new MoBiSimulation {
                BuildConfiguration = _buildConfiguration
            };
        }
Пример #5
0
        private void addTransportProcess(IMoleculeBuilder drug, IProcessMapping compoundProcessMapping, CompoundProperties compoundProperties)
        {
            var compound = compoundProperties.Compound;
            var process  = compound.ProcessByName(compoundProcessMapping.ProcessName);

            if (isRenalClearance(compoundProcessMapping))
            {
                var renalPassiveProcess = _processBuilderMapper.PassiveTransportProcessFrom(process, drug.Name, _passiveTransports.FormulaCache);
                _passiveTransports.Add(renalPassiveProcess);
                _parameterIdUpdater.UpdateBuildingBlockId(renalPassiveProcess.Parameters, compound);
                return;
            }

            var transporter = _individual.MoleculeByName <IndividualTransporter>(compoundProcessMapping.MoleculeName);
            var transporterMoleculeContainer = _processBuilderMapper.ActiveTransportFrom(process, transporter, _moleculeBuildingBlock.FormulaCache);

            _interactionKineticUpdater.UpdateTransport(transporterMoleculeContainer, compoundProcessMapping.MoleculeName, compound.Name, _simulation, _moleculeBuildingBlock.FormulaCache);
            _parameterIdUpdater.UpdateBuildingBlockId(transporterMoleculeContainer.Parameters, compound);
            drug.AddTransporterMoleculeContainer(transporterMoleculeContainer);
        }
Пример #6
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);
        }