public void should_have_converted_the_mol_weight_of_the_compound_in_the_building_block_and_in_the_simulation()
        {
            _compound.Parameter(Constants.Parameters.MOL_WEIGHT).ValueInDisplayUnit.ShouldBeEqualTo(250, 1e-2);
            var simCompound = _simulation.BuildingBlock <Compound>();

            simCompound.Parameter(Constants.Parameters.MOL_WEIGHT).ValueInDisplayUnit.ShouldBeEqualTo(250, 1e-2);
            var modelComp = _simulation.Model.Root.Container(_compound.Name);

            modelComp.Parameter(Constants.Parameters.MOL_WEIGHT).ValueInDisplayUnit.ShouldBeEqualTo(250, 1e-2);
        }
        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);
        }
Exemplo n.º 3
0
        private void checkIsDefaultFlagIn(Compound compound)
        {
            compound.Parameter(CoreConstants.Parameters.MOLECULAR_WEIGHT).IsDefault.ShouldBeFalse();
            var lipoGroup  = compound.ParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_LIPOPHILICITY);
            var parameters = lipoGroup.AllAlternatives.Select(x => x.Parameter(CoreConstants.Parameters.LIPOPHILICITY));

            parameters.Each(p => p.IsDefault.ShouldBeFalse());
        }
        public override void EditCompound(Compound compound)
        {
            _parameter = compound.Parameter(CoreConstants.Parameter.IS_SMALL_MOLECULE);
            var info            = _representationInfoRepository.InfoFor(_parameter);
            var isSmallMolecule = new IsSmallMoleculeDTO {
                Value = _parameter.Value == 1, Description = info.Description, Display = info.DisplayName
            };

            _view.BindTo(isSmallMolecule);
        }
        private void verifyEnableSaturationParameter(Compound compound)
        {
            compound.SupersaturationEnabled.ShouldBeFalse();
            var enableSaturation = compound.Parameter(Constants.Parameters.ENABLE_SUPERSATURATION);

            enableSaturation.CanBeVaried.ShouldBeTrue();
            enableSaturation.Info.ReadOnly.ShouldBeFalse();
            enableSaturation.Visible.ShouldBeTrue();
            enableSaturation.CanBeVariedInPopulation.ShouldBeFalse();
            enableSaturation.IsDefault.ShouldBeTrue();
        }
Exemplo n.º 6
0
        public void Visit(Compound compound)
        {
            //required for wrong conversion between 5.1 and 5.2.1
            var oldFractionUnbound = compound.Parameter(ConverterConstants.Parameter.FractionUnboundPlasma);

            if (oldFractionUnbound == null)
            {
                return;
            }

            oldFractionUnbound.Name = CoreConstants.Parameter.FractionUnbound;
        }
Exemplo n.º 7
0
        public void Visit(Compound compound)
        {
            //required for wrong conversion between 5.1 and 5.2.1
            var oldFractionUnbound = compound.Parameter(ConverterConstants.Parameter.FractionUnboundPlasma);

            if (oldFractionUnbound == null)
            {
                return;
            }

            oldFractionUnbound.Name = CoreConstants.Parameters.FRACTION_UNBOUND_PLASMA_REFERENCE_VALUE;
            _converted = true;
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
        private void addNewParameters(Compound compound)
        {
            var defaultCompound = _compoundFactory.Create();

            var plasmaProteinBindingPartner = _cloner.Clone(defaultCompound.Parameter(Constants.Parameters.PLASMA_PROTEIN_BINDING_PARTNER));

            plasmaProteinBindingPartner.Value = (int)PlasmaProteinBindingPartner.Unknown;
            compound.Add(plasmaProteinBindingPartner);
            compound.Add(_cloner.Clone(defaultCompound.Parameter(ConverterConstants.Parameter.Kass_FcRn)));
            compound.Add(_cloner.Clone(defaultCompound.Parameter(ConverterConstants.Parameter.Kd_FcRn_pls_int)));
            compound.Add(_cloner.Clone(defaultCompound.Parameter(ConverterConstants.Parameter.BP_AGP)));
            compound.Add(_cloner.Clone(defaultCompound.Parameter(ConverterConstants.Parameter.BP_ALBUMIN)));
            compound.Add(_cloner.Clone(defaultCompound.Parameter(ConverterConstants.Parameter.BP_UNKNOWN)));

            var oldKdFCRn = compound.Parameter("Kd (FcRn)");

            oldKdFCRn.Name = ConverterConstants.Parameter.Kd_FcRn_Endo;
        }
Exemplo n.º 10
0
        public void UpdateGainPerChargeInAlternatives(Compound compound, bool updateValues = true)
        {
            var gainPerCharge = compound.Parameter(CoreConstants.Parameter.SolubilityGainPerCharge);

            gainPerCharge.GroupName = CoreConstants.Groups.COMPOUND_SOLUBILITY;

            var solGroup = compound.ParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_SOLUBILITY);

            foreach (var alternative in solGroup.AllAlternatives)
            {
                var alternativeParameter = alternative.Parameter(CoreConstants.Parameter.SolubilityGainPerCharge);
                if (alternativeParameter != null)
                {
                    if (updateValues)
                    {
                        alternativeParameter.Value = gainPerCharge.Value;
                    }
                }
                else
                {
                    alternative.Add(_cloner.Clone(gainPerCharge));
                }
            }
        }
 public override void EditCompound(Compound compound)
 {
     _plasmaProteinPartner = compound.Parameter(Constants.Parameters.PLASMA_PROTEIN_BINDING_PARTNER);
     base.EditCompound(compound);
 }
Exemplo n.º 12
0
 private void convertCompound(Compound compound)
 {
     compound.Parameter(Constants.Parameters.MOL_WEIGHT).CanBeVaried = false;
 }
Exemplo n.º 13
0
 public void should_have_added_the_plasma_protein_binding_partner_parameter()
 {
     _compound.Parameter(CoreConstants.Parameter.PLASMA_PROTEIN_BINDING_PARTNER).ShouldNotBeNull();
     _compound.Parameter(CoreConstants.Parameter.PLASMA_PROTEIN_BINDING_PARTNER).Value.ShouldBeEqualTo((double)PlasmaProteinPartner.Unknown);
 }
        private IEnumerable <IParameter> permeabilityParametersFor(Compound compound, string permeabilityParameterName)
        {
            //create a temp compound from the compound factory
            //retrieve the lipophilicity alternatives
            var lipophilicityGroup = compound.ParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_LIPOPHILICITY);

            foreach (var alternative in lipophilicityGroup.AllAlternatives)
            {
                var tempCompound = _compoundFactory.Create();
                tempCompound.Parameter(Constants.Parameters.IS_SMALL_MOLECULE).Value = compound.Parameter(Constants.Parameters.IS_SMALL_MOLECULE).Value;
                tempCompound.Parameter(CoreConstants.Parameters.EFFECTIVE_MOLECULAR_WEIGHT).Value = compound.Parameter(CoreConstants.Parameters.EFFECTIVE_MOLECULAR_WEIGHT).Value;
                tempCompound.Parameter(CoreConstants.Parameters.LIPOPHILICITY).Value = alternative.Parameter(CoreConstants.Parameters.LIPOPHILICITY).Value;
                var permParameter = tempCompound.Parameter(permeabilityParameterName);
                permParameter.Editable = false;
                permParameter.Name     = alternative.Name;
                yield return(permParameter);
            }
        }