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); }
private void addUndefinedLiverTransporter() { var undefinedLiverTransporter = _individual.MoleculeByName <IndividualTransporter>(CoreConstants.Molecule.UndefinedLiverTransporter); //Already added if (undefinedLiverTransporter != null) { return; } undefinedLiverTransporter = _individualTransporterFactory.UndefinedLiverTransporterFor(_individual); _individual.AddMolecule(undefinedLiverTransporter); }
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 IndividualTransporter AddUndefinedLiverTransporterTo(Individual individual) { var transporter = CreateMolecule(CoreConstants.Molecule.UndefinedLiverTransporter); AddOntogenyParameterTo(transporter); transporter.TransportType = TransportType.Efflux; var liver = individual.Organism.Organ(CoreConstants.Organ.LIVER); LiverZones.Each(zoneName => { var zone = liver.Compartment(zoneName); var intracellular = zone.Container(INTRACELLULAR); addContainerExpression(intracellular, transporter, TransportDirectionId.ExcretionLiver, RelExpParam(REL_EXP), FractionParam(FRACTION_EXPRESSED_APICAL, CoreConstants.Rate.ONE_RATE), InitialConcentrationParam(CoreConstants.Rate.INITIAL_CONCENTRATION_INTRACELLULAR_TRANSPORTER) ); var relExpParameter = intracellular.EntityAt <IParameter>(transporter.Name, REL_EXP); relExpParameter.Value = 1; relExpParameter.DefaultValue = 1; }); _individualPathWithRootExpander.AddRootToPathIn(individual, transporter.Name); individual.AddMolecule(transporter); return(transporter); }
public IndividualEnzyme AddUndefinedLiverTo(Individual individual) { var undefinedLiver = CreateMolecule(CoreConstants.Molecule.UndefinedLiver); AddOntogenyParameterTo(undefinedLiver); undefinedLiver.Localization = Localization.Intracellular; undefinedLiver.ReferenceConcentration.Visible = false; undefinedLiver.HalfLifeLiver.Visible = false; undefinedLiver.HalfLifeIntestine.Visible = false; var liver = individual.Organism.Organ(CoreConstants.Organ.LIVER); CoreConstants.Compartment.LiverZones.Each(zoneName => { var zone = liver.Container(zoneName); var intracellular = zone.Container(CoreConstants.Compartment.INTRACELLULAR); AddContainerExpression(intracellular, undefinedLiver.Name, RelExpParam(REL_EXP), FractionParam(FRACTION_EXPRESSED_INTRACELLULAR, CoreConstants.Rate.ONE_RATE), InitialConcentrationParam(CoreConstants.Rate.INITIAL_CONCENTRATION_INTRACELLULAR) ); var relExpParameter = intracellular.EntityAt <IParameter>(undefinedLiver.Name, REL_EXP); relExpParameter.Value = 1; relExpParameter.DefaultValue = 1; }); _individualPathWithRootExpander.AddRootToPathIn(individual, undefinedLiver.Name); individual.AddMolecule(undefinedLiver); return(undefinedLiver); }
protected override void Context() { _protein = A.Fake <IndividualProtein>(); _context = A.Fake <IExecutionContext>(); _individual = new Individual(); _individual.AddMolecule(_protein); sut = new RemoveMoleculeFromIndividualCommand(_protein, _individual, _context); }
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)); }
public void Update(Individual sourceIndividual, Individual targetIndividual) { foreach (var molecule in sourceIndividual.AllMolecules()) { var newMolecule = _cloner.Clone(molecule); targetIndividual.AddMolecule(newMolecule); //we have to reset the new ontogeny for the molecule _ontogenyTask.SetOntogenyForMolecule(newMolecule, newMolecule.Ontogeny, targetIndividual); } }
protected IndividualEnzyme AddEnzymeTo(Individual individual, string enzymeName) { var enzymeFactory = IoC.Resolve <IIndividualEnzymeFactory>(); var enzyme = enzymeFactory.CreateFor(_individual).DowncastTo <IndividualEnzyme>().WithName(enzymeName); enzyme.GetRelativeExpressionNormParameterFor(CoreConstants.Compartment.Pericentral).Value = 1; enzyme.GetRelativeExpressionNormParameterFor(CoreConstants.Compartment.Periportal).Value = 1; individual.AddMolecule(enzyme); return(enzyme); }
protected override void Context() { base.Context(); _allParameters.Clear(); _allParameters.Add(_para1); _individual = new Individual().WithName("toto"); _individualMolecule = new IndividualEnzyme(); _para1.Name = CoreConstants.Parameters.REFERENCE_CONCENTRATION; _individualMolecule.Add(_para1); _individualMolecule.Name = "CYP3A4"; _individual.AddMolecule(_individualMolecule); }
protected IndividualEnzyme AddEnzymeTo(Individual individual, string enzymeName) { var enzymeFactory = IoC.Resolve <IIndividualEnzymeFactory>(); var enzyme = enzymeFactory.AddMoleculeTo(_individual, enzymeName).DowncastTo <IndividualEnzyme>(); var allExpressionParameters = _individual.AllExpressionParametersFor(enzyme); allExpressionParameters[CoreConstants.Compartment.PERICENTRAL].Value = 1; allExpressionParameters[CoreConstants.Compartment.PERIPORTAL].Value = 1; individual.AddMolecule(enzyme); return(enzyme); }
protected override void Context() { _protein = new IndividualOtherProtein().WithName("CYP3A4"); _context = A.Fake <IExecutionContext>(); _organism = new Organism(); _liver = new Organ().WithName("liver").WithParentContainer(_organism); _localMoleculeContainer = new Container().WithName(_protein.Name).WithParentContainer(_liver); _individual = new Individual { _organism }; _individual.AddMolecule(_protein); sut = new RemoveMoleculeFromIndividualCommand(_protein, _individual, _context); }
public void Update(Individual sourceIndividual, Individual targetIndividual) { foreach (var molecule in sourceIndividual.AllMolecules()) { var newMolecule = _cloner.Clone(molecule); targetIndividual.AddMolecule(newMolecule); //Make sure parameters that user defined parameters are reset to default to ensure proper scaling resetMoleculeParametersToDefault(newMolecule); //we have to reset the ontogeny for the molecule based on the target individual properties _ontogenyTask.SetOntogenyForMolecule(newMolecule, newMolecule.Ontogeny, targetIndividual); } }