Datasets:
Upload folder using huggingface_hub
#1
by
avantikalal
- opened
- .gitattributes +1 -0
- 1_data.ipynb +624 -0
- README.md +46 -3
- data.csv +3 -0
.gitattributes
CHANGED
|
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
data.csv filter=lfs diff=lfs merge=lfs -text
|
1_data.ipynb
ADDED
|
@@ -0,0 +1,624 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "6b984a20-40eb-4c08-8494-ebb607e91b94",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# Process data for chromHMM multiclass classification model"
|
| 9 |
+
]
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"cell_type": "markdown",
|
| 13 |
+
"id": "df5cf6ce-dd2c-445f-a5b3-a13e9fd07d17",
|
| 14 |
+
"metadata": {},
|
| 15 |
+
"source": [
|
| 16 |
+
"## Set up wandb"
|
| 17 |
+
]
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"cell_type": "code",
|
| 21 |
+
"execution_count": 1,
|
| 22 |
+
"id": "35c13d53-f8f7-45c9-a7f0-c0e92d7654c9",
|
| 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 anndata\n",
|
| 37 |
+
"import pandas as pd\n",
|
| 38 |
+
"import numpy as np\n",
|
| 39 |
+
"import os\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"wandb.login(host=\"https://api.wandb.ai\")\n",
|
| 42 |
+
"project_name = 'human-chromhmm-fullstack'"
|
| 43 |
+
]
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"cell_type": "code",
|
| 47 |
+
"execution_count": 2,
|
| 48 |
+
"id": "37ecd399-3fd9-4687-9d7d-95638f529dc1",
|
| 49 |
+
"metadata": {},
|
| 50 |
+
"outputs": [
|
| 51 |
+
{
|
| 52 |
+
"data": {
|
| 53 |
+
"text/html": [
|
| 54 |
+
"Tracking run with wandb version 0.19.7"
|
| 55 |
+
],
|
| 56 |
+
"text/plain": [
|
| 57 |
+
"<IPython.core.display.HTML object>"
|
| 58 |
+
]
|
| 59 |
+
},
|
| 60 |
+
"metadata": {},
|
| 61 |
+
"output_type": "display_data"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"data": {
|
| 65 |
+
"text/html": [
|
| 66 |
+
"Run data is saved locally in <code>/code/github/gReLU-applications/chromhmm/wandb/run-20250306_045811-8fux0bft</code>"
|
| 67 |
+
],
|
| 68 |
+
"text/plain": [
|
| 69 |
+
"<IPython.core.display.HTML object>"
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
"metadata": {},
|
| 73 |
+
"output_type": "display_data"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"data": {
|
| 77 |
+
"text/html": [
|
| 78 |
+
"Syncing run <strong><a href='https://wandb.ai/grelu/human-chromhmm-fullstack/runs/8fux0bft' target=\"_blank\">prep</a></strong> to <a href='https://wandb.ai/grelu/human-chromhmm-fullstack' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/developer-guide' target=\"_blank\">docs</a>)<br>"
|
| 79 |
+
],
|
| 80 |
+
"text/plain": [
|
| 81 |
+
"<IPython.core.display.HTML object>"
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
"metadata": {},
|
| 85 |
+
"output_type": "display_data"
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"data": {
|
| 89 |
+
"text/html": [
|
| 90 |
+
" View project at <a href='https://wandb.ai/grelu/human-chromhmm-fullstack' target=\"_blank\">https://wandb.ai/grelu/human-chromhmm-fullstack</a>"
|
| 91 |
+
],
|
| 92 |
+
"text/plain": [
|
| 93 |
+
"<IPython.core.display.HTML object>"
|
| 94 |
+
]
|
| 95 |
+
},
|
| 96 |
+
"metadata": {},
|
| 97 |
+
"output_type": "display_data"
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"data": {
|
| 101 |
+
"text/html": [
|
| 102 |
+
" View run at <a href='https://wandb.ai/grelu/human-chromhmm-fullstack/runs/8fux0bft' target=\"_blank\">https://wandb.ai/grelu/human-chromhmm-fullstack/runs/8fux0bft</a>"
|
| 103 |
+
],
|
| 104 |
+
"text/plain": [
|
| 105 |
+
"<IPython.core.display.HTML object>"
|
| 106 |
+
]
|
| 107 |
+
},
|
| 108 |
+
"metadata": {},
|
| 109 |
+
"output_type": "display_data"
|
| 110 |
+
}
|
| 111 |
+
],
|
| 112 |
+
"source": [
|
| 113 |
+
"run = wandb.init(\n",
|
| 114 |
+
" entity='grelu', project=project_name, job_type='preprocessing', name='prep',\n",
|
| 115 |
+
" settings=wandb.Settings(\n",
|
| 116 |
+
" program_relpath='1_data.ipynb',\n",
|
| 117 |
+
" program_abspath='/code/github/gReLU-applications/chromhmm/1_data.ipynb')\n",
|
| 118 |
+
")"
|
| 119 |
+
]
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"cell_type": "markdown",
|
| 123 |
+
"id": "b4b88d95-a65a-4e75-a309-032faf846c03",
|
| 124 |
+
"metadata": {},
|
| 125 |
+
"source": [
|
| 126 |
+
"## Load data"
|
| 127 |
+
]
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"cell_type": "code",
|
| 131 |
+
"execution_count": 3,
|
| 132 |
+
"id": "1527622f-94c0-4377-b125-407a0eef4bec",
|
| 133 |
+
"metadata": {},
|
| 134 |
+
"outputs": [
|
| 135 |
+
{
|
| 136 |
+
"data": {
|
| 137 |
+
"text/html": [
|
| 138 |
+
"<div>\n",
|
| 139 |
+
"<style scoped>\n",
|
| 140 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 141 |
+
" vertical-align: middle;\n",
|
| 142 |
+
" }\n",
|
| 143 |
+
"\n",
|
| 144 |
+
" .dataframe tbody tr th {\n",
|
| 145 |
+
" vertical-align: top;\n",
|
| 146 |
+
" }\n",
|
| 147 |
+
"\n",
|
| 148 |
+
" .dataframe thead th {\n",
|
| 149 |
+
" text-align: right;\n",
|
| 150 |
+
" }\n",
|
| 151 |
+
"</style>\n",
|
| 152 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 153 |
+
" <thead>\n",
|
| 154 |
+
" <tr style=\"text-align: right;\">\n",
|
| 155 |
+
" <th></th>\n",
|
| 156 |
+
" <th>chrom</th>\n",
|
| 157 |
+
" <th>start</th>\n",
|
| 158 |
+
" <th>end</th>\n",
|
| 159 |
+
" <th>state</th>\n",
|
| 160 |
+
" </tr>\n",
|
| 161 |
+
" </thead>\n",
|
| 162 |
+
" <tbody>\n",
|
| 163 |
+
" <tr>\n",
|
| 164 |
+
" <th>0</th>\n",
|
| 165 |
+
" <td>chr1</td>\n",
|
| 166 |
+
" <td>10000</td>\n",
|
| 167 |
+
" <td>10400</td>\n",
|
| 168 |
+
" <td>2_GapArtf2</td>\n",
|
| 169 |
+
" </tr>\n",
|
| 170 |
+
" <tr>\n",
|
| 171 |
+
" <th>1</th>\n",
|
| 172 |
+
" <td>chr1</td>\n",
|
| 173 |
+
" <td>10400</td>\n",
|
| 174 |
+
" <td>10600</td>\n",
|
| 175 |
+
" <td>27_Acet1</td>\n",
|
| 176 |
+
" </tr>\n",
|
| 177 |
+
" <tr>\n",
|
| 178 |
+
" <th>2</th>\n",
|
| 179 |
+
" <td>chr1</td>\n",
|
| 180 |
+
" <td>10600</td>\n",
|
| 181 |
+
" <td>10800</td>\n",
|
| 182 |
+
" <td>38_EnhWk4</td>\n",
|
| 183 |
+
" </tr>\n",
|
| 184 |
+
" <tr>\n",
|
| 185 |
+
" <th>3</th>\n",
|
| 186 |
+
" <td>chr1</td>\n",
|
| 187 |
+
" <td>10800</td>\n",
|
| 188 |
+
" <td>12800</td>\n",
|
| 189 |
+
" <td>1_GapArtf1</td>\n",
|
| 190 |
+
" </tr>\n",
|
| 191 |
+
" <tr>\n",
|
| 192 |
+
" <th>4</th>\n",
|
| 193 |
+
" <td>chr1</td>\n",
|
| 194 |
+
" <td>12800</td>\n",
|
| 195 |
+
" <td>13000</td>\n",
|
| 196 |
+
" <td>38_EnhWk4</td>\n",
|
| 197 |
+
" </tr>\n",
|
| 198 |
+
" </tbody>\n",
|
| 199 |
+
"</table>\n",
|
| 200 |
+
"</div>"
|
| 201 |
+
],
|
| 202 |
+
"text/plain": [
|
| 203 |
+
" chrom start end state\n",
|
| 204 |
+
"0 chr1 10000 10400 2_GapArtf2\n",
|
| 205 |
+
"1 chr1 10400 10600 27_Acet1\n",
|
| 206 |
+
"2 chr1 10600 10800 38_EnhWk4\n",
|
| 207 |
+
"3 chr1 10800 12800 1_GapArtf1\n",
|
| 208 |
+
"4 chr1 12800 13000 38_EnhWk4"
|
| 209 |
+
]
|
| 210 |
+
},
|
| 211 |
+
"execution_count": 3,
|
| 212 |
+
"metadata": {},
|
| 213 |
+
"output_type": "execute_result"
|
| 214 |
+
}
|
| 215 |
+
],
|
| 216 |
+
"source": [
|
| 217 |
+
"chromhmm = pd.read_table('https://public.hoffman2.idre.ucla.edu/ernst/2K9RS//full_stack/full_stack_annotation_public_release/hg38/hg38_genome_100_segments.bed.gz', header=None)\n",
|
| 218 |
+
"chromhmm.columns = ['chrom', 'start', 'end', 'state']\n",
|
| 219 |
+
"chromhmm.head()"
|
| 220 |
+
]
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"cell_type": "markdown",
|
| 224 |
+
"id": "91bec5b4-201c-4c66-992f-6b54ba5bc71e",
|
| 225 |
+
"metadata": {},
|
| 226 |
+
"source": [
|
| 227 |
+
"## Process data"
|
| 228 |
+
]
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"cell_type": "code",
|
| 232 |
+
"execution_count": 4,
|
| 233 |
+
"id": "394d7f20-121f-4da7-886e-7b4184d2128d",
|
| 234 |
+
"metadata": {},
|
| 235 |
+
"outputs": [
|
| 236 |
+
{
|
| 237 |
+
"name": "stderr",
|
| 238 |
+
"output_type": "stream",
|
| 239 |
+
"text": [
|
| 240 |
+
"/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",
|
| 241 |
+
" from .autonotebook import tqdm as notebook_tqdm\n"
|
| 242 |
+
]
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"name": "stdout",
|
| 246 |
+
"output_type": "stream",
|
| 247 |
+
"text": [
|
| 248 |
+
"Keeping 5845850 intervals\n",
|
| 249 |
+
"Keeping 5809104 intervals\n"
|
| 250 |
+
]
|
| 251 |
+
}
|
| 252 |
+
],
|
| 253 |
+
"source": [
|
| 254 |
+
"from grelu.data.preprocess import filter_chromosomes, filter_blacklist\n",
|
| 255 |
+
"from grelu.sequence.utils import resize\n",
|
| 256 |
+
"\n",
|
| 257 |
+
"chromhmm = filter_chromosomes(chromhmm, include='autosomes')\n",
|
| 258 |
+
"chromhmm = resize(chromhmm, 1024)\n",
|
| 259 |
+
"chromhmm = filter_blacklist(chromhmm, 'hg38')"
|
| 260 |
+
]
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"cell_type": "markdown",
|
| 264 |
+
"id": "8a93565f-d819-44d4-911c-d8d1f5d7a052",
|
| 265 |
+
"metadata": {},
|
| 266 |
+
"source": [
|
| 267 |
+
"## Get coarse-grained state labels"
|
| 268 |
+
]
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"cell_type": "code",
|
| 272 |
+
"execution_count": 5,
|
| 273 |
+
"id": "44474b8b-7f33-4608-95cb-b77e87fb4840",
|
| 274 |
+
"metadata": {},
|
| 275 |
+
"outputs": [
|
| 276 |
+
{
|
| 277 |
+
"data": {
|
| 278 |
+
"text/plain": [
|
| 279 |
+
"state\n",
|
| 280 |
+
"Quies 1485576\n",
|
| 281 |
+
"Acet 639669\n",
|
| 282 |
+
"EnhA 613794\n",
|
| 283 |
+
"ReprPC 610147\n",
|
| 284 |
+
"Tx 561526\n",
|
| 285 |
+
"EnhWk 543113\n",
|
| 286 |
+
"HET 521161\n",
|
| 287 |
+
"TxWk 254518\n",
|
| 288 |
+
"TxEnh 190465\n",
|
| 289 |
+
"TxEx 121833\n",
|
| 290 |
+
"PromF 88429\n",
|
| 291 |
+
"GapArtf 51474\n",
|
| 292 |
+
"BivProm 48242\n",
|
| 293 |
+
"znf 34146\n",
|
| 294 |
+
"TSS 24402\n",
|
| 295 |
+
"DNase 20609\n",
|
| 296 |
+
"Name: count, dtype: int64"
|
| 297 |
+
]
|
| 298 |
+
},
|
| 299 |
+
"execution_count": 5,
|
| 300 |
+
"metadata": {},
|
| 301 |
+
"output_type": "execute_result"
|
| 302 |
+
}
|
| 303 |
+
],
|
| 304 |
+
"source": [
|
| 305 |
+
"chromhmm['state'] = [\n",
|
| 306 |
+
" x.split('_')[1][:-1] for x in chromhmm.state\n",
|
| 307 |
+
"]\n",
|
| 308 |
+
"chromhmm.loc[chromhmm.state.isin(['EnhA1', 'EnhA2']), 'state'] = 'EnhA'\n",
|
| 309 |
+
"\n",
|
| 310 |
+
"chromhmm['state'] = chromhmm['state'].astype('category')\n",
|
| 311 |
+
"chromhmm.state.value_counts() "
|
| 312 |
+
]
|
| 313 |
+
},
|
| 314 |
+
{
|
| 315 |
+
"cell_type": "markdown",
|
| 316 |
+
"id": "3eb00f57-972a-4b07-badd-d8edf20e9d9e",
|
| 317 |
+
"metadata": {},
|
| 318 |
+
"source": [
|
| 319 |
+
"## Load Enformer splits"
|
| 320 |
+
]
|
| 321 |
+
},
|
| 322 |
+
{
|
| 323 |
+
"cell_type": "code",
|
| 324 |
+
"execution_count": 6,
|
| 325 |
+
"id": "89717895-524f-4ea5-bacc-4914e8893096",
|
| 326 |
+
"metadata": {},
|
| 327 |
+
"outputs": [
|
| 328 |
+
{
|
| 329 |
+
"name": "stderr",
|
| 330 |
+
"output_type": "stream",
|
| 331 |
+
"text": [
|
| 332 |
+
"\u001b[34m\u001b[1mwandb\u001b[0m: 1 of 1 files downloaded. \n"
|
| 333 |
+
]
|
| 334 |
+
},
|
| 335 |
+
{
|
| 336 |
+
"data": {
|
| 337 |
+
"text/html": [
|
| 338 |
+
"<div>\n",
|
| 339 |
+
"<style scoped>\n",
|
| 340 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 341 |
+
" vertical-align: middle;\n",
|
| 342 |
+
" }\n",
|
| 343 |
+
"\n",
|
| 344 |
+
" .dataframe tbody tr th {\n",
|
| 345 |
+
" vertical-align: top;\n",
|
| 346 |
+
" }\n",
|
| 347 |
+
"\n",
|
| 348 |
+
" .dataframe thead th {\n",
|
| 349 |
+
" text-align: right;\n",
|
| 350 |
+
" }\n",
|
| 351 |
+
"</style>\n",
|
| 352 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 353 |
+
" <thead>\n",
|
| 354 |
+
" <tr style=\"text-align: right;\">\n",
|
| 355 |
+
" <th></th>\n",
|
| 356 |
+
" <th>chrom</th>\n",
|
| 357 |
+
" <th>start</th>\n",
|
| 358 |
+
" <th>end</th>\n",
|
| 359 |
+
" <th>split</th>\n",
|
| 360 |
+
" </tr>\n",
|
| 361 |
+
" </thead>\n",
|
| 362 |
+
" <tbody>\n",
|
| 363 |
+
" <tr>\n",
|
| 364 |
+
" <th>0</th>\n",
|
| 365 |
+
" <td>chr18</td>\n",
|
| 366 |
+
" <td>895618</td>\n",
|
| 367 |
+
" <td>1092226</td>\n",
|
| 368 |
+
" <td>train</td>\n",
|
| 369 |
+
" </tr>\n",
|
| 370 |
+
" <tr>\n",
|
| 371 |
+
" <th>1</th>\n",
|
| 372 |
+
" <td>chr4</td>\n",
|
| 373 |
+
" <td>113598179</td>\n",
|
| 374 |
+
" <td>113794787</td>\n",
|
| 375 |
+
" <td>train</td>\n",
|
| 376 |
+
" </tr>\n",
|
| 377 |
+
" <tr>\n",
|
| 378 |
+
" <th>2</th>\n",
|
| 379 |
+
" <td>chr11</td>\n",
|
| 380 |
+
" <td>18394952</td>\n",
|
| 381 |
+
" <td>18591560</td>\n",
|
| 382 |
+
" <td>train</td>\n",
|
| 383 |
+
" </tr>\n",
|
| 384 |
+
" </tbody>\n",
|
| 385 |
+
"</table>\n",
|
| 386 |
+
"</div>"
|
| 387 |
+
],
|
| 388 |
+
"text/plain": [
|
| 389 |
+
" chrom start end split\n",
|
| 390 |
+
"0 chr18 895618 1092226 train\n",
|
| 391 |
+
"1 chr4 113598179 113794787 train\n",
|
| 392 |
+
"2 chr11 18394952 18591560 train"
|
| 393 |
+
]
|
| 394 |
+
},
|
| 395 |
+
"execution_count": 6,
|
| 396 |
+
"metadata": {},
|
| 397 |
+
"output_type": "execute_result"
|
| 398 |
+
}
|
| 399 |
+
],
|
| 400 |
+
"source": [
|
| 401 |
+
"artifact = run.use_artifact('enformer/human_intervals:latest')\n",
|
| 402 |
+
"dir = artifact.download()\n",
|
| 403 |
+
"enformer_intervals = pd.read_table(os.path.join(dir, \"data.tsv\"))\n",
|
| 404 |
+
"enformer_intervals.head(3)"
|
| 405 |
+
]
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"cell_type": "markdown",
|
| 409 |
+
"id": "e19fd34a-5797-49f3-a838-c3e2d0342be0",
|
| 410 |
+
"metadata": {},
|
| 411 |
+
"source": [
|
| 412 |
+
"## Split regions based on their overlap with Enformer split"
|
| 413 |
+
]
|
| 414 |
+
},
|
| 415 |
+
{
|
| 416 |
+
"cell_type": "code",
|
| 417 |
+
"execution_count": 7,
|
| 418 |
+
"id": "86d33170-ccb8-4245-9e7e-c12f1ca9fb2f",
|
| 419 |
+
"metadata": {},
|
| 420 |
+
"outputs": [],
|
| 421 |
+
"source": [
|
| 422 |
+
"chromhmm = chromhmm.reset_index(drop=True)\n",
|
| 423 |
+
"chromhmm['interval_idx'] = range(len(chromhmm))"
|
| 424 |
+
]
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"cell_type": "code",
|
| 428 |
+
"execution_count": 8,
|
| 429 |
+
"id": "6d7628c5-3e70-4835-8c04-b6d193490419",
|
| 430 |
+
"metadata": {},
|
| 431 |
+
"outputs": [
|
| 432 |
+
{
|
| 433 |
+
"data": {
|
| 434 |
+
"text/plain": [
|
| 435 |
+
"split_\n",
|
| 436 |
+
"train 4963283\n",
|
| 437 |
+
"test 402392\n",
|
| 438 |
+
"valid 363619\n",
|
| 439 |
+
"None 76215\n",
|
| 440 |
+
"testtrain 1606\n",
|
| 441 |
+
"trainvalid 1221\n",
|
| 442 |
+
"testvalid 768\n",
|
| 443 |
+
"Name: count, dtype: int64"
|
| 444 |
+
]
|
| 445 |
+
},
|
| 446 |
+
"execution_count": 8,
|
| 447 |
+
"metadata": {},
|
| 448 |
+
"output_type": "execute_result"
|
| 449 |
+
}
|
| 450 |
+
],
|
| 451 |
+
"source": [
|
| 452 |
+
"import bioframe as bf\n",
|
| 453 |
+
"overlaps = bf.overlap(chromhmm, enformer_intervals, how='left')\n",
|
| 454 |
+
"overlaps.split_ = overlaps.split_.fillna('None')\n",
|
| 455 |
+
"\n",
|
| 456 |
+
"overlaps = overlaps.groupby('interval_idx').split_.apply(lambda x: ''.join(list(np.unique(x))))\n",
|
| 457 |
+
"overlaps.value_counts()"
|
| 458 |
+
]
|
| 459 |
+
},
|
| 460 |
+
{
|
| 461 |
+
"cell_type": "code",
|
| 462 |
+
"execution_count": 9,
|
| 463 |
+
"id": "562e9b6e-aaf3-4c11-82fb-41f8b69d94cf",
|
| 464 |
+
"metadata": {},
|
| 465 |
+
"outputs": [],
|
| 466 |
+
"source": [
|
| 467 |
+
"assert np.all(overlaps.index == chromhmm.interval_idx)"
|
| 468 |
+
]
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"cell_type": "code",
|
| 472 |
+
"execution_count": 10,
|
| 473 |
+
"id": "a43a1227-154f-47f7-90fd-a7fd5f59ce3b",
|
| 474 |
+
"metadata": {},
|
| 475 |
+
"outputs": [
|
| 476 |
+
{
|
| 477 |
+
"data": {
|
| 478 |
+
"text/plain": [
|
| 479 |
+
"train 5042325\n",
|
| 480 |
+
"test 402392\n",
|
| 481 |
+
"valid 364387\n",
|
| 482 |
+
"Name: count, dtype: int64"
|
| 483 |
+
]
|
| 484 |
+
},
|
| 485 |
+
"execution_count": 10,
|
| 486 |
+
"metadata": {},
|
| 487 |
+
"output_type": "execute_result"
|
| 488 |
+
}
|
| 489 |
+
],
|
| 490 |
+
"source": [
|
| 491 |
+
"new_splits = np.array(['train'] * len(overlaps))\n",
|
| 492 |
+
"new_splits[[(('valid' in x) and ('train' not in x)) for x in overlaps]] = 'valid'\n",
|
| 493 |
+
"new_splits[[(('test' in x) and ('train' not in x) and ('valid' not in x)) for x in overlaps]] = 'test'\n",
|
| 494 |
+
"pd.Series(new_splits).value_counts()"
|
| 495 |
+
]
|
| 496 |
+
},
|
| 497 |
+
{
|
| 498 |
+
"cell_type": "code",
|
| 499 |
+
"execution_count": 11,
|
| 500 |
+
"id": "04c0bede-0f36-4d07-bd81-7988ca856c09",
|
| 501 |
+
"metadata": {},
|
| 502 |
+
"outputs": [],
|
| 503 |
+
"source": [
|
| 504 |
+
"chromhmm['enformer_split'] = overlaps\n",
|
| 505 |
+
"chromhmm['split'] = new_splits"
|
| 506 |
+
]
|
| 507 |
+
},
|
| 508 |
+
{
|
| 509 |
+
"cell_type": "markdown",
|
| 510 |
+
"id": "7dbf9d8a-aa8f-45b0-a572-e7e3a6abb607",
|
| 511 |
+
"metadata": {},
|
| 512 |
+
"source": [
|
| 513 |
+
"## Save dataset"
|
| 514 |
+
]
|
| 515 |
+
},
|
| 516 |
+
{
|
| 517 |
+
"cell_type": "code",
|
| 518 |
+
"execution_count": 12,
|
| 519 |
+
"id": "801efe31-dfbc-4052-81bf-9b1de399c8f3",
|
| 520 |
+
"metadata": {},
|
| 521 |
+
"outputs": [],
|
| 522 |
+
"source": [
|
| 523 |
+
"chromhmm.to_csv('chromhmm.csv.gz', index=False) "
|
| 524 |
+
]
|
| 525 |
+
},
|
| 526 |
+
{
|
| 527 |
+
"cell_type": "code",
|
| 528 |
+
"execution_count": 13,
|
| 529 |
+
"id": "be914f0c-da00-4b1a-820b-8d61d6725b70",
|
| 530 |
+
"metadata": {},
|
| 531 |
+
"outputs": [
|
| 532 |
+
{
|
| 533 |
+
"data": {
|
| 534 |
+
"text/plain": [
|
| 535 |
+
"<Artifact dataset>"
|
| 536 |
+
]
|
| 537 |
+
},
|
| 538 |
+
"execution_count": 13,
|
| 539 |
+
"metadata": {},
|
| 540 |
+
"output_type": "execute_result"
|
| 541 |
+
}
|
| 542 |
+
],
|
| 543 |
+
"source": [
|
| 544 |
+
"artifact = wandb.Artifact('dataset', type='dataset')\n",
|
| 545 |
+
"artifact.add_file(local_path='chromhmm.csv.gz', name='data.csv.gz')\n",
|
| 546 |
+
"run.log_artifact(artifact)"
|
| 547 |
+
]
|
| 548 |
+
},
|
| 549 |
+
{
|
| 550 |
+
"cell_type": "code",
|
| 551 |
+
"execution_count": 14,
|
| 552 |
+
"id": "7afe340f-d1cd-43d1-a6ce-0db10c2e2e63",
|
| 553 |
+
"metadata": {},
|
| 554 |
+
"outputs": [
|
| 555 |
+
{
|
| 556 |
+
"data": {
|
| 557 |
+
"text/html": [],
|
| 558 |
+
"text/plain": [
|
| 559 |
+
"<IPython.core.display.HTML object>"
|
| 560 |
+
]
|
| 561 |
+
},
|
| 562 |
+
"metadata": {},
|
| 563 |
+
"output_type": "display_data"
|
| 564 |
+
},
|
| 565 |
+
{
|
| 566 |
+
"data": {
|
| 567 |
+
"text/html": [
|
| 568 |
+
" View run <strong style=\"color:#cdcd00\">prep</strong> at: <a href='https://wandb.ai/grelu/human-chromhmm-fullstack/runs/8fux0bft' target=\"_blank\">https://wandb.ai/grelu/human-chromhmm-fullstack/runs/8fux0bft</a><br> View project at: <a href='https://wandb.ai/grelu/human-chromhmm-fullstack' target=\"_blank\">https://wandb.ai/grelu/human-chromhmm-fullstack</a><br>Synced 6 W&B file(s), 0 media file(s), 2 artifact file(s) and 0 other file(s)"
|
| 569 |
+
],
|
| 570 |
+
"text/plain": [
|
| 571 |
+
"<IPython.core.display.HTML object>"
|
| 572 |
+
]
|
| 573 |
+
},
|
| 574 |
+
"metadata": {},
|
| 575 |
+
"output_type": "display_data"
|
| 576 |
+
},
|
| 577 |
+
{
|
| 578 |
+
"data": {
|
| 579 |
+
"text/html": [
|
| 580 |
+
"Find logs at: <code>./wandb/run-20250306_045811-8fux0bft/logs</code>"
|
| 581 |
+
],
|
| 582 |
+
"text/plain": [
|
| 583 |
+
"<IPython.core.display.HTML object>"
|
| 584 |
+
]
|
| 585 |
+
},
|
| 586 |
+
"metadata": {},
|
| 587 |
+
"output_type": "display_data"
|
| 588 |
+
}
|
| 589 |
+
],
|
| 590 |
+
"source": [
|
| 591 |
+
"run.finish()"
|
| 592 |
+
]
|
| 593 |
+
},
|
| 594 |
+
{
|
| 595 |
+
"cell_type": "code",
|
| 596 |
+
"execution_count": null,
|
| 597 |
+
"id": "46094f9a-324c-45ef-acf1-051c7d7ebe3d",
|
| 598 |
+
"metadata": {},
|
| 599 |
+
"outputs": [],
|
| 600 |
+
"source": []
|
| 601 |
+
}
|
| 602 |
+
],
|
| 603 |
+
"metadata": {
|
| 604 |
+
"kernelspec": {
|
| 605 |
+
"display_name": "Python 3 (ipykernel)",
|
| 606 |
+
"language": "python",
|
| 607 |
+
"name": "python3"
|
| 608 |
+
},
|
| 609 |
+
"language_info": {
|
| 610 |
+
"codemirror_mode": {
|
| 611 |
+
"name": "ipython",
|
| 612 |
+
"version": 3
|
| 613 |
+
},
|
| 614 |
+
"file_extension": ".py",
|
| 615 |
+
"mimetype": "text/x-python",
|
| 616 |
+
"name": "python",
|
| 617 |
+
"nbconvert_exporter": "python",
|
| 618 |
+
"pygments_lexer": "ipython3",
|
| 619 |
+
"version": "3.11.9"
|
| 620 |
+
}
|
| 621 |
+
},
|
| 622 |
+
"nbformat": 4,
|
| 623 |
+
"nbformat_minor": 5
|
| 624 |
+
}
|
README.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
tags:
|
| 6 |
+
- biology
|
| 7 |
+
- genomics
|
| 8 |
+
pretty_name: "ChromHMM fullstack annotation of the human genome"
|
| 9 |
+
size_categories:
|
| 10 |
+
- 1M<n<10M
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# human-chromhmm-fullstack
|
| 14 |
+
|
| 15 |
+
## Dataset Summary
|
| 16 |
+
This dataset provides a multi-class annotation of genomic regions across the hg38 genome. It is derived from the ChromHMM fullstack annotation (Vu & Ernst, 2022; https://doi.org/10.1186/s13059-021-02572-z). Genomic regions are classified into 16 states. The data is derived from https://public.hoffman2.idre.ucla.edu/ernst/2K9RS//full_stack/full_stack_annotation_public_release/hg38/hg38_genome_100_segments.bed.gz.
|
| 17 |
+
|
| 18 |
+
## Repository Content
|
| 19 |
+
1. `data.csv`: The main dataset stored in comma-separated tabular format.
|
| 20 |
+
2. `1_data.ipynb`: Jupyter notebook containing the preprocessing steps used to generate the `.csv` file.
|
| 21 |
+
|
| 22 |
+
## Dataset Structure
|
| 23 |
+
|
| 24 |
+
| Column | Type | Description |
|
| 25 |
+
| :--- | :--- | :--- |
|
| 26 |
+
| chrom | string | Chromosome name (e.g., chr1) |
|
| 27 |
+
| start | int | Start coordinate of the genomic interval |
|
| 28 |
+
| end | int | End coordinate of the genomic interval |
|
| 29 |
+
| state | string | Chromatin state annotation (e.g., EnhWk, Quies) |
|
| 30 |
+
| interval_idx | int | Unique numerical index for the specific genomic interval |
|
| 31 |
+
| enformer_split | string | Overlap with the data splits used for training the Enformer model |
|
| 32 |
+
| split | string |Splits used for downstream modeling (training/validation/test) |
|
| 33 |
+
|
| 34 |
+
## Usage
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
import pandas as pd
|
| 38 |
+
from huggingface_hub import hf_hub_download
|
| 39 |
+
|
| 40 |
+
file_path = hf_hub_download(
|
| 41 |
+
repo_id="Genentech/human-chromhmm-fullstack-data",
|
| 42 |
+
filename="data.csv"
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
df = pd.read_csv(file_path)
|
| 46 |
+
```
|
data.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7a827f9fa2d26e924fa134ae16edeb4cccd65bb5e93e5e6c636ed489da3b5ad1
|
| 3 |
+
size 284326235
|