Datasets:
Upload folder using huggingface_hub
Browse files- README.md +63 -3
- data_human.ipynb +471 -0
- data_mouse.ipynb +471 -0
- human_intervals.tsv +0 -0
- mouse_intervals.tsv +0 -0
README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-regression
|
| 5 |
+
tags:
|
| 6 |
+
- biology
|
| 7 |
+
- genomics
|
| 8 |
+
pretty_name: "Borzoi Intervals"
|
| 9 |
+
size_categories:
|
| 10 |
+
- 100K<n<1M
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# borzoi-data
|
| 14 |
+
|
| 15 |
+
## Dataset Summary
|
| 16 |
+
This dataset contains the specific genomic intervals used for training, validating, and testing the Borzoi model, a deep learning architecture for predicting functional genomic tracks from DNA sequence. The intervals are provided for both human and mouse genomes. We modified the intervals provided in the original source by extending the input sequence to 524,288 bp to create the full interval that was supplied to the model.
|
| 17 |
+
|
| 18 |
+
- **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 |
+
- **Original Source** https://github.com/calico/borzoi/tree/main/data
|
| 20 |
+
- **Genome Builds:**
|
| 21 |
+
- Human: hg38
|
| 22 |
+
- Mouse: mm10
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
## Repository Content
|
| 26 |
+
The repository includes two tab-separated values (TSV) files and two Jupyter notebooks:
|
| 27 |
+
1. `human_intervals.tsv`: 55,497 genomic regions (excluding header).
|
| 28 |
+
2. `mouse_intervals.tsv`: 49,369 genomic regions (excluding header).
|
| 29 |
+
3. `data_human.ipynb`: Code to create `human_intervals.tsv`.
|
| 30 |
+
4. `data_mouse.ipynb`: Code to create `mouse_intervals.tsv`.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
## Dataset Structure
|
| 34 |
+
|
| 35 |
+
### Data Fields
|
| 36 |
+
Both files follow a standard genomic interval format:
|
| 37 |
+
|
| 38 |
+
| Column | Type | Description |
|
| 39 |
+
| :--- | :--- | :--- |
|
| 40 |
+
| `chrom` | string | Chromosome identifier (e.g., `chr18`, `chr4`) |
|
| 41 |
+
| `start` | int | Start coordinate of the interval |
|
| 42 |
+
| `end` | int | End coordinate of the interval |
|
| 43 |
+
| `fold` | string | Fold assignment (`fold0`-`fold7`) |
|
| 44 |
+
| `split` | string | Data partition assignment (`train`, `test`, or `val`) |
|
| 45 |
+
|
| 46 |
+
### Statistics
|
| 47 |
+
| File | Number of Regions | Genome Build |
|
| 48 |
+
| :--- | :--- | :--- |
|
| 49 |
+
| `human_intervals.tsv` | 55,497 | hg38 |
|
| 50 |
+
| `mouse_intervals.tsv` | 49,369 | mm10 |
|
| 51 |
+
|
| 52 |
+
## Usage
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from huggingface_hub import hf_hub_download
|
| 56 |
+
import pandas as pd
|
| 57 |
+
|
| 58 |
+
file_path = hf_hub_download(repo_id="Genentech/borzoi-data", filename="human_intervals.tsv")
|
| 59 |
+
df_human = pd.read_csv(file_path, sep='\t')
|
| 60 |
+
|
| 61 |
+
file_path = h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},
|
| 7 |
+
"source": [
|
| 8 |
+
"# Process and save Borzoi genomic intervals"
|
| 9 |
+
]
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"cell_type": "markdown",
|
| 13 |
+
"id": "759f57dc-ef72-46d4-8409-bd7963f72fbd",
|
| 14 |
+
"metadata": {},
|
| 15 |
+
"source": [
|
| 16 |
+
"## Set up wandb"
|
| 17 |
+
]
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"cell_type": "code",
|
| 21 |
+
"execution_count": 1,
|
| 22 |
+
"id": "63bd594d-3be6-482b-885a-bf273aca4733",
|
| 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='borzoi'"
|
| 40 |
+
]
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"cell_type": "code",
|
| 44 |
+
"execution_count": 2,
|
| 45 |
+
"id": "01fd2d09-9580-4c78-a0b0-b57df4101eef",
|
| 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/borzoi/wandb/run-20250306_054006-tuf1j2g4</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/borzoi/runs/tuf1j2g4' target=\"_blank\">prep-intervals-human</a></strong> to <a href='https://wandb.ai/grelu/borzoi' 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/borzoi' target=\"_blank\">https://wandb.ai/grelu/borzoi</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/borzoi/runs/tuf1j2g4' target=\"_blank\">https://wandb.ai/grelu/borzoi/runs/tuf1j2g4</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/borzoi/data_human.ipynb'\n",
|
| 114 |
+
" ))"
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"cell_type": "markdown",
|
| 119 |
+
"id": "c9a6badc-b835-4d38-b134-6661960be06f",
|
| 120 |
+
"metadata": {},
|
| 121 |
+
"source": [
|
| 122 |
+
"## Load intervals"
|
| 123 |
+
]
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"cell_type": "code",
|
| 127 |
+
"execution_count": 3,
|
| 128 |
+
"id": "f6c3dd12-4e0c-43f2-9daf-cd821c85e3ed",
|
| 129 |
+
"metadata": {},
|
| 130 |
+
"outputs": [],
|
| 131 |
+
"source": [
|
| 132 |
+
"intervals_path = '/gstore/data/resbioai/grelu/borzoi-data/hg38/sequences.bed'"
|
| 133 |
+
]
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"cell_type": "code",
|
| 137 |
+
"execution_count": 4,
|
| 138 |
+
"id": "8a7a5189-3123-4926-8e75-cece1371ad9f",
|
| 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>fold</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>82524421</td>\n",
|
| 173 |
+
" <td>82721029</td>\n",
|
| 174 |
+
" <td>fold0</td>\n",
|
| 175 |
+
" </tr>\n",
|
| 176 |
+
" <tr>\n",
|
| 177 |
+
" <th>1</th>\n",
|
| 178 |
+
" <td>chr13</td>\n",
|
| 179 |
+
" <td>18604798</td>\n",
|
| 180 |
+
" <td>18801406</td>\n",
|
| 181 |
+
" <td>fold0</td>\n",
|
| 182 |
+
" </tr>\n",
|
| 183 |
+
" <tr>\n",
|
| 184 |
+
" <th>2</th>\n",
|
| 185 |
+
" <td>chr2</td>\n",
|
| 186 |
+
" <td>189923408</td>\n",
|
| 187 |
+
" <td>190120016</td>\n",
|
| 188 |
+
" <td>fold0</td>\n",
|
| 189 |
+
" </tr>\n",
|
| 190 |
+
" </tbody>\n",
|
| 191 |
+
"</table>\n",
|
| 192 |
+
"</div>"
|
| 193 |
+
],
|
| 194 |
+
"text/plain": [
|
| 195 |
+
" chrom start end fold\n",
|
| 196 |
+
"0 chr4 82524421 82721029 fold0\n",
|
| 197 |
+
"1 chr13 18604798 18801406 fold0\n",
|
| 198 |
+
"2 chr2 189923408 190120016 fold0"
|
| 199 |
+
]
|
| 200 |
+
},
|
| 201 |
+
"execution_count": 4,
|
| 202 |
+
"metadata": {},
|
| 203 |
+
"output_type": "execute_result"
|
| 204 |
+
}
|
| 205 |
+
],
|
| 206 |
+
"source": [
|
| 207 |
+
"intervals = pd.read_table(intervals_path, header=None)\n",
|
| 208 |
+
"intervals.columns = ['chrom', 'start', 'end', 'fold']\n",
|
| 209 |
+
"intervals.head(3)"
|
| 210 |
+
]
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"cell_type": "code",
|
| 214 |
+
"execution_count": 5,
|
| 215 |
+
"id": "74efa465-b003-4a81-af6b-8511990ba1f1",
|
| 216 |
+
"metadata": {},
|
| 217 |
+
"outputs": [
|
| 218 |
+
{
|
| 219 |
+
"data": {
|
| 220 |
+
"text/plain": [
|
| 221 |
+
"split\n",
|
| 222 |
+
"train 41699\n",
|
| 223 |
+
"val 6910\n",
|
| 224 |
+
"test 6888\n",
|
| 225 |
+
"Name: count, dtype: int64"
|
| 226 |
+
]
|
| 227 |
+
},
|
| 228 |
+
"execution_count": 5,
|
| 229 |
+
"metadata": {},
|
| 230 |
+
"output_type": "execute_result"
|
| 231 |
+
}
|
| 232 |
+
],
|
| 233 |
+
"source": [
|
| 234 |
+
"intervals['split'] = 'train'\n",
|
| 235 |
+
"intervals.loc[intervals.fold=='fold3', 'split'] = 'test'\n",
|
| 236 |
+
"intervals.loc[intervals.fold=='fold4', 'split'] = 'val'\n",
|
| 237 |
+
"intervals.split.value_counts()"
|
| 238 |
+
]
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"cell_type": "markdown",
|
| 242 |
+
"id": "2dd99b47-a673-4213-a556-8fadb6b6feca",
|
| 243 |
+
"metadata": {},
|
| 244 |
+
"source": [
|
| 245 |
+
"## Resize intervals"
|
| 246 |
+
]
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"cell_type": "code",
|
| 250 |
+
"execution_count": 6,
|
| 251 |
+
"id": "bff3f031-c936-422c-9413-b50eedafb5b5",
|
| 252 |
+
"metadata": {},
|
| 253 |
+
"outputs": [
|
| 254 |
+
{
|
| 255 |
+
"name": "stderr",
|
| 256 |
+
"output_type": "stream",
|
| 257 |
+
"text": [
|
| 258 |
+
"/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",
|
| 259 |
+
" from .autonotebook import tqdm as notebook_tqdm\n"
|
| 260 |
+
]
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"data": {
|
| 264 |
+
"text/html": [
|
| 265 |
+
"<div>\n",
|
| 266 |
+
"<style scoped>\n",
|
| 267 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 268 |
+
" vertical-align: middle;\n",
|
| 269 |
+
" }\n",
|
| 270 |
+
"\n",
|
| 271 |
+
" .dataframe tbody tr th {\n",
|
| 272 |
+
" vertical-align: top;\n",
|
| 273 |
+
" }\n",
|
| 274 |
+
"\n",
|
| 275 |
+
" .dataframe thead th {\n",
|
| 276 |
+
" text-align: right;\n",
|
| 277 |
+
" }\n",
|
| 278 |
+
"</style>\n",
|
| 279 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 280 |
+
" <thead>\n",
|
| 281 |
+
" <tr style=\"text-align: right;\">\n",
|
| 282 |
+
" <th></th>\n",
|
| 283 |
+
" <th>chrom</th>\n",
|
| 284 |
+
" <th>start</th>\n",
|
| 285 |
+
" <th>end</th>\n",
|
| 286 |
+
" <th>fold</th>\n",
|
| 287 |
+
" <th>split</th>\n",
|
| 288 |
+
" </tr>\n",
|
| 289 |
+
" </thead>\n",
|
| 290 |
+
" <tbody>\n",
|
| 291 |
+
" <tr>\n",
|
| 292 |
+
" <th>0</th>\n",
|
| 293 |
+
" <td>chr4</td>\n",
|
| 294 |
+
" <td>82360581</td>\n",
|
| 295 |
+
" <td>82884869</td>\n",
|
| 296 |
+
" <td>fold0</td>\n",
|
| 297 |
+
" <td>train</td>\n",
|
| 298 |
+
" </tr>\n",
|
| 299 |
+
" <tr>\n",
|
| 300 |
+
" <th>1</th>\n",
|
| 301 |
+
" <td>chr13</td>\n",
|
| 302 |
+
" <td>18440958</td>\n",
|
| 303 |
+
" <td>18965246</td>\n",
|
| 304 |
+
" <td>fold0</td>\n",
|
| 305 |
+
" <td>train</td>\n",
|
| 306 |
+
" </tr>\n",
|
| 307 |
+
" <tr>\n",
|
| 308 |
+
" <th>2</th>\n",
|
| 309 |
+
" <td>chr2</td>\n",
|
| 310 |
+
" <td>189759568</td>\n",
|
| 311 |
+
" <td>190283856</td>\n",
|
| 312 |
+
" <td>fold0</td>\n",
|
| 313 |
+
" <td>train</td>\n",
|
| 314 |
+
" </tr>\n",
|
| 315 |
+
" <tr>\n",
|
| 316 |
+
" <th>3</th>\n",
|
| 317 |
+
" <td>chr10</td>\n",
|
| 318 |
+
" <td>59711903</td>\n",
|
| 319 |
+
" <td>60236191</td>\n",
|
| 320 |
+
" <td>fold0</td>\n",
|
| 321 |
+
" <td>train</td>\n",
|
| 322 |
+
" </tr>\n",
|
| 323 |
+
" <tr>\n",
|
| 324 |
+
" <th>4</th>\n",
|
| 325 |
+
" <td>chr1</td>\n",
|
| 326 |
+
" <td>116945627</td>\n",
|
| 327 |
+
" <td>117469915</td>\n",
|
| 328 |
+
" <td>fold0</td>\n",
|
| 329 |
+
" <td>train</td>\n",
|
| 330 |
+
" </tr>\n",
|
| 331 |
+
" </tbody>\n",
|
| 332 |
+
"</table>\n",
|
| 333 |
+
"</div>"
|
| 334 |
+
],
|
| 335 |
+
"text/plain": [
|
| 336 |
+
" chrom start end fold split\n",
|
| 337 |
+
"0 chr4 82360581 82884869 fold0 train\n",
|
| 338 |
+
"1 chr13 18440958 18965246 fold0 train\n",
|
| 339 |
+
"2 chr2 189759568 190283856 fold0 train\n",
|
| 340 |
+
"3 chr10 59711903 60236191 fold0 train\n",
|
| 341 |
+
"4 chr1 116945627 117469915 fold0 train"
|
| 342 |
+
]
|
| 343 |
+
},
|
| 344 |
+
"execution_count": 6,
|
| 345 |
+
"metadata": {},
|
| 346 |
+
"output_type": "execute_result"
|
| 347 |
+
}
|
| 348 |
+
],
|
| 349 |
+
"source": [
|
| 350 |
+
"from grelu.sequence.utils import resize\n",
|
| 351 |
+
"intervals = resize(intervals, 524288)\n",
|
| 352 |
+
"intervals.head()"
|
| 353 |
+
]
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"cell_type": "markdown",
|
| 357 |
+
"id": "e065a48d-5033-497d-81c4-d12a8dc33b29",
|
| 358 |
+
"metadata": {},
|
| 359 |
+
"source": [
|
| 360 |
+
"## Save"
|
| 361 |
+
]
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"cell_type": "code",
|
| 365 |
+
"execution_count": 7,
|
| 366 |
+
"id": "f419b288-dcd4-4076-842f-9211d33f449c",
|
| 367 |
+
"metadata": {},
|
| 368 |
+
"outputs": [],
|
| 369 |
+
"source": [
|
| 370 |
+
"intervals.to_csv(\"human_intervals.tsv\", index=False, sep=\"\\t\")"
|
| 371 |
+
]
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"cell_type": "code",
|
| 375 |
+
"execution_count": 8,
|
| 376 |
+
"id": "47205dbe-d0f6-4db2-8df2-ad82e2189b84",
|
| 377 |
+
"metadata": {},
|
| 378 |
+
"outputs": [
|
| 379 |
+
{
|
| 380 |
+
"data": {
|
| 381 |
+
"text/plain": [
|
| 382 |
+
"<Artifact human_intervals>"
|
| 383 |
+
]
|
| 384 |
+
},
|
| 385 |
+
"execution_count": 8,
|
| 386 |
+
"metadata": {},
|
| 387 |
+
"output_type": "execute_result"
|
| 388 |
+
}
|
| 389 |
+
],
|
| 390 |
+
"source": [
|
| 391 |
+
"artifact = wandb.Artifact('human_intervals', type='dataset')\n",
|
| 392 |
+
"artifact.add_file(local_path=\"human_intervals.tsv\", name=\"data.tsv\")\n",
|
| 393 |
+
"run.log_artifact(artifact)"
|
| 394 |
+
]
|
| 395 |
+
},
|
| 396 |
+
{
|
| 397 |
+
"cell_type": "code",
|
| 398 |
+
"execution_count": 9,
|
| 399 |
+
"id": "9d13ced8-8755-4f20-acfb-cb59c5a1c5c2",
|
| 400 |
+
"metadata": {},
|
| 401 |
+
"outputs": [
|
| 402 |
+
{
|
| 403 |
+
"data": {
|
| 404 |
+
"text/html": [],
|
| 405 |
+
"text/plain": [
|
| 406 |
+
"<IPython.core.display.HTML object>"
|
| 407 |
+
]
|
| 408 |
+
},
|
| 409 |
+
"metadata": {},
|
| 410 |
+
"output_type": "display_data"
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"data": {
|
| 414 |
+
"text/html": [
|
| 415 |
+
" View run <strong style=\"color:#cdcd00\">prep-intervals-human</strong> at: <a href='https://wandb.ai/grelu/borzoi/runs/tuf1j2g4' target=\"_blank\">https://wandb.ai/grelu/borzoi/runs/tuf1j2g4</a><br> View project at: <a href='https://wandb.ai/grelu/borzoi' target=\"_blank\">https://wandb.ai/grelu/borzoi</a><br>Synced 6 W&B file(s), 0 media file(s), 2 artifact file(s) and 0 other file(s)"
|
| 416 |
+
],
|
| 417 |
+
"text/plain": [
|
| 418 |
+
"<IPython.core.display.HTML object>"
|
| 419 |
+
]
|
| 420 |
+
},
|
| 421 |
+
"metadata": {},
|
| 422 |
+
"output_type": "display_data"
|
| 423 |
+
},
|
| 424 |
+
{
|
| 425 |
+
"data": {
|
| 426 |
+
"text/html": [
|
| 427 |
+
"Find logs at: <code>./wandb/run-20250306_054006-tuf1j2g4/logs</code>"
|
| 428 |
+
],
|
| 429 |
+
"text/plain": [
|
| 430 |
+
"<IPython.core.display.HTML object>"
|
| 431 |
+
]
|
| 432 |
+
},
|
| 433 |
+
"metadata": {},
|
| 434 |
+
"output_type": "display_data"
|
| 435 |
+
}
|
| 436 |
+
],
|
| 437 |
+
"source": [
|
| 438 |
+
"run.finish()"
|
| 439 |
+
]
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
"cell_type": "code",
|
| 443 |
+
"execution_count": null,
|
| 444 |
+
"id": "c1c5c691-bfcf-4601-9c30-b14e2260be96",
|
| 445 |
+
"metadata": {},
|
| 446 |
+
"outputs": [],
|
| 447 |
+
"source": []
|
| 448 |
+
}
|
| 449 |
+
],
|
| 450 |
+
"metadata": {
|
| 451 |
+
"kernelspec": {
|
| 452 |
+
"display_name": "Python 3 (ipykernel)",
|
| 453 |
+
"language": "python",
|
| 454 |
+
"name": "python3"
|
| 455 |
+
},
|
| 456 |
+
"language_info": {
|
| 457 |
+
"codemirror_mode": {
|
| 458 |
+
"name": "ipython",
|
| 459 |
+
"version": 3
|
| 460 |
+
},
|
| 461 |
+
"file_extension": ".py",
|
| 462 |
+
"mimetype": "text/x-python",
|
| 463 |
+
"name": "python",
|
| 464 |
+
"nbconvert_exporter": "python",
|
| 465 |
+
"pygments_lexer": "ipython3",
|
| 466 |
+
"version": "3.11.9"
|
| 467 |
+
}
|
| 468 |
+
},
|
| 469 |
+
"nbformat": 4,
|
| 470 |
+
"nbformat_minor": 5
|
| 471 |
+
}
|
data_mouse.ipynb
ADDED
|
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "9233af61-78a9-45b7-a1c8-e882a780bffe",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# Process and save Borzoi genomic intervals"
|
| 9 |
+
]
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"cell_type": "markdown",
|
| 13 |
+
"id": "759f57dc-ef72-46d4-8409-bd7963f72fbd",
|
| 14 |
+
"metadata": {},
|
| 15 |
+
"source": [
|
| 16 |
+
"## Set up wandb"
|
| 17 |
+
]
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"cell_type": "code",
|
| 21 |
+
"execution_count": 1,
|
| 22 |
+
"id": "63bd594d-3be6-482b-885a-bf273aca4733",
|
| 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='borzoi'"
|
| 40 |
+
]
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"cell_type": "code",
|
| 44 |
+
"execution_count": 2,
|
| 45 |
+
"id": "01fd2d09-9580-4c78-a0b0-b57df4101eef",
|
| 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/borzoi/wandb/run-20250306_054113-laagd3z3</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/borzoi/runs/laagd3z3' target=\"_blank\">prep-intervals-mouse</a></strong> to <a href='https://wandb.ai/grelu/borzoi' 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/borzoi' target=\"_blank\">https://wandb.ai/grelu/borzoi</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/borzoi/runs/laagd3z3' target=\"_blank\">https://wandb.ai/grelu/borzoi/runs/laagd3z3</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/borzoi/data_mouse.ipynb'\n",
|
| 114 |
+
" ))"
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"cell_type": "markdown",
|
| 119 |
+
"id": "c9a6badc-b835-4d38-b134-6661960be06f",
|
| 120 |
+
"metadata": {},
|
| 121 |
+
"source": [
|
| 122 |
+
"## Load intervals"
|
| 123 |
+
]
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"cell_type": "code",
|
| 127 |
+
"execution_count": 3,
|
| 128 |
+
"id": "f6c3dd12-4e0c-43f2-9daf-cd821c85e3ed",
|
| 129 |
+
"metadata": {},
|
| 130 |
+
"outputs": [],
|
| 131 |
+
"source": [
|
| 132 |
+
"intervals_path = '/gstore/data/resbioai/grelu/borzoi-data/mm10/sequences.bed'"
|
| 133 |
+
]
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"cell_type": "code",
|
| 137 |
+
"execution_count": 4,
|
| 138 |
+
"id": "8a7a5189-3123-4926-8e75-cece1371ad9f",
|
| 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>fold</th>\n",
|
| 166 |
+
" </tr>\n",
|
| 167 |
+
" </thead>\n",
|
| 168 |
+
" <tbody>\n",
|
| 169 |
+
" <tr>\n",
|
| 170 |
+
" <th>0</th>\n",
|
| 171 |
+
" <td>chr1</td>\n",
|
| 172 |
+
" <td>46257174</td>\n",
|
| 173 |
+
" <td>46453782</td>\n",
|
| 174 |
+
" <td>fold0</td>\n",
|
| 175 |
+
" </tr>\n",
|
| 176 |
+
" <tr>\n",
|
| 177 |
+
" <th>1</th>\n",
|
| 178 |
+
" <td>chr2</td>\n",
|
| 179 |
+
" <td>83512641</td>\n",
|
| 180 |
+
" <td>83709249</td>\n",
|
| 181 |
+
" <td>fold0</td>\n",
|
| 182 |
+
" </tr>\n",
|
| 183 |
+
" <tr>\n",
|
| 184 |
+
" <th>2</th>\n",
|
| 185 |
+
" <td>chr7</td>\n",
|
| 186 |
+
" <td>16218353</td>\n",
|
| 187 |
+
" <td>16414961</td>\n",
|
| 188 |
+
" <td>fold0</td>\n",
|
| 189 |
+
" </tr>\n",
|
| 190 |
+
" </tbody>\n",
|
| 191 |
+
"</table>\n",
|
| 192 |
+
"</div>"
|
| 193 |
+
],
|
| 194 |
+
"text/plain": [
|
| 195 |
+
" chrom start end fold\n",
|
| 196 |
+
"0 chr1 46257174 46453782 fold0\n",
|
| 197 |
+
"1 chr2 83512641 83709249 fold0\n",
|
| 198 |
+
"2 chr7 16218353 16414961 fold0"
|
| 199 |
+
]
|
| 200 |
+
},
|
| 201 |
+
"execution_count": 4,
|
| 202 |
+
"metadata": {},
|
| 203 |
+
"output_type": "execute_result"
|
| 204 |
+
}
|
| 205 |
+
],
|
| 206 |
+
"source": [
|
| 207 |
+
"intervals = pd.read_table(intervals_path, header=None)\n",
|
| 208 |
+
"intervals.columns = ['chrom', 'start', 'end', 'fold']\n",
|
| 209 |
+
"intervals.head(3)"
|
| 210 |
+
]
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"cell_type": "code",
|
| 214 |
+
"execution_count": 5,
|
| 215 |
+
"id": "74efa465-b003-4a81-af6b-8511990ba1f1",
|
| 216 |
+
"metadata": {},
|
| 217 |
+
"outputs": [
|
| 218 |
+
{
|
| 219 |
+
"data": {
|
| 220 |
+
"text/plain": [
|
| 221 |
+
"split\n",
|
| 222 |
+
"train 36950\n",
|
| 223 |
+
"val 6318\n",
|
| 224 |
+
"test 6101\n",
|
| 225 |
+
"Name: count, dtype: int64"
|
| 226 |
+
]
|
| 227 |
+
},
|
| 228 |
+
"execution_count": 5,
|
| 229 |
+
"metadata": {},
|
| 230 |
+
"output_type": "execute_result"
|
| 231 |
+
}
|
| 232 |
+
],
|
| 233 |
+
"source": [
|
| 234 |
+
"intervals['split'] = 'train'\n",
|
| 235 |
+
"intervals.loc[intervals.fold=='fold3', 'split'] = 'test'\n",
|
| 236 |
+
"intervals.loc[intervals.fold=='fold4', 'split'] = 'val'\n",
|
| 237 |
+
"intervals.split.value_counts()"
|
| 238 |
+
]
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"cell_type": "markdown",
|
| 242 |
+
"id": "2dd99b47-a673-4213-a556-8fadb6b6feca",
|
| 243 |
+
"metadata": {},
|
| 244 |
+
"source": [
|
| 245 |
+
"## Resize intervals"
|
| 246 |
+
]
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"cell_type": "code",
|
| 250 |
+
"execution_count": 6,
|
| 251 |
+
"id": "bff3f031-c936-422c-9413-b50eedafb5b5",
|
| 252 |
+
"metadata": {},
|
| 253 |
+
"outputs": [
|
| 254 |
+
{
|
| 255 |
+
"name": "stderr",
|
| 256 |
+
"output_type": "stream",
|
| 257 |
+
"text": [
|
| 258 |
+
"/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",
|
| 259 |
+
" from .autonotebook import tqdm as notebook_tqdm\n"
|
| 260 |
+
]
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"data": {
|
| 264 |
+
"text/html": [
|
| 265 |
+
"<div>\n",
|
| 266 |
+
"<style scoped>\n",
|
| 267 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 268 |
+
" vertical-align: middle;\n",
|
| 269 |
+
" }\n",
|
| 270 |
+
"\n",
|
| 271 |
+
" .dataframe tbody tr th {\n",
|
| 272 |
+
" vertical-align: top;\n",
|
| 273 |
+
" }\n",
|
| 274 |
+
"\n",
|
| 275 |
+
" .dataframe thead th {\n",
|
| 276 |
+
" text-align: right;\n",
|
| 277 |
+
" }\n",
|
| 278 |
+
"</style>\n",
|
| 279 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 280 |
+
" <thead>\n",
|
| 281 |
+
" <tr style=\"text-align: right;\">\n",
|
| 282 |
+
" <th></th>\n",
|
| 283 |
+
" <th>chrom</th>\n",
|
| 284 |
+
" <th>start</th>\n",
|
| 285 |
+
" <th>end</th>\n",
|
| 286 |
+
" <th>fold</th>\n",
|
| 287 |
+
" <th>split</th>\n",
|
| 288 |
+
" </tr>\n",
|
| 289 |
+
" </thead>\n",
|
| 290 |
+
" <tbody>\n",
|
| 291 |
+
" <tr>\n",
|
| 292 |
+
" <th>0</th>\n",
|
| 293 |
+
" <td>chr1</td>\n",
|
| 294 |
+
" <td>46093334</td>\n",
|
| 295 |
+
" <td>46617622</td>\n",
|
| 296 |
+
" <td>fold0</td>\n",
|
| 297 |
+
" <td>train</td>\n",
|
| 298 |
+
" </tr>\n",
|
| 299 |
+
" <tr>\n",
|
| 300 |
+
" <th>1</th>\n",
|
| 301 |
+
" <td>chr2</td>\n",
|
| 302 |
+
" <td>83348801</td>\n",
|
| 303 |
+
" <td>83873089</td>\n",
|
| 304 |
+
" <td>fold0</td>\n",
|
| 305 |
+
" <td>train</td>\n",
|
| 306 |
+
" </tr>\n",
|
| 307 |
+
" <tr>\n",
|
| 308 |
+
" <th>2</th>\n",
|
| 309 |
+
" <td>chr7</td>\n",
|
| 310 |
+
" <td>16054513</td>\n",
|
| 311 |
+
" <td>16578801</td>\n",
|
| 312 |
+
" <td>fold0</td>\n",
|
| 313 |
+
" <td>train</td>\n",
|
| 314 |
+
" </tr>\n",
|
| 315 |
+
" <tr>\n",
|
| 316 |
+
" <th>3</th>\n",
|
| 317 |
+
" <td>chr3</td>\n",
|
| 318 |
+
" <td>113560579</td>\n",
|
| 319 |
+
" <td>114084867</td>\n",
|
| 320 |
+
" <td>fold0</td>\n",
|
| 321 |
+
" <td>train</td>\n",
|
| 322 |
+
" </tr>\n",
|
| 323 |
+
" <tr>\n",
|
| 324 |
+
" <th>4</th>\n",
|
| 325 |
+
" <td>chr3</td>\n",
|
| 326 |
+
" <td>107306300</td>\n",
|
| 327 |
+
" <td>107830588</td>\n",
|
| 328 |
+
" <td>fold0</td>\n",
|
| 329 |
+
" <td>train</td>\n",
|
| 330 |
+
" </tr>\n",
|
| 331 |
+
" </tbody>\n",
|
| 332 |
+
"</table>\n",
|
| 333 |
+
"</div>"
|
| 334 |
+
],
|
| 335 |
+
"text/plain": [
|
| 336 |
+
" chrom start end fold split\n",
|
| 337 |
+
"0 chr1 46093334 46617622 fold0 train\n",
|
| 338 |
+
"1 chr2 83348801 83873089 fold0 train\n",
|
| 339 |
+
"2 chr7 16054513 16578801 fold0 train\n",
|
| 340 |
+
"3 chr3 113560579 114084867 fold0 train\n",
|
| 341 |
+
"4 chr3 107306300 107830588 fold0 train"
|
| 342 |
+
]
|
| 343 |
+
},
|
| 344 |
+
"execution_count": 6,
|
| 345 |
+
"metadata": {},
|
| 346 |
+
"output_type": "execute_result"
|
| 347 |
+
}
|
| 348 |
+
],
|
| 349 |
+
"source": [
|
| 350 |
+
"from grelu.sequence.utils import resize\n",
|
| 351 |
+
"intervals = resize(intervals, 524288)\n",
|
| 352 |
+
"intervals.head()"
|
| 353 |
+
]
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"cell_type": "markdown",
|
| 357 |
+
"id": "e065a48d-5033-497d-81c4-d12a8dc33b29",
|
| 358 |
+
"metadata": {},
|
| 359 |
+
"source": [
|
| 360 |
+
"## Save"
|
| 361 |
+
]
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"cell_type": "code",
|
| 365 |
+
"execution_count": 7,
|
| 366 |
+
"id": "f419b288-dcd4-4076-842f-9211d33f449c",
|
| 367 |
+
"metadata": {},
|
| 368 |
+
"outputs": [],
|
| 369 |
+
"source": [
|
| 370 |
+
"intervals.to_csv(\"mouse_intervals.tsv\", index=False, sep=\"\\t\")"
|
| 371 |
+
]
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"cell_type": "code",
|
| 375 |
+
"execution_count": 8,
|
| 376 |
+
"id": "47205dbe-d0f6-4db2-8df2-ad82e2189b84",
|
| 377 |
+
"metadata": {},
|
| 378 |
+
"outputs": [
|
| 379 |
+
{
|
| 380 |
+
"data": {
|
| 381 |
+
"text/plain": [
|
| 382 |
+
"<Artifact mouse_intervals>"
|
| 383 |
+
]
|
| 384 |
+
},
|
| 385 |
+
"execution_count": 8,
|
| 386 |
+
"metadata": {},
|
| 387 |
+
"output_type": "execute_result"
|
| 388 |
+
}
|
| 389 |
+
],
|
| 390 |
+
"source": [
|
| 391 |
+
"artifact = wandb.Artifact('mouse_intervals', type='dataset')\n",
|
| 392 |
+
"artifact.add_file(local_path=\"mouse_intervals.tsv\", name=\"data.tsv\")\n",
|
| 393 |
+
"run.log_artifact(artifact)"
|
| 394 |
+
]
|
| 395 |
+
},
|
| 396 |
+
{
|
| 397 |
+
"cell_type": "code",
|
| 398 |
+
"execution_count": 9,
|
| 399 |
+
"id": "9d13ced8-8755-4f20-acfb-cb59c5a1c5c2",
|
| 400 |
+
"metadata": {},
|
| 401 |
+
"outputs": [
|
| 402 |
+
{
|
| 403 |
+
"data": {
|
| 404 |
+
"text/html": [],
|
| 405 |
+
"text/plain": [
|
| 406 |
+
"<IPython.core.display.HTML object>"
|
| 407 |
+
]
|
| 408 |
+
},
|
| 409 |
+
"metadata": {},
|
| 410 |
+
"output_type": "display_data"
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"data": {
|
| 414 |
+
"text/html": [
|
| 415 |
+
" View run <strong style=\"color:#cdcd00\">prep-intervals-mouse</strong> at: <a href='https://wandb.ai/grelu/borzoi/runs/laagd3z3' target=\"_blank\">https://wandb.ai/grelu/borzoi/runs/laagd3z3</a><br> View project at: <a href='https://wandb.ai/grelu/borzoi' target=\"_blank\">https://wandb.ai/grelu/borzoi</a><br>Synced 6 W&B file(s), 0 media file(s), 2 artifact file(s) and 0 other file(s)"
|
| 416 |
+
],
|
| 417 |
+
"text/plain": [
|
| 418 |
+
"<IPython.core.display.HTML object>"
|
| 419 |
+
]
|
| 420 |
+
},
|
| 421 |
+
"metadata": {},
|
| 422 |
+
"output_type": "display_data"
|
| 423 |
+
},
|
| 424 |
+
{
|
| 425 |
+
"data": {
|
| 426 |
+
"text/html": [
|
| 427 |
+
"Find logs at: <code>./wandb/run-20250306_054113-laagd3z3/logs</code>"
|
| 428 |
+
],
|
| 429 |
+
"text/plain": [
|
| 430 |
+
"<IPython.core.display.HTML object>"
|
| 431 |
+
]
|
| 432 |
+
},
|
| 433 |
+
"metadata": {},
|
| 434 |
+
"output_type": "display_data"
|
| 435 |
+
}
|
| 436 |
+
],
|
| 437 |
+
"source": [
|
| 438 |
+
"run.finish()"
|
| 439 |
+
]
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
"cell_type": "code",
|
| 443 |
+
"execution_count": null,
|
| 444 |
+
"id": "c1c5c691-bfcf-4601-9c30-b14e2260be96",
|
| 445 |
+
"metadata": {},
|
| 446 |
+
"outputs": [],
|
| 447 |
+
"source": []
|
| 448 |
+
}
|
| 449 |
+
],
|
| 450 |
+
"metadata": {
|
| 451 |
+
"kernelspec": {
|
| 452 |
+
"display_name": "Python 3 (ipykernel)",
|
| 453 |
+
"language": "python",
|
| 454 |
+
"name": "python3"
|
| 455 |
+
},
|
| 456 |
+
"language_info": {
|
| 457 |
+
"codemirror_mode": {
|
| 458 |
+
"name": "ipython",
|
| 459 |
+
"version": 3
|
| 460 |
+
},
|
| 461 |
+
"file_extension": ".py",
|
| 462 |
+
"mimetype": "text/x-python",
|
| 463 |
+
"name": "python",
|
| 464 |
+
"nbconvert_exporter": "python",
|
| 465 |
+
"pygments_lexer": "ipython3",
|
| 466 |
+
"version": "3.11.9"
|
| 467 |
+
}
|
| 468 |
+
},
|
| 469 |
+
"nbformat": 4,
|
| 470 |
+
"nbformat_minor": 5
|
| 471 |
+
}
|
human_intervals.tsv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
mouse_intervals.tsv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|