Loading JSON serialised objects#

The load_json app loads JSON serialised cogent3 objects from a file, returning whatever was stored.

In the writing JSON section, we wrote a likelihood function object to disk in JSON serialised format, now let’s load it back! All we need is the path to which it was written. Since write_json writes to a data store, this will be <path_to_dstore>/<identifier>.

Tip

To follow along with this example, first head to the writing JSON section to write out this data, or replace the path with a JSON file on your machine.

from cogent3 import get_app

load_json_app = get_app("load_json")
lf = load_json_app(f"{path_to_dstore}/gn_params.json")
lf

GN

log-likelihood = -6987.9632

number of free parameters = 22

Global params
A>CA>GA>TC>AC>GC>TG>AG>CG>TT>A
0.86993.66400.91101.59072.12466.02418.22131.22950.62961.2502
continuation
T>C
3.4168
Edge params
edgeparentlength
Galagoroot0.1734
HowlerMonroot0.0450
Rhesusedge.30.0215
Orangutanedge.20.0078
Gorillaedge.10.0025
Humanedge.00.0061
Chimpanzeeedge.00.0028
edge.0edge.10.0000
edge.1edge.20.0033
edge.2edge.30.0121
edge.3root0.0077
Motif params
ACGT
0.37570.17420.20950.2406