Commit 9fa8bf5e authored by David Hoksza's avatar David Hoksza
Browse files

fixing json decoder issues in progress

parent ba7ed61d
......@@ -26,7 +26,7 @@ def getfreqfromVEPbulck (listOfrsid):
headers={ "Content-Type" : "application/json", "Accept" : "application/json"}
strOfDataDictionary=json.dumps({"ids" : listOfrsid })
res = requests.post(server+ext, headers=headers, data=strOfDataDictionary)
decoded = res.json() # a python dictionary
decoded = json.loads(res.text)# a python dictionary
for elem in decoded:
rsid=elem["input"]
freq_dict={}
......@@ -46,7 +46,7 @@ def getfreqfromVEP (rsid):
if not r.ok:
r.raise_for_status()
sys.exit()
decoded = r.json()
decoded = json.loads(r.text)
for var in decoded[0]["colocated_variants"] :
if "frequencies" in var: freq_dict=var["frequencies"]
return freq_dict
......@@ -59,7 +59,7 @@ def main():
args = parser.parse_args()
with open(args.f) as myf:
allrsId = myf.read().split("\n")
allrsId = myf.read().split("\n")
#thislist=["rs12720452", "rs1060501130"]
maxNumbRsIdForRequest=200 # there is a limit in the VEP rest
while len(allrsId) > 0 :
......
Supports Markdown
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