diff --git a/biolearn/data/MiAge.csv b/biolearn/data/MiAge.csv index cea4762..8c84485 100644 --- a/biolearn/data/MiAge.csv +++ b/biolearn/data/MiAge.csv @@ -1,269 +1,269 @@ -CpGmarker,CoefficientTraining -cg11823511,Age-hyper -cg12212311,Age-hyper -cg17760405,Age-hyper -cg17757602,Age-hyper -cg05937737,Age-hyper -cg01923218,Age-hyper -cg21264189,Age-hyper -cg09053680,Age-hyper -cg22802813,Age-hyper -cg21334513,Age-hyper -cg17034390,Age-hyper -cg07783282,Age-hyper -cg08445802,Age-hyper -cg02874376,Age-hyper -cg24708471,Age-hyper -cg25285090,Age-hyper -cg17265829,Age-hyper -cg27282900,Age-hyper -cg14192957,Age-hyper -cg03409187,Age-hyper -cg23189410,Age-hyper -cg17794299,Age-hyper -cg26267854,Age-hyper -cg11205072,Age-hyper -cg05372113,Age-hyper -cg17694795,Age-hyper -cg11149930,Age-hyper -cg18488157,Age-hyper -cg17078116,Age-hyper -cg00437985,Age-hyper -cg13954457,Age-hyper -cg05745631,Age-hyper -cg08701621,Age-hyper -cg06794543,Age-hyper -cg06607764,Age-hyper -cg19841369,Age-hyper -cg06454760,Age-hyper -cg15909981,Age-hyper -cg13201808,Age-hyper -cg08847173,Age-hyper -cg00370229,Age-hyper -cg04007726,Age-hyper -cg04118306,Age-hyper -cg21136104,Age-hyper -cg17812788,Age-hyper -cg18687675,Age-hyper -cg14627172,Age-hyper -cg14822490,Age-hyper -cg12188986,Age-hyper -cg05525743,Age-hyper -cg09907936,Age-hyper -cg07766263,Age-hyper -cg21730858,Age-hyper -cg12492087,Age-hyper -cg02895639,Age-hyper -cg26709285,Age-hyper -cg00689492,Age-hyper -cg15490715,Age-hyper -cg25537993,Age-hyper -cg04599403,Age-hyper -cg19761848,Age-hyper -cg22727783,Age-hyper -cg13879776,Age-hyper -cg19947104,Age-hyper -cg00303982,Age-hyper -cg04484550,Age-hyper -cg19971388,Age-hyper -cg11324957,Age-hyper -cg00298065,Age-hyper -cg04191427,Age-hyper -cg04958794,Age-hyper -cg04293085,Age-hyper -cg02049405,Age-hyper -cg17434309,Age-hyper -cg05068206,Age-hyper -cg26890189,Age-hyper -cg05206884,Age-hyper -cg14182974,Age-hyper -cg09660365,Age-hyper -cg03192598,Age-hyper -cg04017533,Age-hyper -cg25247859,Age-hyper -cg24368848,Age-hyper -cg06708634,Age-hyper -cg05080154,Age-hyper -cg12444411,Age-hyper -cg12353688,Age-hyper -cg12215340,Age-hyper -cg00465970,Age-hyper -cg21143896,Age-hyper -cg12046758,Age-hyper -cg09354556,Age-hyper -cg18430128,Age-hyper -cg08843809,Age-hyper -cg18146737,Age-hyper -cg09224821,Age-hyper -cg12250896,Age-hyper -cg14013195,Age-hyper -cg14600824,Age-hyper -cg25975712,Age-hyper -cg11962640,Age-hyper -cg12406391,Age-hyper -cg08390209,Age-hyper -cg18628732,Age-hyper -cg12017745,Age-hyper -cg12399536,Age-hyper -cg22499720,Age-hyper -cg27088072,Age-hyper -cg07105285,Age-hyper -cg19717586,Age-hyper -cg05962092,Age-hyper -cg13434842,Age-hyper -cg02578944,Age-hyper -cg08584759,Age-hyper -cg11052143,Age-hyper -cg22319311,Age-hyper -cg13405332,Age-hyper -cg04716021,Age-hyper -cg13687570,Age-hyper -cg26612727,Age-hyper -cg15691862,Age-hyper -cg26557693,Age-hyper -cg06654118,Age-hyper -cg13933080,Age-hyper -cg00032205,Age-hyper -cg22320365,Age-hyper -cg05803237,Age-hyper -cg15871441,Age-hyper -cg05212464,Age-hyper -cg13878010,Age-hyper -cg15842276,Age-hyper -cg01856529,Age-hyper -cg10018167,Age-hyper -cg01734112,Age-hyper -cg20090283,Age-hyper -cg18530645,Age-hyper -cg04863758,Age-hyper -cg10568066,Age-hyper -cg02473540,Age-hyper -cg00891541,Age-hyper -cg12978433,Age-hyper -cg14137625,Age-hyper -cg14759565,Age-hyper -cg04917181,Age-hyper -cg12633154,Age-hyper -cg15090727,Age-hyper -cg26477792,Age-hyper -cg11599981,Age-hyper -cg16339238,Age-hyper -cg27566403,Age-hyper -cg13389502,Age-hyper -cg02994956,Age-hyper -cg10687131,Age-hyper -cg08013557,Age-hyper -cg09809932,Age-hyper -cg00730887,Age-hyper -cg08244866,Age-hyper -cg10132208,Age-hyper -cg13850380,Age-hyper -cg20234976,Age-hyper -cg05716671,Age-hyper -cg23690893,Age-hyper -cg19804605,Age-hyper -cg27205904,Age-hyper -cg00099869,Age-hyper -cg23111655,Age-hyper -cg01514538,Age-hyper -cg17018096,Age-hyper -cg24931632,Age-hyper -cg18953784,Age-hyper -cg26379258,Age-hyper -cg13451127,Age-hyper -cg13333304,Age-hyper -cg13449778,Age-hyper -cg10978355,Age-hyper -cg12598635,Age-hyper -cg00445518,Age-hyper -cg20449685,Age-hyper -cg24173182,Age-hyper -cg00002033,Age-hyper -cg15066416,Age-hyper -cg10556064,Age-hyper -cg10427868,Age-hyper -cg12025310,Age-hyper -cg24541835,Age-hyper -cg04768479,Age-hyper -cg11510523,Age-hyper -cg04507915,Age-hyper -cg18455390,Age-hyper -cg03734874,Age-hyper -cg17971015,Age-hyper -cg04123310,Age-hyper -cg11312495,Age-hyper -cg19122206,Age-hyper -cg05423393,Age-hyper -cg10107050,Age-hyper -cg20544651,Age-hyper -cg10210806,Age-hyper -cg26114043,Age-hyper -cg06111140,Age-hyper -cg22330763,Age-hyper -cg15774153,Age-hyper -cg04436994,Age-hyper -cg06938705,Age-hyper -cg00750428,Age-hyper -cg26416971,Age-hyper -cg05270106,Age-hyper -cg20260127,Age-hyper -cg01005486,Age-hyper -cg15580417,Age-hyper -cg18255166,Age-hyper -cg23484755,Age-hyper -cg01114124,Age-hyper -cg06432119,Age-hyper -cg04850659,Age-hyper -cg02478023,Age-hyper -cg20322433,Age-hyper -cg11738486,Age-hyper -cg04951371,Age-hyper -cg12934382,Age-hyper -cg01722932,Age-hyper -cg23425533,Age-hyper -cg13346441,Age-hyper -cg22614891,Age-hyper -cg05485462,Age-hyper -cg09709600,Age-hyper -cg04271289,Age-hyper -cg04816394,Age-hyper -cg18653282,Age-hyper -cg08608952,Age-hyper -cg25876443,Age-hyper -cg24413339,Age-hyper -cg02455346,Age-hyper -cg13567542,Age-hyper -cg23114616,Age-hyper -cg00510437,Age-hyper -cg04723343,Age-hyper -cg00388812,Age-hyper -cg00158227,Age-hyper -cg22880770,Age-hyper -cg21697794,Age-hyper -cg15473155,Age-hyper -cg04554929,Age-hyper -cg05535398,Age-hyper -cg19341977,Age-hyper -cg02793099,Age-hyper -cg02773588,Age-hyper -cg10204755,Age-hyper -cg21557724,Age-hyper -cg17250863,Age-hyper -cg17676129,Age-hyper -cg22294267,Age-hyper -cg17029193,Age-hyper -cg08171483,Age-hyper -cg19336198,Age-hyper -cg23830290,Age-hyper -cg03984347,Age-hyper -cg12143651,Age-hyper -cg16624069,Age-hyper -cg09506661,Age-hyper -cg06085683,Age-hyper -cg07004744,Age-hyper -cg07957995,Age-hyper -cg07450698,Age-hyper -cg05395187,Age-hyper -cg14184780,Age-hyper -cg15777825,Age-hyper -cg13126279,Age-hyper +CpG,b,c,d +cg11823511,0.997532178573722,0.521451605677157,-0.354770518960769 +cg12212311,0.999515686071933,0.812465172078029,-0.63583405538151 +cg17760405,0.999733159924055,0.435155243806152,-0.343761639293931 +cg17757602,0.997810270123824,0.524318955013262,-0.328248646772022 +cg05937737,0.998683802451356,0.850180749471286,-0.583592926503214 +cg01923218,0.999872291020431,1.00000078292952,-0.958516549883466 +cg21264189,0.999583009728787,0.810030474652367,-0.810030474752367 +cg09053680,0.999320620365592,0.688664088097486,-0.290893926025459 +cg22802813,0.999874644198272,1.00000079772586,-0.996323180596151 +cg21334513,0.99852807819794,0.667323039065931,-0.359806670166855 +cg17034390,0.998386529635878,0.757582981682659,-0.532300398808018 +cg07783282,0.995465290409981,0.679583119123147,-0.534742235947952 +cg08445802,0.999585014049022,0.700894079891497,-0.677385661718727 +cg02874376,0.997932262303167,0.63873039416935,-0.427930985665093 +cg24708471,0.999909707609692,1.00000110750822,-0.931039704222819 +cg25285090,0.999246401164456,0.898930064763863,-0.616508626014736 +cg17265829,0.99923849317883,0.488126565057554,-0.378185577470863 +cg27282900,0.998323615423546,0.822527091998598,-0.172981995462801 +cg14192957,0.999881284465112,0.999685544534162,-0.571597998795496 +cg03409187,0.99920851432113,0.660856573637179,-0.31381492844688 +cg23189410,0.999744402531991,0.581173323952948,-0.461017528040668 +cg17794299,0.9980068593345,0.614903803291611,-0.48655932296868 +cg26267854,0.999782910888747,0.87956552229003,-0.878947473905085 +cg11205072,0.998959602780355,0.691713999935584,-0.609296939572133 +cg05372113,0.998856474636678,0.849646816199207,-0.180589845590195 +cg17694795,0.999603483628956,0.736707797106889,-0.703613381719689 +cg11149930,0.999585271488541,0.822288259909194,-0.388324574636101 +cg18488157,0.997507545052272,0.890847689158119,-0.594016374361886 +cg17078116,0.998989599018316,0.933226488099569,-0.290830016928065 +cg00437985,0.999517414327606,0.774175115359648,-0.333305177986928 +cg13954457,0.999646311770848,0.780581727071466,-0.780581727171466 +cg05745631,0.999887156727736,1.000000886181,-0.948504279785267 +cg08701621,0.999307417908646,0.636119139155725,-0.493511053583864 +cg06794543,0.99964034885444,0.879822842513014,-0.879822842613009 +cg06607764,0.999359188304109,0.79918305945682,-0.799183059556762 +cg19841369,0.999779486817801,0.763657321660192,-0.662904778974315 +cg06454760,0.998843029384821,0.861118168604708,-0.208087157327514 +cg15909981,0.998970319013729,0.756873536559914,-0.472778808399324 +cg13201808,0.99952514781255,0.710524316626996,-0.696927256087063 +cg08847173,0.999487993940197,0.509780154601705,-0.487064724959665 +cg00370229,0.998669109874615,0.809490035784279,-0.219615595571618 +cg04007726,0.999233759365852,0.622768761523717,-0.539195535658597 +cg04118306,0.998929547177654,0.887284875505964,-0.202940594063679 +cg21136104,0.98982905814148,0.389076509249917,-0.389076509349917 +cg17812788,0.99931907231193,0.917546392193717,-0.236305827433979 +cg18687675,0.999810208776108,1.00000052689246,-0.626133283854931 +cg14627172,0.999265407222044,0.90420892627596,-0.304953847411123 +cg14822490,0.995511520414267,0.63005950749519,-0.251260619378949 +cg12188986,0.999745714408351,0.777176475045884,-0.721787755261111 +cg05525743,0.999115160348821,0.606938845974907,-0.378732051811218 +cg09907936,0.998914531717989,0.841684084929068,-0.218304666022593 +cg07766263,0.998811358066761,0.64125109460881,-0.437531880603989 +cg21730858,0.999272223469697,0.477804985835925,-0.362291189970587 +cg12492087,0.99861673523826,0.658122252565138,-0.371927596751882 +cg02895639,0.999260375603694,0.707916050082424,-0.537423755114291 +cg26709285,0.999537174353081,0.6900176268663,-0.6900176269663 +cg00689492,0.997790282362088,0.853532985150653,-0.254438496476494 +cg15490715,0.999705938851847,0.693504139516871,-0.639384160040117 +cg25537993,0.998773123981566,0.719554098878703,-0.652301774806425 +cg04599403,0.999554179939086,0.625055384625531,-0.589979763179533 +cg19761848,0.999838987651104,0.964604670472064,-0.964604670572064 +cg22727783,0.998967715092224,0.561050500545834,-0.53050574290522 +cg13879776,0.99768974464841,0.615490247970696,-0.450140009169886 +cg19947104,0.9994461674992,0.670830869371302,-0.6708308694712 +cg00303982,0.999611532368396,0.949113546157765,-0.145886744984526 +cg04484550,0.999178997948114,0.590811962633663,-0.284287463429017 +cg19971388,0.997264182730005,0.503593985563726,-0.343448407199314 +cg11324957,0.999882639480988,1.0000008520697,-0.999979298106915 +cg00298065,0.997777723836737,0.794720111330982,-0.402109899103255 +cg04191427,0.999561017160567,0.608907198542394,-0.559527154083425 +cg04958794,0.998404521333909,0.838736228726155,-0.783865788655781 +cg04293085,0.99927024416739,0.727870469092498,-0.476656491591621 +cg02049405,0.999083802999921,0.795162971381656,-0.781756246749541 +cg17434309,0.999657345732203,0.868594887400004,-0.724188984038645 +cg05068206,0.998389045530195,0.499255365497263,-0.270928179475897 +cg26890189,1.0,0.0,0.605211953796541 +cg05206884,0.999779434074883,0.652714622140782,-0.380049992720041 +cg14182974,0.999687434254776,1.0000001145495,-0.968316658944849 +cg09660365,0.998489400879061,0.839377672224992,-0.766459202242559 +cg03192598,0.999392653364569,0.681262022630203,-0.59669691429557 +cg04017533,0.998887855550527,0.816038696642188,-0.535352089794062 +cg25247859,0.998917821273106,0.872109920679519,-0.761543010179264 +cg24368848,0.998983669505405,0.629714542668201,-0.406448094419442 +cg06708634,0.998873463017535,0.909094704295871,-0.130277590729169 +cg05080154,0.999180930061241,0.61291883554261,-0.503340418303173 +cg12444411,0.999112418582052,0.618349931967055,-0.164100967705426 +cg12353688,0.999194421334234,0.790260381202537,-0.586372206847464 +cg12215340,0.999785277115292,0.999886644379849,-0.9578409451194 +cg00465970,0.998902485492996,0.463412092841756,-0.246331812635087 +cg21143896,0.999318273290323,0.590798741178887,-0.58518404382155 +cg12046758,0.999110459827632,0.881094733356248,-0.160185794674435 +cg09354556,0.999749803460965,0.73993612665955,-0.611698997958702 +cg18430128,0.998713066739435,0.670302110636983,-0.326589208526356 +cg08843809,0.999024439320303,0.800185093740559,-0.734594143363421 +cg18146737,0.99807597221711,0.768053054875177,-0.531714989510861 +cg09224821,0.999594697016873,0.831671595244428,-0.179884671844445 +cg12250896,0.999715400802377,0.979729732023346,-0.979729732044426 +cg14013195,0.999684260624455,0.696088481231272,-0.650934505494299 +cg14600824,0.99988894894364,0.99995941721362,-0.840581897802136 +cg25975712,0.999804650727378,1.00000051190253,-0.999996529492223 +cg11962640,0.999656132694679,0.733613322531231,-0.625523196674874 +cg12406391,0.999357953268864,0.566926081240353,-0.491121515036139 +cg08390209,0.998895341433006,0.900349629906489,-0.151435601219533 +cg18628732,0.998758366634493,0.502387769675466,-0.43481763135023 +cg12017745,0.992962917035692,0.820150106958359,-0.422066312882795 +cg12399536,0.99739553592466,0.629487713489137,-0.536282631081723 +cg22499720,0.999754149135307,1.00000008698049,-1.00000008708049 +cg27088072,0.997818413475173,0.603073544083479,-0.518151136061801 +cg07105285,0.999718476561302,0.690832377628143,-0.552784783682376 +cg19717586,0.999407050248121,0.645825051336326,-0.599545136627448 +cg05962092,0.999671320166947,0.860454452617693,-0.356922911626375 +cg13434842,0.998918308067536,0.493307119457116,-0.363118720612359 +cg02578944,0.998351956406022,0.719611683508905,-0.509055584546483 +cg08584759,0.999416828355752,0.882848756847746,-0.551205960816327 +cg11052143,0.994274822206481,0.84222839098849,-0.84222839108849 +cg22319311,0.998836444677452,0.642384809543028,-0.481342861783507 +cg13405332,0.999555792779487,0.534784378088809,-0.473439333529474 +cg04716021,0.999123354551544,0.743297755652972,-0.597778599129779 +cg13687570,0.999790241108607,0.751502252962856,-0.692675477135318 +cg26612727,0.999779789819373,0.940489968582633,-0.893913970033529 +cg15691862,0.999325546099773,0.68869469491034,-0.378063869570691 +cg26557693,0.999395151550709,0.673337984176689,-0.673337984276689 +cg06654118,0.999663610728648,0.794524261482963,-0.715356859398852 +cg13933080,0.999548669906832,0.800027604179008,-0.531060768776939 +cg00032205,0.997532952966513,0.589562141151164,-0.380084412257556 +cg22320365,0.999461263969653,0.742966177087033,-0.718003572930928 +cg05803237,0.998834445713927,0.734991827164709,-0.384852193064232 +cg15871441,0.998254394909014,0.889325774818714,-0.640995729212635 +cg05212464,0.998250169025203,0.418774823440546,-0.312468885719852 +cg13878010,0.999858338924585,1.0000007059087,-0.897494465596819 +cg15842276,0.997839993930211,0.490564449500499,-0.291908562859373 +cg01856529,0.999729370522598,0.667827676222479,-0.644725522917693 +cg10018167,0.999599404638493,0.894521724940832,-0.874443447880304 +cg01734112,0.999811927471828,0.733371172714611,-0.674396547157123 +cg20090283,0.999751369288057,0.748088854828947,-0.748088854928473 +cg18530645,0.998996074208533,0.715922366266953,-0.458908084261017 +cg04863758,0.998981626662935,0.660887614021238,-0.419551138349971 +cg10568066,0.995895207748185,0.728460539599085,-0.605530224271045 +cg02473540,0.999002497793815,0.807953535954567,-0.298505183949695 +cg00891541,0.99887545030419,0.822269133769217,-0.731195530762814 +cg12978433,0.999877146406593,1.00000081397526,-1.00000071287226 +cg14137625,0.994458699314063,0.799570458002198,-0.799570458102198 +cg14759565,0.999713969197603,0.596433894321862,-0.442600872420663 +cg04917181,0.999835692510968,0.588770295540566,-0.56004209847672 +cg12633154,0.999825127871056,0.949035914152907,-0.226267111931282 +cg15090727,0.999806233641178,1.00000051608435,-1.00000050854529 +cg26477792,0.999870907452249,1.00000050498025,-0.923932706557344 +cg11599981,0.998166769195783,0.92914892862537,-0.326335607311436 +cg16339238,0.99189872487546,0.684102539480704,-0.419508365310058 +cg27566403,0.999890706134828,0.999977925246875,-0.999977925346875 +cg13389502,0.998567147058459,0.655568686862717,-0.613259228652051 +cg02994956,0.999882117620188,1.00000083304602,-1.00000083314602 +cg10687131,0.998850735762481,0.446954227899635,-0.395627597105004 +cg08013557,0.998876821659624,0.475018679693107,-0.439195511461137 +cg09809932,0.999490662629433,0.702356335989469,-0.6120006450165 +cg00730887,0.99971002988889,0.751217681050256,-0.667180850003609 +cg08244866,0.999885608120364,1.00000087418606,-0.916805438923758 +cg10132208,0.999725365925416,0.888456844857044,-0.703774643734752 +cg13850380,0.999228831515701,0.737416934542258,-0.487344397913108 +cg20234976,0.999761531205346,0.999987355303585,-0.959640099268045 +cg05716671,0.999864053479267,0.786538323565742,-0.699648513963168 +cg23690893,0.999961320285568,1.00000258531749,-0.369837231515496 +cg19804605,0.999746668025123,0.788396789890984,-0.54751645983998 +cg27205904,1.0,0.0,0.7525582927331 +cg00099869,0.999861533224858,1.00000072219176,-0.993648134364735 +cg23111655,0.999145635328246,0.618818439499665,-0.334638362422735 +cg01514538,0.999820975421718,0.909270449484402,-0.866801870468382 +cg17018096,0.999476920825708,0.840842821270397,-0.276569881217759 +cg24931632,0.999438657602823,0.727314594739965,-0.501189347525773 +cg18953784,0.999389150657338,0.599404255273955,-0.425731554761739 +cg26379258,0.999912164762016,1.0000011384928,-1.00000113836212 +cg13451127,0.999447757523798,0.850431757328636,-0.351808805037563 +cg13333304,0.999572503260236,0.682269999972676,-0.682270000072676 +cg13449778,0.999728454133263,0.546046140533544,-0.428218901448656 +cg10978355,0.997231104199948,0.703860888876764,-0.447386344876449 +cg12598635,0.999922027129792,1.00000062752559,-0.90631711820397 +cg00445518,0.999730602966491,0.770170036658548,-0.296067173024484 +cg20449685,0.999232690601245,0.689619890258763,-0.472665620120274 +cg24173182,0.999925894544253,1.00000134942243,-1.00000134573826 +cg00002033,0.998480766100715,0.456784193154432,-0.411720427931816 +cg15066416,0.999861658477746,0.99999174853352,-0.99999174863352 +cg10556064,0.996864729091638,0.437978231831864,-0.327829018760324 +cg10427868,0.999589226335512,0.686346687602767,-0.558705458604506 +cg12025310,0.998557290205795,0.876782813501274,-0.17941877340581 +cg24541835,0.999261786896524,0.79056300459497,-0.755440812381395 +cg04768479,0.999264206426299,0.63940874959904,-0.54643881073947 +cg11510523,0.99808649002651,0.933135066514799,-0.2736559489957 +cg04507915,0.998722928246556,0.418868100912123,-0.418868101012123 +cg18455390,0.999833714705787,0.999995677797279,-0.952197812235388 +cg03734874,0.999894891336424,1.00000079455841,-0.649470853766119 +cg17971015,0.999760115664522,0.89497996486182,-0.817144797420851 +cg04123310,0.999675171037653,0.731883530509915,-0.676733906975514 +cg11312495,0.999696763424002,0.834261300432327,-0.802972093186761 +cg19122206,0.999764907447063,0.99279365949623,-0.911344115050461 +cg05423393,0.999857538269768,0.999999853723697,-0.999999853823697 +cg10107050,0.999596566160825,0.72551454721845,-0.67744530739139 +cg20544651,0.999639853977697,0.747654557369149,-0.569976507363827 +cg10210806,0.999878728795404,0.999998006400914,-0.909853196404887 +cg26114043,0.999756571030803,0.915278706466721,-0.890098322934339 +cg06111140,0.998663679229176,0.844090069582511,-0.43108066325234 +cg22330763,0.99937649901747,0.782122694155624,-0.782122694255624 +cg15774153,0.999238693842319,0.739562564452079,-0.493119837033451 +cg04436994,0.99890050577268,0.650553509643569,-0.581953772162992 +cg06938705,0.999913166132447,1.00000114156734,-0.931139120151557 +cg00750428,0.999668100336396,0.640405472846498,-0.532057832006615 +cg26416971,0.999705908667013,0.746905884886405,-0.651799589383054 +cg05270106,0.999513863335591,0.736390218922098,-0.332714696925705 +cg20260127,0.998602899492064,0.793713744305907,-0.177376478062166 +cg01005486,0.999947610263997,1.00000190866079,-0.891294345537998 +cg15580417,0.999576144364952,0.745964754970318,-0.745964755070318 +cg18255166,0.99987697605975,1.00000081284818,-0.999916301595736 +cg23484755,0.999881050050374,0.999735689652606,-0.973167386414335 +cg01114124,0.99827238512116,0.749702426084699,-0.67419514649112 +cg06432119,0.999547222999604,0.687685975178807,-0.67672794469514 +cg04850659,0.999642022901221,0.764224865932712,-0.653879127075488 +cg02478023,0.998712187256203,0.681558506814701,-0.327757092967576 +cg20322433,0.999493462996757,0.512034511733812,-0.417201601035989 +cg11738486,0.999177496341026,0.57372241602976,-0.473979803316807 +cg04951371,0.9996010647579,0.751877303572345,-0.217125554070779 +cg12934382,0.999646392618859,0.660613688991344,-0.660613689091344 +cg01722932,0.999882418068835,0.843945659980234,-0.681979693690691 +cg23425533,0.99920578098876,0.891974625624471,-0.616070725368353 +cg13346441,0.998978464329933,0.796879587703353,-0.283393674314343 +cg22614891,0.999868854983533,1.00000076246564,-0.97741397379762 +cg05485462,0.998953430274906,0.812442827823663,-0.812442827923663 +cg09709600,0.998265165277086,0.813690117160875,-0.177529937417462 +cg04271289,0.998655958482827,0.575405567768601,-0.342055664963055 +cg04816394,0.999406029957702,0.68449280112688,-0.463823138277717 +cg18653282,0.999688522356747,0.899899264622708,-0.332130007055887 +cg08608952,0.999517809965694,0.693136191264836,-0.67201026056564 +cg25876443,0.998708331674803,0.624178556226972,-0.349857976601906 +cg24413339,0.998832895297934,0.900910623087293,-0.246623116615247 +cg02455346,0.999815158037389,0.760841291492423,-0.696134861408586 +cg13567542,0.999602266957581,0.48430525658806,-0.347716537379908 +cg23114616,0.99817530209033,0.826456728078298,-0.778914594050861 +cg00510437,0.999781637797144,0.920241576095727,-0.901582186582983 +cg04723343,0.996584983557163,0.654799712439235,-0.43509007119781 +cg00388812,0.998788499977253,0.850371346806074,-0.262552301788952 +cg00158227,0.992449312562232,0.711169607014273,-0.420264738216832 +cg22880770,0.998972754950761,0.729365955304439,-0.609654371209523 +cg21697794,0.999304206643222,0.51778051390201,-0.378206522493659 +cg15473155,0.999689433500231,0.402684573891035,-0.363266710044448 +cg04554929,0.999506495818142,0.925978767188864,-0.22941752780688 +cg05535398,0.998848010714877,0.913459475130406,-0.135846608775855 +cg19341977,0.987360836352242,0.688167111776728,-0.364583231001355 +cg02793099,0.999681337771959,0.889975116854377,-0.889975116954377 +cg02773588,0.999826685533983,0.982889698512547,-0.546054096657203 +cg10204755,0.999707451527726,0.79304708550225,-0.338577426707451 +cg21557724,0.999836136784413,1.00000061026108,-0.994329718667405 +cg17250863,0.999732795535468,0.736228585867759,-0.432729118705602 +cg17676129,0.998787437999125,0.716138688276783,-0.628233621412053 +cg22294267,0.999787242760927,0.994119345886607,-0.891993654901652 +cg17029193,0.999606078555699,0.825562626832471,-0.825562626932471 +cg08171483,0.999777482485176,0.738123740740258,-0.490961983889218 +cg19336198,0.999864116081124,0.945883336879447,-0.945883336979447 +cg23830290,0.999873991447348,0.999998104629905,-0.900945120279847 +cg03984347,0.999887631810486,1.00000088992967,-1.00000089002967 +cg12143651,0.999244071324475,0.731866882384178,-0.436350352059731 +cg16624069,0.999343771976178,0.50084475274556,-0.408431658181162 +cg09506661,0.998721195558505,0.640658955032048,-0.520877764896865 +cg06085683,0.999770949148318,0.700357654032084,-0.407336953507809 +cg07004744,0.999121868741723,0.76740935058263,-0.452095748893364 +cg07957995,0.999560901119049,0.792451229677255,-0.696515456336462 +cg07450698,0.999631031789297,0.685831333722154,-0.685831333822153 +cg05395187,0.999620142316625,0.911246692173785,-0.792611336787476 +cg14184780,0.999397986353765,0.594957242960695,-0.582417337613694 +cg15777825,0.999229009571253,0.754893520027078,-0.754893520127078 +cg13126279,0.998576382547561,0.73386524828029,-0.492266133088628 diff --git a/biolearn/model.py b/biolearn/model.py index 4109ebf..aeca651 100644 --- a/biolearn/model.py +++ b/biolearn/model.py @@ -5,6 +5,7 @@ import torch import torch.nn as nn import torch.nn.functional as F +from scipy.optimize import minimize_scalar from sklearn.linear_model import LinearRegression from biolearn.data_library import GeoData @@ -739,6 +740,29 @@ def preprocess(df): "file": "Bocklandt.csv", }, }, + "MiAge": { + "year": 2018, + "species": "Human", + "tissue": "Blood", + "source": "https://doi.org/10.1080/15592294.2017.1389361", + "output": "Mitotic Age (Cell Divisions)", + "model": { + "type": "MiAgeModel", + "file": "MiAge.csv", + }, + }, + "Bohlin": { + "year": 2017, + "species": "Human", + "tissue": "Cord Blood", + "source": "https://doi.org/10.1186/s13059-016-1063-4", + "output": "Age (days)", + "model": { + "type": "LinearMethylationModel", + "file": "Bohlin.csv", + "transform": lambda sum: sum + 277.2421, + }, + }, "PCHorvath1": { "year": 2022, "species": "Human", @@ -1626,5 +1650,139 @@ def __getattr__(self, name): return getattr(self.clock, name) +class MiAgeModel: + """ + MiAge (Mitotic Age) clock implementation. + + Based on Youn & Wang (2018): "The MiAge Calculator: a DNA methylation-based + mitotic age calculator of human tissue types." + + MiAge estimates the number of cell divisions (mitotic age) using an optimization + approach with site-specific parameters (b, c, d) for 268 CpG sites. + + Formula: For each sample, find n (mitotic age) that minimizes: + sum((c + b^(n-1) * d - beta)^2) + where beta is the observed methylation value for each CpG site. + """ + + def __init__(self, parameter_file): + """ + Initialize MiAge model with site-specific parameters. + + Parameters + ---------- + parameter_file : str + Path to CSV file containing CpG, b, c, d columns + """ + params = pd.read_csv(get_data_file(parameter_file)) + self.params = params.set_index("CpG") + self.b_params = self.params["b"] + self.c_params = self.params["c"] + self.d_params = self.params["d"] + self.cpg_sites = self.params.index.tolist() + + @classmethod + def from_definition(cls, clock_definition): + """Create MiAge model from clock definition""" + model_def = clock_definition["model"] + return cls(model_def["file"]) + + def _optimize_sample(self, beta_values): + """ + Optimize mitotic age for a single sample using scipy.optimize. + + Parameters + ---------- + beta_values : numpy.ndarray + Methylation beta values for CpG sites + + Returns + ------- + float + Estimated mitotic age (number of cell divisions) + """ + # Filter to valid (non-NaN) values + valid_mask = ~np.isnan(beta_values) + beta_valid = beta_values[valid_mask] + b_valid = self.b_params.values[valid_mask] + c_valid = self.c_params.values[valid_mask] + d_valid = self.d_params.values[valid_mask] + + def objective(n): + """MiAge objective function: sum((c + b^(n-1) * d - beta)^2)""" + return np.sum( + (c_valid + b_valid ** (n - 1) * d_valid - beta_valid) ** 2 + ) + + # Use multiple starting points for robustness + best_result = None + best_fun = np.inf + + for start in [100, 500, 1000, 2000]: + result = minimize_scalar( + objective, + bounds=(10, 10000), + method="bounded", + options={"xatol": 1e-8}, + ) + if result.fun < best_fun: + best_fun = result.fun + best_result = result + + return best_result.x + + def predict(self, geo_data): + """ + Predict mitotic age for methylation samples. + + Parameters + ---------- + geo_data : GeoData + Object containing methylation data + + Returns + ------- + pd.DataFrame + Predicted mitotic ages for each sample + """ + methylation_data = geo_data.dnam + + # Get shared CpG sites + shared_sites = methylation_data.index.intersection(self.cpg_sites) + + if len(shared_sites) == 0: + raise ValueError("No overlapping CpG sites found for MiAge clock") + + if len(shared_sites) < len(self.cpg_sites) * 0.5: + print( + f"WARNING: Only {len(shared_sites)}/{len(self.cpg_sites)} " + f"CpG sites available ({100*len(shared_sites)/len(self.cpg_sites):.1f}%)" + ) + + # Align data with model CpGs (keeping only shared sites) + # Need to reindex params to match shared sites order + shared_params = self.params.loc[shared_sites] + self.b_params = shared_params["b"] + self.c_params = shared_params["c"] + self.d_params = shared_params["d"] + + X = methylation_data.loc[shared_sites].values + + # Calculate MiAge for each sample + predictions = [] + for i in range(X.shape[1]): + beta_sample = X[:, i] + miage = self._optimize_sample(beta_sample) + predictions.append(miage) + + return pd.DataFrame( + predictions, index=methylation_data.columns, columns=["Predicted"] + ) + + def methylation_sites(self): + """Return list of required CpG sites""" + return self.cpg_sites + + def single_sample_clock(clock_function, data): return clock_function(data).iloc[0, 0] diff --git a/biolearn/model_gallery.py b/biolearn/model_gallery.py index 34fc25b..2a4f32a 100644 --- a/biolearn/model_gallery.py +++ b/biolearn/model_gallery.py @@ -11,6 +11,7 @@ EpiTOC2Model, AltumAgeModel, PCLinearTransformationModel, + MiAgeModel, ) from biolearn.imputation import ( hybrid_impute, @@ -36,6 +37,7 @@ class ModelGallery: "EpiTOC2Model": EpiTOC2Model.from_definition, "AltumAgeModel": AltumAgeModel.from_definition, "PCLinearTransformationModel": PCLinearTransformationModel.from_definition, + "MiAgeModel": MiAgeModel.from_definition, } def __init__(self, models=model_definitions): diff --git a/biolearn/test/data/expected_model_outputs/MiAge.csv b/biolearn/test/data/expected_model_outputs/MiAge.csv new file mode 100644 index 0000000..62a2c3e --- /dev/null +++ b/biolearn/test/data/expected_model_outputs/MiAge.csv @@ -0,0 +1,11 @@ +id,Predicted +GSM1009660,690.7299170623446 +GSM1009661,593.7206748761973 +GSM1009662,731.6428850713417 +GSM1009663,560.0016711692683 +GSM1009664,496.7881567481185 +GSM1009665,405.57820161202085 +GSM1009666,507.01735989703303 +GSM1009667,442.095405784304 +GSM1009668,618.8602361353671 +GSM1009669,583.0866615952626