gemini icon indicating copy to clipboard operation
gemini copied to clipboard

JSON output for inheritance tools

Open komalsrathi opened this issue 8 years ago • 3 comments

Hi,

I was wondering if there is a way where I can get the results from comp_hets, de_novo, autosomal_recessive etc as a JSON object? I tried using --format json and --json but they don't work. It would be really helpful if that feature is implemented (if not already). I am trying to get all my output in JSON format and import in datatables.

komalsrathi avatar Jun 23 '16 20:06 komalsrathi

This isn't available right now, but you could easily do this with a small script like the one below and use as:

gemini de_novo ... | tsv2json.py 

you could also read into pandas and then use to_json to get the correct types.

import sys
import json

header = next(sys.stdin).strip().split("\t")

a = []
for toks in (x.strip().split("\t") for x in sys.stdin):
    a.append(dict(zip(header, toks)))

print json.dumps(a)

brentp avatar Jun 23 '16 20:06 brentp

Thanks! Do you have plans to implement this feature in the future versions?

komalsrathi avatar Jun 23 '16 20:06 komalsrathi

not specifically, but we can leave this issue open as a reminder.

brentp avatar Jun 23 '16 20:06 brentp