Skip to content

Instantly share code, notes, and snippets.

@vkkodali
Created January 9, 2019 22:32
Show Gist options
  • Save vkkodali/0e1ca52673fa5bdc4915035f0b85a3c8 to your computer and use it in GitHub Desktop.
Save vkkodali/0e1ca52673fa5bdc4915035f0b85a3c8 to your computer and use it in GitHub Desktop.
Script to parse MobiDB json file to generate a table
#! /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