protected override void DoStart()
        {
            foreach (var flatStartFormula in _flatMoleculeStartFormulasRepository.All())
            {
                var moleculePath = _flatContainerRepository.ContainerPathFrom(flatStartFormula.Id);
                moleculePath.Add(flatStartFormula.MoleculeName);

                var startFormula = new MoleculeStartFormula(moleculePath, flatStartFormula.CalculationMethod,
                                                            flatStartFormula.Rate);
                _moleculeStartFormulas.Add(startFormula);
            }
        }
Exemplo n.º 2
0
        protected override void DoStart()
        {
            foreach (var flatParameterMapping in _flatParameterMappingRepo.All())
            {
                ICompoundProcessParameterMapping mapping = new CompoundProcessParameterMapping();

                mapping.ProcessName         = flatParameterMapping.ProcessName;
                mapping.ParameterName       = flatParameterMapping.ParameterName;
                mapping.MappedParameterPath = _flatContainerRepo.ContainerPathFrom(flatParameterMapping.ContainerId);
                mapping.MappedParameterPath.Add(flatParameterMapping.ContainerParameterName);

                _parameterMappings.Add(mapping);
            }
        }
Exemplo n.º 3
0
        private IContainer neighborFrom(int neighborId, Organism organism)
        {
            var containerPath = _flatContainerRepository.ContainerPathFrom(neighborId);

            //path from the database do not start with root
            //if called for individual neighborhood (organism is NOT top container),
            //add ROOT as top path entry
            if (organism.ParentContainer != null)
            {
                containerPath.AddAtFront(Constants.ROOT);
            }

            return(containerPath.Resolve <IContainer>(organism));
        }
Exemplo n.º 4
0
        protected override void DoStart()
        {
            _parameterMetaDataList = _flatParameterMetaDataRepository.All().ToList();

            foreach (var parameterMetaData in _parameterMetaDataList)
            {
                parameterMetaData.ParentContainerPath = _flatContainerRepository.ContainerPathFrom(parameterMetaData.ContainerId).ToString();
            }

            //now cache the _parameter values
            foreach (var parameterValueMetaDataGroup in _parameterMetaDataList.GroupBy(x => x.ParentContainerPath))
            {
                _parameterMetaDataCache.Add(parameterValueMetaDataGroup.Key, new List <TParameterMetaData>(parameterValueMetaDataGroup));
            }
        }
      protected override void DoStart()
      {
         _parameterMetaDataList = _flatParameterMetaDataRepository.All().ToList();

         _parameterMetaDataList.Each(parameterMetaData =>
         {
            parameterMetaData.ParentContainerPath = _flatContainerRepository.ContainerPathFrom(parameterMetaData.ContainerId).ToString();
            //Use clone here to ensure that we are not modifying the reference stored in the repository
            var valueOrigin = _valueOriginRepository.FindBy(parameterMetaData.ValueOriginId).Clone();
            parameterMetaData.ValueOrigin = valueOrigin;
         });

         //now cache the parameter meta data by container path
         foreach (var parameterValueMetaDataGroup in _parameterMetaDataList.GroupBy(x => x.ParentContainerPath))
         {
            _parameterMetaDataCacheByContainer.Add(parameterValueMetaDataGroup.Key, new List<TParameterMetaData>(parameterValueMetaDataGroup));            
         }


      }
Exemplo n.º 6
0
        public IObjectPath MapFrom(FlatObjectPath flatObjectPath)
        {
            IObjectPath objectPath;

            if (flatObjectPath.IsAbsolutePath)
            {
                objectPath = _flatContainerRepository.ContainerPathFrom(flatObjectPath.ContainerId);
            }
            else
            {
                objectPath = _relativeObjectPathMapper.MapFrom(flatObjectPath.RelativeObjectPathId);
            }

            //for molecule amounts, object name used is just a dummy in the database,
            //so omit it
            if (!flatObjectPath.UseAmount)
            {
                objectPath.Add(adjustRateObjectName(flatObjectPath.RateObjectName));
            }

            return(objectPath);
        }
