Mercurial > repos > dchristiany > data_manager_proteore
comparison data_manager/resource_building.py @ 47:7b486b0fba4e draft
planemo upload commit cb633de1f04ef7b7133728909716b6c6594533d1-dirty
author | dchristiany |
---|---|
date | Fri, 01 Feb 2019 10:30:00 -0500 |
parents | 80fc0b28e227 |
children | 4b6c6f9b4de0 |
comparison
equal
deleted
inserted
replaced
46:80fc0b28e227 | 47:7b486b0fba4e |
---|---|
277 | 277 |
278 ####################################################################################################### | 278 ####################################################################################################### |
279 # 4. Build protein interaction maps files | 279 # 4. Build protein interaction maps files |
280 ####################################################################################################### | 280 ####################################################################################################### |
281 | 281 |
282 def get_interactant_name(line): | 282 def get_interactant_name(line,dico): |
283 | 283 |
284 if line[0] in dico_geneid_to_gene_name : | 284 if line[0] in dico : |
285 print line[0] | 285 interactant_A = dico[line[0]] |
286 interactant_A = dico_geneid_to_gene_name[line[0]] | |
287 else : | 286 else : |
288 interactant_A = "NA" | 287 interactant_A = "NA" |
289 | 288 |
290 if line[1] in dico_geneid_to_gene_name : | 289 if line[1] in dico : |
291 interactant_B = dico_geneid_to_gene_name[line[1]] | 290 interactant_B = dico[line[1]] |
292 else : | 291 else : |
293 interactant_B = "NA" | 292 interactant_B = "NA" |
294 | 293 |
295 return interactant_A, interactant_B | 294 return interactant_A, interactant_B |
296 | 295 |
424 r = r.content.decode('utf-8') | 423 r = r.content.decode('utf-8') |
425 humap_nodes = csv.reader(r.splitlines(), delimiter=',') | 424 humap_nodes = csv.reader(r.splitlines(), delimiter=',') |
426 | 425 |
427 dico_geneid_to_gene_name={} | 426 dico_geneid_to_gene_name={} |
428 for line in humap_nodes : | 427 for line in humap_nodes : |
429 if check_entrez_geneid(line[5]): | 428 if check_entrez_geneid(line[4]): |
430 if line[5] not in dico_geneid_to_gene_name: | 429 if line[4] not in dico_geneid_to_gene_name: |
431 dico_geneid_to_gene_name[line[5]]=[line[4]] | 430 dico_geneid_to_gene_name[line[4]]=line[3] |
432 else : | |
433 if line[4] not in dico_geneid_to_gene_name[line[5]] : | |
434 dico_geneid_to_gene_name[line[5]].append(line[4]) | |
435 | 431 |
436 with requests.Session() as s: | 432 with requests.Session() as s: |
437 r = s.get('http://proteincomplexes.org/static/downloads/pairsWprob.txt') | 433 r = s.get('http://proteincomplexes.org/static/downloads/pairsWprob.txt') |
438 r = r.content.decode('utf-8') | 434 r = r.content.decode('utf-8') |
439 humap = csv.reader(r.splitlines(), delimiter='\t') | 435 humap = csv.reader(r.splitlines(), delimiter='\t') |