Skip to content

Commit 8152ae7

Browse files
authored
Merge pull request #101 from drbergman/development
0.0.16
2 parents 9233b45 + 3349e13 commit 8152ae7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2169
-1914
lines changed

.github/workflows/CI.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ jobs:
4646
arch: "arm64"
4747
# - os: "windows-latest"
4848
# julia-version: '1'
49-
# shell: "pwsh"
49+
# shell: "msys2"
5050
# compiler: "g++"
5151
# arch: "x64"
5252

5353
defaults:
5454
run:
55-
shell: ${{ matrix.shell }}
55+
shell: ${{ matrix.shell }} {0}
5656

5757
steps:
5858
- name: Checkout repository
@@ -65,28 +65,53 @@ jobs:
6565
brew install ffmpeg
6666
6767
- name: Install MSYS2 on Windows
68-
if: matrix.os.name == 'windows-latest'
68+
if: matrix.os == 'windows-latest'
6969
uses: msys2/setup-msys2@v2
7070
with:
7171
update: true
7272
install: mingw-w64-x86_64-binutils mingw-w64-x86_64-gcc mingw-w64-x86_64-headers-git mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-lapack mingw-w64-x86_64-openblas mingw-w64-x86_64-libxml2 mingw-w64-x86_64-bzip2 mingw-w64-x86_64-python mingw-w64-x86_64-python-zstandard mingw-w64-x86_64-python-cffi make bison flex mingw-w64-x86_64-ca-certificates mingw-w64-x86_64-diffutils
73+
7374
- uses: julia-actions/setup-julia@v2
7475
with:
7576
version: ${{ matrix.julia-version }}
7677
arch: ${{ matrix.arch }}
78+
79+
- name: Add Julia to PATH on Windows
80+
if: matrix.os == 'windows-latest'
81+
run: echo "C:\\hostedtoolcache\\windows\\julia\\${{ matrix.julia-version }}\\${{ matrix.arch }}\\bin" >> $GITHUB_PATH
82+
7783
- name: Set environment variable PHYSICELL_CPP
7884
run: echo "PHYSICELL_CPP=${{ matrix.compiler }}" >> $GITHUB_ENV
85+
7986
- uses: julia-actions/cache@v2
80-
- name: Add PCVCTRegistry
87+
88+
- name: Add PCVCTRegistry (Windows)
89+
if: matrix.os == 'windows-latest'
90+
shell: pwsh
8191
run: julia -e 'import Pkg; Pkg.Registry.add("General"); Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/drbergman/PCVCTRegistry.git"))'
92+
93+
- name: Add PCVCTRegistry (non-Windows)
94+
if: matrix.os != 'windows-latest'
95+
run: julia -e 'import Pkg; Pkg.Registry.add("General"); Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/drbergman/PCVCTRegistry.git"))'
96+
8297
- uses: julia-actions/julia-buildpkg@v1
98+
99+
- name: Install libRoadRunner dependencies on Ubuntu
100+
if: matrix.os == 'ubuntu-latest'
101+
run: |
102+
sudo apt-get update
103+
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb
104+
sudo apt-get install -y ./libtinfo5_6.3-2ubuntu0.1_amd64.deb
105+
83106
- name: Run all tests
84107
uses: julia-actions/julia-runtest@v1
85108
env:
86109
PCVCT_NUM_PARALLEL_SIMS: 8
87110
PHYSICELL_CPP: ${{ matrix.compiler }} # maybe necessary for windows??
88111
PCVCT_PUBLIC_REPO_AUTH: ${{ secrets.PUBLIC_REPO_AUTH }}
112+
89113
- uses: julia-actions/julia-processcoverage@v1
114+
90115
- uses: codecov/codecov-action@v5
91116
with:
92117
files: lcov.info
@@ -102,23 +127,30 @@ jobs:
102127
statuses: write
103128
steps:
104129
- uses: actions/checkout@v4
130+
105131
- uses: julia-actions/setup-julia@v2
106132
with:
107133
version: '1'
134+
108135
- uses: julia-actions/cache@v2
136+
109137
- name: Add PCVCTRegistry
110138
run: julia -e 'import Pkg; Pkg.Registry.add("General"); Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/drbergman/PCVCTRegistry.git"))'
139+
111140
- name: Configure doc environment
112141
shell: julia --project=docs --color=yes {0}
113142
run: |
114143
using Pkg
115144
Pkg.develop(PackageSpec(path=pwd()))
116145
Pkg.instantiate()
146+
117147
- uses: julia-actions/julia-buildpkg@v1
148+
118149
- uses: julia-actions/julia-docdeploy@v1
119150
env:
120151
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
121152
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
153+
122154
- name: Run doctests
123155
shell: julia --project=docs --color=yes {0}
124156
run: |

