Ejemplo n.º 1
0
        protected override void Context()
        {
            base.Context();
            A.CallTo(() => _executionContext.Resolve <IParameterTask>()).Returns(sut);
            _relativeExpressionParameter = new Parameter
            {
                BuildingBlockType = PKSimBuildingBlockType.Individual,
                Formula           = new ConstantFormula(0.0),
                GroupName         = CoreConstants.Groups.RELATIVE_EXPRESSION,
                Name = CoreConstants.Parameters.REL_EXP
            };

            _relativeExpressionParameterNorm = new Parameter
            {
                BuildingBlockType = PKSimBuildingBlockType.Individual,
                Formula           = new ConstantFormula(0.0),
                GroupName         = CoreConstants.Groups.RELATIVE_EXPRESSION,
                Name = CoreConstants.Parameters.REL_EXP_NORM
            };

            var expressionContainer = new MoleculeExpressionContainer {
                Name = "Plasma"
            };

            expressionContainer.Add(_relativeExpressionParameter);
            expressionContainer.Add(_relativeExpressionParameterNorm);
            var molecule = new IndividualEnzyme {
                expressionContainer
            };
        }
        protected override void Context()
        {
            _moleculeExpressionTask             = A.Fake <IMoleculeExpressionTask <Individual> >();
            _querySettingsMapper                = A.Fake <IMoleculeToQueryExpressionSettingsMapper>();
            _geneExpressionsDatabasePathManager = A.Fake <IGeneExpressionsDatabasePathManager>();
            _applicationController              = A.Fake <IApplicationController>();

            sut = new EditMoleculeTask <Individual>(_moleculeExpressionTask, _applicationController);

            _expressionProfileSelectionPresenter = A.Fake <IExpressionProfileSelectionPresenter>();
            A.CallTo(() => _applicationController.Start <IExpressionProfileSelectionPresenter>()).Returns(_expressionProfileSelectionPresenter);


            _moleculeContainer1 = new MoleculeExpressionContainer().WithName("C1");
            _moleculeContainer1.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
            _moleculeContainer2 = new MoleculeExpressionContainer().WithName("C2");
            _moleculeContainer2.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));

            _individual = new Individual {
                OriginData = new OriginData {
                    Species = new Species {
                        Name = "Human", DisplayName = "Human"
                    }
                }
            };


            _molecule = new IndividualEnzyme {
                Name = "CYP3A4"
            };
            _molecule.Add(_moleculeContainer1);
            _molecule.Add(_moleculeContainer2);
        }
Ejemplo n.º 3
0
 protected override void Context()
 {
     base.Context();
     _displayName         = "tutu";
     _expressionContainer = new MoleculeExpressionContainer().WithName("tralal");
     _expressionContainer.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
     A.CallTo(() => _representationInfoRepository.DisplayNameFor(_expressionContainer)).Returns(_displayName);
 }
Ejemplo n.º 4
0
 protected override void Context()
 {
     base.Context();
     _enzyme = new IndividualEnzyme {
         Name = "CYP"
     };
     _container1 = new MoleculeExpressionContainer().WithName("EXP1");
     _container2 = new MoleculeExpressionContainer().WithName("EXP2");
     _enzyme.AddChildren(_container1, _container2);
 }
        private IEnumerable <IContainer> compartmentFor(Organism organism, MoleculeExpressionContainer expressionContainer, string defaultCompartment)
        {
            var usedCompartment = expressionContainer.IsLumen ? expressionContainer.ContainerName : defaultCompartment;
            var compartment     = expressionContainer.CompartmentPath(usedCompartment).Resolve <IContainer>(organism);

            if (compartment == null)
            {
                return(Enumerable.Empty <IContainer>());
            }
            return(new[] { compartment });
        }
