コード例 #1
0
        public override void Execute(IExecutionContext context)
        {
            Description = PKSimConstants.Command.SetProteinTissueLocationDescription(_protein.Localization.ToString(), _localization.ToString());
            var setLocationCommand = new SetExpressionLocalizationInProteinCommand(_protein, _localization, _simulationSubject, context).Run(context);

            Add(setLocationCommand);

            if (_localization.Is(InBloodCells))
            {
                AddRange(updateBloodCellsExpressionParameters(context));
            }

            if (_localization.Is(InVascularEndothelium))
            {
                AddRange(updateVascularEndotheliumExpressionParameters(context));
            }

            if (_localization.Is(InTissue))
            {
                AddRange(updateTissueExpressionParameters(context));
            }

            var expressionProfileUpdater = context.Resolve <IExpressionProfileUpdater>();

            expressionProfileUpdater.SynchronizeAllSimulationSubjectsWithExpressionProfile(_simulationSubject);

            _protein           = null;
            _simulationSubject = null;


            //update properties from first command
            this.UpdatePropertiesFrom(setLocationCommand);
        }
コード例 #2
0
 protected override void Context()
 {
     _protein    = new IndividualOtherProtein();
     _individual = new Individual();
     _context    = A.Fake <IExecutionContext>();
     sut         = new AddMoleculeToIndividualCommand(_protein, _individual, _context);
 }
コード例 #3
0
 protected override void Context()
 {
     base.Context();
     _proteinToRemove = A.Fake <IndividualEnzyme>().WithName("Trlala");
     sut.EditIndividual(_individual);
     A.CallTo(() => _dialogCreator.MessageBoxYesNo(A <string> .Ignored, ViewResult.Yes)).Returns(ViewResult.No);
 }
コード例 #4
0
        private void updateProteinParametersValues(IndividualProtein protein)
        {
            setGlobalParameterValue(protein, CoreConstants.Parameter.REL_EXP_BLOOD_CELL, CoreConstants.Compartment.BloodCells);
            setGlobalParameterValue(protein, CoreConstants.Parameter.REL_EXP_PLASMA, CoreConstants.Compartment.Plasma);
            setGlobalParameterValue(protein, CoreConstants.Parameter.REL_EXP_VASC_ENDO, CoreConstants.Compartment.VascularEndothelium);

            foreach (var expressionContainer in _expressionContainersRetriever.AllContainersFor(_spatialStructure, protein))
            {
                if (expressionContainer.IsBloodCell())
                {
                    setParameterValuesForBloodCells(protein, expressionContainer);
                }
                else if (expressionContainer.IsPlasma())
                {
                    setParameterValuesForPlasma(protein, expressionContainer);
                }
                else if (expressionContainer.IsInterstitial())
                {
                    setParameterValuesForInterstitial(protein, expressionContainer);
                }
                else if (expressionContainer.IsEndosome())
                {
                    setParameterValuesForEndosome(protein, expressionContainer);
                }
                else
                {
                    setParameterValuesForStandardContainer(protein, expressionContainer);
                }
            }
        }
コード例 #5
0
 protected override void Context()
 {
     _protein    = A.Fake <IndividualProtein>();
     _context    = A.Fake <IExecutionContext>();
     _individual = new Individual();
     _individual.AddMolecule(_protein);
     sut = new RemoveMoleculeFromIndividualCommand(_protein, _individual, _context);
 }
コード例 #6
0
 protected override void Context()
 {
     base.Context();
     _enzyme1 = new IndividualOtherProtein().WithName("_enzyme1");
     _enzyme2 = new IndividualEnzyme().WithName("_enzyme2");
     sut.AddMolecule(_enzyme1);
     sut.AddMolecule(_enzyme2);
 }
