Пример #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
            };
        }
Пример #2
0
 protected override void Context()
 {
     _expressionContainer = new MoleculeExpressionContainer().WithName("tralal");
     _expressionContainer.Add(A.Fake <IParameter>().WithName(CoreConstants.Parameters.REL_EXP));
     _expressionContainer.Add(A.Fake <IParameter>().WithName(CoreConstants.Parameters.REL_EXP_NORM));
     _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);
 }
Пример #3
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()
        {
            _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);
        }
Пример #5
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);
 }
        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
                );
        }
Пример #7
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);
        }
Пример #9
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);
        }
        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);
        }