Skip to content

Commit d3c6248

Browse files
author
Daniel Bergman
authored
Merge pull request #78 from drbergman/development
Development
2 parents 08a8a5a + ba87b27 commit d3c6248

39 files changed

+1053
-955
lines changed

Project.toml

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

66
[deps]
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ When an object `T <: AbstractTrial` is instantiated, immediately add it to the d
2828
If a simulation fails, remove it from the CSV without removing it from the database/output.
2929

3030
# To dos
31-
- Figure out how to link pcvct verions to PhysiCell versions
32-
- where does PhysiCell submodule fit in? Just for tests? Or for the whole package?
3331
- Rename for Julia registry. It will be so nice to have user Pkg.add("pcvct") and have it work.
3432
- PhysiCellVT.jl
3533
- PhysiVT.jl (possible confusion with the OpenVT project where VT = virtual tissue)

src/VCTClasses.jl

Lines changed: 231 additions & 303 deletions
Large diffs are not rendered by default.

src/VCTCompilation.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ function loadCustomCode(S::AbstractSampling; force_recompile::Bool=false)
3232
if isdir(temp_custom_modules_dir)
3333
rm(temp_custom_modules_dir; force=true, recursive=true)
3434
end
35-
path_to_input_custom_codes = joinpath(data_dir, "inputs", "custom_codes", S.folder_names.custom_code_folder)
35+
path_to_input_custom_codes = joinpath(data_dir, "inputs", "custom_codes", S.inputs.custom_code.folder)
3636
cp(joinpath(path_to_input_custom_codes, "custom_modules"), temp_custom_modules_dir; force=true)
3737

3838
cp(joinpath(path_to_input_custom_codes, "main.cpp"), joinpath(temp_physicell_dir, "main.cpp"), force=true)
3939
cp(joinpath(path_to_input_custom_codes, "Makefile"), joinpath(temp_physicell_dir, "Makefile"), force=true)
4040

41-
executable_name = baseToExecutable("project_ccid_$(S.folder_ids.custom_code_id)")
41+
executable_name = baseToExecutable("project_ccid_$(S.inputs.custom_code.id)")
4242
cmd = `make -j 8 CC=$(PHYSICELL_CPP) PROGRAM_NAME=$(executable_name) CFLAGS=$(cflags)`
4343
# if Sys.isapple() # hacky way to say the -j flag works on my machine but not on the HPC
4444
# cmd = `$cmd -j 20`
4545
# end
4646

47-
println("Compiling custom code for $(S.folder_names.custom_code_folder) with flags: $cflags")
47+
println("Compiling custom code for $(S.inputs.custom_code.folder) with flags: $cflags")
4848

4949
try
5050
cd(() -> run(pipeline(cmd; stdout=joinpath(path_to_input_custom_codes, "compilation.log"), stderr=joinpath(path_to_input_custom_codes, "compilation.err"))), temp_physicell_dir) # compile the custom code in the PhysiCell directory and return to the original directory
@@ -114,13 +114,13 @@ function compilerFlags(S::AbstractSampling)
114114
cflags *= " -D $(macro_flag)"
115115
end
116116

117-
recompile = recompile || !executableExists(S.folder_names.custom_code_folder) # last chance to recompile: do so if the executable does not exist
117+
recompile = recompile || !executableExists(S.inputs.custom_code.folder) # last chance to recompile: do so if the executable does not exist
118118

119119
return cflags, recompile, clean
120120
end
121121

122122
function writePhysiCellCommitHash(S::AbstractSampling)
123-
path_to_commit_hash = joinpath(data_dir, "inputs", "custom_codes", S.folder_names.custom_code_folder, "physicell_commit_hash.txt")
123+
path_to_commit_hash = joinpath(data_dir, "inputs", "custom_codes", S.inputs.custom_code.folder, "physicell_commit_hash.txt")
124124
physicell_commit_hash = physiCellCommitHash()
125125
current_commit_hash = ""
126126
if isfile(path_to_commit_hash)
@@ -151,7 +151,7 @@ function addMacrosIfNeeded(S::AbstractSampling)
151151
end
152152

