private ExpressionContainerDTO expressionContainerFor(IParameter relativeExpression, IParameter relativeExpressioNorm) { var expressionContainerDTO = new ExpressionContainerDTO(); var moleculeName = relativeExpression.ParentContainer.Name; var simulation = _executionContext.Get <Simulation>(relativeExpression.Origin.SimulationId); var molecule = simulation.Individual?.MoleculeByName <IndividualMolecule>(moleculeName); var isTransporter = moleculeIsTransporter(molecule); expressionContainerDTO.RelativeExpressionParameter = _containerParameterMapper.MapFrom(relativeExpression, expressionContainerDTO, x => x.RelativeExpression, x => x.RelativeExpressionParameter); expressionContainerDTO.RelativeExpressionNormParameter = _containerParameterMapper.MapFrom(relativeExpressioNorm, expressionContainerDTO, x => x.RelativeExpressionNorm, x => x.RelativeExpressionNormParameter); IGroup group; if (parameterIsGlobalExpression(relativeExpression)) { if (isTransporter) { return(null); } group = _groupRepository.GroupByName(CoreConstants.Groups.VASCULAR_SYSTEM); expressionContainerDTO.ContainerPathDTO = _representationInfoRepository.InfoFor(RepresentationObjectType.CONTAINER, containerNameForGlobalExpression(relativeExpression.Name)).ToPathElement(); expressionContainerDTO.Sequence = relativeExpression.Sequence; } else if (expressionShouldBeTreatedAsGlobal(relativeExpression, isTransporter)) { return(null); } else if (relativeExpression.HasAncestorNamed(CoreConstants.Organ.Lumen)) { group = _groupRepository.GroupByName(CoreConstants.Groups.GI_LUMEN); expressionContainerDTO.ContainerPathDTO = _representationInfoRepository.InfoFor(relativeExpression.ParentContainer.ParentContainer).ToPathElement(); } else if (relativeExpression.HasAncestorNamed(CoreConstants.Compartment.Mucosa)) { group = _groupRepository.GroupByName(CoreConstants.Groups.GI_MUCOSA); //Mucosa rel exp are for instance in Mucosa/Duodnum/interstitial expressionContainerDTO.ContainerPathDTO = _representationInfoRepository.InfoFor(relativeExpression.ParentContainer.ParentContainer.ParentContainer).ToPathElement(); } else { var expressionContainer = expressionContainerFor(relativeExpression); group = _groupRepository.GroupByName(isGiTractOrgan(expressionContainer) ? CoreConstants.Groups.GI_NON_MUCOSA_TISSUE : CoreConstants.Groups.ORGANS_AND_TISSUES); expressionContainerDTO.ContainerPathDTO = _representationInfoRepository.InfoFor(expressionContainer).ToPathElement(); } expressionContainerDTO.GroupingPathDTO = _representationInfoRepository.InfoFor(RepresentationObjectType.GROUP, group.Name).ToPathElement(); //May have been set previously if (expressionContainerDTO.Sequence == 0) { expressionContainerDTO.Sequence = group.Sequence; } expressionContainerDTO.MoleculeName = moleculeName; expressionContainerDTO.ParameterPath = _fullPathDisplayResolver.FullPathFor(relativeExpression); return(expressionContainerDTO); }
public SchemaItemDTO MapFrom(SchemaItem schemaItem) { var schemaItemDTO = new SchemaItemDTO(schemaItem); schemaItemDTO.DoseParameter = _parameterDTOMapper.MapFrom(schemaItem.Dose, schemaItemDTO, x => x.Dose, x => x.DoseParameter); schemaItemDTO.StartTimeParameter = _parameterDTOMapper.MapFrom(schemaItem.StartTime, schemaItemDTO, x => x.StartTime, x => x.StartTimeParameter); return(schemaItemDTO); }
public IdentificationParameterDTO MapFrom(IdentificationParameter identificationParameter) { var identificationParameterDTO = new IdentificationParameterDTO(identificationParameter); identificationParameterDTO.StartValueParameter = _parameterMapper.MapFrom(identificationParameter.StartValueParameter, identificationParameterDTO, x => x.StartValue, x => x.StartValueParameter); identificationParameterDTO.MinValueParameter = _parameterMapper.MapFrom(identificationParameter.MinValueParameter, identificationParameterDTO, x => x.MinValue, x => x.MinValueParameter); identificationParameterDTO.MaxValueParameter = _parameterMapper.MapFrom(identificationParameter.MaxValueParameter, identificationParameterDTO, x => x.MaxValue, x => x.MaxValueParameter); return(identificationParameterDTO); }
private TypePKaDTO typePKaFor(IList <IParameter> compoundParameters, string parameterPka1, string parameterCompoundType1) { var pKaParameter = compoundParameters.FindByName(parameterPka1); var compoundTypeParameter = compoundParameters.FindByName(parameterCompoundType1); var dto = new TypePKaDTO(); dto.CompoundTypeParameter = _parameterMapper.MapFrom(compoundTypeParameter, dto, x => x.CompoundTypeValue, x => x.CompoundTypeParameter); dto.PKaParameter = _parameterMapper.MapFrom(pKaParameter, dto, x => x.PKa, x => x.PKaParameter); return(dto); }
public SchemaDTO MapFrom(Schema schema) { var schemaDTO = new SchemaDTO(schema, schema.TimeBetweenRepetitions.Dimension); schemaDTO.TimeBetweenRepetitionsParameter = _parameterDTOMapper.MapFrom(schema.TimeBetweenRepetitions, schemaDTO, x => x.TimeBetweenRepetitions, x => x.TimeBetweenRepetitionsParameter); schemaDTO.StartTimeParameter = _parameterDTOMapper.MapFrom(schema.StartTime, schemaDTO, x => x.StartTime, x => x.StartTimeParameter); schemaDTO.NumberOfRepetitionsParameter = _parameterDTOMapper.MapFrom(schema.NumberOfRepetitions, schemaDTO, x => x.NumberOfRepetitions, x => x.NumberOfRepetitionsParameter); schema.SchemaItems.OrderBy(x => x.Name).Each(item => schemaDTO.AddSchemaItem(_schemaItemDtoMapper.MapFrom(item))); return(schemaDTO); }
private void addTypePKaFor(CompoundTypeDTO compoundTypeDTO, IList <IParameter> compoundParameters, string parameterPka1, string parameterCompoundType1) { var pKaParameter = compoundParameters.FindByName(parameterPka1); var compoundTypeParameter = compoundParameters.FindByName(parameterCompoundType1); var typePKaDTO = new TypePKaDTO(); typePKaDTO.CompoundTypeParameter = _parameterMapper.MapFrom(compoundTypeParameter, typePKaDTO, x => x.CompoundTypeValue, x => x.CompoundTypeParameter); typePKaDTO.PKaParameter = _parameterMapper.MapFrom(pKaParameter, typePKaDTO, x => x.PKa, x => x.PKaParameter); compoundTypeDTO.AddTypePKa(typePKaDTO); }
public OutputIntervalDTO MapFrom(OutputInterval outputInterval) { var outputIntervalDTO = new OutputIntervalDTO { OutputInterval = outputInterval }; outputIntervalDTO.StartTimeParameter = _parameterDTOMapper.MapFrom(outputInterval.StartTime, outputIntervalDTO, x => x.StartTime, x => x.StartTimeParameter); outputIntervalDTO.EndTimeParameter = _parameterDTOMapper.MapFrom(outputInterval.EndTime, outputIntervalDTO, x => x.EndTime, x => x.EndTimeParameter); outputIntervalDTO.ResolutionParameter = _parameterDTOMapper.MapFrom(outputInterval.Resolution, outputIntervalDTO, x => x.Resolution, x => x.ResolutionParameter); return(outputIntervalDTO); }
public SensitivityParameterDTO MapFrom(SensitivityParameter sensitivityParameter) { var sensitivityParameterDTO = new SensitivityParameterDTO(sensitivityParameter); sensitivityParameterDTO.NumberOfStepsParameter = _parameterMapper.MapFrom(sensitivityParameter.NumberOfStepsParameter, sensitivityParameterDTO, x => x.NumberOfSteps, x => x.NumberOfStepsParameter); sensitivityParameterDTO.VariationRangeParameter = _parameterMapper.MapFrom(sensitivityParameter.VariationRangeParameter, sensitivityParameterDTO, x => x.VariationRange, x => x.VariationRangeParameter); sensitivityParameterDTO.DisplayPath = sensitivityParameter.Parameter != null?_quantityDisplayPathMapper.DisplayPathAsStringFor(sensitivityParameter.Parameter, addSimulationName : true) : sensitivityParameter.ParameterSelection.Path; return(sensitivityParameterDTO); }
public MoleculePropertiesDTO MapFrom(IndividualMolecule molecule) { var dto = new MoleculePropertiesDTO(molecule) { MoleculeType = _objectTypeResolver.TypeFor(molecule) }; dto.ReferenceConcentrationParameter = _parameterMapper.MapFrom(molecule.ReferenceConcentration, dto, x => x.ReferenceConcentration, x => x.ReferenceConcentrationParameter); dto.HalfLifeLiverParameter = _parameterMapper.MapFrom(molecule.HalfLifeLiver, dto, x => x.HalfLifeLiver, x => x.HalfLifeLiverParameter); dto.HalfLifeIntestineParameter = _parameterMapper.MapFrom(molecule.HalfLifeIntestine, dto, x => x.HalfLifeIntestine, x => x.HalfLifeIntestineParameter); return(dto); }
public SolubilityAlternativeDTO MapFrom(ParameterAlternative parameterAlternative) { var solubilityAlternativeDTO = new SolubilityAlternativeDTO(parameterAlternative); var solubility = parameterAlternative.Parameter(CoreConstants.Parameter.SolubilityAtRefpH); var refPh = parameterAlternative.Parameter(CoreConstants.Parameter.RefpH); var gainPerCharge = parameterAlternative.Parameter(CoreConstants.Parameter.SolubilityGainPerCharge); solubilityAlternativeDTO.SolubilityParameter = _parameterDTOMapper.MapFrom(solubility, solubilityAlternativeDTO, dto => dto.Solubility, dto => dto.SolubilityParameter); solubilityAlternativeDTO.RefpHParameter = _parameterDTOMapper.MapFrom(refPh, solubilityAlternativeDTO, dto => dto.RefpH, dto => dto.RefpHParameter); solubilityAlternativeDTO.GainPerChargeParameter = _parameterDTOMapper.MapFrom(gainPerCharge, solubilityAlternativeDTO, dto => dto.GainPerCharge, dto => dto.GainPerChargeParameter); return(solubilityAlternativeDTO); }
public PermeabilityAlternativeDTO MapFrom(ParameterAlternative parameterAlternative, string parameterName) { var permeability = parameterAlternative.Parameter(parameterName); var permeabilityAlternativeDTO = new PermeabilityAlternativeDTO(parameterAlternative, permeability.ValueOrigin); permeabilityAlternativeDTO.PermeabilityParameter = _parameterDTOMapper.MapFrom(permeability, permeabilityAlternativeDTO, dto => dto.Permeability, dto => dto.PermeabilityParameter); return(permeabilityAlternativeDTO); }
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); }
public LipophilictyAlternativeDTO MapFrom(ParameterAlternative parameterAlternative) { var lipophilicity = parameterAlternative.Parameter(CoreConstants.Parameters.LIPOPHILICITY); var lipophilictyAlternativeDTO = new LipophilictyAlternativeDTO(parameterAlternative, lipophilicity.ValueOrigin); lipophilictyAlternativeDTO.LipophilictyParameter = _parameterDTOMapper.MapFrom(lipophilicity, lipophilictyAlternativeDTO, dto => dto.Lipophilicty, dto => dto.LipophilictyParameter); return(lipophilictyAlternativeDTO); }
public FractionUnboundAlternativeDTO MapFrom(ParameterAlternativeWithSpecies parameterAlternative) { var fractionUnbound = parameterAlternative.Parameter(CoreConstants.Parameters.FRACTION_UNBOUND_PLASMA_REFERENCE_VALUE); var fractionUnboundAlternativeDTO = new FractionUnboundAlternativeDTO(parameterAlternative, fractionUnbound.ValueOrigin); fractionUnboundAlternativeDTO.FractionUnboundParameter = _parameterDTOMapper.MapFrom(fractionUnbound, fractionUnboundAlternativeDTO, dto => dto.FractionUnbound, dto => dto.FractionUnboundParameter); return(fractionUnboundAlternativeDTO); }
public LipophilictyAlternativeDTO MapFrom(ParameterAlternative parameterAlternative) { var lipophilictyAlternativeDTO = new LipophilictyAlternativeDTO(parameterAlternative); var lipophilicity = parameterAlternative.Parameter(CoreConstants.Parameter.Lipophilicity); lipophilictyAlternativeDTO.LipophilictyParameter = _parameterDTOMapper.MapFrom(lipophilicity, lipophilictyAlternativeDTO, dto => dto.Lipophilicty, dto => dto.LipophilictyParameter); return(lipophilictyAlternativeDTO); }
public FractionUnboundAlternativeDTO MapFrom(ParameterAlternativeWithSpecies parameterAlternative) { var fractionUnboundAlternativeDTO = new FractionUnboundAlternativeDTO(parameterAlternative); var lipophilicity = parameterAlternative.Parameter(CoreConstants.Parameter.FractionUnbound); fractionUnboundAlternativeDTO.FractionUnboundParameter = _parameterDTOMapper.MapFrom(lipophilicity, fractionUnboundAlternativeDTO, dto => dto.FractionUnbound, dto => dto.FractionUnboundParameter); return(fractionUnboundAlternativeDTO); }
public SolubilityAlternativeDTO MapFrom(ParameterAlternative parameterAlternative) { var solubilityAtRefPh = parameterAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_AT_REFERENCE_PH); var solubilityTable = parameterAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_TABLE); var solubilityParameter = solubilityTable.Formula.IsTable() ? solubilityTable : solubilityAtRefPh; var solubilityAlternativeDTO = new SolubilityAlternativeDTO(parameterAlternative, solubilityParameter.ValueOrigin); solubilityAlternativeDTO.SolubilityParameter = _parameterDTOMapper.MapFrom(solubilityParameter, solubilityAlternativeDTO, dto => dto.Solubility, dto => dto.SolubilityParameter); var refPh = parameterAlternative.Parameter(CoreConstants.Parameters.REFERENCE_PH); solubilityAlternativeDTO.RefpHParameter = _parameterDTOMapper.MapFrom(refPh, solubilityAlternativeDTO, dto => dto.RefpH, dto => dto.RefpHParameter); var gainPerCharge = parameterAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_GAIN_PER_CHARGE); solubilityAlternativeDTO.GainPerChargeParameter = _parameterDTOMapper.MapFrom(gainPerCharge, solubilityAlternativeDTO, dto => dto.GainPerCharge, dto => dto.GainPerChargeParameter); return(solubilityAlternativeDTO); }
public EventMappingDTO MapFrom(IEventMapping eventMapping, PKSim.Core.Model.Simulation simulation) { var eventMappingDTO = new EventMappingDTO(eventMapping); eventMappingDTO.StartTimeParameter = _parameterDTOMapper.MapFrom(eventMapping.StartTime, eventMappingDTO, x => x.StartTime, x => x.StartTimeParameter); var templateEvent = _buildingBlockRepository.All <PKSim.Core.Model.PKSimEvent>().FindById(eventMapping.TemplateEventId); var usedEvent = simulation.UsedBuildingBlockByTemplateId(eventMapping.TemplateEventId); //simulation was already using an event based on template. Retrieved the building block used if (usedEvent != null) { templateEvent = _buildingBlockInSimulationManager.TemplateBuildingBlockUsedBy <PKSim.Core.Model.PKSimEvent>(usedEvent); } eventMappingDTO.Event = templateEvent; return(eventMappingDTO); }
private TExpressionParameterDTO createExpressionContainerParameterDTOFrom(string containerName, string compartmentName, string groupName, IParameter moleculeParameter) { var moleculeName = moleculeParameter.ParentContainer.Name; var group = _groupRepository.GroupByName(groupName); var dto = new TExpressionParameterDTO { MoleculeName = moleculeName, ContainerName = containerName, CompartmentName = compartmentName, GroupName = groupName, GroupingPathDTO = _representationInfoRepository.PathElementFor(RepresentationObjectType.GROUP, groupName), ContainerPathDTO = _representationInfoRepository.PathElementFor(RepresentationObjectType.CONTAINER, containerName), CompartmentPathDTO = _representationInfoRepository.PathElementFor(RepresentationObjectType.CONTAINER, compartmentName), Sequence = group.Sequence }; dto.Parameter = _parameterMapper.MapFrom(moleculeParameter, dto, x => x.Value, x => x.Parameter); return(dto); }