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

Project-based Workflow #651

Draft
wants to merge 43 commits into
base: new-project-structure
Choose a base branch
from
Draft

Conversation

Felixmil
Copy link
Collaborator

@Felixmil Felixmil commented May 6, 2024

New Workflow Preview

devtools::load_all()
#> ℹ Loading esqlabsR
#> Loading required package: ospsuite
#> 
#> Loading required package: rClr
#> 
#> Loading the dynamic library for Microsoft .NET runtime...
#> Loaded Common Language Runtime version 4.0.30319.42000

# Create a project
p <- testProject()

# Project Overview
p
#> 
#> ── Project Configuration ───────────────────────────────────────────────────────
#>   • Project Configuration:
#>   'inst/extdata/examples/TestProject/ProjectConfiguration.xlsx'
#>   • Model folder: 'inst/extdata/examples/TestProject/Models/Simulations'
#>   • Configurations folder: 'inst/extdata/examples/TestProject/Configurations'
#>   • Model Parameters:
#>   'inst/extdata/examples/TestProject/Configurations/ModelParameters.xlsx'
#>   • Individuals:
#>   'inst/extdata/examples/TestProject/Configurations/Individuals.xlsx'
#>   • Populations:
#>   'inst/extdata/examples/TestProject/Configurations/Populations.xlsx'
#>   • PopulationsCSV:
#>   'inst/extdata/examples/TestProject/Configurations/PopulationsCSV'
#>   • Scenarios:
#>   'inst/extdata/examples/TestProject/Configurations/Scenarios.xlsx'
#>   • Applications:
#>   'inst/extdata/examples/TestProject/Configurations/Applications.xlsx'
#>   • Plots: 'inst/extdata/examples/TestProject/Configurations/Plots.xlsx'
#>   • Data folder: 'inst/extdata/examples/TestProject/Data'
#>   • Data file:
#>   'inst/extdata/examples/TestProject/Data/TestProject_TimeValuesData.xlsx'
#>   • Data importer configuration:
#>   'inst/extdata/examples/TestProject/Data/esqlabs_dataImporter_configuration.xml'
#>   • Compound Properties File:
#>   • Output folder: 'inst/extdata/examples/TestProject/Results'
#> 
#> ── Configurations ──────────────────────────────────────────────────────────────
#>   • Scenarios: 5
#>   • Models: 1
#>   • Model Parameters: 3
#>   • Individuals: 1
#> 
#> ── Scenarios ───────────────────────────────────────────────────────────────────
#>   • ✅ TestScenario
#>   • ✅ TestScenario2
#>   • ✅ PopulationScenario
#>   • ✅ PopulationScenarioFromCSV
#>   • ✅ TestScenario_missingParam
#> 
#> ── Simulation Results ──────────────────────────────────────────────────────────
#> No Simulation Results available.

# Explore configurations
p$configurations
#> 
#> ── Configurations ──────────────────────────────────────────────────────────────
#> • Scenarios:
#>   • TestScenario
#>   • TestScenario2
#>   • PopulationScenario
#>   • PopulationScenarioFromCSV
#>   • TestScenario_missingParam
#> • Models:
#>   • Aciclovir.pkml
#> • Model Parameters:
#>   • Global
#>   • MissingParam
#>   • Aciclovir
#> • Individuals:
#>   • Indiv1
#> • Applications:
#>   • Aciclovir_iv_250mg

p$configurations$scenarios$TestScenario
#> $id
#> [1] "TestScenario"
#> 
#> $individual
#> [1] "Indiv1"
#> 
#> $population
#> [1] NA
#> 
#> $populationFromCSV
#> [1] NA
#> 
#> $modelParameters
#> [1] "Global"
#> 
#> $applications
#> [1] "Aciclovir_iv_250mg"
#> 
#> $time
#> [1] "0, 24, 60"
#> 
#> $timeUnit
#> [1] "h"
#> 
#> $steadyState
#> [1] FALSE
#> 
#> $steadyStateTime
#> [1] NA
#> 
#> $steadyStateTimeUnit
#> [1] NA
#> 
#> $model
#> [1] "Aciclovir.pkml"
#> 
#> $outputPaths
#> [1] NA

