Mercurial > repos > jeremyjliu > region_motif_data_manager
comparison data_manager/data_manager_fetch_motifs.py @ 6:aa0d1b185070 draft
Uploaded
author | jeremyjliu |
---|---|
date | Wed, 28 Jan 2015 23:39:30 -0500 |
parents | 6621a6ac8bb4 |
children | b4c2836d2e4e |
comparison
equal
deleted
inserted
replaced
5:6621a6ac8bb4 | 6:aa0d1b185070 |
---|---|
17 from galaxy.util.json import from_json_string, to_json_string | 17 from galaxy.util.json import from_json_string, to_json_string |
18 | 18 |
19 CHUNK_SIZE = 2**20 #1mb | 19 CHUNK_SIZE = 2**20 #1mb |
20 | 20 |
21 def download_motif_databases( data_manager_dict, params, target_directory, motif_db ): | 21 def download_motif_databases( data_manager_dict, params, target_directory, motif_db ): |
22 TEST_BGZ_URL = 'http://gehlenborg.com/wp-content/uploads/motif/pouya_test_motifs.bed.bgz' | |
23 TEST_TBI_URL = 'http://gehlenborg.com/wp-content/uploads/motif/pouya_test_motifs.bed.bgz.tbi' | |
24 POUYA_BGZ_URL = '' | |
25 POUYA_TBI_URL = '' | |
26 JOLMA_BGZ_URL = '' | |
27 JOLMA_TBI_URL = '' | |
28 MM9_BGZ_URL = '' | |
29 MM9_TBI_URL = '' | |
30 | 22 |
31 bgz_reader = urllib2.urlopen( TEST_BGZ_URL ) | 23 if motif_db == "pouya": |
24 BGZ = ['COMPBIO URL HERE', | |
25 "pouya_motifs.bed.bgz", "pouya_bgz", "Pouya Encode Motifs (hg19) BGZ"] | |
26 TBI = ['COMPBIO URL HERE', | |
27 "pouya_motifs.bed.bgz.tbi", "pouya_tbi", "Pouya Encode Motifs (hg19) TBI"] | |
28 elif motif_db == "jaspar": | |
29 BGZ = ['COMPBIO URL HERE', | |
30 "jaspar_jolma_motifs.bed.bgz", "jaspar_bgz", "Jaspar and Jolma Motifs (hg19) BGZ"] | |
31 TBI = ['COMPBIO URL HERE', | |
32 "jaspar_jolma_motifs.bed.bgz.tbi", "jaspar_tbi", "Jaspar and Jolma Motifs (hg19) TBI"] | |
33 elif motif_db == "mouse": | |
34 BGZ = ['COMPBIO URL HERE', | |
35 "mouse_motifs.bed.bgz", "mouse_bgz", "Mouse Motifs (mm9) BGZ"] | |
36 TBI = ['COMPBIO URL HERE', | |
37 "mouse_motifs.bed.bgz.tbi", "mouse_tbi", "Mouse Motifs (mm9) TBI"] | |
38 else: | |
39 BGZ = ['http://gehlenborg.com/wp-content/uploads/motif/pouya_test_motifs.bed.bgz', | |
40 "pouya_test_motifs.bed.bgz", "test_bgz", "Test Pouya Subset (hg19) BGZ"] | |
41 TBI = ['http://gehlenborg.com/wp-content/uploads/motif/pouya_test_motifs.bed.bgz.tbi', | |
42 "pouya_test_motifs.bed.bgz.tbi", "test_tbi", "Test Pouya Subset (hg19) TBI"] | |
43 | |
44 bgz_reader = urllib2.urlopen( BGZ[0] ) | |
32 bgz_data_table_entry = _stream_fasta_to_file( bgz_reader, target_directory, params, | 45 bgz_data_table_entry = _stream_fasta_to_file( bgz_reader, target_directory, params, |
33 "pouya_test_motifs.bed.bgz", "test_bgz", "Test Pouya Subset BGZ (hg19)" ) | 46 BGZ[1], BGZ[2], BGZ[3] ) |
34 _add_data_table_entry( data_manager_dict, 'motif_databases', bgz_data_table_entry ) | 47 _add_data_table_entry( data_manager_dict, 'motif_databases', bgz_data_table_entry ) |
35 | 48 |
36 tbi_reader = urllib2.urlopen( TEST_TBI_URL ) | 49 tbi_reader = urllib2.urlopen( TBI[0] ) |
37 tbi_data_table_entry = _stream_fasta_to_file( tbi_reader, target_directory, params, | 50 tbi_data_table_entry = _stream_fasta_to_file( tbi_reader, target_directory, params, |
38 "pouya_test_motifs.bed.bgz.tbi", "test_tbi", "Test Pouya Subset TBI (hg19)" ) | 51 TBI[1], TBI[2], TBI[3] ) |
39 _add_data_table_entry( data_manager_dict, 'motif_databases', tbi_data_table_entry ) | 52 _add_data_table_entry( data_manager_dict, 'motif_databases', tbi_data_table_entry ) |
40 | 53 |
41 def _add_data_table_entry( data_manager_dict, data_table, data_table_entry ): | 54 def _add_data_table_entry( data_manager_dict, data_table, data_table_entry ): |
42 data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} ) | 55 data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} ) |
43 data_manager_dict['data_tables'][data_table] = data_manager_dict['data_tables'].get( data_table, [] ) | 56 data_manager_dict['data_tables'][data_table] = data_manager_dict['data_tables'].get( data_table, [] ) |