diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e097636..a53f444f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,19 +56,19 @@ jobs: - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} + - name: Set environment variable PHYSICELL_CPP + run: echo "PHYSICELL_CPP=${{ matrix.compiler }}" >> $GITHUB_ENV - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 # not sure what this does yet...runs files marked as tests? - - name: Install julia dependencies - run: | - julia -e 'using Pkg; \ - Pkg.add(["DataFrames", "CSV", "SQLite", "Random", "LightXML", "LazyGrids", "Dates", "Tables", "Distributions", "Statistics", "QuasiMonteCarlo", "Sobol", "MAT", "FFTW", "GlobalSensitivity"]); \ - Pkg.update()' - echo "Julia packages added and updated" - - name: Set environment variable PHYSICELL_CPP - run: echo "PHYSICELL_CPP=${{ matrix.compiler }}" >> $GITHUB_ENV - - name: Run sampling - run: | - cd ./tests - julia -t 8 ./test-project/VCT/RunSampling.jl - echo "RunSampling.jl complete" \ No newline at end of file + # - name: Install julia dependencies + # run: | + # julia -e 'using Pkg; \ + # Pkg.add(["DataFrames", "CSV", "SQLite", "Random", "LightXML", "LazyGrids", "Dates", "Tables", "Distributions", "Statistics", "QuasiMonteCarlo", "Sobol", "MAT", "FFTW", "GlobalSensitivity"]); \ + # Pkg.update()' + # echo "Julia packages added and updated" + # - name: Run sampling + # run: | + # cd ./test + # julia -t 8 ./test-project/VCT/RunSampling.jl + # echo "RunSampling.jl complete" \ No newline at end of file diff --git a/src/VCTLoader.jl b/src/VCTLoader.jl index 22d8a877..83a36125 100644 --- a/src/VCTLoader.jl +++ b/src/VCTLoader.jl @@ -18,7 +18,7 @@ end function getLabels(xml_doc::XMLDocument) xml_path = ["cellular_information", "cell_populations", "cell_population", "custom", "simplified_data", "labels"] - labels_element = VCTModule.retrieveElement(xml_doc, xml_path; required=true) + labels_element = retrieveElement(xml_doc, xml_path; required=true) labels = String[] for label in child_elements(labels_element) @@ -45,9 +45,9 @@ indexToFilename(index::Int) = "output$(lpad(index,8,"0"))" function PhysiCellSnapshot(folder::String, index::Union{Int, Symbol}; labels::Vector{String}=String[]) filepath_base = "$(folder)/$(indexToFilename(index))" - xml_doc = VCTModule.openXML("$(filepath_base).xml") + xml_doc = openXML("$(filepath_base).xml") mat_file = "$(filepath_base)_cells.mat" - time = VCTModule.getField(xml_doc, ["metadata","current_time"]) |> x->parse(Float64, x) + time = getField(xml_doc, ["metadata","current_time"]) |> x->parse(Float64, x) if isempty(labels) labels = getLabels(xml_doc) end @@ -55,7 +55,7 @@ function PhysiCellSnapshot(folder::String, index::Union{Int, Symbol}; labels::Ve cells[!,:ID] = convert.(Int,cells[!,:ID]) cells[!,:dead] = convert.(Bool,cells[!,:dead]) cells[!,:cell_type] = convert.(Int,cells[!,:cell_type]) - VCTModule.closeXML(xml_doc) + closeXML(xml_doc) return PhysiCellSnapshot(folder, index, time, DataFrame(cells)) end diff --git a/src/pcvct.jl b/src/pcvct.jl index c9f9b2de..a3f49f04 100644 --- a/src/pcvct.jl +++ b/src/pcvct.jl @@ -1,7 +1,5 @@ module pcvct include("VCTModule.jl") -# using .VCTModule -# export VCTModule end \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index 494c3bda..5f0d789c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,5 +3,5 @@ using Test @testset "pcvct.jl" begin # Write your tests here. - @assert 2+2==4 + include("./test-project/VCT/RunSampling.jl") end diff --git a/test/test-project/VCT/RunSampling.jl b/test/test-project/VCT/RunSampling.jl index dd651ba2..f15564e4 100644 --- a/test/test-project/VCT/RunSampling.jl +++ b/test/test-project/VCT/RunSampling.jl @@ -1,5 +1,7 @@ -include("../../../src/VCTModule.jl") # include -using .VCTModule +using Test, pcvct + +# include("../../../src/pcvct.jl") # include +# using .pcvct path_to_physicell_folder = "./PhysiCell" # path to PhysiCell folder path_to_data_folder = "./test-project/data" # path to data folder @@ -22,7 +24,7 @@ config_variation_ids, rulesets_variation_ids = addVariations(GridVariation(), co println(""" ############################################ -## DATABASE SUCCESSFULLY INITIALIZED! ## +## DATABASE SUCCESSFULLY UPDATED! ## ############################################ """) @@ -63,8 +65,8 @@ println(""" ############################################ """) -query = VCTModule.constructSelectQuery("simulations", "") -df = queryToDataFrame(query; is_row=true) +query = pcvct.constructSelectQuery("simulations", "") +df = pcvct.queryToDataFrame(query; is_row=true) println(""" ############################################ @@ -75,19 +77,17 @@ println(""" monad_min_length = 2 EV = ElementaryVariation[] -xml_path = [VCTModule.cyclePath("default"); "phase_durations"; "duration:index:0"] +xml_path = [pcvct.cyclePath("default"); "phase_durations"; "duration:index:0"] push!(EV, ElementaryVariation(xml_path, [1.0, 2.0])) -xml_path = [VCTModule.cyclePath("default"); "phase_durations"; "duration:index:1"] +xml_path = [pcvct.cyclePath("default"); "phase_durations"; "duration:index:1"] push!(EV, ElementaryVariation(xml_path, [3.0, 4.0])) -xml_path = [VCTModule.cyclePath("default"); "phase_durations"; "duration:index:2"] +xml_path = [pcvct.cyclePath("default"); "phase_durations"; "duration:index:2"] push!(EV, ElementaryVariation(xml_path, [5.0, 6.0])) -xml_path = [VCTModule.cyclePath("default"); "phase_durations"; "duration:index:3"] +xml_path = [pcvct.cyclePath("default"); "phase_durations"; "duration:index:3"] push!(EV, ElementaryVariation(xml_path, [7.0, 8.0])) -reference_config_variation_id = config_variation_id -reference_rulesets_variation_id = rulesets_variation_id - -sampling = Sampling(monad_min_length, config_folder, rulesets_collection_folder, ic_cell_folder, ic_substrate_folder, ic_ecm_folder, custom_code_folder, reference_config_variation_id, reference_rulesets_variation_id) +config_variation_ids, rulesets_variation_ids = addVariations(GridVariation(), config_folder, rulesets_collection_folder, EV; reference_variation_id=config_variation_id, reference_rulesets_variation_id=rulesets_variation_id) +sampling = Sampling(monad_min_length, config_folder, rulesets_collection_folder, ic_cell_folder, ic_substrate_folder, ic_ecm_folder, custom_code_folder, config_variation_ids, rulesets_variation_ids) println(""" ############################################ @@ -106,10 +106,10 @@ println(""" simulation_ids = getSimulations(sampling) expected_num_sims = monad_min_length for ev in EV - expected_num_sims *= length(ev.values) + global expected_num_sims *= length(ev.values) end -@assert length(simulation_ids) == expected_num_sims +@test length(simulation_ids) == expected_num_sims println(""" ############################################