Exemplo n.º 1
0
        protected override void Context()
        {
            _view = A.Fake <IExpressionProfileMoleculesView>();
            _expressionProfileFactory = A.Fake <IExpressionProfileFactory>();
            _applicationController    = A.Fake <IApplicationController>();
            _mapper                               = A.Fake <IExpressionProfileToExpressionProfileDTOMapper>();
            _enzymePresenter                      = A.Fake <IIndividualEnzymeExpressionsPresenter <Individual> >();
            _expressionProfileUpdater             = A.Fake <IExpressionProfileUpdater>();
            _expressionProfileProteinDatabaseTask = A.Fake <IExpressionProfileProteinDatabaseTask>();
            _moleculeParameterTask                = A.Fake <IMoleculeParameterTask>();
            sut = new ExpressionProfileMoleculesPresenter(
                _view,
                _expressionProfileFactory,
                _applicationController,
                _mapper,
                _expressionProfileProteinDatabaseTask,
                _expressionProfileUpdater,
                _moleculeParameterTask);

            sut.InitializeWith(new PKSimMacroCommand());
            _expressionProfile    = A.Fake <ExpressionProfile>();
            _expressionProfileDTO = new ExpressionProfileDTO();
            _enzyme = new IndividualEnzyme();
            A.CallTo(() => _expressionProfile.Molecule).Returns(_enzyme);
            A.CallTo(() => _mapper.MapFrom(_expressionProfile)).Returns(_expressionProfileDTO);

            A.CallTo(() => _applicationController.Start <IIndividualEnzymeExpressionsPresenter <Individual> >()).Returns(_enzymePresenter);
        }
 public CreateExpressionProfilePresenter(
     ICreateExpressionProfileView view,
     IExpressionProfileFactory expressionProfileFactory,
     IExpressionProfileToExpressionProfileDTOMapper expressionProfileDTOMapper,
     IMoleculeParameterTask moleculeParameterTask,
     IDialogCreator dialogCreator) : base(view)
 {
     _expressionProfileFactory   = expressionProfileFactory;
     _expressionProfileDTOMapper = expressionProfileDTOMapper;
     _moleculeParameterTask      = moleculeParameterTask;
     _dialogCreator = dialogCreator;
 }
Exemplo n.º 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);
        }
 public ExpressionProfileMoleculesPresenter(
     IExpressionProfileMoleculesView view,
     IExpressionProfileFactory expressionProfileFactory,
     IApplicationController applicationController,
     IExpressionProfileToExpressionProfileDTOMapper expressionProfileDTOMapper,
     IExpressionProfileProteinDatabaseTask expressionProfileProteinDatabaseTask,
     IExpressionProfileUpdater expressionProfileUpdater,
     IMoleculeParameterTask moleculeParameterTask) : base(view)
 {
     _expressionProfileFactory             = expressionProfileFactory;
     _applicationController                = applicationController;
     _expressionProfileDTOMapper           = expressionProfileDTOMapper;
     _expressionProfileProteinDatabaseTask = expressionProfileProteinDatabaseTask;
     _expressionProfileUpdater             = expressionProfileUpdater;
     _moleculeParameterTask                = moleculeParameterTask;
 }
Exemplo n.º 5
0
 public MoleculeMapper(
     ParameterMapper parameterMapper,
     ExpressionContainerMapper expressionContainerMapper,
     OntogenyMapper ontogenyMapper,
     IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
     IExecutionContext executionContext,
     IOntogenyTask <ModelIndividual> ontogenyTask,
     IMoleculeParameterTask moleculeExpressionTask
     ) : base(parameterMapper)
 {
     _expressionContainerMapper         = expressionContainerMapper;
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _executionContext       = executionContext;
     _ontogenyTask           = ontogenyTask;
     _moleculeExpressionTask = moleculeExpressionTask;
     _ontogenyMapper         = ontogenyMapper;
 }
Exemplo n.º 6
0
        public ExpressionProfileMapper(
            ParameterMapper parameterMapper,
            ExpressionContainerMapper expressionContainerMapper,
            OntogenyMapper ontogenyMapper,
            IOntogenyTask ontogenyTask,
            IMoleculeExpressionTask <ModelIndividual> moleculeExpressionTask,
            IExpressionProfileFactory expressionProfileFactory,
            IMoleculeParameterTask moleculeParameterTask
            )
        {
            _parameterMapper           = parameterMapper;
            _expressionContainerMapper = expressionContainerMapper;
            _ontogenyTask             = ontogenyTask;
            _moleculeExpressionTask   = moleculeExpressionTask;
            _expressionProfileFactory = expressionProfileFactory;
            _moleculeParameterTask    = moleculeParameterTask;

            _ontogenyMapper = ontogenyMapper;
        }
Exemplo n.º 7
0
 public MoleculeExpressionTask(IApplicationController applicationController, IExecutionContext executionContext,
                               IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
                               IMoleculeToQueryExpressionSettingsMapper queryExpressionSettingsMapper,
                               IContainerTask containerTask,
                               IProteinExpressionsDatabasePathManager proteinExpressionsDatabasePathManager,
                               IOntogenyRepository ontogenyRepository,
                               ITransportContainerUpdater transportContainerUpdater,
                               ISimulationSubjectExpressionTask <TSimulationSubject> simulationSubjectExpressionTask,
                               IOntogenyTask <TSimulationSubject> ontogenyTask,
                               IMoleculeParameterTask moleculeParameterTask)
 {
     _applicationController             = applicationController;
     _executionContext                  = executionContext;
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _queryExpressionSettingsMapper     = queryExpressionSettingsMapper;
     _containerTask = containerTask;
     _proteinExpressionsDatabasePathManager = proteinExpressionsDatabasePathManager;
     _ontogenyRepository              = ontogenyRepository;
     _transportContainerUpdater       = transportContainerUpdater;
     _simulationSubjectExpressionTask = simulationSubjectExpressionTask;
     _ontogenyTask          = ontogenyTask;
     _moleculeParameterTask = moleculeParameterTask;
 }
Exemplo n.º 8
0
        protected override void Context()
        {
            _view = A.Fake <ICreateExpressionProfileView>();
            _expressionProfileFactory   = A.Fake <IExpressionProfileFactory>();
            _expressionProfileDTOMapper = A.Fake <IExpressionProfileToExpressionProfileDTOMapper>();
            _moleculeParameterTask      = A.Fake <IMoleculeParameterTask>();
            _dialogCreator = A.Fake <IDialogCreator>();
            sut            = new CreateExpressionProfilePresenter(_view, _expressionProfileFactory, _expressionProfileDTOMapper, _moleculeParameterTask, _dialogCreator);

            _expressionProfile        = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>();
            _updatedExpressionProfile = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>();
            _expressionProfileDTO     = new ExpressionProfileDTO
            {
                Species      = new Species(),
                MoleculeName = "TOTO"
            };

            A.CallTo(() => _expressionProfileFactory.Create <IndividualEnzyme>()).Returns(_expressionProfile);

            A.CallTo(() => _expressionProfileDTOMapper.MapFrom(_expressionProfile)).Returns(_expressionProfileDTO);

            A.CallTo(() => _expressionProfileFactory.Create <IndividualEnzyme>(_expressionProfileDTO.Species, _expressionProfileDTO.MoleculeName))
            .Returns(_updatedExpressionProfile);
        }
Exemplo n.º 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);
        }