コード例 #1
0
        protected override void Context()
        {
            base.Context();

            _simulation      = A.Fake <Simulation>();
            _mixedInhibition = new InhibitionProcess {
                InteractionType = InteractionType.MixedInhibition
            }.WithName("MixedInhibition");
            _competitiveInhibition = new InhibitionProcess {
                InteractionType = InteractionType.CompetitiveInhibition
            }.WithName("CompetitiveInhibition");
            _compound1 = new Compound().WithName("Compound1");
            _compound2 = new Compound().WithName("Compound2");
            _compound2.AddProcess(_mixedInhibition);
            _compound2.AddProcess(_competitiveInhibition);

            _interactionProperties = new InteractionProperties();
            A.CallTo(() => _simulation.InteractionProperties).Returns(_interactionProperties);
            A.CallTo(() => _simulation.Compounds).Returns(new[] { _compound1, _compound2 });

            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _mixedInhibition.Name, CompoundName = _compound2.Name
            });
            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _competitiveInhibition.Name, CompoundName = _compound2.Name
            });
        }
コード例 #2
0
        protected override void Context()
        {
            _simulation       = A.Fake <Simulation>();
            _mixedInhibition1 = new InhibitionProcess {
                InteractionType = InteractionType.MixedInhibition
            }.WithName("MixedInhibition1");
            _mixedInhibition2 = new InhibitionProcess {
                InteractionType = InteractionType.MixedInhibition
            }.WithName("MixedInhibition2");
            _compound1 = new Compound().WithName("Compound1");

            _compound2 = new Compound().WithName("Compound2");
            _compound2.AddProcess(_mixedInhibition1);
            _compound2.AddProcess(_mixedInhibition2);

            _interactionProperties = new InteractionProperties();
            A.CallTo(() => _simulation.InteractionProperties).Returns(_interactionProperties);
            A.CallTo(() => _simulation.Compounds).Returns(new[] { _compound1, _compound2 });

            sut = new MixedInhibitionKineticUpdaterSpecification(new ObjectPathFactoryForSpecs(), A.Fake <IDimensionRepository>(), new InteractionTask());

            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _mixedInhibition1.Name, CompoundName = _compound2.Name
            });
            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _mixedInhibition2.Name, CompoundName = _compound2.Name
            });
        }
コード例 #3
0
        protected override void Context()
        {
            _project          = new PKSimProject();
            _projectRetriever = A.Fake <IProjectRetriever>();
            A.CallTo(() => _projectRetriever.CurrentProject).Returns(_project);

            _compound1          = A.Fake <Compound>();
            _compound1.IsLoaded = false;
            _compound2          = new Compound {
                IsLoaded = true
            };
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "A", Name = "P1"
            });
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "C", Name = "P2"
            });
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "B", Name = "P3"
            });

            _individual1          = A.Fake <Individual>();
            _individual1.IsLoaded = false;
            _individual2          = new Individual {
                IsLoaded = true
            };
            _individual2.AddMolecule(new IndividualEnzyme().WithName("B"));
            _individual2.AddMolecule(new IndividualEnzyme().WithName("D"));

            _project.AddBuildingBlock(_compound1);
            _project.AddBuildingBlock(_compound2);
            _project.AddBuildingBlock(_individual1);
            _project.AddBuildingBlock(_individual2);
            sut = new UsedMoleculeRepository(_projectRetriever);
        }
コード例 #4
0
        protected override void Context()
        {
            _project          = new PKSimProject();
            _projectRetriever = A.Fake <IPKSimProjectRetriever>();
            _transporterContainerTemplateRepository = A.Fake <ITransporterContainerTemplateRepository>();
            A.CallTo(() => _projectRetriever.Current).Returns(_project);

            _compound1          = A.Fake <Compound>();
            _compound1.IsLoaded = false;
            _compound2          = new Compound {
                IsLoaded = true
            };
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "ProjA", Name = "P1"
            });
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "ProjC", Name = "P2"
            });
            _compound2.AddProcess(new EnzymaticProcess {
                MoleculeName = "ProjB", Name = "P3"
            });


            _ontogenyRepository          = A.Fake <IOntogenyRepository>();
            _moleculeParameterRepository = A.Fake <IMoleculeParameterRepository>();

            _expressionProfile          = A.Fake <ExpressionProfile>();
            _expressionProfile.IsLoaded = true;
            A.CallTo(() => _expressionProfile.MoleculeName).Returns("ProjE");

            _project.AddBuildingBlock(_compound1);
            _project.AddBuildingBlock(_compound2);
            _project.AddBuildingBlock(_expressionProfile);
            sut = new UsedMoleculeRepository(_projectRetriever, _ontogenyRepository, _moleculeParameterRepository, _transporterContainerTemplateRepository);

            var molParam1 = new MoleculeParameter {
                MoleculeName = "DbB"
            };
            var molParam2 = new MoleculeParameter {
                MoleculeName = "DbA"
            };

            A.CallTo(() => _moleculeParameterRepository.All()).Returns(new[] { molParam1, molParam2 });
            A.CallTo(() => _transporterContainerTemplateRepository.AllTransporterNames).Returns(new[] { "ATRANS1", "TRANS2" });

            A.CallTo(() => _ontogenyRepository.AllFor(CoreConstants.Species.HUMAN)).Returns(new[] { new DatabaseOntogeny {
                                                                                                        Name = "OntoC"
                                                                                                    } });
        }
