Пример #1
0
        protected override Task Context()
        {
            _parameterMapper     = A.Fake <ParameterMapper>();
            _moleculeMapper      = A.Fake <MoleculeMapper>();
            _dimensionRepository = A.Fake <IDimensionRepository>();
            _individualFactory   = A.Fake <IIndividualFactory>();
            _originDataMapper    = A.Fake <OriginDataMapper>();

            sut = new IndividualMapper(_parameterMapper, _moleculeMapper, _originDataMapper, _individualFactory);

            _individual             = DomainHelperForSpecs.CreateIndividual();
            _individual.Name        = "Ind";
            _individual.Description = "Model Description";

            _parameterLiver  = _individual.EntityAt <IParameter>(Constants.ORGANISM, CoreConstants.Organ.Liver, "PLiver");
            _parameterKidney = _individual.EntityAt <IParameter>(Constants.ORGANISM, CoreConstants.Organ.Kidney, "PKidney");

            _parameterLiver.ValueDiffersFromDefault().ShouldBeFalse();
            _parameterKidney.ValueDiffersFromDefault().ShouldBeFalse();

            _parameterKidney.Value = 40;
            _parameterKidney.ValueDiffersFromDefault().ShouldBeTrue();

            _enzyme = new IndividualEnzyme
            {
                Name = "Enz",
            };
            _individual.AddMolecule(_enzyme);

            _transporter = new IndividualTransporter
            {
                Name = "Trans",
            };

            _individual.AddMolecule(_transporter);

            _enzymeSnapshot = new Molecule {
                Type = QuantityType.Enzyme
            };
            _transporterSnapshot = new Molecule {
                Type = QuantityType.Transporter
            };

            A.CallTo(() => _moleculeMapper.MapToSnapshot(_enzyme)).Returns(_enzymeSnapshot);
            A.CallTo(() => _moleculeMapper.MapToSnapshot(_transporter)).Returns(_transporterSnapshot);

            _originDataSnapshot = new OriginData();
            A.CallTo(() => _originDataMapper.MapToSnapshot(_individual.OriginData)).Returns(_originDataSnapshot);

            _localizedParameterKidney = new LocalizedParameter {
                Path = "Organism|Kidney|PKidney"
            };
            A.CallTo(() => _parameterMapper.LocalizedParametersFrom(A <IEnumerable <IParameter> > .That.Contains(_parameterKidney))).Returns(new[] { _localizedParameterKidney });

            return(_completed);
        }
Пример #2
0
        public DefaultIndividualRetriever(
            ISpeciesRepository speciesRepository,
            IIndividualFactory individualFactory,
            OriginDataMapper originDataMapper
            )

        {
            _speciesRepository = speciesRepository;
            _individualFactory = individualFactory;
            _originDataMapper  = originDataMapper;
        }
Пример #3
0
 internal MatlabIndividualFactory(
     OriginDataMapper originDataMapper,
     IIndividualFactory individualFactory,
     IIndividualToIndividualPropertiesMapper individualPropertiesMapper,
     IOntogenyFactorsRetriever ontogenyFactorsRetriever,
     IEntityPathResolver entityPathResolver)
 {
     _originDataMapper           = originDataMapper;
     _individualFactory          = individualFactory;
     _individualPropertiesMapper = individualPropertiesMapper;
     _ontogenyFactorsRetriever   = ontogenyFactorsRetriever;
     _entityPathResolver         = entityPathResolver;
 }
Пример #4
0
 public StarterRelativeExpressionPresenter(
     IStarterRelativeExpressionView view,
     OriginDataMapper originDataMapper,
     IIndividualFactory individualFactory,
     IIndividualEnzymeFactory individualEnzymeFactory, IIndividualEnzymeExpressionsPresenter <Individual> individualEnzymeExpressionsPresenter) : base(view)
 {
     _originDataMapper        = originDataMapper;
     _individualFactory       = individualFactory;
     _individualEnzymeFactory = individualEnzymeFactory;
     _individualEnzymeExpressionsPresenter = individualEnzymeExpressionsPresenter;
     AddSubPresenters(individualEnzymeExpressionsPresenter);
     InitializeWith(new PKSimMacroCommand());
 }
