Ejemplo n.º 1
0
        public override void GlobalContext()
        {
            base.GlobalContext();
            _transporterContainerTemplateRepository = IoC.Resolve <ITransporterContainerTemplateRepository>();
            var allTransporters = _transporterContainerTemplateRepository.TransportersFor(_individual.Species.Name, CoreConstants.Organ.Brain);

            var influxBBB = allTransporters.Where(x => x.MembraneLocation == MembraneLocation.BloodBrainBarrier)
                            .FirstOrDefault(x => x.TransportType == TransportType.Influx);

            _transporter = _transporterFactory.CreateFor(_individual).DowncastTo <IndividualTransporter>().WithName("TRANS");
            var transportContainer = _transporter.ExpressionContainer(CoreConstants.Organ.Brain).DowncastTo <TransporterExpressionContainer>();

            transportContainer.UpdatePropertiesFrom(influxBBB);
            _individual.AddMolecule(_transporter);
            _transportProcess = _cloneManager.Clone(_compoundProcessRepository.ProcessByName(CoreConstantsForSpecs.Process.ACTIVE_TRANSPORT_SPECIFIC_MM)
                                                    .DowncastTo <PartialProcess>());
            _transportProcess.Name = "My Transport Process";
            _compound.AddProcess(_transportProcess);

            _simulation = DomainFactoryForSpecs.CreateModelLessSimulationWith(_individual, _compound, _protocol)
                          .DowncastTo <IndividualSimulation>();

            _simulation.CompoundPropertiesList.First()
            .Processes
            .TransportAndExcretionSelection
            .AddPartialProcessSelection(new EnzymaticProcessSelection {
                CompoundName = _compound.Name, ProcessName = _transportProcess.Name, MoleculeName = _transporter.Name
            });

            DomainFactoryForSpecs.AddModelToSimulation(_simulation);
        }
Ejemplo n.º 2
0
 protected override void Context()
 {
     _expressionParameterMapper = A.Fake <IExpressionParameterMapper <TransporterExpressionParameterDTO> >();
     _transporterContainerTemplateRepository = A.Fake <ITransporterContainerTemplateRepository>();
     _transporterDirectionRepository         = A.Fake <ITransportDirectionRepository>();
     sut = new IndividualTransporterToTransporterExpressionDTOMapper(_expressionParameterMapper, _transporterDirectionRepository, _transporterContainerTemplateRepository);
 }
Ejemplo n.º 3
0
 public TransportContainerUpdater(
     ITransporterContainerTemplateRepository transporterContainerTemplateRepository,
     IEventPublisher eventPublisher)
 {
     _transporterContainerTemplateRepository = transporterContainerTemplateRepository;
     _eventPublisher = eventPublisher;
 }
 protected override void Context()
 {
     _view                        = A.Fake <IIndividualTransporterExpressionsView>();
     _parameterTask               = A.Fake <IEditParameterPresenterTask>();
     _moleculeTask                = A.Fake <IMoleculeExpressionTask <Individual> >();
     _transporterMapper           = A.Fake <IIndividualTransporterToTransporterExpressionDTOMapper>();
     _transportRepository         = A.Fake <ITransporterContainerTemplateRepository>();
     _moleculePropertiesPresenter = A.Fake <IIndividualMoleculePropertiesPresenter <Individual> >();
     sut = new IndividualTransporterExpressionsPresenter <Individual>(_view, _parameterTask, _moleculeTask, _transporterMapper, _transportRepository, _moleculePropertiesPresenter);
 }
Ejemplo n.º 5
0
 public IndividualTransporterToTransporterExpressionDTOMapper(
     IExpressionParameterMapper <TransporterExpressionParameterDTO> expressionParameterMapper,
     ITransportDirectionRepository transportDirectionRepository,
     ITransporterContainerTemplateRepository transporterContainerTemplateRepository
     )
 {
     _expressionParameterMapper              = expressionParameterMapper;
     _transportDirectionRepository           = transportDirectionRepository;
     _transporterContainerTemplateRepository = transporterContainerTemplateRepository;
 }
 public UsedMoleculeRepository(
     IPKSimProjectRetriever projectRetriever,
     IOntogenyRepository ontogenyRepository,
     IMoleculeParameterRepository moleculeParameterRepository,
     ITransporterContainerTemplateRepository transporterContainerTemplateRepository)
 {
     _projectRetriever                       = projectRetriever;
     _ontogenyRepository                     = ontogenyRepository;
     _moleculeParameterRepository            = moleculeParameterRepository;
     _transporterContainerTemplateRepository = transporterContainerTemplateRepository;
 }
Ejemplo n.º 7
0
 public IndividualTransporterExpressionsPresenter(IIndividualTransporterExpressionsView view, IEditParameterPresenterTask parameterTask, IMoleculeExpressionTask <TSimulationSubject> moleculeExpressionTask,
                                                  IIndividualTransporterToTransporterExpressionDTOMapper transporterExpressionDTOMapper,
                                                  ITransporterContainerTemplateRepository transporterContainerTemplateRepository, IIndividualMoleculePropertiesPresenter <TSimulationSubject> moleculePropertiesPresenter)
     : base(view, parameterTask)
 {
     _moleculeExpressionTask                 = moleculeExpressionTask;
     _transporterExpressionDTOMapper         = transporterExpressionDTOMapper;
     _moleculePropertiesPresenter            = moleculePropertiesPresenter;
     _transporterContainerTemplateRepository = transporterContainerTemplateRepository;
     AddSubPresenters(_moleculePropertiesPresenter);
     view.AddMoleculePropertiesView(_moleculePropertiesPresenter.View);
 }
        protected override void Context()
        {
            _project          = new PKSimProject();
            _projectRetriever = A.Fake <IPKSimProjectRetriever>();
            _transporterContainerTemplateRepository = A.Fake <ITransporterContainerTemplateRepository>();
            A.CallTo(() => _projectRetriever.Current).Returns(_project);

            _compound1          = A.Fake <Compound>();
            _compound1.IsLoaded = false;
            _compound2          = new Compound {
                IsLoaded = true
            };
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "ProjA", Name = "P1"
            });
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "ProjC", Name = "P2"
            });
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "ProjB", Name = "P3"
            });


            _ontogenyRepository          = A.Fake <IOntogenyRepository>();
            _moleculeParameterRepository = A.Fake <IMoleculeParameterRepository>();

            _expressionProfile          = A.Fake <ExpressionProfile>();
            _expressionProfile.IsLoaded = true;
            A.CallTo(() => _expressionProfile.MoleculeName).Returns("ProjE");

            _project.AddBuildingBlock(_compound1);
            _project.AddBuildingBlock(_compound2);
            _project.AddBuildingBlock(_expressionProfile);
            sut = new UsedMoleculeRepository(_projectRetriever, _ontogenyRepository, _moleculeParameterRepository, _transporterContainerTemplateRepository);

            var molParam1 = new MoleculeParameter {
                MoleculeName = "DbB"
            };
            var molParam2 = new MoleculeParameter {
                MoleculeName = "DbA"
            };

            A.CallTo(() => _moleculeParameterRepository.All()).Returns(new[] { molParam1, molParam2 });
            A.CallTo(() => _transporterContainerTemplateRepository.AllTransporterNames).Returns(new[] { "ATRANS1", "TRANS2" });

            A.CallTo(() => _ontogenyRepository.AllFor(CoreConstants.Species.HUMAN)).Returns(new[] { new DatabaseOntogeny {
                                                                                                        Name = "OntoC"
                                                                                                    } });
        }
Ejemplo n.º 9
0
 protected override void Context()
 {
    _repository = A.Fake<ITransporterContainerTemplateRepository>();
    _eventPublisher = A.Fake<IEventPublisher>();
    sut = new TransportContainerUpdater(_repository, _eventPublisher);
 }
