-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathGeneSetDownloader.py
executable file
·1246 lines (1121 loc) · 61.7 KB
/
GeneSetDownloader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###MetabolomicsParser
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - [email protected]
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is furnished
#to do so, subject to the following conditions:
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
#INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
#PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
#HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
#OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
#SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""This module contains methods for reading the HMDB and storing relationships"""
import sys, string
import os.path
import unique
import export
import time
import update; reload(update)
import OBO_import
import gene_associations
import traceback
############# Common file handling routines #############
def filepath(filename):
fn = unique.filepath(filename)
return fn
def read_directory(sub_dir):
dir_list = unique.read_directory(sub_dir); dir_list2 = []
###Code to prevent folder names from being included
for entry in dir_list:
if entry[-4:] == ".txt" or entry[-4:] == ".csv": dir_list2.append(entry)
return dir_list2
def cleanUpLine(line):
line = string.replace(line,'\n','')
line = string.replace(line,'\c','')
data = string.replace(line,'\r','')
data = string.replace(data,'"','')
return data
def lowerSymbolDB(source_to_gene):
source_to_gene2={}
for symbol in source_to_gene:
source_to_gene2[string.lower(symbol)]=source_to_gene[symbol]
return source_to_gene2
def verifyFile(filename):
fn=filepath(filename); file_found = 'yes'
try:
for line in open(fn,'rU').xreadlines():break
except Exception: file_found = 'no'
return file_found
def importSpeciesData():
if program_type == 'GO-Elite': filename = 'Config/species_all.txt' ### species.txt can be cleared during updating
else: filename = 'Config/goelite_species.txt'
x=0
fn=filepath(filename);global species_list; species_list=[]; global species_codes; species_codes={}
global species_names; species_names={}
global species_taxids; species_taxids={}
for line in open(fn,'rU').readlines():
data = cleanUpLine(line)
t = string.split(data,'\t'); abrev=t[0]; species=t[1]
try: taxid = t[2]
except Exception: taxid = None
if x==0: x=1
else:
species_list.append(species)
species_codes[species] = abrev
species_names[abrev] = species
species_taxids[abrev] = taxid
def getSourceData():
filename = 'Config/source_data.txt'; x=0
fn=filepath(filename)
global source_types; source_types={}
global system_codes; system_codes={}
global mod_types; mod_types=[]
for line in open(fn,'rU').readlines():
data = cleanUpLine(line)
t = string.split(data,'\t'); source=t[0]
try: system_code=t[1]
except IndexError: system_code = 'NuLL'
if x==0: x=1
else:
if len(t)>2: ### Therefore, this ID system is a potential MOD
if t[2] == 'MOD': mod_types.append(source)
source_types[source]=system_code
system_codes[system_code] = source ###Used when users include system code data in their input file
############# File download/extraction #############
def downloadPAZARAssocations():
url = 'http://www.pazar.info/tftargets/tftargets.zip'
print 'Downloading Transcription Factor to Target associations'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/tftargets/','')
return 'raw'
def downloadPAZARAssocationsOld():
""" This works fine, but is redundant with the new zip file that contains all files"""
base_url = 'http://www.pazar.info/tftargets/'
filenames = getPAZARFileNames()
print 'Downloading Transcription Factor to Target associations'
source = 'raw'
r = 4; k = -1
for resource in filenames:
filename = filenames[resource]
url = base_url+filename
start_time = time.time()
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/tftargets/','')
end_time = time.time()
if (end_time-start_time)>3: ### Hence the internet connection is very slow (will take forever to get everything)
downloadPreCompiledPAZAR() ### Just get the compiled symbol data instead
print '...access to source PAZAR files too slow, getting pre-compiled from genmapp.org'
source = 'precompiled'
break
k+=1
if r==k:
k=0
print '*',
print ''
return source
def downloadPreCompiledPAZAR():
""" Downloads the already merged symbol to TF file from PAZAR files """
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/tf-target.txt'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/tftargets/symbol/','')
def downloadAmadeusPredictions():
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/symbol-Metazoan-Amadeus.txt'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/Amadeus/','')
def downloadBioMarkers(output_dir):
ensembl_version = unique.getCurrentGeneDatabaseVersion()
#url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/Hs_exon_tissue-specific_protein_coding.zip'
url = 'http://altanalyze.org/archiveDBs/AltDatabase/updated/'+ensembl_version+'/Hs_LineageProfiler.zip'
print 'Downloading BioMarker associations'
fln,status = update.downloadSuppressPrintOuts(url,output_dir,'')
#url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/Mm_gene_tissue-specific_protein_coding.zip'
url = 'http://altanalyze.org/archiveDBs/AltDatabase/updated/'+ensembl_version+'/Mm_LineageProfiler.zip'
fln,status = update.downloadSuppressPrintOuts(url,output_dir,'')
def downloadKEGGPathways(species):
print "Integrating KEGG associations for "+species
url = 'http://www.genmapp.org/go_elite/Databases/KEGG/'+species+'-KEGG_20110518.zip'
### This is a fixed date resource since KEGG licensed their material after this date
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/KEGG/','')
def downloadDomainAssociations(selected_species):
paths=[]
if selected_species != None: ### Restrict to selected species only
current_species_dirs=selected_species
else:
current_species_dirs = unique.read_directory('/'+database_dir)
for species in current_species_dirs:
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/Domains/'+species+'_Ensembl-Domain.gz'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/Domains/','txt')
if 'Internet' not in status:
paths.append((species,fln))
return paths
def downloadPhenotypeOntologyOBO():
print 'Downloading Phenotype Ontology structure and associations'
url = 'ftp://ftp.informatics.jax.org/pub/reports/MPheno_OBO.ontology'
fln,status = update.downloadSuppressPrintOuts(url,program_dir+'OBO/','')
def downloadPhenotypeOntologyGeneAssociations():
url = 'ftp://ftp.informatics.jax.org/pub/reports/HMD_HumanPhenotype.rpt'
#url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/HMD_HumanPhenotype.rpt'
### Mouse and human gene symbols and gene IDs (use the gene symbols)
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/Pheno/','')
def downloadBioGRIDAssociations():
print 'Downloading BioGRID associations'
url = 'http://thebiogrid.org/downloads/archives/Latest%20Release/BIOGRID-ALL-LATEST.tab2.zip'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/BioGRID/','')
def downloadDrugBankAssociations():
print 'Downloading DrugBank associations'
url = 'http://www.drugbank.ca/system/downloads/current/drugbank.txt.zip'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/DrugBank/','')
def downloadPathwayCommons():
print 'Downloading PathwayCommons associations'
url = 'http://www.pathwaycommons.org/pc-snapshot/current-release/gsea/by_species/homo-sapiens-9606-gene-symbol.gmt.zip'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/PathwayCommons/','')
def downloadDiseaseOntologyOBO():
print 'Downloading Disease Ontology structure and associations'
""" Unfortunately, we have to download versions that are not as frequently updated, since RGDs server
reliability is poor """
#url = 'ftp://rgd.mcw.edu/pub/data_release/ontology_obo_files/disease/CTD.obo'
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/CTD.obo'
### Includes congenital and environmental diseases - http://ctdbase.org/detail.go?type=disease&acc=MESH%3aD002318
fln,status = update.downloadSuppressPrintOuts(url,program_dir+'OBO/','')
def downloadDiseaseOntologyGeneAssociations(selected_species):
if selected_species == None: sc = []
else: sc = selected_species
""" Unfortunately, we have to download versions that are not as frequently updated, since RGDs server
reliability is poor """
if 'Hs' in sc or len(sc)==0:
#url = 'ftp://rgd.mcw.edu/pub/data_release/annotated_rgd_objects_by_ontology/homo_genes_do'
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/homo_genes_do'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/Disease/','')
if 'Mm' in sc or len(sc)==0:
#url = 'ftp://rgd.mcw.edu/pub/data_release/annotated_rgd_objects_by_ontology/mus_genes_do'
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/mus_genes_do'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/Disease/','')
if 'Rn' in sc or len(sc)==0:
#url = 'ftp://rgd.mcw.edu/pub/data_release/annotated_rgd_objects_by_ontology/rattus_genes_do'
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/rattus_genes_do'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/Disease/','')
def downloadMiRDatabases(species):
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/'+species+'_microRNA-Ensembl-GOElite_strict.txt'
selected = ['Hs','Mm','Rn'] ### these are simply zipped where the others are not
### These files should be updated on a regular basis
if species in selected:
url = string.replace(url,'.txt','.zip')
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/microRNATargets/','')
else:
### Where strict is too strict
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/'+species+'_microRNA-Ensembl-GOElite_lax.txt'
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/microRNATargets/','')
fln = string.replace(fln,'.zip','.txt')
return fln
def downloadRvistaDatabases(species):
### Source files from http://hazelton.lbl.gov/pub/poliakov/wgrvista_paper/
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/'+species+'_RVista_factors.zip'
### These files should be updated on a regular basis
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/RVista/','')
fln = string.replace(fln,'.zip','.txt')
return fln
def remoteDownloadEnsemblTranscriptAssocations(species):
global program_dir
program_type,database_dir = unique.whatProgramIsThis()
if program_type == 'AltAnalyze':
program_dir = database_dir
downloadEnsemblTranscriptAssociations(species)
def downloadEnsemblTranscriptAssociations(species):
url = 'http://www.genmapp.org/go_elite/Databases/ExternalSystems/Transcripts/'+species+'/Ensembl-EnsTranscript.txt'
### These files should be updated on a regular basis
fln,status = update.downloadSuppressPrintOuts(url,program_dir+species+'/uid-gene/','')
def downloadGOSlimOBO():
url = 'http://geneontology.org/ontology/subsets/goslim_pir.obo'
#url = 'http://www.geneontology.org/GO_slims/goslim_generic.obo' ### Missing
fln,status = update.downloadSuppressPrintOuts(url,database_dir+'OBO/','')
def importUniProtAnnotations(species_db,force):
base_url = 'http://www.altanalyze.org/archiveDBs/'
uniprot_ensembl_db={}
for species in species_db:
url = base_url+species+'/custom_annotations.txt'
if force=='yes':
fln,status = update.downloadSuppressPrintOuts(url,'BuildDBs/UniProt/'+species+'/','')
else:
fln = 'BuildDBs/UniProt/'+species+'/custom_annotations.txt'
for line in open(fln,'rU').xreadlines():
data = cleanUpLine(line)
try:
ens_gene,compartment,function,symbols,full_name,uniprot_name,uniprot_ids,unigene = string.split(data,'\t')
symbols = string.split(string.replace(symbols,'; Synonyms=',', '),', ')
uniprot_ensembl_db[species,uniprot_name] = ens_gene
species_extension = string.split(uniprot_name,'_')[-1]
full_name = string.split(full_name,';')[0]
if 'Transcription factor' in full_name:
symbols.append(string.split(full_name,'Transcription factor ')[-1]) ### Add this additional synonym to symbols
### Extend this database out to account for weird names in PAZAR
for symbol in symbols:
new_name = string.upper(symbol)+'_'+species_extension
if new_name not in uniprot_ensembl_db:
uniprot_ensembl_db[species,symbol+'_'+species_extension] = ens_gene
uniprot_ensembl_db[species,string.upper(symbol)] = ens_gene
except Exception:
None
return uniprot_ensembl_db
############# Import/processing/export #############
def getPAZARFileNames():
""" Filenames are manually and periodically downloaded from: http://www.pazar.info/cgi-bin/downloads_csv.pl"""
fn = filepath('Config/PAZAR_list.txt')
x=0
filenames = {}
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
if x==0: x=1
else:
resource, filename = string.split(data,'\t')
filenames[resource]=filename
return filenames
class TFTargetInfo:
def __init__(self,tf_name,ens_gene,project,pmid,analysis_method):
self.tf_name=tf_name
self.ens_gene=ens_gene
self.project=project
self.pmid=pmid
self.analysis_method=analysis_method
def TFName(self): return self.tf_name
def Ensembl(self): return self.ens_gene
def Project(self):
if self.project[-1]=='_':
return self.project[:-1]
else:
return self.project
def PMID(self): return self.pmid
def AnalysisMethod(self): return self.analysis_method
def __repr__(self): return self.TFName()
def importPAZARAssociations(force):
pazar_files = unique.read_directory('/BuildDBs/tftargets')
species_db={}
tf_to_target={}
tf_name_to_ID_db={}
for file in pazar_files:
if '.csv' in file:
name = string.join(string.split(file,'_')[1:-1],'_')
fn = filepath('BuildDBs/tftargets/'+file)
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
try:
### Each line contains the following 11 tab-delim fields:
### Fields are: <PAZAR TF ID> <TF Name> <PAZAR Gene ID> <ensembl gene accession> <chromosome> <gene start coordinate> <gene end coordinate> <species> <project name> <PMID> <analysis method>
pazar_tf_id, ens_tf_transcript, tf_name, pazar_geneid, ens_gene, chr, gene_start,gene_end,species,project,pmid,analysis_method = string.split(data,'\t')
if ens_tf_transcript == 'ENSMUST00000105345' and 'Pluripotency' in project:
### This is a specific error (TCF3 corresponds to TCF7L1 but poor nomenclature resulted in a mis-annotation here)
ens_tf_transcript = 'ENSMUST00000069536'
species,genus = string.split(species,' ')
species = species[0]+genus[0]
tft=TFTargetInfo(tf_name,ens_gene,project,pmid,analysis_method)
try: tf_to_target[species,tf_name].append(tft)
except Exception: tf_to_target[species,tf_name] = [tft]
species_db[species]=[]
tf_name_to_ID_db[tf_name] = ens_tf_transcript ### This is an Ensembl transcript ID -> convert to gene ID
except Exception:
None ### Occurs due to file formatting issues (during an update?)
if determine_tf_geneids == 'yes':
""" The below code is probably most useful for creation of complex regulatory inference networks in Cytoscape """
uniprot_ensembl_db = importUniProtAnnotations(species_db,force) ### Get UniProt IDs that often match Pazar TF names
transcript_to_gene_db={}
gene_to_symbol_db={}
#species_db={}
#species_db['Mm']=[]
for species in species_db:
try:
try: gene_to_transcript_db = gene_associations.getGeneToUid(species,('hide','Ensembl-EnsTranscript')); #print mod_source, 'relationships imported.'
except Exception:
try:
downloadEnsemblTranscriptAssociations(species)
gene_to_transcript_db = gene_associations.getGeneToUid(species,('hide','Ensembl-EnsTranscript'))
except Exception: gene_to_transcript_db={}
try: gene_to_symbol = gene_associations.getGeneToUid(species,('hide','Ensembl-Symbol'))
except Exception:
### Download this
base_url = 'http://www.altanalyze.org/archiveDBs/'
url = base_url+species+'/Ensembl-Symbol.txt'
update.downloadSuppressPrintOuts(url,'AltDatabase/goelite/'+species+'/uid-gene/','')
gene_to_symbol = gene_associations.getGeneToUid(species,('hide','Ensembl-Symbol'))
except Exception: gene_to_transcript_db={}; gene_to_symbol={}
#print len(gene_to_transcript_db), species
for gene in gene_to_transcript_db:
for transcript in gene_to_transcript_db[gene]:
transcript_to_gene_db[transcript]=gene
for gene in gene_to_symbol:
gene_to_symbol_db[gene] = gene_to_symbol[gene]
missing=[]
for (species,tf_name) in tf_to_target:
original_tf_name = tf_name
try:
ens_tf_transcript = tf_name_to_ID_db[tf_name]
ens_gene = transcript_to_gene_db[ens_tf_transcript]
#if 'ENSMUST00000025271' == ens_tf_transcript: print ens_gene;kill
#print gene_to_symbol_db[ens_gene];sys.exit()
symbol = string.lower(gene_to_symbol_db[ens_gene][0]) ### covert gene ID to lower case symbol ID
### Store the original TF name and Ensembl symbol (different species TFs can have different symbols - store all)
try: tf_to_target_symbol[original_tf_name].append(symbol)
except Exception: tf_to_target_symbol[original_tf_name] = [symbol]
except Exception:
try:
#ens_tf_transcript = tf_name_to_ID_db[tf_name]
#print species, tf_name, ens_tf_transcript;sys.exit()
ens_gene = uniprot_ensembl_db[species,tf_name]
symbol = string.lower(gene_to_symbol_db[ens_gene][0]) ### covert gene ID to lower case symbol ID
try: tf_to_target_symbol[original_tf_name].append(symbol)
except Exception: tf_to_target_symbol[original_tf_name] = [symbol]
except Exception:
try:
tf_name = string.split(tf_name,'_')[0]
ens_gene = uniprot_ensembl_db[species,tf_name]
symbol = string.lower(gene_to_symbol_db[ens_gene][0]) ### covert gene ID to lower case symbol ID
try: tf_to_target_symbol[original_tf_name].append(symbol)
except Exception: tf_to_target_symbol[original_tf_name] = [symbol]
except Exception:
try:
tf_names=[]
if '/' in tf_name:
tf_names = string.split(tf_name,'/')
elif ' ' in tf_name:
tf_names = string.split(tf_name,' ')
for tf_name in tf_names:
ens_gene = uniprot_ensembl_db[species,tf_name]
symbol = string.lower(gene_to_symbol_db[ens_gene][0]) ### covert gene ID to lower case symbol ID
try: tf_to_target_symbol[original_tf_name].append(symbol)
except Exception: tf_to_target_symbol[original_tf_name] = [symbol]
except Exception: missing.append((tf_name,species))
print 'Ensembl IDs found for transcript or UniProt Transcription factor names:',len(tf_to_target_symbol),'and missing:', len(missing)
#print missing[:20]
### Translate all species data to gene symbol to export for all species
species_tf_targets={}
for (species,tf_name) in tf_to_target:
try:
tf_db = species_tf_targets[species]
tf_db[tf_name] = tf_to_target[species,tf_name]
except Exception:
tf_db = {}
tf_db[tf_name] = tf_to_target[species,tf_name]
species_tf_targets[species] = tf_db
tf_dir = 'BuildDBs/tftargets/symbol/tf-target.txt'
tf_data = export.ExportFile(tf_dir)
tf_to_symbol={}
#print 'Exporting:',tf_dir
#print len(species_tf_targets)
for species in species_tf_targets:
try: gene_to_source_id = gene_associations.getGeneToUid(species,('hide','Ensembl-Symbol'))
except Exception: gene_to_source_id={}
tf_db = species_tf_targets[species]
for tf_name in tf_db:
for tft in tf_db[tf_name]:
try:
for symbol in gene_to_source_id[tft.Ensembl()]:
symbol = string.lower(symbol)
tf_id = tf_name+'(Source:'+tft.Project()+'-PAZAR'+')'
tf_data.write(tf_id+'\t'+symbol+'\n')
try: tf_to_symbol[tf_id].append(symbol)
except Exception: tf_to_symbol[tf_id] = [symbol]
except Exception: null=[];
tf_data.close()
tf_to_symbol = gene_associations.eliminate_redundant_dict_values(tf_to_symbol)
return tf_to_symbol
def importPAZARcompiled():
""" Skips over the above function when these tf-target file is downlaoded directly """
tf_dir = 'BuildDBs/tftargets/symbol/tf-target.txt'
tf_to_symbol={}
fn = filepath(tf_dir)
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
tf_id,symbol = string.split(data,'\t')
try: tf_to_symbol[tf_id].append(symbol)
except Exception: tf_to_symbol[tf_id] = [symbol]
tf_to_symbol = gene_associations.eliminate_redundant_dict_values(tf_to_symbol)
return tf_to_symbol
def importPhenotypeOntologyGeneAssociations():
x=0
pheno_symbol={}; phen=[]
fn = filepath('BuildDBs/Pheno/HMD_HumanPhenotype.rpt')
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
t = string.split(data,'\t')
hs_symbol=t[0]; hs_entrez=t[1]; mm_symbol=t[2]; mgi=t[3]; pheno_ids=t[4]
if 'MP' not in pheno_ids:
try: mm_symbol=t[3]; mgi=t[4]; pheno_ids=t[5]
except Exception: pass
hs_symbol = string.lower(hs_symbol)
mm_symbol = string.lower(mm_symbol)
symbols = [mm_symbol,hs_symbol]
pheno_ids = string.split(pheno_ids,' '); phen+=pheno_ids
for pheno_id in pheno_ids:
if len(pheno_id)>0:
for symbol in symbols:
try: pheno_symbol[pheno_id].append(symbol)
except Exception: pheno_symbol[pheno_id]=[symbol]
phen = unique.unique(phen)
pheno_symbol = gene_associations.eliminate_redundant_dict_values(pheno_symbol)
return pheno_symbol
def importAmandeusPredictions(force):
if force == 'yes':
downloadAmadeusPredictions()
x=0
tf_symbol_db={}
fn = filepath('BuildDBs/Amadeus/symbol-Metazoan-Amadeus.txt')
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
if x==0: x=1
else:
symbol,system,tf_name = string.split(data,'\t')
symbol = string.lower(symbol)
if tf_name == 'Oct4': tf_name = 'Pou5f1' ### Known annotation issue
try: tf_symbol_db[tf_name].append(symbol)
except Exception: tf_symbol_db[tf_name]=[symbol]
tf_symbol_db = gene_associations.eliminate_redundant_dict_values(tf_symbol_db)
if determine_tf_geneids == 'yes':
""" ### Since this data is species independent (not indicated in the current file) can't apply this yet
uniprot_ensembl_db = importUniProtAnnotations(species_db,force)
try: gene_to_symbol = gene_associations.getGeneToUid(species,('hide','Ensembl-Symbol'))
except Exception: gene_to_symbol={}
symbol_to_gene = OBO_import.swapKeyValues(gene_to_symbol)
symbol_to_gene = lowerSymbolDB(symbol_to_gene)
uniprot_ensembl_db = lowerSymbolDB(uniprot_ensembl_db)
"""
### Build a TFname to Ensembl gene symbol database for Amadeus
for tf_name in tf_symbol_db:
symbol = string.lower(string.split(tf_name,'(')[0])
if 'miR' not in tf_name and 'let' not in tf_name: ### Exlude miRNAs
try: tf_to_target_symbol[tf_name].append(symbol)
except Exception: tf_to_target_symbol[tf_name] = [symbol]
return tf_symbol_db
def importDiseaseOntologyGeneAssocations():
disease_ontology_files = unique.read_directory('/BuildDBs/Disease')
symbol_to_DO={}
for file in disease_ontology_files:
if '_do' in file:
fn = filepath('BuildDBs/Disease/'+file)
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
t = string.split(data,'\t')
if len(t)>1:
symbol=string.lower(t[2]); doid = t[4]
try: symbol_to_DO[doid].append(symbol)
except Exception: symbol_to_DO[doid]=[symbol]
return symbol_to_DO
def exportSymbolRelationships(pathway_to_symbol,selected_species,pathway_type,type):
if selected_species != None: ### Restrict to selected species only
current_species_dirs=selected_species
else:
current_species_dirs = unique.read_directory('/'+database_dir)
for species in current_species_dirs:
if '.' not in species:
ens_dir = database_dir+'/'+species+'/gene-'+type+'/Ensembl-'+pathway_type+'.txt'
ens_data = export.ExportFile(ens_dir)
try:
if determine_tf_geneids == 'yes':
### When TF data is exported and TF gene-gene interactions are defined, export them
tf_network_dir = 'BuildDBs/TF_Interactions/'+species+'/interactions.txt'
tf_network_data = export.ExportFile(tf_network_dir)
tf_network_data.write('Symbol1\tInteractionType\tSymbol2\tGeneID1\tGeneID2\tSource\n')
interaction = 'transcriptional_target'
print 'Exporting TF-Target gene-gene relationships to',tf_network_dir
tf_count=0; unique_interactions={}
try:
gene_chr_db = gene_associations.getGeneToUid(species,('hide','Ensembl-chr'))
except Exception:
try:
ensembl_version = unique.getCurrentGeneDatabaseVersion()
import EnsemblSQL
EnsemblSQL.getChrGeneOnly(species,'Basic',ensembl_version,'yes')
gene_chr_db = gene_associations.getGeneToUid(species,('hide','Ensembl-chr'))
except Exception: gene_chr_db={}
except Exception: None
if 'mapp' in type: ens_data.write('GeneID\tSystem\tGeneSet\n')
else: ens_data.write('GeneID\tGeneSet\n')
try: ens_to_entrez = gene_associations.getGeneToUid(species,('hide','Ensembl-EntrezGene'))
except Exception: ens_to_entrez ={}
if len(ens_to_entrez)>0:
entrez_dir = database_dir+'/'+species+'/gene-'+type+'/EntrezGene-'+pathway_type+'.txt'
entrez_data = export.ExportFile(entrez_dir)
if 'mapp' in type: entrez_data.write('GeneID\tSystem\tGeneSet\n')
else: entrez_data.write('GeneID\tGeneSet\n')
#print 'Exporting '+pathway_type+' databases for:',species
try: gene_to_source_id = gene_associations.getGeneToUid(species,('hide','Ensembl-Symbol'))
except Exception: gene_to_source_id={}
source_to_gene = OBO_import.swapKeyValues(gene_to_source_id)
source_to_gene = lowerSymbolDB(source_to_gene)
for pathway in pathway_to_symbol:
for symbol in pathway_to_symbol[pathway]:
try:
genes = source_to_gene[symbol]
for gene in genes:
if len(genes)<5: ### don't propagate redundant associations
if 'mapp' in type: ens_data.write(gene+'\tEn\t'+pathway+'\n')
else: ens_data.write(gene+'\t'+pathway+'\n')
if gene in ens_to_entrez:
for entrez in ens_to_entrez[gene]:
if 'mapp' in type: entrez_data.write(entrez+'\tL\t'+pathway+'\n')
else: entrez_data.write(entrez+'\t'+pathway+'\n')
try:
if determine_tf_geneids == 'yes':
if '(' in pathway:
source_name = string.split(pathway,'(')[0]
else:
source_name = pathway
proceed = True
if gene in gene_chr_db:
if len(gene_chr_db[gene][0])>2: ### not a valid chromosome (e.g., HSCHR6_MHC_COX)
proceed = False
if proceed ==True or proceed == False:
try: symbols = tf_to_target_symbol[source_name]
except Exception: symbols = tf_to_target_symbol[pathway]
for symbol in symbols:
tf_gene = source_to_gene[symbol][0] ### meta-species converted symbol -> species Ensembl gene
tf_symbol = gene_to_source_id[tf_gene][0] ### species formatted symbol for TF
symbol = gene_to_source_id[gene][0] ### species formatted symbol for target
if (tf_symbol,symbol,pathway) not in unique_interactions:
tf_network_data.write(string.join([tf_symbol,interaction,symbol,tf_gene,gene,pathway],'\t')+'\n')
unique_interactions[tf_symbol,symbol,pathway]=[]
try: merged_tf_interactions[tf_symbol].append(string.lower(symbol))
except Exception: merged_tf_interactions[tf_symbol] = [string.lower(symbol)]
tf_count+=1
except Exception: None
except Exception: null=[]
ens_data.close()
try: entrez_data.close()
except Exception: null=[]
try:
if determine_tf_geneids == 'yes':
tf_network_data.close()
print tf_count,'TF to target interactions exported..'
except Exception: None
def translateBioMarkersBetweenSpecies(input_dir,species):
### Convert the species Ensembl primary key IDs from the source to
try:
biomarker_files = unique.read_directory(input_dir)
except Exception:
biomarker_files = unique.read_directory(input_dir)
try: gene_to_source_id = gene_associations.getGeneToUid(species,('hide','Ensembl-Symbol'))
except Exception: gene_to_source_id={}
source_to_gene = OBO_import.swapKeyValues(gene_to_source_id)
source_to_gene = lowerSymbolDB(source_to_gene)
print len(source_to_gene)
marker_symbol_db={}
for file in biomarker_files:
if 'tissue-specific' in file and species not in file: ### Don't re-translate an already translated file
export_dir = 'AltDatabase/ensembl/'+species+'/'+species+file[2:]
export_data = export.ExportFile(export_dir)
fn = filepath(input_dir+'/'+file)
x=0
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
t = string.split(data,'\t')
if x==0:
x = 1; y=0
for i in t:
if 'Symbol' in i: sy = y
y+=1
export_data.write(line)
else:
ensembl = t[0]; symbol = string.lower(t[sy])
#print symbol, len(source_to_gene);sys.exit()
if symbol in source_to_gene:
species_gene = source_to_gene[symbol][0] ### should only be one gene per symbol (hopefully)
values = string.join([species_gene]+t[1:],'\t')+'\n'
export_data.write(values)
export_data.close()
print export_dir,'written...'
def extractKEGGAssociations(species,mod,system_codes):
import_dir = filepath('/BuildDBs/KEGG')
g = gene_associations.GrabFiles(); g.setdirectory(import_dir)
filedir = g.getMatchingFolders(species)
gpml_data,pathway_db = gene_associations.parseGPML(filepath(filedir))
gene_to_WP = gene_associations.unifyGeneSystems(gpml_data,species,mod)
gene_associations.exportCustomPathwayMappings(gene_to_WP,mod,system_codes,filepath(database_dir+'/'+species+'/gene-mapp/'+mod+'-KEGG.txt'))
if len(gene_to_WP)>0 and mod == 'Ensembl': ### Export all pathway interactions
try: gene_associations.exportNodeInteractions(pathway_db,mod,filepath(filedir))
except Exception: null=[]
elif len(gene_to_WP)>0 and mod == 'HMDB': ### Export all pathway interactions
try: gene_associations.exportNodeInteractions(pathway_db,mod,filepath(filedir),appendToFile=True)
except Exception: null=[]
return filedir
def extractGMTAssociations(species,mod,system_codes,data_type):
if mod != 'HMDB':
import_dir = filepath('/BuildDBs/'+data_type)
gmt_data = gene_associations.parseGMT(import_dir)
gene_to_custom = gene_associations.unifyGeneSystems(gmt_data,species,mod)
gene_associations.exportCustomPathwayMappings(gene_to_custom,mod,system_codes,filepath(database_dir+'/'+species+'/gene-mapp/'+mod+'-'+data_type+'.txt'))
def transferGOSlimGeneAssociations(selected_species):
if selected_species != None: ### Restrict to selected species only
current_species_dirs=selected_species
else:
current_species_dirs = unique.read_directory('/'+database_dir)
for species_code in current_species_dirs:
try:
ens_go_file_dir = filepath(database_dir+'/'+species_code+'/gene-go/Ensembl-GOSlim.txt')
goslim_ens_file = filepath(database_dir+'/'+species_code+'/uid-gene/Ensembl-goslim_goa.txt')
export.copyFile(goslim_ens_file,ens_go_file_dir)
translateToEntrezGene(species_code,ens_go_file_dir)
except Exception: null=[]
def translateToEntrezGene(species,filename):
x=0; type = 'pathway'
try: ens_to_entrez = gene_associations.getGeneToUid(species,('hide','Ensembl-EntrezGene'))
except Exception: ens_to_entrez ={}
if len(ens_to_entrez)>0:
export_file = string.replace(filename,'Ensembl','EntrezGene')
export_data = export.ExportFile(export_file)
export_data.write('EntrezGene\tOntologyID\n')
fn = filepath(filename)
for line in open(fn,'rU').xreadlines():
if x==0: x=1
else:
data = cleanUpLine(line)
try:
ensembl,pathway = string.split(data,'\t')
type = 'ontology'
except Exception:
ensembl,null,pathway = string.split(data,'\t')
try:
entrezs = ens_to_entrez[ensembl]
for entrez in entrezs:
if type == 'ontology':
export_data.write(entrez+'\t'+pathway+'\n')
else:
export_data.write(entrez+'\tEn\t'+pathway+'\n')
except Exception:
null=[]
export_data.close()
def importRVistaGeneAssociations(species_code,source_path):
x=0; tf_symbol_db={}
fn = filepath(source_path)
TF_symbol_db={}
if species_code == 'Dm' or species_code == 'Mm': ### Dm IDs are Ensembl
gene_to_symbol = gene_associations.getGeneToUid(species_code,('hide','Ensembl-Symbol'))
increment = 10000
print 'Importing symbol-R Vista TF assocations (be patient)'
x=0
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
x+=1
#if x==increment: x=0; print '*',
try:
symbol,TF = string.split(data,'\t')
if species_code == 'Dm' or species_code == 'Mm':
ensembls = [symbol]
try: symbol = gene_to_symbol[symbol][0]
except Exception: forceError
try: TF_symbol_db[TF].append(string.lower(symbol))
except Exception: TF_symbol_db[TF]=[string.lower(symbol)]
except Exception: None
TF_symbol_db = gene_associations.eliminate_redundant_dict_values(TF_symbol_db)
return TF_symbol_db
def importMiRGeneAssociations(species_code,source_path):
try:
destination_path = filepath(database_dir+'/'+species_code+'/gene-mapp/Ensembl-microRNATargets.txt')
export.copyFile(source_path,destination_path)
translateToEntrezGene(species_code,destination_path)
except Exception: null=[]
def importBioMarkerGeneAssociations(input_dir):
try:
biomarker_folder = unique.read_directory(input_dir)
except Exception:
biomarker_folder = unique.read_directory(input_dir)
marker_symbol_db={}
for folder in biomarker_folder:
if '.' in folder: continue ### This is a file not a folder
else: biomarker_files = unique.read_directory(input_dir+'/'+folder)
for file in biomarker_files:
x=0
if '.txt' in file and '-correlation' not in file and 'AltExon' not in file:
fn = filepath('BuildDBs/BioMarkers/'+folder+'/'+file)
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
t = string.split(data,'\t')
if x==0:
x = 1; y=0
for i in t:
if 'marker-in' in i: mi = y
if 'Symbol' in i: sy = y
y+=1
ensembl = t[0]; symbol = string.lower(t[sy]); marker = t[mi]
markers = string.split(marker,'|')
for marker in markers:
try: marker_symbol_db[marker].append(symbol)
except Exception: marker_symbol_db[marker]=[symbol]
marker_symbol_db = gene_associations.eliminate_redundant_dict_values(marker_symbol_db)
return marker_symbol_db
def importDomainGeneAssociations(species_code,source_path):
try:
destination_path = filepath(database_dir+'/'+species_code+'/gene-mapp/Ensembl-Domains.txt')
export.copyFile(source_path,destination_path)
translateToEntrezGene(species_code,destination_path)
except Exception: null=[]
def importBioGRIDGeneAssociations(taxid,species):
model_mammal_tax = {}
model_mammal_tax['9606'] = 'Hs'
model_mammal_tax['10090'] = 'Mm'
model_mammal_tax['10116'] = 'Rn'
filtered=considerOnlyMammalian([species]) ### See if the species is a mammal
if len(filtered)==0: model_mammal_tax={} ### Don't inlcude the gold standard mammals if not a mammal
model_mammal_tax[taxid]=species
biogrid_files = unique.read_directory('/BuildDBs/BioGRID')
latest_file = biogrid_files[-1]
fn = filepath('BuildDBs/BioGRID/'+latest_file)
ens_dir = database_dir+'/'+species+'/gene-interactions/Ensembl-BioGRID.txt'
ens_data = export.ExportFile(ens_dir)
ens_data.write('Symbol1\tInteractionType\tSymbol2\tGeneID1\tGeneID2\tSource\n')
try: gene_to_source_id = gene_associations.getGeneToUid(species,('hide','Ensembl-Symbol'))
except Exception: gene_to_source_id={}
source_to_gene = OBO_import.swapKeyValues(gene_to_source_id)
source_to_gene = lowerSymbolDB(source_to_gene)
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
t = string.split(data,'\t')
species_tax = t[15]
if species_tax in model_mammal_tax:
symbol1 = t[7]; symbol2 = t[8]
source_exp = t[11]; interaction_type = t[12]
try:
ens1 = source_to_gene[string.lower(symbol1)][0]
ens2 = source_to_gene[string.lower(symbol2)][0]
values = string.join([symbol1,interaction_type,symbol2,ens1,ens2,source_exp],'\t')+'\n'
ens_data.write(values)
except Exception:
None
def importDrugBankAssociations(species):
fn = filepath('BuildDBs/DrugBank/drugbank.txt')
ens_dir = database_dir+'/'+species+'/gene-interactions/Ensembl-DrugBank.txt'
ens_data = export.ExportFile(ens_dir)
ens_data.write('DrugName\tMechanism\tGeneSymbol\tDrugBankDB-ID\tGeneID\tSource\n')
try: gene_to_source_id = gene_associations.getGeneToUid(species,('hide','Ensembl-Symbol'))
except Exception: gene_to_source_id={}
source_to_gene = OBO_import.swapKeyValues(gene_to_source_id)
source_to_gene = lowerSymbolDB(source_to_gene)
getCAS=False
getGenericName=False
getMechanim = False
getGeneName = False
geneNames=[]
mechanism=''
for line in open(fn,'rU').xreadlines():
data = cleanUpLine(line)
if data == '# Primary_Accession_No:': getCAS=True ### switched this from CAS to Drug bank ID for consistency and namining simplicity
elif getCAS: casID = data; getCAS=False
if data == '# Generic_Name:': getGenericName=True
elif getGenericName: genericName = data; getGenericName=False
if data == '# Mechanism_Of_Action:': getMechanim=True
elif getMechanim:
if len(data)>0: mechanism += data + ' '
else: getMechanim=False
if '# Drug_Target_' in data and '_Gene_Name' in data: getGeneName=True
elif getGeneName: geneNames.append(data); getGeneName=False
if '#END_DRUGCARD' in data:
for symbol in geneNames:
try:
ens = source_to_gene[string.lower(symbol)][0]
values = string.join([genericName,mechanism,symbol,casID,ens,'DrugBank'],'\t')+'\n'
ens_data.write(values)
except Exception:
None
casID=''; genericName=''; mechanism=''; geneNames=[]
############# Central buid functions #############
def importWikiPathways(selected_species,force):
if selected_species == None:
selected_species = unique.read_directory('/'+database_dir)
importSpeciesData()
getSourceData()
all_species = 'no'
if force == 'yes':
try:
gene_associations.convertAllGPML(selected_species,all_species) ### Downloads GPMLs and builds flat files
for species_code in selected_species:
interaction_file = 'GPML/Interactomes/interactions.txt'
moveInteractionsToInteractionsDir(interaction_file,species_code,'WikiPathways')
status = 'built'
except IOError:
print 'Unable to connect to http://www.wikipathways.org'
status = 'failed'
status = 'built'
if status == 'built':
import BuildAffymetrixAssociations
for species_code in selected_species:
species_name = species_names[species_code]
if status == 'built':
relationship_types = ['native','mapped']
for relationship_type in relationship_types:
#print 'Processing',relationship_type,'relationships'
index=0
integrate_affy_associations = 'no'
incorporate_previous = 'yes'
process_affygo = 'no'
counts = BuildAffymetrixAssociations.importWikipathways(source_types,incorporate_previous,process_affygo,species_name,species_code,integrate_affy_associations,relationship_type,'over-write previous')
index+=1
print 'Finished integrating updated WikiPathways'
def moveInteractionsToInteractionsDir(source_file,species,name):
destination_file = filepath('AltDatabase/goelite/'+species+'/gene-interactions/Ensembl-'+name+'.txt')
source_file = filepath(source_file)
try: export.copyFile(source_file,destination_file)
except Exception: None ### No file to move
def importKEGGAssociations(selected_species,force):
supported_databases = ['Ag','At','Ce','Dm','Dr','Hs','Mm','Os','Rn']
getSourceData()
if selected_species != None: ### Restrict by selected species
supported_databases2=[]
for species in selected_species:
if species in supported_databases:
supported_databases2.append(species)
supported_databases = supported_databases2
mod_types_list=[]
for i in mod_types: mod_types_list.append(i)
mod_types_list.sort()
for species in supported_databases:
if force == 'yes':
downloadKEGGPathways(species)
for mod in mod_types_list:
buildDB_dir = extractKEGGAssociations(species,mod,system_codes)
interaction_file = buildDB_dir+'/Interactomes/interactions.txt'
moveInteractionsToInteractionsDir(interaction_file,species,'KEGG')
def importPathwayCommons(selected_species,force):
original_species = selected_species
selected_species = considerOnlyMammalian(selected_species)
if len(selected_species) == 0:
print 'PLEASE NOTE: %s does not support PathwayCommons update.' % string.join(original_species,',')
else:
if force == 'yes':
downloadPathwayCommons()
getSourceData()
for species in selected_species:
for mod in mod_types:
extractGMTAssociations(species,mod,system_codes,'PathwayCommons')
def importTranscriptionTargetAssociations(selected_species,force):
original_species = selected_species
selected_species = considerOnlyMammalian(selected_species)
x=[]
if len(selected_species) == 0:
print 'PLEASE NOTE: %s does not support Transcription Factor association update.' % string.join(original_species,',')
else:
global determine_tf_geneids
global tf_to_target_symbol ### Used for TF-target interaction networks
global merged_tf_interactions
tf_to_target_symbol={}
source = 'raw'#'precompiled'
merged_tf_interactions={} ### Stores the final merged PAZAR-Amadeus merged data
determine_tf_geneids = 'yes'
### No need to specify a species since the database will be added only to currently installed species
if force == 'yes':
source = downloadPAZARAssocations()