153153
function addMacro(S::AbstractSampling, macro_name::String)
154-
path_to_macros = joinpath(data_dir, "inputs", "custom_codes", S.folder_names.custom_code_folder, "macros.txt")
154+
path_to_macros = joinpath(data_dir, "inputs", "custom_codes", S.inputs.custom_code.folder, "macros.txt")
155155
open(path_to_macros, "a") do f
156156
println(f, macro_name)
157157
end
@@ -162,7 +162,7 @@ function addPhysiECMIfNeeded(S::AbstractSampling)
162162
# if the custom codes folder for the sampling already has the macro, then we don't need to do anything
163163
return
164164
end
165-
if S.folder_ids.ic_ecm_id != -1
165+
if S.inputs.ic_ecm.id != -1
166166
# if this sampling is providing an ic file for ecm, then we need to add the macro
167167
addMacro(S, "ADDON_PHYSIECM")
168168
return
@@ -176,7 +176,7 @@ function addPhysiECMIfNeeded(S::AbstractSampling)
176176
end
177177

178178
function isPhysiECMInConfig(M::AbstractMonad)
179-
path_to_xml = joinpath(data_dir, "inputs", "configs", M.folder_names.config_folder, "config_variations", "config_variation_$(M.variation_ids.config).xml")
179+
path_to_xml = joinpath(data_dir, "inputs", "configs", M.inputs.config.folder, "config_variations", "config_variation_$(M.variation_ids.config).xml")
180180
xml_doc = openXML(path_to_xml)
181181
xml_path = ["microenvironment_setup", "ecm_setup"]
182182
ecm_setup_element = retrieveElement(xml_doc, xml_path; required=false)
@@ -198,7 +198,7 @@ function isPhysiECMInConfig(sampling::Sampling)
198198
end
199199

200200
function readMacrosFile(S::AbstractSampling)
201-
path_to_macros = joinpath(data_dir, "inputs", "custom_codes", S.folder_names.custom_code_folder, "macros.txt")
201+
path_to_macros = joinpath(data_dir, "inputs", "custom_codes", S.inputs.custom_code.folder, "macros.txt")
202202
if !isfile(path_to_macros)
203203
return []
204204
end

src/VCTConfiguration.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ end
7575
################## Configuration Functions ##################
7676

7777
function loadConfiguration(M::AbstractMonad)
78-
path_to_xml = joinpath(data_dir, "inputs", "configs", M.folder_names.config_folder, "config_variations", "config_variation_$(M.variation_ids.config).xml")
78+
path_to_xml = joinpath(data_dir, "inputs", "configs", M.inputs.config.folder, "config_variations", "config_variation_$(M.variation_ids.config).xml")
7979
if isfile(path_to_xml)
8080
return
8181
end
8282
mkpath(dirname(path_to_xml))
83-
path_to_xml_src = joinpath(data_dir, "inputs", "configs", M.folder_names.config_folder, "PhysiCell_settings.xml")
83+
path_to_xml_src = joinpath(data_dir, "inputs", "configs", M.inputs.config.folder, "PhysiCell_settings.xml")
8484
cp(path_to_xml_src, path_to_xml, force=true)
8585

8686
xml_doc = openXML(path_to_xml)
8787
query = constructSelectQuery("config_variations", "WHERE config_variation_id=$(M.variation_ids.config);")
88-
variation_row = queryToDataFrame(query; db=configDB(M.folder_names.config_folder), is_row=true)
88+
variation_row = queryToDataFrame(query; db=configDB(M.inputs.config.folder), is_row=true)
8989
for column_name in names(variation_row)
9090
if column_name == "config_variation_id"
9191
continue
@@ -106,12 +106,12 @@ function loadConfiguration(sampling::Sampling)
106106
end
107107

108108
function loadRulesets(M::AbstractMonad)
109-
if M.variation_ids.rulesets == -1 # no rules being used
109+
if M.variation_ids.rulesets_collection == -1 # no rules being used
110110
return
111111
end
112-
path_to_rulesets_collections_folder = joinpath(data_dir, "inputs", "rulesets_collections", M.folder_names.rulesets_collection_folder)
113-
path_to_rulesets_xml = joinpath(path_to_rulesets_collections_folder, "rulesets_collections_variations", "rulesets_variation_$(M.variation_ids.rulesets).xml")
114-
if isfile(path_to_rulesets_xml) # already have the rulesets variation created
112+
path_to_rulesets_collections_folder = joinpath(data_dir, "inputs", "rulesets_collections", M.inputs.rulesets_collection.folder)
113+
path_to_rulesets_xml = joinpath(path_to_rulesets_collections_folder, "rulesets_collections_variations", "rulesets_variation_$(M.variation_ids.rulesets_collection).xml")
114+
if isfile(path_to_rulesets_xml) # already have the rulesets_collection variation created
115115
return
116116
end
117117
mkpath(dirname(path_to_rulesets_xml)) # ensure the directory exists
@@ -124,11 +124,11 @@ function loadRulesets(M::AbstractMonad)
124124
end
125125

