protected override void Context()
 {
     _view = A.Fake <IMoleculesView>();
     A.CallTo(() => _view.TreeView).Returns(A.Fake <IUxTreeView>());
     _moleculeExpressionTask     = A.Fake <IMoleculeExpressionTask <Individual> >();
     _treeNodeFactory            = A.Fake <ITreeNodeFactory>();
     _contextMenyFactory         = A.Fake <ITreeNodeContextMenuFactory>();
     _dialogCreator              = A.Fake <IDialogCreator>();
     _entityTask                 = A.Fake <IEntityTask>();
     _commandRegister            = A.Fake <ICommandCollector>();
     _expressionsPresenterMapper = A.Fake <IRootNodeToIndividualExpressionsPresenterMapper <Individual> >();
     _noitemInSelectionPresenter = A.Fake <INoItemInSelectionPresenter>();
     _enzymeList                 = new List <IndividualEnzyme>();
     _moleculeList               = new List <IndividualMolecule>();
     _otherProteinList           = new List <IndividualOtherProtein>();
     _transporterList            = new List <IndividualTransporter>();
     _individual                 = A.Fake <Individual>();
     _enzymeFolderNode           = new RootNode(PKSimRootNodeTypes.IndividualMetabolizingEnzymes);
     _otherProteinsFolderNode    = new RootNode(PKSimRootNodeTypes.IndividualProteinBindingPartners);
     _transporterFolderNode      = new RootNode(PKSimRootNodeTypes.IndividualTransportProteins);
     A.CallTo(() => _individual.AllMolecules <IndividualEnzyme>()).Returns(_enzymeList);
     A.CallTo(() => _individual.AllMolecules <IndividualOtherProtein>()).Returns(_otherProteinList);
     A.CallTo(() => _individual.AllMolecules <IndividualTransporter>()).Returns(_transporterList);
     A.CallTo(() => _individual.AllMolecules()).Returns(_moleculeList);
     A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.IndividualMetabolizingEnzymes)).Returns(_enzymeFolderNode);
     A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.IndividualProteinBindingPartners)).Returns(_otherProteinsFolderNode);
     A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.IndividualTransportProteins)).Returns(_transporterFolderNode);
     A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.IndividualMetabolizingEnzymes.Id)).Returns(_enzymeFolderNode);
     A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.IndividualProteinBindingPartners.Id)).Returns(_otherProteinsFolderNode);
     A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.IndividualTransportProteins.Id)).Returns(_transporterFolderNode);
     sut = new IndividualMoleculesPresenter(_view, _moleculeExpressionTask, _treeNodeFactory, _contextMenyFactory, _dialogCreator, _entityTask, _expressionsPresenterMapper, _noitemInSelectionPresenter);
     sut.InitializeWith(_commandRegister);
 }
示例#2
0
        public void Visit(Individual individual)
        {
            _individualCalculationMethodsUpdater.AddMissingCalculationMethodsTo(individual);

            performCommonConversion(individual);
            Visit(individual.OriginData);

            foreach (var transporter in individual.AllMolecules <IndividualTransporter>().SelectMany(x => x.AllExpressionsContainers()))
            {
                var oldProcessNames = transporter.ProcessNames.ToList();
                transporter.ClearProcessNames();
                foreach (var processName in oldProcessNames)
                {
                    transporter.AddProcessName(processName.Replace("_MM", ""));
                }
            }

            //change container type for molecules
            foreach (var molecule in individual.AllMolecules())
            {
                molecule.ContainerType = ContainerType.Molecule;
                updateOntogeny(molecule);
            }

            //special parameters that need conversion by hand
            convertIndividualParameters(individual.Organism);
            convertIndividualForTwoPore(individual);

            var human = _defaultIndividualRetriever.DefaultHuman();

            individual.Organism.Add(clone(human.Organism, CoreConstants.Parameters.ONTOGENY_FACTOR_ALBUMIN));
            individual.Organism.Add(clone(human.Organism, CoreConstants.Parameters.ONTOGENY_FACTOR_AGP));
            individual.Organism.Add(clone(human.Organism, CoreConstants.Parameters.PLASMA_PROTEIN_SCALE_FACTOR));


            if (!individual.IsHuman)
            {
                individual.OriginData.AddCalculationMethod(_calculationMethodRepository.FindByName("MucosaVolume_Animals"));
            }
            else
            {
                individual.OriginData.AddCalculationMethod(_calculationMethodRepository.FindByName("MucosaVolume_Human"));
                individual.OriginData.GestationalAge     = CoreConstants.NOT_PRETERM_GESTATIONAL_AGE_IN_WEEKS;
                individual.OriginData.GestationalAgeUnit = CoreConstants.Units.Weeks;

                var gestationalAge = human.Organism.Parameter(Constants.Parameters.GESTATIONAL_AGE);

                if (!individual.Organism.ContainsName(Constants.Parameters.GESTATIONAL_AGE))
                {
                    individual.Organism.Add(_cloner.Clone(gestationalAge));
                }
            }
        }
