Skip to content

Commit b02cea0

Browse files
author
Hiroaki Imoto
authored
Merge pull request #14 from himoto/develop
Bump version to 0.2.0
2 parents 63a827b + 31adf54 commit b02cea0

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BioMASS"
22
uuid = "324734c7-f323-4536-9335-775d9be9d101"
33
authors = ["Hiroaki Imoto <himoto@protein.osaka-u.ac.jp>"]
4-
version = "0.1.1"
4+
version = "0.2.0"
55

66
[deps]
77
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"

fos_model/fitness.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,13 @@ function objective(indiv_gene::Vector{Float64})::Float64
6060
Sim.simulations[
6161
i,
6262
Sim.normalization[obs_name]["timepoint"],
63-
[conditions_index(c) for c in
64-
Sim.normalization[obs_name]["condition"]]
63+
[conditions_index(c) for c in Sim.normalization[obs_name]["condition"]]
6564
]
6665
) : maximum(
6766
Sim.simulations[
6867
i,
6968
:,
70-
[conditions_index(c) for c in
71-
Sim.normalization[obs_name]["condition"]]
69+
[conditions_index(c) for c in Sim.normalization[obs_name]["condition"]]
7270
]
7371
)
7472
)

src/visualize.jl

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,14 @@ function get_norm_max(
6262
i,
6363
j,
6464
Sim.normalization[obs_name]["timepoint"],
65-
[conditions_index(c) for c in
66-
Sim.normalization[obs_name]["condition"]]
65+
[conditions_index(c) for c in Sim.normalization[obs_name]["condition"]]
6766
]
6867
) : maximum(
6968
simulations_all[
7069
i,
7170
j,
7271
:,
73-
[conditions_index(c) for c in
74-
Sim.normalization[obs_name]["condition"]]
72+
[conditions_index(c) for c in Sim.normalization[obs_name]["condition"]]
7573
]
7674
)
7775
)
@@ -126,7 +124,7 @@ function plot_timecourse(
126124
plot(
127125
Sim.t,
128126
simulations_all[i,j,:,l] ./ ifelse(
129-
length(Sim.normalization) == 0,
127+
length(Sim.normalization) == 0 || maximum(simulations_all[i,j,:,l]) == 0.0,
130128
1.0,
131129
norm_max
132130
),
@@ -148,7 +146,7 @@ function plot_timecourse(
148146
@simd for l in eachindex(Sim.conditions)
149147
normalized[i,j,:,l] = (
150148
simulations_all[i,j,:,l] ./ ifelse(
151-
length(Sim.normalization) == 0,
149+
length(Sim.normalization) == 0 || maximum(simulations_all[i,j,:,l]) == 0.0,
152150
1.0,
153151
norm_max
154152
)
@@ -172,7 +170,9 @@ function plot_timecourse(
172170
for j in eachindex(n_file)
173171
for k in eachindex(Sim.t)
174172
for l in eachindex(Sim.conditions)
175-
@inbounds normalized[i,j,k,l] /= mean_norm_max
173+
if !isnan(mean_norm_max) && mean_norm_max != 0.0
174+
@inbounds normalized[i,j,k,l] /= mean_norm_max
175+
end
176176
end
177177
end
178178
end
@@ -220,23 +220,21 @@ function plot_timecourse(
220220
Sim.simulations[
221221
i,
222222
Sim.normalization[obs_name]["timepoint"],
223-
[conditions_index(c) for c in
224-
Sim.normalization[obs_name]["condition"]]
223+
[conditions_index(c) for c in Sim.normalization[obs_name]["condition"]]
225224
]
226225
) : maximum(
227226
Sim.simulations[
228227
i,
229228
:,
230-
[conditions_index(c) for c in
231-
Sim.normalization[obs_name]["condition"]]
229+
[conditions_index(c) for c in Sim.normalization[obs_name]["condition"]]
232230
]
233231
)
234232
)
235233
for (l,condition) in enumerate(Sim.conditions)
236234
plot(
237235
Sim.t,
238236
Sim.simulations[i,:,l] ./ ifelse(
239-
length(Sim.normalization) == 0,
237+
length(Sim.normalization) == 0 || maximum(Sim.simulations[i,:,l]) == 0.0,
240238
1.0,
241239
norm_max
242240
),

test/parameter_estimation.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ output = []
2424
if isinstalled("matplotlib")
2525
@testset "visualization" begin
2626
visualize(model, viz_type="best")
27-
@test isdir("../fos_model/figure/simulation/best")
27+
files = readdir("../fos_model/figure/simulation/best")
28+
n_pdf = 0
29+
for file in files
30+
if occursin(".pdf", file)
31+
n_pdf += 1
32+
end
33+
end
34+
@test n_pdf == 8 # length(observables)
2835
push!(output, "figure")
2936
end
3037
end

0 commit comments

Comments
 (0)