Exemplo n.º 1
0
        private async Task <CompoundProcessesSelection> modelProcessSelectionFrom(CompoundProcessSelection[] snapshotProcesses, Model.Compound compound, ISimulationSubject simulationSubject, SnapshotContext snapshotContext)
        {
            var compoundProcessesSelection = new CompoundProcessesSelection();

            if (snapshotProcesses == null)
            {
                return(compoundProcessesSelection);
            }

            foreach (var snapshotProcess in snapshotProcesses)
            {
                var process = compound.ProcessByName(snapshotProcess.Name) ?? notSelectedProcessFrom(snapshotProcess, simulationSubject);
                if (process == null)
                {
                    //No process found and a name was specified. This is a snapshot that is corrupted
                    if (!string.IsNullOrEmpty(snapshotProcess.Name))
                    {
                        _logger.AddWarning(PKSimConstants.Error.ProcessNotFoundInCompound(snapshotProcess.Name, compound.Name));
                    }

                    continue;
                }

                await addProcessToProcessSelection(compoundProcessesSelection, snapshotProcess, process, snapshotContext);
            }

            return(compoundProcessesSelection);
        }
Exemplo n.º 2
0
        private async Task addProcessToProcessSelection(CompoundProcessesSelection compoundProcessesSelection, CompoundProcessSelection compoundProcessSelection, Model.CompoundProcess process)
        {
            var processSelectionGroup = selectionGroupFor(compoundProcessesSelection, process);
            var processSelection      = await _processMappingMapper.MapToModel(compoundProcessSelection, process);

            processSelectionGroup.AddProcessSelection(processSelection);
        }
Exemplo n.º 3
0
        private async Task addProcessToProcessSelection(CompoundProcessesSelection compoundProcessesSelection, CompoundProcessSelection snapshotCompoundProcessSelection, Model.CompoundProcess process, SnapshotContext snapshotContext)
        {
            var processSelectionGroup = selectionGroupFor(compoundProcessesSelection, process);
            var processContext        = new CompoundProcessSnapshotContext(process, snapshotContext);
            var processSelection      = await _processMappingMapper.MapToModel(snapshotCompoundProcessSelection, processContext);

            processSelectionGroup.AddProcessSelection(processSelection);
        }
Exemplo n.º 4
0
        private void addUndefinedProteinForSystemicProcessesToIndividual(CompoundProcessesSelection compoundProcessesSelection)
        {
            var hepaticPlasmaClearance = compoundProcessesSelection.MetabolizationSelection.ProcessSelectionFor(SystemicProcessTypes.Hepatic);

            if (hepaticPlasmaClearance != null)
            {
                addUndefinedLiver();
            }

            var biliaryClearance = compoundProcessesSelection.TransportAndExcretionSelection.ProcessSelectionFor(SystemicProcessTypes.Biliary);

            if (biliaryClearance != null)
            {
                addUndefinedLiverTransporter();
            }
        }
Exemplo n.º 5
0
        private async Task <CompoundProcessesSelection> modelProcessSelectionFrom(CompoundProcessSelection[] snapshotProcesses, Model.Compound compound)
        {
            var compoundProcessesSelection = new CompoundProcessesSelection();

            if (snapshotProcesses == null)
            {
                return(compoundProcessesSelection);
            }

            foreach (var snapshotProcess in snapshotProcesses)
            {
                var process = compound.ProcessByName(snapshotProcess.Name);
                if (process == null)
                {
                    _logger.AddWarning(PKSimConstants.Error.ProcessNotFoundInCompound(snapshotProcess.Name, compound.Name));
                }
                else
                {
                    await addProcessToProcessSelection(compoundProcessesSelection, snapshotProcess, process);
                }
            }

            return(compoundProcessesSelection);
        }
Exemplo n.º 6
0
 private Task <CompoundProcessSelection[]> snapshotProcessSelectionFrom(CompoundProcessesSelection compoundProcessesSelection)
 {
     return(_processMappingMapper.MapToSnapshots(compoundProcessesSelection.AllProcesses()));
 }
Exemplo n.º 7
0
 private ProcessSelectionGroup selectionGroupFor(CompoundProcessesSelection compoundProcessesSelection, Model.CompoundProcess process)
 {
     return(selectionGroup <EnzymaticProcess>(compoundProcessesSelection.MetabolizationSelection, process, SystemicProcessTypes.Hepatic) ??
            selectionGroup <TransportPartialProcess>(compoundProcessesSelection.TransportAndExcretionSelection, process, SystemicProcessTypes.GFR, SystemicProcessTypes.Biliary, SystemicProcessTypes.Renal) ??
            selectionGroup <SpecificBindingPartialProcess>(compoundProcessesSelection.SpecificBindingSelection, process));
 }