private Individual createIndividual() { var originData = new OriginData { Species = CoreConstants.Species.HUMAN, Population = CoreConstants.Population.ICRP, Age = new Parameter { Value = 30, Unit = "year(s)", }, Weight = new Parameter { Value = 75, Unit = "kg", }, Height = new Parameter { Value = 175, Unit = "cm", }, Gender = CoreConstants.Gender.MALE }; var modelOriginData = _originDataMapper.MapToModel(originData, new SnapshotContext()).Result; var individual = _individualFactory.CreateAndOptimizeFor(modelOriginData); return(individual); }
protected override void Context() { base.Context(); var originData = new OriginData { Species = CoreConstants.Species.HUMAN, Population = CoreConstants.Population.ICRP, }; originData.AddCalculationMethods("SurfaceAreaPlsInt_VAR1"); _settings = new PopulationSettings { Individual = new Individual { OriginData = originData }, Age = new ParameterRange { Min = 0, Max = 80, Unit = "year(s)", }, Weight = new ParameterRange { Min = 70, Unit = "kg", }, NumberOfIndividuals = 10, ProportionOfFemales = 70 }; _moleculeOntogenies = new [] { new MoleculeOntogeny("CYP3A4", "CYP3A4"), new MoleculeOntogeny("CYP2D6", "CYP2D6") }; }
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); }
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); }
protected override void Context() { base.Context(); var originData = new OriginData { Species = CoreConstants.Species.HUMAN, Population = CoreConstants.Population.PRETERM, }; originData.AddCalculationMethods("SurfaceAreaPlsInt_VAR1"); _settings = new PopulationSettings { Individual = new Individual { OriginData = originData }, Age = new ParameterRange { Min = 0, Max = 80, Unit = "year(s)", }, Weight = new ParameterRange { Min = 70, Unit = "kg", }, GestationalAge = new ParameterRange { Min = 30, Max = 35, Unit = "week(s)", }, NumberOfIndividuals = 10, ProportionOfFemales = 70 }; }