protected override void PerformExecuteWith(IExecutionContext context)
        {
            //Retrieve building block id in execute only since molecule might have been added in a macro command and bbid was not available in constructor
            BuildingBlockId = context.BuildingBlockIdContaining(_molecule);
            var allRelExpressionContainer = _molecule.AllExpressionsContainers().ToList();
            var max = allRelExpressionContainer.Select(x => x.RelativeExpression).Max();

            allRelExpressionContainer.Each(relExp => relExp.RelativeExpressionNorm = max == 0 ? 0 : relExp.RelativeExpression / max);
        }
Exemplo n.º 2
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));
 }
 public SetSchemaItemTargetCompartmentCommand(ISchemaItem schemaItem, string newTargetCompartment, IExecutionContext context)
 {
     _schemaItem           = schemaItem;
     _newTargetCompartment = newTargetCompartment;
     _schemaItemId         = _schemaItem.Id;
     ObjectType            = PKSimConstants.ObjectTypes.AdministrationProtocol;
     CommandType           = PKSimConstants.Command.CommandTypeEdit;
     BuildingBlockId       = context.BuildingBlockIdContaining(schemaItem);
     context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(schemaItem));
 }
 public SetSchemaItemFormulationKeyCommand(ISchemaItem schemaItem, string newFormulationKey, IExecutionContext context)
 {
     _schemaItem        = schemaItem;
     _newFormulationKey = newFormulationKey;
     _schemaItemId      = _schemaItem.Id;
     ObjectType         = PKSimConstants.ObjectTypes.AdministrationProtocol;
     CommandType        = PKSimConstants.Command.CommandTypeEdit;
     BuildingBlockId    = context.BuildingBlockIdContaining(schemaItem);
     context.UpdateBuildinBlockPropertiesInCommand(this, context.BuildingBlockContaining(schemaItem));
 }
Exemplo n.º 5
0
 public RenameDataSourceCommand(CompoundProcess compoundProcess, string newDataSource, IExecutionContext context)
 {
     _processId       = compoundProcess.Id;
     BuildingBlockId  = context.BuildingBlockIdContaining(compoundProcess);
     _newDataSource   = newDataSource;
     _compoundProcess = compoundProcess;
     ObjectType       = context.TypeFor(compoundProcess);
     CommandType      = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(compoundProcess));
 }
 public ChangeApplicationTypeCommand(ISchemaItem schemaItem, ApplicationType newApplicationType, IExecutionContext context)
 {
     _schemaItem         = schemaItem;
     _schemaItemId       = _schemaItem.Id;
     _newApplicationType = newApplicationType;
     ObjectType          = PKSimConstants.ObjectTypes.AdministrationProtocol;
     CommandType         = PKSimConstants.Command.CommandTypeEdit;
     BuildingBlockId     = context.BuildingBlockIdContaining(schemaItem);
     context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(schemaItem));
 }
 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));
 }
Exemplo n.º 8
0
 public RenameMoleculeInPartialProcessCommand(PKSim.Core.Model.PartialProcess partialProcess, string newMoleculeName, IExecutionContext context)
 {
     _partialPocessId = partialProcess.Id;
     BuildingBlockId  = context.BuildingBlockIdContaining(partialProcess);
     _newMoleculeName = newMoleculeName;
     _partialProcess  = partialProcess;
     ObjectType       = PKSimConstants.ObjectTypes.PartialProcess;
     CommandType      = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildinBlockPropertiesInCommand(this, context.BuildingBlockContaining(partialProcess));
 }
Exemplo n.º 9
0
 public SetProteinMembraneLocationCommand(PKSim.Core.Model.IndividualProtein protein, MembraneLocation membraneLocation, IExecutionContext context)
 {
     _protein             = protein;
     BuildingBlockId      = context.BuildingBlockIdContaining(protein);
     _newMembraneLocation = membraneLocation;
     ObjectType           = PKSimConstants.ObjectTypes.Protein;
     CommandType          = PKSimConstants.Command.CommandTypeEdit;
     _proteinId           = _protein.Id;
     context.UpdateBuildinBlockPropertiesInCommand(this, context.BuildingBlockContaining(_protein));
 }
