|
39 | 39 | "cell_type": "code",
|
40 | 40 | "execution_count": 1,
|
41 | 41 | "id": "4adfb4de-cd79-4913-a1af-9e23e9e236c9",
|
42 |
| - "metadata": { |
43 |
| - "execution": { |
44 |
| - "iopub.execute_input": "2024-01-21T18:59:42.539377Z", |
45 |
| - "iopub.status.busy": "2024-01-21T18:59:42.539068Z", |
46 |
| - "iopub.status.idle": "2024-01-21T18:59:44.507365Z", |
47 |
| - "shell.execute_reply": "2024-01-21T18:59:44.506899Z" |
48 |
| - } |
49 |
| - }, |
| 42 | + "metadata": {}, |
50 | 43 | "outputs": [],
|
51 | 44 | "source": [
|
52 | 45 | "import os\n",
|
|
70 | 63 | "cell_type": "code",
|
71 | 64 | "execution_count": 2,
|
72 | 65 | "id": "8aa77372-7ed3-4da7-abc9-d30372106139",
|
73 |
| - "metadata": { |
74 |
| - "execution": { |
75 |
| - "iopub.execute_input": "2024-01-21T18:59:44.509708Z", |
76 |
| - "iopub.status.busy": "2024-01-21T18:59:44.509468Z", |
77 |
| - "iopub.status.idle": "2024-01-21T18:59:44.519431Z", |
78 |
| - "shell.execute_reply": "2024-01-21T18:59:44.519147Z" |
79 |
| - } |
80 |
| - }, |
| 66 | + "metadata": {}, |
81 | 67 | "outputs": [
|
82 | 68 | {
|
83 | 69 | "name": "stdout",
|
|
118 | 104 | "cell_type": "code",
|
119 | 105 | "execution_count": 3,
|
120 | 106 | "id": "78536494-f1d9-44de-8583-c89a310d2307",
|
121 |
| - "metadata": { |
122 |
| - "execution": { |
123 |
| - "iopub.execute_input": "2024-01-21T18:59:44.521139Z", |
124 |
| - "iopub.status.busy": "2024-01-21T18:59:44.521008Z", |
125 |
| - "iopub.status.idle": "2024-01-21T18:59:44.522842Z", |
126 |
| - "shell.execute_reply": "2024-01-21T18:59:44.522540Z" |
127 |
| - } |
128 |
| - }, |
| 107 | + "metadata": {}, |
129 | 108 | "outputs": [],
|
130 | 109 | "source": [
|
131 | 110 | "model = pya.models.ZhangBLUP()"
|
|
143 | 122 | "cell_type": "code",
|
144 | 123 | "execution_count": 4,
|
145 | 124 | "id": "6601da9e-8adc-44ee-9308-75e3cd31b816",
|
146 |
| - "metadata": { |
147 |
| - "execution": { |
148 |
| - "iopub.execute_input": "2024-01-21T18:59:44.524665Z", |
149 |
| - "iopub.status.busy": "2024-01-21T18:59:44.524548Z", |
150 |
| - "iopub.status.idle": "2024-01-21T18:59:44.526636Z", |
151 |
| - "shell.execute_reply": "2024-01-21T18:59:44.526352Z" |
152 |
| - } |
153 |
| - }, |
| 125 | + "metadata": {}, |
154 | 126 | "outputs": [],
|
155 | 127 | "source": [
|
156 | 128 | "model.metadata[\"clock_name\"] = 'zhangblup'\n",
|
157 | 129 | "model.metadata[\"data_type\"] = 'methylation'\n",
|
158 | 130 | "model.metadata[\"species\"] = 'Homo sapiens'\n",
|
159 |
| - "model.metadata[\"year\"] = 2023\n", |
| 131 | + "model.metadata[\"year\"] = 2019\n", |
160 | 132 | "model.metadata[\"approved_by_author\"] = '⌛'\n",
|
161 |
| - "model.metadata[\"citation\"] = \"citation\"\n", |
162 |
| - "model.metadata[\"doi\"] = 'doi'\n", |
| 133 | + "model.metadata[\"citation\"] = \"Zhang, Qian, et al. \\\"Improved precision of epigenetic clock estimates across tissues and its implication for biological ageing.\\\" Genome medicine 11 (2019): 1-11.\"\n", |
| 134 | + "model.metadata[\"doi\"] = 'https://doi.org/10.1186/s13073-019-0667-1'\n", |
163 | 135 | "model.metadata[\"notes\"] = None"
|
164 | 136 | ]
|
165 | 137 | },
|
|
183 | 155 | "cell_type": "code",
|
184 | 156 | "execution_count": 5,
|
185 | 157 | "id": "0ee560a3-8ab6-4202-b8b2-cebf75089bfb",
|
186 |
| - "metadata": { |
187 |
| - "execution": { |
188 |
| - "iopub.execute_input": "2024-01-21T18:59:44.528981Z", |
189 |
| - "iopub.status.busy": "2024-01-21T18:59:44.528811Z", |
190 |
| - "iopub.status.idle": "2024-01-21T18:59:51.075890Z", |
191 |
| - "shell.execute_reply": "2024-01-21T18:59:51.075577Z" |
192 |
| - } |
193 |
| - }, |
| 158 | + "metadata": {}, |
194 | 159 | "outputs": [
|
195 | 160 | {
|
196 | 161 | "data": {
|
|
221 | 186 | "cell_type": "code",
|
222 | 187 | "execution_count": 6,
|
223 | 188 | "id": "3460ce9a-719e-494c-9a94-21fc97dd0be4",
|
224 |
| - "metadata": { |
225 |
| - "execution": { |
226 |
| - "iopub.execute_input": "2024-01-21T18:59:51.077727Z", |
227 |
| - "iopub.status.busy": "2024-01-21T18:59:51.077607Z", |
228 |
| - "iopub.status.idle": "2024-01-21T18:59:51.080045Z", |
229 |
| - "shell.execute_reply": "2024-01-21T18:59:51.079767Z" |
230 |
| - } |
231 |
| - }, |
| 189 | + "metadata": {}, |
232 | 190 | "outputs": [
|
233 | 191 | {
|
234 | 192 | "name": "stdout",
|
|
250 | 208 | "cell_type": "code",
|
251 | 209 | "execution_count": 7,
|
252 | 210 | "id": "11ba180b-0ca9-40e0-8a89-72bc4e085451",
|
253 |
| - "metadata": { |
254 |
| - "execution": { |
255 |
| - "iopub.execute_input": "2024-01-21T18:59:51.081597Z", |
256 |
| - "iopub.status.busy": "2024-01-21T18:59:51.081474Z", |
257 |
| - "iopub.status.idle": "2024-01-21T18:59:55.241288Z", |
258 |
| - "shell.execute_reply": "2024-01-21T18:59:55.240783Z" |
259 |
| - } |
260 |
| - }, |
| 211 | + "metadata": {}, |
261 | 212 | "outputs": [
|
262 | 213 | {
|
263 | 214 | "data": {
|
|
294 | 245 | "cell_type": "code",
|
295 | 246 | "execution_count": 8,
|
296 | 247 | "id": "8a3d5de6-6303-487a-8b4d-e6345792f7be",
|
297 |
| - "metadata": { |
298 |
| - "execution": { |
299 |
| - "iopub.execute_input": "2024-01-21T18:59:55.243334Z", |
300 |
| - "iopub.status.busy": "2024-01-21T18:59:55.243217Z", |
301 |
| - "iopub.status.idle": "2024-01-21T18:59:55.369866Z", |
302 |
| - "shell.execute_reply": "2024-01-21T18:59:55.369401Z" |
303 |
| - } |
304 |
| - }, |
| 248 | + "metadata": {}, |
305 | 249 | "outputs": [],
|
306 | 250 | "source": [
|
307 | 251 | "df = pd.read_table('DNAm-based-age-predictor/blup.coef', sep=' ')\n",
|
|
323 | 267 | "cell_type": "code",
|
324 | 268 | "execution_count": 9,
|
325 | 269 | "id": "e09b3463-4fd4-41b1-ac21-e63ddd223fe0",
|
326 |
| - "metadata": { |
327 |
| - "execution": { |
328 |
| - "iopub.execute_input": "2024-01-21T18:59:55.372739Z", |
329 |
| - "iopub.status.busy": "2024-01-21T18:59:55.372580Z", |
330 |
| - "iopub.status.idle": "2024-01-21T18:59:55.399665Z", |
331 |
| - "shell.execute_reply": "2024-01-21T18:59:55.399331Z" |
332 |
| - } |
333 |
| - }, |
| 270 | + "metadata": {}, |
334 | 271 | "outputs": [],
|
335 | 272 | "source": [
|
336 | 273 | "weights = torch.tensor(df['coefficient'][1:].tolist()).unsqueeze(0)\n",
|
|
349 | 286 | "cell_type": "code",
|
350 | 287 | "execution_count": 10,
|
351 | 288 | "id": "d7f43b99-26f2-4622-9a76-316712058877",
|
352 |
| - "metadata": { |
353 |
| - "execution": { |
354 |
| - "iopub.execute_input": "2024-01-21T18:59:55.402623Z", |
355 |
| - "iopub.status.busy": "2024-01-21T18:59:55.402465Z", |
356 |
| - "iopub.status.idle": "2024-01-21T18:59:55.405926Z", |
357 |
| - "shell.execute_reply": "2024-01-21T18:59:55.405598Z" |
358 |
| - } |
359 |
| - }, |
| 289 | + "metadata": {}, |
360 | 290 | "outputs": [],
|
361 | 291 | "source": [
|
362 | 292 | "base_model = pya.models.LinearModel(input_dim=len(model.features))\n",
|
|
387 | 317 | "cell_type": "code",
|
388 | 318 | "execution_count": 11,
|
389 | 319 | "id": "86de757f-fb38-4bcb-b91e-fc3372d22aad",
|
390 |
| - "metadata": { |
391 |
| - "execution": { |
392 |
| - "iopub.execute_input": "2024-01-21T18:59:55.407742Z", |
393 |
| - "iopub.status.busy": "2024-01-21T18:59:55.407650Z", |
394 |
| - "iopub.status.idle": "2024-01-21T19:00:12.695748Z", |
395 |
| - "shell.execute_reply": "2024-01-21T19:00:12.695248Z" |
396 |
| - } |
397 |
| - }, |
| 320 | + "metadata": {}, |
398 | 321 | "outputs": [],
|
399 | 322 | "source": [
|
400 | 323 | "reference_feature_values_df = pd.read_csv('example_data.csv', index_col=0)\n",
|
|
414 | 337 | "cell_type": "code",
|
415 | 338 | "execution_count": 12,
|
416 | 339 | "id": "7a22fb20-c605-424d-8efb-7620c2c0755c",
|
417 |
| - "metadata": { |
418 |
| - "execution": { |
419 |
| - "iopub.execute_input": "2024-01-21T19:00:12.698719Z", |
420 |
| - "iopub.status.busy": "2024-01-21T19:00:12.698492Z", |
421 |
| - "iopub.status.idle": "2024-01-21T19:00:12.700373Z", |
422 |
| - "shell.execute_reply": "2024-01-21T19:00:12.700093Z" |
423 |
| - } |
424 |
| - }, |
| 340 | + "metadata": {}, |
425 | 341 | "outputs": [],
|
426 | 342 | "source": [
|
427 | 343 | "model.preprocess_name = 'scale_row'\n",
|
|
432 | 348 | "cell_type": "code",
|
433 | 349 | "execution_count": 13,
|
434 | 350 | "id": "ff4a21cb-cf41-44dc-9ed1-95cf8aa15772",
|
435 |
| - "metadata": { |
436 |
| - "execution": { |
437 |
| - "iopub.execute_input": "2024-01-21T19:00:12.702036Z", |
438 |
| - "iopub.status.busy": "2024-01-21T19:00:12.701921Z", |
439 |
| - "iopub.status.idle": "2024-01-21T19:00:12.703538Z", |
440 |
| - "shell.execute_reply": "2024-01-21T19:00:12.703183Z" |
441 |
| - } |
442 |
| - }, |
| 351 | + "metadata": {}, |
443 | 352 | "outputs": [],
|
444 | 353 | "source": [
|
445 | 354 | "model.postprocess_name = None\n",
|
|
458 | 367 | "cell_type": "code",
|
459 | 368 | "execution_count": 14,
|
460 | 369 | "id": "2168355c-47d9-475d-b816-49f65e74887c",
|
461 |
| - "metadata": { |
462 |
| - "execution": { |
463 |
| - "iopub.execute_input": "2024-01-21T19:00:12.705363Z", |
464 |
| - "iopub.status.busy": "2024-01-21T19:00:12.705242Z", |
465 |
| - "iopub.status.idle": "2024-01-21T19:00:12.708681Z", |
466 |
| - "shell.execute_reply": "2024-01-21T19:00:12.708328Z" |
467 |
| - } |
468 |
| - }, |
| 370 | + "metadata": {}, |
469 | 371 | "outputs": [
|
470 | 372 | {
|
471 | 373 | "name": "stdout",
|
|
477 | 379 | "\n",
|
478 | 380 | "training: True\n",
|
479 | 381 | "metadata: {'approved_by_author': '⌛',\n",
|
480 |
| - " 'citation': 'citation',\n", |
| 382 | + " 'citation': 'Zhang, Qian, et al. \"Improved precision of epigenetic clock '\n", |
| 383 | + " 'estimates across tissues and its implication for biological '\n", |
| 384 | + " 'ageing.\" Genome medicine 11 (2019): 1-11.',\n", |
481 | 385 | " 'clock_name': 'zhangblup',\n",
|
482 | 386 | " 'data_type': 'methylation',\n",
|
483 |
| - " 'doi': 'doi',\n", |
| 387 | + " 'doi': 'https://doi.org/10.1186/s13073-019-0667-1',\n", |
484 | 388 | " 'notes': None,\n",
|
485 | 389 | " 'species': 'Homo sapiens',\n",
|
486 | 390 | " 'version': None,\n",
|
487 |
| - " 'year': 2023}\n", |
| 391 | + " 'year': 2019}\n", |
488 | 392 | "reference_values: [0.05946290980445651, 0.9016779859564634, 0.8511621554128406, 0.07497523935546724, 0.08079601941558237, 0.13789119095690058, 0.959990162673912, 0.054840405638908254, 0.11271586156940745, 0.06867464793155438, 0.04092332774669377, 0.03122014881875939, 0.12091171597794977, 0.8626077673429406, 0.02002095456899887, 0.037161243530447204, 0.5228131230887364, 0.025038065219011623, 0.03411737762225109, 0.023966201717807785, 0.13213191286915785, 0.03613520841142101, 0.11053625925027737, 0.09303164766153527, 0.07697707482010466, 0.040677518106921974, 0.016422537053260692, 0.01646509240082735, 0.9634930275356334, 0.8664078943468241]... [Total elements: 319607]\n",
|
489 | 393 | "preprocess_name: 'scale_row'\n",
|
490 | 394 | "preprocess_dependencies: None\n",
|
|
527 | 431 | "cell_type": "code",
|
528 | 432 | "execution_count": 15,
|
529 | 433 | "id": "936b9877-d076-4ced-99aa-e8d4c58c5caf",
|
530 |
| - "metadata": { |
531 |
| - "execution": { |
532 |
| - "iopub.execute_input": "2024-01-21T19:00:12.710566Z", |
533 |
| - "iopub.status.busy": "2024-01-21T19:00:12.710462Z", |
534 |
| - "iopub.status.idle": "2024-01-21T19:00:12.777144Z", |
535 |
| - "shell.execute_reply": "2024-01-21T19:00:12.776841Z" |
536 |
| - } |
537 |
| - }, |
| 434 | + "metadata": {}, |
538 | 435 | "outputs": [
|
539 | 436 | {
|
540 | 437 | "data": {
|
|
577 | 474 | "cell_type": "code",
|
578 | 475 | "execution_count": 16,
|
579 | 476 | "id": "5ef2fa8d-c80b-4fdd-8555-79c0d541788e",
|
580 |
| - "metadata": { |
581 |
| - "execution": { |
582 |
| - "iopub.execute_input": "2024-01-21T19:00:12.779052Z", |
583 |
| - "iopub.status.busy": "2024-01-21T19:00:12.778922Z", |
584 |
| - "iopub.status.idle": "2024-01-21T19:00:12.941402Z", |
585 |
| - "shell.execute_reply": "2024-01-21T19:00:12.941044Z" |
586 |
| - } |
587 |
| - }, |
| 477 | + "metadata": {}, |
588 | 478 | "outputs": [],
|
589 | 479 | "source": [
|
590 | 480 | "torch.save(model, f\"../weights/{model.metadata['clock_name']}.pt\")"
|
|
603 | 493 | "cell_type": "code",
|
604 | 494 | "execution_count": 17,
|
605 | 495 | "id": "11aeaa70-44c0-42f9-86d7-740e3849a7a6",
|
606 |
| - "metadata": { |
607 |
| - "execution": { |
608 |
| - "iopub.execute_input": "2024-01-21T19:00:12.943436Z", |
609 |
| - "iopub.status.busy": "2024-01-21T19:00:12.943316Z", |
610 |
| - "iopub.status.idle": "2024-01-21T19:00:12.953172Z", |
611 |
| - "shell.execute_reply": "2024-01-21T19:00:12.952855Z" |
612 |
| - } |
613 |
| - }, |
| 496 | + "metadata": {}, |
614 | 497 | "outputs": [
|
615 | 498 | {
|
616 | 499 | "name": "stdout",
|
617 | 500 | "output_type": "stream",
|
618 | 501 | "text": [
|
619 | 502 | "Deleted file: download.r\n",
|
| 503 | + "Deleted folder: .ipynb_checkpoints\n", |
620 | 504 | "Deleted folder: DNAm-based-age-predictor\n",
|
621 | 505 | "Deleted file: example_data.csv\n"
|
622 | 506 | ]
|
|
0 commit comments