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 +1 -0
- p3/preprocess/Kidney_Clear_Cell_Carcinoma/GSE119958.csv +3 -0
- p3/preprocess/Psoriatic_Arthritis/GSE141934.csv +0 -0
- p3/preprocess/Psoriatic_Arthritis/GSE57376.csv +0 -0
- p3/preprocess/Psoriatic_Arthritis/GSE57383.csv +0 -0
- p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE141934.csv +4 -0
- p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE142049.csv +4 -0
- p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE57376.csv +4 -0
- p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE57383.csv +4 -0
- p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE57386.csv +4 -0
- p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE57405.csv +4 -0
- p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE61281.csv +3 -0
- p3/preprocess/Psoriatic_Arthritis/code/GSE141934.py +175 -0
- p3/preprocess/Psoriatic_Arthritis/code/GSE142049.py +168 -0
- p3/preprocess/Psoriatic_Arthritis/code/GSE57376.py +171 -0
- p3/preprocess/Psoriatic_Arthritis/code/GSE57383.py +171 -0
- p3/preprocess/Psoriatic_Arthritis/code/GSE57386.py +180 -0
- p3/preprocess/Psoriatic_Arthritis/code/GSE57405.py +171 -0
- p3/preprocess/Psoriatic_Arthritis/code/GSE61281.py +159 -0
- p3/preprocess/Psoriatic_Arthritis/code/TCGA.py +30 -0
- p3/preprocess/Psoriatic_Arthritis/cohort_info.json +1 -0
- p3/preprocess/Psoriatic_Arthritis/gene_data/GSE141934.csv +0 -0
- p3/preprocess/Psoriatic_Arthritis/gene_data/GSE57376.csv +0 -0
- p3/preprocess/Rectal_Cancer/GSE119409.csv +0 -0
- p3/preprocess/Rectal_Cancer/GSE133057.csv +0 -0
- p3/preprocess/Rectal_Cancer/GSE139255.csv +0 -0
- p3/preprocess/Rectal_Cancer/GSE145037.csv +0 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE109057.csv +4 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE119409.csv +3 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE123390.csv +2 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE133057.csv +4 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE139255.csv +2 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE145037.csv +4 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE150082.csv +4 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE170999.csv +2 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE40492.csv +4 -0
- p3/preprocess/Rectal_Cancer/clinical_data/GSE94104.csv +2 -0
- p3/preprocess/Rectal_Cancer/code/GSE109057.py +164 -0
- p3/preprocess/Rectal_Cancer/code/GSE119409.py +168 -0
- p3/preprocess/Rectal_Cancer/code/GSE123390.py +159 -0
- p3/preprocess/Rectal_Cancer/code/GSE133057.py +173 -0
- p3/preprocess/Rectal_Cancer/code/GSE139255.py +131 -0
- p3/preprocess/Rectal_Cancer/code/GSE145037.py +137 -0
- p3/preprocess/Rectal_Cancer/code/GSE150082.py +157 -0
- p3/preprocess/Rectal_Cancer/code/GSE170999.py +160 -0
- p3/preprocess/Rectal_Cancer/code/GSE40492.py +176 -0
- p3/preprocess/Rectal_Cancer/code/GSE94104.py +156 -0
- p3/preprocess/Rectal_Cancer/code/TCGA.py +169 -0
- p3/preprocess/Rectal_Cancer/cohort_info.json +1 -0
- p3/preprocess/Rectal_Cancer/gene_data/GSE119409.csv +0 -0
.gitattributes
CHANGED
@@ -1881,3 +1881,4 @@ p3/preprocess/Kidney_Papillary_Cell_Carcinoma/GSE42977.csv filter=lfs diff=lfs m
|
|
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
|
1883 |
p3/preprocess/Hypertrophic_Cardiomyopathy/GSE36961.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
|
1883 |
p3/preprocess/Hypertrophic_Cardiomyopathy/GSE36961.csv filter=lfs diff=lfs merge=lfs -text
|
1884 |
+
p3/preprocess/Kidney_Clear_Cell_Carcinoma/GSE119958.csv filter=lfs diff=lfs merge=lfs -text
|
p3/preprocess/Kidney_Clear_Cell_Carcinoma/GSE119958.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:495273f71b22fa5f60afa2aa5df0ac8adbe6b2f4107db24a2bee1e129b056abf
|
3 |
+
size 31118015
|
p3/preprocess/Psoriatic_Arthritis/GSE141934.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Psoriatic_Arthritis/GSE57376.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Psoriatic_Arthritis/GSE57383.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE141934.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM4216498,GSM4216499,GSM4216500,GSM4216501,GSM4216502,GSM4216503,GSM4216504,GSM4216505,GSM4216506,GSM4216507,GSM4216508,GSM4216509,GSM4216510,GSM4216511,GSM4216512,GSM4216513,GSM4216514,GSM4216515,GSM4216516,GSM4216517,GSM4216518,GSM4216519,GSM4216520,GSM4216521,GSM4216522,GSM4216523,GSM4216524,GSM4216525,GSM4216526,GSM4216527,GSM4216528,GSM4216529,GSM4216530,GSM4216531,GSM4216532,GSM4216533,GSM4216534,GSM4216535,GSM4216536,GSM4216537,GSM4216538,GSM4216539,GSM4216540,GSM4216541,GSM4216542,GSM4216543,GSM4216544,GSM4216545,GSM4216546,GSM4216547,GSM4216548,GSM4216549,GSM4216550,GSM4216551,GSM4216552,GSM4216553,GSM4216554,GSM4216555,GSM4216556,GSM4216557,GSM4216558,GSM4216559,GSM4216560,GSM4216561,GSM4216562,GSM4216563,GSM4216564,GSM4216565,GSM4216566,GSM4216567,GSM4216568,GSM4216569,GSM4216570,GSM4216571,GSM4216572,GSM4216573,GSM4216574,GSM4216575,GSM4216576,GSM4216577,GSM4216578,GSM4216579,GSM4216580,GSM4216581,GSM4216582,GSM4216583,GSM4216584,GSM4216585,GSM4216586,GSM4216587,GSM4216588,GSM4216589,GSM4216590,GSM4216591,GSM4216592,GSM4216593,GSM4216594,GSM4216595,GSM4216596,GSM4216597
|
2 |
+
Psoriatic_Arthritis,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0
|
3 |
+
Age,50.0,43.0,66.0,55.0,52.0,54.0,63.0,61.0,58.0,79.0,69.0,57.0,46.0,44.0,46.0,63.0,59.0,81.0,60.0,92.0,45.0,47.0,27.0,58.0,57.0,38.0,45.0,51.0,70.0,57.0,56.0,56.0,51.0,50.0,53.0,61.0,66.0,74.0,51.0,46.0,49.0,56.0,58.0,60.0,50.0,50.0,31.0,70.0,52.0,65.0,69.0,73.0,50.0,58.0,27.0,68.0,22.0,39.0,52.0,35.0,69.0,70.0,74.0,38.0,80.0,51.0,56.0,68.0,50.0,74.0,45.0,65.0,53.0,57.0,73.0,74.0,53.0,67.0,49.0,27.0,54.0,26.0,56.0,30.0,50.0,69.0,79.0,61.0,63.0,77.0,48.0,61.0,43.0,54.0,62.0,20.0,62.0,50.0,60.0,69.0
|
4 |
+
Gender,0.0,0.0,0.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,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,0.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,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,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,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE142049.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM4218229,GSM4218230,GSM4218231,GSM4218232,GSM4218233,GSM4218234,GSM4218235,GSM4218236,GSM4218237,GSM4218238,GSM4218239,GSM4218240,GSM4218241,GSM4218242,GSM4218243,GSM4218244,GSM4218245,GSM4218246,GSM4218247,GSM4218248,GSM4218249,GSM4218250,GSM4218251,GSM4218252,GSM4218253,GSM4218254,GSM4218255,GSM4218256,GSM4218257,GSM4218258,GSM4218259,GSM4218260,GSM4218261,GSM4218262,GSM4218263,GSM4218264,GSM4218265,GSM4218266,GSM4218267,GSM4218268,GSM4218269,GSM4218270,GSM4218271,GSM4218272,GSM4218273,GSM4218274,GSM4218275,GSM4218276,GSM4218277,GSM4218278,GSM4218279,GSM4218280,GSM4218281,GSM4218282,GSM4218283,GSM4218284,GSM4218285,GSM4218286,GSM4218287,GSM4218288,GSM4218289,GSM4218290,GSM4218291,GSM4218292,GSM4218293,GSM4218294,GSM4218295,GSM4218296,GSM4218297,GSM4218298,GSM4218299,GSM4218300,GSM4218301,GSM4218302,GSM4218303,GSM4218304,GSM4218305,GSM4218306,GSM4218307,GSM4218308,GSM4218309,GSM4218310,GSM4218311,GSM4218312,GSM4218313,GSM4218314,GSM4218315,GSM4218316,GSM4218317,GSM4218318,GSM4218319,GSM4218320,GSM4218321,GSM4218322,GSM4218323,GSM4218324,GSM4218325,GSM4218326,GSM4218327,GSM4218328,GSM4218329,GSM4218330,GSM4218331,GSM4218332,GSM4218333,GSM4218334,GSM4218335,GSM4218336,GSM4218337,GSM4218338,GSM4218339,GSM4218340,GSM4218341,GSM4218342
|
2 |
+
Psoriatic_Arthritis,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.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,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,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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0
|
3 |
+
Age,82.0,29.0,61.0,56.0,55.0,72.0,50.0,22.0,61.0,53.0,54.0,20.0,49.0,61.0,53.0,59.0,56.0,57.0,55.0,56.0,35.0,58.0,69.0,46.0,57.0,50.0,66.0,52.0,63.0,51.0,50.0,66.0,58.0,60.0,92.0,65.0,60.0,57.0,73.0,43.0,55.0,46.0,54.0,63.0,61.0,56.0,67.0,27.0,73.0,32.0,54.0,61.0,22.0,52.0,51.0,53.0,70.0,56.0,40.0,59.0,62.0,32.0,82.0,45.0,69.0,57.0,79.0,65.0,68.0,43.0,57.0,81.0,50.0,57.0,45.0,47.0,70.0,74.0,26.0,38.0,74.0,45.0,50.0,51.0,53.0,69.0,71.0,82.0,39.0,51.0,43.0,69.0,79.0,52.0,53.0,38.0,41.0,50.0,77.0,62.0,50.0,54.0,43.0,62.0,70.0,68.0,63.0,56.0,74.0,46.0,44.0,56.0,68.0,57.0
|
4 |
+
Gender,1.0,1.0,0.0,1.0,0.0,1.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,1.0,0.0,0.0,0.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,1.0,1.0,0.0,1.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,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE57376.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1381406,GSM1381407,GSM1381408,GSM1381409,GSM1381410,GSM1381411,GSM1381412,GSM1381413,GSM1381414,GSM1381415,GSM1381416,GSM1381417,GSM1381418,GSM1381419,GSM1381420,GSM1381422,GSM1381423,GSM1381424,GSM1381425,GSM1381426,GSM1381427,GSM1381428,GSM1381429,GSM1381430,GSM1381431,GSM1381432,GSM1381433,GSM1381434,GSM1381435,GSM1381436,GSM1381437,GSM1381438
|
2 |
+
Psoriatic_Arthritis,0.0,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,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
|
3 |
+
Age,51.0,28.0,46.0,57.0,61.0,35.0,28.0,19.0,28.0,61.0,57.0,35.0,19.0,67.0,38.0,55.0,39.0,55.0,19.0,61.0,28.0,35.0,57.0,51.0,28.0,28.0,46.0,44.0,67.0,52.0,39.0,55.0
|
4 |
+
Gender,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0
|
p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE57383.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1381524,GSM1381525,GSM1381526,GSM1381527,GSM1381528,GSM1381529,GSM1381530,GSM1381531,GSM1381532,GSM1381533,GSM1381534,GSM1381535,GSM1381536,GSM1381537,GSM1381538,GSM1381539,GSM1381540,GSM1381541,GSM1381542,GSM1381543,GSM1381544,GSM1381545,GSM1381546,GSM1381547,GSM1381548,GSM1381549,GSM1381550,GSM1381551,GSM1381552,GSM1381553,GSM1381554,GSM1381555,GSM1381556,GSM1381557,GSM1381558,GSM1381559,GSM1381560,GSM1381561,GSM1381562,GSM1381563,GSM1381564,GSM1381565,GSM1381566,GSM1381567,GSM1381568,GSM1381569,GSM1381570,GSM1381571,GSM1381572,GSM1381573,GSM1381574,GSM1381575,GSM1381576,GSM1381577,GSM1381578,GSM1381579,GSM1381580,GSM1381581,GSM1381582,GSM1381583,GSM1381584,GSM1381585,GSM1381586,GSM1381587,GSM1381588,GSM1381589,GSM1381590,GSM1381591,GSM1381592,GSM1381593,GSM1381594,GSM1381595,GSM1381596,GSM1381597,GSM1381598,GSM1381599,GSM1381600,GSM1381601,GSM1381602,GSM1381603,GSM1381604,GSM1381605,GSM1381606,GSM1381607,GSM1381608,GSM1381609,GSM1381610,GSM1381611,GSM1381612,GSM1381613,GSM1381614,GSM1381615,GSM1381616,GSM1381617,GSM1381618,GSM1381619,GSM1381620,GSM1381621,GSM1381622,GSM1381623,GSM1381624,GSM1381625,GSM1381626,GSM1381627,GSM1381628,GSM1381629,GSM1381630,GSM1381631,GSM1381632,GSM1381633,GSM1381634,GSM1381635
|
2 |
+
Psoriatic_Arthritis,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,1.0,1.0,1.0,1.0,1.0,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
3 |
+
Age,40.0,40.0,54.0,36.0,23.0,42.0,24.0,23.0,62.0,46.0,56.0,32.0,47.0,60.0,44.0,46.0,36.0,64.0,23.0,19.0,24.0,46.0,61.0,57.0,57.0,35.0,53.0,59.0,53.0,44.0,59.0,19.0,44.0,44.0,61.0,57.0,46.0,24.0,28.0,28.0,28.0,24.0,35.0,53.0,61.0,59.0,46.0,19.0,35.0,39.0,38.0,52.0,52.0,70.0,39.0,60.0,38.0,58.0,68.0,70.0,39.0,60.0,38.0,67.0,31.0,39.0,44.0,39.0,39.0,58.0,60.0,52.0,58.0,70.0,67.0,31.0,31.0,55.0,68.0,55.0,44.0,44.0,67.0,55.0,68.0,28.0,50.0,28.0,28.0,45.0,50.0,51.0,50.0,51.0,62.0,66.0,46.0,45.0,58.0,62.0,58.0,51.0,51.0,66.0,58.0,51.0,46.0,45.0,66.0,46.0,51.0,62.0
|
4 |
+
Gender,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.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,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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0
|
p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE57386.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1381406,GSM1381407,GSM1381408,GSM1381409,GSM1381410,GSM1381411,GSM1381412,GSM1381413,GSM1381414,GSM1381415,GSM1381416,GSM1381417,GSM1381418,GSM1381419,GSM1381420,GSM1381422,GSM1381423,GSM1381424,GSM1381425,GSM1381426,GSM1381427,GSM1381428,GSM1381429,GSM1381430,GSM1381431,GSM1381432,GSM1381433,GSM1381434,GSM1381435,GSM1381436,GSM1381437,GSM1381438,GSM1381524,GSM1381525,GSM1381526,GSM1381527,GSM1381528,GSM1381529,GSM1381530,GSM1381531,GSM1381532,GSM1381533,GSM1381534,GSM1381535,GSM1381536,GSM1381537,GSM1381538,GSM1381539,GSM1381540,GSM1381541,GSM1381542,GSM1381543,GSM1381544,GSM1381545,GSM1381546,GSM1381547,GSM1381548,GSM1381549,GSM1381550,GSM1381551,GSM1381552,GSM1381553,GSM1381554,GSM1381555,GSM1381556,GSM1381557,GSM1381558,GSM1381559,GSM1381560,GSM1381561,GSM1381562,GSM1381563,GSM1381564,GSM1381565,GSM1381566,GSM1381567,GSM1381568,GSM1381569,GSM1381570,GSM1381571,GSM1381572,GSM1381573,GSM1381574,GSM1381575,GSM1381576,GSM1381577,GSM1381578,GSM1381579,GSM1381580,GSM1381581,GSM1381582,GSM1381583,GSM1381584,GSM1381585,GSM1381586,GSM1381587,GSM1381588,GSM1381589,GSM1381590,GSM1381591,GSM1381592,GSM1381593,GSM1381594,GSM1381595,GSM1381596,GSM1381597,GSM1381598,GSM1381599,GSM1381600,GSM1381601,GSM1381602,GSM1381603,GSM1381604,GSM1381605,GSM1381606,GSM1381607,GSM1381608,GSM1381609,GSM1381610,GSM1381611,GSM1381612,GSM1381613,GSM1381614,GSM1381615,GSM1381616,GSM1381617,GSM1381618,GSM1381619,GSM1381620,GSM1381621,GSM1381622,GSM1381623,GSM1381624,GSM1381625,GSM1381626,GSM1381627,GSM1381628,GSM1381629,GSM1381630,GSM1381631,GSM1381632,GSM1381633,GSM1381634,GSM1381635,GSM1382105,GSM1382106,GSM1382107,GSM1382108,GSM1382109,GSM1382110,GSM1382111,GSM1382112,GSM1382113,GSM1382114,GSM1382115,GSM1382116,GSM1382117,GSM1382118,GSM1382119,GSM1382120,GSM1382121,GSM1382122,GSM1382123,GSM1382124,GSM1382125,GSM1382126,GSM1382127,GSM1382128,GSM1382129,GSM1382130,GSM1382131,GSM1382132,GSM1382133,GSM1382134,GSM1382135,GSM1382136,GSM1382137,GSM1382138,GSM1382139,GSM1382140,GSM1382141,GSM1382142,GSM1382143,GSM1382144,GSM1382145,GSM1382146,GSM1382147,GSM1382148,GSM1382149,GSM1382150,GSM1382151,GSM1382152,GSM1382153,GSM1382154,GSM1382155,GSM1382156,GSM1382157,GSM1382158,GSM1382159,GSM1382160,GSM1382161,GSM1382162,GSM1382163,GSM1382164,GSM1382165,GSM1382166,GSM1382167,GSM1382168,GSM1382169,GSM1382170,GSM1382171,GSM1382172,GSM1382173,GSM1382174,GSM1382175,GSM1382176,GSM1382177,GSM1382178,GSM1382179,GSM1382180,GSM1382181,GSM1382182,GSM1382183,GSM1382184,GSM1382185,GSM1382186,GSM1382187,GSM1382188,GSM1382189,GSM1382190,GSM1382191,GSM1382192,GSM1382193,GSM1382194,GSM1382195,GSM1382196,GSM1382197,GSM1382198,GSM1382199,GSM1382200,GSM1382201,GSM1382202,GSM1382203,GSM1382204,GSM1382205,GSM1382206,GSM1382207,GSM1382208,GSM1382209,GSM1382210,GSM1382211,GSM1382212,GSM1382213,GSM1382214,GSM1382215
|
2 |
+
Psoriatic_Arthritis,0.0,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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,1.0,1.0,1.0,1.0
|
3 |
+
Age,51.0,28.0,46.0,57.0,61.0,35.0,28.0,19.0,28.0,61.0,57.0,35.0,19.0,67.0,38.0,55.0,39.0,55.0,19.0,61.0,28.0,35.0,57.0,51.0,28.0,28.0,46.0,44.0,67.0,52.0,39.0,55.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,54.0,40.0,64.0,23.0,60.0,32.0,46.0,24.0,23.0,62.0,42.0,36.0,36.0,40.0,44.0,23.0,56.0,46.0,47.0,50.0,51.0,62.0,51.0,46.0,66.0,28.0,58.0,45.0,66.0,51.0,46.0,50.0,28.0,45.0,58.0,62.0,51.0,46.0,51.0,51.0,45.0,58.0,28.0,66.0,62.0,50.0,46.0,19.0,59.0,44.0,57.0,53.0,24.0,28.0,35.0,61.0,61.0,44.0,35.0,57.0,59.0,19.0,28.0,53.0,24.0,46.0,53.0,24.0,57.0,46.0,61.0,59.0,44.0,35.0,19.0,28.0,39.0,55.0,38.0,60.0,52.0,44.0,67.0,68.0,39.0,58.0,70.0,31.0,39.0,31.0,58.0,67.0,39.0,55.0,38.0,68.0,60.0,52.0,44.0,70.0,60.0,55.0,52.0,67.0,68.0,38.0,70.0,44.0,31.0,58.0,39.0
|
4 |
+
Gender,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.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,0.0,1.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,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.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,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.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,1.0
|
p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE57405.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1382105,GSM1382106,GSM1382107,GSM1382108,GSM1382109,GSM1382110,GSM1382111,GSM1382112,GSM1382113,GSM1382114,GSM1382115,GSM1382116,GSM1382117,GSM1382118,GSM1382119,GSM1382120,GSM1382121,GSM1382122,GSM1382123,GSM1382124,GSM1382125,GSM1382126,GSM1382127,GSM1382128,GSM1382129,GSM1382130,GSM1382131,GSM1382132,GSM1382133,GSM1382134,GSM1382135,GSM1382136,GSM1382137,GSM1382138,GSM1382139,GSM1382140,GSM1382141,GSM1382142,GSM1382143,GSM1382144,GSM1382145,GSM1382146,GSM1382147,GSM1382148,GSM1382149,GSM1382150,GSM1382151,GSM1382152,GSM1382153,GSM1382154,GSM1382155,GSM1382156,GSM1382157,GSM1382158,GSM1382159,GSM1382160,GSM1382161,GSM1382162,GSM1382163,GSM1382164,GSM1382165,GSM1382166,GSM1382167,GSM1382168,GSM1382169,GSM1382170,GSM1382171,GSM1382172,GSM1382173,GSM1382174,GSM1382175,GSM1382176,GSM1382177,GSM1382178,GSM1382179,GSM1382180,GSM1382181,GSM1382182,GSM1382183,GSM1382184,GSM1382185,GSM1382186,GSM1382187,GSM1382188,GSM1382189,GSM1382190,GSM1382191,GSM1382192,GSM1382193,GSM1382194,GSM1382195,GSM1382196,GSM1382197,GSM1382198,GSM1382199,GSM1382200,GSM1382201,GSM1382202,GSM1382203,GSM1382204,GSM1382205,GSM1382206,GSM1382207,GSM1382208,GSM1382209,GSM1382210,GSM1382211,GSM1382212,GSM1382213,GSM1382214,GSM1382215
|
2 |
+
Psoriatic_Arthritis,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,1.0,1.0,1.0,1.0
|
3 |
+
Age,54.0,40.0,64.0,23.0,60.0,32.0,46.0,24.0,23.0,62.0,42.0,36.0,36.0,40.0,44.0,23.0,56.0,46.0,47.0,50.0,51.0,62.0,51.0,46.0,66.0,28.0,58.0,45.0,66.0,51.0,46.0,50.0,28.0,45.0,58.0,62.0,51.0,46.0,51.0,51.0,45.0,58.0,28.0,66.0,62.0,50.0,46.0,19.0,59.0,44.0,57.0,53.0,24.0,28.0,35.0,61.0,61.0,44.0,35.0,57.0,59.0,19.0,28.0,53.0,24.0,46.0,53.0,24.0,57.0,46.0,61.0,59.0,44.0,35.0,19.0,28.0,39.0,55.0,38.0,60.0,52.0,44.0,67.0,68.0,39.0,58.0,70.0,31.0,39.0,31.0,58.0,67.0,39.0,55.0,38.0,68.0,60.0,52.0,44.0,70.0,60.0,55.0,52.0,67.0,68.0,38.0,70.0,44.0,31.0,58.0,39.0
|
4 |
+
Gender,1.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.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,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.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,1.0
|
p3/preprocess/Psoriatic_Arthritis/clinical_data/GSE61281.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
,GSM1501512,GSM1501513,GSM1501514,GSM1501515,GSM1501516,GSM1501517,GSM1501518,GSM1501519,GSM1501520,GSM1501521,GSM1501522,GSM1501523,GSM1501524,GSM1501525,GSM1501526,GSM1501527,GSM1501528,GSM1501529,GSM1501530,GSM1501531,GSM1501532,GSM1501533,GSM1501534,GSM1501535,GSM1501536,GSM1501537,GSM1501538,GSM1501539,GSM1501540,GSM1501541,GSM1501542,GSM1501543,GSM1501544,GSM1501545,GSM1501546,GSM1501547,GSM1501548,GSM1501549,GSM1501550,GSM1501551,GSM1501552,GSM1501553,GSM1501554,GSM1501555,GSM1501556,GSM1501557,GSM1501558,GSM1501559,GSM1501560,GSM1501561,GSM1501562,GSM1501563
|
2 |
+
Psoriatic_Arthritis,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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
|
3 |
+
Gender,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,1.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,0.0,1.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,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0
|
p3/preprocess/Psoriatic_Arthritis/code/GSE141934.py
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Psoriatic_Arthritis"
|
6 |
+
cohort = "GSE141934"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Psoriatic_Arthritis"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Psoriatic_Arthritis/GSE141934"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Psoriatic_Arthritis/GSE141934.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Psoriatic_Arthritis/gene_data/GSE141934.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Psoriatic_Arthritis/clinical_data/GSE141934.csv"
|
16 |
+
json_path = "./output/preprocess/3/Psoriatic_Arthritis/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 T cell transcriptional data according to background, so gene expression data is available
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Data Row Identification
|
38 |
+
trait_row = 6 # working_diagnosis contains Psoriatic Arthritis
|
39 |
+
age_row = 2 # Age data available
|
40 |
+
gender_row = 1 # Gender data available
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion Functions
|
43 |
+
def convert_trait(value: str) -> int:
|
44 |
+
# Binary: 1 for Psoriatic Arthritis, 0 for others
|
45 |
+
if not value or ':' not in value:
|
46 |
+
return None
|
47 |
+
diagnosis = value.split(': ')[1].strip()
|
48 |
+
if diagnosis == 'Psoriatic Arthritis':
|
49 |
+
return 1
|
50 |
+
elif diagnosis in ['Rheumatoid Arthritis', 'Reactive Arthritis', 'Crystal Arthritis',
|
51 |
+
'Osteoarthritis', 'Non-Inflammatory', 'Undifferentiated Inflammatory Arthritis',
|
52 |
+
'Other Inflammatory Arthritis', 'Enteropathic Arthritis',
|
53 |
+
'Undifferentiated Spondylo-Arthropathy', 'Unknown']:
|
54 |
+
return 0
|
55 |
+
return None
|
56 |
+
|
57 |
+
def convert_age(value: str) -> float:
|
58 |
+
# Continuous
|
59 |
+
if not value or ':' not in value:
|
60 |
+
return None
|
61 |
+
try:
|
62 |
+
return float(value.split(': ')[1])
|
63 |
+
except:
|
64 |
+
return None
|
65 |
+
|
66 |
+
def convert_gender(value: str) -> int:
|
67 |
+
# Binary: 0 for female, 1 for male
|
68 |
+
if not value or ':' not in value:
|
69 |
+
return None
|
70 |
+
gender = value.split(': ')[1].strip()
|
71 |
+
if gender == 'F':
|
72 |
+
return 0
|
73 |
+
elif gender == 'M':
|
74 |
+
return 1
|
75 |
+
return None
|
76 |
+
|
77 |
+
# 3. Initial Validation
|
78 |
+
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=trait_row is not None)
|
83 |
+
|
84 |
+
# 4. Clinical Feature Extraction
|
85 |
+
if trait_row is not None:
|
86 |
+
clinical_features = 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 data
|
98 |
+
preview = preview_df(clinical_features)
|
99 |
+
print("Preview of clinical features:")
|
100 |
+
print(preview)
|
101 |
+
|
102 |
+
# Save to CSV
|
103 |
+
clinical_features.to_csv(out_clinical_data_file)
|
104 |
+
# Get gene expression data from matrix file
|
105 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
106 |
+
|
107 |
+
# Examine data structure
|
108 |
+
print("Data structure and head:")
|
109 |
+
print(genetic_data.head())
|
110 |
+
|
111 |
+
print("\nShape:", genetic_data.shape)
|
112 |
+
|
113 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
114 |
+
print(list(genetic_data.index)[:20])
|
115 |
+
|
116 |
+
# Get a few column names to verify sample IDs
|
117 |
+
print("\nFirst 5 column names:")
|
118 |
+
print(list(genetic_data.columns)[:5])
|
119 |
+
# The identifiers start with "ILMN_", indicating these are Illumina probe IDs
|
120 |
+
# We need to map these probe IDs to human gene symbols for analysis
|
121 |
+
requires_gene_mapping = True
|
122 |
+
# Extract gene annotation data
|
123 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
124 |
+
|
125 |
+
# Display column names and preview data
|
126 |
+
print("Column names:")
|
127 |
+
print(gene_annotation.columns)
|
128 |
+
|
129 |
+
print("\nPreview of gene annotation data:")
|
130 |
+
print(preview_df(gene_annotation))
|
131 |
+
# Get gene mapping data - 'ID' is probe ID, 'Symbol' is gene symbol
|
132 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
|
133 |
+
|
134 |
+
# Apply gene mapping to convert probe-level measurements to gene expression
|
135 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
136 |
+
|
137 |
+
# Print dimensions after mapping
|
138 |
+
print("\nShape after mapping:", gene_data.shape)
|
139 |
+
|
140 |
+
# Preview first few gene symbols
|
141 |
+
print("\nFirst few genes:")
|
142 |
+
print(list(gene_data.index)[:10])
|
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 = "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."
|
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/Psoriatic_Arthritis/code/GSE142049.py
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Psoriatic_Arthritis"
|
6 |
+
cohort = "GSE142049"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Psoriatic_Arthritis"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Psoriatic_Arthritis/GSE142049"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Psoriatic_Arthritis/GSE142049.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Psoriatic_Arthritis/gene_data/GSE142049.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Psoriatic_Arthritis/clinical_data/GSE142049.csv"
|
16 |
+
json_path = "./output/preprocess/3/Psoriatic_Arthritis/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 has transcriptional data from B cells, which indicates gene expression data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Data Type Conversion Functions
|
37 |
+
def convert_trait(x):
|
38 |
+
if x is None or ':' not in x:
|
39 |
+
return None
|
40 |
+
# Extract diagnosis after colon
|
41 |
+
diagnosis = x.split(': ')[1].strip()
|
42 |
+
# Binary classification: Psoriatic Arthritis vs others
|
43 |
+
return 1 if diagnosis == 'Psoriatic Arthritis' else 0
|
44 |
+
|
45 |
+
def convert_age(x):
|
46 |
+
if x is None or ':' not in x:
|
47 |
+
return None
|
48 |
+
try:
|
49 |
+
# Extract age value after colon and convert to float
|
50 |
+
return float(x.split(': ')[1])
|
51 |
+
except:
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_gender(x):
|
55 |
+
if x is None or ':' not in x:
|
56 |
+
return None
|
57 |
+
gender = x.split(': ')[1].strip()
|
58 |
+
# Convert to binary: Female=0, Male=1
|
59 |
+
if gender == 'F':
|
60 |
+
return 0
|
61 |
+
elif gender == 'M':
|
62 |
+
return 1
|
63 |
+
return None
|
64 |
+
|
65 |
+
# Identify row indices for variables
|
66 |
+
trait_row = 6 # working_diagnosis contains trait info
|
67 |
+
age_row = 2 # age is available
|
68 |
+
gender_row = 1 # gender is available
|
69 |
+
|
70 |
+
# 3. Save initial metadata
|
71 |
+
is_trait_available = trait_row is not None
|
72 |
+
is_usable = validate_and_save_cohort_info(
|
73 |
+
is_final=False,
|
74 |
+
cohort=cohort,
|
75 |
+
info_path=json_path,
|
76 |
+
is_gene_available=is_gene_available,
|
77 |
+
is_trait_available=is_trait_available
|
78 |
+
)
|
79 |
+
|
80 |
+
# 4. Extract clinical features if trait data is available
|
81 |
+
if trait_row is not None:
|
82 |
+
clinical_df = geo_select_clinical_features(
|
83 |
+
clinical_df=clinical_data,
|
84 |
+
trait=trait,
|
85 |
+
trait_row=trait_row,
|
86 |
+
convert_trait=convert_trait,
|
87 |
+
age_row=age_row,
|
88 |
+
convert_age=convert_age,
|
89 |
+
gender_row=gender_row,
|
90 |
+
convert_gender=convert_gender
|
91 |
+
)
|
92 |
+
|
93 |
+
# Preview the processed clinical data
|
94 |
+
preview = preview_df(clinical_df)
|
95 |
+
print("Preview of processed clinical data:")
|
96 |
+
print(preview)
|
97 |
+
|
98 |
+
# Save clinical data
|
99 |
+
clinical_df.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 |
+
# Observe identifiers start with "ILMN_" - these are Illumina probe IDs that need to be mapped to 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 |
+
# Extract mapping between probe IDs and gene symbols
|
127 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
|
128 |
+
|
129 |
+
# Convert probe data to gene expression data
|
130 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
131 |
+
|
132 |
+
# Look at the first few rows of mapped gene data
|
133 |
+
print("Gene expression data after mapping:")
|
134 |
+
print(gene_data.head())
|
135 |
+
print("\nShape:", gene_data.shape)
|
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 = "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."
|
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/Psoriatic_Arthritis/code/GSE57376.py
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Psoriatic_Arthritis"
|
6 |
+
cohort = "GSE57376"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Psoriatic_Arthritis"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Psoriatic_Arthritis/GSE57376"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Psoriatic_Arthritis/GSE57376.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Psoriatic_Arthritis/gene_data/GSE57376.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Psoriatic_Arthritis/clinical_data/GSE57376.csv"
|
16 |
+
json_path = "./output/preprocess/3/Psoriatic_Arthritis/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 |
+
# Looking at the background info, this is a gene expression study of tissue biopsies
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
# Trait (disease status) is in row 5, Age in row 1, Gender in row 0
|
38 |
+
trait_row = 5
|
39 |
+
age_row = 1
|
40 |
+
gender_row = 0
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion Functions
|
43 |
+
def convert_trait(value: str) -> int:
|
44 |
+
"""Convert disease status to binary (0: no PsA, 1: has PsA)"""
|
45 |
+
if not value or ':' not in value:
|
46 |
+
return None
|
47 |
+
disease = value.split(': ')[1].strip()
|
48 |
+
if disease == 'Psoriatic Arthritis':
|
49 |
+
return 1
|
50 |
+
elif disease in ['Rheumatoid Arthritis', 'Psoriasis']:
|
51 |
+
return 0
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_age(value: str) -> float:
|
55 |
+
"""Convert age to float"""
|
56 |
+
if not value or ':' not 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: female, 1: male)"""
|
65 |
+
if not value or ':' not in value:
|
66 |
+
return None
|
67 |
+
gender = value.split(': ')[1].strip()
|
68 |
+
if gender.upper() == 'F':
|
69 |
+
return 0
|
70 |
+
elif gender.upper() == 'M':
|
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. Extract clinical features
|
85 |
+
if trait_row is not None:
|
86 |
+
clinical_features = 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 extracted features
|
98 |
+
preview = preview_df(clinical_features)
|
99 |
+
|
100 |
+
# Save clinical data
|
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 |
+
# Looking at identifiers like '1007_PM_s_at', these are Affymetrix probe IDs
|
118 |
+
# rather than standard human gene symbols
|
119 |
+
# They need to be mapped to proper gene symbols for analysis
|
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 |
+
# 1. Get probe ID and gene symbol columns
|
131 |
+
# In gene_annotation, 'ID' contains probe IDs and 'Gene Symbol' contains gene symbols
|
132 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
133 |
+
|
134 |
+
# 2. Apply the mapping to convert probe measurements to gene expression data
|
135 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
136 |
+
|
137 |
+
# Save gene expression data
|
138 |
+
gene_data.to_csv(out_gene_data_file)
|
139 |
+
# Reload clinical data that was processed earlier
|
140 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
141 |
+
|
142 |
+
# 1. Normalize gene symbols
|
143 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
144 |
+
genetic_data.to_csv(out_gene_data_file)
|
145 |
+
|
146 |
+
# 2. Link clinical and genetic data
|
147 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
148 |
+
|
149 |
+
# 3. Handle missing values systematically
|
150 |
+
linked_data = handle_missing_values(linked_data, trait)
|
151 |
+
|
152 |
+
# 4. Check for bias in trait and demographic features
|
153 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
154 |
+
|
155 |
+
# 5. Final validation and information saving
|
156 |
+
note = "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."
|
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/Psoriatic_Arthritis/code/GSE57383.py
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Psoriatic_Arthritis"
|
6 |
+
cohort = "GSE57383"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Psoriatic_Arthritis"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Psoriatic_Arthritis/GSE57383"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Psoriatic_Arthritis/GSE57383.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Psoriatic_Arthritis/gene_data/GSE57383.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Psoriatic_Arthritis/clinical_data/GSE57383.csv"
|
16 |
+
json_path = "./output/preprocess/3/Psoriatic_Arthritis/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 appears to be gene expression data from CD14+ cells
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Identify row indices
|
38 |
+
trait_row = 6 # 'disease' row contains trait info
|
39 |
+
age_row = 2 # 'age' row contains age info
|
40 |
+
gender_row = 1 # 'Sex' row contains gender info
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion Functions
|
43 |
+
def convert_trait(value: str) -> int:
|
44 |
+
"""Convert trait value to binary (0=control, 1=case)"""
|
45 |
+
if not value or ':' not in value:
|
46 |
+
return None
|
47 |
+
value = value.split(':')[1].strip()
|
48 |
+
if value == 'Psoriatic Arthritis':
|
49 |
+
return 1
|
50 |
+
elif value == 'Health Control':
|
51 |
+
return 0
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_age(value: str) -> float:
|
55 |
+
"""Convert age value to continuous numeric"""
|
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()
|
68 |
+
if value == 'F':
|
69 |
+
return 0
|
70 |
+
elif value == 'M':
|
71 |
+
return 1
|
72 |
+
return None
|
73 |
+
|
74 |
+
# 3. Save initial filtering 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. Extract clinical features
|
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 |
+
|
96 |
+
# Preview the extracted features
|
97 |
+
print("Preview of extracted clinical features:")
|
98 |
+
print(preview_df(clinical_features))
|
99 |
+
|
100 |
+
# Save clinical features
|
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 |
+
# Checking identifiers - these are Affymetrix probe IDs (ending in "_PM_at" etc)
|
118 |
+
# rather than standard 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 |
+
# Get gene mapping dataframe using ID and Gene Symbol columns
|
130 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
131 |
+
|
132 |
+
# Apply gene mapping to convert probe data to gene expression data
|
133 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
134 |
+
|
135 |
+
# Preview data
|
136 |
+
print("Data shape after mapping:", gene_data.shape)
|
137 |
+
print("\nPreview of mapped gene data:")
|
138 |
+
print(preview_df(gene_data))
|
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 = "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."
|
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/Psoriatic_Arthritis/code/GSE57386.py
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Psoriatic_Arthritis"
|
6 |
+
cohort = "GSE57386"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Psoriatic_Arthritis"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Psoriatic_Arthritis/GSE57386"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Psoriatic_Arthritis/GSE57386.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Psoriatic_Arthritis/gene_data/GSE57386.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Psoriatic_Arthritis/clinical_data/GSE57386.csv"
|
16 |
+
json_path = "./output/preprocess/3/Psoriatic_Arthritis/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 mentions "Gene expression" and includes biopsies and cell samples,
|
34 |
+
# suggesting this dataset contains gene expression data
|
35 |
+
is_gene_available = True
|
36 |
+
|
37 |
+
# 2.1 Data Availability & 2.2 Data Type Conversion
|
38 |
+
# Trait (PsA) can be determined from "disease" field in row 5
|
39 |
+
trait_row = 5
|
40 |
+
|
41 |
+
def convert_trait(value):
|
42 |
+
if pd.isna(value):
|
43 |
+
return None
|
44 |
+
# Extract value after colon and strip whitespace
|
45 |
+
value = value.split(':')[-1].strip()
|
46 |
+
# Convert to binary: 1 for PsA, 0 for others
|
47 |
+
if value == 'Psoriatic Arthritis':
|
48 |
+
return 1
|
49 |
+
elif value in ['Rheumatoid Arthritis', 'Psoriasis', 'normal', 'diseased', 'Healthy Control']:
|
50 |
+
return 0
|
51 |
+
return None
|
52 |
+
|
53 |
+
# Age is available in row 1
|
54 |
+
age_row = 1
|
55 |
+
|
56 |
+
def convert_age(value):
|
57 |
+
if pd.isna(value):
|
58 |
+
return None
|
59 |
+
try:
|
60 |
+
# Extract number after "age: "
|
61 |
+
age = int(value.split(':')[1].strip())
|
62 |
+
return age
|
63 |
+
except:
|
64 |
+
return None
|
65 |
+
|
66 |
+
# Gender (Sex) is available in row 0
|
67 |
+
gender_row = 0
|
68 |
+
|
69 |
+
def convert_gender(value):
|
70 |
+
if pd.isna(value):
|
71 |
+
return None
|
72 |
+
# Extract value after colon
|
73 |
+
value = value.split(':')[1].strip()
|
74 |
+
# Convert to binary: 0 for F, 1 for M
|
75 |
+
if value == 'F':
|
76 |
+
return 0
|
77 |
+
elif value == 'M':
|
78 |
+
return 1
|
79 |
+
return None
|
80 |
+
|
81 |
+
# 3. Save Metadata
|
82 |
+
validate_and_save_cohort_info(
|
83 |
+
is_final=False,
|
84 |
+
cohort=cohort,
|
85 |
+
info_path=json_path,
|
86 |
+
is_gene_available=is_gene_available,
|
87 |
+
is_trait_available=(trait_row is not None)
|
88 |
+
)
|
89 |
+
|
90 |
+
# 4. Clinical Feature Extraction
|
91 |
+
if trait_row is not None:
|
92 |
+
clinical_features = geo_select_clinical_features(
|
93 |
+
clinical_df=clinical_data,
|
94 |
+
trait=trait,
|
95 |
+
trait_row=trait_row,
|
96 |
+
convert_trait=convert_trait,
|
97 |
+
age_row=age_row,
|
98 |
+
convert_age=convert_age,
|
99 |
+
gender_row=gender_row,
|
100 |
+
convert_gender=convert_gender
|
101 |
+
)
|
102 |
+
|
103 |
+
# Preview the extracted features
|
104 |
+
preview = preview_df(clinical_features)
|
105 |
+
print("Preview of clinical features:")
|
106 |
+
print(preview)
|
107 |
+
|
108 |
+
# Save to CSV
|
109 |
+
clinical_features.to_csv(out_clinical_data_file)
|
110 |
+
# Get gene expression data from matrix file
|
111 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
112 |
+
|
113 |
+
# Examine data structure
|
114 |
+
print("Data structure and head:")
|
115 |
+
print(genetic_data.head())
|
116 |
+
|
117 |
+
print("\nShape:", genetic_data.shape)
|
118 |
+
|
119 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
120 |
+
print(list(genetic_data.index)[:20])
|
121 |
+
|
122 |
+
# Get a few column names to verify sample IDs
|
123 |
+
print("\nFirst 5 column names:")
|
124 |
+
print(list(genetic_data.columns)[:5])
|
125 |
+
# The identifiers like "1007_PM_s_at" are probe IDs from Affymetrix GeneChip Human Genome arrays
|
126 |
+
# These need to be mapped to standard gene symbols
|
127 |
+
requires_gene_mapping = True
|
128 |
+
# Extract gene annotation data
|
129 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
130 |
+
|
131 |
+
# Display column names and preview data
|
132 |
+
print("Column names:")
|
133 |
+
print(gene_annotation.columns)
|
134 |
+
|
135 |
+
print("\nPreview of gene annotation data:")
|
136 |
+
print(preview_df(gene_annotation))
|
137 |
+
# Get gene mapping from annotation data
|
138 |
+
# 'ID' column matches the probe IDs in expression data, 'Gene Symbol' contains target gene symbols
|
139 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
140 |
+
|
141 |
+
# Apply mapping to convert probe data to gene expression data
|
142 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
143 |
+
|
144 |
+
# Print shape and preview gene data
|
145 |
+
print("\nGene expression data shape:", gene_data.shape)
|
146 |
+
print("\nPreview of gene expression data:")
|
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 = "Dataset contains subcutaneous adipose tissue gene expression data from PCOS patients and controls. The gender feature is biased (all female) and was removed."
|
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/Psoriatic_Arthritis/code/GSE57405.py
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Psoriatic_Arthritis"
|
6 |
+
cohort = "GSE57405"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Psoriatic_Arthritis"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Psoriatic_Arthritis/GSE57405"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Psoriatic_Arthritis/GSE57405.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Psoriatic_Arthritis/gene_data/GSE57405.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Psoriatic_Arthritis/clinical_data/GSE57405.csv"
|
16 |
+
json_path = "./output/preprocess/3/Psoriatic_Arthritis/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 "gene expression" data
|
34 |
+
|
35 |
+
# 2.1 Data Availability
|
36 |
+
trait_row = 5 # 'disease' field contains trait info
|
37 |
+
age_row = 1 # 'age' field available
|
38 |
+
gender_row = 0 # 'Sex' field available
|
39 |
+
|
40 |
+
# 2.2 Data Type Conversion Functions
|
41 |
+
def convert_trait(x: str) -> Optional[int]:
|
42 |
+
if not isinstance(x, str):
|
43 |
+
return None
|
44 |
+
# Extract value after colon and strip whitespace
|
45 |
+
value = x.split(':')[1].strip() if ':' in x else x.strip()
|
46 |
+
# Convert to binary: 1 for PsA, 0 for others
|
47 |
+
if value == 'Psoriatic Arthritis':
|
48 |
+
return 1
|
49 |
+
elif value in ['Healthy Control', 'Rheumatoid Arthritis', 'Psoriasis']:
|
50 |
+
return 0
|
51 |
+
return None
|
52 |
+
|
53 |
+
def convert_age(x: str) -> Optional[float]:
|
54 |
+
if not isinstance(x, str):
|
55 |
+
return None
|
56 |
+
try:
|
57 |
+
# Extract numeric value after colon
|
58 |
+
value = x.split(':')[1].strip()
|
59 |
+
return float(value)
|
60 |
+
except:
|
61 |
+
return None
|
62 |
+
|
63 |
+
def convert_gender(x: str) -> Optional[int]:
|
64 |
+
if not isinstance(x, str):
|
65 |
+
return None
|
66 |
+
# Extract value after colon and strip whitespace
|
67 |
+
value = x.split(':')[1].strip() if ':' in x else x.strip()
|
68 |
+
if value.upper() == 'F':
|
69 |
+
return 0
|
70 |
+
elif value.upper() == 'M':
|
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(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 |
+
# 4. Clinical Feature Extraction
|
83 |
+
if trait_row is not None:
|
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 |
+
preview = preview_df(clinical_features)
|
97 |
+
print("Preview of clinical features:", preview)
|
98 |
+
|
99 |
+
# Save to CSV
|
100 |
+
clinical_features.to_csv(out_clinical_data_file)
|
101 |
+
# Get gene expression data from matrix file
|
102 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
103 |
+
|
104 |
+
# Examine data structure
|
105 |
+
print("Data structure and head:")
|
106 |
+
print(genetic_data.head())
|
107 |
+
|
108 |
+
print("\nShape:", genetic_data.shape)
|
109 |
+
|
110 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
111 |
+
print(list(genetic_data.index)[:20])
|
112 |
+
|
113 |
+
# Get a few column names to verify sample IDs
|
114 |
+
print("\nFirst 5 column names:")
|
115 |
+
print(list(genetic_data.columns)[:5])
|
116 |
+
# Looking at the probe IDs like "1007_PM_s_at", these are Affymetrix probe IDs, not gene symbols
|
117 |
+
# The "_PM" suffix indicates Perfect Match probes from an Affymetrix microarray
|
118 |
+
# These identifiers need to be mapped to standard 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 |
+
# Get the mapping between probes and genes
|
130 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
131 |
+
|
132 |
+
# Convert probe-level measurements to gene expression data
|
133 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
134 |
+
|
135 |
+
# Observe the result
|
136 |
+
print("\nShape of gene expression data:", gene_data.shape)
|
137 |
+
print("\nFirst few mapped genes and their expression values:")
|
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 = "Dataset contains subcutaneous adipose tissue gene expression data from PCOS patients and controls. The gender feature is biased (all female) and was removed."
|
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/Psoriatic_Arthritis/code/GSE61281.py
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Psoriatic_Arthritis"
|
6 |
+
cohort = "GSE61281"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Psoriatic_Arthritis"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Psoriatic_Arthritis/GSE61281"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Psoriatic_Arthritis/GSE61281.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Psoriatic_Arthritis/gene_data/GSE61281.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Psoriatic_Arthritis/clinical_data/GSE61281.csv"
|
16 |
+
json_path = "./output/preprocess/3/Psoriatic_Arthritis/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 # Study title indicates whole blood transcriptional profiling
|
34 |
+
|
35 |
+
# 2.1 Data Availability
|
36 |
+
trait_row = 1 # 'condition' field contains case/control status
|
37 |
+
gender_row = 2 # 'gender' field available
|
38 |
+
age_row = None # Age data not directly available
|
39 |
+
|
40 |
+
# 2.2 Data Type Conversion Functions
|
41 |
+
def convert_trait(value: str) -> int:
|
42 |
+
"""Convert trait value to binary: 1 for PsA cases, 0 for controls and PsC"""
|
43 |
+
if not value or ':' not in value:
|
44 |
+
return None
|
45 |
+
value = value.split(':')[1].strip().lower()
|
46 |
+
if 'psoriatic arthritis' in value:
|
47 |
+
return 1
|
48 |
+
elif 'unaffected control' in value or 'cutaneous psoriasis without arthritis' in value:
|
49 |
+
return 0
|
50 |
+
return None
|
51 |
+
|
52 |
+
def convert_gender(value: str) -> int:
|
53 |
+
"""Convert gender to binary: 0 for female, 1 for male"""
|
54 |
+
if not value or ':' not in value:
|
55 |
+
return None
|
56 |
+
value = value.split(':')[1].strip().lower()
|
57 |
+
if 'female' in value:
|
58 |
+
return 0
|
59 |
+
elif 'male' in value:
|
60 |
+
return 1
|
61 |
+
return None
|
62 |
+
|
63 |
+
# 3. Save Initial Metadata
|
64 |
+
validate_and_save_cohort_info(is_final=False, cohort=cohort, info_path=json_path,
|
65 |
+
is_gene_available=is_gene_available,
|
66 |
+
is_trait_available=trait_row is not None)
|
67 |
+
|
68 |
+
# 4. Extract Clinical Features
|
69 |
+
if trait_row is not None:
|
70 |
+
selected_clinical_df = geo_select_clinical_features(
|
71 |
+
clinical_df=clinical_data,
|
72 |
+
trait=trait,
|
73 |
+
trait_row=trait_row,
|
74 |
+
convert_trait=convert_trait,
|
75 |
+
gender_row=gender_row,
|
76 |
+
convert_gender=convert_gender
|
77 |
+
)
|
78 |
+
|
79 |
+
# Preview the selected features
|
80 |
+
print("Preview of selected clinical features:")
|
81 |
+
print(preview_df(selected_clinical_df))
|
82 |
+
|
83 |
+
# Save clinical data
|
84 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
85 |
+
# Get gene expression data from matrix file
|
86 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
87 |
+
|
88 |
+
# Examine data structure
|
89 |
+
print("Data structure and head:")
|
90 |
+
print(genetic_data.head())
|
91 |
+
|
92 |
+
print("\nShape:", genetic_data.shape)
|
93 |
+
|
94 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
95 |
+
print(list(genetic_data.index)[:20])
|
96 |
+
|
97 |
+
# Get a few column names to verify sample IDs
|
98 |
+
print("\nFirst 5 column names:")
|
99 |
+
print(list(genetic_data.columns)[:5])
|
100 |
+
# Looking at the gene identifiers like 'A_23_P100001', these are Agilent array probe IDs
|
101 |
+
# They need to be mapped to standard human gene symbols for analysis
|
102 |
+
requires_gene_mapping = True
|
103 |
+
# Extract gene annotation data
|
104 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
105 |
+
|
106 |
+
# Display column names and preview data
|
107 |
+
print("Column names:")
|
108 |
+
print(gene_annotation.columns)
|
109 |
+
|
110 |
+
print("\nPreview of gene annotation data:")
|
111 |
+
print(preview_df(gene_annotation))
|
112 |
+
# Create mapping dataframe using ID and GENE_SYMBOL columns
|
113 |
+
mapping_data = get_gene_mapping(gene_annotation, 'ID', 'GENE_SYMBOL')
|
114 |
+
|
115 |
+
# Apply gene mapping to get gene expression data
|
116 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
117 |
+
|
118 |
+
# Preview the mapped gene expression data
|
119 |
+
print("Gene expression data after mapping:")
|
120 |
+
print(gene_data.head())
|
121 |
+
print("\nShape:", gene_data.shape)
|
122 |
+
print("\nFirst 20 gene symbols:")
|
123 |
+
print(list(gene_data.index)[:20])
|
124 |
+
|
125 |
+
# Save the gene expression data
|
126 |
+
gene_data.to_csv(out_gene_data_file)
|
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 subcutaneous adipose tissue gene expression data from PCOS patients and controls. The gender feature is biased (all female) and was removed."
|
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/Psoriatic_Arthritis/code/TCGA.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Psoriatic_Arthritis"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Psoriatic_Arthritis/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Psoriatic_Arthritis/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Psoriatic_Arthritis/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Psoriatic_Arthritis/cohort_info.json"
|
15 |
+
|
16 |
+
# 1. Check TCGA directories for PTSD-related 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 |
+
# No directories contain PTSD-related data since TCGA is a cancer database
|
20 |
+
is_gene_available = False
|
21 |
+
is_trait_available = False
|
22 |
+
|
23 |
+
# Record that no suitable data is available
|
24 |
+
validate_and_save_cohort_info(
|
25 |
+
is_final=False,
|
26 |
+
cohort="TCGA",
|
27 |
+
info_path=json_path,
|
28 |
+
is_gene_available=is_gene_available,
|
29 |
+
is_trait_available=is_trait_available
|
30 |
+
)
|
p3/preprocess/Psoriatic_Arthritis/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE61281": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": true, "sample_size": 52, "note": "Dataset contains subcutaneous adipose tissue gene expression data from PCOS patients and controls. The gender feature is biased (all female) and was removed."}, "GSE57405": {"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": 111, "note": "Dataset contains subcutaneous adipose tissue gene expression data from PCOS patients and controls. The gender feature is biased (all female) and was removed."}, "GSE57386": {"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": 255, "note": "Dataset contains subcutaneous adipose tissue gene expression data from PCOS patients and controls. The gender feature is biased (all female) and was removed."}, "GSE57383": {"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": 55, "note": "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."}, "GSE57376": {"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": "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."}, "GSE142049": {"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": 114, "note": "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."}, "GSE141934": {"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": 100, "note": "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."}, "TCGA": {"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": null}}
|
p3/preprocess/Psoriatic_Arthritis/gene_data/GSE141934.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Psoriatic_Arthritis/gene_data/GSE57376.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Rectal_Cancer/GSE119409.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Rectal_Cancer/GSE133057.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Rectal_Cancer/GSE139255.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Rectal_Cancer/GSE145037.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE109057.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM2928730,GSM2928731,GSM2928732,GSM2928733,GSM2928734,GSM2928735,GSM2928736,GSM2928737,GSM2928738,GSM2928739,GSM2928740,GSM2928741,GSM2928742,GSM2928743,GSM2928744,GSM2928745,GSM2928746,GSM2928747,GSM2928748,GSM2928749,GSM2928750,GSM2928751,GSM2928752,GSM2928753,GSM2928754,GSM2928755,GSM2928756,GSM2928757,GSM2928758,GSM2928759,GSM2928760,GSM2928761,GSM2928762,GSM2928763,GSM2928764,GSM2928765,GSM2928766,GSM2928767,GSM2928768,GSM2928769,GSM2928770,GSM2928771,GSM2928772,GSM2928773,GSM2928774,GSM2928775,GSM2928776,GSM2928777,GSM2928778,GSM2928779,GSM2928780,GSM2928781,GSM2928782,GSM2928783,GSM2928784,GSM2928785,GSM2928786,GSM2928787,GSM2928788,GSM2928789,GSM2928790,GSM2928791,GSM2928792,GSM2928793,GSM2928794,GSM2928795,GSM2928796,GSM2928797,GSM2928798,GSM2928799,GSM2928800,GSM2928801,GSM2928802,GSM2928803,GSM2928804,GSM2928805,GSM2928806,GSM2928807,GSM2928808,GSM2928809,GSM2928810,GSM2928811,GSM2928812,GSM2928813,GSM2928814,GSM2928815,GSM2928816,GSM2928817,GSM2928818,GSM2928819,GSM2928820
|
2 |
+
Rectal_Cancer,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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,35.0,30.0,55.0,45.0,65.0,75.0,55.0,45.0,70.0,60.0,50.0,30.0,65.0,45.0,65.0,55.0,45.0,45.0,70.0,65.0,45.0,65.0,65.0,55.0,50.0,65.0,45.0,60.0,60.0,65.0,60.0,65.0,55.0,55.0,60.0,50.0,80.0,55.0,45.0,70.0,40.0,65.0,60.0,55.0,60.0,50.0,50.0,60.0,45.0,60.0,65.0,65.0,65.0,60.0,75.0,60.0,55.0,60.0,55.0,75.0,60.0,45.0,60.0,60.0,65.0,45.0,30.0,45.0,50.0,55.0,65.0,45.0,60.0,50.0,70.0,65.0,55.0,60.0,45.0,40.0,35.0,70.0,70.0,70.0,75.0,75.0,70.0,60.0,35.0,50.0,70.0
|
4 |
+
Gender,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,0.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,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,1.0,1.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,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE119409.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
,GSM3374350,GSM3374351,GSM3374352,GSM3374353,GSM3374354,GSM3374355,GSM3374356,GSM3374357,GSM3374358,GSM3374359,GSM3374360,GSM3374361,GSM3374362,GSM3374363,GSM3374364,GSM3374365,GSM3374366,GSM3374367,GSM3374368,GSM3374369,GSM3374370,GSM3374371,GSM3374372,GSM3374373,GSM3374374,GSM3374375,GSM3374376,GSM3374377,GSM3374378,GSM3374379,GSM3374380,GSM3374381,GSM3374382,GSM3374383,GSM3374384,GSM3374385,GSM3374386,GSM3374387,GSM3374388,GSM3374389,GSM3374390,GSM3374391,GSM3374392,GSM3374393,GSM3374394,GSM3374395,GSM3374396,GSM3374397,GSM3374398,GSM3374399,GSM3374400,GSM3374401,GSM3374402,GSM3374403,GSM3374404,GSM3374405,GSM3374406,GSM3374407,GSM3374408,GSM3374409,GSM3374410,GSM3374411,GSM3374412,GSM3374413,GSM3374414,GSM3374415
|
2 |
+
Rectal_Cancer,1.0,,1.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,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,,1.0,0.0,0.0,,,,0.0,,0.0,,1.0,,0.0,,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0
|
3 |
+
Age,52.0,57.0,65.0,61.0,62.0,58.0,63.0,70.0,61.0,74.0,72.0,51.0,70.0,45.0,77.0,64.0,66.0,43.0,65.0,51.0,66.0,52.0,39.0,72.0,71.0,35.0,61.0,45.0,42.0,56.0,40.0,62.0,67.0,63.0,70.0,63.0,42.0,57.0,40.0,47.0,69.0,69.0,50.0,52.0,49.0,65.0,44.0,61.0,57.0,58.0,37.0,,41.0,51.0,59.0,68.0,45.0,60.0,74.0,49.0,69.0,54.0,51.0,54.0,57.0,66.0
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE123390.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM3502511,GSM3502512,GSM3502513,GSM3502514,GSM3502515,GSM3502516,GSM3502517,GSM3502518,GSM3502519,GSM3502520,GSM3502521,GSM3502522,GSM3502523,GSM3502524,GSM3502525,GSM3502526,GSM3502527,GSM3502528,GSM3502529,GSM3502530,GSM3502531,GSM3502532,GSM3502533,GSM3502534,GSM3502535,GSM3502536,GSM3502537,GSM3502538,GSM3502539,GSM3502540,GSM3502541,GSM3502542,GSM3502543
|
2 |
+
Rectal_Cancer,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,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,,,,,
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE133057.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM3899156,GSM3899157,GSM3899158,GSM3899159,GSM3899160,GSM3899161,GSM3899162,GSM3899163,GSM3899164,GSM3899165,GSM3899166,GSM3899167,GSM3899168,GSM3899169,GSM3899170,GSM3899171,GSM3899172,GSM3899173,GSM3899174,GSM3899175,GSM3899176,GSM3899177,GSM3899178,GSM3899179,GSM3899180,GSM3899181,GSM3899182,GSM3899183,GSM3899184,GSM3899185,GSM3899186,GSM3899187,GSM3899188
|
2 |
+
Rectal_Cancer,0.0,0.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,0.0,1.0,1.0,1.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,0.0
|
3 |
+
Age,66.0,65.0,51.0,72.0,62.0,51.0,50.0,46.0,59.0,46.0,51.0,63.0,63.0,51.0,44.0,69.0,63.0,41.0,70.0,66.0,54.0,48.0,75.0,40.0,47.0,60.0,43.0,57.0,52.0,65.0,54.0,48.0,82.0
|
4 |
+
Gender,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,0.0,0.0,0.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,0.0
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE139255.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM4134743,GSM4134744,GSM4134745,GSM4134746,GSM4134747,GSM4134748,GSM4134749,GSM4134750,GSM4134751,GSM4134752,GSM4134753,GSM4134754,GSM4134755,GSM4134756,GSM4134757,GSM4134758,GSM4134759,GSM4134760,GSM4134761,GSM4134762,GSM4134763,GSM4134764,GSM4134765,GSM4134766,GSM4134767,GSM4134768,GSM4134769,GSM4134770,GSM4134771,GSM4134772,GSM4134773,GSM4134774,GSM4134775,GSM4134776,GSM4134777,GSM4134778,GSM4134779,GSM4134780,GSM4134781,GSM4134782,GSM4134783,GSM4134784,GSM4134785,GSM4134786,GSM4134787,GSM4134788,GSM4134789,GSM4134790,GSM4134791,GSM4134792,GSM4134793,GSM4134794,GSM4134795,GSM4134796,GSM4134797,GSM4134798,GSM4134799,GSM4134800,GSM4134801,GSM4134802,GSM4134803,GSM4134804,GSM4134805,GSM4134806,GSM4134807,GSM4134808,GSM4134809,GSM4134810,GSM4134811,GSM4134812,GSM4134813,GSM4134814,GSM4134815,GSM4134816,GSM4134817,GSM4134818,GSM4134819,GSM4134820,GSM4134821,GSM4134822,GSM4134823,GSM4134824,GSM4134825,GSM4134826,GSM4134827,GSM4134828,GSM4134829,GSM4134830,GSM4134831,GSM4134832,GSM4134833,GSM4134834,GSM4134835,GSM4134836,GSM4134837,GSM4134838,GSM4134839,GSM4134840,GSM4134841,GSM4134842,GSM4134843,GSM4134844,GSM4134845,GSM4134846,GSM4134847,GSM4134848,GSM4134849,GSM4134850,GSM4134851,GSM4134852,GSM4134853,GSM4134854,GSM4134855,GSM4134856,GSM4134857,GSM4134858,GSM4134859,GSM4134860,GSM4134861,GSM4134862,GSM4134863,GSM4134864,GSM4134865,GSM4134866,GSM4134867,GSM4134868,GSM4134869,GSM4134870,GSM4134871,GSM4134872,GSM4134873,GSM4134874,GSM4134875,GSM4134876,GSM4134877,GSM4134878,GSM4134879,GSM4134880,GSM4134881,GSM4134882,GSM4134883,GSM4134884,GSM4134885,GSM4134886,GSM4134887,GSM4134888,GSM4134889,GSM4134890,GSM4134891,GSM4134892,GSM4134893,GSM4134894,GSM4134895,GSM4134896,GSM4134897,GSM4134898
|
2 |
+
Rectal_Cancer,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.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,0.0,1.0,0.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,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.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,0.0,0.0,0.0,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,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE145037.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM4304757,GSM4304758,GSM4304759,GSM4304760,GSM4304761,GSM4304762,GSM4304763,GSM4304764,GSM4304765,GSM4304766,GSM4304767,GSM4304768,GSM4304769,GSM4304770,GSM4304771,GSM4304772,GSM4304773,GSM4304774,GSM4304775,GSM4304776,GSM4304777,GSM4304778,GSM4304779,GSM4304780,GSM4304781,GSM4304782,GSM4304783,GSM4304784,GSM4304785,GSM4304786,GSM4304787
|
2 |
+
Response,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,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
|
3 |
+
Age,34.0,66.0,69.0,65.0,72.0,64.0,53.0,60.0,44.0,53.0,58.0,44.0,41.0,52.0,53.0,48.0,49.0,61.0,63.0,75.0,46.0,60.0,59.0,70.0,58.0,63.0,68.0,41.0,60.0,63.0,73.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
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE150082.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM4523129,GSM4523130,GSM4523131,GSM4523132,GSM4523133,GSM4523134,GSM4523135,GSM4523136,GSM4523137,GSM4523138,GSM4523139,GSM4523140,GSM4523141,GSM4523142,GSM4523143,GSM4523144,GSM4523145,GSM4523146,GSM4523147,GSM4523148,GSM4523149,GSM4523150,GSM4523151,GSM4523152,GSM4523153,GSM4523154,GSM4523155,GSM4523156,GSM4523157,GSM4523158,GSM4523159,GSM4523160,GSM4523161,GSM4523162,GSM4523163,GSM4523164,GSM4523165,GSM4523166,GSM4523167
|
2 |
+
Rectal_Cancer,1.0,1.0,1.0,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,1.0,0.0,0.0,0.0
|
3 |
+
Age,70.0,74.0,45.0,45.0,54.0,72.0,57.0,66.0,71.0,47.0,66.0,61.0,64.0,61.0,59.0,34.0,63.0,66.0,46.0,57.0,64.0,55.0,75.0,61.0,42.0,63.0,42.0,69.0,49.0,68.0,60.0,69.0,58.0,30.0,49.0,74.0,56.0,64.0,66.0
|
4 |
+
Gender,1.0,1.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,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,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE170999.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM5215860,GSM5215861,GSM5215862,GSM5215863,GSM5215864,GSM5215865,GSM5215866,GSM5215867,GSM5215868,GSM5215869,GSM5215870,GSM5215871,GSM5215872,GSM5215873,GSM5215874,GSM5215875,GSM5215876,GSM5215877,GSM5215878,GSM5215879,GSM5215880,GSM5215881,GSM5215882,GSM5215883,GSM5215884,GSM5215885,GSM5215886,GSM5215887,GSM5215888,GSM5215889,GSM5215890,GSM5215891,GSM5215892,GSM5215893,GSM5215894,GSM5215895,GSM5215896,GSM5215897,GSM5215898,GSM5215899,GSM5215900,GSM5215901,GSM5215902,GSM5215903,GSM5215904,GSM5215905,GSM5215906,GSM5215907,GSM5215908,GSM5215909,GSM5215910,GSM5215911,GSM5215912,GSM5215913,GSM5215914,GSM5215915,GSM5215916,GSM5215917,GSM5215918,GSM5215919,GSM5215920,GSM5215921,GSM5215922,GSM5215923,GSM5215924,GSM5215925,GSM5215926,GSM5215927,GSM5215928,GSM5215929,GSM5215930,GSM5215931,GSM5215932,GSM5215933,GSM5215934,GSM5215935
|
2 |
+
Rectal_Cancer,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.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,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.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,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.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
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE40492.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,GSM994976,GSM994977,GSM994978,GSM994979,GSM994980,GSM994981,GSM994982,GSM994983,GSM994984,GSM994985,GSM994986,GSM994987,GSM994988,GSM994989,GSM994990,GSM994991,GSM994992,GSM994993,GSM994994,GSM994995,GSM994996,GSM994997,GSM994998,GSM994999,GSM995000,GSM995001,GSM995002,GSM995003,GSM995004,GSM995005,GSM995006,GSM995007,GSM995008,GSM995009,GSM995010,GSM995011,GSM995012,GSM995013,GSM995014,GSM995015,GSM995016,GSM995017,GSM995018,GSM995019,GSM995020,GSM995021,GSM995022,GSM995023,GSM995024,GSM995025,GSM995026,GSM995027,GSM995028,GSM995029,GSM995030,GSM995031,GSM995032,GSM995033,GSM995034,GSM995035,GSM995036,GSM995037,GSM995038,GSM995039,GSM995040,GSM995041,GSM995042,GSM995043,GSM995044,GSM995045,GSM995046,GSM995047,GSM995048,GSM995049,GSM995050,GSM995051,GSM995052,GSM995053,GSM995054,GSM995055,GSM995056,GSM995057,GSM995058,GSM995059,GSM995060,GSM995061,GSM995062,GSM995063,GSM995064,GSM995065,GSM995066,GSM995067,GSM995068,GSM995069,GSM995070,GSM995071,GSM995072,GSM995073,GSM995074,GSM995075,GSM995076,GSM995077,GSM995078,GSM995079,GSM995080,GSM995081,GSM995082,GSM995083,GSM995084,GSM995085,GSM995086,GSM995087,GSM995088,GSM995089,GSM995090,GSM995091,GSM995092,GSM995093,GSM995094,GSM995095,GSM995096,GSM995097,GSM995098,GSM995099,GSM995100,GSM995101,GSM995102,GSM995103,GSM995104,GSM995105,GSM995106,GSM995107,GSM995108,GSM995109,GSM995110,GSM995111,GSM995112,GSM995113,GSM995114,GSM995115,GSM995116,GSM995117,GSM995118,GSM995119,GSM995120,GSM995121,GSM995122,GSM995123,GSM995124,GSM995125,GSM995126,GSM995127,GSM995128,GSM995129,GSM995130,GSM995131,GSM995132,GSM995133,GSM995134,GSM995135,GSM995136,GSM995137,GSM995138,GSM995139,GSM995140,GSM995141,GSM995142,GSM995143,GSM995144,GSM995145,GSM995146,GSM995147,GSM995148,GSM995149,GSM995150,GSM995151,GSM995152,GSM995153,GSM995154,GSM995155,GSM995156,GSM995157,GSM995158,GSM995159,GSM995160,GSM995161,GSM995162,GSM995163,GSM995164,GSM995165,GSM995166,GSM995167,GSM995168,GSM995169,GSM995170,GSM995171,GSM995172,GSM995173,GSM995174,GSM995175,GSM995176,GSM995177,GSM995178,GSM995179,GSM995180,GSM995181,GSM995182,GSM995183,GSM995184,GSM995185,GSM995186,GSM995187,GSM995188,GSM995189,GSM995190,GSM995191,GSM995192,GSM995193,GSM995194,GSM995195,GSM995196,GSM995197,GSM995198,GSM995199,GSM995200,GSM995201,GSM995202,GSM995203,GSM995204,GSM995205,GSM995206,GSM995207,GSM995208,GSM995209,GSM995210,GSM995211,GSM995212,GSM995213,GSM995214,GSM995215,GSM995216,GSM995217,GSM995218,GSM995219,GSM995220
|
2 |
+
Lymph_Node_Status,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,1.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.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,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,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,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,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.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,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.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,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.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,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0
|
3 |
+
Age,55.5,65.6,62.6,61.8,52.1,59.1,70.6,60.6,55.0,53.1,58.5,68.4,58.8,70.0,77.5,68.4,75.2,76.3,38.2,61.1,69.4,54.2,77.7,57.4,61.2,56.5,47.0,62.7,51.2,73.2,47.2,72.7,38.8,75.4,79.9,60.9,76.2,49.4,49.9,58.1,77.2,72.3,59.0,76.2,69.0,61.3,66.3,65.5,68.3,78.8,65.8,57.0,65.6,74.1,48.1,57.2,61.8,65.4,49.1,63.7,58.5,66.3,62.0,57.3,48.3,71.1,71.2,52.6,70.3,54.0,53.7,60.0,68.2,65.7,79.7,81.3,66.3,59.2,57.3,81.5,62.3,63.6,66.8,71.5,76.7,76.5,58.3,76.6,62.5,51.2,67.8,63.3,76.3,41.8,58.0,65.7,59.5,53.6,56.8,60.7,64.0,55.5,50.0,35.6,77.7,65.1,74.6,63.0,73.2,73.3,54.8,61.2,63.2,63.9,75.4,68.2,51.1,46.3,59.4,70.9,59.8,81.1,72.9,70.8,63.8,63.6,72.3,51.9,69.5,65.1,54.8,56.2,66.2,79.5,67.5,54.7,73.7,61.9,73.9,50.5,76.9,41.7,73.0,41.6,67.0,61.9,42.0,68.7,59.3,68.0,78.7,57.2,63.6,60.7,72.0,62.5,51.7,56.5,74.9,61.5,69.8,63.5,58.9,53.1,65.3,71.9,46.2,63.8,47.5,52.4,64.3,65.1,47.6,60.3,70.9,56.3,53.6,55.8,61.2,59.3,62.4,40.8,68.4,62.6,60.2,72.0,70.9,67.5,70.4,61.4,53.7,36.2,58.6,53.8,61.2,67.0,66.8,69.3,60.6,75.0,55.7,48.5,76.2,70.8,76.7,64.3,77.2,70.1,62.5,52.7,60.4,53.3,66.4,56.2,60.7,61.9,69.6,63.2,81.3,58.3,62.8,75.9,74.3,71.4,74.2,76.5,77.5,59.8,46.0,80.7,65.6,75.5,59.9,72.8,57.5,70.7,74.8,75.7,57.5,70.9,66.9,74.3,43.3,83.1,84.3
|
4 |
+
Gender,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,0.0,0.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,0.0,0.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,0.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,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,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.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,0.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,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.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,0.0,1.0,0.0,1.0,0.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,1.0,1.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,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,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,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,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0
|
p3/preprocess/Rectal_Cancer/clinical_data/GSE94104.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,GSM2469019,GSM2469020,GSM2469021,GSM2469022,GSM2469023,GSM2469024,GSM2469025,GSM2469026,GSM2469027,GSM2469028,GSM2469029,GSM2469030,GSM2469031,GSM2469032,GSM2469033,GSM2469034,GSM2469035,GSM2469036,GSM2469037,GSM2469038,GSM2469039,GSM2469040,GSM2469041,GSM2469042,GSM2469043,GSM2469044,GSM2469045,GSM2469046,GSM2469047,GSM2469048,GSM2469049,GSM2469050,GSM2469051,GSM2469052,GSM2469053,GSM2469054,GSM2469055,GSM2469056,GSM2469057,GSM2469058,GSM2469059,GSM2469060,GSM2469061,GSM2469062,GSM2469063,GSM2469064,GSM2469065,GSM2469066,GSM2469067,GSM2469068,GSM2469069,GSM2469070,GSM2469071,GSM2469072,GSM2469073,GSM2469074,GSM2469075,GSM2469076,GSM2469077,GSM2469078,GSM2469079,GSM2469080,GSM2469081,GSM2469082,GSM2469083,GSM2469084,GSM2469085,GSM2469086,GSM2469087,GSM2469088,GSM2469089,GSM2469090,GSM2469091,GSM2469092,GSM2469093,GSM2469094,GSM2469095,GSM2469096,GSM2469097,GSM2469098
|
2 |
+
Rectal_Cancer,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,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,1.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0
|
p3/preprocess/Rectal_Cancer/code/GSE109057.py
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE109057"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE109057"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE109057.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE109057.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE109057.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/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 is gene expression microarray data, as stated in background info
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Feature Row and Type Conversion Functions
|
37 |
+
# trait is available from row 0
|
38 |
+
trait_row = 0
|
39 |
+
def convert_trait(x: str) -> int:
|
40 |
+
# All samples are rectal cancer, binary encoding 1
|
41 |
+
return 1
|
42 |
+
|
43 |
+
# gender is available from row 1
|
44 |
+
gender_row = 1
|
45 |
+
def convert_gender(x: str) -> int:
|
46 |
+
val = x.split(': ')[1]
|
47 |
+
if val == 'F':
|
48 |
+
return 0
|
49 |
+
elif val == 'M':
|
50 |
+
return 1
|
51 |
+
return None
|
52 |
+
|
53 |
+
# age is available from row 2
|
54 |
+
age_row = 2
|
55 |
+
def convert_age(x: str) -> float:
|
56 |
+
val = x.split(': ')[1]
|
57 |
+
# Extract lower bound of age range as representative value
|
58 |
+
try:
|
59 |
+
lower = float(val.split(' <=')[0])
|
60 |
+
return lower
|
61 |
+
except:
|
62 |
+
return None
|
63 |
+
|
64 |
+
# 3. Save initial filtering results
|
65 |
+
validate_and_save_cohort_info(
|
66 |
+
is_final=False,
|
67 |
+
cohort=cohort,
|
68 |
+
info_path=json_path,
|
69 |
+
is_gene_available=is_gene_available,
|
70 |
+
is_trait_available=True
|
71 |
+
)
|
72 |
+
|
73 |
+
# 4. Extract clinical features and save
|
74 |
+
clinical_df = geo_select_clinical_features(
|
75 |
+
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 |
+
print(preview_df(clinical_df))
|
87 |
+
|
88 |
+
# Save to CSV
|
89 |
+
clinical_df.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 |
+
# Based on the row IDs like '11715100_at', '11715101_s_at', '11715102_x_at'
|
106 |
+
# These appear to be Affymetrix probe IDs rather than gene symbols
|
107 |
+
requires_gene_mapping = True
|
108 |
+
# Extract gene annotation data
|
109 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
110 |
+
|
111 |
+
# Display column names and preview data
|
112 |
+
print("Column names:")
|
113 |
+
print(gene_annotation.columns)
|
114 |
+
|
115 |
+
print("\nPreview of gene annotation data:")
|
116 |
+
print(preview_df(gene_annotation))
|
117 |
+
# Create mapping dataframe using ID and Gene Symbol columns
|
118 |
+
mapping_df = get_gene_mapping(gene_annotation, 'ID', 'Gene Symbol')
|
119 |
+
|
120 |
+
# Apply gene mapping to convert probe level data to gene level
|
121 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
122 |
+
|
123 |
+
# Normalize gene symbols using standard dictionary
|
124 |
+
gene_data = normalize_gene_symbols_in_index(gene_data)
|
125 |
+
|
126 |
+
# Save gene expression data
|
127 |
+
gene_data.to_csv(out_gene_data_file)
|
128 |
+
|
129 |
+
# Print preview of gene data
|
130 |
+
print("Preview of gene expression data:")
|
131 |
+
print(preview_df(gene_data))
|
132 |
+
# Reload clinical data that was processed earlier
|
133 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
134 |
+
|
135 |
+
# 1. Normalize gene symbols
|
136 |
+
gene_data = normalize_gene_symbols_in_index(gene_data)
|
137 |
+
gene_data.to_csv(out_gene_data_file)
|
138 |
+
|
139 |
+
# 2. Link clinical and genetic data
|
140 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, gene_data)
|
141 |
+
|
142 |
+
# 3. Handle missing values systematically
|
143 |
+
linked_data = handle_missing_values(linked_data, trait)
|
144 |
+
|
145 |
+
# 4. Check for bias in trait and demographic features
|
146 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
147 |
+
|
148 |
+
# 5. Final validation and information saving
|
149 |
+
note = "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."
|
150 |
+
is_usable = validate_and_save_cohort_info(
|
151 |
+
is_final=True,
|
152 |
+
cohort=cohort,
|
153 |
+
info_path=json_path,
|
154 |
+
is_gene_available=True,
|
155 |
+
is_trait_available=True,
|
156 |
+
is_biased=trait_biased,
|
157 |
+
df=linked_data,
|
158 |
+
note=note
|
159 |
+
)
|
160 |
+
|
161 |
+
# 6. Save linked data only if usable
|
162 |
+
if is_usable:
|
163 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
164 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Rectal_Cancer/code/GSE119409.py
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE119409"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE119409"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE119409.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE119409.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE119409.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/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 series title and summary, this dataset contains gene expression data
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2.1 Data Availability
|
37 |
+
# Trait (sensitivity to therapy) is in row 2
|
38 |
+
trait_row = 2
|
39 |
+
|
40 |
+
# Age is in row 3
|
41 |
+
age_row = 3
|
42 |
+
|
43 |
+
# Gender is not available
|
44 |
+
gender_row = None
|
45 |
+
|
46 |
+
# 2.2 Data Type Conversion Functions
|
47 |
+
def convert_trait(x):
|
48 |
+
if not isinstance(x, str):
|
49 |
+
return None
|
50 |
+
x = x.split(': ')[1].lower()
|
51 |
+
if x == 'sensitive':
|
52 |
+
return 1
|
53 |
+
elif x == 'resistant':
|
54 |
+
return 0
|
55 |
+
return None
|
56 |
+
|
57 |
+
def convert_age(x):
|
58 |
+
if not isinstance(x, str):
|
59 |
+
return None
|
60 |
+
try:
|
61 |
+
age = int(x.split(': ')[1])
|
62 |
+
return age
|
63 |
+
except:
|
64 |
+
return None
|
65 |
+
|
66 |
+
def convert_gender(x):
|
67 |
+
return None
|
68 |
+
|
69 |
+
# 3. Save Metadata
|
70 |
+
validate_and_save_cohort_info(is_final=False,
|
71 |
+
cohort=cohort,
|
72 |
+
info_path=json_path,
|
73 |
+
is_gene_available=is_gene_available,
|
74 |
+
is_trait_available=(trait_row is not None))
|
75 |
+
|
76 |
+
# 4. Clinical Feature Extraction
|
77 |
+
# Extract features since trait data is available
|
78 |
+
clinical_df = geo_select_clinical_features(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 |
+
# Preview the extracted features
|
88 |
+
print("Preview of clinical features:")
|
89 |
+
print(preview_df(clinical_df))
|
90 |
+
|
91 |
+
# Save to CSV
|
92 |
+
clinical_df.to_csv(out_clinical_data_file)
|
93 |
+
# Get gene expression data from matrix file
|
94 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
95 |
+
|
96 |
+
# Examine data structure
|
97 |
+
print("Data structure and head:")
|
98 |
+
print(genetic_data.head())
|
99 |
+
|
100 |
+
print("\nShape:", genetic_data.shape)
|
101 |
+
|
102 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
103 |
+
print(list(genetic_data.index)[:20])
|
104 |
+
|
105 |
+
# Get a few column names to verify sample IDs
|
106 |
+
print("\nFirst 5 column names:")
|
107 |
+
print(list(genetic_data.columns)[:5])
|
108 |
+
# The gene identifiers in the data appear to be Affymetrix probe IDs (e.g. "1007_s_at", "1053_at")
|
109 |
+
# These are not standard gene symbols and need to be mapped to HGNC gene symbols
|
110 |
+
requires_gene_mapping = True
|
111 |
+
# Extract gene annotation data
|
112 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
113 |
+
|
114 |
+
# Display column names and preview data
|
115 |
+
print("Column names:")
|
116 |
+
print(gene_annotation.columns)
|
117 |
+
|
118 |
+
print("\nPreview of gene annotation data:")
|
119 |
+
print(preview_df(gene_annotation))
|
120 |
+
# From the preview, we can see 'ID' contains probe IDs matching gene expression data
|
121 |
+
# and 'Gene Symbol' contains corresponding gene symbols
|
122 |
+
|
123 |
+
# Get gene mapping between probe IDs and gene symbols
|
124 |
+
gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
125 |
+
|
126 |
+
# Convert probe data to gene expression data
|
127 |
+
gene_data = apply_gene_mapping(genetic_data, gene_mapping)
|
128 |
+
|
129 |
+
# Normalize the gene symbols in the data
|
130 |
+
gene_data = normalize_gene_symbols_in_index(gene_data)
|
131 |
+
|
132 |
+
# Print shape of final gene data
|
133 |
+
print("Gene expression data shape:", gene_data.shape)
|
134 |
+
print("\nPreview of gene 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 |
+
gene_data = normalize_gene_symbols_in_index(gene_data)
|
141 |
+
gene_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, gene_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 = "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."
|
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/Rectal_Cancer/code/GSE123390.py
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE123390"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE123390"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE123390.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE123390.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE123390.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/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 Availability
|
33 |
+
# Yes - Using Affymetrix Human Transcriptome Array 2.0 for global gene expression
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Conversion
|
37 |
+
|
38 |
+
# Trait (Response to treatment)
|
39 |
+
# Available in row 2 as "response" - binary outcome (pCR vs pIR)
|
40 |
+
trait_row = 2
|
41 |
+
|
42 |
+
def convert_trait(value):
|
43 |
+
if not isinstance(value, str):
|
44 |
+
return None
|
45 |
+
value = value.split(": ")[-1].strip()
|
46 |
+
if value == "pCR": # Complete response
|
47 |
+
return 1
|
48 |
+
elif value == "pIR": # Incomplete response
|
49 |
+
return 0
|
50 |
+
return None
|
51 |
+
|
52 |
+
# Age - Not available
|
53 |
+
age_row = None
|
54 |
+
convert_age = None
|
55 |
+
|
56 |
+
# Gender - Not available
|
57 |
+
gender_row = None
|
58 |
+
convert_gender = None
|
59 |
+
|
60 |
+
# 3. Save metadata
|
61 |
+
validate_and_save_cohort_info(
|
62 |
+
is_final=False,
|
63 |
+
cohort=cohort,
|
64 |
+
info_path=json_path,
|
65 |
+
is_gene_available=is_gene_available,
|
66 |
+
is_trait_available=trait_row is not None
|
67 |
+
)
|
68 |
+
|
69 |
+
# 4. Extract clinical features
|
70 |
+
if trait_row is not None:
|
71 |
+
selected_clinical = geo_select_clinical_features(
|
72 |
+
clinical_df=clinical_data,
|
73 |
+
trait=trait,
|
74 |
+
trait_row=trait_row,
|
75 |
+
convert_trait=convert_trait,
|
76 |
+
age_row=age_row,
|
77 |
+
convert_age=convert_age,
|
78 |
+
gender_row=gender_row,
|
79 |
+
convert_gender=convert_gender
|
80 |
+
)
|
81 |
+
|
82 |
+
print("Preview of selected clinical features:")
|
83 |
+
print(preview_df(selected_clinical))
|
84 |
+
|
85 |
+
# Save to CSV
|
86 |
+
selected_clinical.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 observation of the row IDs like "2824546_st", these are Affymetrix probe IDs
|
103 |
+
# rather than standard human gene symbols. They will need to be mapped to gene symbols.
|
104 |
+
requires_gene_mapping = True
|
105 |
+
# Extract gene annotation data
|
106 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
107 |
+
|
108 |
+
# Display column names and preview data
|
109 |
+
print("Column names:")
|
110 |
+
print(gene_annotation.columns)
|
111 |
+
|
112 |
+
print("\nPreview of gene annotation data:")
|
113 |
+
print(preview_df(gene_annotation))
|
114 |
+
# The 'ID' column in gene annotation appears to contain probe IDs that match the gene expression data index
|
115 |
+
# The 'gene_assignment' column contains gene symbols, but needs extraction
|
116 |
+
|
117 |
+
# Get gene mapping dataframe
|
118 |
+
mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
|
119 |
+
|
120 |
+
# Apply gene mapping to convert probe-level measurements to gene expression
|
121 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
122 |
+
|
123 |
+
# Print shape and preview gene expression data
|
124 |
+
print("\nShape of gene expression data after mapping:", gene_data.shape)
|
125 |
+
print("\nPreview of gene data:")
|
126 |
+
print(preview_df(gene_data))
|
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 |
+
gene_data = normalize_gene_symbols_in_index(gene_data)
|
132 |
+
gene_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, gene_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 rectal cancer patients examining chemoradiotherapy response."
|
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/Rectal_Cancer/code/GSE133057.py
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE133057"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE133057"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE133057.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE133057.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE133057.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/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, from background info this is transcriptomic analysis of rectal cancer biopsies
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Data Availability
|
38 |
+
# AJCC score is a measure of tumor regression (phenotypic trait)
|
39 |
+
trait_row = 1
|
40 |
+
gender_row = 2
|
41 |
+
age_row = 5
|
42 |
+
|
43 |
+
# 2.2 Data Type Conversion Functions
|
44 |
+
def convert_trait(value: str) -> int:
|
45 |
+
"""Convert AJCC score to binary where 0,1 are good response (0) and 2,3 are poor response (1)"""
|
46 |
+
if not value or ':' not in value:
|
47 |
+
return None
|
48 |
+
score = int(value.split(': ')[1])
|
49 |
+
if score in [0, 1]:
|
50 |
+
return 0 # good response
|
51 |
+
elif score in [2, 3]:
|
52 |
+
return 1 # poor response
|
53 |
+
return None
|
54 |
+
|
55 |
+
def convert_age(value: str) -> float:
|
56 |
+
"""Convert age string to float"""
|
57 |
+
if not value or ':' not in value:
|
58 |
+
return None
|
59 |
+
try:
|
60 |
+
return float(value.split(': ')[1])
|
61 |
+
except:
|
62 |
+
return None
|
63 |
+
|
64 |
+
def convert_gender(value: str) -> int:
|
65 |
+
"""Convert gender to binary (0=female, 1=male)"""
|
66 |
+
if not value or ':' not in value:
|
67 |
+
return None
|
68 |
+
gender = value.split(': ')[1].lower()
|
69 |
+
if gender == 'female':
|
70 |
+
return 0
|
71 |
+
elif gender == 'male':
|
72 |
+
return 1
|
73 |
+
return None
|
74 |
+
|
75 |
+
# 3. Save Metadata
|
76 |
+
is_trait_available = trait_row is not None
|
77 |
+
validate_and_save_cohort_info(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 |
+
# 4. Clinical Feature Extraction
|
84 |
+
if trait_row is not None:
|
85 |
+
clinical_features = geo_select_clinical_features(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 |
+
print("Preview of extracted clinical features:")
|
95 |
+
print(preview_df(clinical_features))
|
96 |
+
|
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 |
+
# Based on "ILMN_" prefix in gene identifiers, these appear to be Illumina probe IDs, not gene symbols
|
114 |
+
# They will need to be mapped to standard gene symbols for 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. From observation:
|
126 |
+
# - Gene expression data uses 'ILMN_' prefixed IDs
|
127 |
+
# - In gene annotation, 'ID' column stores these identifiers, and 'Symbol' column stores gene symbols
|
128 |
+
|
129 |
+
# 2. Get gene mapping dataframe
|
130 |
+
mapping_df = get_gene_mapping(gene_annotation, 'ID', 'Symbol')
|
131 |
+
|
132 |
+
# 3. Apply mapping to convert probe level data to gene level data
|
133 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
134 |
+
|
135 |
+
# Preview and save the gene expression data
|
136 |
+
print("\nGene expression data shape:", gene_data.shape)
|
137 |
+
print("\nPreview of gene expression data:")
|
138 |
+
print(preview_df(gene_data))
|
139 |
+
|
140 |
+
gene_data.to_csv(out_gene_data_file)
|
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 |
+
gene_data = normalize_gene_symbols_in_index(gene_data)
|
146 |
+
gene_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, gene_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 = "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."
|
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/Rectal_Cancer/code/GSE139255.py
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE139255"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE139255"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE139255.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE139255.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE139255.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# Yes - The background info mentions gene expression analysis with nCounter PanCancer Pathway Panel analyzing 770 genes
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Type Conversion
|
37 |
+
# 2.1 Row identification
|
38 |
+
trait_row = 0 # Histological response data is in row 0
|
39 |
+
age_row = None # Age data not available
|
40 |
+
gender_row = None # Gender data not available
|
41 |
+
|
42 |
+
# 2.2 Conversion functions
|
43 |
+
def convert_trait(value):
|
44 |
+
if not isinstance(value, str):
|
45 |
+
return None
|
46 |
+
value = value.split(': ')[-1].strip().lower()
|
47 |
+
if 'good-response' in value:
|
48 |
+
return 1
|
49 |
+
elif 'non-response' in value:
|
50 |
+
return 0
|
51 |
+
return None
|
52 |
+
|
53 |
+
convert_age = None
|
54 |
+
convert_gender = None
|
55 |
+
|
56 |
+
# 3. Save metadata
|
57 |
+
validate_and_save_cohort_info(
|
58 |
+
is_final=False,
|
59 |
+
cohort=cohort,
|
60 |
+
info_path=json_path,
|
61 |
+
is_gene_available=is_gene_available,
|
62 |
+
is_trait_available=trait_row is not None
|
63 |
+
)
|
64 |
+
|
65 |
+
# 4. Extract clinical features
|
66 |
+
clinical_df = geo_select_clinical_features(
|
67 |
+
clinical_df=clinical_data,
|
68 |
+
trait=trait,
|
69 |
+
trait_row=trait_row,
|
70 |
+
convert_trait=convert_trait,
|
71 |
+
age_row=age_row,
|
72 |
+
convert_age=convert_age,
|
73 |
+
gender_row=gender_row,
|
74 |
+
convert_gender=convert_gender
|
75 |
+
)
|
76 |
+
|
77 |
+
# Preview and save clinical data
|
78 |
+
print("Clinical data preview:")
|
79 |
+
print(preview_df(clinical_df))
|
80 |
+
clinical_df.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 |
+
# Looking at the gene IDs like ABL1, ACAD9, ACVR1B - these are standard human gene symbols
|
97 |
+
# No mapping required as they are already in the correct format
|
98 |
+
requires_gene_mapping = False
|
99 |
+
# Reload clinical data that was processed earlier
|
100 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
101 |
+
|
102 |
+
# 1. Normalize gene symbols
|
103 |
+
genetic_data = normalize_gene_symbols_in_index(genetic_data)
|
104 |
+
genetic_data.to_csv(out_gene_data_file)
|
105 |
+
|
106 |
+
# 2. Link clinical and genetic data
|
107 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
108 |
+
|
109 |
+
# 3. Handle missing values systematically
|
110 |
+
linked_data = handle_missing_values(linked_data, trait)
|
111 |
+
|
112 |
+
# 4. Check for bias in trait and demographic features
|
113 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
114 |
+
|
115 |
+
# 5. Final validation and information saving
|
116 |
+
note = "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."
|
117 |
+
is_usable = validate_and_save_cohort_info(
|
118 |
+
is_final=True,
|
119 |
+
cohort=cohort,
|
120 |
+
info_path=json_path,
|
121 |
+
is_gene_available=True,
|
122 |
+
is_trait_available=True,
|
123 |
+
is_biased=trait_biased,
|
124 |
+
df=linked_data,
|
125 |
+
note=note
|
126 |
+
)
|
127 |
+
|
128 |
+
# 6. Save linked data only if usable
|
129 |
+
if is_usable:
|
130 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
131 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Rectal_Cancer/code/GSE145037.py
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE145037"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE145037"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE145037.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE145037.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE145037.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# Get file paths
|
19 |
+
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
|
20 |
+
|
21 |
+
# Get background info and clinical data
|
22 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
|
23 |
+
print("Background Information:")
|
24 |
+
print(background_info)
|
25 |
+
print("\nSample Characteristics:")
|
26 |
+
|
27 |
+
# Get dictionary of unique values per row
|
28 |
+
unique_values_dict = get_unique_values_by_row(clinical_data)
|
29 |
+
for row, values in unique_values_dict.items():
|
30 |
+
print(f"\n{row}:")
|
31 |
+
print(values)
|
32 |
+
# 1. Gene Expression Data Availability
|
33 |
+
# From background info, this dataset contains gene expression data from rectal cancer patients
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Row identifiers
|
38 |
+
trait_row = 3 # response to CRT in row 3
|
39 |
+
age_row = 2 # age in row 2
|
40 |
+
gender_row = 1 # gender in row 1
|
41 |
+
|
42 |
+
# 2.2 Conversion functions
|
43 |
+
def convert_trait(x):
|
44 |
+
if not x:
|
45 |
+
return None
|
46 |
+
value = x.split(': ')[1].lower()
|
47 |
+
return 0 if 'non-response' in value else 1
|
48 |
+
|
49 |
+
def convert_age(x):
|
50 |
+
if not x:
|
51 |
+
return None
|
52 |
+
try:
|
53 |
+
return int(x.split(': ')[1])
|
54 |
+
except:
|
55 |
+
return None
|
56 |
+
|
57 |
+
def convert_gender(x):
|
58 |
+
if not x:
|
59 |
+
return None
|
60 |
+
value = x.split(': ')[1].lower()
|
61 |
+
return 1 if 'male' in value else 0
|
62 |
+
|
63 |
+
# 3. Save metadata for initial filtering
|
64 |
+
is_trait_avail = trait_row is not None
|
65 |
+
validate_and_save_cohort_info(is_final=False,
|
66 |
+
cohort=cohort,
|
67 |
+
info_path=json_path,
|
68 |
+
is_gene_available=is_gene_available,
|
69 |
+
is_trait_available=is_trait_avail)
|
70 |
+
|
71 |
+
# 4. Extract clinical features
|
72 |
+
selected_clinical = geo_select_clinical_features(clinical_data,
|
73 |
+
trait="Response",
|
74 |
+
trait_row=trait_row,
|
75 |
+
convert_trait=convert_trait,
|
76 |
+
age_row=age_row,
|
77 |
+
convert_age=convert_age,
|
78 |
+
gender_row=gender_row,
|
79 |
+
convert_gender=convert_gender)
|
80 |
+
|
81 |
+
# Preview the extracted data
|
82 |
+
preview_dict = preview_df(selected_clinical)
|
83 |
+
print("Preview of extracted clinical data:")
|
84 |
+
print(preview_dict)
|
85 |
+
|
86 |
+
# Save clinical data
|
87 |
+
selected_clinical.to_csv(out_clinical_data_file)
|
88 |
+
# Get gene expression data from matrix file
|
89 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
90 |
+
|
91 |
+
# Examine data structure
|
92 |
+
print("Data structure and head:")
|
93 |
+
print(genetic_data.head())
|
94 |
+
|
95 |
+
print("\nShape:", genetic_data.shape)
|
96 |
+
|
97 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
98 |
+
print(list(genetic_data.index)[:20])
|
99 |
+
|
100 |
+
# Get a few column names to verify sample IDs
|
101 |
+
print("\nFirst 5 column names:")
|
102 |
+
print(list(genetic_data.columns)[:5])
|
103 |
+
# The IDs are human gene symbols (e.g. A1BG, A1CF, A2M) and do not need mapping
|
104 |
+
requires_gene_mapping = False
|
105 |
+
# Reload clinical data that was processed earlier
|
106 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
107 |
+
|
108 |
+
# 1. Normalize gene symbols
|
109 |
+
genetic_data = normalize_gene_symbols_in_index(genetic_data)
|
110 |
+
genetic_data.to_csv(out_gene_data_file)
|
111 |
+
|
112 |
+
# 2. Link clinical and genetic data
|
113 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
114 |
+
|
115 |
+
# 3. Handle missing values systematically
|
116 |
+
linked_data = handle_missing_values(linked_data, "Response")
|
117 |
+
|
118 |
+
# 4. Check for bias in trait and demographic features
|
119 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, "Response")
|
120 |
+
|
121 |
+
# 5. Final validation and information saving
|
122 |
+
note = "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."
|
123 |
+
is_usable = validate_and_save_cohort_info(
|
124 |
+
is_final=True,
|
125 |
+
cohort=cohort,
|
126 |
+
info_path=json_path,
|
127 |
+
is_gene_available=True,
|
128 |
+
is_trait_available=True,
|
129 |
+
is_biased=trait_biased,
|
130 |
+
df=linked_data,
|
131 |
+
note=note
|
132 |
+
)
|
133 |
+
|
134 |
+
# 6. Save linked data only if usable
|
135 |
+
if is_usable:
|
136 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
137 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Rectal_Cancer/code/GSE150082.py
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE150082"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE150082"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE150082.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE150082.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE150082.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/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 Series_title and Series_summary, we can see this is a microarray gene expression dataset
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# Trait (Response to treatment)
|
38 |
+
trait_row = 4 # 'response' field has Good/Poor values
|
39 |
+
def convert_trait(x):
|
40 |
+
if pd.isna(x): return None
|
41 |
+
val = x.split(': ')[1]
|
42 |
+
if val == 'Poor': return 0
|
43 |
+
if val == 'Good': return 1
|
44 |
+
return None
|
45 |
+
|
46 |
+
# Age
|
47 |
+
age_row = 2
|
48 |
+
def convert_age(x):
|
49 |
+
if pd.isna(x): return None
|
50 |
+
try:
|
51 |
+
return int(x.split(': ')[1])
|
52 |
+
except:
|
53 |
+
return None
|
54 |
+
|
55 |
+
# Gender/Sex
|
56 |
+
gender_row = 0
|
57 |
+
def convert_gender(x):
|
58 |
+
if pd.isna(x): return None
|
59 |
+
val = x.split(': ')[1]
|
60 |
+
if val == 'F': return 0
|
61 |
+
if val == 'M': return 1
|
62 |
+
return None
|
63 |
+
|
64 |
+
# 3. Save Metadata
|
65 |
+
is_trait_available = trait_row is not None
|
66 |
+
validate_and_save_cohort_info(is_final=False, cohort=cohort, info_path=json_path,
|
67 |
+
is_gene_available=is_gene_available,
|
68 |
+
is_trait_available=is_trait_available)
|
69 |
+
|
70 |
+
# 4. Clinical Feature Extraction
|
71 |
+
clinical_features = geo_select_clinical_features(clinical_data, trait, trait_row, convert_trait,
|
72 |
+
age_row, convert_age,
|
73 |
+
gender_row, convert_gender)
|
74 |
+
|
75 |
+
# Preview the extracted features
|
76 |
+
preview_dict = preview_df(clinical_features)
|
77 |
+
print("Preview of clinical features:")
|
78 |
+
print(preview_dict)
|
79 |
+
|
80 |
+
# Save clinical data
|
81 |
+
clinical_features.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 |
+
# Based on inspecting the gene identifiers (e.g. 'A_23_P100001'), these appear to be probe IDs
|
98 |
+
# from an Agilent microarray platform, not standard human gene symbols.
|
99 |
+
# They will need to be mapped to proper gene symbols.
|
100 |
+
|
101 |
+
requires_gene_mapping = True
|
102 |
+
# Extract gene annotation data
|
103 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
104 |
+
|
105 |
+
# Display column names and preview data
|
106 |
+
print("Column names:")
|
107 |
+
print(gene_annotation.columns)
|
108 |
+
|
109 |
+
print("\nPreview of gene annotation data:")
|
110 |
+
print(preview_df(gene_annotation))
|
111 |
+
# 1. Determine mapping columns:
|
112 |
+
# 'ID' column in annotation contains same identifiers as gene expression data
|
113 |
+
# 'GENE_SYMBOL' contains the gene symbols we want to map to
|
114 |
+
|
115 |
+
# 2. Get mapping dataframe with ID and gene symbol columns
|
116 |
+
gene_mapping = get_gene_mapping(gene_annotation, 'ID', 'GENE_SYMBOL')
|
117 |
+
|
118 |
+
# 3. Apply gene mapping to convert probe-level data to gene-level expression
|
119 |
+
gene_data = apply_gene_mapping(genetic_data, gene_mapping)
|
120 |
+
|
121 |
+
# Preview transformed data
|
122 |
+
print("Gene expression data shape after mapping:", gene_data.shape)
|
123 |
+
print("\nPreview of first few rows:")
|
124 |
+
print(gene_data.head())
|
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 = "Dataset contains gene expression data from rectal cancer patients with focus on KRAS mutation status."
|
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/Rectal_Cancer/code/GSE170999.py
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE170999"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE170999"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE170999.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE170999.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE170999.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/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 (Affymetrix U133 platform mentioned)
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
|
38 |
+
# 2.1 Find row indices for clinical variables
|
39 |
+
trait_row = 0 # KRAS mutation status is at row 0
|
40 |
+
age_row = None # Age data not available
|
41 |
+
gender_row = None # Gender data not available
|
42 |
+
|
43 |
+
# 2.2 Data type conversion functions
|
44 |
+
def convert_trait(val):
|
45 |
+
if not isinstance(val, str):
|
46 |
+
return None
|
47 |
+
val = val.lower().split(': ')[-1]
|
48 |
+
if 'mutant' in val:
|
49 |
+
return 1
|
50 |
+
elif 'wild-type' in val:
|
51 |
+
return 0
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_age(val):
|
55 |
+
return None # Not used since age data not available
|
56 |
+
|
57 |
+
def convert_gender(val):
|
58 |
+
return None # Not used since gender data not available
|
59 |
+
|
60 |
+
# 3. Save metadata
|
61 |
+
validate_and_save_cohort_info(
|
62 |
+
is_final=False,
|
63 |
+
cohort=cohort,
|
64 |
+
info_path=json_path,
|
65 |
+
is_gene_available=is_gene_available,
|
66 |
+
is_trait_available=(trait_row is not None)
|
67 |
+
)
|
68 |
+
|
69 |
+
# 4. Extract clinical features
|
70 |
+
if trait_row is not None:
|
71 |
+
clinical_features = geo_select_clinical_features(
|
72 |
+
clinical_df=clinical_data,
|
73 |
+
trait=trait,
|
74 |
+
trait_row=trait_row,
|
75 |
+
convert_trait=convert_trait,
|
76 |
+
age_row=age_row,
|
77 |
+
convert_age=convert_age,
|
78 |
+
gender_row=gender_row,
|
79 |
+
convert_gender=convert_gender
|
80 |
+
)
|
81 |
+
|
82 |
+
# Preview the extracted features
|
83 |
+
print("Preview of clinical features:")
|
84 |
+
print(preview_df(clinical_features))
|
85 |
+
|
86 |
+
# Save clinical data
|
87 |
+
clinical_features.to_csv(out_clinical_data_file)
|
88 |
+
# Get gene expression data from matrix file
|
89 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
90 |
+
|
91 |
+
# Examine data structure
|
92 |
+
print("Data structure and head:")
|
93 |
+
print(genetic_data.head())
|
94 |
+
|
95 |
+
print("\nShape:", genetic_data.shape)
|
96 |
+
|
97 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
98 |
+
print(list(genetic_data.index)[:20])
|
99 |
+
|
100 |
+
# Get a few column names to verify sample IDs
|
101 |
+
print("\nFirst 5 column names:")
|
102 |
+
print(list(genetic_data.columns)[:5])
|
103 |
+
# These appear to be probe IDs from Affymetrix U133 Plus 2.0 microarray
|
104 |
+
# Not gene symbols - need to map to HGNC gene symbols
|
105 |
+
requires_gene_mapping = True
|
106 |
+
# Extract gene annotation data
|
107 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
108 |
+
|
109 |
+
# Display column names and preview data
|
110 |
+
print("Column names:")
|
111 |
+
print(gene_annotation.columns)
|
112 |
+
|
113 |
+
print("\nPreview of gene annotation data:")
|
114 |
+
print(preview_df(gene_annotation))
|
115 |
+
# 1. The 'ID' column in gene annotation matches probe IDs in gene expression data
|
116 |
+
# and 'Gene Symbol' contains the corresponding gene symbols
|
117 |
+
|
118 |
+
# 2. Extract mapping between probe IDs and gene symbols
|
119 |
+
mapping_data = get_gene_mapping(gene_annotation, "ID", "Gene Symbol")
|
120 |
+
|
121 |
+
# 3. Apply gene mapping to convert probe-level data to gene-level data
|
122 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_data)
|
123 |
+
|
124 |
+
# Preview gene data
|
125 |
+
print("Preview of gene expression data after mapping:")
|
126 |
+
print(gene_data.head())
|
127 |
+
print("\nShape:", gene_data.shape)
|
128 |
+
# Reload clinical data that was processed earlier
|
129 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
130 |
+
|
131 |
+
# 1. Normalize gene symbols
|
132 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
133 |
+
genetic_data.to_csv(out_gene_data_file)
|
134 |
+
|
135 |
+
# 2. Link clinical and genetic data
|
136 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
137 |
+
|
138 |
+
# 3. Handle missing values systematically
|
139 |
+
linked_data = handle_missing_values(linked_data, trait)
|
140 |
+
|
141 |
+
# 4. Check for bias in trait and demographic features
|
142 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
143 |
+
|
144 |
+
# 5. Final validation and information saving
|
145 |
+
note = "Dataset contains gene expression data from rectal cancer patients with focus on KRAS mutation status."
|
146 |
+
is_usable = validate_and_save_cohort_info(
|
147 |
+
is_final=True,
|
148 |
+
cohort=cohort,
|
149 |
+
info_path=json_path,
|
150 |
+
is_gene_available=True,
|
151 |
+
is_trait_available=True,
|
152 |
+
is_biased=trait_biased,
|
153 |
+
df=linked_data,
|
154 |
+
note=note
|
155 |
+
)
|
156 |
+
|
157 |
+
# 6. Save linked data only if usable
|
158 |
+
if is_usable:
|
159 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
160 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Rectal_Cancer/code/GSE40492.py
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE40492"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE40492"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE40492.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE40492.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE40492.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/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 check
|
33 |
+
# From background info, it's a gene expression microarray study for molecular markers
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable availability and data type conversion
|
37 |
+
# 2.1 Row identification
|
38 |
+
# Trait: Use pathological tumor status after treatment (lymph node status) from row 9
|
39 |
+
trait_row = 9
|
40 |
+
|
41 |
+
# Age: Available in row 1
|
42 |
+
age_row = 1
|
43 |
+
|
44 |
+
# Gender: Available in row 2 as 'Sex'
|
45 |
+
gender_row = 2
|
46 |
+
|
47 |
+
# 2.2 Conversion functions
|
48 |
+
def convert_trait(x):
|
49 |
+
# Convert lymph node status to binary:
|
50 |
+
# 0 = negative nodes, 1 = positive nodes (1 or 2)
|
51 |
+
if x is None or 'NA' in str(x):
|
52 |
+
return None
|
53 |
+
val = x.split(': ')[1]
|
54 |
+
if val == '0':
|
55 |
+
return 0
|
56 |
+
elif val in ['1', '2']:
|
57 |
+
return 1
|
58 |
+
return None
|
59 |
+
|
60 |
+
def convert_age(x):
|
61 |
+
if x is None or 'NA' in str(x):
|
62 |
+
return None
|
63 |
+
try:
|
64 |
+
return float(x.split(': ')[1])
|
65 |
+
except:
|
66 |
+
return None
|
67 |
+
|
68 |
+
def convert_gender(x):
|
69 |
+
if x is None or 'NA' in str(x):
|
70 |
+
return None
|
71 |
+
val = x.split(': ')[1].lower()
|
72 |
+
if 'female' in val:
|
73 |
+
return 0
|
74 |
+
elif 'male' in val:
|
75 |
+
return 1
|
76 |
+
return None
|
77 |
+
|
78 |
+
# 3. Initial filtering and metadata saving
|
79 |
+
is_usable = validate_and_save_cohort_info(
|
80 |
+
is_final=False,
|
81 |
+
cohort=cohort,
|
82 |
+
info_path=json_path,
|
83 |
+
is_gene_available=is_gene_available,
|
84 |
+
is_trait_available=trait_row is not None
|
85 |
+
)
|
86 |
+
|
87 |
+
# 4. Clinical feature extraction
|
88 |
+
if trait_row is not None:
|
89 |
+
clinical_df = geo_select_clinical_features(
|
90 |
+
clinical_data,
|
91 |
+
trait="Lymph_Node_Status",
|
92 |
+
trait_row=trait_row,
|
93 |
+
convert_trait=convert_trait,
|
94 |
+
age_row=age_row,
|
95 |
+
convert_age=convert_age,
|
96 |
+
gender_row=gender_row,
|
97 |
+
convert_gender=convert_gender
|
98 |
+
)
|
99 |
+
|
100 |
+
print("Preview of extracted clinical features:")
|
101 |
+
print(preview_df(clinical_df))
|
102 |
+
|
103 |
+
# Save clinical data
|
104 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
105 |
+
clinical_df.to_csv(out_clinical_data_file)
|
106 |
+
# Get gene expression data from matrix file
|
107 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
108 |
+
|
109 |
+
# Examine data structure
|
110 |
+
print("Data structure and head:")
|
111 |
+
print(genetic_data.head())
|
112 |
+
|
113 |
+
print("\nShape:", genetic_data.shape)
|
114 |
+
|
115 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
116 |
+
print(list(genetic_data.index)[:20])
|
117 |
+
|
118 |
+
# Get a few column names to verify sample IDs
|
119 |
+
print("\nFirst 5 column names:")
|
120 |
+
print(list(genetic_data.columns)[:5])
|
121 |
+
# The IDs are just ordinal numbers and require mapping to human 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 |
+
# Extract probe ID and gene symbol columns from annotation
|
133 |
+
mapping_df = get_gene_mapping(gene_annotation, 'ID', 'GENE_SYMBOL')
|
134 |
+
|
135 |
+
# Convert probe-level measurements to gene-level expression
|
136 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
137 |
+
|
138 |
+
# Preview the processed data
|
139 |
+
print("Preview of gene expression data:")
|
140 |
+
print(gene_data.head())
|
141 |
+
print("\nShape:", gene_data.shape)
|
142 |
+
print("\nFirst 10 gene symbols:")
|
143 |
+
print(list(gene_data.index)[:10])
|
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, "Lymph_Node_Status")
|
156 |
+
|
157 |
+
# 4. Check for bias in trait and demographic features
|
158 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, "Lymph_Node_Status")
|
159 |
+
|
160 |
+
# 5. Final validation and information saving
|
161 |
+
note = "Dataset contains gene expression data from rectal cancer patients with focus on lymph node status after treatment."
|
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/Rectal_Cancer/code/GSE94104.py
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
cohort = "GSE94104"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Rectal_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Rectal_Cancer/GSE94104"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/GSE94104.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/GSE94104.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/GSE94104.csv"
|
16 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/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 info mentions RNA and expression beadchip, so gene expression data is likely available
|
34 |
+
is_gene_available = True
|
35 |
+
|
36 |
+
# 2. Variable Availability and Data Type Conversion
|
37 |
+
# 2.1 Data Availability
|
38 |
+
trait_row = 2 # Tumour regression grade is available and varies
|
39 |
+
age_row = None # Age not provided
|
40 |
+
gender_row = None # Gender not provided
|
41 |
+
|
42 |
+
# 2.2 Data Type Conversion Functions
|
43 |
+
def convert_trait(value):
|
44 |
+
if not isinstance(value, str):
|
45 |
+
return None
|
46 |
+
# Extract numeric grade after colon
|
47 |
+
try:
|
48 |
+
grade = int(value.split(': ')[1])
|
49 |
+
# Convert to binary: grade 1-2 (good response) vs grade 3 (poor response)
|
50 |
+
return 0 if grade <= 2 else 1
|
51 |
+
except:
|
52 |
+
return None
|
53 |
+
|
54 |
+
# No age or gender conversion functions needed since data not available
|
55 |
+
convert_age = None
|
56 |
+
convert_gender = None
|
57 |
+
|
58 |
+
# 3. Save Metadata
|
59 |
+
is_usable = 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=trait_row is not None
|
65 |
+
)
|
66 |
+
|
67 |
+
# 4. Clinical Feature Extraction
|
68 |
+
if trait_row is not None:
|
69 |
+
# Extract available features
|
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 |
+
preview = preview_df(clinical_features)
|
83 |
+
print("Preview of clinical features:")
|
84 |
+
print(preview)
|
85 |
+
|
86 |
+
# Save to CSV
|
87 |
+
clinical_features.to_csv(out_clinical_data_file)
|
88 |
+
# Get gene expression data from matrix file
|
89 |
+
genetic_data = get_genetic_data(matrix_file_path)
|
90 |
+
|
91 |
+
# Examine data structure
|
92 |
+
print("Data structure and head:")
|
93 |
+
print(genetic_data.head())
|
94 |
+
|
95 |
+
print("\nShape:", genetic_data.shape)
|
96 |
+
|
97 |
+
print("\nFirst 20 row IDs (gene/probe identifiers):")
|
98 |
+
print(list(genetic_data.index)[:20])
|
99 |
+
|
100 |
+
# Get a few column names to verify sample IDs
|
101 |
+
print("\nFirst 5 column names:")
|
102 |
+
print(list(genetic_data.columns)[:5])
|
103 |
+
# The gene identifiers start with "ILMN_" which indicates these are Illumina probe IDs
|
104 |
+
# They need to be mapped to standard human gene symbols for downstream analysis
|
105 |
+
requires_gene_mapping = True
|
106 |
+
# Extract gene annotation data
|
107 |
+
gene_annotation = get_gene_annotation(soft_file_path)
|
108 |
+
|
109 |
+
# Display column names and preview data
|
110 |
+
print("Column names:")
|
111 |
+
print(gene_annotation.columns)
|
112 |
+
|
113 |
+
print("\nPreview of gene annotation data:")
|
114 |
+
print(preview_df(gene_annotation))
|
115 |
+
# 1. Identify relevant columns
|
116 |
+
# The gene expression data uses "ILMN_" IDs which match the 'ID' column in annotation
|
117 |
+
# The 'Symbol' column contains gene symbols
|
118 |
+
|
119 |
+
# 2. Get mapping between probe IDs and gene symbols
|
120 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
|
121 |
+
|
122 |
+
# 3. Apply mapping to convert probe data to gene expression data
|
123 |
+
gene_data = apply_gene_mapping(genetic_data, mapping_df)
|
124 |
+
# Reload clinical data that was processed earlier
|
125 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
126 |
+
|
127 |
+
# 1. Normalize gene symbols
|
128 |
+
genetic_data = normalize_gene_symbols_in_index(gene_data)
|
129 |
+
genetic_data.to_csv(out_gene_data_file)
|
130 |
+
|
131 |
+
# 2. Link clinical and genetic data
|
132 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, genetic_data)
|
133 |
+
|
134 |
+
# 3. Handle missing values systematically
|
135 |
+
linked_data = handle_missing_values(linked_data, trait)
|
136 |
+
|
137 |
+
# 4. Check for bias in trait and demographic features
|
138 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
139 |
+
|
140 |
+
# 5. Final validation and information saving
|
141 |
+
note = "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."
|
142 |
+
is_usable = validate_and_save_cohort_info(
|
143 |
+
is_final=True,
|
144 |
+
cohort=cohort,
|
145 |
+
info_path=json_path,
|
146 |
+
is_gene_available=True,
|
147 |
+
is_trait_available=True,
|
148 |
+
is_biased=trait_biased,
|
149 |
+
df=linked_data,
|
150 |
+
note=note
|
151 |
+
)
|
152 |
+
|
153 |
+
# 6. Save linked data only if usable
|
154 |
+
if is_usable:
|
155 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
156 |
+
linked_data.to_csv(out_data_file)
|
p3/preprocess/Rectal_Cancer/code/TCGA.py
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Rectal_Cancer"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/3/Rectal_Cancer/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/3/Rectal_Cancer/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/3/Rectal_Cancer/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/3/Rectal_Cancer/cohort_info.json"
|
15 |
+
|
16 |
+
# 1. Find directory for rectal cancer data
|
17 |
+
selected_dir = 'TCGA_Rectal_Cancer_(READ)'
|
18 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_dir)
|
19 |
+
|
20 |
+
# 2. Get file paths for clinical and genetic data
|
21 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
22 |
+
|
23 |
+
# 3. Load the data files
|
24 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
25 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
26 |
+
|
27 |
+
# 4. Print clinical data columns
|
28 |
+
print("Clinical data columns:")
|
29 |
+
print(clinical_df.columns.tolist())
|
30 |
+
|
31 |
+
# Record data availability
|
32 |
+
is_gene_available = len(genetic_df.columns) > 0
|
33 |
+
is_trait_available = len(clinical_df.columns) > 0
|
34 |
+
|
35 |
+
validate_and_save_cohort_info(
|
36 |
+
is_final=False,
|
37 |
+
cohort="TCGA",
|
38 |
+
info_path=json_path,
|
39 |
+
is_gene_available=is_gene_available,
|
40 |
+
is_trait_available=is_trait_available
|
41 |
+
)
|
42 |
+
# Define candidate columns for age and gender
|
43 |
+
candidate_age_cols = ["age_at_initial_pathologic_diagnosis", "days_to_birth"]
|
44 |
+
candidate_gender_cols = ["gender"]
|
45 |
+
|
46 |
+
# Load clinical data directly from the root directory
|
47 |
+
clinical_file_path = os.path.join(tcga_root_dir, "READ.clinical.txt")
|
48 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep="\t")
|
49 |
+
|
50 |
+
# Extract and preview age columns
|
51 |
+
age_preview = {}
|
52 |
+
for col in candidate_age_cols:
|
53 |
+
if col in clinical_df.columns:
|
54 |
+
age_preview[col] = clinical_df[col].head(5).tolist()
|
55 |
+
print("Age columns preview:", preview_df(clinical_df[candidate_age_cols], n=5))
|
56 |
+
|
57 |
+
# Extract and preview gender columns
|
58 |
+
gender_preview = {}
|
59 |
+
for col in candidate_gender_cols:
|
60 |
+
if col in clinical_df.columns:
|
61 |
+
gender_preview[col] = clinical_df[col].head(5).tolist()
|
62 |
+
print("\nGender columns preview:", preview_df(clinical_df[candidate_gender_cols], n=5))
|
63 |
+
# For Rectal Cancer cohort from TCGA dataset
|
64 |
+
candidate_age_cols = ["age_at_diagnosis", "age_at_index", "age_began_smoking", "age_at_initial_pathologic_diagnosis"]
|
65 |
+
candidate_gender_cols = ["gender", "sex"]
|
66 |
+
|
67 |
+
# Get clinical file path
|
68 |
+
clinical_file_path, _ = tcga_get_relevant_filepaths(os.path.join(tcga_root_dir, trait))
|
69 |
+
|
70 |
+
# Load clinical data
|
71 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0)
|
72 |
+
|
73 |
+
# Create preview dictionaries
|
74 |
+
age_preview = {}
|
75 |
+
for col in candidate_age_cols:
|
76 |
+
if col in clinical_df.columns:
|
77 |
+
age_preview[col] = clinical_df[col].head().to_list()
|
78 |
+
|
79 |
+
gender_preview = {}
|
80 |
+
for col in candidate_gender_cols:
|
81 |
+
if col in clinical_df.columns:
|
82 |
+
gender_preview[col] = clinical_df[col].head().to_list()
|
83 |
+
|
84 |
+
print("Age columns preview:", age_preview)
|
85 |
+
print("Gender columns preview:", gender_preview)
|
86 |
+
# 1. Find directory for rectal cancer data
|
87 |
+
selected_dir = 'TCGA_Rectal_Cancer_(READ)'
|
88 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_dir)
|
89 |
+
|
90 |
+
# 2. Get file paths for clinical and genetic data
|
91 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
92 |
+
|
93 |
+
# 3. Load the data files
|
94 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
95 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
96 |
+
|
97 |
+
# 4. Print clinical data columns
|
98 |
+
print("Clinical data columns:")
|
99 |
+
print(clinical_df.columns.tolist())
|
100 |
+
|
101 |
+
# Record data availability
|
102 |
+
is_gene_available = len(genetic_df.columns) > 0
|
103 |
+
is_trait_available = len(clinical_df.columns) > 0
|
104 |
+
|
105 |
+
validate_and_save_cohort_info(
|
106 |
+
is_final=False,
|
107 |
+
cohort="TCGA",
|
108 |
+
info_path=json_path,
|
109 |
+
is_gene_available=is_gene_available,
|
110 |
+
is_trait_available=is_trait_available
|
111 |
+
)
|
112 |
+
# Get age column name
|
113 |
+
age_candidates = {
|
114 |
+
'age_at_initial_pathologic_diagnosis': ['56', '45', '72', '71', '65'],
|
115 |
+
'days_to_birth': ['-20454', '-27549', '-28914', '-24705', '-19724']
|
116 |
+
}
|
117 |
+
|
118 |
+
# 'age_at_initial_pathologic_diagnosis' is more direct and interpretable than 'days_to_birth'
|
119 |
+
age_col = 'age_at_initial_pathologic_diagnosis'
|
120 |
+
|
121 |
+
# Get gender column name
|
122 |
+
gender_candidates = {
|
123 |
+
'gender': ['MALE', 'FEMALE', 'MALE', 'MALE', 'MALE']
|
124 |
+
}
|
125 |
+
|
126 |
+
# 'gender' is the only and valid column for gender information
|
127 |
+
gender_col = 'gender'
|
128 |
+
|
129 |
+
# Print chosen columns
|
130 |
+
print(f"Selected age column: {age_col}")
|
131 |
+
print(f"Selected gender column: {gender_col}")
|
132 |
+
# 1. Extract and standardize clinical features
|
133 |
+
selected_clinical_df = tcga_select_clinical_features(clinical_df, trait, age_col, gender_col)
|
134 |
+
|
135 |
+
# 2. Normalize gene symbols in genetic data
|
136 |
+
normalized_genetic_df = normalize_gene_symbols_in_index(genetic_df)
|
137 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
138 |
+
normalized_genetic_df.to_csv(out_gene_data_file)
|
139 |
+
|
140 |
+
# 3. Link clinical and genetic data
|
141 |
+
linked_data = pd.merge(selected_clinical_df, normalized_genetic_df.T, left_index=True, right_index=True)
|
142 |
+
|
143 |
+
# 4. Handle missing values
|
144 |
+
linked_data = handle_missing_values(linked_data, trait)
|
145 |
+
|
146 |
+
# 5. Check for bias in trait and demographic features
|
147 |
+
is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
148 |
+
|
149 |
+
# 6. Validate and save cohort info
|
150 |
+
note = f"Sample size after preprocessing: {len(linked_data)}. Number of genes: {len(linked_data.columns) - 3}"
|
151 |
+
is_usable = validate_and_save_cohort_info(
|
152 |
+
is_final=True,
|
153 |
+
cohort="TCGA",
|
154 |
+
info_path=json_path,
|
155 |
+
is_gene_available=True,
|
156 |
+
is_trait_available=True,
|
157 |
+
is_biased=is_biased,
|
158 |
+
df=linked_data,
|
159 |
+
note=note
|
160 |
+
)
|
161 |
+
|
162 |
+
# 7. Save linked data if usable
|
163 |
+
if is_usable:
|
164 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
165 |
+
linked_data.to_csv(out_data_file)
|
166 |
+
print(f"Linked data saved to {out_data_file}")
|
167 |
+
print("Shape of final linked data:", linked_data.shape)
|
168 |
+
else:
|
169 |
+
print("Dataset was found to be unusable and was not saved")
|
p3/preprocess/Rectal_Cancer/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE94104": {"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": 80, "note": "Dataset contains gene expression data from CD14+ cells of Psoriatic Arthritis patients and healthy controls."}, "GSE40492": {"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": 245, "note": "Dataset contains gene expression data from rectal cancer patients with focus on lymph node status after treatment."}, "GSE170999": {"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": 76, "note": "Dataset contains gene expression data from rectal cancer patients with focus on KRAS mutation status."}, "GSE150082": {"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": 39, "note": "Dataset contains gene expression data from rectal cancer patients with focus on KRAS mutation status."}, "GSE145037": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": true, "has_gender": false, "sample_size": 31, "note": "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."}, "GSE139255": {"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": 156, "note": "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."}, "GSE133057": {"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": "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."}, "GSE123390": {"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": 28, "note": "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."}, "GSE119409": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": true, "has_gender": false, "sample_size": 56, "note": "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."}, "GSE109057": {"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": 91, "note": "Dataset contains gene expression data from rectal cancer patients examining chemoradiotherapy response."}, "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": 105, "note": "Sample size after preprocessing: 105. Number of genes: 19848"}}
|
p3/preprocess/Rectal_Cancer/gene_data/GSE119409.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|