Ejemplo n.º 10
0
        protected override void Context()
        {
            _repository     = A.Fake <ITransporterContainerTemplateRepository>();
            _eventPublisher = A.Fake <IEventPublisher>();
            _transportDirectionRepository = A.Fake <ITransportDirectionRepository>();
            sut = new TransportContainerUpdater(_repository, _eventPublisher);
            _fractionExpressedApical       = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.FRACTION_EXPRESSED_APICAL);
            _fractionExpressedApicalMucosa = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.FRACTION_EXPRESSED_APICAL);
            _fractionExpressedApicalBone   = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.FRACTION_EXPRESSED_APICAL);
            //Indicates that this parameter should not be visible to the user and therefore remains unchanged
            _fractionExpressedApicalBone.Visible = false;
            _individual = A.Fake <ISimulationSubject>();
            _individual.Species.Name = _species;
            _transporter             = new IndividualTransporter {
                TransportType = TransportType.Efflux, Name = "toto"
            };
            var organism         = new Organism();
            var mucosa           = new Container().WithName(CoreConstants.Compartment.MUCOSA).WithParentContainer(organism);
            var liver            = new Container().WithName(CoreConstants.Organ.LIVER).WithParentContainer(organism);
            var liverCell        = new Container().WithName(CoreConstants.Compartment.INTRACELLULAR).WithParentContainer(liver);
            var kidney           = new Container().WithName(CoreConstants.Organ.KIDNEY).WithParentContainer(organism);
            var kidneyCell       = new Container().WithName(CoreConstants.Compartment.INTRACELLULAR).WithParentContainer(kidney);
            var bone             = new Container().WithName(CoreConstants.Organ.BONE).WithParentContainer(organism);
            var boneInterstitial = new Container().WithName(CoreConstants.Compartment.INTERSTITIAL).WithParentContainer(bone);

            _transporterWithTemplate = new TransporterExpressionContainer {
                TransportDirection = TransportDirectionId.InfluxInterstitialToIntracellular
            }
            .WithParentContainer(liverCell);
            _transporterWithoutTemplate = new TransporterExpressionContainer
            {
                TransportDirection = TransportDirectionId.EffluxIntracellularToInterstitial
            }
            .WithParentContainer(kidneyCell);

            _transporterInMucosa = new TransporterExpressionContainer {
                TransportDirection = TransportDirectionId.InfluxInterstitialToIntracellular
            }
            .WithParentContainer(mucosa);

            _transporterInBone = new TransporterExpressionContainer {
                TransportDirection = TransportDirectionId.InfluxInterstitialToIntracellular
            }
            .WithParentContainer(boneInterstitial);

            _transporterInMucosa.Add(_fractionExpressedApicalMucosa);
            _transporterWithoutTemplate.Add(_fractionExpressedApical);
            _transporterInBone.Add(_fractionExpressedApicalBone);

            A.CallTo(() => _individual.AllMoleculeContainersFor <TransporterExpressionContainer>(_transporter))
            .Returns(new[] { _transporterWithTemplate, _transporterWithoutTemplate, _transporterInMucosa, _transporterInBone });

            _transporterContainerTemplate = new TransporterContainerTemplate {
                TransportType = TransportType.Influx
            };
            _allTransporterTemplates.Add(_transporterContainerTemplate);

            A.CallTo(() => _repository.HasTransporterTemplateFor(_species, _transporter.Name)).Returns(true);
            A.CallTo(() => _repository.TransportTypeFor(_species, _transporter.Name)).Returns(TransportType.Influx);
            A.CallTo(() => _repository.TransportersFor(_species, liver.Name, _transporter.Name)).Returns(_allTransporterTemplates);
            A.CallTo(() => _repository.TransportersFor(_species, kidney.Name, _transporter.Name)).Returns(new List <TransporterContainerTemplate>());
        }
Ejemplo n.º 11
0
 public IndividualTransporterFactory(IObjectBaseFactory objectBaseFactory, IParameterFactory parameterFactory,
                                     IObjectPathFactory objectPathFactory, IEntityPathResolver entityPathResolver,
                                     ITransporterContainerTemplateRepository transporterContainerTemplateRepository) : base(objectBaseFactory, parameterFactory, objectPathFactory, entityPathResolver)
 {
     _transporterContainerTemplateRepository = transporterContainerTemplateRepository;
 }