tskit icon indicating copy to clipboard operation
tskit copied to clipboard

Method to convert all metadata to JSON

Open hyanwong opened this issue 3 years ago • 1 comments

See https://github.com/tskit-dev/tsinfer/discussions/629 for a use-case and https://github.com/tskit-dev/tsinfer/discussions/629#discussioncomment-2155840 for some code that I think does the trick, modulo top-level metadata.

There might be difficulty if there is stuff in a schema that can't be serialised into JSON. So perhaps this is a tricky thing that is only worth considering if other software developers hit the problem. I.e. if they want to create software (e.g. tsinfer.SampleData.from_tree_sequence) that takes an existing tree sequence produced by some other software that defines its own schema (e.g. SLiM) and return a modified tree sequence with some extra metadata added to it.

hyanwong avatar Feb 15 '22 11:02 hyanwong

Thanks @hyanwong, I've added this to the metadata project for when we design out the API.

benjeffery avatar Feb 15 '22 14:02 benjeffery