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 +26 -0
- p1/preprocess/Acute_Myeloid_Leukemia/GSE222124.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/GSE249638.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/GSE99612.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/clinical_data/GSE222124.csv +2 -0
- p1/preprocess/Acute_Myeloid_Leukemia/clinical_data/GSE249638.csv +2 -0
- p1/preprocess/Acute_Myeloid_Leukemia/clinical_data/GSE99612.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/clinical_data/TCGA.csv +201 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE121291.py +155 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE121431.py +128 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE161532.py +158 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE222124.py +153 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE222169.py +158 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE222616.py +69 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE235070.py +68 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE249638.py +198 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE98578.py +131 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/GSE99612.py +165 -0
- p1/preprocess/Acute_Myeloid_Leukemia/code/TCGA.py +116 -0
- p1/preprocess/Acute_Myeloid_Leukemia/cohort_info.json +1 -0
- p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE121291.csv +0 -0
- p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE121431.csv +0 -0
- p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE161532.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE222124.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE222169.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE249638.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE98578.csv +3 -0
- p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE99612.csv +3 -0
- p1/preprocess/Adrenocortical_Cancer/GSE75415.csv +0 -0
- p1/preprocess/Adrenocortical_Cancer/GSE90713.csv +3 -0
- p1/preprocess/Adrenocortical_Cancer/clinical_data/GSE68950.csv +2 -0
- p1/preprocess/Adrenocortical_Cancer/clinical_data/GSE75415.csv +3 -0
- p1/preprocess/Adrenocortical_Cancer/clinical_data/GSE90713.csv +2 -0
- p1/preprocess/Adrenocortical_Cancer/clinical_data/TCGA.csv +93 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE108088.py +149 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE143383.py +165 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE19776.py +175 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE49278.py +152 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE67766.py +132 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE68606.py +149 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE68950.py +153 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE75415.py +175 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE76019.py +127 -0
- p1/preprocess/Adrenocortical_Cancer/code/GSE90713.py +165 -0
- p1/preprocess/Adrenocortical_Cancer/code/TCGA.py +112 -0
- p1/preprocess/Adrenocortical_Cancer/cohort_info.json +1 -0
- p1/preprocess/Adrenocortical_Cancer/gene_data/GSE108088.csv +3 -0
- p1/preprocess/Adrenocortical_Cancer/gene_data/GSE143383.csv +3 -0
- p1/preprocess/Adrenocortical_Cancer/gene_data/GSE19776.csv +1 -0
- p1/preprocess/Adrenocortical_Cancer/gene_data/GSE49278.csv +1 -0
.gitattributes
CHANGED
@@ -898,3 +898,29 @@ p1/preprocess/Type_2_Diabetes/gene_data/GSE250283.csv filter=lfs diff=lfs merge=
|
|
898 |
p1/preprocess/Type_2_Diabetes/gene_data/GSE182120.csv filter=lfs diff=lfs merge=lfs -text
|
899 |
p1/preprocess/Type_2_Diabetes/gene_data/GSE281144.csv filter=lfs diff=lfs merge=lfs -text
|
900 |
p1/preprocess/Underweight/GSE57802.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
898 |
p1/preprocess/Type_2_Diabetes/gene_data/GSE182120.csv filter=lfs diff=lfs merge=lfs -text
|
899 |
p1/preprocess/Type_2_Diabetes/gene_data/GSE281144.csv filter=lfs diff=lfs merge=lfs -text
|
900 |
p1/preprocess/Underweight/GSE57802.csv filter=lfs diff=lfs merge=lfs -text
|
901 |
+
p1/preprocess/Underweight/gene_data/GSE57802.csv filter=lfs diff=lfs merge=lfs -text
|
902 |
+
p1/preprocess/Uterine_Carcinosarcoma/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
903 |
+
p1/preprocess/Stomach_Cancer/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
904 |
+
p1/preprocess/Von_Willebrand_Disease/GSE27597.csv filter=lfs diff=lfs merge=lfs -text
|
905 |
+
p1/preprocess/Von_Willebrand_Disease/gene_data/GSE27597.csv filter=lfs diff=lfs merge=lfs -text
|
906 |
+
p1/preprocess/Vitamin_D_Levels/gene_data/GSE34450.csv filter=lfs diff=lfs merge=lfs -text
|
907 |
+
p1/preprocess/Werner_Syndrome/GSE48761.csv filter=lfs diff=lfs merge=lfs -text
|
908 |
+
p1/preprocess/Acute_Myeloid_Leukemia/GSE249638.csv filter=lfs diff=lfs merge=lfs -text
|
909 |
+
p1/preprocess/Acute_Myeloid_Leukemia/GSE99612.csv filter=lfs diff=lfs merge=lfs -text
|
910 |
+
p1/preprocess/Werner_Syndrome/gene_data/GSE48761.csv filter=lfs diff=lfs merge=lfs -text
|
911 |
+
p1/preprocess/Stomach_Cancer/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
912 |
+
p1/preprocess/Acute_Myeloid_Leukemia/GSE222124.csv filter=lfs diff=lfs merge=lfs -text
|
913 |
+
p1/preprocess/Vitamin_D_Levels/gene_data/GSE76324.csv filter=lfs diff=lfs merge=lfs -text
|
914 |
+
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE98578.csv filter=lfs diff=lfs merge=lfs -text
|
915 |
+
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE249638.csv filter=lfs diff=lfs merge=lfs -text
|
916 |
+
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE99612.csv filter=lfs diff=lfs merge=lfs -text
|
917 |
+
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE222169.csv filter=lfs diff=lfs merge=lfs -text
|
918 |
+
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE222124.csv filter=lfs diff=lfs merge=lfs -text
|
919 |
+
p1/preprocess/Uterine_Corpus_Endometrial_Carcinoma/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
920 |
+
p1/preprocess/Uterine_Corpus_Endometrial_Carcinoma/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
921 |
+
p1/preprocess/Uterine_Carcinosarcoma/gene_data/GSE68950.csv filter=lfs diff=lfs merge=lfs -text
|
922 |
+
p1/preprocess/Adrenocortical_Cancer/GSE90713.csv filter=lfs diff=lfs merge=lfs -text
|
923 |
+
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE161532.csv filter=lfs diff=lfs merge=lfs -text
|
924 |
+
p1/preprocess/Adrenocortical_Cancer/gene_data/GSE108088.csv filter=lfs diff=lfs merge=lfs -text
|
925 |
+
p1/preprocess/Adrenocortical_Cancer/gene_data/GSE143383.csv filter=lfs diff=lfs merge=lfs -text
|
926 |
+
p1/preprocess/Adrenocortical_Cancer/gene_data/GSE68606.csv filter=lfs diff=lfs merge=lfs -text
|
p1/preprocess/Acute_Myeloid_Leukemia/GSE222124.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7f205ba0aa1ab83409ba3a8672017b0ae7f27631c1f7b34841e549550220df9f
|
3 |
+
size 13765210
|
p1/preprocess/Acute_Myeloid_Leukemia/GSE249638.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a361b229a4d45e13416428a8743199dfa9a755341d7d9d2e6c63a80d79461c12
|
3 |
+
size 11134453
|
p1/preprocess/Acute_Myeloid_Leukemia/GSE99612.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:090599129737ea01127e44ed647ccc147103017fe525e5878f3184f20d441c08
|
3 |
+
size 11930068
|
p1/preprocess/Acute_Myeloid_Leukemia/clinical_data/GSE222124.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
GSM6915207,GSM6915208,GSM6915209,GSM6915210,GSM6915211,GSM6915212,GSM6915213,GSM6915214,GSM6915215,GSM6915216,GSM6915217,GSM6915218,GSM6915219,GSM6915220,GSM6915221,GSM6915222,GSM6915223,GSM6915224,GSM6915225,GSM6915226,GSM6915227,GSM6915228,GSM6915229,GSM6915230,GSM6915231,GSM6915232,GSM6915233,GSM6915234,GSM6915235,GSM6915236,GSM6915237,GSM6915238,GSM6915239,GSM6915240,GSM6915241,GSM6915242,GSM6915243,GSM6915244,GSM6915245,GSM6915246,GSM6915247,GSM6915248,GSM6915249,GSM6915250,GSM6915251,GSM6915252,GSM6915253,GSM6915254,GSM6915255,GSM6915256,GSM6915257,GSM6915258,GSM6915259,GSM6915260,GSM6915261,GSM6915262,GSM6915263,GSM6915264,GSM6915265,GSM6915266,GSM6915267,GSM6915268,GSM6915269,GSM6915270,GSM6915271,GSM6915272,GSM6915273,GSM6915274,GSM6915275,GSM6915276
|
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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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/Acute_Myeloid_Leukemia/clinical_data/GSE249638.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
GSM7956652,GSM7956653,GSM7956654,GSM7956655,GSM7956656,GSM7956657,GSM7956658,GSM7956659,GSM7956660,GSM7956661,GSM7956662,GSM7956663,GSM7956664,GSM7956665,GSM7956666,GSM7956667,GSM7956668,GSM7956669,GSM7956670,GSM7956671,GSM7956672,GSM7956673,GSM7956674,GSM7956675,GSM7956676,GSM7956677,GSM7956678,GSM7956679,GSM7956680,GSM7956681,GSM7956682,GSM7956683,GSM7956684,GSM7956685,GSM7956686,GSM7956687,GSM7956688
|
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,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
p1/preprocess/Acute_Myeloid_Leukemia/clinical_data/GSE99612.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
GSM2648543,GSM2648544,GSM2648545,GSM2648546,GSM2648547,GSM2648548,GSM2648549,GSM2648550,GSM2648551,GSM2648552,GSM2648553,GSM2648554,GSM2648555,GSM2648556,GSM2648557,GSM2648558,GSM2648559,GSM2648560,GSM2648561,GSM2648562,GSM2648563,GSM2648564,GSM2648565,GSM2648566,GSM2648567,GSM2648568,GSM2648569,GSM2648570,GSM2648571,GSM2648572,GSM2648573,GSM2648574,GSM2648575,GSM2648576,GSM2648577,GSM2648578,GSM2648579,GSM2648580,GSM2648581,GSM2648582,GSM2648583,GSM2648584,GSM2648585,GSM2648586,GSM2648587,GSM2648588,GSM2648589,GSM2648590
|
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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
3 |
+
,,,,,,,,,,,,,,,,,,,,,,,,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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/Acute_Myeloid_Leukemia/clinical_data/TCGA.csv
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
sampleID,Acute_Myeloid_Leukemia,Age,Gender
|
2 |
+
TCGA-AB-2802-03,1,50,1
|
3 |
+
TCGA-AB-2803-03,1,61,0
|
4 |
+
TCGA-AB-2804-03,1,30,1
|
5 |
+
TCGA-AB-2805-03,1,77,1
|
6 |
+
TCGA-AB-2806-03,1,46,1
|
7 |
+
TCGA-AB-2807-03,1,68,0
|
8 |
+
TCGA-AB-2808-03,1,23,1
|
9 |
+
TCGA-AB-2809-03,1,64,0
|
10 |
+
TCGA-AB-2810-03,1,76,0
|
11 |
+
TCGA-AB-2811-03,1,81,1
|
12 |
+
TCGA-AB-2812-03,1,25,0
|
13 |
+
TCGA-AB-2813-03,1,78,1
|
14 |
+
TCGA-AB-2814-03,1,39,0
|
15 |
+
TCGA-AB-2815-03,1,49,1
|
16 |
+
TCGA-AB-2816-03,1,57,0
|
17 |
+
TCGA-AB-2817-03,1,64,1
|
18 |
+
TCGA-AB-2818-03,1,62,0
|
19 |
+
TCGA-AB-2819-03,1,52,0
|
20 |
+
TCGA-AB-2820-03,1,76,1
|
21 |
+
TCGA-AB-2821-03,1,64,1
|
22 |
+
TCGA-AB-2822-03,1,65,1
|
23 |
+
TCGA-AB-2823-03,1,61,0
|
24 |
+
TCGA-AB-2824-03,1,45,1
|
25 |
+
TCGA-AB-2825-03,1,31,0
|
26 |
+
TCGA-AB-2826-03,1,64,0
|
27 |
+
TCGA-AB-2827-03,1,33,1
|
28 |
+
TCGA-AB-2828-03,1,55,1
|
29 |
+
TCGA-AB-2829-03,1,50,1
|
30 |
+
TCGA-AB-2830-03,1,64,0
|
31 |
+
TCGA-AB-2831-03,1,59,1
|
32 |
+
TCGA-AB-2832-03,1,60,0
|
33 |
+
TCGA-AB-2833-03,1,77,1
|
34 |
+
TCGA-AB-2834-03,1,33,1
|
35 |
+
TCGA-AB-2835-03,1,48,1
|
36 |
+
TCGA-AB-2836-03,1,35,1
|
37 |
+
TCGA-AB-2837-03,1,66,0
|
38 |
+
TCGA-AB-2838-03,1,67,1
|
39 |
+
TCGA-AB-2839-03,1,51,0
|
40 |
+
TCGA-AB-2840-03,1,74,1
|
41 |
+
TCGA-AB-2841-03,1,51,0
|
42 |
+
TCGA-AB-2842-03,1,65,1
|
43 |
+
TCGA-AB-2843-03,1,77,1
|
44 |
+
TCGA-AB-2844-03,1,63,1
|
45 |
+
TCGA-AB-2845-03,1,37,0
|
46 |
+
TCGA-AB-2846-03,1,57,0
|
47 |
+
TCGA-AB-2847-03,1,53,1
|
48 |
+
TCGA-AB-2848-03,1,62,1
|
49 |
+
TCGA-AB-2849-03,1,39,1
|
50 |
+
TCGA-AB-2850-03,1,72,0
|
51 |
+
TCGA-AB-2851-03,1,66,0
|
52 |
+
TCGA-AB-2853-03,1,51,1
|
53 |
+
TCGA-AB-2854-03,1,51,0
|
54 |
+
TCGA-AB-2855-03,1,18,1
|
55 |
+
TCGA-AB-2856-03,1,63,1
|
56 |
+
TCGA-AB-2857-03,1,54,1
|
57 |
+
TCGA-AB-2858-03,1,75,0
|
58 |
+
TCGA-AB-2859-03,1,40,1
|
59 |
+
TCGA-AB-2860-03,1,60,0
|
60 |
+
TCGA-AB-2861-03,1,76,1
|
61 |
+
TCGA-AB-2862-03,1,33,0
|
62 |
+
TCGA-AB-2863-03,1,63,1
|
63 |
+
TCGA-AB-2864-03,1,54,0
|
64 |
+
TCGA-AB-2865-03,1,75,1
|
65 |
+
TCGA-AB-2866-03,1,67,1
|
66 |
+
TCGA-AB-2867-03,1,66,0
|
67 |
+
TCGA-AB-2868-03,1,77,1
|
68 |
+
TCGA-AB-2869-03,1,64,0
|
69 |
+
TCGA-AB-2870-03,1,76,1
|
70 |
+
TCGA-AB-2871-03,1,51,1
|
71 |
+
TCGA-AB-2872-03,1,42,1
|
72 |
+
TCGA-AB-2873-03,1,51,0
|
73 |
+
TCGA-AB-2874-03,1,59,1
|
74 |
+
TCGA-AB-2875-03,1,43,1
|
75 |
+
TCGA-AB-2876-03,1,45,0
|
76 |
+
TCGA-AB-2877-03,1,60,0
|
77 |
+
TCGA-AB-2878-03,1,47,0
|
78 |
+
TCGA-AB-2879-03,1,68,0
|
79 |
+
TCGA-AB-2880-03,1,24,1
|
80 |
+
TCGA-AB-2881-03,1,48,0
|
81 |
+
TCGA-AB-2882-03,1,73,0
|
82 |
+
TCGA-AB-2883-03,1,60,1
|
83 |
+
TCGA-AB-2884-03,1,44,0
|
84 |
+
TCGA-AB-2885-03,1,71,1
|
85 |
+
TCGA-AB-2886-03,1,26,1
|
86 |
+
TCGA-AB-2887-03,1,60,0
|
87 |
+
TCGA-AB-2888-03,1,57,1
|
88 |
+
TCGA-AB-2889-03,1,55,1
|
89 |
+
TCGA-AB-2890-03,1,69,1
|
90 |
+
TCGA-AB-2891-03,1,42,1
|
91 |
+
TCGA-AB-2892-03,1,42,0
|
92 |
+
TCGA-AB-2893-03,1,45,1
|
93 |
+
TCGA-AB-2894-03,1,50,0
|
94 |
+
TCGA-AB-2895-03,1,41,0
|
95 |
+
TCGA-AB-2896-03,1,21,0
|
96 |
+
TCGA-AB-2897-03,1,50,0
|
97 |
+
TCGA-AB-2898-03,1,69,0
|
98 |
+
TCGA-AB-2899-03,1,76,0
|
99 |
+
TCGA-AB-2900-03,1,70,1
|
100 |
+
TCGA-AB-2901-03,1,27,1
|
101 |
+
TCGA-AB-2903-03,1,76,0
|
102 |
+
TCGA-AB-2904-03,1,65,1
|
103 |
+
TCGA-AB-2905-03,1,48,1
|
104 |
+
TCGA-AB-2906-03,1,59,1
|
105 |
+
TCGA-AB-2907-03,1,69,1
|
106 |
+
TCGA-AB-2908-03,1,81,1
|
107 |
+
TCGA-AB-2909-03,1,22,1
|
108 |
+
TCGA-AB-2910-03,1,61,0
|
109 |
+
TCGA-AB-2911-03,1,51,0
|
110 |
+
TCGA-AB-2912-03,1,63,1
|
111 |
+
TCGA-AB-2913-03,1,61,1
|
112 |
+
TCGA-AB-2914-03,1,22,0
|
113 |
+
TCGA-AB-2915-03,1,73,0
|
114 |
+
TCGA-AB-2916-03,1,48,0
|
115 |
+
TCGA-AB-2917-03,1,41,0
|
116 |
+
TCGA-AB-2918-03,1,47,0
|
117 |
+
TCGA-AB-2919-03,1,54,0
|
118 |
+
TCGA-AB-2920-03,1,44,1
|
119 |
+
TCGA-AB-2921-03,1,56,0
|
120 |
+
TCGA-AB-2922-03,1,83,1
|
121 |
+
TCGA-AB-2923-03,1,78,1
|
122 |
+
TCGA-AB-2924-03,1,59,1
|
123 |
+
TCGA-AB-2925-03,1,57,1
|
124 |
+
TCGA-AB-2926-03,1,57,0
|
125 |
+
TCGA-AB-2927-03,1,88,0
|
126 |
+
TCGA-AB-2928-03,1,43,0
|
127 |
+
TCGA-AB-2929-03,1,71,0
|
128 |
+
TCGA-AB-2930-03,1,63,0
|
129 |
+
TCGA-AB-2931-03,1,75,1
|
130 |
+
TCGA-AB-2932-03,1,62,1
|
131 |
+
TCGA-AB-2933-03,1,58,1
|
132 |
+
TCGA-AB-2934-03,1,65,1
|
133 |
+
TCGA-AB-2935-03,1,66,1
|
134 |
+
TCGA-AB-2936-03,1,61,0
|
135 |
+
TCGA-AB-2937-03,1,36,0
|
136 |
+
TCGA-AB-2938-03,1,76,1
|
137 |
+
TCGA-AB-2939-03,1,72,1
|
138 |
+
TCGA-AB-2940-03,1,35,1
|
139 |
+
TCGA-AB-2941-03,1,73,1
|
140 |
+
TCGA-AB-2942-03,1,67,0
|
141 |
+
TCGA-AB-2943-03,1,70,0
|
142 |
+
TCGA-AB-2944-03,1,48,1
|
143 |
+
TCGA-AB-2945-03,1,65,0
|
144 |
+
TCGA-AB-2946-03,1,41,1
|
145 |
+
TCGA-AB-2947-03,1,52,1
|
146 |
+
TCGA-AB-2948-03,1,67,1
|
147 |
+
TCGA-AB-2949-03,1,58,1
|
148 |
+
TCGA-AB-2950-03,1,34,0
|
149 |
+
TCGA-AB-2952-03,1,60,0
|
150 |
+
TCGA-AB-2954-03,1,55,0
|
151 |
+
TCGA-AB-2955-03,1,56,0
|
152 |
+
TCGA-AB-2956-03,1,61,1
|
153 |
+
TCGA-AB-2957-03,1,31,1
|
154 |
+
TCGA-AB-2959-03,1,71,1
|
155 |
+
TCGA-AB-2963-03,1,56,1
|
156 |
+
TCGA-AB-2964-03,1,58,0
|
157 |
+
TCGA-AB-2965-03,1,60,1
|
158 |
+
TCGA-AB-2966-03,1,57,0
|
159 |
+
TCGA-AB-2967-03,1,58,1
|
160 |
+
TCGA-AB-2968-03,1,79,1
|
161 |
+
TCGA-AB-2969-03,1,55,1
|
162 |
+
TCGA-AB-2970-03,1,34,0
|
163 |
+
TCGA-AB-2971-03,1,76,0
|
164 |
+
TCGA-AB-2972-03,1,82,0
|
165 |
+
TCGA-AB-2973-03,1,68,0
|
166 |
+
TCGA-AB-2974-03,1,67,0
|
167 |
+
TCGA-AB-2975-03,1,54,1
|
168 |
+
TCGA-AB-2976-03,1,53,1
|
169 |
+
TCGA-AB-2977-03,1,71,0
|
170 |
+
TCGA-AB-2978-03,1,61,0
|
171 |
+
TCGA-AB-2979-03,1,30,0
|
172 |
+
TCGA-AB-2980-03,1,50,1
|
173 |
+
TCGA-AB-2981-03,1,35,0
|
174 |
+
TCGA-AB-2982-03,1,29,0
|
175 |
+
TCGA-AB-2983-03,1,45,1
|
176 |
+
TCGA-AB-2984-03,1,38,1
|
177 |
+
TCGA-AB-2985-03,1,81,0
|
178 |
+
TCGA-AB-2986-03,1,31,0
|
179 |
+
TCGA-AB-2987-03,1,75,0
|
180 |
+
TCGA-AB-2988-03,1,67,0
|
181 |
+
TCGA-AB-2989-03,1,29,1
|
182 |
+
TCGA-AB-2990-03,1,51,1
|
183 |
+
TCGA-AB-2991-03,1,40,0
|
184 |
+
TCGA-AB-2992-03,1,32,0
|
185 |
+
TCGA-AB-2993-03,1,57,0
|
186 |
+
TCGA-AB-2994-03,1,25,1
|
187 |
+
TCGA-AB-2995-03,1,63,1
|
188 |
+
TCGA-AB-2996-03,1,74,1
|
189 |
+
TCGA-AB-2997-03,1,25,0
|
190 |
+
TCGA-AB-2998-03,1,68,0
|
191 |
+
TCGA-AB-2999-03,1,62,1
|
192 |
+
TCGA-AB-3000-03,1,25,1
|
193 |
+
TCGA-AB-3001-03,1,31,0
|
194 |
+
TCGA-AB-3002-03,1,68,1
|
195 |
+
TCGA-AB-3005-03,1,45,1
|
196 |
+
TCGA-AB-3006-03,1,61,1
|
197 |
+
TCGA-AB-3007-03,1,35,1
|
198 |
+
TCGA-AB-3008-03,1,22,1
|
199 |
+
TCGA-AB-3009-03,1,23,1
|
200 |
+
TCGA-AB-3011-03,1,21,0
|
201 |
+
TCGA-AB-3012-03,1,53,1
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE121291.py
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE121291"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE121291"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE121291.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE121291.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE121291.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# Step 1: Determine if gene expression data is available
|
42 |
+
# Based on the background information indicating "microarray mRNA", we consider gene data to be available.
|
43 |
+
is_gene_available = True
|
44 |
+
|
45 |
+
# Step 2: Identify rows for each variable and define conversion functions
|
46 |
+
|
47 |
+
# Observing the sample characteristics dictionary:
|
48 |
+
# 0 => ['disease state: Acute Myeloid Leukemia']
|
49 |
+
# 1 => ['cell line: AML cell line THP-1']
|
50 |
+
# 2 => ['agent: DMSO', 'agent: SY-1365', 'agent: JQ1', 'agent: NVP2', 'agent: FLAVO']
|
51 |
+
# 3 => ['time: 2 hours', 'time: 6 hours']
|
52 |
+
# All samples have the same disease state, so there is no variability for the trait.
|
53 |
+
# No keys indicate age or gender.
|
54 |
+
trait_row = None
|
55 |
+
age_row = None
|
56 |
+
gender_row = None
|
57 |
+
|
58 |
+
def convert_trait(value: str) -> int:
|
59 |
+
# Not applicable here since trait data is not available
|
60 |
+
return None
|
61 |
+
|
62 |
+
def convert_age(value: str) -> float:
|
63 |
+
# Not applicable here since age data is not available
|
64 |
+
return None
|
65 |
+
|
66 |
+
def convert_gender(value: str) -> int:
|
67 |
+
# Not applicable here since gender data is not available
|
68 |
+
return None
|
69 |
+
|
70 |
+
# Step 3: Save initial metadata using the library function
|
71 |
+
is_trait_available = trait_row is not None
|
72 |
+
_ = validate_and_save_cohort_info(
|
73 |
+
is_final=False,
|
74 |
+
cohort=cohort,
|
75 |
+
info_path=json_path,
|
76 |
+
is_gene_available=is_gene_available,
|
77 |
+
is_trait_available=is_trait_available
|
78 |
+
)
|
79 |
+
|
80 |
+
# Step 4: Since trait_row is None, we skip clinical feature extraction.
|
81 |
+
# STEP3
|
82 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
83 |
+
gene_data = get_genetic_data(matrix_file)
|
84 |
+
|
85 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
86 |
+
print(gene_data.index[:20])
|
87 |
+
# Based on the observed Affymetrix probe set IDs (e.g., 11715100_at), these are not standard gene symbols.
|
88 |
+
# Therefore, they need to be mapped to human gene symbols.
|
89 |
+
print("\nrequires_gene_mapping = True")
|
90 |
+
# STEP5
|
91 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
92 |
+
gene_annotation = get_gene_annotation(soft_file)
|
93 |
+
|
94 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
95 |
+
print("Gene annotation preview:")
|
96 |
+
print(preview_df(gene_annotation))
|
97 |
+
# STEP: Gene Identifier Mapping
|
98 |
+
|
99 |
+
# 1. Based on the preview, the column "ID" in the annotation matches the probe identifiers (e.g., '11715100_at'),
|
100 |
+
# and "Gene Symbol" is the column containing the gene symbols (e.g., 'HIST1H3G').
|
101 |
+
mapping_df = get_gene_mapping(annotation=gene_annotation, prob_col="ID", gene_col="Gene Symbol")
|
102 |
+
|
103 |
+
# 2. Convert probe-level measurements to gene-level by applying the mapping.
|
104 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
105 |
+
|
106 |
+
# For inspection, let's check the shape and a few index entries of the resulting dataframe:
|
107 |
+
print("Mapped gene expression data shape:", gene_data.shape)
|
108 |
+
print("First 10 gene symbols in the mapped data:", gene_data.index[:10].tolist())
|
109 |
+
# STEP 7
|
110 |
+
|
111 |
+
# 1. Normalize gene symbols in the gene_data, then save to CSV
|
112 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
113 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
114 |
+
|
115 |
+
# 2. Since trait data is not available, skip linking and other steps that depend on the trait.
|
116 |
+
# We only perform final validation indicating that the trait is not available.
|
117 |
+
is_usable = validate_and_save_cohort_info(
|
118 |
+
is_final=True,
|
119 |
+
cohort=cohort,
|
120 |
+
info_path=json_path,
|
121 |
+
is_gene_available=True,
|
122 |
+
is_trait_available=False,
|
123 |
+
note="Gene expression data available, but no trait data. Skipping final linking step."
|
124 |
+
)
|
125 |
+
|
126 |
+
# 3. Because trait is unavailable, no final linked data is saved.
|
127 |
+
# STEP 8
|
128 |
+
|
129 |
+
# 1. Normalize gene symbols in the gene_data, then save to CSV.
|
130 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
131 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
132 |
+
|
133 |
+
# Since we have no clinical data (trait_row=None) and no trait information,
|
134 |
+
# we cannot link clinical data or perform trait-based missing-value handling or bias checks.
|
135 |
+
|
136 |
+
# 2. Perform final validation indicating no trait is available.
|
137 |
+
# Per the library's requirement, we must still provide a DataFrame and an is_biased flag.
|
138 |
+
# Because is_trait_available=False, the dataset will not be marked usable regardless of is_biased value.
|
139 |
+
df_for_validation = normalized_gene_data.copy()
|
140 |
+
is_biased = False # Arbitrary since there's no trait.
|
141 |
+
|
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=False,
|
148 |
+
is_biased=is_biased,
|
149 |
+
df=df_for_validation,
|
150 |
+
note="Gene expression data present, but no trait data. Cannot perform linking or trait-based QC."
|
151 |
+
)
|
152 |
+
|
153 |
+
# 3. If the dataset is not usable (due to no trait), we skip saving any final linked data.
|
154 |
+
if is_usable:
|
155 |
+
df_for_validation.to_csv(out_data_file)
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE121431.py
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE121431"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE121431"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE121431.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE121431.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE121431.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1. Decide whether gene expression data is available
|
42 |
+
is_gene_available = True # Based on dataset background suggesting gene expression profiling
|
43 |
+
|
44 |
+
# 2. Identify rows for trait, age, and gender and define conversion functions
|
45 |
+
|
46 |
+
# The sample characteristics show only one disease state (AML) for all samples,
|
47 |
+
# and there is no mention of age or gender. Thus, for association studies,
|
48 |
+
# none of these variables are available (they are either constant or absent).
|
49 |
+
trait_row = None
|
50 |
+
age_row = None
|
51 |
+
gender_row = None
|
52 |
+
|
53 |
+
def convert_trait(value: str) -> Optional[int]:
|
54 |
+
# This dataset has no varying trait information. Returning None for all.
|
55 |
+
return None
|
56 |
+
|
57 |
+
def convert_age(value: str) -> Optional[float]:
|
58 |
+
# No age data available. Returning None for all.
|
59 |
+
return None
|
60 |
+
|
61 |
+
def convert_gender(value: str) -> Optional[int]:
|
62 |
+
# No gender data available. Returning None for all.
|
63 |
+
return None
|
64 |
+
|
65 |
+
# 3. Save metadata (initial filtering)
|
66 |
+
is_trait_available = (trait_row is not None) # False in this case
|
67 |
+
|
68 |
+
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. Since trait_row is None, we do not extract the clinical features
|
77 |
+
# and thus skip the substep of saving clinical data.
|
78 |
+
# STEP3
|
79 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
80 |
+
gene_data = get_genetic_data(matrix_file)
|
81 |
+
|
82 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
83 |
+
print(gene_data.index[:20])
|
84 |
+
# Observing the given identifiers (e.g., '11715100_at', '11715101_s_at', etc.),
|
85 |
+
# they appear to be Affymetrix probe IDs rather than human gene symbols.
|
86 |
+
# They will require mapping to standard gene symbols.
|
87 |
+
|
88 |
+
print("These IDs look like Affymetrix microarray probe IDs.")
|
89 |
+
print("requires_gene_mapping = True")
|
90 |
+
# STEP5
|
91 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
92 |
+
gene_annotation = get_gene_annotation(soft_file)
|
93 |
+
|
94 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
95 |
+
print("Gene annotation preview:")
|
96 |
+
print(preview_df(gene_annotation))
|
97 |
+
# STEP: Gene Identifier Mapping
|
98 |
+
|
99 |
+
# 1. Identify the columns in the annotation dataframe:
|
100 |
+
# - 'ID' matches the probe IDs found in our gene_data index
|
101 |
+
# - 'Gene Symbol' contains the gene symbols needed for mapping
|
102 |
+
|
103 |
+
# 2. Get the gene mapping dataframe using the library function
|
104 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="Gene Symbol")
|
105 |
+
|
106 |
+
# 3. Convert probe-level measurements to gene expression data
|
107 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
108 |
+
|
109 |
+
# (Optional) Quick check of the shape of the resulting gene_data
|
110 |
+
print(f"Mapped gene_data shape: {gene_data.shape}")
|
111 |
+
# STEP 7
|
112 |
+
|
113 |
+
# 1. Normalize gene symbols in the gene_data, then save to CSV.
|
114 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
115 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
116 |
+
|
117 |
+
# Since trait data is unavailable (trait_row was None in an earlier step),
|
118 |
+
# we cannot do trait-based linking, missing value handling, or bias checks.
|
119 |
+
# Instead, we record this dataset with partial validation: is_final=False.
|
120 |
+
validate_and_save_cohort_info(
|
121 |
+
is_final=False,
|
122 |
+
cohort=cohort,
|
123 |
+
info_path=json_path,
|
124 |
+
is_gene_available=True, # There is gene data
|
125 |
+
is_trait_available=False # No trait data
|
126 |
+
)
|
127 |
+
|
128 |
+
# Because no trait data is available, we do not attempt to generate or save any final linked dataset.
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE161532.py
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE161532"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE161532"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE161532.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE161532.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE161532.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/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 contains gene expression data
|
37 |
+
is_gene_available = True # Affymetrix Human Transcriptome Array 2.0 suggests gene expression data
|
38 |
+
|
39 |
+
# 2) Identify data availability for trait, age, gender
|
40 |
+
# The dataset only has AML samples (no variation), so trait is effectively not available.
|
41 |
+
# Age data is in row 1 and gender data is in row 2, each having more than one unique value.
|
42 |
+
trait_row = None
|
43 |
+
age_row = 1
|
44 |
+
gender_row = 2
|
45 |
+
|
46 |
+
# 2.2) Define conversion functions for trait, age, and gender
|
47 |
+
|
48 |
+
def convert_trait(value: str):
|
49 |
+
"""
|
50 |
+
Convert trait (AML) data to a binary indicator if variation existed.
|
51 |
+
But effectively not used since trait_row is None.
|
52 |
+
"""
|
53 |
+
try:
|
54 |
+
val = value.split(":", 1)[1].strip().lower()
|
55 |
+
# If it contained 'aml', would return 1, else 0
|
56 |
+
return 1 if "aml" in val else 0
|
57 |
+
except:
|
58 |
+
return None
|
59 |
+
|
60 |
+
def convert_age(value: str):
|
61 |
+
"""
|
62 |
+
Convert the 'age: X' format to an integer if possible, else None.
|
63 |
+
"""
|
64 |
+
try:
|
65 |
+
val = value.split(":", 1)[1].strip().lower()
|
66 |
+
return int(val) if val.isdigit() else None
|
67 |
+
except:
|
68 |
+
return None
|
69 |
+
|
70 |
+
def convert_gender(value: str):
|
71 |
+
"""
|
72 |
+
Convert 'gender: Female' or 'gender: Male' to binary (0 for Female, 1 for Male).
|
73 |
+
"""
|
74 |
+
try:
|
75 |
+
val = value.split(":", 1)[1].strip().lower()
|
76 |
+
if val == "female":
|
77 |
+
return 0
|
78 |
+
elif val == "male":
|
79 |
+
return 1
|
80 |
+
else:
|
81 |
+
return None
|
82 |
+
except:
|
83 |
+
return None
|
84 |
+
|
85 |
+
# 3) Initial filtering on dataset usability based on gene/trait availability
|
86 |
+
is_trait_available = (trait_row is not None)
|
87 |
+
validate_and_save_cohort_info(
|
88 |
+
is_final=False,
|
89 |
+
cohort=cohort,
|
90 |
+
info_path=json_path,
|
91 |
+
is_gene_available=is_gene_available,
|
92 |
+
is_trait_available=is_trait_available
|
93 |
+
)
|
94 |
+
|
95 |
+
# 4) Skip clinical feature extraction since trait_row is None (trait not available)
|
96 |
+
# STEP3
|
97 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
98 |
+
gene_data = get_genetic_data(matrix_file)
|
99 |
+
|
100 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
101 |
+
print(gene_data.index[:20])
|
102 |
+
# Based on the observed pattern ("xxxxx_st"), these are likely Affymetrix probe set IDs,
|
103 |
+
# which are not standard human gene symbols and require mapping to gene symbols.
|
104 |
+
|
105 |
+
requires_gene_mapping = True
|
106 |
+
# STEP5
|
107 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
108 |
+
gene_annotation = get_gene_annotation(soft_file)
|
109 |
+
|
110 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
111 |
+
print("Gene annotation preview:")
|
112 |
+
print(preview_df(gene_annotation))
|
113 |
+
# STEP6: Gene Identifier Mapping
|
114 |
+
|
115 |
+
# 1. Decide which columns in the annotation correspond to the expression IDs and gene symbols
|
116 |
+
# From the preview, 'ID' appears to hold probe identifiers like "TC01000001.hg.1"
|
117 |
+
# and 'gene_assignment' has the string containing possible gene symbols.
|
118 |
+
prob_col = "ID"
|
119 |
+
gene_col = "gene_assignment"
|
120 |
+
|
121 |
+
# 2. Get the gene mapping dataframe
|
122 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=prob_col, gene_col=gene_col)
|
123 |
+
|
124 |
+
# 3. Convert probe-level measurements to gene expression data
|
125 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
126 |
+
|
127 |
+
# For confirmation, let's check some aspects of the mapped gene data
|
128 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
129 |
+
print("First 20 gene symbols in mapped data:", list(gene_data.index[:20]))
|
130 |
+
# STEP 7
|
131 |
+
|
132 |
+
# Since in a previous step we determined trait_row = None, this means the trait is not available for this dataset.
|
133 |
+
# Hence, we cannot link clinical and genetic data or proceed with trait-based analyses. We only normalize the gene data,
|
134 |
+
# then finalize the metadata to record that the dataset is not trait-usable.
|
135 |
+
|
136 |
+
# 1. Normalize gene symbols in the gene expression data, then save to CSV
|
137 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
138 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
139 |
+
print(f"Gene data normalized and saved to: {out_gene_data_file}")
|
140 |
+
|
141 |
+
# 2. Prepare to finalize the metadata for a dataset lacking trait data
|
142 |
+
# Provide an empty DataFrame and set is_biased to False to satisfy the function signature
|
143 |
+
empty_df = pd.DataFrame()
|
144 |
+
is_biased = False
|
145 |
+
|
146 |
+
# 3. Perform final validation indicating trait is unavailable
|
147 |
+
validate_and_save_cohort_info(
|
148 |
+
is_final=True,
|
149 |
+
cohort=cohort,
|
150 |
+
info_path=json_path,
|
151 |
+
is_gene_available=True, # Gene data is present
|
152 |
+
is_trait_available=False, # Trait is unavailable as determined
|
153 |
+
is_biased=is_biased, # Required by function signature
|
154 |
+
df=empty_df, # We have no trait-based linked data
|
155 |
+
note="No trait data. Clinical linking skipped."
|
156 |
+
)
|
157 |
+
|
158 |
+
# 4. Since the dataset is not trait-usable, we do not save any linked data file.
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE222124.py
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE222124"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE222124"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE222124.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE222124.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE222124.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/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. Gene Expression Data Availability
|
37 |
+
is_gene_available = True # Based on the series title mentioning "Gene expression alterations"
|
38 |
+
|
39 |
+
# 2. Variable Availability and Data Type Conversion
|
40 |
+
|
41 |
+
# From the sample characteristics dictionary:
|
42 |
+
# 0: ['cell type: T cell leukemia', 'cell type: Acute monocytic leukemia monocyte', 'cell type: Natural killer cell leukemia']
|
43 |
+
# There are three distinct values; one of them (“Acute monocytic leukemia monocyte”) is closely related to AML.
|
44 |
+
# We will thus use row 0 as the binary trait indicator (AML vs. not AML).
|
45 |
+
trait_row = 0 # Because it includes "Acute monocytic leukemia monocyte" (subtype of AML)
|
46 |
+
age_row = None # No explicit or inferable age mention
|
47 |
+
gender_row = None # No explicit or inferable gender mention
|
48 |
+
|
49 |
+
def convert_trait(value: str):
|
50 |
+
parts = value.split(':', 1)
|
51 |
+
if len(parts) < 2:
|
52 |
+
return None
|
53 |
+
val = parts[1].strip().lower()
|
54 |
+
# Map 'acute monocytic leukemia monocyte' to 1 for AML, others to 0
|
55 |
+
if val == 'acute monocytic leukemia monocyte':
|
56 |
+
return 1
|
57 |
+
elif val in ['t cell leukemia', 'natural killer cell leukemia']:
|
58 |
+
return 0
|
59 |
+
else:
|
60 |
+
return None
|
61 |
+
|
62 |
+
# No age or gender data, so we define stub converters returning None
|
63 |
+
def convert_age(value: str):
|
64 |
+
return None
|
65 |
+
|
66 |
+
def convert_gender(value: str):
|
67 |
+
return None
|
68 |
+
|
69 |
+
# 3. Initial filtering and saving metadata
|
70 |
+
is_trait_available = (trait_row is not None)
|
71 |
+
is_usable = validate_and_save_cohort_info(
|
72 |
+
is_final=False,
|
73 |
+
cohort=cohort,
|
74 |
+
info_path=json_path,
|
75 |
+
is_gene_available=is_gene_available,
|
76 |
+
is_trait_available=is_trait_available
|
77 |
+
)
|
78 |
+
|
79 |
+
# 4. Clinical Feature Extraction (only if trait data is available)
|
80 |
+
if trait_row is not None:
|
81 |
+
selected_clinical_df = geo_select_clinical_features(
|
82 |
+
clinical_data,
|
83 |
+
trait=trait,
|
84 |
+
trait_row=trait_row,
|
85 |
+
convert_trait=convert_trait,
|
86 |
+
age_row=age_row,
|
87 |
+
convert_age=convert_age,
|
88 |
+
gender_row=gender_row,
|
89 |
+
convert_gender=convert_gender
|
90 |
+
)
|
91 |
+
# Preview
|
92 |
+
print("Preview of selected clinical data:", preview_df(selected_clinical_df, n=5))
|
93 |
+
# Save
|
94 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
95 |
+
# STEP3
|
96 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
97 |
+
gene_data = get_genetic_data(matrix_file)
|
98 |
+
|
99 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
100 |
+
print(gene_data.index[:20])
|
101 |
+
# Based on the given gene identifiers (Affymetrix probe set IDs), they are not human gene symbols,
|
102 |
+
# so they require mapping to gene symbols.
|
103 |
+
print("requires_gene_mapping = True")
|
104 |
+
# STEP5
|
105 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
106 |
+
gene_annotation = get_gene_annotation(soft_file)
|
107 |
+
|
108 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
109 |
+
print("Gene annotation preview:")
|
110 |
+
print(preview_df(gene_annotation))
|
111 |
+
# STEP6: Gene Identifier Mapping
|
112 |
+
|
113 |
+
# 1. Identify the columns in 'gene_annotation' that match the gene expression data identifiers (probe IDs)
|
114 |
+
# and the columns that contain actual gene symbols. From the preview, we see 'ID' matches the probe IDs
|
115 |
+
# and 'Gene Symbol' corresponds to the gene symbols.
|
116 |
+
probe_col = 'ID'
|
117 |
+
symbol_col = 'Gene Symbol'
|
118 |
+
|
119 |
+
# 2. Create a mapping dataframe for probe-to-gene
|
120 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=symbol_col)
|
121 |
+
|
122 |
+
# 3. Convert the probe-level measurements in 'gene_data' to gene-level data using the mapping
|
123 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
124 |
+
# STEP 7
|
125 |
+
|
126 |
+
# 1. Normalize gene symbols in the gene_data, then save to CSV.
|
127 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
128 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
129 |
+
|
130 |
+
# 2. Link the clinical and gene expression data
|
131 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
132 |
+
|
133 |
+
# 3. Handle missing values
|
134 |
+
linked_data = handle_missing_values(linked_data, trait_col=trait)
|
135 |
+
|
136 |
+
# 4. Determine whether the trait/demographic features are severely biased
|
137 |
+
is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait=trait)
|
138 |
+
|
139 |
+
# 5. Final quality validation and metadata saving
|
140 |
+
is_usable = validate_and_save_cohort_info(
|
141 |
+
is_final=True,
|
142 |
+
cohort=cohort,
|
143 |
+
info_path=json_path,
|
144 |
+
is_gene_available=True,
|
145 |
+
is_trait_available=True,
|
146 |
+
is_biased=is_trait_biased,
|
147 |
+
df=linked_data,
|
148 |
+
note="AML vs healthy controls; microarray-based expression data."
|
149 |
+
)
|
150 |
+
|
151 |
+
# 6. If usable, save the final linked data
|
152 |
+
if is_usable:
|
153 |
+
linked_data.to_csv(out_data_file)
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE222169.py
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE222169"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE222169"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE222169.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE222169.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE222169.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/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. Gene Expression Data Availability
|
37 |
+
# Based on the background ("Mitochondrial fusion ... AML") and sample annotations, we assume
|
38 |
+
# it is likely gene expression data rather than purely miRNA or methylation.
|
39 |
+
is_gene_available = True
|
40 |
+
|
41 |
+
# 2. Variable Availability and Data Conversion
|
42 |
+
# Inspecting the sample characteristics dictionary, the data does not provide variability
|
43 |
+
# for the trait "Acute Myeloid Leukemia" (all samples appear AML), and there is no mention
|
44 |
+
# of age or gender. Therefore, set all rows to None.
|
45 |
+
trait_row = None
|
46 |
+
age_row = None
|
47 |
+
gender_row = None
|
48 |
+
|
49 |
+
# Define conversion functions (though they won't be used with None rows).
|
50 |
+
def convert_trait(value: str) -> int:
|
51 |
+
# Not used here, but implement a placeholder
|
52 |
+
return 1 if value else None
|
53 |
+
|
54 |
+
def convert_age(value: str) -> float:
|
55 |
+
# Not used here, but implement a placeholder
|
56 |
+
return float(value) if value else None
|
57 |
+
|
58 |
+
def convert_gender(value: str) -> int:
|
59 |
+
# Not used here, but implement a placeholder
|
60 |
+
val_lower = value.lower() if value else ""
|
61 |
+
if "female" in val_lower:
|
62 |
+
return 0
|
63 |
+
elif "male" in val_lower:
|
64 |
+
return 1
|
65 |
+
return None
|
66 |
+
|
67 |
+
# 3. Save Metadata (Initial Filtering)
|
68 |
+
# Trait data is not available because trait_row is None, so is_trait_available=False.
|
69 |
+
is_trait_available = (trait_row is not None)
|
70 |
+
|
71 |
+
is_usable = validate_and_save_cohort_info(
|
72 |
+
is_final=False,
|
73 |
+
cohort=cohort,
|
74 |
+
info_path=json_path,
|
75 |
+
is_gene_available=is_gene_available,
|
76 |
+
is_trait_available=is_trait_available
|
77 |
+
)
|
78 |
+
|
79 |
+
# 4. Clinical Feature Extraction
|
80 |
+
# Skip because trait_row is None (no clinical data to extract).
|
81 |
+
# STEP3
|
82 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
83 |
+
gene_data = get_genetic_data(matrix_file)
|
84 |
+
|
85 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
86 |
+
print(gene_data.index[:20])
|
87 |
+
# Based on the observed identifiers, these are not standard gene symbols; they likely refer to probe identifiers.
|
88 |
+
# Therefore, they require gene symbol mapping.
|
89 |
+
|
90 |
+
print("requires_gene_mapping = True")
|
91 |
+
# STEP5
|
92 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
93 |
+
gene_annotation = get_gene_annotation(soft_file)
|
94 |
+
|
95 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
96 |
+
print("Gene annotation preview:")
|
97 |
+
print(preview_df(gene_annotation))
|
98 |
+
# STEP: Gene Identifier Mapping
|
99 |
+
|
100 |
+
# 1. Identify the annotation columns that correspond to the same identifiers in gene_data and the column with gene symbols.
|
101 |
+
# From the preview, 'ID' matches the identifiers in the gene_data, and 'SPOT_ID.1' appears to contain the gene symbol information.
|
102 |
+
gene_id_col = "ID"
|
103 |
+
gene_symbol_col = "SPOT_ID.1"
|
104 |
+
|
105 |
+
# 2. Get a gene mapping dataframe using get_gene_mapping.
|
106 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=gene_id_col, gene_col=gene_symbol_col)
|
107 |
+
|
108 |
+
# 3. Convert probe-level measurements in gene_data to gene expression by applying the mapping.
|
109 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
110 |
+
|
111 |
+
# (At this point, 'gene_data' now contains gene expression values indexed by gene symbols.)
|
112 |
+
# STEP 7
|
113 |
+
|
114 |
+
import pandas as pd
|
115 |
+
|
116 |
+
# We rely on the variable "is_trait_available" from previous steps to decide if trait data is available.
|
117 |
+
# If there is no trait data, we skip final validation (is_final=False) because the library function
|
118 |
+
# requires a valid 'df' and 'is_biased' if is_final=True.
|
119 |
+
|
120 |
+
if not is_trait_available:
|
121 |
+
# Perform a non-final validation, indicating that trait data is unavailable
|
122 |
+
_ = validate_and_save_cohort_info(
|
123 |
+
is_final=False,
|
124 |
+
cohort=cohort,
|
125 |
+
info_path=json_path,
|
126 |
+
is_gene_available=True, # Because from Step 2 we said we do have gene data
|
127 |
+
is_trait_available=False # Confirm we do NOT have trait data
|
128 |
+
)
|
129 |
+
else:
|
130 |
+
# 1. Normalize gene symbols in the gene_data, then save to CSV.
|
131 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
132 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
133 |
+
|
134 |
+
# We assume selected_clinical_df was created in a previous step if trait data was present
|
135 |
+
# 2. Link the clinical and gene expression data
|
136 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
137 |
+
|
138 |
+
# 3. Handle missing values
|
139 |
+
linked_data = handle_missing_values(linked_data, trait_col=trait)
|
140 |
+
|
141 |
+
# 4. Determine whether the trait/demographic features are severely biased
|
142 |
+
is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait=trait)
|
143 |
+
|
144 |
+
# 5. Final quality validation and metadata saving
|
145 |
+
is_usable = validate_and_save_cohort_info(
|
146 |
+
is_final=True,
|
147 |
+
cohort=cohort,
|
148 |
+
info_path=json_path,
|
149 |
+
is_gene_available=True,
|
150 |
+
is_trait_available=True,
|
151 |
+
is_biased=is_trait_biased,
|
152 |
+
df=linked_data,
|
153 |
+
note="AML dataset; microarray-based gene expression."
|
154 |
+
)
|
155 |
+
|
156 |
+
# 6. If usable, save the final linked data
|
157 |
+
if is_usable:
|
158 |
+
linked_data.to_csv(out_data_file)
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE222616.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE222616"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE222616"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE222616.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE222616.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE222616.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/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 whether gene expression data is available
|
37 |
+
# From the background, the platform is an Affymetrix gene expression array.
|
38 |
+
is_gene_available = True
|
39 |
+
|
40 |
+
# 2. Identify data availability for trait, age, and gender
|
41 |
+
# Based on the sample characteristics dictionary, the 'trait' is constant ("Acute myeloid leukaemia"),
|
42 |
+
# and there is no indication of age or gender. Hence they are not useful/available.
|
43 |
+
trait_row = None
|
44 |
+
age_row = None
|
45 |
+
gender_row = None
|
46 |
+
|
47 |
+
# Since they are all None, we do not need converter functions for actual data processing.
|
48 |
+
# But we still define stubs per requirement (they won't be used).
|
49 |
+
def convert_trait(value: str):
|
50 |
+
return None
|
51 |
+
|
52 |
+
def convert_age(value: str):
|
53 |
+
return None
|
54 |
+
|
55 |
+
def convert_gender(value: str):
|
56 |
+
return None
|
57 |
+
|
58 |
+
# 3. Save metadata via initial filtering
|
59 |
+
# If 'trait_row' is None, 'is_trait_available' is False and the dataset fails initial filtering.
|
60 |
+
is_trait_available = (trait_row is not None)
|
61 |
+
validate_and_save_cohort_info(
|
62 |
+
is_final=False,
|
63 |
+
cohort=cohort,
|
64 |
+
info_path=json_path,
|
65 |
+
is_gene_available=is_gene_available,
|
66 |
+
is_trait_available=is_trait_available
|
67 |
+
)
|
68 |
+
|
69 |
+
# 4. Since trait_row is None (trait not available), we skip clinical feature extraction.
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE235070.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE235070"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE235070"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE235070.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE235070.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE235070.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/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: Determine if gene expression data is available
|
37 |
+
is_gene_available = True # Based on dataset description (non-miRNA and non-methylation)
|
38 |
+
|
39 |
+
# Step 2: Identify variable availability and define conversion functions
|
40 |
+
trait_row = None # Only one unique value ("patient with AML"), so no variation
|
41 |
+
age_row = None # No age information found
|
42 |
+
gender_row = None # No gender information found
|
43 |
+
|
44 |
+
def convert_trait(value: str):
|
45 |
+
# Not used; trait is not available (no variation)
|
46 |
+
return None
|
47 |
+
|
48 |
+
def convert_age(value: str):
|
49 |
+
# Not used; no age information
|
50 |
+
return None
|
51 |
+
|
52 |
+
def convert_gender(value: str):
|
53 |
+
# Not used; no gender information
|
54 |
+
return None
|
55 |
+
|
56 |
+
# Step 3: Save metadata with initial filtering
|
57 |
+
is_trait_available = False # No meaningful trait variation
|
58 |
+
is_usable = validate_and_save_cohort_info(
|
59 |
+
is_final=False,
|
60 |
+
cohort=cohort,
|
61 |
+
info_path=json_path,
|
62 |
+
is_gene_available=is_gene_available,
|
63 |
+
is_trait_available=is_trait_available
|
64 |
+
)
|
65 |
+
|
66 |
+
print("is_usable:", is_usable)
|
67 |
+
|
68 |
+
# Step 4: Since trait_row is None, skip clinical feature extraction
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE249638.py
ADDED
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE249638"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE249638"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE249638.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE249638.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE249638.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/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 gene expression data availability
|
37 |
+
is_gene_available = True # Based on "comprehensive transcriptomic profiling"
|
38 |
+
|
39 |
+
# 2) Determine data availability for trait, age, and gender
|
40 |
+
# By examining the sample characteristics dictionary, we see:
|
41 |
+
# - Row 1 has "disease: acute myeloid leukemia" and "disease: healthy control"
|
42 |
+
# which are relevant to our 'trait'. So we set trait_row = 1.
|
43 |
+
# - No rows indicate age or gender. Hence, age_row = None and gender_row = None.
|
44 |
+
|
45 |
+
trait_row = 1
|
46 |
+
age_row = None
|
47 |
+
gender_row = None
|
48 |
+
|
49 |
+
# 2) Data type conversion functions
|
50 |
+
def convert_trait(value: str):
|
51 |
+
"""
|
52 |
+
Convert disease information into a binary variable.
|
53 |
+
'acute myeloid leukemia' -> 1
|
54 |
+
'healthy control' -> 0
|
55 |
+
Unknown values -> None
|
56 |
+
"""
|
57 |
+
# Split by colon and take the latter part
|
58 |
+
parts = value.split(":")
|
59 |
+
if len(parts) < 2:
|
60 |
+
return None
|
61 |
+
val = parts[1].strip().lower()
|
62 |
+
if "acute myeloid leukemia" in val:
|
63 |
+
return 1
|
64 |
+
elif "healthy control" in val:
|
65 |
+
return 0
|
66 |
+
else:
|
67 |
+
return None
|
68 |
+
|
69 |
+
def convert_age(value: str):
|
70 |
+
"""
|
71 |
+
No age information is available for this dataset, so this function will not be used.
|
72 |
+
"""
|
73 |
+
return None
|
74 |
+
|
75 |
+
def convert_gender(value: str):
|
76 |
+
"""
|
77 |
+
No gender information is available for this dataset, so this function will not be used.
|
78 |
+
"""
|
79 |
+
return None
|
80 |
+
|
81 |
+
# 3) Conduct initial filtering on dataset usability
|
82 |
+
# Trait data availability is determined by whether trait_row is None or not.
|
83 |
+
is_trait_available = (trait_row is not None)
|
84 |
+
|
85 |
+
is_usable = validate_and_save_cohort_info(
|
86 |
+
is_final=False,
|
87 |
+
cohort=cohort,
|
88 |
+
info_path=json_path,
|
89 |
+
is_gene_available=is_gene_available,
|
90 |
+
is_trait_available=is_trait_available
|
91 |
+
)
|
92 |
+
|
93 |
+
# 4) If trait_row is not None, extract clinical features
|
94 |
+
if trait_row is not None:
|
95 |
+
selected_clinical_df = geo_select_clinical_features(
|
96 |
+
clinical_df=clinical_data, # assumes 'clinical_data' is already available in the environment
|
97 |
+
trait=trait,
|
98 |
+
trait_row=trait_row,
|
99 |
+
convert_trait=convert_trait,
|
100 |
+
age_row=age_row,
|
101 |
+
convert_age=convert_age,
|
102 |
+
gender_row=gender_row,
|
103 |
+
convert_gender=convert_gender
|
104 |
+
)
|
105 |
+
|
106 |
+
# Preview the extracted clinical features
|
107 |
+
preview = preview_df(selected_clinical_df)
|
108 |
+
print("Preview of selected clinical data:", preview)
|
109 |
+
|
110 |
+
# Save the extracted clinical data
|
111 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
112 |
+
# STEP3
|
113 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
114 |
+
gene_data = get_genetic_data(matrix_file)
|
115 |
+
|
116 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
117 |
+
print(gene_data.index[:20])
|
118 |
+
# Based on the provided identifiers (e.g., "2824546_st"), these are likely Affymetrix microarray probe set IDs,
|
119 |
+
# not standard human gene symbols. Therefore, gene symbol mapping is required.
|
120 |
+
requires_gene_mapping = True
|
121 |
+
# STEP5
|
122 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
123 |
+
gene_annotation = get_gene_annotation(soft_file)
|
124 |
+
|
125 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
126 |
+
print("Gene annotation preview:")
|
127 |
+
print(preview_df(gene_annotation))
|
128 |
+
# STEP 6: Gene Identifier Mapping
|
129 |
+
|
130 |
+
# In this dataset, the probe IDs in gene_data (e.g., "2824546_st")
|
131 |
+
# do not match any column in gene_annotation (which has values like "TC01000001.hg.1").
|
132 |
+
# We will check if there's any column overlap; if not, we cannot proceed with proper mapping.
|
133 |
+
|
134 |
+
gene_annotation_cols = list(gene_annotation.columns)
|
135 |
+
gene_data_index_set = set(gene_data.index)
|
136 |
+
|
137 |
+
matched_column = None
|
138 |
+
for col in gene_annotation_cols:
|
139 |
+
# Convert to string in case of mixed types
|
140 |
+
col_values_set = set(gene_annotation[col].astype(str))
|
141 |
+
overlap = gene_data_index_set & col_values_set
|
142 |
+
if len(overlap) > 0:
|
143 |
+
matched_column = col
|
144 |
+
print(f"Found {len(overlap)} matching IDs in annotation column '{col}'.")
|
145 |
+
break
|
146 |
+
|
147 |
+
if not matched_column:
|
148 |
+
# No column in gene_annotation matches the probe IDs in gene_data
|
149 |
+
print("No matching column found in gene_annotation for gene_data index. "
|
150 |
+
"Skipping mapping; gene_data remains at probe-level.")
|
151 |
+
else:
|
152 |
+
# If we found a column for probe mapping, pick a column for gene symbols.
|
153 |
+
# By inspecting the annotation preview, 'gene_assignment' often contains a recognizable symbol.
|
154 |
+
# We'll assume that's our gene information column.
|
155 |
+
print(f"Using '{matched_column}' as probe identifier column and 'gene_assignment' for gene symbols.")
|
156 |
+
|
157 |
+
mapping_df = get_gene_mapping(
|
158 |
+
annotation=gene_annotation,
|
159 |
+
prob_col=matched_column,
|
160 |
+
gene_col='gene_assignment'
|
161 |
+
)
|
162 |
+
|
163 |
+
# Now apply the mapping to convert probe-level data to gene-level data
|
164 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
165 |
+
|
166 |
+
print("Gene-level expression data shape:", gene_data.shape)
|
167 |
+
print("Gene-level expression data (head):")
|
168 |
+
print(gene_data.head())
|
169 |
+
# STEP 7
|
170 |
+
|
171 |
+
# 1. Normalize gene symbols in the gene_data, then save to CSV.
|
172 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
173 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
174 |
+
|
175 |
+
# 2. Link the clinical and gene expression data
|
176 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
177 |
+
|
178 |
+
# 3. Handle missing values
|
179 |
+
linked_data = handle_missing_values(linked_data, trait_col=trait)
|
180 |
+
|
181 |
+
# 4. Determine whether the trait/demographic features are severely biased
|
182 |
+
is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait=trait)
|
183 |
+
|
184 |
+
# 5. Final quality validation and metadata saving
|
185 |
+
is_usable = validate_and_save_cohort_info(
|
186 |
+
is_final=True,
|
187 |
+
cohort=cohort,
|
188 |
+
info_path=json_path,
|
189 |
+
is_gene_available=True,
|
190 |
+
is_trait_available=True,
|
191 |
+
is_biased=is_trait_biased,
|
192 |
+
df=linked_data,
|
193 |
+
note="AML vs healthy controls; microarray-based expression data."
|
194 |
+
)
|
195 |
+
|
196 |
+
# 6. If usable, save the final linked data
|
197 |
+
if is_usable:
|
198 |
+
linked_data.to_csv(out_data_file)
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE98578.py
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE98578"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE98578"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE98578.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE98578.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE98578.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/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. Gene Expression Data Availability
|
37 |
+
is_gene_available = True # Based on the description, this dataset is about gene expression in AML cell lines
|
38 |
+
|
39 |
+
# 2. Variable Availability and Data Type Conversion
|
40 |
+
|
41 |
+
# From the sample characteristics, we see that the entire dataset consists of AML cell lines (all are AML),
|
42 |
+
# so there is no variation for the main trait "Acute_Myeloid_Leukemia." Hence, it's effectively constant
|
43 |
+
# and considered not available for our association studies.
|
44 |
+
trait_row = None
|
45 |
+
|
46 |
+
# Similarly, there is no age or gender information in the sample characteristics.
|
47 |
+
age_row = None
|
48 |
+
gender_row = None
|
49 |
+
|
50 |
+
# Define data conversion functions (stubs that return None here, since the rows are not available).
|
51 |
+
def convert_trait(value: str):
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_age(value: str):
|
55 |
+
return None
|
56 |
+
|
57 |
+
def convert_gender(value: str):
|
58 |
+
return None
|
59 |
+
|
60 |
+
# 3. Save Metadata (initial filtering)
|
61 |
+
# trait data availability can be determined by whether trait_row is None
|
62 |
+
is_trait_available = (trait_row is not None)
|
63 |
+
|
64 |
+
validate_and_save_cohort_info(
|
65 |
+
is_final=False,
|
66 |
+
cohort=cohort,
|
67 |
+
info_path=json_path,
|
68 |
+
is_gene_available=is_gene_available,
|
69 |
+
is_trait_available=is_trait_available
|
70 |
+
)
|
71 |
+
|
72 |
+
# 4. Clinical Feature Extraction
|
73 |
+
# Since trait_row is None, we skip the clinical feature extraction substep.
|
74 |
+
# STEP3
|
75 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
76 |
+
gene_data = get_genetic_data(matrix_file)
|
77 |
+
|
78 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
79 |
+
print(gene_data.index[:20])
|
80 |
+
# Based on the provided indices, these are Affymetrix microarray probe identifiers rather than standard gene symbols.
|
81 |
+
print("requires_gene_mapping = True")
|
82 |
+
# STEP5
|
83 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
84 |
+
gene_annotation = get_gene_annotation(soft_file)
|
85 |
+
|
86 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
87 |
+
print("Gene annotation preview:")
|
88 |
+
print(preview_df(gene_annotation))
|
89 |
+
# STEP: Gene Identifier Mapping
|
90 |
+
|
91 |
+
# 1. Identify the columns for probe ID (matching the gene expression identifiers) and gene symbol
|
92 |
+
probe_col = "ID"
|
93 |
+
gene_col = "Gene Symbol"
|
94 |
+
|
95 |
+
# 2. Build the gene mapping dataframe from the gene annotation
|
96 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_col)
|
97 |
+
|
98 |
+
# 3. Convert the probe-level gene expression data to gene-level by applying the mapping
|
99 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
100 |
+
|
101 |
+
# (Optional) Quickly inspect the resulting gene-level dataframe
|
102 |
+
print("Gene-level data preview:")
|
103 |
+
print(gene_data.head())
|
104 |
+
# STEP 7
|
105 |
+
|
106 |
+
import pandas as pd
|
107 |
+
|
108 |
+
# 1. Normalize gene symbols in the gene_data, then save to CSV.
|
109 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
110 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
111 |
+
|
112 |
+
# Since in previous steps we concluded trait_row=None (i.e., we have no trait data),
|
113 |
+
# there's no clinical dataframe to link and no trait to analyze. Hence, the dataset
|
114 |
+
# is not usable for trait association. We still finalize the metadata accordingly.
|
115 |
+
|
116 |
+
# 2. Because trait data is unavailable, skip linking and bias steps.
|
117 |
+
# Mark the dataset as not usable for the specified trait, and record in cohort info.
|
118 |
+
|
119 |
+
dummy_df = pd.DataFrame() # we need a dataframe to pass to validation
|
120 |
+
is_usable = validate_and_save_cohort_info(
|
121 |
+
is_final=True,
|
122 |
+
cohort=cohort,
|
123 |
+
info_path=json_path,
|
124 |
+
is_gene_available=True, # We do have gene expression
|
125 |
+
is_trait_available=False, # No trait data
|
126 |
+
is_biased=True, # Force "biased" so that it's deemed unusable
|
127 |
+
df=dummy_df,
|
128 |
+
note="No trait data was found in this cohort."
|
129 |
+
)
|
130 |
+
|
131 |
+
# 3. Since there is no trait data, we do not save any linked dataframe.
|
p1/preprocess/Acute_Myeloid_Leukemia/code/GSE99612.py
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
cohort = "GSE99612"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Acute_Myeloid_Leukemia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Acute_Myeloid_Leukemia/GSE99612"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/GSE99612.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/GSE99612.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/GSE99612.csv"
|
16 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/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 |
+
import re
|
37 |
+
import pandas as pd
|
38 |
+
|
39 |
+
# 1. Gene Expression Data Availability
|
40 |
+
is_gene_available = True # Based on the series title indicating "gene expression profiles"
|
41 |
+
|
42 |
+
# 2. Variable Availability and Data Type Conversion
|
43 |
+
# After inspecting the sample characteristics, we decide:
|
44 |
+
trait_row = 0 # We will interpret "cell line: THP-1" as AML, and "cell line: Caco-2" as not AML.
|
45 |
+
age_row = 3 # We can parse "patient age: 1 year infant" from this row; "tumor origin" rows will be None.
|
46 |
+
gender_row = None # Available data appear to be solely male or inconsistent entries. Treat as not available.
|
47 |
+
|
48 |
+
# Define conversion functions
|
49 |
+
def convert_trait(value: str):
|
50 |
+
if not isinstance(value, str):
|
51 |
+
return None
|
52 |
+
# Extract the string portion after the colon if present
|
53 |
+
parts = value.split(':', 1)
|
54 |
+
val = parts[-1].strip().lower()
|
55 |
+
# Heuristic: THP-1 => 1 (AML), otherwise 0
|
56 |
+
if "thp-1" in val:
|
57 |
+
return 1
|
58 |
+
elif "caco-2" in val:
|
59 |
+
return 0
|
60 |
+
return None
|
61 |
+
|
62 |
+
def convert_age(value: str):
|
63 |
+
if not isinstance(value, str):
|
64 |
+
return None
|
65 |
+
# Extract the string portion after the colon if present
|
66 |
+
parts = value.split(':', 1)
|
67 |
+
val = parts[-1].strip().lower()
|
68 |
+
# Heuristic: find a numeric age if "year" is mentioned
|
69 |
+
match = re.search(r'(\d+)', val)
|
70 |
+
if match:
|
71 |
+
return float(match.group(1))
|
72 |
+
return None
|
73 |
+
|
74 |
+
# Not needed since gender data is not available
|
75 |
+
convert_gender = None
|
76 |
+
|
77 |
+
# 3. Save Metadata (initial filtering)
|
78 |
+
# Trait availability is determined by trait_row not being None
|
79 |
+
is_trait_available = (trait_row is not None)
|
80 |
+
|
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. Clinical Feature Extraction
|
90 |
+
# Only proceed if trait data is available
|
91 |
+
if trait_row is not None:
|
92 |
+
# Suppose 'clinical_data' is a DataFrame loaded in a previous step
|
93 |
+
# (It is assumed to be accessible in the environment)
|
94 |
+
selected_clinical_df = geo_select_clinical_features(
|
95 |
+
clinical_df=clinical_data,
|
96 |
+
trait=trait,
|
97 |
+
trait_row=trait_row,
|
98 |
+
convert_trait=convert_trait,
|
99 |
+
age_row=age_row,
|
100 |
+
convert_age=convert_age,
|
101 |
+
gender_row=gender_row,
|
102 |
+
convert_gender=convert_gender
|
103 |
+
)
|
104 |
+
|
105 |
+
# Preview the extracted features
|
106 |
+
preview = preview_df(selected_clinical_df)
|
107 |
+
print("Preview of selected clinical data:", preview)
|
108 |
+
|
109 |
+
# Save to CSV
|
110 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
111 |
+
# STEP3
|
112 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
113 |
+
gene_data = get_genetic_data(matrix_file)
|
114 |
+
|
115 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
116 |
+
print(gene_data.index[:20])
|
117 |
+
# Based on the numeric format of these identifiers, they do not appear to be human gene symbols.
|
118 |
+
# Therefore, a mapping step is required.
|
119 |
+
print("requires_gene_mapping = True")
|
120 |
+
# STEP5
|
121 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
122 |
+
gene_annotation = get_gene_annotation(soft_file)
|
123 |
+
|
124 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
125 |
+
print("Gene annotation preview:")
|
126 |
+
print(preview_df(gene_annotation))
|
127 |
+
# Gene Identifier Mapping
|
128 |
+
|
129 |
+
# 1 & 2. Decide which columns in the annotation match the gene-data IDs and gene symbols.
|
130 |
+
# In this dataset, the 'ID' column corresponds to the probe identifiers (matching gene_data.index),
|
131 |
+
# and 'gene_assignment' contains references from which we can extract human gene symbols.
|
132 |
+
|
133 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="gene_assignment")
|
134 |
+
|
135 |
+
# 3. Convert probe-level measurements to gene expression data by applying the gene mapping.
|
136 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
137 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
138 |
+
# STEP7
|
139 |
+
# 1. Normalize the obtained gene data with the 'normalize_gene_symbols_in_index' function from the library.
|
140 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
141 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
142 |
+
|
143 |
+
# 2. Link the clinical and genetic data with the 'geo_link_clinical_genetic_data' function from the library.
|
144 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
145 |
+
|
146 |
+
# 3. Handle missing values in the linked data
|
147 |
+
linked_data = handle_missing_values(linked_data, trait)
|
148 |
+
|
149 |
+
# 4. Determine whether the trait and some demographic features are severely biased, and remove biased features.
|
150 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
151 |
+
|
152 |
+
# 5. Conduct quality check and save the cohort information using the final dataset (after bias removal).
|
153 |
+
is_usable = validate_and_save_cohort_info(
|
154 |
+
is_final=True,
|
155 |
+
cohort=cohort,
|
156 |
+
info_path=json_path,
|
157 |
+
is_gene_available=True,
|
158 |
+
is_trait_available=True,
|
159 |
+
is_biased=is_trait_biased,
|
160 |
+
df=unbiased_linked_data
|
161 |
+
)
|
162 |
+
|
163 |
+
# 6. If the linked data is usable, save it as a CSV file to 'out_data_file'.
|
164 |
+
if is_usable:
|
165 |
+
unbiased_linked_data.to_csv(out_data_file)
|
p1/preprocess/Acute_Myeloid_Leukemia/code/TCGA.py
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Acute_Myeloid_Leukemia"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/1/Acute_Myeloid_Leukemia/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/1/Acute_Myeloid_Leukemia/cohort_info.json"
|
15 |
+
|
16 |
+
import os
|
17 |
+
import pandas as pd
|
18 |
+
|
19 |
+
# 1. Identify the relevant subdirectory
|
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 |
+
target_subdir = None
|
37 |
+
for sd in subdirectories:
|
38 |
+
if 'Acute_Myeloid_Leukemia' in sd or 'LAML' in sd:
|
39 |
+
target_subdir = sd
|
40 |
+
break
|
41 |
+
|
42 |
+
if target_subdir is None:
|
43 |
+
# No suitable data found for this trait; mark as completed
|
44 |
+
print("No TCGA subdirectory found for the trait. Skipping.")
|
45 |
+
else:
|
46 |
+
cohort_dir = os.path.join(tcga_root_dir, target_subdir)
|
47 |
+
# 2. Locate clinical and genetic data files
|
48 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
49 |
+
|
50 |
+
# 3. Load the data
|
51 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
52 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
53 |
+
|
54 |
+
# 4. Print column names of clinical data
|
55 |
+
print(clinical_df.columns)
|
56 |
+
candidate_age_cols = ["age_at_initial_pathologic_diagnosis", "days_to_birth"]
|
57 |
+
candidate_gender_cols = ["gender"]
|
58 |
+
|
59 |
+
print(f"candidate_age_cols = {candidate_age_cols}")
|
60 |
+
print(f"candidate_gender_cols = {candidate_gender_cols}")
|
61 |
+
|
62 |
+
age_data = clinical_df[candidate_age_cols] if candidate_age_cols else pd.DataFrame()
|
63 |
+
gender_data = clinical_df[candidate_gender_cols] if candidate_gender_cols else pd.DataFrame()
|
64 |
+
|
65 |
+
print(preview_df(age_data))
|
66 |
+
print(preview_df(gender_data))
|
67 |
+
# Step: Select Demographic Features
|
68 |
+
|
69 |
+
# 1. Decide the best columns for age and gender based on the candidate dictionaries
|
70 |
+
age_col = "age_at_initial_pathologic_diagnosis"
|
71 |
+
gender_col = "gender"
|
72 |
+
|
73 |
+
# 2. Print out the chosen columns
|
74 |
+
print("Chosen column for age_col:", age_col)
|
75 |
+
print("Chosen column for gender_col:", gender_col)
|
76 |
+
# 1. Extract and standardize the clinical features
|
77 |
+
selected_clinical_df = tcga_select_clinical_features(
|
78 |
+
clinical_df=clinical_df,
|
79 |
+
trait=trait,
|
80 |
+
age_col=age_col,
|
81 |
+
gender_col=gender_col
|
82 |
+
)
|
83 |
+
|
84 |
+
# (Optional) Save the selected clinical data
|
85 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
86 |
+
|
87 |
+
# 2. Normalize gene symbols in the genetic data
|
88 |
+
normalized_gene_df = normalize_gene_symbols_in_index(genetic_df)
|
89 |
+
normalized_gene_df.to_csv(out_gene_data_file)
|
90 |
+
|
91 |
+
# 3. Link the clinical and genetic data on sample IDs
|
92 |
+
linked_data = selected_clinical_df.join(normalized_gene_df.T, how="inner")
|
93 |
+
|
94 |
+
# 4. Handle missing values
|
95 |
+
cleaned_df = handle_missing_values(linked_data, trait)
|
96 |
+
|
97 |
+
# 5. Determine if the trait or demographic features are biased
|
98 |
+
is_biased, final_df = judge_and_remove_biased_features(cleaned_df, trait)
|
99 |
+
|
100 |
+
# 6. Final quality validation
|
101 |
+
is_gene_available = not normalized_gene_df.empty
|
102 |
+
is_trait_available = trait in final_df.columns
|
103 |
+
is_usable = validate_and_save_cohort_info(
|
104 |
+
is_final=True,
|
105 |
+
cohort="TCGA",
|
106 |
+
info_path=json_path,
|
107 |
+
is_gene_available=is_gene_available,
|
108 |
+
is_trait_available=is_trait_available,
|
109 |
+
is_biased=is_biased,
|
110 |
+
df=final_df,
|
111 |
+
note=""
|
112 |
+
)
|
113 |
+
|
114 |
+
# 7. If the dataset is usable, save the final dataframe
|
115 |
+
if is_usable:
|
116 |
+
final_df.to_csv(out_data_file)
|
p1/preprocess/Acute_Myeloid_Leukemia/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE99612": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 48, "note": ""}, "GSE98578": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data was found in this cohort."}, "GSE249638": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 37, "note": "AML vs healthy controls; microarray-based expression data."}, "GSE235070": {"is_usable": false, "is_gene_available": true, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}, "GSE222616": {"is_usable": false, "is_gene_available": true, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}, "GSE222169": {"is_usable": false, "is_gene_available": true, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}, "GSE222124": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 70, "note": "AML vs healthy controls; microarray-based expression data."}, "GSE161532": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data. Clinical linking skipped."}, "GSE121431": {"is_usable": false, "is_gene_available": true, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}, "GSE121291": {"is_usable": false, "is_gene_available": true, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "Gene expression data present, but no trait data. Cannot perform linking or trait-based QC."}, "TCGA": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": true, "has_gender": true, "sample_size": 173, "note": ""}}
|
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE121291.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE121431.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE161532.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ae094fd44ffdb2064749e93c9c255eccc2b693de639f51192307937aa3f633a9
|
3 |
+
size 21846516
|
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE222124.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6319bb65acae88602deba7d1071159a0063a8285cba179bce5e69266084b9ad6
|
3 |
+
size 13764911
|
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE222169.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f5bf77b5f865b1a36b64d02b6b2e0229ec0aa0541e888db4ff14e1e70fb0fee2
|
3 |
+
size 13872362
|
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE249638.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:beb01a1b4d6ce6bfe33f9527b86089b96c1ac7097d853640fab00e39553857d2
|
3 |
+
size 11134286
|
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE98578.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fae270923854acd2f88d5d6400c735f3de856d961d4845b203a4b2a0caeaf12b
|
3 |
+
size 12728359
|
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE99612.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:129f90c5436b013818b7c3159de5abc8ad9769ea8258c61872a72381e06ed10e
|
3 |
+
size 11929857
|
p1/preprocess/Adrenocortical_Cancer/GSE75415.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Adrenocortical_Cancer/GSE90713.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e0c16ee650e3fb8152630597741cf4feeffde26b7480a972d0d87021efc26232
|
3 |
+
size 16454332
|
p1/preprocess/Adrenocortical_Cancer/clinical_data/GSE68950.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
GSM1687570,GSM1687571,GSM1687572,GSM1687573,GSM1687574,GSM1687575,GSM1687576,GSM1687577,GSM1687578,GSM1687579,GSM1687580,GSM1687581,GSM1687582,GSM1687583,GSM1687584,GSM1687585,GSM1687586,GSM1687587,GSM1687588,GSM1687589,GSM1687590,GSM1687591,GSM1687592,GSM1687593,GSM1687594,GSM1687595,GSM1687596,GSM1687597,GSM1687598,GSM1687599,GSM1687600,GSM1687601,GSM1687602,GSM1687603,GSM1687604,GSM1687605,GSM1687606,GSM1687607,GSM1687608,GSM1687609,GSM1687610,GSM1687611,GSM1687612,GSM1687613,GSM1687614,GSM1687615,GSM1687616,GSM1687617,GSM1687618,GSM1687619,GSM1687620,GSM1687621,GSM1687622,GSM1687623,GSM1687624,GSM1687625,GSM1687626,GSM1687627,GSM1687628,GSM1687629,GSM1687630,GSM1687631,GSM1687632,GSM1687633,GSM1687634,GSM1687635,GSM1687636,GSM1687637,GSM1687638,GSM1687639,GSM1687640,GSM1687641,GSM1687642,GSM1687643,GSM1687644,GSM1687645,GSM1687646,GSM1687647,GSM1687648,GSM1687649,GSM1687650,GSM1687651,GSM1687652,GSM1687653,GSM1687654,GSM1687655,GSM1687656,GSM1687657,GSM1687658,GSM1687659,GSM1687660,GSM1687661,GSM1687662,GSM1687663,GSM1687664,GSM1687665,GSM1687666,GSM1687667,GSM1687668,GSM1687669,GSM1687670,GSM1687671,GSM1687672,GSM1687673,GSM1687674,GSM1687675,GSM1687676,GSM1687677,GSM1687678,GSM1687679,GSM1687680,GSM1687681,GSM1687682,GSM1687683,GSM1687684,GSM1687685,GSM1687686,GSM1687687,GSM1687688,GSM1687689,GSM1687690,GSM1687691,GSM1687692,GSM1687693,GSM1687694,GSM1687695,GSM1687696,GSM1687697,GSM1687698,GSM1687699,GSM1687700,GSM1687701,GSM1687702,GSM1687703,GSM1687704,GSM1687705,GSM1687706,GSM1687707,GSM1687708,GSM1687709,GSM1687710,GSM1687711,GSM1687712,GSM1687713,GSM1687714,GSM1687715,GSM1687716,GSM1687717,GSM1687718,GSM1687719,GSM1687720,GSM1687721,GSM1687722,GSM1687723,GSM1687724,GSM1687725,GSM1687726,GSM1687727,GSM1687728,GSM1687729,GSM1687730,GSM1687731,GSM1687732,GSM1687733,GSM1687734,GSM1687735,GSM1687736,GSM1687737,GSM1687738,GSM1687739,GSM1687740,GSM1687741,GSM1687742,GSM1687743,GSM1687744,GSM1687745,GSM1687746,GSM1687747,GSM1687748,GSM1687749,GSM1687750,GSM1687751,GSM1687752,GSM1687753,GSM1687754,GSM1687755,GSM1687756,GSM1687757,GSM1687758,GSM1687759,GSM1687760,GSM1687761,GSM1687762,GSM1687763,GSM1687764,GSM1687765,GSM1687766,GSM1687767,GSM1687768,GSM1687769,GSM1687770,GSM1687771,GSM1687772,GSM1687773,GSM1687774,GSM1687775,GSM1687776,GSM1687777,GSM1687778,GSM1687779,GSM1687780,GSM1687781,GSM1687782,GSM1687783,GSM1687784,GSM1687785,GSM1687786,GSM1687787,GSM1687788,GSM1687789,GSM1687790,GSM1687791,GSM1687792,GSM1687793,GSM1687794,GSM1687795,GSM1687796,GSM1687797,GSM1687798,GSM1687799,GSM1687800,GSM1687801,GSM1687802,GSM1687803,GSM1687804,GSM1687805,GSM1687806,GSM1687807,GSM1687808,GSM1687809,GSM1687810,GSM1687811,GSM1687812,GSM1687813,GSM1687814,GSM1687815,GSM1687816,GSM1687817,GSM1687818,GSM1687819,GSM1687820,GSM1687821,GSM1687822,GSM1687823,GSM1687824,GSM1687825,GSM1687826,GSM1687827,GSM1687828,GSM1687829,GSM1687830,GSM1687831,GSM1687832,GSM1687833,GSM1687834,GSM1687835,GSM1687836,GSM1687837,GSM1687838,GSM1687839,GSM1687840,GSM1687841,GSM1687842,GSM1687843,GSM1687844,GSM1687845,GSM1687846,GSM1687847,GSM1687848,GSM1687849,GSM1687850,GSM1687851,GSM1687852,GSM1687853,GSM1687854,GSM1687855,GSM1687856,GSM1687857,GSM1687858,GSM1687859,GSM1687860,GSM1687861,GSM1687862,GSM1687863,GSM1687864,GSM1687865,GSM1687866,GSM1687867,GSM1687868,GSM1687869,GSM1687870,GSM1687871,GSM1687872,GSM1687873,GSM1687874,GSM1687875,GSM1687876,GSM1687877,GSM1687878,GSM1687879,GSM1687880,GSM1687881,GSM1687882,GSM1687883,GSM1687884,GSM1687885,GSM1687886,GSM1687887,GSM1687888,GSM1687889,GSM1687890,GSM1687891,GSM1687892,GSM1687893,GSM1687894,GSM1687895,GSM1687896,GSM1687897,GSM1687898,GSM1687899,GSM1687900,GSM1687901,GSM1687902,GSM1687903,GSM1687904,GSM1687905,GSM1687906,GSM1687907,GSM1687908,GSM1687909,GSM1687910,GSM1687911,GSM1687912,GSM1687913,GSM1687914,GSM1687915,GSM1687916,GSM1687917,GSM1687918,GSM1687919,GSM1687920,GSM1687921,GSM1687922,GSM1687923,GSM1687924,GSM1687925,GSM1687926,GSM1687927,GSM1687928,GSM1687929,GSM1687930,GSM1687931,GSM1687932,GSM1687933,GSM1687934,GSM1687935,GSM1687936,GSM1687937,GSM1687938,GSM1687939,GSM1687940,GSM1687941,GSM1687942,GSM1687943,GSM1687944,GSM1687945,GSM1687946,GSM1687947,GSM1687948,GSM1687949,GSM1687950,GSM1687951,GSM1687952,GSM1687953,GSM1687954,GSM1687955,GSM1687956,GSM1687957,GSM1687958,GSM1687959,GSM1687960,GSM1687961,GSM1687962,GSM1687963,GSM1687964,GSM1687965,GSM1687966,GSM1687967,GSM1687968,GSM1687969,GSM1687970,GSM1687971,GSM1687972,GSM1687973,GSM1687974,GSM1687975,GSM1687976,GSM1687977,GSM1687978,GSM1687979,GSM1687980,GSM1687981,GSM1687982,GSM1687983,GSM1687984,GSM1687985,GSM1687986,GSM1687987,GSM1687988,GSM1687989,GSM1687990,GSM1687991,GSM1687992,GSM1687993,GSM1687994,GSM1687995,GSM1687996,GSM1687997,GSM1687998,GSM1687999,GSM1688000,GSM1688001,GSM1688002,GSM1688003,GSM1688004,GSM1688005,GSM1688006,GSM1688007,GSM1688008,GSM1688009,GSM1688010,GSM1688011,GSM1688012,GSM1688013,GSM1688014,GSM1688015,GSM1688016,GSM1688017,GSM1688018,GSM1688019,GSM1688020,GSM1688021,GSM1688022,GSM1688023,GSM1688024,GSM1688025,GSM1688026,GSM1688027,GSM1688028,GSM1688029,GSM1688030,GSM1688031,GSM1688032,GSM1688033,GSM1688034,GSM1688035,GSM1688036,GSM1688037,GSM1688038,GSM1688039,GSM1688040,GSM1688041,GSM1688042,GSM1688043,GSM1688044,GSM1688045,GSM1688046,GSM1688047,GSM1688048,GSM1688049,GSM1688050,GSM1688051,GSM1688052,GSM1688053,GSM1688054,GSM1688055,GSM1688056,GSM1688057,GSM1688058,GSM1688059,GSM1688060,GSM1688061,GSM1688062,GSM1688063,GSM1688064,GSM1688065,GSM1688066,GSM1688067,GSM1688068,GSM1688069,GSM1688070,GSM1688071,GSM1688072,GSM1688073,GSM1688074,GSM1688075,GSM1688076,GSM1688077,GSM1688078,GSM1688079,GSM1688080,GSM1688081,GSM1688082,GSM1688083,GSM1688084,GSM1688085,GSM1688086,GSM1688087,GSM1688088,GSM1688089,GSM1688090,GSM1688091,GSM1688092,GSM1688093,GSM1688094,GSM1688095,GSM1688096,GSM1688097,GSM1688098,GSM1688099,GSM1688100,GSM1688101,GSM1688102,GSM1688103,GSM1688104,GSM1688105,GSM1688106,GSM1688107,GSM1688108,GSM1688109,GSM1688110,GSM1688111,GSM1688112,GSM1688113,GSM1688114,GSM1688115,GSM1688116,GSM1688117,GSM1688118,GSM1688119,GSM1688120,GSM1688121,GSM1688122,GSM1688123,GSM1688124,GSM1688125,GSM1688126,GSM1688127,GSM1688128,GSM1688129,GSM1688130,GSM1688131,GSM1688132,GSM1688133,GSM1688134,GSM1688135,GSM1688136,GSM1688137,GSM1688138,GSM1688139,GSM1688140,GSM1688141,GSM1688142,GSM1688143,GSM1688144,GSM1688145,GSM1688146,GSM1688147,GSM1688148,GSM1688149,GSM1688150,GSM1688151,GSM1688152,GSM1688153,GSM1688154,GSM1688155,GSM1688156,GSM1688157,GSM1688158,GSM1688159,GSM1688160,GSM1688161,GSM1688162,GSM1688163,GSM1688164,GSM1688165,GSM1688166,GSM1688167,GSM1688168,GSM1688169,GSM1688170,GSM1688171,GSM1688172,GSM1688173,GSM1688174,GSM1688175,GSM1688176,GSM1688177,GSM1688178,GSM1688179,GSM1688180,GSM1688181,GSM1688182,GSM1688183,GSM1688184,GSM1688185,GSM1688186,GSM1688187,GSM1688188,GSM1688189,GSM1688190,GSM1688191,GSM1688192,GSM1688193,GSM1688194,GSM1688195,GSM1688196,GSM1688197,GSM1688198,GSM1688199,GSM1688200,GSM1688201,GSM1688202,GSM1688203,GSM1688204,GSM1688205,GSM1688206,GSM1688207,GSM1688208,GSM1688209,GSM1688210,GSM1688211,GSM1688212,GSM1688213,GSM1688214,GSM1688215,GSM1688216,GSM1688217,GSM1688218,GSM1688219,GSM1688220,GSM1688221,GSM1688222,GSM1688223,GSM1688224,GSM1688225,GSM1688226,GSM1688227,GSM1688228,GSM1688229,GSM1688230,GSM1688231,GSM1688232,GSM1688233,GSM1688234,GSM1688235,GSM1688236,GSM1688237,GSM1688238,GSM1688239,GSM1688240,GSM1688241,GSM1688242,GSM1688243,GSM1688244,GSM1688245,GSM1688246,GSM1688247,GSM1688248,GSM1688249,GSM1688250,GSM1688251,GSM1688252,GSM1688253,GSM1688254,GSM1688255,GSM1688256,GSM1688257,GSM1688258,GSM1688259,GSM1688260,GSM1688261,GSM1688262,GSM1688263,GSM1688264,GSM1688265,GSM1688266,GSM1688267,GSM1688268,GSM1688269,GSM1688270,GSM1688271,GSM1688272,GSM1688273,GSM1688274,GSM1688275,GSM1688276,GSM1688277,GSM1688278,GSM1688279,GSM1688280,GSM1688281,GSM1688282,GSM1688283,GSM1688284,GSM1688285,GSM1688286,GSM1688287,GSM1688288,GSM1688289,GSM1688290,GSM1688291,GSM1688292,GSM1688293,GSM1688294,GSM1688295,GSM1688296,GSM1688297,GSM1688298,GSM1688299,GSM1688300,GSM1688301,GSM1688302,GSM1688303,GSM1688304,GSM1688305,GSM1688306,GSM1688307,GSM1688308,GSM1688309,GSM1688310,GSM1688311,GSM1688312,GSM1688313,GSM1688314,GSM1688315,GSM1688316,GSM1688317,GSM1688318,GSM1688319,GSM1688320,GSM1688321,GSM1688322,GSM1688323,GSM1688324,GSM1688325,GSM1688326,GSM1688327,GSM1688328,GSM1688329,GSM1688330,GSM1688331,GSM1688332,GSM1688333,GSM1688334,GSM1688335,GSM1688336,GSM1688337,GSM1688338,GSM1688339,GSM1688340,GSM1688341,GSM1688342,GSM1688343,GSM1688344,GSM1688345,GSM1688346,GSM1688347,GSM1688348,GSM1688349,GSM1688350,GSM1688351,GSM1688352,GSM1688353,GSM1688354,GSM1688355,GSM1688356,GSM1688357,GSM1688358,GSM1688359,GSM1688360,GSM1688361,GSM1688362,GSM1688363,GSM1688364,GSM1688365,GSM1688366,GSM1688367
|
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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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/Adrenocortical_Cancer/clinical_data/GSE75415.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
GSM1954726,GSM1954727,GSM1954728,GSM1954729,GSM1954730,GSM1954731,GSM1954732,GSM1954733,GSM1954734,GSM1954735,GSM1954736,GSM1954737,GSM1954738,GSM1954739,GSM1954740,GSM1954741,GSM1954742,GSM1954743,GSM1954744,GSM1954745,GSM1954746,GSM1954747,GSM1954748,GSM1954749,GSM1954750,GSM1954751,GSM1954752,GSM1954753,GSM1954754,GSM1954755,GSM1954756
|
2 |
+
0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
3 |
+
0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,,,,,,,,
|
p1/preprocess/Adrenocortical_Cancer/clinical_data/GSE90713.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
GSM2411058,GSM2411059,GSM2411060,GSM2411061,GSM2411062,GSM2411063,GSM2411064,GSM2411065,GSM2411066,GSM2411067,GSM2411068,GSM2411069,GSM2411070,GSM2411071,GSM2411072,GSM2411073,GSM2411074,GSM2411075,GSM2411076,GSM2411077,GSM2411078,GSM2411079,GSM2411080,GSM2411081,GSM2411082,GSM2411083,GSM2411084,GSM2411085,GSM2411086,GSM2411087,GSM2411088,GSM2411089,GSM2411090,GSM2411091,GSM2411092,GSM2411093,GSM2411094,GSM2411095,GSM2411096,GSM2411097,GSM2411098,GSM2411099,GSM2411100,GSM2411101,GSM2411102,GSM2411103,GSM2411104,GSM2411105,GSM2411106,GSM2411107,GSM2411108,GSM2411109,GSM2411110,GSM2411111,GSM2411112,GSM2411113,GSM2411114,GSM2411115,GSM2411116,GSM2411117,GSM2411118,GSM2411119,GSM2411120
|
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,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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/Adrenocortical_Cancer/clinical_data/TCGA.csv
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
sampleID,Adrenocortical_Cancer,Age
|
2 |
+
TCGA-OR-A5J1-01,1,58
|
3 |
+
TCGA-OR-A5J2-01,1,44
|
4 |
+
TCGA-OR-A5J3-01,1,23
|
5 |
+
TCGA-OR-A5J4-01,1,23
|
6 |
+
TCGA-OR-A5J5-01,1,30
|
7 |
+
TCGA-OR-A5J6-01,1,29
|
8 |
+
TCGA-OR-A5J7-01,1,30
|
9 |
+
TCGA-OR-A5J8-01,1,66
|
10 |
+
TCGA-OR-A5J9-01,1,22
|
11 |
+
TCGA-OR-A5JA-01,1,53
|
12 |
+
TCGA-OR-A5JB-01,1,52
|
13 |
+
TCGA-OR-A5JC-01,1,37
|
14 |
+
TCGA-OR-A5JD-01,1,57
|
15 |
+
TCGA-OR-A5JE-01,1,17
|
16 |
+
TCGA-OR-A5JF-01,1,69
|
17 |
+
TCGA-OR-A5JG-01,1,61
|
18 |
+
TCGA-OR-A5JH-01,1,32
|
19 |
+
TCGA-OR-A5JI-01,1,22
|
20 |
+
TCGA-OR-A5JJ-01,1,65
|
21 |
+
TCGA-OR-A5JK-01,1,49
|
22 |
+
TCGA-OR-A5JL-01,1,36
|
23 |
+
TCGA-OR-A5JM-01,1,25
|
24 |
+
TCGA-OR-A5JO-01,1,26
|
25 |
+
TCGA-OR-A5JP-01,1,40
|
26 |
+
TCGA-OR-A5JQ-01,1,26
|
27 |
+
TCGA-OR-A5JR-01,1,45
|
28 |
+
TCGA-OR-A5JS-01,1,65
|
29 |
+
TCGA-OR-A5JT-01,1,65
|
30 |
+
TCGA-OR-A5JU-01,1,58
|
31 |
+
TCGA-OR-A5JV-01,1,55
|
32 |
+
TCGA-OR-A5JW-01,1,47
|
33 |
+
TCGA-OR-A5JX-01,1,50
|
34 |
+
TCGA-OR-A5JY-01,1,68
|
35 |
+
TCGA-OR-A5JZ-01,1,60
|
36 |
+
TCGA-OR-A5K0-01,1,69
|
37 |
+
TCGA-OR-A5K1-01,1,48
|
38 |
+
TCGA-OR-A5K2-01,1,32
|
39 |
+
TCGA-OR-A5K3-01,1,53
|
40 |
+
TCGA-OR-A5K4-01,1,64
|
41 |
+
TCGA-OR-A5K5-01,1,59
|
42 |
+
TCGA-OR-A5K6-01,1,56
|
43 |
+
TCGA-OR-A5K8-01,1,39
|
44 |
+
TCGA-OR-A5K9-01,1,61
|
45 |
+
TCGA-OR-A5KB-01,1,61
|
46 |
+
TCGA-OR-A5KO-01,1,39
|
47 |
+
TCGA-OR-A5KP-01,1,45
|
48 |
+
TCGA-OR-A5KQ-01,1,20
|
49 |
+
TCGA-OR-A5KS-01,1,72
|
50 |
+
TCGA-OR-A5KT-01,1,44
|
51 |
+
TCGA-OR-A5KU-01,1,37
|
52 |
+
TCGA-OR-A5KV-01,1,17
|
53 |
+
TCGA-OR-A5KW-01,1,55
|
54 |
+
TCGA-OR-A5KX-01,1,25
|
55 |
+
TCGA-OR-A5KY-01,1,23
|
56 |
+
TCGA-OR-A5KZ-01,1,42
|
57 |
+
TCGA-OR-A5L1-01,1,37
|
58 |
+
TCGA-OR-A5L2-01,1,83
|
59 |
+
TCGA-OR-A5L3-01,1,67
|
60 |
+
TCGA-OR-A5L4-01,1,48
|
61 |
+
TCGA-OR-A5L5-01,1,77
|
62 |
+
TCGA-OR-A5L6-01,1,60
|
63 |
+
TCGA-OR-A5L8-01,1,36
|
64 |
+
TCGA-OR-A5L9-01,1,53
|
65 |
+
TCGA-OR-A5LA-01,1,52
|
66 |
+
TCGA-OR-A5LB-01,1,59
|
67 |
+
TCGA-OR-A5LC-01,1,71
|
68 |
+
TCGA-OR-A5LD-01,1,52
|
69 |
+
TCGA-OR-A5LE-01,1,14
|
70 |
+
TCGA-OR-A5LF-01,1,74
|
71 |
+
TCGA-OR-A5LG-01,1,46
|
72 |
+
TCGA-OR-A5LH-01,1,36
|
73 |
+
TCGA-OR-A5LI-01,1,42
|
74 |
+
TCGA-OR-A5LJ-01,1,54
|
75 |
+
TCGA-OR-A5LK-01,1,62
|
76 |
+
TCGA-OR-A5LL-01,1,75
|
77 |
+
TCGA-OR-A5LM-01,1,23
|
78 |
+
TCGA-OR-A5LN-01,1,31
|
79 |
+
TCGA-OR-A5LO-01,1,61
|
80 |
+
TCGA-OR-A5LP-01,1,37
|
81 |
+
TCGA-OR-A5LR-01,1,30
|
82 |
+
TCGA-OR-A5LS-01,1,34
|
83 |
+
TCGA-OR-A5LT-01,1,57
|
84 |
+
TCGA-OU-A5PI-01,1,53
|
85 |
+
TCGA-P6-A5OF-01,1,55
|
86 |
+
TCGA-P6-A5OG-01,1,45
|
87 |
+
TCGA-P6-A5OH-01,1,59
|
88 |
+
TCGA-PA-A5YG-01,1,51
|
89 |
+
TCGA-PK-A5H8-01,1,42
|
90 |
+
TCGA-PK-A5H9-01,1,27
|
91 |
+
TCGA-PK-A5HA-01,1,63
|
92 |
+
TCGA-PK-A5HB-01,1,63
|
93 |
+
TCGA-PK-A5HC-01,1,44
|
p1/preprocess/Adrenocortical_Cancer/code/GSE108088.py
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE108088"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE108088"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE108088.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE108088.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE108088.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
import pandas as pd
|
42 |
+
import numpy as np
|
43 |
+
|
44 |
+
# 1. Determine gene expression availability
|
45 |
+
# Based on the background info "comprehensive molecular profiling," we assume it includes gene expression data.
|
46 |
+
is_gene_available = True
|
47 |
+
|
48 |
+
# 2. Identify the keys for trait, age, and gender
|
49 |
+
# After examining the sample characteristics dictionary, there's no direct or inferred "Adrenocortical_Cancer,"
|
50 |
+
# no age info, and no gender info. Hence, we set them all to None.
|
51 |
+
trait_row = None
|
52 |
+
age_row = None
|
53 |
+
gender_row = None
|
54 |
+
|
55 |
+
# 2.1 and 2.2: Data type conversion functions
|
56 |
+
def convert_trait(raw_value: str):
|
57 |
+
# This function would parse the raw_value and return 0 or 1 if the trait is binary,
|
58 |
+
# or a float if continuous. Here, we have no trait data, so it's a placeholder.
|
59 |
+
# If used, ensure to handle unknown or malformed entries by returning None.
|
60 |
+
# We split by 'colon' if needed, but since trait_row is None, we won't use it.
|
61 |
+
return None
|
62 |
+
|
63 |
+
def convert_age(raw_value: str):
|
64 |
+
# Sample placeholder function. No age data is found, so it returns None.
|
65 |
+
return None
|
66 |
+
|
67 |
+
def convert_gender(raw_value: str):
|
68 |
+
# Sample placeholder function. No gender data is found, so it returns None.
|
69 |
+
return None
|
70 |
+
|
71 |
+
# 3. Conduct initial filtering on dataset usability, saving relevant metadata
|
72 |
+
# Trait data availability is determined by whether trait_row is None.
|
73 |
+
is_trait_available = (trait_row is not None)
|
74 |
+
|
75 |
+
_ = validate_and_save_cohort_info(
|
76 |
+
is_final=False,
|
77 |
+
cohort=cohort,
|
78 |
+
info_path=json_path,
|
79 |
+
is_gene_available=is_gene_available,
|
80 |
+
is_trait_available=is_trait_available
|
81 |
+
)
|
82 |
+
|
83 |
+
# 4. Clinical feature extraction
|
84 |
+
# We only proceed if trait_row is not None.
|
85 |
+
# Since trait_row is None, we skip this substep.
|
86 |
+
# STEP3
|
87 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
88 |
+
gene_data = get_genetic_data(matrix_file)
|
89 |
+
|
90 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
91 |
+
print(gene_data.index[:20])
|
92 |
+
# Based on the given identifiers (e.g., "1007_s_at", "1053_at", etc.), these are Affymetrix probe IDs,
|
93 |
+
# not human gene symbols. Therefore, further mapping is required to convert them into gene symbols.
|
94 |
+
|
95 |
+
print("requires_gene_mapping = True")
|
96 |
+
# STEP5
|
97 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
98 |
+
gene_annotation = get_gene_annotation(soft_file)
|
99 |
+
|
100 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
101 |
+
print("Gene annotation preview:")
|
102 |
+
print(preview_df(gene_annotation))
|
103 |
+
# STEP6: Gene Identifier Mapping
|
104 |
+
|
105 |
+
# 1. Identify which columns in the annotation dataframe correspond to the probe IDs and gene symbols.
|
106 |
+
prob_col = "ID"
|
107 |
+
gene_col = "Gene Symbol"
|
108 |
+
|
109 |
+
# 2. Obtain the gene mapping dataframe.
|
110 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col, gene_col)
|
111 |
+
|
112 |
+
# 3. Convert probe-level expression data to gene-level expression data by applying the mapping.
|
113 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
114 |
+
|
115 |
+
# Let's inspect the shape and a quick preview of the mapped gene expression data.
|
116 |
+
print("Gene data shape after mapping:", gene_data.shape)
|
117 |
+
print("Gene data preview:")
|
118 |
+
print(preview_df(gene_data, n=5))
|
119 |
+
# STEP 7: Data Normalization and Linking
|
120 |
+
|
121 |
+
# In this dataset, we determined in Step 2 that trait data is not available (trait_row = None).
|
122 |
+
# Therefore, we cannot link clinical and genetic data or perform trait-based processing.
|
123 |
+
# Nonetheless, we can still normalize probe-level data to standard gene symbols and finalize validation.
|
124 |
+
|
125 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
126 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
127 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
128 |
+
|
129 |
+
# 2. Since trait data is missing, skip linking clinical and genetic data,
|
130 |
+
# skip missing-value handling and bias detection for the trait.
|
131 |
+
|
132 |
+
# 3. Conduct final validation and record info.
|
133 |
+
# Since trait data is unavailable, set is_trait_available=False,
|
134 |
+
# pass a dummy/empty DataFrame and is_biased=False (it won't be used).
|
135 |
+
dummy_df = pd.DataFrame()
|
136 |
+
is_usable = validate_and_save_cohort_info(
|
137 |
+
is_final=True,
|
138 |
+
cohort=cohort,
|
139 |
+
info_path=json_path,
|
140 |
+
is_gene_available=True,
|
141 |
+
is_trait_available=False,
|
142 |
+
is_biased=False,
|
143 |
+
df=dummy_df,
|
144 |
+
note="No trait data found; skipped clinical-linking steps."
|
145 |
+
)
|
146 |
+
|
147 |
+
# 4. If the dataset were usable, save. In this scenario, it's not usable due to missing trait data.
|
148 |
+
if is_usable:
|
149 |
+
dummy_df.to_csv(out_data_file, index=True)
|
p1/preprocess/Adrenocortical_Cancer/code/GSE143383.py
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE143383"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE143383"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE143383.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE143383.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE143383.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1. Gene Expression Data Availability
|
42 |
+
is_gene_available = True # Based on "gene expression analysis" and Affymetrix platform info.
|
43 |
+
|
44 |
+
# 2. Variable Availability and Data Type Conversion
|
45 |
+
# 2.1 Identify rows for trait, age, and gender
|
46 |
+
trait_row = None # No variable in the dictionary indicates a differing trait (likely constant or not listed).
|
47 |
+
age_row = None # No row found for age in the sample characteristics.
|
48 |
+
gender_row = 0 # Row 0 contains 'gender: X'.
|
49 |
+
|
50 |
+
# 2.2 Define the conversion functions
|
51 |
+
def convert_trait(x: str) -> Optional[float]:
|
52 |
+
"""Not applicable here because trait_row is None. This is a placeholder."""
|
53 |
+
return None
|
54 |
+
|
55 |
+
def convert_age(x: str) -> Optional[float]:
|
56 |
+
"""Not applicable here because age_row is None. This is a placeholder."""
|
57 |
+
return None
|
58 |
+
|
59 |
+
def convert_gender(x: str) -> Optional[int]:
|
60 |
+
"""
|
61 |
+
Convert 'gender: X' to binary.
|
62 |
+
'F' -> 0, 'M' -> 1, anything else -> None.
|
63 |
+
"""
|
64 |
+
parts = x.split(':')
|
65 |
+
if len(parts) < 2:
|
66 |
+
return None
|
67 |
+
val = parts[1].strip().lower()
|
68 |
+
if val == 'f':
|
69 |
+
return 0
|
70 |
+
elif val == 'm':
|
71 |
+
return 1
|
72 |
+
else:
|
73 |
+
return None
|
74 |
+
|
75 |
+
# 3. Save Metadata - initial filtering
|
76 |
+
# Trait data availability depends on whether trait_row is None.
|
77 |
+
is_trait_available = (trait_row is not None)
|
78 |
+
|
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 |
+
# Skip if trait_row is None.
|
89 |
+
if trait_row is not None:
|
90 |
+
# Assuming `clinical_data` is the dataframe for sample characteristics
|
91 |
+
selected_clinical_df = geo_select_clinical_features(
|
92 |
+
clinical_df=clinical_data,
|
93 |
+
trait=trait, # 'Adrenocortical_Cancer'
|
94 |
+
trait_row=trait_row,
|
95 |
+
convert_trait=convert_trait,
|
96 |
+
age_row=age_row,
|
97 |
+
convert_age=convert_age,
|
98 |
+
gender_row=gender_row,
|
99 |
+
convert_gender=convert_gender
|
100 |
+
)
|
101 |
+
# Preview and save
|
102 |
+
print("Clinical features preview:", preview_df(selected_clinical_df, n=5))
|
103 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
104 |
+
# STEP3
|
105 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
106 |
+
gene_data = get_genetic_data(matrix_file)
|
107 |
+
|
108 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
109 |
+
print(gene_data.index[:20])
|
110 |
+
# Based on the listed identifiers (e.g., "11715100_at"), they appear to be Affymetrix probe set IDs, not human gene symbols.
|
111 |
+
# Hence, gene mapping is required.
|
112 |
+
|
113 |
+
print("requires_gene_mapping = True")
|
114 |
+
# STEP5
|
115 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
116 |
+
gene_annotation = get_gene_annotation(soft_file)
|
117 |
+
|
118 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
119 |
+
print("Gene annotation preview:")
|
120 |
+
print(preview_df(gene_annotation))
|
121 |
+
# STEP: Gene Identifier Mapping
|
122 |
+
|
123 |
+
# 1. Identify the columns in the gene_annotation dataframe that correspond to the probe IDs and gene symbols.
|
124 |
+
# From the preview, "ID" matches the probe identifiers in gene_data, and "Gene Symbol" contains the gene symbols.
|
125 |
+
|
126 |
+
# 2. Create a gene mapping dataframe using the relevant columns.
|
127 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="Gene Symbol")
|
128 |
+
|
129 |
+
# 3. Convert probe-level measurements in gene_data to gene-level data.
|
130 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
131 |
+
|
132 |
+
# Print a quick preview of the resulting gene_data
|
133 |
+
print("Mapped gene_data preview:")
|
134 |
+
print(gene_data.head(5))
|
135 |
+
# STEP 7: Data Normalization and Linking
|
136 |
+
|
137 |
+
# In this dataset, we determined in Step 2 that trait data is not available (trait_row = None).
|
138 |
+
# Therefore, we cannot link clinical and genetic data or perform trait-based processing.
|
139 |
+
# Nonetheless, we can still normalize probe-level data to standard gene symbols and finalize validation.
|
140 |
+
|
141 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
142 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
143 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
144 |
+
|
145 |
+
# 2. Since trait data is missing, skip linking clinical and genetic data,
|
146 |
+
# skip missing-value handling and bias detection for the trait.
|
147 |
+
|
148 |
+
# 3. Conduct final validation and record info.
|
149 |
+
# Since trait data is unavailable, set is_trait_available=False,
|
150 |
+
# pass a dummy/empty DataFrame and is_biased=False (it won't be used).
|
151 |
+
dummy_df = pd.DataFrame()
|
152 |
+
is_usable = validate_and_save_cohort_info(
|
153 |
+
is_final=True,
|
154 |
+
cohort=cohort,
|
155 |
+
info_path=json_path,
|
156 |
+
is_gene_available=True,
|
157 |
+
is_trait_available=False,
|
158 |
+
is_biased=False,
|
159 |
+
df=dummy_df,
|
160 |
+
note="No trait data found; skipped clinical-linking steps."
|
161 |
+
)
|
162 |
+
|
163 |
+
# 4. If the dataset were usable, save. In this scenario, it's not usable due to missing trait data.
|
164 |
+
if is_usable:
|
165 |
+
dummy_df.to_csv(out_data_file, index=True)
|
p1/preprocess/Adrenocortical_Cancer/code/GSE19776.py
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE19776"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE19776"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE19776.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE19776.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE19776.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# Step 1: Decide if the dataset contains gene expression data
|
42 |
+
# Based on the series title "Adrenocortical Carcinoma Gene Expression Profiling",
|
43 |
+
# we conclude that it is likely to contain gene expression data.
|
44 |
+
is_gene_available = True
|
45 |
+
|
46 |
+
# Step 2: Variable Availability and Data Type Conversion
|
47 |
+
|
48 |
+
# 2.1 Identify Rows
|
49 |
+
# - trait: We see only "tissue: adrenocortical carcinoma" under key 0. This is a single unique value,
|
50 |
+
# which is uninformative for association. Hence treat it as not available for the trait.
|
51 |
+
trait_row = None
|
52 |
+
|
53 |
+
# - age: Found under key 5 (multiple distinct values, some are "age: Unknown").
|
54 |
+
age_row = 5
|
55 |
+
|
56 |
+
# - gender: Found under key 4 (M/F). Multiple values, not constant.
|
57 |
+
gender_row = 4
|
58 |
+
|
59 |
+
# 2.2 Define Conversion Functions
|
60 |
+
def convert_trait(x: str) -> int:
|
61 |
+
"""
|
62 |
+
Returns None because trait is not available (single unique value in dataset).
|
63 |
+
This function is a placeholder to adhere to the required interface.
|
64 |
+
"""
|
65 |
+
return None
|
66 |
+
|
67 |
+
def convert_age(x: str) -> float:
|
68 |
+
"""
|
69 |
+
Convert the substring after 'age:' to float if possible.
|
70 |
+
If it's 'Unknown' or non-parsable, return None.
|
71 |
+
"""
|
72 |
+
val = x.split(':')[-1].strip()
|
73 |
+
if val.lower() == "unknown":
|
74 |
+
return None
|
75 |
+
try:
|
76 |
+
return float(val)
|
77 |
+
except ValueError:
|
78 |
+
return None
|
79 |
+
|
80 |
+
def convert_gender(x: str) -> int:
|
81 |
+
"""
|
82 |
+
Convert 'gender: F' -> 0, 'gender: M' -> 1.
|
83 |
+
If the value is unknown or doesn't match, return None.
|
84 |
+
"""
|
85 |
+
val = x.split(':')[-1].strip().upper()
|
86 |
+
if val == 'F':
|
87 |
+
return 0
|
88 |
+
elif val == 'M':
|
89 |
+
return 1
|
90 |
+
return None
|
91 |
+
|
92 |
+
# Step 3: Save initial filtering metadata
|
93 |
+
# Trait data is not available if trait_row is None
|
94 |
+
is_trait_available = (trait_row is not None)
|
95 |
+
|
96 |
+
is_usable = validate_and_save_cohort_info(
|
97 |
+
is_final=False,
|
98 |
+
cohort=cohort,
|
99 |
+
info_path=json_path,
|
100 |
+
is_gene_available=is_gene_available,
|
101 |
+
is_trait_available=is_trait_available
|
102 |
+
)
|
103 |
+
|
104 |
+
# Step 4: Extract clinical features only if trait_row is not None
|
105 |
+
# Since trait_row = None, we skip clinical feature extraction.
|
106 |
+
# STEP3
|
107 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
108 |
+
gene_data = get_genetic_data(matrix_file)
|
109 |
+
|
110 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
111 |
+
print(gene_data.index[:20])
|
112 |
+
# The provided gene identifiers are all numeric, which are not standard human gene symbols.
|
113 |
+
# They likely refer to probe IDs or some other numeric format.
|
114 |
+
# Therefore, gene mapping to human gene symbols is required.
|
115 |
+
|
116 |
+
requires_gene_mapping = True
|
117 |
+
# STEP5
|
118 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
119 |
+
gene_annotation = get_gene_annotation(soft_file)
|
120 |
+
|
121 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
122 |
+
print("Gene annotation preview:")
|
123 |
+
print(preview_df(gene_annotation))
|
124 |
+
# STEP6: Gene Identifier Mapping
|
125 |
+
|
126 |
+
# Reviewer feedback indicates a mismatch between the numeric row IDs in the gene expression dataframe
|
127 |
+
# (e.g., "3", "4", "5") and the probe IDs in the annotation file (e.g., "1007_s_at", "1053_at").
|
128 |
+
# Because there is no overlap, a direct mapping is not possible with the provided annotation.
|
129 |
+
# We'll demonstrate a fallback approach: we attempt to match, but if no overlap is found, we skip mapping.
|
130 |
+
|
131 |
+
# 1. Decide which columns in the annotation *would* store the probe IDs and gene symbols if they matched.
|
132 |
+
probe_col = "ID"
|
133 |
+
gene_col = "Gene Symbol"
|
134 |
+
|
135 |
+
# 2. Extract the potential mapping dataframe.
|
136 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_col)
|
137 |
+
|
138 |
+
# 3. Check for any intersection in identifiers before applying the mapping.
|
139 |
+
common_ids = set(gene_data.index).intersection(mapping_df['ID'])
|
140 |
+
if len(common_ids) == 0:
|
141 |
+
print("No matching identifiers found between gene expression data and annotation. Skipping gene mapping.")
|
142 |
+
else:
|
143 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
144 |
+
print("Gene mapping applied successfully.")
|
145 |
+
# STEP 7: Data Normalization and Linking
|
146 |
+
|
147 |
+
# In this dataset, we determined in Step 2 that trait data is not available (trait_row = None).
|
148 |
+
# Therefore, we cannot link clinical and genetic data or perform trait-based processing.
|
149 |
+
# Nonetheless, we can still normalize probe-level data to standard gene symbols and finalize validation.
|
150 |
+
|
151 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
152 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
153 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
154 |
+
|
155 |
+
# 2. Since trait data is missing, skip linking clinical and genetic data,
|
156 |
+
# skip missing-value handling and bias detection for the trait.
|
157 |
+
|
158 |
+
# 3. Conduct final validation and record info.
|
159 |
+
# Since trait data is unavailable, set is_trait_available=False,
|
160 |
+
# pass a dummy/empty DataFrame and is_biased=False (it won't be used).
|
161 |
+
dummy_df = pd.DataFrame()
|
162 |
+
is_usable = validate_and_save_cohort_info(
|
163 |
+
is_final=True,
|
164 |
+
cohort=cohort,
|
165 |
+
info_path=json_path,
|
166 |
+
is_gene_available=True,
|
167 |
+
is_trait_available=False,
|
168 |
+
is_biased=False,
|
169 |
+
df=dummy_df,
|
170 |
+
note="No trait data found; skipped clinical-linking steps."
|
171 |
+
)
|
172 |
+
|
173 |
+
# 4. If the dataset were usable, save. In this scenario, it's not usable due to missing trait data.
|
174 |
+
if is_usable:
|
175 |
+
dummy_df.to_csv(out_data_file, index=True)
|
p1/preprocess/Adrenocortical_Cancer/code/GSE49278.py
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE49278"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE49278"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE49278.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE49278.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE49278.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1. Gene Expression Data Availability
|
42 |
+
is_gene_available = True # Based on the background info: "Expression profiling by array ..."
|
43 |
+
|
44 |
+
# 2. Variable Availability and Data Type Conversion
|
45 |
+
# Observing the sample characteristics, key=2 has only one unique value (Adrenocortical carcinoma),
|
46 |
+
# so that is constant and not useful for association analyses, thus trait_row = None.
|
47 |
+
trait_row = None
|
48 |
+
|
49 |
+
# key=0 shows multiple age values => available
|
50 |
+
age_row = 0
|
51 |
+
|
52 |
+
# key=1 shows two gender values => available
|
53 |
+
gender_row = 1
|
54 |
+
|
55 |
+
# Define conversion functions
|
56 |
+
def convert_trait(value: str):
|
57 |
+
# Since trait data is effectively not available (constant),
|
58 |
+
# this function returns None
|
59 |
+
return None
|
60 |
+
|
61 |
+
def convert_age(value: str):
|
62 |
+
# Typical format: "age (years): 70"
|
63 |
+
# Convert the part after the colon to a numeric type
|
64 |
+
try:
|
65 |
+
val_str = value.split(':', 1)[1].strip()
|
66 |
+
return float(val_str)
|
67 |
+
except:
|
68 |
+
return None
|
69 |
+
|
70 |
+
def convert_gender(value: str):
|
71 |
+
# Typical format: "gender: F" or "gender: M"
|
72 |
+
# Convert F -> 0, M -> 1
|
73 |
+
try:
|
74 |
+
val_str = value.split(':', 1)[1].strip().upper()
|
75 |
+
if val_str == 'F':
|
76 |
+
return 0
|
77 |
+
elif val_str == 'M':
|
78 |
+
return 1
|
79 |
+
else:
|
80 |
+
return None
|
81 |
+
except:
|
82 |
+
return None
|
83 |
+
|
84 |
+
# 3. Save Metadata (initial filtering)
|
85 |
+
is_trait_available = (trait_row is not None)
|
86 |
+
_ = validate_and_save_cohort_info(
|
87 |
+
is_final=False,
|
88 |
+
cohort=cohort,
|
89 |
+
info_path=json_path,
|
90 |
+
is_gene_available=is_gene_available,
|
91 |
+
is_trait_available=is_trait_available
|
92 |
+
)
|
93 |
+
|
94 |
+
# 4. Clinical Feature Extraction
|
95 |
+
# Skip this step because trait_row is None (no trait data available).
|
96 |
+
# STEP3
|
97 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
98 |
+
gene_data = get_genetic_data(matrix_file)
|
99 |
+
|
100 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
101 |
+
print(gene_data.index[:20])
|
102 |
+
print("requires_gene_mapping = True")
|
103 |
+
# STEP5
|
104 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
105 |
+
gene_annotation = get_gene_annotation(soft_file)
|
106 |
+
|
107 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
108 |
+
print("Gene annotation preview:")
|
109 |
+
print(preview_df(gene_annotation))
|
110 |
+
# STEP6: Gene Identifier Mapping
|
111 |
+
|
112 |
+
# After reviewing the annotation DataFrame columns:
|
113 |
+
# ['ID', 'RANGE_STRAND', 'RANGE_START', 'RANGE_END', 'total_probes', 'GB_ACC', 'SPOT_ID', 'RANGE_GB']
|
114 |
+
# we see that 'GB_ACC' usually contains "NR_" transcripts and 'SPOT_ID' has genomic coordinates. Neither appear to provide
|
115 |
+
# valid gene symbols recognizable by extract_human_gene_symbols (which filters out NR_, XR_, LOC, etc.).
|
116 |
+
# Therefore, mapping to standard gene symbols is not possible here.
|
117 |
+
# We'll retain the original probe-level data without attempting gene-level aggregation.
|
118 |
+
|
119 |
+
print("No suitable gene symbol column found. Proceeding with probe-level data only.")
|
120 |
+
# The 'gene_data' DataFrame remains as probe-level data.
|
121 |
+
# No further action is required for mapping in this dataset.
|
122 |
+
# STEP 7: Data Normalization and Linking
|
123 |
+
|
124 |
+
# In this dataset, we determined in Step 2 that trait data is not available (trait_row = None).
|
125 |
+
# Therefore, we cannot link clinical and genetic data or perform trait-based processing.
|
126 |
+
# Nonetheless, we can still normalize probe-level data to standard gene symbols and finalize validation.
|
127 |
+
|
128 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
129 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
130 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
131 |
+
|
132 |
+
# 2. Since trait data is missing, skip linking clinical and genetic data,
|
133 |
+
# skip missing-value handling and bias detection for the trait.
|
134 |
+
|
135 |
+
# 3. Conduct final validation and record info.
|
136 |
+
# Since trait data is unavailable, set is_trait_available=False,
|
137 |
+
# pass a dummy/empty DataFrame and is_biased=False (it won't be used).
|
138 |
+
dummy_df = pd.DataFrame()
|
139 |
+
is_usable = validate_and_save_cohort_info(
|
140 |
+
is_final=True,
|
141 |
+
cohort=cohort,
|
142 |
+
info_path=json_path,
|
143 |
+
is_gene_available=True,
|
144 |
+
is_trait_available=False,
|
145 |
+
is_biased=False,
|
146 |
+
df=dummy_df,
|
147 |
+
note="No trait data found; skipped clinical-linking steps."
|
148 |
+
)
|
149 |
+
|
150 |
+
# 4. If the dataset were usable, save. In this scenario, it's not usable due to missing trait data.
|
151 |
+
if is_usable:
|
152 |
+
dummy_df.to_csv(out_data_file, index=True)
|
p1/preprocess/Adrenocortical_Cancer/code/GSE67766.py
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE67766"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE67766"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE67766.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE67766.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE67766.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1. Determine if gene expression data is available
|
42 |
+
is_gene_available = True # Based on background context, we assume gene expression data is present
|
43 |
+
|
44 |
+
# 2. Determine availability for trait, age, and gender from the sample characteristics dictionary
|
45 |
+
# Given the dictionary: {0: ['cell line: SW-13']}, there is no variation or explicit mention
|
46 |
+
# of trait, age, or gender. Hence, they are all considered unavailable.
|
47 |
+
trait_row = None
|
48 |
+
age_row = None
|
49 |
+
gender_row = None
|
50 |
+
|
51 |
+
# 2.2 Define data type conversion functions
|
52 |
+
def convert_trait(x: str):
|
53 |
+
# No trait data available. Return None for any input.
|
54 |
+
return None
|
55 |
+
|
56 |
+
def convert_age(x: str):
|
57 |
+
# No age data available. Return None for any input.
|
58 |
+
return None
|
59 |
+
|
60 |
+
def convert_gender(x: str):
|
61 |
+
# No gender data available. Return None for any input.
|
62 |
+
return None
|
63 |
+
|
64 |
+
# 3. Save Metadata (initial filtering)
|
65 |
+
# 'is_trait_available' is False because 'trait_row' is None
|
66 |
+
is_trait_available = (trait_row is not None)
|
67 |
+
|
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. Clinical Feature Extraction
|
77 |
+
# Since 'trait_row' is None, we skip this step (no clinical data to extract).
|
78 |
+
# STEP3
|
79 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
80 |
+
gene_data = get_genetic_data(matrix_file)
|
81 |
+
|
82 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
83 |
+
print(gene_data.index[:20])
|
84 |
+
# These gene identifiers ('ILMN_...') are Illumina probe IDs rather than standard human gene symbols.
|
85 |
+
# Hence, gene mapping to official symbols is required.
|
86 |
+
print("requires_gene_mapping = True")
|
87 |
+
# STEP5
|
88 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
89 |
+
gene_annotation = get_gene_annotation(soft_file)
|
90 |
+
|
91 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
92 |
+
print("Gene annotation preview:")
|
93 |
+
print(preview_df(gene_annotation))
|
94 |
+
# STEP: Gene Identifier Mapping
|
95 |
+
|
96 |
+
# 1) Identify the columns for gene identifier and gene symbol based on the annotation preview.
|
97 |
+
probe_col = "ID"
|
98 |
+
symbol_col = "Symbol"
|
99 |
+
|
100 |
+
# 2) Build the gene mapping dataframe from the annotation dataframe.
|
101 |
+
mapping_df = get_gene_mapping(gene_annotation, probe_col, symbol_col)
|
102 |
+
|
103 |
+
# 3) Apply the mapping to convert probe-level expression to gene-level expression.
|
104 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
105 |
+
# STEP 7: Data Normalization and Linking
|
106 |
+
|
107 |
+
# 1. Normalize gene symbols in the obtained gene expression data
|
108 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
109 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
110 |
+
|
111 |
+
# Since trait data is unavailable (trait_row = None), we cannot link or analyze trait/demographic features.
|
112 |
+
# We must finalize this dataset as unusable for downstream analysis.
|
113 |
+
|
114 |
+
# Provide a dummy dataframe and a boolean for is_biased to satisfy the library requirements.
|
115 |
+
import pandas as pd
|
116 |
+
empty_df = pd.DataFrame()
|
117 |
+
|
118 |
+
# 5. Perform final quality validation and save cohort info.
|
119 |
+
# We set is_biased=False to fulfill the function parameters; it will still result in is_usable=False
|
120 |
+
# because is_trait_available=False.
|
121 |
+
is_usable = validate_and_save_cohort_info(
|
122 |
+
is_final=True,
|
123 |
+
cohort=cohort,
|
124 |
+
info_path=json_path,
|
125 |
+
is_gene_available=True,
|
126 |
+
is_trait_available=False,
|
127 |
+
is_biased=False,
|
128 |
+
df=empty_df,
|
129 |
+
note="No trait data available for this cohort."
|
130 |
+
)
|
131 |
+
|
132 |
+
# 6. Since no trait data is available, is_usable must be False, so we skip saving the final linked data.
|
p1/preprocess/Adrenocortical_Cancer/code/GSE68606.py
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE68606"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE68606"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE68606.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE68606.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE68606.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1) Gene Expression Data Availability
|
42 |
+
# Based on the "Assay Type: Gene Expression" and "Affymetrix Human Genome U133A arrays" in the metadata,
|
43 |
+
# we conclude that this dataset likely contains gene expression data.
|
44 |
+
is_gene_available = True
|
45 |
+
|
46 |
+
# 2) Variable Availability and Data Type Conversion
|
47 |
+
|
48 |
+
# 2.1 Identify availability of 'trait', 'age', and 'gender' by looking at the Sample Characteristics Dictionary
|
49 |
+
# We did not find "Adrenocortical_Cancer" or an equivalent entry in any row,
|
50 |
+
# so trait data is considered not available.
|
51 |
+
trait_row = None
|
52 |
+
|
53 |
+
# Age data is present in row 6 with multiple unique numeric values.
|
54 |
+
age_row = 6
|
55 |
+
|
56 |
+
# Gender data is present in row 5 (female/male).
|
57 |
+
gender_row = 5
|
58 |
+
|
59 |
+
# 2.2 Define conversion functions for each variable
|
60 |
+
|
61 |
+
def convert_trait(x: str):
|
62 |
+
# Trait data is not available in this dataset, return None for all inputs.
|
63 |
+
return None
|
64 |
+
|
65 |
+
def convert_age(x: str):
|
66 |
+
# Extract the substring after the colon and strip whitespace
|
67 |
+
val = x.split(":", 1)[-1].strip()
|
68 |
+
# Convert to integer if possible, otherwise None
|
69 |
+
return int(val) if val.isdigit() else None
|
70 |
+
|
71 |
+
def convert_gender(x: str):
|
72 |
+
# Extract the substring after the colon and strip whitespace
|
73 |
+
val = x.split(":", 1)[-1].strip().lower()
|
74 |
+
if val == "female":
|
75 |
+
return 0
|
76 |
+
elif val == "male":
|
77 |
+
return 1
|
78 |
+
else:
|
79 |
+
return None
|
80 |
+
|
81 |
+
# 3) Save Metadata (Initial Filtering)
|
82 |
+
|
83 |
+
is_trait_available = (trait_row is not None) # False in this case
|
84 |
+
validate_and_save_cohort_info(
|
85 |
+
is_final=False,
|
86 |
+
cohort=cohort,
|
87 |
+
info_path=json_path,
|
88 |
+
is_gene_available=is_gene_available,
|
89 |
+
is_trait_available=is_trait_available
|
90 |
+
)
|
91 |
+
|
92 |
+
# 4) Clinical Feature Extraction
|
93 |
+
# Skip this step because trait_row is None (no trait data available).
|
94 |
+
# STEP3
|
95 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
96 |
+
gene_data = get_genetic_data(matrix_file)
|
97 |
+
|
98 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
99 |
+
print(gene_data.index[:20])
|
100 |
+
# These identifiers (e.g., '1007_s_at', '1053_at') are Affymetrix probe set IDs, not human gene symbols.
|
101 |
+
# Therefore, they require mapping to gene symbols.
|
102 |
+
print("requires_gene_mapping = True")
|
103 |
+
# STEP5
|
104 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
105 |
+
gene_annotation = get_gene_annotation(soft_file)
|
106 |
+
|
107 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
108 |
+
print("Gene annotation preview:")
|
109 |
+
print(preview_df(gene_annotation))
|
110 |
+
# STEP: Gene Identifier Mapping
|
111 |
+
|
112 |
+
# 1) The key for the probe identifiers in the gene annotation is "ID",
|
113 |
+
# and the key for the gene symbols is "Gene Symbol".
|
114 |
+
|
115 |
+
# 2) Build a gene mapping dataframe using those two columns.
|
116 |
+
gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
117 |
+
|
118 |
+
# 3) Apply the mapping to convert probe-level measurements to gene expression data.
|
119 |
+
gene_data = apply_gene_mapping(gene_data, gene_mapping)
|
120 |
+
# STEP 7: Data Normalization and Linking
|
121 |
+
|
122 |
+
# Even though we lack trait data, it's still valuable to finalize gene-level data.
|
123 |
+
# 1. Normalize gene symbols and save the normalized gene data
|
124 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
125 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
126 |
+
|
127 |
+
# Since trait_row = None, there's no trait data to link or analyze.
|
128 |
+
# We cannot produce a linked dataset or evaluate trait bias in a meaningful way.
|
129 |
+
# However, the task instructions request a "final" validation.
|
130 |
+
|
131 |
+
import pandas as pd
|
132 |
+
|
133 |
+
# Provide a dummy DataFrame and set is_biased to False
|
134 |
+
# so that validate_and_save_cohort_info can finalize and mark this dataset as unusable for trait analysis.
|
135 |
+
empty_df = pd.DataFrame()
|
136 |
+
is_biased = False
|
137 |
+
|
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, # We do have gene data
|
143 |
+
is_trait_available=False, # But no trait data
|
144 |
+
is_biased=is_biased, # Arbitrarily set to False since no trait is present
|
145 |
+
df=empty_df, # An empty DataFrame to satisfy the function's requirements
|
146 |
+
note="No trait data available, so no final linked dataset can be produced."
|
147 |
+
)
|
148 |
+
|
149 |
+
# 6. Because the dataset is not usable for trait-based analysis, we do not save a final linked dataset.
|
p1/preprocess/Adrenocortical_Cancer/code/GSE68950.py
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE68950"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE68950"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE68950.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE68950.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE68950.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1. Gene Expression Data Availability
|
42 |
+
is_gene_available = True # "Assay Type: Gene Expression" indicates gene expression data.
|
43 |
+
|
44 |
+
# 2.1 Variable Availability
|
45 |
+
# The term "adrenal cortical carcinoma" is present in the "disease state" field (row 1),
|
46 |
+
# matching our trait "Adrenocortical_Cancer." Hence, trait_row = 1.
|
47 |
+
trait_row = 1
|
48 |
+
age_row = None
|
49 |
+
gender_row = None
|
50 |
+
|
51 |
+
# 2.2 Data Type Conversions
|
52 |
+
def convert_trait(value: str):
|
53 |
+
"""
|
54 |
+
Convert 'disease state' to a binary trait:
|
55 |
+
1 for 'adrenal cortical carcinoma',
|
56 |
+
0 for anything else.
|
57 |
+
"""
|
58 |
+
label = value.split(":", 1)[-1].strip().lower()
|
59 |
+
if "adrenal cortical carcinoma" in label:
|
60 |
+
return 1
|
61 |
+
else:
|
62 |
+
return 0
|
63 |
+
|
64 |
+
def convert_age(value: str):
|
65 |
+
return None # Age data not available
|
66 |
+
|
67 |
+
def convert_gender(value: str):
|
68 |
+
return None # Gender data not available
|
69 |
+
|
70 |
+
# 3. Save Metadata with initial filtering
|
71 |
+
is_trait_available = (trait_row is not None)
|
72 |
+
validate_and_save_cohort_info(
|
73 |
+
is_final=False,
|
74 |
+
cohort=cohort,
|
75 |
+
info_path=json_path,
|
76 |
+
is_gene_available=is_gene_available,
|
77 |
+
is_trait_available=is_trait_available
|
78 |
+
)
|
79 |
+
|
80 |
+
# 4. Clinical Feature Extraction (only if trait_row is not None)
|
81 |
+
if trait_row is not None:
|
82 |
+
selected_clinical_df = geo_select_clinical_features(
|
83 |
+
clinical_data,
|
84 |
+
trait=trait, # "Adrenocortical_Cancer"
|
85 |
+
trait_row=trait_row,
|
86 |
+
convert_trait=convert_trait,
|
87 |
+
age_row=age_row,
|
88 |
+
convert_age=convert_age,
|
89 |
+
gender_row=gender_row,
|
90 |
+
convert_gender=convert_gender
|
91 |
+
)
|
92 |
+
# Preview the selected clinical features
|
93 |
+
print(preview_df(selected_clinical_df))
|
94 |
+
# Save the extracted clinical data
|
95 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
96 |
+
# STEP3
|
97 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
98 |
+
gene_data = get_genetic_data(matrix_file)
|
99 |
+
|
100 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
101 |
+
print(gene_data.index[:20])
|
102 |
+
# The gene identifiers shown (e.g., "1007_s_at", "1053_at") are Affymetrix probe set IDs
|
103 |
+
# rather than standard human gene symbols, so they require mapping.
|
104 |
+
requires_gene_mapping = True
|
105 |
+
# STEP5
|
106 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
107 |
+
gene_annotation = get_gene_annotation(soft_file)
|
108 |
+
|
109 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
110 |
+
print("Gene annotation preview:")
|
111 |
+
print(preview_df(gene_annotation))
|
112 |
+
# STEP: Gene Identifier Mapping
|
113 |
+
|
114 |
+
# 1. Identify the columns for gene identifier and gene symbol in the annotation dataframe
|
115 |
+
probe_col = "ID"
|
116 |
+
symbol_col = "Gene Symbol"
|
117 |
+
|
118 |
+
# 2. Get the mapping dataframe
|
119 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=symbol_col)
|
120 |
+
|
121 |
+
# 3. Map probe-level expression to gene-level expression
|
122 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
123 |
+
# STEP 7: Data Normalization and Linking
|
124 |
+
|
125 |
+
# 1. Normalize gene symbols and save the normalized gene data
|
126 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
127 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
128 |
+
|
129 |
+
# 2. Link clinical and genetic data on sample IDs
|
130 |
+
# "selected_clinical_df" was defined in a previous step, so we can use it directly.
|
131 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
132 |
+
|
133 |
+
# 3. Handle missing values systematically
|
134 |
+
processed_data = handle_missing_values(linked_data, trait)
|
135 |
+
|
136 |
+
# 4. Determine whether the trait or demographic features are severely biased
|
137 |
+
trait_biased, processed_data = judge_and_remove_biased_features(processed_data, trait)
|
138 |
+
|
139 |
+
# 5. Final quality validation and save cohort info
|
140 |
+
is_usable = validate_and_save_cohort_info(
|
141 |
+
is_final=True,
|
142 |
+
cohort=cohort,
|
143 |
+
info_path=json_path,
|
144 |
+
is_gene_available=True,
|
145 |
+
is_trait_available=True,
|
146 |
+
is_biased=trait_biased,
|
147 |
+
df=processed_data,
|
148 |
+
note="Trait data present and mapped from step 2."
|
149 |
+
)
|
150 |
+
|
151 |
+
# 6. Save the final linked data only if usable
|
152 |
+
if is_usable:
|
153 |
+
processed_data.to_csv(out_data_file, index=True)
|
p1/preprocess/Adrenocortical_Cancer/code/GSE75415.py
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE75415"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE75415"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE75415.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE75415.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE75415.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1. Determine if gene expression data is available
|
42 |
+
is_gene_available = True # Based on the series title/summary indicating gene expression microarray data.
|
43 |
+
|
44 |
+
# 2. Identify rows and define conversion functions for trait, age, and gender.
|
45 |
+
trait_row = 1 # "histologic type: ..." key
|
46 |
+
age_row = None # No age info found
|
47 |
+
gender_row = 0 # "gender: ..." key
|
48 |
+
|
49 |
+
def convert_trait(value: str):
|
50 |
+
"""
|
51 |
+
Convert histologic type to a binary variable:
|
52 |
+
1 => adrenocortical carcinoma
|
53 |
+
0 => adenoma or normal
|
54 |
+
None => unknown
|
55 |
+
"""
|
56 |
+
parts = value.split(':', 1)
|
57 |
+
if len(parts) == 2:
|
58 |
+
val = parts[1].strip().lower()
|
59 |
+
if 'carcinoma' in val:
|
60 |
+
return 1
|
61 |
+
elif 'adenoma' in val or 'normal' in val:
|
62 |
+
return 0
|
63 |
+
elif 'unknown' in val:
|
64 |
+
return None
|
65 |
+
return None
|
66 |
+
|
67 |
+
def convert_age(value: str):
|
68 |
+
"""
|
69 |
+
Age data is not available, so return None.
|
70 |
+
"""
|
71 |
+
return None
|
72 |
+
|
73 |
+
def convert_gender(value: str):
|
74 |
+
"""
|
75 |
+
Convert gender to binary:
|
76 |
+
0 => female
|
77 |
+
1 => male
|
78 |
+
None => unknown
|
79 |
+
"""
|
80 |
+
parts = value.split(':', 1)
|
81 |
+
if len(parts) == 2:
|
82 |
+
val = parts[1].strip().lower()
|
83 |
+
if val == 'female':
|
84 |
+
return 0
|
85 |
+
elif val == 'male':
|
86 |
+
return 1
|
87 |
+
return None
|
88 |
+
|
89 |
+
# 3. Conduct initial filtering and save metadata
|
90 |
+
is_trait_available = (trait_row is not None)
|
91 |
+
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. Extract clinical features if trait data is available
|
100 |
+
if trait_row is not None:
|
101 |
+
selected_clinical_df = geo_select_clinical_features(
|
102 |
+
clinical_data, # Assuming clinical_data is the DataFrame with sample characteristics
|
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,
|
109 |
+
convert_gender=convert_gender
|
110 |
+
)
|
111 |
+
# Preview and save
|
112 |
+
previewed = preview_df(selected_clinical_df)
|
113 |
+
print("Selected Clinical Features Preview:", previewed)
|
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 |
+
# Observing the provided list of identifiers (e.g., "1007_s_at", "1053_at"), they are Affymetrix probe set IDs.
|
122 |
+
# These are not standard human gene symbols; hence they do require mapping.
|
123 |
+
print("requires_gene_mapping = True")
|
124 |
+
# STEP5
|
125 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
126 |
+
gene_annotation = get_gene_annotation(soft_file)
|
127 |
+
|
128 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
129 |
+
print("Gene annotation preview:")
|
130 |
+
print(preview_df(gene_annotation))
|
131 |
+
# STEP: Gene Identifier Mapping
|
132 |
+
|
133 |
+
# 1. Based on the annotation preview, the column "ID" in 'gene_annotation' matches the probe identifiers
|
134 |
+
# in the gene expression data (also labeled "ID"). The column "Gene Symbol" contains the actual gene symbols.
|
135 |
+
# 2. Extract the two columns from the gene annotation dataframe, "ID" (probe ID) and "Gene Symbol" (gene symbol),
|
136 |
+
# to create the mapping dataframe.
|
137 |
+
mapping_df = get_gene_mapping(gene_annotation, "ID", "Gene Symbol")
|
138 |
+
|
139 |
+
# 3. Convert probe-level measurements to gene-level expression data using the mapping.
|
140 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
141 |
+
|
142 |
+
# (Optional) Print the resulting dataframe shape and some rows to verify.
|
143 |
+
print("Gene expression data shape after mapping:", gene_data.shape)
|
144 |
+
print(gene_data.head())
|
145 |
+
# STEP 7: Data Normalization and Linking
|
146 |
+
|
147 |
+
# 1. Normalize gene symbols and save the normalized gene data
|
148 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
149 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
150 |
+
|
151 |
+
# 2. Link clinical and genetic data on sample IDs
|
152 |
+
# "selected_clinical_df" was defined in a previous step, so we can use it directly.
|
153 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
154 |
+
|
155 |
+
# 3. Handle missing values systematically
|
156 |
+
processed_data = handle_missing_values(linked_data, trait)
|
157 |
+
|
158 |
+
# 4. Determine whether the trait or demographic features are severely biased
|
159 |
+
trait_biased, processed_data = judge_and_remove_biased_features(processed_data, trait)
|
160 |
+
|
161 |
+
# 5. Final quality validation and save cohort info
|
162 |
+
is_usable = validate_and_save_cohort_info(
|
163 |
+
is_final=True,
|
164 |
+
cohort=cohort,
|
165 |
+
info_path=json_path,
|
166 |
+
is_gene_available=True,
|
167 |
+
is_trait_available=True,
|
168 |
+
is_biased=trait_biased,
|
169 |
+
df=processed_data,
|
170 |
+
note="Trait data present and mapped from step 2."
|
171 |
+
)
|
172 |
+
|
173 |
+
# 6. Save the final linked data only if usable
|
174 |
+
if is_usable:
|
175 |
+
processed_data.to_csv(out_data_file, index=True)
|
p1/preprocess/Adrenocortical_Cancer/code/GSE76019.py
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE76019"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE76019"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE76019.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE76019.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE76019.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1. Gene expression data availability
|
42 |
+
is_gene_available = True # Based on "gene expression profiling" statement
|
43 |
+
# 2. Variable availability
|
44 |
+
# The trait is constant ("ACC") across all samples --> not useful for association study
|
45 |
+
trait_row = None
|
46 |
+
age_row = None
|
47 |
+
gender_row = None
|
48 |
+
|
49 |
+
# 2.2 Define data conversion functions (they won't be used because rows are None, but we must still define them)
|
50 |
+
def convert_trait(value: str):
|
51 |
+
# No actual functionality here because trait_row is None
|
52 |
+
return None
|
53 |
+
|
54 |
+
def convert_age(value: str):
|
55 |
+
# No actual functionality here because age_row is None
|
56 |
+
return None
|
57 |
+
|
58 |
+
def convert_gender(value: str):
|
59 |
+
# No actual functionality here because gender_row is None
|
60 |
+
return None
|
61 |
+
|
62 |
+
# 3. Initial Filtering (Save metadata)
|
63 |
+
is_trait_available = (trait_row is not None)
|
64 |
+
is_usable = validate_and_save_cohort_info(
|
65 |
+
is_final=False,
|
66 |
+
cohort=cohort,
|
67 |
+
info_path=json_path,
|
68 |
+
is_gene_available=is_gene_available,
|
69 |
+
is_trait_available=is_trait_available
|
70 |
+
)
|
71 |
+
|
72 |
+
# 4. Clinical Feature Extraction is skipped since trait_row is None
|
73 |
+
# STEP3
|
74 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
75 |
+
gene_data = get_genetic_data(matrix_file)
|
76 |
+
|
77 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
78 |
+
print(gene_data.index[:20])
|
79 |
+
# The gene expression data uses probe-based identifiers (e.g., Affymetrix probe IDs) rather than standard human gene symbols.
|
80 |
+
# Therefore, a mapping step is needed.
|
81 |
+
print("requires_gene_mapping = True")
|
82 |
+
# STEP5
|
83 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
84 |
+
gene_annotation = get_gene_annotation(soft_file)
|
85 |
+
|
86 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
87 |
+
print("Gene annotation preview:")
|
88 |
+
print(preview_df(gene_annotation))
|
89 |
+
# STEP: Gene Identifier Mapping
|
90 |
+
|
91 |
+
# 1) The key in 'gene_annotation' that matches the probe identifiers in 'gene_data' is "ID".
|
92 |
+
# The key that stores the gene symbols is "Gene Symbol".
|
93 |
+
|
94 |
+
# 2) Extract a gene mapping dataframe from 'gene_annotation' with these columns.
|
95 |
+
mapping_df = get_gene_mapping(
|
96 |
+
annotation=gene_annotation,
|
97 |
+
prob_col="ID",
|
98 |
+
gene_col="Gene Symbol"
|
99 |
+
)
|
100 |
+
|
101 |
+
# 3) Convert probe-level measurements to gene-level expression data.
|
102 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
103 |
+
# STEP 7: Data Normalization and Linking
|
104 |
+
|
105 |
+
import pandas as pd
|
106 |
+
|
107 |
+
# 1. Normalize gene symbols and save the normalized gene data
|
108 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
109 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
110 |
+
|
111 |
+
# Since the trait was determined unavailable (trait_row is None), there is no clinical data to link.
|
112 |
+
# We therefore skip linking, missing value handling, and bias checks.
|
113 |
+
|
114 |
+
# 5. Final quality validation (the dataset is not suitable for trait-based association studies).
|
115 |
+
# We must provide a DataFrame and a boolean for is_biased to avoid errors, even though trait data is missing.
|
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=False,
|
122 |
+
is_biased=False, # Arbitrary value, as the dataset is already not usable due to missing trait
|
123 |
+
df=pd.DataFrame(), # Empty DataFrame to satisfy validation requirements
|
124 |
+
note="No trait data, so dataset is not suitable for association studies."
|
125 |
+
)
|
126 |
+
|
127 |
+
# 6. Since the dataset is not usable for trait-based analyses, we do NOT save a final linked data file.
|
p1/preprocess/Adrenocortical_Cancer/code/GSE90713.py
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
cohort = "GSE90713"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Adrenocortical_Cancer"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Adrenocortical_Cancer/GSE90713"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/GSE90713.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/GSE90713.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/GSE90713.csv"
|
16 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
|
21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
23 |
+
|
24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
27 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
28 |
+
matrix_file,
|
29 |
+
background_prefixes,
|
30 |
+
clinical_prefixes
|
31 |
+
)
|
32 |
+
|
33 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
34 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
35 |
+
|
36 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
37 |
+
print("Background Information:")
|
38 |
+
print(background_info)
|
39 |
+
print("Sample Characteristics Dictionary:")
|
40 |
+
print(sample_characteristics_dict)
|
41 |
+
# 1) Determine if gene expression data is available
|
42 |
+
is_gene_available = True # Based on the series description showing Affymetrix microarray gene expression
|
43 |
+
|
44 |
+
# 2) Identify availability of trait, age, and gender data
|
45 |
+
trait_row = 0 # "tissue: adrenocortical carcinoma" vs. "tissue: normal adrenal"
|
46 |
+
age_row = None # No age-related information found
|
47 |
+
gender_row = None # No gender-related information found
|
48 |
+
|
49 |
+
# 2) Data type conversion functions
|
50 |
+
def convert_trait(x: str) -> Optional[int]:
|
51 |
+
"""
|
52 |
+
Convert the tissue annotation to binary values for adrenocortical carcinoma (1) or normal adrenal (0).
|
53 |
+
Unknown values return None.
|
54 |
+
"""
|
55 |
+
parts = x.split(':')
|
56 |
+
if len(parts) < 2:
|
57 |
+
return None
|
58 |
+
val = parts[-1].strip().lower()
|
59 |
+
if val in ["adrenocortical carcinoma", "acc", "tumor"]:
|
60 |
+
return 1
|
61 |
+
elif val in ["normal adrenal", "normal"]:
|
62 |
+
return 0
|
63 |
+
else:
|
64 |
+
return None
|
65 |
+
|
66 |
+
def convert_age(x: str) -> Optional[float]:
|
67 |
+
"""No age data available, so always return None."""
|
68 |
+
return None
|
69 |
+
|
70 |
+
def convert_gender(x: str) -> Optional[int]:
|
71 |
+
"""No gender data available, so always return None."""
|
72 |
+
return None
|
73 |
+
|
74 |
+
# 3) Initial filtering and metadata saving
|
75 |
+
is_trait_available = (trait_row is not None)
|
76 |
+
is_usable = validate_and_save_cohort_info(
|
77 |
+
is_final=False,
|
78 |
+
cohort=cohort,
|
79 |
+
info_path=json_path,
|
80 |
+
is_gene_available=is_gene_available,
|
81 |
+
is_trait_available=is_trait_available
|
82 |
+
)
|
83 |
+
|
84 |
+
# 4) Extract clinical features if trait_row is not None
|
85 |
+
if trait_row is not None:
|
86 |
+
selected_clinical_df = geo_select_clinical_features(
|
87 |
+
clinical_df=clinical_data,
|
88 |
+
trait=trait,
|
89 |
+
trait_row=trait_row,
|
90 |
+
convert_trait=convert_trait,
|
91 |
+
age_row=age_row,
|
92 |
+
convert_age=convert_age,
|
93 |
+
gender_row=gender_row,
|
94 |
+
convert_gender=convert_gender
|
95 |
+
)
|
96 |
+
# Preview and save the extracted clinical features
|
97 |
+
preview_result = preview_df(selected_clinical_df)
|
98 |
+
print("Preview of Clinical Data:", preview_result)
|
99 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
100 |
+
# STEP3
|
101 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
102 |
+
gene_data = get_genetic_data(matrix_file)
|
103 |
+
|
104 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
105 |
+
print(gene_data.index[:20])
|
106 |
+
# These identifiers (e.g., "11715100_at", "11715101_s_at") appear to be Affymetrix probe set IDs,
|
107 |
+
# not standard human gene symbols. Hence, gene symbol mapping is required.
|
108 |
+
|
109 |
+
print("requires_gene_mapping = True")
|
110 |
+
# STEP5
|
111 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
112 |
+
gene_annotation = get_gene_annotation(soft_file)
|
113 |
+
|
114 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
115 |
+
print("Gene annotation preview:")
|
116 |
+
print(preview_df(gene_annotation))
|
117 |
+
# STEP: Gene Identifier Mapping
|
118 |
+
|
119 |
+
# 1. Identify the columns in the annotation that match our probe IDs and gene symbols:
|
120 |
+
# - Probe ID column: 'ID'
|
121 |
+
# - Gene Symbol column: 'Gene Symbol'
|
122 |
+
|
123 |
+
probe_col = 'ID'
|
124 |
+
gene_symbol_col = 'Gene Symbol'
|
125 |
+
|
126 |
+
# 2. Generate a gene mapping dataframe
|
127 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
128 |
+
|
129 |
+
# 3. Apply the gene mapping to convert probe-level expression to gene-level expression
|
130 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
131 |
+
|
132 |
+
# Print a quick preview of the first few rows after mapping
|
133 |
+
print("Mapped Gene Expression Data (first 5 rows):")
|
134 |
+
print(gene_data.head(5))
|
135 |
+
# STEP 7: Data Normalization and Linking
|
136 |
+
|
137 |
+
# 1. Normalize gene symbols and save the normalized gene data
|
138 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
139 |
+
normalized_gene_data.to_csv(out_gene_data_file, index=True)
|
140 |
+
|
141 |
+
# 2. Link clinical and genetic data on sample IDs
|
142 |
+
# "selected_clinical_df" was defined in a previous step, so we can use it directly.
|
143 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
144 |
+
|
145 |
+
# 3. Handle missing values systematically
|
146 |
+
processed_data = handle_missing_values(linked_data, trait)
|
147 |
+
|
148 |
+
# 4. Determine whether the trait or demographic features are severely biased
|
149 |
+
trait_biased, processed_data = judge_and_remove_biased_features(processed_data, trait)
|
150 |
+
|
151 |
+
# 5. Final quality validation and save cohort info
|
152 |
+
is_usable = validate_and_save_cohort_info(
|
153 |
+
is_final=True,
|
154 |
+
cohort=cohort,
|
155 |
+
info_path=json_path,
|
156 |
+
is_gene_available=True,
|
157 |
+
is_trait_available=True,
|
158 |
+
is_biased=trait_biased,
|
159 |
+
df=processed_data,
|
160 |
+
note="Trait data present and mapped from step 2."
|
161 |
+
)
|
162 |
+
|
163 |
+
# 6. Save the final linked data only if usable
|
164 |
+
if is_usable:
|
165 |
+
processed_data.to_csv(out_data_file, index=True)
|
p1/preprocess/Adrenocortical_Cancer/code/TCGA.py
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Adrenocortical_Cancer"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/1/Adrenocortical_Cancer/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/1/Adrenocortical_Cancer/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/1/Adrenocortical_Cancer/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/1/Adrenocortical_Cancer/cohort_info.json"
|
15 |
+
|
16 |
+
import os
|
17 |
+
import pandas as pd
|
18 |
+
|
19 |
+
# 1. Identify the relevant subdirectory for the trait "Obesity"
|
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 |
+
trait_keyword = trait
|
37 |
+
target_subdir = None
|
38 |
+
|
39 |
+
for sd in subdirectories:
|
40 |
+
if trait_keyword.lower() in sd.lower():
|
41 |
+
target_subdir = sd
|
42 |
+
break
|
43 |
+
|
44 |
+
if target_subdir is None:
|
45 |
+
# No suitable data found for this trait; mark as completed
|
46 |
+
print("No TCGA subdirectory found for the trait. Skipping.")
|
47 |
+
else:
|
48 |
+
# 2. Locate clinical and genetic data files
|
49 |
+
cohort_dir = os.path.join(tcga_root_dir, target_subdir)
|
50 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
51 |
+
|
52 |
+
# 3. Load the data
|
53 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
54 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
55 |
+
|
56 |
+
# 4. Print column names of clinical data
|
57 |
+
print(clinical_df.columns)
|
58 |
+
candidate_age_cols = ["age_at_initial_pathologic_diagnosis"]
|
59 |
+
candidate_gender_cols = []
|
60 |
+
|
61 |
+
candidate_demo_cols = candidate_age_cols + candidate_gender_cols
|
62 |
+
if candidate_demo_cols:
|
63 |
+
extracted_df = clinical_df[candidate_demo_cols]
|
64 |
+
preview_data = preview_df(extracted_df)
|
65 |
+
print(preview_data)
|
66 |
+
# Based on the inspection of the provided dictionaries for age and gender:
|
67 |
+
age_col = "age_at_initial_pathologic_diagnosis"
|
68 |
+
gender_col = None
|
69 |
+
|
70 |
+
print("Chosen age_col:", age_col)
|
71 |
+
print("Chosen gender_col:", gender_col)
|
72 |
+
# 1. Extract and standardize the clinical features
|
73 |
+
selected_clinical_df = tcga_select_clinical_features(
|
74 |
+
clinical_df=clinical_df,
|
75 |
+
trait=trait,
|
76 |
+
age_col=age_col,
|
77 |
+
gender_col=gender_col
|
78 |
+
)
|
79 |
+
|
80 |
+
# (Optional) Save the selected clinical data
|
81 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
82 |
+
|
83 |
+
# 2. Normalize gene symbols in the genetic data
|
84 |
+
normalized_gene_df = normalize_gene_symbols_in_index(genetic_df)
|
85 |
+
normalized_gene_df.to_csv(out_gene_data_file)
|
86 |
+
|
87 |
+
# 3. Link the clinical and genetic data on sample IDs
|
88 |
+
linked_data = selected_clinical_df.join(normalized_gene_df.T, how="inner")
|
89 |
+
|
90 |
+
# 4. Handle missing values
|
91 |
+
cleaned_df = handle_missing_values(linked_data, trait)
|
92 |
+
|
93 |
+
# 5. Determine if the trait or demographic features are biased
|
94 |
+
is_biased, final_df = judge_and_remove_biased_features(cleaned_df, trait)
|
95 |
+
|
96 |
+
# 6. Final quality validation
|
97 |
+
is_gene_available = not normalized_gene_df.empty
|
98 |
+
is_trait_available = trait in final_df.columns
|
99 |
+
is_usable = validate_and_save_cohort_info(
|
100 |
+
is_final=True,
|
101 |
+
cohort="TCGA",
|
102 |
+
info_path=json_path,
|
103 |
+
is_gene_available=is_gene_available,
|
104 |
+
is_trait_available=is_trait_available,
|
105 |
+
is_biased=is_biased,
|
106 |
+
df=final_df,
|
107 |
+
note=""
|
108 |
+
)
|
109 |
+
|
110 |
+
# 7. If the dataset is usable, save the final dataframe
|
111 |
+
if is_usable:
|
112 |
+
final_df.to_csv(out_data_file)
|
p1/preprocess/Adrenocortical_Cancer/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE90713": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 63, "note": "Trait data present and mapped from step 2."}, "GSE76019": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data, so dataset is not suitable for association studies."}, "GSE75415": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": true, "sample_size": 30, "note": "Trait data present and mapped from step 2."}, "GSE68950": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": false, "has_gender": false, "sample_size": 798, "note": "Trait data present and mapped from step 2."}, "GSE68606": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data available, so no final linked dataset can be produced."}, "GSE67766": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data available for this cohort."}, "GSE49278": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data found; skipped clinical-linking steps."}, "GSE19776": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data found; skipped clinical-linking steps."}, "GSE143383": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data found; skipped clinical-linking steps."}, "GSE108088": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "No trait data found; skipped clinical-linking steps."}, "TCGA": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": true, "has_gender": false, "sample_size": 79, "note": ""}}
|
p1/preprocess/Adrenocortical_Cancer/gene_data/GSE108088.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cb50d3f64363391929b11b0b0c3b9b60220fdf282410c0fbee176df2e3905608
|
3 |
+
size 11463867
|
p1/preprocess/Adrenocortical_Cancer/gene_data/GSE143383.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b84c1abcbbb0d634ec65f7af9b8266221d89f82714b2571c6600d3f9c49e5558
|
3 |
+
size 12280887
|
p1/preprocess/Adrenocortical_Cancer/gene_data/GSE19776.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ID,GSM493903,GSM493904,GSM493905,GSM493906,GSM493907,GSM493908,GSM493909,GSM493910,GSM493911,GSM493912,GSM493913,GSM493914,GSM493915,GSM493916,GSM493917
|
p1/preprocess/Adrenocortical_Cancer/gene_data/GSE49278.csv
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ID,GSM1196511,GSM1196512,GSM1196513,GSM1196514,GSM1196515,GSM1196516,GSM1196517,GSM1196518,GSM1196519,GSM1196520,GSM1196521,GSM1196522,GSM1196523,GSM1196524,GSM1196525,GSM1196526,GSM1196527,GSM1196528,GSM1196529,GSM1196530,GSM1196531,GSM1196532,GSM1196533,GSM1196534,GSM1196535,GSM1196536,GSM1196537,GSM1196538,GSM1196539,GSM1196540,GSM1196541,GSM1196542,GSM1196543,GSM1196544,GSM1196545,GSM1196546,GSM1196547,GSM1196548,GSM1196549,GSM1196550,GSM1196551,GSM1196552,GSM1196553,GSM1196554
|