Unverified Commit 253cef09 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil Committed by GitHub
Browse files

Merge pull request #555 from LCSB-BioCore/mk-clear-unions

clean up some leftover unions with Nothing
parents 17c91878 cc06a28a
Pipeline #51199 failed with stages
in 7 minutes and 53 seconds
"""
flux_balance_analysis_vec(args...)::Union{Vector{Float64},Nothing}
flux_balance_analysis_vec(args...)::Maybe{Vector{Float64}}
A variant of FBA that returns a vector of fluxes in the same order as reactions
of the model, if the solution is found.
......@@ -13,7 +13,7 @@ flux_balance_analysis_vec(args...; kwargs...)::Maybe{Vector{Float64}} =
flux_vector(flux_balance_analysis(args...; kwargs...))
"""
flux_balance_analysis_dict(model::MetabolicModel, args...)::Union{Dict{String, Float64},Nothing}
flux_balance_analysis_dict(model::MetabolicModel, args...)::Maybe{Dict{String, Float64}}
A variant of FBA that returns a dictionary assigning fluxes to reactions, if
the solution is found. Arguments are passed to [`flux_balance_analysis`](@ref).
......
......@@ -175,7 +175,7 @@ screen_variants(model, variants, analysis; workers = [myid()]) =
screen(model; variants = variants, analysis = analysis, workers = workers)
"""
screen_optimize_objective(_, optmodel)::Union{Float64,Nothing}
screen_optimize_objective(_, optmodel)::Maybe{Float64}
A variant of [`optimize_objective`](@ref) directly usable in
[`screen_optmodel_modifications`](@ref).
......
......@@ -4,8 +4,8 @@
Stores summary information about the result of a flux variability analysis.
"""
struct FluxVariabilitySummary
biomass_fluxes::Dict{String,Vector{Union{Float64,Nothing}}}
exchange_fluxes::Dict{String,Vector{Union{Float64,Nothing}}}
biomass_fluxes::Dict{String,Vector{Maybe{Float64}}}
exchange_fluxes::Dict{String,Vector{Maybe{Float64}}}
end
"""
......@@ -15,8 +15,8 @@ A default empty constructor for [`FluxVariabilitySummary`](@ref).
"""
function FluxVariabilitySummary()
FluxVariabilitySummary(
Dict{String,Vector{Union{Float64,Nothing}}}(),
Dict{String,Vector{Union{Float64,Nothing}}}(),
Dict{String,Vector{Maybe{Float64}}}(),
Dict{String,Vector{Maybe{Float64}}}(),
)
end
......@@ -84,14 +84,14 @@ function flux_variability_summary(
rxn_ids,
)
biomass_fluxes = Dict{String,Vector{Union{Float64,Nothing}}}()
biomass_fluxes = Dict{String,Vector{Maybe{Float64}}}()
for rxn_id in bmasses
lb = isnothing(flux_result[1][rxn_id]) ? nothing : flux_result[1][rxn_id][rxn_id]
ub = isnothing(flux_result[2][rxn_id]) ? nothing : flux_result[2][rxn_id][rxn_id]
biomass_fluxes[rxn_id] = [lb, ub]
end
ex_rxn_fluxes = Dict{String,Vector{Union{Float64,Nothing}}}()
ex_rxn_fluxes = Dict{String,Vector{Maybe{Float64}}}()
for rxn_id in ex_rxns
lb = isnothing(flux_result[1][rxn_id]) ? nothing : flux_result[1][rxn_id][rxn_id]
ub = isnothing(flux_result[2][rxn_id]) ? nothing : flux_result[2][rxn_id][rxn_id]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment