Пример #1
0
        public override async Task <SnapshotOriginData> MapToSnapshot(ModelOriginData originData)
        {
            var snapshot = await SnapshotFrom(originData, x =>
            {
                x.Species    = originData.Species.Name;
                x.Population = originData.Species.Populations.Count > 1 ? originData.SpeciesPopulation.Name : null;
                x.Gender     = originData.SpeciesPopulation.Genders.Count > 1 ? originData.Gender.Name : null;
            });

            if (originData.SpeciesPopulation.IsAgeDependent)
            {
                //Always generate age for Age dependent species
                snapshot.Age            = parameterFrom(originData.Age, originData.AgeUnit, _dimensionRepository.AgeInYears);
                snapshot.GestationalAge = originDataParameterFor(originData, _individualModelTask.MeanGestationalAgeFor, originData.GestationalAge, originData.GestationalAgeUnit, _dimensionRepository.AgeInWeeks);
            }

            snapshot.Weight = originDataParameterFor(originData, _individualModelTask.MeanWeightFor, originData.Weight, originData.WeightUnit, _dimensionRepository.Mass);

            if (originData.SpeciesPopulation.IsHeightDependent)
            {
                snapshot.Height = originDataParameterFor(originData, _individualModelTask.MeanHeightFor, originData.Height, originData.HeightUnit, _dimensionRepository.Length);
            }

            snapshot.ValueOrigin = await _valueOriginMapper.MapToSnapshot(originData.ValueOrigin);

            snapshot.CalculationMethods = await _calculationMethodCacheMapper.MapToSnapshot(originData.CalculationMethodCache, originData.Species.Name);

            return(snapshot);
        }
        private async Task mapRunModeParameters(SnapshotParameterIdentificationRunMode snapshot, ModelParameterIdentificationRunMode runMode)
        {
            switch (runMode)
            {
            case MultipleParameterIdentificationRunMode multipleParameterIdentificationRunMode:
                snapshot.NumberOfRuns = multipleParameterIdentificationRunMode.NumberOfRuns;
                break;

            case CategorialParameterIdentificationRunMode categorialParameterIdentificationRunMode:
                if (categorialParameterIdentificationRunMode.AllTheSame)
                {
                    snapshot.AllTheSameSelection = await _calculationMethodCacheMapper.MapToSnapshot(categorialParameterIdentificationRunMode.AllTheSameSelection);
                }
                else
                {
                    snapshot.CalculationMethods = await calculationMethodsCacheFor(categorialParameterIdentificationRunMode);
                }
                break;
            }
        }
Пример #3
0
        public override async Task <SnapshotCompoundProperties> MapToSnapshot(ModelCompoundProperties modelCompoundProperties, PKSimProject project)
        {
            var compound = modelCompoundProperties.Compound;
            var snapshot = await SnapshotFrom(modelCompoundProperties, x =>
            {
                x.Name         = compound.Name;
                x.Alternatives = alternativeSelectionsFrom(compound, modelCompoundProperties);
                x.Protocol     = protocolPropertiesFrom(modelCompoundProperties.ProtocolProperties, project);
            });

            snapshot.CalculationMethods = await _calculationMethodCacheMapper.MapToSnapshot(modelCompoundProperties.CalculationMethodCache);

            snapshot.Processes = await snapshotProcessSelectionFrom(modelCompoundProperties.Processes);

            return(snapshot);
        }
Пример #4
0
        public override async Task <SnapshotCompound> MapToSnapshot(ModelCompound compound)
        {
            var snapshot = await SnapshotFrom(compound);

            snapshot.CalculationMethods = await _calculationMethodCacheMapper.MapToSnapshot(compound.CalculationMethodCache);

            snapshot.Lipophilicity = await mapAlternatives(compound, COMPOUND_LIPOPHILICITY);

            snapshot.FractionUnbound = await mapAlternatives(compound, COMPOUND_FRACTION_UNBOUND);

            snapshot.Solubility = await mapAlternatives(compound, COMPOUND_SOLUBILITY);

            snapshot.IntestinalPermeability = await mapAlternatives(compound, COMPOUND_INTESTINAL_PERMEABILITY);

            snapshot.Permeability = await mapAlternatives(compound, COMPOUND_PERMEABILITY);

            snapshot.PkaTypes  = mapPkaTypes(compound);
            snapshot.Processes = await mapProcesses(compound);

            snapshot.IsSmallMolecule             = compound.IsSmallMolecule;
            snapshot.PlasmaProteinBindingPartner = SnapshotValueFor(compound.PlasmaProteinBindingPartner, PlasmaProteinBindingPartner.Unknown);
            return(snapshot);
        }