コード例 #7
0
 public SetTissueLocationCommand(IndividualProtein protein, TissueLocation tissueLocation, IExecutionContext context)
 {
     _protein            = protein;
     BuildingBlockId     = context.BuildingBlockIdContaining(protein);
     _newTissuleLocation = tissueLocation;
     ObjectType          = PKSimConstants.ObjectTypes.Protein;
     CommandType         = PKSimConstants.Command.CommandTypeEdit;
     _proteinId          = _protein.Id;
     context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(protein));
 }
コード例 #8
0
 protected override void Context()
 {
     base.Context();
     _protein = A.Fake <IndividualProtein>();
     _enzyme  = A.Fake <IndividualEnzyme>();
     _moleculeList.AddRange(new[] { _protein, _enzyme });
     _enzymeList.Add(_enzyme);
     _enzymeNode = A.Fake <ITreeNode <IndividualEnzyme> >();
     A.CallTo(() => _treeNodeFactory.CreateFor(_enzyme)).Returns(_enzymeNode);
 }
コード例 #9
0
        public ProteinExpressionDTO MapFrom(IndividualProtein protein)
        {
            var proteinExpressionDTO = new ProteinExpressionDTO(protein);

            foreach (var enzymeExpressionContainer in protein.AllExpressionsContainers())
            {
                addContainerExpression(proteinExpressionDTO, protein, enzymeExpressionContainer);
            }
            return(proteinExpressionDTO);
        }
 public SetProteinIntracellularVascularEndoLocationCommand(IndividualProtein protein, IntracellularVascularEndoLocation newVascularEndoLocation, IExecutionContext context)
 {
     _protein = protein;
     _newVascularEndoLocation = newVascularEndoLocation;
     BuildingBlockId          = context.BuildingBlockIdContaining(protein);
     ObjectType  = PKSimConstants.ObjectTypes.Protein;
     CommandType = PKSimConstants.Command.CommandTypeEdit;
     _proteinId  = _protein.Id;
     context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(_protein));
 }
コード例 #11
0
        public ProteinExpressionDTO MapFrom(IndividualProtein protein)
        {
            var proteinExpressionDTO = new ProteinExpressionDTO(protein);

            foreach (var enzymeExpressionContainer in protein.GetChildren <IMoleculeExpressionContainer>())
            {
                addContainerExpression(proteinExpressionDTO, protein, enzymeExpressionContainer);
            }
            return(proteinExpressionDTO);
        }
コード例 #12
0
 protected override void Context()
 {
     base.Context();
     _selectedOntogeny = new DatabaseOntogeny();
     _individual       = A.Fake <Individual>();
     _protein          = A.Fake <IndividualProtein>();
     _command          = A.Fake <IPKSimCommand>();
     A.CallTo(() => _ontogenyTask.SetOntogenyForMolecule(_protein, _selectedOntogeny, _individual)).Returns(_command);
     sut.Edit(_protein, _individual);
 }
コード例 #13
0
 protected override void Context()
 {
     base.Context();
     _command         = A.Fake <IPKSimCommand>();
     _proteinToRemove = A.Fake <IndividualEnzyme>().WithName("Trlala");
     _proteinType     = "toto";
     A.CallTo(() => _moleculeExpressionTask.RemoveMoleculeFrom(_proteinToRemove, _individual)).Returns(_command);
     A.CallTo(() => _dialogCreator.MessageBoxYesNo(A <string> .Ignored, ViewResult.Yes)).Returns(ViewResult.Yes);
     A.CallTo(() => _entityTask.TypeFor(_proteinToRemove)).Returns(_proteinType);
     sut.EditIndividual(_individual);
 }
        public IndividualProteinDTO MapFrom(IndividualProtein protein, ISimulationSubject simulationSubject)
        {
            var dto = new IndividualProteinDTO(protein);

            simulationSubject.AllMoleculeContainersFor(protein)
            .SelectMany(x => x.AllParameters())
            .Union(protein.AllGlobalExpressionParameters)
            .MapAllUsing(_expressionContainerMapper)
            .Each(dto.AddExpressionParameter);

            return(dto);
        }
 protected override void Context()
 {
     _protein    = new IndividualOtherProtein();
     _population = new RandomPopulation {
         new AdvancedParameterCollection()
     };
     _population.Settings = new RandomPopulationSettings {
         BaseIndividual = new Individual()
     };
     _context = A.Fake <IExecutionContext>();
     sut      = new AddMoleculeToPopulationCommand(_protein, _population, _context);
 }