コード例 #5
0
        public override void GlobalContext()
        {
            base.GlobalContext();

            _otherCompound = DomainFactoryForSpecs.CreateStandardCompound().WithName("OtherCompound");
            _otherProtocol = DomainFactoryForSpecs.CreateStandardIVBolusProtocol().WithName("OtherProtocol");
            _otherCompound.AddProcess(_cloneManager.Clone(_metabolizationProcess));

            _simulation = DomainFactoryForSpecs.CreateModelLessSimulationWith(_individual, new[] { _compound, _otherCompound }, new[] { _protocol, _otherProtocol, })
                          .DowncastTo <IndividualSimulation>();

            _simulation.CompoundPropertiesFor(_compound.Name)
            .Processes
            .MetabolizationSelection
            .AddPartialProcessSelection(new EnzymaticProcessSelection {
                CompoundName = _compound.Name, ProcessName = _metabolizationProcess.Name, MoleculeName = _enzyme.Name
            });

            _simulation.CompoundPropertiesFor(_otherCompound.Name)
            .Processes
            .MetabolizationSelection
            .AddPartialProcessSelection(new EnzymaticProcessSelection {
                CompoundName = _otherCompound.Name, ProcessName = _metabolizationProcess.Name, MoleculeName = _enzyme.Name
            });

            DomainFactoryForSpecs.AddModelToSimulation(_simulation);
        }
