Liu-Hy commited on
Commit
a3c6344
·
verified ·
1 Parent(s): ee94703

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +16 -0
  2. p1/preprocess/Acute_Myeloid_Leukemia/gene_data/TCGA.csv +3 -0
  3. p1/preprocess/Adrenocortical_Cancer/gene_data/GSE90713.csv +3 -0
  4. p1/preprocess/Adrenocortical_Cancer/gene_data/TCGA.csv +3 -0
  5. p1/preprocess/Age-Related_Macular_Degeneration/GSE29801.csv +3 -0
  6. p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE29801.csv +3 -0
  7. p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE38662.csv +3 -0
  8. p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE43176.csv +3 -0
  9. p1/preprocess/Allergies/GSE182740.csv +3 -0
  10. p1/preprocess/Allergies/GSE185658.csv +3 -0
  11. p1/preprocess/Allergies/GSE203196.csv +0 -0
  12. p1/preprocess/Allergies/clinical_data/GSE185658.csv +2 -0
  13. p1/preprocess/Allergies/clinical_data/GSE203196.csv +4 -0
  14. p1/preprocess/Allergies/clinical_data/GSE270312.csv +3 -0
  15. p1/preprocess/Allergies/code/GSE169149.py +161 -0
  16. p1/preprocess/Allergies/code/GSE182740.py +195 -0
  17. p1/preprocess/Allergies/code/GSE184382.py +142 -0
  18. p1/preprocess/Allergies/code/GSE185658.py +163 -0
  19. p1/preprocess/Allergies/code/GSE192454.py +152 -0
  20. p1/preprocess/Allergies/code/GSE203196.py +199 -0
  21. p1/preprocess/Allergies/code/GSE203409.py +157 -0
  22. p1/preprocess/Allergies/code/GSE205151.py +132 -0
  23. p1/preprocess/Allergies/code/GSE230164.py +141 -0
  24. p1/preprocess/Allergies/code/GSE270312.py +145 -0
  25. p1/preprocess/Allergies/code/GSE84046.py +155 -0
  26. p1/preprocess/Allergies/code/TCGA.py +57 -0
  27. p1/preprocess/Allergies/gene_data/GSE169149.csv +0 -0
  28. p1/preprocess/Allergies/gene_data/GSE182740.csv +3 -0
  29. p1/preprocess/Allergies/gene_data/GSE184382.csv +0 -0
  30. p1/preprocess/Allergies/gene_data/GSE185658.csv +3 -0
  31. p1/preprocess/Allergies/gene_data/GSE192454.csv +0 -0
  32. p1/preprocess/Allergies/gene_data/GSE203196.csv +0 -0
  33. p1/preprocess/Allergies/gene_data/GSE203409.csv +0 -0
  34. p1/preprocess/Allergies/gene_data/GSE205151.csv +0 -0
  35. p1/preprocess/Allergies/gene_data/GSE230164.csv +3 -0
  36. p1/preprocess/Allergies/gene_data/GSE270312.csv +0 -0
  37. p1/preprocess/Allergies/gene_data/GSE84046.csv +3 -0
  38. p1/preprocess/Alopecia/clinical_data/GSE66664.csv +2 -0
  39. p1/preprocess/Alopecia/clinical_data/GSE80342.csv +4 -0
  40. p1/preprocess/Alopecia/clinical_data/GSE81071.csv +2 -0
  41. p1/preprocess/Alopecia/code/GSE148346.py +149 -0
  42. p1/preprocess/Alopecia/code/GSE18876.py +158 -0
  43. p1/preprocess/Alopecia/code/GSE66664.py +174 -0
  44. p1/preprocess/Alopecia/code/GSE80342.py +192 -0
  45. p1/preprocess/Alopecia/code/GSE81071.py +189 -0
  46. p1/preprocess/Alopecia/code/TCGA.py +57 -0
  47. p1/preprocess/Alopecia/cohort_info.json +1 -0
  48. p1/preprocess/Alopecia/gene_data/GSE80342.csv +0 -0
  49. p1/preprocess/Alopecia/gene_data/GSE81071.csv +1 -0
  50. p1/preprocess/Alzheimers_Disease/GSE117589.csv +32 -0