Ejemplo n.º 6
0
 protected override void Context()
 {
     _expressionContainer = new MoleculeExpressionContainer().WithName("tralal");
     _expressionContainer.Add(A.Fake <IParameter>().WithName(CoreConstants.Parameters.REL_EXP));
     _anotherContainer = new MoleculeExpressionContainer().WithName("AnotherContainer");
     sut = new IndividualEnzyme();
     _referenceConcentration = A.Fake <IParameter>().WithName(CoreConstants.Parameters.REFERENCE_CONCENTRATION);
     sut.Add(_referenceConcentration);
     sut.Add(_expressionContainer);
     sut.Add(_anotherContainer);
 }
Ejemplo n.º 7
0
        protected override void Context()
        {
            _individual                    = new Individual();
            _individual.OriginData         = new OriginData();
            _individual.OriginData.Species = new Species().WithName("Human");
            _ontogeny = new DatabaseOntogeny {
                Name = "toto"
            };
            _executionContext                  = A.Fake <IExecutionContext>();
            _proteinExpressionPresenter        = A.Fake <IProteinExpressionsPresenter>();
            _simpleMoleculePresenter           = A.Fake <ISimpleMoleculePresenter>();
            _querySettingsMapper               = A.Fake <IMoleculeToQueryExpressionSettingsMapper>();
            _applicationController             = A.Fake <IApplicationController>();
            _individualMoleculeFactoryResolver = A.Fake <IIndividualMoleculeFactoryResolver>();
            _transportContainerUpdater         = A.Fake <ITransportContainerUpdater>();
            _containerTask = A.Fake <IContainerTask>();
            _geneExpressionsDatabasePathManager = A.Fake <IGeneExpressionsDatabasePathManager>();
            A.CallTo(() => _applicationController.Start <IProteinExpressionsPresenter>()).Returns(_proteinExpressionPresenter);
            A.CallTo(() => _applicationController.Start <ISimpleMoleculePresenter>()).Returns(_simpleMoleculePresenter);
            _moleculeParameterTask = A.Fake <IMoleculeParameterTask>();
            _ontogenyRepository    = A.Fake <IOntogenyRepository>();
            var proteinFactory = A.Fake <IIndividualMoleculeFactory>();

            _moleculeContainer1 = new MoleculeExpressionContainer().WithName("C1");
            _moleculeContainer1.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
            _moleculeContainer1.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.REL_EXP_NORM));
            _moleculeContainer2 = new MoleculeExpressionContainer().WithName("C2");
            _moleculeContainer2.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
            _moleculeContainer2.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.REL_EXP_NORM));
            A.CallTo(() => _individualMoleculeFactoryResolver.FactoryFor <IndividualProtein>()).Returns(proteinFactory);
            _molecule = new IndividualEnzyme {
                Name = "CYP3A4"
            };
            _molecule.Add(_moleculeContainer1);
            _molecule.Add(_moleculeContainer2);
            A.CallTo(() => proteinFactory.CreateFor(_individual)).Returns(_molecule);

            A.CallTo(() => _ontogenyRepository.AllFor(_individual.Species.Name)).Returns(new[] { _ontogeny, new DatabaseOntogeny {
                                                                                                     Name = "tralala"
                                                                                                 }, });
            A.CallTo(() => _executionContext.Resolve <IOntogenyRepository>()).Returns(_ontogenyRepository);

            _subjectExpressionTask = new IndividualExpressionTask(_executionContext);

            _ontogenyTask = A.Fake <IOntogenyTask <Individual> >();
            sut           = new MoleculeExpressionTask <Individual>(_applicationController, _executionContext,
                                                                    _individualMoleculeFactoryResolver, _querySettingsMapper,
                                                                    _containerTask, _geneExpressionsDatabasePathManager,
                                                                    _ontogenyRepository, _transportContainerUpdater, _subjectExpressionTask, _ontogenyTask, _moleculeParameterTask);
        }
 protected override void Context()
 {
     base.Context();
     _protein = A.Fake <IndividualProtein>();
     _protein.QueryConfiguration = "toto";
     _exp1     = new MoleculeExpressionContainer().WithName("exp1");
     _exp2     = new MoleculeExpressionContainer().WithName("exp2");
     _expInfo1 = A.Fake <ExpressionContainerInfo>();
     _expInfo2 = A.Fake <ExpressionContainerInfo>();
     A.CallTo(() => _protein.AllExpressionsContainers()).Returns(new[] { _exp1, _exp2 });
     _proteinContent = 10;
     A.CallTo(() => _protein.ReferenceConcentration).Returns(DomainHelperForSpecs.ConstantParameterWithValue(_proteinContent));
     A.CallTo(() => _expressionContainerMapper.MapFrom(_exp1)).Returns(_expInfo1);
     A.CallTo(() => _expressionContainerMapper.MapFrom(_exp2)).Returns(_expInfo2);
 }
        public void UpdateProperties(ExpressionContainerDTO expressionDTO, MoleculeExpressionContainer expressionContainer)
        {
            var group         = _groupRepository.GroupByName(expressionContainer.GroupName);
            var groupInfo     = _representationInfoRepository.InfoFor(RepresentationObjectType.GROUP, expressionContainer.GroupName);
            var containerInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.CONTAINER, expressionContainer.ContainerName);

            expressionDTO.GroupingPathDTO             = groupInfo.ToPathElement();
            expressionDTO.ContainerPathDTO            = containerInfo.ToPathElement();
            expressionDTO.Sequence                    = group.Sequence;
            expressionDTO.RelativeExpressionParameter =
                _parameterMapper.MapFrom(expressionContainer.RelativeExpressionParameter, expressionDTO,
                                         x => x.RelativeExpression, x => x.RelativeExpressionParameter);

            expressionDTO.RelativeExpressionNormParameter =
                _parameterMapper.MapFrom(expressionContainer.RelativeExpressionNormParameter, expressionDTO,
                                         x => x.RelativeExpressionNorm, x => x.RelativeExpressionNormParameter);
        }
        protected override void Context()
        {
            _individual = new Individual {
                OriginData = new OriginData {
                    Species = new Species().WithName("Human")
                }
            };
            _ontogeny = new DatabaseOntogeny {
                Name = "toto"
            };
            _executionContext = A.Fake <IExecutionContext>();
            _individualMoleculeFactoryResolver = A.Fake <IIndividualMoleculeFactoryResolver>();
            _ontogenyRepository = A.Fake <IOntogenyRepository>();
            var proteinFactory = A.Fake <IIndividualMoleculeFactory>();

            _expressionProfileUpdater = A.Fake <IExpressionProfileUpdater>();
            _moleculeContainer1       = new MoleculeExpressionContainer().WithName("C1");
            _moleculeContainer1.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
            _moleculeContainer2 = new MoleculeExpressionContainer().WithName("C2");
            _moleculeContainer2.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
            A.CallTo(() => _individualMoleculeFactoryResolver.FactoryFor <IndividualProtein>()).Returns(proteinFactory);
            _molecule = new IndividualEnzyme {
                Name = "CYP3A4"
            };
            _molecule.Add(_moleculeContainer1);
            _molecule.Add(_moleculeContainer2);
            A.CallTo(() => proteinFactory.AddMoleculeTo(_individual, A <string> ._)).Returns(_molecule);

            A.CallTo(() => _ontogenyRepository.AllFor(_individual.Species.Name)).Returns(new[] { _ontogeny, new DatabaseOntogeny {
                                                                                                     Name = "tralala"
                                                                                                 }, });
            A.CallTo(() => _executionContext.Resolve <IOntogenyRepository>()).Returns(_ontogenyRepository);

            _subjectExpressionTask = new IndividualExpressionTask(_executionContext);

            sut = new MoleculeExpressionTask <Individual>(
                _executionContext,
                _individualMoleculeFactoryResolver,
                _subjectExpressionTask,
                _expressionProfileUpdater
                );
        }
