Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +3 -0
- p3/preprocess/Kidney_Papillary_Cell_Carcinoma/GSE42977.csv +3 -0
- p3/preprocess/Parkinsons_Disease/clinical_data/GSE202665.csv +4 -0
- p3/preprocess/Parkinsons_Disease/clinical_data/GSE202667.csv +4 -0
- p3/preprocess/Parkinsons_Disease/clinical_data/GSE30335.csv +2 -0
- p3/preprocess/Parkinsons_Disease/clinical_data/GSE49126.csv +2 -0
- p3/preprocess/Parkinsons_Disease/clinical_data/GSE57475.csv +4 -0
- p3/preprocess/Parkinsons_Disease/clinical_data/GSE71220.csv +4 -0
- p3/preprocess/Parkinsons_Disease/clinical_data/GSE72267.csv +2 -0
- p3/preprocess/Parkinsons_Disease/clinical_data/GSE80599.csv +4 -0
- p3/preprocess/Parkinsons_Disease/code/GSE101534.py +195 -0
- p3/preprocess/Parkinsons_Disease/code/GSE103099.py +180 -0
- p3/preprocess/Parkinsons_Disease/code/GSE202665.py +176 -0
- p3/preprocess/Parkinsons_Disease/code/GSE202667.py +171 -0
- p3/preprocess/Parkinsons_Disease/code/GSE30335.py +155 -0
- p3/preprocess/Parkinsons_Disease/code/GSE49126.py +256 -0
- p3/preprocess/Parkinsons_Disease/code/GSE57475.py +173 -0
- p3/preprocess/Parkinsons_Disease/code/GSE71220.py +168 -0
- p3/preprocess/Parkinsons_Disease/code/GSE72267.py +162 -0
- p3/preprocess/Parkinsons_Disease/code/GSE80599.py +175 -0
- p3/preprocess/Parkinsons_Disease/code/TCGA.py +36 -0
- p3/preprocess/Parkinsons_Disease/gene_data/GSE101534.csv +1 -0
- p3/preprocess/Parkinsons_Disease/gene_data/GSE49126.csv +0 -0
- p3/preprocess/Parkinsons_Disease/gene_data/GSE72267.csv +0 -0
- p3/preprocess/Peptic_ulcer_disease/GSE43580.csv +0 -0
- p3/preprocess/Peptic_ulcer_disease/GSE60427.csv +0 -0
- p3/preprocess/Peptic_ulcer_disease/clinical_data/GSE43580.csv +4 -0
- p3/preprocess/Peptic_ulcer_disease/clinical_data/GSE60427.csv +4 -0
- p3/preprocess/Peptic_ulcer_disease/code/GSE43580.py +170 -0
- p3/preprocess/Peptic_ulcer_disease/code/GSE60427.py +173 -0
- p3/preprocess/Peptic_ulcer_disease/code/TCGA.py +107 -0
- p3/preprocess/Peptic_ulcer_disease/cohort_info.json +1 -0
- p3/preprocess/Peptic_ulcer_disease/gene_data/GSE60427.csv +0 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/GSE19987.csv +0 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE19422.csv +2 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE19987.csv +2 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE33371.csv +4 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE39716.csv +4 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE64957.csv +2 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE67066.csv +2 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE19422.py +159 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE19987.py +172 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE33371.py +175 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE39716.py +173 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE64957.py +190 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE67066.py +157 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/TCGA.py +143 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/cohort_info.json +1 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/gene_data/GSE19987.csv +0 -0
- p3/preprocess/Pheochromocytoma_and_Paraganglioma/gene_data/GSE64957.csv +1 -0
.gitattributes
CHANGED
@@ -1877,3 +1877,6 @@ p3/preprocess/Liver_Cancer/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -tex
|
|
1877 |
p3/preprocess/Liver_cirrhosis/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1878 |
p3/preprocess/Liver_cirrhosis/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1879 |
p3/preprocess/Intellectual_Disability/GSE59630.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
1877 |
p3/preprocess/Liver_cirrhosis/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1878 |
p3/preprocess/Liver_cirrhosis/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1879 |
p3/preprocess/Intellectual_Disability/GSE59630.csv filter=lfs diff=lfs merge=lfs -text
|
1880 |
+
p3/preprocess/Kidney_Papillary_Cell_Carcinoma/GSE42977.csv filter=lfs diff=lfs merge=lfs -text
|
1881 |
+
p3/preprocess/lower_grade_glioma_and_glioblastoma/gene_data/GSE35158.csv filter=lfs diff=lfs merge=lfs -text
|
1882 |
+
p3/preprocess/lower_grade_glioma_and_glioblastoma/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
p3/preprocess/Kidney_Papillary_Cell_Carcinoma/GSE42977.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:85fb3027fbcc3d696ce2d922d9c4d22f03e361cdbb3d1175989ec207120ac081
|
3 |
+
size 24576678
|
p3/preprocess/Parkinsons_Disease/clinical_data/GSE202665.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM6128044,GSM6128045,GSM6128046,GSM6128047,GSM6128048,GSM6128049,GSM6128050,GSM6128051,GSM6128052,GSM6128053,GSM6128054,GSM6128055,GSM6128056,GSM6128057,GSM6128058,GSM6128059,GSM6128060,GSM6128061,GSM6128062,GSM6128063,GSM6128064,GSM6128065,GSM6128066,GSM6128067,GSM6128068,GSM6128069,GSM6128070,GSM6128071,GSM6128072,GSM6128073,GSM6128074,GSM6128075,GSM6128076,GSM6128077,GSM6128078,GSM6128079,GSM6128080,GSM6128081,GSM6128082,GSM6128083,GSM6128084,GSM6128085,GSM6128086,GSM6128087,GSM6128088,GSM6128089,GSM6128090,GSM6128091,GSM6128092,GSM6128093,GSM6128094,GSM6128095,GSM6128096,GSM6128097,GSM6128098,GSM6128099,GSM6128100,GSM6128101,GSM6128102
|
2 |
+
Parkinsons_Disease,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,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
|
3 |
+
Age,53.0,53.0,53.0,53.0,53.0,53.0,57.0,57.0,57.0,57.0,57.0,63.0,63.0,63.0,63.0,63.0,63.0,75.0,75.0,75.0,75.0,75.0,75.0,85.0,85.0,85.0,85.0,85.0,85.0,76.0,76.0,76.0,76.0,76.0,76.0,63.0,63.0,63.0,63.0,63.0,63.0,69.0,69.0,69.0,69.0,69.0,69.0,66.0,66.0,66.0,66.0,66.0,66.0,53.0,53.0,53.0,53.0,53.0,53.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,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/Parkinsons_Disease/clinical_data/GSE202667.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM6128103,GSM6128104,GSM6128105,GSM6128106,GSM6128107,GSM6128108,GSM6128109,GSM6128110,GSM6128111,GSM6128112,GSM6128113,GSM6128114,GSM6128115,GSM6128116,GSM6128117,GSM6128118,GSM6128119,GSM6128120,GSM6128121,GSM6128122,GSM6128123,GSM6128124,GSM6128125,GSM6128126,GSM6128127,GSM6128128,GSM6128129,GSM6128130,GSM6128131,GSM6128132,GSM6128133,GSM6128134,GSM6128135,GSM6128136,GSM6128137,GSM6128138,GSM6128139,GSM6128140,GSM6128141,GSM6128142,GSM6128143,GSM6128144,GSM6128145,GSM6128146,GSM6128147,GSM6128148,GSM6128149,GSM6128150,GSM6128151,GSM6128152,GSM6128153,GSM6128154,GSM6128155,GSM6128156,GSM6128157,GSM6128158,GSM6128159,GSM6128160,GSM6128161,GSM6128162
|
2 |
+
Parkinsons_Disease,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,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
|
3 |
+
Age,53.0,53.0,53.0,53.0,53.0,53.0,57.0,57.0,57.0,57.0,57.0,57.0,63.0,63.0,63.0,63.0,63.0,63.0,75.0,75.0,75.0,75.0,75.0,75.0,85.0,85.0,85.0,85.0,85.0,85.0,76.0,76.0,76.0,76.0,76.0,76.0,63.0,63.0,63.0,63.0,63.0,63.0,69.0,69.0,69.0,69.0,69.0,69.0,66.0,66.0,66.0,66.0,66.0,66.0,53.0,53.0,53.0,53.0,53.0,53.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,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/Parkinsons_Disease/clinical_data/GSE30335.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM752043,GSM752044,GSM752045,GSM752046,GSM752047,GSM752049,GSM752050,GSM752051,GSM752052,GSM752053,GSM752054,GSM752055,GSM752056,GSM752057,GSM752058,GSM752059,GSM752060,GSM752061,GSM752062,GSM752064,GSM752065,GSM752066,GSM752068,GSM752069,GSM752070,GSM752071,GSM752072,GSM752073,GSM752075,GSM752076,GSM752077,GSM752078,GSM752080,GSM752081,GSM752082,GSM752084,GSM752085,GSM752086,GSM752087,GSM752088
|
2 |
+
Parkinsons_Disease,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
p3/preprocess/Parkinsons_Disease/clinical_data/GSE49126.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM1194062,GSM1194063,GSM1194064,GSM1194065,GSM1194066,GSM1194067,GSM1194068,GSM1194069,GSM1194070,GSM1194071,GSM1194072,GSM1194073,GSM1194074,GSM1194075,GSM1194076,GSM1194077,GSM1194078,GSM1194079,GSM1194080,GSM1194081,GSM1194082,GSM1194083,GSM1194084,GSM1194085,GSM1194086,GSM1194087,GSM1194088,GSM1194089,GSM1194090,GSM1194091,GSM1194092,GSM1194093,GSM1194094,GSM1194095,GSM1194096,GSM1194097,GSM1194098,GSM1194099,GSM1194100,GSM1194101,GSM1194102,GSM1194103,GSM1194104,GSM1194105,GSM1194106,GSM1194107,GSM1194108,GSM1194109,GSM1194110,GSM1194111
|
2 |
+
Parkinsons_Disease,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,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/Parkinsons_Disease/clinical_data/GSE57475.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1383302,GSM1383303,GSM1383304,GSM1383305,GSM1383306,GSM1383307,GSM1383308,GSM1383309,GSM1383310,GSM1383311,GSM1383312,GSM1383313,GSM1383314,GSM1383315,GSM1383316,GSM1383317,GSM1383318,GSM1383319,GSM1383320,GSM1383321,GSM1383322,GSM1383323,GSM1383324,GSM1383325,GSM1383326,GSM1383327,GSM1383328,GSM1383329,GSM1383330,GSM1383331,GSM1383332,GSM1383333,GSM1383334,GSM1383335,GSM1383336,GSM1383337,GSM1383338,GSM1383339,GSM1383340,GSM1383341,GSM1383342,GSM1383343,GSM1383344,GSM1383345,GSM1383346,GSM1383347,GSM1383348,GSM1383349,GSM1383350,GSM1383351,GSM1383352,GSM1383353,GSM1383354,GSM1383355,GSM1383356,GSM1383357,GSM1383358,GSM1383359,GSM1383360,GSM1383361,GSM1383362,GSM1383363,GSM1383364,GSM1383365,GSM1383366,GSM1383367,GSM1383368,GSM1383369,GSM1383370,GSM1383371,GSM1383372,GSM1383373,GSM1383374,GSM1383375,GSM1383376,GSM1383377,GSM1383378,GSM1383379,GSM1383380,GSM1383381,GSM1383382,GSM1383383,GSM1383384,GSM1383385,GSM1383386,GSM1383387,GSM1383388,GSM1383389,GSM1383390,GSM1383391,GSM1383392,GSM1383393,GSM1383394,GSM1383395,GSM1383396,GSM1383397,GSM1383398,GSM1383399,GSM1383400,GSM1383401,GSM1383402,GSM1383403,GSM1383404,GSM1383405,GSM1383406,GSM1383407,GSM1383408,GSM1383409,GSM1383410,GSM1383411,GSM1383412,GSM1383413,GSM1383414,GSM1383415,GSM1383416,GSM1383417,GSM1383418,GSM1383419,GSM1383420,GSM1383421,GSM1383422,GSM1383423,GSM1383424,GSM1383425,GSM1383426,GSM1383427,GSM1383428,GSM1383429,GSM1383430,GSM1383431,GSM1383432,GSM1383433,GSM1383434,GSM1383435,GSM1383436,GSM1383437,GSM1383438,GSM1383439,GSM1383440,GSM1383441,GSM1383442,GSM1383443
|
2 |
+
Parkinsons_Disease,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,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
|
3 |
+
Age,62.0,54.0,58.0,76.0,52.0,52.0,72.0,54.0,78.0,61.0,67.0,68.0,76.0,84.0,65.0,58.0,86.0,49.0,72.0,71.0,69.0,64.0,55.0,69.0,60.0,56.0,60.0,61.0,53.0,69.0,65.0,58.0,63.0,80.0,45.0,52.0,49.0,67.0,75.0,66.0,78.0,65.0,51.0,60.0,70.0,76.0,57.0,66.0,52.0,68.0,55.0,39.0,53.0,78.0,61.0,59.0,52.0,67.0,53.0,64.0,61.0,58.0,70.0,49.0,59.0,63.0,49.0,84.0,79.0,59.0,67.0,72.0,61.0,58.0,77.0,58.0,61.0,69.0,61.0,55.0,62.0,77.0,60.0,55.0,62.0,61.0,66.0,59.0,61.0,52.0,53.0,59.0,69.0,81.0,54.0,57.0,70.0,49.0,73.0,74.0,79.0,67.0,49.0,55.0,57.0,63.0,59.0,55.0,54.0,56.0,57.0,58.0,59.0,69.0,60.0,60.0,53.0,52.0,59.0,87.0,47.0,59.0,51.0,76.0,51.0,73.0,65.0,48.0,57.0,65.0,64.0,61.0,49.0,55.0,63.0,57.0,58.0,64.0,74.0,57.0,76.0,76.0
|
4 |
+
Gender,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.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,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.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,0.0,1.0,0.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,0.0,1.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,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.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,0.0,1.0,0.0,1.0,1.0,1.0,1.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,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0
|
p3/preprocess/Parkinsons_Disease/clinical_data/GSE71220.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1830157,GSM1830158,GSM1830159,GSM1830160,GSM1830161,GSM1830162,GSM1830163,GSM1830164,GSM1830165,GSM1830166,GSM1830167,GSM1830168,GSM1830169,GSM1830170,GSM1830171,GSM1830172,GSM1830173,GSM1830174,GSM1830175,GSM1830176,GSM1830177,GSM1830178,GSM1830179,GSM1830180,GSM1830181,GSM1830182,GSM1830183,GSM1830184,GSM1830185,GSM1830186,GSM1830187,GSM1830188,GSM1830189,GSM1830190,GSM1830191,GSM1830192,GSM1830193,GSM1830194,GSM1830195,GSM1830196,GSM1830197,GSM1830198,GSM1830199,GSM1830200,GSM1830201,GSM1830202,GSM1830203,GSM1830204,GSM1830205,GSM1830206,GSM1830207,GSM1830208,GSM1830209,GSM1830210,GSM1830211,GSM1830212,GSM1830213,GSM1830214,GSM1830215,GSM1830216,GSM1830217,GSM1830218,GSM1830219,GSM1830220,GSM1830221,GSM1830222,GSM1830223,GSM1830224,GSM1830225,GSM1830226,GSM1830227,GSM1830228,GSM1830229,GSM1830230,GSM1830231,GSM1830232,GSM1830233,GSM1830234,GSM1830235,GSM1830236,GSM1830237,GSM1830238,GSM1830239,GSM1830240,GSM1830241,GSM1830242,GSM1830243,GSM1830244,GSM1830245,GSM1830246,GSM1830247,GSM1830248,GSM1830249,GSM1830250,GSM1830251,GSM1830252,GSM1830253,GSM1830254,GSM1830255,GSM1830256,GSM1830257,GSM1830258,GSM1830259,GSM1830260,GSM1830261,GSM1830262,GSM1830263,GSM1830264,GSM1830265,GSM1830266,GSM1830267,GSM1830268,GSM1830269,GSM1830270,GSM1830271,GSM1830272,GSM1830273,GSM1830274,GSM1830275,GSM1830276,GSM1830277,GSM1830278,GSM1830279,GSM1830280,GSM1830281,GSM1830282,GSM1830283,GSM1830284,GSM1830285,GSM1830286,GSM1830287,GSM1830288,GSM1830289,GSM1830290,GSM1830291,GSM1830292,GSM1830293,GSM1830294,GSM1830295,GSM1830296,GSM1830297,GSM1830298,GSM1830299,GSM1830300,GSM1830301,GSM1830302,GSM1830303,GSM1830304,GSM1830305,GSM1830306,GSM1830307,GSM1830308,GSM1830309,GSM1830310,GSM1830311,GSM1830312,GSM1830313,GSM1830314,GSM1830315,GSM1830316,GSM1830317,GSM1830318,GSM1830319,GSM1830320,GSM1830321,GSM1830322,GSM1830323,GSM1830324,GSM1830325,GSM1830326,GSM1830327,GSM1830328,GSM1830329,GSM1830330,GSM1830331,GSM1830332,GSM1830333,GSM1830334,GSM1830335,GSM1830336,GSM1830337,GSM1830338,GSM1830339,GSM1830340,GSM1830341,GSM1830342,GSM1830343,GSM1830344,GSM1830345,GSM1830346,GSM1830347,GSM1830348,GSM1830349,GSM1830350,GSM1830351,GSM1830352,GSM1830353,GSM1830354,GSM1830355,GSM1830356,GSM1830357,GSM1830358,GSM1830359,GSM1830360,GSM1830361,GSM1830362,GSM1830363,GSM1830364,GSM1830365,GSM1830366,GSM1830367,GSM1830368,GSM1830369,GSM1830370,GSM1830371,GSM1830372,GSM1830373,GSM1830374,GSM1830375,GSM1830376,GSM1830377,GSM1830378,GSM1830379,GSM1830380,GSM1830381,GSM1830382,GSM1830383,GSM1830384,GSM1830385,GSM1830386,GSM1830387,GSM1830388,GSM1830389,GSM1830390,GSM1830391,GSM1830392,GSM1830393,GSM1830394,GSM1830395,GSM1830396,GSM1830397,GSM1830398,GSM1830399,GSM1830400,GSM1830401,GSM1830402,GSM1830403,GSM1830404,GSM1830405,GSM1830406,GSM1830407,GSM1830408,GSM1830409,GSM1830410,GSM1830411,GSM1830412,GSM1830413,GSM1830414,GSM1830415,GSM1830416,GSM1830417,GSM1830418,GSM1830419,GSM1830420,GSM1830421,GSM1830422,GSM1830423,GSM1830424,GSM1830425,GSM1830426,GSM1830427,GSM1830428,GSM1830429,GSM1830430,GSM1830431,GSM1830432,GSM1830433,GSM1830434,GSM1830435,GSM1830436,GSM1830437,GSM1830438,GSM1830439,GSM1830440,GSM1830441,GSM1830442,GSM1830443,GSM1830444,GSM1830445,GSM1830446,GSM1830447,GSM1830448,GSM1830449,GSM1830450,GSM1830451,GSM1830452,GSM1830453,GSM1830454,GSM1830455,GSM1830456,GSM1830457,GSM1830458,GSM1830459,GSM1830460,GSM1830461,GSM1830462,GSM1830463,GSM1830464,GSM1830465,GSM1830466,GSM1830467,GSM1830468,GSM1830469,GSM1830470,GSM1830471,GSM1830472,GSM1830473,GSM1830474,GSM1830475,GSM1830476,GSM1830477,GSM1830478,GSM1830479,GSM1830480,GSM1830481,GSM1830482,GSM1830483,GSM1830484,GSM1830485,GSM1830486,GSM1830487,GSM1830488,GSM1830489,GSM1830490,GSM1830491,GSM1830492,GSM1830493,GSM1830494,GSM1830495,GSM1830496,GSM1830497,GSM1830498,GSM1830499,GSM1830500,GSM1830501,GSM1830502,GSM1830503,GSM1830504,GSM1830505,GSM1830506,GSM1830507,GSM1830508,GSM1830509,GSM1830510,GSM1830511,GSM1830512,GSM1830513,GSM1830514,GSM1830515,GSM1830516,GSM1830517,GSM1830518,GSM1830519,GSM1830520,GSM1830521,GSM1830522,GSM1830523,GSM1830524,GSM1830525,GSM1830526,GSM1830527,GSM1830528,GSM1830529,GSM1830530,GSM1830531,GSM1830532,GSM1830533,GSM1830534,GSM1830535,GSM1830536,GSM1830537,GSM1830538,GSM1830539,GSM1830540,GSM1830541,GSM1830542,GSM1830543,GSM1830544,GSM1830545,GSM1830546,GSM1830547,GSM1830548,GSM1830549,GSM1830550,GSM1830551,GSM1830552,GSM1830553,GSM1830554,GSM1830555,GSM1830556,GSM1830557,GSM1830558,GSM1830559,GSM1830560,GSM1830561,GSM1830562,GSM1830563,GSM1830564,GSM1830565,GSM1830566,GSM1830567,GSM1830568,GSM1830569,GSM1830570,GSM1830571,GSM1830572,GSM1830573,GSM1830574,GSM1830575,GSM1830576,GSM1830577,GSM1830578,GSM1830579,GSM1830580,GSM1830581,GSM1830582,GSM1830583,GSM1830584,GSM1830585,GSM1830586,GSM1830587,GSM1830588,GSM1830589,GSM1830590,GSM1830591,GSM1830592,GSM1830593,GSM1830594,GSM1830595,GSM1830596,GSM1830597,GSM1830598,GSM1830599,GSM1830600,GSM1830601,GSM1830602,GSM1830603,GSM1830604,GSM1830605,GSM1830606,GSM1830607,GSM1830608,GSM1830609,GSM1830610,GSM1830611,GSM1830612,GSM1830613,GSM1830614,GSM1830615,GSM1830616,GSM1830617,GSM1830618,GSM1830619,GSM1830620,GSM1830621,GSM1830622,GSM1830623,GSM1830624,GSM1830625,GSM1830626,GSM1830627,GSM1830628,GSM1830629,GSM1830630,GSM1830631,GSM1830632,GSM1830633,GSM1830634,GSM1830635,GSM1830636,GSM1830637,GSM1830638,GSM1830639,GSM1830640,GSM1830641,GSM1830642,GSM1830643,GSM1830644,GSM1830645,GSM1830646,GSM1830647,GSM1830648,GSM1830649,GSM1830650,GSM1830651,GSM1830652,GSM1830653,GSM1830654,GSM1830655,GSM1830656,GSM1830657,GSM1830658,GSM1830659,GSM1830660,GSM1830661,GSM1830662,GSM1830663,GSM1830664,GSM1830665,GSM1830666,GSM1830667,GSM1830668,GSM1830669,GSM1830670,GSM1830671,GSM1830672,GSM1830673,GSM1830674,GSM1830675,GSM1830676,GSM1830677,GSM1830678,GSM1830679,GSM1830680,GSM1830681,GSM1830682,GSM1830683,GSM1830684,GSM1830685,GSM1830686,GSM1830687,GSM1830688,GSM1830689,GSM1830690,GSM1830691,GSM1830692,GSM1830693,GSM1830694,GSM1830695,GSM1830696,GSM1830697,GSM1830698,GSM1830699,GSM1830700,GSM1830701,GSM1830702,GSM1830703,GSM1830704,GSM1830705,GSM1830706,GSM1830707,GSM1830708,GSM1830709,GSM1830710,GSM1830711,GSM1830712,GSM1830713,GSM1830714,GSM1830715,GSM1830716,GSM1830717,GSM1830718,GSM1830719,GSM1830720,GSM1830721,GSM1830722,GSM1830723,GSM1830724,GSM1830725,GSM1830726,GSM1830727,GSM1830728,GSM1830729,GSM1830730,GSM1830731,GSM1830732,GSM1830733,GSM1830734,GSM1830735,GSM1830736,GSM1830737,GSM1830738,GSM1830739,GSM1830740,GSM1830741,GSM1830742,GSM1830743,GSM1830744,GSM1830745,GSM1830746,GSM1830747,GSM1830748,GSM1830749,GSM1830750,GSM1830751,GSM1830752,GSM1830753,GSM1830754,GSM1830755,GSM1830756,GSM1830757,GSM1830758,GSM1830759,GSM1830760,GSM1830761,GSM1830762,GSM1830763,GSM1830764,GSM1830765,GSM1830766,GSM1830767,GSM1830768,GSM1830769,GSM1830770,GSM1830771,GSM1830772,GSM1830773
|
2 |
+
Parkinsons_Disease,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,0.0,1.0,1.0,1.0,0.0,0.0,1.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,1.0,1.0,0.0,0.0,1.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,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,0.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,1.0,1.0,0.0,0.0,0.0,0.0,1.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,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,1.0,1.0,1.0,1.0,0.0,0.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,0.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,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,1.0,1.0,1.0,1.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,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,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.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,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,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,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,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,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
|
3 |
+
Age,57.0,72.0,70.0,57.0,62.0,67.0,60.0,66.0,74.0,61.0,70.0,68.0,71.0,49.0,70.0,74.0,71.0,69.0,75.0,60.0,63.0,63.0,51.0,71.0,68.0,57.0,70.0,65.0,73.0,75.0,59.0,75.0,72.0,61.0,63.0,55.0,58.0,69.0,58.0,58.0,63.0,73.0,72.0,67.0,66.0,65.0,71.0,69.0,52.0,53.0,68.0,62.0,67.0,68.0,67.0,72.0,71.0,59.0,68.0,58.0,52.0,68.0,59.0,51.0,59.0,60.0,63.0,58.0,67.0,60.0,68.0,61.0,50.0,67.0,73.0,61.0,53.0,61.0,73.0,56.0,61.0,70.0,63.0,66.0,59.0,70.0,69.0,61.0,61.0,73.0,58.0,68.0,73.0,68.0,72.0,60.0,51.0,61.0,49.0,51.0,55.0,67.0,54.0,56.0,54.0,59.0,61.0,59.0,53.0,54.0,67.0,73.0,62.0,61.0,62.0,51.0,63.0,61.0,59.0,59.0,69.0,59.0,57.0,57.0,69.0,61.0,63.0,59.0,67.0,53.0,66.0,64.0,62.0,64.0,62.0,51.0,60.0,62.0,69.0,58.0,63.0,56.0,71.0,64.0,66.0,65.0,67.0,70.0,49.0,51.0,51.0,63.0,57.0,67.0,58.0,58.0,68.0,66.0,57.0,69.0,71.0,60.0,73.0,64.0,71.0,64.0,65.0,65.0,64.0,56.0,60.0,60.0,63.0,60.0,60.0,61.0,57.0,65.0,70.0,60.0,66.0,74.0,69.0,71.0,70.0,60.0,72.0,56.0,59.0,63.0,54.0,65.0,61.0,63.0,70.0,74.0,55.0,54.0,62.0,63.0,65.0,64.0,71.0,64.0,66.0,57.0,73.0,66.0,69.0,67.0,53.0,65.0,54.0,50.0,53.0,65.0,59.0,68.0,67.0,68.0,67.0,64.0,66.0,62.0,60.0,70.0,57.0,72.0,62.0,75.0,66.0,61.0,64.0,52.0,62.0,55.0,60.0,62.0,63.0,70.0,64.0,61.0,69.0,61.0,69.0,61.0,60.0,65.0,64.0,69.0,63.0,74.0,59.0,53.0,62.0,71.0,71.0,65.0,70.0,65.0,69.0,50.0,75.0,64.0,53.0,72.0,68.0,59.0,52.0,74.0,52.0,58.0,69.0,72.0,73.0,61.0,68.0,50.0,62.0,63.0,71.0,54.0,69.0,60.0,51.0,72.0,66.0,63.0,63.0,54.0,72.0,59.0,74.0,62.0,66.0,63.0,71.0,74.0,72.0,51.0,73.0,54.0,65.0,62.0,62.0,60.0,70.0,59.0,57.0,68.0,68.0,67.0,70.0,55.0,64.0,70.0,62.0,57.0,56.0,74.0,59.0,75.0,64.0,61.0,62.0,51.0,58.0,69.0,65.0,66.0,71.0,62.0,61.0,65.0,56.0,57.0,63.0,71.0,72.0,66.0,63.0,72.0,69.0,59.0,55.0,73.0,68.0,61.0,72.0,58.0,69.0,74.0,62.0,67.0,64.0,61.0,63.0,70.0,59.0,67.0,67.0,68.0,65.0,68.0,73.0,64.0,71.0,65.0,66.0,68.0,74.0,73.0,69.0,63.0,71.0,63.0,53.0,73.0,65.0,71.0,66.0,53.0,67.0,57.0,73.0,62.0,57.0,58.0,65.0,50.0,70.0,63.0,60.0,65.0,65.0,66.0,64.0,69.0,74.0,63.0,68.0,62.0,72.0,55.0,60.0,64.0,64.0,67.0,64.0,57.0,66.0,70.0,70.0,52.0,60.0,66.0,65.0,66.0,71.0,63.0,59.0,64.0,64.0,62.0,71.0,63.0,57.0,62.0,70.0,59.0,73.0,60.0,63.0,62.0,63.0,63.0,64.0,59.0,70.0,64.0,58.0,57.0,71.0,68.0,73.0,62.0,72.0,66.0,65.0,67.0,65.0,60.0,66.0,62.0,65.0,50.0,67.0,62.0,60.0,57.0,59.0,73.0,74.0,63.0,64.0,60.0,62.0,70.0,52.0,65.0,70.0,64.0,65.0,66.0,57.0,66.0,70.0,72.0,62.0,55.0,74.0,58.0,65.0,63.0,66.0,57.0,70.0,60.0,59.0,60.0,52.0,55.0,66.0,69.0,60.0,69.0,60.0,60.0,59.0,63.0,67.0,54.0,56.0,54.0,62.0,71.0,69.0,64.0,54.0,68.0,64.0,60.0,51.0,71.0,59.0,68.0,58.0,68.0,68.0,57.0,68.0,66.0,73.0,70.0,67.0,54.0,53.0,69.0,56.0,59.0,56.0,58.0,59.0,57.0,60.0,70.0,57.0,69.0,67.0,50.0,68.0,67.0,66.0,59.0,72.0,69.0,59.0,67.0,70.0,73.0,56.0,73.0,72.0,52.0,56.0,69.0,71.0,66.0,69.0,59.0,65.0,72.0,66.0,62.0,60.0,59.0,62.0,60.0,70.0,75.0,59.0,57.0,61.0,58.0,75.0,52.0,63.0,55.0,69.0,57.0,59.0,50.0,65.0,72.0,51.0,73.0,58.0,64.0,60.0,60.0,60.0,68.0,68.0,59.0,72.0,66.0,65.0,53.0,67.0,74.0,53.0,67.0,57.0,72.0,59.0,53.0,73.0,63.0,52.0,62.0,69.0,73.0,65.0,68.0,63.0,74.0,64.0
|
4 |
+
Gender,0.0,1.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,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,0.0,1.0,1.0,1.0,1.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,0.0,1.0,1.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,0.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,1.0,1.0,1.0,1.0,1.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,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.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,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,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.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,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,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.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,0.0,1.0,1.0,1.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,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.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,0.0,0.0,0.0,0.0,0.0,0.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,1.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,0.0,1.0,1.0,1.0,1.0,0.0,1.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,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.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,0.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,1.0,0.0,0.0,0.0,0.0,0.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,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.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,1.0,1.0,1.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,0.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.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,0.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,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,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.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,0.0,1.0,0.0,1.0,0.0,0.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,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.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,1.0
|
p3/preprocess/Parkinsons_Disease/clinical_data/GSE72267.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM1859079,GSM1859080,GSM1859081,GSM1859082,GSM1859083,GSM1859084,GSM1859085,GSM1859086,GSM1859087,GSM1859088,GSM1859089,GSM1859090,GSM1859091,GSM1859092,GSM1859093,GSM1859094,GSM1859095,GSM1859096,GSM1859097,GSM1859098,GSM1859099,GSM1859100,GSM1859101,GSM1859102,GSM1859103,GSM1859104,GSM1859105,GSM1859106,GSM1859107,GSM1859108,GSM1859109,GSM1859110,GSM1859111,GSM1859112,GSM1859113,GSM1859114,GSM1859115,GSM1859116,GSM1859117,GSM1859118,GSM1859119,GSM1859120,GSM1859121,GSM1859122,GSM1859123,GSM1859124,GSM1859125,GSM1859126,GSM1859127,GSM1859128,GSM1859129,GSM1859130,GSM1859131,GSM1859132,GSM1859133,GSM1859134,GSM1859135,GSM1859136,GSM1859137
|
2 |
+
Parkinsons_Disease,0.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,0.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,1.0,0.0,1.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,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,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
p3/preprocess/Parkinsons_Disease/clinical_data/GSE80599.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM2131374,GSM2131375,GSM2131376,GSM2131377,GSM2131378,GSM2131379,GSM2131380,GSM2131381,GSM2131382,GSM2131383,GSM2131384,GSM2131385,GSM2131386,GSM2131387,GSM2131388,GSM2131389,GSM2131390,GSM2131391,GSM2131392,GSM2131393,GSM2131394,GSM2131395,GSM2131396,GSM2131397,GSM2131398,GSM2131399,GSM2131400,GSM2131401,GSM2131402,GSM2131403,GSM2131404,GSM2131405,GSM2131406,GSM2131407,GSM2131408,GSM2131409,GSM2131410,GSM2131411,GSM2131412,GSM2131413,GSM2131414,GSM2131415,GSM2131416,GSM2131417,GSM2131418,GSM2131419,GSM2131420,GSM2131421,GSM2131422,GSM2131423,GSM2131424,GSM2131425,GSM2131426,GSM2131427,GSM2131428,GSM2131429,GSM2131430,GSM2131431,GSM2131432,GSM2131433,GSM2131434,GSM2131435,GSM2131436,GSM2131437,GSM2131438,GSM2131439,GSM2131440
|
2 |
+
Parkinsons_Disease,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.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,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.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,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0
|
3 |
+
Age,68.0,58.0,53.0,54.0,50.0,53.0,62.0,52.0,65.0,69.0,60.0,74.0,54.0,52.0,62.0,55.0,50.0,46.0,36.0,45.0,45.0,42.0,52.0,65.0,47.0,46.0,63.0,47.0,44.0,56.0,47.0,55.0,45.0,43.0,60.0,62.0,58.0,51.0,36.0,50.0,51.0,60.0,34.0,80.0,40.0,38.0,51.0,46.0,41.0,8.0,62.0,41.0,56.0,61.0,35.0,64.0,53.0,63.0,59.0,50.0,24.0,69.0,51.0,57.0,48.0,54.0,27.0
|
4 |
+
Gender,1.0,1.0,0.0,0.0,1.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,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,0.0,1.0,0.0,1.0,1.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,1.0,0.0,1.0,1.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
|
p3/preprocess/Parkinsons_Disease/code/GSE101534.py
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE101534"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE101534"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE101534.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE101534.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE101534.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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
|
33 |
+
is_gene_available = True # Based on background info mentioning "Genome-wide expression profiling"
|
34 |
+
|
35 |
+
# 2.1 Data Row Identification
|
36 |
+
trait_row = 0 # Based on mutation status in characteristic dictionary
|
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(value):
|
42 |
+
if not isinstance(value, str):
|
43 |
+
return None
|
44 |
+
value = value.lower().split(': ')[-1]
|
45 |
+
if value == 'patient':
|
46 |
+
return 1
|
47 |
+
elif value == 'healthy':
|
48 |
+
return 0
|
49 |
+
return None
|
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 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 |
+
if trait_row is not None:
|
69 |
+
selected_clinical = geo_select_clinical_features(
|
70 |
+
clinical_df=clinical_data,
|
71 |
+
trait=trait,
|
72 |
+
trait_row=trait_row,
|
73 |
+
convert_trait=convert_trait
|
74 |
+
)
|
75 |
+
|
76 |
+
# Preview data
|
77 |
+
preview = preview_df(selected_clinical)
|
78 |
+
print("Preview of clinical data:", preview)
|
79 |
+
|
80 |
+
# Save to CSV
|
81 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
82 |
+
# Get gene expression data from matrix file
|
83 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
84 |
+
|
85 |
+
# Examine data structure
|
86 |
+
print("Data structure and head:")
|
87 |
+
print(genetic_data.head())
|
88 |
+
|
89 |
+
print("\nShape:", genetic_data.shape)
|
90 |
+
|
91 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
92 |
+
print(list(genetic_data.index)[:20])
|
93 |
+
|
94 |
+
# Get a few column names to verify sample IDs
|
95 |
+
print("\nFirst 5 column names:")
|
96 |
+
print(list(genetic_data.columns)[:5])
|
97 |
+
# Looking at the identifiers "16650001", etc - these appear to be microarray probe IDs
|
98 |
+
# rather than standard human gene symbols (which would be like "SNCA", "PINK1", etc)
|
99 |
+
# Therefore we need to map these probe IDs to gene symbols
|
100 |
+
requires_gene_mapping = True
|
101 |
+
# First examine a portion of the SOFT file to locate gene annotation table
|
102 |
+
with gzip.open(soft_file_path, 'rt') as f:
|
103 |
+
in_table = False
|
104 |
+
table_lines = []
|
105 |
+
for i, line in enumerate(f):
|
106 |
+
if '!Platform_table_begin' in line:
|
107 |
+
in_table = True
|
108 |
+
table_lines.append(line)
|
109 |
+
continue
|
110 |
+
if in_table and '!Platform_table_end' in line:
|
111 |
+
break
|
112 |
+
if in_table:
|
113 |
+
table_lines.append(line)
|
114 |
+
if i < 5: # Print first few lines for context
|
115 |
+
print(line.strip())
|
116 |
+
|
117 |
+
# Parse table content into dataframe
|
118 |
+
table_content = ''.join(table_lines)
|
119 |
+
gene_annotation = pd.read_csv(io.StringIO(table_content), sep='\t', comment='!')
|
120 |
+
|
121 |
+
# Display column names and preview data
|
122 |
+
print("\nColumn names:")
|
123 |
+
print(gene_annotation.columns)
|
124 |
+
|
125 |
+
print("\nPreview of gene annotation data:")
|
126 |
+
print(preview_df(gene_annotation))
|
127 |
+
# Extract gene annotation data using the library function
|
128 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
129 |
+
|
130 |
+
# Load mapping between RefSeq accessions and gene symbols
|
131 |
+
# Since we see NM_ and NR_ accessions, this data likely needs mapping through external resources
|
132 |
+
# For now let's examine what columns and data we have
|
133 |
+
print("Column names in gene annotation data:")
|
134 |
+
print(gene_annotation.columns.tolist())
|
135 |
+
|
136 |
+
print("\nSample of gene annotation data:")
|
137 |
+
print(gene_annotation.head().to_dict('records'))
|
138 |
+
|
139 |
+
# Look at the distribution of GB_ACC patterns to understand what types of IDs we have
|
140 |
+
gb_acc_patterns = gene_annotation['GB_ACC'].dropna().str.extract(r'(^[A-Z]{2}_)')[0].value_counts()
|
141 |
+
print("\nDistribution of GB_ACC identifier types:")
|
142 |
+
print(gb_acc_patterns)
|
143 |
+
|
144 |
+
# Check total number of entries with GB_ACC
|
145 |
+
total = len(gene_annotation)
|
146 |
+
with_gb = gene_annotation['GB_ACC'].notna().sum()
|
147 |
+
print(f"\nTotal entries: {total}")
|
148 |
+
print(f"Entries with GB_ACC: {with_gb} ({(with_gb/total)*100:.1f}%)")
|
149 |
+
# Use the working annotation extraction from Step 6
|
150 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
151 |
+
|
152 |
+
# Create mapping dataframe focusing on ID and RefSeq accession
|
153 |
+
mapping_df = gene_annotation[['ID', 'GB_ACC']].dropna()
|
154 |
+
|
155 |
+
# Clean the RefSeq IDs and extract gene symbols
|
156 |
+
def get_gene_from_refseq(acc):
|
157 |
+
if pd.isna(acc):
|
158 |
+
return None
|
159 |
+
# Keep only NM (mRNA) and NR (RNA) entries, strip version numbers
|
160 |
+
acc = acc.split('.')[0]
|
161 |
+
if acc.startswith(('NM_', 'NR_')):
|
162 |
+
return acc
|
163 |
+
return None
|
164 |
+
|
165 |
+
mapping_df['Gene'] = mapping_df['GB_ACC'].apply(get_gene_from_refseq)
|
166 |
+
mapping_df = mapping_df[['ID', 'Gene']].dropna()
|
167 |
+
|
168 |
+
# Apply mapping to convert probe data to gene expression data
|
169 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
170 |
+
|
171 |
+
print("Gene expression data shape after mapping:", gene_data.shape)
|
172 |
+
if len(gene_data) > 0:
|
173 |
+
print("\nFirst few gene symbols:", list(gene_data.index)[:10])
|
174 |
+
print("\nPreview of gene expression values:")
|
175 |
+
print(gene_data.iloc[:5, :5])
|
176 |
+
# Reload clinical data that was processed earlier
|
177 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
178 |
+
|
179 |
+
# First evaluate bias using the clinical data we have
|
180 |
+
trait_biased, clinical_df_processed = judge_and_remove_biased_features(selected_clinical_df, trait)
|
181 |
+
|
182 |
+
# Exit with appropriate metadata since gene mapping failed in previous step
|
183 |
+
note = "Gene mapping failed - no valid gene expression data obtained."
|
184 |
+
validate_and_save_cohort_info(
|
185 |
+
is_final=True,
|
186 |
+
cohort=cohort,
|
187 |
+
info_path=json_path,
|
188 |
+
is_gene_available=False, # Set to False since we couldn't get valid gene data
|
189 |
+
is_trait_available=True,
|
190 |
+
is_biased=trait_biased,
|
191 |
+
df=clinical_df_processed,
|
192 |
+
note=note
|
193 |
+
)
|
194 |
+
|
195 |
+
# Do not save any output files since data processing failed
|
p3/preprocess/Parkinsons_Disease/code/GSE103099.py
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE103099"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE103099"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE103099.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE103099.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE103099.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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 |
+
# Dataset includes gene expression analysis in brain tissue
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Data Availability
|
38 |
+
trait_row = 2 # CAV-2 infection status as trait variable
|
39 |
+
gender_row = 0 # Gender is available
|
40 |
+
age_row = 1 # Age is available
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion Functions
|
43 |
+
def convert_trait(x):
|
44 |
+
if not isinstance(x, str):
|
45 |
+
return None
|
46 |
+
x = x.split(': ')[1].lower() if ': ' in x else x.lower()
|
47 |
+
if 'no infection' in x:
|
48 |
+
return 0 # Control
|
49 |
+
elif 'infection' in x:
|
50 |
+
return 1 # Treatment
|
51 |
+
return None
|
52 |
+
|
53 |
+
def convert_age(x):
|
54 |
+
if not isinstance(x, str):
|
55 |
+
return None
|
56 |
+
x = x.split(': ')[1].lower() if ': ' in x else x.lower()
|
57 |
+
try:
|
58 |
+
# Extract numeric value before "year"
|
59 |
+
age = float(x.split()[0])
|
60 |
+
return age
|
61 |
+
except:
|
62 |
+
return None
|
63 |
+
|
64 |
+
def convert_gender(x):
|
65 |
+
if not isinstance(x, str):
|
66 |
+
return None
|
67 |
+
x = x.split(': ')[1].lower() if ': ' in x else x.lower()
|
68 |
+
if 'female' in x:
|
69 |
+
return 0
|
70 |
+
elif 'male' in x:
|
71 |
+
return 1
|
72 |
+
return None
|
73 |
+
|
74 |
+
# 3. Save Metadata
|
75 |
+
is_trait_available = trait_row is not None
|
76 |
+
validate_and_save_cohort_info(
|
77 |
+
is_final=False,
|
78 |
+
cohort=cohort,
|
79 |
+
info_path=json_path,
|
80 |
+
is_gene_available=is_gene_available,
|
81 |
+
is_trait_available=is_trait_available
|
82 |
+
)
|
83 |
+
|
84 |
+
# 4. Clinical Feature Extraction
|
85 |
+
if trait_row is not None:
|
86 |
+
selected_clinical = geo_select_clinical_features(
|
87 |
+
clinical_df=clinical_data,
|
88 |
+
trait=trait,
|
89 |
+
trait_row=trait_row,
|
90 |
+
convert_trait=convert_trait,
|
91 |
+
age_row=age_row,
|
92 |
+
convert_age=convert_age,
|
93 |
+
gender_row=gender_row,
|
94 |
+
convert_gender=convert_gender
|
95 |
+
)
|
96 |
+
|
97 |
+
# Preview the processed clinical data
|
98 |
+
preview = preview_df(selected_clinical)
|
99 |
+
print("Preview of processed clinical data:", preview)
|
100 |
+
|
101 |
+
# Save processed clinical data
|
102 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
103 |
+
# Get gene expression data from matrix file
|
104 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
105 |
+
|
106 |
+
# Examine data structure
|
107 |
+
print("Data structure and head:")
|
108 |
+
print(genetic_data.head())
|
109 |
+
|
110 |
+
print("\nShape:", genetic_data.shape)
|
111 |
+
|
112 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
113 |
+
print(list(genetic_data.index)[:20])
|
114 |
+
|
115 |
+
# Get a few column names to verify sample IDs
|
116 |
+
print("\nFirst 5 column names:")
|
117 |
+
print(list(genetic_data.columns)[:5])
|
118 |
+
# The gene identifiers in this dataset appear to be probe IDs from
|
119 |
+
# the Affymetrix Human Genome U133 Plus 2.0 Array, not human gene symbols.
|
120 |
+
# They follow the format of "XXXXXX_at" or "XXXXXX_s_at" which is characteristic
|
121 |
+
# of Affy probe IDs. These need to be mapped to gene symbols.
|
122 |
+
requires_gene_mapping = True
|
123 |
+
# Extract gene annotation data
|
124 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
125 |
+
|
126 |
+
# Display column names and preview data
|
127 |
+
print("Column names:")
|
128 |
+
print(gene_annotation.columns)
|
129 |
+
|
130 |
+
print("\nPreview of gene annotation data:")
|
131 |
+
print(preview_df(gene_annotation))
|
132 |
+
# 1. Identify mapping columns
|
133 |
+
# 'ID' column in gene annotation contains probe IDs that match the gene expression data
|
134 |
+
# 'Gene Symbol' column contains the target gene symbols
|
135 |
+
prob_col = 'ID'
|
136 |
+
gene_col = 'Gene Symbol'
|
137 |
+
|
138 |
+
# 2. Get gene mapping dataframe
|
139 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col, gene_col)
|
140 |
+
|
141 |
+
# 3. Apply gene mapping to convert probe data to gene expression data
|
142 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
143 |
+
|
144 |
+
# Preview result
|
145 |
+
print("Mapped gene expression data shape:", gene_data.shape)
|
146 |
+
print("\nFirst few genes and their expression values:")
|
147 |
+
print(gene_data.head())
|
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/Parkinsons_Disease/code/GSE202665.py
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE202665"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE202665"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE202665.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE202665.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE202665.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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 - yes, mRNA array data is available
|
33 |
+
is_gene_available = True
|
34 |
+
|
35 |
+
# 2.1 Data Availability
|
36 |
+
trait_row = 0 # Disease state in row 0
|
37 |
+
age_row = 3 # Age in row 3
|
38 |
+
gender_row = 2 # Gender in row 2
|
39 |
+
|
40 |
+
# 2.2 Data Type Conversion Functions
|
41 |
+
def convert_trait(value):
|
42 |
+
if value is None:
|
43 |
+
return None
|
44 |
+
value = value.lower().split(': ')[-1]
|
45 |
+
if "parkinson" in value:
|
46 |
+
return 1
|
47 |
+
elif "healthy control" in value:
|
48 |
+
return 0
|
49 |
+
return None
|
50 |
+
|
51 |
+
def convert_age(value):
|
52 |
+
if value is None:
|
53 |
+
return None
|
54 |
+
try:
|
55 |
+
return float(value.split(': ')[-1])
|
56 |
+
except:
|
57 |
+
return None
|
58 |
+
|
59 |
+
def convert_gender(value):
|
60 |
+
if value is None:
|
61 |
+
return None
|
62 |
+
value = value.lower().split(': ')[-1]
|
63 |
+
if value == 'male':
|
64 |
+
return 1
|
65 |
+
elif value == 'female':
|
66 |
+
return 0
|
67 |
+
return None
|
68 |
+
|
69 |
+
# 3. Save Metadata (Initial Filtering)
|
70 |
+
is_trait_available = trait_row is not None
|
71 |
+
validate_and_save_cohort_info(
|
72 |
+
is_final=False,
|
73 |
+
cohort=cohort,
|
74 |
+
info_path=json_path,
|
75 |
+
is_gene_available=is_gene_available,
|
76 |
+
is_trait_available=is_trait_available
|
77 |
+
)
|
78 |
+
|
79 |
+
# 4. Clinical Feature Extraction
|
80 |
+
if trait_row is not None:
|
81 |
+
clinical_features = 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 processed clinical data
|
93 |
+
preview = preview_df(clinical_features)
|
94 |
+
print("Preview of clinical features:")
|
95 |
+
print(preview)
|
96 |
+
|
97 |
+
# Save clinical features
|
98 |
+
clinical_features.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 |
+
# The gene expression data appears to use probe IDs (simple numeric identifiers) rather than gene symbols
|
115 |
+
# For example, IDs like '1', '2', '3', etc. are numeric probe IDs that need to be mapped to human 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 |
+
# 1. Identify columns for mapping - 'ID' matches the probe IDs in expression data, 'GENE_SYMBOL' contains gene symbols
|
127 |
+
prob_col = 'ID'
|
128 |
+
gene_col = 'GENE_SYMBOL'
|
129 |
+
|
130 |
+
# 2. Get mapping between probe IDs and gene symbols
|
131 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col, gene_col)
|
132 |
+
|
133 |
+
# 3. Apply mapping to convert probe-level data to gene expression data
|
134 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
135 |
+
|
136 |
+
# Preview the converted gene data
|
137 |
+
print("\nShape of gene expression data after mapping:", gene_data.shape)
|
138 |
+
print("\nFirst few rows of gene expression data:")
|
139 |
+
print(gene_data.head())
|
140 |
+
|
141 |
+
# Preview some gene symbols
|
142 |
+
print("\nFirst 20 gene symbols:")
|
143 |
+
print(list(gene_data.index)[:20])
|
144 |
+
# Reload clinical data that was processed earlier
|
145 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
146 |
+
|
147 |
+
# 1. Normalize gene symbols
|
148 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
149 |
+
genetic_data.to_csv(out_gene_data_file)
|
150 |
+
|
151 |
+
# 2. Link clinical and genetic data
|
152 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
153 |
+
|
154 |
+
# 3. Handle missing values systematically
|
155 |
+
linked_data = handle_missing_values(linked_data, trait)
|
156 |
+
|
157 |
+
# 4. Check for bias in trait and demographic features
|
158 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
159 |
+
|
160 |
+
# 5. Final validation and information saving
|
161 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
162 |
+
is_usable = validate_and_save_cohort_info(
|
163 |
+
is_final=True,
|
164 |
+
cohort=cohort,
|
165 |
+
info_path=json_path,
|
166 |
+
is_gene_available=True,
|
167 |
+
is_trait_available=True,
|
168 |
+
is_biased=trait_biased,
|
169 |
+
df=linked_data,
|
170 |
+
note=note
|
171 |
+
)
|
172 |
+
|
173 |
+
# 6. Save linked data only if usable
|
174 |
+
if is_usable:
|
175 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
176 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Parkinsons_Disease/code/GSE202667.py
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE202667"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE202667"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE202667.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE202667.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE202667.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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 |
+
# The series title suggests RNA signatures, indicating gene expression data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
# Disease state (trait) is in row 0, age in row 3, gender in row 2
|
38 |
+
trait_row = 0
|
39 |
+
age_row = 3
|
40 |
+
gender_row = 2 # Although all male, still include for consistency
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion Functions
|
43 |
+
def convert_trait(value: str) -> int:
|
44 |
+
"""Convert trait value to binary (0: Control, 1: PD)"""
|
45 |
+
if not value or ':' not in value:
|
46 |
+
return None
|
47 |
+
value = value.split(':')[1].strip().lower()
|
48 |
+
if "parkinson" in value:
|
49 |
+
return 1
|
50 |
+
elif "control" in value:
|
51 |
+
return 0
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_age(value: str) -> float:
|
55 |
+
"""Convert age value to continuous number"""
|
56 |
+
if not value or ':' not in value:
|
57 |
+
return None
|
58 |
+
try:
|
59 |
+
return float(value.split(':')[1].strip())
|
60 |
+
except:
|
61 |
+
return None
|
62 |
+
|
63 |
+
def convert_gender(value: str) -> int:
|
64 |
+
"""Convert gender to binary (0: Female, 1: Male)"""
|
65 |
+
if not value or ':' not in value:
|
66 |
+
return None
|
67 |
+
value = value.split(':')[1].strip().lower()
|
68 |
+
if value == 'male':
|
69 |
+
return 1
|
70 |
+
elif value == 'female':
|
71 |
+
return 0
|
72 |
+
return None
|
73 |
+
|
74 |
+
# 3. Save Metadata
|
75 |
+
is_trait_available = trait_row is not None
|
76 |
+
validate_and_save_cohort_info(False, cohort, json_path, is_gene_available, is_trait_available)
|
77 |
+
|
78 |
+
# 4. Clinical Feature Extraction
|
79 |
+
# Since trait_row is not None, extract and save clinical features
|
80 |
+
selected_clinical_df = geo_select_clinical_features(
|
81 |
+
clinical_df=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 |
+
# Preview the extracted clinical data
|
92 |
+
preview_result = preview_df(selected_clinical_df)
|
93 |
+
print("Preview of clinical data:")
|
94 |
+
print(preview_result)
|
95 |
+
|
96 |
+
# Save clinical data
|
97 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
98 |
+
# Get gene expression data from matrix file
|
99 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
100 |
+
|
101 |
+
# Examine data structure
|
102 |
+
print("Data structure and head:")
|
103 |
+
print(genetic_data.head())
|
104 |
+
|
105 |
+
print("\nShape:", genetic_data.shape)
|
106 |
+
|
107 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
108 |
+
print(list(genetic_data.index)[:20])
|
109 |
+
|
110 |
+
# Get a few column names to verify sample IDs
|
111 |
+
print("\nFirst 5 column names:")
|
112 |
+
print(list(genetic_data.columns)[:5])
|
113 |
+
# The IDs observed are integers, which are likely probe IDs or other non-gene identifiers
|
114 |
+
# They need to be mapped to standard gene symbols for meaningful biological analysis
|
115 |
+
requires_gene_mapping = True
|
116 |
+
# Extract gene annotation data
|
117 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
118 |
+
|
119 |
+
# Display column names and preview data
|
120 |
+
print("Column names:")
|
121 |
+
print(gene_annotation.columns)
|
122 |
+
|
123 |
+
print("\nPreview of gene annotation data:")
|
124 |
+
print(preview_df(gene_annotation))
|
125 |
+
# 1. Identify relevant columns for mapping
|
126 |
+
# 'ID' column in gene annotation matches the numeric identifiers in gene expression data
|
127 |
+
# 'GENE_SYMBOL' contains the target gene symbols
|
128 |
+
|
129 |
+
# 2. Get mapping between probe IDs and gene symbols
|
130 |
+
gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
|
131 |
+
|
132 |
+
# 3. Apply mapping to convert probe-level data to gene expression data
|
133 |
+
gene_data = apply_gene_mapping(genetic_data, gene_mapping)
|
134 |
+
|
135 |
+
# Print shape and preview to verify the mapping result
|
136 |
+
print("Shape of gene expression data:", gene_data.shape)
|
137 |
+
print("\nPreview of gene expression data:")
|
138 |
+
print(gene_data.head())
|
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/Parkinsons_Disease/code/GSE30335.py
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE30335"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE30335"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE30335.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE30335.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE30335.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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 "blood gene expression"
|
34 |
+
|
35 |
+
# 2. Variable Availability and Data Type Conversion
|
36 |
+
trait_row = 0 # 'occupation' field contains trait status
|
37 |
+
age_row = None # Age not provided in sample characteristics
|
38 |
+
gender_row = None # Gender is constant (all male) based on background info
|
39 |
+
|
40 |
+
def convert_trait(value: str) -> int:
|
41 |
+
"""Convert occupation to binary PD risk (1=farmworker, 0=manual worker)"""
|
42 |
+
if not value or ':' not in value:
|
43 |
+
return None
|
44 |
+
value = value.split(':')[1].strip().lower()
|
45 |
+
if 'farmworker' in value:
|
46 |
+
return 1 # Higher PD risk group
|
47 |
+
elif 'manual worker' in value:
|
48 |
+
return 0 # Lower PD risk group
|
49 |
+
return None
|
50 |
+
|
51 |
+
convert_age = None # No age data available
|
52 |
+
convert_gender = None # No gender data needed (all male)
|
53 |
+
|
54 |
+
# 3. Save metadata
|
55 |
+
validate_and_save_cohort_info(
|
56 |
+
is_final=False,
|
57 |
+
cohort=cohort,
|
58 |
+
info_path=json_path,
|
59 |
+
is_gene_available=is_gene_available,
|
60 |
+
is_trait_available=trait_row is not None
|
61 |
+
)
|
62 |
+
|
63 |
+
# 4. Clinical Feature Extraction
|
64 |
+
if trait_row is not None:
|
65 |
+
selected_clinical = 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 |
+
|
76 |
+
print("Preview of selected clinical features:")
|
77 |
+
print(preview_df(selected_clinical))
|
78 |
+
|
79 |
+
# Save clinical data
|
80 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
81 |
+
# Get gene expression data from matrix file
|
82 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
83 |
+
|
84 |
+
# Examine data structure
|
85 |
+
print("Data structure and head:")
|
86 |
+
print(genetic_data.head())
|
87 |
+
|
88 |
+
print("\nShape:", genetic_data.shape)
|
89 |
+
|
90 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
91 |
+
print(list(genetic_data.index)[:20])
|
92 |
+
|
93 |
+
# Get a few column names to verify sample IDs
|
94 |
+
print("\nFirst 5 column names:")
|
95 |
+
print(list(genetic_data.columns)[:5])
|
96 |
+
# Based on the row IDs in the data, these are Affymetrix probe set IDs (_at suffix), not gene symbols
|
97 |
+
# Format 'XXXXXX_at' or 'XXXXXX_s_at' is characteristic of Affymetrix microarray probes
|
98 |
+
# The identifiers need to be mapped to official gene symbols
|
99 |
+
|
100 |
+
requires_gene_mapping = True
|
101 |
+
# Extract gene annotation data
|
102 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
103 |
+
|
104 |
+
# Display column names and preview data
|
105 |
+
print("Column names:")
|
106 |
+
print(gene_annotation.columns)
|
107 |
+
|
108 |
+
print("\nPreview of gene annotation data:")
|
109 |
+
print(preview_df(gene_annotation))
|
110 |
+
# 1. ID in genetic_data matches ID in gene_annotation
|
111 |
+
# Gene Symbol is stored in 'Gene Symbol' column
|
112 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
113 |
+
|
114 |
+
# 2. Apply the mapping to convert probe-level data to gene-level data
|
115 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
116 |
+
|
117 |
+
# 3. Save the gene data
|
118 |
+
gene_data.to_csv(out_gene_data_file)
|
119 |
+
|
120 |
+
print("\nShape of gene expression data after mapping:", gene_data.shape)
|
121 |
+
print("\nPreview of gene expression data:")
|
122 |
+
print(preview_df(gene_data))
|
123 |
+
# Reload clinical data that was processed earlier
|
124 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
125 |
+
|
126 |
+
# 1. Normalize gene symbols
|
127 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
128 |
+
genetic_data.to_csv(out_gene_data_file)
|
129 |
+
|
130 |
+
# 2. Link clinical and genetic data
|
131 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
132 |
+
|
133 |
+
# 3. Handle missing values systematically
|
134 |
+
linked_data = handle_missing_values(linked_data, trait)
|
135 |
+
|
136 |
+
# 4. Check for bias in trait and demographic features
|
137 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
138 |
+
|
139 |
+
# 5. Final validation and information saving
|
140 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
141 |
+
is_usable = validate_and_save_cohort_info(
|
142 |
+
is_final=True,
|
143 |
+
cohort=cohort,
|
144 |
+
info_path=json_path,
|
145 |
+
is_gene_available=True,
|
146 |
+
is_trait_available=True,
|
147 |
+
is_biased=trait_biased,
|
148 |
+
df=linked_data,
|
149 |
+
note=note
|
150 |
+
)
|
151 |
+
|
152 |
+
# 6. Save linked data only if usable
|
153 |
+
if is_usable:
|
154 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
155 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Parkinsons_Disease/code/GSE49126.py
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE49126"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE49126"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE49126.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE49126.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE49126.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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 - series uses Agilent expression microarrays on PBMC samples
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
# Trait (PD) data is in row 0, binary control vs PD
|
38 |
+
trait_row = 0
|
39 |
+
# Age and gender not available in characteristics
|
40 |
+
age_row = None
|
41 |
+
gender_row = None
|
42 |
+
|
43 |
+
# 2.2 Data Type Conversion Functions
|
44 |
+
def convert_trait(value):
|
45 |
+
"""Convert PD status to binary (0=control, 1=PD)"""
|
46 |
+
if not isinstance(value, str):
|
47 |
+
return None
|
48 |
+
value = value.lower().split(": ")[-1].strip()
|
49 |
+
if "control" in value:
|
50 |
+
return 0
|
51 |
+
elif "parkinson" in value:
|
52 |
+
return 1
|
53 |
+
return None
|
54 |
+
|
55 |
+
convert_age = None
|
56 |
+
convert_gender = None
|
57 |
+
|
58 |
+
# 3. Save metadata for initial filtering
|
59 |
+
is_trait_available = trait_row is not None
|
60 |
+
validate_and_save_cohort_info(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 |
+
# 4. Extract clinical features since trait data is available
|
67 |
+
# Create DataFrame from characteristics
|
68 |
+
characteristics_data = {0: ['disease state: control', "disease state: Parkinson's disease"]}
|
69 |
+
clinical_data = pd.DataFrame.from_dict(characteristics_data, orient='index')
|
70 |
+
|
71 |
+
selected_clinical = geo_select_clinical_features(clinical_data,
|
72 |
+
trait=trait,
|
73 |
+
trait_row=trait_row,
|
74 |
+
convert_trait=convert_trait,
|
75 |
+
age_row=age_row,
|
76 |
+
convert_age=convert_age,
|
77 |
+
gender_row=gender_row,
|
78 |
+
convert_gender=convert_gender)
|
79 |
+
|
80 |
+
# Preview the clinical data
|
81 |
+
preview_df(selected_clinical)
|
82 |
+
|
83 |
+
# Save clinical features
|
84 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
85 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
86 |
+
# Get gene expression data from matrix file
|
87 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
88 |
+
|
89 |
+
# Examine data structure
|
90 |
+
print("Data structure and head:")
|
91 |
+
print(genetic_data.head())
|
92 |
+
|
93 |
+
print("\nShape:", genetic_data.shape)
|
94 |
+
|
95 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
96 |
+
print(list(genetic_data.index)[:20])
|
97 |
+
|
98 |
+
# Get a few column names to verify sample IDs
|
99 |
+
print("\nFirst 5 column names:")
|
100 |
+
print(list(genetic_data.columns)[:5])
|
101 |
+
# The IDs are numeric values starting from 12, which are definitely not human gene symbols
|
102 |
+
# They appear to be probe IDs that need to be mapped to gene symbols
|
103 |
+
requires_gene_mapping = True
|
104 |
+
# Extract gene annotation data
|
105 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
106 |
+
|
107 |
+
# Display column names and preview data
|
108 |
+
print("Column names:")
|
109 |
+
print(gene_annotation.columns)
|
110 |
+
|
111 |
+
print("\nPreview of gene annotation data:")
|
112 |
+
print(preview_df(gene_annotation))
|
113 |
+
# 1. Get gene mapping from ID to GENE_SYMBOL
|
114 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
|
115 |
+
|
116 |
+
# 2. Apply gene mapping to convert probe-level data to gene expression data
|
117 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
118 |
+
|
119 |
+
# Preview gene data
|
120 |
+
print("Gene data preview:")
|
121 |
+
print(gene_data.head())
|
122 |
+
print("\nGene data shape:", gene_data.shape)
|
123 |
+
# Reload clinical data that was processed earlier
|
124 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
125 |
+
|
126 |
+
# 1. Normalize gene symbols
|
127 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
128 |
+
genetic_data.to_csv(out_gene_data_file)
|
129 |
+
|
130 |
+
# 2. Link clinical and genetic data
|
131 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df.T, genetic_data)
|
132 |
+
|
133 |
+
# Print column names to debug
|
134 |
+
print("Columns in linked data:")
|
135 |
+
print(linked_data.columns[:10]) # Show first 10 columns
|
136 |
+
|
137 |
+
# 3. Handle missing values systematically
|
138 |
+
# The trait column name needs to match what's in the data
|
139 |
+
linked_data = handle_missing_values(linked_data, trait_col="PD")
|
140 |
+
|
141 |
+
# 4. Check for bias in trait and demographic features
|
142 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, "PD")
|
143 |
+
|
144 |
+
# 5. Final validation and information saving
|
145 |
+
note = "Gene expression data from PBMC cells of PD patients and controls"
|
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)
|
161 |
+
# Reload clinical data that was processed earlier
|
162 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
163 |
+
|
164 |
+
# 1. Normalize gene symbols
|
165 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
166 |
+
genetic_data.to_csv(out_gene_data_file)
|
167 |
+
|
168 |
+
# 2. Link clinical and genetic data
|
169 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df.T, genetic_data)
|
170 |
+
|
171 |
+
# 3. Handle missing values systematically
|
172 |
+
linked_data = handle_missing_values(linked_data, trait_col='PD')
|
173 |
+
|
174 |
+
# 4. Check for bias in trait and demographic features
|
175 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, 'PD')
|
176 |
+
|
177 |
+
# 5. Final validation and information saving
|
178 |
+
note = "Gene expression data from peripheral blood mononuclear cells (PBMC) of Parkinson's Disease patients and controls"
|
179 |
+
is_usable = validate_and_save_cohort_info(
|
180 |
+
is_final=True,
|
181 |
+
cohort=cohort,
|
182 |
+
info_path=json_path,
|
183 |
+
is_gene_available=True,
|
184 |
+
is_trait_available=True,
|
185 |
+
is_biased=trait_biased,
|
186 |
+
df=linked_data,
|
187 |
+
note=note
|
188 |
+
)
|
189 |
+
|
190 |
+
# 6. Save linked data only if usable
|
191 |
+
if is_usable:
|
192 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
193 |
+
linked_data.to_csv(out_data_file)
|
194 |
+
# Get file paths
|
195 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
196 |
+
|
197 |
+
# Get background info and clinical data
|
198 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
199 |
+
print("Background Information:")
|
200 |
+
print(background_info)
|
201 |
+
print("\nSample Characteristics:")
|
202 |
+
|
203 |
+
# Get dictionary of unique values per row
|
204 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
205 |
+
for row, values in unique_values_dict.items():
|
206 |
+
print(f"\n{row}:")
|
207 |
+
print(values)
|
208 |
+
# Check gene expression data availability
|
209 |
+
is_gene_available = True # Agilent expression microarrays indicate gene expression data
|
210 |
+
|
211 |
+
# Find rows for trait, age and gender
|
212 |
+
trait_row = 0 # Disease state is recorded in row 0
|
213 |
+
age_row = None # Age not available in sample characteristics
|
214 |
+
gender_row = None # Gender not available in sample characteristics
|
215 |
+
|
216 |
+
# Define conversion functions
|
217 |
+
def convert_trait(value):
|
218 |
+
if not isinstance(value, str):
|
219 |
+
return None
|
220 |
+
value = value.lower().split(': ')[-1]
|
221 |
+
if "parkinson" in value:
|
222 |
+
return 1
|
223 |
+
elif "control" in value:
|
224 |
+
return 0
|
225 |
+
return None
|
226 |
+
|
227 |
+
def convert_age(value):
|
228 |
+
return None # Not used since age data not available
|
229 |
+
|
230 |
+
def convert_gender(value):
|
231 |
+
return None # Not used since gender data not available
|
232 |
+
|
233 |
+
# Validate and save initial cohort info
|
234 |
+
validate_and_save_cohort_info(
|
235 |
+
is_final=False,
|
236 |
+
cohort=cohort,
|
237 |
+
info_path=json_path,
|
238 |
+
is_gene_available=is_gene_available,
|
239 |
+
is_trait_available=(trait_row is not None)
|
240 |
+
)
|
241 |
+
|
242 |
+
# Extract clinical features since trait data is available
|
243 |
+
clinical_df = geo_select_clinical_features(
|
244 |
+
clinical_df=clinical_data,
|
245 |
+
trait=trait,
|
246 |
+
trait_row=trait_row,
|
247 |
+
convert_trait=convert_trait,
|
248 |
+
age_row=age_row,
|
249 |
+
convert_age=convert_age,
|
250 |
+
gender_row=gender_row,
|
251 |
+
convert_gender=convert_gender
|
252 |
+
)
|
253 |
+
|
254 |
+
# Preview and save clinical data
|
255 |
+
preview_df(clinical_df)
|
256 |
+
clinical_df.to_csv(out_clinical_data_file)
|
p3/preprocess/Parkinsons_Disease/code/GSE57475.py
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE57475"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE57475"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE57475.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE57475.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE57475.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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 the background info, this is a gene expression study focusing on SNCA transcripts
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
# Disease state (trait) is in row 2
|
38 |
+
trait_row = 2
|
39 |
+
# Age is in row 0
|
40 |
+
age_row = 0
|
41 |
+
# Gender is in row 1
|
42 |
+
gender_row = 1
|
43 |
+
|
44 |
+
# 2.2 Data Type Conversion Functions
|
45 |
+
def convert_trait(x: str) -> int:
|
46 |
+
"""Convert PD status to binary: control=0, PD=1"""
|
47 |
+
if not isinstance(x, str):
|
48 |
+
return None
|
49 |
+
value = x.split(': ')[-1].strip().lower()
|
50 |
+
if 'pd' in value or 'parkinson' in value:
|
51 |
+
return 1
|
52 |
+
elif 'control' in value or 'healthy' in value:
|
53 |
+
return 0
|
54 |
+
return None
|
55 |
+
|
56 |
+
def convert_age(x: str) -> float:
|
57 |
+
"""Convert age to float"""
|
58 |
+
if not isinstance(x, str):
|
59 |
+
return None
|
60 |
+
try:
|
61 |
+
return float(x.split(': ')[-1])
|
62 |
+
except:
|
63 |
+
return None
|
64 |
+
|
65 |
+
def convert_gender(x: str) -> int:
|
66 |
+
"""Convert gender to binary: F=0, M=1"""
|
67 |
+
if not isinstance(x, str):
|
68 |
+
return None
|
69 |
+
value = x.split(': ')[-1].strip().upper()
|
70 |
+
if value == 'F':
|
71 |
+
return 0
|
72 |
+
elif value == 'M':
|
73 |
+
return 1
|
74 |
+
return None
|
75 |
+
|
76 |
+
# 3. Save Metadata
|
77 |
+
is_trait_available = trait_row is not None
|
78 |
+
is_valid = validate_and_save_cohort_info(is_final=False,
|
79 |
+
cohort=cohort,
|
80 |
+
info_path=json_path,
|
81 |
+
is_gene_available=is_gene_available,
|
82 |
+
is_trait_available=is_trait_available)
|
83 |
+
|
84 |
+
# 4. Clinical Feature Extraction
|
85 |
+
if trait_row is not None:
|
86 |
+
clinical_features = geo_select_clinical_features(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 |
+
# Preview the data
|
96 |
+
preview = preview_df(clinical_features)
|
97 |
+
print("Preview of clinical features:")
|
98 |
+
print(preview)
|
99 |
+
|
100 |
+
# Save to CSV
|
101 |
+
clinical_features.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 |
+
# Observing the identifiers - these are Illumina BeadChip probes
|
118 |
+
# (ILMN prefix) which need mapping to gene symbols
|
119 |
+
requires_gene_mapping = True
|
120 |
+
# Extract gene annotation data
|
121 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
122 |
+
|
123 |
+
# Display column names and preview data
|
124 |
+
print("Column names:")
|
125 |
+
print(gene_annotation.columns)
|
126 |
+
|
127 |
+
print("\nPreview of gene annotation data:")
|
128 |
+
print(preview_df(gene_annotation))
|
129 |
+
# 1. ID column matches the gene expression data's identifiers (ILMN_...)
|
130 |
+
# Symbol column contains the gene symbols
|
131 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="Symbol")
|
132 |
+
|
133 |
+
# 2. Convert probe-level measurements to gene expression data
|
134 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
135 |
+
|
136 |
+
# Print basic info about the gene expression data
|
137 |
+
print("\nGene expression data after mapping:")
|
138 |
+
print("Shape:", gene_data.shape)
|
139 |
+
print("\nFirst few gene symbols:")
|
140 |
+
print(list(gene_data.index)[:10])
|
141 |
+
# Reload clinical data that was processed earlier
|
142 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
143 |
+
|
144 |
+
# 1. Normalize gene symbols
|
145 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
146 |
+
genetic_data.to_csv(out_gene_data_file)
|
147 |
+
|
148 |
+
# 2. Link clinical and genetic data
|
149 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
150 |
+
|
151 |
+
# 3. Handle missing values systematically
|
152 |
+
linked_data = handle_missing_values(linked_data, trait)
|
153 |
+
|
154 |
+
# 4. Check for bias in trait and demographic features
|
155 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
156 |
+
|
157 |
+
# 5. Final validation and information saving
|
158 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
159 |
+
is_usable = validate_and_save_cohort_info(
|
160 |
+
is_final=True,
|
161 |
+
cohort=cohort,
|
162 |
+
info_path=json_path,
|
163 |
+
is_gene_available=True,
|
164 |
+
is_trait_available=True,
|
165 |
+
is_biased=trait_biased,
|
166 |
+
df=linked_data,
|
167 |
+
note=note
|
168 |
+
)
|
169 |
+
|
170 |
+
# 6. Save linked data only if usable
|
171 |
+
if is_usable:
|
172 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
173 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Parkinsons_Disease/code/GSE71220.py
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE71220"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE71220"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE71220.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE71220.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE71220.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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 |
+
# Affymetrix Human Gene 1.1 ST array mentioned in background, indicating gene expression data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
trait_row = 1 # Disease status in row 1
|
38 |
+
age_row = 2 # Age data in row 2
|
39 |
+
gender_row = 3 # Gender data in row 3
|
40 |
+
|
41 |
+
# 2.2 Data Type Conversion Functions
|
42 |
+
def convert_trait(x):
|
43 |
+
if not isinstance(x, str):
|
44 |
+
return None
|
45 |
+
value = x.split(': ')[-1].strip()
|
46 |
+
if value == 'COPD':
|
47 |
+
return 1
|
48 |
+
elif value == 'Control':
|
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 |
+
if not isinstance(x, str):
|
62 |
+
return None
|
63 |
+
value = x.split(': ')[-1].strip()
|
64 |
+
if value == 'F':
|
65 |
+
return 0
|
66 |
+
elif value == 'M':
|
67 |
+
return 1
|
68 |
+
return None
|
69 |
+
|
70 |
+
# 3. Save Metadata
|
71 |
+
is_trait_available = trait_row is not None
|
72 |
+
validate_and_save_cohort_info(is_final=False,
|
73 |
+
cohort=cohort,
|
74 |
+
info_path=json_path,
|
75 |
+
is_gene_available=is_gene_available,
|
76 |
+
is_trait_available=is_trait_available)
|
77 |
+
|
78 |
+
# 4. Clinical Feature Extraction
|
79 |
+
if trait_row is not None:
|
80 |
+
clinical_features = geo_select_clinical_features(
|
81 |
+
clinical_df=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 extracted clinical features:")
|
92 |
+
print(preview_df(clinical_features))
|
93 |
+
|
94 |
+
# Save clinical features
|
95 |
+
clinical_features.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 row IDs being numeric identifiers (e.g. '7892501') rather than standard gene symbols,
|
112 |
+
# this appears to be probe IDs that need to be mapped to gene symbols
|
113 |
+
requires_gene_mapping = True
|
114 |
+
# Extract gene annotation data
|
115 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
116 |
+
|
117 |
+
# Display column names and preview data
|
118 |
+
print("Column names:")
|
119 |
+
print(gene_annotation.columns)
|
120 |
+
|
121 |
+
print("\nPreview of gene annotation data:")
|
122 |
+
print(preview_df(gene_annotation))
|
123 |
+
# 1. Get mapping from probe IDs to gene symbols
|
124 |
+
# 'ID' in annotation matches probe IDs in expression data
|
125 |
+
# 'gene_assignment' contains gene symbols in format "NM_### // SYMBOL // description"
|
126 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
|
127 |
+
|
128 |
+
# 2. Apply gene mapping to convert probe data to gene expression data
|
129 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
130 |
+
|
131 |
+
# 3. Save gene data
|
132 |
+
gene_data.to_csv(out_gene_data_file)
|
133 |
+
|
134 |
+
print("\nPreview of gene expression data:")
|
135 |
+
print(preview_df(gene_data))
|
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 clinical measurements including disease status (COPD vs Control)"
|
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/Parkinsons_Disease/code/GSE72267.py
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE72267"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE72267"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE72267.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE72267.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE72267.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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 is gene expression data from blood samples using Affymetrix platform
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
|
38 |
+
# Trait (PD diagnosis) is in row 0
|
39 |
+
trait_row = 0
|
40 |
+
|
41 |
+
# Age and gender information not available in sample characteristics
|
42 |
+
age_row = None
|
43 |
+
gender_row = None
|
44 |
+
|
45 |
+
# 2.2 Data Type Conversion Functions
|
46 |
+
|
47 |
+
def convert_trait(value: str) -> int:
|
48 |
+
"""Convert trait value to binary (0=Control, 1=Case)"""
|
49 |
+
if value is None or ':' not in value:
|
50 |
+
return None
|
51 |
+
value = value.split(':')[1].strip().lower()
|
52 |
+
if "parkinson" in value:
|
53 |
+
return 1
|
54 |
+
elif "healthy" in value:
|
55 |
+
return 0
|
56 |
+
return None
|
57 |
+
|
58 |
+
# No age/gender conversion functions needed since data not available
|
59 |
+
convert_age = None
|
60 |
+
convert_gender = None
|
61 |
+
|
62 |
+
# 3. Save metadata about dataset usability
|
63 |
+
is_usable = validate_and_save_cohort_info(
|
64 |
+
is_final=False,
|
65 |
+
cohort=cohort,
|
66 |
+
info_path=json_path,
|
67 |
+
is_gene_available=is_gene_available,
|
68 |
+
is_trait_available=trait_row is not None
|
69 |
+
)
|
70 |
+
|
71 |
+
# 4. Extract clinical features
|
72 |
+
if trait_row is not None:
|
73 |
+
clinical_features = 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 |
+
gender_row=gender_row,
|
81 |
+
convert_gender=convert_gender
|
82 |
+
)
|
83 |
+
|
84 |
+
# Preview the extracted features
|
85 |
+
preview = preview_df(clinical_features)
|
86 |
+
print("Preview of clinical features:")
|
87 |
+
print(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 |
+
# Based on the identifier pattern which ends with '_at' or '_s_at', this data is from an Affymetrix microarray
|
107 |
+
# and contains probe IDs, not gene symbols. We need to map them to proper gene symbols.
|
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 |
+
# Get mapping between probe IDs and gene symbols
|
119 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
120 |
+
|
121 |
+
# Apply the mapping to convert probe measurements to gene expression data
|
122 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
123 |
+
|
124 |
+
# Preview the result
|
125 |
+
print("Data structure after mapping:")
|
126 |
+
print(gene_data.head())
|
127 |
+
print("\nShape:", gene_data.shape)
|
128 |
+
print("\nFirst 20 gene symbols:")
|
129 |
+
print(list(gene_data.index)[:20])
|
130 |
+
# Reload clinical data that was processed earlier
|
131 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
132 |
+
|
133 |
+
# 1. Normalize gene symbols
|
134 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
135 |
+
genetic_data.to_csv(out_gene_data_file)
|
136 |
+
|
137 |
+
# 2. Link clinical and genetic data
|
138 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
139 |
+
|
140 |
+
# 3. Handle missing values systematically
|
141 |
+
linked_data = handle_missing_values(linked_data, trait)
|
142 |
+
|
143 |
+
# 4. Check for bias in trait and demographic features
|
144 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
145 |
+
|
146 |
+
# 5. Final validation and information saving
|
147 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
148 |
+
is_usable = validate_and_save_cohort_info(
|
149 |
+
is_final=True,
|
150 |
+
cohort=cohort,
|
151 |
+
info_path=json_path,
|
152 |
+
is_gene_available=True,
|
153 |
+
is_trait_available=True,
|
154 |
+
is_biased=trait_biased,
|
155 |
+
df=linked_data,
|
156 |
+
note=note
|
157 |
+
)
|
158 |
+
|
159 |
+
# 6. Save linked data only if usable
|
160 |
+
if is_usable:
|
161 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
162 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Parkinsons_Disease/code/GSE80599.py
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
cohort = "GSE80599"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Parkinsons_Disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Parkinsons_Disease/GSE80599"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/GSE80599.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/GSE80599.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/GSE80599.csv"
|
16 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/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, the dataset contains gene expression data from Affymetrix Human Genome U219 platform
|
34 |
+
|
35 |
+
# 2.1 Data Availability
|
36 |
+
|
37 |
+
# For trait: Based on UPDRS-MDS3.12 score in row 3
|
38 |
+
# Score >=1 means rapid progression, 0 means slow progression
|
39 |
+
trait_row = 3
|
40 |
+
|
41 |
+
# Age data available in row 4
|
42 |
+
age_row = 4
|
43 |
+
|
44 |
+
# Gender data available in row 1
|
45 |
+
gender_row = 1
|
46 |
+
|
47 |
+
# 2.2 Data Type Conversion Functions
|
48 |
+
def convert_trait(value):
|
49 |
+
"""Convert UPDRS-MDS3.12 score to binary: 1 for rapid progression (score>=1), 0 for slow progression (score=0)"""
|
50 |
+
if not isinstance(value, str):
|
51 |
+
return None
|
52 |
+
try:
|
53 |
+
score = int(value.split(': ')[1])
|
54 |
+
return 1 if score >= 1 else 0
|
55 |
+
except:
|
56 |
+
return None
|
57 |
+
|
58 |
+
def convert_age(value):
|
59 |
+
"""Convert age string to continuous numeric value"""
|
60 |
+
if not isinstance(value, str):
|
61 |
+
return None
|
62 |
+
try:
|
63 |
+
age = int(value.split(': ')[1])
|
64 |
+
return age
|
65 |
+
except:
|
66 |
+
return None
|
67 |
+
|
68 |
+
def convert_gender(value):
|
69 |
+
"""Convert gender to binary: 0 for female, 1 for male"""
|
70 |
+
if not isinstance(value, str):
|
71 |
+
return None
|
72 |
+
gender = value.split(': ')[1].lower()
|
73 |
+
if gender == 'female':
|
74 |
+
return 0
|
75 |
+
elif gender == 'male':
|
76 |
+
return 1
|
77 |
+
return None
|
78 |
+
|
79 |
+
# 3. Save Metadata
|
80 |
+
is_trait_available = trait_row is not None
|
81 |
+
validate_and_save_cohort_info(is_final=False,
|
82 |
+
cohort=cohort,
|
83 |
+
info_path=json_path,
|
84 |
+
is_gene_available=is_gene_available,
|
85 |
+
is_trait_available=is_trait_available)
|
86 |
+
|
87 |
+
# 4. Extract Clinical Features
|
88 |
+
selected_clinical_df = geo_select_clinical_features(clinical_df=clinical_data,
|
89 |
+
trait=trait,
|
90 |
+
trait_row=trait_row,
|
91 |
+
convert_trait=convert_trait,
|
92 |
+
age_row=age_row,
|
93 |
+
convert_age=convert_age,
|
94 |
+
gender_row=gender_row,
|
95 |
+
convert_gender=convert_gender)
|
96 |
+
|
97 |
+
# Preview the extracted features
|
98 |
+
print("Preview of extracted clinical features:")
|
99 |
+
print(preview_df(selected_clinical_df))
|
100 |
+
|
101 |
+
# Save clinical data
|
102 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
103 |
+
# Get gene expression data from matrix file
|
104 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
105 |
+
|
106 |
+
# Examine data structure
|
107 |
+
print("Data structure and head:")
|
108 |
+
print(genetic_data.head())
|
109 |
+
|
110 |
+
print("\nShape:", genetic_data.shape)
|
111 |
+
|
112 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
113 |
+
print(list(genetic_data.index)[:20])
|
114 |
+
|
115 |
+
# Get a few column names to verify sample IDs
|
116 |
+
print("\nFirst 5 column names:")
|
117 |
+
print(list(genetic_data.columns)[:5])
|
118 |
+
# The gene identifiers (e.g. '11715100_at', '11715101_s_at') appear to be Affymetrix probe IDs
|
119 |
+
# rather than standard human gene symbols. They need to be mapped to gene symbols.
|
120 |
+
requires_gene_mapping = True
|
121 |
+
# Extract gene annotation data
|
122 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
123 |
+
|
124 |
+
# Display column names and preview data
|
125 |
+
print("Column names:")
|
126 |
+
print(gene_annotation.columns)
|
127 |
+
|
128 |
+
print("\nPreview of gene annotation data:")
|
129 |
+
print(preview_df(gene_annotation))
|
130 |
+
# Get gene mapping dataframe from annotation data
|
131 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
132 |
+
|
133 |
+
# Apply gene mapping to convert probe expression to gene expression
|
134 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
135 |
+
|
136 |
+
# Preview output
|
137 |
+
print("Output shape:", gene_data.shape)
|
138 |
+
print("\nFirst 5 genes and their values:")
|
139 |
+
print(gene_data.head())
|
140 |
+
|
141 |
+
# Save gene expression data
|
142 |
+
gene_data.to_csv(out_gene_data_file)
|
143 |
+
# Reload clinical data that was processed earlier
|
144 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
145 |
+
|
146 |
+
# 1. Normalize gene symbols
|
147 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
148 |
+
genetic_data.to_csv(out_gene_data_file)
|
149 |
+
|
150 |
+
# 2. Link clinical and genetic data
|
151 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
152 |
+
|
153 |
+
# 3. Handle missing values systematically
|
154 |
+
linked_data = handle_missing_values(linked_data, trait)
|
155 |
+
|
156 |
+
# 4. Check for bias in trait and demographic features
|
157 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
158 |
+
|
159 |
+
# 5. Final validation and information saving
|
160 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
161 |
+
is_usable = validate_and_save_cohort_info(
|
162 |
+
is_final=True,
|
163 |
+
cohort=cohort,
|
164 |
+
info_path=json_path,
|
165 |
+
is_gene_available=True,
|
166 |
+
is_trait_available=True,
|
167 |
+
is_biased=trait_biased,
|
168 |
+
df=linked_data,
|
169 |
+
note=note
|
170 |
+
)
|
171 |
+
|
172 |
+
# 6. Save linked data only if usable
|
173 |
+
if is_usable:
|
174 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
175 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Parkinsons_Disease/code/TCGA.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Parkinsons_Disease"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Parkinsons_Disease/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Parkinsons_Disease/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Parkinsons_Disease/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Parkinsons_Disease/cohort_info.json"
|
15 |
+
|
16 |
+
# 1. Search for Parkinson's Disease related directories in TCGA dataset
|
17 |
+
all_dirs = ['CrawlData.ipynb', '.DS_Store', 'TCGA_lower_grade_glioma_and_glioblastoma_(GBMLGG)', 'TCGA_Uterine_Carcinosarcoma_(UCS)', 'TCGA_Thyroid_Cancer_(THCA)', 'TCGA_Thymoma_(THYM)', 'TCGA_Testicular_Cancer_(TGCT)', 'TCGA_Stomach_Cancer_(STAD)', 'TCGA_Sarcoma_(SARC)', 'TCGA_Rectal_Cancer_(READ)', 'TCGA_Prostate_Cancer_(PRAD)', 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)', 'TCGA_Pancreatic_Cancer_(PAAD)', 'TCGA_Ovarian_Cancer_(OV)', 'TCGA_Ocular_melanomas_(UVM)', 'TCGA_Mesothelioma_(MESO)', 'TCGA_Melanoma_(SKCM)', 'TCGA_Lung_Squamous_Cell_Carcinoma_(LUSC)', 'TCGA_Lung_Cancer_(LUNG)', 'TCGA_Lung_Adenocarcinoma_(LUAD)', 'TCGA_Lower_Grade_Glioma_(LGG)', 'TCGA_Liver_Cancer_(LIHC)', 'TCGA_Large_Bcell_Lymphoma_(DLBC)', 'TCGA_Kidney_Papillary_Cell_Carcinoma_(KIRP)', 'TCGA_Kidney_Clear_Cell_Carcinoma_(KIRC)', 'TCGA_Kidney_Chromophobe_(KICH)', 'TCGA_Head_and_Neck_Cancer_(HNSC)', 'TCGA_Glioblastoma_(GBM)', 'TCGA_Esophageal_Cancer_(ESCA)', 'TCGA_Endometrioid_Cancer_(UCEC)', 'TCGA_Colon_and_Rectal_Cancer_(COADREAD)', 'TCGA_Colon_Cancer_(COAD)', 'TCGA_Cervical_Cancer_(CESC)', 'TCGA_Breast_Cancer_(BRCA)', 'TCGA_Bladder_Cancer_(BLCA)', 'TCGA_Bile_Duct_Cancer_(CHOL)', 'TCGA_Adrenocortical_Cancer_(ACC)', 'TCGA_Acute_Myeloid_Leukemia_(LAML)']
|
18 |
+
|
19 |
+
# Search for directories containing "Parkinson" or related terms
|
20 |
+
parkinsons_dirs = [d for d in all_dirs if "parkinson" in d.lower()]
|
21 |
+
|
22 |
+
# No directories found containing Parkinson's Disease related terms
|
23 |
+
print(f"No directories found containing data relevant to {trait}")
|
24 |
+
|
25 |
+
# Mark data as unavailable since no relevant cohort exists
|
26 |
+
is_gene_available = False
|
27 |
+
is_trait_available = False
|
28 |
+
|
29 |
+
# Record this information
|
30 |
+
validate_and_save_cohort_info(
|
31 |
+
is_final=False,
|
32 |
+
cohort="TCGA",
|
33 |
+
info_path=json_path,
|
34 |
+
is_gene_available=is_gene_available,
|
35 |
+
is_trait_available=is_trait_available
|
36 |
+
)
|
p3/preprocess/Parkinsons_Disease/gene_data/GSE101534.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM2705776,GSM2705777,GSM2705778,GSM2705779,GSM2705780,GSM2705781,GSM2705782,GSM2705783,GSM2705784,GSM2705785,GSM2705786,GSM2705787,GSM2705788,GSM2705789,GSM2705790,GSM2705791,GSM2705792,GSM2705793,GSM2705794,GSM2705795,GSM2705796,GSM2705797,GSM2705798,GSM2705799,GSM2705800,GSM2705801,GSM2705802,GSM2705803,GSM2705804,GSM2705805,GSM2705806,GSM2705807,GSM2705808,GSM2705809,GSM2705810,GSM2705811,GSM2705812,GSM2705813,GSM2705814,GSM2705815,GSM2705816,GSM2705817,GSM2705818,GSM2705819,GSM2705820,GSM2705821,GSM2705822,GSM2705823,GSM2705824,GSM2705825,GSM2705826
|
p3/preprocess/Parkinsons_Disease/gene_data/GSE49126.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Parkinsons_Disease/gene_data/GSE72267.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Peptic_ulcer_disease/GSE43580.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Peptic_ulcer_disease/GSE60427.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Peptic_ulcer_disease/clinical_data/GSE43580.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1065725,GSM1065726,GSM1065727,GSM1065728,GSM1065729,GSM1065730,GSM1065731,GSM1065732,GSM1065733,GSM1065734,GSM1065735,GSM1065736,GSM1065737,GSM1065738,GSM1065739,GSM1065740,GSM1065741,GSM1065742,GSM1065743,GSM1065744,GSM1065745,GSM1065746,GSM1065747,GSM1065748,GSM1065749,GSM1065750,GSM1065751,GSM1065752,GSM1065753,GSM1065754,GSM1065755,GSM1065756,GSM1065757,GSM1065758,GSM1065759,GSM1065760,GSM1065761,GSM1065762,GSM1065763,GSM1065764,GSM1065765,GSM1065766,GSM1065767,GSM1065768,GSM1065769,GSM1065770,GSM1065771,GSM1065772,GSM1065773,GSM1065774,GSM1065775,GSM1065776,GSM1065777,GSM1065778,GSM1065779,GSM1065780,GSM1065781,GSM1065782,GSM1065783,GSM1065784,GSM1065785,GSM1065786,GSM1065787,GSM1065788,GSM1065789,GSM1065790,GSM1065791,GSM1065792,GSM1065793,GSM1065794,GSM1065795,GSM1065796,GSM1065797,GSM1065798,GSM1065799,GSM1065800,GSM1065801,GSM1065802,GSM1065803,GSM1065804,GSM1065805,GSM1065806,GSM1065807,GSM1065808,GSM1065809,GSM1065810,GSM1065811,GSM1065812,GSM1065813,GSM1065814,GSM1065815,GSM1065816,GSM1065817,GSM1065818,GSM1065819,GSM1065820,GSM1065821,GSM1065822,GSM1065823,GSM1065824,GSM1065825,GSM1065826,GSM1065827,GSM1065828,GSM1065829,GSM1065830,GSM1065831,GSM1065832,GSM1065833,GSM1065834,GSM1065835,GSM1065836,GSM1065837,GSM1065838,GSM1065839,GSM1065840,GSM1065841,GSM1065842,GSM1065843,GSM1065844,GSM1065845,GSM1065846,GSM1065847,GSM1065848,GSM1065849,GSM1065850,GSM1065851,GSM1065852,GSM1065853,GSM1065854,GSM1065855,GSM1065856,GSM1065857,GSM1065858,GSM1065859,GSM1065860,GSM1065861,GSM1065862,GSM1065863,GSM1065864,GSM1065865,GSM1065866,GSM1065867,GSM1065868,GSM1065869,GSM1065870,GSM1065871,GSM1065872,GSM1065873,GSM1065874
|
2 |
+
Peptic_ulcer_disease,1.0,,,,1.0,1.0,1.0,,,,,,,,,,1.0,,,,0.0,,0.0,,1.0,,,,,,1.0,,,,,,,,,1.0,,,,,,,1.0,0.0,,,1.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,,,,1.0,,0.0,1.0,,0.0,,,,,0.0,1.0,,,,,,,,,,0.0,,
|
3 |
+
Age,65.0,61.0,43.0,44.0,60.0,58.0,67.0,52.0,43.0,66.0,47.0,56.0,62.0,69.0,60.0,47.0,69.0,49.0,68.0,65.0,52.0,67.0,70.0,60.0,46.0,52.0,66.0,63.0,57.0,56.0,39.0,63.0,68.0,55.0,71.0,55.0,54.0,72.0,74.0,59.0,73.0,55.0,52.0,62.0,46.0,70.0,54.0,67.0,52.0,56.0,52.0,77.0,52.0,57.0,69.0,55.0,71.0,71.0,61.0,53.0,49.0,51.0,65.0,58.0,55.0,59.0,53.0,42.0,57.0,55.0,49.0,49.0,52.0,52.0,70.0,55.0,61.0,42.0,57.0,81.0,49.0,62.0,72.0,46.0,64.0,61.0,79.0,56.0,,79.0,54.0,57.0,54.0,42.0,71.0,76.0,60.0,53.0,48.0,73.0,48.0,69.0,64.0,58.0,55.0,56.0,54.0,73.0,77.0,51.0,55.0,59.0,58.0,65.0,66.0,55.0,68.0,64.0,70.0,64.0,52.0,62.0,63.0,62.0,58.0,58.0,56.0,55.0,68.0,69.0,62.0,64.0,70.0,,77.0,65.0,71.0,54.0,69.0,72.0,80.0,57.0,69.0,53.0,53.0,64.0,58.0,64.0,46.0,56.0
|
4 |
+
Gender,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,1.0,1.0,1.0,1.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,1.0,1.0,1.0,1.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,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.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,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.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,0.0,1.0,0.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,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0
|
p3/preprocess/Peptic_ulcer_disease/clinical_data/GSE60427.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1479654,GSM1479655,GSM1479656,GSM1479657,GSM1479658,GSM1479659,GSM1479660,GSM1479661,GSM1479662,GSM1479663,GSM1479664,GSM1479665,GSM1479666,GSM1479667,GSM1479668,GSM1479669,GSM1479670,GSM1479671,GSM1479672,GSM1479673,GSM1479674,GSM1479675,GSM1479676,GSM1479677,GSM1479678,GSM1479679,GSM1479680,GSM1479681,GSM1479682,GSM1479683,GSM1479684,GSM1479685
|
2 |
+
Peptic_ulcer_disease,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,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
|
3 |
+
Age,50.0,25.0,25.0,66.0,33.0,27.0,47.0,38.0,30.0,28.0,51.0,40.0,51.0,24.0,25.0,53.0,65.0,47.0,25.0,47.0,34.0,18.0,61.0,41.0,64.0,49.0,27.0,42.0,82.0,73.0,57.0,46.0
|
4 |
+
Gender,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.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,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0
|
p3/preprocess/Peptic_ulcer_disease/code/GSE43580.py
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Peptic_ulcer_disease"
|
6 |
+
cohort = "GSE43580"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Peptic_ulcer_disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Peptic_ulcer_disease/GSE43580"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Peptic_ulcer_disease/GSE43580.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Peptic_ulcer_disease/gene_data/GSE43580.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Peptic_ulcer_disease/clinical_data/GSE43580.csv"
|
16 |
+
json_path = "./output/preprocess/3/Peptic_ulcer_disease/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 information we know this is gene expression data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability and 2.2 Data Type Conversion
|
37 |
+
|
38 |
+
# Trait data: available in key 17 showing SCC/AC stage information
|
39 |
+
trait_row = 17
|
40 |
+
def convert_trait(x):
|
41 |
+
if pd.isna(x):
|
42 |
+
return None
|
43 |
+
x = str(x).split(': ')[-1]
|
44 |
+
if x == 'SCC1' or x == 'SCC2':
|
45 |
+
return 1 # Having SCC
|
46 |
+
elif x == 'AC1' or x == 'AC2':
|
47 |
+
return 0 # Having AC
|
48 |
+
return None
|
49 |
+
|
50 |
+
# Age data: available in key 1
|
51 |
+
age_row = 1
|
52 |
+
def convert_age(x):
|
53 |
+
if pd.isna(x):
|
54 |
+
return None
|
55 |
+
try:
|
56 |
+
age = int(str(x).split(': ')[-1])
|
57 |
+
return age
|
58 |
+
except:
|
59 |
+
return None
|
60 |
+
|
61 |
+
# Gender data: available in key 0
|
62 |
+
gender_row = 0
|
63 |
+
def convert_gender(x):
|
64 |
+
if pd.isna(x):
|
65 |
+
return None
|
66 |
+
x = str(x).split(': ')[-1].lower()
|
67 |
+
if x == 'female':
|
68 |
+
return 0
|
69 |
+
elif x == 'male':
|
70 |
+
return 1
|
71 |
+
return None
|
72 |
+
|
73 |
+
# 3. Save initial metadata
|
74 |
+
is_initial_check = validate_and_save_cohort_info(
|
75 |
+
is_final=False,
|
76 |
+
cohort=cohort,
|
77 |
+
info_path=json_path,
|
78 |
+
is_gene_available=is_gene_available,
|
79 |
+
is_trait_available=trait_row is not None
|
80 |
+
)
|
81 |
+
|
82 |
+
# 4. Extract clinical features
|
83 |
+
if trait_row is not None:
|
84 |
+
selected_clinical_df = geo_select_clinical_features(
|
85 |
+
clinical_data,
|
86 |
+
trait=trait,
|
87 |
+
trait_row=trait_row,
|
88 |
+
convert_trait=convert_trait,
|
89 |
+
age_row=age_row,
|
90 |
+
convert_age=convert_age,
|
91 |
+
gender_row=gender_row,
|
92 |
+
convert_gender=convert_gender
|
93 |
+
)
|
94 |
+
|
95 |
+
# Preview the extracted features
|
96 |
+
preview = preview_df(selected_clinical_df)
|
97 |
+
print("Preview of extracted clinical features:")
|
98 |
+
print(preview)
|
99 |
+
|
100 |
+
# Save to CSV
|
101 |
+
selected_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 |
+
# Based on identifiers like "1007_s_at", these are Affymetrix probe IDs
|
118 |
+
# They need to be mapped to human gene symbols
|
119 |
+
requires_gene_mapping = True
|
120 |
+
# Extract gene annotation data
|
121 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
122 |
+
|
123 |
+
# Display column names and preview data
|
124 |
+
print("Column names:")
|
125 |
+
print(gene_annotation.columns)
|
126 |
+
|
127 |
+
print("\nPreview of gene annotation data:")
|
128 |
+
print(preview_df(gene_annotation))
|
129 |
+
# The 'ID' column in gene annotation matches the probe IDs in gene expression data
|
130 |
+
# The 'Gene Symbol' column contains the target gene symbols
|
131 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
132 |
+
|
133 |
+
# Convert probe-level data to gene expression data by applying the mapping
|
134 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
135 |
+
|
136 |
+
# Save the gene data
|
137 |
+
gene_data.to_csv(out_gene_data_file)
|
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/Peptic_ulcer_disease/code/GSE60427.py
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Peptic_ulcer_disease"
|
6 |
+
cohort = "GSE60427"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Peptic_ulcer_disease"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Peptic_ulcer_disease/GSE60427"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Peptic_ulcer_disease/GSE60427.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Peptic_ulcer_disease/gene_data/GSE60427.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Peptic_ulcer_disease/clinical_data/GSE60427.csv"
|
16 |
+
json_path = "./output/preprocess/3/Peptic_ulcer_disease/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 is a microarray expression dataset studying TLR genes
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Row Identification
|
37 |
+
# trait: Use gastritis grade as an indicator of PUD severity (row 4)
|
38 |
+
trait_row = 4
|
39 |
+
# gender data available in row 1
|
40 |
+
gender_row = 1
|
41 |
+
# age data available in row 2
|
42 |
+
age_row = 2
|
43 |
+
|
44 |
+
# 2.2 Data Type Conversion Functions
|
45 |
+
def convert_trait(value: str) -> int:
|
46 |
+
# Extract value after colon and strip whitespace
|
47 |
+
if ':' in value:
|
48 |
+
value = value.split(':')[1].strip()
|
49 |
+
# Convert to binary: 1 for severe/IM, 0 for normal/mild
|
50 |
+
if value in ['severe', 'IM']:
|
51 |
+
return 1
|
52 |
+
elif value in ['normal', 'mild']:
|
53 |
+
return 0
|
54 |
+
return None
|
55 |
+
|
56 |
+
def convert_age(value: str) -> float:
|
57 |
+
if ':' in value:
|
58 |
+
try:
|
59 |
+
return float(value.split(':')[1].strip())
|
60 |
+
except:
|
61 |
+
return None
|
62 |
+
return None
|
63 |
+
|
64 |
+
def convert_gender(value: str) -> int:
|
65 |
+
if ':' in value:
|
66 |
+
value = value.split(':')[1].strip()
|
67 |
+
if value.upper() == 'F':
|
68 |
+
return 0
|
69 |
+
elif value.upper() == 'M':
|
70 |
+
return 1
|
71 |
+
return None
|
72 |
+
|
73 |
+
# 3. Save initial validation results
|
74 |
+
is_trait_available = trait_row is not None
|
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=is_trait_available
|
81 |
+
)
|
82 |
+
|
83 |
+
# 4. Extract clinical features since trait data is available
|
84 |
+
clinical_features = geo_select_clinical_features(
|
85 |
+
clinical_df=clinical_data,
|
86 |
+
trait=trait,
|
87 |
+
trait_row=trait_row,
|
88 |
+
convert_trait=convert_trait,
|
89 |
+
age_row=age_row,
|
90 |
+
convert_age=convert_age,
|
91 |
+
gender_row=gender_row,
|
92 |
+
convert_gender=convert_gender
|
93 |
+
)
|
94 |
+
|
95 |
+
# Preview the extracted features
|
96 |
+
print(preview_df(clinical_features))
|
97 |
+
|
98 |
+
# Save clinical data
|
99 |
+
clinical_features.to_csv(out_clinical_data_file)
|
100 |
+
# Get gene expression data from matrix file
|
101 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
102 |
+
|
103 |
+
# Examine data structure
|
104 |
+
print("Data structure and head:")
|
105 |
+
print(genetic_data.head())
|
106 |
+
|
107 |
+
print("\nShape:", genetic_data.shape)
|
108 |
+
|
109 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
110 |
+
print(list(genetic_data.index)[:20])
|
111 |
+
|
112 |
+
# Get a few column names to verify sample IDs
|
113 |
+
print("\nFirst 5 column names:")
|
114 |
+
print(list(genetic_data.columns)[:5])
|
115 |
+
# The identifiers starting with "A_19_P" appear to be Agilent array probe IDs rather than standard human gene symbols
|
116 |
+
# They follow the standard Agilent microarray probe ID format
|
117 |
+
requires_gene_mapping = True
|
118 |
+
# Extract gene annotation data
|
119 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
120 |
+
|
121 |
+
# Display column names and preview data
|
122 |
+
print("Column names:")
|
123 |
+
print(gene_annotation.columns)
|
124 |
+
|
125 |
+
print("\nPreview of gene annotation data:")
|
126 |
+
print(preview_df(gene_annotation))
|
127 |
+
# Extract gene mapping from annotation data
|
128 |
+
# ID column in gene_annotation matches probe identifiers in gene expression data
|
129 |
+
# GENE_SYMBOL contains corresponding human gene symbols
|
130 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
|
131 |
+
|
132 |
+
# Apply gene mapping to convert probe-level data to gene-level data
|
133 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
134 |
+
|
135 |
+
# Preview the gene expression data
|
136 |
+
print("Gene expression data shape:", gene_data.shape)
|
137 |
+
print("\nFirst few rows:")
|
138 |
+
print(gene_data.head())
|
139 |
+
print("\nFirst few gene symbols:")
|
140 |
+
print(list(gene_data.index)[:10])
|
141 |
+
# Reload clinical data that was processed earlier
|
142 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
143 |
+
|
144 |
+
# 1. Normalize gene symbols
|
145 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
146 |
+
genetic_data.to_csv(out_gene_data_file)
|
147 |
+
|
148 |
+
# 2. Link clinical and genetic data
|
149 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
150 |
+
|
151 |
+
# 3. Handle missing values systematically
|
152 |
+
linked_data = handle_missing_values(linked_data, trait)
|
153 |
+
|
154 |
+
# 4. Check for bias in trait and demographic features
|
155 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
156 |
+
|
157 |
+
# 5. Final validation and information saving
|
158 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
159 |
+
is_usable = validate_and_save_cohort_info(
|
160 |
+
is_final=True,
|
161 |
+
cohort=cohort,
|
162 |
+
info_path=json_path,
|
163 |
+
is_gene_available=True,
|
164 |
+
is_trait_available=True,
|
165 |
+
is_biased=trait_biased,
|
166 |
+
df=linked_data,
|
167 |
+
note=note
|
168 |
+
)
|
169 |
+
|
170 |
+
# 6. Save linked data only if usable
|
171 |
+
if is_usable:
|
172 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
173 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Peptic_ulcer_disease/code/TCGA.py
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Peptic_ulcer_disease"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Peptic_ulcer_disease/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Peptic_ulcer_disease/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Peptic_ulcer_disease/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Peptic_ulcer_disease/cohort_info.json"
|
15 |
+
|
16 |
+
# 1. Check for available directories for peptic ulcer disease data
|
17 |
+
all_dirs = ['CrawlData.ipynb', '.DS_Store', 'TCGA_lower_grade_glioma_and_glioblastoma_(GBMLGG)', 'TCGA_Uterine_Carcinosarcoma_(UCS)', 'TCGA_Thyroid_Cancer_(THCA)', 'TCGA_Thymoma_(THYM)', 'TCGA_Testicular_Cancer_(TGCT)', 'TCGA_Stomach_Cancer_(STAD)', 'TCGA_Sarcoma_(SARC)', 'TCGA_Rectal_Cancer_(READ)', 'TCGA_Prostate_Cancer_(PRAD)', 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)', 'TCGA_Pancreatic_Cancer_(PAAD)', 'TCGA_Ovarian_Cancer_(OV)', 'TCGA_Ocular_melanomas_(UVM)', 'TCGA_Mesothelioma_(MESO)', 'TCGA_Melanoma_(SKCM)', 'TCGA_Lung_Squamous_Cell_Carcinoma_(LUSC)', 'TCGA_Lung_Cancer_(LUNG)', 'TCGA_Lung_Adenocarcinoma_(LUAD)', 'TCGA_Lower_Grade_Glioma_(LGG)', 'TCGA_Liver_Cancer_(LIHC)', 'TCGA_Large_Bcell_Lymphoma_(DLBC)', 'TCGA_Kidney_Papillary_Cell_Carcinoma_(KIRP)', 'TCGA_Kidney_Clear_Cell_Carcinoma_(KIRC)', 'TCGA_Kidney_Chromophobe_(KICH)', 'TCGA_Head_and_Neck_Cancer_(HNSC)', 'TCGA_Glioblastoma_(GBM)', 'TCGA_Esophageal_Cancer_(ESCA)', 'TCGA_Endometrioid_Cancer_(UCEC)', 'TCGA_Colon_and_Rectal_Cancer_(COADREAD)', 'TCGA_Colon_Cancer_(COAD)', 'TCGA_Cervical_Cancer_(CESC)', 'TCGA_Breast_Cancer_(BRCA)', 'TCGA_Bladder_Cancer_(BLCA)', 'TCGA_Bile_Duct_Cancer_(CHOL)', 'TCGA_Adrenocortical_Cancer_(ACC)', 'TCGA_Acute_Myeloid_Leukemia_(LAML)']
|
18 |
+
|
19 |
+
# Select STAD (stomach cancer) directory as most relevant to peptic ulcer disease
|
20 |
+
selected_dir = 'TCGA_Stomach_Cancer_(STAD)'
|
21 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_dir)
|
22 |
+
|
23 |
+
# Get file paths for clinical and genetic data
|
24 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
25 |
+
|
26 |
+
# Load the data files
|
27 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
28 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
29 |
+
|
30 |
+
# Print clinical columns for analysis
|
31 |
+
print("Clinical data columns:")
|
32 |
+
print(clinical_df.columns.tolist())
|
33 |
+
|
34 |
+
is_gene_available = True
|
35 |
+
is_trait_available = True
|
36 |
+
|
37 |
+
# Record the data availability
|
38 |
+
validate_and_save_cohort_info(
|
39 |
+
is_final=False,
|
40 |
+
cohort="TCGA",
|
41 |
+
info_path=json_path,
|
42 |
+
is_gene_available=is_gene_available,
|
43 |
+
is_trait_available=is_trait_available
|
44 |
+
)
|
45 |
+
# Define candidate columns for age and gender
|
46 |
+
candidate_age_cols = ['age_at_initial_pathologic_diagnosis', 'days_to_birth']
|
47 |
+
candidate_gender_cols = ['gender']
|
48 |
+
|
49 |
+
# Load clinical data from previous step (keeping this commented out since it should exist from earlier)
|
50 |
+
#clinical_df = pd.read_csv(clinical_file_path, index_col=0)
|
51 |
+
|
52 |
+
# Extract candidate columns
|
53 |
+
age_preview = preview_df(clinical_df[candidate_age_cols])
|
54 |
+
gender_preview = preview_df(clinical_df[candidate_gender_cols])
|
55 |
+
|
56 |
+
print("Age columns preview:")
|
57 |
+
print(age_preview)
|
58 |
+
print("\nGender columns preview:")
|
59 |
+
print(gender_preview)
|
60 |
+
# Analyze age columns
|
61 |
+
age_col = 'age_at_initial_pathologic_diagnosis' # This column has valid numeric values
|
62 |
+
# days_to_birth has missing values and requires conversion, so we skip it
|
63 |
+
|
64 |
+
# Analyze gender columns
|
65 |
+
gender_col = 'gender' # Only one gender column exists with valid values
|
66 |
+
|
67 |
+
# Print chosen columns
|
68 |
+
print(f"Chosen age column: {age_col}")
|
69 |
+
print(f"Chosen gender column: {gender_col}")
|
70 |
+
# 1. Extract and standardize clinical features
|
71 |
+
selected_clinical_df = tcga_select_clinical_features(clinical_df, trait, age_col, gender_col)
|
72 |
+
|
73 |
+
# 2. Normalize gene symbols in genetic data
|
74 |
+
normalized_genetic_df = normalize_gene_symbols_in_index(genetic_df)
|
75 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
76 |
+
normalized_genetic_df.to_csv(out_gene_data_file)
|
77 |
+
|
78 |
+
# 3. Link clinical and genetic data
|
79 |
+
linked_data = pd.merge(selected_clinical_df, normalized_genetic_df.T, left_index=True, right_index=True)
|
80 |
+
|
81 |
+
# 4. Handle missing values
|
82 |
+
linked_data = handle_missing_values(linked_data, trait)
|
83 |
+
|
84 |
+
# 5. Check for bias in trait and demographic features
|
85 |
+
is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
86 |
+
|
87 |
+
# 6. Validate and save cohort info
|
88 |
+
note = f"Sample size after preprocessing: {len(linked_data)}. Number of genes: {len(linked_data.columns) - 3}"
|
89 |
+
is_usable = validate_and_save_cohort_info(
|
90 |
+
is_final=True,
|
91 |
+
cohort="TCGA",
|
92 |
+
info_path=json_path,
|
93 |
+
is_gene_available=True,
|
94 |
+
is_trait_available=True,
|
95 |
+
is_biased=is_biased,
|
96 |
+
df=linked_data,
|
97 |
+
note=note
|
98 |
+
)
|
99 |
+
|
100 |
+
# 7. Save linked data if usable
|
101 |
+
if is_usable:
|
102 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
103 |
+
linked_data.to_csv(out_data_file)
|
104 |
+
print(f"Linked data saved to {out_data_file}")
|
105 |
+
print("Shape of final linked data:", linked_data.shape)
|
106 |
+
else:
|
107 |
+
print("Dataset was found to be unusable and was not saved")
|
p3/preprocess/Peptic_ulcer_disease/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE60427": {"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": 32, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "GSE43580": {"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": 33, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "TCGA": {"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": 450, "note": "Sample size after preprocessing: 450. Number of genes: 19848"}}
|
p3/preprocess/Peptic_ulcer_disease/gene_data/GSE60427.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/GSE19987.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE19422.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM482992,GSM482993,GSM482994,GSM482995,GSM482996,GSM482997,GSM482998,GSM482999,GSM483000,GSM483001,GSM483002,GSM483003,GSM483004,GSM483005,GSM483006,GSM483007,GSM483008,GSM483009,GSM483010,GSM483011,GSM483012,GSM483013,GSM483014,GSM483015,GSM483016,GSM483017,GSM483018,GSM483019,GSM483020,GSM483021,GSM483022,GSM483023,GSM483024,GSM483025,GSM483026,GSM483027,GSM483028,GSM483029,GSM483030,GSM483031,GSM483032,GSM483033,GSM483034,GSM483035,GSM483036,GSM483037,GSM483038,GSM483039,GSM483040,GSM483041,GSM483042,GSM483043,GSM483044,GSM483045,GSM483046,GSM483047,GSM483048,GSM483049,GSM483050,GSM483051,GSM483052,GSM483053,GSM483054,GSM483055,GSM483056,GSM483057,GSM483058,GSM483059,GSM483060,GSM483061,GSM483062,GSM483063,GSM483064,GSM483065,GSM483066,GSM483067,GSM483068,GSM483069,GSM483070,GSM483071,GSM483072,GSM483073,GSM483074,GSM483075,GSM483076,GSM483077,GSM483078,GSM483079,GSM483080,GSM483081
|
2 |
+
Pheochromocytoma_and_Paraganglioma,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,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/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 |
+
Pheochromocytoma_and_Paraganglioma,0.0,1.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,1.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,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,1.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,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
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE33371.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM825367,GSM825368,GSM825369,GSM825370,GSM825371,GSM825372,GSM825373,GSM825374,GSM825375,GSM825376,GSM825377,GSM825378,GSM825379,GSM825380,GSM825381,GSM825382,GSM825383,GSM825384,GSM825385,GSM825386,GSM825387,GSM825388,GSM825389,GSM825390,GSM825391,GSM825392,GSM825393,GSM825394,GSM825395,GSM825396,GSM825397,GSM825398,GSM825399,GSM825400,GSM825401,GSM825402,GSM825403,GSM825404,GSM825405,GSM825406,GSM825407,GSM825408,GSM825409,GSM825410,GSM825411,GSM825412,GSM825413,GSM825414,GSM825415,GSM825416,GSM825417,GSM825418,GSM825419,GSM825420,GSM825421,GSM825422,GSM825423,GSM825424,GSM825425,GSM825426,GSM825427,GSM825428,GSM825429,GSM825430,GSM825431
|
2 |
+
Pheochromocytoma,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,0.0,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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,71.0,58.0,71.0,44.0,32.0,28.0,55.0,78.0,41.0,58.0,45.0,28.0,57.0,25.0,25.0,56.0,33.0,44.0,71.0,56.0,51.0,32.0,38.0,49.0,62.0,59.0,52.0,54.0,48.0,55.0,64.0,45.0,5.0,49.0,45.0,48.0,77.0,47.0,55.0,52.0,34.0,35.0,52.0,48.0,45.0,39.0,40.0,31.0,87.0,45.0,41.0,5.0,32.0,50.0,55.0,19.0,61.0,33.0,31.0,60.0,51.0,71.0,25.0,47.0,49.0
|
4 |
+
Gender,0.0,0.0,1.0,1.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,0.0,0.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,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,0.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,0.0,0.0,0.0,1.0,0.0,0.0,0.0
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE39716.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM978080,GSM978081,GSM978082,GSM978083,GSM978084,GSM978085,GSM978086,GSM978087,GSM978088,GSM978089,GSM978090,GSM978091,GSM978092,GSM978093,GSM978094,GSM978095,GSM978096,GSM978097,GSM978098,GSM978099,GSM978100,GSM978101,GSM978102,GSM978103,GSM978104,GSM978105,GSM978106,GSM978107,GSM978108,GSM978109,GSM978110,GSM978111,GSM978112,GSM978113,GSM978114,GSM978115,GSM978116,GSM978117,GSM978118,GSM978119,GSM978120,GSM978121,GSM978122,GSM978123,GSM978124,GSM978125,GSM978126,GSM978127,GSM978128,GSM978129,GSM978130,GSM978131,GSM978132
|
2 |
+
Pheochromocytoma_and_Paraganglioma,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,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
|
3 |
+
Age,61.0,,53.0,72.0,72.0,65.0,56.0,62.0,28.5,24.0,46.0,9.0,22.8,26.6,38.2,45.6,36.0,36.2,52.0,12.0,31.0,55.0,35.0,34.8,17.0,30.0,16.0,31.0,26.6,61.4,31.8,32.6,49.3,61.1,26.6,27.1,48.0,29.0,24.3,34.0,42.8,29.4,42.6,39.2,30.0,33.1,18.9,13.1,28.6,16.1,22.7,23.1,24.8
|
4 |
+
Gender,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,0.0,0.0,1.0,1.0,1.0,1.0,1.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,0.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,1.0,1.0,1.0,1.0,0.0
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE64957.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM1584943,GSM1584944,GSM1584945,GSM1584946,GSM1584947,GSM1584948,GSM1584949,GSM1584950,GSM1584951,GSM1584952,GSM1584953,GSM1584954,GSM1584955,GSM1584956,GSM1584957,GSM1584958,GSM1584959,GSM1584960,GSM1584961,GSM1584962,GSM1584963,GSM1584964,GSM1584965,GSM1584966,GSM1584967,GSM1584968,GSM1584969,GSM1584970,GSM1584971,GSM1584972,GSM1584973,GSM1584974,GSM1584975,GSM1584976,GSM1584977,GSM1584978,GSM1584979,GSM1584980,GSM1584981,GSM1584982,GSM1584983,GSM1584984,GSM1584985,GSM1584986,GSM1584987,GSM1584988,GSM1584989,GSM1584990,GSM1584991,GSM1584992,GSM1584993,GSM1584994,GSM1584995,GSM1584996,GSM1584997
|
2 |
+
Pheochromocytoma_and_Paraganglioma,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,1.0,0.0,1.0,1.0,0.0,0.0,0.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,0.0,0.0,0.0,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,0.0,0.0,0.0
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE67066.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM1637993,GSM1637994,GSM1637995,GSM1637996,GSM1637997,GSM1637998,GSM1637999,GSM1638000,GSM1638001,GSM1638002,GSM1638003,GSM1638004,GSM1638005,GSM1638006,GSM1638007,GSM1638008,GSM1638009,GSM1638010,GSM1638011,GSM1638012,GSM1638013,GSM1638014,GSM1638015,GSM1638016,GSM1638017,GSM1638018,GSM1638019,GSM1638020,GSM1638021,GSM1638022,GSM1638023,GSM1638024,GSM1638025,GSM1638026,GSM1638027,GSM1638028,GSM1638029,GSM1638030,GSM1638031,GSM1638032,GSM1638033,GSM1638034,GSM1638035,GSM1638036,GSM1638037,GSM1638038,GSM1638039,GSM1638040,GSM1638041,GSM1638042,GSM1638043
|
2 |
+
Pheochromocytoma_and_Paraganglioma,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE19422.py
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Pheochromocytoma_and_Paraganglioma"
|
6 |
+
cohort = "GSE19422"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma/GSE19422"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/GSE19422.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/gene_data/GSE19422.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE19422.csv"
|
16 |
+
json_path = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/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 the background info mentioning "Gene expression profiling" and "cDNA microarray",
|
34 |
+
# this dataset contains gene expression data
|
35 |
+
is_gene_available = True
|
36 |
+
|
37 |
+
# 2.1 Row identifiers for clinical features
|
38 |
+
# tissue type indicates tumor/normal status (trait)
|
39 |
+
trait_row = 0
|
40 |
+
|
41 |
+
# Age and gender are not available in sample characteristics
|
42 |
+
age_row = None
|
43 |
+
gender_row = None
|
44 |
+
|
45 |
+
# 2.2 Data type conversion functions
|
46 |
+
def convert_trait(value):
|
47 |
+
"""Convert tissue type to binary: 1 for tumor (PCC/PGL), 0 for normal"""
|
48 |
+
if not value or ':' not in value:
|
49 |
+
return None
|
50 |
+
value = value.split(':')[1].strip().lower()
|
51 |
+
if 'normal' in value:
|
52 |
+
return 0
|
53 |
+
elif 'tumor' in value or 'pcc' in value or 'pgl' in value:
|
54 |
+
return 1
|
55 |
+
return None
|
56 |
+
|
57 |
+
convert_age = None
|
58 |
+
convert_gender = None
|
59 |
+
|
60 |
+
# 3. Save metadata about data availability
|
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 since trait data is available
|
70 |
+
clinical_features = geo_select_clinical_features(
|
71 |
+
clinical_df=clinical_data,
|
72 |
+
trait=trait,
|
73 |
+
trait_row=trait_row,
|
74 |
+
convert_trait=convert_trait,
|
75 |
+
age_row=age_row,
|
76 |
+
convert_age=convert_age,
|
77 |
+
gender_row=gender_row,
|
78 |
+
convert_gender=convert_gender
|
79 |
+
)
|
80 |
+
|
81 |
+
# Preview the extracted features
|
82 |
+
print("Preview of clinical features:")
|
83 |
+
print(preview_df(clinical_features))
|
84 |
+
|
85 |
+
# Save clinical data
|
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 |
+
# Based on the gene identifiers which start with "A_23_P", these are Agilent microarray probe IDs, not gene symbols
|
103 |
+
# They need to be mapped to human gene symbols for analysis
|
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 |
+
# Get gene mapping data
|
115 |
+
# 'ID' in gene annotation matches probe IDs in expression data
|
116 |
+
# 'GENE_SYMBOL' contains the target gene symbols
|
117 |
+
mapping_data = get_gene_mapping(gene_annotation, 'ID', 'GENE_SYMBOL')
|
118 |
+
|
119 |
+
# Convert probe measurements to gene expression data
|
120 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
121 |
+
|
122 |
+
# Preview results
|
123 |
+
print("Shape of original probe data:", genetic_data.shape)
|
124 |
+
print("Shape after mapping to genes:", gene_data.shape)
|
125 |
+
print("\nFirst few rows and columns of gene expression data:")
|
126 |
+
print(gene_data.head().iloc[:, :5])
|
127 |
+
# Reload clinical data that was processed earlier
|
128 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
129 |
+
|
130 |
+
# 1. Normalize gene symbols
|
131 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
132 |
+
genetic_data.to_csv(out_gene_data_file)
|
133 |
+
|
134 |
+
# 2. Link clinical and genetic data
|
135 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
136 |
+
|
137 |
+
# 3. Handle missing values systematically
|
138 |
+
linked_data = handle_missing_values(linked_data, trait)
|
139 |
+
|
140 |
+
# 4. Check for bias in trait and demographic features
|
141 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
142 |
+
|
143 |
+
# 5. Final validation and information saving
|
144 |
+
note = "Dataset contains gene expression data from adrenal tissue samples, with cases identified by presence of pheochromocytoma"
|
145 |
+
is_usable = validate_and_save_cohort_info(
|
146 |
+
is_final=True,
|
147 |
+
cohort=cohort,
|
148 |
+
info_path=json_path,
|
149 |
+
is_gene_available=True,
|
150 |
+
is_trait_available=True,
|
151 |
+
is_biased=trait_biased,
|
152 |
+
df=linked_data,
|
153 |
+
note=note
|
154 |
+
)
|
155 |
+
|
156 |
+
# 6. Save linked data only if usable
|
157 |
+
if is_usable:
|
158 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
159 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE19987.py
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Pheochromocytoma_and_Paraganglioma"
|
6 |
+
cohort = "GSE19987"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma/GSE19987"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/GSE19987.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/gene_data/GSE19987.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE19987.csv"
|
16 |
+
json_path = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/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 for studying Pheochromocytoma
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
|
38 |
+
# Trait can be determined from tumor location (row 2)
|
39 |
+
trait_row = 2
|
40 |
+
|
41 |
+
# Age data not available
|
42 |
+
age_row = None
|
43 |
+
|
44 |
+
# Gender data not available
|
45 |
+
gender_row = None
|
46 |
+
|
47 |
+
# 2.2 Data Type Conversion Functions
|
48 |
+
def convert_trait(value: str) -> int:
|
49 |
+
# Extract value after colon
|
50 |
+
if ':' in value:
|
51 |
+
value = value.split(':')[1].strip()
|
52 |
+
if value.lower() == 'adrenal':
|
53 |
+
return 0 # Adrenal pheochromocytoma
|
54 |
+
elif value.lower() == 'extraadrenal':
|
55 |
+
return 1 # Extra-adrenal paraganglioma
|
56 |
+
return None
|
57 |
+
|
58 |
+
def convert_age(value: str) -> float:
|
59 |
+
# Not used since age data unavailable
|
60 |
+
return None
|
61 |
+
|
62 |
+
def convert_gender(value: str) -> int:
|
63 |
+
# Not used since gender data unavailable
|
64 |
+
return None
|
65 |
+
|
66 |
+
# 3. Save Metadata
|
67 |
+
validate_and_save_cohort_info(
|
68 |
+
is_final=False,
|
69 |
+
cohort=cohort,
|
70 |
+
info_path=json_path,
|
71 |
+
is_gene_available=is_gene_available,
|
72 |
+
is_trait_available=trait_row is not None
|
73 |
+
)
|
74 |
+
|
75 |
+
# 4. Clinical Feature Extraction
|
76 |
+
if trait_row is not None:
|
77 |
+
selected_clinical = geo_select_clinical_features(
|
78 |
+
clinical_df=clinical_data,
|
79 |
+
trait=trait,
|
80 |
+
trait_row=trait_row,
|
81 |
+
convert_trait=convert_trait,
|
82 |
+
age_row=age_row,
|
83 |
+
convert_age=convert_age,
|
84 |
+
gender_row=gender_row,
|
85 |
+
convert_gender=convert_gender
|
86 |
+
)
|
87 |
+
|
88 |
+
# Preview the processed clinical data
|
89 |
+
print("Preview of processed clinical data:")
|
90 |
+
print(preview_df(selected_clinical))
|
91 |
+
|
92 |
+
# Save to CSV
|
93 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
94 |
+
# Get gene expression data from matrix file
|
95 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
96 |
+
|
97 |
+
# Examine data structure
|
98 |
+
print("Data structure and head:")
|
99 |
+
print(genetic_data.head())
|
100 |
+
|
101 |
+
print("\nShape:", genetic_data.shape)
|
102 |
+
|
103 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
104 |
+
print(list(genetic_data.index)[:20])
|
105 |
+
|
106 |
+
# Get a few column names to verify sample IDs
|
107 |
+
print("\nFirst 5 column names:")
|
108 |
+
print(list(genetic_data.columns)[:5])
|
109 |
+
# Based on the row IDs ending with "_at" (e.g. "1007_s_at", "1053_at"),
|
110 |
+
# these appear to be Affymetrix probe IDs rather than gene symbols,
|
111 |
+
# so they will need to be mapped to official gene symbols
|
112 |
+
requires_gene_mapping = True
|
113 |
+
# Extract gene annotation data
|
114 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
115 |
+
|
116 |
+
# Display column names and preview data
|
117 |
+
print("Column names:")
|
118 |
+
print(gene_annotation.columns)
|
119 |
+
|
120 |
+
print("\nPreview of gene annotation data:")
|
121 |
+
print(preview_df(gene_annotation))
|
122 |
+
# 1. From inspection, 'ID' column contains probe IDs (e.g., "1007_s_at") matching gene expression data
|
123 |
+
# 'Gene Symbol' column contains the corresponding gene symbols
|
124 |
+
prob_col = 'ID'
|
125 |
+
gene_col = 'Gene Symbol'
|
126 |
+
|
127 |
+
# 2. Get mapping between probe IDs and gene symbols
|
128 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col, gene_col)
|
129 |
+
|
130 |
+
# 3. Apply mapping to convert probe expressions to gene expressions
|
131 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
132 |
+
|
133 |
+
# Preview results
|
134 |
+
print("First few rows and columns of mapped gene expression data:")
|
135 |
+
print(gene_data.head().iloc[:, :5])
|
136 |
+
|
137 |
+
print("\nShape:", gene_data.shape)
|
138 |
+
print("\nFirst 10 gene symbols:")
|
139 |
+
print(list(gene_data.index)[:10])
|
140 |
+
# Reload clinical data that was processed earlier
|
141 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
142 |
+
|
143 |
+
# 1. Normalize gene symbols
|
144 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
145 |
+
genetic_data.to_csv(out_gene_data_file)
|
146 |
+
|
147 |
+
# 2. Link clinical and genetic data
|
148 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
149 |
+
|
150 |
+
# 3. Handle missing values systematically
|
151 |
+
linked_data = handle_missing_values(linked_data, trait)
|
152 |
+
|
153 |
+
# 4. Check for bias in trait and demographic features
|
154 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
155 |
+
|
156 |
+
# 5. Final validation and information saving
|
157 |
+
note = "Dataset contains gene expression data from adrenal tissue samples, with cases identified by presence of pheochromocytoma"
|
158 |
+
is_usable = validate_and_save_cohort_info(
|
159 |
+
is_final=True,
|
160 |
+
cohort=cohort,
|
161 |
+
info_path=json_path,
|
162 |
+
is_gene_available=True,
|
163 |
+
is_trait_available=True,
|
164 |
+
is_biased=trait_biased,
|
165 |
+
df=linked_data,
|
166 |
+
note=note
|
167 |
+
)
|
168 |
+
|
169 |
+
# 6. Save linked data only if usable
|
170 |
+
if is_usable:
|
171 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
172 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE33371.py
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Pheochromocytoma_and_Paraganglioma"
|
6 |
+
cohort = "GSE33371"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma/GSE33371"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/GSE33371.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/gene_data/GSE33371.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE33371.csv"
|
16 |
+
json_path = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/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 title and overall design, this dataset contains Affymetrix HG_U133_plus_2 arrays data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data availability
|
37 |
+
# trait_row: 3 - Clinical characteristics shows pheochromocytoma cases
|
38 |
+
trait_row = 3
|
39 |
+
# age_row: 0 - Age data is available
|
40 |
+
age_row = 0
|
41 |
+
# gender_row: 1 - Sex data is available
|
42 |
+
gender_row = 1
|
43 |
+
|
44 |
+
# 2.2 Data conversion functions
|
45 |
+
def convert_trait(x: str) -> Union[int, None]:
|
46 |
+
"""Convert clinical characteristics to binary labels"""
|
47 |
+
if not isinstance(x, str):
|
48 |
+
return None
|
49 |
+
value = x.split(': ')[-1].lower()
|
50 |
+
# Convert to binary: 1 for pheochromocytoma cases, 0 for others
|
51 |
+
if 'pheochromocytoma' in value:
|
52 |
+
return 1
|
53 |
+
return 0
|
54 |
+
|
55 |
+
def convert_age(x: str) -> Union[float, None]:
|
56 |
+
"""Convert age to float"""
|
57 |
+
if not isinstance(x, str):
|
58 |
+
return None
|
59 |
+
value = x.split(': ')[-1]
|
60 |
+
try:
|
61 |
+
if value == '<10':
|
62 |
+
return 5.0 # Approximate middle value
|
63 |
+
return float(value)
|
64 |
+
except:
|
65 |
+
return None
|
66 |
+
|
67 |
+
def convert_gender(x: str) -> Union[int, None]:
|
68 |
+
"""Convert gender to binary (0:Female, 1:Male)"""
|
69 |
+
if not isinstance(x, str):
|
70 |
+
return None
|
71 |
+
value = x.split(': ')[-1].upper()
|
72 |
+
if value == 'F':
|
73 |
+
return 0
|
74 |
+
elif value == 'M':
|
75 |
+
return 1
|
76 |
+
return None
|
77 |
+
|
78 |
+
# 3. Save metadata
|
79 |
+
validate_and_save_cohort_info(is_final=False,
|
80 |
+
cohort=cohort,
|
81 |
+
info_path=json_path,
|
82 |
+
is_gene_available=is_gene_available,
|
83 |
+
is_trait_available=trait_row is not None)
|
84 |
+
|
85 |
+
# 4. Clinical feature extraction
|
86 |
+
# Extract clinical features using the library function
|
87 |
+
clinical_df = geo_select_clinical_features(clinical_data,
|
88 |
+
trait='Pheochromocytoma',
|
89 |
+
trait_row=trait_row,
|
90 |
+
convert_trait=convert_trait,
|
91 |
+
age_row=age_row,
|
92 |
+
convert_age=convert_age,
|
93 |
+
gender_row=gender_row,
|
94 |
+
convert_gender=convert_gender)
|
95 |
+
|
96 |
+
# Preview the extracted features
|
97 |
+
preview_result = preview_df(clinical_df)
|
98 |
+
print("Preview of clinical features:")
|
99 |
+
print(preview_result)
|
100 |
+
|
101 |
+
# Save clinical data
|
102 |
+
clinical_df.to_csv(out_clinical_data_file)
|
103 |
+
# Get gene expression data from matrix file
|
104 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
105 |
+
|
106 |
+
# Examine data structure
|
107 |
+
print("Data structure and head:")
|
108 |
+
print(genetic_data.head())
|
109 |
+
|
110 |
+
print("\nShape:", genetic_data.shape)
|
111 |
+
|
112 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
113 |
+
print(list(genetic_data.index)[:20])
|
114 |
+
|
115 |
+
# Get a few column names to verify sample IDs
|
116 |
+
print("\nFirst 5 column names:")
|
117 |
+
print(list(genetic_data.columns)[:5])
|
118 |
+
# Observe the IDs from the gene expression data
|
119 |
+
# The identifiers follow the pattern like '1007_s_at', '1053_at' which are
|
120 |
+
# Affymetrix probe IDs from microarray platforms
|
121 |
+
# These need to be mapped to human gene symbols
|
122 |
+
|
123 |
+
requires_gene_mapping = True
|
124 |
+
# Extract gene annotation data
|
125 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
126 |
+
|
127 |
+
# Display column names and preview data
|
128 |
+
print("Column names:")
|
129 |
+
print(gene_annotation.columns)
|
130 |
+
|
131 |
+
print("\nPreview of gene annotation data:")
|
132 |
+
print(preview_df(gene_annotation))
|
133 |
+
# Get gene mapping from annotation data
|
134 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
135 |
+
|
136 |
+
# Apply mapping to convert probe-level data to gene expression data
|
137 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
138 |
+
|
139 |
+
# Print first few rows and shape of the mapped gene data
|
140 |
+
print("Gene expression data after mapping:")
|
141 |
+
print(gene_data.head())
|
142 |
+
print("\nShape:", gene_data.shape)
|
143 |
+
# Reload clinical data that was processed earlier
|
144 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
145 |
+
|
146 |
+
# 1. Normalize gene symbols
|
147 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
148 |
+
genetic_data.to_csv(out_gene_data_file)
|
149 |
+
|
150 |
+
# 2. Link clinical and genetic data
|
151 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
152 |
+
|
153 |
+
# 3. Handle missing values systematically
|
154 |
+
linked_data = handle_missing_values(linked_data, "Pheochromocytoma")
|
155 |
+
|
156 |
+
# 4. Check for bias in trait and demographic features
|
157 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, "Pheochromocytoma")
|
158 |
+
|
159 |
+
# 5. Final validation and information saving
|
160 |
+
note = "Dataset contains gene expression data from adrenal tissue samples, with cases identified by presence of pheochromocytoma"
|
161 |
+
is_usable = validate_and_save_cohort_info(
|
162 |
+
is_final=True,
|
163 |
+
cohort=cohort,
|
164 |
+
info_path=json_path,
|
165 |
+
is_gene_available=True,
|
166 |
+
is_trait_available=True,
|
167 |
+
is_biased=trait_biased,
|
168 |
+
df=linked_data,
|
169 |
+
note=note
|
170 |
+
)
|
171 |
+
|
172 |
+
# 6. Save linked data only if usable
|
173 |
+
if is_usable:
|
174 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
175 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE39716.py
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Pheochromocytoma_and_Paraganglioma"
|
6 |
+
cohort = "GSE39716"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma/GSE39716"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/GSE39716.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/gene_data/GSE39716.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE39716.csv"
|
16 |
+
json_path = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/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 |
+
# This dataset contains human HuGene1.0-ST Gene Chip data, which is gene expression data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Data rows from sample characteristics
|
38 |
+
trait_row = 2 # tissue type indicates normal vs tumor
|
39 |
+
age_row = 0 # age data is available
|
40 |
+
gender_row = 1 # gender data is available
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion Functions
|
43 |
+
def convert_trait(value: str) -> int:
|
44 |
+
"""Convert tissue type to binary: 0 for normal, 1 for tumor"""
|
45 |
+
if not value or '--' in value:
|
46 |
+
return None
|
47 |
+
value = value.split(': ')[1].lower()
|
48 |
+
if 'normal' in value:
|
49 |
+
return 0
|
50 |
+
elif 'tumor' in value:
|
51 |
+
return 1
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_age(value: str) -> float:
|
55 |
+
"""Convert age to float"""
|
56 |
+
if not value or '--' in value:
|
57 |
+
return None
|
58 |
+
try:
|
59 |
+
return float(value.split(': ')[1])
|
60 |
+
except:
|
61 |
+
return None
|
62 |
+
|
63 |
+
def convert_gender(value: str) -> int:
|
64 |
+
"""Convert gender to binary: 0 for female, 1 for male"""
|
65 |
+
if not value or '--' in value:
|
66 |
+
return None
|
67 |
+
value = value.split(': ')[1].lower()
|
68 |
+
if value == 'female':
|
69 |
+
return 0
|
70 |
+
elif value == 'male':
|
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 |
+
if trait_row is not None:
|
85 |
+
clinical_features = geo_select_clinical_features(
|
86 |
+
clinical_df=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 |
+
print("Preview of extracted clinical features:")
|
96 |
+
print(preview_df(clinical_features))
|
97 |
+
clinical_features.to_csv(out_clinical_data_file)
|
98 |
+
# Get gene expression data from matrix file
|
99 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
100 |
+
|
101 |
+
# Examine data structure
|
102 |
+
print("Data structure and head:")
|
103 |
+
print(genetic_data.head())
|
104 |
+
|
105 |
+
print("\nShape:", genetic_data.shape)
|
106 |
+
|
107 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
108 |
+
print(list(genetic_data.index)[:20])
|
109 |
+
|
110 |
+
# Get a few column names to verify sample IDs
|
111 |
+
print("\nFirst 5 column names:")
|
112 |
+
print(list(genetic_data.columns)[:5])
|
113 |
+
# The gene identifiers are 7-digit IDs starting with '7892', which appear to be Illumina probe IDs
|
114 |
+
# These are not standard human gene symbols and will need to be mapped
|
115 |
+
requires_gene_mapping = True
|
116 |
+
# Extract gene annotation data
|
117 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
118 |
+
|
119 |
+
# Display column names and preview data
|
120 |
+
print("Column names:")
|
121 |
+
print(gene_annotation.columns)
|
122 |
+
|
123 |
+
print("\nPreview of gene annotation data:")
|
124 |
+
print(preview_df(gene_annotation))
|
125 |
+
# From the output, we can see that 'ID' in the annotation matches the row IDs in expression data
|
126 |
+
# 'gene_assignment' contains gene symbol information
|
127 |
+
|
128 |
+
# Extract mapping between identifiers and gene symbols
|
129 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
|
130 |
+
|
131 |
+
# Apply the mapping to convert probe-level data to gene-level data
|
132 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
133 |
+
|
134 |
+
# Save the processed gene expression data
|
135 |
+
gene_data.to_csv(out_gene_data_file)
|
136 |
+
|
137 |
+
# Preview gene data structure
|
138 |
+
print("\nProcessed gene data preview:")
|
139 |
+
print(preview_df(gene_data))
|
140 |
+
print("\nShape:", gene_data.shape)
|
141 |
+
# Reload clinical data that was processed earlier
|
142 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
143 |
+
|
144 |
+
# 1. Normalize gene symbols
|
145 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
146 |
+
genetic_data.to_csv(out_gene_data_file)
|
147 |
+
|
148 |
+
# 2. Link clinical and genetic data
|
149 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
150 |
+
|
151 |
+
# 3. Handle missing values systematically
|
152 |
+
linked_data = handle_missing_values(linked_data, trait)
|
153 |
+
|
154 |
+
# 4. Check for bias in trait and demographic features
|
155 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
156 |
+
|
157 |
+
# 5. Final validation and information saving
|
158 |
+
note = "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"
|
159 |
+
is_usable = validate_and_save_cohort_info(
|
160 |
+
is_final=True,
|
161 |
+
cohort=cohort,
|
162 |
+
info_path=json_path,
|
163 |
+
is_gene_available=True,
|
164 |
+
is_trait_available=True,
|
165 |
+
is_biased=trait_biased,
|
166 |
+
df=linked_data,
|
167 |
+
note=note
|
168 |
+
)
|
169 |
+
|
170 |
+
# 6. Save linked data only if usable
|
171 |
+
if is_usable:
|
172 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
173 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE64957.py
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Pheochromocytoma_and_Paraganglioma"
|
6 |
+
cohort = "GSE64957"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma/GSE64957"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/GSE64957.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/gene_data/GSE64957.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE64957.csv"
|
16 |
+
json_path = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/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 Human Genome U133 Plus 2.0 Array
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Variable Availability
|
37 |
+
# Trait (pheo vs non-pheo) can be inferred from row 0 (disease field)
|
38 |
+
trait_row = 0
|
39 |
+
|
40 |
+
# Age not available
|
41 |
+
age_row = None
|
42 |
+
|
43 |
+
# Gender not available
|
44 |
+
gender_row = None
|
45 |
+
|
46 |
+
# 2.2 Data Type Conversion Functions
|
47 |
+
def convert_trait(value):
|
48 |
+
"""Convert disease value to binary: Pheochromocytoma (1) vs non-Pheochromocytoma (0)"""
|
49 |
+
if not isinstance(value, str):
|
50 |
+
return None
|
51 |
+
value = value.lower().split(': ')[-1]
|
52 |
+
if 'pheochromocytoma' in value:
|
53 |
+
return 1
|
54 |
+
elif "conn's syndrome" in value:
|
55 |
+
return 0
|
56 |
+
return None
|
57 |
+
|
58 |
+
def convert_age(value):
|
59 |
+
return None
|
60 |
+
|
61 |
+
def convert_gender(value):
|
62 |
+
return None
|
63 |
+
|
64 |
+
# 3. Save initial 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. Extract clinical features
|
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 |
+
|
88 |
+
# Save clinical features
|
89 |
+
clinical_features.to_csv(out_clinical_data_file)
|
90 |
+
# Get gene expression data from matrix file
|
91 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
92 |
+
|
93 |
+
# Examine data structure
|
94 |
+
print("Data structure and head:")
|
95 |
+
print(genetic_data.head())
|
96 |
+
|
97 |
+
print("\nShape:", genetic_data.shape)
|
98 |
+
|
99 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
100 |
+
print(list(genetic_data.index)[:20])
|
101 |
+
|
102 |
+
# Get a few column names to verify sample IDs
|
103 |
+
print("\nFirst 5 column names:")
|
104 |
+
print(list(genetic_data.columns)[:5])
|
105 |
+
# The IDs appear to be numerical probe identifiers (e.g. 7892501, 7892502)
|
106 |
+
# rather than human gene symbols (e.g. TP53, BRCA1)
|
107 |
+
# These are likely probe IDs from a microarray platform that need to be mapped to gene symbols
|
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 |
+
# In gene_annotation, 'ID' column stores probe identifiers matching genetic_data indices
|
119 |
+
# 'gene_assignment' column stores gene symbol information in format "gene symbol // gene title // ..."
|
120 |
+
|
121 |
+
# Create mapping dataframe from probe ID to gene symbol
|
122 |
+
mapping_data = get_gene_mapping(gene_annotation, 'ID', 'gene_assignment')
|
123 |
+
|
124 |
+
# Extract gene symbols from gene assignment string
|
125 |
+
mapping_data['Gene'] = mapping_data['Gene'].str.split(' // ').str[0]
|
126 |
+
|
127 |
+
# Apply gene mapping to convert probe measurements to gene expression
|
128 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
129 |
+
|
130 |
+
# Preview results
|
131 |
+
print("Gene expression data shape:", gene_data.shape)
|
132 |
+
print("\nFirst few gene symbols:")
|
133 |
+
print(list(gene_data.index)[:10])
|
134 |
+
print("\nFirst few values:")
|
135 |
+
print(gene_data.head())
|
136 |
+
# First check the clinical data processing
|
137 |
+
print("Clinical Data Preview:")
|
138 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
139 |
+
print(selected_clinical_df.head())
|
140 |
+
print("\nClinical Data Shape:", selected_clinical_df.shape)
|
141 |
+
print("\nClinical Data Column Names:", selected_clinical_df.columns)
|
142 |
+
print("\nClinical Data Info:")
|
143 |
+
print(selected_clinical_df.info())
|
144 |
+
|
145 |
+
# If clinical data is valid, proceed with processing
|
146 |
+
if not selected_clinical_df.empty and not selected_clinical_df.isna().all().all():
|
147 |
+
# 1. Normalize gene symbols
|
148 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
149 |
+
genetic_data.to_csv(out_gene_data_file)
|
150 |
+
print("\nGenetic Data Shape after normalization:", genetic_data.shape)
|
151 |
+
|
152 |
+
# 2. Link clinical and genetic data
|
153 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
154 |
+
print("\nLinked Data Shape:", linked_data.shape)
|
155 |
+
|
156 |
+
# 3. Handle missing values
|
157 |
+
linked_data = handle_missing_values(linked_data, trait)
|
158 |
+
|
159 |
+
# 4. Check for bias
|
160 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
161 |
+
|
162 |
+
# 5. Final validation and saving metadata
|
163 |
+
note = "Gene expression data from Affymetrix array with disease status (pheochromocytoma vs Conn's syndrome)"
|
164 |
+
is_usable = validate_and_save_cohort_info(
|
165 |
+
is_final=True,
|
166 |
+
cohort=cohort,
|
167 |
+
info_path=json_path,
|
168 |
+
is_gene_available=True,
|
169 |
+
is_trait_available=True,
|
170 |
+
is_biased=trait_biased,
|
171 |
+
df=linked_data,
|
172 |
+
note=note
|
173 |
+
)
|
174 |
+
|
175 |
+
# 6. Save if usable
|
176 |
+
if is_usable:
|
177 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
178 |
+
linked_data.to_csv(out_data_file)
|
179 |
+
else:
|
180 |
+
print("Error: Clinical data processing failed - empty or invalid data")
|
181 |
+
validate_and_save_cohort_info(
|
182 |
+
is_final=True,
|
183 |
+
cohort=cohort,
|
184 |
+
info_path=json_path,
|
185 |
+
is_gene_available=True,
|
186 |
+
is_trait_available=True,
|
187 |
+
is_biased=True,
|
188 |
+
df=pd.DataFrame(),
|
189 |
+
note="Clinical data processing failed - empty or invalid data"
|
190 |
+
)
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/code/GSE67066.py
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Pheochromocytoma_and_Paraganglioma"
|
6 |
+
cohort = "GSE67066"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Pheochromocytoma_and_Paraganglioma/GSE67066"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/GSE67066.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/gene_data/GSE67066.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/clinical_data/GSE67066.csv"
|
16 |
+
json_path = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/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 |
+
# The background indicates this is mRNA expression data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# Trait data (benign vs malignant) is available in row 1
|
38 |
+
trait_row = 1
|
39 |
+
|
40 |
+
def convert_trait(value: str) -> int:
|
41 |
+
if not isinstance(value, str):
|
42 |
+
return None
|
43 |
+
value = value.split(': ')[-1].lower()
|
44 |
+
if 'benign' in value:
|
45 |
+
return 0
|
46 |
+
elif 'malignant' in value:
|
47 |
+
return 1
|
48 |
+
return None
|
49 |
+
|
50 |
+
# Age and gender data not found in sample characteristics
|
51 |
+
age_row = None
|
52 |
+
gender_row = None
|
53 |
+
convert_age = None
|
54 |
+
convert_gender = None
|
55 |
+
|
56 |
+
# 3. Save metadata about data availability
|
57 |
+
validate_and_save_cohort_info(is_final=False,
|
58 |
+
cohort=cohort,
|
59 |
+
info_path=json_path,
|
60 |
+
is_gene_available=is_gene_available,
|
61 |
+
is_trait_available=trait_row is not None)
|
62 |
+
|
63 |
+
# 4. Extract clinical features
|
64 |
+
clinical_df = geo_select_clinical_features(clinical_data,
|
65 |
+
trait,
|
66 |
+
trait_row=trait_row,
|
67 |
+
convert_trait=convert_trait,
|
68 |
+
age_row=age_row,
|
69 |
+
convert_age=convert_age,
|
70 |
+
gender_row=gender_row,
|
71 |
+
convert_gender=convert_gender)
|
72 |
+
|
73 |
+
# Preview extracted features
|
74 |
+
print("Preview of clinical data:")
|
75 |
+
print(preview_df(clinical_df))
|
76 |
+
|
77 |
+
# Save clinical data
|
78 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
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 the format of the gene identifiers (e.g. "1007_s_at"), which appear to be Affymetrix probe IDs,
|
96 |
+
# we need to map these to human gene symbols
|
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 mapping between probe IDs and gene symbols
|
108 |
+
mapping_data = get_gene_mapping(gene_annotation, 'ID', 'Gene Symbol')
|
109 |
+
|
110 |
+
# Apply gene mapping to convert probe-level data to gene expression data
|
111 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
112 |
+
|
113 |
+
# Preview resulting gene expression data
|
114 |
+
print("Preview of mapped gene expression data:")
|
115 |
+
print(gene_data.head())
|
116 |
+
print("\nShape:", gene_data.shape)
|
117 |
+
|
118 |
+
# Print some gene symbols to verify mapping
|
119 |
+
print("\nFirst 20 gene symbols:")
|
120 |
+
print(list(gene_data.index)[:20])
|
121 |
+
|
122 |
+
# Get a few column names to verify sample IDs are preserved
|
123 |
+
print("\nFirst 5 column names:")
|
124 |
+
print(list(gene_data.columns)[:5])
|
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/Pheochromocytoma_and_Paraganglioma/code/TCGA.py
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Pheochromocytoma_and_Paraganglioma"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Pheochromocytoma_and_Paraganglioma/cohort_info.json"
|
15 |
+
|
16 |
+
# 1. Check for available directories for Pheochromocytoma and Paraganglioma data
|
17 |
+
all_dirs = ['CrawlData.ipynb', '.DS_Store', 'TCGA_lower_grade_glioma_and_glioblastoma_(GBMLGG)', 'TCGA_Uterine_Carcinosarcoma_(UCS)', 'TCGA_Thyroid_Cancer_(THCA)', 'TCGA_Thymoma_(THYM)', 'TCGA_Testicular_Cancer_(TGCT)', 'TCGA_Stomach_Cancer_(STAD)', 'TCGA_Sarcoma_(SARC)', 'TCGA_Rectal_Cancer_(READ)', 'TCGA_Prostate_Cancer_(PRAD)', 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)', 'TCGA_Pancreatic_Cancer_(PAAD)', 'TCGA_Ovarian_Cancer_(OV)', 'TCGA_Ocular_melanomas_(UVM)', 'TCGA_Mesothelioma_(MESO)', 'TCGA_Melanoma_(SKCM)', 'TCGA_Lung_Squamous_Cell_Carcinoma_(LUSC)', 'TCGA_Lung_Cancer_(LUNG)', 'TCGA_Lung_Adenocarcinoma_(LUAD)', 'TCGA_Lower_Grade_Glioma_(LGG)', 'TCGA_Liver_Cancer_(LIHC)', 'TCGA_Large_Bcell_Lymphoma_(DLBC)', 'TCGA_Kidney_Papillary_Cell_Carcinoma_(KIRP)', 'TCGA_Kidney_Clear_Cell_Carcinoma_(KIRC)', 'TCGA_Kidney_Chromophobe_(KICH)', 'TCGA_Head_and_Neck_Cancer_(HNSC)', 'TCGA_Glioblastoma_(GBM)', 'TCGA_Esophageal_Cancer_(ESCA)', 'TCGA_Endometrioid_Cancer_(UCEC)', 'TCGA_Colon_and_Rectal_Cancer_(COADREAD)', 'TCGA_Colon_Cancer_(COAD)', 'TCGA_Cervical_Cancer_(CESC)', 'TCGA_Breast_Cancer_(BRCA)', 'TCGA_Bladder_Cancer_(BLCA)', 'TCGA_Bile_Duct_Cancer_(CHOL)', 'TCGA_Adrenocortical_Cancer_(ACC)', 'TCGA_Acute_Myeloid_Leukemia_(LAML)']
|
18 |
+
|
19 |
+
# Select PCPG directory as exact match for Pheochromocytoma and Paraganglioma
|
20 |
+
selected_dir = 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)'
|
21 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_dir)
|
22 |
+
|
23 |
+
# Get file paths for clinical and genetic data
|
24 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
25 |
+
|
26 |
+
# Load the data files
|
27 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
28 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
29 |
+
|
30 |
+
# Print clinical columns for analysis
|
31 |
+
print("Clinical data columns:")
|
32 |
+
print(clinical_df.columns.tolist())
|
33 |
+
|
34 |
+
is_gene_available = True
|
35 |
+
is_trait_available = True
|
36 |
+
|
37 |
+
# Record the data availability
|
38 |
+
validate_and_save_cohort_info(
|
39 |
+
is_final=False,
|
40 |
+
cohort="TCGA",
|
41 |
+
info_path=json_path,
|
42 |
+
is_gene_available=is_gene_available,
|
43 |
+
is_trait_available=is_trait_available
|
44 |
+
)
|
45 |
+
# Identify candidate columns
|
46 |
+
candidate_age_cols = ['age_at_initial_pathologic_diagnosis', 'days_to_birth']
|
47 |
+
candidate_gender_cols = ['gender']
|
48 |
+
|
49 |
+
# Debug directory structure
|
50 |
+
print(f"Root dir exists: {os.path.exists(tcga_root_dir)}")
|
51 |
+
if os.path.exists(tcga_root_dir):
|
52 |
+
print("Available directories:", os.listdir(tcga_root_dir))
|
53 |
+
|
54 |
+
# Get clinical file path
|
55 |
+
cohort_dir = os.path.join(tcga_root_dir, "TCGA-PCPG")
|
56 |
+
clinical_file_path, _ = tcga_get_relevant_filepaths(cohort_dir)
|
57 |
+
|
58 |
+
# Read clinical data
|
59 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0)
|
60 |
+
|
61 |
+
# Extract and preview age columns
|
62 |
+
age_preview = clinical_df[candidate_age_cols].head()
|
63 |
+
print("\nAge columns preview:")
|
64 |
+
print(preview_df(age_preview))
|
65 |
+
|
66 |
+
# Extract and preview gender columns
|
67 |
+
gender_preview = clinical_df[candidate_gender_cols].head()
|
68 |
+
print("\nGender columns preview:")
|
69 |
+
print(preview_df(gender_preview))
|
70 |
+
# 1. Check for available directories for Pheochromocytoma and Paraganglioma data
|
71 |
+
all_dirs = ['CrawlData.ipynb', '.DS_Store', 'TCGA_lower_grade_glioma_and_glioblastoma_(GBMLGG)', 'TCGA_Uterine_Carcinosarcoma_(UCS)', 'TCGA_Thyroid_Cancer_(THCA)', 'TCGA_Thymoma_(THYM)', 'TCGA_Testicular_Cancer_(TGCT)', 'TCGA_Stomach_Cancer_(STAD)', 'TCGA_Sarcoma_(SARC)', 'TCGA_Rectal_Cancer_(READ)', 'TCGA_Prostate_Cancer_(PRAD)', 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)', 'TCGA_Pancreatic_Cancer_(PAAD)', 'TCGA_Ovarian_Cancer_(OV)', 'TCGA_Ocular_melanomas_(UVM)', 'TCGA_Mesothelioma_(MESO)', 'TCGA_Melanoma_(SKCM)', 'TCGA_Lung_Squamous_Cell_Carcinoma_(LUSC)', 'TCGA_Lung_Cancer_(LUNG)', 'TCGA_Lung_Adenocarcinoma_(LUAD)', 'TCGA_Lower_Grade_Glioma_(LGG)', 'TCGA_Liver_Cancer_(LIHC)', 'TCGA_Large_Bcell_Lymphoma_(DLBC)', 'TCGA_Kidney_Papillary_Cell_Carcinoma_(KIRP)', 'TCGA_Kidney_Clear_Cell_Carcinoma_(KIRC)', 'TCGA_Kidney_Chromophobe_(KICH)', 'TCGA_Head_and_Neck_Cancer_(HNSC)', 'TCGA_Glioblastoma_(GBM)', 'TCGA_Esophageal_Cancer_(ESCA)', 'TCGA_Endometrioid_Cancer_(UCEC)', 'TCGA_Colon_and_Rectal_Cancer_(COADREAD)', 'TCGA_Colon_Cancer_(COAD)', 'TCGA_Cervical_Cancer_(CESC)', 'TCGA_Breast_Cancer_(BRCA)', 'TCGA_Bladder_Cancer_(BLCA)', 'TCGA_Bile_Duct_Cancer_(CHOL)', 'TCGA_Adrenocortical_Cancer_(ACC)', 'TCGA_Acute_Myeloid_Leukemia_(LAML)']
|
72 |
+
|
73 |
+
# Select PCPG directory as exact match for Pheochromocytoma and Paraganglioma
|
74 |
+
selected_dir = 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)'
|
75 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_dir)
|
76 |
+
|
77 |
+
# Get file paths for clinical and genetic data
|
78 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
79 |
+
|
80 |
+
# Load the data files
|
81 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
82 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
83 |
+
|
84 |
+
# Print clinical columns for analysis
|
85 |
+
print("Clinical data columns:")
|
86 |
+
print(clinical_df.columns.tolist())
|
87 |
+
|
88 |
+
is_gene_available = True
|
89 |
+
is_trait_available = True
|
90 |
+
|
91 |
+
# Record the data availability
|
92 |
+
validate_and_save_cohort_info(
|
93 |
+
is_final=False,
|
94 |
+
cohort="TCGA",
|
95 |
+
info_path=json_path,
|
96 |
+
is_gene_available=is_gene_available,
|
97 |
+
is_trait_available=is_trait_available
|
98 |
+
)
|
99 |
+
# Set age and gender column variables based on known column names
|
100 |
+
age_col = "age_at_initial_pathologic_diagnosis"
|
101 |
+
gender_col = "gender"
|
102 |
+
|
103 |
+
# Print chosen columns
|
104 |
+
print(f"Chosen age column: {age_col}")
|
105 |
+
print(f"Chosen gender column: {gender_col}")
|
106 |
+
# 1. Extract and standardize clinical features
|
107 |
+
selected_clinical_df = tcga_select_clinical_features(clinical_df, trait, age_col, gender_col)
|
108 |
+
|
109 |
+
# 2. Normalize gene symbols in genetic data
|
110 |
+
normalized_genetic_df = normalize_gene_symbols_in_index(genetic_df)
|
111 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
112 |
+
normalized_genetic_df.to_csv(out_gene_data_file)
|
113 |
+
|
114 |
+
# 3. Link clinical and genetic data
|
115 |
+
linked_data = pd.merge(selected_clinical_df, normalized_genetic_df.T, left_index=True, right_index=True)
|
116 |
+
|
117 |
+
# 4. Handle missing values
|
118 |
+
linked_data = handle_missing_values(linked_data, trait)
|
119 |
+
|
120 |
+
# 5. Check for bias in trait and demographic features
|
121 |
+
is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
122 |
+
|
123 |
+
# 6. Validate and save cohort info
|
124 |
+
note = f"Sample size after preprocessing: {len(linked_data)}. Number of genes: {len(linked_data.columns) - 3}"
|
125 |
+
is_usable = validate_and_save_cohort_info(
|
126 |
+
is_final=True,
|
127 |
+
cohort="TCGA",
|
128 |
+
info_path=json_path,
|
129 |
+
is_gene_available=True,
|
130 |
+
is_trait_available=True,
|
131 |
+
is_biased=is_biased,
|
132 |
+
df=linked_data,
|
133 |
+
note=note
|
134 |
+
)
|
135 |
+
|
136 |
+
# 7. Save linked data if usable
|
137 |
+
if is_usable:
|
138 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
139 |
+
linked_data.to_csv(out_data_file)
|
140 |
+
print(f"Linked data saved to {out_data_file}")
|
141 |
+
print("Shape of final linked data:", linked_data.shape)
|
142 |
+
else:
|
143 |
+
print("Dataset was found to be unusable and was not saved")
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE67066": {"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": 51, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "GSE64957": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "Gene expression data from Affymetrix array with disease status (pheochromocytoma vs Conn's syndrome)"}, "GSE39716": {"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": 53, "note": "Contains gene expression data with metabolic rate (inferred from multicentric occurrence-free survival days) measurements"}, "GSE33371": {"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": 65, "note": "Dataset contains gene expression data from adrenal tissue samples, with cases identified by presence of pheochromocytoma"}, "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": "Dataset contains gene expression data from adrenal tissue samples, with cases identified by presence of pheochromocytoma"}, "GSE19422": {"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": 90, "note": "Dataset contains gene expression data from adrenal tissue samples, with cases identified by presence of pheochromocytoma"}, "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/Pheochromocytoma_and_Paraganglioma/gene_data/GSE19987.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Pheochromocytoma_and_Paraganglioma/gene_data/GSE64957.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM1584943,GSM1584944,GSM1584945,GSM1584946,GSM1584947,GSM1584948,GSM1584949,GSM1584950,GSM1584951,GSM1584952,GSM1584953,GSM1584954,GSM1584955,GSM1584956,GSM1584957,GSM1584958,GSM1584959,GSM1584960,GSM1584961,GSM1584962,GSM1584963,GSM1584964,GSM1584965,GSM1584966,GSM1584967,GSM1584968,GSM1584969,GSM1584970,GSM1584971,GSM1584972,GSM1584973,GSM1584974,GSM1584975,GSM1584976,GSM1584977,GSM1584978,GSM1584979,GSM1584980,GSM1584981,GSM1584982,GSM1584983,GSM1584984,GSM1584985,GSM1584986,GSM1584987,GSM1584988,GSM1584989,GSM1584990,GSM1584991,GSM1584992,GSM1584993,GSM1584994,GSM1584995,GSM1584996,GSM1584997
|