コード例 #1
0
 public IndividualMapper(IIndividualFactory individualFactory, IOriginDataMapper originDataMapper,
                         IIndividualMoleculeFactoryResolver moleculeFactoryResolver, IBatchLogger batchLogger)
 {
     _individualFactory       = individualFactory;
     _originDataMapper        = originDataMapper;
     _moleculeFactoryResolver = moleculeFactoryResolver;
     _batchLogger             = batchLogger;
 }
コード例 #2
0
 public MoleculeExpressionTask(IExecutionContext executionContext,
                               IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
                               ISimulationSubjectExpressionTask <TSimulationSubject> simulationSubjectExpressionTask,
                               IExpressionProfileUpdater expressionProfileUpdater)
 {
     _executionContext = executionContext;
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _simulationSubjectExpressionTask   = simulationSubjectExpressionTask;
     _expressionProfileUpdater          = expressionProfileUpdater;
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public Converter9To10(
     IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
     IDefaultIndividualRetriever defaultIndividualRetriever,
     IMoleculeExpressionTask <Individual> moleculeExpressionTask,
     ICloner cloner,
     Converter90To100 coreConverter90To100
     )
 {
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _defaultIndividualRetriever        = defaultIndividualRetriever;
     _moleculeExpressionTask            = moleculeExpressionTask;
     _cloner = cloner;
     _coreConverter90To100 = coreConverter90To100;
 }
コード例 #5
0
 public ExpressionProfileFactory(
     ISpeciesRepository speciesRepository,
     IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
     IPKSimObjectBaseFactory objectBaseFactory,
     IIndividualFactory individualFactory,
     IUsedExpressionProfileCategoryRepository usedExpressionProfileCategoryRepository
     )
 {
     _speciesRepository = speciesRepository;
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _objectBaseFactory = objectBaseFactory;
     _individualFactory = individualFactory;
     _usedExpressionProfileCategoryRepository = usedExpressionProfileCategoryRepository;
 }
コード例 #6
0
ファイル: MoleculeMapper.cs プロジェクト: devhliu/PK-Sim
 public MoleculeMapper(
     ParameterMapper parameterMapper,
     ExpressionContainerMapper expressionContainerMapper,
     OntogenyMapper ontogenyMapper,
     IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
     IExecutionContext executionContext,
     IOntogenyTask <ModelIndividual> ontogenyTask,
     IMoleculeParameterTask moleculeExpressionTask
     ) : base(parameterMapper)
 {
     _expressionContainerMapper         = expressionContainerMapper;
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _executionContext       = executionContext;
     _ontogenyTask           = ontogenyTask;
     _moleculeExpressionTask = moleculeExpressionTask;
     _ontogenyMapper         = ontogenyMapper;
 }
コード例 #7
0
        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
                );
        }
コード例 #8
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;
 }
コード例 #9
0
        protected override Task Context()
        {
            _parameterMapper                   = A.Fake <ParameterMapper>();
            _expressionContainerMapper         = A.Fake <ExpressionContainerMapper>();
            _executionContext                  = A.Fake <IExecutionContext>();
            _individualMoleculeFactoryResolver = A.Fake <IIndividualMoleculeFactoryResolver>();
            _ontogenyMapper = A.Fake <OntogenyMapper>();
            _ontogenyTask   = A.Fake <IOntogenyTask <Individual> >();
            _individualMoleculeParametersTask = A.Fake <IMoleculeParameterTask>();

            sut = new MoleculeMapper(_parameterMapper, _expressionContainerMapper,
                                     _ontogenyMapper, _individualMoleculeFactoryResolver, _executionContext, _ontogenyTask, _individualMoleculeParametersTask);

            _ontogeny = new DatabaseOntogeny
            {
                Name = "Ontogeny"
            };

            _enzyme = new IndividualEnzyme
            {
                Name        = "Enzyme",
                Description = "Help",
                Ontogeny    = _ontogeny,
            };

            _transporter = new IndividualTransporter
            {
                Name        = "Transporter",
                Description = "Help"
            };

            _otherProtein = new IndividualOtherProtein
            {
                Name        = "OtherProtein",
                Description = "Help"
            };

            _enzymeGlobalParameter         = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: true).WithName(CoreConstants.Parameters.HALF_LIFE_LIVER);
            _enzymeGlobalParameterSnapshot = new Parameter();

            A.CallTo(() => _parameterMapper.MapToSnapshot(_enzymeGlobalParameter)).Returns(_enzymeGlobalParameterSnapshot);

            _expressionContainer1 = new MoleculeExpressionContainer {
                Name = "Exp Container1"
            };
            _expressionContainer2 = new MoleculeExpressionContainer {
                Name = "Exp Container2"
            };
            _enzyme.AddChildren(_expressionContainer1, _expressionContainer2, _enzymeGlobalParameter);

            _relativeExpressionParameter1     = DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(CoreConstants.Parameters.REL_EXP);
            _relativeExpressionParameterNorm1 = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.REL_EXP_NORM);
            _expressionContainer1.Add(_relativeExpressionParameter1);
            _expressionContainer1.Add(_relativeExpressionParameterNorm1);

            _relativeExpressionParameterNotSet     = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.REL_EXP);
            _relativeExpressionParameterNotSetNorm = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.REL_EXP_NORM);
            _expressionContainer2.Add(_relativeExpressionParameterNotSet);
            _expressionContainer2.Add(_relativeExpressionParameterNotSetNorm);

            _relativeExpressionContainerSnapshot1 = new ExpressionContainer();
            _relativeExpressionContainerSnapshot2 = new ExpressionContainer();

            A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer1)).Returns(_relativeExpressionContainerSnapshot1);
            A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer2)).Returns(_relativeExpressionContainerSnapshot2);

            _snapshotOntogeny = new Snapshots.Ontogeny();
            A.CallTo(() => _ontogenyMapper.MapToSnapshot(_ontogeny)).Returns(_snapshotOntogeny);
            _individual = new Individual();

            return(_completed);
        }