Project.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name = "pcvct"
22
uuid = "3c374bc7-7384-4f83-8ca0-87b8c727e6ff"
33
authors = ["Daniel Bergman <[email protected]> and contributors"]
4-
version = "0.0.15"
4+
version = "0.0.16"
55

66
[deps]
7+
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
78
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
89
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
910
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
@@ -28,9 +29,11 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
2829
SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9"
2930
Sobol = "ed01d8cd-4d21-5b2a-85b4-cc3bdc58bad4"
3031
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
32+
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
3133
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
3234

3335
[compat]
36+
AutoHashEquals = "2.2.0"
3437
CSV = "0.10"
3538
DataFrames = "1"
3639
Distributions = "0.25"
@@ -53,6 +56,7 @@ RecipesBase = "1.3.4"
5356
SQLite = "1"
5457
Sobol = "1"
5558
Statistics = "1"
59+
TOML = "1.0.3"
5660
Tables = "1"
5761
julia = "1.6.7"
5862

docs/make.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ makedocs(;
1818
"Getting started" => "man/getting_started.md",
1919
"CoVariations" => "man/covariations.md",
2020
"Data directory" => "man/data_directory.md",
21+
"Intracellular inputs" => "man/intracellular_inputs.md",
2122
"Known limitations" => "man/known_limitations.md",
2223
"PhysiCell Studio" => "man/physicell_studio.md",
2324
"Sensitivity analysis" => "man/sensitivity_analysis.md",
25+
"Developer guide" => "man/developer_guide.md",
2426
],
2527
"Documentation" => map(
2628
s -> "lib/$(s)",

docs/src/lib/VCTComponents.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
```@meta
2+
CollapsedDocStrings = true
3+
```
4+
5+
# VCTComponents
6+
7+
Allows for combining PhysiCell input components into whole inputs.
8+
9+
Currently, only supports this for intracellular ODE (libRoadRunner) models.
10+
11+
```@autodocs
12+
Modules = [pcvct]
13+
Pages = ["VCTComponents.jl"]
14+
```

docs/src/lib/VCTConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CollapsedDocStrings = true
66

77
Interface with the configuration file necessary for PhysiCell simulations.
88

9-
Provide functionality for accessing and modifying elements in any XML, including the PhysiCell configuration file, XML rules file, and XML IC cell file.
9+
Provide functionality for accessing and modifying elements in any XML, including the PhysiCell configuration file, XML rules file, combined intracellular XML file, XML IC cell file, and XML IC ECM file.
1010

1111
```@autodocs
1212
Modules = [pcvct]

docs/src/man/data_directory.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ project-dir/
1313
│ │ ├── dcs/
1414
│ │ ├── ecms/
1515
│ │ └── substrates/
16+
│ ├── intracellulars/
1617
│ ├── rulesets_collections/
1718
...
1819
```
@@ -31,6 +32,23 @@ Add within `data/inputs/custom_codes/default/` the following, each exactly as is
3132
- `Makefile`
3233
- `custom_modules/`
3334

35+
## Rulesets collections
36+
37+
Add a single file within `data/inputs/rulesets_collections/default/` called `base_rulesets.csv` with the base ruleset collection for your PhysiCell project.
38+
If your project does not use rules, you can skip this step.
39+
40+
You may also place an XML file here. Use [PhysiCellXMLRules.jl](https://github.com/drbergman/PhysiCellXMLRules.jl) to create one from a standard CSV version of the rules.
41+
42+
**Important**: In either case, the variations you define *must* be on the XML version.
43+
After calling `initializeModelManager()`, any folder with `base_rulesets.csv` will now be populated with a `base_rulesets.xml` file that can be reference to set the XML paths.
44+
45+
## Intracellulars
46+
47+
Add a single XML file within `data/inputs/intracellulars/default/` called `intracellular.xml` in which the root has two child elements: `cell_definitions` and `intracellulars`.
48+
This currently only supports libRoadRunner, i.e., ODEs.
49+
See the `sample_projects_intracellular/combined/template-combined` for an example.
50+
See [Intracellular inputs](@ref) for much more information.
51+
3452
## ICs
3553

3654
These folders are optional as not every model includes initial conditions as separate files.
@@ -47,7 +65,14 @@ cells/
4765

4866
Proceed similarly for `dcs/`, `ecms/`, and `substrates/`, renaming those files to `dcs.csv`, `ecm.csv`, and `substrates.csv`, respectively.
4967

50-
## Rulesets collections
68+
### IC cells
5169

52-
Add a single file within `data/inputs/rulesets_collections/default/` called `base_rulesets.csv` with the base ruleset collection for your PhysiCell project.
53-
If your project does not use rules, you can skip this step.
70+
pcvct uses [PhysiCellCellCreator.jl](https://github.com/drbergman/PhysiCellCellCreator.jl) to allow for creation of `cells.csv` files based on geometries defined in a `cells.xml` file.
71+
To use this, first create such an XML document (see [PhysiCellCellCreator.jl](https://github.com/drbergman/PhysiCellCellCreator.jl) for details) and place this in place of the `cells.csv` file.
72+
You may make variations on this in the same was as for `config` and `rulesets_collection`.
73+
74+
### IC ecm
75+
76+
pcvct uses [PhysiCellECMCreator.jl](https://github.com/drbergman/PhysiCellECMCreator.jl) to allow for creation of `ecm.csv` files based on the structure defined in a `ecm.xml` file.
77+
To use this, first create such an XML document (see [PhysiCellECMCreator.jl](https://github.com/drbergman/PhysiCellECMCreator.jl) for details) and place this in place of the `ecm.csv` file.
78+
You may make variations on this in the same was as for `config` and `rulesets_collection`.

docs/src/man/developer_guide.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Developer guide
2+
3+
## Style guide
4+
- Use `#!` for comments that are informative
5+
- This helps find code lines commented out in development.
6+
- Using the regexp `^(\s+)?# .+\n` seems to work well for finding commented out code lines.

docs/src/man/intracellular_inputs.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Intracellular inputs
2+
3+
pcvct currently only supports ODE intracellular models using libRoadRunner.
4+
It uses a specialized format to achieve this, creating the SBML files needed by libRoadRunner at PhysiCell runtime.
5+
Briefly, the `intracellular.xml` file defines a mapping between cell definitions and intracellular models.
6+
See the template provided [here](https://github.com/drbergman/PhysiCell/blob/my-physicell/sample_projects_intracellular/combined/template-combined/config/sample_combined_sbmls.xml).
7+
8+
To facilitate creation of such files, and to make it easy to mix-and-match intracellular models, users can place the SBML files that define the ODEs into `data/components/roadrunner` and then simply reference those to construct the specialized XMLs needed.
9+
For example, place the `Toy_Metabolic_Model.xml` from [sample_projects_intracellular/ode/ode_energy/config/](https://github.com/drbergman/PhysiCell/blob/my-physicell/sample_projects_intracellular/ode/ode_energy/config) into `data/components/roadrunner` and assemble the XML as follows
10+
11+
```julia
12+
cell_type = "default" # name of the cell type using this intracellular model
13+
component = PhysiCellComponent("roadrunner", "Toy_Metabolic_Model.xml") # pass in the type of the component and the name of the file to use
14+
cell_type_to_component = Dict{String, PhysiCellComponent}(cell_type => component) # add other entries to this Dict for other cell types using an intracellular model
15+
intracellular_folder = assembleIntracellular!(cell_type_to_component; name="toy_metabolic") # will return "toy_metabolic" or "toy_metabolic_n"
16+
```
17+
18+
This creates a folder at `data/inputs/intracellulars/` with the name stored in `intracellular_folder`.
19+
Also, the `!` in `assembleIntracellular!` references how the components in the `cell_type_to_component` `Dict` are updated to match those in `data/inputs/intracellulars/$(intracellular_folder)/intracellular.xml`.
20+
Use these IDs to make variations on the components by using
21+
22+
```julia
23+
xml_path = ["intracellulars", "intracellular:ID:$(component.id)", ...]
24+
```
25+
26+
where the `...` is the path starting with the root of the XML file (`sbml` for SBML files).
27+
28+
Finally, pass this folder into `InputFolders` to use this input in simulation runs:
29+
```julia
30+
inputs = InputFolders(...; ..., intracellular=intracellular_folder, ...)
31+
```

docs/src/man/known_limitations.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ If you do need an upper bound on the number of simulations in such a grouping, s
77
It is assumed that most, if not all use cases, will benefit from more simulations.
88

99
## Initial conditions not loaded when launching PhysiCell Studio for a simulation.
10-
When launching PhysiCell Studio from pcvct, the initial conditions (cells and substrates) are not loaded.
10+
When launching PhysiCell Studio from pcvct, the initial conditions (cells and substrates) are not loaded.
11+
12+
## Limited intracellular models
13+
Currently only supports ODE intracellular models (using libRoadRunner).
14+
Does not support MaBoSS or dFBA.

src/VCTAnalysis/motility.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ function meanSpeed(p; direction=:any)::NTuple{3,Dict{String,Float64}}
3434
distance_dict = Dict{String, Float64}(zip(cell_type_names, zeros(Float64, length(cell_type_names))))
3535
time_dict = Dict{String, Float64}(zip(cell_type_names, zeros(Float64, length(cell_type_names))))
3636
while start_ind <= length(type_change)
37-
I = findfirst(type_change[start_ind:end]) # from s to I, cell_type_name is constant. at I+1 it changes
38-
I = isnothing(I) ? length(type_change)+2-start_ind : I # if the cell_type_name is constant till the end, set I to be at the end
39-
# If start_ind = 1 (at start of sim) and I = 2 (so cell_type_name[3] != cell_type_name[2], meaning that for steps [1,2] cell_type_name is constnat), only use dx in stepping from 1->2 since somewhere in 2->3 the type changes. That is, use dx[1]
40-
distance_dict[cell_type_name[start_ind]] += sum(dist_fn.(dx[start_ind:I-1], dy[start_ind:I-1], dz[start_ind:I-1])) # only count distance travelled while remaining in the initial cell_type_name
41-
time_dict[cell_type_name[start_ind]] += p.time[start_ind+I-1] - p.time[start_ind] # record time spent in this cell_type_name (note p.time is not diffs like dx and dy are, hence the difference in indices)
42-
start_ind += I # advance the start to the first instance of a new cell_type_name
37+
I = findfirst(type_change[start_ind:end]) #! from s to I, cell_type_name is constant. at I+1 it changes
38+
I = isnothing(I) ? length(type_change)+2-start_ind : I #! if the cell_type_name is constant till the end, set I to be at the end
39+
#! If start_ind = 1 (at start of sim) and I = 2 (so cell_type_name[3] != cell_type_name[2], meaning that for steps [1,2] cell_type_name is constnat), only use dx in stepping from 1->2 since somewhere in 2->3 the type changes. That is, use dx[1]
40+
distance_dict[cell_type_name[start_ind]] += sum(dist_fn.(dx[start_ind:I-1], dy[start_ind:I-1], dz[start_ind:I-1])) #! only count distance travelled while remaining in the initial cell_type_name
41+
time_dict[cell_type_name[start_ind]] += p.time[start_ind+I-1] - p.time[start_ind] #! record time spent in this cell_type_name (note p.time is not diffs like dx and dy are, hence the difference in indices)
42+
start_ind += I #! advance the start to the first instance of a new cell_type_name
4343
end
44-
speed_dict = [k => distance_dict[k] / time_dict[k] for k in cell_type_names] |> Dict{String,Float64} # convert to speed
44+
speed_dict = [k => distance_dict[k] / time_dict[k] for k in cell_type_names] |> Dict{String,Float64} #! convert to speed
4545
return speed_dict, distance_dict, time_dict
4646
end
4747

0 commit comments

Comments
 (0)