Ejemplo n.º 1
0
        private void updateTransporterContainerFromTemplate(TransporterExpressionContainer expressionContainer,
                                                            TransporterContainerTemplate transporterContainerTemplate, TransportType defaultTransportType)
        {
            var transportType = transporterContainerTemplate?.TransportType ?? defaultTransportType;

            expressionContainer.TransportDirection = TransportDirections.DefaultDirectionFor(transportType, expressionContainer);
        }
        public void should_return_the_expected_direction_for_tissue()
        {
            _transporterExpressionContainer.WithParentContainer(_bone_cell);
            TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.InfluxInterstitialToIntracellular);

            TransportDirections.DefaultDirectionFor(TransportType.BiDirectional, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.BiDirectionalInterstitialIntracellular);

            TransportDirections.DefaultDirectionFor(TransportType.Efflux, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.EffluxIntracellularToInterstitial);
        }
        public void should_return_the_expected_direction_for_liver_and_kidney()
        {
            _transporterExpressionContainer.WithParentContainer(_liver_cell);
            _transporterExpressionContainer.TransportDirection = TransportDirectionId.ExcretionLiver;
            TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.ExcretionLiver);

            TransportDirections.DefaultDirectionFor(TransportType.Efflux, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.ExcretionLiver);

            _transporterExpressionContainer.WithParentContainer(_kidney_cell);
            _transporterExpressionContainer.TransportDirection = TransportDirectionId.ExcretionKidney;
            TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.ExcretionKidney);

            TransportDirections.DefaultDirectionFor(TransportType.Efflux, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.ExcretionKidney);
        }
Ejemplo n.º 4
0
        private void convertIndividualTransporter(IndividualMolecule moleculeToConvert, IndividualMolecule newMolecule, Individual individual)
        {
            var transporterToConvert = moleculeToConvert as IndividualTransporter;
            var newTransporter       = newMolecule as IndividualTransporter;

            if (transporterToConvert == null || newTransporter == null)
            {
                return;
            }

            newTransporter.TransportType = transporterToConvert.TransportType;

            var allTransporterExpressionContainers = individual.AllMoleculeContainersFor <TransporterExpressionContainer>(newTransporter)
                                                     .Where(x => x.TransportDirection != TransportDirectionId.None).ToList();

            //Ensure we update the default direction based on the selected transporter type
            allTransporterExpressionContainers.Each(x => x.TransportDirection = TransportDirections.DefaultDirectionFor(newTransporter.TransportType, x));

            moleculeToConvert.GetAllChildren <TransporterExpressionContainer>().Each(x => convertTransportContainer(x, allTransporterExpressionContainers));
        }
        public void should_return_the_expected_direction_for_organ_with_lumen()
        {
            _transporterExpressionContainer.WithParentContainer(_mucosaDuodenumInt);
            TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.InfluxInterstitialToIntracellular);

            TransportDirections.DefaultDirectionFor(TransportType.BiDirectional, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.BiDirectionalInterstitialIntracellular);

            TransportDirections.DefaultDirectionFor(TransportType.Efflux, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.EffluxIntracellularToInterstitial);

            _transporterExpressionContainer.WithParentContainer(_mucosaDuodenumCell);
            TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.InfluxLumenToMucosaIntracellular);

            TransportDirections.DefaultDirectionFor(TransportType.BiDirectional, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.BiDirectionalLumenMucosaIntracellular);

            TransportDirections.DefaultDirectionFor(TransportType.Efflux, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.EffluxMucosaIntracellularToLumen);
        }
        public void should_return_the_expected_direction_for_brain()
        {
            _transporterExpressionContainer.WithParentContainer(_brain_pls);
            TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.InfluxBrainPlasmaToInterstitial);

            TransportDirections.DefaultDirectionFor(TransportType.BiDirectional, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.BiDirectionalBrainPlasmaInterstitial);

            TransportDirections.DefaultDirectionFor(TransportType.Efflux, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.EffluxBrainInterstitialToPlasma);

            _transporterExpressionContainer.WithParentContainer(_brain_cell);
            TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.InfluxBrainInterstitialToTissue);

            TransportDirections.DefaultDirectionFor(TransportType.BiDirectional, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.BiDirectionalBrainInterstitialTissue);

            TransportDirections.DefaultDirectionFor(TransportType.Efflux, _transporterExpressionContainer)
            .ShouldBeEqualTo(TransportDirectionId.EffluxBrainTissueToInterstitial);
        }
Ejemplo n.º 7
0
 public void should_use_the_default_settings_otherwise()
 {
     _transporterWithoutTemplate.TransportDirection.ShouldBeEqualTo(TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterWithoutTemplate));
 }
Ejemplo n.º 8
0
 public void should_use_the_template_defined_in_the_database_if_available()
 {
     _transporterWithTemplate.TransportDirection.ShouldBeEqualTo(TransportDirections.DefaultDirectionFor(TransportType.Influx, _transporterWithTemplate));
 }
Ejemplo n.º 9
0
        public override async Task <MoleculeExpressionContainer> MapToModel(ExpressionContainer snapshot, ExpressionContainerMapperContext snapshotContext)
        {
            if (snapshot == null)
            {
                return(null);
            }

            var molecule = snapshotContext.Molecule;
            var expressionParameterCache      = snapshotContext.ExpressionParameters;
            var expressionContainerParameters = snapshotContext.MoleculeExpressionContainers;

            //Value was only defined for older version of the snapshot
            if (snapshot.Value.HasValue)
            {
                var relExp = expressionParameterCache[snapshot.Name];
                if (relExp == null)
                {
                    _logger.AddWarning(PKSimConstants.Error.RelativeExpressionContainerNotFound(snapshot.Name));
                    return(null);
                }

                await _parameterMapper.MapToModel(snapshot, new ParameterSnapshotContext(relExp, snapshotContext));
            }


            //We do not return anything as container are created at construction time
            if (!(molecule is IndividualTransporter transporter))
            {
                return(null);
            }

            var expressionsContainers = expressionContainerParameters.OfType <TransporterExpressionContainer>()
                                        .Where(queryPredicate(snapshotContext.IsV9FormatOrEarlier, snapshot))
                                        .Where(x => x.TransportDirection != TransportDirectionId.None)
                                        .ToList();

            if (expressionsContainers.Count == 0)
            {
                _logger.AddWarning(PKSimConstants.Error.RelativeExpressionContainerNotFound(snapshot.Name));
                return(null);
            }

            var firstExpressionContainer = expressionsContainers[0];

            //This is the new format
            if (!snapshotContext.IsV9FormatOrEarlier)
            {
                //we should only have one
                firstExpressionContainer.TransportDirection = snapshot.TransportDirection.Value;
                return(firstExpressionContainer);
            }

            expressionsContainers.Each(x => x.TransportDirection = TransportDirections.DefaultDirectionFor(transporter.TransportType, x));

            //only one direction to take into consideration. all good, nothing else to do
            if (expressionsContainers.Count == 1)
            {
                return(firstExpressionContainer);
            }

            //This is the old format. Basolateral was the default
            var membraneLocation = ModelValueFor(snapshot.MembraneLocation, MembraneLocation.Basolateral);

            MembraneLocationConverter.ConvertMembraneLocationToParameterFraction(expressionsContainers, membraneLocation);
            return(firstExpressionContainer);
        }