Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2640 export initial conditions for expressions as part of the expression profile #2649

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/PKSim.Assets.Images/PKSim.Assets.Images.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.188" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.188" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.Assets/PKSim.Assets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.188" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.188" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.BatchTool/PKSim.BatchTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Core" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.186" />
<PackageReference Include="OSPSuite.Core" Version="12.0.188" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.188" />
<PackageReference Include="OSPSuite.DevExpress" Version="21.2.3" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.CLI.Core/PKSim.CLI.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.188" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.186" />
<PackageReference Include="OSPSuite.Core" Version="12.0.188" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/PKSim.CLI/PKSim.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.0" />
<PackageReference Include="OSPSuite.Core" Version="12.0.186" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.186" />
<PackageReference Include="OSPSuite.Core" Version="12.0.188" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.188" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.188" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public QueryExpressionSettings MapFrom(IndividualMolecule molecule, ISimulationS
public QueryExpressionSettings MapFrom(ExpressionProfileBuildingBlock expressionProfileBuildingBlock)
{
var expressionContainers = expressionProfileBuildingBlock.
Where(x => x.Value.HasValue && x.HasExpressionName()).
ExpressionParameters.Where(x => x.Value.HasValue && x.HasExpressionName()).
Select(expressionContainerInfoForExpressionParameter).ToList();

return new QueryExpressionSettings(expressionContainers, string.Empty, expressionProfileBuildingBlock.MoleculeName);
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.Core/Model/Compound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ public virtual ParameterAlternativeGroup ParameterAlternativeGroup(string parame
public virtual IEnumerable<CompoundProcess> AllProcesses() => AllProcesses<CompoundProcess>();

/// <summary>
/// Returns <c>true</c> if at least one proces is defined in the compound otherwise false
/// Returns <c>true</c> if at least one process is defined in the compound otherwise false
/// </summary>
public virtual bool HasProcesses() => HasProcesses<CompoundProcess>();

/// <summary>
/// Returns <c>true</c> if at least one proces of type <typeparamref name="TCompoundProcess"/> is defined in the compound otherwise false
/// Returns <c>true</c> if at least one process of type <typeparamref name="TCompoundProcess"/> is defined in the compound otherwise false
/// </summary>
public virtual bool HasProcesses<TCompoundProcess>() where TCompoundProcess : CompoundProcess => AllProcesses<TCompoundProcess>().Any();

Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.Core/Model/PartialProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void UpdatePropertiesFrom(IUpdatable sourceObject, ICloneManager
}

/// <summary>
/// Name of the molecule responsible for triggering the processs
/// Name of the molecule responsible for triggering the process
/// </summary>
public string MoleculeName
{
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.Core/Model/SimulationFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ public Simulation CreateForVSS(Protocol protocol, Individual individual, Compoun
{
//we create a clone here to ensure that a name is set in the compound
var vssCompound = _cloner.Clone(compound).WithName("VSS COMPOUND");
var simulation = CreateFrom(individual, new[] {vssCompound}, _modelPropertiesTask.DefaultFor(individual.OriginData));
_simulationBuildingBlockUpdater.UpdateMultipleUsedBuildingBlockInSimulationFromTemplate(simulation, new[] {protocol}, PKSimBuildingBlockType.Protocol);
var simulation = CreateFrom(individual, new[] { vssCompound }, _modelPropertiesTask.DefaultFor(individual.OriginData));
_simulationBuildingBlockUpdater.UpdateMultipleUsedBuildingBlockInSimulationFromTemplate(simulation, new[] { protocol }, PKSimBuildingBlockType.Protocol);
_simulationModelCreator.CreateModelFor(simulation);
return simulation;
}
Expand Down
8 changes: 4 additions & 4 deletions src/PKSim.Core/PKSim.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.186" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.186" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.186" />
<PackageReference Include="OSPSuite.Core" Version="12.0.188" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.188" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.188" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.188" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/PKSim.Core/Services/EventBuildingBlockCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public EventBuildingBlockCreator(IObjectBaseFactory objectBaseFactory,
ICloneManagerForBuildingBlock cloneManagerForBuildingBlock,
IParameterIdUpdater parameterIdUpdater,
IParameterSetUpdater parameterSetUpdater,
IEventGroupRepository eventGroupRepository,
IEventGroupRepository eventGroupRepository,
IParameterDefaultStateUpdater parameterDefaultStateUpdater)
{
_objectBaseFactory = objectBaseFactory;
Expand Down Expand Up @@ -85,7 +85,7 @@ private void createNonApplicationEvents()
var eventBuildingBlockInfos = (from eventMapping in _simulation.EventProperties.EventMappings
let usedBuildingBlock = _simulation.UsedBuildingBlockByTemplateId(eventMapping.TemplateEventId)
let eventBuildingBlock = usedBuildingBlock.BuildingBlock.DowncastTo<PKSimEvent>()
select new {eventBuildingBlock.Id, eventBuildingBlock.TemplateName, eventBuildingBlock.Name})
select new { eventBuildingBlock.Id, eventBuildingBlock.TemplateName, eventBuildingBlock.Name })
.Distinct();

// create event groups for each used event-building block
Expand Down Expand Up @@ -229,15 +229,15 @@ private static void setParticleRadiusDistributionParametersToLockedAndInvisible(
CoreConstants.Parameters.ParticleDistributionStructuralParameters.Each(paramName => formulationBuilder.Parameter(paramName).Editable = false);

// second, set some parameters to not visible depending on settings
var parameterNamesToBeInvisible = new List<string> { Constants.Parameters.PARTICLE_DISPERSE_SYSTEM};
var parameterNamesToBeInvisible = new List<string> { Constants.Parameters.PARTICLE_DISPERSE_SYSTEM };

var numberOfBins = (int) formulationBuilder.Parameter(Constants.Parameters.NUMBER_OF_BINS).Value;
var numberOfBins = (int)formulationBuilder.Parameter(Constants.Parameters.NUMBER_OF_BINS).Value;

if (numberOfBins == 1)
parameterNamesToBeInvisible.AddRange(CoreConstants.Parameters.HiddenParameterForMonodisperse);
else
{
var particlesDistributionType = (int) formulationBuilder.Parameter(Constants.Parameters.PARTICLE_SIZE_DISTRIBUTION).Value;
var particlesDistributionType = (int)formulationBuilder.Parameter(Constants.Parameters.PARTICLE_SIZE_DISTRIBUTION).Value;

if (particlesDistributionType == CoreConstants.Parameters.PARTICLE_SIZE_DISTRIBUTION_NORMAL)
parameterNamesToBeInvisible.AddRange(CoreConstants.Parameters.HiddenParameterForPolydisperseNormal);
Expand Down
5 changes: 2 additions & 3 deletions src/PKSim.Core/Services/MoleculesAndReactionsCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using PKSim.Core.Model;
using PKSim.Core.Repositories;
using IMoleculeBuilderFactory = PKSim.Core.Model.IMoleculeBuilderFactory;
using ModelConfiguration = PKSim.Core.Model.ModelConfiguration;

namespace PKSim.Core.Services
{
Expand Down Expand Up @@ -187,8 +186,8 @@ private void addAdditionalStaticMolecules(string modelName, CompoundProperties c

private string moleculeNameFor(string moleculeName, string compoundName)
{
return moleculeName.ReplaceKeywords(new[] {CoreConstants.Molecule.Drug, CoreConstants.Molecule.DrugFcRnComplexTemplate},
new[] {compoundName, CoreConstants.Molecule.DrugFcRnComplexName(compoundName)});
return moleculeName.ReplaceKeywords(new[] { CoreConstants.Molecule.Drug, CoreConstants.Molecule.DrugFcRnComplexTemplate },
new[] { compoundName, CoreConstants.Molecule.DrugFcRnComplexName(compoundName) });
}

private void addIndividualMolecules(IEnumerable<CompoundProperties> compoundPropertiesList)
Expand Down
44 changes: 22 additions & 22 deletions src/PKSim.Core/Services/PKAnalysesTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,13 @@ private IContainer calculateGlobalPKAnalysisFor(Simulation simulation, string co
vssPlasma.Value *= bioAvailabilityValue;
vdPlasma.Value *= bioAvailabilityValue;
totalPlasmaCL.Value *= bioAvailabilityValue;
fractionAbsorbedWarningParameters.AddRange(new[] {vssPlasma, vdPlasma});
pkValues.AddRange(new[] {vssPlasma, vdPlasma, totalPlasmaCL, bioAvailability});
fractionAbsorbedWarningParameters.AddRange(new[] { vssPlasma, vdPlasma });
pkValues.AddRange(new[] { vssPlasma, vdPlasma, totalPlasmaCL, bioAvailability });
}
else
{
fractionAbsorbedWarningParameters.AddRange(new[] {vssPlasmaOverF, vdPlasmaOverF});
pkValues.AddRange(new[] {vssPlasmaOverF, vdPlasmaOverF, totalPlasmaCLOverF, bioAvailability});
fractionAbsorbedWarningParameters.AddRange(new[] { vssPlasmaOverF, vdPlasmaOverF });
pkValues.AddRange(new[] { vssPlasmaOverF, vdPlasmaOverF, totalPlasmaCLOverF, bioAvailability });
}


Expand Down Expand Up @@ -427,9 +427,9 @@ private static QuantityPKParameter quantityPKParameterFor(ICache<int, GlobalPKAn
if (firstParameter == null)
return new QuantityPKParameter();

var quantityPKParameter = new QuantityPKParameter {Dimension = firstParameter.Dimension, Name = firstParameter.Name, QuantityPath = quantityPath};
var quantityPKParameter = new QuantityPKParameter { Dimension = firstParameter.Dimension, Name = firstParameter.Name, QuantityPath = quantityPath };

pKValuesForPKParameter.Each(pKValue => { quantityPKParameter.SetValue(pKValuesForPKParameter.IndexOf(pKValue), (float) pKValue.Value); });
pKValuesForPKParameter.Each(pKValue => { quantityPKParameter.SetValue(pKValuesForPKParameter.IndexOf(pKValue), (float)pKValue.Value); });
return quantityPKParameter;
}

Expand Down Expand Up @@ -535,7 +535,7 @@ public void CalculateBioavailabilityFor(Simulation simulation, string compoundNa
// We know this is a valid cast because it is cloned from simulation
var populationSimulation = simulation.DowncastTo<PopulationSimulation>();
CalculateFor(ivPopulationSimulation, ivCompoundPKContext);
var contextForPopulationSimulation = createContextForPopulationSimulation(ivCompoundPKContext, mapFromBioavailabilityCompoundPK, compoundName, populationSimulation, new[] {Bioavailability});
var contextForPopulationSimulation = createContextForPopulationSimulation(ivCompoundPKContext, mapFromBioavailabilityCompoundPK, compoundName, populationSimulation, new[] { Bioavailability });
populationSimulation.PKAnalyses = CalculateFor(populationSimulation, contextForPopulationSimulation);
}
else if (ivSimulation is IndividualSimulation ivIndividualSimulation)
Expand Down Expand Up @@ -581,7 +581,7 @@ public void CalculateDDIRatioFor(Simulation simulation)

// First calculate the compound context. We will know the AucInf and CMax when DDI is turned off
CalculateFor(ddiPopulationSimulation, ddiCompoundPKContext);
var parameterNames = new[] {AUCRatio, C_maxRatio};
var parameterNames = new[] { AUCRatio, C_maxRatio };

// From the ddi context, create the context from the original simulation and the ddi simulation for calculating ddi ratio parameters
var contextForPopulationSimulation = createContextForPopulationSimulation(ddiCompoundPKContext, mapFromDDISimulationCompoundPK, compoundName, populationSimulation, parameterNames);
Expand Down Expand Up @@ -632,14 +632,14 @@ private CompoundPKContext createContextForPopulationSimulation(CompoundPKContext

private CompoundPK mapFromBioavailabilityCompoundPK(CompoundPK bioAvailabilitySimulationCompoundPK)
{
var compoundPK = new CompoundPK {CompoundName = bioAvailabilitySimulationCompoundPK.CompoundName};
var compoundPK = new CompoundPK { CompoundName = bioAvailabilitySimulationCompoundPK.CompoundName };
bioAvailabilitySimulationCompoundPK.AllBioAvailabilityAucInf.KeyValues.Each(bioAvailability => { compoundPK.AddBioavailability(bioAvailability.Key, bioAvailability.Value); });
return compoundPK;
}

private CompoundPK mapFromDDISimulationCompoundPK(CompoundPK ddiSimulationCompoundPK)
{
var compoundPK = new CompoundPK {CompoundName = ddiSimulationCompoundPK.CompoundName};
var compoundPK = new CompoundPK { CompoundName = ddiSimulationCompoundPK.CompoundName };
ddiSimulationCompoundPK.AllDDIAucInf.KeyValues.Each(aucInf => compoundPK.AddDDIAucInf(aucInf.Key, aucInf.Value));
ddiSimulationCompoundPK.AllDDICMax.KeyValues.Each(cMax => compoundPK.AddDDICMax(cMax.Key, cMax.Value));
return compoundPK;
Expand Down Expand Up @@ -732,7 +732,7 @@ public IEnumerable<PopulationPKAnalysis> CalculateFor(IPopulationDataCollector p
return pkAnalyses; // there are no analyses to calculate

var allColumns = timeProfileChartData.Panes.SelectMany(x => x.Curves).SelectMany(x =>
columnsFor(x, populationDataCollector).Select(column => new {curveData = x, column}))
columnsFor(x, populationDataCollector).Select(column => new { curveData = x, column }))
.Where(c => c.column.IsConcentration());

var columnsByMolecules = allColumns.GroupBy(x => x.column.MoleculeName());
Expand Down Expand Up @@ -775,7 +775,7 @@ public IEnumerable<IndividualPKAnalysis> CalculateFor(IReadOnlyList<Simulation>

private IEnumerable<DataColumn> columnsFor(CurveData<TimeProfileXValue, TimeProfileYValue> curveData, IPopulationDataCollector populationDataCollector)
{
var baseGrid = new BaseGrid(Constants.TIME, curveData.XAxis.Dimension) {Values = curveData.XValues.Select(x => x.X).ToList()};
var baseGrid = new BaseGrid(Constants.TIME, curveData.XAxis.Dimension) { Values = curveData.XValues.Select(x => x.X).ToList() };

if (curveData.IsRange())
{
Expand All @@ -785,14 +785,14 @@ private IEnumerable<DataColumn> columnsFor(CurveData<TimeProfileXValue, TimeProf
new DataColumn(lowerRange, curveData.YAxis.Dimension, baseGrid)
{
Values = curveData.YValues.Select(y => y.LowerValue).ToList(),
DataInfo = {MolWeight = populationDataCollector.MolWeightFor(curveData.QuantityPath)},
QuantityInfo = {Path = curveData.QuantityPath.ToPathArray()}
DataInfo = { MolWeight = populationDataCollector.MolWeightFor(curveData.QuantityPath) },
QuantityInfo = { Path = curveData.QuantityPath.ToPathArray() }
},
new DataColumn(upperRange, curveData.YAxis.Dimension, baseGrid)
{
Values = curveData.YValues.Select(y => y.UpperValue).ToList(),
DataInfo = {MolWeight = populationDataCollector.MolWeightFor(curveData.QuantityPath)},
QuantityInfo = {Path = curveData.QuantityPath.ToPathArray()}
DataInfo = { MolWeight = populationDataCollector.MolWeightFor(curveData.QuantityPath) },
QuantityInfo = { Path = curveData.QuantityPath.ToPathArray() }
}
};
}
Expand All @@ -802,8 +802,8 @@ private IEnumerable<DataColumn> columnsFor(CurveData<TimeProfileXValue, TimeProf
new DataColumn(curveData.Caption, curveData.YAxis.Dimension, baseGrid)
{
Values = curveData.YValues.Select(y => y.Y).ToList(),
DataInfo = {MolWeight = populationDataCollector.MolWeightFor(curveData.QuantityPath)},
QuantityInfo = {Path = curveData.QuantityPath.ToPathArray()}
DataInfo = { MolWeight = populationDataCollector.MolWeightFor(curveData.QuantityPath) },
QuantityInfo = { Path = curveData.QuantityPath.ToPathArray() }
}
};
}
Expand All @@ -813,7 +813,7 @@ public IndividualPKAnalysis CalculateFor(Simulation simulation, DataColumn dataC
if (dataColumn == null)
return new NullIndividualPKAnalysis();

return CalculateFor(new[] {simulation}, new[] {dataColumn}).FirstOrDefault() ?? new NullIndividualPKAnalysis();
return CalculateFor(new[] { simulation }, new[] { dataColumn }).FirstOrDefault() ?? new NullIndividualPKAnalysis();
}

private PKValues calculatePK(DataColumn column, PKCalculationOptions options)
Expand Down Expand Up @@ -890,13 +890,13 @@ public PKAnalysis CreatePKAnalysisFromValues(PKValues pkValues, Simulation simul
/// </returns>
private (string lowerRange, string upperRange) rangeDescriptions(string text)
{
var splitStrings = text.Split(new[] {"Range"}, StringSplitOptions.None);
var splitStrings = text.Split(new[] { "Range" }, StringSplitOptions.None);
var match = splitStrings.Length == 2;

if (!match)
return (text, text);

var upperAndLowerRange = splitStrings.Last().Split(new[] {"to"}, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToArray();
var upperAndLowerRange = splitStrings.Last().Split(new[] { "to" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToArray();

return ($"{splitStrings[0]}{upperAndLowerRange[0]}", $"{splitStrings[0]}{upperAndLowerRange[1]}");
}
Expand Down Expand Up @@ -945,7 +945,7 @@ private string correctNameFromMetric(string originalText, bool multipleValues, b
suffix = isLowerValue ? lowerRange : upperRange;
}

return (new[] {captionPrefix, suffix}).ToCaption();
return (new[] { captionPrefix, suffix }).ToCaption();
}

private CurveData<TimeProfileXValue, TimeProfileYValue> buildCurveData(QuantityPKParameter quantityPKParameter, string caption)
Expand Down
Loading