LCSB-BioCore / COBREXA.jl

Constraint-Based Reconstruction and EXascale Analysis
https://lcsb-biocore.github.io/COBREXA.jl/
Apache License 2.0
43 stars 9 forks source link

further vastly simplify the printing of metabolic models and their contents #713

Closed exaexa closed 1 year ago

exaexa commented 1 year ago

...might be useful to add other stuff.

Merges into #698, let's merge right after.

exaexa commented 1 year ago

anyway it looks like this:

julia> using COBREXA; m = COBREXA.IO.load_model(COBREXA.Types.ObjectModel, "work/COBREXA.jl/test/downloaded/e_coli_core.xml")
COBREXA.Types.ObjectModel(#= 95 reactions, 72 metabolites =#)

julia> m.reactions
OrderedCollections.OrderedDict{String, COBREXA.Types.Reaction} with 95 entries:
  "R_EX_fum_e"    => Reaction(id="R_EX_fum_e", name="Fumarate exchange", metabolites=Dict("M_fum_e"=>-1.…
  "R_ACONTb"      => Reaction(id="R_ACONTb", name="Aconitase (half-reaction B, Isocitrate hydro-lyase)",…
  "R_TPI"         => Reaction(id="R_TPI", name="Triose-phosphate isomerase", metabolites=Dict("M_dhap_c"…
  "R_SUCOAS"      => Reaction(id="R_SUCOAS", name="Succinyl-CoA synthetase (ADP-forming)", metabolites=D…
  "R_GLNS"        => Reaction(id="R_GLNS", name="Glutamine synthetase", metabolites=Dict("M_gln__L_c"=>1…
  "R_EX_pi_e"     => Reaction(id="R_EX_pi_e", name="Phosphate exchange", metabolites=Dict("M_pi_e"=>-1.0…
  "R_PPC"         => Reaction(id="R_PPC", name="Phosphoenolpyruvate carboxylase", metabolites=Dict("M_co…
  "R_O2t"         => Reaction(id="R_O2t", name="O2 transport  diffusion ", metabolites=Dict("M_o2_e"=>-1…
  "R_G6PDH2r"     => Reaction(id="R_G6PDH2r", name="Glucose 6-phosphate dehydrogenase", metabolites=Dict…
  "R_TALA"        => Reaction(id="R_TALA", name="Transaldolase", metabolites=Dict("M_e4p_c"=>1.0, "M_g3p…
  ⋮               => ⋮

julia> m.reactions["R_ADK1"]
COBREXA.Types.Reaction(
 id = "R_ADK1",
 name = "Adenylate kinase",
 metabolites = Dict("M_amp_c"=>-1.0, "M_atp_c"=>-1.0, "M_adp_c"=>2.0),
 lower_bound = -1000.0,
 upper_bound = 1000.0,
 gene_associations = COBREXA.Types.Isozyme[Isozyme(stoichiometry=Dict("G_b0474"=>1.0), annotation=Dict{String, Vector{String}}(), kcat_forward=nothing, kcat_backward=nothing)],
 subsystem = nothing,
 notes = Dict{String, Vector{String}}(),
 annotations = Dict("ec-code"=>["2.7.4.3"], "sabiork"=>["82"], "sbo"=>["SBO:0000176"], "metanetx.reaction"=>["MNXR95450"], "rhea"=>["12975", "12973", "12976", "12974"], "seed.reaction"=>["rxn00097"], "kegg.reaction"=>["R00127"], "biocyc"=>["META:ADENYL-KIN-RXN"], "reactome.reaction"=>["R-ATH-110145", "R-SSC-110144", "R-ATH-110144", "R-SSC-110145", "R-GGA-110145", "R-PFA-110144", "R-HSA-110145", "R-RNO-110144", "R-OSA-110145", "R-SCE-110145"  …  "R-DDI-110145", "R-GGA-110144", "R-TGU-110144", "R-BTA-110145", "R-CEL-110145", "R-CFA-110145", "R-DME-110145", "R-TGU-110145", "R-DDI-110144", "R-MMU-110145"], "bigg.reaction"=>["ADK1"]…),
)

and a nice reference for the future of prettyprinting: https://github.com/JuliaLang/julia/issues/40030

exaexa commented 1 year ago

I'll merge this to save time, because tests are okay locally and gitlab is suffering some kind of existential problem and the other PR is gonna need to pass them again anyway.