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);
        }
Example #2
0
 public Converter740To80(
     ICompoundFactory compoundFactory,
     ICloner cloner)
 {
     _templateCompound = new Lazy <Compound>(compoundFactory.Create);
     _cloner           = cloner;
 }
Example #3
0
 public ObservedDataToCompoundMappingPresenter(IObservedDataToCompoundMappingView view, ICompoundFactory compoundFactory) : base(view)
 {
     _compoundFactory       = compoundFactory;
     _undefinedCompound     = _compoundFactory.Create().WithName(PKSimConstants.UI.Undefined);
     _allAvailableCompounds = new List <PKSim.Core.Model.Compound> {
         _undefinedCompound
     };
     view.CancelVisible = false;
 }
 public CreateCompoundPresenter(ICreateCompoundView view, ISubPresenterItemManager <ICompoundItemPresenter> subPresenterItemManager, IDialogCreator dialogCreator,
                                ICompoundFactory compoundFactory, IObjectBaseDTOFactory objectBaseDTOFactory, IBuildingBlockPropertiesMapper propertiesMapper)
     : base(view, subPresenterItemManager, CompoundItems.All, dialogCreator)
 {
     _compoundFactory      = compoundFactory;
     _objectBaseDTOFactory = objectBaseDTOFactory;
     _propertiesMapper     = propertiesMapper;
     AllowQuickFinish      = true;
 }
Example #5
0
 public CompoundMapper(
     ParameterMapper parameterMapper,
     AlternativeMapper alternativeMapper,
     CalculationMethodCacheMapper calculationMethodCacheMapper,
     CompoundProcessMapper processMapper,
     ICompoundFactory compoundFactory) : base(parameterMapper)
 {
     _alternativeMapper            = alternativeMapper;
     _calculationMethodCacheMapper = calculationMethodCacheMapper;
     _processMapper   = processMapper;
     _compoundFactory = compoundFactory;
 }
 protected override void Context()
 {
     _parameterAlternativeFactory = A.Fake <IParameterAlternativeFactory>();
     _applicationController       = A.Fake <IApplicationController>();
     _executionContext            = A.Fake <IExecutionContext>();
     _entityTask              = A.Fake <IEntityTask>();
     _formulaFactory          = A.Fake <IFormulaFactory>();
     _parameterTask           = A.Fake <IParameterTask>();
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     _compoundFactory         = new CompoundFactoryForSpecs();
     sut = new CompoundAlternativeTask(_parameterAlternativeFactory, _applicationController,
                                       _executionContext, _compoundFactory, _entityTask, _formulaFactory, _parameterTask, _buildingBlockRepository);
 }
Example #7
0
 public CompoundAlternativeTask(IParameterAlternativeFactory parameterAlternativeFactory, IApplicationController applicationController,
                                IExecutionContext executionContext, ICompoundFactory compoundFactory, IEntityTask entityTask,
                                IFormulaFactory formulaFactory, IParameterTask parameterTask, IBuildingBlockRepository buildingBlockRepository)
 {
     _parameterAlternativeFactory = parameterAlternativeFactory;
     _applicationController       = applicationController;
     _executionContext            = executionContext;
     _compoundFactory             = compoundFactory;
     _entityTask              = entityTask;
     _formulaFactory          = formulaFactory;
     _parameterTask           = parameterTask;
     _buildingBlockRepository = buildingBlockRepository;
 }
Example #8
0
 public CompoundMapper(ICompoundFactory compoundFactory, ICompoundProcessRepository compoundProcessRepository,
                       IBatchLogger batchLogger, ICloner cloner,
                       ICompoundCalculationMethodCategoryRepository calculationMethodCategoryRepository,
                       ICalculationMethodRepository calculationMethodRepository, ICompoundProcessTask compoundProcessTask, ISpeciesRepository speciesRepository)
 {
     _compoundFactory           = compoundFactory;
     _compoundProcessRepository = compoundProcessRepository;
     _batchLogger = batchLogger;
     _cloner      = cloner;
     _calculationMethodCategoryRepository = calculationMethodCategoryRepository;
     _calculationMethodRepository         = calculationMethodRepository;
     _compoundProcessTask = compoundProcessTask;
     _speciesRepository   = speciesRepository;
 }
 protected override void Context()
 {
     _parameterAlternativeFactory = A.Fake <IParameterAlternativeFactory>();
     _executionContext            = A.Fake <IExecutionContext>();
     _formulaFactory          = A.Fake <IFormulaFactory>();
     _parameterTask           = A.Fake <IParameterTask>();
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     _dimensionRepository     = A.Fake <IDimensionRepository>();
     _dataImporter            = A.Fake <IDataImporter>();
     _compoundFactory         = new CompoundFactoryForSpecs();
     sut = new CompoundAlternativeTask(_parameterAlternativeFactory,
                                       _executionContext, _compoundFactory, _formulaFactory, _parameterTask,
                                       _buildingBlockRepository, _dimensionRepository, _dataImporter);
 }