コード例 #16
0
 public SetExpressionLocalizationCommand(
     IndividualProtein protein,
     Localization localization,
     ISimulationSubject simulationSubject,
     IExecutionContext context)
 {
     _protein           = protein;
     _simulationSubject = simulationSubject;
     _localization      = localization;
     ObjectType         = PKSimConstants.ObjectTypes.Protein;
     CommandType        = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(protein));
 }
コード例 #17
0
 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);
 }
        protected override void Context()
        {
            _context = A.Fake <IExecutionContext>();
            var expressionProfile = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>();

            (_molecule, _)     = expressionProfile;
            _protein           = _molecule.DowncastTo <IndividualProtein>();
            _result            = new QueryExpressionResults(_expressionResults);
            _simulationSubject = A.Fake <ISimulationSubject>();
            sut = new EditIndividualMoleculeExpressionInSimulationSubjectFromQueryCommand(_molecule, _result, _simulationSubject);

            A.CallTo(() => _simulationSubject.AllExpressionParametersFor(_molecule)).Returns(_allExpressionParameters);
        }
コード例 #19
0
        protected override void Context()
        {
            _view = A.Fake <IExpressionLocalizationView>();
            _moleculeExpressionTask = A.Fake <IMoleculeExpressionTask <Individual> >();
            _dialogCreator          = A.Fake <IDialogCreator>();
            sut = new ExpressionLocalizationPresenter <Individual>(_view, _moleculeExpressionTask, _dialogCreator);
            _commandCollector = new PKSimMacroCommand();
            sut.InitializeWith(_commandCollector);
            _molecule   = new IndividualEnzyme();
            _individual = new Individual();
            sut.Edit(_molecule, _individual);

            sut.LocalizationChanged += (o, e) => _notified = true;

            _command = A.Fake <IPKSimCommand>();
            A.CallTo(_moleculeExpressionTask).WithReturnType <ICommand>().Returns(_command);
        }
        private void updateLocalizationForProtein(IndividualProtein protein, IExecutionContext context)
        {
            //special case for blood cells and vascular endothelium. if the value is set > 0. we need to turn on some locations programatically
            var bloodCells = _queryExpressionResults.ExpressionResultFor(CoreConstants.Compartment.BLOOD_CELLS);

            if (bloodCells?.RelativeExpression > 0 && !protein.InBloodCells)
            {
                Add(new SetExpressionLocalizationCommand(protein, Localization.BloodCellsIntracellular, _simulationSubject, context).Run(context));
            }

            var vascularEndothelium = _queryExpressionResults.ExpressionResultFor(CoreConstants.Compartment.VASCULAR_ENDOTHELIUM);

            if (vascularEndothelium?.RelativeExpression > 0 && !protein.InVascularEndothelium)
            {
                Add(new SetExpressionLocalizationCommand(protein, Localization.VascEndosome, _simulationSubject, context).Run(context));
            }
        }
コード例 #21
0
 public SetExpressionLocalizationInProteinCommand(
     IndividualProtein protein,
     Localization localization,
     ISimulationSubject simulationSubject,
     IExecutionContext context, bool setAsFlag = true)
 {
     _protein           = protein;
     _simulationSubject = simulationSubject;
     BuildingBlockId    = context.BuildingBlockIdContaining(protein);
     _newLocalization   = setAsFlag ? _protein.Localization ^ localization : localization;
     ObjectType         = PKSimConstants.ObjectTypes.Protein;
     CommandType        = PKSimConstants.Command.CommandTypeEdit;
     _proteinId         = _protein.Id;
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(protein));
     //This command is not visible. Only required to ensure that we can undo
     Visible = false;
 }