コード例 #6
0
 public override void GlobalContext()
 {
     base.GlobalContext();
     _compoundProcessRepository = IoC.Resolve <ICompoundProcessRepository>();
     _cloneManager                 = IoC.Resolve <ICloneManager>();
     _enzymeFactory                = IoC.Resolve <IIndividualEnzymeFactory>();
     _transporterFactory           = IoC.Resolve <IIndividualTransporterFactory>();
     _modelPropertiesTask          = IoC.Resolve <IModelPropertiesTask>();
     _modelConfigurationRepository = IoC.Resolve <IModelConfigurationRepository>();
     _compound   = DomainFactoryForSpecs.CreateStandardCompound();
     _individual = DomainFactoryForSpecs.CreateStandardIndividual();
     _protocol   = DomainFactoryForSpecs.CreateStandardIVBolusProtocol();
     _enzyme     = _enzymeFactory.CreateFor(_individual).DowncastTo <IndividualEnzyme>().WithName("CYP");
     _enzyme.GetRelativeExpressionNormParameterFor(CoreConstants.Compartment.Plasma).Value              = _relExpNormPls;
     _enzyme.GetRelativeExpressionNormParameterFor(CoreConstants.Compartment.BloodCells).Value          = _relExpNormBloodCells;
     _enzyme.GetRelativeExpressionNormParameterFor(CoreConstants.Compartment.VascularEndothelium).Value = _relExpVascEndo;
     _individual.AddMolecule(_enzyme);
     _hct = _individual.Organism.Parameter(CoreConstants.Parameters.HCT).Value;
     _metabolizationProcess      = _cloneManager.Clone(_compoundProcessRepository.ProcessByName(CoreConstantsForSpecs.Process.METABOLIZATION_SPECIFIC_FIRST_ORDER).DowncastTo <PartialProcess>());
     _metabolizationProcess.Name = "My Partial Process";
     _metabolizationProcess.Parameter(ConverterConstants.Parameter.CLspec).Value = 15;
     _compound.AddProcess(_metabolizationProcess);
     _simulationRunOptions = new SimulationRunOptions {
         RaiseEvents = false
     };
 }
        public override void GlobalContext()
        {
            base.GlobalContext();
            _buildConfigurationTask = IoC.Resolve <IBuildConfigurationTask>();
            _entityPathResolver     = IoC.Resolve <IEntityPathResolver>();
            var enzymeFactory             = IoC.Resolve <IIndividualEnzymeFactory>();
            var compoundProcessRepository = IoC.Resolve <ICompoundProcessRepository>();
            var cloneManager = IoC.Resolve <ICloneManager>();

            _compound              = DomainFactoryForSpecs.CreateStandardCompound();
            _individual            = DomainFactoryForSpecs.CreateStandardIndividual();
            _protocol              = DomainFactoryForSpecs.CreateStandardIVBolusProtocol();
            _enzyme                = enzymeFactory.AddMoleculeTo(_individual, "CYP").DowncastTo <IndividualEnzyme>();
            _metabolizationProcess = cloneManager.Clone(compoundProcessRepository
                                                        .ProcessByName(CoreConstantsForSpecs.Process.METABOLIZATION_SPECIFIC_FIRST_ORDER).DowncastTo <PartialProcess>());
            _metabolizationProcess.Name = "My Partial Process";
            _metabolizationProcess.Parameter(ConverterConstants.Parameters.CLspec).Value = 15;
            _compound.AddProcess(_metabolizationProcess);

            _simulation = DomainFactoryForSpecs.CreateModelLessSimulationWith(_individual, _compound, _protocol)
                          .DowncastTo <IndividualSimulation>();

            _simulation.CompoundPropertiesList.First()
            .Processes
            .MetabolizationSelection
            .AddPartialProcessSelection(new EnzymaticProcessSelection {
                ProcessName = _metabolizationProcess.Name, MoleculeName = _enzyme.Name
            });

            DomainFactoryForSpecs.AddModelToSimulation(_simulation);
        }
        protected override void Context()
        {
            _interactionProcessRetriever = A.Fake <IInteractionProcessRetriever>();
            _view = A.Fake <ISimulationCompoundInteractionSelectionView>();
            sut   = new SimulationCompoundInteractionSelectionPresenter(_view, _interactionProcessRetriever);

            _interactionProperties             = new InteractionProperties();
            _allSimulationInteractionProcesses = new List <SimulationPartialProcess>();
            _simulation = A.Fake <Simulation>();
            var individual = new Individual().WithName("Enzyme");

            _molecule1      = new IndividualEnzyme().WithName("CYP3A4");
            _undefinedLiver = new IndividualEnzyme().WithName(CoreConstants.Molecule.UndefinedLiver);
            individual.AddMolecule(_molecule1);
            individual.AddMolecule(_undefinedLiver);

            _interactionProcess1 = new InhibitionProcess().WithName("INTERACTION1");
            _interactionProcess2 = new InhibitionProcess().WithName("INTERACTION2");
            _interactionProcess3 = new InhibitionProcess().WithName("INTERACTION3");
            var comp1 = new Compound();

            comp1.AddProcess(_interactionProcess1);
            var comp2 = new Compound();

            comp2.AddProcess(_interactionProcess2);
            comp2.AddProcess(_interactionProcess3);

            _allSimulationInteractionProcesses.Add(new SimulationPartialProcess {
                CompoundProcess = _interactionProcess1, IndividualMolecule = _molecule1
            });
            _allSimulationInteractionProcesses.Add(new SimulationPartialProcess {
                CompoundProcess = _interactionProcess2, IndividualMolecule = _molecule1
            });

            A.CallTo(() => _simulation.InteractionProperties).Returns(_interactionProperties);
            A.CallTo(() => _simulation.Individual).Returns(individual);
            A.CallTo(() => _simulation.Compounds).Returns(new[] { comp1, comp2 });

            A.CallTo(_interactionProcessRetriever).WithReturnType <IReadOnlyList <SimulationPartialProcess> >()
            .Invokes(x => _useDefaultMap = x.GetArgument <bool>(2))
            .Returns(_allSimulationInteractionProcesses);

            A.CallTo(() => _view.BindTo(A <IEnumerable <SimulationInteractionProcessSelectionDTO> > ._))
            .Invokes(x => _allSimulationInteractionProcessSelectionDTO = x.GetArgument <IEnumerable <SimulationInteractionProcessSelectionDTO> >(0));
        }
