Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- p3/preprocess/Metabolic_Rate/GSE101492.csv +0 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE101492.csv +3 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE106800.csv +4 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE151683.csv +4 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE23025.csv +2 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE26440.csv +3 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE40589.csv +2 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE40873.csv +2 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE41168.csv +3 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE61225.csv +4 -0
- p3/preprocess/Metabolic_Rate/clinical_data/GSE89231.csv +2 -0
- p3/preprocess/Metabolic_Rate/code/GSE101492.py +174 -0
- p3/preprocess/Metabolic_Rate/code/GSE106800.py +171 -0
- p3/preprocess/Metabolic_Rate/code/GSE151683.py +180 -0
- p3/preprocess/Metabolic_Rate/code/GSE23025.py +146 -0
- p3/preprocess/Metabolic_Rate/code/GSE26440.py +160 -0
- p3/preprocess/Metabolic_Rate/code/GSE40589.py +108 -0
- p3/preprocess/Metabolic_Rate/code/GSE40873.py +154 -0
- p3/preprocess/Metabolic_Rate/code/GSE41168.py +125 -0
- p3/preprocess/Metabolic_Rate/code/GSE61225.py +165 -0
- p3/preprocess/Metabolic_Rate/code/GSE89231.py +166 -0
- p3/preprocess/Metabolic_Rate/code/TCGA.py +26 -0
- p3/preprocess/Metabolic_Rate/gene_data/GSE101492.csv +0 -0
- p3/preprocess/Migraine/clinical_data/GSE67311.csv +2 -0
- p3/preprocess/Migraine/code/GSE67311.py +157 -0
- p3/preprocess/Migraine/code/TCGA.py +26 -0
- p3/preprocess/Migraine/cohort_info.json +1 -0
- p3/preprocess/Mitochondrial_Disorders/GSE42986.csv +0 -0
- p3/preprocess/Mitochondrial_Disorders/clinical_data/GSE22651.csv +4 -0
- p3/preprocess/Mitochondrial_Disorders/clinical_data/GSE30933.csv +2 -0
- p3/preprocess/Mitochondrial_Disorders/clinical_data/GSE42986.csv +4 -0
- p3/preprocess/Mitochondrial_Disorders/clinical_data/GSE65399.csv +2 -0
- p3/preprocess/Mitochondrial_Disorders/code/GSE22651.py +170 -0
- p3/preprocess/Mitochondrial_Disorders/code/GSE30933.py +160 -0
- p3/preprocess/Mitochondrial_Disorders/code/GSE42986.py +218 -0
- p3/preprocess/Mitochondrial_Disorders/code/GSE65399.py +168 -0
- p3/preprocess/Mitochondrial_Disorders/code/TCGA.py +104 -0
- p3/preprocess/Mitochondrial_Disorders/cohort_info.json +1 -0
- p3/preprocess/Mitochondrial_Disorders/gene_data/GSE42986.csv +0 -0
- p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/GSE19987.csv +0 -0
- p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/clinical_data/GSE19987.csv +2 -0
- p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/code/GSE19987.py +156 -0
- p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/code/TCGA.py +82 -0
- p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/cohort_info.json +1 -0
- p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/gene_data/GSE19987.csv +0 -0
- p3/preprocess/Multiple_sclerosis/GSE135511.csv +0 -0
- p3/preprocess/Multiple_sclerosis/GSE203241.csv +0 -0
- p3/preprocess/Multiple_sclerosis/clinical_data/GSE131279.csv +4 -0
- p3/preprocess/Multiple_sclerosis/clinical_data/GSE131281.csv +4 -0
- p3/preprocess/Multiple_sclerosis/clinical_data/GSE131282.csv +4 -0
p3/preprocess/Metabolic_Rate/GSE101492.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE101492.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
,GSM2704900,GSM2704901,GSM2704902,GSM2704903,GSM2704904,GSM2704905,GSM2704906,GSM2704907,GSM2704908,GSM2704909,GSM2704910,GSM2704911,GSM2704912,GSM2704913,GSM2704914,GSM2704915,GSM2704916,GSM2704917,GSM2704918,GSM2704919,GSM2704920,GSM2704921,GSM2704922,GSM2704923,GSM2704924,GSM2704925,GSM2704926,GSM2704927,GSM2704928,GSM2704929,GSM2704930,GSM2704931,GSM2704932,GSM2704933,GSM2704934,GSM2704935,GSM2704936,GSM2704937,GSM2704938,GSM2704939,GSM2704940,GSM2704941,GSM2704942,GSM2704943,GSM2704944,GSM2704945,GSM2704946,GSM2704947,GSM2704948,GSM2704949,GSM2704950,GSM2704951,GSM2704952,GSM2704953,GSM2704954,GSM2704955,GSM2704956,GSM2704957,GSM2704958,GSM2704959,GSM2704960,GSM2704961,GSM2704962,GSM2704963,GSM2704964,GSM2704965,GSM2704966,GSM2704967,GSM2704968,GSM2704969,GSM2704970,GSM2704971,GSM2704972,GSM2704973,GSM2704974,GSM2704975,GSM2704976,GSM2704977,GSM2704978,GSM2704979
|
2 |
+
Metabolic_Rate,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0
|
3 |
+
Age,39.0,28.0,42.0,30.0,42.0,37.0,36.0,33.0,27.0,43.0,37.0,42.0,43.0,39.0,42.0,44.0,25.0,36.0,25.0,25.0,44.0,43.0,44.0,35.0,40.0,25.0,29.0,41.0,34.0,43.0,31.0,41.0,37.0,39.0,29.0,28.0,35.0,37.0,36.0,40.0,30.0,33.0,34.0,40.0,40.0,30.0,38.0,40.0,28.0,39.0,42.0,44.0,40.0,34.0,33.0,41.0,41.0,42.0,36.0,40.0,33.0,39.0,44.0,29.0,28.0,36.0,41.0,43.0,43.0,26.0,33.0,32.0,38.0,31.0,30.0,28.0,27.0,45.0,40.0,25.0
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE106800.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM2850460,GSM2850461,GSM2850462,GSM2850463,GSM2850464,GSM2850465,GSM2850466,GSM2850467,GSM2850468,GSM2850469,GSM2850470,GSM2850471,GSM2850472,GSM2850473,GSM2850474,GSM2850475,GSM2850476,GSM2850477,GSM2850478,GSM2850479,GSM2850480,GSM2850481,GSM2850482,GSM2850483,GSM2850484,GSM2850485,GSM2850486,GSM2850487,GSM2850488,GSM2850489,GSM2850490,GSM2850491,GSM2850492,GSM2850493,GSM2850494,GSM2850495,GSM2850496,GSM2850497,GSM2850498,GSM2850499,GSM2850500,GSM2850501,GSM2850502,GSM2850503,GSM2850504,GSM2850505,GSM2850506
|
2 |
+
Metabolic_Rate,9.599,9.608,9.332,7.221,8.054,19.143,10.435,9.27,21.314,19.777,13.271,18.606,9.398,7.026,6.094,12.949,10.679,7.027,6.081,12.669,5.792,7.669,5.272,8.732,15.353,12.865,8.427,11.508,12.07,6.1,8.319,9.807,12.652,14.358,12.6,9.443,9.63,7.8,13.329,3.416,4.447,6.429,4.135,9.251,8.622,5.076,11.157
|
3 |
+
Age,24.0,24.0,24.0,24.0,24.0,24.0,24.0,24.0,21.0,21.0,21.0,21.0,20.0,20.0,20.0,20.0,22.0,22.0,22.0,22.0,20.0,20.0,20.0,19.0,19.0,19.0,19.0,22.0,22.0,22.0,22.0,21.0,21.0,21.0,21.0,26.0,26.0,26.0,26.0,20.0,20.0,20.0,20.0,29.0,29.0,29.0,29.0
|
4 |
+
Gender,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE151683.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM4588191,GSM4588192,GSM4588193,GSM4588194,GSM4588195,GSM4588196,GSM4588197,GSM4588198,GSM4588199,GSM4588200,GSM4588201,GSM4588202,GSM4588203,GSM4588204,GSM4588205,GSM4588206,GSM4588207,GSM4588208,GSM4588209,GSM4588210,GSM4588211,GSM4588212,GSM4588213,GSM4588214,GSM4588215,GSM4588216,GSM4588217,GSM4588218,GSM4588219,GSM4588220,GSM4588221,GSM4588222,GSM4588223,GSM4588224,GSM4588225,GSM4588226,GSM4588227,GSM4588228,GSM4588229,GSM4588230,GSM4588231,GSM4588232,GSM4588233,GSM4588234,GSM4588235,GSM4588236
|
2 |
+
Metabolic_Rate,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0
|
3 |
+
Age,42.0,42.0,63.0,63.0,40.0,40.0,41.0,41.0,43.0,43.0,45.0,45.0,56.0,56.0,46.0,46.0,41.0,41.0,42.0,42.0,42.0,42.0,62.0,62.0,46.0,46.0,42.0,42.0,40.0,40.0,44.0,44.0,54.0,54.0,48.0,48.0,46.0,46.0,44.0,44.0,42.0,42.0,60.0,60.0,49.0,49.0
|
4 |
+
Gender,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE23025.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM568139,GSM568140,GSM568141,GSM568142,GSM568143,GSM568144,GSM568145,GSM568146,GSM568147,GSM568148,GSM568149,GSM568150,GSM568151,GSM568152,GSM568153,GSM568154,GSM568155,GSM568156,GSM568157,GSM568158,GSM568159,GSM568160,GSM568161,GSM568162,GSM568163,GSM568164,GSM568165,GSM568166,GSM568167,GSM568168,GSM568169,GSM568170,GSM568171,GSM568172,GSM568173,GSM568174,GSM568175,GSM568176,GSM568177,GSM568178,GSM568179,GSM568180,GSM568181,GSM568182,GSM568183,GSM568184,GSM568185,GSM568186,GSM568187,GSM568188,GSM568189,GSM568190,GSM568191,GSM568192,GSM568193,GSM568194,GSM568195,GSM568196,GSM568197,GSM568198,GSM568199,GSM568200,GSM568201,GSM568202,GSM568203,GSM568204,GSM568205,GSM568206,GSM568207,GSM568208,GSM568209,GSM568210,GSM568211,GSM568212,GSM568213,GSM568214,GSM568215,GSM568216,GSM568217,GSM568218,GSM568219,GSM568220,GSM568221,GSM568222,GSM568223,GSM568224,GSM568225,GSM568226,GSM568227,GSM568228,GSM568229,GSM568230,GSM568231,GSM568232,GSM568233,GSM568234,GSM568235,GSM568236,GSM568237,GSM568238,GSM568239,GSM568240,GSM568241,GSM568242,GSM568243,GSM568244,GSM568245,GSM568246,GSM568247,GSM568248,GSM568249,GSM568250,GSM568251,GSM568252,GSM568253,GSM568254,GSM568255,GSM568256,GSM568257,GSM568258,GSM568259,GSM568260,GSM568261,GSM568262
|
2 |
+
Metabolic_Rate,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE26440.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
,GSM648590,GSM648591,GSM648592,GSM648593,GSM648594,GSM648595,GSM648596,GSM648597,GSM648598,GSM648599,GSM648600,GSM648601,GSM648602,GSM648603,GSM648604,GSM648605,GSM648606,GSM648607,GSM648608,GSM648609,GSM648610,GSM648611,GSM648612,GSM648613,GSM648614,GSM648615,GSM648616,GSM648617,GSM648618,GSM648619,GSM648620,GSM648621,GSM648622,GSM648623,GSM648624,GSM648625,GSM648626,GSM648627,GSM648628,GSM648629,GSM648630,GSM648631,GSM648632,GSM648633,GSM648634,GSM648635,GSM648636,GSM648637,GSM648638,GSM648639,GSM648640,GSM648641,GSM648642,GSM648643,GSM648644,GSM648645,GSM648646,GSM648647,GSM648648,GSM648649,GSM648650,GSM648651,GSM648652,GSM648653,GSM648654,GSM648655,GSM648656,GSM648657,GSM648658,GSM648659,GSM648660,GSM648661,GSM648662,GSM648663,GSM648664,GSM648665,GSM648666,GSM648667,GSM648668,GSM648669,GSM648670,GSM648671,GSM648672,GSM648673,GSM648674,GSM648675,GSM648676,GSM648677,GSM648678,GSM648679,GSM648680,GSM648681,GSM648682,GSM648683,GSM648684,GSM648685,GSM648686,GSM648687,GSM648688,GSM648689,GSM648690,GSM648691,GSM648692,GSM648693,GSM648694,GSM648695,GSM648696,GSM648697,GSM648698,GSM648699,GSM648700,GSM648701,GSM648702,GSM648703,GSM648704,GSM648705,GSM648706,GSM648707,GSM648708,GSM648709,GSM648710,GSM648711,GSM648712,GSM648713,GSM648714,GSM648715,GSM648716,GSM648717,GSM648718,GSM648719
|
2 |
+
Metabolic_Rate,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,,,,1.0,1.0,0.0,0.0,,1.0,,1.0,,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,,,1.0,,,,,,,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0
|
3 |
+
Age,9.4,3.0,2.1,1.9,0.8,0.3,9.1,0.6,2.6,8.8,0.9,4.5,2.0,0.5,2.4,0.1,0.8,2.7,6.8,7.1,7.3,4.4,2.8,0.3,3.0,3.7,2.7,2.7,0.1,0.7,0.0,1.6,1.1,1.9,2.2,4.2,2.3,7.2,0.0,2.8,3.3,0.9,5.3,7.3,5.7,0.9,1.6,0.0,0.0,2.9,2.9,0.0,7.3,2.3,9.0,0.2,0.0,0.3,2.5,0.0,2.2,5.1,10.9,6.0,0.7,1.9,2.3,5.3,10.8,7.5,2.9,1.4,7.8,1.9,1.5,6.1,8.9,1.8,3.7,0.7,1.4,0.9,0.0,6.8,0.0,0.0,5.9,9.7,0.2,0.3,6.3,0.3,0.1,1.3,8.0,1.7,0.2,6.0,6.0,1.9,0.7,1.5,3.0,1.2,5.1,1.4,7.0,5.9,0.1,2.0,1.8,3.8,1.0,0.0,0.3,9.4,0.3,1.5,0.0,8.2,4.3,2.0,2.0,2.0,2.0,2.4,2.0,2.0,7.4,10.0
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE40589.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM997377,GSM997378,GSM997379,GSM997380,GSM997381,GSM997382,GSM997383,GSM997384,GSM997385,GSM997386,GSM997387,GSM997388,GSM997389,GSM997390,GSM997391,GSM997392,GSM997393,GSM997394,GSM997395,GSM997396,GSM997399,GSM997401,GSM997403,GSM997406,GSM997408,GSM997410,GSM997412,GSM997414,GSM997416,GSM997418,GSM997420,GSM997422,GSM997424,GSM997426,GSM997428,GSM997431,GSM997433,GSM997435,GSM997438,GSM997440,GSM997442,GSM997444,GSM997447,GSM997449,GSM997451,GSM997454,GSM997457,GSM997459,GSM997461,GSM997463,GSM997467,GSM997469,GSM997472,GSM997475,GSM997478,GSM997480,GSM997482,GSM997483,GSM997485,GSM997488,GSM997489,GSM997492,GSM997494,GSM997497,GSM997499,GSM997501,GSM997503,GSM997504,GSM997505,GSM997506,GSM997507,GSM997508,GSM997509,GSM997510,GSM997511,GSM997512,GSM997513,GSM997514,GSM997515,GSM997516,GSM997517,GSM997518,GSM997519,GSM997520,GSM997521,GSM997522,GSM997523,GSM997524,GSM997525,GSM997526,GSM997527,GSM997528,GSM997529,GSM997530,GSM997531,GSM997532
|
2 |
+
Metabolic_Rate,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE40873.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM1003891,GSM1003892,GSM1003893,GSM1003894,GSM1003895,GSM1003896,GSM1003897,GSM1003898,GSM1003899,GSM1003900,GSM1003901,GSM1003902,GSM1003903,GSM1003904,GSM1003905,GSM1003906,GSM1003907,GSM1003908,GSM1003909,GSM1003910,GSM1003911,GSM1003912,GSM1003913,GSM1003914,GSM1003915,GSM1003916,GSM1003917,GSM1003918,GSM1003919,GSM1003920,GSM1003921,GSM1003922,GSM1003923,GSM1003924,GSM1003925,GSM1003926,GSM1003927,GSM1003928,GSM1003929,GSM1003930,GSM1003931,GSM1003932,GSM1003933,GSM1003934,GSM1003935,GSM1003936,GSM1003937,GSM1003938,GSM1003939
|
2 |
+
Metabolic_Rate,0.0388,0.8904,0.2396,0.8576,0.2848,0.034,0.0556,0.0228,0.1928,0.6428,0.7604,0.7372,0.1068,0.3292,0.0988,0.3056,0.1964,0.2936,0.226,0.1796,0.6524,0.6492,0.1116,0.0256,0.0172,0.0348,0.08,0.0516,0.1132,0.0824,0.1808,0.5352,0.1704,0.0884,0.136,0.2404,0.5708,0.0304,0.4176,0.1056,0.1472,0.2592,0.0896,0.5552,0.112,0.1032,0.1056,0.1584,0.1512
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE41168.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1009750,GSM1009751,GSM1009752,GSM1009753,GSM1009754,GSM1009755,GSM1009756,GSM1009757,GSM1009758,GSM1009759,GSM1009760,GSM1009761,GSM1009762,GSM1009763,GSM1009764,GSM1009765,GSM1009766,GSM1009767,GSM1009768,GSM1009769,GSM1009770,GSM1009771,GSM1009772,GSM1009773,GSM1009774,GSM1009775,GSM1009776,GSM1009777,GSM1009778,GSM1009779,GSM1009780,GSM1009781,GSM1009782,GSM1009783,GSM1009784,GSM1009785,GSM1009786,GSM1009787,GSM1009788,GSM1009789,GSM1009790,GSM1009791,GSM1009792,GSM1009793,GSM1009794,GSM1009795,GSM1009796,GSM1009797,GSM1009798,GSM1009799,GSM1009800,GSM1009801,GSM1009802,GSM1009803,GSM1009804,GSM1009805,GSM1009806,GSM1009807,GSM1009808,GSM1009809,GSM1009810,GSM1009811,GSM1009812,GSM1009813,GSM1009814,GSM1009815,GSM1009816,GSM1009817,GSM1009818,GSM1009819,GSM1009820,GSM1009821,GSM1009822,GSM1009823,GSM1009824,GSM1009825,GSM1009826,GSM1009827,GSM1009828,GSM1009829,GSM1009830,GSM1009831,GSM1009832,GSM1009833,GSM1009834,GSM1009835,GSM1009836,GSM1009837,GSM1009838,GSM1009839,GSM1009840,GSM1009841,GSM1009842,GSM1009843,GSM1009844,GSM1009845,GSM1009846,GSM1009847,GSM1009848,GSM1009849,GSM1009850,GSM1009851,GSM1009852,GSM1009853,GSM1009854,GSM1009855,GSM1009856,GSM1009857,GSM1009858,GSM1009859,GSM1009860,GSM1009861,GSM1009862,GSM1009863,GSM1009864,GSM1009865,GSM1009866,GSM1009867,GSM1009868,GSM1009869,GSM1009870,GSM1009871,GSM1009872,GSM1009873,GSM1009874,GSM1009875,GSM1009876,GSM1009877,GSM1009878,GSM1009879,GSM1009880,GSM1009881,GSM1009882,GSM1009883,GSM1009884,GSM1009885,GSM1009886,GSM1009887,GSM1009888,GSM1009889
|
2 |
+
Metabolic_Rate,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0
|
3 |
+
Gender,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE61225.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1499829,GSM1499830,GSM1499831,GSM1499832,GSM1499833,GSM1499834,GSM1499835,GSM1499836,GSM1499837,GSM1499838,GSM1499839,GSM1499840,GSM1499841,GSM1499842,GSM1499843,GSM1499844,GSM1499845,GSM1499846,GSM1499847,GSM1499848,GSM1499849,GSM1499850,GSM1499851,GSM1499852,GSM1499853,GSM1499854,GSM1499855,GSM1499856,GSM1499857,GSM1499858,GSM1499859,GSM1499860,GSM1499861,GSM1499862,GSM1499863,GSM1499864,GSM1499865,GSM1499866,GSM1499867,GSM1499868,GSM1499869,GSM1499870,GSM1499871,GSM1499872,GSM1499873,GSM1499874,GSM1499875,GSM1499876,GSM1499877,GSM1499878,GSM1499879,GSM1499880,GSM1499881,GSM1499882,GSM1499883,GSM1499884,GSM1499885,GSM1499886,GSM1499887,GSM1499888,GSM1499889,GSM1499890,GSM1499891,GSM1499892,GSM1499893,GSM1499894,GSM1499895,GSM1499896,GSM1499897,GSM1499898,GSM1499899,GSM1499900,GSM1499901,GSM1499902
|
2 |
+
Metabolic_Rate,0.681873816522757,0.8523423,0.665104620956877,0.8313807,0.786010716020953,0.9825132,0.744848045678339,0.9310601,0.814710221540659,1.018388,0.709058218744461,0.8863227,0.733268847575824,0.9165859,0.728783827412329,0.9109797,0.759969166965226,2.277797,0.863847192835992,2.987472,0.732301833893021,4.727416,0.755339902416559,3.308808,0.757193473208602,0.9464918,0.709058218744461,1.471296,0.812838481910338,3.748088,0.915727555354096,4.644773,0.736619878676601,4.075963,0.73853661923046,3.064927,0.705031456992829,3.250978,0.660887301626415,3.047425,0.760896527420428,0.9511205,0.740808706999891,2.220368,0.744848045678339,1.889017,0.74715416981939,1.722605,0.813342819234442,2.062728,0.718701917558319,2.899763,0.734934524683196,3.727751,0.720948083807537,4.487902,0.881592993199644,2.235817,0.595372813525237,2.33353,0.948882866645629,4.375404,0.638827477795041,2.945704,0.711721049272041,2.461369,0.6815901810508,2.200022,0.814710221540659,1.40877,0.733268847575824,5.917071,0.74230759890745,3.936292
|
3 |
+
Age,31.60849,31.60849,24.39425,24.39425,51.2115,51.2115,30.16838,30.16838,26.02053,26.02053,29.64819,29.64819,33.63176,33.63176,28.3258,28.3258,27.32101,27.32101,26.20945,26.20945,30.19576,30.19576,35.37851,35.37851,23.36208,23.36208,29.64819,29.64819,38.17112,38.17112,41.41821,41.41821,40.75838,40.75838,22.71869,22.71869,37.81246,37.81246,30.9076,30.9076,29.45654,29.45654,33.64271,33.64271,30.16838,30.16838,30.43669,30.43669,32.33949,32.33949,24.53114,24.53114,30.20671,30.20671,39.97262,39.97262,39.2334,39.2334,25.21013,25.21013,25.42916,25.42916,28.46544,28.46544,28.7885,28.7885,31.49897,31.49897,26.02053,26.02053,33.63176,33.63176,28.59138,28.59138
|
4 |
+
Gender,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0
|
p3/preprocess/Metabolic_Rate/clinical_data/GSE89231.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM2361446,GSM2361447,GSM2361448,GSM2361449,GSM2361450,GSM2361451,GSM2361452,GSM2361453,GSM2361454,GSM2361455,GSM2361456,GSM2361457,GSM2361458,GSM2361459,GSM2361460,GSM2361461,GSM2361462,GSM2361463,GSM2361464,GSM2361465,GSM2361466,GSM2361467,GSM2361468,GSM2361469,GSM2361470,GSM2361471,GSM2361472,GSM2361473,GSM2361474,GSM2361475,GSM2361476,GSM2361477,GSM2361478,GSM2361479,GSM2361480,GSM2361481,GSM2361482,GSM2361483,GSM2361484,GSM2361485,GSM2361486,GSM2361487,GSM2361488,GSM2361489,GSM2361490,GSM2361491,GSM2361492,GSM2361493,GSM2361494
|
2 |
+
Metabolic_Rate,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
p3/preprocess/Metabolic_Rate/code/GSE101492.py
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE101492"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE101492"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE101492.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE101492.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE101492.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Based on background info, this study examines lncRNAs and gene expression in adipose tissue
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# Trait (insulin sensitivity) is in row 3
|
38 |
+
trait_row = 3
|
39 |
+
def convert_trait(x):
|
40 |
+
if not x or ':' not in x:
|
41 |
+
return None
|
42 |
+
value = x.split(':')[1].strip().lower()
|
43 |
+
if 'resistant' in value:
|
44 |
+
return 1
|
45 |
+
elif 'sensitive' in value:
|
46 |
+
return 0
|
47 |
+
return None
|
48 |
+
|
49 |
+
# Age is in row 2
|
50 |
+
age_row = 2
|
51 |
+
def convert_age(x):
|
52 |
+
if not x or ':' not in x:
|
53 |
+
return None
|
54 |
+
try:
|
55 |
+
return float(x.split(':')[1].strip())
|
56 |
+
except:
|
57 |
+
return None
|
58 |
+
|
59 |
+
# Gender is in row 1, but it's constant (all female)
|
60 |
+
gender_row = None
|
61 |
+
def convert_gender(x):
|
62 |
+
return None
|
63 |
+
|
64 |
+
# 3. Save metadata
|
65 |
+
is_trait_available = trait_row is not None
|
66 |
+
validate_and_save_cohort_info(is_final=False,
|
67 |
+
cohort=cohort,
|
68 |
+
info_path=json_path,
|
69 |
+
is_gene_available=is_gene_available,
|
70 |
+
is_trait_available=is_trait_available)
|
71 |
+
|
72 |
+
# 4. Clinical Feature Extraction
|
73 |
+
if trait_row is not None:
|
74 |
+
clinical_features = geo_select_clinical_features(
|
75 |
+
clinical_df=clinical_data,
|
76 |
+
trait=trait,
|
77 |
+
trait_row=trait_row,
|
78 |
+
convert_trait=convert_trait,
|
79 |
+
age_row=age_row,
|
80 |
+
convert_age=convert_age,
|
81 |
+
gender_row=gender_row,
|
82 |
+
convert_gender=convert_gender
|
83 |
+
)
|
84 |
+
|
85 |
+
# Preview the extracted features
|
86 |
+
preview = preview_df(clinical_features)
|
87 |
+
print("Preview of clinical features:", preview)
|
88 |
+
|
89 |
+
# Save to CSV
|
90 |
+
clinical_features.to_csv(out_clinical_data_file)
|
91 |
+
# Get gene expression data from matrix file
|
92 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
93 |
+
|
94 |
+
# Examine data structure
|
95 |
+
print("Data structure and head:")
|
96 |
+
print(genetic_data.head())
|
97 |
+
|
98 |
+
print("\nShape:", genetic_data.shape)
|
99 |
+
|
100 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
101 |
+
print(list(genetic_data.index)[:20])
|
102 |
+
|
103 |
+
# Get a few column names to verify sample IDs
|
104 |
+
print("\nFirst 5 column names:")
|
105 |
+
print(list(genetic_data.columns)[:5])
|
106 |
+
# Looking at the ID format (18670xxx), these appear to be probe IDs or Illumina IDs,
|
107 |
+
# not standard HGNC gene symbols. Gene mapping will be required.
|
108 |
+
requires_gene_mapping = True
|
109 |
+
# Extract gene annotation data
|
110 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
111 |
+
|
112 |
+
# Display column names and preview data
|
113 |
+
print("Column names:")
|
114 |
+
print(gene_annotation.columns)
|
115 |
+
|
116 |
+
print("\nPreview of gene annotation data:")
|
117 |
+
print(preview_df(gene_annotation))
|
118 |
+
# Extract mapping data with proper parsing of gene_assignment field
|
119 |
+
relevant_rows = gene_annotation[~gene_annotation['gene_assignment'].str.contains('Housekeeping Controls', na=False)]
|
120 |
+
|
121 |
+
def parse_gene_assignment(text):
|
122 |
+
if pd.isna(text) or '---' in str(text):
|
123 |
+
return None
|
124 |
+
parts = str(text).split('//')
|
125 |
+
if len(parts) >= 3:
|
126 |
+
gene_info = parts[2].strip()
|
127 |
+
if gene_info.startswith('gene:'):
|
128 |
+
return gene_info.split(':')[1].strip()
|
129 |
+
return gene_info
|
130 |
+
return None
|
131 |
+
|
132 |
+
relevant_rows['Gene'] = relevant_rows['gene_assignment'].apply(parse_gene_assignment)
|
133 |
+
mapping_data = relevant_rows[['ID', 'Gene']].dropna()
|
134 |
+
|
135 |
+
# Apply mapping to convert probe data to gene data
|
136 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
137 |
+
|
138 |
+
# Preview the results
|
139 |
+
print("Gene expression data shape after mapping:", gene_data.shape)
|
140 |
+
print("\nFirst few gene symbols:")
|
141 |
+
print(list(gene_data.index)[:10])
|
142 |
+
# Reload clinical data that was processed earlier
|
143 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
144 |
+
|
145 |
+
# 1. Normalize gene symbols
|
146 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
147 |
+
genetic_data.to_csv(out_gene_data_file)
|
148 |
+
|
149 |
+
# 2. Link clinical and genetic data
|
150 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
151 |
+
|
152 |
+
# 3. Handle missing values systematically
|
153 |
+
linked_data = handle_missing_values(linked_data, trait)
|
154 |
+
|
155 |
+
# 4. Check for bias in trait and demographic features
|
156 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
157 |
+
|
158 |
+
# 5. Final validation and information saving
|
159 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
160 |
+
is_usable = validate_and_save_cohort_info(
|
161 |
+
is_final=True,
|
162 |
+
cohort=cohort,
|
163 |
+
info_path=json_path,
|
164 |
+
is_gene_available=True,
|
165 |
+
is_trait_available=True,
|
166 |
+
is_biased=trait_biased,
|
167 |
+
df=linked_data,
|
168 |
+
note=note
|
169 |
+
)
|
170 |
+
|
171 |
+
# 6. Save linked data only if usable
|
172 |
+
if is_usable:
|
173 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
174 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Metabolic_Rate/code/GSE106800.py
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE106800"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE106800"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE106800.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE106800.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE106800.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Background info mentions microarray analysis on muscle biopsies, so gene data likely exists
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# Metabolic rate (trait) can be inferred from fasting glucose, insulin & FFA measurements in rows 8,9,10
|
38 |
+
# Age data is in row 2, Gender in row 0
|
39 |
+
trait_row = 9 # Using insulin level as proxy for metabolic rate since title mentions insulin resistance
|
40 |
+
age_row = 2
|
41 |
+
gender_row = 0
|
42 |
+
|
43 |
+
def convert_trait(value):
|
44 |
+
# Extract numeric insulin value after colon as continuous trait
|
45 |
+
try:
|
46 |
+
return float(value.split(': ')[1])
|
47 |
+
except:
|
48 |
+
return None
|
49 |
+
|
50 |
+
def convert_age(value):
|
51 |
+
# Extract numeric age value after colon
|
52 |
+
try:
|
53 |
+
return float(value.split(': ')[1])
|
54 |
+
except:
|
55 |
+
return None
|
56 |
+
|
57 |
+
def convert_gender(value):
|
58 |
+
# Convert gender to binary (female=0, male=1)
|
59 |
+
try:
|
60 |
+
gender = value.split(': ')[1].lower()
|
61 |
+
if gender == 'male':
|
62 |
+
return 1
|
63 |
+
elif gender == 'female':
|
64 |
+
return 0
|
65 |
+
return None
|
66 |
+
except:
|
67 |
+
return None
|
68 |
+
|
69 |
+
# 3. Save Metadata
|
70 |
+
validate_and_save_cohort_info(
|
71 |
+
is_final=False,
|
72 |
+
cohort=cohort,
|
73 |
+
info_path=json_path,
|
74 |
+
is_gene_available=is_gene_available,
|
75 |
+
is_trait_available=trait_row is not None
|
76 |
+
)
|
77 |
+
|
78 |
+
# 4. Clinical Feature Extraction
|
79 |
+
if trait_row is not None:
|
80 |
+
selected_clinical = geo_select_clinical_features(
|
81 |
+
clinical_data,
|
82 |
+
trait=trait,
|
83 |
+
trait_row=trait_row,
|
84 |
+
convert_trait=convert_trait,
|
85 |
+
age_row=age_row,
|
86 |
+
convert_age=convert_age,
|
87 |
+
gender_row=gender_row,
|
88 |
+
convert_gender=convert_gender
|
89 |
+
)
|
90 |
+
|
91 |
+
print("Preview of selected clinical features:")
|
92 |
+
print(preview_df(selected_clinical))
|
93 |
+
|
94 |
+
# Save clinical data
|
95 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
96 |
+
# Get gene expression data from matrix file
|
97 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
98 |
+
|
99 |
+
# Examine data structure
|
100 |
+
print("Data structure and head:")
|
101 |
+
print(genetic_data.head())
|
102 |
+
|
103 |
+
print("\nShape:", genetic_data.shape)
|
104 |
+
|
105 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
106 |
+
print(list(genetic_data.index)[:20])
|
107 |
+
|
108 |
+
# Get a few column names to verify sample IDs
|
109 |
+
print("\nFirst 5 column names:")
|
110 |
+
print(list(genetic_data.columns)[:5])
|
111 |
+
# Based on the gene identifiers shown (e.g., '16650001', '16650003', etc.),
|
112 |
+
# these appear to be probe IDs from a microarray platform rather than human gene symbols.
|
113 |
+
# They need to be mapped to standard gene symbols for analysis.
|
114 |
+
requires_gene_mapping = True
|
115 |
+
# Extract gene annotation data
|
116 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
117 |
+
|
118 |
+
# Display column names and preview data
|
119 |
+
print("Column names:")
|
120 |
+
print(gene_annotation.columns)
|
121 |
+
|
122 |
+
print("\nPreview of gene annotation data:")
|
123 |
+
print(preview_df(gene_annotation))
|
124 |
+
# From inspection, 'ID' stores gene identifiers matching those in expression data,
|
125 |
+
# and 'gene_assignment' contains gene symbols
|
126 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
|
127 |
+
|
128 |
+
# Apply mapping to convert probe-level measurements to gene expression data
|
129 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
130 |
+
|
131 |
+
# Preview results
|
132 |
+
print("Gene expression data shape:", gene_data.shape)
|
133 |
+
print("\nFirst 5 gene symbols:", gene_data.index[:5])
|
134 |
+
print("\nPreview of expression values:")
|
135 |
+
print(gene_data.head())
|
136 |
+
|
137 |
+
# Save gene expression data
|
138 |
+
gene_data.to_csv(out_gene_data_file)
|
139 |
+
# Reload clinical data that was processed earlier
|
140 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
141 |
+
|
142 |
+
# 1. Normalize gene symbols
|
143 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
144 |
+
genetic_data.to_csv(out_gene_data_file)
|
145 |
+
|
146 |
+
# 2. Link clinical and genetic data
|
147 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
148 |
+
|
149 |
+
# 3. Handle missing values systematically
|
150 |
+
linked_data = handle_missing_values(linked_data, trait)
|
151 |
+
|
152 |
+
# 4. Check for bias in trait and demographic features
|
153 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
154 |
+
|
155 |
+
# 5. Final validation and information saving
|
156 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
157 |
+
is_usable = validate_and_save_cohort_info(
|
158 |
+
is_final=True,
|
159 |
+
cohort=cohort,
|
160 |
+
info_path=json_path,
|
161 |
+
is_gene_available=True,
|
162 |
+
is_trait_available=True,
|
163 |
+
is_biased=trait_biased,
|
164 |
+
df=linked_data,
|
165 |
+
note=note
|
166 |
+
)
|
167 |
+
|
168 |
+
# 6. Save linked data only if usable
|
169 |
+
if is_usable:
|
170 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
171 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Metabolic_Rate/code/GSE151683.py
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE151683"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE151683"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE151683.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE151683.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE151683.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Based on background info mentioning DNA microarray analysis and gene expression profiles
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Identify rows for each variable
|
38 |
+
# Trait (Metabolic Rate) can be inferred from treatment group and time
|
39 |
+
trait_row = 4 # time weeks used to calculate metabolic rate change
|
40 |
+
gender_row = 1 # Gender data available
|
41 |
+
age_row = 2 # Age data available
|
42 |
+
|
43 |
+
# 2.2 Conversion functions
|
44 |
+
def convert_trait(value: str) -> Optional[float]:
|
45 |
+
"""Convert time weeks to binary - 0 for baseline, 1 for endpoint"""
|
46 |
+
if not value:
|
47 |
+
return None
|
48 |
+
try:
|
49 |
+
time = float(value.split(': ')[1])
|
50 |
+
if time == 0:
|
51 |
+
return 0.0
|
52 |
+
elif time == 8:
|
53 |
+
return 1.0
|
54 |
+
return None
|
55 |
+
except:
|
56 |
+
return None
|
57 |
+
|
58 |
+
def convert_age(value: str) -> Optional[float]:
|
59 |
+
"""Convert age to float"""
|
60 |
+
if not value:
|
61 |
+
return None
|
62 |
+
try:
|
63 |
+
age = float(value.split(': ')[1])
|
64 |
+
return age
|
65 |
+
except:
|
66 |
+
return None
|
67 |
+
|
68 |
+
def convert_gender(value: str) -> Optional[float]:
|
69 |
+
"""Convert gender to binary - 0 for female, 1 for male"""
|
70 |
+
if not value:
|
71 |
+
return None
|
72 |
+
gender = value.split(': ')[1].lower()
|
73 |
+
if gender == 'male':
|
74 |
+
return 1.0
|
75 |
+
elif gender == 'female':
|
76 |
+
return 0.0
|
77 |
+
return None
|
78 |
+
|
79 |
+
# 3. Save metadata
|
80 |
+
validate_and_save_cohort_info(
|
81 |
+
is_final=False,
|
82 |
+
cohort=cohort,
|
83 |
+
info_path=json_path,
|
84 |
+
is_gene_available=is_gene_available,
|
85 |
+
is_trait_available=trait_row is not None
|
86 |
+
)
|
87 |
+
|
88 |
+
# 4. Extract clinical features
|
89 |
+
selected_clinical = geo_select_clinical_features(
|
90 |
+
clinical_df=clinical_data,
|
91 |
+
trait=trait,
|
92 |
+
trait_row=trait_row,
|
93 |
+
convert_trait=convert_trait,
|
94 |
+
age_row=age_row,
|
95 |
+
convert_age=convert_age,
|
96 |
+
gender_row=gender_row,
|
97 |
+
convert_gender=convert_gender
|
98 |
+
)
|
99 |
+
|
100 |
+
# Preview the data
|
101 |
+
preview_data = preview_df(selected_clinical)
|
102 |
+
print("Preview of clinical data:")
|
103 |
+
print(preview_data)
|
104 |
+
|
105 |
+
# Save clinical data
|
106 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
107 |
+
# Get gene expression data from matrix file
|
108 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
109 |
+
|
110 |
+
# Examine data structure
|
111 |
+
print("Data structure and head:")
|
112 |
+
print(genetic_data.head())
|
113 |
+
|
114 |
+
print("\nShape:", genetic_data.shape)
|
115 |
+
|
116 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
117 |
+
print(list(genetic_data.index)[:20])
|
118 |
+
|
119 |
+
# Get a few column names to verify sample IDs
|
120 |
+
print("\nFirst 5 column names:")
|
121 |
+
print(list(genetic_data.columns)[:5])
|
122 |
+
# These identifiers are Affymetrix probe IDs (ending in "_at" or "_s_at"),
|
123 |
+
# not standard human gene symbols.
|
124 |
+
# They need to be mapped to gene symbols for consistency and interpretability.
|
125 |
+
requires_gene_mapping = True
|
126 |
+
# Extract gene annotation data
|
127 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
128 |
+
|
129 |
+
# Display column names and preview data
|
130 |
+
print("Column names:")
|
131 |
+
print(gene_annotation.columns)
|
132 |
+
|
133 |
+
print("\nPreview of gene annotation data:")
|
134 |
+
print(preview_df(gene_annotation))
|
135 |
+
# Get mapping between probe IDs and gene symbols
|
136 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
137 |
+
|
138 |
+
# Apply mapping to convert probe level data to gene level data
|
139 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
140 |
+
|
141 |
+
# Save processed gene expression data
|
142 |
+
gene_data.to_csv(out_gene_data_file)
|
143 |
+
|
144 |
+
# Preview results
|
145 |
+
print("Preview of mapped gene expression data:")
|
146 |
+
print(gene_data.head())
|
147 |
+
print("\nShape:", gene_data.shape)
|
148 |
+
# Reload clinical data that was processed earlier
|
149 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
150 |
+
|
151 |
+
# 1. Normalize gene symbols
|
152 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
153 |
+
genetic_data.to_csv(out_gene_data_file)
|
154 |
+
|
155 |
+
# 2. Link clinical and genetic data
|
156 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
157 |
+
|
158 |
+
# 3. Handle missing values systematically
|
159 |
+
linked_data = handle_missing_values(linked_data, trait)
|
160 |
+
|
161 |
+
# 4. Check for bias in trait and demographic features
|
162 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
163 |
+
|
164 |
+
# 5. Final validation and information saving
|
165 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
166 |
+
is_usable = validate_and_save_cohort_info(
|
167 |
+
is_final=True,
|
168 |
+
cohort=cohort,
|
169 |
+
info_path=json_path,
|
170 |
+
is_gene_available=True,
|
171 |
+
is_trait_available=True,
|
172 |
+
is_biased=trait_biased,
|
173 |
+
df=linked_data,
|
174 |
+
note=note
|
175 |
+
)
|
176 |
+
|
177 |
+
# 6. Save linked data only if usable
|
178 |
+
if is_usable:
|
179 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
180 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Metabolic_Rate/code/GSE23025.py
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE23025"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE23025"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE23025.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE23025.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE23025.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Yes - this dataset contains gene expression data from Affymetrix HG U133 plus 2.0 Arrays
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Data Availability
|
38 |
+
trait_row = 3 # patient status indicates metabolic rate (case vs control)
|
39 |
+
age_row = None # age data not available
|
40 |
+
gender_row = None # gender data not available
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion
|
43 |
+
def convert_trait(x):
|
44 |
+
"""Convert case/control status to binary"""
|
45 |
+
if x is None:
|
46 |
+
return None
|
47 |
+
val = x.split(': ')[-1].strip().lower()
|
48 |
+
if val == 'case':
|
49 |
+
return 1
|
50 |
+
elif val == 'control':
|
51 |
+
return 0
|
52 |
+
return None
|
53 |
+
|
54 |
+
convert_age = None # No age data
|
55 |
+
convert_gender = None # No gender data
|
56 |
+
|
57 |
+
# 3. Save Metadata
|
58 |
+
is_trait_available = trait_row is not None
|
59 |
+
validate_and_save_cohort_info(is_final=False, cohort=cohort, info_path=json_path,
|
60 |
+
is_gene_available=is_gene_available,
|
61 |
+
is_trait_available=is_trait_available)
|
62 |
+
|
63 |
+
# 4. Clinical Feature Extraction
|
64 |
+
if trait_row is not None:
|
65 |
+
clinical_features = geo_select_clinical_features(
|
66 |
+
clinical_df=clinical_data,
|
67 |
+
trait=trait,
|
68 |
+
trait_row=trait_row,
|
69 |
+
convert_trait=convert_trait,
|
70 |
+
age_row=age_row,
|
71 |
+
convert_age=convert_age,
|
72 |
+
gender_row=gender_row,
|
73 |
+
convert_gender=convert_gender
|
74 |
+
)
|
75 |
+
preview_df(clinical_features)
|
76 |
+
clinical_features.to_csv(out_clinical_data_file)
|
77 |
+
# Get gene expression data from matrix file
|
78 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
79 |
+
|
80 |
+
# Examine data structure
|
81 |
+
print("Data structure and head:")
|
82 |
+
print(genetic_data.head())
|
83 |
+
|
84 |
+
print("\nShape:", genetic_data.shape)
|
85 |
+
|
86 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
87 |
+
print(list(genetic_data.index)[:20])
|
88 |
+
|
89 |
+
# Get a few column names to verify sample IDs
|
90 |
+
print("\nFirst 5 column names:")
|
91 |
+
print(list(genetic_data.columns)[:5])
|
92 |
+
# Based on the gene identifiers in the format "XXXX_at" or "XXXX_s_at",
|
93 |
+
# these appear to be Affymetrix probe IDs rather than human gene symbols
|
94 |
+
requires_gene_mapping = True
|
95 |
+
# Extract gene annotation data
|
96 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
97 |
+
|
98 |
+
# Display column names and preview data
|
99 |
+
print("Column names:")
|
100 |
+
print(gene_annotation.columns)
|
101 |
+
|
102 |
+
print("\nPreview of gene annotation data:")
|
103 |
+
print(preview_df(gene_annotation))
|
104 |
+
# Get gene mapping dataframe using ID and Gene Symbol columns
|
105 |
+
gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
106 |
+
|
107 |
+
# Apply gene mapping to convert probe measurements to gene expression
|
108 |
+
gene_data = apply_gene_mapping(genetic_data, gene_mapping)
|
109 |
+
|
110 |
+
# Preview the converted gene data
|
111 |
+
print("Gene expression data shape after mapping:", gene_data.shape)
|
112 |
+
print("\nFirst few genes and their expression values:")
|
113 |
+
print(gene_data.head())
|
114 |
+
# Reload clinical data that was processed earlier
|
115 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
116 |
+
|
117 |
+
# 1. Normalize gene symbols
|
118 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
119 |
+
genetic_data.to_csv(out_gene_data_file)
|
120 |
+
|
121 |
+
# 2. Link clinical and genetic data
|
122 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
123 |
+
|
124 |
+
# 3. Handle missing values systematically
|
125 |
+
linked_data = handle_missing_values(linked_data, trait)
|
126 |
+
|
127 |
+
# 4. Check for bias in trait and demographic features
|
128 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
129 |
+
|
130 |
+
# 5. Final validation and information saving
|
131 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
132 |
+
is_usable = validate_and_save_cohort_info(
|
133 |
+
is_final=True,
|
134 |
+
cohort=cohort,
|
135 |
+
info_path=json_path,
|
136 |
+
is_gene_available=True,
|
137 |
+
is_trait_available=True,
|
138 |
+
is_biased=trait_biased,
|
139 |
+
df=linked_data,
|
140 |
+
note=note
|
141 |
+
)
|
142 |
+
|
143 |
+
# 6. Save linked data only if usable
|
144 |
+
if is_usable:
|
145 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
146 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Metabolic_Rate/code/GSE26440.py
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE26440"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE26440"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE26440.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE26440.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE26440.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
is_gene_available = True # Based on background info mentioning "genome-wide expression profiling"
|
34 |
+
|
35 |
+
# 2. Variable Availability and Data Type Conversion
|
36 |
+
# 2.1 Data Availability
|
37 |
+
trait_row = 3 # outcome indicates metabolic state/survival
|
38 |
+
age_row = 2 # age is available
|
39 |
+
gender_row = None # gender info not available
|
40 |
+
|
41 |
+
# 2.2 Data Type Conversion
|
42 |
+
def convert_trait(x):
|
43 |
+
if not isinstance(x, str):
|
44 |
+
return None
|
45 |
+
x = x.lower().split(': ')[-1].strip()
|
46 |
+
if x == 'survivor':
|
47 |
+
return 1
|
48 |
+
elif x == 'nonsurvivor':
|
49 |
+
return 0
|
50 |
+
return None
|
51 |
+
|
52 |
+
def convert_age(x):
|
53 |
+
if not isinstance(x, str):
|
54 |
+
return None
|
55 |
+
try:
|
56 |
+
return float(x.split(': ')[-1])
|
57 |
+
except:
|
58 |
+
return None
|
59 |
+
|
60 |
+
def convert_gender(x):
|
61 |
+
return None # gender data not available
|
62 |
+
|
63 |
+
# 3. Save Metadata
|
64 |
+
validate_and_save_cohort_info(
|
65 |
+
is_final=False,
|
66 |
+
cohort=cohort,
|
67 |
+
info_path=json_path,
|
68 |
+
is_gene_available=is_gene_available,
|
69 |
+
is_trait_available=trait_row is not None
|
70 |
+
)
|
71 |
+
|
72 |
+
# 4. Clinical Feature Extraction
|
73 |
+
selected_clinical_df = geo_select_clinical_features(
|
74 |
+
clinical_df=clinical_data,
|
75 |
+
trait=trait,
|
76 |
+
trait_row=trait_row,
|
77 |
+
convert_trait=convert_trait,
|
78 |
+
age_row=age_row,
|
79 |
+
convert_age=convert_age
|
80 |
+
)
|
81 |
+
|
82 |
+
# Preview the data
|
83 |
+
preview_dict = preview_df(selected_clinical_df)
|
84 |
+
|
85 |
+
# Save clinical data
|
86 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
87 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
88 |
+
# Get gene expression data from matrix file
|
89 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
90 |
+
|
91 |
+
# Examine data structure
|
92 |
+
print("Data structure and head:")
|
93 |
+
print(genetic_data.head())
|
94 |
+
|
95 |
+
print("\nShape:", genetic_data.shape)
|
96 |
+
|
97 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
98 |
+
print(list(genetic_data.index)[:20])
|
99 |
+
|
100 |
+
# Get a few column names to verify sample IDs
|
101 |
+
print("\nFirst 5 column names:")
|
102 |
+
print(list(genetic_data.columns)[:5])
|
103 |
+
# The identifiers (e.g. 1007_s_at, 1053_at) appear to be Affymetrix probe IDs
|
104 |
+
# These need to be mapped to gene symbols for proper analysis
|
105 |
+
requires_gene_mapping = True
|
106 |
+
# Extract gene annotation data
|
107 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
108 |
+
|
109 |
+
# Display column names and preview data
|
110 |
+
print("Column names:")
|
111 |
+
print(gene_annotation.columns)
|
112 |
+
|
113 |
+
print("\nPreview of gene annotation data:")
|
114 |
+
print(preview_df(gene_annotation))
|
115 |
+
# Get gene mapping data
|
116 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
117 |
+
|
118 |
+
# Apply gene mapping to convert probe data to gene data
|
119 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
120 |
+
|
121 |
+
# Save gene expression data
|
122 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
123 |
+
gene_data.to_csv(out_gene_data_file)
|
124 |
+
|
125 |
+
print("\nShape after mapping probes to genes:", gene_data.shape)
|
126 |
+
print("\nFirst few gene symbols:")
|
127 |
+
print(list(gene_data.index)[:10])
|
128 |
+
# Reload clinical data that was processed earlier
|
129 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
130 |
+
|
131 |
+
# 1. Normalize gene symbols
|
132 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
133 |
+
genetic_data.to_csv(out_gene_data_file)
|
134 |
+
|
135 |
+
# 2. Link clinical and genetic data
|
136 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
137 |
+
|
138 |
+
# 3. Handle missing values systematically
|
139 |
+
linked_data = handle_missing_values(linked_data, trait)
|
140 |
+
|
141 |
+
# 4. Check for bias in trait and demographic features
|
142 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
143 |
+
|
144 |
+
# 5. Final validation and information saving
|
145 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
146 |
+
is_usable = validate_and_save_cohort_info(
|
147 |
+
is_final=True,
|
148 |
+
cohort=cohort,
|
149 |
+
info_path=json_path,
|
150 |
+
is_gene_available=True,
|
151 |
+
is_trait_available=True,
|
152 |
+
is_biased=trait_biased,
|
153 |
+
df=linked_data,
|
154 |
+
note=note
|
155 |
+
)
|
156 |
+
|
157 |
+
# 6. Save linked data only if usable
|
158 |
+
if is_usable:
|
159 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
160 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Metabolic_Rate/code/GSE40589.py
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE40589"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE40589"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE40589.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE40589.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE40589.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
is_gene_available = True # Yes, based on Series_title and Series_summary describing gene expression in adipose tissue
|
34 |
+
|
35 |
+
# 2. Variable Availability and Row Identification
|
36 |
+
trait_row = None # Metabolic rate not available in sample characteristics
|
37 |
+
age_row = None # Age not available
|
38 |
+
gender_row = None # Gender not available
|
39 |
+
|
40 |
+
# 2.2 Data Type Conversion Functions
|
41 |
+
def convert_trait(x):
|
42 |
+
return None # Not used since trait data not available
|
43 |
+
|
44 |
+
def convert_age(x):
|
45 |
+
return None # Not used since age data not available
|
46 |
+
|
47 |
+
def convert_gender(x):
|
48 |
+
return None # Not used since gender data not available
|
49 |
+
|
50 |
+
# 3. Save Metadata
|
51 |
+
is_trait_available = trait_row is not None
|
52 |
+
validate_and_save_cohort_info(is_final=False,
|
53 |
+
cohort=cohort,
|
54 |
+
info_path=json_path,
|
55 |
+
is_gene_available=is_gene_available,
|
56 |
+
is_trait_available=is_trait_available)
|
57 |
+
|
58 |
+
# 4. Clinical Feature Extraction
|
59 |
+
# Skip since trait_row is None
|
60 |
+
# Get gene expression data from matrix file
|
61 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
62 |
+
|
63 |
+
# Examine data structure
|
64 |
+
print("Data structure and head:")
|
65 |
+
print(genetic_data.head())
|
66 |
+
|
67 |
+
print("\nShape:", genetic_data.shape)
|
68 |
+
|
69 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
70 |
+
print(list(genetic_data.index)[:20])
|
71 |
+
|
72 |
+
# Get a few column names to verify sample IDs
|
73 |
+
print("\nFirst 5 column names:")
|
74 |
+
print(list(genetic_data.columns)[:5])
|
75 |
+
# These identifiers start with 'A_23' indicating they are Agilent array probe IDs
|
76 |
+
# They need to be mapped to human gene symbols for proper analysis
|
77 |
+
requires_gene_mapping = True
|
78 |
+
# Extract gene annotation data
|
79 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
80 |
+
|
81 |
+
# Display column names and preview data
|
82 |
+
print("Column names:")
|
83 |
+
print(gene_annotation.columns)
|
84 |
+
|
85 |
+
print("\nPreview of gene annotation data:")
|
86 |
+
print(preview_df(gene_annotation))
|
87 |
+
# Create mapping between probe IDs and gene symbols
|
88 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
|
89 |
+
|
90 |
+
# Apply gene mapping to convert probe data to gene expression data
|
91 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
92 |
+
|
93 |
+
# Print first few rows and shape to verify mapping worked
|
94 |
+
print("Gene expression data after mapping:")
|
95 |
+
print(gene_data.head())
|
96 |
+
print("\nShape after mapping:", gene_data.shape)
|
97 |
+
# 1. Normalize gene symbols
|
98 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
99 |
+
genetic_data.to_csv(out_gene_data_file)
|
100 |
+
|
101 |
+
# Since we lack clinical data, use initial validation to filter out the dataset
|
102 |
+
is_usable = validate_and_save_cohort_info(
|
103 |
+
is_final=False, # Initial validation for filtering out datasets lacking required data
|
104 |
+
cohort=cohort,
|
105 |
+
info_path=json_path,
|
106 |
+
is_gene_available=True,
|
107 |
+
is_trait_available=False
|
108 |
+
)
|
p3/preprocess/Metabolic_Rate/code/GSE40873.py
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE40873"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE40873"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE40873.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE40873.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE40873.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene expression data availability
|
33 |
+
# Yes - The background indicates this is a genome-wide gene expression analysis
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable availability and data type conversion
|
37 |
+
# 2.1 Row identifiers
|
38 |
+
trait_row = 2 # Metabolic rate can be inferred from survival time
|
39 |
+
age_row = None # Age not available
|
40 |
+
gender_row = None # Gender not available
|
41 |
+
|
42 |
+
# 2.2 Conversion functions
|
43 |
+
def convert_trait(x):
|
44 |
+
"""Convert multicentric occurrence-free survival days to metabolic rate"""
|
45 |
+
try:
|
46 |
+
# Extract number after colon and convert to float
|
47 |
+
days = float(x.split(': ')[1])
|
48 |
+
# Higher survival time indicates better metabolic function
|
49 |
+
# Normalize to 0-1 range using 2500 days as max
|
50 |
+
return min(days/2500, 1.0)
|
51 |
+
except:
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_age(x):
|
55 |
+
return None # Not used since age data unavailable
|
56 |
+
|
57 |
+
def convert_gender(x):
|
58 |
+
return None # Not used since gender data unavailable
|
59 |
+
|
60 |
+
# 3. Save metadata
|
61 |
+
validate_and_save_cohort_info(
|
62 |
+
is_final=False,
|
63 |
+
cohort=cohort,
|
64 |
+
info_path=json_path,
|
65 |
+
is_gene_available=is_gene_available,
|
66 |
+
is_trait_available=trait_row is not None
|
67 |
+
)
|
68 |
+
|
69 |
+
# 4. Extract clinical features
|
70 |
+
clinical_df = geo_select_clinical_features(
|
71 |
+
clinical_df=clinical_data,
|
72 |
+
trait=trait,
|
73 |
+
trait_row=trait_row,
|
74 |
+
convert_trait=convert_trait
|
75 |
+
)
|
76 |
+
|
77 |
+
# Preview and save clinical data
|
78 |
+
print(preview_df(clinical_df))
|
79 |
+
clinical_df.to_csv(out_clinical_data_file)
|
80 |
+
# Get gene expression data from matrix file
|
81 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
82 |
+
|
83 |
+
# Examine data structure
|
84 |
+
print("Data structure and head:")
|
85 |
+
print(genetic_data.head())
|
86 |
+
|
87 |
+
print("\nShape:", genetic_data.shape)
|
88 |
+
|
89 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
90 |
+
print(list(genetic_data.index)[:20])
|
91 |
+
|
92 |
+
# Get a few column names to verify sample IDs
|
93 |
+
print("\nFirst 5 column names:")
|
94 |
+
print(list(genetic_data.columns)[:5])
|
95 |
+
# Based on ID format (e.g., '1007_s_at'), these are Affymetrix probe IDs, not gene symbols
|
96 |
+
# They need to be mapped to standard gene symbols for analysis
|
97 |
+
requires_gene_mapping = True
|
98 |
+
# Extract gene annotation data
|
99 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
100 |
+
|
101 |
+
# Display column names and preview data
|
102 |
+
print("Column names:")
|
103 |
+
print(gene_annotation.columns)
|
104 |
+
|
105 |
+
print("\nPreview of gene annotation data:")
|
106 |
+
print(preview_df(gene_annotation))
|
107 |
+
# Get gene mapping from annotation data
|
108 |
+
# 'ID' column stores probe IDs matching gene expression data
|
109 |
+
# 'Gene Symbol' column stores target gene symbols
|
110 |
+
mapping_df = get_gene_mapping(gene_annotation, 'ID', 'Gene Symbol')
|
111 |
+
|
112 |
+
# Apply gene mapping to convert probe-level data to gene expression data
|
113 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
114 |
+
|
115 |
+
# Preview mapped gene expression data
|
116 |
+
print("Shape after gene mapping:", gene_data.shape)
|
117 |
+
print("\nFirst few mapped genes and their expression values:")
|
118 |
+
print(gene_data.head())
|
119 |
+
|
120 |
+
# Save gene expression data
|
121 |
+
gene_data.to_csv(out_gene_data_file)
|
122 |
+
# Reload clinical data that was processed earlier
|
123 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
124 |
+
|
125 |
+
# 1. Normalize gene symbols
|
126 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
127 |
+
genetic_data.to_csv(out_gene_data_file)
|
128 |
+
|
129 |
+
# 2. Link clinical and genetic data
|
130 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
131 |
+
|
132 |
+
# 3. Handle missing values systematically
|
133 |
+
linked_data = handle_missing_values(linked_data, trait)
|
134 |
+
|
135 |
+
# 4. Check for bias in trait and demographic features
|
136 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
137 |
+
|
138 |
+
# 5. Final validation and information saving
|
139 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
140 |
+
is_usable = validate_and_save_cohort_info(
|
141 |
+
is_final=True,
|
142 |
+
cohort=cohort,
|
143 |
+
info_path=json_path,
|
144 |
+
is_gene_available=True,
|
145 |
+
is_trait_available=True,
|
146 |
+
is_biased=trait_biased,
|
147 |
+
df=linked_data,
|
148 |
+
note=note
|
149 |
+
)
|
150 |
+
|
151 |
+
# 6. Save linked data only if usable
|
152 |
+
if is_usable:
|
153 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
154 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Metabolic_Rate/code/GSE41168.py
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE41168"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE41168"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE41168.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE41168.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE41168.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
is_gene_available = True # The background indicates this is a gene expression study involving muscle and adipose tissue
|
34 |
+
|
35 |
+
# 2.1 Data Availability
|
36 |
+
trait_row = None # Metabolic rate data is described in background but not given in characteristics
|
37 |
+
age_row = None # Age is not available in characteristics
|
38 |
+
gender_row = 3 # Gender information is in row 3
|
39 |
+
|
40 |
+
# 2.2 Data Type Conversion Functions
|
41 |
+
def convert_trait(x):
|
42 |
+
return None # Not used since trait data not available
|
43 |
+
|
44 |
+
def convert_age(x):
|
45 |
+
return None # Not used since age data not available
|
46 |
+
|
47 |
+
def convert_gender(x):
|
48 |
+
if not isinstance(x, str):
|
49 |
+
return None
|
50 |
+
x = x.lower().split(': ')[-1].strip()
|
51 |
+
if 'female' in x:
|
52 |
+
return 0
|
53 |
+
elif 'male' in x:
|
54 |
+
return 1
|
55 |
+
return None
|
56 |
+
|
57 |
+
# 3. Save Metadata
|
58 |
+
is_trait_available = trait_row is not None
|
59 |
+
validate_and_save_cohort_info(
|
60 |
+
is_final=False,
|
61 |
+
cohort=cohort,
|
62 |
+
info_path=json_path,
|
63 |
+
is_gene_available=is_gene_available,
|
64 |
+
is_trait_available=is_trait_available
|
65 |
+
)
|
66 |
+
|
67 |
+
# 4. Clinical Feature Extraction
|
68 |
+
# Skip since trait_row is None
|
69 |
+
# Get gene expression data from matrix file
|
70 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
71 |
+
|
72 |
+
# Examine data structure
|
73 |
+
print("Data structure and head:")
|
74 |
+
print(genetic_data.head())
|
75 |
+
|
76 |
+
print("\nShape:", genetic_data.shape)
|
77 |
+
|
78 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
79 |
+
print(list(genetic_data.index)[:20])
|
80 |
+
|
81 |
+
# Get a few column names to verify sample IDs
|
82 |
+
print("\nFirst 5 column names:")
|
83 |
+
print(list(genetic_data.columns)[:5])
|
84 |
+
# These are probe IDs from Affymetrix arrays (_at suffix is typical for Affy probes)
|
85 |
+
# They need to be mapped to gene symbols
|
86 |
+
requires_gene_mapping = True
|
87 |
+
# Extract gene annotation data
|
88 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
89 |
+
|
90 |
+
# Display column names and preview data
|
91 |
+
print("Column names:")
|
92 |
+
print(gene_annotation.columns)
|
93 |
+
|
94 |
+
print("\nPreview of gene annotation data:")
|
95 |
+
print(preview_df(gene_annotation))
|
96 |
+
# Get gene mapping dataframe
|
97 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
98 |
+
|
99 |
+
# Convert probe-level measurements to gene expression data using the mapping
|
100 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
101 |
+
|
102 |
+
print("Gene data shape:", gene_data.shape)
|
103 |
+
print("\nPreview of gene data:")
|
104 |
+
print(preview_df(gene_data))
|
105 |
+
# 1. Normalize gene symbols
|
106 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
107 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
108 |
+
genetic_data.to_csv(out_gene_data_file)
|
109 |
+
|
110 |
+
# Create a simple dataframe just for validation since no trait data available
|
111 |
+
df = pd.DataFrame({'no_trait': [0]})
|
112 |
+
|
113 |
+
# Since clinical data was not available (trait_row was None), mark dataset as unusable
|
114 |
+
note = "Contains gene expression data but no metabolic rate measurements"
|
115 |
+
validate_and_save_cohort_info(
|
116 |
+
is_final=True,
|
117 |
+
cohort=cohort,
|
118 |
+
info_path=json_path,
|
119 |
+
is_gene_available=True,
|
120 |
+
is_trait_available=False,
|
121 |
+
is_biased=True, # Set to True since dataset lacks trait data
|
122 |
+
df=df,
|
123 |
+
note=note
|
124 |
+
)
|
125 |
+
# No linked data saved since trait data was unavailable
|
p3/preprocess/Metabolic_Rate/code/GSE61225.py
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE61225"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE61225"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE61225.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE61225.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE61225.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Yes - Illumina HumanHT-12v3 Expression-BeadChip indicates gene expression data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# Trait (Metabolic Rate) is in row 4 as metabolic equivalents (METs)
|
38 |
+
trait_row = 4
|
39 |
+
# Age is in row 6
|
40 |
+
age_row = 6
|
41 |
+
# Gender is in row 5
|
42 |
+
gender_row = 5
|
43 |
+
|
44 |
+
def convert_trait(x):
|
45 |
+
# Convert metabolic equivalents to float
|
46 |
+
try:
|
47 |
+
return float(x.split(': ')[1])
|
48 |
+
except:
|
49 |
+
return None
|
50 |
+
|
51 |
+
def convert_age(x):
|
52 |
+
try:
|
53 |
+
return float(x.split(': ')[1])
|
54 |
+
except:
|
55 |
+
return None
|
56 |
+
|
57 |
+
def convert_gender(x):
|
58 |
+
try:
|
59 |
+
gender = x.split(': ')[1].lower()
|
60 |
+
return 0 if gender == 'female' else 1 if gender == 'male' else None
|
61 |
+
except:
|
62 |
+
return None
|
63 |
+
|
64 |
+
# 3. Save Metadata
|
65 |
+
is_trait_available = trait_row is not None
|
66 |
+
validate_and_save_cohort_info(is_final=False,
|
67 |
+
cohort=cohort,
|
68 |
+
info_path=json_path,
|
69 |
+
is_gene_available=is_gene_available,
|
70 |
+
is_trait_available=is_trait_available)
|
71 |
+
|
72 |
+
# 4. Clinical Feature Extraction
|
73 |
+
if trait_row is not None:
|
74 |
+
selected_clinical_df = geo_select_clinical_features(
|
75 |
+
clinical_df=clinical_data,
|
76 |
+
trait=trait,
|
77 |
+
trait_row=trait_row,
|
78 |
+
convert_trait=convert_trait,
|
79 |
+
age_row=age_row,
|
80 |
+
convert_age=convert_age,
|
81 |
+
gender_row=gender_row,
|
82 |
+
convert_gender=convert_gender
|
83 |
+
)
|
84 |
+
|
85 |
+
# Preview the extracted features
|
86 |
+
preview = preview_df(selected_clinical_df)
|
87 |
+
print("Clinical Features Preview:")
|
88 |
+
print(preview)
|
89 |
+
|
90 |
+
# Save to CSV
|
91 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
92 |
+
# Get gene expression data from matrix file
|
93 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
94 |
+
|
95 |
+
# Examine data structure
|
96 |
+
print("Data structure and head:")
|
97 |
+
print(genetic_data.head())
|
98 |
+
|
99 |
+
print("\nShape:", genetic_data.shape)
|
100 |
+
|
101 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
102 |
+
print(list(genetic_data.index)[:20])
|
103 |
+
|
104 |
+
# Get a few column names to verify sample IDs
|
105 |
+
print("\nFirst 5 column names:")
|
106 |
+
print(list(genetic_data.columns)[:5])
|
107 |
+
# The gene identifiers start with "ILMN_" which indicates these are Illumina probe IDs
|
108 |
+
# These need to be mapped to standard human gene symbols for consistency and interpretability
|
109 |
+
requires_gene_mapping = True
|
110 |
+
# Extract gene annotation data
|
111 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
112 |
+
|
113 |
+
# Display column names and preview data
|
114 |
+
print("Column names:")
|
115 |
+
print(gene_annotation.columns)
|
116 |
+
|
117 |
+
print("\nPreview of gene annotation data:")
|
118 |
+
print(preview_df(gene_annotation))
|
119 |
+
# 1. Identify mapping columns:
|
120 |
+
# 'ID' in gene annotation matches the probe IDs in gene expression data
|
121 |
+
# 'ILMN_Gene' contains the gene symbols
|
122 |
+
prob_col = 'ID'
|
123 |
+
gene_col = 'ILMN_Gene'
|
124 |
+
|
125 |
+
# 2. Get mapping dataframe
|
126 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col, gene_col)
|
127 |
+
|
128 |
+
# 3. Convert probe measurements to gene expression
|
129 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
130 |
+
|
131 |
+
# Preview results
|
132 |
+
print("Gene expression data shape:", gene_data.shape)
|
133 |
+
print("\nFirst 5 gene symbols:", list(gene_data.index)[:5])
|
134 |
+
print("\nPreview of gene expression values:")
|
135 |
+
print(preview_df(gene_data))
|
136 |
+
# 1. Normalize gene symbols
|
137 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
138 |
+
genetic_data.to_csv(out_gene_data_file)
|
139 |
+
|
140 |
+
# 2. Link clinical and genetic data
|
141 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
142 |
+
|
143 |
+
# 3. Handle missing values systematically
|
144 |
+
linked_data = handle_missing_values(linked_data, trait)
|
145 |
+
|
146 |
+
# 4. Check for bias in trait and demographic features
|
147 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
148 |
+
|
149 |
+
# 5. Final validation and information saving
|
150 |
+
note = "Contains swimming pool exposure data with metabolic rate and gene expression measurements"
|
151 |
+
is_usable = validate_and_save_cohort_info(
|
152 |
+
is_final=True,
|
153 |
+
cohort=cohort,
|
154 |
+
info_path=json_path,
|
155 |
+
is_gene_available=True,
|
156 |
+
is_trait_available=True,
|
157 |
+
is_biased=trait_biased,
|
158 |
+
df=linked_data,
|
159 |
+
note=note
|
160 |
+
)
|
161 |
+
|
162 |
+
# 6. Save linked data only if usable
|
163 |
+
if is_usable:
|
164 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
165 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Metabolic_Rate/code/GSE89231.py
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
cohort = "GSE89231"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Metabolic_Rate"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Metabolic_Rate/GSE89231"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/GSE89231.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/GSE89231.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/GSE89231.csv"
|
16 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Yes, the series investigates gene expression profiling of DLBCL cell lines
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Data Availability
|
38 |
+
trait_row = 0 # Cell line names contain intrinsic doxorubicin sensitivity information
|
39 |
+
age_row = None # No age data for cell lines
|
40 |
+
gender_row = None # No gender data for cell lines
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion
|
43 |
+
def convert_trait(x):
|
44 |
+
# Extract cell line name after colon and strip whitespace
|
45 |
+
cell_line = x.split(':')[1].strip()
|
46 |
+
|
47 |
+
# Based on background info, DLBCL cell lines have different intrinsic sensitivity
|
48 |
+
# Convert to binary: 1 for sensitive, 0 for resistant cell lines
|
49 |
+
# Reference: https://pubmed.ncbi.nlm.nih.gov/28255297/
|
50 |
+
sensitive_lines = {'RIVA', 'U2932', 'FARAGE'}
|
51 |
+
resistant_lines = {'OCI-Ly7', 'SU-DHL-5', 'NU-DHL-1'}
|
52 |
+
|
53 |
+
if cell_line in sensitive_lines:
|
54 |
+
return 1
|
55 |
+
elif cell_line in resistant_lines:
|
56 |
+
return 0
|
57 |
+
return None
|
58 |
+
|
59 |
+
convert_age = None # No age data
|
60 |
+
convert_gender = None # No gender data
|
61 |
+
|
62 |
+
# 3. Save Metadata
|
63 |
+
# Initial filtering - trait data is available (trait_row is not None)
|
64 |
+
validate_and_save_cohort_info(
|
65 |
+
is_final=False,
|
66 |
+
cohort=cohort,
|
67 |
+
info_path=json_path,
|
68 |
+
is_gene_available=is_gene_available,
|
69 |
+
is_trait_available=True
|
70 |
+
)
|
71 |
+
|
72 |
+
# 4. Clinical Feature Extraction
|
73 |
+
# Since trait_row is not None, extract clinical features
|
74 |
+
clinical_features = geo_select_clinical_features(
|
75 |
+
clinical_df=clinical_data,
|
76 |
+
trait=trait,
|
77 |
+
trait_row=trait_row,
|
78 |
+
convert_trait=convert_trait,
|
79 |
+
age_row=age_row,
|
80 |
+
convert_age=convert_age,
|
81 |
+
gender_row=gender_row,
|
82 |
+
convert_gender=convert_gender
|
83 |
+
)
|
84 |
+
|
85 |
+
# Preview the extracted features
|
86 |
+
preview_result = preview_df(clinical_features)
|
87 |
+
print("Preview of clinical features:")
|
88 |
+
print(preview_result)
|
89 |
+
|
90 |
+
# Save clinical features
|
91 |
+
clinical_features.to_csv(out_clinical_data_file)
|
92 |
+
# Get gene expression data from matrix file
|
93 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
94 |
+
|
95 |
+
# Examine data structure
|
96 |
+
print("Data structure and head:")
|
97 |
+
print(genetic_data.head())
|
98 |
+
|
99 |
+
print("\nShape:", genetic_data.shape)
|
100 |
+
|
101 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
102 |
+
print(list(genetic_data.index)[:20])
|
103 |
+
|
104 |
+
# Get a few column names to verify sample IDs
|
105 |
+
print("\nFirst 5 column names:")
|
106 |
+
print(list(genetic_data.columns)[:5])
|
107 |
+
# Based on observing "_at" or "_s_at" patterns in the identifiers (e.g. "1007_s_at", "1053_at"),
|
108 |
+
# these appear to be Affymetrix probe IDs rather than gene symbols.
|
109 |
+
# They require mapping to human gene symbols.
|
110 |
+
requires_gene_mapping = True
|
111 |
+
# Extract gene annotation data
|
112 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
113 |
+
|
114 |
+
# Display column names and preview data
|
115 |
+
print("Column names:")
|
116 |
+
print(gene_annotation.columns)
|
117 |
+
|
118 |
+
print("\nPreview of gene annotation data:")
|
119 |
+
print(preview_df(gene_annotation))
|
120 |
+
# 1. Choose columns for mapping
|
121 |
+
# The gene expression data uses probe IDs (e.g., "1007_s_at") which match the 'ID' column
|
122 |
+
# Gene symbols are stored in the 'Gene Symbol' column
|
123 |
+
prob_col = 'ID'
|
124 |
+
gene_col = 'Gene Symbol'
|
125 |
+
|
126 |
+
# 2. Get gene mapping dataframe
|
127 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col, gene_col)
|
128 |
+
|
129 |
+
# 3. Apply gene mapping to convert probe data to gene expression data
|
130 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
131 |
+
|
132 |
+
# Preview mapped gene expression data
|
133 |
+
print("\nPreview of gene expression data after mapping:")
|
134 |
+
print(f"Shape: {gene_data.shape}")
|
135 |
+
print("\nFirst few rows:")
|
136 |
+
print(gene_data.head())
|
137 |
+
# 1. Normalize gene symbols
|
138 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
139 |
+
genetic_data.to_csv(out_gene_data_file)
|
140 |
+
|
141 |
+
# 2. Link clinical and genetic data
|
142 |
+
linked_data = geo_link_clinical_genetic_data(clinical_features, genetic_data)
|
143 |
+
|
144 |
+
# 3. Handle missing values systematically
|
145 |
+
linked_data = handle_missing_values(linked_data, trait)
|
146 |
+
|
147 |
+
# 4. Check for bias in trait and demographic features
|
148 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
149 |
+
|
150 |
+
# 5. Final validation and information saving
|
151 |
+
note = "Dataset contains doxorubicin sensitivity data from DLBCL cell lines, suitable for binary analysis."
|
152 |
+
is_usable = validate_and_save_cohort_info(
|
153 |
+
is_final=True,
|
154 |
+
cohort=cohort,
|
155 |
+
info_path=json_path,
|
156 |
+
is_gene_available=True,
|
157 |
+
is_trait_available=True,
|
158 |
+
is_biased=trait_biased,
|
159 |
+
df=linked_data,
|
160 |
+
note=note
|
161 |
+
)
|
162 |
+
|
163 |
+
# 6. Save linked data only if usable
|
164 |
+
if is_usable:
|
165 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
166 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Metabolic_Rate/code/TCGA.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Metabolic_Rate"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Metabolic_Rate/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Metabolic_Rate/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Metabolic_Rate/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Metabolic_Rate/cohort_info.json"
|
15 |
+
|
16 |
+
# Review the TCGA subdirectories and look for matches with Metabolic_Rate trait
|
17 |
+
# No directory clearly related to metabolic rate was found
|
18 |
+
|
19 |
+
# Record that this trait cannot be processed due to lack of suitable data
|
20 |
+
validate_and_save_cohort_info(
|
21 |
+
is_final=False,
|
22 |
+
cohort="TCGA",
|
23 |
+
info_path=json_path,
|
24 |
+
is_gene_available=True, # TCGA has gene expression data
|
25 |
+
is_trait_available=False # No suitable trait data found
|
26 |
+
)
|
p3/preprocess/Metabolic_Rate/gene_data/GSE101492.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Migraine/clinical_data/GSE67311.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM1644447,GSM1644448,GSM1644449,GSM1644450,GSM1644451,GSM1644452,GSM1644453,GSM1644454,GSM1644455,GSM1644456,GSM1644457,GSM1644458,GSM1644459,GSM1644460,GSM1644461,GSM1644462,GSM1644463,GSM1644464,GSM1644465,GSM1644466,GSM1644467,GSM1644468,GSM1644469,GSM1644470,GSM1644471,GSM1644472,GSM1644473,GSM1644474,GSM1644475,GSM1644476,GSM1644477,GSM1644478,GSM1644479,GSM1644480,GSM1644481,GSM1644482,GSM1644483,GSM1644484,GSM1644485,GSM1644486,GSM1644487,GSM1644488,GSM1644489,GSM1644490,GSM1644491,GSM1644492,GSM1644493,GSM1644494,GSM1644495,GSM1644496,GSM1644497,GSM1644498,GSM1644499,GSM1644500,GSM1644501,GSM1644502,GSM1644503,GSM1644504,GSM1644505,GSM1644506,GSM1644507,GSM1644508,GSM1644509,GSM1644510,GSM1644511,GSM1644512,GSM1644513,GSM1644514,GSM1644515,GSM1644516,GSM1644517,GSM1644518,GSM1644519,GSM1644520,GSM1644521,GSM1644522,GSM1644523,GSM1644524,GSM1644525,GSM1644526,GSM1644527,GSM1644528,GSM1644529,GSM1644530,GSM1644531,GSM1644532,GSM1644533,GSM1644534,GSM1644535,GSM1644536,GSM1644537,GSM1644538,GSM1644539,GSM1644540,GSM1644541,GSM1644542,GSM1644543,GSM1644544,GSM1644545,GSM1644546,GSM1644547,GSM1644548,GSM1644549,GSM1644550,GSM1644551,GSM1644552,GSM1644553,GSM1644554,GSM1644555,GSM1644556,GSM1644557,GSM1644558,GSM1644559,GSM1644560,GSM1644561,GSM1644562,GSM1644563,GSM1644564,GSM1644565,GSM1644566,GSM1644567,GSM1644568,GSM1644569,GSM1644570,GSM1644571,GSM1644572,GSM1644573,GSM1644574,GSM1644575,GSM1644576,GSM1644577,GSM1644578,GSM1644579,GSM1644580,GSM1644581,GSM1644582,GSM1644583,GSM1644584,GSM1644585,GSM1644586,GSM1644587,GSM1644588
|
2 |
+
Migraine,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,,1.0,1.0,1.0,1.0,0.0,1.0,,1.0,,1.0,1.0,0.0,0.0,,0.0,1.0,0.0,1.0,0.0,0.0,0.0,,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,,1.0,1.0,0.0
|
p3/preprocess/Migraine/code/GSE67311.py
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Migraine"
|
6 |
+
cohort = "GSE67311"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Migraine"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Migraine/GSE67311"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Migraine/GSE67311.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Migraine/gene_data/GSE67311.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Migraine/clinical_data/GSE67311.csv"
|
16 |
+
json_path = "./output/preprocess/3/Migraine/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# From background info, this dataset contains whole blood gene expression data using Affymetrix arrays
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
# Trait (Migraine) data is available in row 4
|
38 |
+
trait_row = 4
|
39 |
+
|
40 |
+
# Age is not available in the sample characteristics
|
41 |
+
age_row = None
|
42 |
+
|
43 |
+
# Gender is not available in the sample characteristics
|
44 |
+
gender_row = None
|
45 |
+
|
46 |
+
# 2.2 Data Type Conversion Functions
|
47 |
+
def convert_trait(value):
|
48 |
+
if pd.isna(value):
|
49 |
+
return None
|
50 |
+
# Extract value after colon and strip whitespace
|
51 |
+
value = value.split(':')[1].strip()
|
52 |
+
# Convert to binary where Yes=1, No=0, missing=None
|
53 |
+
if value == 'Yes':
|
54 |
+
return 1
|
55 |
+
elif value == 'No':
|
56 |
+
return 0
|
57 |
+
return None
|
58 |
+
|
59 |
+
def convert_age(value):
|
60 |
+
return None # Not used since age data not available
|
61 |
+
|
62 |
+
def convert_gender(value):
|
63 |
+
return None # Not used since gender data not available
|
64 |
+
|
65 |
+
# 3. Save Metadata
|
66 |
+
validate_and_save_cohort_info(is_final=False,
|
67 |
+
cohort=cohort,
|
68 |
+
info_path=json_path,
|
69 |
+
is_gene_available=is_gene_available,
|
70 |
+
is_trait_available=trait_row is not None)
|
71 |
+
|
72 |
+
# 4. Clinical Feature Extraction
|
73 |
+
# Since trait_row is not None, we extract clinical features
|
74 |
+
selected_clinical = geo_select_clinical_features(clinical_df=clinical_data,
|
75 |
+
trait=trait,
|
76 |
+
trait_row=trait_row,
|
77 |
+
convert_trait=convert_trait)
|
78 |
+
|
79 |
+
# Preview the extracted features
|
80 |
+
print(preview_df(selected_clinical))
|
81 |
+
|
82 |
+
# Save clinical data
|
83 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
84 |
+
# Get gene expression data from matrix file
|
85 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
86 |
+
|
87 |
+
# Examine data structure
|
88 |
+
print("Data structure and head:")
|
89 |
+
print(genetic_data.head())
|
90 |
+
|
91 |
+
print("\nShape:", genetic_data.shape)
|
92 |
+
|
93 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
94 |
+
print(list(genetic_data.index)[:20])
|
95 |
+
|
96 |
+
# Get a few column names to verify sample IDs
|
97 |
+
print("\nFirst 5 column names:")
|
98 |
+
print(list(genetic_data.columns)[:5])
|
99 |
+
# The IDs appear to be identifiers that need mapping - they are numeric codes starting with "789" likely from a microarray
|
100 |
+
# These are not standard human gene symbols like BRCA1, TP53, etc.
|
101 |
+
# Based on the numeric format and length, these look like Illumina BeadArray probe IDs
|
102 |
+
requires_gene_mapping = True
|
103 |
+
# Extract gene annotation data
|
104 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
105 |
+
|
106 |
+
# Display column names and preview data
|
107 |
+
print("Column names:")
|
108 |
+
print(gene_annotation.columns)
|
109 |
+
|
110 |
+
print("\nPreview of gene annotation data:")
|
111 |
+
print(preview_df(gene_annotation))
|
112 |
+
# Get mapping between probe IDs and gene symbols
|
113 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
|
114 |
+
|
115 |
+
# Convert probe-level measurements to gene-level expression
|
116 |
+
gene_data = apply_gene_mapping(expression_df=genetic_data, mapping_df=mapping_data)
|
117 |
+
|
118 |
+
# Normalize gene symbols using the NCBI synonym information
|
119 |
+
gene_data = normalize_gene_symbols_in_index(gene_data)
|
120 |
+
|
121 |
+
# Preview results
|
122 |
+
print("Gene-level expression data shape:", gene_data.shape)
|
123 |
+
print("\nFirst 5 genes and their values across first 3 samples:")
|
124 |
+
print(gene_data.iloc[:5, :3])
|
125 |
+
# Reload clinical data that was processed earlier
|
126 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
127 |
+
|
128 |
+
# 1. Normalize gene symbols
|
129 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
130 |
+
genetic_data.to_csv(out_gene_data_file)
|
131 |
+
|
132 |
+
# 2. Link clinical and genetic data
|
133 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
134 |
+
|
135 |
+
# 3. Handle missing values systematically
|
136 |
+
linked_data = handle_missing_values(linked_data, trait)
|
137 |
+
|
138 |
+
# 4. Check for bias in trait and demographic features
|
139 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
140 |
+
|
141 |
+
# 5. Final validation and information saving
|
142 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
143 |
+
is_usable = validate_and_save_cohort_info(
|
144 |
+
is_final=True,
|
145 |
+
cohort=cohort,
|
146 |
+
info_path=json_path,
|
147 |
+
is_gene_available=True,
|
148 |
+
is_trait_available=True,
|
149 |
+
is_biased=trait_biased,
|
150 |
+
df=linked_data,
|
151 |
+
note=note
|
152 |
+
)
|
153 |
+
|
154 |
+
# 6. Save linked data only if usable
|
155 |
+
if is_usable:
|
156 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
157 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Migraine/code/TCGA.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Migraine"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Migraine/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Migraine/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Migraine/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Migraine/cohort_info.json"
|
15 |
+
|
16 |
+
# Review the TCGA subdirectories for datasets relevant to Migraine
|
17 |
+
# No directory clearly related to migraine was found
|
18 |
+
|
19 |
+
# Record that this trait cannot be processed due to lack of suitable data
|
20 |
+
validate_and_save_cohort_info(
|
21 |
+
is_final=False,
|
22 |
+
cohort="TCGA",
|
23 |
+
info_path=json_path,
|
24 |
+
is_gene_available=True, # TCGA has gene expression data
|
25 |
+
is_trait_available=False # No suitable migraine data found
|
26 |
+
)
|
p3/preprocess/Migraine/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE67311": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 133, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "TCGA": {"is_usable": false, "is_gene_available": true, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}}
|
p3/preprocess/Mitochondrial_Disorders/GSE42986.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Mitochondrial_Disorders/clinical_data/GSE22651.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM561902,GSM561903,GSM561904,GSM561905,GSM561906,GSM561907,GSM561908,GSM561909,GSM561910,GSM561911,GSM561912,GSM561913,GSM561914,GSM561915,GSM561916,GSM561917,GSM561918,GSM561919,GSM561920,GSM561921,GSM561922,GSM561923,GSM561924,GSM561925,GSM561926,GSM561927,GSM561928,GSM561929,GSM561930,GSM561931,GSM561932,GSM561933,GSM561934,GSM561935,GSM561936,GSM561937,GSM561938,GSM561939,GSM561940,GSM561941,GSM561942,GSM561943,GSM561944,GSM561945,GSM561946,GSM561947,GSM561948,GSM561949,GSM561950,GSM561951,GSM561952,GSM561953,GSM561954,GSM561955,GSM561956,GSM561957,GSM561958,GSM561959,GSM561960,GSM561961,GSM561962,GSM561963,GSM561964,GSM561965,GSM561966
|
2 |
+
Mitochondrial_Disorders,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
3 |
+
Age,,47.0,47.0,,,,,,,,,47.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,47.0,,,,,,,,,,,,,,,,,,47.0
|
4 |
+
Gender,1.0,,,1.0,,,,,,,1.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1.0,,,,,,,,,,,,,,,,,,1.0,
|
p3/preprocess/Mitochondrial_Disorders/clinical_data/GSE30933.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM766694,GSM766695,GSM766696,GSM766697,GSM766698,GSM766699,GSM766700,GSM766701,GSM766702,GSM766703,GSM766704,GSM766705,GSM766706,GSM766707,GSM766708,GSM766709,GSM766710,GSM766711,GSM766712,GSM766713,GSM766714,GSM766715,GSM766716,GSM766717,GSM766718,GSM766719,GSM766720,GSM766721,GSM766722,GSM766723,GSM766724,GSM766725,GSM766726,GSM766727,GSM766728,GSM766729,GSM766730,GSM766731,GSM766732,GSM766733,GSM766734,GSM766735,GSM766736,GSM766737,GSM766738,GSM766739,GSM766740,GSM766741,GSM766742,GSM766743,GSM766744,GSM766745,GSM766746,GSM766747,GSM766748,GSM766749,GSM766750,GSM766751,GSM766752,GSM766753,GSM766754,GSM766755,GSM766756,GSM766757,GSM766758,GSM766759,GSM766760,GSM766761,GSM766762,GSM766763,GSM766764,GSM766765,GSM766766,GSM766767,GSM766768,GSM766769,GSM766770,GSM766771,GSM766772,GSM766773,GSM766774,GSM766775,GSM766776,GSM766777,GSM766778,GSM766779,GSM766780,GSM766781,GSM766782,GSM766783,GSM766784,GSM766785,GSM766786,GSM766787,GSM766788,GSM766789,GSM766790,GSM766791,GSM766792,GSM766793,GSM766794,GSM766795,GSM766796,GSM766797,GSM766798,GSM766799,GSM766800,GSM766801
|
2 |
+
Mitochondrial_Disorders,,,,,,,,,,,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,,,,,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,,,,,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,,,,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,,,,,,,,,,,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p3/preprocess/Mitochondrial_Disorders/clinical_data/GSE42986.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1054461,GSM1054462,GSM1054463,GSM1054464,GSM1054465,GSM1054466,GSM1054467,GSM1054468,GSM1054469,GSM1054470,GSM1054471,GSM1054472,GSM1054473,GSM1054474,GSM1054475,GSM1054476,GSM1054477,GSM1054478,GSM1054479,GSM1054480,GSM1054481,GSM1054482,GSM1054483,GSM1054484,GSM1054485,GSM1054486,GSM1054487,GSM1054488,GSM1054489,GSM1054490,GSM1054491,GSM1054492,GSM1054493,GSM1054494,GSM1054495,GSM1054496,GSM1054497,GSM1054498,GSM1054499,GSM1054500,GSM1054501,GSM1054502,GSM1054503,GSM1054504,GSM1054505,GSM1054506,GSM1054507,GSM1054508,GSM1054509,GSM1054510,GSM1054511,GSM1054512,GSM1054513
|
2 |
+
Mitochondrial_Disorders,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,,1.0,1.0,,,0.0,0.0,0.0,,1.0,,,0.0,0.0,0.0,1.0,0.0,,1.0,1.0,1.0,1.0,0.0,,1.0,0.0,,0.0,1.0,0.0,1.0,1.0,,1.0,1.0,1.0
|
3 |
+
Age,0.76,20.0,20.0,16.0,1.0,0.75,0.75,3.0,3.0,0.2,0.9,2.0,6.0,10.0,4.0,0.3,8.0,72.0,54.0,23.0,0.75,60.0,67.0,59.0,59.0,11.0,46.0,42.0,2.0,,,,4.0,0.76,20.0,5.0,16.0,5.0,1.0,0.75,3.0,30.0,2.0,36.0,39.0,6.0,10.0,4.0,0.3,0.1,8.0,11.0,0.7
|
4 |
+
Gender,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0
|
p3/preprocess/Mitochondrial_Disorders/clinical_data/GSE65399.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM1595393,GSM1595394,GSM1595395,GSM1595396,GSM1595397,GSM1595398,GSM1595399,GSM1595400,GSM1595401,GSM1595402,GSM1595403,GSM1595404,GSM1595405,GSM1595406,GSM1595407,GSM1595408,GSM1595409,GSM1595410,GSM1595411,GSM1595412,GSM1595413,GSM1595414,GSM1595415,GSM1595416,GSM1595417,GSM1595418,GSM1595419,GSM1595420,GSM1595421,GSM1595422,GSM1595423,GSM1595424,GSM1595425,GSM1595426,GSM1595427,GSM1595428,GSM1595429,GSM1595430,GSM1595431,GSM1595432,GSM1595433,GSM1595434,GSM1595435,GSM1595436,GSM1595437,GSM1595438,GSM1595439,GSM1595440,GSM1595441,GSM1595442,GSM1595443,GSM1595444,GSM1595445,GSM1595446,GSM1595447,GSM1595448,GSM1595449,GSM1595450,GSM1595451,GSM1595452,GSM1595453,GSM1595454,GSM1595455,GSM1595456,GSM1595457,GSM1595458,GSM1595459,GSM1595460,GSM1595461,GSM1595462,GSM1595463,GSM1595464,GSM1595465,GSM1595466,GSM1595467
|
2 |
+
Mitochondrial_Disorders,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,,,,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p3/preprocess/Mitochondrial_Disorders/code/GSE22651.py
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Mitochondrial_Disorders"
|
6 |
+
cohort = "GSE22651"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Mitochondrial_Disorders"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Mitochondrial_Disorders/GSE22651"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Mitochondrial_Disorders/GSE22651.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Mitochondrial_Disorders/gene_data/GSE22651.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Mitochondrial_Disorders/clinical_data/GSE22651.csv"
|
16 |
+
json_path = "./output/preprocess/3/Mitochondrial_Disorders/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# Check gene expression data availability
|
33 |
+
is_gene_available = True # Based on background info showing Illumina HT12 v3 chips were used
|
34 |
+
|
35 |
+
# Analyze trait availability
|
36 |
+
# From background info, we know this is a Friedreich's ataxia study where control and disease samples are compared
|
37 |
+
# Looking at the sample characteristics, we can identify disease status from cell lines
|
38 |
+
# Cell lines 3816.5, 4078.1A2, 4078.1B3 are FRDA patient-derived iPSC lines
|
39 |
+
trait_row = 0 # Cell line info is in row 0
|
40 |
+
def convert_trait(x):
|
41 |
+
if pd.isna(x):
|
42 |
+
return None
|
43 |
+
x = x.split(': ')[1]
|
44 |
+
if any(p in x for p in ['3816.5', '4078.1A2', '4078.1B3']):
|
45 |
+
return 1 # Patient
|
46 |
+
return 0 # Control
|
47 |
+
|
48 |
+
# Analyze age availability
|
49 |
+
age_row = 0 # Age info appears in row 0
|
50 |
+
def convert_age(x):
|
51 |
+
if pd.isna(x):
|
52 |
+
return None
|
53 |
+
try:
|
54 |
+
age = x.split(': ')[1]
|
55 |
+
return float(age.split()[0]) # Extract numeric value before 'years'
|
56 |
+
except:
|
57 |
+
return None
|
58 |
+
|
59 |
+
# Analyze gender availability
|
60 |
+
gender_row = 0 # Gender info appears in multiple rows
|
61 |
+
def convert_gender(x):
|
62 |
+
if pd.isna(x):
|
63 |
+
return None
|
64 |
+
x = x.split(': ')[1].lower()
|
65 |
+
if 'female' in x:
|
66 |
+
return 0
|
67 |
+
elif 'male' in x:
|
68 |
+
return 1
|
69 |
+
return None
|
70 |
+
|
71 |
+
# Validate and save cohort info
|
72 |
+
is_trait_available = trait_row is not None
|
73 |
+
validate_and_save_cohort_info(is_final=False,
|
74 |
+
cohort=cohort,
|
75 |
+
info_path=json_path,
|
76 |
+
is_gene_available=is_gene_available,
|
77 |
+
is_trait_available=is_trait_available)
|
78 |
+
|
79 |
+
# Extract clinical features if trait data is available
|
80 |
+
if trait_row is not None:
|
81 |
+
selected_clinical_df = geo_select_clinical_features(
|
82 |
+
clinical_df=clinical_data,
|
83 |
+
trait=trait,
|
84 |
+
trait_row=trait_row,
|
85 |
+
convert_trait=convert_trait,
|
86 |
+
age_row=age_row,
|
87 |
+
convert_age=convert_age,
|
88 |
+
gender_row=gender_row,
|
89 |
+
convert_gender=convert_gender
|
90 |
+
)
|
91 |
+
|
92 |
+
# Preview the extracted features
|
93 |
+
preview = preview_df(selected_clinical_df)
|
94 |
+
print("Preview of clinical features:")
|
95 |
+
print(preview)
|
96 |
+
|
97 |
+
# Save clinical features
|
98 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
99 |
+
# Get gene expression data from matrix file
|
100 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
101 |
+
|
102 |
+
# Examine data structure
|
103 |
+
print("Data structure and head:")
|
104 |
+
print(genetic_data.head())
|
105 |
+
|
106 |
+
print("\nShape:", genetic_data.shape)
|
107 |
+
|
108 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
109 |
+
print(list(genetic_data.index)[:20])
|
110 |
+
|
111 |
+
# Get a few column names to verify sample IDs
|
112 |
+
print("\nFirst 5 column names:")
|
113 |
+
print(list(genetic_data.columns)[:5])
|
114 |
+
# ILMN_ prefix indicates these are Illumina probe IDs from BeadArray technology
|
115 |
+
# They need to be mapped to standard gene symbols
|
116 |
+
requires_gene_mapping = True
|
117 |
+
# Extract gene annotation data
|
118 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
119 |
+
|
120 |
+
# Display column names and preview data
|
121 |
+
print("Column names:")
|
122 |
+
print(gene_annotation.columns)
|
123 |
+
|
124 |
+
print("\nPreview of gene annotation data:")
|
125 |
+
print(preview_df(gene_annotation))
|
126 |
+
# Map probe IDs to gene symbols
|
127 |
+
# Looking at annotation data, 'ID' contains probe IDs matching ILMN_ format in gene expression data
|
128 |
+
# 'Symbol' contains gene symbols
|
129 |
+
mapping_df = get_gene_mapping(gene_annotation, 'ID', 'Symbol')
|
130 |
+
|
131 |
+
# Convert probe measurements to gene expression using the mapping
|
132 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
133 |
+
|
134 |
+
# Preview result
|
135 |
+
print("Shape of gene expression data:", gene_data.shape)
|
136 |
+
print("\nExample gene expression values:")
|
137 |
+
print(gene_data.head())
|
138 |
+
# Reload clinical data that was processed earlier
|
139 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
140 |
+
|
141 |
+
# 1. Normalize gene symbols
|
142 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
143 |
+
genetic_data.to_csv(out_gene_data_file)
|
144 |
+
|
145 |
+
# 2. Link clinical and genetic data
|
146 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
147 |
+
|
148 |
+
# 3. Handle missing values systematically
|
149 |
+
linked_data = handle_missing_values(linked_data, trait)
|
150 |
+
|
151 |
+
# 4. Check for bias in trait and demographic features
|
152 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
153 |
+
|
154 |
+
# 5. Final validation and information saving
|
155 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
156 |
+
is_usable = validate_and_save_cohort_info(
|
157 |
+
is_final=True,
|
158 |
+
cohort=cohort,
|
159 |
+
info_path=json_path,
|
160 |
+
is_gene_available=True,
|
161 |
+
is_trait_available=True,
|
162 |
+
is_biased=trait_biased,
|
163 |
+
df=linked_data,
|
164 |
+
note=note
|
165 |
+
)
|
166 |
+
|
167 |
+
# 6. Save linked data only if usable
|
168 |
+
if is_usable:
|
169 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
170 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Mitochondrial_Disorders/code/GSE30933.py
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Mitochondrial_Disorders"
|
6 |
+
cohort = "GSE30933"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Mitochondrial_Disorders"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Mitochondrial_Disorders/GSE30933"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Mitochondrial_Disorders/GSE30933.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Mitochondrial_Disorders/gene_data/GSE30933.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Mitochondrial_Disorders/clinical_data/GSE30933.csv"
|
16 |
+
json_path = "./output/preprocess/3/Mitochondrial_Disorders/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Based on background info mentioning gene expression studies and microarray experiments
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
|
38 |
+
# 2.1 Data Availability
|
39 |
+
# Trait (disease status) is in row 0
|
40 |
+
trait_row = 0
|
41 |
+
|
42 |
+
# Age and gender not available in sample characteristics
|
43 |
+
age_row = None
|
44 |
+
gender_row = None
|
45 |
+
|
46 |
+
# 2.2 Data Type Conversion Functions
|
47 |
+
def convert_trait(x):
|
48 |
+
"""Convert disease status to binary (0=control, 1=FRDA)"""
|
49 |
+
if not isinstance(x, str):
|
50 |
+
return None
|
51 |
+
value = x.split(": ")[-1].strip()
|
52 |
+
if value == "FRDA":
|
53 |
+
return 1
|
54 |
+
elif value == "Normal":
|
55 |
+
return 0
|
56 |
+
return None # Carriers excluded
|
57 |
+
|
58 |
+
def convert_age(x):
|
59 |
+
"""Placeholder since age not available"""
|
60 |
+
return None
|
61 |
+
|
62 |
+
def convert_gender(x):
|
63 |
+
"""Placeholder since gender not available"""
|
64 |
+
return None
|
65 |
+
|
66 |
+
# 3. Save Metadata
|
67 |
+
is_trait_available = trait_row is not None
|
68 |
+
validate_and_save_cohort_info(is_final=False, cohort=cohort, info_path=json_path,
|
69 |
+
is_gene_available=is_gene_available,
|
70 |
+
is_trait_available=is_trait_available)
|
71 |
+
|
72 |
+
# 4. Clinical Feature Extraction
|
73 |
+
clinical_df = geo_select_clinical_features(clinical_data, trait, trait_row, convert_trait,
|
74 |
+
age_row, convert_age,
|
75 |
+
gender_row, convert_gender)
|
76 |
+
|
77 |
+
# Preview and save clinical data
|
78 |
+
print("Clinical data preview:")
|
79 |
+
print(preview_df(clinical_df))
|
80 |
+
|
81 |
+
# Save to CSV
|
82 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
83 |
+
clinical_df.to_csv(out_clinical_data_file)
|
84 |
+
# Get gene expression data from matrix file
|
85 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
86 |
+
|
87 |
+
# Examine data structure
|
88 |
+
print("Data structure and head:")
|
89 |
+
print(genetic_data.head())
|
90 |
+
|
91 |
+
print("\nShape:", genetic_data.shape)
|
92 |
+
|
93 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
94 |
+
print(list(genetic_data.index)[:20])
|
95 |
+
|
96 |
+
# Get a few column names to verify sample IDs
|
97 |
+
print("\nFirst 5 column names:")
|
98 |
+
print(list(genetic_data.columns)[:5])
|
99 |
+
# The gene identifiers start with "ILMN_", which indicates these are Illumina probe IDs
|
100 |
+
# and need to be mapped to standard human gene symbols for analysis
|
101 |
+
requires_gene_mapping = True
|
102 |
+
# Extract gene annotation data
|
103 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
104 |
+
|
105 |
+
# Display column names and preview data
|
106 |
+
print("Column names:")
|
107 |
+
print(gene_annotation.columns)
|
108 |
+
|
109 |
+
print("\nPreview of gene annotation data:")
|
110 |
+
print(preview_df(gene_annotation))
|
111 |
+
# 1. Based on preview, 'ID' is the identifier column matching to the gene expression data
|
112 |
+
# and 'SYMBOL' is the gene symbol column
|
113 |
+
|
114 |
+
# 2. Get mapping dataframe with ID and SYMBOL columns
|
115 |
+
mapping_data = get_gene_mapping(gene_annotation, 'ID', 'SYMBOL')
|
116 |
+
|
117 |
+
# 3. Convert probe-level measurements to gene expression data
|
118 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
119 |
+
|
120 |
+
# Preview output
|
121 |
+
print("Gene expression data shape:", gene_data.shape)
|
122 |
+
print("\nPreview of gene expression data:")
|
123 |
+
print(preview_df(gene_data))
|
124 |
+
|
125 |
+
# Save gene data to file
|
126 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
127 |
+
gene_data.to_csv(out_gene_data_file)
|
128 |
+
# Reload clinical data that was processed earlier
|
129 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
130 |
+
|
131 |
+
# 1. Normalize gene symbols
|
132 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
133 |
+
genetic_data.to_csv(out_gene_data_file)
|
134 |
+
|
135 |
+
# 2. Link clinical and genetic data
|
136 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
137 |
+
|
138 |
+
# 3. Handle missing values systematically
|
139 |
+
linked_data = handle_missing_values(linked_data, trait)
|
140 |
+
|
141 |
+
# 4. Check for bias in trait and demographic features
|
142 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
143 |
+
|
144 |
+
# 5. Final validation and information saving
|
145 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
146 |
+
is_usable = validate_and_save_cohort_info(
|
147 |
+
is_final=True,
|
148 |
+
cohort=cohort,
|
149 |
+
info_path=json_path,
|
150 |
+
is_gene_available=True,
|
151 |
+
is_trait_available=True,
|
152 |
+
is_biased=trait_biased,
|
153 |
+
df=linked_data,
|
154 |
+
note=note
|
155 |
+
)
|
156 |
+
|
157 |
+
# 6. Save linked data only if usable
|
158 |
+
if is_usable:
|
159 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
160 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Mitochondrial_Disorders/code/GSE42986.py
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Mitochondrial_Disorders"
|
6 |
+
cohort = "GSE42986"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Mitochondrial_Disorders"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Mitochondrial_Disorders/GSE42986"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Mitochondrial_Disorders/GSE42986.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Mitochondrial_Disorders/gene_data/GSE42986.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Mitochondrial_Disorders/clinical_data/GSE42986.csv"
|
16 |
+
json_path = "./output/preprocess/3/Mitochondrial_Disorders/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# Clinical data was loaded in previous step as a dictionary
|
33 |
+
raw_clinical_data = {
|
34 |
+
0: ['tissue: Skeletal muscle', 'tissue: fibroblast cell line'],
|
35 |
+
1: ['respiratory chain complex deficiency: No Respiratory Chain Complex Deficiency',
|
36 |
+
'respiratory chain complex deficiency: Complexes I and III',
|
37 |
+
'respiratory chain complex deficiency: Complex IV',
|
38 |
+
'respiratory chain complex deficiency: Complexes II and III',
|
39 |
+
'respiratory chain complex deficiency: Not measured; 87% mtDNA depletion in muscle',
|
40 |
+
'respiratory chain complex deficiency: Complex IV; 70% mtDNA depletion in liver',
|
41 |
+
'respiratory chain complex deficiency: Complex IV; 93% mtDNA depletion in muscle',
|
42 |
+
'respiratory chain complex deficiency: Complexes I and IV',
|
43 |
+
'respiratory chain complex deficiency: Complex I',
|
44 |
+
'respiratory chain complex deficiency: Complex I and IV',
|
45 |
+
'respiratory chain complex deficiency in muscle: Not Determined',
|
46 |
+
'respiratory chain complex deficiency in muscle: Complex I+III Deficiency',
|
47 |
+
'respiratory chain complex deficiency in muscle: No Respiratory Chain Complex Deficiency',
|
48 |
+
'respiratory chain complex deficiency in muscle: Complexes I and III',
|
49 |
+
'respiratory chain complex deficiency in muscle: Complex IV',
|
50 |
+
'respiratory chain complex deficiency in muscle: Complexes II and III',
|
51 |
+
'respiratory chain complex deficiency in muscle: Complex IV; 93% mtDNA depletion in muscle',
|
52 |
+
'respiratory chain complex deficiency in muscle: Complex I'],
|
53 |
+
2: ['gender: F', 'gender: M'],
|
54 |
+
3: ['age (years): 0.76', 'age (years): 20', 'age (years): 16', 'age (years): 1',
|
55 |
+
'age (years): 0.75', 'age (years): 3', 'age (years): 0.2', 'age (years): 0.9',
|
56 |
+
'age (years): 2', 'age (years): 6', 'age (years): 10', 'age (years): 4',
|
57 |
+
'age (years): 0.3', 'age (years): 8', 'age (years): 72', 'age (years): 54',
|
58 |
+
'age (years): 23', 'age (years): 60', 'age (years): 67', 'age (years): 59',
|
59 |
+
'age (years): 11', 'age (years): 46', 'age (years): 42', 'age (years): not obtained',
|
60 |
+
'age (years): 5', 'age (years): 30', 'age (years): 36', 'age (years): 39',
|
61 |
+
'age (years): 0.1', 'age (years): 0.7'],
|
62 |
+
4: ['informatic analysis group: Control Group', 'informatic analysis group: Mito Disease Group',
|
63 |
+
'informatic analysis group: Excluded - poor quality', 'informatic analysis group: Excluded - sample outlier']
|
64 |
+
}
|
65 |
+
|
66 |
+
clinical_data = pd.DataFrame()
|
67 |
+
for key, values in raw_clinical_data.items():
|
68 |
+
clinical_data[key] = pd.Series(values)
|
69 |
+
|
70 |
+
# Check gene expression data availability
|
71 |
+
# From background info, we can see this is Affymetrix Human Exon microarray data, which contains gene expression
|
72 |
+
is_gene_available = True
|
73 |
+
|
74 |
+
# Define conversion functions
|
75 |
+
def convert_trait(value: str) -> int:
|
76 |
+
# Extract value after colon and strip whitespace
|
77 |
+
value = value.split(':')[1].strip().lower()
|
78 |
+
# Convert to binary - 1 for disease group, 0 for control
|
79 |
+
if 'mito disease group' in value:
|
80 |
+
return 1
|
81 |
+
elif 'control group' in value:
|
82 |
+
return 0
|
83 |
+
# Exclude poor quality and outlier samples
|
84 |
+
return None
|
85 |
+
|
86 |
+
def convert_age(value: str) -> float:
|
87 |
+
# Extract value after colon and strip whitespace
|
88 |
+
value = value.split(':')[1].strip()
|
89 |
+
try:
|
90 |
+
# Convert to float if possible
|
91 |
+
return float(value)
|
92 |
+
except:
|
93 |
+
return None
|
94 |
+
|
95 |
+
def convert_gender(value: str) -> int:
|
96 |
+
# Extract value after colon and strip whitespace
|
97 |
+
value = value.split(':')[1].strip().upper()
|
98 |
+
# Convert F->0, M->1
|
99 |
+
if value == 'F':
|
100 |
+
return 0
|
101 |
+
elif value == 'M':
|
102 |
+
return 1
|
103 |
+
return None
|
104 |
+
|
105 |
+
# Identify row numbers for variables
|
106 |
+
# trait data is in row 4 (informatic analysis group)
|
107 |
+
trait_row = 4
|
108 |
+
# age data is in row 3
|
109 |
+
age_row = 3
|
110 |
+
# gender data is in row 2
|
111 |
+
gender_row = 2
|
112 |
+
|
113 |
+
# Save metadata and validate initial filtering
|
114 |
+
is_trait_available = trait_row is not None
|
115 |
+
validate_and_save_cohort_info(is_final=False, cohort=cohort, info_path=json_path,
|
116 |
+
is_gene_available=is_gene_available,
|
117 |
+
is_trait_available=is_trait_available)
|
118 |
+
|
119 |
+
# Extract clinical features if trait data is available
|
120 |
+
if trait_row is not None:
|
121 |
+
clinical_features = geo_select_clinical_features(
|
122 |
+
clinical_df=clinical_data,
|
123 |
+
trait=trait,
|
124 |
+
trait_row=trait_row,
|
125 |
+
convert_trait=convert_trait,
|
126 |
+
age_row=age_row,
|
127 |
+
convert_age=convert_age,
|
128 |
+
gender_row=gender_row,
|
129 |
+
convert_gender=convert_gender
|
130 |
+
)
|
131 |
+
|
132 |
+
# Preview the extracted features
|
133 |
+
preview = preview_df(clinical_features)
|
134 |
+
|
135 |
+
# Save clinical data
|
136 |
+
clinical_features.to_csv(out_clinical_data_file)
|
137 |
+
# Cannot properly implement without seeing output from previous step
|
138 |
+
# containing sample characteristics and background information
|
139 |
+
|
140 |
+
# Need these details to:
|
141 |
+
# 1. Determine if gene expression data exists
|
142 |
+
# 2. Identify row numbers with clinical variables
|
143 |
+
# 3. Design appropriate conversion functions
|
144 |
+
# 4. Make data availability decisions
|
145 |
+
|
146 |
+
# Will wait for output from previous step before proceeding
|
147 |
+
# Get gene expression data from matrix file
|
148 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
149 |
+
|
150 |
+
# Examine data structure
|
151 |
+
print("Data structure and head:")
|
152 |
+
print(genetic_data.head())
|
153 |
+
|
154 |
+
print("\nShape:", genetic_data.shape)
|
155 |
+
|
156 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
157 |
+
print(list(genetic_data.index)[:20])
|
158 |
+
|
159 |
+
# Get a few column names to verify sample IDs
|
160 |
+
print("\nFirst 5 column names:")
|
161 |
+
print(list(genetic_data.columns)[:5])
|
162 |
+
# Looking at the gene identifiers ending with "_at", these appear to be probe IDs from an Affymetrix microarray
|
163 |
+
# that need to be mapped to human gene symbols
|
164 |
+
|
165 |
+
requires_gene_mapping = True
|
166 |
+
# Extract gene annotation data
|
167 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
168 |
+
|
169 |
+
# Display column names and preview data
|
170 |
+
print("Column names:")
|
171 |
+
print(gene_annotation.columns)
|
172 |
+
|
173 |
+
print("\nPreview of gene annotation data:")
|
174 |
+
print(preview_df(gene_annotation))
|
175 |
+
# Get mapping between probe IDs and gene symbols
|
176 |
+
# ID column contains probe IDs (ending with "_at"), Symbol column contains gene symbols
|
177 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
|
178 |
+
|
179 |
+
# Apply the mapping to convert probe measurements to gene expression values
|
180 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
181 |
+
|
182 |
+
# Preview the mapped gene expression data
|
183 |
+
print("\nFirst few rows of gene expression data after mapping:")
|
184 |
+
print(gene_data.head())
|
185 |
+
print("\nShape after mapping:", gene_data.shape)
|
186 |
+
# Reload clinical data that was processed earlier
|
187 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
188 |
+
|
189 |
+
# 1. Normalize gene symbols
|
190 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
191 |
+
genetic_data.to_csv(out_gene_data_file)
|
192 |
+
|
193 |
+
# 2. Link clinical and genetic data
|
194 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
195 |
+
|
196 |
+
# 3. Handle missing values systematically
|
197 |
+
linked_data = handle_missing_values(linked_data, trait)
|
198 |
+
|
199 |
+
# 4. Check for bias in trait and demographic features
|
200 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
201 |
+
|
202 |
+
# 5. Final validation and information saving
|
203 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
204 |
+
is_usable = validate_and_save_cohort_info(
|
205 |
+
is_final=True,
|
206 |
+
cohort=cohort,
|
207 |
+
info_path=json_path,
|
208 |
+
is_gene_available=True,
|
209 |
+
is_trait_available=True,
|
210 |
+
is_biased=trait_biased,
|
211 |
+
df=linked_data,
|
212 |
+
note=note
|
213 |
+
)
|
214 |
+
|
215 |
+
# 6. Save linked data only if usable
|
216 |
+
if is_usable:
|
217 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
218 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Mitochondrial_Disorders/code/GSE65399.py
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Mitochondrial_Disorders"
|
6 |
+
cohort = "GSE65399"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Mitochondrial_Disorders"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Mitochondrial_Disorders/GSE65399"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Mitochondrial_Disorders/GSE65399.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Mitochondrial_Disorders/gene_data/GSE65399.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Mitochondrial_Disorders/clinical_data/GSE65399.csv"
|
16 |
+
json_path = "./output/preprocess/3/Mitochondrial_Disorders/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Background info shows "Gene expression profiles were obtained using the Illumina HT12v4 Gene Expression BeadArray"
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# From background info, this is a study about FRDA patients
|
38 |
+
# The differentiation/tissue type in row 0 indicates disease state information
|
39 |
+
trait_row = 0
|
40 |
+
age_row = None # Age not available in characteristics
|
41 |
+
gender_row = None # Gender not available in characteristics
|
42 |
+
|
43 |
+
def convert_trait(x):
|
44 |
+
if x is None or pd.isna(x):
|
45 |
+
return None
|
46 |
+
val = x.split(': ')[-1].lower()
|
47 |
+
# Samples are neural progenitors or fetal tissues
|
48 |
+
# Neural progenitors are FRDA patient-derived cells
|
49 |
+
if 'neural progenitors' in val:
|
50 |
+
return 1 # FRDA patient
|
51 |
+
elif 'fetal' in val:
|
52 |
+
return 0 # Control tissue
|
53 |
+
return None
|
54 |
+
|
55 |
+
def convert_age(x):
|
56 |
+
if x is None or pd.isna(x):
|
57 |
+
return None
|
58 |
+
val = x.split(': ')[-1].lower()
|
59 |
+
try:
|
60 |
+
return float(val)
|
61 |
+
except:
|
62 |
+
return None
|
63 |
+
|
64 |
+
def convert_gender(x):
|
65 |
+
if x is None or pd.isna(x):
|
66 |
+
return None
|
67 |
+
val = x.split(': ')[-1].lower()
|
68 |
+
if 'female' in val or 'f' in val:
|
69 |
+
return 0
|
70 |
+
elif 'male' in val or 'm' in val:
|
71 |
+
return 1
|
72 |
+
return None
|
73 |
+
|
74 |
+
# 3. Save Metadata
|
75 |
+
_ = validate_and_save_cohort_info(
|
76 |
+
is_final=False,
|
77 |
+
cohort=cohort,
|
78 |
+
info_path=json_path,
|
79 |
+
is_gene_available=is_gene_available,
|
80 |
+
is_trait_available=(trait_row is not None)
|
81 |
+
)
|
82 |
+
|
83 |
+
# 4. Clinical Feature Extraction
|
84 |
+
# Trait data is available, so extract clinical features
|
85 |
+
clinical_df = geo_select_clinical_features(
|
86 |
+
clinical_data,
|
87 |
+
trait=trait,
|
88 |
+
trait_row=trait_row,
|
89 |
+
convert_trait=convert_trait,
|
90 |
+
age_row=age_row,
|
91 |
+
convert_age=convert_age,
|
92 |
+
gender_row=gender_row,
|
93 |
+
convert_gender=convert_gender
|
94 |
+
)
|
95 |
+
|
96 |
+
# Preview the extracted clinical data
|
97 |
+
print("\nPreview of clinical data:")
|
98 |
+
print(preview_df(clinical_df))
|
99 |
+
|
100 |
+
# Save clinical data
|
101 |
+
clinical_df.to_csv(out_clinical_data_file)
|
102 |
+
# Get gene expression data from matrix file
|
103 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
104 |
+
|
105 |
+
# Examine data structure
|
106 |
+
print("Data structure and head:")
|
107 |
+
print(genetic_data.head())
|
108 |
+
|
109 |
+
print("\nShape:", genetic_data.shape)
|
110 |
+
|
111 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
112 |
+
print(list(genetic_data.index)[:20])
|
113 |
+
|
114 |
+
# Get a few column names to verify sample IDs
|
115 |
+
print("\nFirst 5 column names:")
|
116 |
+
print(list(genetic_data.columns)[:5])
|
117 |
+
# The identifiers starting with ILMN_ are Illumina probe IDs, not gene symbols
|
118 |
+
requires_gene_mapping = True
|
119 |
+
# Extract gene annotation data
|
120 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
121 |
+
|
122 |
+
# Display column names and preview data
|
123 |
+
print("Column names:")
|
124 |
+
print(gene_annotation.columns)
|
125 |
+
|
126 |
+
print("\nPreview of gene annotation data:")
|
127 |
+
print(preview_df(gene_annotation))
|
128 |
+
# Get gene mapping from annotation data
|
129 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
|
130 |
+
|
131 |
+
# Apply gene mapping to convert probe measurements to gene expression values
|
132 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
133 |
+
|
134 |
+
# Save gene expression data
|
135 |
+
gene_data.to_csv(out_gene_data_file)
|
136 |
+
# Reload clinical data that was processed earlier
|
137 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
138 |
+
|
139 |
+
# 1. Normalize gene symbols
|
140 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
141 |
+
genetic_data.to_csv(out_gene_data_file)
|
142 |
+
|
143 |
+
# 2. Link clinical and genetic data
|
144 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
145 |
+
|
146 |
+
# 3. Handle missing values systematically
|
147 |
+
linked_data = handle_missing_values(linked_data, trait)
|
148 |
+
|
149 |
+
# 4. Check for bias in trait and demographic features
|
150 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
151 |
+
|
152 |
+
# 5. Final validation and information saving
|
153 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
154 |
+
is_usable = validate_and_save_cohort_info(
|
155 |
+
is_final=True,
|
156 |
+
cohort=cohort,
|
157 |
+
info_path=json_path,
|
158 |
+
is_gene_available=True,
|
159 |
+
is_trait_available=True,
|
160 |
+
is_biased=trait_biased,
|
161 |
+
df=linked_data,
|
162 |
+
note=note
|
163 |
+
)
|
164 |
+
|
165 |
+
# 6. Save linked data only if usable
|
166 |
+
if is_usable:
|
167 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
168 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Mitochondrial_Disorders/code/TCGA.py
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Mitochondrial_Disorders"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Mitochondrial_Disorders/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Mitochondrial_Disorders/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Mitochondrial_Disorders/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Mitochondrial_Disorders/cohort_info.json"
|
15 |
+
|
16 |
+
# Define candidate columns
|
17 |
+
candidate_age_cols = []
|
18 |
+
candidate_gender_cols = []
|
19 |
+
|
20 |
+
# Since no column data was provided as output from previous step,
|
21 |
+
# we cannot preview any data. Return empty dictionary
|
22 |
+
preview_data = {}
|
23 |
+
# Select the PCPG directory which may contain relevant data for mitochondrial disorders
|
24 |
+
cohort_dir = os.path.join(tcga_root_dir, "TCGA_Pheochromocytoma_Paraganglioma_(PCPG)")
|
25 |
+
|
26 |
+
# Get paths to clinical and genetic data files
|
27 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
28 |
+
|
29 |
+
# Load the clinical and genetic data
|
30 |
+
clinical_df = pd.read_table(clinical_file_path, index_col=0)
|
31 |
+
genetic_df = pd.read_table(genetic_file_path, index_col=0)
|
32 |
+
|
33 |
+
# Print clinical data columns for examination
|
34 |
+
print("Clinical data columns:")
|
35 |
+
print(clinical_df.columns)
|
36 |
+
# Identify candidate columns for age and gender
|
37 |
+
candidate_age_cols = ['age_at_initial_pathologic_diagnosis']
|
38 |
+
candidate_gender_cols = ['gender']
|
39 |
+
|
40 |
+
# Get correct file paths
|
41 |
+
cohort_dir = os.path.join(tcga_root_dir, "TCGA_Pheochromocytoma_Paraganglioma_(PCPG)")
|
42 |
+
clinical_file_path, _ = tcga_get_relevant_filepaths(cohort_dir)
|
43 |
+
|
44 |
+
# Load clinical data
|
45 |
+
clinical_df = pd.read_csv(clinical_file_path, sep="\t", index_col=0)
|
46 |
+
|
47 |
+
# Extract and preview age columns
|
48 |
+
age_preview = {}
|
49 |
+
for col in candidate_age_cols:
|
50 |
+
if col in clinical_df.columns:
|
51 |
+
age_preview[col] = clinical_df[col].head(5).tolist()
|
52 |
+
print("Age columns preview:", age_preview)
|
53 |
+
|
54 |
+
# Extract and preview gender columns
|
55 |
+
gender_preview = {}
|
56 |
+
for col in candidate_gender_cols:
|
57 |
+
if col in clinical_df.columns:
|
58 |
+
gender_preview[col] = clinical_df[col].head(5).tolist()
|
59 |
+
print("Gender columns preview:", gender_preview)
|
60 |
+
# Assign age and gender column names based on inspection of available columns
|
61 |
+
age_col = 'age_at_initial_pathologic_diagnosis' # Valid age values present
|
62 |
+
gender_col = 'gender' # Valid gender values present
|
63 |
+
|
64 |
+
# Print selected column names
|
65 |
+
print(f"Selected age column: {age_col}")
|
66 |
+
print(f"Selected gender column: {gender_col}")
|
67 |
+
# 1. Extract and standardize clinical features
|
68 |
+
selected_clinical_df = tcga_select_clinical_features(clinical_df, trait, age_col, gender_col)
|
69 |
+
|
70 |
+
# 2. Normalize gene symbols in genetic data
|
71 |
+
normalized_genetic_df = normalize_gene_symbols_in_index(genetic_df)
|
72 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
73 |
+
normalized_genetic_df.to_csv(out_gene_data_file)
|
74 |
+
|
75 |
+
# 3. Link clinical and genetic data
|
76 |
+
linked_data = pd.merge(selected_clinical_df, normalized_genetic_df.T, left_index=True, right_index=True)
|
77 |
+
|
78 |
+
# 4. Handle missing values
|
79 |
+
linked_data = handle_missing_values(linked_data, trait)
|
80 |
+
|
81 |
+
# 5. Check for bias in trait and demographic features
|
82 |
+
is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
83 |
+
|
84 |
+
# 6. Validate and save cohort info
|
85 |
+
note = f"Sample size after preprocessing: {len(linked_data)}. Number of genes: {len(linked_data.columns) - 3}"
|
86 |
+
is_usable = validate_and_save_cohort_info(
|
87 |
+
is_final=True,
|
88 |
+
cohort="TCGA",
|
89 |
+
info_path=json_path,
|
90 |
+
is_gene_available=True,
|
91 |
+
is_trait_available=True,
|
92 |
+
is_biased=is_biased,
|
93 |
+
df=linked_data,
|
94 |
+
note=note
|
95 |
+
)
|
96 |
+
|
97 |
+
# 7. Save linked data if usable
|
98 |
+
if is_usable:
|
99 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
100 |
+
linked_data.to_csv(out_data_file)
|
101 |
+
print(f"Linked data saved to {out_data_file}")
|
102 |
+
print("Shape of final linked data:", linked_data.shape)
|
103 |
+
else:
|
104 |
+
print("Dataset was found to be unusable and was not saved")
|
p3/preprocess/Mitochondrial_Disorders/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE65399": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 69, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "GSE42986": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": true, "has_gender": true, "sample_size": 43, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "GSE30933": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 74, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "GSE22651": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 65, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "TCGA": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": true, "has_gender": true, "sample_size": 187, "note": "Sample size after preprocessing: 187. Number of genes: 19848"}}
|
p3/preprocess/Mitochondrial_Disorders/gene_data/GSE42986.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/GSE19987.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/clinical_data/GSE19987.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM62248,GSM62249,GSM62250,GSM62251,GSM62252,GSM62253,GSM62254,GSM62255,GSM62256,GSM62257,GSM62258,GSM62259,GSM62260,GSM62261,GSM62262,GSM62263,GSM62264,GSM62265,GSM62266,GSM62267,GSM62268,GSM62269,GSM62270,GSM62271,GSM62272,GSM62273,GSM62274,GSM62275,GSM62276,GSM62277,GSM62278,GSM62279,GSM62280,GSM62281,GSM62282,GSM62283,GSM62284,GSM62285,GSM62286,GSM62287,GSM62288,GSM62289,GSM62290,GSM62291,GSM62292,GSM62293,GSM62294,GSM62295,GSM62296,GSM62297,GSM62298,GSM62299,GSM62300,GSM62301,GSM62302,GSM62303,GSM62304,GSM62305,GSM62306,GSM62307,GSM62308,GSM62309,GSM62310,GSM62311,GSM62312,GSM62313,GSM62314,GSM62315,GSM62316,GSM62317,GSM62318,GSM62319,GSM62320,GSM62321,GSM62322
|
2 |
+
Multiple_Endocrine_Neoplasia_Type_2,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/code/GSE19987.py
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Multiple_Endocrine_Neoplasia_Type_2"
|
6 |
+
cohort = "GSE19987"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Multiple_Endocrine_Neoplasia_Type_2"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Multiple_Endocrine_Neoplasia_Type_2/GSE19987"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Multiple_Endocrine_Neoplasia_Type_2/GSE19987.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Multiple_Endocrine_Neoplasia_Type_2/gene_data/GSE19987.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Multiple_Endocrine_Neoplasia_Type_2/clinical_data/GSE19987.csv"
|
16 |
+
json_path = "./output/preprocess/3/Multiple_Endocrine_Neoplasia_Type_2/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
is_gene_available = True # Based on background info, this is a gene expression profiling study
|
34 |
+
|
35 |
+
# 2.1 Data Row Identification
|
36 |
+
trait_row = 1 # 'genetic class' contains MEN2A vs others information
|
37 |
+
age_row = None # Age information not available
|
38 |
+
gender_row = None # Gender information not available
|
39 |
+
|
40 |
+
# 2.2 Data Type Conversion Functions
|
41 |
+
def convert_trait(value):
|
42 |
+
"""Convert MEN2 trait status from genetic class info.
|
43 |
+
MEN2A -> 1, others -> 0"""
|
44 |
+
if pd.isna(value) or ':' not in value:
|
45 |
+
return None
|
46 |
+
value = value.split(':')[1].strip()
|
47 |
+
if value == 'MEN2A':
|
48 |
+
return 1
|
49 |
+
return 0 # All other genetic classes are controls
|
50 |
+
|
51 |
+
def convert_age(value):
|
52 |
+
return None # Not used since age data unavailable
|
53 |
+
|
54 |
+
def convert_gender(value):
|
55 |
+
return None # Not used since gender data unavailable
|
56 |
+
|
57 |
+
# 3. Save initial validation info
|
58 |
+
is_trait_available = trait_row is not None
|
59 |
+
validate_and_save_cohort_info(
|
60 |
+
is_final=False,
|
61 |
+
cohort=cohort,
|
62 |
+
info_path=json_path,
|
63 |
+
is_gene_available=is_gene_available,
|
64 |
+
is_trait_available=is_trait_available
|
65 |
+
)
|
66 |
+
|
67 |
+
# 4. Extract clinical features
|
68 |
+
if trait_row is not None:
|
69 |
+
clinical_features = geo_select_clinical_features(
|
70 |
+
clinical_df=clinical_data,
|
71 |
+
trait=trait,
|
72 |
+
trait_row=trait_row,
|
73 |
+
convert_trait=convert_trait,
|
74 |
+
age_row=age_row,
|
75 |
+
convert_age=convert_age,
|
76 |
+
gender_row=gender_row,
|
77 |
+
convert_gender=convert_gender
|
78 |
+
)
|
79 |
+
|
80 |
+
# Preview the extracted features
|
81 |
+
print("Preview of clinical features:")
|
82 |
+
print(preview_df(clinical_features))
|
83 |
+
|
84 |
+
# Save clinical features
|
85 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
86 |
+
clinical_features.to_csv(out_clinical_data_file)
|
87 |
+
# Get gene expression data from matrix file
|
88 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
89 |
+
|
90 |
+
# Examine data structure
|
91 |
+
print("Data structure and head:")
|
92 |
+
print(genetic_data.head())
|
93 |
+
|
94 |
+
print("\nShape:", genetic_data.shape)
|
95 |
+
|
96 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
97 |
+
print(list(genetic_data.index)[:20])
|
98 |
+
|
99 |
+
# Get a few column names to verify sample IDs
|
100 |
+
print("\nFirst 5 column names:")
|
101 |
+
print(list(genetic_data.columns)[:5])
|
102 |
+
# The identifiers are probe IDs (e.g. '1007_s_at') from Affymetrix HG-U133A array
|
103 |
+
# These need to be mapped to human gene symbols
|
104 |
+
requires_gene_mapping = True
|
105 |
+
# Extract gene annotation data
|
106 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
107 |
+
|
108 |
+
# Display column names and preview data
|
109 |
+
print("Column names:")
|
110 |
+
print(gene_annotation.columns)
|
111 |
+
|
112 |
+
print("\nPreview of gene annotation data:")
|
113 |
+
print(preview_df(gene_annotation))
|
114 |
+
# Extract gene mapping (probe ID to gene symbol) from annotation data
|
115 |
+
gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
116 |
+
|
117 |
+
# Apply gene mapping to convert probe data to gene expression data
|
118 |
+
gene_data = apply_gene_mapping(genetic_data, gene_mapping)
|
119 |
+
|
120 |
+
# Preview the gene expression data
|
121 |
+
print("Shape of gene expression data after mapping:", gene_data.shape)
|
122 |
+
print("\nPreview of gene expression data:")
|
123 |
+
print(preview_df(gene_data))
|
124 |
+
# Reload clinical data that was processed earlier
|
125 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
126 |
+
|
127 |
+
# 1. Normalize gene symbols
|
128 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
129 |
+
genetic_data.to_csv(out_gene_data_file)
|
130 |
+
|
131 |
+
# 2. Link clinical and genetic data
|
132 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
133 |
+
|
134 |
+
# 3. Handle missing values systematically
|
135 |
+
linked_data = handle_missing_values(linked_data, trait)
|
136 |
+
|
137 |
+
# 4. Check for bias in trait and demographic features
|
138 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
139 |
+
|
140 |
+
# 5. Final validation and information saving
|
141 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
142 |
+
is_usable = validate_and_save_cohort_info(
|
143 |
+
is_final=True,
|
144 |
+
cohort=cohort,
|
145 |
+
info_path=json_path,
|
146 |
+
is_gene_available=True,
|
147 |
+
is_trait_available=True,
|
148 |
+
is_biased=trait_biased,
|
149 |
+
df=linked_data,
|
150 |
+
note=note
|
151 |
+
)
|
152 |
+
|
153 |
+
# 6. Save linked data only if usable
|
154 |
+
if is_usable:
|
155 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
156 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/code/TCGA.py
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Multiple_Endocrine_Neoplasia_Type_2"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Multiple_Endocrine_Neoplasia_Type_2/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Multiple_Endocrine_Neoplasia_Type_2/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Multiple_Endocrine_Neoplasia_Type_2/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Multiple_Endocrine_Neoplasia_Type_2/cohort_info.json"
|
15 |
+
|
16 |
+
# Select the PCPG directory which may contain relevant data for mitochondrial disorders
|
17 |
+
cohort_dir = os.path.join(tcga_root_dir, "TCGA_Pheochromocytoma_Paraganglioma_(PCPG)")
|
18 |
+
|
19 |
+
# Get paths to clinical and genetic data files
|
20 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
21 |
+
|
22 |
+
# Load the clinical and genetic data
|
23 |
+
clinical_df = pd.read_table(clinical_file_path, index_col=0)
|
24 |
+
genetic_df = pd.read_table(genetic_file_path, index_col=0)
|
25 |
+
|
26 |
+
# Print clinical data columns for examination
|
27 |
+
print("Clinical data columns:")
|
28 |
+
print(clinical_df.columns)
|
29 |
+
# Define candidate columns based on column list examination
|
30 |
+
candidate_age_cols = ['age_at_initial_pathologic_diagnosis', 'days_to_birth', 'year_of_initial_pathologic_diagnosis']
|
31 |
+
candidate_gender_cols = ['gender']
|
32 |
+
|
33 |
+
print("Identified candidate columns:")
|
34 |
+
print("Age columns:", candidate_age_cols)
|
35 |
+
print("Gender columns:", candidate_gender_cols)
|
36 |
+
|
37 |
+
print("\nNote: Data preview will be implemented when data access is properly configured.")
|
38 |
+
# Select appropriate columns for age and gender
|
39 |
+
age_col = 'age_at_initial_pathologic_diagnosis' # This column directly gives age values
|
40 |
+
gender_col = 'gender' # Only one gender column available
|
41 |
+
|
42 |
+
# Print chosen columns
|
43 |
+
print(f"Selected age column: {age_col}")
|
44 |
+
print(f"Selected gender column: {gender_col}")
|
45 |
+
# 1. Extract and standardize clinical features
|
46 |
+
selected_clinical_df = tcga_select_clinical_features(clinical_df, trait, age_col, gender_col)
|
47 |
+
|
48 |
+
# 2. Normalize gene symbols in genetic data
|
49 |
+
normalized_genetic_df = normalize_gene_symbols_in_index(genetic_df)
|
50 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
51 |
+
normalized_genetic_df.to_csv(out_gene_data_file)
|
52 |
+
|
53 |
+
# 3. Link clinical and genetic data
|
54 |
+
linked_data = pd.merge(selected_clinical_df, normalized_genetic_df.T, left_index=True, right_index=True)
|
55 |
+
|
56 |
+
# 4. Handle missing values
|
57 |
+
linked_data = handle_missing_values(linked_data, trait)
|
58 |
+
|
59 |
+
# 5. Check for bias in trait and demographic features
|
60 |
+
is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
61 |
+
|
62 |
+
# 6. Validate and save cohort info
|
63 |
+
note = f"Sample size after preprocessing: {len(linked_data)}. Number of genes: {len(linked_data.columns) - 3}"
|
64 |
+
is_usable = validate_and_save_cohort_info(
|
65 |
+
is_final=True,
|
66 |
+
cohort="TCGA",
|
67 |
+
info_path=json_path,
|
68 |
+
is_gene_available=True,
|
69 |
+
is_trait_available=True,
|
70 |
+
is_biased=is_biased,
|
71 |
+
df=linked_data,
|
72 |
+
note=note
|
73 |
+
)
|
74 |
+
|
75 |
+
# 7. Save linked data if usable
|
76 |
+
if is_usable:
|
77 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
78 |
+
linked_data.to_csv(out_data_file)
|
79 |
+
print(f"Linked data saved to {out_data_file}")
|
80 |
+
print("Shape of final linked data:", linked_data.shape)
|
81 |
+
else:
|
82 |
+
print("Dataset was found to be unusable and was not saved")
|
p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE19987": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 75, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "TCGA": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": true, "has_gender": true, "sample_size": 187, "note": "Sample size after preprocessing: 187. Number of genes: 19848"}}
|
p3/preprocess/Multiple_Endocrine_Neoplasia_Type_2/gene_data/GSE19987.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Multiple_sclerosis/GSE135511.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Multiple_sclerosis/GSE203241.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Multiple_sclerosis/clinical_data/GSE131279.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM3768507,GSM3768508,GSM3768509,GSM3768510,GSM3768511,GSM3768512,GSM3768513,GSM3768514,GSM3768515,GSM3768516,GSM3768517,GSM3768518,GSM3768519,GSM3768520,GSM3768521,GSM3768522,GSM3768523,GSM3768524,GSM3768525,GSM3768526,GSM3768527,GSM3768528,GSM3768529,GSM3768530,GSM3768531,GSM3768532,GSM3768533,GSM3768534,GSM3768535,GSM3768536,GSM3768537,GSM3768538,GSM3768539,GSM3768540,GSM3768541,GSM3768542,GSM3768543,GSM3768544,GSM3768545,GSM3768546,GSM3768547,GSM3768548,GSM3768549,GSM3768550,GSM3768551,GSM3768552,GSM3768553,GSM3768554,GSM3768555,GSM3768556,GSM3768557,GSM3768558,GSM3768559,GSM3768560,GSM3768561,GSM3768562,GSM3768563,GSM3768564,GSM3768565,GSM3768566,GSM3768567,GSM3768568,GSM3768569,GSM3768570,GSM3768571,GSM3768572,GSM3768573,GSM3768574,GSM3768575,GSM3768576,GSM3768577,GSM3768578,GSM3768579,GSM3768580,GSM3768581,GSM3768582,GSM3768583,GSM3768584
|
2 |
+
Multiple_sclerosis,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0
|
3 |
+
Age,58.0,59.0,80.0,63.0,47.0,78.0,59.0,88.0,45.0,45.0,61.0,50.0,54.0,78.0,80.0,61.0,45.0,69.0,39.0,58.0,78.0,56.0,44.0,58.0,78.0,58.0,58.0,80.0,58.0,56.0,78.0,42.0,58.0,58.0,50.0,78.0,92.0,54.0,71.0,58.0,39.0,78.0,78.0,56.0,58.0,54.0,45.0,59.0,45.0,77.0,78.0,56.0,44.0,58.0,78.0,34.0,58.0,63.0,78.0,78.0,58.0,92.0,58.0,69.0,58.0,49.0,47.0,78.0,45.0,58.0,70.0,56.0,58.0,71.0,45.0,78.0,78.0,49.0
|
4 |
+
Gender,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0
|
p3/preprocess/Multiple_sclerosis/clinical_data/GSE131281.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM3768613,GSM3768614,GSM3768616,GSM3768617,GSM3768619,GSM3768620,GSM3768621,GSM3768623,GSM3768624,GSM3768625,GSM3768626,GSM3768627,GSM3768628,GSM3768629,GSM3768630,GSM3768631,GSM3768632,GSM3768633,GSM3768634,GSM3768635,GSM3768636,GSM3768637,GSM3768638,GSM3768639,GSM3768640,GSM3768641,GSM3768642,GSM3768643,GSM3768644,GSM3768645,GSM3768646,GSM3768647,GSM3768648,GSM3768649,GSM3768650,GSM3768651,GSM3768652,GSM3768653,GSM3768654,GSM3768655,GSM3768656,GSM3768657,GSM3768658,GSM3768659,GSM3768660,GSM3768661,GSM3768662,GSM3768663,GSM3768664,GSM3768665,GSM3768666,GSM3768667,GSM3768668,GSM3768669,GSM3768670,GSM3768671,GSM3768672,GSM3768673,GSM3768674,GSM3768675,GSM3768676,GSM3768677,GSM3768678,GSM3768679,GSM3768680,GSM3768681,GSM3768682,GSM3768683,GSM3768684,GSM3768685,GSM3768686,GSM3768687,GSM3768688,GSM3768689,GSM3768690,GSM3768691,GSM3768692,GSM3768693,GSM3768694,GSM3768695,GSM3768696,GSM3768697,GSM3768698,GSM3768699,GSM3768700,GSM3768701,GSM3768702,GSM3768703,GSM3768704,GSM3768705,GSM3768706,GSM3768707,GSM3768708,GSM3768709,GSM3768710,GSM3768711,GSM3768712,GSM3768713,GSM3768714,GSM3768715,GSM3768716,GSM3768717,GSM3768718,GSM3768719,GSM3768720,GSM3768721
|
2 |
+
Multiple_sclerosis,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0
|
3 |
+
Age,58.0,92.0,56.0,35.0,80.0,56.0,84.0,75.0,38.0,59.0,77.0,58.0,78.0,64.0,56.0,95.0,60.0,78.0,75.0,58.0,78.0,75.0,51.0,56.0,64.0,77.0,58.0,78.0,60.0,39.0,47.0,87.0,75.0,88.0,64.0,75.0,35.0,58.0,39.0,56.0,61.0,78.0,84.0,73.0,59.0,75.0,47.0,78.0,77.0,39.0,60.0,77.0,49.0,89.0,75.0,58.0,58.0,84.0,70.0,47.0,77.0,58.0,56.0,60.0,75.0,58.0,88.0,92.0,45.0,59.0,84.0,78.0,84.0,60.0,75.0,58.0,58.0,49.0,51.0,58.0,78.0,77.0,35.0,84.0,49.0,75.0,75.0,61.0,75.0,78.0,47.0,58.0,39.0,78.0,77.0,87.0,35.0,45.0,84.0,70.0,58.0,73.0,45.0,78.0,64.0,58.0
|
4 |
+
Gender,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0
|
p3/preprocess/Multiple_sclerosis/clinical_data/GSE131282.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM3768507,GSM3768508,GSM3768509,GSM3768510,GSM3768511,GSM3768512,GSM3768513,GSM3768514,GSM3768515,GSM3768516,GSM3768517,GSM3768518,GSM3768519,GSM3768520,GSM3768521,GSM3768522,GSM3768523,GSM3768524,GSM3768525,GSM3768526,GSM3768527,GSM3768528,GSM3768529,GSM3768530,GSM3768531,GSM3768532,GSM3768533,GSM3768534,GSM3768535,GSM3768536,GSM3768537,GSM3768538,GSM3768539,GSM3768540,GSM3768541,GSM3768542,GSM3768543,GSM3768544,GSM3768545,GSM3768546,GSM3768547,GSM3768548,GSM3768549,GSM3768550,GSM3768551,GSM3768552,GSM3768553,GSM3768554,GSM3768555,GSM3768556,GSM3768557,GSM3768558,GSM3768559,GSM3768560,GSM3768561,GSM3768562,GSM3768563,GSM3768564,GSM3768565,GSM3768566,GSM3768567,GSM3768568,GSM3768569,GSM3768570,GSM3768571,GSM3768572,GSM3768573,GSM3768574,GSM3768575,GSM3768576,GSM3768577,GSM3768578,GSM3768579,GSM3768580,GSM3768581,GSM3768582,GSM3768583,GSM3768584,GSM3768613,GSM3768614,GSM3768616,GSM3768617,GSM3768619,GSM3768620,GSM3768621,GSM3768623,GSM3768624,GSM3768625,GSM3768626,GSM3768627,GSM3768628,GSM3768629,GSM3768630,GSM3768631,GSM3768632,GSM3768633,GSM3768634,GSM3768635,GSM3768636,GSM3768637,GSM3768638,GSM3768639,GSM3768640,GSM3768641,GSM3768642,GSM3768643,GSM3768644,GSM3768645,GSM3768646,GSM3768647,GSM3768648,GSM3768649,GSM3768650,GSM3768651,GSM3768652,GSM3768653,GSM3768654,GSM3768655,GSM3768656,GSM3768657,GSM3768658,GSM3768659,GSM3768660,GSM3768661,GSM3768662,GSM3768663,GSM3768664,GSM3768665,GSM3768666,GSM3768667,GSM3768668,GSM3768669,GSM3768670,GSM3768671,GSM3768672,GSM3768673,GSM3768674,GSM3768675,GSM3768676,GSM3768677,GSM3768678,GSM3768679,GSM3768680,GSM3768681,GSM3768682,GSM3768683,GSM3768684,GSM3768685,GSM3768686,GSM3768687,GSM3768688,GSM3768689,GSM3768690,GSM3768691,GSM3768692,GSM3768693,GSM3768694,GSM3768695,GSM3768696,GSM3768697,GSM3768698,GSM3768699,GSM3768700,GSM3768701,GSM3768702,GSM3768703,GSM3768704,GSM3768705,GSM3768706,GSM3768707,GSM3768708,GSM3768709,GSM3768710,GSM3768711,GSM3768712,GSM3768713,GSM3768714,GSM3768715,GSM3768716,GSM3768717,GSM3768718,GSM3768719,GSM3768720,GSM3768721
|
2 |
+
Multiple_sclerosis,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
3 |
+
Age,58.0,59.0,80.0,63.0,47.0,78.0,59.0,88.0,45.0,45.0,61.0,50.0,54.0,78.0,80.0,61.0,45.0,69.0,39.0,58.0,78.0,56.0,44.0,58.0,78.0,58.0,58.0,80.0,58.0,56.0,78.0,42.0,58.0,58.0,50.0,78.0,92.0,54.0,71.0,58.0,39.0,78.0,78.0,56.0,58.0,54.0,45.0,59.0,45.0,77.0,78.0,56.0,44.0,58.0,78.0,34.0,58.0,63.0,78.0,78.0,58.0,92.0,58.0,69.0,58.0,49.0,47.0,78.0,45.0,58.0,70.0,56.0,58.0,71.0,45.0,78.0,78.0,49.0,58.0,92.0,56.0,35.0,80.0,56.0,84.0,75.0,38.0,59.0,77.0,58.0,78.0,64.0,56.0,95.0,60.0,78.0,75.0,58.0,78.0,75.0,51.0,56.0,64.0,77.0,58.0,78.0,60.0,39.0,47.0,87.0,75.0,88.0,64.0,75.0,35.0,58.0,39.0,56.0,61.0,78.0,84.0,73.0,59.0,75.0,47.0,78.0,77.0,39.0,60.0,77.0,49.0,89.0,75.0,58.0,58.0,84.0,70.0,47.0,77.0,58.0,56.0,60.0,75.0,58.0,88.0,92.0,45.0,59.0,84.0,78.0,84.0,60.0,75.0,58.0,58.0,49.0,51.0,58.0,78.0,77.0,35.0,84.0,49.0,75.0,75.0,61.0,75.0,78.0,47.0,58.0,39.0,78.0,77.0,87.0,35.0,45.0,84.0,70.0,58.0,73.0,45.0,78.0,64.0,58.0
|
4 |
+
Gender,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0
|