コード例 #22
0
        protected override void Context()
        {
            sut = new ExpressionContainersRetriever();
            var objectPathFactory  = new ObjectPathFactoryForSpecs();
            var entityPathResolver = new EntityPathResolverForSpecs();

            _liver.Add(_intLiver);
            _liver.Add(_cellLiver);
            _liver.Add(_plsLiver);
            _liver.Add(_bcLiver);
            _liver.Add(_endoLiver);

            _kidney.Add(_intKidney);
            _kidney.Add(_cellKidney);
            _kidney.Add(_plsKidney);
            _kidney.Add(_bcKidney);
            _kidney.Add(_endoKidney);

            _lumen.Add(_duodenum);
            _organism.Add(_liver);
            _organism.Add(_kidney);
            _organism.Add(_lumen);

            _protein = new IndividualEnzyme();
            _protein.Add(new MoleculeExpressionContainer {
                OrganPath = objectPathFactory.CreateObjectPathFrom(CoreConstants.Compartment.BloodCells)
            }.WithName(CoreConstants.Compartment.BloodCells));
            _protein.Add(new MoleculeExpressionContainer {
                OrganPath = objectPathFactory.CreateObjectPathFrom(CoreConstants.Compartment.Plasma)
            }.WithName(CoreConstants.Compartment.Plasma));
            _protein.Add(new MoleculeExpressionContainer {
                OrganPath = objectPathFactory.CreateObjectPathFrom(CoreConstants.Compartment.VascularEndothelium)
            }.WithName(CoreConstants.Compartment.VascularEndothelium));
            _protein.Add(new MoleculeExpressionContainer {
                OrganPath = entityPathResolver.ObjectPathFor(_liver)
            }.WithName(CoreConstants.Organ.Liver));
            _protein.Add(new MoleculeExpressionContainer {
                OrganPath = entityPathResolver.ObjectPathFor(_kidney)
            }.WithName(CoreConstants.Organ.Kidney));
            _protein.Add(new MoleculeExpressionContainer {
                OrganPath = entityPathResolver.ObjectPathFor(_lumen), GroupName = CoreConstants.Groups.GI_LUMEN, ContainerName = _duodenum.Name
            }.WithName(CoreConstants.ContainerName.LumenSegmentNameFor("Duodenum")));
        }