.gitattributes CHANGED
@@ -924,3 +924,19 @@ p1/preprocess/Acute_Myeloid_Leukemia/gene_data/GSE161532.csv filter=lfs diff=lfs
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
927
+ p1/preprocess/Adrenocortical_Cancer/gene_data/GSE90713.csv filter=lfs diff=lfs merge=lfs -text
928
+ p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE43176.csv filter=lfs diff=lfs merge=lfs -text
929
+ p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE38662.csv filter=lfs diff=lfs merge=lfs -text
930
+ p1/preprocess/Adrenocortical_Cancer/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
931
+ p1/preprocess/Allergies/GSE182740.csv filter=lfs diff=lfs merge=lfs -text
932
+ p1/preprocess/Allergies/GSE185658.csv filter=lfs diff=lfs merge=lfs -text
933
+ p1/preprocess/Age-Related_Macular_Degeneration/GSE29801.csv filter=lfs diff=lfs merge=lfs -text
934
+ p1/preprocess/Acute_Myeloid_Leukemia/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
935
+ p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE29801.csv filter=lfs diff=lfs merge=lfs -text
936
+ p1/preprocess/Von_Hippel_Lindau/TCGA.csv filter=lfs diff=lfs merge=lfs -text
937
+ p1/preprocess/Allergies/gene_data/GSE182740.csv filter=lfs diff=lfs merge=lfs -text
938
+ p1/preprocess/Allergies/gene_data/GSE84046.csv filter=lfs diff=lfs merge=lfs -text
939
+ p1/preprocess/Von_Hippel_Lindau/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
940
+ p1/preprocess/Allergies/gene_data/GSE185658.csv filter=lfs diff=lfs merge=lfs -text
941
+ p1/preprocess/Thyroid_Cancer/TCGA.csv filter=lfs diff=lfs merge=lfs -text
942
+ p1/preprocess/Allergies/gene_data/GSE230164.csv filter=lfs diff=lfs merge=lfs -text
p1/preprocess/Acute_Myeloid_Leukemia/gene_data/TCGA.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb21aaffce97761860ea3e19dc18e974ff7a2bc786c22ba1f85d585c53893b2a
3
+ size 51467419
p1/preprocess/Adrenocortical_Cancer/gene_data/GSE90713.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dbfc52fb01783814edb23150227b6cf71e5640532c0870f54ddb0474f46971ea
3
+ size 16454062
p1/preprocess/Adrenocortical_Cancer/gene_data/TCGA.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb88446bced0cff3e824c9a989f3599680dbfcf274543b4e52cd5125bba5dbcd
3
+ size 23776634
p1/preprocess/Age-Related_Macular_Degeneration/GSE29801.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10dc1113899e64fb310f5fac55952429506cbeca85ccdc40567300607d360410
3
+ size 32413074
p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE29801.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52fa32d0646337ffcbb20913657fa132d2abdefad5f15ca969eabb5e422f0f4b
3
+ size 32409226
p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE38662.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6147f738acbd48f34cbe802c44c18958ba214292efc67f7bf703d30f26f1ccc5
3
+ size 13209116
p1/preprocess/Age-Related_Macular_Degeneration/gene_data/GSE43176.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:027ea925d47b7a2258a7223d85776848df79e4ec3ff133f9b82175915ac6dba7
3
+ size 10613167
p1/preprocess/Allergies/GSE182740.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:922996df441ee6899082b2f03b081194f08acafd4faba715b212f9518701c727
3
+ size 16722903
p1/preprocess/Allergies/GSE185658.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96a4c549513592117b4869093c10f1cd17fc0a67601f86ffb7c207762d7fe148
3
+ size 18243249
p1/preprocess/Allergies/GSE203196.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Allergies/clinical_data/GSE185658.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ GSM5621296,GSM5621297,GSM5621298,GSM5621299,GSM5621300,GSM5621301,GSM5621302,GSM5621303,GSM5621304,GSM5621305,GSM5621306,GSM5621307,GSM5621308,GSM5621309,GSM5621310,GSM5621311,GSM5621312,GSM5621313,GSM5621314,GSM5621315,GSM5621316,GSM5621317,GSM5621318,GSM5621319,GSM5621320,GSM5621321,GSM5621322,GSM5621323,GSM5621324,GSM5621325,GSM5621326,GSM5621327,GSM5621328,GSM5621329,GSM5621330,GSM5621331,GSM5621332,GSM5621333,GSM5621334,GSM5621335,GSM5621336,GSM5621337,GSM5621338,GSM5621339,GSM5621340,GSM5621341,GSM5621342,GSM5621343
2
+ 1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0
p1/preprocess/Allergies/clinical_data/GSE203196.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ GSM6161618,GSM6161619,GSM6161620,GSM6161621,GSM6161622,GSM6161623,GSM6161624,GSM6161625,GSM6161626,GSM6161627,GSM6161628,GSM6161629,GSM6161630,GSM6161631,GSM6161632,GSM6161633,GSM6161634,GSM6161635,GSM6161636,GSM6161637,GSM6161638,GSM6161639,GSM6161640,GSM6161641,GSM6161642,GSM6161643,GSM6161644,GSM6161645,GSM6161646,GSM6161647
2
+ 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0
3
+ 28.0,28.0,28.0,28.0,28.0,28.0,40.0,40.0,40.0,24.0,24.0,24.0,21.0,21.0,21.0,27.0,27.0,27.0,22.0,22.0,22.0,50.0,50.0,50.0,41.0,41.0,41.0,26.0,26.0,26.0
4
+ 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0
p1/preprocess/Allergies/clinical_data/GSE270312.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ GSM8339381,GSM8339382,GSM8339383,GSM8339384,GSM8339385,GSM8339386,GSM8339387,GSM8339388,GSM8339389,GSM8339390,GSM8339391,GSM8339392,GSM8339393,GSM8339394,GSM8339395,GSM8339396,GSM8339397,GSM8339398,GSM8339399,GSM8339400,GSM8339401,GSM8339402,GSM8339403,GSM8339404,GSM8339405,GSM8339406,GSM8339407,GSM8339408,GSM8339409,GSM8339410,GSM8339411,GSM8339412,GSM8339413,GSM8339414,GSM8339415,GSM8339416,GSM8339417,GSM8339418,GSM8339419,GSM8339420,GSM8339421,GSM8339422,GSM8339423,GSM8339424,GSM8339425,GSM8339426,GSM8339427,GSM8339428,GSM8339429,GSM8339430,GSM8339431,GSM8339432,GSM8339433,GSM8339434,GSM8339435,GSM8339436,GSM8339437,GSM8339438,GSM8339439,GSM8339440,GSM8339441,GSM8339442,GSM8339443,GSM8339444,GSM8339445,GSM8339446,GSM8339447,GSM8339448,GSM8339449,GSM8339450,GSM8339451,GSM8339452,GSM8339453,GSM8339454,GSM8339455,GSM8339456,GSM8339457,GSM8339458,GSM8339459,GSM8339460,GSM8339461,GSM8339462,GSM8339463,GSM8339464,GSM8339465,GSM8339466,GSM8339467,GSM8339468,GSM8339469,GSM8339470
2
+ 0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0
3
+ 0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0
p1/preprocess/Allergies/code/GSE169149.py ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE169149"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE169149"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE169149.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE169149.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE169149.csv"
16
+ json_path = "./output/preprocess/1/Allergies/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # Step 1: Determine gene expression availability
43
+ is_gene_available = True # Based on the background, we assume this dataset likely contains gene expression data.
44
+
45
+ # Step 2: Identify data availability for 'trait', 'age', and 'gender'
46
+ # According to the sample characteristics dictionary, there is no mention of "Allergies," "age," or "gender."
47
+ trait_row = None
48
+ age_row = None
49
+ gender_row = None
50
+
51
+ # Step 2.2: Define data type conversion functions
52
+ def convert_trait(value: str) -> Optional[int]:
53
+ # No actual data for 'Allergies' in this dataset
54
+ return None
55
+
56
+ def convert_age(value: str) -> Optional[float]:
57
+ # No age information in this dataset
58
+ return None
59
+
60
+ def convert_gender(value: str) -> Optional[int]:
61
+ # No gender information in this dataset
62
+ return None
63
+
64
+ # Step 3: Conduct initial filtering and save metadata
65
+ is_trait_available = (trait_row is not None)
66
+ validate_and_save_cohort_info(
67
+ is_final=False,
68
+ cohort=cohort,
69
+ info_path=json_path,
70
+ is_gene_available=is_gene_available,
71
+ is_trait_available=is_trait_available
72
+ )
73
+
74
+ # Step 4: If trait data is available, extract clinical features; otherwise, skip.
75
+ if trait_row is not None:
76
+ selected_clinical_df = geo_select_clinical_features(
77
+ clinical_data,
78
+ trait=trait,
79
+ trait_row=trait_row,
80
+ convert_trait=convert_trait,
81
+ age_row=age_row,
82
+ convert_age=convert_age,
83
+ gender_row=gender_row,
84
+ convert_gender=convert_gender
85
+ )
86
+ preview = preview_df(selected_clinical_df)
87
+ selected_clinical_df.to_csv(out_clinical_data_file, index=False)
88
+ # STEP3
89
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
90
+ gene_data = get_genetic_data(matrix_file)
91
+
92
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
93
+ print(gene_data.index[:20])
94
+ # Based on the numeric nature of these identifiers, they do not appear to be conventional human gene symbols.
95
+ # Therefore, they require mapping to known gene symbols.
96
+ print("requires_gene_mapping = True")
97
+ # STEP5
98
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
99
+ gene_annotation = get_gene_annotation(soft_file)
100
+
101
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
102
+ print("Gene annotation preview:")
103
+ print(preview_df(gene_annotation))
104
+ # STEP: Gene Identifier Mapping
105
+
106
+ # 1. Decide which columns map the same kind of IDs as the gene expression data and which store the gene symbols
107
+ # From the annotation preview, the "ID" column matches the expression data identifiers (1, 2, 3, ...).
108
+ # The "Assay" column appears to contain the gene symbols.
109
+
110
+ # 2. Extract a gene mapping dataframe
111
+ mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="Assay")
112
+
113
+ # 3. Convert probe-level measurements to gene expression data
114
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
115
+
116
+ # Display the first few rows of the resulting gene expression dataframe for verification
117
+ print(gene_data.head())
118
+ import pandas as pd
119
+
120
+ # STEP 7: Data Normalization and (Conditional) Linking
121
+
122
+ # 1. Normalize gene symbols in the obtained gene expression data
123
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
124
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
125
+ print(f"Saved normalized gene data to {out_gene_data_file}")
126
+
127
+ # Since trait_row was None in step 2, we have no clinical features extracted.
128
+ # Hence 'clinical_data_selected' does not exist, and there is no trait column to link or to analyze.
129
+
130
+ # We will proceed with final validation using the fact that trait data is unavailable.
131
+ is_trait_available = False
132
+ is_gene_available = True # As concluded in step 2, it is a gene expression dataset
133
+
134
+ if not is_trait_available:
135
+ # Without trait data, we cannot link or do the usual missing-value handling by trait.
136
+ # We still provide the normalized_gene_data to the validator (though it won't be used for trait analysis).
137
+ final_data = normalized_gene_data
138
+ is_biased = False # We must supply a boolean; no trait data => cannot assess bias
139
+
140
+ # 5. Final quality validation
141
+ is_usable = validate_and_save_cohort_info(
142
+ is_final=True,
143
+ cohort=cohort,
144
+ info_path=json_path,
145
+ is_gene_available=is_gene_available,
146
+ is_trait_available=is_trait_available,
147
+ is_biased=is_biased,
148
+ df=final_data,
149
+ note="No trait data available in this dataset."
150
+ )
151
+
152
+ # 6. If the dataset is usable, save final data; however, in this scenario it likely won't be.
153
+ if is_usable:
154
+ final_data.to_csv(out_data_file)
155
+ print(f"Saved final linked data to {out_data_file}")
156
+ else:
157
+ print("Data not usable; skipping final output.")
158
+ else:
159
+ # If trait data were available, we would link, handle missing values, check bias, and finalize.
160
+ # This branch is skipped because 'is_trait_available' is False.
161
+ pass
p1/preprocess/Allergies/code/GSE182740.py ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE182740"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE182740"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE182740.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE182740.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE182740.csv"
16
+ json_path = "./output/preprocess/1/Allergies/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1. Gene Expression Data Availability
43
+ # Based on the background information ("Global mRNA expression" is mentioned),
44
+ # we conclude that gene expression data is available:
45
+ is_gene_available = True
46
+
47
+ # 2. Variable Availability and Data Type Conversion
48
+
49
+ # After reviewing the sample characteristics dictionary, we see that
50
+ # key=1 contains "disease: Psoriasis", "disease: Atopic_dermatitis", "disease: Mixed", "disease: Normal_skin".
51
+ # We can use this to infer a binary trait for "Allergies" if "Atopic_dermatitis" or "Mixed" is present, else 0.
52
+ trait_row = 1 # because it provides disease info that we can map to 'Allergies'
53
+
54
+ # No mention of age or gender in the dictionary, so these are not available:
55
+ age_row = None
56
+ gender_row = None
57
+
58
+ # Define the conversion functions.
59
+ def convert_trait(value: str):
60
+ """
61
+ Convert a string like "disease: Psoriasis" to a binary indicator for the trait "Allergies".
62
+ We parse the substring after "disease:" and map:
63
+ - "Atopic_dermatitis" or "Mixed" -> 1 (indicative of 'Allergies')
64
+ - Otherwise -> 0
65
+ Unknown or unexpected -> None
66
+ """
67
+ if not isinstance(value, str):
68
+ return None
69
+
70
+ # Typically "disease: something", split by colon
71
+ parts = value.split(":", 1)
72
+ if len(parts) < 2:
73
+ return None
74
+ disease_str = parts[1].strip().lower() # e.g. "psoriasis", "atopic_dermatitis", "mixed", "normal_skin"
75
+
76
+ if "atopic_dermatitis" in disease_str or "mixed" in disease_str:
77
+ return 1
78
+ elif "psoriasis" in disease_str or "normal_skin" in disease_str:
79
+ return 0
80
+ else:
81
+ return None
82
+
83
+ def convert_age(value: str):
84
+ """
85
+ Data not available; placeholder function returning None.
86
+ """
87
+ return None
88
+
89
+ def convert_gender(value: str):
90
+ """
91
+ Data not available; placeholder function returning None.
92
+ """
93
+ return None
94
+
95
+ # 3. Save Metadata (initial filtering)
96
+ # Trait data is available if trait_row != None
97
+ is_trait_available = (trait_row is not None)
98
+
99
+ # Perform the initial validation and save metadata.
100
+ # The function returns True if the dataset passes final validation,
101
+ # but here we only do the initial filtering (is_final=False).
102
+ is_usable = validate_and_save_cohort_info(
103
+ is_final=False,
104
+ cohort=cohort,
105
+ info_path=json_path,
106
+ is_gene_available=is_gene_available,
107
+ is_trait_available=is_trait_available
108
+ )
109
+
110
+ # 4. Clinical Feature Extraction
111
+ # Proceed only if trait_row is not None
112
+ if trait_row is not None:
113
+ # Assuming "clinical_data" is the previously obtained clinical DataFrame
114
+ clinical_data_selected = geo_select_clinical_features(
115
+ clinical_df=clinical_data,
116
+ trait=trait,
117
+ trait_row=trait_row,
118
+ convert_trait=convert_trait,
119
+ age_row=age_row,
120
+ convert_age=convert_age,
121
+ gender_row=gender_row,
122
+ convert_gender=convert_gender
123
+ )
124
+
125
+ # Preview the selected clinical data
126
+ preview_result = preview_df(clinical_data_selected)
127
+ print("Clinical data preview:", preview_result)
128
+
129
+ # Save the extracted clinical features
130
+ clinical_data_selected.to_csv(out_clinical_data_file, index=False)
131
+ # STEP3
132
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
133
+ gene_data = get_genetic_data(matrix_file)
134
+
135
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
136
+ print(gene_data.index[:20])
137
+ # The given identifiers (e.g., '1007_s_at', '1053_at') appear to be Affymetrix probe IDs, not official gene symbols.
138
+ # Hence, we need to map them to recognized gene symbols.
139
+ print("requires_gene_mapping = True")
140
+ # STEP5
141
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
142
+ gene_annotation = get_gene_annotation(soft_file)
143
+
144
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
145
+ print("Gene annotation preview:")
146
+ print(preview_df(gene_annotation))
147
+ # STEP: Gene Identifier Mapping
148
+
149
+ # 1. Decide which keys in the gene annotation store the probe IDs and gene symbols
150
+ # From our observation, 'ID' matches the probe IDs (e.g., '1007_s_at'),
151
+ # and 'Gene Symbol' stores the gene symbols.
152
+
153
+ # 2. Get a gene mapping dataframe
154
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
155
+
156
+ # 3. Convert probe-level measurements to gene-level measurements
157
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
158
+
159
+ # (At this stage, 'gene_data' now holds gene-level expression data.)
160
+ import pandas as pd
161
+
162
+ # STEP 7: Data Normalization and Linking
163
+
164
+ # 1. Normalize gene symbols in the obtained gene expression data
165
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
166
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
167
+ print(f"Saved normalized gene data to {out_gene_data_file}")
168
+
169
+ # 2. Link clinical and genetic data
170
+ linked_data = geo_link_clinical_genetic_data(clinical_data_selected, normalized_gene_data)
171
+
172
+ # 3. Handle missing values
173
+ cleaned_data = handle_missing_values(linked_data, trait)
174
+
175
+ # 4. Determine bias in trait and demographic features
176
+ trait_biased, final_data = judge_and_remove_biased_features(cleaned_data, trait)
177
+
178
+ # 5. Final validation and save metadata
179
+ is_usable = validate_and_save_cohort_info(
180
+ is_final=True,
181
+ cohort=cohort,
182
+ info_path=json_path,
183
+ is_gene_available=True,
184
+ is_trait_available=True,
185
+ is_biased=trait_biased,
186
+ df=final_data,
187
+ note="Processed with standard GEO pipeline."
188
+ )
189
+
190
+ # 6. If data is usable, save the final linked data
191
+ if is_usable:
192
+ final_data.to_csv(out_data_file)
193
+ print(f"Saved final linked data to {out_data_file}")
194
+ else:
195
+ print("Data not usable; skipping final output.")
p1/preprocess/Allergies/code/GSE184382.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE184382"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE184382"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE184382.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE184382.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE184382.csv"
16
+ json_path = "./output/preprocess/1/Allergies/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1. Gene Expression Data Availability
43
+ # Based on the background info mentioning both miR microarray and transcriptome microarray,
44
+ # we conclude that gene expression data is available.
45
+ is_gene_available = True
46
+
47
+ # 2. Variable Availability and Data Type Conversion
48
+ # From the sample characteristics dictionary, we do not have any rows indicating the 'Allergies' trait,
49
+ # age, or gender. Hence, none of these variables are available.
50
+ trait_row = None
51
+ age_row = None
52
+ gender_row = None
53
+
54
+ # Define conversion functions. Although the variables are not available, we still provide the requested functions.
55
+ def convert_trait(value: str):
56
+ # No actual data to convert; return None
57
+ return None
58
+
59
+ def convert_age(value: str):
60
+ # No actual data to convert; return None
61
+ return None
62
+
63
+ def convert_gender(value: str):
64
+ # No actual data to convert; return None
65
+ return None
66
+
67
+ # 3. Save Metadata (Initial Filtering)
68
+ # Trait data availability is determined by whether trait_row is None.
69
+ is_trait_available = (trait_row is not None)
70
+
71
+ # We perform the initial validation (is_final=False).
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
81
+ # Since trait_row is None, we skip clinical feature extraction as instructed.
82
+ # STEP3
83
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
84
+ gene_data = get_genetic_data(matrix_file)
85
+
86
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
87
+ print(gene_data.index[:20])
88
+ # Based on the identifiers like "A_19_P00315452", these appear to be microarray probe IDs (not standard human gene symbols).
89
+ # Therefore, they need to be mapped to human gene symbols.
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. Decide which annotation columns match our expression data IDs and gene symbols:
101
+ # - The "ID" column in the annotation file corresponds to probe identifiers (e.g., "A_21_P0014386", "A_19_P00315452").
102
+ # - The "GENE_SYMBOL" column stores the gene symbol.
103
+
104
+ # 2. Get the gene mapping dataframe using the relevant columns from the annotation.
105
+ gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
106
+
107
+ # 3. Convert probe-level measurements to gene expression data by applying the gene mapping.
108
+ gene_data = apply_gene_mapping(gene_data, gene_mapping)
109
+ import pandas as pd
110
+
111
+ # STEP 5: Data Normalization and Linking
112
+
113
+ # 1. Normalize gene symbols in the obtained gene expression data
114
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
115
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
116
+ print(f"Saved normalized gene data to {out_gene_data_file}")
117
+
118
+ # Since in earlier steps trait_row was None, we have no clinical data to link.
119
+ # Hence, there's no trait column to process. We'll skip linking and further steps
120
+ # that require the trait. However, we must still perform a final validation.
121
+
122
+ # Prepare a dummy DataFrame for the final validation
123
+ dummy_df = pd.DataFrame()
124
+
125
+ # We must provide is_biased and df to the final validation.
126
+ # Because trait data is not available, this dataset won't be usable.
127
+ is_biased = False # Arbitrarily set; since trait is unavailable, "is_usable" will be False anyway.
128
+
129
+ is_usable = validate_and_save_cohort_info(
130
+ is_final=True,
131
+ cohort=cohort,
132
+ info_path=json_path,
133
+ is_gene_available=True, # Gene data is available
134
+ is_trait_available=False, # Trait data is not available
135
+ is_biased=is_biased,
136
+ df=dummy_df,
137
+ note="No trait data available; skipping linking."
138
+ )
139
+
140
+ # 6. If data were usable, we would save it; otherwise we do nothing
141
+ if is_usable:
142
+ print("Data is unexpectedly marked usable, but trait is unavailable. Skipping save.")
p1/preprocess/Allergies/code/GSE185658.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE185658"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE185658"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE185658.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE185658.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE185658.csv"
16
+ json_path = "./output/preprocess/1/Allergies/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1) Check if gene expression data is available:
43
+ is_gene_available = True # Based on microarray mention in the background info
44
+
45
+ # 2) Identify trait_row, age_row, gender_row, and define the conversion functions:
46
+ trait_row = 1 # "group" key likely indicates allergic status (AsthmaHDM vs. others)
47
+ age_row = None # No age info found
48
+ gender_row = None # No gender info found
49
+
50
+ def convert_trait(value: str):
51
+ # Extract the substring after the colon
52
+ parts = value.split(':', 1)
53
+ if len(parts) < 2:
54
+ return None
55
+ val = parts[1].strip()
56
+ # Interpret "AsthmaHDM" as having allergies (1) and others as no allergies (0)
57
+ if val == 'AsthmaHDM':
58
+ return 1
59
+ elif val in ['AsthmaHDMNeg', 'Healthy']:
60
+ return 0
61
+ return None
62
+
63
+ # Not used due to unavailability:
64
+ convert_age = None
65
+ convert_gender = None
66
+
67
+ # 3) Initial filtering and metadata saving:
68
+ is_trait_available = (trait_row is not None)
69
+ is_usable = validate_and_save_cohort_info(
70
+ is_final=False,
71
+ cohort=cohort,
72
+ info_path=json_path,
73
+ is_gene_available=is_gene_available,
74
+ is_trait_available=is_trait_available
75
+ )
76
+
77
+ # 4) Clinical feature extraction if trait data is available:
78
+ if trait_row is not None:
79
+ selected_clinical_df = geo_select_clinical_features(
80
+ clinical_data,
81
+ trait,
82
+ trait_row,
83
+ convert_trait,
84
+ age_row,
85
+ convert_age,
86
+ gender_row,
87
+ convert_gender
88
+ )
89
+ print(preview_df(selected_clinical_df, n=5))
90
+ selected_clinical_df.to_csv(out_clinical_data_file, index=False)
91
+ # STEP3
92
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
93
+ gene_data = get_genetic_data(matrix_file)
94
+
95
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
96
+ print(gene_data.index[:20])
97
+ # Based on the numeric indices (e.g., '7892501', '7892502') rather than standard gene symbols like 'CD69' or 'TNF',
98
+ # these identifiers appear to be probe IDs or some other non-human-gene-symbol identifiers that would require mapping.
99
+
100
+ requires_gene_mapping = True
101
+ # STEP5
102
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
103
+ gene_annotation = get_gene_annotation(soft_file)
104
+
105
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
106
+ print("Gene annotation preview:")
107
+ print(preview_df(gene_annotation))
108
+ # STEP 6: Gene Identifier Mapping
109
+
110
+ # 1. The column "ID" in gene_annotation matches the probe IDs in the expression data,
111
+ # and "gene_assignment" contains the relevant references for gene symbols.
112
+
113
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
114
+
115
+ # 2. Convert probe-level measurements to gene-level data.
116
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
117
+
118
+ # Quick check of the resulting gene_data
119
+ print("Gene-level expression data shape:", gene_data.shape)
120
+ print("First 20 gene symbols:", gene_data.index[:20].tolist())
121
+ import pandas as pd
122
+
123
+ # STEP 7: Data Normalization and Linking
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
+ print(f"Saved normalized gene data to {out_gene_data_file}")
129
+
130
+ # 2. Read the previously saved clinical data (which contains the trait) correctly:
131
+ # Since we saved a single row (the trait) with multiple columns (sample IDs),
132
+ # we read it as a normal CSV (no index_col) and then set the row index to the trait name.
133
+ clinical_df = pd.read_csv(out_clinical_data_file)
134
+ # Assign the single row index to the trait; columns are sample IDs.
135
+ clinical_df.index = [trait]
136
+
137
+ # 3. Link the clinical and genetic data
138
+ linked_data = geo_link_clinical_genetic_data(clinical_df, normalized_gene_data)
139
+
140
+ # 4. Handle missing values in the linked data
141
+ linked_data = handle_missing_values(linked_data, trait_col=trait)
142
+
143
+ # 5. Check and remove biased features, and see if our trait is biased
144
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
145
+
146
+ # 6. Final validation and saving metadata
147
+ is_usable = validate_and_save_cohort_info(
148
+ is_final=True,
149
+ cohort=cohort,
150
+ info_path=json_path,
151
+ is_gene_available=True,
152
+ is_trait_available=True,
153
+ is_biased=is_biased,
154
+ df=linked_data,
155
+ note="Processed with correct trait indexing, missing-value handling, and bias checks."
156
+ )
157
+
158
+ # 7. If the dataset is usable, save the final linked data
159
+ if is_usable:
160
+ linked_data.to_csv(out_data_file, index=True)
161
+ print(f"Final linked data saved to {out_data_file}")
162
+ else:
163
+ print("Dataset is not usable; final linked data not saved.")
p1/preprocess/Allergies/code/GSE192454.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE192454"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE192454"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE192454.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE192454.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE192454.csv"
16
+ json_path = "./output/preprocess/1/Allergies/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1. Gene Expression Data Availability
43
+ # Based on "whole transcriptome profiling by microarray", we consider gene expression data present.
44
+ is_gene_available = True
45
+
46
+ # 2. Variable Availability and Data Type Conversion
47
+
48
+ # From the sample characteristics dictionary, there is no row that indicates 'Allergies'
49
+ # or any direct or inferred measure of atopic condition variability, so trait data is not available.
50
+ trait_row = None
51
+
52
+ # No 'age' or 'gender' information is provided. Hence, both are unavailable.
53
+ age_row = None
54
+ gender_row = None
55
+
56
+ # Define data conversion functions as requested (they will not be used here since rows are None).
57
+ def convert_trait(value: str):
58
+ # Typically extract the part after the colon
59
+ parts = value.split(':', 1)
60
+ val = parts[1].strip() if len(parts) > 1 else ''
61
+ # For "Allergies" we would normally map, but data is not available here
62
+ # Unknown or missing values go to None
63
+ return None
64
+
65
+ def convert_age(value: str):
66
+ # Typically extract numeric age or None
67
+ parts = value.split(':', 1)
68
+ val = parts[1].strip() if len(parts) > 1 else ''
69
+ # Not available, so default to None
70
+ return None
71
+
72
+ def convert_gender(value: str):
73
+ # Typically map female->0, male->1
74
+ parts = value.split(':', 1)
75
+ val = parts[1].strip() if len(parts) > 1 else ''
76
+ # Not available, so default to None
77
+ return None
78
+
79
+ # 3. Save Metadata with initial filtering
80
+ is_trait_available = (trait_row is not None)
81
+ validate_and_save_cohort_info(
82
+ is_final=False,
83
+ cohort=cohort,
84
+ info_path=json_path,
85
+ is_gene_available=is_gene_available,
86
+ is_trait_available=is_trait_available
87
+ )
88
+
89
+ # 4. Clinical Feature Extraction
90
+ # Since trait_row is None, no clinical feature extraction is performed.
91
+ # STEP3
92
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
93
+ gene_data = get_genetic_data(matrix_file)
94
+
95
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
96
+ print(gene_data.index[:20])
97
+ # Based on the provided identifiers, they appear to be numeric IDs rather than human gene symbols.
98
+ # Therefore, they likely need to be mapped to proper gene symbols.
99
+
100
+ print("requires_gene_mapping = True")
101
+ # STEP5
102
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
103
+ gene_annotation = get_gene_annotation(soft_file)
104
+
105
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
106
+ print("Gene annotation preview:")
107
+ print(preview_df(gene_annotation))
108
+ # STEP: Gene Identifier Mapping
109
+
110
+ # 1. Identify the columns in the gene annotation that match the gene expression data ID and the gene symbol.
111
+ # Here, the 'ID' column in gene_annotation matches the numeric IDs in gene_data,
112
+ # and the 'GENE_SYMBOL' column stores the gene symbols.
113
+
114
+ # 2. Get the gene mapping dataframe:
115
+ mapping_df = get_gene_mapping(gene_annotation, "ID", "GENE_SYMBOL")
116
+
117
+ # 3. Convert probe-level measurements to gene-level expression data:
118
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
119
+ import pandas as pd
120
+
121
+ # STEP 5: Data Normalization and Linking
122
+
123
+ # 1. Normalize gene symbols in the obtained gene expression 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
+ print(f"Saved normalized gene data to {out_gene_data_file}")
127
+
128
+ # Since in earlier steps trait_row was None, we have no clinical data to link.
129
+ # Hence, there's no trait column to process. We'll skip linking and further steps
130
+ # that require the trait. However, we must still perform a final validation.
131
+
132
+ # Prepare a dummy DataFrame for the final validation
133
+ dummy_df = pd.DataFrame()
134
+
135
+ # We must provide is_biased and df to the final validation.
136
+ # Because trait data is not available, this dataset won't be usable.
137
+ is_biased = False # Arbitrarily set; since trait is unavailable, "is_usable" will be False anyway.
138
+
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, # Gene data is available
144
+ is_trait_available=False, # Trait data is not available
145
+ is_biased=is_biased,
146
+ df=dummy_df,
147
+ note="No trait data available; skipping linking."
148
+ )
149
+
150
+ # 6. If data were usable, we would save it; otherwise we do nothing
151
+ if is_usable:
152
+ print("Data is unexpectedly marked usable, but trait is unavailable. Skipping save.")
p1/preprocess/Allergies/code/GSE203196.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE203196"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE203196"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE203196.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE203196.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE203196.csv"
16
+ json_path = "./output/preprocess/1/Allergies/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1. Determine if gene expression data is available
43
+ is_gene_available = True # Based on the summary: "RNA ... used for transcriptomic studies"
44
+
45
+ # 2. Determine data availability for trait, age, and gender (row keys) and define type conversions
46
+
47
+ # From the sample characteristics dictionary:
48
+ # {0: ['cell type: ...'],
49
+ # 1: ['gender: F','gender: M'],
50
+ # 2: ['individual: patient16', ...],
51
+ # 3: ['age: 28','age: 40',...],
52
+ # 4: ['allergy: mild','allergy: severe','allergy: control']}
53
+ trait_row = 4 # variable "allergy: mild/severe/control"
54
+ age_row = 3 # variable "age: NN"
55
+ gender_row = 1 # variable "gender: F/M"
56
+
57
+ def convert_trait(value: str) -> Optional[int]:
58
+ """
59
+ Convert allergy values to binary:
60
+ 'control' -> 0, 'mild'/'severe' -> 1, otherwise None
61
+ """
62
+ # Expected format is 'allergy: something'
63
+ parts = value.split(':')
64
+ if len(parts) < 2:
65
+ return None
66
+ val = parts[1].strip().lower()
67
+ if val == 'control':
68
+ return 0
69
+ elif val in ['mild', 'severe']:
70
+ return 1
71
+ return None
72
+
73
+ def convert_age(value: str) -> Optional[float]:
74
+ """
75
+ Convert age values to float; unknown or malformed -> None
76
+ """
77
+ # Expected format is 'age: NN'
78
+ parts = value.split(':')
79
+ if len(parts) < 2:
80
+ return None
81
+ try:
82
+ return float(parts[1].strip())
83
+ except ValueError:
84
+ return None
85
+
86
+ def convert_gender(value: str) -> Optional[int]:
87
+ """
88
+ Convert gender values to binary:
89
+ 'F' -> 0, 'M' -> 1, otherwise None
90
+ """
91
+ # Expected format is 'gender: F' or 'gender: M'
92
+ parts = value.split(':')
93
+ if len(parts) < 2:
94
+ return None
95
+ val = parts[1].strip().upper()
96
+ if val == 'F':
97
+ return 0
98
+ elif val == 'M':
99
+ return 1
100
+ return None
101
+
102
+ # Determine if trait data is available
103
+ is_trait_available = (trait_row is not None)
104
+
105
+ # 3. Initial filtering and saving metadata
106
+ is_usable = validate_and_save_cohort_info(
107
+ is_final=False,
108
+ cohort=cohort,
109
+ info_path=json_path,
110
+ is_gene_available=is_gene_available,
111
+ is_trait_available=is_trait_available
112
+ )
113
+
114
+ # 4. Clinical feature extraction (only if trait_row is not None)
115
+ if trait_row is not None:
116
+ # Suppose 'clinical_data' DataFrame was obtained in a previous step
117
+ # We'll assume it's already loaded in the environment
118
+ df_clinical = geo_select_clinical_features(
119
+ clinical_data,
120
+ trait=trait,
121
+ trait_row=trait_row,
122
+ convert_trait=convert_trait,
123
+ age_row=age_row,
124
+ convert_age=convert_age,
125
+ gender_row=gender_row,
126
+ convert_gender=convert_gender
127
+ )
128
+ # Observe a preview of the extracted features
129
+ clinical_preview = preview_df(df_clinical)
130
+ print("Preview of clinical features:", clinical_preview)
131
+
132
+ # Save the clinical dataframe to CSV
133
+ df_clinical.to_csv(out_clinical_data_file, index=False)
134
+ # STEP3
135
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
136
+ gene_data = get_genetic_data(matrix_file)
137
+
138
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
139
+ print(gene_data.index[:20])
140
+ # Based on the numeric nature of these IDs, they are not standard human gene symbols and require mapping.
141
+ print("requires_gene_mapping = True")
142
+ # STEP5
143
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
144
+ gene_annotation = get_gene_annotation(soft_file)
145
+
146
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
147
+ print("Gene annotation preview:")
148
+ print(preview_df(gene_annotation))
149
+ # STEP 6: Gene Identifier Mapping
150
+
151
+ # 1. Identify which annotation columns match the expression data and gene symbols
152
+ # - The gene expression data index is stored in "ID"
153
+ # - The likely column with gene symbols is "gene_assignment"
154
+
155
+ # 2. Get the gene mapping dataframe
156
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
157
+
158
+ # 3. Convert probe-level data to gene expression data
159
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
160
+
161
+ # (Optional) Print a quick shape check to confirm mapping
162
+ print("Mapped gene expression data shape:", gene_data.shape)
163
+ # STEP 7: Data Normalization and Linking
164
+
165
+ import pandas as pd
166
+
167
+ # 1. Normalize gene symbols in the obtained gene expression data
168
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
169
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
170
+ print(f"Saved normalized gene data to {out_gene_data_file}")
171
+
172
+ # 2. Link the refined clinical data (with "Allergies" column) to the normalized gene data
173
+ # Recall that 'df_clinical' was created in an earlier step and contains the trait column "Allergies."
174
+ linked_data = geo_link_clinical_genetic_data(df_clinical, normalized_gene_data)
175
+
176
+ # 3. Handle missing values in the linked dataset
177
+ processed_data = handle_missing_values(linked_data, trait)
178
+
179
+ # 4. Judge if the trait (and covariates) are biased
180
+ trait_biased, processed_data = judge_and_remove_biased_features(processed_data, trait)
181
+
182
+ # 5. Conduct final quality validation and save metadata
183
+ is_usable = validate_and_save_cohort_info(
184
+ is_final=True,
185
+ cohort=cohort,
186
+ info_path=json_path,
187
+ is_gene_available=True,
188
+ is_trait_available=True,
189
+ is_biased=trait_biased,
190
+ df=processed_data,
191
+ note="Linked clinical and gene data successfully."
192
+ )
193
+
194
+ # 6. If the dataset is usable, save the final linked DataFrame
195
+ if is_usable:
196
+ processed_data.to_csv(out_data_file, index=True)
197
+ print(f"Final linked data saved to {out_data_file}")
198
+ else:
199
+ print("Data was determined not to be usable; final dataset not saved.")
p1/preprocess/Allergies/code/GSE203409.py ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE203409"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE203409"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE203409.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE203409.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE203409.csv"
16
+ json_path = "./output/preprocess/1/Allergies/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1. Gene Expression Data Availability
43
+ # Based on the series title and summary ("Gene expression profiling..."),
44
+ # we conclude that gene expression data is indeed available.
45
+ is_gene_available = True
46
+
47
+ # 2. Variable Availability and Data Type Conversion
48
+
49
+ # From the sample characteristics dictionary, we see:
50
+ # 0 -> cell line info
51
+ # 1 -> knockdown info
52
+ # 2 -> treatment info
53
+ # 3 -> treatment compound concentration
54
+ # This dataset is an in vitro study using a HaCaT cell line.
55
+ # There is no human-level "Allergies" status, no age, and no gender data.
56
+ # Hence, for each variable (trait, age, gender), data is NOT available.
57
+
58
+ trait_row = None
59
+ age_row = None
60
+ gender_row = None
61
+
62
+ # Even though data is not available, we must define conversion functions.
63
+ # If called, they would handle extraction and conversion logic. Here, they return None.
64
+
65
+ def convert_trait(value: str):
66
+ # Placeholder implementation.
67
+ # Usually, we'd parse 'value' after the colon, e.g. value.split(':')[-1].strip().
68
+ # But since data is not available, always return None.
69
+ return None
70
+
71
+ def convert_age(value: str):
72
+ # Placeholder implementation.
73
+ return None
74
+
75
+ def convert_gender(value: str):
76
+ # Placeholder implementation.
77
+ return None
78
+
79
+ # 3. Save Metadata
80
+ # We do an initial validation using 'validate_and_save_cohort_info'.
81
+ # Trait data availability is determined by (trait_row is not None).
82
+ is_trait_available = (trait_row is not None)
83
+
84
+ is_usable = 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
+ # Since trait_row is None, we skip the clinical extraction step.
94
+ # (No substep needed as there is no clinical data to extract.)
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 inspection, the identifiers "ILMN_xxxxxx" appear to be Illumina probe IDs, not standard human gene symbols.
102
+ # Therefore, gene symbol mapping is required.
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
+ # STEP: Gene Identifier Mapping
112
+
113
+ # 1) From the preview, the "ID" column in 'gene_annotation' matches the probe IDs in 'gene_data' (both have "ILMN_xxxxx" format),
114
+ # and the "Symbol" column holds the gene symbol information.
115
+ # 2) Create a mapping dataframe.
116
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
117
+
118
+ # 3) Convert probe-level measurements to gene-level by applying the mapping.
119
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
120
+
121
+ # For confirmation, print out the shape and a small preview of the mapped gene_data.
122
+ print("Gene data shape after mapping:", gene_data.shape)
123
+ print(gene_data.head())
124
+ import pandas as pd
125
+
126
+ # STEP 5: Data Normalization and Linking
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
+ print(f"Saved normalized gene data to {out_gene_data_file}")
132
+
133
+ # Since in earlier steps trait_row was None, we have no clinical data to link.
134
+ # Hence, there's no trait column to process. We'll skip linking and further steps
135
+ # that require the trait. However, we must still perform a final validation.
136
+
137
+ # Prepare a dummy DataFrame for the final validation
138
+ dummy_df = pd.DataFrame()
139
+
140
+ # We must provide is_biased and df to the final validation.
141
+ # Because trait data is not available, this dataset won't be usable.
142
+ is_biased = False # Arbitrarily set; since trait is unavailable, "is_usable" will be False anyway.
143
+
144
+ is_usable = validate_and_save_cohort_info(
145
+ is_final=True,
146
+ cohort=cohort,
147
+ info_path=json_path,
148
+ is_gene_available=True, # Gene data is available
149
+ is_trait_available=False, # Trait data is not available
150
+ is_biased=is_biased,
151
+ df=dummy_df,
152
+ note="No trait data available; skipping linking."
153
+ )
154
+
155
+ # 6. If data were usable, we would save it; otherwise we do nothing
156
+ if is_usable:
157
+ print("Data is unexpectedly marked usable, but trait is unavailable. Skipping save.")
p1/preprocess/Allergies/code/GSE205151.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE205151"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE205151"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE205151.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE205151.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE205151.csv"
16
+ json_path = "./output/preprocess/1/Allergies/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1. Determine if gene expression data is available
43
+ is_gene_available = True # This dataset includes mRNA analysis from a Nanostring array.
44
+
45
+ # 2. Identify data availability and define conversion functions
46
+
47
+ # Since the sample characteristics dictionary only shows "polyic_stimulation" and "cluster" data,
48
+ # and does not contain explicit or implicit information about the trait "Allergies", age, or gender,
49
+ # we set their row keys to None.
50
+ trait_row = None
51
+ age_row = None
52
+ gender_row = None
53
+
54
+ # Define data-type conversion functions
55
+ def convert_trait(x: str):
56
+ """
57
+ Convert a raw string to a binary indicator (0 or 1) or None.
58
+ This is a placeholder function: no actual conversion logic is used
59
+ here since 'trait_row' is None for this dataset.
60
+ """
61
+ return None
62
+
63
+ def convert_age(x: str):
64
+ """
65
+ Convert a raw string to a float age or None.
66
+ This is a placeholder function: no actual conversion logic is used
67
+ here since 'age_row' is None for this dataset.
68
+ """
69
+ return None
70
+
71
+ def convert_gender(x: str):
72
+ """
73
+ Convert a raw string to 0 (female), 1 (male), or None.
74
+ This is a placeholder function: no actual conversion logic is used
75
+ here since 'gender_row' is None for this dataset.
76
+ """
77
+ return None
78
+
79
+ # 3. Save metadata (initial filtering)
80
+ is_trait_available = (trait_row is not None)
81
+ _ = validate_and_save_cohort_info(
82
+ is_final=False,
83
+ cohort=cohort,
84
+ info_path=json_path,
85
+ is_gene_available=is_gene_available,
86
+ is_trait_available=is_trait_available
87
+ )
88
+
89
+ # 4. Clinical feature extraction (skip because trait_row is None)
90
+ # No clinical data extraction step is performed here.
91
+ # STEP3
92
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
93
+ gene_data = get_genetic_data(matrix_file)
94
+
95
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
96
+ print(gene_data.index[:20])
97
+ # Observed gene identifiers are standard recognized human gene symbols, so no mapping is required.
98
+ requires_gene_mapping = False
99
+ import pandas as pd
100
+
101
+ # STEP 5: Data Normalization and Linking
102
+
103
+ # 1. Normalize gene symbols in the obtained gene expression data
104
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
105
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
106
+ print(f"Saved normalized gene data to {out_gene_data_file}")
107
+
108
+ # Since in earlier steps trait_row was None, we have no clinical data to link.
109
+ # Hence, there's no trait column to process. We'll skip linking and further steps
110
+ # that require the trait. However, we must still perform a final validation.
111
+
112
+ # Prepare a dummy DataFrame for the final validation
113
+ dummy_df = pd.DataFrame()
114
+
115
+ # We must provide is_biased and df to the final validation.
116
+ # Because trait data is not available, this dataset won't be usable.
117
+ is_biased = False # Arbitrarily set; since trait is unavailable, "is_usable" will be False anyway.
118
+
119
+ is_usable = validate_and_save_cohort_info(
120
+ is_final=True,
121
+ cohort=cohort,
122
+ info_path=json_path,
123
+ is_gene_available=True, # Gene data is available
124
+ is_trait_available=False, # Trait data is not available
125
+ is_biased=is_biased,
126
+ df=dummy_df,
127
+ note="No trait data available; skipping linking."
128
+ )
129
+
130
+ # 6. If data were usable, we would save it; otherwise we do nothing
131
+ if is_usable:
132
+ print("Data is unexpectedly marked usable, but trait is unavailable. Skipping save.")
p1/preprocess/Allergies/code/GSE230164.py ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE230164"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE230164"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE230164.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE230164.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE230164.csv"
16
+ json_path = "./output/preprocess/1/Allergies/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 "Gene expression profiling" title
43
+
44
+ # 2. Variable Availability and Data Type Conversion
45
+
46
+ # From the sample characteristics, we only see key=0 for "gender: female" and "gender: male".
47
+ # Therefore:
48
+ trait_row = None # "Allergies" not found
49
+ age_row = None # Age not found
50
+ gender_row = 0 # Found under key=0
51
+
52
+ # Conversion Functions
53
+ def convert_trait(value: str):
54
+ # Since we don't have trait data, return None if called (function is here for completeness)
55
+ return None
56
+
57
+ def convert_age(value: str):
58
+ # Since we don't have age data, return None if called (function is here for completeness)
59
+ return None
60
+
61
+ def convert_gender(value: str):
62
+ # Split at ':' and pick the last portion, then convert to 0/1
63
+ val = value.split(':')[-1].strip().lower()
64
+ if val == 'female':
65
+ return 0
66
+ elif val == 'male':
67
+ return 1
68
+ return None
69
+
70
+ # 3. Initial Filtering and Saving Metadata
71
+ # trait_row is None => trait data is not available
72
+ is_trait_available = (trait_row is not None)
73
+
74
+ is_usable = validate_and_save_cohort_info(
75
+ is_final=False,
76
+ cohort=cohort,
77
+ info_path=json_path,
78
+ is_gene_available=is_gene_available,
79
+ is_trait_available=is_trait_available
80
+ )
81
+
82
+ # 4. Clinical Feature Extraction is skipped because trait_row is None
83
+ # STEP3
84
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
85
+ gene_data = get_genetic_data(matrix_file)
86
+
87
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
88
+ print(gene_data.index[:20])
89
+ # These identifiers (e.g., ILMN_1343291) are Illumina probe IDs rather than standard gene symbols.
90
+ # Therefore, they need to be mapped to gene symbols.
91
+
92
+ print("requires_gene_mapping = True")
93
+ # STEP5
94
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
95
+ gene_annotation = get_gene_annotation(soft_file)
96
+
97
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
98
+ print("Gene annotation preview:")
99
+ print(preview_df(gene_annotation))
100
+ # STEP: Gene Identifier Mapping
101
+
102
+ # 1. Select the columns from the gene_annotation dataframe for probe ID and gene symbol.
103
+ # From the preview, the "ID" column matches the probe identifiers and "Symbol" stores the gene symbols.
104
+ mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="Symbol")
105
+
106
+ # 2. Apply the mapping to convert probe-level data into gene-level data.
107
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
108
+
109
+ # (Optional) Peek at the results
110
+ print("Gene expression dataframe shape:", gene_data.shape)
111
+ print("First 10 gene symbols:", list(gene_data.index[:10]))
112
+ import pandas as pd
113
+
114
+ # STEP 7: Data Normalization and Linking
115
+
116
+ # In this dataset, the trait is unavailable (trait_row was None), so we cannot proceed with linking or final processing
117
+ # that relies on clinical trait data. Instead, we record the dataset's unavailability without performing final validation.
118
+
119
+ # We still have a gene_data DataFrame from the previous steps. Let's normalize and save it.
120
+ # Although the clinical data is not usable (no trait), we can still provide the normalized gene data CSV
121
+ # for reference purposes.
122
+
123
+ # 1. Normalize gene symbols in the obtained gene expression 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
+ print(f"Saved normalized gene data to {out_gene_data_file}")
127
+
128
+ # 2. Since trait data is unavailable, we skip linking and downstream processing.
129
+
130
+ # 3. Record that the trait is missing via validate_and_save_cohort_info with is_final=False.
131
+ # This avoids the requirement to provide 'df' and 'is_biased' parameters.
132
+ validate_and_save_cohort_info(
133
+ is_final=False,
134
+ cohort=cohort,
135
+ info_path=json_path,
136
+ is_gene_available=True, # We do have gene expression data
137
+ is_trait_available=False, # No trait data
138
+ note="Trait data not available; further steps were skipped."
139
+ )
140
+
141
+ print("Trait data was missing, so final linking and downstream steps were skipped.")
p1/preprocess/Allergies/code/GSE270312.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE270312"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE270312"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE270312.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE270312.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE270312.csv"
16
+ json_path = "./output/preprocess/1/Allergies/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 transcriptome data (nanostring)
43
+
44
+ # 2. Variable Availability and Data Type Conversion
45
+ # From the sample characteristics dictionary, we see that:
46
+ # - 'allergic rhinitis status: Yes/No' corresponds to allergies, i.e., trait_row = 5
47
+ # - No age information is available => age_row = None
48
+ # - 'gender: Female/Male' => gender_row = 2
49
+
50
+ trait_row = 5
51
+ age_row = None
52
+ gender_row = 2
53
+
54
+ # Define the conversion functions
55
+ def convert_trait(value: str):
56
+ # Extract the part after the colon and strip spaces
57
+ val = value.split(':')[-1].strip().lower()
58
+ if val == 'yes':
59
+ return 1
60
+ elif val == 'no':
61
+ return 0
62
+ return None # For unknown or unexpected values
63
+
64
+ def convert_age(value: str):
65
+ # Not applicable here, so just return None
66
+ return None
67
+
68
+ def convert_gender(value: str):
69
+ val = value.split(':')[-1].strip().lower()
70
+ if val == 'female':
71
+ return 0
72
+ elif val == 'male':
73
+ return 1
74
+ return None
75
+
76
+ # 3. Save Metadata (Initial Filtering)
77
+ is_trait_available = (trait_row is not None)
78
+ is_usable = validate_and_save_cohort_info(
79
+ is_final=False,
80
+ cohort=cohort,
81
+ info_path=json_path,
82
+ is_gene_available=is_gene_available,
83
+ is_trait_available=is_trait_available
84
+ )
85
+
86
+ # 4. Clinical Feature Extraction (only if trait data is available)
87
+ if trait_row is not None:
88
+ selected_clinical_df = geo_select_clinical_features(
89
+ clinical_df=clinical_data,
90
+ trait=trait,
91
+ trait_row=trait_row,
92
+ convert_trait=convert_trait,
93
+ age_row=age_row,
94
+ convert_age=None,
95
+ gender_row=gender_row,
96
+ convert_gender=convert_gender
97
+ )
98
+ # Preview the extracted clinical DataFrame
99
+ preview_result = preview_df(selected_clinical_df)
100
+ print("Preview of selected clinical features:", preview_result)
101
+
102
+ # Save the clinical features to CSV
103
+ selected_clinical_df.to_csv(out_clinical_data_file, index=False)
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
+ # These identifiers appear to be valid human gene symbols.
111
+ # Hence, no additional mapping is required.
112
+ requires_gene_mapping = False
113
+
114
+ # STEP 6: Data Normalization and Linking
115
+
116
+ # 1. Normalize gene symbols in the obtained gene expression data
117
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
118
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
119
+ print(f"Saved normalized gene data to {out_gene_data_file}")
120
+
121
+ # 2. Link the clinical and genetic data on sample IDs
122
+ linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
123
+
124
+ # 3. Handle missing values in the linked data systematically
125
+ linked_data_processed = handle_missing_values(linked_data, trait)
126
+
127
+ # 4. Determine whether the trait and demographic features are biased
128
+ is_trait_biased, linked_data_processed = judge_and_remove_biased_features(linked_data_processed, trait)
129
+
130
+ # 5. Conduct final validation and record information
131
+ is_usable = validate_and_save_cohort_info(
132
+ is_final=True,
133
+ cohort=cohort,
134
+ info_path=json_path,
135
+ is_gene_available=True,
136
+ is_trait_available=True,
137
+ is_biased=is_trait_biased,
138
+ df=linked_data_processed,
139
+ note="Final step completed with trait and gene data available."
140
+ )
141
+
142
+ # 6. If the linked data is usable, save it; otherwise, do not save
143
+ if is_usable:
144
+ linked_data_processed.to_csv(out_data_file)
145
+ print(f"Final linked data saved to {out_data_file}")
p1/preprocess/Allergies/code/GSE84046.py ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+ cohort = "GSE84046"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Allergies"
10
+ in_cohort_dir = "../DATA/GEO/Allergies/GSE84046"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Allergies/GSE84046.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/GSE84046.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/GSE84046.csv"
16
+ json_path = "./output/preprocess/1/Allergies/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 # The study clearly mentions "whole genome gene expression" in adipose tissue.
43
+
44
+ # 2. Variable Availability
45
+ # Trait (Allergies): Not found in the sample characteristics.
46
+ trait_row = None
47
+ # Age: We can infer from date of birth, which is stored under key=5 "date of birth".
48
+ age_row = 5
49
+ # Gender: Found under key=4 "sexe: Male/Female".
50
+ gender_row = 4
51
+
52
+ # 2.2 Data Type Conversion Functions
53
+ def convert_trait(value: str):
54
+ # No trait data, so return None.
55
+ return None
56
+
57
+ def convert_age(value: str):
58
+ # Example format: "date of birth (dd-mm-yyyy): 1952-06-17"
59
+ # We parse out '1952-06-17' and convert it to approximate age.
60
+ try:
61
+ date_str = value.split(':', 1)[1].strip() # e.g. "1952-06-17"
62
+ birth_year = int(date_str.split('-')[0])
63
+ # Approximate age by subtracting from current year
64
+ approx_age = 2023 - birth_year
65
+ if approx_age < 0 or approx_age > 120:
66
+ return None
67
+ return float(approx_age)
68
+ except:
69
+ return None
70
+
71
+ def convert_gender(value: str):
72
+ # Example format: "sexe: Male" or "sexe: Female"
73
+ try:
74
+ gender_str = value.split(':', 1)[1].strip().lower()
75
+ if gender_str == "male":
76
+ return 1
77
+ elif gender_str == "female":
78
+ return 0
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
+ # Since trait_row is None, we skip extracting clinical features for the trait "Allergies".
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 in the provided index are numeric, suggesting they are not standard human gene symbols.
103
+ # These likely need to be mapped 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
+ # STEP: Gene Identifier Mapping
114
+
115
+ # 1. Decide which columns in 'gene_annotation' match the probe IDs in 'gene_data' (i.e., "ID")
116
+ # and which column contains text that can lead to actual gene symbols (i.e., "gene_assignment").
117
+ prob_col = "ID"
118
+ gene_col = "gene_assignment"
119
+
120
+ # 2. Get a gene mapping dataframe using these two columns.
121
+ gene_mapping_df = get_gene_mapping(gene_annotation, prob_col, gene_col)
122
+
123
+ # 3. Apply the gene mapping to convert probe-level data to gene-level data.
124
+ gene_data = apply_gene_mapping(gene_data, gene_mapping_df)
125
+ # STEP 7: Data Normalization and Linking
126
+
127
+ # In this dataset, we determined in Step 2 that trait data is not available (trait_row = None).
128
+ # Therefore, we cannot link clinical and genetic data or perform trait-based processing.
129
+ # Nonetheless, we can still normalize probe-level data to standard gene symbols and finalize validation.
130
+
131
+ # 1. Normalize gene symbols in the obtained gene expression data
132
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
133
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
134
+
135
+ # 2. Since trait data is missing, skip linking clinical and genetic data,
136
+ # skip missing-value handling and bias detection for the trait.
137
+
138
+ # 3. Conduct final validation and record info.
139
+ # Since trait data is unavailable, set is_trait_available=False,
140
+ # pass a dummy/empty DataFrame and is_biased=False (it won't be used).
141
+ dummy_df = pd.DataFrame()
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=False,
149
+ df=dummy_df,
150
+ note="No trait data found; skipped clinical-linking steps."
151
+ )
152
+
153
+ # 4. If the dataset were usable, save. In this scenario, it's not usable due to missing trait data.
154
+ if is_usable:
155
+ dummy_df.to_csv(out_data_file, index=True)
p1/preprocess/Allergies/code/TCGA.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Allergies"
6
+
7
+ # Input paths
8
+ tcga_root_dir = "../DATA/TCGA"
9
+
10
+ # Output paths
11
+ out_data_file = "./output/preprocess/1/Allergies/TCGA.csv"
12
+ out_gene_data_file = "./output/preprocess/1/Allergies/gene_data/TCGA.csv"
13
+ out_clinical_data_file = "./output/preprocess/1/Allergies/clinical_data/TCGA.csv"
14
+ json_path = "./output/preprocess/1/Allergies/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)
p1/preprocess/Allergies/gene_data/GSE169149.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Allergies/gene_data/GSE182740.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:095173af41a72566b017be3af9b37ffcce35a7b1300de4acb4731e97fb40270d
3
+ size 16722597
p1/preprocess/Allergies/gene_data/GSE184382.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Allergies/gene_data/GSE185658.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3b064b4ff46319ff3299b7070c722d1dc8c5d18ccd250e48a01a23b881a5478
3
+ size 18243051
p1/preprocess/Allergies/gene_data/GSE192454.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Allergies/gene_data/GSE203196.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Allergies/gene_data/GSE203409.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Allergies/gene_data/GSE205151.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Allergies/gene_data/GSE230164.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e6255f788c2c7ca89a3dab26eb0d2a82c7ec2fc31f7e4b1b9d184fa1db05eec
3
+ size 25530449
p1/preprocess/Allergies/gene_data/GSE270312.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Allergies/gene_data/GSE84046.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d28cbd17a3b8fde7cad97fdd235a4eb7f60a848d6819c231ae2f861172439408
3
+ size 12843969
p1/preprocess/Alopecia/clinical_data/GSE66664.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ GSM1627302,GSM1627303,GSM1627304,GSM1627305,GSM1627306,GSM1627307,GSM1627308,GSM1627309,GSM1627310,GSM1627311,GSM1627312,GSM1627313,GSM1627314,GSM1627315,GSM1627316,GSM1627317,GSM1627318,GSM1627319,GSM1627320,GSM1627321,GSM1627322,GSM1627323,GSM1627324,GSM1627325,GSM1627326,GSM1627327,GSM1627328,GSM1627329,GSM1627330,GSM1627331,GSM1627332,GSM1627333,GSM1627334,GSM1627335,GSM1627336,GSM1627337,GSM1627338,GSM1627339,GSM1627340,GSM1627341,GSM1627342,GSM1627343,GSM1627344,GSM1627345,GSM1627346,GSM1627347,GSM1627348,GSM1627349,GSM1627350,GSM1627351,GSM1627352,GSM1627353,GSM1627354,GSM1627355,GSM1627356,GSM1627357,GSM1627358,GSM1627359,GSM1627360,GSM1627361,GSM1627362,GSM1627363,GSM1627364,GSM1627365,GSM1627366,GSM1627367,GSM1627368,GSM1627369,GSM1627370,GSM1627371,GSM1627372,GSM1627373,GSM1627374,GSM1627375,GSM1627376,GSM1627377,GSM1627378,GSM1627379,GSM1627380,GSM1627381,GSM1627382,GSM1627383,GSM1627384,GSM1627385,GSM1627386,GSM1627387,GSM1627388,GSM1627389,GSM1627390,GSM1627391,GSM1627392,GSM1627393,GSM1627394,GSM1627395,GSM1627396,GSM1627397,GSM1627398,GSM1627399,GSM1627400,GSM1627401,GSM1627402,GSM1627403,GSM1627404,GSM1627405,GSM1627406,GSM1627407,GSM1627408,GSM1627409,GSM1627410,GSM1627411,GSM1627412,GSM1627413,GSM1627414,GSM1627415,GSM1627416,GSM1627417,GSM1627418,GSM1627419,GSM1627420,GSM1627421,GSM1627422,GSM1627423,GSM1627424,GSM1627425,GSM1627426,GSM1627427,GSM1627428,GSM1627429,GSM1627430,GSM1627431,GSM1627432,GSM1627433,GSM1627434,GSM1627435,GSM1627436,GSM1627437,GSM1627438,GSM1627439,GSM1627440,GSM1627441
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,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
p1/preprocess/Alopecia/clinical_data/GSE80342.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ GSM2124815,GSM2124816,GSM2124817,GSM2124818,GSM2124819,GSM2124820,GSM2124821,GSM2124822,GSM2124823,GSM2124824,GSM2124825,GSM2124826,GSM2124827,GSM2124828,GSM2124829,GSM2124830,GSM2124831,GSM2124832,GSM2124833,GSM2124834,GSM2124835,GSM2124836,GSM2124837,GSM2124838,GSM2124839,GSM2124840,GSM2124841,GSM2124842,GSM2124843,GSM2124844,GSM2124845
2
+ 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
3
+ 43.0,27.0,40.0,36.0,45.0,48.0,34.0,34.0,58.0,35.0,31.0,63.0,60.0,62.0,20.0,60.0,58.0,35.0,31.0,48.0,34.0,36.0,45.0,48.0,34.0,58.0,31.0,63.0,60.0,62.0,45.0
4
+ 1.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0
p1/preprocess/Alopecia/clinical_data/GSE81071.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ GSM2142137,GSM2142138,GSM2142139,GSM2142140,GSM2142141,GSM2142142,GSM2142143,GSM2142144,GSM2142145,GSM2142146,GSM2142147,GSM2142148,GSM2142149,GSM2142150,GSM2142151,GSM2142152,GSM2142153,GSM2142154,GSM2142155,GSM2142156,GSM2142157,GSM2142158,GSM2142159,GSM2142160,GSM2142161,GSM2142162,GSM2142163,GSM2142164,GSM2142165,GSM2142166,GSM2142167,GSM2142168,GSM2142169,GSM2142170,GSM2142171,GSM2142172,GSM2142173,GSM2142174,GSM2142175,GSM2142176,GSM2142177,GSM2142178,GSM2142179,GSM2142180,GSM2142181,GSM2142182,GSM2142183,GSM2142184,GSM2142185,GSM2142186,GSM2142187,GSM2142188,GSM2142189,GSM2142190,GSM2142191,GSM2142192,GSM3999298,GSM3999300,GSM3999301,GSM3999303,GSM3999304,GSM3999306,GSM3999307,GSM3999308,GSM3999309,GSM3999311,GSM3999312,GSM3999313,GSM3999314,GSM3999315,GSM3999317,GSM3999318,GSM3999319,GSM3999320,GSM3999322,GSM3999323,GSM3999324,GSM3999326,GSM3999327,GSM3999328,GSM3999330,GSM3999332,GSM3999333,GSM3999334,GSM3999336,GSM3999337,GSM3999339,GSM3999340,GSM3999341,GSM3999343,GSM3999344,GSM3999345,GSM3999347,GSM3999348,GSM3999349,GSM3999351,GSM3999352,GSM3999353,GSM3999355,GSM3999356,GSM3999357,GSM3999359,GSM3999360
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,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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
p1/preprocess/Alopecia/code/GSE148346.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Alopecia"
6
+ cohort = "GSE148346"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Alopecia"
10
+ in_cohort_dir = "../DATA/GEO/Alopecia/GSE148346"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Alopecia/GSE148346.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Alopecia/gene_data/GSE148346.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Alopecia/clinical_data/GSE148346.csv"
16
+ json_path = "./output/preprocess/1/Alopecia/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1. Gene Expression Data Availability
43
+ is_gene_available = True # Based on the study context, it appears to involve gene expression data.
44
+
45
+ # 2. Variable Availability
46
+ # Examination of the sample characteristics dictionary shows no variation for the trait (all are AA cases),
47
+ # and no entries for age or gender.
48
+ trait_row = None
49
+ age_row = None
50
+ gender_row = None
51
+
52
+ # 2.2 Data Type Conversion
53
+ # Even though they are not available, we define the required conversion functions for completeness.
54
+ def convert_trait(value: str):
55
+ return None # Not available; returning None
56
+
57
+ def convert_age(value: str):
58
+ return None # Not available; returning None
59
+
60
+ def convert_gender(value: str):
61
+ return None # Not available; returning None
62
+
63
+ # 3. Save Metadata (Initial Filtering)
64
+ # trait data availability is determined by whether trait_row is None
65
+ is_trait_available = (trait_row is not None)
66
+ is_usable = validate_and_save_cohort_info(
67
+ is_final=False,
68
+ cohort=cohort,
69
+ info_path=json_path,
70
+ is_gene_available=is_gene_available,
71
+ is_trait_available=is_trait_available
72
+ )
73
+
74
+ # 4. Clinical Feature Extraction
75
+ # Since trait_row is None (trait data not available), we skip this step.
76
+ # STEP3
77
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
78
+ gene_data = get_genetic_data(matrix_file)
79
+
80
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
81
+ print(gene_data.index[:20])
82
+ print("requires_gene_mapping = True")
83
+ # STEP5
84
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
85
+ gene_annotation = get_gene_annotation(soft_file)
86
+
87
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
88
+ print("Gene annotation preview:")
89
+ print(preview_df(gene_annotation))
90
+ # STEP: Gene Identifier Mapping
91
+
92
+ # 1. Identify the columns in the annotation that match the probe identifiers in the expression data and the gene symbols.
93
+ probe_col = "ID"
94
+ gene_col = "Gene Symbol"
95
+
96
+ # 2. Get the gene mapping from the annotation dataframe.
97
+ mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_col)
98
+
99
+ # 3. Convert probe-level measurements to gene-level expression data.
100
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
101
+
102
+ # Print a brief check of the resulting gene expression data
103
+ print("Gene-level expression data shape:", gene_data.shape)
104
+ print("First 20 Gene IDs (index):")
105
+ print(gene_data.index[:20])
106
+ # STEP 7: Data Normalization and Linking
107
+
108
+ # Recall from Step 2 that trait_row was None, so we have no clinical/trait data to link.
109
+ # Therefore, we will normalize gene_data but skip linking to clinical data or performing
110
+ # trait-based preprocessing. We must still do final validation, indicating that the dataset
111
+ # lacks trait data and is not usable for an association study.
112
+
113
+ # 1. Normalize gene symbols in the obtained gene expression data
114
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
115
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
116
+ print(f"Saved normalized gene data to {out_gene_data_file}")
117
+
118
+ # Because trait_row is None, we have no selected_clinical_df to link.
119
+ # We also cannot perform missing value handling or bias checks on the trait.
120
+ # Hence, we finalize by marking the dataset as not usable for trait-based association.
121
+
122
+ import pandas as pd
123
+
124
+ # We provide an empty dataframe as the final dataset for validation, ensuring the function can run.
125
+ empty_df = pd.DataFrame()
126
+
127
+ # Mark trait as biased (or effectively unavailable) so that it is deemed not usable.
128
+ trait_biased = True
129
+
130
+ # 5. Final validation and save metadata
131
+ is_usable = validate_and_save_cohort_info(
132
+ is_final=True,
133
+ cohort=cohort,
134
+ info_path=json_path,
135
+ is_gene_available=True,
136
+ is_trait_available=False, # trait not available
137
+ is_biased=trait_biased,
138
+ df=empty_df,
139
+ note="No trait data available; cannot be used for association studies."
140
+ )
141
+
142
+ # 6. If the dataset were usable, we'd save it. Here, it is not usable, so we skip saving a final linked CSV.
143
+ if is_usable:
144
+ # This branch will not be taken because trait is unavailable.
145
+ out_data_file_final = out_data_file
146
+ empty_df.to_csv(out_data_file_final)
147
+ print(f"Saved final linked data to {out_data_file_final}")
148
+ else:
149
+ print("Data not usable for association; skipping final output.")
p1/preprocess/Alopecia/code/GSE18876.py ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Alopecia"
6
+ cohort = "GSE18876"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Alopecia"
10
+ in_cohort_dir = "../DATA/GEO/Alopecia/GSE18876"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Alopecia/GSE18876.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Alopecia/gene_data/GSE18876.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Alopecia/clinical_data/GSE18876.csv"
16
+ json_path = "./output/preprocess/1/Alopecia/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1) Decide if gene expression data is available
43
+ is_gene_available = True # Based on the exon array info, this dataset likely contains gene expression data
44
+
45
+ # 2) Determine the availability of trait, age, and gender
46
+ trait_row = None # No row for Alopecia in the sample characteristics
47
+ age_row = 0 # Found "age: ..." in row 0
48
+ gender_row = None # All are males, so effectively constant - not useful
49
+
50
+ # 2.2) Define the data type conversion functions
51
+ def convert_trait(value: str):
52
+ # No trait data available, return None
53
+ return None
54
+
55
+ def convert_age(value: str):
56
+ # Expected format: "age: [number]"
57
+ parts = value.split(":")
58
+ if len(parts) >= 2:
59
+ age_str = parts[1].strip()
60
+ try:
61
+ return float(age_str)
62
+ except ValueError:
63
+ pass
64
+ return None
65
+
66
+ def convert_gender(value: str):
67
+ # No gender row; not used
68
+ return None
69
+
70
+ # 3) Initial filtering and save metadata
71
+ # Trait is considered unavailable if trait_row is None.
72
+ is_trait_available = (trait_row is not None)
73
+
74
+ validate_and_save_cohort_info(
75
+ is_final=False,
76
+ cohort=cohort,
77
+ info_path=json_path,
78
+ is_gene_available=is_gene_available,
79
+ is_trait_available=is_trait_available
80
+ )
81
+
82
+ # 4) Because trait_row is None (trait not available), we skip clinical feature extraction.
83
+ # STEP3
84
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
85
+ gene_data = get_genetic_data(matrix_file)
86
+
87
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
88
+ print(gene_data.index[:20])
89
+ # Observing the numeric identifiers, they do not appear to match standard human gene symbols.
90
+ # They are likely array-specific probe IDs that need to be mapped to gene symbols.
91
+ print("requires_gene_mapping = True")
92
+ # STEP5
93
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
94
+ gene_annotation = get_gene_annotation(soft_file)
95
+
96
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
97
+ print("Gene annotation preview:")
98
+ print(preview_df(gene_annotation))
99
+ # STEP: Gene Identifier Mapping
100
+
101
+ # 1. Decide which columns store matching probe IDs and gene symbols
102
+ # Based on the preview, 'ID' matches the probe IDs in the gene expression dataframe,
103
+ # and 'gene_assignment' contains gene symbol information.
104
+
105
+ # 2. Create a mapping dataframe
106
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
107
+
108
+ # 3. Apply the gene mapping to convert probe-level measurements to gene-level expression data
109
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
110
+
111
+ # Check the result
112
+ print("Mapped gene_data shape:", gene_data.shape)
113
+ print("Mapped gene_data (first 5 rows):")
114
+ print(gene_data.head(5))
115
+ # STEP 7: Data Normalization and Linking
116
+
117
+ # Recall from Step 2 that trait_row was None, so we have no clinical/trait data to link.
118
+ # Therefore, we will normalize gene_data but skip linking to clinical data or performing
119
+ # trait-based preprocessing. We must still do final validation, indicating that the dataset
120
+ # lacks trait data and is not usable for an association study.
121
+
122
+ # 1. Normalize gene symbols in the obtained gene expression data
123
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
124
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
125
+ print(f"Saved normalized gene data to {out_gene_data_file}")
126
+
127
+ # Because trait_row is None, we have no selected_clinical_df to link.
128
+ # We also cannot perform missing value handling or bias checks on the trait.
129
+ # Hence, we finalize by marking the dataset as not usable for trait-based association.
130
+
131
+ import pandas as pd
132
+
133
+ # We provide an empty dataframe as the final dataset for validation, ensuring the function can run.
134
+ empty_df = pd.DataFrame()
135
+
136
+ # Mark trait as biased (or effectively unavailable) so that it is deemed not usable.
137
+ trait_biased = True
138
+
139
+ # 5. Final validation and save metadata
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=False, # trait not available
146
+ is_biased=trait_biased,
147
+ df=empty_df,
148
+ note="No trait data available; cannot be used for association studies."
149
+ )
150
+
151
+ # 6. If the dataset were usable, we'd save it. Here, it is not usable, so we skip saving a final linked CSV.
152
+ if is_usable:
153
+ # This branch will not be taken because trait is unavailable.
154
+ out_data_file_final = out_data_file
155
+ empty_df.to_csv(out_data_file_final)
156
+ print(f"Saved final linked data to {out_data_file_final}")
157
+ else:
158
+ print("Data not usable for association; skipping final output.")
p1/preprocess/Alopecia/code/GSE66664.py ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Alopecia"
6
+ cohort = "GSE66664"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Alopecia"
10
+ in_cohort_dir = "../DATA/GEO/Alopecia/GSE66664"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Alopecia/GSE66664.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Alopecia/gene_data/GSE66664.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Alopecia/clinical_data/GSE66664.csv"
16
+ json_path = "./output/preprocess/1/Alopecia/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1) Determine if the dataset is likely to contain gene expression data
43
+ is_gene_available = True # Based on transcriptome analysis in the series summary
44
+
45
+ # 2) Variable Availability
46
+ # Observing sample characteristics, 'BAB' = balding, 'BAN' = non-balding. These two distinct values
47
+ # represent different states relevant to "Alopecia"; thus it can be considered as the trait variable.
48
+ trait_row = 0
49
+
50
+ # No key suggests an age variable, or it appears constant (not present). So no age data.
51
+ age_row = None
52
+
53
+ # The study states "male patients," implying no variation for gender, and there's no separate field.
54
+ gender_row = None
55
+
56
+ # 2) Data Type Conversion Functions
57
+ def convert_trait(value: str):
58
+ """
59
+ Converts 'BAB' -> 1 (balding) and 'BAN' -> 0 (non-balding).
60
+ Unknown values map to None.
61
+ """
62
+ if ':' in value:
63
+ val = value.split(':', 1)[1].strip().upper() # Extract after colon, e.g. 'BAB'
64
+ if val == 'BAB':
65
+ return 1
66
+ elif val == 'BAN':
67
+ return 0
68
+ return None
69
+
70
+ def convert_age(value: str):
71
+ """
72
+ Not available in the current dataset. Return None.
73
+ """
74
+ return None
75
+
76
+ def convert_gender(value: str):
77
+ """
78
+ Not available in the current dataset. Return None.
79
+ """
80
+ return None
81
+
82
+ # 3) Conduct initial filtering and save metadata
83
+ # Trait data is available if trait_row is not None
84
+ is_trait_available = (trait_row is not None)
85
+
86
+ is_usable = 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 if trait data is available
95
+ if trait_row is not None:
96
+ selected_clinical_df = geo_select_clinical_features(
97
+ clinical_data, # Assume clinical_data is already in the environment
98
+ trait=trait,
99
+ trait_row=trait_row,
100
+ convert_trait=convert_trait,
101
+ age_row=age_row,
102
+ convert_age=convert_age,
103
+ gender_row=gender_row,
104
+ convert_gender=convert_gender
105
+ )
106
+ preview = preview_df(selected_clinical_df, n=5, max_items=200)
107
+ print("Preview of selected clinical features:", preview)
108
+ selected_clinical_df.to_csv(out_clinical_data_file, index=False)
109
+ # STEP3
110
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
111
+ gene_data = get_genetic_data(matrix_file)
112
+
113
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
114
+ print(gene_data.index[:20])
115
+ # The given identifiers (e.g., ILMN_1343291) are Illumina probe IDs, not standard HGNC gene symbols.
116
+ # Therefore, mapping to gene symbols is required.
117
+
118
+ requires_gene_mapping = True
119
+ # STEP5
120
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
121
+ gene_annotation = get_gene_annotation(soft_file)
122
+
123
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
124
+ print("Gene annotation preview:")
125
+ print(preview_df(gene_annotation))
126
+ # STEP: Gene Identifier Mapping
127
+
128
+ # 1. Identify the correct columns in the annotation dataframe.
129
+ # The "ID" column in `gene_annotation` matches the row IDs in the gene expression data (e.g. ILMN_xxxx).
130
+ # The "Symbol" column in `gene_annotation` contains the gene symbols.
131
+
132
+ # 2. Create a gene mapping dataframe from the annotation.
133
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
134
+
135
+ # 3. Convert probe-level measurements to gene-level measurements.
136
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
137
+
138
+ # By now, 'gene_data' contains gene expression values indexed by actual gene symbols.
139
+ import pandas as pd
140
+
141
+ # STEP 7: Data Normalization and Linking
142
+
143
+ # 1. Normalize gene symbols in the obtained gene expression data
144
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
145
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
146
+ print(f"Saved normalized gene data to {out_gene_data_file}")
147
+
148
+ # 2. Link clinical and genetic data
149
+ linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
150
+
151
+ # 3. Handle missing values
152
+ cleaned_data = handle_missing_values(linked_data, trait)
153
+
154
+ # 4. Determine bias in trait and demographic features
155
+ trait_biased, final_data = judge_and_remove_biased_features(cleaned_data, trait)
156
+
157
+ # 5. Final validation and save metadata
158
+ is_usable = validate_and_save_cohort_info(
159
+ is_final=True,
160
+ cohort=cohort,
161
+ info_path=json_path,
162
+ is_gene_available=True,
163
+ is_trait_available=True,
164
+ is_biased=trait_biased,
165
+ df=final_data,
166
+ note="Processed with standard GEO pipeline."
167
+ )
168
+
169
+ # 6. If data is usable, save the final linked data
170
+ if is_usable:
171
+ final_data.to_csv(out_data_file)
172
+ print(f"Saved final linked data to {out_data_file}")
173
+ else:
174
+ print("Data not usable; skipping final output.")
p1/preprocess/Alopecia/code/GSE80342.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Alopecia"
6
+ cohort = "GSE80342"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Alopecia"
10
+ in_cohort_dir = "../DATA/GEO/Alopecia/GSE80342"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Alopecia/GSE80342.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Alopecia/gene_data/GSE80342.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Alopecia/clinical_data/GSE80342.csv"
16
+ json_path = "./output/preprocess/1/Alopecia/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1) Determine if this dataset has gene expression data
43
+ is_gene_available = True # Based on the background info (microarray analysis assessing gene expression).
44
+
45
+ # 2) Identify rows for trait, age, and gender; define type conversion functions.
46
+
47
+ # From inspecting the sample characteristics, row 7 ('aatype') indicates whether
48
+ # a sample is a healthy control or various alopecia subtypes. We will treat
49
+ # "healthy_control" as 0 and all other alopecia types as 1.
50
+
51
+ trait_row = 7
52
+ age_row = 4 # row 4 has age values
53
+ gender_row = 3 # row 3 has gender
54
+
55
+ def convert_trait(raw_value: str) -> int:
56
+ """
57
+ Convert raw aatype value to a binary format: 0 if healthy_control, else 1.
58
+ Unknown entries become None.
59
+ """
60
+ # Example raw_value: "aatype: healthy_control"
61
+ parts = raw_value.split(':', maxsplit=1)
62
+ if len(parts) < 2:
63
+ return None
64
+ val = parts[1].strip().lower()
65
+ if val == 'healthy_control':
66
+ return 0
67
+ elif val in ['persistent_patchy', 'severe_patchy', 'totalis', 'universalis']:
68
+ return 1
69
+ return None
70
+
71
+ def convert_age(raw_value: str) -> float:
72
+ """
73
+ Convert raw age field (e.g., 'agebaseline: 43') to a continuous numeric format.
74
+ """
75
+ parts = raw_value.split(':', maxsplit=1)
76
+ if len(parts) < 2:
77
+ return None
78
+ val = parts[1].strip()
79
+ try:
80
+ return float(val)
81
+ except ValueError:
82
+ return None
83
+
84
+ def convert_gender(raw_value: str) -> int:
85
+ """
86
+ Convert raw gender field to 0 for female, 1 for male, None if unknown.
87
+ """
88
+ parts = raw_value.split(':', maxsplit=1)
89
+ if len(parts) < 2:
90
+ return None
91
+ val = parts[1].strip().lower()
92
+ if val in ['m', 'male']:
93
+ return 1
94
+ elif val in ['f', 'female']:
95
+ return 0
96
+ return None
97
+
98
+ # 3) Initialize trait availability and save preliminary metadata.
99
+ # If trait_row is None, the trait is not available.
100
+ is_trait_available = (trait_row is not None)
101
+
102
+ # Perform an initial validation and save relevant info.
103
+ is_usable = validate_and_save_cohort_info(
104
+ is_final=False,
105
+ cohort=cohort,
106
+ info_path=json_path,
107
+ is_gene_available=is_gene_available,
108
+ is_trait_available=is_trait_available
109
+ )
110
+
111
+ # 4) If trait_row is not None (trait data available), extract clinical features and save them.
112
+ if trait_row is not None:
113
+ selected_clinical_df = geo_select_clinical_features(
114
+ clinical_df=clinical_data, # "clinical_data" is assumed to be a DataFrame loaded from the step's context
115
+ trait=trait,
116
+ trait_row=trait_row,
117
+ convert_trait=convert_trait,
118
+ age_row=age_row,
119
+ convert_age=convert_age,
120
+ gender_row=gender_row,
121
+ convert_gender=convert_gender
122
+ )
123
+
124
+ # Preview and then save
125
+ print("Selected Clinical Features Preview:", preview_df(selected_clinical_df))
126
+ selected_clinical_df.to_csv(out_clinical_data_file, index=False)
127
+ # STEP3
128
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
129
+ gene_data = get_genetic_data(matrix_file)
130
+
131
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
132
+ print(gene_data.index[:20])
133
+ # Based on the observed identifiers (e.g., "1007_s_at", "1053_at"), these are Affymetrix probe set IDs,
134
+ # not conventional human gene symbols and they require mapping to official gene symbols.
135
+ print("These are Affymetrix probe set IDs.\nrequires_gene_mapping = True")
136
+ # STEP5
137
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
138
+ gene_annotation = get_gene_annotation(soft_file)
139
+
140
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
141
+ print("Gene annotation preview:")
142
+ print(preview_df(gene_annotation))
143
+ # STEP: Gene Identifier Mapping
144
+
145
+ # 1) We observe that the "ID" column in gene_annotation matches the probe identifiers in gene_data.index,
146
+ # and the "Gene Symbol" column stores the gene symbols we need.
147
+
148
+ # 2) Get the probe-to-gene mapping DataFrame.
149
+ mapping_df = get_gene_mapping(
150
+ annotation=gene_annotation,
151
+ prob_col="ID", # The column storing the same IDs as in gene_data.index
152
+ gene_col="Gene Symbol" # The column storing the gene symbols
153
+ )
154
+
155
+ # 3) Convert probe-level measurements to gene-level expression data by applying the mapping.
156
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
157
+ import pandas as pd
158
+
159
+ # STEP 7: Data Normalization and Linking
160
+
161
+ # 1. Normalize gene symbols in the obtained gene expression data
162
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
163
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
164
+ print(f"Saved normalized gene data to {out_gene_data_file}")
165
+
166
+ # 2. Link clinical and genetic data
167
+ linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
168
+
169
+ # 3. Handle missing values
170
+ cleaned_data = handle_missing_values(linked_data, trait)
171
+
172
+ # 4. Determine bias in trait and demographic features
173
+ trait_biased, final_data = judge_and_remove_biased_features(cleaned_data, trait)
174
+
175
+ # 5. Final validation and save metadata
176
+ is_usable = validate_and_save_cohort_info(
177
+ is_final=True,
178
+ cohort=cohort,
179
+ info_path=json_path,
180
+ is_gene_available=True,
181
+ is_trait_available=True,
182
+ is_biased=trait_biased,
183
+ df=final_data,
184
+ note="Processed with standard GEO pipeline."
185
+ )
186
+
187
+ # 6. If data is usable, save the final linked data
188
+ if is_usable:
189
+ final_data.to_csv(out_data_file)
190
+ print(f"Saved final linked data to {out_data_file}")
191
+ else:
192
+ print("Data not usable; skipping final output.")
p1/preprocess/Alopecia/code/GSE81071.py ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Alopecia"
6
+ cohort = "GSE81071"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Alopecia"
10
+ in_cohort_dir = "../DATA/GEO/Alopecia/GSE81071"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/1/Alopecia/GSE81071.csv"
14
+ out_gene_data_file = "./output/preprocess/1/Alopecia/gene_data/GSE81071.csv"
15
+ out_clinical_data_file = "./output/preprocess/1/Alopecia/clinical_data/GSE81071.csv"
16
+ json_path = "./output/preprocess/1/Alopecia/cohort_info.json"
17
+
18
+ # STEP 1
19
+
20
+ from tools.preprocess import *
21
+
22
+ # 1. Identify the paths to the SOFT file and the matrix file
23
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
24
+
25
+ # 2. Read the matrix file to obtain background information and sample characteristics data
26
+ background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
27
+ clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
28
+ background_info, clinical_data = get_background_and_clinical_data(
29
+ matrix_file,
30
+ background_prefixes,
31
+ clinical_prefixes
32
+ )
33
+
34
+ # 3. Obtain the sample characteristics dictionary from the clinical dataframe
35
+ sample_characteristics_dict = get_unique_values_by_row(clinical_data)
36
+
37
+ # 4. Explicitly print out all the background information and the sample characteristics dictionary
38
+ print("Background Information:")
39
+ print(background_info)
40
+ print("\nSample Characteristics Dictionary:")
41
+ print(sample_characteristics_dict)
42
+ # 1. Gene Expression Data Availability
43
+ is_gene_available = True # This dataset contains data from Affymetrix microarrays, indicating gene expression data.
44
+
45
+ # 2. Variable Availability and Data Type Conversion
46
+ # Based on the background info that "DLE" often leads to alopecia, we infer the trait from the row containing "disease state: DLE".
47
+ # Here, we choose row 0. Age and gender data are indeed not available, so keep those as None.
48
+ trait_row = 0
49
+ age_row = None
50
+ gender_row = None
51
+
52
+ def convert_trait(value: str):
53
+ """
54
+ Convert disease state to a binary indicator of alopecia (1 for DLE, 0 otherwise).
55
+ Unknown values become None.
56
+ """
57
+ parts = value.split(':', 1)
58
+ if len(parts) < 2:
59
+ return None
60
+ val = parts[1].strip().lower()
61
+ if val == 'dle':
62
+ return 1
63
+ elif val in ['normal', 'scle', 'healthy', 'skin', 'skin biopsy']:
64
+ return 0
65
+ return None
66
+
67
+ def convert_age(value: str):
68
+ return None # No age data available
69
+
70
+ def convert_gender(value: str):
71
+ return None # No gender data available
72
+
73
+ # 3. Save Metadata (initial filtering)
74
+ is_trait_available = (trait_row is not None)
75
+ is_usable = 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
+ # Since trait_row is not None, we extract clinical features and save the output.
85
+ if trait_row is not None:
86
+ df_clinical = geo_select_clinical_features(
87
+ clinical_data,
88
+ trait,
89
+ trait_row,
90
+ convert_trait,
91
+ age_row,
92
+ convert_age,
93
+ gender_row,
94
+ convert_gender
95
+ )
96
+ print(preview_df(df_clinical))
97
+ df_clinical.to_csv(out_clinical_data_file, index=False)
98
+ # STEP3
99
+ # 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
100
+ gene_data = get_genetic_data(matrix_file)
101
+
102
+ # 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
103
+ print(gene_data.index[:20])
104
+ # Based on the example identifiers (e.g., "100009613_at"), these are Affymetrix probe IDs,
105
+ # not standardized human gene symbols. Thus, gene symbol mapping is required.
106
+
107
+ print("requires_gene_mapping = True")
108
+ # STEP5
109
+ # 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
110
+ gene_annotation = get_gene_annotation(soft_file)
111
+
112
+ # 2. Use the 'preview_df' function from the library to preview the data and print out the results.
113
+ print("Gene annotation preview:")
114
+ print(preview_df(gene_annotation))
115
+ # STEP 6: Gene Identifier Mapping
116
+
117
+ # The "gene_annotation" preview shows columns "ID" and "ENTREZ_GENE_ID",
118
+ # but no true "Gene Symbol" column. We will therefore treat "ENTREZ_GENE_ID"
119
+ # as the gene identifier, skipping text-based extraction.
120
+
121
+ def apply_gene_mapping_entrez(expression_df: pd.DataFrame, annotation_df: pd.DataFrame) -> pd.DataFrame:
122
+ """
123
+ Convert probe-level expression to gene-level expression using Entrez ID.
124
+ Each probe is assumed to map to exactly 1 gene (ENTREZ_GENE_ID).
125
+ """
126
+ # Keep only probes that exist in the expression data
127
+ annotation_df = annotation_df[annotation_df['ID'].isin(expression_df.index)].copy()
128
+
129
+ # Rename "ENTREZ_GENE_ID" to "Gene" so we can group by it.
130
+ annotation_df.rename(columns={'ENTREZ_GENE_ID': 'Gene'}, inplace=True)
131
+ annotation_df['num_genes'] = 1
132
+ annotation_df.set_index('ID', inplace=True)
133
+
134
+ # Merge annotation with expression data on probe ID
135
+ merged_df = annotation_df.join(expression_df)
136
+ expr_cols = [col for col in merged_df.columns if col not in ['Gene', 'num_genes']]
137
+
138
+ # Distribute expression values (though here it's trivially 1-to-1)
139
+ merged_df[expr_cols] = merged_df[expr_cols].div(merged_df['num_genes'].replace(0, 1), axis=0)
140
+
141
+ # Sum expression values for each gene
142
+ gene_expression_df = merged_df.groupby('Gene')[expr_cols].sum()
143
+ return gene_expression_df
144
+
145
+ # 1. Construct our mapping DataFrame using 'ID' -> 'ENTREZ_GENE_ID'
146
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='ENTREZ_GENE_ID')
147
+
148
+ # 2. Apply our custom function to generate gene-level expression data
149
+ gene_data = apply_gene_mapping_entrez(gene_data, mapping_df)
150
+
151
+ # 3. Display the result for a quick check
152
+ print("Gene expression dataframe shape:", gene_data.shape)
153
+ print("Gene expression dataframe index preview:", gene_data.index[:20])
154
+ import pandas as pd
155
+
156
+ # STEP 7: Data Normalization and Linking
157
+
158
+ # 1. Normalize gene symbols in the obtained gene expression data
159
+ normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
160
+ normalized_gene_data.to_csv(out_gene_data_file, index=True)
161
+ print(f"Saved normalized gene data to {out_gene_data_file}")
162
+
163
+ # 2. Link clinical and genetic data
164
+ linked_data = geo_link_clinical_genetic_data(df_clinical, normalized_gene_data)
165
+
166
+ # 3. Handle missing values
167
+ cleaned_data = handle_missing_values(linked_data, trait)
168
+
169
+ # 4. Determine bias in trait and demographic features
170
+ trait_biased, final_data = judge_and_remove_biased_features(cleaned_data, trait)
171
+
172
+ # 5. Final validation and save metadata
173
+ is_usable = validate_and_save_cohort_info(
174
+ is_final=True,
175
+ cohort=cohort,
176
+ info_path=json_path,
177
+ is_gene_available=True,
178
+ is_trait_available=True,
179
+ is_biased=trait_biased,
180
+ df=final_data,
181
+ note="Processed with standard GEO pipeline."
182
+ )
183
+
184
+ # 6. If data is usable, save the final linked data
185
+ if is_usable:
186
+ final_data.to_csv(out_data_file)
187
+ print(f"Saved final linked data to {out_data_file}")
188
+ else:
189
+ print("Data not usable; skipping final output.")
p1/preprocess/Alopecia/code/TCGA.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Alopecia"
6
+
7
+ # Input paths
8
+ tcga_root_dir = "../DATA/TCGA"
9
+
10
+ # Output paths
11
+ out_data_file = "./output/preprocess/1/Alopecia/TCGA.csv"
12
+ out_gene_data_file = "./output/preprocess/1/Alopecia/gene_data/TCGA.csv"
13
+ out_clinical_data_file = "./output/preprocess/1/Alopecia/clinical_data/TCGA.csv"
14
+ json_path = "./output/preprocess/1/Alopecia/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)
p1/preprocess/Alopecia/cohort_info.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"GSE81071": {"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": "Processed with standard GEO pipeline."}, "GSE80342": {"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": 31, "note": "Processed with standard GEO pipeline."}, "GSE66664": {"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": 140, "note": "Processed with standard GEO pipeline."}, "GSE18876": {"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; cannot be used for association studies."}, "GSE148346": {"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; cannot be used for association studies."}}
p1/preprocess/Alopecia/gene_data/GSE80342.csv ADDED
The diff for this file is too large to render. See raw diff
 