Ejemplo n.º 11
0
        protected override Task Context()
        {
            _parameterMapper = A.Fake <ParameterMapper>();
            _logger          = A.Fake <IOSPSuiteLogger>();

            sut = new ExpressionContainerMapper(_parameterMapper, _logger);

            _relativeExpressionParameter =
                DomainHelperForSpecs.ConstantParameterWithValue(0, isDefault: true).WithName(CoreConstants.Parameters.REL_EXP);
            _moleculeExpressionContainer = new MoleculeExpressionContainer().WithName("EXP");
            _moleculeExpressionContainer.Add(_relativeExpressionParameter);

            _transporterRelativeExpressionParameter =
                DomainHelperForSpecs.ConstantParameterWithValue(0, isDefault: true).WithName(CoreConstants.Parameters.REL_EXP);
            _transporterExpressionContainer = new TransporterExpressionContainer().WithName("TRANS");
            _transporterExpressionContainer.TransportDirection = TransportDirectionId.InfluxInterstitialToIntracellular;

            _bloodCellsExpressionContainer = new TransporterExpressionContainer().WithName(CoreConstants.Compartment.BLOOD_CELLS);
            _bloodCellsExpressionContainer.TransportDirection = TransportDirectionId.BiDirectionalBloodCellsPlasma;

            _transporterExpressionContainer.Add(_transporterRelativeExpressionParameter);

            _individual = new Individual {
                OriginData = new OriginData {
                    Species = new Species().WithName("Human")
                }
            };
            _expressionContainerMapperContext = new ExpressionContainerMapperContext(new SnapshotContext())
            {
            };

            _enzyme = new IndividualEnzyme {
                _moleculeExpressionContainer
            };
            _transporter = new IndividualTransporter {
                _transporterExpressionContainer, _bloodCellsExpressionContainer
            };
            return(_completed);
        }
        protected override Task Context()
        {
            _parameterMapper           = A.Fake <ParameterMapper>();
            _transportContainerUpdater = A.Fake <ITransportContainerUpdater>();
            _logger = A.Fake <ILogger>();

            sut = new ExpressionContainerMapper(_parameterMapper, _transportContainerUpdater, _logger);

            _relativeExpressionParameter = DomainHelperForSpecs.ConstantParameterWithValue(0, isDefault: true).WithName(CoreConstants.Parameters.REL_EXP);
            _moleculeExpressionContainer = new MoleculeExpressionContainer().WithName("EXP");
            _moleculeExpressionContainer.Add(_relativeExpressionParameter);

            _transporterRelativeExpressionParameter          = DomainHelperForSpecs.ConstantParameterWithValue(0, isDefault: true).WithName(CoreConstants.Parameters.REL_EXP);
            _transporterExpressionContainer                  = new TransporterExpressionContainer().WithName("TRANS");
            _transporterExpressionContainer.MembraneLocation = MembraneLocation.Apical;

            _transporterExpressionContainer.Add(_transporterRelativeExpressionParameter);

            _individual = new Individual {
                OriginData = new  Model.OriginData {
                    Species = new Species().WithName("Human")
                }
            };

            _expressionContainerMapperContext = new ExpressionContainerMapperContext
            {
                SimulationSubject = _individual
            };

            _enzyme = new IndividualEnzyme {
                _moleculeExpressionContainer
            };
            _transporter = new IndividualTransporter {
                _transporterExpressionContainer
            };
            return(_completed);
        }
        protected override void Context()
        {
            base.Context();
            _protein = A.Fake <IndividualProtein>();
            _protein.QueryConfiguration = "toto";
            _exp1    = new MoleculeExpressionContainer().WithName("exp1");
            _exp2    = new MoleculeExpressionContainer().WithName("exp2");
            _relExp1 = DomainHelperForSpecs.ConstantParameterWithValue(1);
            _relExp2 = DomainHelperForSpecs.ConstantParameterWithValue(2);
            var allExpressions = new Cache <string, IParameter> {
                { _exp1.Name, _relExp1 }, { _exp2.Name, _relExp2 }
            };

            A.CallTo(() => _individual.AllExpressionParametersFor(_protein)).Returns(allExpressions);

            _proteinContent = 10;
            A.CallTo(() => _protein.ReferenceConcentration).Returns(DomainHelperForSpecs.ConstantParameterWithValue(_proteinContent));
            A.CallTo(() => _representationInfoRepository.ContainerInfoFor(_exp1.Name)).Returns(new RepresentationInfo {
                DisplayName = "disp1"
            });
            A.CallTo(() => _representationInfoRepository.ContainerInfoFor(_exp2.Name)).Returns(new RepresentationInfo {
                DisplayName = "disp2"
            });
        }
        private IEnumerable <IContainer> allContainersFor(Organism organism, IndividualMolecule molecule, IEnumerable <IContainer> allContainers, MoleculeExpressionContainer expressionContainer)
        {
            if (molecule.MoleculeType == QuantityType.Transporter)
            {
                return(allContainersForTransporter(organism, molecule.DowncastTo <IndividualTransporter>(), allContainers, expressionContainer.DowncastTo <TransporterExpressionContainer>()));
            }

            var protein = molecule.DowncastTo <IndividualProtein>();

            //plasma always generated
            if (expressionContainer.IsPlasma())
            {
                return(allPlasmaCompartmentsOf(allContainers));
            }

            switch (protein.TissueLocation)
            {
            case TissueLocation.ExtracellularMembrane:
                if (expressionContainer.IsBloodCell())
                {
                    return(allPlasmaCompartmentsOf(allContainers));
                }
                if (expressionContainer.IsVascularEndothelium())
                {
                    if (protein.MembraneLocation == MembraneLocation.Apical)
                    {
                        return(allPlasmaCompartmentsOf(allContainers));
                    }

                    return(allInterstitialCompartmentsOf(allContainers));
                }
                return(compartmentFor(organism, expressionContainer, CoreConstants.Compartment.Interstitial));

            case TissueLocation.Intracellular:
                if (expressionContainer.IsBloodCell())
                {
                    return(allBloodCellsCompartmentsOf(allContainers));
                }

                if (expressionContainer.IsVascularEndothelium())
                {
                    if (protein.IntracellularVascularEndoLocation == IntracellularVascularEndoLocation.Endosomal)
                    {
                        return(allEndosomeCompartmentsOf(allContainers));
                    }

                    return(allInterstitialCompartmentsOf(allContainers));
                }
                return(compartmentFor(organism, expressionContainer, CoreConstants.Compartment.Intracellular));

            case TissueLocation.Interstitial:
                if (expressionContainer.IsBloodCell())
                {
                    return(allBloodCellsCompartmentsOf(allContainers));
                }

                if (expressionContainer.IsVascularEndothelium())
                {
                    return(allInterstitialCompartmentsOf(allContainers));
                }

                return(compartmentFor(organism, expressionContainer, CoreConstants.Compartment.Interstitial));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 15
0
        private void updateReferenceToIndividualParametersForSurrogateContainer(Individual individual, IndividualMolecule molecule, MoleculeExpressionContainer expressionContainer, IContainer globalMoleculeContainer)
        {
            string relExpName;

            if (expressionContainer.IsBloodCell())
            {
                relExpName = CoreConstants.Parameters.REL_EXP_BLOOD_CELL;
            }
            else if (expressionContainer.IsPlasma())
            {
                relExpName = CoreConstants.Parameters.REL_EXP_PLASMA;
            }
            else if (expressionContainer.IsVascularEndothelium())
            {
                relExpName = CoreConstants.Parameters.REL_EXP_VASC_ENDO;
            }
            else
            {
                return;
            }

            var relExpNormName = CoreConstants.Parameters.NormParameterFor(relExpName);

            updateFromIndividualParameter(globalMoleculeContainer.Parameter(relExpName), expressionContainer.RelativeExpressionParameter, individual, molecule);
            updateFromIndividualParameter(globalMoleculeContainer.Parameter(relExpNormName), expressionContainer.RelativeExpressionNormParameter, individual, molecule);
        }
Ejemplo n.º 16
0
        private void updateReferenceToIndividualParametersForStandardContainer(Individual individual, IndividualMolecule molecule, MoleculeExpressionContainer expressionContainer, IList <IContainer> allOrganismContainers, PathCache <IMoleculeAmount> moleculeAmountPath)
        {
            var allContainers = _expressionContainersRetriever.AllContainersFor(individual.Organism, allOrganismContainers, molecule, expressionContainer);

            foreach (var container in allContainers)
            {
                var amount = amountFor(container, molecule, moleculeAmountPath);
                if (amount == null)
                {
                    continue;
                }

                updateFromIndividualParameter(amount.Parameter(CoreConstants.Parameters.REL_EXP), expressionContainer.RelativeExpressionParameter, individual, molecule);
                updateFromIndividualParameter(amount.Parameter(CoreConstants.Parameters.REL_EXP_NORM), expressionContainer.RelativeExpressionNormParameter, individual, molecule);
            }
        }
Ejemplo n.º 17
0
 public ExpressionContainerInfo MapFrom(MoleculeExpressionContainer moleculeExpressionContainer)
 {
     return(new ExpressionContainerInfo(moleculeExpressionContainer.Name,
                                        _representationInfoRepository.DisplayNameFor(moleculeExpressionContainer),
                                        moleculeExpressionContainer.RelativeExpression));
 }
Ejemplo n.º 18
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);
        }