Example #10
0
 public CompoundAlternativeTask(
     IParameterAlternativeFactory parameterAlternativeFactory,
     IExecutionContext executionContext,
     ICompoundFactory compoundFactory,
     IFormulaFactory formulaFactory,
     IParameterTask parameterTask,
     IBuildingBlockRepository buildingBlockRepository,
     IDimensionRepository dimensionRepository,
     IDataImporter dataImporter)
 {
     _parameterAlternativeFactory = parameterAlternativeFactory;
     _executionContext            = executionContext;
     _compoundFactory             = compoundFactory;
     _formulaFactory          = formulaFactory;
     _parameterTask           = parameterTask;
     _buildingBlockRepository = buildingBlockRepository;
     _dimensionRepository     = dimensionRepository;
     _dataImporter            = dataImporter;
 }
Example #11
0
        protected override Task Context()
        {
            _alternativeMapper            = A.Fake <AlternativeMapper>();
            _parameterMapper              = A.Fake <ParameterMapper>();
            _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>();
            _processMapper   = A.Fake <CompoundProcessMapper>();
            _compoundFactory = A.Fake <ICompoundFactory>();
            sut = new CompoundMapper(_parameterMapper, _alternativeMapper, _calculationMethodCacheMapper, _processMapper, _compoundFactory);

            _compound = new Model.Compound
            {
                Name        = "Compound",
                Description = "Description"
            };

            addPkAParameters(_compound, 0, 8, CompoundType.Base);
            addPkAParameters(_compound, 1, 4, CompoundType.Acid);
            addPkAParameters(_compound, 2, 7, CompoundType.Neutral);

            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_LIPOPHILICITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_FRACTION_UNBOUND));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_SOLUBILITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_INTESTINAL_PERMEABILITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_PERMEABILITY));

            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.IS_SMALL_MOLECULE));
            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue((int)PlasmaProteinBindingPartner.Glycoprotein).WithName(CoreConstants.Parameters.PLASMA_PROTEIN_BINDING_PARTNER));

            _partialProcess  = new EnzymaticProcess().WithName("EnzymaticProcess");
            _systemicProcess = new SystemicProcess().WithName("SystemicProcess");
            _compound.AddProcess(_partialProcess);
            _compound.AddProcess(_systemicProcess);

            _calculationMethodCacheSnapshot = new CalculationMethodCache();
            A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compound.CalculationMethodCache)).Returns(_calculationMethodCacheSnapshot);

            _snapshotProcess1 = new CompoundProcess();
            _snapshotProcess2 = new CompoundProcess();
            A.CallTo(() => _processMapper.MapToSnapshot(_partialProcess)).Returns(_snapshotProcess1);
            A.CallTo(() => _processMapper.MapToSnapshot(_systemicProcess)).Returns(_snapshotProcess2);

            return(_completed);
        }
Example #12
0
 public Converter721To730(
     ICompoundFactory compoundFactory,
     ICloner cloner,
     ICreationMetaDataFactory creationMetaDataFactory,
     IContainerTask containerTask,
     IFormulationRepository formulationRepository,
     IEventGroupRepository eventGroupRepository,
     Converter710To730 coreConverter,
     ICompoundProcessRepository compoundProcessRepository,
     ISchemaItemRepository schemaItemRepository
     )
 {
     _compoundFactory           = compoundFactory;
     _cloner                    = cloner;
     _creationMetaDataFactory   = creationMetaDataFactory;
     _containerTask             = containerTask;
     _formulationRepository     = formulationRepository;
     _eventGroupRepository      = eventGroupRepository;
     _coreConverter             = coreConverter;
     _compoundProcessRepository = compoundProcessRepository;
     _schemaItemRepository      = schemaItemRepository;
 }
