Skip to content

Commit

Permalink
Fixes #2084 problem with expression profile (#2085)
Browse files Browse the repository at this point in the history
* Fixes #2084 problem with expression profile

* Remove duplicate in file

* Also remove merge union in git attrivutes
  • Loading branch information
msevestre authored Feb 3, 2022
1 parent 08f512e commit c15f087
Show file tree
Hide file tree
Showing 27 changed files with 7,600 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*.coffee text
*.config text
*.cs text diff=csharp
*.csproj text merge=union
*.csproj text
*.cshtml text
*.css text
*.dtd text
Expand Down
7 changes: 4 additions & 3 deletions PKSim.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29025.244
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9B4D05BE-A0E7-41D6-8FCF-1C6005FBE801}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
appveyor-coverage.yml = appveyor-coverage.yml
appveyor-nightly.yml = appveyor-nightly.yml
Expand Down Expand Up @@ -136,8 +137,8 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {13620E23-1993-42C6-A4AB-468E29DD24DE}
VisualSVNWorkingCopyRoot =
SolutionGuid = {13620E23-1993-42C6-A4AB-468E29DD24DE}
EndGlobalSection
GlobalSection(NDepend) = preSolution
Project = ".\PKSim.ndproj"
Expand Down
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="11.0.77" />
<PackageReference Include="OSPSuite.Assets.Images" Version="11.0.77" />
<PackageReference Include="OSPSuite.Assets" Version="11.0.82" />
<PackageReference Include="OSPSuite.Assets.Images" Version="11.0.82" />
</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="11.0.77" />
<PackageReference Include="OSPSuite.Assets.Images" Version="11.0.77" />
<PackageReference Include="OSPSuite.Assets" Version="11.0.82" />
<PackageReference Include="OSPSuite.Assets.Images" Version="11.0.82" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.BatchTool/PKSim.BatchTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
<PackageReference Include="OSPSuite.DevExpress" Version="21.2.3" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.51" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.45" GeneratePathProperty="true" />
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.CLI.Core/PKSim.CLI.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<ItemGroup>
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/PKSim.CLI.Core/Services/ExportSimulationRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using OSPSuite.Core.Domain;
using OSPSuite.Core.Domain.Services;
using OSPSuite.Core.Qualification;
using OSPSuite.Core.Services;
using OSPSuite.Utility;
Expand All @@ -11,6 +12,7 @@
using PKSim.Core;
using PKSim.Core.Model;
using PKSim.Core.Services;
using ILazyLoadTask = PKSim.Core.Services.ILazyLoadTask;
using SimulationRunOptions = PKSim.Core.Services.SimulationRunOptions;

