How to parse Hyphy JSON output into treedata?
I have two outputs from evolutionary software analysis I can upload to R studio: aPAML codeml .mlc file and a Hyphy aBSREL output in JSON format. I am currently using the treeio, jsonlite, tidyverse and data.table packages in R studio.
I would like to grab the omega values generated from the Hyphy.json file onto a tree containing all the information from the .mlc file using ggtree. I can grab the PAML tree and add the omega values from Hyphy, but I am stuck on how to parse out the Hyphy data into a format I can convert into tree data.
I've only gotten this far after reading both the manuals and looking online:
- I can open the file using jsonlite:
fromJSON(). It is a list of lists and I am grabbing the second item in the file
" branch attributes"The items in this list I want to grab are in another list with 10 items.
- I can transform this item into a data table but I am also wanting to figure out a way to iterate through uneven rows in these lists.
What I've tried and doesn't work/don't want
- Reading the output using
read.jplace()or other programs in treeio.
- I can pull out the individual omega values, create a new column in the treedata in PAML and map it out on ggtree. However, I would like a way to get all my data in as a tree so I can plot that as well.
Thanks for the help.
• 12 views