Skip to content

Commit aac963a

Browse files
committed
track hub per tissue
1 parent ca73c65 commit aac963a

File tree

1,377 files changed

+271
-8181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,377 files changed

+271
-8181
lines changed

14_track_hub.ipynb

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,33 +106,42 @@
106106
},
107107
{
108108
"cell_type": "code",
109-
"execution_count": 6,
109+
"execution_count": 5,
110110
"metadata": {},
111111
"outputs": [],
112112
"source": [
113113
"with open('track_hub/hg38/trackDb.txt', 'w') as f_track_hubs:\n",
114114
" for tissue in TISSUES:\n",
115+
" all_tissue_genes = []\n",
115116
" try:\n",
116117
" for community_id in range(1, 999999):\n",
117118
" arr_com = []\n",
118119
" dic_community = pickle.load(open(\"svm_results/\" + tissue + '_' + str(community_id) + \".pkl\", \"rb\"))\n",
119-
" len_common = len(dic_community['genes'])\n",
120-
"\n",
121-
" with open(f'track_hub/hg38/{tissue}_{community_id}.bed', 'w') as f:\n",
122-
" for gene in dic_community['genes']:\n",
123-
" if gene in dic_all_genes_info.keys():\n",
124-
" gene_info = dic_all_genes_info[gene]\n",
125-
" f.write(f'{gene_info[\"chr\"]}\\t{gene_info[\"chr_start\"]}\\t{gene_info[\"chr_end\"]}\\n')\n",
126-
" \n",
127-
" f_track_hubs.write(f'track {tissue}_{community_id}\\n')\n",
128-
" f_track_hubs.write(f'bigDataUrl https://raw.githubusercontent.com/tjiagoM/gtex-transcriptome-modelling/master/track_hub/hg38/{tissue}_{community_id}.bb\\n')\n",
129-
" f_track_hubs.write(f'shortLabel {tissue}_{community_id}\\n')\n",
130-
" f_track_hubs.write(f'longLabel {tissue}_{community_id}\\n')\n",
131-
" f_track_hubs.write(f'type bigBed\\n')\n",
132-
" f_track_hubs.write(f'\\n')\n",
133-
"\n",
120+
" all_tissue_genes.extend(dic_community['genes'])\n",
134121
" except Exception as e:\n",
135-
" pass"
122+
" pass\n",
123+
" \n",
124+
" # Removing duplicates\n",
125+
" all_tissue_genes = list(set(all_tissue_genes))\n",
126+
" \n",
127+
" # Saving all the tissue's genes\n",
128+
" with open(f'track_hub/hg38/{tissue}.bed', 'w') as f:\n",
129+
" for gene in all_tissue_genes:\n",
130+
" if gene in dic_all_genes_info.keys():\n",
131+
" gene_info = dic_all_genes_info[gene]\n",
132+
" f.write(f'{gene_info[\"chr\"]}\\t{gene_info[\"chr_start\"]}\\t{gene_info[\"chr_end\"]}\\n')\n",
133+
" # Some genes are separated with a '-' rather than with a '.'\n",
134+
" elif gene.replace('.', '-') in dic_all_genes_info.keys():\n",
135+
" gene_info = dic_all_genes_info[gene.replace('.', '-')]\n",
136+
" f.write(f'{gene_info[\"chr\"]}\\t{gene_info[\"chr_start\"]}\\t{gene_info[\"chr_end\"]}\\n')\n",
137+
"\n",
138+
" f_track_hubs.write(f'track {tissue}\\n')\n",
139+
" f_track_hubs.write(f'bigDataUrl https://raw.githubusercontent.com/tjiagoM/gtex-transcriptome-modelling/master/track_hub/hg38/{tissue}.bb\\n')\n",
140+
" f_track_hubs.write(f'shortLabel {tissue}\\n')\n",
141+
" f_track_hubs.write(f'longLabel {tissue}\\n')\n",
142+
" f_track_hubs.write(f'type bigBed\\n')\n",
143+
" f_track_hubs.write(f'visibility full\\n')\n",
144+
" f_track_hubs.write(f'\\n')"
136145
]
137146
},
138147
{
-19.5 KB
Binary file not shown.
-19.6 KB
Binary file not shown.
-19.2 KB
Binary file not shown.
-25.4 KB
Binary file not shown.
-13 KB
Binary file not shown.
-12.9 KB
Binary file not shown.
-12.9 KB
Binary file not shown.
-19.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)