public MoleculeExpressionTask(IExecutionContext executionContext,
                               IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
                               ISimulationSubjectExpressionTask <TSimulationSubject> simulationSubjectExpressionTask,
                               IExpressionProfileUpdater expressionProfileUpdater)
 {
     _executionContext = executionContext;
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _simulationSubjectExpressionTask   = simulationSubjectExpressionTask;
     _expressionProfileUpdater          = expressionProfileUpdater;
 }
        protected override void Context()
        {
            _individual                    = new Individual();
            _individual.OriginData         = new OriginData();
            _individual.OriginData.Species = new Species().WithName("Human");
            _ontogeny = new DatabaseOntogeny {
                Name = "toto"
            };
            _molecule = new IndividualEnzyme {
                Name = "CYP3A4"
            };
            _executionContext                  = A.Fake <IExecutionContext>();
            _proteinExpressionPresenter        = A.Fake <IProteinExpressionsPresenter>();
            _simpleMoleculePresenter           = A.Fake <ISimpleMoleculePresenter>();
            _querySettingsMapper               = A.Fake <IMoleculeToQueryExpressionSettingsMapper>();
            _applicationController             = A.Fake <IApplicationController>();
            _individualMoleculeFactoryResolver = A.Fake <IIndividualMoleculeFactoryResolver>();
            _transportContainerUpdater         = A.Fake <ITransportContainerUpdater>();
            _containerTask = A.Fake <IContainerTask>();
            _moleculeParameterRepository    = A.Fake <IMoleculeParameterRepository>();
            _proteinExpressionDbPathManager = A.Fake <IProteinExpressionsDatabasePathManager>();
            A.CallTo(() => _applicationController.Start <IProteinExpressionsPresenter>()).Returns(_proteinExpressionPresenter);
            A.CallTo(() => _applicationController.Start <ISimpleMoleculePresenter>()).Returns(_simpleMoleculePresenter);
            _ontogenyRepository = A.Fake <IOntogenyRepository>();
            var proteinFactory = A.Fake <IIndividualMoleculeFactory>();

            _moleculeContainer1 = new MoleculeExpressionContainer().WithName("C1");
            _moleculeContainer1.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameter.RelExp));
            _moleculeContainer1.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameter.RelExpNorm));
            _moleculeContainer2 = new MoleculeExpressionContainer().WithName("C2");
            _moleculeContainer2.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameter.RelExp));
            _moleculeContainer2.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameter.RelExpNorm));
            A.CallTo(() => _individualMoleculeFactoryResolver.FactoryFor <IndividualProtein>()).Returns(proteinFactory);
            A.CallTo(() => proteinFactory.CreateFor(_individual)).Returns(_molecule);
            _molecule.Add(_moleculeContainer1);
            _molecule.Add(_moleculeContainer2);
            _molecule.Add(DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(CoreConstants.Parameter.REFERENCE_CONCENTRATION));
            _molecule.Add(DomainHelperForSpecs.ConstantParameterWithValue(20).WithName(CoreConstants.Parameter.HALF_LIFE_LIVER));
            _molecule.Add(DomainHelperForSpecs.ConstantParameterWithValue(30).WithName(CoreConstants.Parameter.HALF_LIFE_INTESTINE));

            A.CallTo(() => _ontogenyRepository.AllFor(_individual.Species.Name)).Returns(new[] { _ontogeny, new DatabaseOntogeny {
                                                                                                     Name = "tralala"
                                                                                                 }, });
            A.CallTo(() => _executionContext.Resolve <IOntogenyRepository>()).Returns(_ontogenyRepository);

            _subjectExpressionTask = new IndividualExpressionTask(_executionContext);

            _ontogenyTask = A.Fake <IOntogenyTask <Individual> >();
            sut           = new MoleculeExpressionTask <Individual>(_applicationController, _executionContext,
                                                                    _individualMoleculeFactoryResolver, _querySettingsMapper,
                                                                    _containerTask, _proteinExpressionDbPathManager,
                                                                    _ontogenyRepository, _transportContainerUpdater, _moleculeParameterRepository, _subjectExpressionTask, _ontogenyTask);
        }
        protected override void Context()
        {
            _individual = new Individual {
                OriginData = new OriginData {
                    Species = new Species().WithName("Human")
                }
            };
            _ontogeny = new DatabaseOntogeny {
                Name = "toto"
            };
            _executionContext = A.Fake <IExecutionContext>();
            _individualMoleculeFactoryResolver = A.Fake <IIndividualMoleculeFactoryResolver>();
            _ontogenyRepository = A.Fake <IOntogenyRepository>();
            var proteinFactory = A.Fake <IIndividualMoleculeFactory>();

            _expressionProfileUpdater = A.Fake <IExpressionProfileUpdater>();
            _moleculeContainer1       = new MoleculeExpressionContainer().WithName("C1");
            _moleculeContainer1.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
            _moleculeContainer2 = new MoleculeExpressionContainer().WithName("C2");
            _moleculeContainer2.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
            A.CallTo(() => _individualMoleculeFactoryResolver.FactoryFor <IndividualProtein>()).Returns(proteinFactory);
            _molecule = new IndividualEnzyme {
                Name = "CYP3A4"
            };
            _molecule.Add(_moleculeContainer1);
            _molecule.Add(_moleculeContainer2);
            A.CallTo(() => proteinFactory.AddMoleculeTo(_individual, A <string> ._)).Returns(_molecule);

            A.CallTo(() => _ontogenyRepository.AllFor(_individual.Species.Name)).Returns(new[] { _ontogeny, new DatabaseOntogeny {
                                                                                                     Name = "tralala"
                                                                                                 }, });
            A.CallTo(() => _executionContext.Resolve <IOntogenyRepository>()).Returns(_ontogenyRepository);

            _subjectExpressionTask = new IndividualExpressionTask(_executionContext);

            sut = new MoleculeExpressionTask <Individual>(
                _executionContext,
                _individualMoleculeFactoryResolver,
                _subjectExpressionTask,
                _expressionProfileUpdater
                );
        }
예제 #4
0
 public MoleculeExpressionTask(IApplicationController applicationController, IExecutionContext executionContext,
                               IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
                               IMoleculeToQueryExpressionSettingsMapper queryExpressionSettingsMapper,
                               IContainerTask containerTask,
                               IProteinExpressionsDatabasePathManager proteinExpressionsDatabasePathManager,
                               IOntogenyRepository ontogenyRepository,
                               ITransportContainerUpdater transportContainerUpdater,
                               ISimulationSubjectExpressionTask <TSimulationSubject> simulationSubjectExpressionTask,
                               IOntogenyTask <TSimulationSubject> ontogenyTask,
                               IMoleculeParameterTask moleculeParameterTask)
 {
     _applicationController             = applicationController;
     _executionContext                  = executionContext;
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _queryExpressionSettingsMapper     = queryExpressionSettingsMapper;
     _containerTask = containerTask;
     _proteinExpressionsDatabasePathManager = proteinExpressionsDatabasePathManager;
     _ontogenyRepository              = ontogenyRepository;
     _transportContainerUpdater       = transportContainerUpdater;
     _simulationSubjectExpressionTask = simulationSubjectExpressionTask;
     _ontogenyTask          = ontogenyTask;
     _moleculeParameterTask = moleculeParameterTask;
 }