Created
January 9, 2019 22:32
-
-
Save vkkodali/0e1ca52673fa5bdc4915035f0b85a3c8 to your computer and use it in GitHub Desktop.
Script to parse MobiDB json file to generate a table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import sys | |
import gzip | |
import json | |
input_json = sys.argv[1] | |
with gzip.open(input_json, 'rt') as f: | |
for line in f: | |
d = json.loads(line.rstrip('\n')) | |
acc = d['acc'] | |
for i in d['mobidb_consensus']['disorder']['predictors']: | |
if 'regions' in i: | |
for j in i['regions']: | |
print(acc, *j, sep = '\t') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment