public ParameterValue[] CreateIndividual(OriginData batchOriginData, IEnumerable <MoleculeOntogeny> moleculeOntogenies) { var originData = _originDataMapper.MapFrom(batchOriginData); var individual = _individualFactory.CreateAndOptimizeFor(originData); var individualProperties = _individualPropertiesMapper.MapFrom(individual); var allIndividualParameters = individualProperties.ParameterValues.ToList(); allIndividualParameters.AddRange(_ontogenyFactorsRetriever.FactorsFor(originData, moleculeOntogenies)); return(allIndividualParameters.ToArray()); }
public Model.Individual MapFrom(Individual batchIndividual) { var batchOriginData = new OriginData { Species = batchIndividual.Species, Population = batchIndividual.Population, Gender = batchIndividual.Gender, Age = batchIndividual.Age.GetValueOrDefault(double.NaN), Height = batchIndividual.Height.GetValueOrDefault(double.NaN), Weight = batchIndividual.Weight.GetValueOrDefault(double.NaN), GestationalAge = batchIndividual.GestationalAge.GetValueOrDefault(double.NaN), }; var originData = _originDataMapper.MapFrom(batchOriginData); var individual = _individualFactory.CreateAndOptimizeFor(originData, batchIndividual.Seed).WithName("Individual"); batchIndividual.Enzymes.Each(enzyme => addMoleculeTo <IndividualEnzyme>(individual, enzyme)); batchIndividual.OtherProteins.Each(otherProtein => addMoleculeTo <IndividualOtherProtein>(individual, otherProtein)); batchIndividual.Transporters.Each(transporter => { var individualTransporter = addMoleculeTo <IndividualTransporter>(individual, transporter); individualTransporter.TransportType = EnumHelper.ParseValue <TransportType>(transporter.TransportType); _batchLogger.AddDebug($"Transport type for transporter '{individualTransporter.Name}' is {individualTransporter.TransportType}"); }); return(individual); }
private Model.OriginData originDataFrom(PopulationSettings batchPopulationSettings) { //create default individual based on given data var batchOriginData = new OriginData { Species = batchPopulationSettings.Species, Population = batchPopulationSettings.Population }; batchPopulationSettings.AllCalculationMethods.KeyValues.Each(kv => batchOriginData.AddCalculationMethod(kv.Key, kv.Value)); return(_originDataMapper.MapFrom(batchOriginData)); }