コード例 #9
0
        private SystemicProcess addLiverPlasmaClearanceTo(Compound compound)
        {
            var liverClearance = _cloneManager.Clone(_compoundProcessRepository.ProcessByName(CoreConstantsForSpecs.Process.LIVER_CLEARANCE).DowncastTo <SystemicProcess>());

            liverClearance.Name = "My Liver Process";
            liverClearance.Parameter(ConverterConstants.Parameter.PlasmaClearance).Value = 10;
            compound.AddProcess(liverClearance);
            return(liverClearance);
        }
コード例 #10
0
        protected EnzymaticProcess AddEnzymaticProcess(Compound compound, IndividualEnzyme enzyme)
        {
            var compoundProcessRepository = IoC.Resolve <ICompoundProcessRepository>();
            var cloneManager     = IoC.Resolve <ICloneManager>();
            var enzymaticProcess = cloneManager.Clone(compoundProcessRepository.ProcessByName(CoreConstantsForSpecs.Process.METABOLIZATION_SPECIFIC_FIRST_ORDER).DowncastTo <EnzymaticProcess>());

            enzymaticProcess.Name         = "My Partial Process " + enzyme.Name;
            enzymaticProcess.MoleculeName = enzyme.Name;
            enzymaticProcess.Parameter(ConverterConstants.Parameters.CLspec).Value = 10;
            compound.AddProcess(enzymaticProcess);
            return(enzymaticProcess);
        }
        protected override void Context()
        {
            _simulation = A.Fake <Simulation>();
            _irreversibleInhibition1 = new InhibitionProcess {
                InteractionType = InteractionType.IrreversibleInhibition
            }.WithName("IrreversibleInhibition1");
            _irreversibleInhibition2 = new InhibitionProcess {
                InteractionType = InteractionType.IrreversibleInhibition
            }.WithName("IrreversibleInhibition2");
            _uncompetitiveInhibition = new InhibitionProcess {
                InteractionType = InteractionType.UncompetitiveInhibition
            }.WithName("UncompetitiveInhibition");
            _compound1 = new Compound().WithName("Compound1");
            _compound1.AddProcess(_irreversibleInhibition1);
            _compound1.AddProcess(_uncompetitiveInhibition);

            _compound2 = new Compound().WithName("Compound2");
            _compound2.AddProcess(_irreversibleInhibition2);

            _interactionProperties = new InteractionProperties();
            A.CallTo(() => _simulation.InteractionProperties).Returns(_interactionProperties);
            A.CallTo(() => _simulation.Compounds).Returns(new[] { _compound1, _compound2 });

            _objectPathFactory   = new ObjectPathFactoryForSpecs();
            _dimensionRepository = A.Fake <IDimensionRepository>();
            _interactionTask     = new InteractionTask();
            sut = new IrreversibleInhibitionKineticUpdaterSpecification(_objectPathFactory, _dimensionRepository, _interactionTask);

            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _irreversibleInhibition1.Name, CompoundName = _compound1.Name
            });
            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _irreversibleInhibition2.Name, CompoundName = _compound2.Name
            });
            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _uncompetitiveInhibition.Name, CompoundName = _compound2.Name
            });
        }
コード例 #12
0
        protected override void Context()
        {
            base.Context();
            _moleculeMappable        = new IndividualEnzyme().WithName("MoleculeMapped");
            _moleculeAlreadySelected = new IndividualEnzyme().WithName("MoleculeAlreadySelected");
            _moleculeNotMapped       = new IndividualEnzyme().WithName("MoleculeNotMapped");
            _inhibitionProcess1      = new InhibitionProcess().WithName("InhibitionProcess1");
            _inhibitionProcess2      = new InhibitionProcess().WithName("InhibitionProcess2");
            _inductionProcess1       = new InductionProcess().WithName("InductionProcess1");
            _inhibitionProcess3      = new InhibitionProcess().WithName("InhibitionProcess3");

            _individual.AddMolecule(_moleculeNotMapped);
            _individual.AddMolecule(_moleculeMappable);
            _individual.AddMolecule(_moleculeAlreadySelected);

            _compound.AddProcess(_inhibitionProcess1);

            _compound2 = new Compound().WithName("Comp2");
            _compound2.AddProcess(_inhibitionProcess2);
            _inhibitionProcess2.MoleculeName = _moleculeMappable.Name;

            _compound2.AddProcess(_inhibitionProcess3);
            _inhibitionProcess3.MoleculeName = _moleculeMappable.Name;

            _compound2.AddProcess(_inductionProcess1);
            _inductionProcess1.MoleculeName = _moleculeMappable.Name;

            var interactionProperties = new InteractionProperties();

            interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeAlreadySelected.Name, ProcessName = _inhibitionProcess1.Name, CompoundName = _compound.Name
            });

            A.CallTo(() => _simulation.InteractionProperties).Returns(interactionProperties);
            A.CallTo(() => _simulation.Compounds).Returns(new[] { _compound, _compound2 });
        }