示例#3
0
        public void should_have_set_the_ontogeny_factor_as_visible()
        {
            foreach (var plasmaOntogenyFactoryName in CoreConstants.Parameter.AllPlasmaProteinOntogenyFactors)
            {
                _individual.Organism.Parameter(plasmaOntogenyFactoryName).Visible.ShouldBeTrue();
            }

            foreach (var molecule in _individual.AllMolecules())
            {
                molecule.OntogenyFactorParameter.Visible.ShouldBeTrue();
                molecule.OntogenyFactorGIParameter.Visible.ShouldBeTrue();
            }
        }
        public void should_have_removed_the_ontogeny_factor_from_all_container_in_the_individual()
        {
            foreach (var molecule in _individual.AllMolecules())
            {
                molecule.Parameter(CoreConstants.Parameters.ONTOGENY_FACTOR).ShouldNotBeNull();
                if (molecule.Name != CoreConstants.Molecule.UndefinedLiver)
                {
                    molecule.Parameter(CoreConstants.Parameters.ONTOGENY_FACTOR_GI).ShouldNotBeNull();
                }

                foreach (var container in molecule.AllExpressionsContainers())
                {
                    container.Parameter(CoreConstants.Parameters.ONTOGENY_FACTOR).ShouldBeNull();
                }
            }
        }
示例#5
0
 public void should_have_converted_the_protein_expression_container_in_molecule_expression_container()
 {
     _individual.AllMolecules().Count().ShouldBeEqualTo(1);
     _population.AllMolecules().Count().ShouldBeEqualTo(1);
     _indSimulation.Individual.AllMolecules().Count().ShouldBeEqualTo(1);
     _popSimulation.Population.AllMolecules().Count().ShouldBeEqualTo(1);
 }
示例#6
0
 private void assertTransporterHaveTheRightTransportName(Individual individual)
 {
     foreach (var transporter in individual.AllMolecules <IndividualTransporter>())
     {
         transporter.AllInducedProcesses().Each(p => p.Contains("_MM").ShouldBeFalse());
     }
 }
示例#7
0
 public void should_have_changed_the_container_type_of_all_individual_molecule()
 {
     foreach (var molecule in _individual.AllMolecules())
     {
         molecule.ContainerType.ShouldBeEqualTo(ContainerType.Molecule);
     }
 }
示例#8
0
        public void should_have_replaced_the_reference_to_liver_with_pericentral_and_periportal_in_the_database_query()
        {
            var enzyme = _individual.AllMolecules().First();

            enzyme.QueryConfiguration.Contains(CoreConstants.Compartment.Pericentral).ShouldBeTrue();
            enzyme.QueryConfiguration.Contains(CoreConstants.Compartment.Periportal).ShouldBeTrue();
        }
示例#9
0
        private void validateIndividual(Individual individual)
        {
            var molecule = individual.AllMolecules().First();

            molecule.Ontogeny.ShouldNotBeNull();
            molecule.OntogenyFactorParameter.ShouldNotBeNull();
            molecule.OntogenyFactorGIParameter.ShouldNotBeNull();
        }
示例#10
0
 public void Update(Individual sourceIndividual, Individual targetIndividual)
 {
     foreach (var molecule in sourceIndividual.AllMolecules())
     {
         var newMolecule = _cloner.Clone(molecule);
         targetIndividual.AddMolecule(newMolecule);
         //we have to reset the new ontogeny for the molecule
         _ontogenyTask.SetOntogenyForMolecule(newMolecule, newMolecule.Ontogeny, targetIndividual);
     }
 }
        private void verifyIndividual(Individual individual)
        {
            individual.AllMolecules <IndividualProtein>().Each(m =>
            {
                m.Localization.ShouldNotBeEqualTo(Localization.None);

                //Should have created parameters in most compartments. About 30+
                var allExpressionParameters = individual.AllExpressionParametersFor(m);
                allExpressionParameters.Count.ShouldBeGreaterThan(30);
            });
        }
示例#12
0
        public void Update(Individual sourceIndividual, Individual targetIndividual)
        {
            foreach (var molecule in sourceIndividual.AllMolecules())
            {
                var newMolecule = _cloner.Clone(molecule);
                targetIndividual.AddMolecule(newMolecule);

                //Make sure parameters that user defined parameters are reset to default to ensure proper scaling
                resetMoleculeParametersToDefault(newMolecule);

                //we have to reset the ontogeny for the molecule based on the target individual properties
                _ontogenyTask.SetOntogenyForMolecule(newMolecule, newMolecule.Ontogeny, targetIndividual);
            }
        }
示例#13
0
 private void updateLiverExpressions(Individual individual)
 {
     individual.AllMolecules().Each(updateLiverMoleculeExpression);
 }
示例#14
0
 private void addIndividualMolecules(IEnumerable <CompoundProperties> compoundPropertiesList)
 {
     //first of all: add undefined proteins that are created internaly and are necessary to use the systemic processes
     compoundPropertiesList.Select(x => x.Processes).Each(addUndefinedProteinForSystemicProcessesToIndividual);
     _individual.AllMolecules().Each(addMolecule);
 }
 public void should_have_set_the_dimension_of_relative_expression_in_individual_molecules_to_dimensionsless()
 {
     _individual.AllMolecules().SelectMany(x => x.AllExpressionsContainers())
     .Select(x => x.RelativeExpressionParameter)
     .Each(p => p.Dimension.ShouldBeEqualTo(Constants.Dimension.NO_DIMENSION));
 }