Пример #5
0
 public IndividualFactory(
     OriginDataMapper originDataMapper,
     ICoreIndividualFactory individualFactory,
     IIndividualToIndividualValuesMapper individualValuesMapper,
     IOntogenyFactorsRetriever ontogenyFactorsRetriever,
     IEntityPathResolver entityPathResolver,
     IContainerTask containerTask)
 {
     _originDataMapper         = originDataMapper;
     _individualFactory        = individualFactory;
     _individualValuesMapper   = individualValuesMapper;
     _ontogenyFactorsRetriever = ontogenyFactorsRetriever;
     _entityPathResolver       = entityPathResolver;
     _containerTask            = containerTask;
 }
Пример #6
0
        protected override Task Context()
        {
            _parameterMapper         = A.Fake <ParameterMapper>();
            _expressionProfileMapper = A.Fake <ExpressionProfileMapper>();
            _dimensionRepository     = A.Fake <IDimensionRepository>();
            _individualFactory       = A.Fake <IIndividualFactory>();
            _originDataMapper        = A.Fake <OriginDataMapper>();
            _moleculeExpressionTask  = A.Fake <IMoleculeExpressionTask <ModelIndividual> >();

            sut = new IndividualMapper(_parameterMapper, _expressionProfileMapper, _originDataMapper, _individualFactory, _moleculeExpressionTask);

            _individual             = DomainHelperForSpecs.CreateIndividual();
            _individual.Name        = "Ind";
            _individual.Description = "Model Description";
            var kidney = _individual.EntityAt <IContainer>(Constants.ORGANISM, CoreConstants.Organ.KIDNEY);

            _parameterLiver        = _individual.EntityAt <IParameter>(Constants.ORGANISM, CoreConstants.Organ.LIVER, "PLiver");
            _parameterKidney       = _individual.EntityAt <IParameter>(Constants.ORGANISM, CoreConstants.Organ.KIDNEY, "PKidney");
            _parameterKidneyRelExp = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.REL_EXP);
            _parameterKidneyRelExp.DefaultValue = 10;
            kidney.Add(_parameterKidneyRelExp);

            _parameterLiver.ValueDiffersFromDefault().ShouldBeFalse();
            _parameterKidney.ValueDiffersFromDefault().ShouldBeFalse();

            _parameterKidney.Value = 40;
            _parameterKidney.ValueDiffersFromDefault().ShouldBeTrue();
            _parameterKidneyRelExp.Value = 50;
            _parameterKidneyRelExp.ValueDiffersFromDefault().ShouldBeTrue();

            _expressionProfile1 = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>(moleculeName: "Enz");
            _expressionProfile2 = DomainHelperForSpecs.CreateExpressionProfile <IndividualTransporter>(moleculeName: "Trans");
            _individual.AddExpressionProfile(_expressionProfile1);
            _individual.AddExpressionProfile(_expressionProfile2);


            _originDataSnapshot = new OriginData();
            A.CallTo(() => _originDataMapper.MapToSnapshot(_individual.OriginData)).Returns(_originDataSnapshot);

            _localizedParameterKidney = new LocalizedParameter {
                Path = "Organism|Kidney|PKidney"
            };
            A.CallTo(() => _parameterMapper.LocalizedParametersFrom(A <IEnumerable <IParameter> > ._))
            .Invokes(x => _mappedParameters = x.GetArgument <IEnumerable <IParameter> >(0).ToList())
            .Returns(new[] { _localizedParameterKidney });

            return(_completed);
        }
Пример #7
0
 protected override void Context()
 {
     _speciesRepository   = A.Fake <ISpeciesRepository>();
     _originDataTask      = A.Fake <IOriginDataTask>();
     _individualModelTask = A.Fake <IIndividualModelTask>();
     _male   = new Gender().WithName(CoreConstants.Gender.Male);
     _female = new Gender().WithName(CoreConstants.Gender.Female);
     _human  = new Species().WithName(CoreConstants.Species.Human);
     _icrp   = new SpeciesPopulation {
         IsHeightDependent = true, IsAgeDependent = true
     }.WithName(CoreConstants.Population.ICRP);
     _anotherPop = new SpeciesPopulation().WithName("Another Pop");
     _cmForHuman = new CalculationMethod();
     _cmForHuman.AddSpecies(_human.Name);
     _icrp.AddGender(_male);
     _human.AddPopulation(_icrp);
     _category = new CalculationMethodCategory();
     _category.Add(_cmForHuman);
     A.CallTo(() => _speciesRepository.All()).Returns(new[] { _human });
     A.CallTo(() => _originDataTask.AllCalculationMethodCategoryFor(_human)).Returns(new[] { _category });
     _batchOriginData = new OriginData();
     sut = new OriginDataMapper(_speciesRepository, _originDataTask, _individualModelTask);
 }