126126
xml_doc = parse_file(path_to_base_xml)
127-
if M.variation_ids.rulesets != 0 # only update if not using the base variation for the ruleset
128-
query = constructSelectQuery("rulesets_variations", "WHERE rulesets_variation_id=$(M.variation_ids.rulesets);")
127+
if M.variation_ids.rulesets_collection != 0 # only update if not using the base variation for the ruleset
128+
query = constructSelectQuery("rulesets_collection_variations", "WHERE rulesets_collection_variation_id=$(M.variation_ids.rulesets_collection);")
129129
variation_row = queryToDataFrame(query; db=rulesetsCollectionDB(M), is_row=true)
130130
for column_name in names(variation_row)
131-
if column_name == "rulesets_variation_id"
131+
if column_name == "rulesets_collection_variation_id"
132132
continue
133133
end
134134
xml_path = columnNameToXMLPath(column_name)
@@ -141,10 +141,10 @@ function loadRulesets(M::AbstractMonad)
141141
end
142142

143143
function loadICCells(M::AbstractMonad)
144-
if M.folder_ids.ic_cell_id == -1 # no ic cells being used
144+
if M.inputs.ic_cell.id == -1 # no ic cells being used
145145
return
146146
end
147-
path_to_ic_cells_folder = joinpath(data_dir, "inputs", "ics", "cells", M.folder_names.ic_cell_folder)
147+
path_to_ic_cells_folder = joinpath(data_dir, "inputs", "ics", "cells", M.inputs.ic_cell.folder)
148148
if isfile(joinpath(path_to_ic_cells_folder, "cells.csv")) # ic already given by cells.csv
149149
return
150150
end
@@ -158,7 +158,7 @@ function loadICCells(M::AbstractMonad)
158158
xml_doc = parse_file(path_to_base_xml)
159159
if M.variation_ids.ic_cell != 0 # only update if not using the base variation for the ic cells
160160
query = constructSelectQuery("ic_cell_variations", "WHERE ic_cell_variation_id=$(M.variation_ids.ic_cell);")
161-
variation_row = queryToDataFrame(query; db=icCellDB(M.folder_names.ic_cell_folder), is_row=true)
161+
variation_row = queryToDataFrame(query; db=icCellDB(M.inputs.ic_cell.folder), is_row=true)
162162
for column_name in names(variation_row)
163163
if column_name == "ic_cell_variation_id"
164164
continue
@@ -173,8 +173,8 @@ function loadICCells(M::AbstractMonad)
173173
end
174174

175175
function pathToICCell(simulation::Simulation)
176-
@assert simulation.folder_ids.ic_cell_id != -1 "No IC cell variation being used" # we should have already checked this before calling this function
177-
path_to_ic_cell_folder = joinpath(data_dir, "inputs", "ics", "cells", simulation.folder_names.ic_cell_folder)
176+
@assert simulation.inputs.ic_cell.id != -1 "No IC cell variation being used" # we should have already checked this before calling this function
177+
path_to_ic_cell_folder = joinpath(data_dir, "inputs", "ics", "cells", simulation.inputs.ic_cell.folder)
178178
if isfile(joinpath(path_to_ic_cell_folder, "cells.csv")) # ic already given by cells.csv
179179
return joinpath(path_to_ic_cell_folder, "cells.csv")
180180
end
@@ -291,7 +291,7 @@ function simpleConfigVariationNames(name::String)
291291
end
292292

293293
function simpleRulesetsVariationNames(name::String)
294-
if name == "rulesets_variation_id"
294+
if name == "rulesets_collection_variation_id"
295295
return "RulesVarID"
296296
elseif startswith(name, "hypothesis_ruleset")
297297
return getRuleParameterName(name)

0 commit comments

Comments
 (0)