Exemplo n.º 7
0
        public IEnumerable <IContainer> SubContainersFor(Species species, ModelConfiguration modelConfiguration, IContainer parentContainer)
        {
            IList <IContainer> allSubContainers = new List <IContainer>();

            string pathToParentContainer = _entityPathResolver.PathFor(parentContainer);

            var flatParentContainer    = _flatContainerRepo.ContainerFrom(pathToParentContainer);
            var flatModelSubContainers = _modelContainerRepo.AllSubContainerFor(modelConfiguration.ModelName, flatParentContainer.Id);
            var allSpeciesSubContainer = speciesSubContainers(species.Name, flatParentContainer.Id);

            foreach (var flatModelContainer in flatModelSubContainers)
            {
                // check if container available in species
                if (allSpeciesSubContainer.Contains(flatModelContainer.Id))
                {
                    //model subcontainer available in the species structure - add to model subcontainers and continue
                    allSubContainers.Add(_flatContainerIdToContainerMapper.MapFrom(flatModelContainer));
                    continue;
                }

                // model subcontainer NOT available in species structure.
                // In this case, action depends on UsageInIndividuum-flag

                if (flatModelContainer.UsageInIndividual == CoreConstants.ORM.UsageInIndividualRequired)
                {
                    throw new ArgumentException(PKSimConstants.Error.ModelContainerNotAvailable(_flatContainerRepo.ContainerPathFrom(flatModelContainer.Id).ToString()));
                }

                if (flatModelContainer.UsageInIndividual == CoreConstants.ORM.UsageInIndividualOptional)
                {
                    continue;
                }

                if (flatModelContainer.UsageInIndividual == CoreConstants.ORM.UsageInIndividualExtended)
                {
                    allSubContainers.Add(_flatContainerIdToContainerMapper.MapFrom(flatModelContainer));
                    continue;
                }

                throw new ArgumentException(PKSimConstants.Error.UnknownUsageInIndividualFlag(flatModelContainer.UsageInIndividual));
            }

            return(allSubContainers);
        }
        public IReadOnlyList <IContainer> SubContainersFor(SpeciesPopulation population, ModelConfiguration modelConfiguration, IContainer parentContainer)
        {
            var allSubContainers = new List <IContainer>();

            string pathToParentContainer = _entityPathResolver.PathFor(parentContainer);

            var flatParentContainer    = _flatContainerRepo.ContainerFrom(pathToParentContainer);
            var flatModelSubContainers = _modelContainerRepo.AllSubContainerFor(modelConfiguration.ModelName, flatParentContainer.Id);
            var allSpeciesSubContainer = populationSubContainers(population, flatParentContainer);

            foreach (var flatModelContainer in flatModelSubContainers)
            {
                // check if container available in species
                if (allSpeciesSubContainer.Contains(flatModelContainer.Id))
                {
                    //model subcontainer available in the species structure - add to model subcontainers and continue
                    allSubContainers.Add(_flatContainerIdToContainerMapper.MapFrom(flatModelContainer));
                    continue;
                }

                // model subcontainer NOT available in species structure.
                // In this case, action depends on UsageInIndividuum-flag

                if (flatModelContainer.UsageInIndividual == CoreConstants.ORM.USAGE_IN_INDIVIDUAL_REQUIRED)
                {
                    throw new ArgumentException(PKSimConstants.Error.ModelContainerNotAvailable(_flatContainerRepo.ContainerPathFrom(flatModelContainer.Id).ToString()));
                }

                if (flatModelContainer.UsageInIndividual == CoreConstants.ORM.USAGE_IN_INDIVIDUAL_OPTIONAL)
                {
                    continue;
                }

                if (flatModelContainer.UsageInIndividual == CoreConstants.ORM.USAGE_IN_INDIVIDUAL_EXTENDED)
                {
                    allSubContainers.Add(_flatContainerIdToContainerMapper.MapFrom(flatModelContainer));
                    continue;
                }

                throw new ArgumentException(PKSimConstants.Error.UnknownUsageInIndividualFlag(flatModelContainer.UsageInIndividual));
            }

            return(allSubContainers);
        }