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 +5 -0
- p1/preprocess/Alzheimers_Disease/GSE132903.csv +3 -0
- p1/preprocess/Alzheimers_Disease/gene_data/GSE122063.csv +3 -0
- p1/preprocess/Alzheimers_Disease/gene_data/GSE132903.csv +3 -0
- p1/preprocess/Alzheimers_Disease/gene_data/GSE243243.csv +3 -0
- p1/preprocess/Arrhythmia/clinical_data/GSE182600.csv +4 -0
- p1/preprocess/Arrhythmia/clinical_data/GSE53622.csv +4 -0
- p1/preprocess/Arrhythmia/clinical_data/GSE93101.csv +4 -0
- p1/preprocess/Arrhythmia/code/GSE136992.py +173 -0
- p1/preprocess/Arrhythmia/code/GSE143924.py +132 -0
- p1/preprocess/Arrhythmia/code/GSE182600.py +179 -0
- p1/preprocess/Arrhythmia/code/GSE235307.py +199 -0
- p1/preprocess/Arrhythmia/code/GSE55231.py +172 -0
- p1/preprocess/Arrhythmia/code/GSE93101.py +181 -0
- p1/preprocess/Arrhythmia/code/TCGA.py +60 -0
- p1/preprocess/Arrhythmia/gene_data/GSE115574.csv +1 -0
- p1/preprocess/Arrhythmia/gene_data/GSE136992.csv +1 -0
- p1/preprocess/Arrhythmia/gene_data/GSE143924.csv +1 -0
- p1/preprocess/Arrhythmia/gene_data/GSE41177.csv +1 -0
- p1/preprocess/Arrhythmia/gene_data/GSE53622.csv +1 -0
- p1/preprocess/Arrhythmia/gene_data/GSE55231.csv +1 -0
- p1/preprocess/Arrhythmia/gene_data/GSE93101.csv +1 -0
- p1/preprocess/Asthma/clinical_data/GSE123086.csv +3 -0
- p1/preprocess/Asthma/clinical_data/GSE123088.csv +4 -0
- p1/preprocess/Asthma/clinical_data/GSE182797.csv +3 -0
- p1/preprocess/Asthma/clinical_data/GSE182798.csv +3 -0
- p1/preprocess/Asthma/clinical_data/GSE185658.csv +2 -0
- p1/preprocess/Asthma/clinical_data/GSE270312.csv +3 -0
- p1/preprocess/Asthma/code/GSE123086.py +228 -0
- p1/preprocess/Asthma/code/GSE123088.py +181 -0
- p1/preprocess/Asthma/code/GSE182797.py +189 -0
- p1/preprocess/Asthma/code/GSE182798.py +189 -0
- p1/preprocess/Asthma/code/GSE184382.py +155 -0
- p1/preprocess/Asthma/code/GSE185658.py +157 -0
- p1/preprocess/Asthma/code/GSE188424.py +134 -0
- p1/preprocess/Asthma/code/GSE205151.py +96 -0
- p1/preprocess/Asthma/code/GSE230164.py +160 -0
- p1/preprocess/Asthma/code/GSE270312.py +162 -0
- p1/preprocess/Asthma/code/TCGA.py +59 -0
- p1/preprocess/Asthma/gene_data/GSE123086.csv +1 -0
- p1/preprocess/Asthma/gene_data/GSE123088.csv +1 -0
- p1/preprocess/Asthma/gene_data/GSE182797.csv +1 -0
- p1/preprocess/Asthma/gene_data/GSE182798.csv +1 -0
- p1/preprocess/Asthma/gene_data/GSE184382.csv +1 -0
- p1/preprocess/Asthma/gene_data/GSE185658.csv +1 -0
- p1/preprocess/Asthma/gene_data/GSE188424.csv +1 -0
- p1/preprocess/Asthma/gene_data/GSE230164.csv +1 -0
- p1/preprocess/Asthma/gene_data/GSE270312.csv +1 -0
- p1/preprocess/Atrial_Fibrillation/GSE143924.csv +0 -0
- p1/preprocess/Atrial_Fibrillation/clinical_data/GSE115574.csv +2 -0
.gitattributes
CHANGED
@@ -947,3 +947,8 @@ p1/preprocess/Thyroid_Cancer/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -t
|
|
947 |
p1/preprocess/Alopecia/GSE66664.csv filter=lfs diff=lfs merge=lfs -text
|
948 |
p1/preprocess/Alopecia/gene_data/GSE66664.csv filter=lfs diff=lfs merge=lfs -text
|
949 |
p1/preprocess/Alzheimers_Disease/GSE122063.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
947 |
p1/preprocess/Alopecia/GSE66664.csv filter=lfs diff=lfs merge=lfs -text
|
948 |
p1/preprocess/Alopecia/gene_data/GSE66664.csv filter=lfs diff=lfs merge=lfs -text
|
949 |
p1/preprocess/Alzheimers_Disease/GSE122063.csv filter=lfs diff=lfs merge=lfs -text
|
950 |
+
p1/preprocess/Alzheimers_Disease/gene_data/GSE243243.csv filter=lfs diff=lfs merge=lfs -text
|
951 |
+
p1/preprocess/Alzheimers_Disease/gene_data/GSE122063.csv filter=lfs diff=lfs merge=lfs -text
|
952 |
+
p1/preprocess/Alzheimers_Disease/gene_data/GSE132903.csv filter=lfs diff=lfs merge=lfs -text
|
953 |
+
p1/preprocess/Alzheimers_Disease/GSE132903.csv filter=lfs diff=lfs merge=lfs -text
|
954 |
+
p1/preprocess/Von_Willebrand_Disease/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
p1/preprocess/Alzheimers_Disease/GSE132903.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:91e64c18b6f151c74c55ce8c6a8327a3603a0d991feeebe12a4b867b49d26a73
|
3 |
+
size 46424882
|
p1/preprocess/Alzheimers_Disease/gene_data/GSE122063.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:167a58f7e2efb1dcb8d9bf1db0c6b23c9b31677eb900434a5cdfb2769979209c
|
3 |
+
size 34270174
|
p1/preprocess/Alzheimers_Disease/gene_data/GSE132903.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:68a154f0c8e664cc61d16dc207b178e362caa3a5ab1f7563e6a20e87cd12d496
|
3 |
+
size 46422319
|
p1/preprocess/Alzheimers_Disease/gene_data/GSE243243.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b3a1f69b13be0d5eff4c17860bc7c3dcf0ae2ae9ff02f14218e63c38bf03b1b9
|
3 |
+
size 25405099
|
p1/preprocess/Arrhythmia/clinical_data/GSE182600.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GSM5532093,GSM5532094,GSM5532095,GSM5532096,GSM5532097,GSM5532098,GSM5532099,GSM5532100,GSM5532101,GSM5532102,GSM5532103,GSM5532104,GSM5532105,GSM5532106,GSM5532107,GSM5532108,GSM5532109,GSM5532110,GSM5532111,GSM5532112,GSM5532113,GSM5532114,GSM5532115,GSM5532116,GSM5532117,GSM5532118,GSM5532119,GSM5532120,GSM5532121,GSM5532122,GSM5532123,GSM5532124,GSM5532125,GSM5532126,GSM5532127,GSM5532128,GSM5532129,GSM5532130,GSM5532131,GSM5532132,GSM5532133,GSM5532134,GSM5532135,GSM5532136,GSM5532137,GSM5532138,GSM5532139,GSM5532140,GSM5532141,GSM5532142,GSM5532143,GSM5532144,GSM5532145,GSM5532146,GSM5532147,GSM5532148,GSM5532149,GSM5532150,GSM5532151,GSM5532152,GSM5532153,GSM5532154,GSM5532155,GSM5532156,GSM5532157,GSM5532158,GSM5532159,GSM5532160,GSM5532161,GSM5532162,GSM5532163,GSM5532164,GSM5532165,GSM5532166,GSM5532167,GSM5532168,GSM5532169,GSM5532170
|
2 |
+
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,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
|
3 |
+
33.4,51.2,51.9,47.8,41.5,67.3,52.8,16.1,78.9,53.2,70.9,59.9,21.9,45.2,52.4,32.3,52.8,55.8,47.0,55.8,57.3,31.7,49.3,66.1,55.9,49.1,63.0,21.0,53.6,50.1,37.4,71.5,56.5,33.4,51.2,51.9,47.8,41.5,67.3,52.8,78.9,53.2,70.9,59.9,21.9,45.2,52.4,32.3,55.8,47.0,55.8,57.3,31.7,49.3,66.1,55.9,49.1,63.0,21.0,53.6,50.1,37.4,71.5,56.5,33.4,51.2,51.9,47.8,52.8,53.2,21.9,55.8,47.0,49.3,66.1,53.6,50.1,56.5
|
4 |
+
0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,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,0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,0.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,1.0,1.0,1.0,1.0,1.0,0.0,1.0
|
p1/preprocess/Arrhythmia/clinical_data/GSE53622.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GSM1296956,GSM1296957,GSM1296958,GSM1296959,GSM1296960,GSM1296961,GSM1296962,GSM1296963,GSM1296964,GSM1296965,GSM1296966,GSM1296967,GSM1296968,GSM1296969,GSM1296970,GSM1296971,GSM1296972,GSM1296973,GSM1296974,GSM1296975,GSM1296976,GSM1296977,GSM1296978,GSM1296979,GSM1296980,GSM1296981,GSM1296982,GSM1296983,GSM1296984,GSM1296985,GSM1296986,GSM1296987,GSM1296988,GSM1296989,GSM1296990,GSM1296991,GSM1296992,GSM1296993,GSM1296994,GSM1296995,GSM1296996,GSM1296997,GSM1296998,GSM1296999,GSM1297000,GSM1297001,GSM1297002,GSM1297003,GSM1297004,GSM1297005,GSM1297006,GSM1297007,GSM1297008,GSM1297009,GSM1297010,GSM1297011,GSM1297012,GSM1297013,GSM1297014,GSM1297015,GSM1297016,GSM1297017,GSM1297018,GSM1297019,GSM1297020,GSM1297021,GSM1297022,GSM1297023,GSM1297024,GSM1297025,GSM1297026,GSM1297027,GSM1297028,GSM1297029,GSM1297030,GSM1297031,GSM1297032,GSM1297033,GSM1297034,GSM1297035,GSM1297036,GSM1297037,GSM1297038,GSM1297039,GSM1297040,GSM1297041,GSM1297042,GSM1297043,GSM1297044,GSM1297045,GSM1297046,GSM1297047,GSM1297048,GSM1297049,GSM1297050,GSM1297051,GSM1297052,GSM1297053,GSM1297054,GSM1297055,GSM1297056,GSM1297057,GSM1297058,GSM1297059,GSM1297060,GSM1297061,GSM1297062,GSM1297063,GSM1297064,GSM1297065,GSM1297066,GSM1297067,GSM1297068,GSM1297069,GSM1297070,GSM1297071,GSM1297072,GSM1297073,GSM1297074,GSM1297075
|
2 |
+
0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,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,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,1.0,1.0,1.0,1.0
|
3 |
+
66.4602739726027,66.4602739726027,64.013698630137,64.013698630137,50.9123287671233,50.9123287671233,46.3287671232877,46.3287671232877,53.9972602739726,53.9972602739726,67.8438356164384,67.8438356164384,64.8794520547945,64.8794520547945,45.2219178082192,45.2219178082192,54.4794520547945,54.4794520547945,56.2328767123288,56.2328767123288,57.0986301369863,57.0986301369863,44.6630136986301,44.6630136986301,43.7698630136986,43.7698630136986,67.2739726027397,67.2739726027397,68.2904109589041,68.2904109589041,60.5068493150685,60.5068493150685,48.4027397260274,48.4027397260274,54.2931506849315,54.2931506849315,51.9890410958904,51.9890410958904,58.3205479452055,58.3205479452055,66.2712328767123,66.2712328767123,72.241095890411,72.241095890411,64.7506849315069,64.7506849315069,54.5753424657534,54.5753424657534,62.4383561643836,62.4383561643836,66.1479452054794,66.1479452054794,53.7424657534247,53.7424657534247,56.9643835616438,56.9643835616438,71.9150684931507,71.9150684931507,53.5643835616438,53.5643835616438,61.2739726027397,61.2739726027397,66.4602739726027,66.4602739726027,62.1205479452055,62.1205479452055,59.6520547945205,59.6520547945205,65.4493150684931,65.4493150684931,51.7369863013699,51.7369863013699,58.6356164383562,58.6356164383562,75.5095890410959,75.5095890410959,71.1835616438356,71.1835616438356,55.9890410958904,55.9890410958904,56.0849315068493,56.0849315068493,56.0,56.0,81.0,81.0,51.0,51.0,57.3945205479452,57.3945205479452,50.9424657534247,50.9424657534247,80.9506849315069,80.9506849315069,63.7178082191781,63.7178082191781,62.8986301369863,62.8986301369863,62.8438356164384,62.8438356164384,68.5178082191781,68.5178082191781,39.5397260273973,39.5397260273973,68.0849315068493,68.0849315068493,66.9178082191781,66.9178082191781,47.5506849315069,47.5506849315069,46.0328767123288,46.0328767123288,59.972602739726,59.972602739726,63.6602739726027,63.6602739726027,78.8876712328767,78.8876712328767,61.3315068493151,61.3315068493151
|
4 |
+
0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,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,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,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
|
p1/preprocess/Arrhythmia/clinical_data/GSE93101.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GSM2443799,GSM2443800,GSM2443801,GSM2443802,GSM2443803,GSM2443804,GSM2443805,GSM2443806,GSM2443807,GSM2443808,GSM2443809,GSM2443810,GSM2443811,GSM2443812,GSM2443813,GSM2443814,GSM2443815,GSM2443816,GSM2443817,GSM2443818,GSM2443819,GSM2443820,GSM2443821,GSM2443822,GSM2443823,GSM2443824,GSM2443825,GSM2443826,GSM2443827,GSM2443828,GSM2443829,GSM2443830,GSM2443831
|
2 |
+
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
3 |
+
33.4,51.2,51.9,47.8,41.5,67.3,52.8,16.1,78.9,53.2,70.9,59.9,21.9,45.2,52.4,32.3,52.8,55.8,47.0,55.8,57.3,31.7,49.3,66.1,55.9,49.1,63.0,21.0,53.6,50.1,37.4,71.5,56.5
|
4 |
+
0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,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
|
p1/preprocess/Arrhythmia/code/GSE136992.py
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Arrhythmia"
|
6 |
+
cohort = "GSE136992"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Arrhythmia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Arrhythmia/GSE136992"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Arrhythmia/GSE136992.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Arrhythmia/gene_data/GSE136992.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Arrhythmia/clinical_data/GSE136992.csv"
|
16 |
+
json_path = "./output/preprocess/1/Arrhythmia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
from tools.preprocess import *
|
21 |
+
|
22 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
23 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
24 |
+
|
25 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
26 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
27 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
28 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
29 |
+
matrix_file,
|
30 |
+
background_prefixes,
|
31 |
+
clinical_prefixes
|
32 |
+
)
|
33 |
+
|
34 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
35 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
36 |
+
|
37 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
38 |
+
print("Background Information:")
|
39 |
+
print(background_info)
|
40 |
+
print("\nSample Characteristics Dictionary:")
|
41 |
+
print(sample_characteristics_dict)
|
42 |
+
# 1. Determine gene expression data availability
|
43 |
+
is_gene_available = True # This dataset includes Illumina whole genome gene expression data
|
44 |
+
|
45 |
+
# 2.1 Determine data availability (keys for trait, age, gender)
|
46 |
+
trait_row = None # No row found for "Arrhythmia" in the sample characteristics
|
47 |
+
age_row = 2 # Row 2 contains multiple distinct 'age' values
|
48 |
+
gender_row = 3 # Row 3 contains multiple distinct 'gender' values
|
49 |
+
|
50 |
+
# 2.2 Define data type conversions
|
51 |
+
def convert_trait(value: str):
|
52 |
+
# Trait data is not available; return None
|
53 |
+
return None
|
54 |
+
|
55 |
+
def convert_age(value: str):
|
56 |
+
"""Convert 'age: XX weeks' to a numeric type."""
|
57 |
+
try:
|
58 |
+
# Extract the substring after 'age:' and strip spaces
|
59 |
+
raw = value.split(':', 1)[1].strip()
|
60 |
+
# Remove the word 'weeks' if present
|
61 |
+
raw = raw.lower().replace('weeks', '').strip()
|
62 |
+
return float(raw)
|
63 |
+
except:
|
64 |
+
return None
|
65 |
+
|
66 |
+
def convert_gender(value: str):
|
67 |
+
"""Convert 'gender: male/female' to binary (0=female, 1=male)."""
|
68 |
+
try:
|
69 |
+
raw = value.split(':', 1)[1].strip().lower()
|
70 |
+
if raw == 'male':
|
71 |
+
return 1
|
72 |
+
elif raw == 'female':
|
73 |
+
return 0
|
74 |
+
else:
|
75 |
+
return None
|
76 |
+
except:
|
77 |
+
return None
|
78 |
+
|
79 |
+
# 3. Conduct initial filtering and save metadata
|
80 |
+
is_trait_available = (trait_row is not None)
|
81 |
+
validate_and_save_cohort_info(
|
82 |
+
is_final=False,
|
83 |
+
cohort=cohort,
|
84 |
+
info_path=json_path,
|
85 |
+
is_gene_available=is_gene_available,
|
86 |
+
is_trait_available=is_trait_available
|
87 |
+
)
|
88 |
+
|
89 |
+
# 4. Skip clinical feature extraction, since trait_row is None
|
90 |
+
# STEP3
|
91 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
92 |
+
gene_data = get_genetic_data(matrix_file)
|
93 |
+
|
94 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
95 |
+
print(gene_data.index[:20])
|
96 |
+
# These identifiers, starting with "ILMN_", are Illumina probe IDs rather than standard gene symbols.
|
97 |
+
# Therefore, they need to be mapped to the corresponding human gene symbols.
|
98 |
+
print("requires_gene_mapping = True")
|
99 |
+
# STEP5
|
100 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
101 |
+
gene_annotation = get_gene_annotation(soft_file)
|
102 |
+
|
103 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
104 |
+
print("Gene annotation preview:")
|
105 |
+
print(preview_df(gene_annotation))
|
106 |
+
# STEP: Gene Identifier Mapping
|
107 |
+
|
108 |
+
# 1. Decide which columns hold the probe IDs (same as gene_data.index) and the gene symbols.
|
109 |
+
# From the annotation preview, "ID" matches the probe IDs, and "Symbol" contains the gene symbols.
|
110 |
+
|
111 |
+
# 2. Get a gene mapping dataframe (probe ID -> gene symbol).
|
112 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="Symbol")
|
113 |
+
|
114 |
+
# 3. Convert the probe-level expression data to gene-level data using the mapping.
|
115 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
116 |
+
# STEP 7: Data Normalization and Linking
|
117 |
+
|
118 |
+
# First, check if trait data is available.
|
119 |
+
# From our previous steps, we know 'trait_row' was None, so trait data is not available.
|
120 |
+
# Hence, we skip linking, missing-value handling, and bias checks,
|
121 |
+
# but we still need to do final validation to mark it unusable.
|
122 |
+
|
123 |
+
if not is_trait_available:
|
124 |
+
import pandas as pd
|
125 |
+
|
126 |
+
print("Trait data is not available. Skipping link, missing-value handling, and bias checks.")
|
127 |
+
# Provide a boolean for is_biased to avoid the ValueError in final validation.
|
128 |
+
# The dataset is not usable because the trait is missing, so we can set is_biased=True.
|
129 |
+
is_usable = validate_and_save_cohort_info(
|
130 |
+
is_final=True,
|
131 |
+
cohort=cohort,
|
132 |
+
info_path=json_path,
|
133 |
+
is_gene_available=True, # gene data is available,
|
134 |
+
is_trait_available=False, # but trait data is missing
|
135 |
+
is_biased=True, # no valid trait -> not usable
|
136 |
+
df=pd.DataFrame(), # an empty DataFrame suffices here
|
137 |
+
note="Trait data not found; dataset is not usable."
|
138 |
+
)
|
139 |
+
print("Dataset was not deemed usable due to missing trait data; final linked data not saved.")
|
140 |
+
|
141 |
+
else:
|
142 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
143 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
144 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
145 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
146 |
+
|
147 |
+
# 2. Link the clinical and genetic data on sample IDs (requires clinical data from step 2)
|
148 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
149 |
+
|
150 |
+
# 3. Handle missing values in linked data
|
151 |
+
linked_data = handle_missing_values(linked_data, trait_col=trait)
|
152 |
+
|
153 |
+
# 4. Determine bias
|
154 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait=trait)
|
155 |
+
|
156 |
+
# 5. Final validation
|
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="Trait data and gene data successfully linked."
|
166 |
+
)
|
167 |
+
|
168 |
+
# 6. Save final linked data if usable
|
169 |
+
if is_usable:
|
170 |
+
linked_data.to_csv(out_data_file)
|
171 |
+
print(f"Saved final linked data to {out_data_file}")
|
172 |
+
else:
|
173 |
+
print("Dataset was not deemed usable; final linked data not saved.")
|
p1/preprocess/Arrhythmia/code/GSE143924.py
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Arrhythmia"
|
6 |
+
cohort = "GSE143924"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Arrhythmia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Arrhythmia/GSE143924"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Arrhythmia/GSE143924.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Arrhythmia/gene_data/GSE143924.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Arrhythmia/clinical_data/GSE143924.csv"
|
16 |
+
json_path = "./output/preprocess/1/Arrhythmia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
from tools.preprocess import *
|
21 |
+
|
22 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
23 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
24 |
+
|
25 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
26 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
27 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
28 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
29 |
+
matrix_file,
|
30 |
+
background_prefixes,
|
31 |
+
clinical_prefixes
|
32 |
+
)
|
33 |
+
|
34 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
35 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
36 |
+
|
37 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
38 |
+
print("Background Information:")
|
39 |
+
print(background_info)
|
40 |
+
print("\nSample Characteristics Dictionary:")
|
41 |
+
print(sample_characteristics_dict)
|
42 |
+
# 1) Assess Gene Expression Data Availability
|
43 |
+
is_gene_available = True # "Transcriptome analysis" indicates gene expression data is available.
|
44 |
+
|
45 |
+
# 2) Identify Variable Availability (trait, age, gender) and Define Converters
|
46 |
+
trait_row = 1
|
47 |
+
age_row = None
|
48 |
+
gender_row = None
|
49 |
+
|
50 |
+
def convert_trait(value: str):
|
51 |
+
parts = value.split(':')
|
52 |
+
val = parts[1].strip() if len(parts) > 1 else parts[0].strip()
|
53 |
+
# Map sinus rhythm => 0, atrial fibrillation => 1, otherwise None
|
54 |
+
if 'sinus rhythm' in val.lower():
|
55 |
+
return 0
|
56 |
+
elif 'atrial fibrillation' in val.lower():
|
57 |
+
return 1
|
58 |
+
return None
|
59 |
+
|
60 |
+
def convert_age(value: str):
|
61 |
+
return None # No age data available
|
62 |
+
|
63 |
+
def convert_gender(value: str):
|
64 |
+
return None # No gender data available
|
65 |
+
|
66 |
+
# 3) Initial Filtering and Save Metadata
|
67 |
+
is_trait_available = (trait_row is not None)
|
68 |
+
is_usable = validate_and_save_cohort_info(
|
69 |
+
is_final=False,
|
70 |
+
cohort=cohort,
|
71 |
+
info_path=json_path,
|
72 |
+
is_gene_available=is_gene_available,
|
73 |
+
is_trait_available=is_trait_available
|
74 |
+
)
|
75 |
+
|
76 |
+
# 4) If trait data is available, extract clinical features and save
|
77 |
+
if trait_row is not None:
|
78 |
+
selected_clinical_data = geo_select_clinical_features(
|
79 |
+
clinical_df=clinical_data,
|
80 |
+
trait=trait,
|
81 |
+
trait_row=trait_row,
|
82 |
+
convert_trait=convert_trait,
|
83 |
+
age_row=age_row,
|
84 |
+
convert_age=convert_age,
|
85 |
+
gender_row=gender_row,
|
86 |
+
convert_gender=convert_gender
|
87 |
+
)
|
88 |
+
print("Preview of Selected Clinical Features:")
|
89 |
+
print(preview_df(selected_clinical_data, n=5, max_items=200))
|
90 |
+
selected_clinical_data.to_csv(out_clinical_data_file, index=False)
|
91 |
+
# STEP3
|
92 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
93 |
+
gene_data = get_genetic_data(matrix_file)
|
94 |
+
|
95 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
96 |
+
print(gene_data.index[:20])
|
97 |
+
# Based on the observed gene identifiers, they appear to be recognized human gene symbols or their aliases.
|
98 |
+
requires_gene_mapping = False
|
99 |
+
# STEP 5: Data Normalization and Linking
|
100 |
+
|
101 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
102 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
103 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
104 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
105 |
+
|
106 |
+
# 2. Link the clinical and genetic data on sample IDs
|
107 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
108 |
+
|
109 |
+
# 3. Handle missing values in the linked data
|
110 |
+
linked_data = handle_missing_values(linked_data, trait_col=trait)
|
111 |
+
|
112 |
+
# 4. Determine whether the trait/demographic features are severely biased
|
113 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait=trait)
|
114 |
+
|
115 |
+
# 5. Conduct final quality validation and save metadata
|
116 |
+
is_usable = validate_and_save_cohort_info(
|
117 |
+
is_final=True,
|
118 |
+
cohort=cohort,
|
119 |
+
info_path=json_path,
|
120 |
+
is_gene_available=True,
|
121 |
+
is_trait_available=True,
|
122 |
+
is_biased=trait_biased,
|
123 |
+
df=linked_data,
|
124 |
+
note="Trait data and gene data successfully linked."
|
125 |
+
)
|
126 |
+
|
127 |
+
# 6. If the dataset is deemed usable, save the final linked data as a CSV file
|
128 |
+
if is_usable:
|
129 |
+
linked_data.to_csv(out_data_file)
|
130 |
+
print(f"Saved final linked data to {out_data_file}")
|
131 |
+
else:
|
132 |
+
print("Dataset was not deemed usable; final linked data not saved.")
|
p1/preprocess/Arrhythmia/code/GSE182600.py
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Arrhythmia"
|
6 |
+
cohort = "GSE182600"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Arrhythmia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Arrhythmia/GSE182600"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Arrhythmia/GSE182600.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Arrhythmia/gene_data/GSE182600.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Arrhythmia/clinical_data/GSE182600.csv"
|
16 |
+
json_path = "./output/preprocess/1/Arrhythmia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
from tools.preprocess import *
|
21 |
+
|
22 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
23 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
24 |
+
|
25 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
26 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
27 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
28 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
29 |
+
matrix_file,
|
30 |
+
background_prefixes,
|
31 |
+
clinical_prefixes
|
32 |
+
)
|
33 |
+
|
34 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
35 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
36 |
+
|
37 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
38 |
+
print("Background Information:")
|
39 |
+
print(background_info)
|
40 |
+
print("\nSample Characteristics Dictionary:")
|
41 |
+
print(sample_characteristics_dict)
|
42 |
+
# Step 1: Determine if gene expression data is available
|
43 |
+
is_gene_available = True # Based on the background info describing "genome-wide gene expression"
|
44 |
+
|
45 |
+
# Step 2: Identify trait/age/gender rows and define data conversion functions
|
46 |
+
trait_row = 0 # Row containing disease states, including "Arrhythmia"
|
47 |
+
age_row = 1 # Row containing age
|
48 |
+
gender_row = 2 # Row containing gender
|
49 |
+
|
50 |
+
def convert_trait(value: str) -> int:
|
51 |
+
"""
|
52 |
+
Convert the 'disease state' string to a binary value.
|
53 |
+
1 if it indicates 'Arrhythmia', else 0.
|
54 |
+
"""
|
55 |
+
# Extract the part after "disease state:"
|
56 |
+
parts = value.split(":")
|
57 |
+
if len(parts) < 2:
|
58 |
+
return None
|
59 |
+
disease_str = parts[1].strip().lower()
|
60 |
+
return 1 if disease_str == "arrhythmia" else 0
|
61 |
+
|
62 |
+
def convert_age(value: str) -> float:
|
63 |
+
"""
|
64 |
+
Convert the 'age' string to a float.
|
65 |
+
Return None if conversion fails.
|
66 |
+
"""
|
67 |
+
parts = value.split(":")
|
68 |
+
if len(parts) < 2:
|
69 |
+
return None
|
70 |
+
try:
|
71 |
+
return float(parts[1].strip())
|
72 |
+
except ValueError:
|
73 |
+
return None
|
74 |
+
|
75 |
+
def convert_gender(value: str) -> int:
|
76 |
+
"""
|
77 |
+
Convert the 'gender' string to a binary value.
|
78 |
+
Female -> 0, Male -> 1, None if unknown.
|
79 |
+
"""
|
80 |
+
parts = value.split(":")
|
81 |
+
if len(parts) < 2:
|
82 |
+
return None
|
83 |
+
gender_str = parts[1].strip().lower()
|
84 |
+
if gender_str == "f":
|
85 |
+
return 0
|
86 |
+
elif gender_str == "m":
|
87 |
+
return 1
|
88 |
+
else:
|
89 |
+
return None
|
90 |
+
|
91 |
+
# Step 3: Determine if trait data is available
|
92 |
+
is_trait_available = (trait_row is not None)
|
93 |
+
|
94 |
+
# Perform initial filtering and save metadata
|
95 |
+
is_usable = validate_and_save_cohort_info(
|
96 |
+
is_final=False,
|
97 |
+
cohort=cohort,
|
98 |
+
info_path=json_path,
|
99 |
+
is_gene_available=is_gene_available,
|
100 |
+
is_trait_available=is_trait_available
|
101 |
+
)
|
102 |
+
|
103 |
+
# Step 4: If trait is available, extract clinical features and save
|
104 |
+
if trait_row is not None:
|
105 |
+
# Assume 'clinical_data' is already loaded as a DataFrame in the environment
|
106 |
+
selected_clinical_df = geo_select_clinical_features(
|
107 |
+
clinical_data,
|
108 |
+
trait="Trait",
|
109 |
+
trait_row=trait_row,
|
110 |
+
convert_trait=convert_trait,
|
111 |
+
age_row=age_row,
|
112 |
+
convert_age=convert_age,
|
113 |
+
gender_row=gender_row,
|
114 |
+
convert_gender=convert_gender
|
115 |
+
)
|
116 |
+
print("Preview of selected clinical dataframe:", preview_df(selected_clinical_df))
|
117 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
118 |
+
# STEP3
|
119 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
120 |
+
gene_data = get_genetic_data(matrix_file)
|
121 |
+
|
122 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
123 |
+
print(gene_data.index[:20])
|
124 |
+
# The listed identifiers (e.g., "ILMN_...") are Illumina probe IDs, not standard human gene symbols.
|
125 |
+
# Therefore, they require mapping to gene symbols.
|
126 |
+
|
127 |
+
requires_gene_mapping = True
|
128 |
+
# STEP5
|
129 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
130 |
+
gene_annotation = get_gene_annotation(soft_file)
|
131 |
+
|
132 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
133 |
+
print("Gene annotation preview:")
|
134 |
+
print(preview_df(gene_annotation))
|
135 |
+
# STEP: Gene Identifier Mapping
|
136 |
+
|
137 |
+
# 1. Identify which columns from the gene_annotation match the gene expression IDs and the gene symbols
|
138 |
+
prob_col = "ID" # column in gene_annotation matching the probe ID (e.g., "ILMN_...")
|
139 |
+
symbol_col = "Symbol" # column in gene_annotation storing the gene symbol
|
140 |
+
|
141 |
+
# 2. Generate a mapping dataframe using the library function
|
142 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=prob_col, gene_col=symbol_col)
|
143 |
+
|
144 |
+
# 3. Apply the mapping to convert probe-level data to gene-level data
|
145 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
146 |
+
# STEP 7: Data Normalization and Linking
|
147 |
+
|
148 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
149 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
150 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
151 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
152 |
+
|
153 |
+
# 2. Link the clinical and genetic data on sample IDs
|
154 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
155 |
+
|
156 |
+
# 3. Handle missing values in the linked data
|
157 |
+
linked_data = handle_missing_values(linked_data, trait_col="Trait")
|
158 |
+
|
159 |
+
# 4. Determine whether the trait/demographic features are severely biased
|
160 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait="Trait")
|
161 |
+
|
162 |
+
# 5. Conduct final quality validation and save metadata
|
163 |
+
is_usable = validate_and_save_cohort_info(
|
164 |
+
is_final=True,
|
165 |
+
cohort=cohort,
|
166 |
+
info_path=json_path,
|
167 |
+
is_gene_available=True,
|
168 |
+
is_trait_available=True,
|
169 |
+
is_biased=trait_biased,
|
170 |
+
df=linked_data,
|
171 |
+
note="Trait data and gene data successfully linked."
|
172 |
+
)
|
173 |
+
|
174 |
+
# 6. If the dataset is deemed usable, save the final linked data as a CSV file
|
175 |
+
if is_usable:
|
176 |
+
linked_data.to_csv(out_data_file)
|
177 |
+
print(f"Saved final linked data to {out_data_file}")
|
178 |
+
else:
|
179 |
+
print("Dataset was not deemed usable; final linked data not saved.")
|
p1/preprocess/Arrhythmia/code/GSE235307.py
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Arrhythmia"
|
6 |
+
cohort = "GSE235307"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Arrhythmia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Arrhythmia/GSE235307"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Arrhythmia/GSE235307.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Arrhythmia/gene_data/GSE235307.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Arrhythmia/clinical_data/GSE235307.csv"
|
16 |
+
json_path = "./output/preprocess/1/Arrhythmia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
from tools.preprocess import *
|
21 |
+
|
22 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
23 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
24 |
+
|
25 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
26 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
27 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
28 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
29 |
+
matrix_file,
|
30 |
+
background_prefixes,
|
31 |
+
clinical_prefixes
|
32 |
+
)
|
33 |
+
|
34 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
35 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
36 |
+
|
37 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
38 |
+
print("Background Information:")
|
39 |
+
print(background_info)
|
40 |
+
print("\nSample Characteristics Dictionary:")
|
41 |
+
print(sample_characteristics_dict)
|
42 |
+
# 1. Gene Expression Data Availability
|
43 |
+
# Based on the series summary stating “Gene expression ...”, we set is_gene_available=True.
|
44 |
+
is_gene_available = True
|
45 |
+
|
46 |
+
# 2. Variable Availability and Data Type Conversion
|
47 |
+
|
48 |
+
# 2.1 Assign row keys if data is available and non-constant.
|
49 |
+
# Observing the sample characteristics, we identify:
|
50 |
+
# - trait_row: 5 (where we see "Atrial fibrillation" vs "Sinus rhythm")
|
51 |
+
# - age_row: 2 (ages vary)
|
52 |
+
# - gender_row: 1 (male/female are present)
|
53 |
+
|
54 |
+
trait_row = 5
|
55 |
+
age_row = 2
|
56 |
+
gender_row = 1
|
57 |
+
|
58 |
+
# 2.2 Define the conversion functions
|
59 |
+
|
60 |
+
def convert_trait(value: str) -> Optional[int]:
|
61 |
+
"""Convert 'cardiac rhythm after 1 year follow-up' to binary (0 or 1)."""
|
62 |
+
# Extract the substring after colon
|
63 |
+
parts = value.split(':', 1)
|
64 |
+
if len(parts) < 2:
|
65 |
+
return None
|
66 |
+
val = parts[1].strip().lower() # e.g. 'sinus rhythm', 'atrial fibrillation'
|
67 |
+
if val == 'sinus rhythm':
|
68 |
+
return 0
|
69 |
+
elif val == 'atrial fibrillation':
|
70 |
+
return 1
|
71 |
+
else:
|
72 |
+
return None
|
73 |
+
|
74 |
+
def convert_age(value: str) -> Optional[float]:
|
75 |
+
"""Convert the age string to float."""
|
76 |
+
parts = value.split(':', 1)
|
77 |
+
if len(parts) < 2:
|
78 |
+
return None
|
79 |
+
val = parts[1].strip()
|
80 |
+
try:
|
81 |
+
return float(val)
|
82 |
+
except ValueError:
|
83 |
+
return None
|
84 |
+
|
85 |
+
def convert_gender(value: str) -> Optional[int]:
|
86 |
+
"""Convert gender to binary (0 for Female, 1 for Male)."""
|
87 |
+
parts = value.split(':', 1)
|
88 |
+
if len(parts) < 2:
|
89 |
+
return None
|
90 |
+
val = parts[1].strip().lower()
|
91 |
+
if val == 'male':
|
92 |
+
return 1
|
93 |
+
elif val == 'female':
|
94 |
+
return 0
|
95 |
+
else:
|
96 |
+
return None
|
97 |
+
|
98 |
+
# 3. Save Metadata using initial filtering
|
99 |
+
is_trait_available = (trait_row is not None)
|
100 |
+
is_usable = validate_and_save_cohort_info(
|
101 |
+
is_final=False,
|
102 |
+
cohort=cohort,
|
103 |
+
info_path=json_path,
|
104 |
+
is_gene_available=is_gene_available,
|
105 |
+
is_trait_available=is_trait_available
|
106 |
+
)
|
107 |
+
|
108 |
+
# 4. Clinical Feature Extraction (only if trait_row is not None)
|
109 |
+
if trait_row is not None:
|
110 |
+
selected_clinical_df = geo_select_clinical_features(
|
111 |
+
clinical_data,
|
112 |
+
trait=trait,
|
113 |
+
trait_row=trait_row,
|
114 |
+
convert_trait=convert_trait,
|
115 |
+
age_row=age_row,
|
116 |
+
convert_age=convert_age,
|
117 |
+
gender_row=gender_row,
|
118 |
+
convert_gender=convert_gender
|
119 |
+
)
|
120 |
+
# Preview the selected clinical features
|
121 |
+
preview_result = preview_df(selected_clinical_df)
|
122 |
+
print("Preview of selected clinical features:", preview_result)
|
123 |
+
# Save the clinical features to CSV
|
124 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
125 |
+
# STEP3
|
126 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
127 |
+
gene_data = get_genetic_data(matrix_file)
|
128 |
+
|
129 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
130 |
+
print(gene_data.index[:20])
|
131 |
+
# Observing the given identifiers (e.g., '4', '5', '6', etc.), they do not match typical human gene symbols.
|
132 |
+
# Therefore, they likely need to be mapped to recognized gene symbols.
|
133 |
+
|
134 |
+
print("requires_gene_mapping = True")
|
135 |
+
# STEP5
|
136 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
137 |
+
gene_annotation = get_gene_annotation(soft_file)
|
138 |
+
|
139 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
140 |
+
print("Gene annotation preview:")
|
141 |
+
print(preview_df(gene_annotation))
|
142 |
+
# STEP: Gene Identifier Mapping
|
143 |
+
|
144 |
+
# 1. Identify columns in the gene_annotation dataframe corresponding to the probe IDs (matching gene_data.index)
|
145 |
+
# and the gene symbols.
|
146 |
+
probe_id_column = "ID"
|
147 |
+
gene_symbol_column = "GENE_SYMBOL"
|
148 |
+
|
149 |
+
# 2. Get a gene mapping dataframe from the gene annotation
|
150 |
+
mapping_df = get_gene_mapping(
|
151 |
+
gene_annotation,
|
152 |
+
prob_col=probe_id_column,
|
153 |
+
gene_col=gene_symbol_column
|
154 |
+
)
|
155 |
+
|
156 |
+
# 3. Convert probe-level measurements to gene-level expression data using the mapping
|
157 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
158 |
+
import pandas as pd
|
159 |
+
|
160 |
+
# STEP 7: Data Normalization and Linking
|
161 |
+
|
162 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
163 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
164 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
165 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
166 |
+
|
167 |
+
# 2. Read the clinical DataFrame in a way that preserves the three rows (Arrhythmia, Age, Gender)
|
168 |
+
# and interprets the first CSV row as the sample ID columns.
|
169 |
+
clinical_df = pd.read_csv(out_clinical_data_file, header=0)
|
170 |
+
# We know there are exactly 3 rows of data: [0]: Arrhythmia, [1]: Age, [2]: Gender
|
171 |
+
clinical_df.index = [trait, "Age", "Gender"]
|
172 |
+
|
173 |
+
# 3. Link the clinical and genetic data
|
174 |
+
linked_data = geo_link_clinical_genetic_data(clinical_df, normalized_gene_data)
|
175 |
+
|
176 |
+
# 4. Handle missing values
|
177 |
+
linked_data = handle_missing_values(linked_data, trait)
|
178 |
+
|
179 |
+
# 5. Check for bias in the trait and remove any biased demographic features
|
180 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
181 |
+
|
182 |
+
# 6. Perform final validation and save metadata
|
183 |
+
is_usable = validate_and_save_cohort_info(
|
184 |
+
is_final=True,
|
185 |
+
cohort=cohort,
|
186 |
+
info_path=json_path,
|
187 |
+
is_gene_available=True,
|
188 |
+
is_trait_available=True,
|
189 |
+
is_biased=trait_biased,
|
190 |
+
df=linked_data,
|
191 |
+
note="Trait data is available; completed linking and preprocessing."
|
192 |
+
)
|
193 |
+
|
194 |
+
# 7. If the dataset is usable, save the final linked data
|
195 |
+
if is_usable:
|
196 |
+
linked_data.to_csv(out_data_file, index=True)
|
197 |
+
print(f"Saved linked data to {out_data_file}")
|
198 |
+
else:
|
199 |
+
print("The dataset is not usable; skipping final data output.")
|
p1/preprocess/Arrhythmia/code/GSE55231.py
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Arrhythmia"
|
6 |
+
cohort = "GSE55231"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Arrhythmia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Arrhythmia/GSE55231"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Arrhythmia/GSE55231.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Arrhythmia/gene_data/GSE55231.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Arrhythmia/clinical_data/GSE55231.csv"
|
16 |
+
json_path = "./output/preprocess/1/Arrhythmia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
from tools.preprocess import *
|
21 |
+
|
22 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
23 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
24 |
+
|
25 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
26 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
27 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
28 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
29 |
+
matrix_file,
|
30 |
+
background_prefixes,
|
31 |
+
clinical_prefixes
|
32 |
+
)
|
33 |
+
|
34 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
35 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
36 |
+
|
37 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
38 |
+
print("Background Information:")
|
39 |
+
print(background_info)
|
40 |
+
print("\nSample Characteristics Dictionary:")
|
41 |
+
print(sample_characteristics_dict)
|
42 |
+
# 1. Determine if gene expression data is available
|
43 |
+
is_gene_available = True # Based on study description (eQTL analysis, transcription profiling)
|
44 |
+
|
45 |
+
# 2. Identify variable availability
|
46 |
+
# Trait "Arrhythmia" is not listed in the sample characteristics, so treat it as not available.
|
47 |
+
trait_row = None
|
48 |
+
|
49 |
+
# Age is provided under key 2
|
50 |
+
age_row = 2
|
51 |
+
|
52 |
+
# Gender is provided under key 0
|
53 |
+
gender_row = 0
|
54 |
+
|
55 |
+
# 2.2 Define conversion functions
|
56 |
+
def convert_trait(value: str):
|
57 |
+
# Trait data is not available. Return None for all inputs.
|
58 |
+
return None
|
59 |
+
|
60 |
+
def convert_age(value: str):
|
61 |
+
# Parse the string after colon and convert to float if possible
|
62 |
+
parts = value.split(':', 1)
|
63 |
+
raw = parts[1].strip() if len(parts) > 1 else parts[0].strip()
|
64 |
+
try:
|
65 |
+
return float(raw)
|
66 |
+
except ValueError:
|
67 |
+
return None
|
68 |
+
|
69 |
+
def convert_gender(value: str):
|
70 |
+
# Parse the string after colon and convert to binary (female=0, male=1)
|
71 |
+
parts = value.split(':', 1)
|
72 |
+
raw = parts[1].strip().lower() if len(parts) > 1 else parts[0].strip().lower()
|
73 |
+
if raw == 'female':
|
74 |
+
return 0
|
75 |
+
elif raw == 'male':
|
76 |
+
return 1
|
77 |
+
return None
|
78 |
+
|
79 |
+
# 3. Initial usability filtering and metadata saving
|
80 |
+
is_trait_available = (trait_row is not None)
|
81 |
+
cohort_usable = validate_and_save_cohort_info(
|
82 |
+
is_final=False,
|
83 |
+
cohort=cohort,
|
84 |
+
info_path=json_path,
|
85 |
+
is_gene_available=is_gene_available,
|
86 |
+
is_trait_available=is_trait_available
|
87 |
+
)
|
88 |
+
|
89 |
+
# 4. Since trait_row is None, skip clinical feature extraction.
|
90 |
+
# STEP3
|
91 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
92 |
+
gene_data = get_genetic_data(matrix_file)
|
93 |
+
|
94 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
95 |
+
print(gene_data.index[:20])
|
96 |
+
# Based on observation, the "ILMN_" prefix indicates Illumina probe IDs, not standard human gene symbols.
|
97 |
+
# Therefore, they require mapping to gene symbols.
|
98 |
+
print("These identifiers are Illumina probe IDs.\nrequires_gene_mapping = True")
|
99 |
+
# STEP5
|
100 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
101 |
+
gene_annotation = get_gene_annotation(soft_file)
|
102 |
+
|
103 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
104 |
+
print("Gene annotation preview:")
|
105 |
+
print(preview_df(gene_annotation))
|
106 |
+
# STEP: Gene Identifier Mapping
|
107 |
+
|
108 |
+
# 1. Identify the columns in gene_annotation that match the probe ID and gene symbol
|
109 |
+
probe_col = 'ID'
|
110 |
+
gene_symbol_col = 'Symbol'
|
111 |
+
|
112 |
+
# 2. Create the gene mapping dataframe
|
113 |
+
gene_mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
114 |
+
|
115 |
+
# 3. Convert probe-level measurements to gene-level expression data
|
116 |
+
gene_data = apply_gene_mapping(gene_data, gene_mapping_df)
|
117 |
+
|
118 |
+
# Just for a brief preview, let's check the resulting shape
|
119 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
120 |
+
# STEP 7: Data Normalization and Linking
|
121 |
+
|
122 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
123 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
124 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
125 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
126 |
+
|
127 |
+
# 2. Check if we have a clinical dataframe called 'selected_clinical_df' (which only exists if trait_row was not None)
|
128 |
+
if 'selected_clinical_df' in globals():
|
129 |
+
# We have trait data, so we can link and proceed with the final steps.
|
130 |
+
selected_clinical = selected_clinical_df
|
131 |
+
|
132 |
+
# 3. Link the clinical and genetic data on sample IDs
|
133 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical, normalized_gene_data)
|
134 |
+
|
135 |
+
# 4. Handle missing values, removing or imputing as instructed
|
136 |
+
linked_data = handle_missing_values(linked_data, trait)
|
137 |
+
|
138 |
+
# 5. Determine whether the trait is severely biased.
|
139 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
140 |
+
|
141 |
+
# 6. Conduct final quality validation and save metadata
|
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="Cohort data successfully processed with trait-based analysis."
|
151 |
+
)
|
152 |
+
|
153 |
+
# 7. If the dataset is usable, save the final linked data
|
154 |
+
if is_usable:
|
155 |
+
linked_data.to_csv(out_data_file, index=True)
|
156 |
+
print(f"Saved final linked data to {out_data_file}")
|
157 |
+
else:
|
158 |
+
print("The dataset is not usable for trait-based association. Skipping final output.")
|
159 |
+
|
160 |
+
else:
|
161 |
+
# Trait data was not extracted in Step 2 (trait_row was None), so no clinical linking or bias checks.
|
162 |
+
print("No trait data found. Skipping linking, missing value handling, and trait bias analysis.")
|
163 |
+
# Perform an initial metadata save (not final) since we lack a trait.
|
164 |
+
is_usable = validate_and_save_cohort_info(
|
165 |
+
is_final=False,
|
166 |
+
cohort=cohort,
|
167 |
+
info_path=json_path,
|
168 |
+
is_gene_available=True,
|
169 |
+
is_trait_available=False
|
170 |
+
)
|
171 |
+
# Without trait data, this dataset won't move forward to final association analysis
|
172 |
+
print("No final output generated due to missing trait data.")
|
p1/preprocess/Arrhythmia/code/GSE93101.py
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Arrhythmia"
|
6 |
+
cohort = "GSE93101"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Arrhythmia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Arrhythmia/GSE93101"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Arrhythmia/GSE93101.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Arrhythmia/gene_data/GSE93101.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Arrhythmia/clinical_data/GSE93101.csv"
|
16 |
+
json_path = "./output/preprocess/1/Arrhythmia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
from tools.preprocess import *
|
21 |
+
|
22 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
23 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
24 |
+
|
25 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
26 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
27 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
28 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
29 |
+
matrix_file,
|
30 |
+
background_prefixes,
|
31 |
+
clinical_prefixes
|
32 |
+
)
|
33 |
+
|
34 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
35 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
36 |
+
|
37 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
38 |
+
print("Background Information:")
|
39 |
+
print(background_info)
|
40 |
+
print("\nSample Characteristics Dictionary:")
|
41 |
+
print(sample_characteristics_dict)
|
42 |
+
# 1. Decide whether gene expression data is available
|
43 |
+
# From the background information, this submission represents transcriptome data.
|
44 |
+
is_gene_available = True
|
45 |
+
|
46 |
+
# 2. Identify rows for trait, age, and gender, and define conversion functions.
|
47 |
+
# - trait_row, age_row, gender_row
|
48 |
+
trait_row = 0 # "course:" with multiple diseases listed, including "Arrhythmia"
|
49 |
+
age_row = 1 # "age:"
|
50 |
+
gender_row = 2 # "gender:"
|
51 |
+
|
52 |
+
def convert_trait(value: str) -> Optional[int]:
|
53 |
+
"""Convert the 'course' field to a binary variable: 1 if Arrhythmia, 0 otherwise."""
|
54 |
+
try:
|
55 |
+
# Example: "course: Arrhythmia"
|
56 |
+
val = value.split(":")[1].strip().lower()
|
57 |
+
return 1 if val == "arrhythmia" else 0
|
58 |
+
except IndexError:
|
59 |
+
return None
|
60 |
+
|
61 |
+
def convert_age(value: str) -> Optional[float]:
|
62 |
+
"""Convert the 'age' field to a float."""
|
63 |
+
try:
|
64 |
+
# Example: "age: 55.8"
|
65 |
+
val = value.split(":")[1].strip()
|
66 |
+
return float(val)
|
67 |
+
except (IndexError, ValueError):
|
68 |
+
return None
|
69 |
+
|
70 |
+
def convert_gender(value: str) -> Optional[int]:
|
71 |
+
"""Convert the 'gender' field to 0 (Female) or 1 (Male)."""
|
72 |
+
try:
|
73 |
+
# Example: "gender: F"
|
74 |
+
val = value.split(":")[1].strip().lower()
|
75 |
+
if val == "f":
|
76 |
+
return 0
|
77 |
+
elif val == "m":
|
78 |
+
return 1
|
79 |
+
else:
|
80 |
+
return None
|
81 |
+
except IndexError:
|
82 |
+
return None
|
83 |
+
|
84 |
+
# 3. Perform initial filtering and save metadata
|
85 |
+
# Trait data availability is inferred from whether trait_row is None.
|
86 |
+
is_trait_available = (trait_row is not None)
|
87 |
+
|
88 |
+
is_usable = validate_and_save_cohort_info(
|
89 |
+
is_final=False,
|
90 |
+
cohort=cohort,
|
91 |
+
info_path=json_path,
|
92 |
+
is_gene_available=is_gene_available,
|
93 |
+
is_trait_available=is_trait_available
|
94 |
+
)
|
95 |
+
|
96 |
+
# 4. If the trait data is available, extract and preview clinical features
|
97 |
+
if trait_row is not None:
|
98 |
+
selected_clinical_df = geo_select_clinical_features(
|
99 |
+
clinical_data, # Assume 'clinical_data' is our previously obtained pandas DataFrame
|
100 |
+
trait, # Global variable: "Arrhythmia"
|
101 |
+
trait_row,
|
102 |
+
convert_trait,
|
103 |
+
age_row,
|
104 |
+
convert_age,
|
105 |
+
gender_row,
|
106 |
+
convert_gender
|
107 |
+
)
|
108 |
+
|
109 |
+
# Preview the extracted clinical features
|
110 |
+
preview = preview_df(selected_clinical_df, n=5)
|
111 |
+
print(preview)
|
112 |
+
|
113 |
+
# Save the clinical features to file
|
114 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
115 |
+
# STEP3
|
116 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
117 |
+
gene_data = get_genetic_data(matrix_file)
|
118 |
+
|
119 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
120 |
+
print(gene_data.index[:20])
|
121 |
+
# Based on the provided identifiers (e.g., "ILMN_1651209", "ILMN_1651228"), they appear to be Illumina probe IDs, not standard human gene symbols.
|
122 |
+
# Therefore, mapping to gene symbols is needed.
|
123 |
+
|
124 |
+
print("requires_gene_mapping = True")
|
125 |
+
# STEP5
|
126 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
127 |
+
gene_annotation = get_gene_annotation(soft_file)
|
128 |
+
|
129 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
130 |
+
print("Gene annotation preview:")
|
131 |
+
print(preview_df(gene_annotation))
|
132 |
+
# STEP: Gene Identifier Mapping
|
133 |
+
|
134 |
+
# 1. Decide which columns correspond to the probe ID and the gene symbol.
|
135 |
+
# From the preview, the 'ID' column in 'gene_annotation' matches the expression data's row index,
|
136 |
+
# and the 'Symbol' column appears to store the gene symbol.
|
137 |
+
probe_id_col = "ID"
|
138 |
+
gene_symbol_col = "Symbol"
|
139 |
+
|
140 |
+
# 2. Get the gene mapping dataframe from the annotation.
|
141 |
+
mapping_df = get_gene_mapping(gene_annotation, probe_id_col, gene_symbol_col)
|
142 |
+
|
143 |
+
# 3. Convert probe-level measurements to gene-level expression data.
|
144 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
145 |
+
# STEP 7: Data Normalization and Linking
|
146 |
+
|
147 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
148 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
149 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
150 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
151 |
+
|
152 |
+
# 2. Use the 'selected_clinical_df' variable from step 2 to link clinical and genetic data
|
153 |
+
selected_clinical = selected_clinical_df
|
154 |
+
|
155 |
+
# 3. Link the clinical and genetic data on sample IDs
|
156 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical, normalized_gene_data)
|
157 |
+
|
158 |
+
# 4. Handle missing values, removing or imputing as instructed
|
159 |
+
linked_data = handle_missing_values(linked_data, trait)
|
160 |
+
|
161 |
+
# 5. Determine whether the trait (and potentially other features) is severely biased.
|
162 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
163 |
+
|
164 |
+
# 6. Conduct final quality validation and save metadata
|
165 |
+
is_usable = validate_and_save_cohort_info(
|
166 |
+
is_final=True,
|
167 |
+
cohort=cohort,
|
168 |
+
info_path=json_path,
|
169 |
+
is_gene_available=True,
|
170 |
+
is_trait_available=True, # We do have a trait column
|
171 |
+
is_biased=trait_biased,
|
172 |
+
df=linked_data,
|
173 |
+
note="Cohort data successfully processed with trait-based analysis."
|
174 |
+
)
|
175 |
+
|
176 |
+
# 7. If the dataset is usable, save the final linked data
|
177 |
+
if is_usable:
|
178 |
+
linked_data.to_csv(out_data_file, index=True)
|
179 |
+
print(f"Saved final linked data to {out_data_file}")
|
180 |
+
else:
|
181 |
+
print("The dataset is not usable for trait-based association. Skipping final output.")
|
p1/preprocess/Arrhythmia/code/TCGA.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Arrhythmia"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/1/Arrhythmia/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/1/Arrhythmia/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/1/Arrhythmia/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/1/Arrhythmia/cohort_info.json"
|
15 |
+
|
16 |
+
import os
|
17 |
+
import pandas as pd
|
18 |
+
|
19 |
+
# 1. Identify the relevant subdirectory for the trait "Arrhythmia"
|
20 |
+
subdirectories = [
|
21 |
+
'CrawlData.ipynb', '.DS_Store', 'TCGA_lower_grade_glioma_and_glioblastoma_(GBMLGG)',
|
22 |
+
'TCGA_Uterine_Carcinosarcoma_(UCS)', 'TCGA_Thyroid_Cancer_(THCA)', 'TCGA_Thymoma_(THYM)',
|
23 |
+
'TCGA_Testicular_Cancer_(TGCT)', 'TCGA_Stomach_Cancer_(STAD)', 'TCGA_Sarcoma_(SARC)',
|
24 |
+
'TCGA_Rectal_Cancer_(READ)', 'TCGA_Prostate_Cancer_(PRAD)', 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)',
|
25 |
+
'TCGA_Pancreatic_Cancer_(PAAD)', 'TCGA_Ovarian_Cancer_(OV)', 'TCGA_Ocular_melanomas_(UVM)',
|
26 |
+
'TCGA_Mesothelioma_(MESO)', 'TCGA_Melanoma_(SKCM)', 'TCGA_Lung_Squamous_Cell_Carcinoma_(LUSC)',
|
27 |
+
'TCGA_Lung_Cancer_(LUNG)', 'TCGA_Lung_Adenocarcinoma_(LUAD)', 'TCGA_Lower_Grade_Glioma_(LGG)',
|
28 |
+
'TCGA_Liver_Cancer_(LIHC)', 'TCGA_Large_Bcell_Lymphoma_(DLBC)', 'TCGA_Kidney_Papillary_Cell_Carcinoma_(KIRP)',
|
29 |
+
'TCGA_Kidney_Clear_Cell_Carcinoma_(KIRC)', 'TCGA_Kidney_Chromophobe_(KICH)', 'TCGA_Head_and_Neck_Cancer_(HNSC)',
|
30 |
+
'TCGA_Glioblastoma_(GBM)', 'TCGA_Esophageal_Cancer_(ESCA)', 'TCGA_Endometrioid_Cancer_(UCEC)',
|
31 |
+
'TCGA_Colon_and_Rectal_Cancer_(COADREAD)', 'TCGA_Colon_Cancer_(COAD)', 'TCGA_Cervical_Cancer_(CESC)',
|
32 |
+
'TCGA_Breast_Cancer_(BRCA)', 'TCGA_Bladder_Cancer_(BLCA)', 'TCGA_Bile_Duct_Cancer_(CHOL)',
|
33 |
+
'TCGA_Adrenocortical_Cancer_(ACC)', 'TCGA_Acute_Myeloid_Leukemia_(LAML)'
|
34 |
+
]
|
35 |
+
|
36 |
+
# Include potential synonyms or related terms for "Arrhythmia"
|
37 |
+
trait_keyword = "Arrhythmia"
|
38 |
+
synonyms = ["arrhythmia", "af", "fibrillation", "arrhythmic", "atrial"]
|
39 |
+
|
40 |
+
target_subdir = None
|
41 |
+
for sd in subdirectories:
|
42 |
+
# Check if any synonym appears in the subdirectory name
|
43 |
+
if any(syn in sd.lower() for syn in synonyms):
|
44 |
+
target_subdir = sd
|
45 |
+
break
|
46 |
+
|
47 |
+
if target_subdir is None:
|
48 |
+
# No suitable data found for this trait; mark as completed
|
49 |
+
print("No TCGA subdirectory found for the trait. Skipping.")
|
50 |
+
else:
|
51 |
+
# 2. Locate clinical and genetic data files
|
52 |
+
cohort_dir = os.path.join(tcga_root_dir, target_subdir)
|
53 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
54 |
+
|
55 |
+
# 3. Load the data
|
56 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
57 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
58 |
+
|
59 |
+
# 4. Print column names of clinical data
|
60 |
+
print(clinical_df.columns)
|
p1/preprocess/Arrhythmia/gene_data/GSE115574.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM3182680,GSM3182681,GSM3182682,GSM3182683,GSM3182684,GSM3182685,GSM3182686,GSM3182687,GSM3182688,GSM3182689,GSM3182690,GSM3182691,GSM3182692,GSM3182693,GSM3182694,GSM3182695,GSM3182696,GSM3182697,GSM3182698,GSM3182699,GSM3182700,GSM3182701,GSM3182702,GSM3182703,GSM3182704,GSM3182705,GSM3182706,GSM3182707,GSM3182708,GSM3182709,GSM3182710,GSM3182711,GSM3182712,GSM3182713,GSM3182714,GSM3182715,GSM3182716,GSM3182717,GSM3182718,GSM3182719,GSM3182720,GSM3182721,GSM3182722,GSM3182723,GSM3182724,GSM3182725,GSM3182726,GSM3182727,GSM3182728,GSM3182729,GSM3182730,GSM3182731,GSM3182732,GSM3182733,GSM3182734,GSM3182735,GSM3182736,GSM3182737,GSM3182738
|
p1/preprocess/Arrhythmia/gene_data/GSE136992.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM4064970,GSM4064971,GSM4064972,GSM4064973,GSM4064974,GSM4064975,GSM4064976,GSM4064977,GSM4064978,GSM4064979,GSM4064980,GSM4064981,GSM4064982,GSM4064983,GSM4064984,GSM4064985,GSM4064986,GSM4064987,GSM4064988,GSM4064989,GSM4064990,GSM4064991,GSM4064992,GSM4064993,GSM4064994,GSM4064995,GSM4064996,GSM4064997,GSM4064998,GSM4064999,GSM4065000,GSM4065001,GSM4065002,GSM4065003,GSM4065004,GSM4065005,GSM4065006,GSM4065007,GSM4065008,GSM4065009,GSM4065010,GSM4065011,GSM4065012,GSM4065013,GSM4065014,GSM4065015,GSM4065016,GSM4065017,GSM4065018,GSM4065019,GSM4065020,GSM4065021,GSM4065022,GSM4065023,GSM4065024,GSM4065025,GSM4065026,GSM4065027,GSM4065028,GSM4065029
|
p1/preprocess/Arrhythmia/gene_data/GSE143924.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ID,GSM4276706,GSM4276707,GSM4276708,GSM4276709,GSM4276710,GSM4276711,GSM4276712,GSM4276713,GSM4276714,GSM4276715,GSM4276716,GSM4276717,GSM4276718,GSM4276719,GSM4276720,GSM4276721,GSM4276722,GSM4276723,GSM4276724,GSM4276725,GSM4276726,GSM4276727,GSM4276728,GSM4276729,GSM4276730,GSM4276731,GSM4276732,GSM4276733,GSM4276734,GSM4276735
|
p1/preprocess/Arrhythmia/gene_data/GSE41177.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM1005418,GSM1005419,GSM1005420,GSM1005421,GSM1005422,GSM1005423,GSM1005424,GSM1005425,GSM1005426,GSM1005427,GSM1005428,GSM1005429,GSM1005430,GSM1005431,GSM1005432,GSM1005433,GSM1005434,GSM1005435,GSM1005436,GSM1005437,GSM1005438,GSM1005439,GSM1005440,GSM1005441,GSM1005442,GSM1005443,GSM1005444,GSM1005445,GSM1006245,GSM1006246,GSM1006247,GSM1006248,GSM1006249,GSM1006250,GSM1006251,GSM1006252,GSM1006253,GSM1006254
|
p1/preprocess/Arrhythmia/gene_data/GSE53622.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM1296956,GSM1296957,GSM1296958,GSM1296959,GSM1296960,GSM1296961,GSM1296962,GSM1296963,GSM1296964,GSM1296965,GSM1296966,GSM1296967,GSM1296968,GSM1296969,GSM1296970,GSM1296971,GSM1296972,GSM1296973,GSM1296974,GSM1296975,GSM1296976,GSM1296977,GSM1296978,GSM1296979,GSM1296980,GSM1296981,GSM1296982,GSM1296983,GSM1296984,GSM1296985,GSM1296986,GSM1296987,GSM1296988,GSM1296989,GSM1296990,GSM1296991,GSM1296992,GSM1296993,GSM1296994,GSM1296995,GSM1296996,GSM1296997,GSM1296998,GSM1296999,GSM1297000,GSM1297001,GSM1297002,GSM1297003,GSM1297004,GSM1297005,GSM1297006,GSM1297007,GSM1297008,GSM1297009,GSM1297010,GSM1297011,GSM1297012,GSM1297013,GSM1297014,GSM1297015,GSM1297016,GSM1297017,GSM1297018,GSM1297019,GSM1297020,GSM1297021,GSM1297022,GSM1297023,GSM1297024,GSM1297025,GSM1297026,GSM1297027,GSM1297028,GSM1297029,GSM1297030,GSM1297031,GSM1297032,GSM1297033,GSM1297034,GSM1297035,GSM1297036,GSM1297037,GSM1297038,GSM1297039,GSM1297040,GSM1297041,GSM1297042,GSM1297043,GSM1297044,GSM1297045,GSM1297046,GSM1297047,GSM1297048,GSM1297049,GSM1297050,GSM1297051,GSM1297052,GSM1297053,GSM1297054,GSM1297055,GSM1297056,GSM1297057,GSM1297058,GSM1297059,GSM1297060,GSM1297061,GSM1297062,GSM1297063,GSM1297064,GSM1297065,GSM1297066,GSM1297067,GSM1297068,GSM1297069,GSM1297070,GSM1297071,GSM1297072,GSM1297073,GSM1297074,GSM1297075
|
p1/preprocess/Arrhythmia/gene_data/GSE55231.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM1332057,GSM1332058,GSM1332059,GSM1332060,GSM1332061,GSM1332062,GSM1332063,GSM1332064,GSM1332065,GSM1332066,GSM1332067,GSM1332068,GSM1332069,GSM1332070,GSM1332071,GSM1332072,GSM1332073,GSM1332074,GSM1332075,GSM1332076,GSM1332077,GSM1332078,GSM1332079,GSM1332080,GSM1332081,GSM1332082,GSM1332083,GSM1332084,GSM1332085,GSM1332086,GSM1332087,GSM1332088,GSM1332089,GSM1332090,GSM1332091,GSM1332092,GSM1332093,GSM1332094,GSM1332095,GSM1332096,GSM1332097,GSM1332098,GSM1332099,GSM1332100,GSM1332101,GSM1332102,GSM1332103,GSM1332104,GSM1332105,GSM1332106,GSM1332107,GSM1332108,GSM1332109,GSM1332110,GSM1332111,GSM1332112,GSM1332113,GSM1332114,GSM1332115,GSM1332116,GSM1332117,GSM1332118,GSM1332119,GSM1332120,GSM1332121,GSM1332122,GSM1332123,GSM1332124,GSM1332125,GSM1332126,GSM1332127,GSM1332128,GSM1332129,GSM1332130,GSM1332131,GSM1332132,GSM1332133,GSM1332134,GSM1332135,GSM1332136,GSM1332137,GSM1332138,GSM1332139,GSM1332140,GSM1332141,GSM1332142,GSM1332143,GSM1332144,GSM1332145,GSM1332146,GSM1332147,GSM1332148,GSM1332149,GSM1332150,GSM1332151,GSM1332152,GSM1332153,GSM1332154,GSM1332155,GSM1332156,GSM1332157,GSM1332158,GSM1332159,GSM1332160,GSM1332161,GSM1332162,GSM1332163,GSM1332164,GSM1332165,GSM1332166,GSM1332167,GSM1332168,GSM1332169,GSM1332170,GSM1332171,GSM1332172,GSM1332173,GSM1332174,GSM1332175,GSM1332176,GSM1332177,GSM1332178,GSM1332179,GSM1332180,GSM1332181,GSM1332182,GSM1332183,GSM1332184,GSM1332185
|
p1/preprocess/Arrhythmia/gene_data/GSE93101.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM2443799,GSM2443800,GSM2443801,GSM2443802,GSM2443803,GSM2443804,GSM2443805,GSM2443806,GSM2443807,GSM2443808,GSM2443809,GSM2443810,GSM2443811,GSM2443812,GSM2443813,GSM2443814,GSM2443815,GSM2443816,GSM2443817,GSM2443818,GSM2443819,GSM2443820,GSM2443821,GSM2443822,GSM2443823,GSM2443824,GSM2443825,GSM2443826,GSM2443827,GSM2443828,GSM2443829,GSM2443830,GSM2443831
|
p1/preprocess/Asthma/clinical_data/GSE123086.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
GSM3494884,GSM3494885,GSM3494886,GSM3494887,GSM3494888,GSM3494889,GSM3494890,GSM3494891,GSM3494892,GSM3494893,GSM3494894,GSM3494895,GSM3494896,GSM3494897,GSM3494898,GSM3494899,GSM3494900,GSM3494901,GSM3494902,GSM3494903,GSM3494904,GSM3494905,GSM3494906,GSM3494907,GSM3494908,GSM3494909,GSM3494910,GSM3494911,GSM3494912,GSM3494913,GSM3494914,GSM3494915,GSM3494916,GSM3494917,GSM3494918,GSM3494919,GSM3494920,GSM3494921,GSM3494922,GSM3494923,GSM3494924,GSM3494925,GSM3494926,GSM3494927,GSM3494928,GSM3494929,GSM3494930,GSM3494931,GSM3494932,GSM3494933,GSM3494934,GSM3494935,GSM3494936,GSM3494937,GSM3494938,GSM3494939,GSM3494940,GSM3494941,GSM3494942,GSM3494943,GSM3494944,GSM3494945,GSM3494946,GSM3494947,GSM3494948,GSM3494949,GSM3494950,GSM3494951,GSM3494952,GSM3494953,GSM3494954,GSM3494955,GSM3494956,GSM3494957,GSM3494958,GSM3494959,GSM3494960,GSM3494961,GSM3494962,GSM3494963,GSM3494964,GSM3494965,GSM3494966,GSM3494967,GSM3494968,GSM3494969,GSM3494970,GSM3494971,GSM3494972,GSM3494973,GSM3494974,GSM3494975,GSM3494976,GSM3494977,GSM3494978,GSM3494979,GSM3494980,GSM3494981,GSM3494982,GSM3494983,GSM3494984,GSM3494985,GSM3494986,GSM3494987,GSM3494988,GSM3494989,GSM3494990,GSM3494991,GSM3494992,GSM3494993,GSM3494994,GSM3494995,GSM3494996,GSM3494997,GSM3494998,GSM3494999,GSM3495000,GSM3495001,GSM3495002,GSM3495003,GSM3495004,GSM3495005,GSM3495006,GSM3495007,GSM3495008,GSM3495009,GSM3495010,GSM3495011,GSM3495012,GSM3495013,GSM3495014,GSM3495015,GSM3495016,GSM3495017,GSM3495018,GSM3495019,GSM3495020,GSM3495021,GSM3495022,GSM3495023,GSM3495024,GSM3495025,GSM3495026,GSM3495027,GSM3495028,GSM3495029,GSM3495030,GSM3495031,GSM3495032,GSM3495033,GSM3495034,GSM3495035,GSM3495036,GSM3495037,GSM3495038,GSM3495039,GSM3495040,GSM3495041,GSM3495042,GSM3495043,GSM3495044,GSM3495045,GSM3495046,GSM3495047,GSM3495048,GSM3495049
|
2 |
+
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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 |
+
56.0,,20.0,51.0,37.0,61.0,,31.0,56.0,41.0,61.0,,80.0,53.0,61.0,73.0,60.0,76.0,77.0,74.0,69.0,77.0,81.0,70.0,82.0,69.0,82.0,67.0,67.0,78.0,67.0,74.0,,51.0,72.0,66.0,80.0,36.0,67.0,31.0,31.0,45.0,56.0,65.0,53.0,48.0,50.0,76.0,,24.0,42.0,76.0,22.0,,23.0,34.0,43.0,47.0,24.0,55.0,48.0,58.0,30.0,28.0,41.0,63.0,55.0,55.0,67.0,47.0,46.0,49.0,23.0,68.0,39.0,24.0,36.0,58.0,38.0,27.0,67.0,61.0,69.0,63.0,60.0,17.0,10.0,9.0,13.0,10.0,13.0,15.0,12.0,13.0,81.0,94.0,51.0,40.0,,97.0,23.0,93.0,58.0,28.0,54.0,15.0,8.0,11.0,12.0,8.0,14.0,8.0,10.0,14.0,13.0,40.0,52.0,42.0,29.0,43.0,41.0,54.0,42.0,49.0,45.0,56.0,64.0,71.0,48.0,20.0,53.0,32.0,26.0,28.0,47.0,24.0,48.0,,19.0,41.0,38.0,,15.0,12.0,13.0,,11.0,,16.0,11.0,,35.0,26.0,39.0,46.0,42.0,20.0,69.0,69.0,47.0,47.0,56.0,54.0,53.0,50.0,22.0
|
p1/preprocess/Asthma/clinical_data/GSE123088.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GSM3494884,GSM3494885,GSM3494886,GSM3494887,GSM3494888,GSM3494889,GSM3494890,GSM3494891,GSM3494892,GSM3494893,GSM3494894,GSM3494895,GSM3494896,GSM3494897,GSM3494898,GSM3494899,GSM3494900,GSM3494901,GSM3494902,GSM3494903,GSM3494904,GSM3494905,GSM3494906,GSM3494907,GSM3494908,GSM3494909,GSM3494910,GSM3494911,GSM3494912,GSM3494913,GSM3494914,GSM3494915,GSM3494916,GSM3494917,GSM3494918,GSM3494919,GSM3494920,GSM3494921,GSM3494922,GSM3494923,GSM3494924,GSM3494925,GSM3494926,GSM3494927,GSM3494928,GSM3494929,GSM3494930,GSM3494931,GSM3494932,GSM3494933,GSM3494934,GSM3494935,GSM3494936,GSM3494937,GSM3494938,GSM3494939,GSM3494940,GSM3494941,GSM3494942,GSM3494943,GSM3494944,GSM3494945,GSM3494946,GSM3494947,GSM3494948,GSM3494949,GSM3494950,GSM3494951,GSM3494952,GSM3494953,GSM3494954,GSM3494955,GSM3494956,GSM3494957,GSM3494958,GSM3494959,GSM3494960,GSM3494961,GSM3494962,GSM3494963,GSM3494964,GSM3494965,GSM3494966,GSM3494967,GSM3494968,GSM3494969,GSM3494970,GSM3494971,GSM3494972,GSM3494973,GSM3494974,GSM3494975,GSM3494976,GSM3494977,GSM3494978,GSM3494979,GSM3494980,GSM3494981,GSM3494982,GSM3494983,GSM3494984,GSM3494985,GSM3494986,GSM3494987,GSM3494988,GSM3494989,GSM3494990,GSM3494991,GSM3494992,GSM3494993,GSM3494994,GSM3494995,GSM3494996,GSM3494997,GSM3494998,GSM3494999,GSM3495000,GSM3495001,GSM3495002,GSM3495003,GSM3495004,GSM3495005,GSM3495006,GSM3495007,GSM3495008,GSM3495009,GSM3495010,GSM3495011,GSM3495012,GSM3495013,GSM3495014,GSM3495015,GSM3495016,GSM3495017,GSM3495018,GSM3495019,GSM3495020,GSM3495021,GSM3495022,GSM3495023,GSM3495024,GSM3495025,GSM3495026,GSM3495027,GSM3495028,GSM3495029,GSM3495030,GSM3495031,GSM3495032,GSM3495033,GSM3495034,GSM3495035,GSM3495036,GSM3495037,GSM3495038,GSM3495039,GSM3495040,GSM3495041,GSM3495042,GSM3495043,GSM3495044,GSM3495045,GSM3495046,GSM3495047,GSM3495048,GSM3495049,GSM3495050,GSM3495051,GSM3495052,GSM3495053,GSM3495054,GSM3495055,GSM3495056,GSM3495057,GSM3495058,GSM3495059,GSM3495060,GSM3495061,GSM3495062,GSM3495063,GSM3495064,GSM3495065,GSM3495066,GSM3495067,GSM3495068,GSM3495069,GSM3495070,GSM3495071,GSM3495072,GSM3495073,GSM3495074,GSM3495075,GSM3495076,GSM3495077,GSM3495078,GSM3495079,GSM3495080,GSM3495081,GSM3495082,GSM3495083,GSM3495084,GSM3495085,GSM3495086,GSM3495087
|
2 |
+
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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 |
+
56.0,,20.0,51.0,37.0,61.0,,31.0,56.0,41.0,61.0,,80.0,53.0,61.0,73.0,60.0,76.0,77.0,74.0,69.0,77.0,81.0,70.0,82.0,69.0,82.0,67.0,67.0,78.0,67.0,74.0,,51.0,72.0,66.0,80.0,36.0,67.0,31.0,31.0,45.0,56.0,65.0,53.0,48.0,50.0,76.0,,24.0,42.0,76.0,22.0,,23.0,34.0,43.0,47.0,24.0,55.0,48.0,58.0,30.0,28.0,41.0,63.0,55.0,55.0,67.0,47.0,46.0,49.0,23.0,68.0,39.0,24.0,36.0,58.0,38.0,27.0,67.0,61.0,69.0,63.0,60.0,17.0,10.0,9.0,13.0,10.0,13.0,15.0,12.0,13.0,81.0,94.0,51.0,40.0,,97.0,23.0,93.0,58.0,28.0,54.0,15.0,8.0,11.0,12.0,8.0,14.0,8.0,10.0,14.0,13.0,40.0,52.0,42.0,29.0,43.0,41.0,54.0,42.0,49.0,45.0,56.0,64.0,71.0,48.0,20.0,53.0,32.0,26.0,28.0,47.0,24.0,48.0,,19.0,41.0,38.0,,15.0,12.0,13.0,,11.0,,16.0,11.0,,35.0,26.0,39.0,46.0,42.0,20.0,69.0,69.0,47.0,47.0,56.0,54.0,53.0,50.0,22.0,62.0,74.0,57.0,47.0,70.0,50.0,52.0,43.0,57.0,53.0,70.0,41.0,61.0,39.0,58.0,55.0,63.0,60.0,43.0,68.0,67.0,50.0,67.0,51.0,59.0,44.0,35.0,83.0,78.0,88.0,41.0,60.0,72.0,53.0,73.0,56.0,38.0,53.0
|
4 |
+
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,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,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,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,0.0,0.0,1.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,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,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,0.0,,0.0,1.0,0.0,,1.0,,1.0,1.0,,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p1/preprocess/Asthma/clinical_data/GSE182797.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
GSM5537157,GSM5537158,GSM5537159,GSM5537160,GSM5537161,GSM5537162,GSM5537163,GSM5537164,GSM5537165,GSM5537166,GSM5537167,GSM5537168,GSM5537169,GSM5537170,GSM5537171,GSM5537172,GSM5537173,GSM5537174,GSM5537175,GSM5537176,GSM5537177,GSM5537178,GSM5537179,GSM5537180,GSM5537181,GSM5537182,GSM5537183,GSM5537184,GSM5537185,GSM5537186,GSM5537187,GSM5537188,GSM5537189,GSM5537190,GSM5537191,GSM5537192,GSM5537193,GSM5537194,GSM5537195,GSM5537196,GSM5537197,GSM5537198,GSM5537199,GSM5537200,GSM5537201,GSM5537202,GSM5537203,GSM5537204,GSM5537205,GSM5537206,GSM5537207,GSM5537208,GSM5537209,GSM5537210,GSM5537211,GSM5537212,GSM5537213,GSM5537214,GSM5537215,GSM5537216,GSM5537217,GSM5537218,GSM5537219,GSM5537220,GSM5537221,GSM5537222,GSM5537223,GSM5537224,GSM5537225,GSM5537226,GSM5537227,GSM5537228,GSM5537229,GSM5537230,GSM5537231,GSM5537232,GSM5537233,GSM5537234,GSM5537235,GSM5537236
|
2 |
+
0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.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,0.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.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,0.0,0.0,1.0,1.0,1.0,0.0
|
3 |
+
38.33,38.08,48.83,33.42,46.08,45.58,28.0,30.83,39.25,60.17,52.75,25.75,60.67,64.67,54.83,57.67,47.0,47.5,24.25,47.67,47.58,18.42,41.33,24.5,47.08,47.5,41.17,48.83,47.17,59.83,42.58,56.67,37.5,58.58,24.75,52.75,55.33,56.17,52.75,40.67,19.17,42.5,57.08,40.58,40.67,55.75,43.17,59.58,56.25,46.42,47.08,51.75,53.5,52.58,52.25,45.58,52.67,50.5,60.08,44.67,57.58,53.17,51.33,46.17,26.58,60.17,54.67,57.75,28.42,33.08,50.33,37.83,44.25,58.83,48.25,43.08,41.17,51.75,53.58,41.5
|
p1/preprocess/Asthma/clinical_data/GSE182798.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
GSM5530417,GSM5530418,GSM5530419,GSM5530420,GSM5530421,GSM5530422,GSM5530423,GSM5530424,GSM5530425,GSM5530426,GSM5530427,GSM5530428,GSM5530429,GSM5530430,GSM5530431,GSM5530432,GSM5530433,GSM5530434,GSM5530435,GSM5530436,GSM5530437,GSM5530438,GSM5530439,GSM5530440,GSM5530441,GSM5530442,GSM5530443,GSM5530444,GSM5530445,GSM5530446,GSM5530447,GSM5530448,GSM5530449,GSM5530450,GSM5530451,GSM5530452,GSM5530453,GSM5530454,GSM5530455,GSM5530456,GSM5530457,GSM5530458,GSM5530459,GSM5530460,GSM5530461,GSM5530462,GSM5530463,GSM5530464,GSM5530465,GSM5530466,GSM5530467,GSM5530468,GSM5530469,GSM5530470,GSM5530471,GSM5530472,GSM5530473,GSM5530474,GSM5530475,GSM5530476,GSM5530477,GSM5530478,GSM5530479,GSM5530480,GSM5530481,GSM5530482,GSM5530483,GSM5530484,GSM5530485,GSM5530486,GSM5530487,GSM5530488,GSM5530489,GSM5530490,GSM5530491,GSM5530492,GSM5530493,GSM5530494,GSM5530495,GSM5530496,GSM5530497,GSM5530498,GSM5530499,GSM5530500,GSM5530501,GSM5530502,GSM5530503,GSM5530504,GSM5530505,GSM5530506,GSM5530507,GSM5530508,GSM5530509,GSM5530510,GSM5530511,GSM5530512,GSM5530513,GSM5530514,GSM5530515,GSM5530516,GSM5530517,GSM5530518,GSM5537157,GSM5537158,GSM5537159,GSM5537160,GSM5537161,GSM5537162,GSM5537163,GSM5537164,GSM5537165,GSM5537166,GSM5537167,GSM5537168,GSM5537169,GSM5537170,GSM5537171,GSM5537172,GSM5537173,GSM5537174,GSM5537175,GSM5537176,GSM5537177,GSM5537178,GSM5537179,GSM5537180,GSM5537181,GSM5537182,GSM5537183,GSM5537184,GSM5537185,GSM5537186,GSM5537187,GSM5537188,GSM5537189,GSM5537190,GSM5537191,GSM5537192,GSM5537193,GSM5537194,GSM5537195,GSM5537196,GSM5537197,GSM5537198,GSM5537199,GSM5537200,GSM5537201,GSM5537202,GSM5537203,GSM5537204,GSM5537205,GSM5537206,GSM5537207,GSM5537208,GSM5537209,GSM5537210,GSM5537211,GSM5537212,GSM5537213,GSM5537214,GSM5537215,GSM5537216,GSM5537217,GSM5537218,GSM5537219,GSM5537220,GSM5537221,GSM5537222,GSM5537223,GSM5537224,GSM5537225,GSM5537226,GSM5537227,GSM5537228,GSM5537229,GSM5537230,GSM5537231,GSM5537232,GSM5537233,GSM5537234,GSM5537235,GSM5537236
|
2 |
+
1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.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,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,0.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,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.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,0.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.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,0.0,0.0,1.0,1.0,1.0,0.0
|
3 |
+
33.42,46.08,45.58,28.0,25.75,59.83,41.17,47.58,50.75,42.58,52.75,51.75,18.42,47.0,38.33,58.58,56.17,52.75,40.67,47.5,54.67,48.83,25.75,64.67,54.83,57.67,39.17,38.08,28.42,40.75,43.17,43.08,48.83,58.83,26.58,42.5,48.25,39.25,55.33,47.0,55.75,47.08,47.5,53.58,60.17,40.58,50.5,46.17,51.33,56.67,37.5,48.83,38.08,52.58,52.67,59.58,56.25,46.42,47.08,52.67,60.08,44.67,57.58,26.58,53.5,58.83,41.5,47.17,51.25,33.08,50.33,60.17,19.17,40.67,24.25,43.08,51.75,41.17,30.83,40.58,42.58,52.75,43.17,24.75,51.75,24.5,44.5,53.17,38.08,37.83,41.33,47.67,57.75,37.5,41.5,44.25,53.58,45.58,19.17,18.42,57.08,60.67,38.33,38.08,48.83,33.42,46.08,45.58,28.0,30.83,39.25,60.17,52.75,25.75,60.67,64.67,54.83,57.67,47.0,47.5,24.25,47.67,47.58,18.42,41.33,24.5,47.08,47.5,41.17,48.83,47.17,59.83,42.58,56.67,37.5,58.58,24.75,52.75,55.33,56.17,52.75,40.67,19.17,42.5,57.08,40.58,40.67,55.75,43.17,59.58,56.25,46.42,47.08,51.75,53.5,52.58,52.25,45.58,52.67,50.5,60.08,44.67,57.58,53.17,51.33,46.17,26.58,60.17,54.67,57.75,28.42,33.08,50.33,37.83,44.25,58.83,48.25,43.08,41.17,51.75,53.58,41.5
|
p1/preprocess/Asthma/clinical_data/GSE185658.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
GSM5621296,GSM5621297,GSM5621298,GSM5621299,GSM5621300,GSM5621301,GSM5621302,GSM5621303,GSM5621304,GSM5621305,GSM5621306,GSM5621307,GSM5621308,GSM5621309,GSM5621310,GSM5621311,GSM5621312,GSM5621313,GSM5621314,GSM5621315,GSM5621316,GSM5621317,GSM5621318,GSM5621319,GSM5621320,GSM5621321,GSM5621322,GSM5621323,GSM5621324,GSM5621325,GSM5621326,GSM5621327,GSM5621328,GSM5621329,GSM5621330,GSM5621331,GSM5621332,GSM5621333,GSM5621334,GSM5621335,GSM5621336,GSM5621337,GSM5621338,GSM5621339,GSM5621340,GSM5621341,GSM5621342,GSM5621343
|
2 |
+
1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,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,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0
|
p1/preprocess/Asthma/clinical_data/GSE270312.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
GSM8339381,GSM8339382,GSM8339383,GSM8339384,GSM8339385,GSM8339386,GSM8339387,GSM8339388,GSM8339389,GSM8339390,GSM8339391,GSM8339392,GSM8339393,GSM8339394,GSM8339395,GSM8339396,GSM8339397,GSM8339398,GSM8339399,GSM8339400,GSM8339401,GSM8339402,GSM8339403,GSM8339404,GSM8339405,GSM8339406,GSM8339407,GSM8339408,GSM8339409,GSM8339410,GSM8339411,GSM8339412,GSM8339413,GSM8339414,GSM8339415,GSM8339416,GSM8339417,GSM8339418,GSM8339419,GSM8339420,GSM8339421,GSM8339422,GSM8339423,GSM8339424,GSM8339425,GSM8339426,GSM8339427,GSM8339428,GSM8339429,GSM8339430,GSM8339431,GSM8339432,GSM8339433,GSM8339434,GSM8339435,GSM8339436,GSM8339437,GSM8339438,GSM8339439,GSM8339440,GSM8339441,GSM8339442,GSM8339443,GSM8339444,GSM8339445,GSM8339446,GSM8339447,GSM8339448,GSM8339449,GSM8339450,GSM8339451,GSM8339452,GSM8339453,GSM8339454,GSM8339455,GSM8339456,GSM8339457,GSM8339458,GSM8339459,GSM8339460,GSM8339461,GSM8339462,GSM8339463,GSM8339464,GSM8339465,GSM8339466,GSM8339467,GSM8339468,GSM8339469,GSM8339470
|
2 |
+
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,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,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0
|
3 |
+
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,0.0,0.0,0.0,0.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,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,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,0.0,0.0,0.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,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0
|
p1/preprocess/Asthma/code/GSE123086.py
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE123086"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE123086"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE123086.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE123086.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE123086.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1. Determine if the dataset likely contains gene expression data
|
37 |
+
# Based on the microarray-based gene expression description, set this to True.
|
38 |
+
is_gene_available = True
|
39 |
+
|
40 |
+
# 2. Identify availability of "trait", "age", and "gender" from the sample characteristics
|
41 |
+
# After examining each row in the sample characteristics dictionary:
|
42 |
+
# - The primary diagnosis row is key 1, which includes "primary diagnosis: ASTHMA" among others.
|
43 |
+
# That will serve as our trait row, since it's not constant and contains "ASTHMA".
|
44 |
+
# - Age values appear predominantly in row 3 (and some in row 4). We'll select row 3 for age.
|
45 |
+
# - Gender data is scattered (partly in row 2, partly in row 3) and not presented in a single row,
|
46 |
+
# so we set gender_row to None.
|
47 |
+
|
48 |
+
trait_row = 1
|
49 |
+
age_row = 3
|
50 |
+
gender_row = None
|
51 |
+
|
52 |
+
# 2.2. Define data conversion functions
|
53 |
+
|
54 |
+
def convert_trait(x: str) -> Optional[int]:
|
55 |
+
"""
|
56 |
+
Convert trait data into a binary variable, 1 for ASTHMA, 0 otherwise.
|
57 |
+
If not parsable, return None.
|
58 |
+
"""
|
59 |
+
parts = x.split(':')
|
60 |
+
if len(parts) < 2:
|
61 |
+
return None
|
62 |
+
val = parts[1].strip().upper()
|
63 |
+
return 1 if val == "ASTHMA" else 0
|
64 |
+
|
65 |
+
def convert_age(x: str) -> Optional[float]:
|
66 |
+
"""
|
67 |
+
Convert age data into a continuous float. If the string does not
|
68 |
+
contain 'age:' or cannot be parsed, return None.
|
69 |
+
"""
|
70 |
+
parts = x.split(':')
|
71 |
+
if len(parts) < 2:
|
72 |
+
return None
|
73 |
+
if "age" in parts[0].lower():
|
74 |
+
try:
|
75 |
+
return float(parts[1].strip())
|
76 |
+
except ValueError:
|
77 |
+
return None
|
78 |
+
return None
|
79 |
+
|
80 |
+
def convert_gender(x: str) -> Optional[int]:
|
81 |
+
"""
|
82 |
+
Convert gender data to 0 (female) or 1 (male). If not parsable, return None.
|
83 |
+
"""
|
84 |
+
parts = x.split(':')
|
85 |
+
if len(parts) < 2:
|
86 |
+
return None
|
87 |
+
if "sex" in parts[0].lower():
|
88 |
+
val = parts[1].strip().lower()
|
89 |
+
if val == "female":
|
90 |
+
return 0
|
91 |
+
elif val == "male":
|
92 |
+
return 1
|
93 |
+
return None
|
94 |
+
|
95 |
+
# 3. Save metadata (initial filtering)
|
96 |
+
# Trait availability is True if trait_row is not None, otherwise False.
|
97 |
+
is_trait_available = (trait_row is not None)
|
98 |
+
is_usable = validate_and_save_cohort_info(
|
99 |
+
is_final=False,
|
100 |
+
cohort=cohort,
|
101 |
+
info_path=json_path,
|
102 |
+
is_gene_available=is_gene_available,
|
103 |
+
is_trait_available=is_trait_available
|
104 |
+
)
|
105 |
+
|
106 |
+
# 4. If trait data is available, extract clinical features and save them
|
107 |
+
if trait_row is not None:
|
108 |
+
selected_clinical_df = geo_select_clinical_features(
|
109 |
+
clinical_df=clinical_data,
|
110 |
+
trait=trait,
|
111 |
+
trait_row=trait_row,
|
112 |
+
convert_trait=convert_trait,
|
113 |
+
age_row=age_row,
|
114 |
+
convert_age=convert_age,
|
115 |
+
gender_row=gender_row,
|
116 |
+
convert_gender=convert_gender
|
117 |
+
)
|
118 |
+
# Preview the resulting DataFrame
|
119 |
+
preview_clin = preview_df(selected_clinical_df)
|
120 |
+
print("Preview of selected clinical features:", preview_clin)
|
121 |
+
|
122 |
+
# Save the clinical data to CSV
|
123 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
124 |
+
# STEP3
|
125 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
126 |
+
gene_data = get_genetic_data(matrix_file)
|
127 |
+
|
128 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
129 |
+
print(gene_data.index[:20])
|
130 |
+
# Observing the identifiers: they appear to be numeric and not standard human gene symbols.
|
131 |
+
# Therefore, they likely need to be mapped to gene symbols.
|
132 |
+
print("requires_gene_mapping = True")
|
133 |
+
# STEP5
|
134 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
135 |
+
gene_annotation = get_gene_annotation(soft_file)
|
136 |
+
|
137 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
138 |
+
print("Gene annotation preview:")
|
139 |
+
print(preview_df(gene_annotation))
|
140 |
+
# STEP 6: Gene Identifier Mapping (Revised Debugged Code)
|
141 |
+
|
142 |
+
def apply_gene_mapping_entrez(expression_df: pd.DataFrame, mapping_df: pd.DataFrame) -> pd.DataFrame:
|
143 |
+
"""
|
144 |
+
Convert measured data about gene probes (indexed by numeric 'ID') into gene-level data
|
145 |
+
(using numeric Entrez IDs). Handles one-to-many or many-to-one mappings by splitting
|
146 |
+
probe expression values equally among mapped genes, and summing where multiple probes
|
147 |
+
map to the same gene.
|
148 |
+
"""
|
149 |
+
# Remove any duplicate probe entries in the mapping
|
150 |
+
mapping_df = mapping_df.drop_duplicates(subset=['ID', 'Gene'])
|
151 |
+
mapping_df = mapping_df.dropna(subset=['ID', 'Gene'])
|
152 |
+
|
153 |
+
# Also ensure expression_df has a unique index
|
154 |
+
expression_df = expression_df[~expression_df.index.duplicated(keep='first')]
|
155 |
+
|
156 |
+
# Make sure mapping DataFrame is indexed by probe ID
|
157 |
+
mapping_df.set_index('ID', inplace=True)
|
158 |
+
|
159 |
+
# Some platforms may have multiple Entrez IDs joined by a delimiter. Split safely if needed.
|
160 |
+
mapping_df['Gene'] = mapping_df['Gene'].astype(str)
|
161 |
+
mapping_df['Gene'] = mapping_df['Gene'].apply(
|
162 |
+
lambda x: x.split('//') if '//' in x else x.split(';') if ';' in x else [x]
|
163 |
+
)
|
164 |
+
|
165 |
+
# Count the number of genes each probe maps to
|
166 |
+
mapping_df['num_genes'] = mapping_df['Gene'].apply(len)
|
167 |
+
|
168 |
+
# Expand to one row per (probe, gene) pair
|
169 |
+
mapping_df = mapping_df.explode('Gene').dropna(subset=['Gene'])
|
170 |
+
|
171 |
+
# Join expression values (probe-level) onto the mapping table
|
172 |
+
merged_df = mapping_df.join(expression_df, how='inner') # inner join to keep only matched probes
|
173 |
+
|
174 |
+
# Identify the columns containing actual expression values (the sample columns)
|
175 |
+
# We'll exclude 'Gene' and 'num_genes'
|
176 |
+
expr_cols = [c for c in merged_df.columns if c not in ['Gene', 'num_genes']]
|
177 |
+
|
178 |
+
# Divide each probe's expression by the number of genes it maps to
|
179 |
+
merged_df[expr_cols] = merged_df[expr_cols].div(merged_df['num_genes'].replace(0, 1), axis=0)
|
180 |
+
|
181 |
+
# Finally, sum over genes to get gene-level expression data
|
182 |
+
gene_expression_df = merged_df.groupby('Gene')[expr_cols].sum()
|
183 |
+
|
184 |
+
return gene_expression_df
|
185 |
+
|
186 |
+
# 1. Identify the columns in the annotation that match our needs
|
187 |
+
probe_col = "ID"
|
188 |
+
gene_col = "ENTREZ_GENE_ID"
|
189 |
+
|
190 |
+
# 2. Build a mapping DataFrame
|
191 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_col)
|
192 |
+
|
193 |
+
# 3. Convert probe-level data to gene-level data
|
194 |
+
# Using the debugged function that preserves numeric Entrez IDs
|
195 |
+
gene_data = apply_gene_mapping_entrez(gene_data, mapping_df)
|
196 |
+
|
197 |
+
# Check resulting shape and index
|
198 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
199 |
+
print("First 10 gene identifiers in mapped data:", gene_data.index[:10].tolist())
|
200 |
+
# STEP7
|
201 |
+
# 1. Normalize the obtained gene data with the 'normalize_gene_symbols_in_index' function from the library.
|
202 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
203 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
204 |
+
|
205 |
+
# 2. Link the clinical and genetic data with the 'geo_link_clinical_genetic_data' function from the library.
|
206 |
+
# Replace 'df_clinical' with the correct clinical DataFrame variable 'selected_clinical_df'.
|
207 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
208 |
+
|
209 |
+
# 3. Handle missing values in the linked data
|
210 |
+
linked_data = handle_missing_values(linked_data, trait)
|
211 |
+
|
212 |
+
# 4. Determine whether the trait and some demographic features are severely biased, and remove biased features.
|
213 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
214 |
+
|
215 |
+
# 5. Conduct quality check and save the cohort information, passing the final unbiased data.
|
216 |
+
is_usable = validate_and_save_cohort_info(
|
217 |
+
is_final=True,
|
218 |
+
cohort=cohort,
|
219 |
+
info_path=json_path,
|
220 |
+
is_gene_available=True,
|
221 |
+
is_trait_available=True,
|
222 |
+
is_biased=is_trait_biased,
|
223 |
+
df=unbiased_linked_data
|
224 |
+
)
|
225 |
+
|
226 |
+
# 6. If the linked data is usable, save it as a CSV file to 'out_data_file'.
|
227 |
+
if is_usable:
|
228 |
+
unbiased_linked_data.to_csv(out_data_file)
|
p1/preprocess/Asthma/code/GSE123088.py
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE123088"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE123088"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE123088.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE123088.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE123088.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# Step 1. Decide if gene expression data is available:
|
37 |
+
is_gene_available = True # Based on the background info, we assume it's a gene expression dataset.
|
38 |
+
|
39 |
+
# Step 2. Identify keys and define conversion functions.
|
40 |
+
|
41 |
+
# 2.1 Find the rows that hold the trait (Asthma), age, and gender data.
|
42 |
+
trait_row = 1 # multiple diagnoses found here, including 'ASTHMA'
|
43 |
+
age_row = 3 # row with various ages
|
44 |
+
gender_row = 2 # row containing both 'Sex: Male' and 'Sex: Female'
|
45 |
+
|
46 |
+
# 2.2 Data type conversion functions
|
47 |
+
def convert_trait(x: str):
|
48 |
+
"""
|
49 |
+
Convert trait to binary:
|
50 |
+
1 -> Asthma
|
51 |
+
0 -> Non-Asthma
|
52 |
+
If cannot parse, return None.
|
53 |
+
"""
|
54 |
+
parts = x.split(":")
|
55 |
+
if len(parts) < 2:
|
56 |
+
return None
|
57 |
+
value = parts[1].strip().lower()
|
58 |
+
# If the word "asthma" appears, treat it as 1; otherwise 0.
|
59 |
+
return 1 if "asthma" in value else 0
|
60 |
+
|
61 |
+
def convert_age(x: str):
|
62 |
+
"""
|
63 |
+
Convert age to a float (continuous).
|
64 |
+
Unknown or unparsable -> None
|
65 |
+
"""
|
66 |
+
parts = x.split(":")
|
67 |
+
if len(parts) < 2:
|
68 |
+
return None
|
69 |
+
value = parts[1].strip()
|
70 |
+
try:
|
71 |
+
return float(value)
|
72 |
+
except:
|
73 |
+
return None
|
74 |
+
|
75 |
+
def convert_gender(x: str):
|
76 |
+
"""
|
77 |
+
Convert gender to binary:
|
78 |
+
0 -> Female
|
79 |
+
1 -> Male
|
80 |
+
Unknown -> None
|
81 |
+
"""
|
82 |
+
parts = x.split(":")
|
83 |
+
if len(parts) < 2:
|
84 |
+
return None
|
85 |
+
value = parts[1].strip().lower()
|
86 |
+
if value == "male":
|
87 |
+
return 1
|
88 |
+
elif value == "female":
|
89 |
+
return 0
|
90 |
+
else:
|
91 |
+
return None
|
92 |
+
|
93 |
+
# Step 3. Save basic metadata (initial filtering)
|
94 |
+
is_trait_available = (trait_row is not None)
|
95 |
+
is_usable = validate_and_save_cohort_info(
|
96 |
+
is_final=False,
|
97 |
+
cohort=cohort,
|
98 |
+
info_path=json_path,
|
99 |
+
is_gene_available=is_gene_available,
|
100 |
+
is_trait_available=is_trait_available
|
101 |
+
)
|
102 |
+
|
103 |
+
# Step 4. Clinical feature extraction (only if trait data is available).
|
104 |
+
if trait_row is not None:
|
105 |
+
df_clinical = geo_select_clinical_features(
|
106 |
+
clinical_df=clinical_data,
|
107 |
+
trait=trait,
|
108 |
+
trait_row=trait_row,
|
109 |
+
convert_trait=convert_trait,
|
110 |
+
age_row=age_row,
|
111 |
+
convert_age=convert_age,
|
112 |
+
gender_row=gender_row,
|
113 |
+
convert_gender=convert_gender
|
114 |
+
)
|
115 |
+
# Observe the output
|
116 |
+
preview_result = preview_df(df_clinical)
|
117 |
+
print("Preview of extracted clinical features:\n", preview_result)
|
118 |
+
|
119 |
+
# Save the clinical features
|
120 |
+
df_clinical.to_csv(out_clinical_data_file, index=False)
|
121 |
+
# STEP3
|
122 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
123 |
+
gene_data = get_genetic_data(matrix_file)
|
124 |
+
|
125 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
126 |
+
print(gene_data.index[:20])
|
127 |
+
# Based on the numeric IDs observed (e.g., '1', '2', '3'), these are not standard human gene symbols.
|
128 |
+
# They appear to be Entrez IDs or some other numeric identifiers. Therefore, gene mapping is required.
|
129 |
+
|
130 |
+
requires_gene_mapping = True
|
131 |
+
# STEP5
|
132 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
133 |
+
gene_annotation = get_gene_annotation(soft_file)
|
134 |
+
|
135 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
136 |
+
print("Gene annotation preview:")
|
137 |
+
print(preview_df(gene_annotation))
|
138 |
+
# STEP: Gene Identifier Mapping
|
139 |
+
|
140 |
+
# 1. Identify which columns correspond to the gene expression IDs and the gene symbols:
|
141 |
+
# From the preview, the "ID" column matches the numeric identifiers in the gene expression DataFrame,
|
142 |
+
# and "ENTREZ_GENE_ID" represents the gene symbol (though it's also numeric, it's the only available gene label).
|
143 |
+
|
144 |
+
mapping_df = get_gene_mapping(
|
145 |
+
annotation=gene_annotation,
|
146 |
+
prob_col="ID", # The probe/ID column that matches the expression data index
|
147 |
+
gene_col="ENTREZ_GENE_ID" # The column we treat as the 'Gene' symbol
|
148 |
+
)
|
149 |
+
|
150 |
+
# 2. Convert probe-level measurements to gene-level expression
|
151 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
152 |
+
|
153 |
+
# gene_data now contains aggregated expression by gene.
|
154 |
+
# STEP7
|
155 |
+
# 1. Normalize the obtained gene data with the 'normalize_gene_symbols_in_index' function from the library.
|
156 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
157 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
158 |
+
|
159 |
+
# 2. Link the clinical and genetic data with the 'geo_link_clinical_genetic_data' function from the library.
|
160 |
+
linked_data = geo_link_clinical_genetic_data(df_clinical, normalized_gene_data)
|
161 |
+
|
162 |
+
# 3. Handle missing values in the linked data
|
163 |
+
linked_data = handle_missing_values(linked_data, trait)
|
164 |
+
|
165 |
+
# 4. Determine whether the trait and some demographic features are severely biased, and remove biased features.
|
166 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
167 |
+
|
168 |
+
# 5. Conduct quality check and save the cohort information, passing the final unbiased data.
|
169 |
+
is_usable = validate_and_save_cohort_info(
|
170 |
+
is_final=True,
|
171 |
+
cohort=cohort,
|
172 |
+
info_path=json_path,
|
173 |
+
is_gene_available=True,
|
174 |
+
is_trait_available=True,
|
175 |
+
is_biased=is_trait_biased,
|
176 |
+
df=unbiased_linked_data
|
177 |
+
)
|
178 |
+
|
179 |
+
# 6. If the linked data is usable, save it as a CSV file to 'out_data_file'.
|
180 |
+
if is_usable:
|
181 |
+
unbiased_linked_data.to_csv(out_data_file)
|
p1/preprocess/Asthma/code/GSE182797.py
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE182797"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE182797"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE182797.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE182797.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE182797.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
27 |
+
matrix_file,
|
28 |
+
background_prefixes,
|
29 |
+
clinical_prefixes
|
30 |
+
)
|
31 |
+
|
32 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
33 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
34 |
+
|
35 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
36 |
+
print("Background Information:")
|
37 |
+
print(background_info)
|
38 |
+
print("\nSample Characteristics Dictionary:")
|
39 |
+
print(sample_characteristics_dict)
|
40 |
+
# 1) Gene Expression Data Availability
|
41 |
+
is_gene_available = True # Based on "Transcriptomic profiling" and "microarray analyses"
|
42 |
+
|
43 |
+
# 2) Variable Availability and Data Type Conversion
|
44 |
+
# 2.1 Identify rows
|
45 |
+
trait_row = 0 # "diagnosis: ..." contains multiple distinct values including "adult-onset asthma"
|
46 |
+
age_row = 2 # "age: ..." contains multiple numerical values
|
47 |
+
gender_row = None # Only "gender: Female" found, no variability => not available
|
48 |
+
|
49 |
+
# 2.2 Define conversion functions
|
50 |
+
def convert_trait(value: str):
|
51 |
+
"""
|
52 |
+
Convert diagnosis data to a binary label:
|
53 |
+
adult-onset asthma -> 1, otherwise (healthy/IEI) -> 0, unknown -> None
|
54 |
+
"""
|
55 |
+
parts = value.split(':')
|
56 |
+
if len(parts) < 2:
|
57 |
+
return None
|
58 |
+
val = parts[1].strip().lower()
|
59 |
+
if 'adult-onset asthma' in val:
|
60 |
+
return 1
|
61 |
+
elif 'healthy' in val or 'iei' in val:
|
62 |
+
return 0
|
63 |
+
return None
|
64 |
+
|
65 |
+
def convert_age(value: str):
|
66 |
+
"""Convert age data to a float. Unknown or invalid entries -> None."""
|
67 |
+
parts = value.split(':')
|
68 |
+
if len(parts) < 2:
|
69 |
+
return None
|
70 |
+
val = parts[1].strip()
|
71 |
+
try:
|
72 |
+
return float(val)
|
73 |
+
except ValueError:
|
74 |
+
return None
|
75 |
+
|
76 |
+
def convert_gender(value: str):
|
77 |
+
"""
|
78 |
+
Convert gender data to binary (female->0, male->1).
|
79 |
+
Not used here because gender_row is None, but defined for completeness.
|
80 |
+
"""
|
81 |
+
parts = value.split(':')
|
82 |
+
if len(parts) < 2:
|
83 |
+
return None
|
84 |
+
val = parts[1].strip().lower()
|
85 |
+
if val == 'female':
|
86 |
+
return 0
|
87 |
+
elif val == 'male':
|
88 |
+
return 1
|
89 |
+
return None
|
90 |
+
|
91 |
+
# 3) Save Metadata (initial filtering)
|
92 |
+
is_trait_available = (trait_row is not None)
|
93 |
+
is_usable = validate_and_save_cohort_info(
|
94 |
+
is_final=False,
|
95 |
+
cohort=cohort,
|
96 |
+
info_path=json_path,
|
97 |
+
is_gene_available=is_gene_available,
|
98 |
+
is_trait_available=is_trait_available
|
99 |
+
)
|
100 |
+
|
101 |
+
# 4) Clinical Feature Extraction (only if trait data is available)
|
102 |
+
if trait_row is not None:
|
103 |
+
# 'clinical_data' is assumed to be the DataFrame containing sample characteristics
|
104 |
+
selected_clinical_df = geo_select_clinical_features(
|
105 |
+
clinical_df=clinical_data,
|
106 |
+
trait=trait,
|
107 |
+
trait_row=trait_row,
|
108 |
+
convert_trait=convert_trait,
|
109 |
+
age_row=age_row,
|
110 |
+
convert_age=convert_age,
|
111 |
+
gender_row=gender_row,
|
112 |
+
convert_gender=convert_gender
|
113 |
+
)
|
114 |
+
|
115 |
+
# Preview and save the selected clinical data
|
116 |
+
preview = preview_df(selected_clinical_df)
|
117 |
+
print("Preview of extracted clinical data:", preview)
|
118 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
119 |
+
# STEP3
|
120 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
121 |
+
gene_data = get_genetic_data(matrix_file)
|
122 |
+
|
123 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
124 |
+
print(gene_data.index[:20])
|
125 |
+
# These identifiers (e.g., 'A_19_P00315452') are microarray probe IDs
|
126 |
+
# and do not appear to be standard human gene symbols.
|
127 |
+
# Therefore, they need to be mapped to gene symbols.
|
128 |
+
print("requires_gene_mapping = True")
|
129 |
+
# STEP5
|
130 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
131 |
+
gene_annotation = get_gene_annotation(soft_file)
|
132 |
+
|
133 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
134 |
+
print("Gene annotation preview:")
|
135 |
+
print(preview_df(gene_annotation))
|
136 |
+
# STEP: Gene Identifier Mapping
|
137 |
+
|
138 |
+
# 1. Identify columns in gene_annotation for probe IDs and gene symbols
|
139 |
+
probe_col = 'ID'
|
140 |
+
gene_symbol_col = 'GENE_SYMBOL'
|
141 |
+
|
142 |
+
# 2. Get the mapping of probe IDs to gene symbols
|
143 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
144 |
+
|
145 |
+
# 3. Convert probe-level data to gene-level data
|
146 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
147 |
+
|
148 |
+
# (Optional) Check the shape or a small preview of the mapped gene_data
|
149 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
150 |
+
# STEP 7: Data Normalization and Linking
|
151 |
+
|
152 |
+
# 1) Normalize gene symbols
|
153 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
154 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
155 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
156 |
+
|
157 |
+
# 2) Read the previously saved clinical data (which should have shape (2 rows) x (80 columns))
|
158 |
+
# so that it aligns correctly with normalized_gene_data.
|
159 |
+
temp_clinical = pd.read_csv(out_clinical_data_file) # Use the first row as header
|
160 |
+
temp_clinical.index = [trait, "Age"]
|
161 |
+
temp_clinical.columns = normalized_gene_data.columns # Match with the 80 sample IDs
|
162 |
+
|
163 |
+
# Link the clinical and gene data
|
164 |
+
linked_data = geo_link_clinical_genetic_data(temp_clinical, normalized_gene_data)
|
165 |
+
|
166 |
+
# 3) Handle missing values
|
167 |
+
processed_data = handle_missing_values(linked_data, trait_col=trait)
|
168 |
+
|
169 |
+
# 4) Remove biased demographic features; check whether our trait is overly biased
|
170 |
+
trait_biased, final_data = judge_and_remove_biased_features(processed_data, trait=trait)
|
171 |
+
|
172 |
+
# 5) Conduct final dataset validation
|
173 |
+
is_usable = validate_and_save_cohort_info(
|
174 |
+
is_final=True,
|
175 |
+
cohort=cohort,
|
176 |
+
info_path=json_path,
|
177 |
+
is_gene_available=True,
|
178 |
+
is_trait_available=True,
|
179 |
+
is_biased=trait_biased,
|
180 |
+
df=final_data,
|
181 |
+
note="Final processed dataset for trait and gene expression."
|
182 |
+
)
|
183 |
+
|
184 |
+
# 6) If the dataset is usable, save the final linked data
|
185 |
+
if is_usable:
|
186 |
+
final_data.to_csv(out_data_file)
|
187 |
+
print(f"Saved final linked data to {out_data_file}")
|
188 |
+
else:
|
189 |
+
print("Dataset not usable. No final linked file was saved.")
|
p1/preprocess/Asthma/code/GSE182798.py
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE182798"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE182798"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE182798.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE182798.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE182798.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
27 |
+
matrix_file,
|
28 |
+
background_prefixes,
|
29 |
+
clinical_prefixes
|
30 |
+
)
|
31 |
+
|
32 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
33 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
34 |
+
|
35 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
36 |
+
print("Background Information:")
|
37 |
+
print(background_info)
|
38 |
+
print("\nSample Characteristics Dictionary:")
|
39 |
+
print(sample_characteristics_dict)
|
40 |
+
def convert_trait(x):
|
41 |
+
if not isinstance(x, str):
|
42 |
+
return None
|
43 |
+
# Split only once, to ensure we keep the part after the colon.
|
44 |
+
parts = x.split(':', 1)
|
45 |
+
if len(parts) < 2:
|
46 |
+
return None
|
47 |
+
val = parts[1].strip().lower()
|
48 |
+
# Convert to a binary indicator: 1 if adult-onset asthma, else 0
|
49 |
+
# (other categories like IEI or healthy => 0)
|
50 |
+
if 'adult-onset asthma' in val:
|
51 |
+
return 1
|
52 |
+
else:
|
53 |
+
return 0
|
54 |
+
|
55 |
+
def convert_age(x):
|
56 |
+
if not isinstance(x, str):
|
57 |
+
return None
|
58 |
+
parts = x.split(':', 1)
|
59 |
+
if len(parts) < 2:
|
60 |
+
return None
|
61 |
+
try:
|
62 |
+
return float(parts[1].strip())
|
63 |
+
except ValueError:
|
64 |
+
return None
|
65 |
+
|
66 |
+
def convert_gender(x):
|
67 |
+
if not isinstance(x, str):
|
68 |
+
return None
|
69 |
+
parts = x.split(':', 1)
|
70 |
+
if len(parts) < 2:
|
71 |
+
return None
|
72 |
+
val = parts[1].strip().lower()
|
73 |
+
if val in ['female', 'f']:
|
74 |
+
return 0
|
75 |
+
elif val in ['male', 'm']:
|
76 |
+
return 1
|
77 |
+
return None
|
78 |
+
|
79 |
+
# 1. Check gene expression data availability
|
80 |
+
is_gene_available = True # Based on the transcriptomic profiling background
|
81 |
+
|
82 |
+
# 2.1 Identify row indices for trait, age, and gender
|
83 |
+
trait_row = 0 # "diagnosis: adult-onset asthma", etc. => available
|
84 |
+
age_row = 2 # "age: 33.42", "age: 46.08", ... => available
|
85 |
+
# Row 1 (gender) has only one unique value => treat it as not available
|
86 |
+
gender_row = None
|
87 |
+
|
88 |
+
# 3. Metadata: initial filtering
|
89 |
+
# trait_row != None => trait is available
|
90 |
+
is_trait_available = (trait_row is not None)
|
91 |
+
is_usable = validate_and_save_cohort_info(
|
92 |
+
is_final=False,
|
93 |
+
cohort=cohort,
|
94 |
+
info_path=json_path,
|
95 |
+
is_gene_available=is_gene_available,
|
96 |
+
is_trait_available=is_trait_available
|
97 |
+
)
|
98 |
+
|
99 |
+
# 4. If trait is available, extract clinical features
|
100 |
+
if trait_row is not None:
|
101 |
+
selected_clinical_df = geo_select_clinical_features(
|
102 |
+
clinical_data,
|
103 |
+
trait=trait,
|
104 |
+
trait_row=trait_row,
|
105 |
+
convert_trait=convert_trait,
|
106 |
+
age_row=age_row,
|
107 |
+
convert_age=convert_age,
|
108 |
+
gender_row=gender_row, # None
|
109 |
+
convert_gender=convert_gender
|
110 |
+
)
|
111 |
+
preview_result = preview_df(selected_clinical_df)
|
112 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
113 |
+
print(preview_result)
|
114 |
+
# STEP3
|
115 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
116 |
+
gene_data = get_genetic_data(matrix_file)
|
117 |
+
|
118 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
119 |
+
print(gene_data.index[:20])
|
120 |
+
# These IDs (e.g., 'A_19_P00315452') appear to be array probe identifiers rather than standard gene symbols.
|
121 |
+
# Therefore, gene mapping is required.
|
122 |
+
print("requires_gene_mapping = True")
|
123 |
+
# STEP5
|
124 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
125 |
+
gene_annotation = get_gene_annotation(soft_file)
|
126 |
+
|
127 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
128 |
+
print("Gene annotation preview:")
|
129 |
+
print(preview_df(gene_annotation))
|
130 |
+
# STEP: Gene Identifier Mapping
|
131 |
+
|
132 |
+
# 1) Identify the appropriate columns in the gene annotation
|
133 |
+
# - The probe ID column in the annotation that matches the expression data index is "ID"
|
134 |
+
# - The gene symbol column is "GENE_SYMBOL"
|
135 |
+
|
136 |
+
# 2) Get a dataframe mapping probe IDs to gene symbols
|
137 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="GENE_SYMBOL")
|
138 |
+
|
139 |
+
# 3) Convert probe-level expression data into gene-level expression data
|
140 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
141 |
+
|
142 |
+
# (Optional) Print the shape or a small preview of the resulting gene_data
|
143 |
+
print("Gene-level expression data shape:", gene_data.shape)
|
144 |
+
print("Gene-level expression data (head):")
|
145 |
+
print(gene_data.head())
|
146 |
+
# STEP 7: Data Normalization and Linking
|
147 |
+
|
148 |
+
# 1) Normalize gene symbols in the obtained gene expression data;
|
149 |
+
# remove unrecognized symbols and average duplicates.
|
150 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
151 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
152 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
153 |
+
|
154 |
+
# 2) Read previously saved clinical data. Because we saved it in Step 2 with index=False and each row representing
|
155 |
+
# a feature (trait or age), we need to transpose it so that the samples become rows and features become columns.
|
156 |
+
clinical_df = pd.read_csv(out_clinical_data_file, header=0)
|
157 |
+
clinical_df = clinical_df.T
|
158 |
+
# Rename the columns so they match the variables we want
|
159 |
+
clinical_df.columns = [trait, "Age"]
|
160 |
+
|
161 |
+
# 3) Link clinical with genetic data
|
162 |
+
linked_data = geo_link_clinical_genetic_data(clinical_df, normalized_gene_data)
|
163 |
+
|
164 |
+
# 4) Handle missing values in the linked data:
|
165 |
+
# remove samples with missing trait, remove genes with >20% missing,
|
166 |
+
# remove samples with >5% missing genes, then impute for the rest.
|
167 |
+
linked_data = handle_missing_values(linked_data, trait)
|
168 |
+
|
169 |
+
# 5) Check for severe bias in the trait and remove biased demographic features
|
170 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
|
171 |
+
|
172 |
+
# 6) Conduct final quality validation and save metadata
|
173 |
+
is_usable = validate_and_save_cohort_info(
|
174 |
+
is_final=True,
|
175 |
+
cohort=cohort,
|
176 |
+
info_path=json_path,
|
177 |
+
is_gene_available=True,
|
178 |
+
is_trait_available=True,
|
179 |
+
is_biased=trait_biased,
|
180 |
+
df=linked_data,
|
181 |
+
note="Processed with trait and gene data successfully."
|
182 |
+
)
|
183 |
+
|
184 |
+
# 7) If the dataset is usable, save the final linked data to CSV
|
185 |
+
if is_usable:
|
186 |
+
linked_data.to_csv(out_data_file)
|
187 |
+
print(f"Saved final linked data to {out_data_file}")
|
188 |
+
else:
|
189 |
+
print("Data not usable. No final linked file was saved.")
|
p1/preprocess/Asthma/code/GSE184382.py
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE184382"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE184382"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE184382.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE184382.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE184382.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
27 |
+
matrix_file,
|
28 |
+
background_prefixes,
|
29 |
+
clinical_prefixes
|
30 |
+
)
|
31 |
+
|
32 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
33 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
34 |
+
|
35 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
36 |
+
print("Background Information:")
|
37 |
+
print(background_info)
|
38 |
+
print("\nSample Characteristics Dictionary:")
|
39 |
+
print(sample_characteristics_dict)
|
40 |
+
# 1. Gene Expression Data Availability
|
41 |
+
is_gene_available = True # This dataset includes transcriptome microarray data.
|
42 |
+
|
43 |
+
# 2. Variable Availability
|
44 |
+
trait_row = None # No row indicates "asthma" or similar
|
45 |
+
age_row = None # No row for age
|
46 |
+
gender_row = None # No row for gender
|
47 |
+
|
48 |
+
# 2.2 Data Type Conversion
|
49 |
+
def convert_trait(value: str) -> int:
|
50 |
+
"""
|
51 |
+
Convert raw trait string to a binary indicator (0 or 1).
|
52 |
+
Since trait_row is None, this function won't be used.
|
53 |
+
"""
|
54 |
+
# Placeholder implementation
|
55 |
+
return None
|
56 |
+
|
57 |
+
def convert_age(value: str) -> float:
|
58 |
+
"""
|
59 |
+
Convert raw age string to a float (continuous).
|
60 |
+
Since age_row is None, this function won't be used.
|
61 |
+
"""
|
62 |
+
# Placeholder implementation
|
63 |
+
return None
|
64 |
+
|
65 |
+
def convert_gender(value: str) -> int:
|
66 |
+
"""
|
67 |
+
Convert raw gender string to 0 (female) or 1 (male).
|
68 |
+
Since gender_row is None, this function won't be used.
|
69 |
+
"""
|
70 |
+
# Placeholder implementation
|
71 |
+
return None
|
72 |
+
|
73 |
+
# 3. Save Metadata
|
74 |
+
# Determine trait availability
|
75 |
+
is_trait_available = (trait_row is not None)
|
76 |
+
|
77 |
+
is_usable = validate_and_save_cohort_info(
|
78 |
+
is_final=False,
|
79 |
+
cohort=cohort,
|
80 |
+
info_path=json_path,
|
81 |
+
is_gene_available=is_gene_available,
|
82 |
+
is_trait_available=is_trait_available
|
83 |
+
)
|
84 |
+
|
85 |
+
# 4. Clinical Feature Extraction
|
86 |
+
# Since trait_row is None, we skip feature extraction.
|
87 |
+
# STEP3
|
88 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
89 |
+
gene_data = get_genetic_data(matrix_file)
|
90 |
+
|
91 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
92 |
+
print(gene_data.index[:20])
|
93 |
+
# These identifiers (e.g., "A_19_P...", "(+)E1A_r60_...", "3xSLv1") are not standard human gene symbols.
|
94 |
+
# They appear to be array or custom IDs that require mapping to gene symbols.
|
95 |
+
|
96 |
+
requires_gene_mapping = True
|
97 |
+
# STEP5
|
98 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
99 |
+
gene_annotation = get_gene_annotation(soft_file)
|
100 |
+
|
101 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
102 |
+
print("Gene annotation preview:")
|
103 |
+
print(preview_df(gene_annotation))
|
104 |
+
# STEP: Gene Identifier Mapping
|
105 |
+
|
106 |
+
# 1 & 2. Identify the columns in the annotation corresponding to the gene expression IDs and the gene symbols
|
107 |
+
# Here, 'ID' holds probe identifiers matching those in 'gene_data'
|
108 |
+
# and 'GENE_SYMBOL' holds the corresponding gene symbols.
|
109 |
+
|
110 |
+
gene_mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="GENE_SYMBOL")
|
111 |
+
|
112 |
+
# 3. Convert probe-level measurements to gene-level data using the mapping.
|
113 |
+
gene_data = apply_gene_mapping(gene_data, gene_mapping_df)
|
114 |
+
# STEP 7: Data Normalization and Linking
|
115 |
+
|
116 |
+
# We know from prior steps:
|
117 |
+
# - Trait is NOT available (trait_row = None), so no clinical CSV was saved.
|
118 |
+
# - We do have gene data, so we will at least normalize it.
|
119 |
+
|
120 |
+
# 1) Normalize gene symbols
|
121 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
122 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
123 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
124 |
+
|
125 |
+
# 2) Since trait is not available, we cannot link or handle clinical data.
|
126 |
+
# We'll set up placeholders for final validation.
|
127 |
+
is_trait_available = False
|
128 |
+
trait_biased = False # Arbitrarily set; the library requires a boolean.
|
129 |
+
|
130 |
+
# 3) We have no clinical data to integrate; skip missing value handling.
|
131 |
+
|
132 |
+
# 4) With no trait, we cannot check bias meaningfully. Skipped.
|
133 |
+
|
134 |
+
# 5) Final dataset validation
|
135 |
+
# The library requires df and is_biased if is_final=True, so we provide an empty DataFrame.
|
136 |
+
# This ensures it records the dataset as not usable.
|
137 |
+
empty_df = pd.DataFrame()
|
138 |
+
is_usable = validate_and_save_cohort_info(
|
139 |
+
is_final=True,
|
140 |
+
cohort=cohort,
|
141 |
+
info_path=json_path,
|
142 |
+
is_gene_available=True, # Gene data is available
|
143 |
+
is_trait_available=False, # Trait is not available
|
144 |
+
is_biased=trait_biased,
|
145 |
+
df=empty_df,
|
146 |
+
note="No trait data; final record."
|
147 |
+
)
|
148 |
+
|
149 |
+
# 6) If the linked data were usable, we would save it. But here, is_usable will be False.
|
150 |
+
if is_usable:
|
151 |
+
# This block won't run in our scenario, but included for completeness
|
152 |
+
empty_df.to_csv(out_data_file)
|
153 |
+
print(f"Saved final linked data to {out_data_file}")
|
154 |
+
else:
|
155 |
+
print("Data not usable (no trait). No final linked file was saved.")
|
p1/preprocess/Asthma/code/GSE185658.py
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE185658"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE185658"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE185658.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE185658.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE185658.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
27 |
+
matrix_file,
|
28 |
+
background_prefixes,
|
29 |
+
clinical_prefixes
|
30 |
+
)
|
31 |
+
|
32 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
33 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
34 |
+
|
35 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
36 |
+
print("Background Information:")
|
37 |
+
print(background_info)
|
38 |
+
print("\nSample Characteristics Dictionary:")
|
39 |
+
print(sample_characteristics_dict)
|
40 |
+
# 1) Gene Expression Data Availability
|
41 |
+
is_gene_available = True # The background indicates Affymetrix microarrays for global gene expression
|
42 |
+
|
43 |
+
# 2) Variable Availability and Data Type Conversion
|
44 |
+
# Based on the sample characteristics dictionary, we only see a "group" field (row=1) that includes asthma vs healthy.
|
45 |
+
trait_row = 1
|
46 |
+
age_row = None
|
47 |
+
gender_row = None
|
48 |
+
|
49 |
+
# Define the conversion function for the trait (binary: 1 for Asthma, 0 for Healthy, None otherwise).
|
50 |
+
def convert_trait(value):
|
51 |
+
parts = value.split(':')
|
52 |
+
label = parts[-1].strip().lower() # Take text after ':'
|
53 |
+
if 'asthma' in label:
|
54 |
+
return 1
|
55 |
+
elif 'healthy' in label:
|
56 |
+
return 0
|
57 |
+
return None
|
58 |
+
|
59 |
+
# We do not have age or gender data, so these conversion functions are not used.
|
60 |
+
convert_age = None
|
61 |
+
convert_gender = None
|
62 |
+
|
63 |
+
# 3) Save Metadata (initial filtering)
|
64 |
+
is_trait_available = (trait_row is not None)
|
65 |
+
is_usable = 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=is_trait_available
|
71 |
+
)
|
72 |
+
|
73 |
+
# 4) Clinical Feature Extraction (only if trait data is available)
|
74 |
+
if trait_row is not None:
|
75 |
+
selected_clinical_df = geo_select_clinical_features(
|
76 |
+
clinical_df=clinical_data, # previously obtained DataFrame of sample characteristics
|
77 |
+
trait=trait,
|
78 |
+
trait_row=trait_row,
|
79 |
+
convert_trait=convert_trait,
|
80 |
+
age_row=age_row,
|
81 |
+
convert_age=convert_age,
|
82 |
+
gender_row=gender_row,
|
83 |
+
convert_gender=convert_gender
|
84 |
+
)
|
85 |
+
preview_dict = preview_df(selected_clinical_df)
|
86 |
+
print("Preview of selected clinical features:", preview_dict)
|
87 |
+
|
88 |
+
# Save the extracted clinical features to CSV
|
89 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
90 |
+
# STEP3
|
91 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
92 |
+
gene_data = get_genetic_data(matrix_file)
|
93 |
+
|
94 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
95 |
+
print(gene_data.index[:20])
|
96 |
+
# Based on the numeric format (e.g., '7892501'), these are likely not standard human gene symbols.
|
97 |
+
# Therefore, we conclude that gene mapping is required.
|
98 |
+
print("requires_gene_mapping = True")
|
99 |
+
# STEP5
|
100 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
101 |
+
gene_annotation = get_gene_annotation(soft_file)
|
102 |
+
|
103 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
104 |
+
print("Gene annotation preview:")
|
105 |
+
print(preview_df(gene_annotation))
|
106 |
+
# STEP: Gene Identifier Mapping
|
107 |
+
|
108 |
+
# 1. Decide which columns in the gene_annotation dataframe correspond to the probe ID and the gene symbol text.
|
109 |
+
# From the preview, "ID" appears to match the probe identifier (same as gene_data index),
|
110 |
+
# and "gene_assignment" appears to contain the gene symbols (though in a messy string).
|
111 |
+
|
112 |
+
# 2. Build a mapping dataframe using these two columns.
|
113 |
+
mapping_df = get_gene_mapping(annotation=gene_annotation, prob_col="ID", gene_col="gene_assignment")
|
114 |
+
|
115 |
+
# 3. Convert the probe-level measurements to gene expression data using the mapping,
|
116 |
+
# distributing expression when a probe maps to multiple genes and summing the contributions for each gene.
|
117 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
118 |
+
# STEP 7: Data Normalization and Linking
|
119 |
+
|
120 |
+
# 1) Normalize gene symbols
|
121 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
122 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
123 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
124 |
+
|
125 |
+
# 2) Link clinical and genetic data
|
126 |
+
# We know from previous steps that we do have trait data in out_clinical_data_file.
|
127 |
+
clinical_df = pd.read_csv(out_clinical_data_file, header=0)
|
128 |
+
# The clinical CSV contains a single row with the trait values and columns as sample IDs.
|
129 |
+
# Label that row with the trait name, so that geo_link_clinical_genetic_data can handle it properly.
|
130 |
+
clinical_df.index = [trait]
|
131 |
+
|
132 |
+
linked_data = geo_link_clinical_genetic_data(clinical_df, normalized_gene_data)
|
133 |
+
|
134 |
+
# 3) Handle missing values
|
135 |
+
linked_data = handle_missing_values(df=linked_data, trait_col=trait)
|
136 |
+
|
137 |
+
# 4) Determine bias
|
138 |
+
trait_biased, linked_data = judge_and_remove_biased_features(df=linked_data, trait=trait)
|
139 |
+
|
140 |
+
# 5) Final dataset validation
|
141 |
+
is_usable = validate_and_save_cohort_info(
|
142 |
+
is_final=True,
|
143 |
+
cohort=cohort,
|
144 |
+
info_path=json_path,
|
145 |
+
is_gene_available=True,
|
146 |
+
is_trait_available=True,
|
147 |
+
is_biased=trait_biased,
|
148 |
+
df=linked_data,
|
149 |
+
note="Completed data preprocessing and quality checks."
|
150 |
+
)
|
151 |
+
|
152 |
+
# 6) If usable, save the final linked data
|
153 |
+
if is_usable:
|
154 |
+
linked_data.to_csv(out_data_file, index=True)
|
155 |
+
print(f"Saved final linked data to {out_data_file}")
|
156 |
+
else:
|
157 |
+
print("Data not usable. No final file was saved.")
|
p1/preprocess/Asthma/code/GSE188424.py
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE188424"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE188424"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE188424.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE188424.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE188424.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
27 |
+
matrix_file,
|
28 |
+
background_prefixes,
|
29 |
+
clinical_prefixes
|
30 |
+
)
|
31 |
+
|
32 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
33 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
34 |
+
|
35 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
36 |
+
print("Background Information:")
|
37 |
+
print(background_info)
|
38 |
+
print("\nSample Characteristics Dictionary:")
|
39 |
+
print(sample_characteristics_dict)
|
40 |
+
# Step 1: Determine gene expression data availability
|
41 |
+
is_gene_available = True # Transcriptome data indicated in the series description
|
42 |
+
|
43 |
+
# Step 2.1: Determine availability of trait, age, and gender data
|
44 |
+
# From the dictionary {0: ['gender: female', 'gender: male']},
|
45 |
+
# only gender data is found under key=0. No separate entries for trait or age are available.
|
46 |
+
trait_row = None
|
47 |
+
age_row = None
|
48 |
+
gender_row = 0
|
49 |
+
|
50 |
+
# Step 2.2: Define data conversion functions
|
51 |
+
def convert_trait(value: str):
|
52 |
+
# No trait data row is available; return None.
|
53 |
+
return None
|
54 |
+
|
55 |
+
def convert_age(value: str):
|
56 |
+
# No age data row is available; return None.
|
57 |
+
return None
|
58 |
+
|
59 |
+
def convert_gender(value: str):
|
60 |
+
"""
|
61 |
+
Convert the gender string to 0 or 1:
|
62 |
+
- female -> 0
|
63 |
+
- male -> 1
|
64 |
+
- others/unknown -> None
|
65 |
+
"""
|
66 |
+
parts = value.split(':', 1)
|
67 |
+
if len(parts) < 2:
|
68 |
+
return None
|
69 |
+
gender_str = parts[1].strip().lower()
|
70 |
+
if gender_str == 'female':
|
71 |
+
return 0
|
72 |
+
elif gender_str == 'male':
|
73 |
+
return 1
|
74 |
+
return None
|
75 |
+
|
76 |
+
# Step 3: Save metadata via initial filtering
|
77 |
+
# Trait data availability is determined by whether trait_row is None.
|
78 |
+
is_trait_available = (trait_row is not None)
|
79 |
+
|
80 |
+
is_usable = validate_and_save_cohort_info(
|
81 |
+
is_final=False,
|
82 |
+
cohort=cohort,
|
83 |
+
info_path=json_path,
|
84 |
+
is_gene_available=is_gene_available,
|
85 |
+
is_trait_available=is_trait_available
|
86 |
+
)
|
87 |
+
|
88 |
+
# Step 4: Since trait_row is None, we skip clinical feature extraction.
|
89 |
+
# STEP3
|
90 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
91 |
+
gene_data = get_genetic_data(matrix_file)
|
92 |
+
|
93 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
94 |
+
print(gene_data.index[:20])
|
95 |
+
# Based on the observed identifiers (e.g., ILMN_1651199), these are Illumina probe IDs
|
96 |
+
# rather than human gene symbols and require mapping.
|
97 |
+
print("requires_gene_mapping = True")
|
98 |
+
# STEP5
|
99 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
100 |
+
gene_annotation = get_gene_annotation(soft_file)
|
101 |
+
|
102 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
103 |
+
print("Gene annotation preview:")
|
104 |
+
print(preview_df(gene_annotation))
|
105 |
+
# STEP: Gene Identifier Mapping
|
106 |
+
|
107 |
+
# 1 & 2. Identify the correct columns in gene_annotation corresponding to the Illumina probe IDs and gene symbols
|
108 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
|
109 |
+
|
110 |
+
# 3. Convert probe-level measurements to gene expression data by applying the gene mapping
|
111 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
112 |
+
# STEP 7: Data Normalization and Linking
|
113 |
+
|
114 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
115 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
116 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
117 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
118 |
+
|
119 |
+
# Since 'trait_row' was None, no clinical feature extraction occurred and trait data is unavailable.
|
120 |
+
# We must skip linking and final data prep steps and directly do final validation to record that this dataset is unusable for trait-based analysis.
|
121 |
+
|
122 |
+
empty_df = pd.DataFrame() # Placeholder, as df must be provided to the validation function
|
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=False, # No trait data was found
|
129 |
+
is_biased=True, # Arbitrary True to pass validation, making the dataset not usable
|
130 |
+
df=empty_df,
|
131 |
+
note="Trait data is unavailable; skipping linking and final data steps."
|
132 |
+
)
|
133 |
+
|
134 |
+
print("Trait data unavailable. Skipping linking and final data output.")
|
p1/preprocess/Asthma/code/GSE205151.py
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE205151"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE205151"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE205151.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE205151.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE205151.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
27 |
+
matrix_file,
|
28 |
+
background_prefixes,
|
29 |
+
clinical_prefixes
|
30 |
+
)
|
31 |
+
|
32 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
33 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
34 |
+
|
35 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
36 |
+
print("Background Information:")
|
37 |
+
print(background_info)
|
38 |
+
print("\nSample Characteristics Dictionary:")
|
39 |
+
print(sample_characteristics_dict)
|
40 |
+
# 1. Gene expression data availability
|
41 |
+
# Based on the metadata: "mRNA was analyzed using a targeted Nanostring immunology array,"
|
42 |
+
# indicating this study involves gene expression data.
|
43 |
+
is_gene_available = True
|
44 |
+
|
45 |
+
# 2. Variable Availability and Conversion
|
46 |
+
|
47 |
+
# From the sample characteristics, only two keys (0 and 1) are available:
|
48 |
+
# 0 -> polyic_stimulation, and 1 -> cluster
|
49 |
+
# There's no mention of 'Asthma' variation, age, or gender.
|
50 |
+
# So, all samples are asthmatic, which yields no variability in 'trait',
|
51 |
+
# and age/gender aren't in the dictionary.
|
52 |
+
|
53 |
+
trait_row = None # No variation in "Asthma" (everyone is asthmatic)
|
54 |
+
age_row = None # Not found
|
55 |
+
gender_row = None # Not found
|
56 |
+
|
57 |
+
def convert_trait(value: str) -> int:
|
58 |
+
"""
|
59 |
+
Trait data is not available/variable here,
|
60 |
+
so we won't actually use this function.
|
61 |
+
"""
|
62 |
+
return None
|
63 |
+
|
64 |
+
def convert_age(value: str) -> float:
|
65 |
+
"""
|
66 |
+
Age data not available.
|
67 |
+
"""
|
68 |
+
return None
|
69 |
+
|
70 |
+
def convert_gender(value: str) -> int:
|
71 |
+
"""
|
72 |
+
Gender data not available.
|
73 |
+
"""
|
74 |
+
return None
|
75 |
+
|
76 |
+
# 3. Save Metadata (initial filtering)
|
77 |
+
# Trait data is not available because there's no variability.
|
78 |
+
is_trait_available = False
|
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=is_trait_available
|
85 |
+
)
|
86 |
+
|
87 |
+
# 4. Clinical Feature Extraction
|
88 |
+
# Since trait_row is None, we skip extraction for this dataset.
|
89 |
+
# STEP3
|
90 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
91 |
+
gene_data = get_genetic_data(matrix_file)
|
92 |
+
|
93 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
94 |
+
print(gene_data.index[:20])
|
95 |
+
# Based on inspection, these appear to be standard human gene symbols.
|
96 |
+
print("requires_gene_mapping = False")
|
p1/preprocess/Asthma/code/GSE230164.py
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE230164"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE230164"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE230164.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE230164.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE230164.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
from tools.preprocess import *
|
21 |
+
|
22 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
23 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
24 |
+
|
25 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
26 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
27 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
28 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
29 |
+
matrix_file,
|
30 |
+
background_prefixes,
|
31 |
+
clinical_prefixes
|
32 |
+
)
|
33 |
+
|
34 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
35 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
36 |
+
|
37 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
38 |
+
print("Background Information:")
|
39 |
+
print(background_info)
|
40 |
+
print("\nSample Characteristics Dictionary:")
|
41 |
+
print(sample_characteristics_dict)
|
42 |
+
# Step 1: Determine if gene expression data is likely available
|
43 |
+
is_gene_available = True # Based on the title "Gene expression profiling of asthma"
|
44 |
+
|
45 |
+
# Step 2: Identify the rows for trait, age, and gender
|
46 |
+
# From the provided sample characteristics dictionary (only key 0 with gender info),
|
47 |
+
# we see no mention of the trait (asthma) or age, so these are not available.
|
48 |
+
trait_row = None
|
49 |
+
age_row = None
|
50 |
+
gender_row = 0 # "gender: female" and "gender: male" are present
|
51 |
+
|
52 |
+
# Data type conversion functions
|
53 |
+
|
54 |
+
def convert_trait(value: str) -> Optional[int]:
|
55 |
+
"""
|
56 |
+
Convert trait values to binary (e.g., 'asthma' -> 1, 'control' or 'healthy' -> 0).
|
57 |
+
Returns None if unknown.
|
58 |
+
"""
|
59 |
+
# Extract the actual data after the colon if present
|
60 |
+
parts = value.split(':', 1)
|
61 |
+
val = parts[1].strip().lower() if len(parts) > 1 else value.lower()
|
62 |
+
|
63 |
+
# Example mapping (if we had trait data)
|
64 |
+
if 'asthma' in val:
|
65 |
+
return 1
|
66 |
+
if 'control' in val or 'healthy' in val:
|
67 |
+
return 0
|
68 |
+
|
69 |
+
return None
|
70 |
+
|
71 |
+
def convert_age(value: str) -> Optional[float]:
|
72 |
+
"""
|
73 |
+
Convert age values to continuous floats.
|
74 |
+
Returns None if parsing fails or data is unknown.
|
75 |
+
"""
|
76 |
+
parts = value.split(':', 1)
|
77 |
+
val = parts[1].strip() if len(parts) > 1 else value
|
78 |
+
try:
|
79 |
+
return float(val)
|
80 |
+
except ValueError:
|
81 |
+
return None
|
82 |
+
|
83 |
+
def convert_gender(value: str) -> Optional[int]:
|
84 |
+
"""
|
85 |
+
Convert gender to binary (female -> 0, male -> 1).
|
86 |
+
Returns None if unknown.
|
87 |
+
"""
|
88 |
+
parts = value.split(':', 1)
|
89 |
+
val = parts[1].strip().lower() if len(parts) > 1 else value.lower()
|
90 |
+
if 'female' in val:
|
91 |
+
return 0
|
92 |
+
if 'male' in val:
|
93 |
+
return 1
|
94 |
+
return None
|
95 |
+
|
96 |
+
# Step 3: Initial filtering and saving of metadata
|
97 |
+
is_trait_available = trait_row is not None
|
98 |
+
|
99 |
+
dataset_usable = validate_and_save_cohort_info(
|
100 |
+
is_final=False,
|
101 |
+
cohort=cohort,
|
102 |
+
info_path=json_path,
|
103 |
+
is_gene_available=is_gene_available,
|
104 |
+
is_trait_available=is_trait_available
|
105 |
+
)
|
106 |
+
|
107 |
+
# Step 4: Since trait_row is None, we skip substep of clinical feature extraction
|
108 |
+
# STEP3
|
109 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
110 |
+
gene_data = get_genetic_data(matrix_file)
|
111 |
+
|
112 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
113 |
+
print(gene_data.index[:20])
|
114 |
+
# Based on the given identifiers (e.g., ILMN_1651199), these appear to be Illumina probe IDs
|
115 |
+
# rather than standard human gene symbols. Therefore, gene symbol mapping is required.
|
116 |
+
|
117 |
+
print("requires_gene_mapping = True")
|
118 |
+
# STEP5
|
119 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
120 |
+
gene_annotation = get_gene_annotation(soft_file)
|
121 |
+
|
122 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
123 |
+
print("Gene annotation preview:")
|
124 |
+
print(preview_df(gene_annotation))
|
125 |
+
# STEP: Gene Identifier Mapping
|
126 |
+
|
127 |
+
# 1. Identify the columns in the gene annotation dataframe
|
128 |
+
# - "ID" column contains Illumina probe IDs matching those in the expression data
|
129 |
+
# - "Symbol" column contains the gene symbols
|
130 |
+
prob_col = 'ID'
|
131 |
+
gene_col = 'Symbol'
|
132 |
+
|
133 |
+
# 2. Get a gene mapping dataframe by extracting the two columns
|
134 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=prob_col, gene_col=gene_col)
|
135 |
+
|
136 |
+
# 3. Convert probe-level measurements to gene expression data
|
137 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
138 |
+
# STEP 7: Data Normalization and Linking
|
139 |
+
|
140 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
141 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
142 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
143 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
144 |
+
|
145 |
+
# Since 'trait_row' was None, no clinical feature extraction occurred and trait data is unavailable.
|
146 |
+
# We must skip linking and final data prep steps and directly do final validation to record that this dataset is unusable for trait-based analysis.
|
147 |
+
|
148 |
+
empty_df = pd.DataFrame() # Placeholder, as df must be provided to the validation function
|
149 |
+
is_usable = validate_and_save_cohort_info(
|
150 |
+
is_final=True,
|
151 |
+
cohort=cohort,
|
152 |
+
info_path=json_path,
|
153 |
+
is_gene_available=True,
|
154 |
+
is_trait_available=False, # No trait data was found
|
155 |
+
is_biased=True, # Arbitrary True to pass validation, making the dataset not usable
|
156 |
+
df=empty_df,
|
157 |
+
note="Trait data is unavailable; skipping linking and final data steps."
|
158 |
+
)
|
159 |
+
|
160 |
+
print("Trait data unavailable. Skipping linking and final data output.")
|
p1/preprocess/Asthma/code/GSE270312.py
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
cohort = "GSE270312"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Asthma"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Asthma/GSE270312"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Asthma/GSE270312.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/GSE270312.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/GSE270312.csv"
|
16 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP 1
|
19 |
+
|
20 |
+
from tools.preprocess import *
|
21 |
+
|
22 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
23 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
24 |
+
|
25 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
26 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
27 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
28 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
29 |
+
matrix_file,
|
30 |
+
background_prefixes,
|
31 |
+
clinical_prefixes
|
32 |
+
)
|
33 |
+
|
34 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
35 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
36 |
+
|
37 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
38 |
+
print("Background Information:")
|
39 |
+
print(background_info)
|
40 |
+
print("\nSample Characteristics Dictionary:")
|
41 |
+
print(sample_characteristics_dict)
|
42 |
+
# Step 1: Gene Expression Data Availability
|
43 |
+
# Based on the background stating "RNA transcriptome responses" were measured, we consider it gene expression data.
|
44 |
+
is_gene_available = True
|
45 |
+
|
46 |
+
# Step 2: Variable Availability and Conversion
|
47 |
+
|
48 |
+
# 2.1 Identify rows for trait, age, and gender
|
49 |
+
# From the sample characteristics dictionary, 'asthma status' = row 3, 'gender' = row 2.
|
50 |
+
# No age information is provided.
|
51 |
+
trait_row = 3
|
52 |
+
age_row = None
|
53 |
+
gender_row = 2
|
54 |
+
|
55 |
+
# 2.2 Define data conversion functions
|
56 |
+
def convert_trait(value: str):
|
57 |
+
# Example: "asthma status: Yes"
|
58 |
+
# Split by colon, then strip extra spaces
|
59 |
+
parts = value.split(":")
|
60 |
+
if len(parts) < 2:
|
61 |
+
return None
|
62 |
+
val = parts[1].strip().lower()
|
63 |
+
if val == "yes":
|
64 |
+
return 1
|
65 |
+
elif val == "no":
|
66 |
+
return 0
|
67 |
+
return None
|
68 |
+
|
69 |
+
def convert_age(value: str):
|
70 |
+
# No age data available, so return None
|
71 |
+
return None
|
72 |
+
|
73 |
+
def convert_gender(value: str):
|
74 |
+
# Example: "gender: Female"
|
75 |
+
parts = value.split(":")
|
76 |
+
if len(parts) < 2:
|
77 |
+
return None
|
78 |
+
val = parts[1].strip().lower()
|
79 |
+
if val == "female":
|
80 |
+
return 0
|
81 |
+
elif val == "male":
|
82 |
+
return 1
|
83 |
+
return None
|
84 |
+
|
85 |
+
# Step 3: Save Metadata (initial filtering)
|
86 |
+
# Trait data is considered available if we have a valid row for it
|
87 |
+
is_trait_available = (trait_row is not None)
|
88 |
+
|
89 |
+
filter_pass = validate_and_save_cohort_info(
|
90 |
+
is_final=False,
|
91 |
+
cohort=cohort,
|
92 |
+
info_path=json_path,
|
93 |
+
is_gene_available=is_gene_available,
|
94 |
+
is_trait_available=is_trait_available
|
95 |
+
)
|
96 |
+
|
97 |
+
# Step 4: Clinical Feature Extraction
|
98 |
+
if trait_row is not None:
|
99 |
+
selected_clinical_df = geo_select_clinical_features(
|
100 |
+
clinical_df=clinical_data,
|
101 |
+
trait=trait,
|
102 |
+
trait_row=trait_row,
|
103 |
+
convert_trait=convert_trait,
|
104 |
+
age_row=age_row,
|
105 |
+
convert_age=convert_age,
|
106 |
+
gender_row=gender_row,
|
107 |
+
convert_gender=convert_gender
|
108 |
+
)
|
109 |
+
|
110 |
+
# Preview the selected clinical features
|
111 |
+
preview_clinical = preview_df(selected_clinical_df)
|
112 |
+
# (You could print the preview or store it if needed; omitted here for brevity.)
|
113 |
+
|
114 |
+
# Save the clinical data
|
115 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
116 |
+
# STEP3
|
117 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
118 |
+
gene_data = get_genetic_data(matrix_file)
|
119 |
+
|
120 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
121 |
+
print(gene_data.index[:20])
|
122 |
+
# Based on the observed gene identifiers such as ABCF1, ACE, ACKR2, etc.,
|
123 |
+
# these appear to be valid human gene symbols and do not require additional mapping.
|
124 |
+
|
125 |
+
print("These genes are human gene symbols.")
|
126 |
+
|
127 |
+
# Conclusion
|
128 |
+
print("\nrequires_gene_mapping = False")
|
129 |
+
# STEP 7: Data Normalization and Linking
|
130 |
+
|
131 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
132 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
133 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
134 |
+
print(f"Saved normalized gene data to {out_gene_data_file}")
|
135 |
+
|
136 |
+
# 2. Link the clinical and genetic data on sample IDs
|
137 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
138 |
+
|
139 |
+
# 3. Handle missing values in the linked data
|
140 |
+
linked_data = handle_missing_values(linked_data, trait_col=trait)
|
141 |
+
|
142 |
+
# 4. Determine whether the trait/demographic features are severely biased
|
143 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait=trait)
|
144 |
+
|
145 |
+
# 5. Conduct final quality validation and save metadata
|
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="Trait data and gene data successfully linked."
|
155 |
+
)
|
156 |
+
|
157 |
+
# 6. If the dataset is deemed usable, save the final linked data as a CSV file
|
158 |
+
if is_usable:
|
159 |
+
linked_data.to_csv(out_data_file)
|
160 |
+
print(f"Saved final linked data to {out_data_file}")
|
161 |
+
else:
|
162 |
+
print("Dataset was not deemed usable; final linked data not saved.")
|
p1/preprocess/Asthma/code/TCGA.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Asthma"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/1/Asthma/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/1/Asthma/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/1/Asthma/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/1/Asthma/cohort_info.json"
|
15 |
+
|
16 |
+
import os
|
17 |
+
|
18 |
+
# Step 1: Identify subdirectory that might relate to "Asthma"
|
19 |
+
subdirs = [
|
20 |
+
'CrawlData.ipynb', '.DS_Store', 'TCGA_lower_grade_glioma_and_glioblastoma_(GBMLGG)',
|
21 |
+
'TCGA_Uterine_Carcinosarcoma_(UCS)', 'TCGA_Thyroid_Cancer_(THCA)', 'TCGA_Thymoma_(THYM)',
|
22 |
+
'TCGA_Testicular_Cancer_(TGCT)', 'TCGA_Stomach_Cancer_(STAD)', 'TCGA_Sarcoma_(SARC)',
|
23 |
+
'TCGA_Rectal_Cancer_(READ)', 'TCGA_Prostate_Cancer_(PRAD)', 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)',
|
24 |
+
'TCGA_Pancreatic_Cancer_(PAAD)', 'TCGA_Ovarian_Cancer_(OV)', 'TCGA_Ocular_melanomas_(UVM)',
|
25 |
+
'TCGA_Mesothelioma_(MESO)', 'TCGA_Melanoma_(SKCM)', 'TCGA_Lung_Squamous_Cell_Carcinoma_(LUSC)',
|
26 |
+
'TCGA_Lung_Cancer_(LUNG)', 'TCGA_Lung_Adenocarcinoma_(LUAD)', 'TCGA_Lower_Grade_Glioma_(LGG)',
|
27 |
+
'TCGA_Liver_Cancer_(LIHC)', 'TCGA_Large_Bcell_Lymphoma_(DLBC)', 'TCGA_Kidney_Papillary_Cell_Carcinoma_(KIRP)',
|
28 |
+
'TCGA_Kidney_Clear_Cell_Carcinoma_(KIRC)', 'TCGA_Kidney_Chromophobe_(KICH)', 'TCGA_Head_and_Neck_Cancer_(HNSC)',
|
29 |
+
'TCGA_Glioblastoma_(GBM)', 'TCGA_Esophageal_Cancer_(ESCA)', 'TCGA_Endometrioid_Cancer_(UCEC)',
|
30 |
+
'TCGA_Colon_and_Rectal_Cancer_(COADREAD)', 'TCGA_Colon_Cancer_(COAD)', 'TCGA_Cervical_Cancer_(CESC)',
|
31 |
+
'TCGA_Breast_Cancer_(BRCA)', 'TCGA_Bladder_Cancer_(BLCA)', 'TCGA_Bile_Duct_Cancer_(CHOL)',
|
32 |
+
'TCGA_Adrenocortical_Cancer_(ACC)', 'TCGA_Acute_Myeloid_Leukemia_(LAML)'
|
33 |
+
]
|
34 |
+
|
35 |
+
# Since we're looking for "Asthma" and no subdirectory name suggests an asthma-related cancer,
|
36 |
+
# no suitable subdirectory is found.
|
37 |
+
suitable_subdir = None
|
38 |
+
|
39 |
+
# Confirm no matching subdirectory
|
40 |
+
for sd in subdirs:
|
41 |
+
# Normally, you'd check synonyms for "Asthma" if needed.
|
42 |
+
if "asthma" in sd.lower():
|
43 |
+
suitable_subdir = sd
|
44 |
+
break
|
45 |
+
|
46 |
+
# If not found, skip the trait:
|
47 |
+
if not suitable_subdir:
|
48 |
+
print("No suitable subdirectory found for trait 'Asthma'. Skipping this trait.")
|
49 |
+
# Mark as completed but unavailable in metadata
|
50 |
+
validate_and_save_cohort_info(
|
51 |
+
is_final=False,
|
52 |
+
cohort="TCGA",
|
53 |
+
info_path=json_path,
|
54 |
+
is_gene_available=False,
|
55 |
+
is_trait_available=False
|
56 |
+
)
|
57 |
+
else:
|
58 |
+
# (Would proceed to load data if a matching subdirectory was found.)
|
59 |
+
pass
|
p1/preprocess/Asthma/gene_data/GSE123086.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM3494884,GSM3494885,GSM3494886,GSM3494887,GSM3494888,GSM3494889,GSM3494890,GSM3494891,GSM3494892,GSM3494893,GSM3494894,GSM3494895,GSM3494896,GSM3494897,GSM3494898,GSM3494899,GSM3494900,GSM3494901,GSM3494902,GSM3494903,GSM3494904,GSM3494905,GSM3494906,GSM3494907,GSM3494908,GSM3494909,GSM3494910,GSM3494911,GSM3494912,GSM3494913,GSM3494914,GSM3494915,GSM3494916,GSM3494917,GSM3494918,GSM3494919,GSM3494920,GSM3494921,GSM3494922,GSM3494923,GSM3494924,GSM3494925,GSM3494926,GSM3494927,GSM3494928,GSM3494929,GSM3494930,GSM3494931,GSM3494932,GSM3494933,GSM3494934,GSM3494935,GSM3494936,GSM3494937,GSM3494938,GSM3494939,GSM3494940,GSM3494941,GSM3494942,GSM3494943,GSM3494944,GSM3494945,GSM3494946,GSM3494947,GSM3494948,GSM3494949,GSM3494950,GSM3494951,GSM3494952,GSM3494953,GSM3494954,GSM3494955,GSM3494956,GSM3494957,GSM3494958,GSM3494959,GSM3494960,GSM3494961,GSM3494962,GSM3494963,GSM3494964,GSM3494965,GSM3494966,GSM3494967,GSM3494968,GSM3494969,GSM3494970,GSM3494971,GSM3494972,GSM3494973,GSM3494974,GSM3494975,GSM3494976,GSM3494977,GSM3494978,GSM3494979,GSM3494980,GSM3494981,GSM3494982,GSM3494983,GSM3494984,GSM3494985,GSM3494986,GSM3494987,GSM3494988,GSM3494989,GSM3494990,GSM3494991,GSM3494992,GSM3494993,GSM3494994,GSM3494995,GSM3494996,GSM3494997,GSM3494998,GSM3494999,GSM3495000,GSM3495001,GSM3495002,GSM3495003,GSM3495004,GSM3495005,GSM3495006,GSM3495007,GSM3495008,GSM3495009,GSM3495010,GSM3495011,GSM3495012,GSM3495013,GSM3495014,GSM3495015,GSM3495016,GSM3495017,GSM3495018,GSM3495019,GSM3495020,GSM3495021,GSM3495022,GSM3495023,GSM3495024,GSM3495025,GSM3495026,GSM3495027,GSM3495028,GSM3495029,GSM3495030,GSM3495031,GSM3495032,GSM3495033,GSM3495034,GSM3495035,GSM3495036,GSM3495037,GSM3495038,GSM3495039,GSM3495040,GSM3495041,GSM3495042,GSM3495043,GSM3495044,GSM3495045,GSM3495046,GSM3495047,GSM3495048,GSM3495049
|
p1/preprocess/Asthma/gene_data/GSE123088.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM3494884,GSM3494885,GSM3494886,GSM3494887,GSM3494888,GSM3494889,GSM3494890,GSM3494891,GSM3494892,GSM3494893,GSM3494894,GSM3494895,GSM3494896,GSM3494897,GSM3494898,GSM3494899,GSM3494900,GSM3494901,GSM3494902,GSM3494903,GSM3494904,GSM3494905,GSM3494906,GSM3494907,GSM3494908,GSM3494909,GSM3494910,GSM3494911,GSM3494912,GSM3494913,GSM3494914,GSM3494915,GSM3494916,GSM3494917,GSM3494918,GSM3494919,GSM3494920,GSM3494921,GSM3494922,GSM3494923,GSM3494924,GSM3494925,GSM3494926,GSM3494927,GSM3494928,GSM3494929,GSM3494930,GSM3494931,GSM3494932,GSM3494933,GSM3494934,GSM3494935,GSM3494936,GSM3494937,GSM3494938,GSM3494939,GSM3494940,GSM3494941,GSM3494942,GSM3494943,GSM3494944,GSM3494945,GSM3494946,GSM3494947,GSM3494948,GSM3494949,GSM3494950,GSM3494951,GSM3494952,GSM3494953,GSM3494954,GSM3494955,GSM3494956,GSM3494957,GSM3494958,GSM3494959,GSM3494960,GSM3494961,GSM3494962,GSM3494963,GSM3494964,GSM3494965,GSM3494966,GSM3494967,GSM3494968,GSM3494969,GSM3494970,GSM3494971,GSM3494972,GSM3494973,GSM3494974,GSM3494975,GSM3494976,GSM3494977,GSM3494978,GSM3494979,GSM3494980,GSM3494981,GSM3494982,GSM3494983,GSM3494984,GSM3494985,GSM3494986,GSM3494987,GSM3494988,GSM3494989,GSM3494990,GSM3494991,GSM3494992,GSM3494993,GSM3494994,GSM3494995,GSM3494996,GSM3494997,GSM3494998,GSM3494999,GSM3495000,GSM3495001,GSM3495002,GSM3495003,GSM3495004,GSM3495005,GSM3495006,GSM3495007,GSM3495008,GSM3495009,GSM3495010,GSM3495011,GSM3495012,GSM3495013,GSM3495014,GSM3495015,GSM3495016,GSM3495017,GSM3495018,GSM3495019,GSM3495020,GSM3495021,GSM3495022,GSM3495023,GSM3495024,GSM3495025,GSM3495026,GSM3495027,GSM3495028,GSM3495029,GSM3495030,GSM3495031,GSM3495032,GSM3495033,GSM3495034,GSM3495035,GSM3495036,GSM3495037,GSM3495038,GSM3495039,GSM3495040,GSM3495041,GSM3495042,GSM3495043,GSM3495044,GSM3495045,GSM3495046,GSM3495047,GSM3495048,GSM3495049,GSM3495050,GSM3495051,GSM3495052,GSM3495053,GSM3495054,GSM3495055,GSM3495056,GSM3495057,GSM3495058,GSM3495059,GSM3495060,GSM3495061,GSM3495062,GSM3495063,GSM3495064,GSM3495065,GSM3495066,GSM3495067,GSM3495068,GSM3495069,GSM3495070,GSM3495071,GSM3495072,GSM3495073,GSM3495074,GSM3495075,GSM3495076,GSM3495077,GSM3495078,GSM3495079,GSM3495080,GSM3495081,GSM3495082,GSM3495083,GSM3495084,GSM3495085,GSM3495086,GSM3495087
|
p1/preprocess/Asthma/gene_data/GSE182797.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM5537157,GSM5537158,GSM5537159,GSM5537160,GSM5537161,GSM5537162,GSM5537163,GSM5537164,GSM5537165,GSM5537166,GSM5537167,GSM5537168,GSM5537169,GSM5537170,GSM5537171,GSM5537172,GSM5537173,GSM5537174,GSM5537175,GSM5537176,GSM5537177,GSM5537178,GSM5537179,GSM5537180,GSM5537181,GSM5537182,GSM5537183,GSM5537184,GSM5537185,GSM5537186,GSM5537187,GSM5537188,GSM5537189,GSM5537190,GSM5537191,GSM5537192,GSM5537193,GSM5537194,GSM5537195,GSM5537196,GSM5537197,GSM5537198,GSM5537199,GSM5537200,GSM5537201,GSM5537202,GSM5537203,GSM5537204,GSM5537205,GSM5537206,GSM5537207,GSM5537208,GSM5537209,GSM5537210,GSM5537211,GSM5537212,GSM5537213,GSM5537214,GSM5537215,GSM5537216,GSM5537217,GSM5537218,GSM5537219,GSM5537220,GSM5537221,GSM5537222,GSM5537223,GSM5537224,GSM5537225,GSM5537226,GSM5537227,GSM5537228,GSM5537229,GSM5537230,GSM5537231,GSM5537232,GSM5537233,GSM5537234,GSM5537235,GSM5537236
|
p1/preprocess/Asthma/gene_data/GSE182798.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM5530417,GSM5530418,GSM5530419,GSM5530420,GSM5530421,GSM5530422,GSM5530423,GSM5530424,GSM5530425,GSM5530426,GSM5530427,GSM5530428,GSM5530429,GSM5530430,GSM5530431,GSM5530432,GSM5530433,GSM5530434,GSM5530435,GSM5530436,GSM5530437,GSM5530438,GSM5530439,GSM5530440,GSM5530441,GSM5530442,GSM5530443,GSM5530444,GSM5530445,GSM5530446,GSM5530447,GSM5530448,GSM5530449,GSM5530450,GSM5530451,GSM5530452,GSM5530453,GSM5530454,GSM5530455,GSM5530456,GSM5530457,GSM5530458,GSM5530459,GSM5530460,GSM5530461,GSM5530462,GSM5530463,GSM5530464,GSM5530465,GSM5530466,GSM5530467,GSM5530468,GSM5530469,GSM5530470,GSM5530471,GSM5530472,GSM5530473,GSM5530474,GSM5530475,GSM5530476,GSM5530477,GSM5530478,GSM5530479,GSM5530480,GSM5530481,GSM5530482,GSM5530483,GSM5530484,GSM5530485,GSM5530486,GSM5530487,GSM5530488,GSM5530489,GSM5530490,GSM5530491,GSM5530492,GSM5530493,GSM5530494,GSM5530495,GSM5530496,GSM5530497,GSM5530498,GSM5530499,GSM5530500,GSM5530501,GSM5530502,GSM5530503,GSM5530504,GSM5530505,GSM5530506,GSM5530507,GSM5530508,GSM5530509,GSM5530510,GSM5530511,GSM5530512,GSM5530513,GSM5530514,GSM5530515,GSM5530516,GSM5530517,GSM5530518,GSM5537157,GSM5537158,GSM5537159,GSM5537160,GSM5537161,GSM5537162,GSM5537163,GSM5537164,GSM5537165,GSM5537166,GSM5537167,GSM5537168,GSM5537169,GSM5537170,GSM5537171,GSM5537172,GSM5537173,GSM5537174,GSM5537175,GSM5537176,GSM5537177,GSM5537178,GSM5537179,GSM5537180,GSM5537181,GSM5537182,GSM5537183,GSM5537184,GSM5537185,GSM5537186,GSM5537187,GSM5537188,GSM5537189,GSM5537190,GSM5537191,GSM5537192,GSM5537193,GSM5537194,GSM5537195,GSM5537196,GSM5537197,GSM5537198,GSM5537199,GSM5537200,GSM5537201,GSM5537202,GSM5537203,GSM5537204,GSM5537205,GSM5537206,GSM5537207,GSM5537208,GSM5537209,GSM5537210,GSM5537211,GSM5537212,GSM5537213,GSM5537214,GSM5537215,GSM5537216,GSM5537217,GSM5537218,GSM5537219,GSM5537220,GSM5537221,GSM5537222,GSM5537223,GSM5537224,GSM5537225,GSM5537226,GSM5537227,GSM5537228,GSM5537229,GSM5537230,GSM5537231,GSM5537232,GSM5537233,GSM5537234,GSM5537235,GSM5537236
|
p1/preprocess/Asthma/gene_data/GSE184382.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM5585358,GSM5585359,GSM5585360,GSM5585361,GSM5585362,GSM5585363,GSM5585364,GSM5585365,GSM5585366,GSM5585367,GSM5585368,GSM5585369,GSM5585370,GSM5585371,GSM5585372,GSM5585373,GSM5585374,GSM5585375,GSM5585376,GSM5585377,GSM5585378,GSM5585379,GSM5585380,GSM5585381,GSM5585382,GSM5585383,GSM5585384,GSM5585385,GSM5585386,GSM5585387,GSM5585388,GSM5585389,GSM5585390,GSM5585391,GSM5585392,GSM5585393,GSM5585394,GSM5585395,GSM5585396
|
p1/preprocess/Asthma/gene_data/GSE185658.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM5621296,GSM5621297,GSM5621298,GSM5621299,GSM5621300,GSM5621301,GSM5621302,GSM5621303,GSM5621304,GSM5621305,GSM5621306,GSM5621307,GSM5621308,GSM5621309,GSM5621310,GSM5621311,GSM5621312,GSM5621313,GSM5621314,GSM5621315,GSM5621316,GSM5621317,GSM5621318,GSM5621319,GSM5621320,GSM5621321,GSM5621322,GSM5621323,GSM5621324,GSM5621325,GSM5621326,GSM5621327,GSM5621328,GSM5621329,GSM5621330,GSM5621331,GSM5621332,GSM5621333,GSM5621334,GSM5621335,GSM5621336,GSM5621337,GSM5621338,GSM5621339,GSM5621340,GSM5621341,GSM5621342,GSM5621343
|
p1/preprocess/Asthma/gene_data/GSE188424.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM5681954,GSM5681955,GSM5681956,GSM5681957,GSM5681958,GSM5681959,GSM5681960,GSM5681961,GSM5681962,GSM5681963,GSM5681964,GSM5681965,GSM5681966,GSM5681967,GSM5681968,GSM5681969,GSM5681970,GSM5681971,GSM5681972,GSM5681973,GSM5681974,GSM5681975,GSM5681976,GSM5681977,GSM5681978,GSM5681979,GSM5681980,GSM5681981,GSM5681982,GSM5681983,GSM5681984,GSM5681985,GSM5681986,GSM5681987,GSM5681988,GSM5681989,GSM5681990,GSM5681991,GSM5681992,GSM5681993,GSM5681994,GSM5681995,GSM5681996,GSM5681997,GSM5681998,GSM5681999,GSM5682000,GSM5682001,GSM5682002,GSM5682003,GSM5682004,GSM5682005,GSM5682006,GSM5682007,GSM5682008,GSM5682009,GSM5682010,GSM5682011,GSM5682012,GSM5682013,GSM5682014,GSM5682015,GSM5682016,GSM5682017,GSM5682018,GSM5682019,GSM5682020,GSM5682021,GSM5682022,GSM5682023,GSM5682024,GSM5682025,GSM5682026,GSM5682027,GSM5682028,GSM5682029,GSM5682030,GSM5682031,GSM5682032,GSM5682033,GSM5682034,GSM5682035,GSM5682036,GSM5682037,GSM5682038,GSM5682039,GSM5682040,GSM5682041,GSM5682042,GSM5682043,GSM5682044,GSM5682045,GSM5682046,GSM5682047,GSM5682048,GSM5682049,GSM5682050,GSM5682051,GSM5682052
|
p1/preprocess/Asthma/gene_data/GSE230164.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Gene,GSM5681954,GSM5681955,GSM5681956,GSM5681957,GSM5681958,GSM5681959,GSM5681960,GSM5681961,GSM5681962,GSM5681963,GSM5681964,GSM5681965,GSM5681966,GSM5681967,GSM5681968,GSM5681969,GSM5681970,GSM5681971,GSM5681972,GSM5681973,GSM5681974,GSM5681975,GSM5681976,GSM5681977,GSM5681978,GSM5681979,GSM5681980,GSM5681981,GSM5681982,GSM5681983,GSM5681984,GSM5681985,GSM5681986,GSM5681987,GSM5681988,GSM5681989,GSM5681990,GSM5681991,GSM5681992,GSM5681993,GSM5681994,GSM5681995,GSM5681996,GSM5681997,GSM5681998,GSM5681999,GSM5682000,GSM5682001,GSM5682002,GSM5682003,GSM5682004,GSM5682005,GSM5682006,GSM5682007,GSM5682008,GSM5682009,GSM5682010,GSM5682011,GSM5682012,GSM5682013,GSM5682014,GSM5682015,GSM5682016,GSM5682017,GSM5682018,GSM5682019,GSM5682020,GSM5682021,GSM5682022,GSM5682023,GSM5682024,GSM5682025,GSM5682026,GSM5682027,GSM5682028,GSM5682029,GSM5682030,GSM5682031,GSM5682032,GSM5682033,GSM5682034,GSM5682035,GSM5682036,GSM5682037,GSM5682038,GSM5682039,GSM5682040,GSM5682041,GSM5682042,GSM5682043,GSM5682044,GSM5682045,GSM5682046,GSM5682047,GSM5682048,GSM5682049,GSM5682050,GSM5682051,GSM5682052
|
p1/preprocess/Asthma/gene_data/GSE270312.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ID,GSM8339381,GSM8339382,GSM8339383,GSM8339384,GSM8339385,GSM8339386,GSM8339387,GSM8339388,GSM8339389,GSM8339390,GSM8339391,GSM8339392,GSM8339393,GSM8339394,GSM8339395,GSM8339396,GSM8339397,GSM8339398,GSM8339399,GSM8339400,GSM8339401,GSM8339402,GSM8339403,GSM8339404,GSM8339405,GSM8339406,GSM8339407,GSM8339408,GSM8339409,GSM8339410,GSM8339411,GSM8339412,GSM8339413,GSM8339414,GSM8339415,GSM8339416,GSM8339417,GSM8339418,GSM8339419,GSM8339420,GSM8339421,GSM8339422,GSM8339423,GSM8339424,GSM8339425,GSM8339426,GSM8339427,GSM8339428,GSM8339429,GSM8339430,GSM8339431,GSM8339432,GSM8339433,GSM8339434,GSM8339435,GSM8339436,GSM8339437,GSM8339438,GSM8339439,GSM8339440,GSM8339441,GSM8339442,GSM8339443,GSM8339444,GSM8339445,GSM8339446,GSM8339447,GSM8339448,GSM8339449,GSM8339450,GSM8339451,GSM8339452,GSM8339453,GSM8339454,GSM8339455,GSM8339456,GSM8339457,GSM8339458,GSM8339459,GSM8339460,GSM8339461,GSM8339462,GSM8339463,GSM8339464,GSM8339465,GSM8339466,GSM8339467,GSM8339468,GSM8339469,GSM8339470
|
p1/preprocess/Atrial_Fibrillation/GSE143924.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Atrial_Fibrillation/clinical_data/GSE115574.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
GSM3182680,GSM3182681,GSM3182682,GSM3182683,GSM3182684,GSM3182685,GSM3182686,GSM3182687,GSM3182688,GSM3182689,GSM3182690,GSM3182691,GSM3182692,GSM3182693,GSM3182694,GSM3182695,GSM3182696,GSM3182697,GSM3182698,GSM3182699,GSM3182700,GSM3182701,GSM3182702,GSM3182703,GSM3182704,GSM3182705,GSM3182706,GSM3182707,GSM3182708,GSM3182709,GSM3182710,GSM3182711,GSM3182712,GSM3182713,GSM3182714,GSM3182715,GSM3182716,GSM3182717,GSM3182718,GSM3182719,GSM3182720,GSM3182721,GSM3182722,GSM3182723,GSM3182724,GSM3182725,GSM3182726,GSM3182727,GSM3182728,GSM3182729,GSM3182730,GSM3182731,GSM3182732,GSM3182733,GSM3182734,GSM3182735,GSM3182736,GSM3182737,GSM3182738
|
2 |
+
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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
|