comparison data_manager/resource_building.py @ 40:fddf4a3847f4 draft

planemo upload commit 43e2a01d7519104c2c16510e4dbdc023e65c49c7-dirty
author dchristiany
date Tue, 29 Jan 2019 10:50:31 -0500
parents ec6252ad1a8e
children 4062484f2cee
comparison
equal deleted inserted replaced
39:ec6252ad1a8e 40:fddf4a3847f4
310 shutil.rmtree("tmp_BioGRID", ignore_errors=True) 310 shutil.rmtree("tmp_BioGRID", ignore_errors=True)
311 311
312 #download NCBI2Reactome.txt file and build dictionary 312 #download NCBI2Reactome.txt file and build dictionary
313 with requests.Session() as s: 313 with requests.Session() as s:
314 r = s.get('https://www.reactome.org/download/current/NCBI2Reactome.txt') 314 r = s.get('https://www.reactome.org/download/current/NCBI2Reactome.txt')
315 r.encoding = r.apparent_encoding 315 r.encoding ="utf-8"
316 tab_file = csv.reader(r.text.splitlines(), delimiter='\t') 316 tab_file = csv.reader(r.content.splitlines(), delimiter='\t')
317 317
318 dico_nodes = {} 318 dico_nodes = {}
319 uniProt_index=0 319 uniProt_index=0
320 pathway_description_index=3 320 pathway_description_index=3
321 species_index=5 321 species_index=5
354 else: 354 else:
355 dico_network["UniProt-AC"][line[2]].append([line[i] for i in network_uniprot_cols]) 355 dico_network["UniProt-AC"][line[2]].append([line[i] for i in network_uniprot_cols])
356 dico_GeneID_to_UniProt[line[0]]=line[2] 356 dico_GeneID_to_UniProt[line[0]]=line[2]
357 357
358 with requests.Session() as s: 358 with requests.Session() as s:
359 download = s.get('https://reactome.org/download/current/UniProt2Reactome.txt') 359 r = s.get('https://reactome.org/download/current/UniProt2Reactome.txt')
360 decoded_content = download.content.decode('utf-8') 360 r.encoding ="utf-8"
361 tab_file = csv.reader(decoded_content.splitlines(), delimiter='\t') 361 tab_file = csv.reader(r.content.splitlines(), delimiter='\t')
362 362
363 dico_nodes_uniprot = {} 363 dico_nodes_uniprot = {}
364 uniProt_index=0 364 uniProt_index=0
365 pathway_description_index=3 365 pathway_description_index=3
366 species_index=5 366 species_index=5
371 else : 371 else :
372 dico_nodes_uniprot[line[uniProt_index]] = [line[pathway_description_index]] 372 dico_nodes_uniprot[line[uniProt_index]] = [line[pathway_description_index]]
373 373
374 with requests.Session() as s: 374 with requests.Session() as s:
375 r = s.get('https://www.reactome.org/download/current/NCBI2Reactome.txt') 375 r = s.get('https://www.reactome.org/download/current/NCBI2Reactome.txt')
376 r.encoding = r.apparent_encoding 376 r.encoding ="utf-8"
377 tab_file = csv.reader(r.text.splitlines(), delimiter='\t') 377 tab_file = csv.reader(r.content.splitlines(), delimiter='\t')
378 378
379 dico_nodes_geneid = {} 379 dico_nodes_geneid = {}
380 uniProt_index=0 380 uniProt_index=0
381 pathway_description_index=3 381 pathway_description_index=3
382 species_index=5 382 species_index=5