コード例 #13
0
ファイル: CompoundTaskSpecs.cs プロジェクト: valdiman/PK-Sim
        protected override void Context()
        {
            base.Context();
            _metabolite    = new Compound().WithName("METABOLITE");
            _subMetabolite = new Compound().WithName("SUB_METABOLITE");
            _compound.AddProcess(new EnzymaticProcess {
                MetaboliteName = _metabolite.Name
            });
            _metabolite.AddProcess(new EnzymaticProcess {
                MetaboliteName = _subMetabolite.Name
            });
            A.CallTo(() => _buildingBlockRepository.All <Compound>()).Returns(new[] { _compound, _metabolite, _subMetabolite });

            A.CallTo(() => _buildingBlockTask.LoadFromTemplate <Compound>(PKSimBuildingBlockType.Compound)).Returns(new[] { _compound, _metabolite, _subMetabolite });
        }
コード例 #14
0
ファイル: CompoundTaskSpecs.cs プロジェクト: valdiman/PK-Sim
 protected override void Context()
 {
     base.Context();
     _metabolite    = new Compound().WithName("METABOLITE");
     _subMetabolite = new Compound().WithName("SUB_METABOLITE");
     _compound.AddProcess(new EnzymaticProcess {
         MetaboliteName = _metabolite.Name
     });
     _metabolite.AddProcess(new EnzymaticProcess {
         MetaboliteName = _subMetabolite.Name
     });
     _subMetabolite.AddProcess(new EnzymaticProcess {
         MetaboliteName = _compound.Name
     });
     A.CallTo(() => _buildingBlockRepository.All <Compound>()).Returns(new[] { _compound, _metabolite, _subMetabolite });
     A.CallTo(_dialogCreator).WithReturnType <ViewResult>().Returns(ViewResult.Yes);
 }
コード例 #15
0
        protected override void Context()
        {
            base.Context();
            _compound1 = new Compound().WithName(_drugName);
            _compound1.AddProcess(_uncompetitiveInhibition1);

            _compound2 = new Compound().WithName("Compound2");
            _compound2.AddProcess(_uncompetitiveInhibition2);

            A.CallTo(() => _simulation.Compounds).Returns(new[] { _compound1, _compound2 });

            _interactionProperties.ClearInteractions();

            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _uncompetitiveInhibition1.Name, CompoundName = _compound1.Name
            });
            _interactionProperties.AddInteraction(new InteractionSelection {
                MoleculeName = _moleculeName, ProcessName = _uncompetitiveInhibition2.Name, CompoundName = _compound2.Name
            });
        }
コード例 #16
0
        protected override void Context()
        {
            base.Context();
            _formulaCache = new FormulaCache();
            _protein      = new MoleculeBuilder().WithName("CYP3A4");

            _interactionProcess = new InductionProcess().WithName("Induction");
            _interactionProcess.InternalName = "AA";

            _compound = new Compound().WithName("Inhibitor");
            _compound.AddProcess(_interactionProcess);

            _template = new PKSimReaction();
            A.CallTo(() => _simulationActiveProcessRepository.ProcessFor <PKSimReaction>(_interactionProcess.InternalName)).Returns(_template);

            var reaction = new PKSimReaction {
                Formula = new ExplicitFormula().WithName("ABC")
            };

            reaction.Formula.AddObjectPath(new FormulaUsablePath(CoreConstants.KeyWords.Protein, "P1").WithAlias("P1"));
            reaction.Formula.AddObjectPath(new FormulaUsablePath(CoreConstants.KeyWords.Reaction, "R1").WithAlias("R1"));
            reaction.Formula.AddObjectPath(new FormulaUsablePath(CoreConstants.KeyWords.Molecule, "M11").WithAlias("M1"));
            A.CallTo(() => _cloneManager.Clone <IReactionBuilder>(_template)).Returns(reaction);
        }