コード例 #23
0
        private void setParameterValuesForInterstitial(IndividualProtein protein, IContainer expressionContainer)
        {
            var relExpNormPath = relExpNormPathFor(protein, expressionContainer);
            var relExpPath     = relExpPathFor(protein, expressionContainer);
            var relExpOut      = relExpOutPathFor(protein, expressionContainer);

            setParameterValuesForStandardContainer(protein, expressionContainer);

            //out path now depends on protein configuration
            switch (protein.TissueLocation)
            {
            case TissueLocation.ExtracellularMembrane:
                if (protein.MembraneLocation == MembraneLocation.Apical)
                {
                    trySetFormula(relExpOut, CoreConstants.Rate.RelExpInterstialMembraneExtracellularApical);
                }
                else
                {
                    trySetFormula(relExpOut, CoreConstants.Rate.RelExpInterstialMembraneExtracellularBasolateral);
                }
                break;

            case TissueLocation.Intracellular:
                if (protein.IntracellularVascularEndoLocation == IntracellularVascularEndoLocation.Interstitial)
                {
                    //reset value in interstitial that was set before
                    trySetFormula(relExpNormPath, zeroFormula());
                    trySetFormula(relExpPath, zeroFormula());
                    trySetFormula(relExpOut, CoreConstants.Rate.RelExpInterstialIntraVascEndoIsInterstitial);
                }
                break;

            case TissueLocation.Interstitial:
                trySetFormula(relExpOut, CoreConstants.Rate.RelExpInterstialForInterstitial);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #24
0
        private void setParameterValuesForPlasma(IndividualProtein protein, IContainer expressionContainer)
        {
            trySetFormula(relExpNormPathFor(protein, expressionContainer), CoreConstants.Rate.RelExpPlasmaNormGlobal);
            trySetFormula(relExpPathFor(protein, expressionContainer), CoreConstants.Rate.RelExpPlasmaGlobal);
            var relExpOut = relExpOutPathFor(protein, expressionContainer);

            //out path now depends on protein configuration
            switch (protein.TissueLocation)
            {
            case TissueLocation.ExtracellularMembrane:
                if (protein.MembraneLocation == MembraneLocation.Apical)
                {
                    if (expressionContainer.ParentContainer.IsBloodOrgan())
                    {
                        trySetFormula(relExpOut, CoreConstants.Rate.RelExpPlasmaMembraneExtracellularApicalBloodOrgan);
                    }
                    else
                    {
                        trySetFormula(relExpOut, CoreConstants.Rate.RelExpPlasmaMembraneExtracellularApicalTissueOrgan);
                    }
                }

                else
                {
                    trySetFormula(relExpOut, CoreConstants.Rate.RelExpPlasmaMembraneExtracellularBasolateral);
                }

                break;

            case TissueLocation.Intracellular:
            case TissueLocation.Interstitial:
                trySetFormula(relExpOut, CoreConstants.Rate.RelExpOutFromNorm);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #25
0
 public ICommand SetIntracellularVascularEndoLocation(IndividualProtein protein, IntracellularVascularEndoLocation vascularEndoLocation)
 {
     return(new SetProteinIntracellularVascularEndoLocationCommand(protein, vascularEndoLocation, _executionContext).Run(_executionContext));
 }
コード例 #26
0
 public ICommand SetMembraneLocationFor(IndividualProtein protein, MembraneLocation membraneLocation)
 {
     return(new SetProteinMembraneLocationCommand(protein, membraneLocation, _executionContext).Run(_executionContext));
 }
コード例 #27
0
 public ICommand SetTissueLocationFor(IndividualProtein protein, TissueLocation tissueLocation)
 {
     return(new SetTissueLocationCommand(protein, tissueLocation, _executionContext).Run(_executionContext));
 }
コード例 #28
0
        private void addContainerExpression(ProteinExpressionDTO proteinExpressionDTO, IndividualProtein protein, MoleculeExpressionContainer moleculeExpressionContainer)
        {
            var expressionDTO = new ExpressionContainerDTO {
                MoleculeName = protein.Name, ContainerName = moleculeExpressionContainer.Name
            };

            _expressionContainerDTOUpdater.UpdateProperties(expressionDTO, moleculeExpressionContainer);
            proteinExpressionDTO.AddProteinExpression(expressionDTO);
        }
コード例 #29
0
 private void setParameterValuesForBloodCells(IndividualProtein protein, IContainer expressionContainer)
 {
     trySetFormula(relExpNormPathFor(protein, expressionContainer), CoreConstants.Rate.RelExpBloodCellsNormGlobal);
     trySetFormula(relExpPathFor(protein, expressionContainer), CoreConstants.Rate.RelExpBloodCellsGlobal);
     trySetFormula(relExpOutPathFor(protein, expressionContainer), CoreConstants.Rate.RelExpOutFromNorm);
 }
コード例 #30
0
 private void setParameterValuesForEndosome(IndividualProtein protein, IContainer expressionContainer)
 {
     trySetFormula(relExpNormPathFor(protein, expressionContainer), CoreConstants.Rate.RelExpVascEndoNormGlobal);
     trySetFormula(relExpPathFor(protein, expressionContainer), CoreConstants.Rate.RelExpVascEndoGlobal);
     trySetFormula(relExpOutPathFor(protein, expressionContainer), CoreConstants.Rate.RelExpEndosomal);
 }