Ejemplo n.º 19
0
        protected override Task Context()
        {
            _parameterMapper                   = A.Fake <ParameterMapper>();
            _expressionContainerMapper         = A.Fake <ExpressionContainerMapper>();
            _executionContext                  = A.Fake <IExecutionContext>();
            _individualMoleculeFactoryResolver = A.Fake <IIndividualMoleculeFactoryResolver>();
            _ontogenyMapper = A.Fake <OntogenyMapper>();
            _ontogenyTask   = A.Fake <IOntogenyTask <Individual> >();
            _individualMoleculeParametersTask = A.Fake <IMoleculeParameterTask>();

            sut = new MoleculeMapper(_parameterMapper, _expressionContainerMapper,
                                     _ontogenyMapper, _individualMoleculeFactoryResolver, _executionContext, _ontogenyTask, _individualMoleculeParametersTask);

            _ontogeny = new DatabaseOntogeny
            {
                Name = "Ontogeny"
            };

            _enzyme = new IndividualEnzyme
            {
                Name        = "Enzyme",
                Description = "Help",
                Ontogeny    = _ontogeny,
            };

            _transporter = new IndividualTransporter
            {
                Name        = "Transporter",
                Description = "Help"
            };

            _otherProtein = new IndividualOtherProtein
            {
                Name        = "OtherProtein",
                Description = "Help"
            };

            _enzymeGlobalParameter         = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: true).WithName(CoreConstants.Parameters.HALF_LIFE_LIVER);
            _enzymeGlobalParameterSnapshot = new Parameter();

            A.CallTo(() => _parameterMapper.MapToSnapshot(_enzymeGlobalParameter)).Returns(_enzymeGlobalParameterSnapshot);

            _expressionContainer1 = new MoleculeExpressionContainer {
                Name = "Exp Container1"
            };
            _expressionContainer2 = new MoleculeExpressionContainer {
                Name = "Exp Container2"
            };
            _enzyme.AddChildren(_expressionContainer1, _expressionContainer2, _enzymeGlobalParameter);

            _relativeExpressionParameter1     = DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(CoreConstants.Parameters.REL_EXP);
            _relativeExpressionParameterNorm1 = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.REL_EXP_NORM);
            _expressionContainer1.Add(_relativeExpressionParameter1);
            _expressionContainer1.Add(_relativeExpressionParameterNorm1);

            _relativeExpressionParameterNotSet     = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.REL_EXP);
            _relativeExpressionParameterNotSetNorm = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.REL_EXP_NORM);
            _expressionContainer2.Add(_relativeExpressionParameterNotSet);
            _expressionContainer2.Add(_relativeExpressionParameterNotSetNorm);

            _relativeExpressionContainerSnapshot1 = new ExpressionContainer();
            _relativeExpressionContainerSnapshot2 = new ExpressionContainer();

            A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer1)).Returns(_relativeExpressionContainerSnapshot1);
            A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer2)).Returns(_relativeExpressionContainerSnapshot2);

            _snapshotOntogeny = new Snapshots.Ontogeny();
            A.CallTo(() => _ontogenyMapper.MapToSnapshot(_ontogeny)).Returns(_snapshotOntogeny);
            _individual = new Individual();

            return(_completed);
        }
 public IEnumerable <IContainer> AllContainersFor(Organism organism, IEnumerable <IContainer> allOrganismContainers, IndividualMolecule molecule, MoleculeExpressionContainer expressionContainer)
 {
     return(allContainersFor(organism, molecule, allOrganismContainers, expressionContainer));
 }
        protected override Task Context()
        {
            _parameterMapper           = A.Fake <ParameterMapper>();
            _expressionContainerMapper = A.Fake <ExpressionContainerMapper>();
            _expressionProfileFactory  = A.Fake <IExpressionProfileFactory>();
            _ontogenyMapper            = A.Fake <OntogenyMapper>();
            _ontogenyTask           = A.Fake <IOntogenyTask>();
            _moleculeExpressionTask = A.Fake <IMoleculeExpressionTask <Individual> >();
            _moleculeParameterTask  = A.Fake <IMoleculeParameterTask>();
            sut = new ExpressionProfileMapper(
                _parameterMapper,
                _expressionContainerMapper,
                _ontogenyMapper,
                _ontogenyTask,
                _moleculeExpressionTask,
                _expressionProfileFactory,
                _moleculeParameterTask);

            _ontogeny = new DatabaseOntogeny
            {
                Name = "Ontogeny"
            };

            _expressionProfileEnzyme = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>("Enzyme");
            _expressionProfileEnzyme.Molecule.Ontogeny = _ontogeny;
            _expressionProfileEnzyme.Description       = "Help";

            _expressionProfileTransporter             = DomainHelperForSpecs.CreateExpressionProfile <IndividualTransporter>("Transporter");
            _expressionProfileTransporter.Description = "Help";

            _expressionProfileOtherProtein = DomainHelperForSpecs.CreateExpressionProfile <IndividualOtherProtein>("OtherProtein");

            _enzymeGlobalParameter = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: true)
                                     .WithName(CoreConstants.Parameters.HALF_LIFE_LIVER);
            _enzymeGlobalParameterSnapshot = new Parameter();

            A.CallTo(() => _parameterMapper.MapToSnapshot(_enzymeGlobalParameter)).Returns(_enzymeGlobalParameterSnapshot);

            _expressionContainer1 = new MoleculeExpressionContainer {
                Name = "Exp Container1"
            };
            _expressionContainer2 = new MoleculeExpressionContainer {
                Name = "Exp Container2"
            };
            _expressionProfileEnzyme.Individual.AddChildren(_expressionContainer1, _expressionContainer2, _enzymeGlobalParameter);
            _expressionProfileEnzyme.Molecule.DowncastTo <IndividualEnzyme>().Localization = Localization.Intracellular | Localization.BloodCellsMembrane;

            _relativeExpressionParameter1 = DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(CoreConstants.Parameters.REL_EXP);
            _expressionContainer1.Add(_relativeExpressionParameter1);

            _relativeExpressionParameterNotSet = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.REL_EXP);
            _expressionContainer2.Add(_relativeExpressionParameterNotSet);

            _relativeExpressionContainerSnapshot1 = new ExpressionContainer();
            _relativeExpressionContainerSnapshot2 = new ExpressionContainer();

            A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer1)).Returns(_relativeExpressionContainerSnapshot1);
            A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer2)).Returns(_relativeExpressionContainerSnapshot2);

            _snapshotOntogeny = new Snapshots.Ontogeny();
            A.CallTo(() => _ontogenyMapper.MapToSnapshot(_ontogeny)).Returns(_snapshotOntogeny);
            _individual = new Individual();

            return(_completed);
        }