コード例 #1
0
        public void PrepareSolubilityAlternativeForTableSolubility(ParameterAlternative solubilityAlternative)
        {
            var solubilityAtRefPhParameter = solubilityAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_AT_REFERENCE_PH);
            var phParameter             = solubilityAlternative.Parameter(CoreConstants.Parameters.REFERENCE_PH);
            var solubilityGainParameter = solubilityAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_GAIN_PER_CHARGE);

            resetParameters(solubilityGainParameter, solubilityAtRefPhParameter, phParameter);
            solubilityAtRefPhParameter.Value = 0;

            var tableParameter = solubilityAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_TABLE);

            tableParameter.Visible   = true;
            tableParameter.IsDefault = false;
        }
コード例 #2
0
        public SolubilityAlternativeDTO MapFrom(ParameterAlternative parameterAlternative)
        {
            var solubilityAlternativeDTO = new SolubilityAlternativeDTO(parameterAlternative);

            var solubility    = parameterAlternative.Parameter(CoreConstants.Parameter.SolubilityAtRefpH);
            var refPh         = parameterAlternative.Parameter(CoreConstants.Parameter.RefpH);
            var gainPerCharge = parameterAlternative.Parameter(CoreConstants.Parameter.SolubilityGainPerCharge);

            solubilityAlternativeDTO.SolubilityParameter    = _parameterDTOMapper.MapFrom(solubility, solubilityAlternativeDTO, dto => dto.Solubility, dto => dto.SolubilityParameter);
            solubilityAlternativeDTO.RefpHParameter         = _parameterDTOMapper.MapFrom(refPh, solubilityAlternativeDTO, dto => dto.RefpH, dto => dto.RefpHParameter);
            solubilityAlternativeDTO.GainPerChargeParameter = _parameterDTOMapper.MapFrom(gainPerCharge, solubilityAlternativeDTO, dto => dto.GainPerCharge, dto => dto.GainPerChargeParameter);

            return(solubilityAlternativeDTO);
        }
コード例 #3
0
        protected override void Context()
        {
            base.Context();
            _formulaCache                = new FormulaCache();
            _compoundFactory             = IoC.Resolve <ICompoundFactory>();
            _parameterAlternativeFactory = IoC.Resolve <IParameterAlternativeFactory>();
            _compound = _compoundFactory.Create().WithName("Comp");
            _compound.Parameter(Constants.Parameters.MOL_WEIGHT).Value = 250;
            //Two simple parameters without alternatives

            //one parameter defined as a constant for which an alternative was also specififed
            var lipoGroup = _compound.ParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_LIPOPHILICITY);

            _alternativeLipo1 = _parameterAlternativeFactory.CreateAlternativeFor(lipoGroup).WithName("ALT_LIPO1").WithId("ALT_LIPO1");
            _alternativeLipo1.Parameter(CoreConstants.Parameters.LIPOPHILICITY).Value = 2;
            _alternativeLipo2 = _parameterAlternativeFactory.CreateAlternativeFor(lipoGroup).WithName("ALT_LIPO2").WithId("ALT_LIPO2");
            _alternativeLipo2.Parameter(CoreConstants.Parameters.LIPOPHILICITY).Value = 5;
            lipoGroup.AddAlternative(_alternativeLipo1);
            lipoGroup.AddAlternative(_alternativeLipo2);

            //one parameter defined as a formula with a default calculated alternative

            var permAlternativeGroup = _compound.ParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_PERMEABILITY);

            //value cannot be changed by user
            _alternativePerm1 = _parameterAlternativeFactory.CreateDefaultAlternativeFor(permAlternativeGroup).WithName("ALT_PERM1").WithId("ALT_PERM1");
            _alternativePerm2 = _parameterAlternativeFactory.CreateAlternativeFor(permAlternativeGroup).WithName("ALT_PERM2").WithId("ALT_PERM2");
            _alternativePerm2.Parameter(CoreConstants.Parameters.PERMEABILITY).Value = 10;
            permAlternativeGroup.AddAlternative(_alternativePerm1);
            permAlternativeGroup.AddAlternative(_alternativePerm2);
        }
        public PermeabilityAlternativeDTO MapFrom(ParameterAlternative parameterAlternative, string parameterName)
        {
            var permeability = parameterAlternative.Parameter(parameterName);
            var permeabilityAlternativeDTO = new PermeabilityAlternativeDTO(parameterAlternative, permeability.ValueOrigin);

            permeabilityAlternativeDTO.PermeabilityParameter = _parameterDTOMapper.MapFrom(permeability, permeabilityAlternativeDTO, dto => dto.Permeability, dto => dto.PermeabilityParameter);
            return(permeabilityAlternativeDTO);
        }
