Upload folder using huggingface_hub

#3
Files changed (3) hide show
  1. README.md +5 -3
  2. data_human.ipynb +437 -0
  3. data_mouse.ipynb +437 -0
README.md CHANGED
@@ -13,7 +13,7 @@ size_categories:
13
  # enformer-data
14
 
15
  ## Dataset Summary
16
- This dataset contains the specific genomic intervals used for training, validating, and testing the Enformer model, a deep learning architecture for predicting functional genomic tracks from DNA sequence. The intervals are provided for both human and mouse genomes.
17
 
18
  - **Source Publication:** [Avsec, Ž., et al. "Effective gene expression prediction from sequence by integrating long-range interactions." Nat Methods 18, 1196–1203 (2021).](https://www.nature.com/articles/s41592-021-01252-x)
19
  - **Genome Builds:**
@@ -21,11 +21,13 @@ This dataset contains the specific genomic intervals used for training, validati
21
  - Mouse: mm10
22
 
23
 
24
-
25
  ## Repository Content
26
- The repository includes two tab-separated values (TSV) files:
27
  1. `human_intervals.tsv`: 38,171 genomic regions (excluding header).
28
  2. `mouse_intervals.tsv`: 33,521 genomic regions (excluding header).
 
 
 
29
 
30
  ## Dataset Structure
31
 
 
13
  # enformer-data
14
 
15
  ## Dataset Summary
16
+ This dataset contains the specific genomic intervals used for training, validating, and testing the Enformer model, a deep learning architecture for predicting functional genomic tracks from DNA sequence. The intervals are provided for both human and mouse genomes. As done in the publication, we modified the Basenji2 dataset by extending the input sequence to 196,608 bp from the original 131,072 bp using the hg38 reference genome.
17
 
18
  - **Source Publication:** [Avsec, Ž., et al. "Effective gene expression prediction from sequence by integrating long-range interactions." Nat Methods 18, 1196–1203 (2021).](https://www.nature.com/articles/s41592-021-01252-x)
19
  - **Genome Builds:**
 
21
  - Mouse: mm10
22
 
23
 
 
24
  ## Repository Content
25
+ The repository includes two tab-separated values (TSV) files and two Jupyter notebooks:
26
  1. `human_intervals.tsv`: 38,171 genomic regions (excluding header).
27
  2. `mouse_intervals.tsv`: 33,521 genomic regions (excluding header).
28
+ 3. `data_human.ipynb`: Code to create `human_intervals.tsv`.
29
+ 4. `data_mouse.ipynb`: Code to create `mouse_intervals.tsv`.
30
+
31
 
32
  ## Dataset Structure
33
 
data_human.ipynb ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "c7451d98-b6f2-4d5f-b57f-c3a800d937c9",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Process and save Enformer genomic intervals"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "3b30b38e-fdd0-4c04-8b50-576e8f09dc30",
14
+ "metadata": {},
15
+ "source": [
16
+ "## Set up wandb"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": 1,
22
+ "id": "d374bd3d-c131-4086-ad8b-a9b8c01bd1e0",
23
+ "metadata": {},
24
+ "outputs": [
25
+ {
26
+ "name": "stderr",
27
+ "output_type": "stream",
28
+ "text": [
29
+ "\u001b[34m\u001b[1mwandb\u001b[0m: Using wandb-core as the SDK backend. Please refer to https://wandb.me/wandb-core for more information.\n",
30
+ "\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33mavantikalal\u001b[0m (\u001b[33mgrelu\u001b[0m) to \u001b[32mhttps://api.wandb.ai\u001b[0m. Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n"
31
+ ]
32
+ }
33
+ ],
34
+ "source": [
35
+ "import wandb\n",
36
+ "import pandas as pd\n",
37
+ "\n",
38
+ "wandb.login(host=\"https://api.wandb.ai\")\n",
39
+ "project_name='enformer'"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": 2,
45
+ "id": "b356a72f-628a-4fbb-9e95-df9c38d3bedf",
46
+ "metadata": {},
47
+ "outputs": [
48
+ {
49
+ "data": {
50
+ "text/html": [
51
+ "Tracking run with wandb version 0.19.7"
52
+ ],
53
+ "text/plain": [
54
+ "<IPython.core.display.HTML object>"
55
+ ]
56
+ },
57
+ "metadata": {},
58
+ "output_type": "display_data"
59
+ },
60
+ {
61
+ "data": {
62
+ "text/html": [
63
+ "Run data is saved locally in <code>/code/github/gReLU-applications/enformer/wandb/run-20250305_234119-9gws7tjk</code>"
64
+ ],
65
+ "text/plain": [
66
+ "<IPython.core.display.HTML object>"
67
+ ]
68
+ },
69
+ "metadata": {},
70
+ "output_type": "display_data"
71
+ },
72
+ {
73
+ "data": {
74
+ "text/html": [
75
+ "Syncing run <strong><a href='https://wandb.ai/grelu/enformer/runs/9gws7tjk' target=\"_blank\">prep-intervals-human</a></strong> to <a href='https://wandb.ai/grelu/enformer' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/developer-guide' target=\"_blank\">docs</a>)<br>"
76
+ ],
77
+ "text/plain": [
78
+ "<IPython.core.display.HTML object>"
79
+ ]
80
+ },
81
+ "metadata": {},
82
+ "output_type": "display_data"
83
+ },
84
+ {
85
+ "data": {
86
+ "text/html": [
87
+ " View project at <a href='https://wandb.ai/grelu/enformer' target=\"_blank\">https://wandb.ai/grelu/enformer</a>"
88
+ ],
89
+ "text/plain": [
90
+ "<IPython.core.display.HTML object>"
91
+ ]
92
+ },
93
+ "metadata": {},
94
+ "output_type": "display_data"
95
+ },
96
+ {
97
+ "data": {
98
+ "text/html": [
99
+ " View run at <a href='https://wandb.ai/grelu/enformer/runs/9gws7tjk' target=\"_blank\">https://wandb.ai/grelu/enformer/runs/9gws7tjk</a>"
100
+ ],
101
+ "text/plain": [
102
+ "<IPython.core.display.HTML object>"
103
+ ]
104
+ },
105
+ "metadata": {},
106
+ "output_type": "display_data"
107
+ }
108
+ ],
109
+ "source": [
110
+ "run = wandb.init(entity='grelu', project=project_name, job_type='preprocessing', name='prep-intervals-human',\n",
111
+ " settings=wandb.Settings(\n",
112
+ " program_relpath='data_human.ipynb',\n",
113
+ " program_abspath='/code/github/gReLU-applications/enformer/data_human.ipynb'\n",
114
+ " ))"
115
+ ]
116
+ },
117
+ {
118
+ "cell_type": "markdown",
119
+ "id": "82818c93-972b-4426-9420-b8e1957b3d4e",
120
+ "metadata": {},
121
+ "source": [
122
+ "## Load intervals"
123
+ ]
124
+ },
125
+ {
126
+ "cell_type": "code",
127
+ "execution_count": 3,
128
+ "id": "e2c21829-cc9f-4c74-a3a2-376cc9c88851",
129
+ "metadata": {},
130
+ "outputs": [],
131
+ "source": [
132
+ "sequences_path = '/gstore/data/resbioai/grelu/enformer/sequences.bed'"
133
+ ]
134
+ },
135
+ {
136
+ "cell_type": "code",
137
+ "execution_count": 4,
138
+ "id": "02bc916e-2322-4676-bc93-c0838384a0ce",
139
+ "metadata": {},
140
+ "outputs": [
141
+ {
142
+ "data": {
143
+ "text/html": [
144
+ "<div>\n",
145
+ "<style scoped>\n",
146
+ " .dataframe tbody tr th:only-of-type {\n",
147
+ " vertical-align: middle;\n",
148
+ " }\n",
149
+ "\n",
150
+ " .dataframe tbody tr th {\n",
151
+ " vertical-align: top;\n",
152
+ " }\n",
153
+ "\n",
154
+ " .dataframe thead th {\n",
155
+ " text-align: right;\n",
156
+ " }\n",
157
+ "</style>\n",
158
+ "<table border=\"1\" class=\"dataframe\">\n",
159
+ " <thead>\n",
160
+ " <tr style=\"text-align: right;\">\n",
161
+ " <th></th>\n",
162
+ " <th>chrom</th>\n",
163
+ " <th>start</th>\n",
164
+ " <th>end</th>\n",
165
+ " <th>split</th>\n",
166
+ " </tr>\n",
167
+ " </thead>\n",
168
+ " <tbody>\n",
169
+ " <tr>\n",
170
+ " <th>0</th>\n",
171
+ " <td>chr18</td>\n",
172
+ " <td>928386</td>\n",
173
+ " <td>1059458</td>\n",
174
+ " <td>train</td>\n",
175
+ " </tr>\n",
176
+ " <tr>\n",
177
+ " <th>1</th>\n",
178
+ " <td>chr4</td>\n",
179
+ " <td>113630947</td>\n",
180
+ " <td>113762019</td>\n",
181
+ " <td>train</td>\n",
182
+ " </tr>\n",
183
+ " <tr>\n",
184
+ " <th>2</th>\n",
185
+ " <td>chr11</td>\n",
186
+ " <td>18427720</td>\n",
187
+ " <td>18558792</td>\n",
188
+ " <td>train</td>\n",
189
+ " </tr>\n",
190
+ " </tbody>\n",
191
+ "</table>\n",
192
+ "</div>"
193
+ ],
194
+ "text/plain": [
195
+ " chrom start end split\n",
196
+ "0 chr18 928386 1059458 train\n",
197
+ "1 chr4 113630947 113762019 train\n",
198
+ "2 chr11 18427720 18558792 train"
199
+ ]
200
+ },
201
+ "execution_count": 4,
202
+ "metadata": {},
203
+ "output_type": "execute_result"
204
+ }
205
+ ],
206
+ "source": [
207
+ "intervals = pd.read_table(sequences_path, header=None)\n",
208
+ "intervals.columns = ['chrom', 'start', 'end', 'split']\n",
209
+ "intervals.head(3)"
210
+ ]
211
+ },
212
+ {
213
+ "cell_type": "markdown",
214
+ "id": "01824d66-4434-400a-a030-16d9237efde1",
215
+ "metadata": {},
216
+ "source": [
217
+ "## Resize intervals"
218
+ ]
219
+ },
220
+ {
221
+ "cell_type": "code",
222
+ "execution_count": 5,
223
+ "id": "f7915dc8-2cca-427a-918d-8bf12a995ec5",
224
+ "metadata": {},
225
+ "outputs": [
226
+ {
227
+ "name": "stderr",
228
+ "output_type": "stream",
229
+ "text": [
230
+ "/opt/conda/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
231
+ " from .autonotebook import tqdm as notebook_tqdm\n"
232
+ ]
233
+ },
234
+ {
235
+ "data": {
236
+ "text/html": [
237
+ "<div>\n",
238
+ "<style scoped>\n",
239
+ " .dataframe tbody tr th:only-of-type {\n",
240
+ " vertical-align: middle;\n",
241
+ " }\n",
242
+ "\n",
243
+ " .dataframe tbody tr th {\n",
244
+ " vertical-align: top;\n",
245
+ " }\n",
246
+ "\n",
247
+ " .dataframe thead th {\n",
248
+ " text-align: right;\n",
249
+ " }\n",
250
+ "</style>\n",
251
+ "<table border=\"1\" class=\"dataframe\">\n",
252
+ " <thead>\n",
253
+ " <tr style=\"text-align: right;\">\n",
254
+ " <th></th>\n",
255
+ " <th>chrom</th>\n",
256
+ " <th>start</th>\n",
257
+ " <th>end</th>\n",
258
+ " <th>split</th>\n",
259
+ " </tr>\n",
260
+ " </thead>\n",
261
+ " <tbody>\n",
262
+ " <tr>\n",
263
+ " <th>0</th>\n",
264
+ " <td>chr18</td>\n",
265
+ " <td>895618</td>\n",
266
+ " <td>1092226</td>\n",
267
+ " <td>train</td>\n",
268
+ " </tr>\n",
269
+ " <tr>\n",
270
+ " <th>1</th>\n",
271
+ " <td>chr4</td>\n",
272
+ " <td>113598179</td>\n",
273
+ " <td>113794787</td>\n",
274
+ " <td>train</td>\n",
275
+ " </tr>\n",
276
+ " <tr>\n",
277
+ " <th>2</th>\n",
278
+ " <td>chr11</td>\n",
279
+ " <td>18394952</td>\n",
280
+ " <td>18591560</td>\n",
281
+ " <td>train</td>\n",
282
+ " </tr>\n",
283
+ " <tr>\n",
284
+ " <th>3</th>\n",
285
+ " <td>chr16</td>\n",
286
+ " <td>85772913</td>\n",
287
+ " <td>85969521</td>\n",
288
+ " <td>train</td>\n",
289
+ " </tr>\n",
290
+ " <tr>\n",
291
+ " <th>4</th>\n",
292
+ " <td>chr3</td>\n",
293
+ " <td>158353420</td>\n",
294
+ " <td>158550028</td>\n",
295
+ " <td>train</td>\n",
296
+ " </tr>\n",
297
+ " </tbody>\n",
298
+ "</table>\n",
299
+ "</div>"
300
+ ],
301
+ "text/plain": [
302
+ " chrom start end split\n",
303
+ "0 chr18 895618 1092226 train\n",
304
+ "1 chr4 113598179 113794787 train\n",
305
+ "2 chr11 18394952 18591560 train\n",
306
+ "3 chr16 85772913 85969521 train\n",
307
+ "4 chr3 158353420 158550028 train"
308
+ ]
309
+ },
310
+ "execution_count": 5,
311
+ "metadata": {},
312
+ "output_type": "execute_result"
313
+ }
314
+ ],
315
+ "source": [
316
+ "from grelu.sequence.utils import resize\n",
317
+ "intervals = resize(intervals, 196608)\n",
318
+ "intervals.head()"
319
+ ]
320
+ },
321
+ {
322
+ "cell_type": "markdown",
323
+ "id": "2b079e2e-8ad5-4cac-808a-3f6ab84e1bb3",
324
+ "metadata": {},
325
+ "source": [
326
+ "## Save"
327
+ ]
328
+ },
329
+ {
330
+ "cell_type": "code",
331
+ "execution_count": 6,
332
+ "id": "2f0b7a9f-3760-4ae1-8ef3-cee84090a41f",
333
+ "metadata": {},
334
+ "outputs": [],
335
+ "source": [
336
+ "intervals.to_csv(\"human_intervals.tsv\", index=False, sep=\"\\t\")"
337
+ ]
338
+ },
339
+ {
340
+ "cell_type": "code",
341
+ "execution_count": 7,
342
+ "id": "d5b7b1fd-7c09-498d-9fdf-53332321ae25",
343
+ "metadata": {},
344
+ "outputs": [
345
+ {
346
+ "data": {
347
+ "text/plain": [
348
+ "<Artifact human_intervals>"
349
+ ]
350
+ },
351
+ "execution_count": 7,
352
+ "metadata": {},
353
+ "output_type": "execute_result"
354
+ }
355
+ ],
356
+ "source": [
357
+ "artifact = wandb.Artifact('human_intervals', type='dataset')\n",
358
+ "artifact.add_file(local_path=\"human_intervals.tsv\", name=\"data.tsv\")\n",
359
+ "run.log_artifact(artifact)"
360
+ ]
361
+ },
362
+ {
363
+ "cell_type": "code",
364
+ "execution_count": 8,
365
+ "id": "bbfe1c93-c9fa-48e2-9291-5532597f761e",
366
+ "metadata": {},
367
+ "outputs": [
368
+ {
369
+ "data": {
370
+ "text/html": [],
371
+ "text/plain": [
372
+ "<IPython.core.display.HTML object>"
373
+ ]
374
+ },
375
+ "metadata": {},
376
+ "output_type": "display_data"
377
+ },
378
+ {
379
+ "data": {
380
+ "text/html": [
381
+ " View run <strong style=\"color:#cdcd00\">prep-intervals-human</strong> at: <a href='https://wandb.ai/grelu/enformer/runs/9gws7tjk' target=\"_blank\">https://wandb.ai/grelu/enformer/runs/9gws7tjk</a><br> View project at: <a href='https://wandb.ai/grelu/enformer' target=\"_blank\">https://wandb.ai/grelu/enformer</a><br>Synced 6 W&B file(s), 0 media file(s), 2 artifact file(s) and 0 other file(s)"
382
+ ],
383
+ "text/plain": [
384
+ "<IPython.core.display.HTML object>"
385
+ ]
386
+ },
387
+ "metadata": {},
388
+ "output_type": "display_data"
389
+ },
390
+ {
391
+ "data": {
392
+ "text/html": [
393
+ "Find logs at: <code>./wandb/run-20250305_234119-9gws7tjk/logs</code>"
394
+ ],
395
+ "text/plain": [
396
+ "<IPython.core.display.HTML object>"
397
+ ]
398
+ },
399
+ "metadata": {},
400
+ "output_type": "display_data"
401
+ }
402
+ ],
403
+ "source": [
404
+ "run.finish()"
405
+ ]
406
+ },
407
+ {
408
+ "cell_type": "code",
409
+ "execution_count": null,
410
+ "id": "10041781-c2a0-44c0-b2db-388bc455645d",
411
+ "metadata": {},
412
+ "outputs": [],
413
+ "source": []
414
+ }
415
+ ],
416
+ "metadata": {
417
+ "kernelspec": {
418
+ "display_name": "Python 3 (ipykernel)",
419
+ "language": "python",
420
+ "name": "python3"
421
+ },
422
+ "language_info": {
423
+ "codemirror_mode": {
424
+ "name": "ipython",
425
+ "version": 3
426
+ },
427
+ "file_extension": ".py",
428
+ "mimetype": "text/x-python",
429
+ "name": "python",
430
+ "nbconvert_exporter": "python",
431
+ "pygments_lexer": "ipython3",
432
+ "version": "3.11.9"
433
+ }
434
+ },
435
+ "nbformat": 4,
436
+ "nbformat_minor": 5
437
+ }
data_mouse.ipynb ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "c7451d98-b6f2-4d5f-b57f-c3a800d937c9",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Process and save Enformer genomic intervals"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "3b30b38e-fdd0-4c04-8b50-576e8f09dc30",
14
+ "metadata": {},
15
+ "source": [
16
+ "## Set up wandb"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": 1,
22
+ "id": "d374bd3d-c131-4086-ad8b-a9b8c01bd1e0",
23
+ "metadata": {},
24
+ "outputs": [
25
+ {
26
+ "name": "stderr",
27
+ "output_type": "stream",
28
+ "text": [
29
+ "\u001b[34m\u001b[1mwandb\u001b[0m: Using wandb-core as the SDK backend. Please refer to https://wandb.me/wandb-core for more information.\n",
30
+ "\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33mavantikalal\u001b[0m (\u001b[33mgrelu\u001b[0m) to \u001b[32mhttps://api.wandb.ai\u001b[0m. Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n"
31
+ ]
32
+ }
33
+ ],
34
+ "source": [
35
+ "import wandb\n",
36
+ "import pandas as pd\n",
37
+ "\n",
38
+ "wandb.login(host=\"https://api.wandb.ai\")\n",
39
+ "project_name='enformer'"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": 2,
45
+ "id": "b356a72f-628a-4fbb-9e95-df9c38d3bedf",
46
+ "metadata": {},
47
+ "outputs": [
48
+ {
49
+ "data": {
50
+ "text/html": [
51
+ "Tracking run with wandb version 0.19.7"
52
+ ],
53
+ "text/plain": [
54
+ "<IPython.core.display.HTML object>"
55
+ ]
56
+ },
57
+ "metadata": {},
58
+ "output_type": "display_data"
59
+ },
60
+ {
61
+ "data": {
62
+ "text/html": [
63
+ "Run data is saved locally in <code>/code/github/gReLU-applications/enformer/wandb/run-20250305_234301-of3e4sm1</code>"
64
+ ],
65
+ "text/plain": [
66
+ "<IPython.core.display.HTML object>"
67
+ ]
68
+ },
69
+ "metadata": {},
70
+ "output_type": "display_data"
71
+ },
72
+ {
73
+ "data": {
74
+ "text/html": [
75
+ "Syncing run <strong><a href='https://wandb.ai/grelu/enformer/runs/of3e4sm1' target=\"_blank\">prep-intervals-mouse</a></strong> to <a href='https://wandb.ai/grelu/enformer' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/developer-guide' target=\"_blank\">docs</a>)<br>"
76
+ ],
77
+ "text/plain": [
78
+ "<IPython.core.display.HTML object>"
79
+ ]
80
+ },
81
+ "metadata": {},
82
+ "output_type": "display_data"
83
+ },
84
+ {
85
+ "data": {
86
+ "text/html": [
87
+ " View project at <a href='https://wandb.ai/grelu/enformer' target=\"_blank\">https://wandb.ai/grelu/enformer</a>"
88
+ ],
89
+ "text/plain": [
90
+ "<IPython.core.display.HTML object>"
91
+ ]
92
+ },
93
+ "metadata": {},
94
+ "output_type": "display_data"
95
+ },
96
+ {
97
+ "data": {
98
+ "text/html": [
99
+ " View run at <a href='https://wandb.ai/grelu/enformer/runs/of3e4sm1' target=\"_blank\">https://wandb.ai/grelu/enformer/runs/of3e4sm1</a>"
100
+ ],
101
+ "text/plain": [
102
+ "<IPython.core.display.HTML object>"
103
+ ]
104
+ },
105
+ "metadata": {},
106
+ "output_type": "display_data"
107
+ }
108
+ ],
109
+ "source": [
110
+ "run = wandb.init(entity='grelu', project=project_name, job_type='preprocessing', name='prep-intervals-mouse',\n",
111
+ " settings=wandb.Settings(\n",
112
+ " program_relpath='data_mouse.ipynb',\n",
113
+ " program_abspath='/code/github/gReLU-applications/enformer/data_mouse.ipynb'\n",
114
+ " ))"
115
+ ]
116
+ },
117
+ {
118
+ "cell_type": "markdown",
119
+ "id": "82818c93-972b-4426-9420-b8e1957b3d4e",
120
+ "metadata": {},
121
+ "source": [
122
+ "## Load intervals"
123
+ ]
124
+ },
125
+ {
126
+ "cell_type": "code",
127
+ "execution_count": 3,
128
+ "id": "e2c21829-cc9f-4c74-a3a2-376cc9c88851",
129
+ "metadata": {},
130
+ "outputs": [],
131
+ "source": [
132
+ "sequences_path = '/gstore/data/resbioai/grelu/enformer/sequences-mouse.bed'"
133
+ ]
134
+ },
135
+ {
136
+ "cell_type": "code",
137
+ "execution_count": 4,
138
+ "id": "02bc916e-2322-4676-bc93-c0838384a0ce",
139
+ "metadata": {},
140
+ "outputs": [
141
+ {
142
+ "data": {
143
+ "text/html": [
144
+ "<div>\n",
145
+ "<style scoped>\n",
146
+ " .dataframe tbody tr th:only-of-type {\n",
147
+ " vertical-align: middle;\n",
148
+ " }\n",
149
+ "\n",
150
+ " .dataframe tbody tr th {\n",
151
+ " vertical-align: top;\n",
152
+ " }\n",
153
+ "\n",
154
+ " .dataframe thead th {\n",
155
+ " text-align: right;\n",
156
+ " }\n",
157
+ "</style>\n",
158
+ "<table border=\"1\" class=\"dataframe\">\n",
159
+ " <thead>\n",
160
+ " <tr style=\"text-align: right;\">\n",
161
+ " <th></th>\n",
162
+ " <th>chrom</th>\n",
163
+ " <th>start</th>\n",
164
+ " <th>end</th>\n",
165
+ " <th>split</th>\n",
166
+ " </tr>\n",
167
+ " </thead>\n",
168
+ " <tbody>\n",
169
+ " <tr>\n",
170
+ " <th>0</th>\n",
171
+ " <td>chr4</td>\n",
172
+ " <td>34106647</td>\n",
173
+ " <td>34237719</td>\n",
174
+ " <td>train</td>\n",
175
+ " </tr>\n",
176
+ " <tr>\n",
177
+ " <th>1</th>\n",
178
+ " <td>chr5</td>\n",
179
+ " <td>52207747</td>\n",
180
+ " <td>52338819</td>\n",
181
+ " <td>train</td>\n",
182
+ " </tr>\n",
183
+ " <tr>\n",
184
+ " <th>2</th>\n",
185
+ " <td>chr19</td>\n",
186
+ " <td>20136862</td>\n",
187
+ " <td>20267934</td>\n",
188
+ " <td>train</td>\n",
189
+ " </tr>\n",
190
+ " </tbody>\n",
191
+ "</table>\n",
192
+ "</div>"
193
+ ],
194
+ "text/plain": [
195
+ " chrom start end split\n",
196
+ "0 chr4 34106647 34237719 train\n",
197
+ "1 chr5 52207747 52338819 train\n",
198
+ "2 chr19 20136862 20267934 train"
199
+ ]
200
+ },
201
+ "execution_count": 4,
202
+ "metadata": {},
203
+ "output_type": "execute_result"
204
+ }
205
+ ],
206
+ "source": [
207
+ "intervals = pd.read_table(sequences_path, header=None)\n",
208
+ "intervals.columns = ['chrom', 'start', 'end', 'split']\n",
209
+ "intervals.head(3)"
210
+ ]
211
+ },
212
+ {
213
+ "cell_type": "markdown",
214
+ "id": "01824d66-4434-400a-a030-16d9237efde1",
215
+ "metadata": {},
216
+ "source": [
217
+ "## Resize intervals"
218
+ ]
219
+ },
220
+ {
221
+ "cell_type": "code",
222
+ "execution_count": 5,
223
+ "id": "f7915dc8-2cca-427a-918d-8bf12a995ec5",
224
+ "metadata": {},
225
+ "outputs": [
226
+ {
227
+ "name": "stderr",
228
+ "output_type": "stream",
229
+ "text": [
230
+ "/opt/conda/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
231
+ " from .autonotebook import tqdm as notebook_tqdm\n"
232
+ ]
233
+ },
234
+ {
235
+ "data": {
236
+ "text/html": [
237
+ "<div>\n",
238
+ "<style scoped>\n",
239
+ " .dataframe tbody tr th:only-of-type {\n",
240
+ " vertical-align: middle;\n",
241
+ " }\n",
242
+ "\n",
243
+ " .dataframe tbody tr th {\n",
244
+ " vertical-align: top;\n",
245
+ " }\n",
246
+ "\n",
247
+ " .dataframe thead th {\n",
248
+ " text-align: right;\n",
249
+ " }\n",
250
+ "</style>\n",
251
+ "<table border=\"1\" class=\"dataframe\">\n",
252
+ " <thead>\n",
253
+ " <tr style=\"text-align: right;\">\n",
254
+ " <th></th>\n",
255
+ " <th>chrom</th>\n",
256
+ " <th>start</th>\n",
257
+ " <th>end</th>\n",
258
+ " <th>split</th>\n",
259
+ " </tr>\n",
260
+ " </thead>\n",
261
+ " <tbody>\n",
262
+ " <tr>\n",
263
+ " <th>0</th>\n",
264
+ " <td>chr4</td>\n",
265
+ " <td>34073879</td>\n",
266
+ " <td>34270487</td>\n",
267
+ " <td>train</td>\n",
268
+ " </tr>\n",
269
+ " <tr>\n",
270
+ " <th>1</th>\n",
271
+ " <td>chr5</td>\n",
272
+ " <td>52174979</td>\n",
273
+ " <td>52371587</td>\n",
274
+ " <td>train</td>\n",
275
+ " </tr>\n",
276
+ " <tr>\n",
277
+ " <th>2</th>\n",
278
+ " <td>chr19</td>\n",
279
+ " <td>20104094</td>\n",
280
+ " <td>20300702</td>\n",
281
+ " <td>train</td>\n",
282
+ " </tr>\n",
283
+ " <tr>\n",
284
+ " <th>3</th>\n",
285
+ " <td>chr14</td>\n",
286
+ " <td>61812671</td>\n",
287
+ " <td>62009279</td>\n",
288
+ " <td>train</td>\n",
289
+ " </tr>\n",
290
+ " <tr>\n",
291
+ " <th>4</th>\n",
292
+ " <td>chr15</td>\n",
293
+ " <td>6559578</td>\n",
294
+ " <td>6756186</td>\n",
295
+ " <td>train</td>\n",
296
+ " </tr>\n",
297
+ " </tbody>\n",
298
+ "</table>\n",
299
+ "</div>"
300
+ ],
301
+ "text/plain": [
302
+ " chrom start end split\n",
303
+ "0 chr4 34073879 34270487 train\n",
304
+ "1 chr5 52174979 52371587 train\n",
305
+ "2 chr19 20104094 20300702 train\n",
306
+ "3 chr14 61812671 62009279 train\n",
307
+ "4 chr15 6559578 6756186 train"
308
+ ]
309
+ },
310
+ "execution_count": 5,
311
+ "metadata": {},
312
+ "output_type": "execute_result"
313
+ }
314
+ ],
315
+ "source": [
316
+ "from grelu.sequence.utils import resize\n",
317
+ "intervals = resize(intervals, 196608)\n",
318
+ "intervals.head()"
319
+ ]
320
+ },
321
+ {
322
+ "cell_type": "markdown",
323
+ "id": "2b079e2e-8ad5-4cac-808a-3f6ab84e1bb3",
324
+ "metadata": {},
325
+ "source": [
326
+ "## Save"
327
+ ]
328
+ },
329
+ {
330
+ "cell_type": "code",
331
+ "execution_count": 6,
332
+ "id": "2f0b7a9f-3760-4ae1-8ef3-cee84090a41f",
333
+ "metadata": {},
334
+ "outputs": [],
335
+ "source": [
336
+ "intervals.to_csv(\"mouse_intervals.tsv\", index=False, sep=\"\\t\")"
337
+ ]
338
+ },
339
+ {
340
+ "cell_type": "code",
341
+ "execution_count": 7,
342
+ "id": "d5b7b1fd-7c09-498d-9fdf-53332321ae25",
343
+ "metadata": {},
344
+ "outputs": [
345
+ {
346
+ "data": {
347
+ "text/plain": [
348
+ "<Artifact mouse_intervals>"
349
+ ]
350
+ },
351
+ "execution_count": 7,
352
+ "metadata": {},
353
+ "output_type": "execute_result"
354
+ }
355
+ ],
356
+ "source": [
357
+ "artifact = wandb.Artifact('mouse_intervals', type='dataset')\n",
358
+ "artifact.add_file(local_path=\"mouse_intervals.tsv\", name=\"data.tsv\")\n",
359
+ "run.log_artifact(artifact)"
360
+ ]
361
+ },
362
+ {
363
+ "cell_type": "code",
364
+ "execution_count": 8,
365
+ "id": "bbfe1c93-c9fa-48e2-9291-5532597f761e",
366
+ "metadata": {},
367
+ "outputs": [
368
+ {
369
+ "data": {
370
+ "text/html": [],
371
+ "text/plain": [
372
+ "<IPython.core.display.HTML object>"
373
+ ]
374
+ },
375
+ "metadata": {},
376
+ "output_type": "display_data"
377
+ },
378
+ {
379
+ "data": {
380
+ "text/html": [
381
+ " View run <strong style=\"color:#cdcd00\">prep-intervals-mouse</strong> at: <a href='https://wandb.ai/grelu/enformer/runs/of3e4sm1' target=\"_blank\">https://wandb.ai/grelu/enformer/runs/of3e4sm1</a><br> View project at: <a href='https://wandb.ai/grelu/enformer' target=\"_blank\">https://wandb.ai/grelu/enformer</a><br>Synced 6 W&B file(s), 0 media file(s), 2 artifact file(s) and 0 other file(s)"
382
+ ],
383
+ "text/plain": [
384
+ "<IPython.core.display.HTML object>"
385
+ ]
386
+ },
387
+ "metadata": {},
388
+ "output_type": "display_data"
389
+ },
390
+ {
391
+ "data": {
392
+ "text/html": [
393
+ "Find logs at: <code>./wandb/run-20250305_234301-of3e4sm1/logs</code>"
394
+ ],
395
+ "text/plain": [
396
+ "<IPython.core.display.HTML object>"
397
+ ]
398
+ },
399
+ "metadata": {},
400
+ "output_type": "display_data"
401
+ }
402
+ ],
403
+ "source": [
404
+ "run.finish()"
405
+ ]
406
+ },
407
+ {
408
+ "cell_type": "code",
409
+ "execution_count": null,
410
+ "id": "10041781-c2a0-44c0-b2db-388bc455645d",
411
+ "metadata": {},
412
+ "outputs": [],
413
+ "source": []
414
+ }
415
+ ],
416
+ "metadata": {
417
+ "kernelspec": {
418
+ "display_name": "Python 3 (ipykernel)",
419
+ "language": "python",
420
+ "name": "python3"
421
+ },
422
+ "language_info": {
423
+ "codemirror_mode": {
424
+ "name": "ipython",
425
+ "version": 3
426
+ },
427
+ "file_extension": ".py",
428
+ "mimetype": "text/x-python",
429
+ "name": "python",
430
+ "nbconvert_exporter": "python",
431
+ "pygments_lexer": "ipython3",
432
+ "version": "3.11.9"
433
+ }
434
+ },
435
+ "nbformat": 4,
436
+ "nbformat_minor": 5
437
+ }