Skip to content

Commit 2a06d15

Browse files
Lucas CamilloLucas Camillo
Lucas Camillo
authored and
Lucas Camillo
committed
updated docs
1 parent 429845d commit 2a06d15

File tree

4 files changed

+55
-285
lines changed

4 files changed

+55
-285
lines changed

clocks/notebooks/zhangblup.ipynb

+26-142
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,7 @@
3939
"cell_type": "code",
4040
"execution_count": 1,
4141
"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": {},
5043
"outputs": [],
5144
"source": [
5245
"import os\n",
@@ -70,14 +63,7 @@
7063
"cell_type": "code",
7164
"execution_count": 2,
7265
"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": {},
8167
"outputs": [
8268
{
8369
"name": "stdout",
@@ -118,14 +104,7 @@
118104
"cell_type": "code",
119105
"execution_count": 3,
120106
"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": {},
129108
"outputs": [],
130109
"source": [
131110
"model = pya.models.ZhangBLUP()"
@@ -143,23 +122,16 @@
143122
"cell_type": "code",
144123
"execution_count": 4,
145124
"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": {},
154126
"outputs": [],
155127
"source": [
156128
"model.metadata[\"clock_name\"] = 'zhangblup'\n",
157129
"model.metadata[\"data_type\"] = 'methylation'\n",
158130
"model.metadata[\"species\"] = 'Homo sapiens'\n",
159-
"model.metadata[\"year\"] = 2023\n",
131+
"model.metadata[\"year\"] = 2019\n",
160132
"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",
163135
"model.metadata[\"notes\"] = None"
164136
]
165137
},
@@ -183,14 +155,7 @@
183155
"cell_type": "code",
184156
"execution_count": 5,
185157
"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": {},
194159
"outputs": [
195160
{
196161
"data": {
@@ -221,14 +186,7 @@
221186
"cell_type": "code",
222187
"execution_count": 6,
223188
"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": {},
232190
"outputs": [
233191
{
234192
"name": "stdout",
@@ -250,14 +208,7 @@
250208
"cell_type": "code",
251209
"execution_count": 7,
252210
"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": {},
261212
"outputs": [
262213
{
263214
"data": {
@@ -294,14 +245,7 @@
294245
"cell_type": "code",
295246
"execution_count": 8,
296247
"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": {},
305249
"outputs": [],
306250
"source": [
307251
"df = pd.read_table('DNAm-based-age-predictor/blup.coef', sep=' ')\n",
@@ -323,14 +267,7 @@
323267
"cell_type": "code",
324268
"execution_count": 9,
325269
"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": {},
334271
"outputs": [],
335272
"source": [
336273
"weights = torch.tensor(df['coefficient'][1:].tolist()).unsqueeze(0)\n",
@@ -349,14 +286,7 @@
349286
"cell_type": "code",
350287
"execution_count": 10,
351288
"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": {},
360290
"outputs": [],
361291
"source": [
362292
"base_model = pya.models.LinearModel(input_dim=len(model.features))\n",
@@ -387,14 +317,7 @@
387317
"cell_type": "code",
388318
"execution_count": 11,
389319
"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": {},
398321
"outputs": [],
399322
"source": [
400323
"reference_feature_values_df = pd.read_csv('example_data.csv', index_col=0)\n",
@@ -414,14 +337,7 @@
414337
"cell_type": "code",
415338
"execution_count": 12,
416339
"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": {},
425341
"outputs": [],
426342
"source": [
427343
"model.preprocess_name = 'scale_row'\n",
@@ -432,14 +348,7 @@
432348
"cell_type": "code",
433349
"execution_count": 13,
434350
"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": {},
443352
"outputs": [],
444353
"source": [
445354
"model.postprocess_name = None\n",
@@ -458,14 +367,7 @@
458367
"cell_type": "code",
459368
"execution_count": 14,
460369
"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": {},
469371
"outputs": [
470372
{
471373
"name": "stdout",
@@ -477,14 +379,16 @@
477379
"\n",
478380
"training: True\n",
479381
"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",
481385
" 'clock_name': 'zhangblup',\n",
482386
" 'data_type': 'methylation',\n",
483-
" 'doi': 'doi',\n",
387+
" 'doi': 'https://doi.org/10.1186/s13073-019-0667-1',\n",
484388
" 'notes': None,\n",
485389
" 'species': 'Homo sapiens',\n",
486390
" 'version': None,\n",
487-
" 'year': 2023}\n",
391+
" 'year': 2019}\n",
488392
"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",
489393
"preprocess_name: 'scale_row'\n",
490394
"preprocess_dependencies: None\n",
@@ -527,14 +431,7 @@
527431
"cell_type": "code",
528432
"execution_count": 15,
529433
"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": {},
538435
"outputs": [
539436
{
540437
"data": {
@@ -577,14 +474,7 @@
577474
"cell_type": "code",
578475
"execution_count": 16,
579476
"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": {},
588478
"outputs": [],
589479
"source": [
590480
"torch.save(model, f\"../weights/{model.metadata['clock_name']}.pt\")"
@@ -603,20 +493,14 @@
603493
"cell_type": "code",
604494
"execution_count": 17,
605495
"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": {},
614497
"outputs": [
615498
{
616499
"name": "stdout",
617500
"output_type": "stream",
618501
"text": [
619502
"Deleted file: download.r\n",
503+
"Deleted folder: .ipynb_checkpoints\n",
620504
"Deleted folder: DNAm-based-age-predictor\n",
621505
"Deleted file: example_data.csv\n"
622506
]

0 commit comments

Comments
 (0)