コード例 #5
0
        public LipophilictyAlternativeDTO MapFrom(ParameterAlternative parameterAlternative)
        {
            var lipophilicity = parameterAlternative.Parameter(CoreConstants.Parameters.LIPOPHILICITY);
            var lipophilictyAlternativeDTO = new LipophilictyAlternativeDTO(parameterAlternative, lipophilicity.ValueOrigin);

            lipophilictyAlternativeDTO.LipophilictyParameter = _parameterDTOMapper.MapFrom(lipophilicity, lipophilictyAlternativeDTO, dto => dto.Lipophilicty, dto => dto.LipophilictyParameter);
            return(lipophilictyAlternativeDTO);
        }
コード例 #6
0
        public TableFormula SolubilityTableForPh(ParameterAlternative solubilityAlternative, Compound compound)
        {
            //Already a table formula. Use as IS!
            var tableSolubility = solubilityAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_TABLE);

            if (tableSolubility.Formula.IsTable())
            {
                return(tableSolubility.Formula.DowncastTo <TableFormula>());
            }

            //Sol(pH) = ref_Solubility * Solubility_Factor (ref_pH) / Solubility_Factor(pH)
            //Solubility_pKa_pH_Factor

            var refSolubility      = solubilityAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_AT_REFERENCE_PH);
            var refPh              = solubilityAlternative.Parameter(CoreConstants.Parameters.REFERENCE_PH);
            var gainPerCharge      = solubilityAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_GAIN_PER_CHARGE);
            var refSolubilityValue = refSolubility.Value;

            var compoundForCalculation = _executionContext.Clone(compound);
            var formula = initializeSolubilityTableFormula(_formulaFactory.CreateTableFormula(), refPh.Dimension, refSolubility.Dimension);

            compoundForCalculation.Parameter(CoreConstants.Parameters.REFERENCE_PH).Value = refPh.Value;
            compoundForCalculation.Parameter(CoreConstants.Parameters.SOLUBILITY_GAIN_PER_CHARGE).Value = gainPerCharge.Value;

            double solFactorRefpH = compoundForCalculation.Parameter(CoreConstants.Parameters.SOLUBILITY_P_KA__P_H_FACTOR).Value;
            var    allPh          = new List <double>();
            int    ph             = 0;

            while (ph <= 13)
            {
                allPh.AddRange(new[] { ph, ph + 0.5 });
                ph++;
            }

            allPh.Add(14);
            foreach (var pH in allPh)
            {
                compoundForCalculation.Parameter(CoreConstants.Parameters.REFERENCE_PH).Value = pH;
                double solFactorAtpH = compoundForCalculation.Parameter(CoreConstants.Parameters.SOLUBILITY_P_KA__P_H_FACTOR).Value;
                formula.AddPoint(pH, refSolubilityValue * solFactorRefpH / solFactorAtpH);
            }

            return(formula);
        }
        public LipophilictyAlternativeDTO MapFrom(ParameterAlternative parameterAlternative)
        {
            var lipophilictyAlternativeDTO = new LipophilictyAlternativeDTO(parameterAlternative);

            var lipophilicity = parameterAlternative.Parameter(CoreConstants.Parameter.Lipophilicity);

            lipophilictyAlternativeDTO.LipophilictyParameter = _parameterDTOMapper.MapFrom(lipophilicity, lipophilictyAlternativeDTO, dto => dto.Lipophilicty, dto => dto.LipophilictyParameter);

            return(lipophilictyAlternativeDTO);
        }
