Example #1
0
        public override void GlobalContext()
        {
            base.GlobalContext();

            _individual            = new Individual();
            _originData            = new OriginData();
            _neighborhoods         = new Container().WithName(Constants.NEIGHBORHOODS);
            _individual.OriginData = _originData;
            _individual.Add(_organism);
            _individual.Add(_neighborhoods);
            _originData.Species = new Species();
            A.CallTo(() => _speciesContainerQuery.SubContainersFor(_originData.Species, _individual)).Returns(new[] { _organism });
            A.CallTo(() => _speciesContainerQuery.SubContainersFor(_originData.Species, _organism)).Returns(new[] { _organ });
            A.CallTo(() => _speciesContainerQuery.SubContainersFor(_originData.Species, _organ)).Returns(new[] { _compartment });
            A.CallTo(() => _speciesContainerQuery.SubContainersFor(_originData.Species, _compartment)).Returns(new List <IContainer>());
            A.CallTo(() => _speciesContainerQuery.SubContainersFor(_originData.Species, _neighborhoods)).Returns(new List <IContainer>());
        }
        protected override void Context()
        {
            base.Context();
            _individual = new Individual();
            var neighborhoods = A.Fake <IContainer>().WithName(Constants.NEIGHBORHOODS);

            _neighborhood1 = A.Fake <INeighborhood>();
            _neighborhood2 = A.Fake <INeighborhood>();
            A.CallTo(() => neighborhoods.GetChildren <INeighborhood>()).Returns(new[] { _neighborhood1, _neighborhood2 });
            _individual.Add(neighborhoods);
        }
 protected override void Context()
 {
     base.Context();
     _para1 = A.Fake <IParameter>().WithName("P1");
     A.CallTo(() => _para1.IsChangedByCreateIndividual).Returns(true);
     _para2 = A.Fake <IParameter>().WithName("P2");
     A.CallTo(() => _para2.IsChangedByCreateIndividual).Returns(true);
     _para3 = A.Fake <IParameter>().WithName("P3");
     A.CallTo(() => _para3.IsChangedByCreateIndividual).Returns(false);
     _pathPara1                    = "tralal";
     _pathPara2                    = "tutu";
     _individual                   = new Individual();
     _individual.OriginData        = A.Fake <OriginData>();
     _individual.OriginData.Gender = A.Fake <Gender>();
     A.CallTo(() => _entityPathResolver.PathFor(_para1)).Returns(_pathPara1);
     A.CallTo(() => _entityPathResolver.PathFor(_para2)).Returns(_pathPara2);
     A.CallTo(() => _entityPathResolver.PathFor(_para2)).Returns(_pathPara2);
     _individual.Add(_para1);
     _individual.Add(_para2);
     _individual.Add(_para3);
 }
 protected override void Context()
 {
     _withIdRepository = A.Fake <IWithIdRepository>();
     sut = new BuildingBlockRetriever(_withIdRepository);
     _objectWithoutParent = A.Fake <IEntity>();
     _objectWithParent    = A.Fake <IEntity>();
     _objectWithoutParent.ParentContainer = null;
     _container = new Compartment();
     _container.Add(_objectWithParent);
     _individual = new Individual();
     _individual.Add(_container);
 }
 protected override void Context()
 {
     _view = A.Fake <IIndividualParametersView>();
     _parameterGroupPresenter = A.Fake <IParameterGroupsPresenter>();
     A.CallTo(() => _parameterGroupPresenter.View).Returns(A.Fake <IParameterGroupsView>());
     _organism   = A.Fake <Organism>();
     _individual = new Individual();
     _individual.Add(_organism);
     _individualPresenter = A.Fake <IIndividualPresenter>();
     A.CallTo(() => _individualPresenter.Individual).Returns(_individual);
     sut = new IndividualParametersPresenter(_view, _parameterGroupPresenter);
     sut.InitializeWith(_individualPresenter);
 }
