Skip to content

Commit a8a927a

Browse files
author
Hiroaki Imoto
authored
Merge pull request #37 from himoto/develop
Release v0.4.3
2 parents 672766a + cf7bea8 commit a8a927a

File tree

12 files changed

+141
-120
lines changed

12 files changed

+141
-120
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.4.2"
4+
version = "0.4.3"
55

66
[deps]
77
CMAEvolutionStrategy = "8d3b24bd-414e-49e0-94fb-163cc3a3e411"

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
[![Actions Status](https://github.com/himoto/BioMASS.jl/workflows/CI/badge.svg)](https://github.com/himoto/BioMASS.jl/actions)
44
[![version](https://juliahub.com/docs/BioMASS/version.svg)](https://juliahub.com/ui/Packages/BioMASS/acq1V)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6+
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
7+
58
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://himoto.github.io/BioMASS.jl/stable)
69
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://himoto.github.io/BioMASS.jl/dev)
7-
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8-
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
910

1011
This module provides a Julia interface to the [BioMASS](https://github.com/okadalabipr/biomass) parameter estimation.
1112

@@ -33,7 +34,7 @@ optimize(model, 1, max_generation=20000, allowable_error=0.5)
3334
visualize(model, viz_type="best", show_all=true)
3435
```
3536

36-
## Convert optimized parameters to BioMASS format
37+
### Conversion of optimized parameters into BioMASS format
3738

3839
![](docs/src/assets/conversion.png)
3940

docs/src/assets/Subp_1NMPP1.png

45.3 KB
Loading

docs/src/usage/bifurcation_analysis.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
A numerical study of the changes in the dynamics and stability of a system upon variations in its parameters.
44

5+
![](../assets/Subp_1NMPP1.png)
6+
57
## Procedure for stability analysis at fixed points
68

79
Consider the following system of ordinary differential equations:

src/BioMASS.jl

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,83 @@ using StatsBase
66
using Statistics
77
using DelimitedFiles
88

9-
export optimize,
9+
export load_model,
10+
optimize,
1011
optimize_continue,
1112
param2biomass,
12-
load_model,
1313
visualize,
1414
create_diffeq,
1515
new_curve!,
1616
get_bistable_regime
1717

18+
19+
const requirements = [
20+
joinpath("name2idx", "parameters.jl"),
21+
joinpath("name2idx", "species.jl"),
22+
"set_model.jl",
23+
"observable.jl",
24+
"simulation.jl",
25+
"experimental_data.jl",
26+
"set_search_param.jl",
27+
"fitness.jl",
28+
]
29+
30+
struct ExecModel
31+
path::String
32+
parameters::Module
33+
species::Module
34+
observables::Vector{String}
35+
sim::Module
36+
exp::Module
37+
obj_func::Function
38+
cond2idx::Function
39+
search_idx::Function
40+
search_region::Function
41+
update_param::Function
42+
gene2val::Function
43+
val2gene::Function
44+
bestIndivVal2randGene::Function
45+
end
46+
function ExecModel(model_path::String, show_info::Bool)
47+
for req in requirements
48+
include(joinpath(model_path, req))
49+
end
50+
if show_info
51+
print(
52+
"Model information\n"
53+
* "-----------------\n"
54+
* @sprintf(
55+
"%d species\n%d parameters, of which %d to be estimated",
56+
length(V.NAMES), length(C.NAMES), length(get_search_index()[1])
57+
)
58+
)
59+
end
60+
ExecModel(
61+
model_path,
62+
C,
63+
V,
64+
observables,
65+
Sim,
66+
Exp,
67+
objective,
68+
conditions_index,
69+
get_search_index,
70+
get_search_region,
71+
update_param,
72+
decode_gene2val,
73+
encode_val2gene,
74+
encode_bestIndivVal2randGene,
75+
)
76+
end
77+
78+
function load_model(path_to_model::String; show_info::Bool=false)
79+
if isdir(path_to_model)
80+
ExecModel(path_to_model, show_info)
81+
else
82+
error("$path_to_model: No such directory")
83+
end
84+
end
85+
1886
function isinstalled(pymodule::String)::Bool
1987
try
2088
pyimport(pymodule)
@@ -24,13 +92,12 @@ function isinstalled(pymodule::String)::Bool
2492
end
2593
end
2694

27-
include("exec_model.jl")
2895
include("convert.jl")
2996
include("optimize.jl")
30-
include("ga/initial_population.jl")
31-
include("ga/converging.jl")
32-
include("ga/local_search.jl")
33-
include("ga/v2.jl")
97+
include("estimation/initial_population.jl")
98+
include("estimation/converging.jl")
99+
include("estimation/local_search.jl")
100+
include("estimation/ga.jl")
34101
if isinstalled("matplotlib")
35102
include("visualize.jl")
36103
else
File renamed without changes.

src/ga/v2.jl renamed to src/estimation/ga.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ function ga_v2_continue(;
284284
)
285285
)[:, 1]
286286
best_indiv_gene::Vector{Float64} = model.val2gene(best_indiv)
287-
best_fitness::Float64 = objective(best_indiv_gene)
287+
best_fitness::Float64 = model.obj_func(best_indiv_gene)
288288

289289
population::Matrix{Float64} = get_initial_population_continue(
290290
model, nth_param_set, n_population, n_gene, initial_threshold, p0_bounds
File renamed without changes.

src/ga/local_search.jl renamed to src/estimation/local_search.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function local_search!(
5656
verbosity=0,
5757
multi_threading=true,
5858
maxiter=maxiter,
59-
maxfevals=100 * n_gene,
59+
maxfevals=1000 * n_gene,
6060
)
6161
x_best_fit = xbest(result)
6262
obj_val = objective(x_best_fit)

src/ga/scipy_optimize.jl renamed to src/estimation/scipy_optimize.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function __init__()
3737
'xtol': 0.1,
3838
'ftol': 1.0,
3939
'maxiter': maxiter,
40-
'maxfev': 100 * n_gene,
40+
'maxfev': 1000 * n_gene,
4141
'direc': direc,
4242
}
4343
)
@@ -61,7 +61,7 @@ function __init__()
6161
objective,
6262
tuple(zip(lower, upper)),
6363
strategy='best2bin',
64-
mutation=0.1,
64+
mutation=(0.0, 0.3),
6565
recombination=0.9,
6666
maxiter=maxiter,
6767
popsize=1,

src/exec_model.jl

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)