コード例 #8
0
        public SolubilityAlternativeDTO MapFrom(ParameterAlternative parameterAlternative)
        {
            var solubilityAtRefPh   = parameterAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_AT_REFERENCE_PH);
            var solubilityTable     = parameterAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_TABLE);
            var solubilityParameter = solubilityTable.Formula.IsTable() ? solubilityTable : solubilityAtRefPh;

            var solubilityAlternativeDTO = new SolubilityAlternativeDTO(parameterAlternative, solubilityParameter.ValueOrigin);

            solubilityAlternativeDTO.SolubilityParameter = _parameterDTOMapper.MapFrom(solubilityParameter, solubilityAlternativeDTO, dto => dto.Solubility, dto => dto.SolubilityParameter);

            var refPh = parameterAlternative.Parameter(CoreConstants.Parameters.REFERENCE_PH);

            solubilityAlternativeDTO.RefpHParameter = _parameterDTOMapper.MapFrom(refPh, solubilityAlternativeDTO, dto => dto.RefpH, dto => dto.RefpHParameter);

            var gainPerCharge = parameterAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_GAIN_PER_CHARGE);

            solubilityAlternativeDTO.GainPerChargeParameter = _parameterDTOMapper.MapFrom(gainPerCharge, solubilityAlternativeDTO, dto => dto.GainPerCharge, dto => dto.GainPerChargeParameter);


            return(solubilityAlternativeDTO);
        }
コード例 #9
0
        public TableFormula SolubilityTableForPh(ParameterAlternative solubilityAlternative, Compound compound)
        {
            //Sol(pH) = ref_Solubility * Solubility_Factor (ref_pH) / Solubility_Factor(pH)
            //Solubility_pKa_pH_Factor

            var refPh              = solubilityAlternative.Parameter(CoreConstants.Parameter.RefpH);
            var refSolubility      = solubilityAlternative.Parameter(CoreConstants.Parameter.SolubilityAtRefpH);
            var gainPerCharge      = solubilityAlternative.Parameter(CoreConstants.Parameter.SolubilityGainPerCharge);
            var refSolubilityValue = refSolubility.Value;

            var formula = _formulaFactory.CreateTableFormula()
                          .WithName(PKSimConstants.UI.Solubility)
                          .InitializedWith(PKSimConstants.UI.pH, PKSimConstants.UI.Solubility, refPh.Dimension, refSolubility.Dimension);

            compound.Parameter(CoreConstants.Parameter.RefpH).Value = refPh.Value;
            compound.Parameter(CoreConstants.Parameter.SolubilityGainPerCharge).Value = gainPerCharge.Value;

            double solFactorRefpH = compound.Parameter(CoreConstants.Parameter.SOLUBILITY_P_KA__P_H_FACTOR).Value;
            var    allPh          = new List <double>();
            int    ph             = 0;

            while (ph <= 13)
            {
                allPh.AddRange(new[] { ph, ph + 0.5 });
                ph++;
            }
            allPh.Add(14);
            foreach (var pH in allPh)
            {
                compound.Parameter(CoreConstants.Parameter.RefpH).Value = pH;
                double solFactorAtpH = compound.Parameter(CoreConstants.Parameter.SOLUBILITY_P_KA__P_H_FACTOR).Value;
                formula.AddPoint(pH, refSolubilityValue * solFactorRefpH / solFactorAtpH);
            }

            return(formula);
        }
コード例 #10
0
 public void should_have_set_the_compound_specific_parameter_using_the_defined_value_if_available()
 {
     _result.Parameter(CoreConstants.Parameters.FRACTION_UNBOUND_EXPERIMENT).Value.ShouldBeEqualTo(_fuAlternative.Parameter(CoreConstants.Parameters.FRACTION_UNBOUND_PLASMA_REFERENCE_VALUE).Value);
 }
コード例 #11
0
 public void should_have_set_the_compound_specific_parameter_using_the_defined_value_if_available()
 {
     _result.Parameter(CoreConstants.Parameter.FRATION_UNBOUND_EXPERIMENT).Value.ShouldBeEqualTo(_fuAlternative.Parameter(CoreConstants.Parameter.FractionUnbound).Value);
 }
コード例 #12
0
 public void should_have_added_a_clone_of_the_template_paraemter_for_the_given_group_to_the_alternative()
 {
     _newAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_TABLE).ShouldBeEqualTo(_solubilityTable);
 }
コード例 #13
0
 protected override void Because()
 {
     _result = sut.CreateAlternativeFor(_compoundParameterGroup);
     _alternativeParameter = _result.Parameter("toto");
 }