Example #6
0
 protected override void Context()
 {
     base.Context();
     _para1 = A.Fake <IParameter>().WithName("P1");
     A.CallTo(() => _para1.IsChangedByCreateIndividual).Returns(true);
     _para2 = A.Fake <IParameter>().WithName("P2");
     A.CallTo(() => _para2.IsChangedByCreateIndividual).Returns(true);
     _para3 = A.Fake <IParameter>().WithName("P3");
     A.CallTo(() => _para3.IsChangedByCreateIndividual).Returns(false);
     _pathPara1             = "tata";
     _pathPara2             = "tutu";
     _individual            = new Individual();
     _individual.OriginData = new OriginData
     {
         Gender     = new Gender().WithName("TOTO"),
         Population = new SpeciesPopulation(),
     };
     A.CallTo(() => _entityPathResolver.PathFor(_para1)).Returns(_pathPara1);
     A.CallTo(() => _entityPathResolver.PathFor(_para2)).Returns(_pathPara2);
     A.CallTo(() => _entityPathResolver.PathFor(_para2)).Returns(_pathPara2);
     _individual.Add(_para1);
     _individual.Add(_para2);
     _individual.Add(_para3);
 }
        protected override void Context()
        {
            base.Context();
            _individual = new Individual {
                Root = new RootContainer()
            };
            var organism = new Organism();

            _individual.Add(organism);

            var ageParameter = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(CoreConstants.Parameters.AGE);

            organism.Add(ageParameter);
            var gaParameter = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(Constants.Parameters.GESTATIONAL_AGE);

            organism.Add(gaParameter);

            var ageValues = new ParameterValues(_entityPathResolver.PathFor(ageParameter));

            ageValues.Add(1);
            ageValues.Add(2);

            var gaValues = new ParameterValues(_entityPathResolver.PathFor(gaParameter));

            gaValues.Add(30);
            gaValues.Add(40);

            _population = new RandomPopulation {
                Settings = new RandomPopulationSettings {
                    BaseIndividual = _individual, NumberOfIndividuals = 2
                }
            };
            _population.IndividualValuesCache.Add(ageValues);
            _population.IndividualValuesCache.Add(gaValues);
            _population.IndividualValuesCache.IndividualIds.AddRange(new [] { 1, 2 });

            A.CallTo(() => _ontogenyRepository.OntogenyFactorFor(_ontogeny, CoreConstants.Groups.ONTOGENY_LIVER, 1, 30, _population.RandomGenerator)).Returns(10);
            A.CallTo(() => _ontogenyRepository.OntogenyFactorFor(_ontogeny, CoreConstants.Groups.ONTOGENY_LIVER, 2, 40, _population.RandomGenerator)).Returns(11);
            A.CallTo(() => _ontogenyRepository.OntogenyFactorFor(_ontogeny, CoreConstants.Groups.ONTOGENY_DUODENUM, 1, 30, _population.RandomGenerator)).Returns(20);
            A.CallTo(() => _ontogenyRepository.OntogenyFactorFor(_ontogeny, CoreConstants.Groups.ONTOGENY_DUODENUM, 2, 40, _population.RandomGenerator)).Returns(21);
        }
Example #8
0
        public static Individual CreateIndividual()
        {
            var originData = new OriginData();

            originData.SubPopulation     = new SubPopulation();
            originData.Species           = new Species().WithName("Species");
            originData.Gender            = new Gender().WithName("Gender");
            originData.SpeciesPopulation = new SpeciesPopulation().WithName("Population");
            var pvv      = new ParameterValueVersion().WithName("PVVName");
            var category = new ParameterValueVersionCategory().WithName("CategoryName");

            category.Add(pvv);
            originData.SubPopulation.AddParameterValueVersion(pvv);
            var organism   = new Organism().WithName("Organism").WithId("OrganismId");
            var organLiver = new Organ().WithName(CoreConstants.Organ.Liver).WithId("LiverId");

            organLiver.OrganType = OrganType.Liver;
            var periportal = new Compartment().WithName(CoreConstants.Compartment.Periportal).WithId("PeriportalId");

            periportal.Add(new Container().WithName(CoreConstants.Compartment.Intracellular).WithId("PeriportalIntracellular"));
            var pericentral = new Compartment().WithName(CoreConstants.Compartment.Pericentral).WithId("PericentralId");

            pericentral.Add(new Container().WithName(CoreConstants.Compartment.Intracellular).WithId("PericentralIntracellular"));
            organLiver.Add(periportal);
            organLiver.Add(pericentral);

            var organKidney = new Organ().WithName(CoreConstants.Organ.Kidney).WithId("KidneyId");

            organKidney.OrganType = OrganType.Kidney;
            organKidney.Add(new Compartment {
                Visible = true
            }.WithName(CoreConstants.Compartment.Plasma).WithId("KidneyPlasma"));
            var lumen = new Organ().WithName("GiTract").WithId("GiTract");

            lumen.OrganType = OrganType.Lumen;

            var duodenum  = new Compartment().WithName("Duodenum").WithId("Duodenum");
            var caecum    = new Compartment().WithName("Caecum").WithId("Caecum");
            var dimension = Constants.Dimension.NO_DIMENSION;

            var parameterLiver = new PKSimParameter().WithName("PLiver").WithId("PLiverId").WithFormula(new ExplicitFormula("1").WithId("1")).WithDimension(dimension);

            parameterLiver.Info = new ParameterValueMetaData {
                DefaultValue = 1
            };
            var parameterKidney = new PKSimParameter().WithName("PKidney").WithId("PKidneyId").WithFormula(new ExplicitFormula("2").WithId("2")).WithDimension(dimension);

            parameterKidney.Info = new ParameterValueMetaData {
                DefaultValue = 2
            };
            var parameterOrganism = new PKSimParameter().WithName(ParameterInOrganism).WithId("POrganismId").WithFormula(new ExplicitFormula("3").WithId("3")).WithDimension(dimension);

            parameterOrganism.Info = new ParameterValueMetaData {
                DefaultValue = 3
            };
            organLiver.Add(parameterLiver);
            organKidney.Add(parameterKidney);
            organism.Add(organLiver);
            organism.Add(organKidney);
            organism.Add(lumen);
            organism.Add(parameterOrganism);
            lumen.Add(duodenum);
            lumen.Add(caecum);

            var individual = new Individual {
                OriginData = originData
            }.WithName("Individual").WithId("IndividualId");

            individual.Add(organism);

            return(individual);
        }