p1/preprocess/Alopecia/gene_data/GSE81071.csv ADDED
@@ -0,0 +1 @@
 
 
1
+ Gene,GSM2142137,GSM2142138,GSM2142139,GSM2142140,GSM2142141,GSM2142142,GSM2142143,GSM2142144,GSM2142145,GSM2142146,GSM2142147,GSM2142148,GSM2142149,GSM2142150,GSM2142151,GSM2142152,GSM2142153,GSM2142154,GSM2142155,GSM2142156,GSM2142157,GSM2142158,GSM2142159,GSM2142160,GSM2142161,GSM2142162,GSM2142163,GSM2142164,GSM2142165,GSM2142166,GSM2142167,GSM2142168,GSM2142169,GSM2142170,GSM2142171,GSM2142172,GSM2142173,GSM2142174,GSM2142175,GSM2142176,GSM2142177,GSM2142178,GSM2142179,GSM2142180,GSM2142181,GSM2142182,GSM2142183,GSM2142184,GSM2142185,GSM2142186,GSM2142187,GSM2142188,GSM2142189,GSM2142190,GSM2142191,GSM2142192,GSM3999298,GSM3999300,GSM3999301,GSM3999303,GSM3999304,GSM3999306,GSM3999307,GSM3999308,GSM3999309,GSM3999311,GSM3999312,GSM3999313,GSM3999314,GSM3999315,GSM3999317,GSM3999318,GSM3999319,GSM3999320,GSM3999322,GSM3999323,GSM3999324,GSM3999326,GSM3999327,GSM3999328,GSM3999330,GSM3999332,GSM3999333,GSM3999334,GSM3999336,GSM3999337,GSM3999339,GSM3999340,GSM3999341,GSM3999343,GSM3999344,GSM3999345,GSM3999347,GSM3999348,GSM3999349,GSM3999351,GSM3999352,GSM3999353,GSM3999355,GSM3999356,GSM3999357,GSM3999359,GSM3999360
p1/preprocess/Alzheimers_Disease/GSE117589.csv ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ,Alzheimers_Disease,Age,Gender,AGRN,AKIRIN1,AKIRIN2,AXIN1,AXIN2,BECN1,BLTP1,BLTP2,BRD10,CAPN11,CAPN7,CFAP92,CIP2A,CRACD,D21S2088E,DELE1,DENND11,ECPAS,ELAPOR1,GARRE1,IQCN,JCAD,KATNIP,KHDC4,KIAA0040,KIAA0232,KIAA0319,KIAA0513,KIAA0586,KIAA0753,KIAA0825,KIAA0930,KIAA1191,KIAA1210,KIAA1217,KIAA1328,KIAA1549,KIAA1586,KIAA1614,KIAA1671,KIAA1755,KIAA1958,KIAA2012,KIAA2013,LORICRIN,MATCAP2,MINAR1,MYORG,NEXMIF,NHSL3,NOTCH1,NOTCH2,NOTCH3,NOTCH4,NTNG1,NTNG2,RELCH,RESF1,SEPTIN1,SEPTIN10,SEPTIN11,SEPTIN12,SEPTIN2,SEPTIN3,SEPTIN4,SEPTIN5,SEPTIN6,SEPTIN7,SEPTIN8,SEPTIN9,SHISAL1,TAFAZZIN,TMEM131L,TRMT9B,VIRMA
2
+ GSM3304268,0.0,60.0,0.0,8.79937168,11.6898301,9.510004411,9.700292334,8.325053577,9.291183858,6.615750731,9.878761178,7.073737982,7.844697219,7.833474122,5.523770374,8.350379945,6.397318831,5.6713482,7.659456705,8.86339167,9.84671876,6.072764101,9.422058321,5.41843396,4.533625745,8.439084635,10.22809485,7.12469764,8.082731023,6.574855229,6.880602343,8.073488774,9.624940906,4.063984672,8.623213053,10.59157307,4.753682646,6.928909102,6.781537633,7.681346266,7.302101006,7.399233378,7.239372273,6.415636399,8.366845432,5.271352112,9.142503058,6.602122018,3.803853323,4.346529574,6.402331517,4.569766691,10.16749687,9.095234232,9.394789684,10.82139708,6.893229915,6.088752889,5.627961318,9.034370652,9.595731851,5.343112009,9.558519759,9.020125178,7.888130859,12.35136933,9.614228218,6.321986608,6.45658518,7.42221979,7.566683978,8.26468352,9.85629318,8.719598354,8.185195766,9.31434846,4.86925959,7.866426007
3
+ GSM3304269,0.0,64.0,1.0,8.844981876,11.93110523,9.264096308,9.701551146,8.399255797,9.256676776,6.538178537,9.302003115,7.590834075,7.905173072,7.519492089,5.50160742,8.113952669,6.181934857,5.678298633,7.755925805,8.611478864,9.48019797,5.959943254,9.192694376,4.902664516,4.658602008,8.516211805,10.04609509,7.322763795,7.779293546,6.752028538,6.738980148,8.089594586,9.113742487,3.996525919,8.843539412,10.65537931,4.860697325,7.061838771,6.847925146,7.232951873,7.615790367,7.277769165,7.023202118,6.399059895,8.613238552,5.266689873,9.120562474,6.553870444,3.971142133,4.543916097,6.548514734,4.574713452,10.13925633,8.944430412,9.155304414,10.43364188,6.81587273,6.22525675,6.081290679,8.974836833,9.483573936,5.48879324,10.0245944,9.100136487,8.043437403,12.45749495,9.574219244,6.456528879,6.71396984,7.844383712,7.788864963,8.419366215,9.309253981,8.139360659,8.286445588,9.078464165,4.904598569,7.9194302
4
+ GSM3304270,0.0,72.0,1.0,8.457050741,11.86657368,9.283160935,9.666850207,8.237446199,9.318245226,6.456363068,9.157029087,7.539764091,7.821033512,7.892132908,5.528989031,8.506739338,6.133460108,6.259211185,7.742795618,8.764583052,9.588247279,5.893762385,9.343792538,5.328586274,4.596511941,8.360090378,10.60989569,7.254666636,8.068933772,6.438775741,6.750798082,8.119835961,9.450050897,4.016201116,8.824733381,10.86237011,4.670556564,6.835344883,6.513432684,7.275759763,8.058459058,7.280786937,6.994395422,6.052279138,8.519645632,5.14947708,9.1717388,6.101923465,4.055294405,4.403689153,6.031513428,4.508412598,9.914964135,8.675612042,9.061783463,10.60698774,6.667934675,6.019776318,5.827810364,9.147824563,9.765538406,5.321937426,10.17926038,9.078396292,7.793985611,12.71899038,9.823529984,6.450915031,5.299138597,7.3208969,8.235604375,8.237660498,9.160291947,8.268686787,8.128281325,9.278940446,4.812634066,8.079861281
5
+ GSM3304271,0.0,73.0,1.0,8.563056081,11.39593824,8.797436599,9.724176516,8.128147036,9.452651254,6.242788309,8.729532246,7.374498521,7.541836031,7.768808531,5.321991138,8.264667942,6.008192481,5.652143811,7.588331546,8.633042896,9.678499399,5.804459821,9.350065648,5.145256074,4.54172661,8.600961462,10.42071742,7.383061332,8.055225175,6.729109277,7.002077598,8.184210333,9.589058415,3.862172739,8.822939673,10.90012617,4.546578992,6.654529803,6.515071012,7.359989861,7.360948904,7.192522055,7.190716268,6.259713173,8.745078229,5.302509134,9.284319174,6.560754462,3.961622272,4.619649914,6.269396482,4.536181542,10.07893715,8.58243845,9.286010541,10.5648712,6.769372967,6.218236088,5.614584247,9.166697736,9.606735328,5.359038076,9.845658973,8.78211075,7.666572214,12.4066328,9.827973474,6.205309109,5.943212372,7.586555525,8.091841096,8.181352412,9.143787426,8.396142325,8.172135107,9.432038561,4.874119964,7.973724477
6
+ GSM3304272,0.0,75.0,0.0,8.672395896,12.27546896,9.392545965,9.764876267,8.488445967,9.369820239,6.43411795,9.321512367,7.529138947,7.55114118,7.925995142,5.538733119,8.328068546,6.530264008,5.487693097,7.695345249,8.670639572,9.829865752,6.023071212,9.407729945,5.235984487,4.477563356,8.007880617,10.60130212,7.26920728,7.719777471,6.519091524,6.562512507,8.076917364,9.4261271,3.8164729,8.692202979,10.51879341,4.77266229,6.623601628,6.57969201,7.402042093,7.655542978,7.508814539,7.162276864,6.384074061,8.453267239,5.285577015,9.400244108,6.365855669,3.752308853,4.205141922,6.078543269,4.536692863,9.869795086,8.550176123,9.088746487,10.43295434,6.676408559,6.100832517,5.453427364,9.379336767,9.947537815,5.510203394,10.03754831,9.086963687,7.656051586,12.60673547,9.638826915,6.231762399,5.770122251,7.844341998,8.114555856,8.178678237,9.065319537,8.093088416,8.038460483,9.389561101,4.817511545,7.863083451
7
+ GSM3304273,0.0,92.0,0.0,8.615062991,11.40713595,8.723497837,9.824967585,7.874142127,9.670306079,6.062768884,9.554470579,7.497345362,7.956467326,7.098398002,5.464414599,8.010924037,6.021239459,6.034419263,7.838957292,8.817604873,10.06793358,6.191155244,9.309268316,5.189296301,4.59546076,8.218030107,10.31979387,7.043432331,7.823057205,7.098588327,6.790470024,8.163565146,9.520256514,3.868765469,8.644284923,10.74438299,4.922336949,6.81037354,6.639208626,7.306537991,7.366777728,7.352285835,7.371248023,6.255424917,8.46496735,5.313609844,9.321686406,6.04740718,3.951286159,4.745431421,6.334198541,4.739140446,10.02982994,8.659617353,9.260578182,10.4085711,7.210641024,6.210790556,5.461301349,8.931607106,9.280464411,5.426939116,9.817763588,9.027611872,7.540435798,12.30810513,9.58412237,6.342383035,5.816148215,7.621897702,7.77435802,8.292432482,9.415495039,8.566879405,8.085569076,9.785962361,5.111377991,7.808828071
8
+ GSM3304274,1.0,60.0,1.0,8.901821126,11.30043874,8.825609687,9.641914394,7.781648279,9.415453291,6.238292965,9.525864652,7.37686635,7.918280126,7.427102932,5.387021431,8.223574988,6.377563543,5.609975932,7.697647246,8.966838324,9.519833303,6.184241461,9.10145628,5.343843116,4.600259535,8.513011875,10.32194474,6.84690214,8.11796533,6.903349655,7.086224195,7.918956577,9.857656739,4.001298272,8.613822932,10.69962929,4.64877918,6.882577177,6.62980282,7.512946903,7.798035126,7.501318378,7.180109731,6.249815858,8.47111216,5.346581407,9.237737941,6.616455201,3.953801913,4.455537404,6.44840223,4.686801571,9.356391229,8.896272605,9.127325999,10.64613322,7.041828174,6.064474601,5.784534797,8.916008193,9.274426037,5.574184918,8.859135946,9.005630802,7.577813792,12.37574765,10.01274923,6.522074753,6.523004664,7.713385423,7.667744938,8.234642153,9.458107126,8.885915117,8.127757485,9.359589734,4.956340875,7.950910994
9
+ GSM3304275,1.0,69.0,0.0,8.531937131,11.6883104,8.440438299,9.593698884,8.009979504,9.498563281,6.41928727,8.629967586,7.66514293,7.790994976,8.076209862,5.473817528,8.439573246,6.251421655,5.652143811,7.730395184,8.62801219,9.552065945,6.032181719,9.254094689,4.816083545,4.460773061,8.196234316,10.20248679,7.137433688,7.898324306,6.60894439,6.749402475,8.071254004,9.558461188,3.980972839,8.642125756,10.55460383,4.527981678,6.941266112,6.657856665,7.178331716,7.77535435,7.378959232,7.085867866,6.243790346,8.403935461,5.264325564,9.200468183,6.648501599,3.99541225,4.192935216,6.414941996,4.656276873,9.914690466,8.614575171,9.070575734,10.32463327,6.982651424,6.175719768,5.929441459,9.217128427,9.78862864,5.324379512,9.759005372,8.883730926,7.724298584,12.57690887,9.823548172,6.339621841,5.855935719,8.023490321,7.850429994,8.368087396,9.073175867,8.412903471,8.081634751,9.108338329,4.94928455,8.240926394
10
+ GSM3304276,1.0,72.0,1.0,8.599732584,11.87059738,9.583256735,9.658638347,8.436319682,9.437795203,6.483837537,9.685238974,7.352183218,7.746193218,7.611802855,5.401855133,8.720104058,6.074983533,5.604431379,7.704014394,8.976335414,10.0153922,5.913762964,9.268988495,5.313380798,4.450588788,8.318143369,9.954246855,7.070516409,8.181746021,6.612092723,6.810893189,8.051742136,9.667887684,4.052712766,8.623213053,10.74895,4.93958608,7.114643135,6.599805352,7.423496219,7.600214109,7.327012062,7.079925186,6.285723373,8.582105523,5.163028294,9.229046328,6.495435902,3.689577949,4.331344628,6.309402453,4.53651466,10.05546938,8.880551121,9.515653263,10.78337892,6.969962123,6.114092528,5.546983592,9.199797647,9.965789477,5.708771173,9.860871164,9.135234534,7.740132942,12.59092096,9.601225356,6.279346642,5.936162857,7.932482771,7.859530468,8.174564752,9.997417385,8.451158188,8.101922942,9.406639351,4.848354959,7.956957027
11
+ GSM3304277,1.0,87.0,0.0,8.765882103,11.72024551,9.336531312,9.704652353,8.169609785,9.570383615,6.363902057,9.821046865,7.723164033,7.404309908,7.563428957,5.510006088,8.579468149,6.181629596,5.520082344,7.595322801,9.072176336,10.25934433,5.984377204,9.391417713,5.22517558,4.512278536,8.339332858,10.22119734,7.134407224,8.314488232,6.736785565,6.54551343,8.128794741,9.681112179,3.97577075,8.786599063,10.91661227,4.939881892,7.072723718,6.478907987,7.60940415,7.631936868,7.142700846,7.296236889,6.13041361,8.73169087,4.934878281,9.260076317,6.483336867,3.840764036,4.383754172,6.353638539,4.514135785,10.00557664,9.078891029,9.468465239,10.83798471,6.738615941,6.096367492,5.321658105,9.223086024,10.11461831,5.40220113,10.17335879,9.491059705,7.568353585,12.43032817,9.694549208,6.163382882,5.960071303,7.66579647,7.899419577,8.279295544,9.522207075,8.703672039,7.967351434,9.731580345,4.789952271,8.008180929
12
+ GSM3304278,0.0,60.0,0.0,7.325828003,10.38970293,6.358785495,7.36368956,7.113570516,9.550509738,4.731529151,8.271198736,8.146678801,5.428752131,8.965251756,6.729795515,5.353830966,4.623431813,3.941020688,7.985743321,7.208840952,9.563307843,5.397292077,8.377774574,6.54373963,3.728808733,8.175628503,10.46775627,5.143348993,9.026878632,5.9237029,6.618106503,7.36485017,9.17489951,3.034601411,8.61574321,11.51960716,3.287479501,5.217650961,6.076551171,8.476460213,7.608717267,6.482318257,6.657732611,5.12695352,9.572732374,4.26225478,8.040687763,4.795390026,7.945687095,5.004719564,6.065538214,6.225745025,8.131452731,8.544242543,8.440096214,7.088020566,6.313342282,6.682091892,5.302210168,8.951466159,8.20934115,5.001227227,8.459122909,10.4494178,6.836967342,11.18887355,9.587798228,5.676243455,6.713682136,7.663136882,8.008616109,8.831837741,8.04897007,10.03358063,7.773140041,7.066732484,4.256355941,8.318497022
13
+ GSM3304279,0.0,64.0,1.0,7.080526189,10.18281571,7.022273629,7.172766901,6.944927608,9.606852801,4.982836625,7.821016547,8.823526195,5.4594641,9.333022264,6.352616906,5.081613119,4.456131838,3.487192735,7.71800613,7.529639292,9.455803379,5.72174012,8.91476352,6.480217507,3.648963106,8.103214838,11.0602808,4.852749275,9.440055105,6.023533741,6.828845299,7.535310058,9.167999453,3.338029541,8.566664408,11.60764925,3.338029541,4.717055962,6.115199242,8.782649747,8.271926734,6.326572953,6.255352767,4.965167439,8.816641631,3.953444257,8.03855515,4.699693805,8.395761245,5.736039821,6.090919722,7.318402824,7.666897063,8.775671935,8.083216623,6.412920682,6.386503709,5.423408637,5.73087889,9.381634544,8.770725461,4.759716051,8.344825895,9.86898413,6.991901257,11.0805184,10.20318659,5.734234324,6.592523705,7.4922531,8.818811639,8.426942418,7.729496569,9.257257225,7.749576655,7.094681221,4.211212797,8.871358977
14
+ GSM3304280,0.0,72.0,1.0,6.948520842,9.854483046,6.334251524,7.253637647,6.848365212,9.274120368,4.883475249,7.854067056,8.598032255,5.363921131,9.833572238,6.731582592,5.446368835,4.442513514,3.612876905,7.758141196,7.897308812,9.366983603,5.314032626,9.015224738,5.785199736,3.844388332,8.053647975,10.95085239,4.852749275,9.084414755,4.930151828,6.684696255,7.347789351,9.103564801,3.152132755,8.414223597,11.28314016,3.159172639,4.656662084,6.219598126,8.233799018,8.223470661,6.344319894,6.28040872,4.92411083,9.782981096,4.17074714,8.004497911,4.547090945,9.098615716,6.370676577,5.912113823,6.172093301,7.818755908,8.915542839,7.628837396,6.585334607,6.240642182,5.894200475,5.906551233,8.706410814,8.850194436,4.71733621,8.728402765,9.868697999,6.600655029,11.1625521,9.729172972,5.778627667,6.416393078,7.830021215,8.274312198,8.540063889,7.8764432,8.248861819,7.938001861,7.220235099,4.248842277,8.480499909
15
+ GSM3304281,0.0,73.0,1.0,7.060158841,9.750219424,6.431128169,7.286059996,6.98434251,9.19918894,4.819059087,7.816425661,8.569461986,5.549347184,9.051423496,6.592697575,5.719770295,4.63196672,3.612876905,7.546053702,7.467226223,9.589825129,5.734328467,8.7397262,5.909826983,4.254038839,8.011633944,10.5560234,4.852749275,9.156145926,5.464755548,6.548979187,7.72312888,8.902126927,3.088250836,8.729758759,11.50120344,3.225585933,4.718511906,6.041010265,8.677039611,8.250395956,6.428625218,5.984738146,4.977025251,9.416923958,3.839244777,7.863143193,4.535080451,8.414998195,5.782784008,5.975470927,7.344172022,7.432719611,9.147666876,7.762669144,6.801029294,6.237216048,6.024682029,5.270260665,8.812078027,8.301847351,5.053845647,8.588712591,10.13339821,6.580066936,10.83270271,9.990991701,5.592697673,7.044808971,7.868697974,8.673579835,8.311189354,8.007490036,7.986197156,7.648640484,7.389304036,4.235921091,8.524279336
16
+ GSM3304282,0.0,75.0,0.0,7.127371008,9.817204693,6.865366671,7.201182331,6.929226806,9.109140876,4.790314761,7.682022148,8.745888541,5.363921131,9.004709217,6.368397135,5.177457609,4.546887028,3.496199465,7.58948936,7.401020897,9.438152881,6.008168521,8.95167908,6.058437624,4.274372649,8.00337674,10.44830566,4.834824115,9.730354916,6.983366011,6.835523206,7.513183473,9.11920392,3.317172244,9.206909112,11.57131144,3.243679246,4.591524308,6.34401591,9.611631582,8.203925923,6.333156887,5.986777642,4.983435018,9.048741219,4.015554447,7.885203805,4.621339826,9.524612604,8.308715472,6.153035969,8.238621824,7.789414522,8.354327612,7.75730665,6.148974961,6.26024418,6.441240663,6.452863991,9.100637014,8.271765943,5.045793179,8.10296062,9.872696966,6.828488789,10.35711532,10.38169524,5.807841932,6.912504166,7.121325705,8.786580581,8.809037638,7.865851086,9.349203657,7.599343261,7.219651732,4.898739019,8.507920068
17
+ GSM3304283,0.0,92.0,0.0,7.243237795,9.879884648,6.576453906,7.096697771,6.967170722,9.255687729,4.768986872,7.940363974,8.557030354,5.366117769,8.925928281,7.316495733,6.079682469,4.52158853,3.612876905,7.822342917,7.863890349,9.585558174,5.706687017,8.878594461,6.425695467,3.836641145,8.069626324,10.42964916,4.890959327,9.169015394,5.929568942,6.601071095,7.855640414,9.245136222,3.317172244,8.575564257,11.43825335,3.096554239,4.795626018,6.109068838,8.487696173,8.437663775,6.457631263,6.28040872,4.799162154,10.05333719,4.085492405,8.029617182,4.770974312,8.312855237,5.314032626,5.987375591,4.813599426,7.714166774,8.937114815,7.5524893,6.807102494,6.258124107,5.803688409,6.108864763,8.696603958,8.827357554,4.730814696,8.675562121,10.10020684,6.680945084,10.94014705,9.635008065,5.746324982,6.765232208,7.643117702,8.4386214,8.429618321,7.773845136,8.417817673,7.67202382,7.863579304,4.407056539,8.61129392
18
+ GSM3304284,1.0,60.0,0.0,7.082320514,9.866145696,7.083259846,7.295159671,7.024322412,9.146372288,4.889658038,7.744554837,9.06710772,5.625694972,9.088273803,6.011402085,5.453531407,4.52158853,3.565126995,7.627313362,7.42668387,9.356539128,6.183612314,8.993980256,6.457170031,4.027839646,8.144474514,10.60696258,4.934163473,9.662495883,7.109234952,7.200314711,7.474509911,9.329569234,3.298760106,9.348901708,11.33048409,3.243679246,4.703655435,6.480018973,9.756202247,8.203925923,6.504782432,6.008494574,4.973618821,8.771909599,3.990701106,7.91057832,4.456088077,9.427703121,7.946489353,6.05954002,8.952976661,7.789414522,8.27637886,7.537697354,6.115651642,6.476238523,6.623828091,6.85409179,9.394613994,8.93580564,4.724281817,7.269280271,9.347482049,7.168574249,10.14588412,10.62285442,6.016386912,6.908582642,6.827761827,9.470604511,8.134081961,7.872138158,9.345240136,7.703474838,7.259360665,4.505363525,8.576555522
19
+ GSM3304285,1.0,60.0,1.0,7.035923988,9.89177391,6.452354563,7.175398096,6.95333699,9.152641854,4.994045494,7.741196622,8.792171339,5.126531256,9.299957072,5.915319958,5.806345086,4.219598395,3.620663208,7.478086583,7.463064048,9.455803379,5.975648515,8.852297312,6.025499318,5.102865425,8.144474514,10.60261866,4.765323757,9.476437746,6.775491242,6.953200269,7.404123183,9.367633177,3.532747105,8.987734968,11.37803526,3.377003439,4.73790195,6.216005278,9.505112958,8.107388723,6.400049081,6.368210501,4.973618821,8.810961419,4.065695664,7.783210046,4.682215443,9.410414773,7.847332771,6.012307629,8.534678902,7.912470458,8.125253971,8.492316817,6.437832136,6.12518075,5.865484478,5.621940348,9.341498546,8.673765127,4.615440639,8.491242021,9.197434561,6.516575003,10.72738253,10.38223655,5.663860341,6.572257254,7.510797545,8.946438982,8.657876628,7.911331876,7.81500311,7.407214564,7.160619421,4.426437925,8.572833102
20
+ GSM3304286,1.0,69.0,0.0,6.929293345,9.731274344,6.583585263,7.356085383,6.683002361,9.105206297,5.040133944,7.575090469,8.870328627,5.34866542,9.228984887,5.686686373,5.496972137,4.543556875,3.612876905,7.396139432,7.199737776,9.419892825,6.140016018,9.099125549,5.762587948,4.855406874,8.144474514,10.50255342,4.897495861,9.528805056,7.43168279,7.191020499,7.318491184,9.169480706,3.317172244,9.327796462,11.65170086,3.243679246,4.736544721,6.274620996,9.450296193,8.116982898,6.308006608,6.44637297,5.013824235,8.698466974,4.009850753,7.868126017,4.786232929,9.874832786,8.443372817,6.145129004,9.013551211,8.005015115,8.212434968,8.342681565,6.300486629,6.314093255,6.17145022,5.812714272,9.439845685,8.363156628,4.870803894,7.964665253,8.970098076,6.761610527,10.19349264,10.52542343,6.007989996,6.963550784,7.030236639,9.049316407,8.911016289,7.717279394,8.741097977,7.544949091,6.51373146,4.627845618,8.546034707
21
+ GSM3304287,1.0,72.0,1.0,7.085097455,9.84223979,6.648895401,7.030967083,6.975191414,9.148223279,4.901075913,7.80821066,8.951385792,5.386932327,9.512249935,6.293887896,5.471435523,4.670207876,3.650672593,7.453797236,7.629054642,9.241279936,5.762706591,8.879150341,5.769847112,4.177596696,8.230516075,10.72311651,4.868633215,9.585796124,5.992238458,6.945915031,7.488113274,9.078000198,3.41981604,8.954422317,11.54818661,3.243679246,4.684551419,6.273203655,9.205359866,8.370940149,6.475499071,6.02974172,4.972881994,9.716320138,3.960224691,7.841561459,4.623757585,9.271154939,6.166957639,5.997644825,7.526800855,7.866195431,8.751711127,7.465637254,6.421294169,6.177814038,6.154412475,6.189993375,9.118337705,9.19510351,5.158102408,8.564246746,9.777506137,6.632535889,10.75118843,10.21283338,6.001136632,6.803475138,7.339081742,8.457552533,8.596826753,7.419808474,9.218320314,7.661204505,7.193872024,5.013531731,8.690001053
22
+ GSM3304288,1.0,87.0,0.0,7.068745843,9.995798037,6.315248863,7.24290962,7.507068959,9.302467766,4.883475249,7.827928887,8.64956772,5.294008441,9.444098759,6.513039334,5.696262772,4.384685269,3.526946533,7.684622923,7.791836728,9.791846295,6.385374621,8.947722174,6.40545066,4.273016187,8.465406198,10.5978451,4.81630209,9.519398836,6.989697203,6.772775443,7.240936057,9.628530797,3.424327072,9.033160588,11.39651311,3.200279359,4.843504922,6.342294665,9.231056071,8.055642641,6.144417954,6.77217515,4.946056743,9.035951374,4.046474289,8.025534524,4.660667811,9.721911735,7.86542926,5.982707616,7.921821057,8.07586369,7.597764086,8.926827311,6.493274229,6.200900333,5.284852141,5.565834437,9.108875643,8.206496426,4.783629359,9.850885406,9.189838899,6.596595096,10.69648288,9.928334635,5.727932981,6.734650135,7.510797545,8.649056066,8.663582141,8.003556367,7.25957128,7.593845513,7.219651732,4.160015387,8.473251795
23
+ GSM3304289,0.0,60.0,0.0,7.227146758,9.994460692,5.705950768,7.016261856,7.154514371,9.096748059,4.564993759,7.857920729,7.739085799,4.538998353,8.765512388,6.616621638,7.785526568,3.884078308,4.435561292,7.275796055,7.146913157,9.434055131,4.278090151,8.730806175,4.604503584,6.673914909,7.488108945,10.80101661,5.010144293,8.774738513,4.544463311,5.431225851,8.077463329,9.424699599,3.589971666,8.071188808,11.40254138,3.581021266,4.788884014,5.883903986,8.053600221,8.233712192,5.972082084,6.078253523,4.269111126,7.769713357,4.266021574,8.234698542,4.379331404,8.313468798,4.739347197,5.222069758,4.046604959,7.068123889,8.22989278,8.324626022,6.656026529,5.338181155,5.654515766,5.135896857,8.474792072,8.714985323,4.867435762,9.618935323,8.678482787,5.860138441,11.1162537,6.431358984,4.586079572,6.138295514,8.208409148,8.684899781,6.38858564,9.151254278,6.215860129,6.900654779,7.090889779,4.37659873,7.891979359
24
+ GSM3304290,0.0,64.0,1.0,7.360472844,10.17194483,5.779556786,6.920569638,6.687206086,8.953839211,4.678428113,7.980201934,7.809934981,4.76772838,8.239695006,6.71533495,7.819423099,4.218578986,3.978777265,7.407111226,7.316741435,9.462482897,4.242848217,8.893524316,4.341662691,4.491629319,7.6981212,10.57257389,4.842677805,8.800510167,4.765661438,5.404722734,8.667599301,9.244359945,3.564958583,8.225026604,11.53956522,3.498436871,4.660000835,5.988372056,7.782965221,8.349658484,5.826740245,6.072433654,4.292166583,8.377899274,4.027715664,8.222763695,4.391801113,7.994302594,4.403474005,5.337857589,4.265433659,7.957720563,8.450436985,8.02771073,6.766393664,5.590472609,5.295005426,4.967992675,8.428523096,8.794653333,5.171910692,9.828497233,9.255760439,6.123429504,11.16502997,6.890121299,4.436793386,6.082381096,7.896254587,8.732566551,6.41526081,9.232002899,6.711285793,7.162228356,7.210416067,4.122386546,7.969340973
25
+ GSM3304291,0.0,72.0,1.0,7.156592992,10.06760646,5.869806466,6.929077181,6.959049359,8.888342299,4.597217957,7.950513351,7.743756598,4.688293487,8.38167516,6.737735741,7.938804794,3.853845906,3.975392539,7.65584949,7.447598711,9.349762691,4.425477123,8.907226458,4.502182231,5.062001715,7.844700121,10.70812198,4.799081747,8.824427096,4.626918023,5.437268562,8.691863044,9.188572025,3.587645113,8.000784203,11.31695871,3.579643503,4.660109043,5.901210125,7.655137448,8.39069964,5.808757073,5.943387029,4.283873301,8.460078715,4.067033081,8.24733047,4.29612815,7.885728925,4.60852379,5.416474654,4.16489586,7.705831566,8.120078205,7.963746868,6.835320012,5.485687308,5.645138899,4.934622198,8.348661948,8.81737733,5.171744128,9.720828983,8.879187017,5.696452852,11.10119945,6.728001073,4.491353094,6.175231612,8.217246176,8.972382513,6.346520706,9.081164628,6.770119465,7.077603937,7.240277026,4.513736935,7.864286774
26
+ GSM3304292,0.0,73.0,1.0,7.192958255,9.901370863,5.835747068,6.812612638,6.764786102,8.74827147,4.669177298,7.800627645,7.650656461,4.562113351,8.406326568,7.064886748,8.058938029,4.208650271,4.00643065,7.411050295,7.547374585,9.347461715,4.394665036,9.169120687,4.600184845,4.017816126,7.931154629,10.82291933,4.77410599,8.712902306,4.453772947,5.351758473,8.65041067,9.202993245,3.612234767,8.017755722,11.58604595,3.679900422,4.582499982,5.872349922,7.788792954,8.598511352,5.986895252,6.176805471,4.19712935,9.078756016,3.930276721,8.233447624,4.497724703,8.126344882,4.300947914,5.394549657,4.031508162,8.412663396,8.072865249,7.631021844,6.736838735,5.531339535,5.401349239,5.129041206,8.420142748,9.238775474,5.294826314,9.693405829,8.599561069,5.586969298,11.1463757,7.48359416,4.45649071,6.333429682,8.303102978,8.770567241,6.234366265,8.937590194,6.802752536,7.151679579,7.113885041,4.411624356,7.889029136
27
+ GSM3304293,0.0,92.0,0.0,7.205127077,10.0116444,5.662613747,6.852046908,6.801474249,8.949432744,4.498508043,7.868584673,7.64860702,4.442538887,8.50073076,7.034674922,7.888781244,4.208592112,6.156939023,7.419121641,7.041758814,9.34144936,4.411080793,8.894390645,4.95379171,4.713552158,7.843086699,10.76327294,4.977591531,8.796597255,4.742963569,5.397745725,8.07064615,9.588270348,3.584708529,7.776406674,11.63255973,3.583093633,4.703846447,5.805575023,8.099373441,8.412033881,5.766880431,6.256032281,4.062650009,8.197965976,3.983911164,8.366402037,4.410986955,8.178231164,4.824081361,5.274280573,4.221377703,7.371295993,8.16276476,7.845219114,6.70301439,5.606439133,5.272754654,4.941317366,8.523609263,8.797152724,5.227569829,9.659037859,8.524604326,5.68442369,10.96665373,7.083402963,4.467238259,6.148883105,7.717781152,8.83460531,6.089748988,9.336652563,6.769768165,6.979549435,6.928290185,4.370209551,7.823861861
28
+ GSM3304294,1.0,60.0,0.0,6.845412577,10.10064411,5.827917324,6.828822433,7.292964756,9.108943724,4.686823457,7.949841265,7.730248608,4.578204031,8.379783295,7.156567099,8.072972522,4.292714292,3.888599714,7.391783833,7.62173701,9.53155713,4.289508005,8.794663873,4.574381065,4.382774329,7.786429136,10.74460983,4.795169335,8.739094736,4.802774335,5.628926107,8.427241775,9.203249467,3.604827269,8.137158101,11.33427995,3.476498445,4.826031745,5.854778232,8.137665056,8.485596957,5.961827472,5.821657912,4.27958629,8.742368253,4.087412128,8.253717171,4.516678615,8.03014219,4.82965958,5.261410402,4.060247636,7.911186398,7.785440841,8.091555782,6.666347365,5.4837537,6.014871649,5.260622991,8.277217383,9.162673199,4.931051338,9.760232595,8.66257871,5.96418949,10.92107559,7.545719218,4.438887317,6.126960687,8.302036401,8.867098746,6.480909393,8.787882171,6.945141849,7.001448935,7.182985469,4.414531054,7.851689728
29
+ GSM3304295,1.0,60.0,1.0,7.210149768,10.55183465,6.182974055,6.745260316,6.332210965,8.982696967,4.617286369,8.17508702,7.876227025,4.851595803,8.529137513,6.431576076,7.707538452,4.266843985,3.882573091,7.444497965,7.849634056,9.02678069,4.430914754,8.709804477,4.739600141,4.027343395,7.761519341,10.78023433,4.789958029,8.780895197,4.48504568,5.691495462,8.343987178,9.368356739,3.60849711,8.130039894,11.65158714,3.608224159,4.482052426,5.858804329,8.32605884,8.281258341,5.76275785,5.790369657,4.290834891,8.858099157,4.037394978,8.077028815,4.423991744,7.426988982,5.457502899,5.440008174,4.057693453,6.859524801,8.38418483,7.562272578,6.77735272,5.737868398,6.463455579,5.114277225,8.62805012,9.210069025,5.005288512,9.132146941,8.53329229,5.78870108,11.2259539,7.944372556,4.537036506,6.182393878,7.841988891,8.860927474,6.654214625,9.088218748,5.772726149,6.92291682,7.871125533,4.431596325,7.865884986
30
+ GSM3304296,1.0,69.0,0.0,7.220310218,10.2905247,6.132417136,6.632493503,6.457384661,8.983429202,4.583473304,7.668291475,7.805657187,4.502043449,8.545487664,6.308430234,7.876245903,4.36125871,3.915030282,7.473385972,8.347958425,9.124672482,4.400374596,8.464448501,4.417139212,4.401857347,7.425468709,10.62827976,4.799833253,8.800447154,4.776120356,5.598104169,8.462508971,9.234523523,3.545392956,8.36340232,11.6047907,3.579123223,4.36377261,5.87193239,8.294910823,8.297586108,5.646465043,5.901430891,4.074158395,9.145925818,3.980502462,8.280767205,4.612494142,8.089457567,4.351262632,5.261456,4.387013454,7.237396826,8.854446885,7.830744417,6.842177261,5.56719684,5.751219224,4.930061142,8.35503472,9.039051461,4.875835401,9.303995804,8.595670756,5.699313841,11.06826146,8.027135335,4.45649071,6.18174423,8.082717874,8.986706541,6.784153661,8.926449839,6.991634529,6.980251069,7.336548166,4.471112241,7.850391532
31
+ GSM3304297,1.0,72.0,1.0,7.214134273,10.14274361,5.919520674,6.681175724,6.588290589,8.838235235,4.486814224,7.87760513,7.649903886,4.607836664,8.471903533,6.383923759,8.035999037,4.143417235,3.965803874,7.353415879,7.326361683,9.313307558,4.260747039,8.9053867,4.66532081,4.884587519,7.928272313,10.83482538,4.868706377,8.64719551,4.651759172,5.425233894,8.55433847,9.153908573,3.619408543,7.94133733,11.404649,3.535909853,4.59893198,5.830716686,7.823766773,8.226598358,5.82782434,5.973797375,4.405838514,8.32331136,4.066234943,8.135762771,4.471482872,7.169962096,4.842356101,5.235776328,3.980152327,6.893877157,8.128938408,8.28947438,7.073843011,5.554946618,6.347854058,5.727781096,8.326535812,9.04171495,5.366432405,9.563053128,8.512639783,5.674046433,11.0357375,7.040826984,4.512384298,6.368591719,8.756382381,8.682024556,6.30796735,8.986885314,6.577188542,6.87194311,7.815174404,4.614690789,7.964929531
32
+ GSM3304298,1.0,87.0,0.0,7.349399459,10.19419888,5.957993092,6.849706702,6.237269094,8.904339775,4.654130874,7.893248487,7.726381557,4.473305599,8.466248123,6.570712158,7.720366015,4.06160227,3.87611104,7.193481504,7.960249203,9.133838465,4.471467183,8.364130254,4.360951916,4.168623496,7.442994197,10.47664218,4.865490278,8.77449247,4.739054342,5.713647183,8.371961637,9.077144189,3.44753138,8.541963195,11.84730225,3.855632048,4.580917088,5.861335097,7.97829135,8.294482535,5.633346025,6.25377102,4.323773838,8.940859496,4.111049974,8.264850928,4.681675574,8.061613325,4.963040167,5.441109784,4.037742104,7.159432083,8.02463851,8.079281678,7.112325491,5.662081491,6.513086977,5.504413461,8.443070225,8.674817558,5.109756741,9.747891849,8.767646904,5.874493141,11.0345651,8.563151726,4.639556266,6.237196815,8.264282901,8.930004316,6.815149345,8.85877146,6.352606213,6.89666197,7.924647365,4.461604808,7.723199396