namespace PKSim.CLI.Core.Services
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.CLI/PKSim.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.0" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Presentation" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
<PackageReference Include="OSPSuite.Presentation" Version="11.0.82" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.51" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.45" GeneratePathProperty="true" />
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.Core/Model/PKSimProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ public virtual void AddBuildingBlock(IPKSimBuildingBlock buildingBlockToAdd)
{
//that should never happen. Just in case
var bbWithTheSameName = All(buildingBlockToAdd.BuildingBlockType)
.Where(bb => string.Equals(bb.Name, buildingBlockToAdd.Name));
.Where(bb => bb.IsNamed(buildingBlockToAdd.Name));

if (bbWithTheSameName.Count() != 0)
if (bbWithTheSameName.Any())
throw new BuildingBlockAlreadyExistsInProjectException(buildingBlockToAdd);

_allBuildingBlocks.Add(buildingBlockToAdd);
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 @@ -30,10 +30,10 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Assets" Version="11.0.77" />
<PackageReference Include="OSPSuite.Assets.Images" Version="11.0.77" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
<PackageReference Include="OSPSuite.Assets" Version="11.0.82" />
<PackageReference Include="OSPSuite.Assets.Images" Version="11.0.82" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="11.0.82" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public override async Task<ModelExpressionProfile> MapToModel(SnapshotExpression
expressionProfile.Category = snapshot.Category;

var (molecule, individual) = expressionProfile;
await _parameterMapper.MapLocalizedParameters(snapshot.Parameters, individual);
await _parameterMapper.MapLocalizedParameters(snapshot.Parameters, individual, !isV9Format(snapshot));

updateMoleculePropertiesToMolecule(molecule, snapshot, individual);

Expand Down
15 changes: 9 additions & 6 deletions src/PKSim.Core/Snapshots/Mappers/IndividualMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override async Task<ModelIndividual> MapToModel(SnapshotIndividual indivi
await updateIndividualParameters(individualSnapshot, individual);

if (isV10Format(individualSnapshot))
await convertMoleculesToExpressionProfiles(individualSnapshot, project);
await convertMoleculesToExpressionProfiles(individualSnapshot, project);

individualSnapshot.ExpressionProfiles?.Each(x =>
{
Expand All @@ -74,7 +74,7 @@ public override async Task<ModelIndividual> MapToModel(SnapshotIndividual indivi
return individual;
}

private async Task convertMoleculesToExpressionProfiles(SnapshotIndividual individualSnapshot, PKSimProject project)
private async Task convertMoleculesToExpressionProfiles(SnapshotIndividual individualSnapshot, PKSimProject project)
{
var expressionProfilesSnapshot = individualSnapshot.Molecules;
expressionProfilesSnapshot.Each(x =>
Expand All @@ -84,11 +84,15 @@ private async Task convertMoleculesToExpressionProfiles(SnapshotIndividual indiv
x.Molecule = x.Name;
});

var expressionProfiles = await _expressionProfileMapper.MapToModels(individualSnapshot.Molecules);
var expressionProfiles = await _expressionProfileMapper.MapToModels(expressionProfilesSnapshot);
foreach (var expressionProfile in expressionProfiles)
{
var (molecule, individual) = expressionProfile;
project.AddBuildingBlock(expressionProfile);
var (_, individual) = expressionProfile;
//Expression profile may have been added already to the project when converting a project with population
//and individual. So we only add if not available already
if (project.BuildingBlockByName<Model.ExpressionProfile>(expressionProfile.Name) == null)
project.AddBuildingBlock(expressionProfile);

//this needs to happen here since molecule parameters were defined in individual in v10
await updateIndividualParameters(individualSnapshot, individual);
}
Expand All @@ -103,6 +107,5 @@ private Task updateIndividualParameters(SnapshotIndividual snapshot, ModelIndivi
//We do not show warning for v10 format as we will FOR SURE have missing parameters
return _parameterMapper.MapLocalizedParameters(snapshot.Parameters, individual, showParameterNotFoundWarning: !isV10Format(snapshot));
}

}
}
16 changes: 8 additions & 8 deletions src/PKSim.Infrastructure/PKSim.Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.0" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.13" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Infrastructure" Version="11.0.77" />
<PackageReference Include="OSPSuite.Infrastructure.Castle" Version="11.0.77" />
<PackageReference Include="OSPSuite.Infrastructure.Export" Version="11.0.77" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="11.0.77" />
<PackageReference Include="OSPSuite.Infrastructure.Reporting" Version="11.0.77" />
<PackageReference Include="OSPSuite.Infrastructure.Serialization" Version="11.0.77" />
<PackageReference Include="OSPSuite.Presentation.Serialization" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
<PackageReference Include="OSPSuite.Infrastructure" Version="11.0.82" />
<PackageReference Include="OSPSuite.Infrastructure.Castle" Version="11.0.82" />
<PackageReference Include="OSPSuite.Infrastructure.Export" Version="11.0.82" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="11.0.82" />
<PackageReference Include="OSPSuite.Infrastructure.Reporting" Version="11.0.82" />
<PackageReference Include="OSPSuite.Infrastructure.Serialization" Version="11.0.82" />
<PackageReference Include="OSPSuite.Presentation.Serialization" Version="11.0.82" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.Matlab/PKSim.Matlab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<ItemGroup>
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.Presentation/PKSim.Presentation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<ItemGroup>
<PackageReference Include="OSPSuite.TeXReporting" Version="3.0.0.4" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Presentation" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Presentation" Version="11.0.82" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.R/PKSim.R.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

<ItemGroup>
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.51" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.45" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
Expand Down
6 changes: 3 additions & 3 deletions src/PKSim.UI/PKSim.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<PackageReference Include="OSPSuite.DataBinding.DevExpress" Version="6.0.0.2" />
<PackageReference Include="OSPSuite.DevExpress" Version="21.2.3" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Presentation" Version="11.0.77" />
<PackageReference Include="OSPSuite.UI" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Presentation" Version="11.0.82" />
<PackageReference Include="OSPSuite.UI" Version="11.0.82" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
</ItemGroup>

<ItemGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

<ItemGroup>
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
<PackageReference Include="OSPSuite.DevExpress" Version="21.2.3" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.51" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.45" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.Presentation" Version="11.0.77" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.Presentation" Version="11.0.82" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.TeXReporting" Version="3.0.0.4" GeneratePathProperty="true" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion tests/PKSim.Matlab.Tests/PKSim.Matlab.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="OSPSuite.BDDHelper" Version="4.0.0.1" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.51" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.45" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
Expand Down
2 changes: 1 addition & 1 deletion tests/PKSim.R.Tests/PKSim.R.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="OSPSuite.BDDHelper" Version="4.0.0.1" />
<PackageReference Include="OSPSuite.Core" Version="11.0.77" />
<PackageReference Include="OSPSuite.Core" Version="11.0.82" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.51" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.45" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
Expand Down
11 changes: 7 additions & 4 deletions tests/PKSim.Tests/CLI/ExportSimulationRunnerSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using OSPSuite.BDDHelper.Extensions;
using OSPSuite.Core.Domain;
using OSPSuite.Core.Domain.Builder;
using OSPSuite.Core.Domain.Services;
using OSPSuite.Core.Qualification;
using OSPSuite.Utility;
using OSPSuite.Utility.Exceptions;
Expand All @@ -17,17 +18,19 @@
using PKSim.Core.Model;
using PKSim.Core.Services;
using OSPSuite.Core.Services;
using ILazyLoadTask = PKSim.Core.Services.ILazyLoadTask;
using SimulationRunOptions = PKSim.Core.Services.SimulationRunOptions;

namespace PKSim.CLI
{
public abstract class concern_for_ExportSimulationRunner : ContextSpecificationAsync<ExportSimulationRunner>
{
protected IOSPSuiteLogger _logger;
protected IWorkspacePersistor _workspacePersitor;
protected IWorkspacePersistor _workspacePersistor;
protected ICoreWorkspace _workspace;
protected ISimulationExporter _simulationExporter;
protected ILazyLoadTask _lazyLoadTask;

protected ExportRunOptions _exportRunOptions = new ExportRunOptions {ExportMode = SimulationExportMode.Json | SimulationExportMode.Xml};

private Func<string, bool> _oldFileExists;
Expand Down Expand Up @@ -74,17 +77,17 @@ public override async Task GlobalContext()
protected override Task Context()
{
_logger = A.Fake<IOSPSuiteLogger>();
_workspacePersitor = A.Fake<IWorkspacePersistor>();
_workspacePersistor = A.Fake<IWorkspacePersistor>();
_workspace = A.Fake<ICoreWorkspace>();
_simulationExporter = A.Fake<ISimulationExporter>();
_lazyLoadTask = A.Fake<ILazyLoadTask>();
sut = new ExportSimulationRunner(_logger, _workspacePersitor, _workspace, _simulationExporter, _lazyLoadTask);
sut = new ExportSimulationRunner(_logger, _workspacePersistor, _workspace, _simulationExporter, _lazyLoadTask);

_project = new PKSimProject {Name = _projectName};
_simulation1 = createSimulationWithResults(_simulation1Name);
_simulation2 = createSimulationWithResults(_simulation2Name);

A.CallTo(() => _workspacePersitor.LoadSession(_workspace, _projectFileName)).Invokes(x => { _workspace.Project = _project; });
A.CallTo(() => _workspacePersistor.LoadSession(_workspace, _projectFileName)).Invokes(x => { _workspace.Project = _project; });


return _completed;
Expand Down
Loading

0 comments on commit c15f087

Please sign in to comment.