# Modify configurations
p$configurations$modelParameters$Global$`EHC continuous fraction`$value
#> [1] 1
p$configurations$modelParameters$Global$`EHC continuous fraction`$value <- 0.5
p$configurations$scenarios$TestScenario$modelParameters <- c("Global", "Aciclovir")

# Explore scenarios
p$scenarios$TestScenario$configuration$modelParameters
#> $Global
#> $Global$`EHC continuous fraction`
#> $containerPath
#> [1] "Organism|Liver"
#> 
#> $parameterName
#> [1] "EHC continuous fraction"
#> 
#> $value
#> [1] 0.5
#> 
#> $units
#> [1] ""
#> 
#> 
#> 
#> $Aciclovir
#> $Aciclovir$Lipophilicity
#> $containerPath
#> [1] "Aciclovir"
#> 
#> $parameterName
#> [1] "Lipophilicity"
#> 
#> $value
#> [1] -0.1
#> 
#> $units
#> [1] "Log Units"

# Select which scenarios to run (all active by default)
p$selectScenarios("TestScenario")


# Check the scenarios status
p$scenarios
#> $TestScenario
#> • Status: ✅ active
#> • Type: individual
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>     • Global
#>     • Aciclovir
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg
#> 
#> $TestScenario2
#> • Status: ⏸ inactive
#> • Type: individual
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>     • Global
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg
#> 
#> $PopulationScenario
#> • Status: ⏸ inactive
#> • Type: population
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>     • Global
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg
#> 
#> $PopulationScenarioFromCSV
#> • Status: ⏸ inactive
#> • Type: population
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>     • Global
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg
#> 
#> $TestScenario_missingParam
#> • Status: ⏸ inactive
#> • Type: individual
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg

# Run the scenarios
p$runScenarios()
#> Loading Scenarios ■■■■■■■ 20% | ETA: 20s
## This will load and run the scenarios but this can be done in two separated manual steps
# p$loadScenarios()
# modify scenarios
# p$runScenarios()

# Access simulation results
p$simulationResults
#> $TestScenario
#> SimulationResults: 
#>    Number of individuals: 1

Created on 2024-05-06 with reprex v2.1.0

…n without inducing breaking changes

+ usethis::use_package("lifecycle")
+ update tests accordingly
+ add test for deprecation
+ devtools::document()
+ remove names of internal collaborators
…msFile-to-modelParamsFile

# Conflicts:
#	NEWS.md
#	R/project-configuration.R
#	inst/extdata/examples/TestProject/Configurations/Populations.xlsx
#	inst/extdata/examples/TestProject/ProjectConfiguration.xlsx
#	tests/testthat/test-utilities-population.R
+ use projectConfiguration$populationsCSV to locate population CSV files to read
+ add test to make sure all test scenarios can be properly created
…msFile-to-modelParamsFile

# Conflicts:
#	NEWS.md
…nfigurations, scenarios, simulationResults)

+ tests
@Felixmil Felixmil changed the title Implement project Initial implementation of project base workflow May 15, 2024
# Conflicts:
#	R/project-configuration.R
#	R/scenario.R
#	R/utilities-project-configuration.R
#	inst/extdata/examples/TestProject/ProjectConfiguration.xlsx
#	man/ExportConfiguration.Rd
#	man/ProjectConfiguration.Rd
#	tests/testthat/helpers.R
#	tests/testthat/test-utilities-population.R
#	tests/testthat/test-utilities-project-configuration.R
#	tests/testthat/test-utilities-scenarios.R
@Felixmil Felixmil requested a review from rengelke June 11, 2024 15:40
@Felixmil Felixmil changed the title Initial implementation of project base workflow Project-based Workflow Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant