Commit c0db9a40 authored by lmueller's avatar lmueller
Browse files

adapted resolve_dbxrefs.py to input format

parent 9d4265ae
......@@ -7,7 +7,7 @@ import sys
parser = argparse.ArgumentParser(description='Resolve dbxrefs from json file')
parser.add_argument('--input', '-i', required=True, help='The json input document')
parser.add_argument('--retriever', '-s', required=True, help='Location of retriever')
parser.add_argument('--output', '-o', required=True, help='Name of the output document')
#parser.add_argument('--output', '-o', required=True, help='Name of the output document')
args = parser.parse_args()
basename = args.retriever.replace('scripts/', '')
......@@ -18,13 +18,16 @@ from retriever import retrieve
json_file = open(args.input).read()
j = json.loads(json_file)
di = []
#di = []
for c in j['computations']:
for r in c['results']:
di = retrieve(r['informations'], basename)
output_filename = args.output
with open(output_filename, 'w') as o:
json.dump(di, o)
if 'target'in r and 'dbxref' in r['target']:
di = retrieve([r['target']['dbxref']], basename)
r['target']['dbxref'] = {'dbxref': r['target']['dbxref'], 'informations': di[0]}
#output_filename = args.output
#with open(output_filename, 'w') as o:
with open(args.input, 'w') as o:
json.dump(j, o)
......@@ -9,21 +9,186 @@
},
"results" : [
{
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"informations" : [
"UniProtKB/Swiss-Prot:Q5XI95",
"UniProtKB/Swiss-Prot:Q70UN9",
"GO:0008270",
"GO:0004024",
"GO:0004930",
"EC:1.1.1.1",
"EC:2.2.1.1",
"PFAM:PF00002",
"PFAM:PF08240",
"SO:0000022",
"SO:0000714"
]
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "UniProtKB/Swiss-Prot:Q5XI95"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "UniProtKB/Swiss-Prot:Q70UN9"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "GO:0008270"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "GO:0004024"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "GO:0004930"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "EC:1.1.1.1"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "EC:2.2.1.1"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "PFAM:PF00002"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "PFAM:PF08240"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "SO:0000022"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "SO:0000714"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "GO:0005737"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "GO:0004022"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "GO:0008270"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "Pfam:PF08240"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "SO:0000380"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "SO:0000026"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "SO:0000020"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "UniProtKB/Swiss-Prot:P09370"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "UniProtKB/Swiss-Prot:P22246"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "UniProtKB/Swiss-Prot:P08843"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "GO:001"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "EC:2.1"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "Pfam:PF040"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "SO:020"
}
},
{
"target" : {
"score" : "42",
"alignment" : "|||||||||||||||||||||||||||",
"dbxref" : "UniProtKB/Swiss-Prot:P09"
}
}
]
}
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment