Exemplo n.º 1
0
 private void addSystemicProcesses(Model.Compound compound, ProcessSelectionGroup processSelectionGroup, SystemicProcessType systemicProcessType)
 {
     //add all systemic processes
     compound.AllSystemicProcessesOfType(systemicProcessType).Each(systemicProcess =>
     {
         var processSelection = new SystemicProcessSelection {
             ProcessName = systemicProcess.Name, ProcessType = systemicProcess.SystemicProcessType
         };
         processSelectionGroup.AddSystemicProcessSelection(processSelection);
     });
 }
Exemplo n.º 2
0
        private CompoundGroupSelection[] alternativeSelectionsFrom(Model.Compound compound, ModelCompoundProperties modelCompoundProperties)
        {
            var alternativesSelections = new List <CompoundGroupSelection>();

            modelCompoundProperties.CompoundGroupSelections.Each(x =>
            {
                var compoundProperties = compound.ParameterAlternativeGroup(x.GroupName);
                if (compoundProperties.AllAlternatives.Count() > 1)
                {
                    alternativesSelections.Add(x);
                }
            });

            return(!alternativesSelections.Any() ? null : alternativesSelections.ToArray());
        }
Exemplo n.º 3
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.º 4
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.º 5
0
        private void addPartialProcesses <TPartialProcess, TIndividualMolecule, TProcessSelection>(Model.Compound compound, Model.Individual individual, ProcessSelectionGroup processSelectionGroup)
            where TPartialProcess : Model.PartialProcess
            where TIndividualMolecule : IndividualMolecule
            where TProcessSelection : ProcessSelection, new()
        {
            //default mapping with processes: Mapping done only by name
            foreach (var process in compound.AllProcesses <TPartialProcess>())
            {
                var molecule = individual.MoleculeByName <TIndividualMolecule>(process.MoleculeName);
                //enzyme not found in individual
                if (molecule == null)
                {
                    _batchLogger.AddDebug($"Molecule '{process.MoleculeName}' not found in individual  but is defined in compound for process '{process.Name}'");
                    continue;
                }

                _batchLogger.AddDebug($"Adding process {process.Name} for molecule {molecule.Name}");
                processSelectionGroup.AddPartialProcessSelection(new TProcessSelection {
                    ProcessName = process.Name, MoleculeName = molecule.Name, CompoundName = compound.Name
                });
            }
        }