Exemplo n.º 10
0
 public NormalizeSimulationRelativeExpressionCommand(IParameter parameter, IExecutionContext context)
 {
     _parameter      = parameter;
     ParameterId     = parameter.Id;
     CommandType     = PKSimConstants.Command.CommandTypeEdit;
     ObjectType      = PKSimConstants.ObjectTypes.Protein;
     BuildingBlockId = context.BuildingBlockIdContaining(parameter);
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(parameter));
     //This command is necessary to insure consitency but does not need to be seen
     Visible = false;
 }
        public RenameEntityCommand(IEntity entity, string newName, IExecutionContext context)
        {
            _entity         = entity;
            _newName        = newName;
            _entityId       = entity.Id;
            BuildingBlockId = context.BuildingBlockIdContaining(entity);

            ObjectType  = context.TypeFor(entity);
            CommandType = PKSimConstants.Command.CommandTypeEdit;
            Description = PKSimConstants.Command.RenameEntityCommandDescripiton(ObjectType, entity.Name, _newName);
        }
 public ChangeCompoundProcessInternalNameCommand(CompoundProcess compoundProcess, string internalName, IExecutionContext context)
 {
     _compoundProcess = compoundProcess;
     _internalName    = internalName;
     _processId       = compoundProcess.Id;
     _oldInternalName = _compoundProcess.InternalName;
     BuildingBlockId  = context.BuildingBlockIdContaining(_compoundProcess);
     //This command is necessary to insure consitency but does not need to be seen
     context.UpdateBuildinBlockPropertiesInCommand(this, context.BuildingBlockContaining(_compoundProcess));
     Visible = false;
 }
        public ChangeEnzymaticProcessMetaboliteNameCommand(EnzymaticProcess process, string newMetabolite, IExecutionContext context)
        {
            _process        = process;
            BuildingBlockId = context.BuildingBlockIdContaining(_process);
            _processId      = process.Id;
            _newMetabolite  = newMetabolite;
            CommandType     = PKSimConstants.Command.CommandTypeEdit;
            Description     = PKSimConstants.Command.SetMetaboliteForProcess(_newMetabolite, process.Name, process.MetaboliteName);
            ObjectType      = PKSimConstants.ObjectTypes.MetabolizingEnzyme;

            context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(_process));
        }
Exemplo n.º 14
0
 public SetSpeciesInSpeciesDependentEntityCommand(ISpeciesDependentEntity entity, Species species, IExecutionContext context)
 {
     _entity         = entity;
     _entityId       = entity.Id;
     BuildingBlockId = context.BuildingBlockIdContaining(entity);
     ObjectType      = context.TypeFor(entity);
     CommandType     = PKSimConstants.Command.CommandTypeEdit;
     _oldSpecies     = entity.Species;
     _newSpecies     = species;
     Description     = PKSimConstants.Command.SetSpeciesInSpeciesDependentEntityDescription(context.TypeFor(_entity), entity.Name, _oldSpecies.Name, _newSpecies.Name);
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(entity));
 }
Exemplo n.º 15
0
        public RenameEntityCommand(IEntity entity, string newName, IExecutionContext context)
        {
            _entity         = entity;
            _newName        = newName;
            _entityId       = entity.Id;
            BuildingBlockId = context.BuildingBlockIdContaining(entity);

            //per default, should not change the version of the renamed entity
            ShouldChangeVersion = false;
            ObjectType          = context.TypeFor(entity);
            CommandType         = PKSimConstants.Command.CommandTypeEdit;
            Description         = PKSimConstants.Command.RenameEntityCommandDescripiton(ObjectType, entity.Name, _newName);
        }
 public SetDefaultAlternativeParameterCommand(ParameterAlternativeGroup parameterGroup, ParameterAlternative parameterAlternative, IExecutionContext context)
 {
     _parameterGroup          = parameterGroup;
     _parameterGroupId        = _parameterGroup.Id;
     _parameterAlternative    = parameterAlternative;
     _oldDefaultAlternative   = parameterGroup.DefaultAlternative;
     _oldDefaultAlternativeId = _oldDefaultAlternative.Id;
     ObjectType          = PKSimConstants.ObjectTypes.Compound;
     CommandType         = PKSimConstants.Command.CommandTypeEdit;
     BuildingBlockId     = context.BuildingBlockIdContaining(parameterGroup);
     Description         = PKSimConstants.Command.SetDefaultAlternativeParameterDescription(context.DisplayNameFor(parameterGroup), _oldDefaultAlternative.Name, parameterAlternative.Name);
     ShouldChangeVersion = false;
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(parameterGroup));
 }
Exemplo n.º 17
0
        public EditObjectBaseDescriptionCommand(IObjectBase objectBase, string newDescription, IExecutionContext context)
        {
            _objectBase     = objectBase;
            _newDescription = newDescription;
            _objectBaseId   = objectBase.Id;
            var entity = objectBase as IEntity;

            if (entity != null)
            {
                _buildingBlockId = context.BuildingBlockIdContaining(entity);
                context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(entity));
            }

            ObjectType  = context.TypeFor(objectBase);
            CommandType = PKSimConstants.Command.CommandTypeEdit;
            Description = PKSimConstants.Command.EditEntityDescriptionCommandDescripiton(ObjectType, objectBase.Name);
        }
Exemplo n.º 18
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;
 }
Exemplo n.º 19
0
        protected AddEntityToContainerCommand(TEntity entityToAdd, TContainer parentContainer, IExecutionContext context, Func <TContainer, Action <TEntity> > addFunction)
        {
            _entityToAdd       = entityToAdd;
            _parentContainer   = parentContainer;
            _addFunction       = addFunction;
            _entityToAddId     = _entityToAdd.Id;
            _parentContainerId = _parentContainer.Id;

            IncrementVersion = true;
            BuildingBlockId  = context.BuildingBlockIdContaining(parentContainer);

            ObjectType  = context.TypeFor(entityToAdd);
            CommandType = PKSimConstants.Command.CommandTypeAdd;
            var buildingBlock = context.BuildingBlockContaining(parentContainer);

            context.UpdateBuildinBlockProperties(this, buildingBlock);
            string containerName = string.IsNullOrEmpty(parentContainer.Name) ? CoreConstants.ContainerName.NameTemplate : parentContainer.Name;

            Description = PKSimConstants.Command.AddEntityToContainer(ObjectType, entityToAdd.Name, context.TypeFor(parentContainer), containerName);
        }
Exemplo n.º 20
0
        protected override void PerformExecuteWith(IExecutionContext context)
        {
            //Retrieve building block id in execute only since parameter might have been added in a macro command and building block id was not available in constructor
            BuildingBlockId = context.BuildingBlockIdContaining(_parameter);

            //Model parameter in simulation might not be found as belonging to a building block, In that case, we set
            //the building block id equal to the simulation id, which is also a building block
            if (string.IsNullOrEmpty(BuildingBlockId))
            {
                BuildingBlockId = SimulationId;
            }

            udpateBuildingBlockProperties(context);
            setBuildingBlockAlteredFlag(context);

            //Command dependent implementation
            ExecuteUpdateParameter(context);

            //Once values have been updated, update dependent objects
            UpdateDependenciesOnParameter(context);
        }
 protected override void PerformExecuteWith(IExecutionContext context)
 {
     //Retrieve building block id in execute only since molecule might have been added in a macro command and bbid was not available in constructor
     BuildingBlockId = context.BuildingBlockIdContaining(_molecule);
     NormalizeExpressions(_simulationSubject, _molecule);
 }