Example #9
0
        public static Individual CreateIndividual(string speciesName = "Species")
        {
            var originData = new OriginData
            {
                SubPopulation = new SubPopulation(),
                Species       = new Species {
                    DisplayName = speciesName, Id = speciesName
                }.WithName(speciesName),
                Gender     = new Gender().WithName("Gender"),
                Population = new SpeciesPopulation().WithName("Population"),
            };

            var pvv      = new ParameterValueVersion().WithName("PVVName");
            var category = new ParameterValueVersionCategory().WithName("CategoryName");

            category.Add(pvv);
            originData.SubPopulation.AddParameterValueVersion(pvv);
            var organism   = new Organism().WithName(Constants.ORGANISM).WithId("OrganismId");
            var organLiver = new Organ().WithName(CoreConstants.Organ.LIVER).WithId("LiverId");

            organLiver.OrganType = OrganType.TissueOrgansNotInGiTract;
            var periportal = new Compartment().WithName(CoreConstants.Compartment.PERIPORTAL).WithId("PeriportalId");

            periportal.Add(new Container().WithName(CoreConstants.Compartment.INTRACELLULAR).WithId("PeriportalIntracellular"));
            var pericentral = new Compartment().WithName(CoreConstants.Compartment.PERICENTRAL).WithId("PericentralId");

            pericentral.Add(new Container().WithName(CoreConstants.Compartment.INTRACELLULAR).WithId("PericentralIntracellular"));
            organLiver.Add(periportal);
            organLiver.Add(pericentral);

            var organKidney = new Organ().WithName(CoreConstants.Organ.KIDNEY).WithId("KidneyId");

            organKidney.OrganType = OrganType.TissueOrgansNotInGiTract;
            organKidney.Add(new Compartment {
                Visible = true
            }.WithName(CoreConstants.Compartment.PLASMA).WithId("KidneyPlasma"));
            var lumen = new Organ().WithName("GiTract").WithId("GiTract");

            lumen.OrganType = OrganType.Lumen;

            var duodenum  = new Compartment().WithName("Duodenum").WithId("Duodenum");
            var caecum    = new Compartment().WithName("Caecum").WithId("Caecum");
            var dimension = Constants.Dimension.NO_DIMENSION;

            var parameterLiver = new PKSimParameter().WithName("PLiver").WithId("PLiverId").WithFormula(new ExplicitFormula("1").WithId("1")).WithDimension(dimension);

            parameterLiver.Info = new ParameterValueMetaData {
                DefaultValue = 1
            };
            var parameterKidney = new PKSimParameter().WithName("PKidney").WithId("PKidneyId").WithFormula(new ExplicitFormula("2").WithId("2")).WithDimension(dimension);

            parameterKidney.Info = new ParameterValueMetaData {
                DefaultValue = 2
            };
            var parameterOrganism = new PKSimParameter().WithName(ParameterInOrganism).WithId("POrganismId").WithFormula(new ExplicitFormula("3").WithId("3")).WithDimension(dimension);

            parameterOrganism.Info = new ParameterValueMetaData {
                DefaultValue = 3
            };
            organLiver.Add(parameterLiver);
            organKidney.Add(parameterKidney);
            organism.Add(organLiver);
            organism.Add(organKidney);
            organism.Add(lumen);
            organism.Add(parameterOrganism);
            lumen.Add(duodenum);
            lumen.Add(caecum);

            var individual = new Individual {
                OriginData = originData
            }.WithName("Individual").WithId("IndividualId");

            individual.Add(organism);

            return(individual);
        }