From 0f050b5bbe7ee283467f8a20910ec393f7be16d1 Mon Sep 17 00:00:00 2001 From: Alfonso Landeros Date: Fri, 14 Sep 2018 15:08:47 -0700 Subject: [PATCH 01/17] Fix deprecation warnings for tests --- test/independent.jl | 2 +- test/kendall.jl | 2 +- test/linear.jl | 2 +- test/runtests.jl | 10 +++++++--- test/sir.jl | 2 +- test/summary.jl | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/independent.jl b/test/independent.jl index 6ac68ae..a5f8d15 100644 --- a/test/independent.jl +++ b/test/independent.jl @@ -19,7 +19,7 @@ for algorithm in algorithms @printf "%+6s\n" algorithm for M in model_size model = independent(M, x0) - srand(u) + seed!(u) @printf "%+6s: %3d" "M" M @time run_test(model, algorithm, t, n, m) end diff --git a/test/kendall.jl b/test/kendall.jl index 824396f..e9d2ed5 100644 --- a/test/kendall.jl +++ b/test/kendall.jl @@ -40,7 +40,7 @@ print(" Running tests...\n\n") for algorithm in algorithms print(" - $(algorithm): ") - srand(u) + seed!(u) @time result = run_test(model, algorithm, t, n, m) diff --git a/test/linear.jl b/test/linear.jl index 1a4a227..5a50254 100644 --- a/test/linear.jl +++ b/test/linear.jl @@ -19,7 +19,7 @@ for algorithm in algorithms @printf "%+6s\n" algorithm for M in model_size model = linear(M, x0) - srand(u) + seed!(u) @printf "%+6s: %3d" "M" M @time run_test(model, algorithm, t, n, m) end diff --git a/test/runtests.jl b/test/runtests.jl index afe84c3..10de5e2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,15 +1,19 @@ using BioSimulator -using Base.Test +using Test +using Random +using Statistics import BioSimulator: Algorithm +import Random: seed! +import Printf: @printf -function run_test{T}( +function run_test( model :: Network, alg :: T, t :: Real, n :: Integer, m :: Integer; - kwargs...) + kwargs...) where T result = simulate(model, alg, time=t, epochs=n, trials=m, kwargs...) end diff --git a/test/sir.jl b/test/sir.jl index 28326e7..e8f254f 100644 --- a/test/sir.jl +++ b/test/sir.jl @@ -22,7 +22,7 @@ algorithms = [ ] for algorithm in algorithms - srand(u) + seed!(u) print(" - $(algorithm): ") @time run_test(model, algorithm, t, n, m) end diff --git a/test/summary.jl b/test/summary.jl index 934ee8a..81b1854 100644 --- a/test/summary.jl +++ b/test/summary.jl @@ -10,7 +10,7 @@ x0[5] = 3 # P2 = 3 model = autoreg(x0 = x0) -srand(5357) +seed!(5357) # single simulation result = simulate(model, Direct(), Val(:full), time = 100.0) From 785808a721b55d62ce989db7450988b54b71f1f7 Mon Sep 17 00:00:00 2001 From: Alfonso Landeros Date: Fri, 14 Sep 2018 15:16:36 -0700 Subject: [PATCH 02/17] Update dependencies for v0.7 --- REQUIRE | 3 +++ src/BioSimulator.jl | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/REQUIRE b/REQUIRE index abd1de3..ba8473b 100644 --- a/REQUIRE +++ b/REQUIRE @@ -5,3 +5,6 @@ TikzGraphs LightGraphs StatsFuns DataStructures +SparseArrays +Random +Statistics diff --git a/src/BioSimulator.jl b/src/BioSimulator.jl index a6ae5a5..30fc91a 100644 --- a/src/BioSimulator.jl +++ b/src/BioSimulator.jl @@ -4,13 +4,14 @@ __precompile__() using DataStructures using RecipesBase - -import TikzGraphs +using SparseArrays using LightGraphs: DiGraph, add_edge! +using Random +import TikzGraphs import StatsFuns.RFunctions: poisrand - import DataFrames: DataFrame +import Statistics: mean, std import Base: (<=), (>=), From bcdf5a96312d93df338ebc2bf8222bd4d515b926 Mon Sep 17 00:00:00 2001 From: Alfonso Landeros Date: Fri, 14 Sep 2018 15:19:10 -0700 Subject: [PATCH 03/17] Fix deprecation warnings for parametric functions/types --- src/backend/pvec.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/pvec.jl b/src/backend/pvec.jl index f12f848..c90b19f 100644 --- a/src/backend/pvec.jl +++ b/src/backend/pvec.jl @@ -24,13 +24,13 @@ Base.eltype(x::PVec{T}) where T = T ##### PVec interface ##### intensity(x::PVec) = x.intensity -isstable{T}(x::PVec{T}) = (x.error_bound <= eps(T) * x.intensity) +isstable(x::PVec{T}) where T = (x.error_bound <= eps(T) * x.intensity) -@fastmath function update_errorbound!{T}(x::PVec{T}, xi::T, i::Integer) +@fastmath function update_errorbound!(x::PVec{T}, xi::T, i::Integer) where T x.error_bound = x.error_bound + eps(T) * (x.intensity + x[i] + xi) end -@fastmath function update_intensity!{T}(x::PVec{T}, xi::T, i::Integer) +@fastmath function update_intensity!(x::PVec{T}, xi::T, i::Integer) where T # if x.intensity - x[i] + xi < 0 # error(""" # Intensity update failed! From 3fe9e4319ee267efc5fdcdf09e653434ef690e88 Mon Sep 17 00:00:00 2001 From: Alfonso Landeros Date: Fri, 14 Sep 2018 15:33:21 -0700 Subject: [PATCH 04/17] Missed deprecation warnings in tests --- test/kendall.jl | 10 ++++------ test/sort.jl | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/test/kendall.jl b/test/kendall.jl index e9d2ed5..97a0cd4 100644 --- a/test/kendall.jl +++ b/test/kendall.jl @@ -1,9 +1,7 @@ -using BioSimulator -using Base.Test - function kendall_mean(i, t, α, μ, ν) - x = exp.((α - μ) * t) - return i * x + ν / (α - μ) * (x - 1) + x = @. exp((α - μ) * t) + @. x = i * x + ν / (α - μ) * (x - 1) + return x end i = 5 @@ -18,7 +16,7 @@ m = 1_000 # for a real test, use 100_000 model = kendall(i, α, μ, ν) -theoretical = kendall_mean(i, linspace(0.0, t, n + 1), α, μ, ν) +theoretical = kendall_mean(i, range(0.0, stop = t, length = n + 1), α, μ, ν) algorithms = [ Direct(), diff --git a/test/sort.jl b/test/sort.jl index e54357f..f7ebcce 100644 --- a/test/sort.jl +++ b/test/sort.jl @@ -13,7 +13,7 @@ X0, id, id2ind = BioSimulator.make_species_vector(species) system = BioSimulator.SparseReactionSystem(reactions, id2ind, c, d) ix = sortperm(shuffle!(collect(1:d))) -indexmap = Dict(i => findfirst(ix, i) for i in eachindex(ix)) +indexmap = Dict(i => findfirst(isequal(i), ix) for i in eachindex(ix)) V = deepcopy(stoichiometry(system)) U = deepcopy(coefficients(system)) From 275b5f6ddf8c92770a17df1d60b570343f97c8bf Mon Sep 17 00:00:00 2001 From: Alfonso Landeros Date: Fri, 14 Sep 2018 15:46:08 -0700 Subject: [PATCH 05/17] Wrap tests in a function --- test/independent.jl | 32 +++++++++-------- test/kendall.jl | 84 ++++++++++++++++++++++++--------------------- test/linear.jl | 52 +++++++++++++++------------- test/sir.jl | 44 +++++++++++++----------- 4 files changed, 114 insertions(+), 98 deletions(-) diff --git a/test/independent.jl b/test/independent.jl index a5f8d15..8d29bd9 100644 --- a/test/independent.jl +++ b/test/independent.jl @@ -1,26 +1,30 @@ -x0 = 1_000 -model_size = [10, 100, 500] - -t = 10.0 -n = 1 -u = 5357 -m = 1 - -algorithms = [ +function test_independent() + x0 = 1_000 + model_size = [10, 100, 500] + + t = 10.0 + n = 1 + u = 5357 + m = 1 + + algorithms = [ Direct(), FirstReaction(), NextReaction(), OptimizedDirect(), TauLeaping(), StepAnticipation() -] - -for algorithm in algorithms - @printf "%+6s\n" algorithm - for M in model_size + ] + + for algorithm in algorithms + @printf "%+6s\n" algorithm + for M in model_size model = independent(M, x0) seed!(u) @printf "%+6s: %3d" "M" M @time run_test(model, algorithm, t, n, m) + end end end + +test_independent() diff --git a/test/kendall.jl b/test/kendall.jl index 97a0cd4..ed94102 100644 --- a/test/kendall.jl +++ b/test/kendall.jl @@ -4,53 +4,57 @@ function kendall_mean(i, t, α, μ, ν) return x end -i = 5 -α = 2.0 -μ = 1.0 -ν = 0.5 - -t = 4.0 -n = 100 -u = 5357 -m = 1_000 # for a real test, use 100_000 - -model = kendall(i, α, μ, ν) - -theoretical = kendall_mean(i, range(0.0, stop = t, length = n + 1), α, μ, ν) - -algorithms = [ +function test_kendall() + i = 5 + α = 2.0 + μ = 1.0 + ν = 0.5 + + t = 4.0 + n = 100 + u = 5357 + m = 1_000 # for a real test, use 100_000 + + model = kendall(i, α, μ, ν) + + theoretical = kendall_mean(i, range(0.0, stop = t, length = n + 1), α, μ, ν) + + algorithms = [ Direct(), FirstReaction(), NextReaction(), OptimizedDirect(), TauLeaping(), StepAnticipation() -] - -# Run SSA and SAL once to compile -print(" Precompiling..."); @time begin + ] + + # Run SSA and SAL once to compile + print(" Precompiling..."); @time begin + for algorithm in algorithms + run_test(model, algorithm, t, n, 1) + end + end + + print(" Running tests...\n\n") for algorithm in algorithms - run_test(model, algorithm, t, n, 1) + print(" - $(algorithm): ") + + seed!(u) + + @time result = run_test(model, algorithm, t, n, m) + + # count the number of relative errors that lie outside the interval [0.98, 1.02] + avg = BioSimulator.AveragePath(result.simulation_data) + + observed = reshape(avg.xmean, n+1, 1) + relative = observed ./ theoretical + badness = count(x -> !isapprox(x, 1.0, rtol=0.4), relative) + + @test badness / n ≤ 0.05 + + print(" % bad estimates = ", badness / m, " out of $(m)\n") + println() end end -print(" Running tests...\n\n") -for algorithm in algorithms - print(" - $(algorithm): ") - - seed!(u) - - @time result = run_test(model, algorithm, t, n, m) - - # count the number of relative errors that lie outside the interval [0.98, 1.02] - avg = BioSimulator.AveragePath(result.simulation_data) - - observed = reshape(avg.xmean, n+1, 1) - relative = observed ./ theoretical - badness = count(x -> !isapprox(x, 1.0, rtol=0.4), relative) - - @test badness / n ≤ 0.05 - - print(" % bad estimates = ", badness / m, " out of $(m)\n") - println() -end +test_kendall() diff --git a/test/linear.jl b/test/linear.jl index 5a50254..6d3d069 100644 --- a/test/linear.jl +++ b/test/linear.jl @@ -1,26 +1,30 @@ -x0 = 1_000 -model_size = [10, 100, 500] - -t = 5.0 -n = 1 -u = 5357 -m = 1 - -algorithms = [ - Direct(), - FirstReaction(), - NextReaction(), - OptimizedDirect(), - TauLeaping(), - StepAnticipation() -] - -for algorithm in algorithms - @printf "%+6s\n" algorithm - for M in model_size - model = linear(M, x0) - seed!(u) - @printf "%+6s: %3d" "M" M - @time run_test(model, algorithm, t, n, m) +function test_linear() + x0 = 1_000 + model_size = [10, 100, 500] + + t = 5.0 + n = 1 + u = 5357 + m = 1 + + algorithms = [ + Direct(), + FirstReaction(), + NextReaction(), + OptimizedDirect(), + TauLeaping(), + StepAnticipation() + ] + + for algorithm in algorithms + @printf "%+6s\n" algorithm + for M in model_size + model = linear(M, x0) + seed!(u) + @printf "%+6s: %3d" "M" M + @time run_test(model, algorithm, t, n, m) + end end end + +test_linear() diff --git a/test/sir.jl b/test/sir.jl index e8f254f..d3acbd3 100644 --- a/test/sir.jl +++ b/test/sir.jl @@ -1,28 +1,32 @@ -#= -Updating propensities when S population goes to 0 may lead to negative propensities. This happened when we failed to properly update the propensities using Kahan summation. This test only checks that we do not throw an error, but it should always run *except* if the propensities were not updated correctly. -=# -S = 9999 -I = 1 -R = 0 - -model = sir(S,I,R) - -t = 1000.0 -n = 1000 -u = 5357 -m = 1 - -algorithms = [ +function test_sir() + #= + Updating propensities when S population goes to 0 may lead to negative propensities. This happened when we failed to properly update the propensities using Kahan summation. This test only checks that we do not throw an error, but it should always run *except* if the propensities were not updated correctly. + =# + S = 9999 + I = 1 + R = 0 + + model = sir(S,I,R) + + t = 1000.0 + n = 1000 + u = 5357 + m = 1 + + algorithms = [ Direct(), FirstReaction(), NextReaction(), OptimizedDirect(), TauLeaping(), StepAnticipation() -] - -for algorithm in algorithms - seed!(u) + ] + + for algorithm in algorithms + seed!(u) print(" - $(algorithm): ") - @time run_test(model, algorithm, t, n, m) + @time run_test(model, algorithm, t, n, m) + end end + +test_sir() From cf24c62bad757303d955c2c45c89f69b9f882c9a Mon Sep 17 00:00:00 2001 From: Alfonso Landeros Date: Fri, 14 Sep 2018 15:48:34 -0700 Subject: [PATCH 06/17] Fix various deprecation warnings related to syntax --- src/algorithm/odm.jl | 2 +- src/algorithm/otl.jl | 2 +- src/backend/util.jl | 6 +++--- src/interface/reaction.jl | 2 +- src/interface/simulate.jl | 6 +++--- src/output/average_path.jl | 2 +- src/output/summary.jl | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/algorithm/odm.jl b/src/algorithm/odm.jl index 718e1e4..cc96b81 100644 --- a/src/algorithm/odm.jl +++ b/src/algorithm/odm.jl @@ -106,7 +106,7 @@ end r.scaled_rates[i] = k[i] r.dependencies[i] = g[i] for j in eachindex(g[i]) - r.dependencies[i][j] = findfirst(ix, g[i][j]) + r.dependencies[i][j] = something(findfirst(isequal(g[i][j]), ix), 0) end end diff --git a/src/algorithm/otl.jl b/src/algorithm/otl.jl index 6d5402e..31a8fe1 100644 --- a/src/algorithm/otl.jl +++ b/src/algorithm/otl.jl @@ -31,7 +31,7 @@ mutable struct OTL <: TauLeapMethod # end function OTL(end_time, ϵ, δ, β, stats_tracked) new(end_time, ϵ, δ, β, - 0.0, Matrix{Float64}(0,0), Int[], + 0.0, Matrix{Float64}(undef,0,0), Int[], stats_tracked, Dict{Symbol,Int}( :negative_excursions => 0, diff --git a/src/backend/util.jl b/src/backend/util.jl index 1a9970e..0ad74ed 100644 --- a/src/backend/util.jl +++ b/src/backend/util.jl @@ -60,9 +60,9 @@ function make_dependency_graph!(dg, reactions_dict) return dg end -function make_species_vector(dict::Associative{Symbol,Species}) - X0 = Array{Int}(length(dict)) - id = Array{Symbol}(length(dict)) +function make_species_vector(dict::AbstractDict{Symbol,Species}) + X0 = zeros(Int, length(dict)) + id = Array{Symbol}(undef, length(dict)) id2ind = Dict{Symbol,Int}() i = 1 diff --git a/src/interface/reaction.jl b/src/interface/reaction.jl index 74a1f0f..6569250 100644 --- a/src/interface/reaction.jl +++ b/src/interface/reaction.jl @@ -62,7 +62,7 @@ function print_participants(io, participants) end end -parse_reaction(formula::String) = parse_reaction(parse(formula)) +parse_reaction(formula::String) = parse_reaction(Meta.parse(formula)) function parse_reaction(ex::Expr) reactants = OrderedDict{Symbol,Int}() diff --git a/src/interface/simulate.jl b/src/interface/simulate.jl index fa16ec3..76a6c18 100644 --- a/src/interface/simulate.jl +++ b/src/interface/simulate.jl @@ -57,10 +57,10 @@ end function build_output(::Val{:fixed}, nspecies, epochs, ntrials, tfinal) n = epochs + 1 - tdata = collect(linspace(0.0, tfinal, n)) + tdata = collect(range(0.0, stop = tfinal, length = n)) output = RegularEnsemble(ntrials, nspecies, epochs) for i in eachindex(output) - @inbounds copy!(output[i].tdata, tdata) + @inbounds copyto!(output[i].tdata, tdata) end return output end @@ -100,7 +100,7 @@ end function simulate_chunk!(output, Xt, X0, algorithm, reactions, trial_set) a = propensities(reactions) for trial in trial_set - copy!(Xt, X0) + copyto!(Xt, X0) reset!(algorithm, Xt, reactions) xw = output[trial] diff --git a/src/output/average_path.jl b/src/output/average_path.jl index fe4417b..43399c5 100644 --- a/src/output/average_path.jl +++ b/src/output/average_path.jl @@ -12,7 +12,7 @@ function AveragePath(xw :: RegularEnsemble{T1,T2}) where {T1,T2} trials = length(xw) xmean = mean(xw[k].xdata for k in 1:trials) - temp = std([xw[k].xdata[i, j] for i in 1:d, j in 1:n, k in 1:trials], 3) + temp = std([xw[k].xdata[i, j] for i in 1:d, j in 1:n, k in 1:trials], dims=3) xstd = reshape(temp, n, d) return AveragePath{T1}(tdata, xmean, xstd) diff --git a/src/output/summary.jl b/src/output/summary.jl index 4a9c6a4..8a40109 100644 --- a/src/output/summary.jl +++ b/src/output/summary.jl @@ -57,7 +57,7 @@ function get_regular_path(xw::SamplePath{T1,T2}, tfinal, epochs) where {T1,T2} x0 = xw.xdata[1] - tdata = collect(linspace(0.0, tfinal, max_epoch)) + tdata = collect(range(0.0, stop = tfinal, length = max_epoch)) xdata = zeros(T2, length(xw.xdata[1]), max_epoch) epoch = 1 From e8f91a3ece46b5658630fd2649446a56cf338534 Mon Sep 17 00:00:00 2001 From: Alfonso Landeros Date: Fri, 14 Sep 2018 16:20:14 -0700 Subject: [PATCH 07/17] Fix mysterious 'convert' deprecation warning --- src/backend/util.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/util.jl b/src/backend/util.jl index 0ad74ed..393e192 100644 --- a/src/backend/util.jl +++ b/src/backend/util.jl @@ -68,7 +68,7 @@ function make_species_vector(dict::AbstractDict{Symbol,Species}) i = 1 for (key, s) in dict X0[i] = s.population - id[i] = s.id + id[i] = Symbol(s.id) id2ind[key] = i i = i + 1 end From 3ae424312b2c33e06689e7bee060fac6dfb53e48 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 15 Jan 2019 11:25:27 -0800 Subject: [PATCH 08/17] Update scripts --- .travis.yml | 4 ++-- appveyor.yml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index f15b71c..7d81c9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,13 @@ os: - osx julia: - - 0.6 - 0.7 + - 1.0 - nightly matrix: allow_failures: - - julia: 0.7 + - julia: 1.0 - julia: nightly notifications: diff --git a/appveyor.yml b/appveyor.yml index 152c9ea..43e8346 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,15 +1,15 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.7-latest-win32.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.7-latest-win64.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-1.0-latest-win32.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-1.0-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" matrix: allow_failures: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-1.0-latest-win32.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-1.0-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" branches: From 44a8733ee2c2088224df33275548770c90d35403 Mon Sep 17 00:00:00 2001 From: alanderos91 Date: Tue, 15 Jan 2019 11:57:13 -0800 Subject: [PATCH 09/17] Update .travis.yml --- .travis.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7d81c9a..54a21cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,14 +17,21 @@ matrix: notifications: email: false -script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia -e 'Pkg.clone(pwd())' - - julia -e 'Pkg.test("BioSimulator", coverage=true)' +#script: # the default script is equivalent to the following +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia -e 'Pkg.clone(pwd()); Pkg.build("Example"); Pkg.test("Example"; coverage=true)'; after_success: - - julia -e 'cd(Pkg.dir("BioSimulator")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' - - julia -e 'cd(Pkg.dir("BioSimulator")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' - - julia -e 'Pkg.add("Plots"); Pkg.add("GR")' - - julia -e 'Pkg.add("Documenter"); Pkg.add("JSON")' - - julia -e 'cd(Pkg.dir("BioSimulator")); include(joinpath("docs", "make.jl"))' + - julia -e 'if VERSION >= v"0.7.0-" using Pkg end; cd(Pkg.dir("Example")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'; + - julia -e 'if VERSION >= v"0.7.0-" using Pkg end; cd(Pkg.dir("Example")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'; + +jobs: + include: + - stage: "Documentation" + julia: 0.7 + os: linux + script: + - julia --project=docs/ -e 'using Pkg; Pkg.instantiate(); + Pkg.develop(PackageSpec(path=pwd()))' + - julia --project=docs/ docs/make.jl + after_success: skip From 456041b9c8c7c49de287954b3271022eababd7da Mon Sep 17 00:00:00 2001 From: alanderos91 Date: Tue, 15 Jan 2019 12:00:21 -0800 Subject: [PATCH 10/17] Update appveyor.yml --- appveyor.yml | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b240799..a9a4b75 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,10 +3,18 @@ environment: - julia_version: 0.7 - julia_version: 1 - julia_version: nightly + +platform: + - x86 # 32-bit + - x64 # 64-bit + +# Uncomment the following lines to allow failures on nightly julia +# (tests will run but not make your overall status red) matrix: - allow_failures: - - julia_version: 1 - - julia_version: nightly + allow_failures: + - julia_version: 1 + - julia_version: nightly + branches: only: - master @@ -19,20 +27,18 @@ notifications: on_build_status_changed: false install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" -# Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $env:JULIA_URL, - "C:\projects\julia-binary.exe") - - set PATH=C:\Miniconda3;C:\Miniconda3\Scripts;%PATH% -# Run installer silently, output to C:\projects\julia - - C:\projects\julia-binary.exe /S /D=C:\projects\julia + - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: -# Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"BioSimulator\"); Pkg.build(\"BioSimulator\")" + - echo "%JL_BUILD_SCRIPT%" + - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: - - C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"BioSimulator\")" + - echo "%JL_TEST_SCRIPT%" + - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" + +# # Uncomment to support code coverage upload. Should only be enabled for packages +# # which would have coverage gaps without running on Windows +# on_success: +# - echo "%JL_CODECOV_SCRIPT%" +# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" From 87ac3a7c60bf736444caef8be3e0395503de3554 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 15 Jan 2019 12:59:29 -0800 Subject: [PATCH 11/17] Remove packages in stdlib from REQUIRE --- REQUIRE | 3 --- 1 file changed, 3 deletions(-) diff --git a/REQUIRE b/REQUIRE index ba8473b..abd1de3 100644 --- a/REQUIRE +++ b/REQUIRE @@ -5,6 +5,3 @@ TikzGraphs LightGraphs StatsFuns DataStructures -SparseArrays -Random -Statistics From c47fd0f26797345a4b5e850c64b9665e813769fe Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 15 Jan 2019 15:26:20 -0800 Subject: [PATCH 12/17] Build docs on 1.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 54a21cd..1b764b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ after_success: jobs: include: - stage: "Documentation" - julia: 0.7 + julia: 1.0 os: linux script: - julia --project=docs/ -e 'using Pkg; Pkg.instantiate(); From 123c5e519f19c32a7a03017a28be1f585933a737 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 20 Jan 2019 01:59:39 -0800 Subject: [PATCH 13/17] Fix the deprecation warnings we missed --- src/output/petrinet.jl | 6 +++--- src/output/summary.jl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/output/petrinet.jl b/src/output/petrinet.jl index 8d5b017..508d334 100644 --- a/src/output/petrinet.jl +++ b/src/output/petrinet.jl @@ -55,11 +55,11 @@ function petri_net(model :: Network) end species_nodes = collect(1:s) - species_labels = map(string, keys(species)) + species_labels = [string(v) for v in keys(species)] species_styles = Dict( i => "draw, rounded corners, fill=blue!10, font=\\large" for i in species_nodes ) reaction_nodes = collect(s+1:s+r) - reaction_labels = map(string, keys(reactions)) + reaction_labels = [string(v) for v in keys(reactions)] reaction_styles = Dict( i => "draw, rounded corners, thick, fill=red!10, font=\\large" for i in reaction_nodes) node_labels = [ species_labels; reaction_labels ] @@ -85,7 +85,7 @@ function draw(x :: PetriNet, options) edge_labels = x.edge_labels edge_styles = x.edge_styles - labels = map(x -> replace(x, "_", "\$\\cdot\$"), labels) + labels = map(x -> replace(x, "_" => "\$\\cdot\$"), labels) TikzGraphs.plot(graph, TikzGraphs.Layouts.Layered(), labels, diff --git a/src/output/summary.jl b/src/output/summary.jl index 8a40109..85bbbbc 100644 --- a/src/output/summary.jl +++ b/src/output/summary.jl @@ -103,9 +103,9 @@ end if species == nothing species = collect(keys(result.id2index)) - labels = map(String, keys(result.id2index)) + labels = [string(s) for s in keys(result.id2index)] else - labels = map(s -> String(s), species) + labels = [string(s) for s in species] end label --> reshape(labels, 1, length(labels)) From 1658da003d6f46975cb2d57c5bd4dc8db2708ce1 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 20 Jan 2019 02:16:51 -0800 Subject: [PATCH 14/17] Fix documentation deprecation warnings --- docs/make.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 3bb0d05..af937c5 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -6,7 +6,7 @@ ENV["PLOTS_TEST"] = "true" makedocs( doctest = false, - format = :html, + format = Documenter.HTML(), modules = [BioSimulator], clean = true, sitename = "BioSimulator.jl", @@ -22,7 +22,6 @@ makedocs( deploydocs( repo = "github.com/alanderos91/BioSimulator.jl.git", target = "build", - julia = "0.6", deps = nothing, make = nothing ) From a8fa737d679b396b2961e2a88795dc7fd0f54631 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 20 Jan 2019 02:17:09 -0800 Subject: [PATCH 15/17] Attempt to build petri net figures in docs --- docs/src/man/examples.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/src/man/examples.md b/docs/src/man/examples.md index d579e7b..869bf4b 100644 --- a/docs/src/man/examples.md +++ b/docs/src/man/examples.md @@ -4,15 +4,15 @@ The following examples illustrate BioSimulator.jl's interface and features. Each code block assumes BioSimulator.jl and Plots.jl are loaded; that is, `using BioSimulator, Plots`. ```@setup kendall -using BioSimulator, Plots +using BioSimulator, Plots, TikzPictures gr(fmt = :png, dpi = 300) ``` ```@setup mmek -using BioSimulator, Plots +using BioSimulator, Plots, TikzPictures gr(fmt = :png, dpi = 300) ``` ```@setup gene -using BioSimulator, Plots +using BioSimulator, Plots, TikzPictures gr(fmt = :png, dpi = 300) ``` ```@setup brusselator_cascade @@ -41,7 +41,7 @@ model <= Reaction("immigration", 0.5, "0 --> X") # Petri net; the "scale = 2" argument is optional and can be omitted # it is used to pass additional options for the underlying Tikz document fig = visualize(model, "scale = 2") -nothing #hide +TikzPictures.save(SVG("kendall_petri.svg"), fig) # hide ``` ![](kendall_petri.svg) @@ -88,7 +88,7 @@ model <= Reaction("Conversion", 0.1, "SE --> P + E") # Petri net fig = visualize(model) -nothing #hide +TikzPictures.save(SVG("mmek_petri.svg"), fig) # hide ``` ![](mmek_petri.svg) @@ -175,7 +175,7 @@ model = autoreg() # Petri net fig = visualize(model) -nothing # hide +TikzPictures.save(SVG("gene_petri.svg"), fig) # hide ``` ![](gene_petri.svg) From 153b3226ebdb5d2db9eee2200dba1859b6868b84 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 20 Jan 2019 02:42:04 -0800 Subject: [PATCH 16/17] Code coverage and docs --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b764b6..9a14a67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,8 +22,8 @@ notifications: # - julia -e 'Pkg.clone(pwd()); Pkg.build("Example"); Pkg.test("Example"; coverage=true)'; after_success: - - julia -e 'if VERSION >= v"0.7.0-" using Pkg end; cd(Pkg.dir("Example")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'; - - julia -e 'if VERSION >= v"0.7.0-" using Pkg end; cd(Pkg.dir("Example")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'; + - julia -e 'if VERSION >= v"0.7.0-" using Pkg end; cd(Pkg.dir("BioSimulator")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'; + - julia -e 'if VERSION >= v"0.7.0-" using Pkg end; cd(Pkg.dir("BioSimulator")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'; jobs: include: @@ -31,6 +31,7 @@ jobs: julia: 1.0 os: linux script: + - julia -e 'using Pkg; Pkg.add("Documenter"); Pkg.add("TikzPictures")' - julia --project=docs/ -e 'using Pkg; Pkg.instantiate(); Pkg.develop(PackageSpec(path=pwd()))' - julia --project=docs/ docs/make.jl From 3899ef7594ea3cd1fcda2a4b5417dbed25b0ca76 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 20 Jan 2019 03:14:39 -0800 Subject: [PATCH 17/17] Add Plots to setup --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9a14a67..a34ca1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ jobs: julia: 1.0 os: linux script: - - julia -e 'using Pkg; Pkg.add("Documenter"); Pkg.add("TikzPictures")' + - julia -e 'using Pkg; Pkg.add("Documenter"); Pkg.add("TikzPictures"); Pkg.add("Plots")' - julia --project=docs/ -e 'using Pkg; Pkg.instantiate(); Pkg.develop(PackageSpec(path=pwd()))' - julia --project=docs/ docs/make.jl