Example #13
0
        protected override Task Context()
        {
            _parameterMapper              = A.Fake <ParameterMapper>();
            _alternativeMapper            = A.Fake <AlternativeMapper>();
            _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>();
            _processMapper     = A.Fake <CompoundProcessMapper>();
            _compoundFactory   = A.Fake <ICompoundFactory>();
            _valueOriginMapper = A.Fake <ValueOriginMapper>();
            sut = new CompoundMapper(_parameterMapper, _alternativeMapper, _calculationMethodCacheMapper, _processMapper, _valueOriginMapper, _compoundFactory);

            _compound = new Model.Compound
            {
                Name        = "Compound",
                Description = "Description"
            };
            _pkaValueOrigin = new ValueOrigin {
                Method = ValueOriginDeterminationMethods.InVitro, Description = "PKA"
            };
            _snapshotValueOrigin = new Snapshots.ValueOrigin {
                Method = ValueOriginDeterminationMethodId.InVivo, Description = "PKA"
            };

            addPkAParameters(_compound, 0, 8, CompoundType.Base);
            addPkAParameters(_compound, 1, 4, CompoundType.Acid);
            addPkAParameters(_compound, 2, 7, CompoundType.Neutral);

            _compoundIntestinalPermeabilityAlternativeGroup = createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_INTESTINAL_PERMEABILITY);
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_LIPOPHILICITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_FRACTION_UNBOUND));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_SOLUBILITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_PERMEABILITY));
            _compound.AddParameterAlternativeGroup(_compoundIntestinalPermeabilityAlternativeGroup);

            _compoundIntestinalPermeabilityAlternativeGroup.DefaultAlternative.IsDefault = true;
            //Calculated alternative will not be the default alternative for intestinal perm
            _calculatedAlternative = new ParameterAlternative {
                Name = PKSimConstants.UI.CalculatedAlernative, IsDefault = false
            };
            _compoundIntestinalPermeabilityAlternativeGroup.AddAlternative(_calculatedAlternative);
            //Mapping of a calculated alternative returns null
            A.CallTo(() => _alternativeMapper.MapToSnapshot(_calculatedAlternative)).Returns(Task.FromResult <Alternative>(null));

            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.IS_SMALL_MOLECULE));
            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue((int)PlasmaProteinBindingPartner.Glycoprotein).WithName(CoreConstants.Parameters.PLASMA_PROTEIN_BINDING_PARTNER));

            _partialProcess  = new EnzymaticProcess().WithName("EnzymaticProcess");
            _systemicProcess = new SystemicProcess().WithName("SystemicProcess");
            _compound.AddProcess(_partialProcess);
            _compound.AddProcess(_systemicProcess);

            _calculationMethodCacheSnapshot = new CalculationMethodCache();
            A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compound.CalculationMethodCache)).Returns(_calculationMethodCacheSnapshot);

            _snapshotProcess1 = new CompoundProcess();
            _snapshotProcess2 = new CompoundProcess();
            A.CallTo(() => _processMapper.MapToSnapshot(_partialProcess)).Returns(_snapshotProcess1);
            A.CallTo(() => _processMapper.MapToSnapshot(_systemicProcess)).Returns(_snapshotProcess2);

            _molweightParameter = DomainHelperForSpecs.ConstantParameterWithValue(400).WithName(Constants.Parameters.MOL_WEIGHT);
            _molweightParameter.ValueOrigin.Method = ValueOriginDeterminationMethods.InVivo;

            //Do not update F value origin to ensure that it's being synchronized when mapping from snapshot
            _halogenFParameter = DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(Constants.Parameters.F);

            _compound.Add(_molweightParameter);
            _compound.Add(_halogenFParameter);
            return(_completed);
        }
Example #14
0
 public CompoundBuilder(ICompoundFactory <TInA, TInB, TResult> factory) => _factory = factory;
Example #15
0
 public CompoundConverter(ICompoundFactory compoundFactory, ICloner cloner)
 {
     _compoundFactory = compoundFactory;
     _cloner          = cloner;
 }