Liu-Hy commited on
Commit
a0b62f5
·
verified ·
1 Parent(s): 4c09b1c

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 +26 -0
  2. p3/preprocess/Alzheimers_Disease/GSE132903.csv +3 -0
  3. p3/preprocess/Alzheimers_Disease/gene_data/GSE109887.csv +3 -0
  4. p3/preprocess/Alzheimers_Disease/gene_data/GSE122063.csv +3 -0
  5. p3/preprocess/Alzheimers_Disease/gene_data/GSE132903.csv +3 -0
  6. p3/preprocess/Alzheimers_Disease/gene_data/GSE243243.csv +3 -0
  7. p3/preprocess/Amyotrophic_Lateral_Sclerosis/GSE68607.csv +3 -0
  8. p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE118336.csv +3 -0
  9. p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE212131.csv +0 -0
  10. p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE26927.csv +3 -0
  11. p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE52937.csv +3 -0
  12. p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE68607.csv +3 -0
  13. p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE95810.csv +3 -0
  14. p3/preprocess/Aniridia/GSE137996.csv +3 -0
  15. p3/preprocess/Aniridia/GSE204791.csv +0 -0
  16. p3/preprocess/Aniridia/code/GSE137996.py +192 -0
  17. p3/preprocess/Aniridia/code/GSE137997.py +146 -0
  18. p3/preprocess/Aniridia/code/GSE204791.py +199 -0
  19. p3/preprocess/Aniridia/code/TCGA.py +24 -0
  20. p3/preprocess/Aniridia/gene_data/GSE137996.csv +3 -0
  21. p3/preprocess/Aniridia/gene_data/GSE204791.csv +0 -0
  22. p3/preprocess/Ankylosing_Spondylitis/GSE25101.csv +0 -0
  23. p3/preprocess/Ankylosing_Spondylitis/GSE73754.csv +3 -0
  24. p3/preprocess/Ankylosing_Spondylitis/clinical_data/GSE25101.csv +2 -0
  25. p3/preprocess/Ankylosing_Spondylitis/clinical_data/GSE73754.csv +4 -0
  26. p3/preprocess/Ankylosing_Spondylitis/code/GSE25101.py +179 -0
  27. p3/preprocess/Ankylosing_Spondylitis/code/GSE73754.py +193 -0
  28. p3/preprocess/Ankylosing_Spondylitis/code/TCGA.py +27 -0
  29. p3/preprocess/Ankylosing_Spondylitis/cohort_info.json +1 -0
  30. p3/preprocess/Ankylosing_Spondylitis/gene_data/GSE25101.csv +0 -0
  31. p3/preprocess/Ankylosing_Spondylitis/gene_data/GSE73754.csv +3 -0
  32. p3/preprocess/Anorexia_Nervosa/GSE60190.csv +3 -0
  33. p3/preprocess/Anorexia_Nervosa/clinical_data/GSE60190.csv +4 -0
  34. p3/preprocess/Anorexia_Nervosa/code/GSE60190.py +191 -0
  35. p3/preprocess/Anorexia_Nervosa/code/TCGA.py +27 -0
  36. p3/preprocess/Anorexia_Nervosa/cohort_info.json +1 -0
  37. p3/preprocess/Anorexia_Nervosa/gene_data/GSE60190.csv +3 -0
  38. p3/preprocess/Anxiety_disorder/GSE60491.csv +3 -0
  39. p3/preprocess/Anxiety_disorder/GSE61672.csv +0 -0
  40. p3/preprocess/Anxiety_disorder/GSE68526.csv +3 -0
  41. p3/preprocess/Anxiety_disorder/GSE78104.csv +0 -0
  42. p3/preprocess/Anxiety_disorder/GSE94119.csv +3 -0
  43. p3/preprocess/Anxiety_disorder/clinical_data/GSE60190.csv +4 -0
  44. p3/preprocess/Anxiety_disorder/clinical_data/GSE60491.csv +4 -0
  45. p3/preprocess/Anxiety_disorder/clinical_data/GSE61672.csv +4 -0
  46. p3/preprocess/Anxiety_disorder/clinical_data/GSE68526.csv +4 -0
  47. p3/preprocess/Anxiety_disorder/clinical_data/GSE78104.csv +4 -0
  48. p3/preprocess/Anxiety_disorder/clinical_data/GSE94119.csv +3 -0
  49. p3/preprocess/Anxiety_disorder/code/GSE119995.py +144 -0
  50. p3/preprocess/Anxiety_disorder/code/GSE60190.py +462 -0
.gitattributes CHANGED
@@ -1451,3 +1451,29 @@ p3/preprocess/Alopecia/GSE66664.csv filter=lfs diff=lfs merge=lfs -text
1451
  p3/preprocess/Alopecia/gene_data/GSE66664.csv filter=lfs diff=lfs merge=lfs -text
1452
  p3/preprocess/Amyotrophic_Lateral_Sclerosis/GSE118336.csv filter=lfs diff=lfs merge=lfs -text
1453
  p3/preprocess/Amyotrophic_Lateral_Sclerosis/GSE26927.csv filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1451
  p3/preprocess/Alopecia/gene_data/GSE66664.csv filter=lfs diff=lfs merge=lfs -text
1452
  p3/preprocess/Amyotrophic_Lateral_Sclerosis/GSE118336.csv filter=lfs diff=lfs merge=lfs -text
1453
  p3/preprocess/Amyotrophic_Lateral_Sclerosis/GSE26927.csv filter=lfs diff=lfs merge=lfs -text
1454
+ p3/preprocess/Alzheimers_Disease/gene_data/GSE109887.csv filter=lfs diff=lfs merge=lfs -text
1455
+ p3/preprocess/Alzheimers_Disease/GSE132903.csv filter=lfs diff=lfs merge=lfs -text
1456
+ p3/preprocess/Alzheimers_Disease/gene_data/GSE243243.csv filter=lfs diff=lfs merge=lfs -text
1457
+ p3/preprocess/Amyotrophic_Lateral_Sclerosis/GSE68607.csv filter=lfs diff=lfs merge=lfs -text
1458
+ p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE52937.csv filter=lfs diff=lfs merge=lfs -text
1459
+ p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE26927.csv filter=lfs diff=lfs merge=lfs -text
1460
+ p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE118336.csv filter=lfs diff=lfs merge=lfs -text
1461
+ p3/preprocess/Aniridia/GSE137996.csv filter=lfs diff=lfs merge=lfs -text
1462
+ p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE68607.csv filter=lfs diff=lfs merge=lfs -text
1463
+ p3/preprocess/Alzheimers_Disease/gene_data/GSE122063.csv filter=lfs diff=lfs merge=lfs -text
1464
+ p3/preprocess/Aniridia/gene_data/GSE137996.csv filter=lfs diff=lfs merge=lfs -text
1465
+ p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE95810.csv filter=lfs diff=lfs merge=lfs -text
1466
+ p3/preprocess/Alzheimers_Disease/gene_data/GSE132903.csv filter=lfs diff=lfs merge=lfs -text
1467
+ p3/preprocess/Von_Hippel_Lindau/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
1468
+ p3/preprocess/Ankylosing_Spondylitis/GSE73754.csv filter=lfs diff=lfs merge=lfs -text
1469
+ p3/preprocess/Anxiety_disorder/GSE94119.csv filter=lfs diff=lfs merge=lfs -text
1470
+ p3/preprocess/Von_Hippel_Lindau/TCGA.csv filter=lfs diff=lfs merge=lfs -text
1471
+ p3/preprocess/Ankylosing_Spondylitis/gene_data/GSE73754.csv filter=lfs diff=lfs merge=lfs -text
1472
+ p3/preprocess/Anxiety_disorder/GSE68526.csv filter=lfs diff=lfs merge=lfs -text
1473
+ p3/preprocess/Anxiety_disorder/GSE60491.csv filter=lfs diff=lfs merge=lfs -text
1474
+ p3/preprocess/Anorexia_Nervosa/GSE60190.csv filter=lfs diff=lfs merge=lfs -text
1475
+ p3/preprocess/Anorexia_Nervosa/gene_data/GSE60190.csv filter=lfs diff=lfs merge=lfs -text
1476
+ p3/preprocess/Anxiety_disorder/gene_data/GSE94119.csv filter=lfs diff=lfs merge=lfs -text
1477
+ p3/preprocess/Arrhythmia/GSE136992.csv filter=lfs diff=lfs merge=lfs -text
1478
+ p3/preprocess/Arrhythmia/GSE115574.csv filter=lfs diff=lfs merge=lfs -text
1479
+ p3/preprocess/Anxiety_disorder/gene_data/GSE60491.csv filter=lfs diff=lfs merge=lfs -text
p3/preprocess/Alzheimers_Disease/GSE132903.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91e64c18b6f151c74c55ce8c6a8327a3603a0d991feeebe12a4b867b49d26a73
3
+ size 46424882
p3/preprocess/Alzheimers_Disease/gene_data/GSE109887.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a64f7927975659075067e848cc09f7734d65748acf16823886826aebe1da7e63
3
+ size 25491421
p3/preprocess/Alzheimers_Disease/gene_data/GSE122063.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:167a58f7e2efb1dcb8d9bf1db0c6b23c9b31677eb900434a5cdfb2769979209c
3
+ size 34270174
p3/preprocess/Alzheimers_Disease/gene_data/GSE132903.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68a154f0c8e664cc61d16dc207b178e362caa3a5ab1f7563e6a20e87cd12d496
3
+ size 46422319
p3/preprocess/Alzheimers_Disease/gene_data/GSE243243.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3a1f69b13be0d5eff4c17860bc7c3dcf0ae2ae9ff02f14218e63c38bf03b1b9
3
+ size 25405099
p3/preprocess/Amyotrophic_Lateral_Sclerosis/GSE68607.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa229574d1a8698cd7f54dd5a6351992337357d16b0fb300bb8781c48b7abbb1
3
+ size 18452259
p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE118336.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32cf5a7a1aaab06654db90a023c9c7fb3d0047ac36ccb482eee3adf956cf3403
3
+ size 17824380
p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE212131.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE26927.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fda1a917d07ebec40d5d6a7c34c1d365f4bb067f524abc8ec9df5fbc71de21ec
3
+ size 15651482
p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE52937.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28746a2e664631fd2108941097c33e4e1be448b620e10d53592c785fe31dec7b
3
+ size 13182082
p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE68607.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ce4016da6e5a472fe7c555a3f5e7823c8d0ed620bc78a62f069e3a945e10796
3
+ size 18451957
p3/preprocess/Amyotrophic_Lateral_Sclerosis/gene_data/GSE95810.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80df82d08b317462e8730d5eadcb2666c90fa4718552532b8360249eeb77ac01
3
+ size 21229925
p3/preprocess/Aniridia/GSE137996.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ddd1919aa5c89b314fd8c542cadea3c9543f4d1ac7095379459dbc98a30715c0
3
+ size 10652736
p3/preprocess/Aniridia/GSE204791.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Aniridia/code/GSE137996.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Aniridia"
6
+ cohort = "GSE137996"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Aniridia"
10
+ in_cohort_dir = "../DATA/GEO/Aniridia/GSE137996"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Aniridia/GSE137996.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Aniridia/gene_data/GSE137996.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Aniridia/clinical_data/GSE137996.csv"
16
+ json_path = "./output/preprocess/3/Aniridia/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Extract background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
23
+
24
+ # Get unique values per clinical feature
25
+ sample_characteristics = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background info
28
+ print("Dataset Background Information:")
29
+ print(f"{background_info}\n")
30
+
31
+ # Print sample characteristics
32
+ print("Sample Characteristics:")
33
+ for feature, values in sample_characteristics.items():
34
+ print(f"Feature: {feature}")
35
+ print(f"Values: {values}\n")
36
+ # 1. Gene Expression Data Availability
37
+ is_gene_available = True # Series summary mentions mRNA analysis with microarrays
38
+
39
+ # 2.1 Data Availability
40
+ trait_row = 2 # Disease status in Feature 2
41
+ age_row = 0 # Age data in Feature 0
42
+ gender_row = 1 # Gender data in Feature 1
43
+
44
+ # 2.2 Data Type Conversion Functions
45
+ def convert_trait(x):
46
+ # Binary: 0 for control, 1 for disease
47
+ if not isinstance(x, str):
48
+ return None
49
+ value = x.split(": ")[-1].lower()
50
+ if "aak" in value:
51
+ return 1
52
+ elif "control" in value:
53
+ return 0
54
+ return None
55
+
56
+ def convert_age(x):
57
+ # Continuous
58
+ if not isinstance(x, str):
59
+ return None
60
+ try:
61
+ return float(x.split(": ")[-1])
62
+ except:
63
+ return None
64
+
65
+ def convert_gender(x):
66
+ # Binary: 0 for female, 1 for male
67
+ if not isinstance(x, str):
68
+ return None
69
+ value = x.split(": ")[-1].lower()
70
+ if value in ['f', 'w']: # 'w' likely means woman
71
+ return 0
72
+ elif value == 'm':
73
+ return 1
74
+ return None
75
+
76
+ # 3. Save Initial Metadata
77
+ validate_and_save_cohort_info(
78
+ is_final=False,
79
+ cohort=cohort,
80
+ info_path=json_path,
81
+ is_gene_available=is_gene_available,
82
+ is_trait_available=trait_row is not None
83
+ )
84
+
85
+ # 4. Clinical Feature Extraction
86
+ if trait_row is not None:
87
+ selected_clinical_df = geo_select_clinical_features(
88
+ clinical_df=clinical_data,
89
+ trait=trait,
90
+ trait_row=trait_row,
91
+ convert_trait=convert_trait,
92
+ age_row=age_row,
93
+ convert_age=convert_age,
94
+ gender_row=gender_row,
95
+ convert_gender=convert_gender
96
+ )
97
+
98
+ # Preview the selected features
99
+ print("Preview of selected clinical features:")
100
+ print(preview_df(selected_clinical_df))
101
+
102
+ # Save clinical data
103
+ os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
104
+ selected_clinical_df.to_csv(out_clinical_data_file)
105
+ # Extract gene expression data from matrix file
106
+ gene_data = get_genetic_data(matrix_file)
107
+
108
+ # Print first 20 row IDs and shape of data to help debug
109
+ print("Shape of gene expression data:", gene_data.shape)
110
+ print("\nFirst few rows of data:")
111
+ print(gene_data.head())
112
+ print("\nFirst 20 gene/probe identifiers:")
113
+ print(gene_data.index[:20])
114
+
115
+ # Inspect a snippet of raw file to verify identifier format
116
+ import gzip
117
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
118
+ lines = []
119
+ for i, line in enumerate(f):
120
+ if "!series_matrix_table_begin" in line:
121
+ # Get the next 5 lines after the marker
122
+ for _ in range(5):
123
+ lines.append(next(f).strip())
124
+ break
125
+ print("\nFirst few lines after matrix marker in raw file:")
126
+ for line in lines:
127
+ print(line)
128
+ # Based on the provided data, the gene identifiers are Agilent probe IDs (A_19_P format)
129
+ # These are not standard human gene symbols and need to be mapped
130
+ requires_gene_mapping = True
131
+ # Extract gene annotation from SOFT file
132
+ gene_annotation = get_gene_annotation(soft_file)
133
+
134
+ # Preview annotation dataframe structure
135
+ print("Gene Annotation Preview:")
136
+ print("Column names:", gene_annotation.columns.tolist())
137
+ print("\nFirst few rows as dictionary:")
138
+ print(preview_df(gene_annotation))
139
+ # 1. Looking at the gene identifiers in gene expression data (e.g., A_19_P00315452)
140
+ # and in gene annotation data, 'ID' column has the same format
141
+ # 'GENE_SYMBOL' column contains the gene symbols we want to map to
142
+
143
+ # 2. Get mapping between probe IDs and gene symbols
144
+ probe_to_gene_map = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
145
+
146
+ # 3. Apply mapping to convert probe-level data to gene-level data
147
+ gene_data = apply_gene_mapping(gene_data, probe_to_gene_map)
148
+ # 1. Normalize gene symbols
149
+ gene_data = normalize_gene_symbols_in_index(gene_data)
150
+
151
+ # Save normalized gene data
152
+ gene_data.to_csv(out_gene_data_file)
153
+
154
+ # 2. Link clinical and genetic data
155
+ try:
156
+ clinical_data = pd.read_csv(out_clinical_data_file, index_col=0)
157
+ linked_data = geo_link_clinical_genetic_data(clinical_data, gene_data)
158
+
159
+ # 3. Handle missing values
160
+ linked_data = handle_missing_values(linked_data, trait)
161
+
162
+ # 4. Determine if features are biased
163
+ is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
164
+
165
+ # 5. Validate and save cohort info
166
+ is_usable = validate_and_save_cohort_info(
167
+ is_final=True,
168
+ cohort=cohort,
169
+ info_path=json_path,
170
+ is_gene_available=True,
171
+ is_trait_available=True,
172
+ is_biased=is_trait_biased,
173
+ df=linked_data,
174
+ note="Gene expression data successfully mapped and linked with clinical features"
175
+ )
176
+
177
+ # 6. Save linked data only if usable AND trait is not biased
178
+ if is_usable and not is_trait_biased:
179
+ linked_data.to_csv(out_data_file)
180
+
181
+ except Exception as e:
182
+ print(f"Error in data linking and processing: {str(e)}")
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=True,
190
+ df=pd.DataFrame(),
191
+ note=f"Data processing failed: {str(e)}"
192
+ )
p3/preprocess/Aniridia/code/GSE137997.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Aniridia"
6
+ cohort = "GSE137997"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Aniridia"
10
+ in_cohort_dir = "../DATA/GEO/Aniridia/GSE137997"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Aniridia/GSE137997.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Aniridia/gene_data/GSE137997.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Aniridia/clinical_data/GSE137997.csv"
16
+ json_path = "./output/preprocess/3/Aniridia/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Extract background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
23
+
24
+ # Get unique values per clinical feature
25
+ sample_characteristics = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background info
28
+ print("Dataset Background Information:")
29
+ print(f"{background_info}\n")
30
+
31
+ # Print sample characteristics
32
+ print("Sample Characteristics:")
33
+ for feature, values in sample_characteristics.items():
34
+ print(f"Feature: {feature}")
35
+ print(f"Values: {values}\n")
36
+ # 1. Gene Expression Data Availability
37
+ # Based on the background info, this is an mRNA study, so gene expression data should be available
38
+ is_gene_available = True
39
+
40
+ # 2. Variable Availability and Data Type Conversion
41
+ # Trait (Aniridia) can be inferred from disease status (AAK vs control) in Feature 2
42
+ trait_row = 2
43
+
44
+ def convert_trait(value):
45
+ if not isinstance(value, str):
46
+ return None
47
+ value = value.split(': ')[-1].strip().lower()
48
+ # AAK (aniridia-associated keratopathy) indicates aniridia
49
+ if value == 'aak':
50
+ return 1
51
+ elif value == 'healthy control':
52
+ return 0
53
+ return None
54
+
55
+ # Age is available in Feature 0
56
+ age_row = 0
57
+
58
+ def convert_age(value):
59
+ if not isinstance(value, str):
60
+ return None
61
+ try:
62
+ age = int(value.split(': ')[-1])
63
+ return age
64
+ except:
65
+ return None
66
+
67
+ # Gender is available in Feature 1
68
+ gender_row = 1
69
+
70
+ def convert_gender(value):
71
+ if not isinstance(value, str):
72
+ return None
73
+ value = value.split(': ')[-1].strip().lower()
74
+ if value in ['f', 'w']: # 'w' likely means woman/weiblich(German)
75
+ return 0
76
+ elif value == 'm':
77
+ return 1
78
+ return None
79
+
80
+ # 3. Save Metadata
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=trait_row is not None
87
+ )
88
+
89
+ # 4. Clinical Feature Extraction
90
+ if trait_row is not None:
91
+ clinical_features = geo_select_clinical_features(
92
+ clinical_df=clinical_data,
93
+ trait=trait,
94
+ trait_row=trait_row,
95
+ convert_trait=convert_trait,
96
+ age_row=age_row,
97
+ convert_age=convert_age,
98
+ gender_row=gender_row,
99
+ convert_gender=convert_gender
100
+ )
101
+
102
+ # Preview the extracted features
103
+ preview = preview_df(clinical_features)
104
+ print("Preview of clinical features:")
105
+ print(preview)
106
+
107
+ # Save to CSV
108
+ clinical_features.to_csv(out_clinical_data_file)
109
+ # Extract gene expression data from matrix file
110
+ gene_data = get_genetic_data(matrix_file)
111
+
112
+ # Print first 20 row IDs and shape of data to help debug
113
+ print("Shape of gene expression data:", gene_data.shape)
114
+ print("\nFirst few rows of data:")
115
+ print(gene_data.head())
116
+ print("\nFirst 20 gene/probe identifiers:")
117
+ print(gene_data.index[:20])
118
+ # Based on the identifiers having the format "hsa-miR-*" and "hsa-let-*", these are microRNA identifiers,
119
+ # not standard human gene symbols. They need to be mapped to their target genes.
120
+ requires_gene_mapping = True
121
+ # Extract gene annotation from SOFT file
122
+ gene_annotation = get_gene_annotation(soft_file)
123
+
124
+ # Print findings about dataset nature
125
+ print("Dataset Analysis:")
126
+ print("-" * 50)
127
+ print("This dataset contains miRNA expression data (hsa-miR-* identifiers)")
128
+ print("Standard gene mapping is not applicable for miRNA data")
129
+ print("The dataset cannot be used for gene-level analysis without miRNA target information")
130
+ print("-" * 50)
131
+
132
+ # Set requires_gene_mapping to False since we cannot map miRNAs to genes
133
+ requires_gene_mapping = False
134
+
135
+ # Set is_gene_available to False since we don't have gene expression data
136
+ is_gene_available = False
137
+
138
+ # Save updated metadata about dataset usability
139
+ validate_and_save_cohort_info(
140
+ is_final=False,
141
+ cohort=cohort,
142
+ info_path=json_path,
143
+ is_gene_available=is_gene_available,
144
+ is_trait_available=True,
145
+ note="Dataset contains miRNA expression data instead of gene expression data"
146
+ )
p3/preprocess/Aniridia/code/GSE204791.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Aniridia"
6
+ cohort = "GSE204791"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Aniridia"
10
+ in_cohort_dir = "../DATA/GEO/Aniridia/GSE204791"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Aniridia/GSE204791.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Aniridia/gene_data/GSE204791.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Aniridia/clinical_data/GSE204791.csv"
16
+ json_path = "./output/preprocess/3/Aniridia/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Extract background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
23
+
24
+ # Get unique values per clinical feature
25
+ sample_characteristics = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background info
28
+ print("Dataset Background Information:")
29
+ print(f"{background_info}\n")
30
+
31
+ # Print sample characteristics
32
+ print("Sample Characteristics:")
33
+ for feature, values in sample_characteristics.items():
34
+ print(f"Feature: {feature}")
35
+ print(f"Values: {values}\n")
36
+ # 1. Gene Expression Data Availability
37
+ is_gene_available = True # Contains both mRNA and miRNA data according to background
38
+
39
+ # 2. Data Availability and Type Conversion
40
+ # 2.1 Row identifiers
41
+ trait_row = 2 # 'disease' field indicates KC vs control status
42
+ age_row = 0 # 'age' field
43
+ gender_row = 1 # 'gender' field
44
+
45
+ # 2.2 Conversion functions
46
+ def convert_trait(value: str) -> Optional[int]:
47
+ if pd.isna(value):
48
+ return None
49
+ value = value.split(': ')[1].lower() if ': ' in value else value.lower()
50
+ if 'kc' in value:
51
+ return 1
52
+ elif 'control' in value:
53
+ return 0
54
+ return None
55
+
56
+ def convert_age(value: str) -> Optional[float]:
57
+ if pd.isna(value):
58
+ return None
59
+ value = value.split(': ')[1] if ': ' in value else value
60
+ try:
61
+ return float(value)
62
+ except:
63
+ return None
64
+
65
+ def convert_gender(value: str) -> Optional[int]:
66
+ if pd.isna(value):
67
+ return None
68
+ value = value.split(': ')[1].upper() if ': ' in value else value.upper()
69
+ if value == 'F':
70
+ return 0
71
+ elif value == 'M':
72
+ return 1
73
+ return None
74
+
75
+ # 3. Save metadata
76
+ validate_and_save_cohort_info(
77
+ is_final=False,
78
+ cohort=cohort,
79
+ info_path=json_path,
80
+ is_gene_available=is_gene_available,
81
+ is_trait_available=trait_row is not None
82
+ )
83
+
84
+ # 4. Clinical Feature Extraction
85
+ if trait_row is not None:
86
+ clinical_features = geo_select_clinical_features(
87
+ clinical_df=clinical_data,
88
+ trait=trait,
89
+ trait_row=trait_row,
90
+ convert_trait=convert_trait,
91
+ age_row=age_row,
92
+ convert_age=convert_age,
93
+ gender_row=gender_row,
94
+ convert_gender=convert_gender
95
+ )
96
+ preview = preview_df(clinical_features)
97
+ print("Preview of clinical features:", preview)
98
+ clinical_features.to_csv(out_clinical_data_file)
99
+ # Extract gene expression data from matrix file
100
+ gene_data = get_genetic_data(matrix_file)
101
+
102
+ # Print first 20 row IDs and shape of data to help debug
103
+ print("Shape of gene expression data:", gene_data.shape)
104
+ print("\nFirst few rows of data:")
105
+ print(gene_data.head())
106
+ print("\nFirst 20 gene/probe identifiers:")
107
+ print(gene_data.index[:20])
108
+
109
+ # Inspect a snippet of raw file to verify identifier format
110
+ import gzip
111
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
112
+ lines = []
113
+ for i, line in enumerate(f):
114
+ if "!series_matrix_table_begin" in line:
115
+ # Get the next 5 lines after the marker
116
+ for _ in range(5):
117
+ lines.append(next(f).strip())
118
+ break
119
+ print("\nFirst few lines after matrix marker in raw file:")
120
+ for line in lines:
121
+ print(line)
122
+ # Looking at the gene identifiers, they appear to be probe IDs
123
+ # (e.g. "(+)E1A_r60_1", "A_19_P00315452") rather than standard human gene symbols.
124
+ # These identifiers come from a microarray platform and need to be mapped to gene symbols.
125
+
126
+ requires_gene_mapping = True
127
+ # Extract gene annotation from SOFT file and get meaningful data
128
+ gene_annotation = get_gene_annotation(soft_file)
129
+
130
+ # Preview gene annotation data
131
+ print("Gene annotation shape:", gene_annotation.shape)
132
+ print("\nGene annotation preview:")
133
+ print(preview_df(gene_annotation))
134
+
135
+ print("\nNumber of non-null values in each column:")
136
+ print(gene_annotation.count())
137
+
138
+ print("\nNote: Gene mapping will use:")
139
+ print("'ID' column: Probe identifiers")
140
+ print("'GENE_SYMBOL' column: Contains gene symbols")
141
+ print("\nExample gene symbol value:")
142
+ print(gene_annotation['GENE_SYMBOL'].iloc[0])
143
+ # 1. Create gene mapping dataframe from annotation
144
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
145
+
146
+ # 2. Apply gene mapping to convert probe-level data to gene expression data
147
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
148
+
149
+ # Preview the mapped gene expression data
150
+ print("Shape of gene expression data after mapping:", gene_data.shape)
151
+ print("\nFirst few rows of mapped data:")
152
+ print(gene_data.head())
153
+ print("\nFirst 20 gene symbols:")
154
+ print(gene_data.index[:20])
155
+ # 1. Normalize gene symbols
156
+ gene_data = normalize_gene_symbols_in_index(gene_data)
157
+
158
+ # Save normalized gene data
159
+ gene_data.to_csv(out_gene_data_file)
160
+
161
+ # 2. Link clinical and genetic data
162
+ try:
163
+ clinical_data = pd.read_csv(out_clinical_data_file, index_col=0)
164
+ linked_data = geo_link_clinical_genetic_data(clinical_data, gene_data)
165
+
166
+ # 3. Handle missing values
167
+ linked_data = handle_missing_values(linked_data, trait)
168
+
169
+ # 4. Determine if features are biased
170
+ is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
171
+
172
+ # 5. Validate and save cohort info
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=is_trait_biased,
180
+ df=linked_data,
181
+ note="Gene expression data successfully mapped and linked with clinical features"
182
+ )
183
+
184
+ # 6. Save linked data only if usable AND trait is not biased
185
+ if is_usable and not is_trait_biased:
186
+ linked_data.to_csv(out_data_file)
187
+
188
+ except Exception as e:
189
+ print(f"Error in data linking and processing: {str(e)}")
190
+ is_usable = validate_and_save_cohort_info(
191
+ is_final=True,
192
+ cohort=cohort,
193
+ info_path=json_path,
194
+ is_gene_available=True,
195
+ is_trait_available=True,
196
+ is_biased=True,
197
+ df=pd.DataFrame(),
198
+ note=f"Data processing failed: {str(e)}"
199
+ )
p3/preprocess/Aniridia/code/TCGA.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Aniridia"
6
+
7
+ # Input paths
8
+ tcga_root_dir = "../DATA/TCGA"
9
+
10
+ # Output paths
11
+ out_data_file = "./output/preprocess/3/Aniridia/TCGA.csv"
12
+ out_gene_data_file = "./output/preprocess/3/Aniridia/gene_data/TCGA.csv"
13
+ out_clinical_data_file = "./output/preprocess/3/Aniridia/clinical_data/TCGA.csv"
14
+ json_path = "./output/preprocess/3/Aniridia/cohort_info.json"
15
+
16
+ # No cohort in TCGA matches Aniridia (congenital absence of iris)
17
+ # Mark trait as unavailable and skip further processing
18
+ validate_and_save_cohort_info(
19
+ is_final=False,
20
+ cohort="TCGA",
21
+ info_path=json_path,
22
+ is_gene_available=False,
23
+ is_trait_available=False
24
+ )
p3/preprocess/Aniridia/gene_data/GSE137996.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf53c745e3f06fd8ff5be2dff4ad6369afd7466c33cb6edb93709d6d5bc442f1
3
+ size 10652200
p3/preprocess/Aniridia/gene_data/GSE204791.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Ankylosing_Spondylitis/GSE25101.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Ankylosing_Spondylitis/GSE73754.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f082f896405560c4c0fa041b70732b9e2e6d67a97b56351c43e4792d8ae9a43
3
+ size 15381007
p3/preprocess/Ankylosing_Spondylitis/clinical_data/GSE25101.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ,GSM616668,GSM616669,GSM616670,GSM616671,GSM616672,GSM616673,GSM616674,GSM616675,GSM616676,GSM616677,GSM616678,GSM616679,GSM616680,GSM616681,GSM616682,GSM616683,GSM616684,GSM616685,GSM616686,GSM616687,GSM616688,GSM616689,GSM616690,GSM616691,GSM616692,GSM616693,GSM616694,GSM616695,GSM616696,GSM616697,GSM616698,GSM616699
2
+ Ankylosing_Spondylitis,1.0,1.0,1.0,1.0,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
p3/preprocess/Ankylosing_Spondylitis/clinical_data/GSE73754.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM1902130,GSM1902131,GSM1902132,GSM1902133,GSM1902134,GSM1902135,GSM1902136,GSM1902137,GSM1902138,GSM1902139,GSM1902140,GSM1902141,GSM1902142,GSM1902143,GSM1902144,GSM1902145,GSM1902146,GSM1902147,GSM1902148,GSM1902149,GSM1902150,GSM1902151,GSM1902152,GSM1902153,GSM1902154,GSM1902155,GSM1902156,GSM1902157,GSM1902158,GSM1902159,GSM1902160,GSM1902161,GSM1902162,GSM1902163,GSM1902164,GSM1902165,GSM1902166,GSM1902167,GSM1902168,GSM1902169,GSM1902170,GSM1902171,GSM1902172,GSM1902173,GSM1902174,GSM1902175,GSM1902176,GSM1902177,GSM1902178,GSM1902179,GSM1902180,GSM1902181,GSM1902182,GSM1902183,GSM1902184,GSM1902185,GSM1902186,GSM1902187,GSM1902188,GSM1902189,GSM1902190,GSM1902191,GSM1902192,GSM1902193,GSM1902194,GSM1902195,GSM1902196,GSM1902197,GSM1902198,GSM1902199,GSM1902200,GSM1902201
2
+ Ankylosing_Spondylitis,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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
3
+ Age,53.0,26.0,29.0,50.0,35.0,48.0,18.0,39.0,49.0,43.0,43.0,18.0,59.0,51.0,18.0,45.0,52.0,77.0,34.0,31.0,51.0,23.0,52.0,46.0,40.0,55.0,54.0,41.0,38.0,45.0,52.0,43.0,41.0,21.0,47.0,60.0,46.0,27.0,37.0,28.0,37.0,48.0,41.0,53.0,39.0,18.0,50.0,22.0,48.0,57.0,23.0,56.0,28.0,26.0,65.0,41.0,32.0,56.0,47.0,71.0,24.0,24.0,27.0,37.0,42.0,63.0,61.0,20.0,31.0,25.0,29.0,65.0
4
+ Gender,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
p3/preprocess/Ankylosing_Spondylitis/code/GSE25101.py ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Ankylosing_Spondylitis"
6
+ cohort = "GSE25101"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Ankylosing_Spondylitis"
10
+ in_cohort_dir = "../DATA/GEO/Ankylosing_Spondylitis/GSE25101"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/GSE25101.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/gene_data/GSE25101.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/clinical_data/GSE25101.csv"
16
+ json_path = "./output/preprocess/3/Ankylosing_Spondylitis/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Extract background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
23
+
24
+ # Get unique values per clinical feature
25
+ sample_characteristics = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background info
28
+ print("Dataset Background Information:")
29
+ print(f"{background_info}\n")
30
+
31
+ # Print sample characteristics
32
+ print("Sample Characteristics:")
33
+ for feature, values in sample_characteristics.items():
34
+ print(f"Feature: {feature}")
35
+ print(f"Values: {values}\n")
36
+ # 1. Gene Expression Data Availability
37
+ # Dataset uses Illumina HT-12 Whole-Genome Expression BeadChips
38
+ # and measures whole blood gene expression
39
+ is_gene_available = True
40
+
41
+ # 2.1 Data Availability
42
+ # Trait data in row 2 - disease status
43
+ trait_row = 2
44
+ # Age and gender not available in characteristics but mentioned as matched in design
45
+ age_row = None
46
+ gender_row = None
47
+
48
+ # 2.2 Convert functions
49
+ def convert_trait(value):
50
+ """Convert disease status to binary"""
51
+ if 'disease status:' in value:
52
+ if 'Ankylosing spondylitis patient' in value:
53
+ return 1
54
+ elif 'Normal control' in value:
55
+ return 0
56
+ return None
57
+
58
+ convert_age = None
59
+ convert_gender = None
60
+
61
+ # 3. Save metadata
62
+ validate_and_save_cohort_info(
63
+ is_final=False,
64
+ cohort=cohort,
65
+ info_path=json_path,
66
+ is_gene_available=is_gene_available,
67
+ is_trait_available=(trait_row is not None)
68
+ )
69
+
70
+ # 4. Extract clinical features
71
+ clinical_features = geo_select_clinical_features(
72
+ clinical_df=clinical_data,
73
+ trait=trait,
74
+ trait_row=trait_row,
75
+ convert_trait=convert_trait,
76
+ age_row=age_row,
77
+ convert_age=convert_age,
78
+ gender_row=gender_row,
79
+ convert_gender=convert_gender
80
+ )
81
+
82
+ # Preview the extracted features
83
+ print(preview_df(clinical_features))
84
+
85
+ # Save clinical data
86
+ clinical_features.to_csv(out_clinical_data_file)
87
+ # Extract gene expression data from matrix file
88
+ gene_data = get_genetic_data(matrix_file)
89
+
90
+ # Print first 20 row IDs and shape of data to help debug
91
+ print("Shape of gene expression data:", gene_data.shape)
92
+ print("\nFirst few rows of data:")
93
+ print(gene_data.head())
94
+ print("\nFirst 20 gene/probe identifiers:")
95
+ print(gene_data.index[:20])
96
+
97
+ # Inspect a snippet of raw file to verify identifier format
98
+ import gzip
99
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
100
+ lines = []
101
+ for i, line in enumerate(f):
102
+ if "!series_matrix_table_begin" in line:
103
+ # Get the next 5 lines after the marker
104
+ for _ in range(5):
105
+ lines.append(next(f).strip())
106
+ break
107
+ print("\nFirst few lines after matrix marker in raw file:")
108
+ for line in lines:
109
+ print(line)
110
+ # Based on the gene identifiers starting with "ILMN_", these are Illumina probe IDs
111
+ # which need to be mapped to HUGO gene symbols for interpretability
112
+ requires_gene_mapping = True
113
+ # Extract gene annotation from SOFT file
114
+ gene_annotation = get_gene_annotation(soft_file)
115
+
116
+ # Preview annotation dataframe structure
117
+ print("Gene Annotation Preview:")
118
+ print("Column names:", gene_annotation.columns.tolist())
119
+ print("\nFirst few rows as dictionary:")
120
+ print(preview_df(gene_annotation))
121
+ # Extract gene mapping from annotation data
122
+ # 'ID' column in annotation matches ILMN_* identifiers in expression data
123
+ # 'Symbol' column contains the target gene symbols
124
+ mapping_data = get_gene_mapping(gene_annotation, 'ID', 'Symbol')
125
+
126
+ # Apply gene mapping to convert probe-level data to gene-level data
127
+ gene_data = apply_gene_mapping(gene_data, mapping_data)
128
+
129
+ # Preview results
130
+ print("Shape of mapped gene expression data:", gene_data.shape)
131
+ print("\nFirst few rows of mapped data:")
132
+ print(gene_data.head())
133
+ print("\nFirst 20 gene symbols:")
134
+ print(gene_data.index[:20])
135
+ # 1. Normalize gene symbols
136
+ gene_data = normalize_gene_symbols_in_index(gene_data)
137
+
138
+ # Save normalized gene data
139
+ gene_data.to_csv(out_gene_data_file)
140
+
141
+ # 2. Link clinical and genetic data
142
+ try:
143
+ clinical_data = pd.read_csv(out_clinical_data_file, index_col=0)
144
+ linked_data = geo_link_clinical_genetic_data(clinical_data, gene_data)
145
+
146
+ # 3. Handle missing values
147
+ linked_data = handle_missing_values(linked_data, trait)
148
+
149
+ # 4. Determine if features are biased
150
+ is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
151
+
152
+ # 5. Validate and save cohort info
153
+ is_usable = validate_and_save_cohort_info(
154
+ is_final=True,
155
+ cohort=cohort,
156
+ info_path=json_path,
157
+ is_gene_available=True,
158
+ is_trait_available=True,
159
+ is_biased=is_trait_biased,
160
+ df=linked_data,
161
+ note="Gene expression data successfully mapped and linked with clinical features"
162
+ )
163
+
164
+ # 6. Save linked data only if usable AND trait is not biased
165
+ if is_usable and not is_trait_biased:
166
+ linked_data.to_csv(out_data_file)
167
+
168
+ except Exception as e:
169
+ print(f"Error in data linking and processing: {str(e)}")
170
+ is_usable = validate_and_save_cohort_info(
171
+ is_final=True,
172
+ cohort=cohort,
173
+ info_path=json_path,
174
+ is_gene_available=True,
175
+ is_trait_available=True,
176
+ is_biased=True,
177
+ df=pd.DataFrame(),
178
+ note=f"Data processing failed: {str(e)}"
179
+ )
p3/preprocess/Ankylosing_Spondylitis/code/GSE73754.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Ankylosing_Spondylitis"
6
+ cohort = "GSE73754"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Ankylosing_Spondylitis"
10
+ in_cohort_dir = "../DATA/GEO/Ankylosing_Spondylitis/GSE73754"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/GSE73754.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/gene_data/GSE73754.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/clinical_data/GSE73754.csv"
16
+ json_path = "./output/preprocess/3/Ankylosing_Spondylitis/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Extract background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
23
+
24
+ # Get unique values per clinical feature
25
+ sample_characteristics = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background info
28
+ print("Dataset Background Information:")
29
+ print(f"{background_info}\n")
30
+
31
+ # Print sample characteristics
32
+ print("Sample Characteristics:")
33
+ for feature, values in sample_characteristics.items():
34
+ print(f"Feature: {feature}")
35
+ print(f"Values: {values}\n")
36
+ # 1. Gene expression data availability check
37
+ is_gene_available = True # Based on series title and background, this is gene expression data
38
+
39
+ # 2.1 Data availability check
40
+ trait_row = 3 # 'disease' field contains trait info
41
+ age_row = 1 # 'age (yr)' field contains age info
42
+ gender_row = 0 # 'Sex' field contains gender info
43
+
44
+ # 2.2 Data type conversion functions
45
+ def convert_trait(value: str) -> int:
46
+ """Convert trait value to binary: 1 for AS, 0 for healthy control"""
47
+ if not value or 'disease:' not in value:
48
+ return None
49
+ value = value.split('disease:')[1].strip().lower()
50
+ if 'ankylosing spondylitis' in value:
51
+ return 1
52
+ elif 'healthy control' in value:
53
+ return 0
54
+ return None
55
+
56
+ def convert_age(value: str) -> float:
57
+ """Convert age value to continuous numeric"""
58
+ if not value or 'age (yr):' not in value:
59
+ return None
60
+ try:
61
+ return float(value.split('age (yr):')[1].strip())
62
+ except:
63
+ return None
64
+
65
+ def convert_gender(value: str) -> int:
66
+ """Convert gender to binary: 1 for male, 0 for female"""
67
+ if not value or 'Sex:' not in value:
68
+ return None
69
+ value = value.split('Sex:')[1].strip().lower()
70
+ if 'male' in value:
71
+ return 1
72
+ elif 'female' in value:
73
+ return 0
74
+ return None
75
+
76
+ # 3. Save metadata
77
+ validate_and_save_cohort_info(
78
+ is_final=False,
79
+ cohort=cohort,
80
+ info_path=json_path,
81
+ is_gene_available=is_gene_available,
82
+ is_trait_available=trait_row is not None
83
+ )
84
+
85
+ # 4. Extract clinical features if trait data available
86
+ if trait_row is not None:
87
+ clinical_features = geo_select_clinical_features(
88
+ clinical_df=clinical_data,
89
+ trait=trait,
90
+ trait_row=trait_row,
91
+ convert_trait=convert_trait,
92
+ age_row=age_row,
93
+ convert_age=convert_age,
94
+ gender_row=gender_row,
95
+ convert_gender=convert_gender
96
+ )
97
+
98
+ # Preview the extracted features
99
+ preview = preview_df(clinical_features)
100
+ print("Preview of clinical features:", preview)
101
+
102
+ # Save clinical data
103
+ clinical_features.to_csv(out_clinical_data_file)
104
+ # Extract gene expression data from matrix file
105
+ gene_data = get_genetic_data(matrix_file)
106
+
107
+ # Print first 20 row IDs and shape of data to help debug
108
+ print("Shape of gene expression data:", gene_data.shape)
109
+ print("\nFirst few rows of data:")
110
+ print(gene_data.head())
111
+ print("\nFirst 20 gene/probe identifiers:")
112
+ print(gene_data.index[:20])
113
+
114
+ # Inspect a snippet of raw file to verify identifier format
115
+ import gzip
116
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
117
+ lines = []
118
+ for i, line in enumerate(f):
119
+ if "!series_matrix_table_begin" in line:
120
+ # Get the next 5 lines after the marker
121
+ for _ in range(5):
122
+ lines.append(next(f).strip())
123
+ break
124
+ print("\nFirst few lines after matrix marker in raw file:")
125
+ for line in lines:
126
+ print(line)
127
+ # The identifiers starting with "ILMN_" indicate these are Illumina probe IDs
128
+ # They need to be mapped to standard human gene symbols for analysis
129
+ requires_gene_mapping = True
130
+ # Extract gene annotation from SOFT file
131
+ gene_annotation = get_gene_annotation(soft_file)
132
+
133
+ # Preview annotation dataframe structure
134
+ print("Gene Annotation Preview:")
135
+ print("Column names:", gene_annotation.columns.tolist())
136
+ print("\nFirst few rows as dictionary:")
137
+ print(preview_df(gene_annotation))
138
+ # Get gene mapping from probe IDs to gene symbols
139
+ mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
140
+
141
+ # Convert probe measurements to gene expression data
142
+ gene_data = apply_gene_mapping(gene_data, mapping_data)
143
+
144
+ # Normalize gene symbols to ensure consistency
145
+ gene_data = normalize_gene_symbols_in_index(gene_data)
146
+
147
+ # Save gene expression data
148
+ gene_data.to_csv(out_gene_data_file)
149
+ # 1. Normalize gene symbols
150
+ gene_data = normalize_gene_symbols_in_index(gene_data)
151
+
152
+ # Save normalized gene data
153
+ gene_data.to_csv(out_gene_data_file)
154
+
155
+ # 2. Link clinical and genetic data
156
+ try:
157
+ clinical_data = pd.read_csv(out_clinical_data_file, index_col=0)
158
+ linked_data = geo_link_clinical_genetic_data(clinical_data, gene_data)
159
+
160
+ # 3. Handle missing values
161
+ linked_data = handle_missing_values(linked_data, trait)
162
+
163
+ # 4. Determine if features are biased
164
+ is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
165
+
166
+ # 5. Validate and save cohort info
167
+ is_usable = validate_and_save_cohort_info(
168
+ is_final=True,
169
+ cohort=cohort,
170
+ info_path=json_path,
171
+ is_gene_available=True,
172
+ is_trait_available=True,
173
+ is_biased=is_trait_biased,
174
+ df=linked_data,
175
+ note="Gene expression data successfully mapped and linked with clinical features"
176
+ )
177
+
178
+ # 6. Save linked data only if usable AND trait is not biased
179
+ if is_usable and not is_trait_biased:
180
+ linked_data.to_csv(out_data_file)
181
+
182
+ except Exception as e:
183
+ print(f"Error in data linking and processing: {str(e)}")
184
+ is_usable = validate_and_save_cohort_info(
185
+ is_final=True,
186
+ cohort=cohort,
187
+ info_path=json_path,
188
+ is_gene_available=True,
189
+ is_trait_available=True,
190
+ is_biased=True,
191
+ df=pd.DataFrame(),
192
+ note=f"Data processing failed: {str(e)}"
193
+ )
p3/preprocess/Ankylosing_Spondylitis/code/TCGA.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Ankylosing_Spondylitis"
6
+
7
+ # Input paths
8
+ tcga_root_dir = "../DATA/TCGA"
9
+
10
+ # Output paths
11
+ out_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/TCGA.csv"
12
+ out_gene_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/gene_data/TCGA.csv"
13
+ out_clinical_data_file = "./output/preprocess/3/Ankylosing_Spondylitis/clinical_data/TCGA.csv"
14
+ json_path = "./output/preprocess/3/Ankylosing_Spondylitis/cohort_info.json"
15
+
16
+ # 1. Review subdirectories
17
+ # No cohort in TCGA matches or overlaps with Ankylosing Spondylitis (AS), which is an
18
+ # autoimmune condition rather than a cancer type. The available cancer cohorts are not
19
+ # relevant for studying this inflammatory arthritis condition.
20
+
21
+ validate_and_save_cohort_info(
22
+ is_final=False,
23
+ cohort="TCGA",
24
+ info_path=json_path,
25
+ is_gene_available=False,
26
+ is_trait_available=False
27
+ )
p3/preprocess/Ankylosing_Spondylitis/cohort_info.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"GSE73754": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": true, "has_gender": false, "sample_size": 72, "note": "Gene expression data successfully mapped and linked with clinical features"}, "GSE25101": {"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": 32, "note": "Gene expression data successfully mapped and linked with clinical features"}, "TCGA": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}}
p3/preprocess/Ankylosing_Spondylitis/gene_data/GSE25101.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Ankylosing_Spondylitis/gene_data/GSE73754.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:278d218464e4ad1fbb35f589dba9d301dce3d14e929abe97df9b5f01bb5f1949
3
+ size 15380336
p3/preprocess/Anorexia_Nervosa/GSE60190.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15d5c3df085c8109fba9b91ac712e5c48c8d062349a5cea50699ca89e8fb573e
3
+ size 27251111
p3/preprocess/Anorexia_Nervosa/clinical_data/GSE60190.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM1467273,GSM1467274,GSM1467275,GSM1467276,GSM1467277,GSM1467278,GSM1467279,GSM1467280,GSM1467281,GSM1467282,GSM1467283,GSM1467284,GSM1467285,GSM1467286,GSM1467287,GSM1467288,GSM1467289,GSM1467290,GSM1467291,GSM1467292,GSM1467293,GSM1467294,GSM1467295,GSM1467296,GSM1467297,GSM1467298,GSM1467299,GSM1467300,GSM1467301,GSM1467302,GSM1467303,GSM1467304,GSM1467305,GSM1467306,GSM1467307,GSM1467308,GSM1467309,GSM1467310,GSM1467311,GSM1467312,GSM1467313,GSM1467314,GSM1467315,GSM1467316,GSM1467317,GSM1467318,GSM1467319,GSM1467320,GSM1467321,GSM1467322,GSM1467323,GSM1467324,GSM1467325,GSM1467326,GSM1467327,GSM1467328,GSM1467329,GSM1467330,GSM1467331,GSM1467332,GSM1467333,GSM1467334,GSM1467335,GSM1467336,GSM1467337,GSM1467338,GSM1467339,GSM1467340,GSM1467341,GSM1467342,GSM1467343,GSM1467344,GSM1467345,GSM1467346,GSM1467347,GSM1467348,GSM1467349,GSM1467350,GSM1467351,GSM1467352,GSM1467353,GSM1467354,GSM1467355,GSM1467356,GSM1467357,GSM1467358,GSM1467359,GSM1467360,GSM1467361,GSM1467362,GSM1467363,GSM1467364,GSM1467365,GSM1467366,GSM1467367,GSM1467368,GSM1467369,GSM1467370,GSM1467371,GSM1467372,GSM1467373,GSM1467374,GSM1467375,GSM1467376,GSM1467377,GSM1467378,GSM1467379,GSM1467380,GSM1467381,GSM1467382,GSM1467383,GSM1467384,GSM1467385,GSM1467386,GSM1467387,GSM1467388,GSM1467389,GSM1467390,GSM1467391,GSM1467392,GSM1467393,GSM1467394,GSM1467395,GSM1467396,GSM1467397,GSM1467398,GSM1467399,GSM1467400,GSM1467401,GSM1467402,GSM1467403,GSM1467404,GSM1467405
2
+ Anorexia_Nervosa,1.0,0.0,,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,1.0,0.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,0.0,0.0,1.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0
3
+ Age,50.421917,27.49863,30.627397,61.167123,32.69589,39.213698,58.605479,49.2,41.041095,51.750684,50.89863,26.745205,29.104109,39.301369,48.978082,57.884931,28.364383,24.041095,19.268493,27.230136,46.605479,23.443835,51.038356,39.663013,46.109589,77.989041,46.967123,63.241095,62.306849,83.641095,42.838356,51.386301,66.715068,51.939726,34.339726,50.109589,18.758904,16.649315,16.353424,42.065753,16.726027,34.465753,34.254794,47.484931,43.756164,49.210958,57.482191,46.561643,49.561643,28.589041,38.410958,30.032876,56.09041,46.915068,49.021917,71.109589,17.235616,16.583561,16.934246,16.8,18.117808,18.660273,16.69589,75.572602,59.260273,55.545205,41.778082,57.454794,45.284931,56.304109,39.654794,55.945205,38.232876,58.109589,40.021917,50.504109,36.550684,45.117808,83.545205,18.786301,48.567123,38.331506,48.101369,18.39452,60.843835,61.372602,52.038356,59.254794,41.567123,50.358904,31.558904,45.701369,44.731506,34.39726,31.613698,54.846575,84.057534,66.79452,53.323287,30.043835,55.435616,45.676712,54.334246,63.558904,45.224657,23.69589,67.865753,16.753424,18.424657,17.09041,16.183561,33.260273,54.424657,45.378082,52.523287,35.273972,22.630136,20.863013,26.531506,24.627397,53.978082,34.961643,18.731506,30.726027,63.471232,54.808219,57.512328,57.610958,44.958904,35.684931,63.0,38.780821,45.978082
4
+ Gender,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0
p3/preprocess/Anorexia_Nervosa/code/GSE60190.py ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Anorexia_Nervosa"
6
+ cohort = "GSE60190"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Anorexia_Nervosa"
10
+ in_cohort_dir = "../DATA/GEO/Anorexia_Nervosa/GSE60190"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Anorexia_Nervosa/GSE60190.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Anorexia_Nervosa/gene_data/GSE60190.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Anorexia_Nervosa/clinical_data/GSE60190.csv"
16
+ json_path = "./output/preprocess/3/Anorexia_Nervosa/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Extract background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
23
+
24
+ # Get unique values per clinical feature
25
+ sample_characteristics = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background info
28
+ print("Dataset Background Information:")
29
+ print(f"{background_info}\n")
30
+
31
+ # Print sample characteristics
32
+ print("Sample Characteristics:")
33
+ for feature, values in sample_characteristics.items():
34
+ print(f"Feature: {feature}")
35
+ print(f"Values: {values}\n")
36
+ # 1. Gene Expression Data Availability
37
+ is_gene_available = True # Yes - The dataset uses Illumina HumanHT-12 v3 microarray for gene expression
38
+
39
+ # 2. Variable Availability and Data Type Conversion
40
+ # 2.1 Data Availability
41
+ trait_row = 1 # 'ocd' field shows ED vs Control cases
42
+ age_row = 5 # 'age' field available
43
+ gender_row = 7 # 'Sex' field available
44
+
45
+ # 2.2 Data Type Conversion Functions
46
+ def convert_trait(x):
47
+ """Convert ED/Control/OCD to binary values"""
48
+ if not x or ':' not in x:
49
+ return None
50
+ val = x.split(': ')[1].strip()
51
+ if val == 'ED':
52
+ return 1
53
+ elif val == 'Control':
54
+ return 0
55
+ return None
56
+
57
+ def convert_age(x):
58
+ """Convert age strings to float values"""
59
+ if not x or ':' not in x:
60
+ return None
61
+ try:
62
+ return float(x.split(': ')[1])
63
+ except:
64
+ return None
65
+
66
+ def convert_gender(x):
67
+ """Convert gender strings to binary (F=0, M=1)"""
68
+ if not x or ':' not in x:
69
+ return None
70
+ val = x.split(': ')[1].strip()
71
+ if val == 'F':
72
+ return 0
73
+ elif val == 'M':
74
+ return 1
75
+ return None
76
+
77
+ # 3. Save Metadata for Initial Filtering
78
+ validate_and_save_cohort_info(is_final=False,
79
+ cohort=cohort,
80
+ info_path=json_path,
81
+ is_gene_available=is_gene_available,
82
+ is_trait_available=trait_row is not None)
83
+
84
+ # 4. Clinical Feature Extraction
85
+ if trait_row is not None:
86
+ selected_clinical = geo_select_clinical_features(
87
+ clinical_df=clinical_data,
88
+ trait=trait,
89
+ trait_row=trait_row,
90
+ convert_trait=convert_trait,
91
+ age_row=age_row,
92
+ convert_age=convert_age,
93
+ gender_row=gender_row,
94
+ convert_gender=convert_gender
95
+ )
96
+
97
+ # Preview the extracted features
98
+ print("Preview of extracted clinical features:")
99
+ print(preview_df(selected_clinical))
100
+
101
+ # Save clinical data
102
+ selected_clinical.to_csv(out_clinical_data_file)
103
+ # Extract gene expression data from matrix file
104
+ gene_data = get_genetic_data(matrix_file)
105
+
106
+ # Print first 20 row IDs and shape of data to help debug
107
+ print("Shape of gene expression data:", gene_data.shape)
108
+ print("\nFirst few rows of data:")
109
+ print(gene_data.head())
110
+ print("\nFirst 20 gene/probe identifiers:")
111
+ print(gene_data.index[:20])
112
+
113
+ # Inspect a snippet of raw file to verify identifier format
114
+ import gzip
115
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
116
+ lines = []
117
+ for i, line in enumerate(f):
118
+ if "!series_matrix_table_begin" in line:
119
+ # Get the next 5 lines after the marker
120
+ for _ in range(5):
121
+ lines.append(next(f).strip())
122
+ break
123
+ print("\nFirst few lines after matrix marker in raw file:")
124
+ for line in lines:
125
+ print(line)
126
+ # These appear to be Illumina probe IDs (ILMN_) rather than gene symbols
127
+ # They require mapping to official human gene symbols
128
+ requires_gene_mapping = True
129
+ # Extract gene annotation from SOFT file
130
+ gene_annotation = get_gene_annotation(soft_file)
131
+
132
+ # Preview annotation dataframe structure
133
+ print("Gene Annotation Preview:")
134
+ print("Column names:", gene_annotation.columns.tolist())
135
+ print("\nFirst few rows as dictionary:")
136
+ print(preview_df(gene_annotation))
137
+ # Get mapping between gene identifiers and gene symbols
138
+ gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
139
+
140
+ # Apply the mapping to convert probe data to gene expression data
141
+ gene_data = apply_gene_mapping(gene_data, gene_mapping)
142
+
143
+ # Preview the result
144
+ print("Shape of gene expression data after mapping:", gene_data.shape)
145
+ print("\nFirst few rows of mapped gene data:")
146
+ print(gene_data.head())
147
+ # 1. Normalize gene symbols
148
+ gene_data = normalize_gene_symbols_in_index(gene_data)
149
+
150
+ # Save normalized gene data
151
+ gene_data.to_csv(out_gene_data_file)
152
+
153
+ # 2. Link clinical and genetic data
154
+ try:
155
+ clinical_data = pd.read_csv(out_clinical_data_file, index_col=0)
156
+ linked_data = geo_link_clinical_genetic_data(clinical_data, gene_data)
157
+
158
+ # 3. Handle missing values
159
+ linked_data = handle_missing_values(linked_data, trait)
160
+
161
+ # 4. Determine if features are biased
162
+ is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
163
+
164
+ # 5. Validate and save cohort info
165
+ is_usable = validate_and_save_cohort_info(
166
+ is_final=True,
167
+ cohort=cohort,
168
+ info_path=json_path,
169
+ is_gene_available=True,
170
+ is_trait_available=True,
171
+ is_biased=is_trait_biased,
172
+ df=linked_data,
173
+ note="Gene expression data successfully mapped and linked with clinical features"
174
+ )
175
+
176
+ # 6. Save linked data only if usable AND trait is not biased
177
+ if is_usable and not is_trait_biased:
178
+ linked_data.to_csv(out_data_file)
179
+
180
+ except Exception as e:
181
+ print(f"Error in data linking and processing: {str(e)}")
182
+ is_usable = validate_and_save_cohort_info(
183
+ is_final=True,
184
+ cohort=cohort,
185
+ info_path=json_path,
186
+ is_gene_available=True,
187
+ is_trait_available=True,
188
+ is_biased=True,
189
+ df=pd.DataFrame(),
190
+ note=f"Data processing failed: {str(e)}"
191
+ )
p3/preprocess/Anorexia_Nervosa/code/TCGA.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Anorexia_Nervosa"
6
+
7
+ # Input paths
8
+ tcga_root_dir = "../DATA/TCGA"
9
+
10
+ # Output paths
11
+ out_data_file = "./output/preprocess/3/Anorexia_Nervosa/TCGA.csv"
12
+ out_gene_data_file = "./output/preprocess/3/Anorexia_Nervosa/gene_data/TCGA.csv"
13
+ out_clinical_data_file = "./output/preprocess/3/Anorexia_Nervosa/clinical_data/TCGA.csv"
14
+ json_path = "./output/preprocess/3/Anorexia_Nervosa/cohort_info.json"
15
+
16
+ # Review the provided TCGA subdirectories
17
+ # No suitable TCGA cohort found for Anorexia Nervosa as TCGA only contains cancer-related
18
+ # datasets, while Anorexia Nervosa is an eating disorder. None of the available cancer
19
+ # cohorts are relevant for studying this psychiatric/metabolic condition.
20
+
21
+ validate_and_save_cohort_info(
22
+ is_final=False,
23
+ cohort="TCGA",
24
+ info_path=json_path,
25
+ is_gene_available=False,
26
+ is_trait_available=False
27
+ )
p3/preprocess/Anorexia_Nervosa/cohort_info.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"GSE60190": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": true, "has_gender": true, "sample_size": 117, "note": "Gene expression data successfully mapped and linked with clinical features"}, "TCGA": {"is_usable": false, "is_gene_available": false, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}}
p3/preprocess/Anorexia_Nervosa/gene_data/GSE60190.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4a8f3fd148a67cabad28a1c791ac8495aa0cd2e43f38204757ca991d326698b
3
+ size 30959101
p3/preprocess/Anxiety_disorder/GSE60491.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e81eea8d1c3d47961711ad548b2e3aeed1e7d21b28b2a119caa2b1da62cd29fe
3
+ size 22264215
p3/preprocess/Anxiety_disorder/GSE61672.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Anxiety_disorder/GSE68526.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84088071631543dadcb0eb373d46c2dae14dd321f3ed92c3d2cfd8e01bdfd8b2
3
+ size 20039105
p3/preprocess/Anxiety_disorder/GSE78104.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Anxiety_disorder/GSE94119.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:192e8d7b973b362647e0d7695dfbc2c76246cfe2bca1cb134a89a0801be1fa06
3
+ size 11979089
p3/preprocess/Anxiety_disorder/clinical_data/GSE60190.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM1467273,GSM1467274,GSM1467275,GSM1467276,GSM1467277,GSM1467278,GSM1467279,GSM1467280,GSM1467281,GSM1467282,GSM1467283,GSM1467284,GSM1467285,GSM1467286,GSM1467287,GSM1467288,GSM1467289,GSM1467290,GSM1467291,GSM1467292,GSM1467293,GSM1467294,GSM1467295,GSM1467296,GSM1467297,GSM1467298,GSM1467299,GSM1467300,GSM1467301,GSM1467302,GSM1467303,GSM1467304,GSM1467305,GSM1467306,GSM1467307,GSM1467308,GSM1467309,GSM1467310,GSM1467311,GSM1467312,GSM1467313,GSM1467314,GSM1467315,GSM1467316,GSM1467317,GSM1467318,GSM1467319,GSM1467320,GSM1467321,GSM1467322,GSM1467323,GSM1467324,GSM1467325,GSM1467326,GSM1467327,GSM1467328,GSM1467329,GSM1467330,GSM1467331,GSM1467332,GSM1467333,GSM1467334,GSM1467335,GSM1467336,GSM1467337,GSM1467338,GSM1467339,GSM1467340,GSM1467341,GSM1467342,GSM1467343,GSM1467344,GSM1467345,GSM1467346,GSM1467347,GSM1467348,GSM1467349,GSM1467350,GSM1467351,GSM1467352,GSM1467353,GSM1467354,GSM1467355,GSM1467356,GSM1467357,GSM1467358,GSM1467359,GSM1467360,GSM1467361,GSM1467362,GSM1467363,GSM1467364,GSM1467365,GSM1467366,GSM1467367,GSM1467368,GSM1467369,GSM1467370,GSM1467371,GSM1467372,GSM1467373,GSM1467374,GSM1467375,GSM1467376,GSM1467377,GSM1467378,GSM1467379,GSM1467380,GSM1467381,GSM1467382,GSM1467383,GSM1467384,GSM1467385,GSM1467386,GSM1467387,GSM1467388,GSM1467389,GSM1467390,GSM1467391,GSM1467392,GSM1467393,GSM1467394,GSM1467395,GSM1467396,GSM1467397,GSM1467398,GSM1467399,GSM1467400,GSM1467401,GSM1467402,GSM1467403,GSM1467404,GSM1467405
2
+ Anxiety_disorder,,0.0,1.0,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,1.0,,0.0,,0.0,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,,,0.0,1.0,1.0,1.0,1.0,0.0,,0.0,0.0,,0.0,,,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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
3
+ Age,50.421917,27.49863,30.627397,61.167123,32.69589,39.213698,58.605479,49.2,41.041095,51.750684,50.89863,26.745205,29.104109,39.301369,48.978082,57.884931,28.364383,24.041095,19.268493,27.230136,46.605479,23.443835,51.038356,39.663013,46.109589,77.989041,46.967123,63.241095,62.306849,83.641095,42.838356,51.386301,66.715068,51.939726,34.339726,50.109589,18.758904,16.649315,16.353424,42.065753,16.726027,34.465753,34.254794,47.484931,43.756164,49.210958,57.482191,46.561643,49.561643,28.589041,38.410958,30.032876,56.09041,46.915068,49.021917,71.109589,17.235616,16.583561,16.934246,16.8,18.117808,18.660273,16.69589,75.572602,59.260273,55.545205,41.778082,57.454794,45.284931,56.304109,39.654794,55.945205,38.232876,58.109589,40.021917,50.504109,36.550684,45.117808,83.545205,18.786301,48.567123,38.331506,48.101369,18.39452,60.843835,61.372602,52.038356,59.254794,41.567123,50.358904,31.558904,45.701369,44.731506,34.39726,31.613698,54.846575,84.057534,66.79452,53.323287,30.043835,55.435616,45.676712,54.334246,63.558904,45.224657,23.69589,67.865753,16.753424,18.424657,17.09041,16.183561,33.260273,54.424657,45.378082,52.523287,35.273972,22.630136,20.863013,26.531506,24.627397,53.978082,34.961643,18.731506,30.726027,63.471232,54.808219,57.512328,57.610958,44.958904,35.684931,63.0,38.780821,45.978082
4
+ Gender,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0
p3/preprocess/Anxiety_disorder/clinical_data/GSE60491.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM1481100,GSM1481101,GSM1481102,GSM1481103,GSM1481104,GSM1481105,GSM1481106,GSM1481107,GSM1481108,GSM1481109,GSM1481110,GSM1481111,GSM1481112,GSM1481113,GSM1481114,GSM1481115,GSM1481116,GSM1481117,GSM1481118,GSM1481119,GSM1481120,GSM1481121,GSM1481122,GSM1481123,GSM1481124,GSM1481125,GSM1481126,GSM1481127,GSM1481128,GSM1481129,GSM1481130,GSM1481131,GSM1481132,GSM1481133,GSM1481134,GSM1481135,GSM1481136,GSM1481137,GSM1481138,GSM1481139,GSM1481140,GSM1481141,GSM1481142,GSM1481143,GSM1481144,GSM1481145,GSM1481146,GSM1481147,GSM1481148,GSM1481149,GSM1481150,GSM1481151,GSM1481152,GSM1481153,GSM1481154,GSM1481155,GSM1481156,GSM1481157,GSM1481158,GSM1481159,GSM1481160,GSM1481161,GSM1481162,GSM1481163,GSM1481164,GSM1481165,GSM1481166,GSM1481167,GSM1481168,GSM1481169,GSM1481170,GSM1481171,GSM1481172,GSM1481173,GSM1481174,GSM1481175,GSM1481176,GSM1481177,GSM1481178,GSM1481179,GSM1481180,GSM1481181,GSM1481182,GSM1481183,GSM1481184,GSM1481185,GSM1481186,GSM1481187,GSM1481188,GSM1481189,GSM1481190,GSM1481191,GSM1481192,GSM1481193,GSM1481194,GSM1481195,GSM1481196,GSM1481197,GSM1481198,GSM1481199,GSM1481200,GSM1481201,GSM1481202,GSM1481203,GSM1481204,GSM1481205,GSM1481206,GSM1481207,GSM1481208,GSM1481209,GSM1481210,GSM1481211,GSM1481212,GSM1481213,GSM1481214,GSM1481215,GSM1481216,GSM1481217,GSM1481218
2
+ Anxiety_disorder,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0
3
+ Age,21.0,22.0,21.0,21.0,22.0,23.0,23.0,23.0,23.0,23.0,21.0,33.0,21.0,22.0,22.0,23.0,23.0,20.0,34.0,21.0,20.0,21.0,19.0,22.0,21.0,20.0,20.0,20.0,23.0,20.0,33.0,23.0,22.0,20.0,20.0,19.0,27.0,19.0,53.0,21.0,22.0,20.0,21.0,22.0,21.0,25.0,22.0,22.0,23.0,19.0,26.0,21.0,22.0,34.0,21.0,19.0,20.0,23.0,45.0,19.0,19.0,33.0,22.0,38.0,19.0,26.0,29.0,30.0,23.0,28.0,19.0,19.0,22.0,20.0,20.0,19.0,19.0,18.0,21.0,25.0,18.0,19.0,21.0,24.0,20.0,20.0,22.0,20.0,21.0,22.0,19.0,20.0,20.0,21.0,21.0,22.0,45.0,59.0,22.0,22.0,35.0,51.0,34.0,51.0,50.0,21.0,21.0,25.0,29.0,24.0,20.0,26.0,22.0,32.0,27.0,22.0,26.0,18.0,20.0
4
+ Gender,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0
p3/preprocess/Anxiety_disorder/clinical_data/GSE61672.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM1510561,GSM1510562,GSM1510563,GSM1510564,GSM1510565,GSM1510566,GSM1510567,GSM1510568,GSM1510569,GSM1510570,GSM1510571,GSM1510572,GSM1510573,GSM1510574,GSM1510575,GSM1510576,GSM1510577,GSM1510578,GSM1510579,GSM1510580,GSM1510581,GSM1510582,GSM1510583,GSM1510584,GSM1510585,GSM1510586,GSM1510587,GSM1510588,GSM1510589,GSM1510590,GSM1510591,GSM1510592,GSM1510593,GSM1510594,GSM1510595,GSM1510596,GSM1510597,GSM1510598,GSM1510599,GSM1510600,GSM1510601,GSM1510602,GSM1510603,GSM1510604,GSM1510605,GSM1510606,GSM1510607,GSM1510608,GSM1510609,GSM1510610,GSM1510611,GSM1510612,GSM1510613,GSM1510614,GSM1510615,GSM1510616,GSM1510617,GSM1510618,GSM1510619,GSM1510620,GSM1510621,GSM1510622,GSM1510623,GSM1510624,GSM1510625,GSM1510626,GSM1510627,GSM1510628,GSM1510629,GSM1510630,GSM1510631,GSM1510632,GSM1510633,GSM1510634,GSM1510635,GSM1510636,GSM1510637,GSM1510638,GSM1510639,GSM1510640,GSM1510641,GSM1510642,GSM1510643,GSM1510644,GSM1510645,GSM1510646,GSM1510647,GSM1510648,GSM1510649,GSM1510650,GSM1510651,GSM1510652,GSM1510653,GSM1510654,GSM1510655,GSM1510656,GSM1510657,GSM1510658,GSM1510659,GSM1510660,GSM1510661,GSM1510662,GSM1510663,GSM1510664,GSM1510665,GSM1510666,GSM1510667,GSM1510668,GSM1510669,GSM1510670,GSM1510671,GSM1510672,GSM1510673,GSM1510674,GSM1510675,GSM1510676,GSM1510677,GSM1510678,GSM1510679,GSM1510680,GSM1510681,GSM1510682,GSM1510683,GSM1510684,GSM1510685,GSM1510686,GSM1510687,GSM1510688,GSM1510689,GSM1510690,GSM1510691,GSM1510692,GSM1510693,GSM1510694,GSM1510695,GSM1510696,GSM1510697,GSM1510698,GSM1510699,GSM1510700,GSM1510701,GSM1510702,GSM1510703,GSM1510704,GSM1510705,GSM1510706,GSM1510707,GSM1510708,GSM1510709,GSM1510710,GSM1510711,GSM1510712,GSM1510713,GSM1510714,GSM1510715,GSM1510716,GSM1510717,GSM1510718,GSM1510719,GSM1510720,GSM1510721,GSM1510722,GSM1510723,GSM1510724,GSM1510725,GSM1510726,GSM1510727,GSM1510728,GSM1510729,GSM1510730,GSM1510731,GSM1510732,GSM1510733,GSM1510734,GSM1510735,GSM1510736,GSM1510737,GSM1510738,GSM1510739,GSM1510740,GSM1510741,GSM1510742,GSM1510743,GSM1510744,GSM1510745,GSM1510746,GSM1510747,GSM1510748,GSM1510749,GSM1510750,GSM1510751,GSM1510752,GSM1510753,GSM1510754,GSM1510755,GSM1510756,GSM1510757,GSM1510758,GSM1510759,GSM1510760,GSM1510761,GSM1510762,GSM1510763,GSM1510764,GSM1510765,GSM1510766,GSM1510767,GSM1510768,GSM1510769,GSM1510770,GSM1510771,GSM1510772,GSM1510773,GSM1510774,GSM1510775,GSM1510776,GSM1510777,GSM1510778,GSM1510779,GSM1510780,GSM1510781,GSM1510782,GSM1510783,GSM1510784,GSM1510785,GSM1510786,GSM1510787,GSM1510788,GSM1510789,GSM1510790,GSM1510791,GSM1510792,GSM1510793,GSM1510794,GSM1510795,GSM1510796,GSM1510797,GSM1510798,GSM1510799,GSM1510800,GSM1510801,GSM1510802,GSM1510803,GSM1510804,GSM1510805,GSM1510806,GSM1510807,GSM1510808,GSM1510809,GSM1510810,GSM1510811,GSM1510812,GSM1510813,GSM1510814,GSM1510815,GSM1510816,GSM1510817,GSM1510818,GSM1510819,GSM1510820,GSM1510821,GSM1510822,GSM1510823,GSM1510824,GSM1510825,GSM1510826,GSM1510827,GSM1510828,GSM1510829,GSM1510830,GSM1510831,GSM1510832,GSM1510833,GSM1510834,GSM1510835,GSM1510836,GSM1510837,GSM1510838,GSM1510839,GSM1510840,GSM1510841,GSM1510842,GSM1510843,GSM1510844,GSM1510845,GSM1510846,GSM1510847,GSM1510848,GSM1510849,GSM1510850,GSM1510851,GSM1510852,GSM1510853,GSM1510854,GSM1510855,GSM1510856,GSM1510857,GSM1510858,GSM1510859,GSM1510860,GSM1510861,GSM1510862,GSM1510863,GSM1510864,GSM1510865,GSM1510866,GSM1510867,GSM1510868,GSM1510869,GSM1510870,GSM1510871,GSM1510872,GSM1510873,GSM1510874,GSM1510875,GSM1510876,GSM1510877,GSM1510878,GSM1510879,GSM1510880,GSM1510881,GSM1510882,GSM1510883,GSM1510884,GSM1510885,GSM1510886,GSM1510887,GSM1510888,GSM1510889,GSM1510890,GSM1510891,GSM1510892,GSM1510893,GSM1510894,GSM1510895,GSM1510896,GSM1510897,GSM1510898,GSM1510899,GSM1510900,GSM1510901,GSM1510902,GSM1510903,GSM1510904,GSM1510905,GSM1510906,GSM1510907,GSM1510908,GSM1510909,GSM1510910,GSM1510911,GSM1510912,GSM1510913,GSM1510914,GSM1510915,GSM1510916,GSM1510917,GSM1510918,GSM1510919,GSM1510920,GSM1510921,GSM1510922,GSM1510923,GSM1510924,GSM1510925,GSM1510926,GSM1510927,GSM1510928,GSM1510929,GSM1510930,GSM1510931,GSM1510932,GSM1510933,GSM1510934,GSM1510935,GSM1510936,GSM1510937,GSM1510938,GSM1510939,GSM1510940,GSM1510941,GSM1510942,GSM1510943,GSM1510944,GSM1510945,GSM1510946,GSM1510947,GSM1510948,GSM1510949,GSM1510950,GSM1510951,GSM1510952,GSM1510953,GSM1510954,GSM1510955,GSM1510956,GSM1510957,GSM1510958,GSM1510959,GSM1510960,GSM1510961,GSM1510962,GSM1510963,GSM1510964,GSM1510965,GSM1510966,GSM1510967,GSM1510968,GSM1510969,GSM1510970,GSM1510971,GSM1510972,GSM1510973,GSM1510974,GSM1510975,GSM1510976,GSM1510977,GSM1510978,GSM1510979,GSM1510980,GSM1510981,GSM1510982,GSM1510983,GSM1510984,GSM1510985,GSM1510986,GSM1510987,GSM1510988,GSM1510989,GSM1510990,GSM1510991,GSM1510992,GSM1510993,GSM1510994,GSM1510995,GSM1510996,GSM1510997,GSM1510998,GSM1510999,GSM1511000,GSM1511001,GSM1511002,GSM1511003,GSM1511004,GSM1511005,GSM1511006,GSM1511007,GSM1511008,GSM1511009,GSM1511010,GSM1511011,GSM1511012,GSM1511013,GSM1511014,GSM1511015,GSM1511016,GSM1511017,GSM1511018,GSM1511019,GSM1511020,GSM1511021,GSM1511022,GSM1511023,GSM1511024,GSM1511025,GSM1511026,GSM1511027,GSM1511028,GSM1511029,GSM1511030,GSM1511031,GSM1511032,GSM1511033,GSM1511034,GSM1511035,GSM1511036,GSM1511037,GSM1511038,GSM1511039,GSM1511040,GSM1511041,GSM1511042,GSM1511043,GSM1511044,GSM1511045,GSM1511046,GSM1511047,GSM1511048,GSM1511049,GSM1511050,GSM1511051,GSM1511052,GSM1511053,GSM1511054,GSM1511055,GSM1511056,GSM1511057,GSM1511058,GSM1511059,GSM1511060,GSM1511061,GSM1511062,GSM1511063,GSM1511064,GSM1511065,GSM1511066,GSM1511067,GSM1511068,GSM1511069,GSM1511070,GSM1511071,GSM1511072,GSM1511073,GSM1511074,GSM1511075,GSM1511076,GSM1511077,GSM1511078,GSM1511079,GSM1511080,GSM1511081,GSM1511082,GSM1511083,GSM1511084,GSM1511085,GSM1511086,GSM1511087,GSM1511088,GSM1511089,GSM1511090,GSM1511091,GSM1511092,GSM1511093,GSM1511094,GSM1511095,GSM1511096,GSM1511097,GSM1511098,GSM1511099,GSM1511100,GSM1511101,GSM1511102,GSM1511103,GSM1511104,GSM1511105,GSM1511106
2
+ Anxiety_disorder,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1.0,0.0,0.0,,,,1.0,0.0,0.0,1.0,1.0,,1.0,0.0,,1.0,,0.0,1.0,0.0,0.0,0.0,0.0,1.0,,,1.0,,,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,,1.0,0.0,1.0,,,,,1.0,1.0,0.0,1.0,0.0,0.0,0.0,,0.0,,,,,,1.0,0.0,1.0,1.0,0.0,,,0.0,0.0,1.0,,,0.0,1.0,1.0,,0.0,0.0,0.0,,1.0,0.0,0.0,0.0,,0.0,1.0,1.0,,0.0,0.0,1.0,,,,1.0,0.0,0.0,,0.0,0.0,,0.0,1.0,0.0,,,1.0,0.0,1.0,,1.0,,0.0,,,1.0,1.0,0.0,,0.0,1.0,0.0,1.0,,,0.0,1.0,0.0,0.0,,,1.0,0.0,0.0,0.0,1.0,0.0,1.0,,,,0.0,1.0,,0.0,0.0,1.0,0.0,0.0,,0.0,0.0,0.0,,1.0,1.0,1.0,0.0,0.0,0.0,,,0.0,,,1.0,,,0.0,,1.0,0.0,1.0,,,0.0,0.0,0.0,0.0,1.0,,1.0,,,0.0,0.0,,,1.0,1.0,0.0,,1.0,,1.0,1.0,1.0,,1.0
3
+ Age,44.0,59.0,44.0,39.0,64.0,58.0,45.0,37.0,40.0,39.0,57.0,52.0,59.0,57.0,62.0,62.0,55.0,55.0,53.0,47.0,48.0,49.0,35.0,58.0,46.0,54.0,67.0,47.0,51.0,34.0,58.0,58.0,57.0,64.0,55.0,60.0,62.0,41.0,53.0,47.0,44.0,53.0,38.0,54.0,37.0,44.0,73.0,28.0,56.0,34.0,71.0,41.0,51.0,47.0,35.0,45.0,55.0,50.0,50.0,55.0,38.0,57.0,57.0,57.0,48.0,52.0,51.0,42.0,51.0,51.0,65.0,31.0,44.0,50.0,58.0,64.0,49.0,52.0,46.0,53.0,45.0,32.0,50.0,63.0,52.0,54.0,28.0,55.0,59.0,56.0,39.0,46.0,60.0,61.0,45.0,44.0,41.0,56.0,53.0,50.0,56.0,78.0,62.0,47.0,40.0,63.0,55.0,55.0,53.0,34.0,48.0,46.0,58.0,52.0,47.0,62.0,45.0,51.0,38.0,38.0,51.0,59.0,56.0,39.0,29.0,58.0,57.0,45.0,33.0,46.0,35.0,57.0,55.0,66.0,51.0,59.0,61.0,56.0,65.0,37.0,65.0,45.0,45.0,74.0,50.0,39.0,26.0,44.0,49.0,52.0,47.0,37.0,40.0,39.0,40.0,31.0,48.0,59.0,39.0,37.0,59.0,54.0,49.0,57.0,50.0,55.0,50.0,68.0,43.0,67.0,47.0,45.0,56.0,62.0,48.0,39.0,39.0,41.0,63.0,51.0,48.0,50.0,61.0,35.0,50.0,52.0,44.0,45.0,33.0,61.0,58.0,38.0,36.0,50.0,45.0,60.0,55.0,53.0,52.0,47.0,43.0,41.0,47.0,59.0,54.0,52.0,64.0,41.0,46.0,38.0,48.0,43.0,63.0,53.0,60.0,58.0,53.0,52.0,25.0,60.0,27.0,56.0,47.0,40.0,35.0,50.0,56.0,35.0,18.0,52.0,41.0,45.0,54.0,64.0,35.0,48.0,57.0,73.0,46.0,52.0,34.0,19.0,56.0,54.0,46.0,54.0,44.0,19.0,61.0,29.0,48.0,34.0,50.0,39.0,62.0,25.0,18.0,60.0,51.0,58.0,61.0,33.0,50.0,52.0,52.0,59.0,54.0,31.0,60.0,43.0,28.0,34.0,46.0,51.0,43.0,53.0,51.0,48.0,43.0,69.0,48.0,53.0,58.0,57.0,54.0,47.0,60.0,56.0,45.0,35.0,44.0,53.0,43.0,50.0,53.0,69.0,35.0,45.0,57.0,50.0,36.0,33.0,42.0,68.0,57.0,32.0,47.0,54.0,54.0,54.0,41.0,59.0,66.0,29.0,60.0,41.0,53.0,49.0,56.0,59.0,50.0,60.0,53.0,44.0,41.0,56.0,52.0,38.0,47.0,32.0,44.0,39.0,60.0,54.0,50.0,31.0,43.0,58.0,47.0,52.0,44.0,53.0,55.0,38.0,47.0,58.0,30.0,51.0,48.0,54.0,63.0,34.0,36.0,55.0,60.0,53.0,52.0,51.0,36.0,53.0,51.0,55.0,50.0,40.0,43.0,42.0,64.0,71.0,30.0,39.0,60.0,39.0,49.0,56.0,46.0,55.0,34.0,64.0,26.0,59.0,46.0,50.0,20.0,53.0,47.0,46.0,37.0,18.0,37.0,47.0,55.0,41.0,56.0,48.0,51.0,54.0,59.0,53.0,41.0,42.0,42.0,35.0,58.0,41.0,58.0,32.0,31.0,60.0,36.0,78.0,22.0,42.0,35.0,51.0,54.0,39.0,40.0,18.0,47.0,49.0,34.0,49.0,46.0,58.0,44.0,36.0,62.0,59.0,58.0,44.0,52.0,36.0,46.0,51.0,37.0,55.0,63.0,44.0,36.0,51.0,40.0,62.0,41.0,42.0,49.0,63.0,73.0,43.0,49.0,53.0,44.0,30.0,61.0,41.0,41.0,57.0,30.0,50.0,41.0,49.0,37.0,54.0,41.0,37.0,44.0,58.0,39.0,54.0,57.0,36.0,37.0,56.0,37.0,59.0,41.0,48.0,41.0,35.0,52.0,54.0,47.0,57.0,48.0,67.0,55.0,55.0,36.0,55.0,35.0,56.0,48.0,50.0,43.0,59.0,35.0,82.0,51.0,34.0,48.0,58.0,58.0,52.0,59.0,26.0,42.0,55.0,58.0,46.0,44.0,55.0,48.0,50.0,49.0,57.0,30.0,43.0,62.0,42.0,36.0,48.0,38.0,50.0,29.0,53.0,53.0,40.0,36.0,57.0,44.0,41.0,59.0,28.0,35.0,53.0,56.0,44.0,58.0,58.0,57.0,56.0,54.0,59.0,57.0,56.0,56.0,37.0
4
+ Gender,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.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,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
p3/preprocess/Anxiety_disorder/clinical_data/GSE68526.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM1674313,GSM1674314,GSM1674315,GSM1674316,GSM1674317,GSM1674318,GSM1674319,GSM1674320,GSM1674321,GSM1674322,GSM1674323,GSM1674324,GSM1674325,GSM1674326,GSM1674327,GSM1674328,GSM1674329,GSM1674330,GSM1674331,GSM1674332,GSM1674333,GSM1674334,GSM1674335,GSM1674336,GSM1674337,GSM1674338,GSM1674339,GSM1674340,GSM1674341,GSM1674342,GSM1674343,GSM1674344,GSM1674345,GSM1674346,GSM1674347,GSM1674348,GSM1674349,GSM1674350,GSM1674351,GSM1674352,GSM1674353,GSM1674354,GSM1674355,GSM1674356,GSM1674357,GSM1674358,GSM1674359,GSM1674360,GSM1674361,GSM1674362,GSM1674363,GSM1674364,GSM1674365,GSM1674366,GSM1674367,GSM1674368,GSM1674369,GSM1674370,GSM1674371,GSM1674372,GSM1674373,GSM1674374,GSM1674375,GSM1674376,GSM1674377,GSM1674378,GSM1674379,GSM1674380,GSM1674381,GSM1674382,GSM1674383,GSM1674384,GSM1674385,GSM1674386,GSM1674387,GSM1674388,GSM1674389,GSM1674390,GSM1674391,GSM1674392,GSM1674393,GSM1674394,GSM1674395,GSM1674396,GSM1674397,GSM1674398,GSM1674399,GSM1674400,GSM1674401,GSM1674402,GSM1674403,GSM1674404,GSM1674405,GSM1674406,GSM1674407,GSM1674408,GSM1674409,GSM1674410,GSM1674411,GSM1674412,GSM1674413,GSM1674414,GSM1674415,GSM1674416,GSM1674417,GSM1674418,GSM1674419,GSM1674420,GSM1674421,GSM1674422,GSM1674423,GSM1674424,GSM1674425,GSM1674426,GSM1674427,GSM1674428,GSM1674429,GSM1674430,GSM1674431,GSM1674432,GSM1674433
2
+ Anxiety_disorder,1.0,1.0,1.8,1.2,1.4,1.2,1.2,1.0,1.4,1.2,1.8,2.2,1.4,1.8,1.0,1.0,1.0,1.0,1.2,1.0,1.2,1.6,,1.0,1.8,2.8,1.2,2.2,1.8,2.0,,1.6,,1.0,,2.2,1.6,1.4,2.0,1.8,1.0,1.4,,1.4,1.4,1.2,1.0,1.4,1.6,1.0,1.4,1.0,1.4,1.0,1.4,1.2,1.2,1.4,1.0,1.4,,,2.0,1.0,2.4,1.0,,1.2,1.4,,1.6,2.0,1.4,1.0,1.8,2.0,2.0,1.4,3.2,2.0,1.0,1.0,2.6,2.4,,1.0,1.2,1.6,,2.0,1.6,1.4,2.2,1.0,1.4,1.4,1.8,1.0,2.2,1.4,3.2,2.0,2.4,1.0,2.4,1.6,1.0,,1.4,1.0,,1.0,,1.0,1.0,1.0,1.0,1.4,1.8,1.0,1.4
3
+ Age,79.0,79.0,76.0,70.0,65.0,64.0,75.0,70.0,66.0,66.0,93.0,69.0,69.0,67.0,77.0,74.0,73.0,80.0,68.0,83.0,64.0,87.0,87.0,83.0,81.0,84.0,55.0,68.0,62.0,58.0,81.0,76.0,84.0,60.0,87.0,56.0,86.0,81.0,60.0,78.0,78.0,75.0,48.0,82.0,76.0,95.0,69.0,62.0,69.0,75.0,87.0,68.0,73.0,84.0,71.0,85.0,76.0,73.0,76.0,70.0,68.0,64.0,69.0,82.0,75.0,73.0,55.0,61.0,82.0,77.0,70.0,75.0,57.0,79.0,65.0,69.0,62.0,71.0,84.0,74.0,56.0,81.0,94.0,61.0,58.0,73.0,79.0,74.0,79.0,71.0,71.0,88.0,64.0,57.0,59.0,73.0,62.0,51.0,82.0,72.0,82.0,77.0,80.0,69.0,84.0,67.0,81.0,91.0,76.0,62.0,68.0,83.0,89.0,85.0,88.0,87.0,81.0,72.0,66.0,71.0,73.0
4
+ Gender,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.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,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0
p3/preprocess/Anxiety_disorder/clinical_data/GSE78104.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM2067403,GSM2067404,GSM2067405,GSM2067406,GSM2067407,GSM2067408,GSM2067409,GSM2067410,GSM2067411,GSM2067412,GSM2067413,GSM2067414,GSM2067415,GSM2067416,GSM2067417,GSM2067418,GSM2067419,GSM2067420,GSM2067421,GSM2067422,GSM2067423,GSM2067424,GSM2067425,GSM2067426,GSM2067427,GSM2067428,GSM2067429,GSM2067430,GSM2067431,GSM2067432,GSM2067433,GSM2067434,GSM2067435,GSM2067436,GSM2067437,GSM2067438,GSM2067439,GSM2067440,GSM2067441,GSM2067442,GSM2067443,GSM2067444,GSM2067445,GSM2067446,GSM2067447,GSM2067448,GSM2067449,GSM2067450,GSM2067451,GSM2067452,GSM2067453,GSM2067454,GSM2067455,GSM2067456,GSM2067457,GSM2067458,GSM2067459,GSM2067460,GSM2067461,GSM2067462
2
+ Anxiety_disorder,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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
3
+ Age,25.0,23.0,18.0,26.0,27.0,19.0,22.0,27.0,18.0,25.0,16.0,35.0,16.0,16.0,32.0,18.0,15.0,43.0,36.0,17.0,45.0,40.0,35.0,28.0,27.0,31.0,23.0,35.0,60.0,59.0,24.0,23.0,18.0,27.0,27.0,20.0,21.0,27.0,20.0,24.0,18.0,35.0,17.0,18.0,32.0,18.0,18.0,44.0,37.0,17.0,43.0,40.0,32.0,28.0,27.0,30.0,24.0,35.0,56.0,56.0
4
+ Gender,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0
p3/preprocess/Anxiety_disorder/clinical_data/GSE94119.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ ,GSM2469746,GSM2469747,GSM2469748,GSM2469749,GSM2469750,GSM2469751,GSM2469752,GSM2469753,GSM2469754,GSM2469755,GSM2469756,GSM2469757,GSM2469758,GSM2469759,GSM2469760,GSM2469761,GSM2469762,GSM2469763,GSM2469764,GSM2469765,GSM2469766,GSM2469767,GSM2469768,GSM2469769,GSM2469770,GSM2469771,GSM2469772,GSM2469773,GSM2469774,GSM2469775,GSM2469776,GSM2469777,GSM2469778,GSM2469779,GSM2469780,GSM2469781,GSM2469782,GSM2469783,GSM2469784,GSM2469785,GSM2469786,GSM2469787,GSM2469788,GSM2469789,GSM2469790,GSM2469791,GSM2469792,GSM2469793,GSM2469794,GSM2469795,GSM2469796,GSM2469797,GSM2469798,GSM2469799,GSM2469800,GSM2469801,GSM2469802,GSM2469803,GSM2469804,GSM2469805,GSM2469806,GSM2469807,GSM2469808,GSM2469809,GSM2469810,GSM2469811,GSM2469812,GSM2469813,GSM2469814,GSM2469815,GSM2469816,GSM2469817,GSM2469818,GSM2469819,GSM2469820,GSM2469821,GSM2469822,GSM2469823,GSM2469824,GSM2469825,GSM2469826,GSM2469827,GSM2469828,GSM2469829,GSM2469830,GSM2469831,GSM2469832,GSM2469833,GSM2469834,GSM2469835,GSM2469836,GSM2469837,GSM2469838,GSM2469839,GSM2469840,GSM2469841,GSM2469842,GSM2469843,GSM2469844,GSM2469845,GSM2469846,GSM2469847,GSM2469848,GSM2469849,GSM2469850,GSM2469851,GSM2469852,GSM2469853,GSM2469854,GSM2469855,GSM2469856,GSM2469857,GSM2469858,GSM2469859,GSM2469860,GSM2469861,GSM2469862,GSM2469863,GSM2469864,GSM2469865,GSM2469866,GSM2469867,GSM2469868,GSM2469869,GSM2469870,GSM2469871,GSM2469872,GSM2469873,GSM2469874,GSM2469875,GSM2469876,GSM2469877,GSM2469878,GSM2469879,GSM2469880,GSM2469881,GSM2469882,GSM2469883,GSM2469884,GSM2469885,GSM2469886,GSM2469887,GSM2469888,GSM2469889,GSM2469890,GSM2469891,GSM2469892,GSM2469893,GSM2469894,GSM2469895,GSM2469896,GSM2469897,GSM2469898,GSM2469899,GSM2469900,GSM2469901,GSM2469902,GSM2469903,GSM2469904,GSM2469905,GSM2469906,GSM2469907,GSM2469908,GSM2469909,GSM2469910,GSM2469911,GSM2469912,GSM2469913,GSM2469914,GSM2469915,GSM2469916,GSM2469917,GSM2469918,GSM2469919,GSM2469920,GSM2469921,GSM2469922,GSM2469923,GSM2469924,GSM2469925,GSM2469926,GSM2469927,GSM2469928,GSM2469929,GSM2469930,GSM2469931,GSM2469932,GSM2469933,GSM2469934,GSM2469935,GSM2469936,GSM2469937,GSM2469938,GSM2469939,GSM2469940,GSM2469941,GSM2469942,GSM2469943,GSM2469944,GSM2469945,GSM2469946,GSM2469947,GSM2469948,GSM2469949,GSM2469950,GSM2469951,GSM2469952,GSM2469953,GSM2469954,GSM2469955,GSM2469956,GSM2469957,GSM2469958,GSM2469959,GSM2469960,GSM2469961,GSM2469962,GSM2469963,GSM2469964,GSM2469965,GSM2469966,GSM2469967,GSM2469968,GSM2469969,GSM2469970,GSM2469971,GSM2469972,GSM2469973,GSM2469974,GSM2469975,GSM2469976,GSM2469977,GSM2469978,GSM2469979,GSM2469980,GSM2469981,GSM2469982,GSM2469983,GSM2469984,GSM2469985,GSM2469986,GSM2469987,GSM2469988,GSM2469989,GSM2469990,GSM2469991,GSM2469992,GSM2469993,GSM2469994,GSM2469995,GSM2469996,GSM2469997,GSM2469998,GSM2469999,GSM2470000,GSM2470001,GSM2470002,GSM2470003,GSM2470004,GSM2470005,GSM2470006,GSM2470007,GSM2470008,GSM2470009,GSM2470010,GSM2470011,GSM2470012,GSM2470013,GSM2470014,GSM2470015,GSM2470016,GSM2470017,GSM2470018,GSM2470019,GSM2470020,GSM2470021,GSM2470022,GSM2470023,GSM2470024,GSM2470025,GSM2470026,GSM2470027,GSM2470028,GSM2470029,GSM2470030,GSM2470031,GSM2470032,GSM2470033,GSM2470034,GSM2470035,GSM2470036,GSM2470037,GSM2470038,GSM2470039,GSM2470040,GSM2470041,GSM2470042,GSM2470043,GSM2470044,GSM2470045,GSM2470046,GSM2470047,GSM2470048,GSM2470049,GSM2470050,GSM2470051,GSM2470052,GSM2470053,GSM2470054,GSM2470055,GSM2470056,GSM2470057,GSM2470058,GSM2470059,GSM2470060
2
+ Anxiety_disorder,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0
3
+ Gender,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,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,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,0.0,0.0,0.0,0.0,0.0,0.0,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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,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,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,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,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,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,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,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,0.0,0.0,0.0,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,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0
p3/preprocess/Anxiety_disorder/code/GSE119995.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Anxiety_disorder"
6
+ cohort = "GSE119995"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Anxiety_disorder"
10
+ in_cohort_dir = "../DATA/GEO/Anxiety_disorder/GSE119995"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Anxiety_disorder/GSE119995.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Anxiety_disorder/gene_data/GSE119995.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Anxiety_disorder/clinical_data/GSE119995.csv"
16
+ json_path = "./output/preprocess/3/Anxiety_disorder/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Extract background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
23
+
24
+ # Get unique values per clinical feature
25
+ sample_characteristics = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background info
28
+ print("Dataset Background Information:")
29
+ print(f"{background_info}\n")
30
+
31
+ # Print sample characteristics
32
+ print("Sample Characteristics:")
33
+ for feature, values in sample_characteristics.items():
34
+ print(f"Feature: {feature}")
35
+ print(f"Values: {values}\n")
36
+ # 1. Gene Expression Data Availability
37
+ # From series title and summary, this dataset contains mRNA expression data from blood plasma
38
+ is_gene_available = True
39
+
40
+ # 2.1 Data Availability
41
+ # Trait: all samples have panic disorder (Feature 0), so not useful for case-control study
42
+ trait_row = None
43
+
44
+ # Age: not available in sample characteristics
45
+ age_row = None
46
+
47
+ # Gender: available in Feature 2
48
+ gender_row = 2
49
+
50
+ # 2.2 Data Type Conversion Functions
51
+ def convert_trait(x):
52
+ # Not used since trait_row is None
53
+ return None
54
+
55
+ def convert_age(x):
56
+ # Not used since age_row is None
57
+ return None
58
+
59
+ def convert_gender(x):
60
+ if pd.isna(x):
61
+ return None
62
+ val = x.split(': ')[1].lower()
63
+ if val == 'female':
64
+ return 0
65
+ elif val == 'male':
66
+ return 1
67
+ return None
68
+
69
+ # 3. Save Metadata
70
+ is_trait_available = trait_row is not None
71
+ validate_and_save_cohort_info(is_final=False,
72
+ cohort=cohort,
73
+ info_path=json_path,
74
+ is_gene_available=is_gene_available,
75
+ is_trait_available=is_trait_available)
76
+
77
+ # 4. Clinical Feature Extraction
78
+ # Skip since trait_row is None
79
+ # Get file paths
80
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
81
+
82
+ # Extract gene expression data from matrix file
83
+ gene_data = get_genetic_data(matrix_file)
84
+
85
+ # Print first 20 row IDs and shape of data to help debug
86
+ print("Shape of gene expression data:", gene_data.shape)
87
+ print("\nFirst few rows of data:")
88
+ print(gene_data.head())
89
+ print("\nFirst 20 gene/probe identifiers:")
90
+ print(gene_data.index[:20])
91
+
92
+ # Inspect a snippet of raw file to verify identifier format
93
+ import gzip
94
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
95
+ lines = []
96
+ for i, line in enumerate(f):
97
+ if "!series_matrix_table_begin" in line:
98
+ # Get the next 5 lines after the marker
99
+ for _ in range(5):
100
+ lines.append(next(f).strip())
101
+ break
102
+ print("\nFirst few lines after matrix marker in raw file:")
103
+ for line in lines:
104
+ print(line)
105
+ # The gene IDs start with "ILMN_" which indicates these are Illumina probe IDs
106
+ # They need to be mapped to human gene symbols for analysis
107
+ requires_gene_mapping = True
108
+ # Get file paths
109
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
110
+
111
+ # Extract gene annotation from SOFT file
112
+ gene_annotation = get_gene_annotation(soft_file)
113
+
114
+ # Preview annotation dataframe structure
115
+ print("Gene Annotation Preview:")
116
+ print("Column names:", gene_annotation.columns.tolist())
117
+ print("\nFirst few rows as dictionary:")
118
+ print(preview_df(gene_annotation))
119
+ # 1. Observe the gene identifiers in both gene expression data and annotation:
120
+ # Gene expression data uses 'ILMN_' probe IDs which is stored as 'ID' column in annotation
121
+ # Gene symbols are stored in 'Symbol' column in annotation
122
+
123
+ # 2. Get gene mapping dataframe
124
+ mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
125
+
126
+ # 3. Convert probe-level measurements to gene expression data
127
+ gene_data = apply_gene_mapping(gene_data, mapping_data)
128
+ # 1. Normalize gene symbols
129
+ gene_data = normalize_gene_symbols_in_index(gene_data)
130
+
131
+ # Save normalized gene data
132
+ gene_data.to_csv(out_gene_data_file)
133
+
134
+ # Since we already determined in Step 2 that there's no valid trait variation
135
+ is_usable = validate_and_save_cohort_info(
136
+ is_final=True,
137
+ cohort=cohort,
138
+ info_path=json_path,
139
+ is_gene_available=True,
140
+ is_trait_available=False, # All samples have same trait value
141
+ is_biased=True,
142
+ df=pd.DataFrame(),
143
+ note="Dataset lacks trait variation - all samples have panic disorder"
144
+ )
p3/preprocess/Anxiety_disorder/code/GSE60190.py ADDED
@@ -0,0 +1,462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Anxiety_disorder"
6
+ cohort = "GSE60190"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Anxiety_disorder"
10
+ in_cohort_dir = "../DATA/GEO/Anxiety_disorder/GSE60190"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Anxiety_disorder/GSE60190.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Anxiety_disorder/gene_data/GSE60190.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Anxiety_disorder/clinical_data/GSE60190.csv"
16
+ json_path = "./output/preprocess/3/Anxiety_disorder/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Extract background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
23
+
24
+ # Get unique values per clinical feature
25
+ sample_characteristics = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background info
28
+ print("Dataset Background Information:")
29
+ print(f"{background_info}\n")
30
+
31
+ # Print sample characteristics
32
+ print("Sample Characteristics:")
33
+ for feature, values in sample_characteristics.items():
34
+ print(f"Feature: {feature}")
35
+ print(f"Values: {values}\n")
36
+ ```python
37
+ # 1. Gene Expression Data Availability
38
+ # Based on Series_summary, this dataset uses Illumina HumanHT-12 v3 microarray for gene expression measurement
39
+ is_gene_available = True
40
+
41
+ # 2.1 Data Availability & 2.2 Data Type Conversion
42
+ # trait (anxiety) can be inferred from dx field
43
+ trait_row = 3
44
+
45
+ def convert_trait(value):
46
+ if not isinstance(value, str):
47
+ return None
48
+ val = value.split(": ")[-1]
49
+ # Anxiety disorder can be comorbid with OCD, so consider OCD cases as anxiety cases
50
+ if val in ["OCD", "Tics"]:
51
+ return 1
52
+ elif val == "Control":
53
+ return 0
54
+ return None
55
+
56
+ # age is available
57
+ age_row = 5
58
+
59
+ def convert_age(value):
60
+ if not isinstance(value, str):
61
+ return None
62
+ try:
63
+ return float(value.split(": ")[-1])
64
+ except:
65
+ return None
66
+
67
+ # gender is available
68
+ gender_row = 7
69
+
70
+ def convert_gender(value):
71
+ if not isinstance(value, str):
72
+ return None
73
+ val = value.split(": ")[-1]
74
+ if val == "F":
75
+ return 0
76
+ elif val == "M":
77
+ return 1
78
+ return None
79
+
80
+ # 3. Save Metadata
81
+ validate_and_save_cohort_info(is_final=False,
82
+ cohort=cohort,
83
+ info_path=json_path,
84
+ is_gene_available=is_gene_available,
85
+ is_trait_available=True)
86
+
87
+ # 4. Clinical Feature Extraction
88
+ sample_characteristics = {
89
+ '0': ['rin: 7.4', 'rin: 8.6', 'rin: 7.8', 'rin: 8.2', 'rin: 8.5', 'rin: 8.3', 'rin: 8.1', 'rin: 8.8', 'rin: 8.7', 'rin: 7.5', 'rin: 9', 'rin: 7.1', 'rin: 7.2', 'rin: 7.7', 'rin: 8.9', 'rin: 6.7', 'rin: 6', 'rin: 8.4', 'rin: 7.3', 'rin: 8', 'rin: 9.1', 'rin: 7.9', 'rin: 9.7', 'rin: 9.2', 'rin: 6.5', 'rin: 7', 'rin: 7.6', 'rin: 6.6', 'rin: 5.4', 'rin: 5.6'],
90
+ '1': ['ocd: ED', 'ocd: Control', 'ocd: OCD'],
91
+ '2': ['rinmatched: 1', 'rinmatched: 0'],
92
+ '3': ['dx: Bipolar', 'dx: Control', 'dx: MDD', 'dx: Tics', 'dx: OCD', 'dx: ED'],
93
+ '4': ['ph: 6.18', 'ph: 6.59', 'ph: 6.37', 'ph: 6.6', 'ph: 6.38', 'ph: 6.02', 'ph: 6.87', 'ph: 6.95', 'ph: 6.82', 'ph: 6.27', 'ph: 6.53', 'ph: 6.55', 'ph: 6', 'ph: 6.13', 'ph: 6.08', 'ph: 6.29', 'ph: 6.98', 'ph: 5.91', 'ph: 6.06', 'ph: 6.9', 'ph: 6.83', 'ph: 6.36', 'ph: 6.84', 'ph: 6.74', 'ph: 6.28', 'ph: 6.49', 'ph: 6.7', 'ph: 6.63', 'ph: 6.48', 'ph: 6.62'],
94
+ '5': ['age: 50.421917', 'age: 27.49863', 'age: 30.627397', 'age: 61.167123', 'age: 32.69589', 'age: 39.213698', 'age: 58.605479', 'age: 49.2', 'age: 41.041095', 'age: 51.750684', 'age: 50.89863', 'age: 26.745205', 'age: 29.104109', 'age: 39.301369', 'age: 48.978082', 'age: 57.884931', 'age: 28.364383', 'age: 24.041095', 'age: 19.268493', 'age: 27.230136', 'age: 46.605479', 'age: 23.443835', 'age: 51.038356', 'age: 39.663013', 'age: 46.109589', 'age: 77.989041', 'age: 46.967123', 'age: 63.241095', 'age: 62.306849', 'age: 83.641095'],
95
+ '6': ['pmi: 27', 'pmi: 19.5', 'pmi: 71.5', 'pmi: 22.5', 'pmi: 64', 'pmi: 28', 'pmi: 18', 'pmi: 29', 'pmi: 49', 'pmi: 13', 'pmi: 26.5', 'pmi: 16.5', 'pmi: 35', 'pmi: 19', 'pmi: 20.5', 'pmi: 9.5', 'pmi: 65.5', 'pmi: 68', 'pmi: 17.5', 'pmi: 44', 'pmi: 34', 'pmi: 21.5', 'pmi: 67.5', 'pmi: 26', 'pmi: 46.5', 'pmi: 33.5', 'pmi: 24.5', 'pmi: 30.5', 'pmi: 29.5', 'pmi: 51.5'],
96
+ '7': ['Sex: F', 'Sex: M'],
97
+ '8': ['race: CAUC'],
98
+ '9': ['batch1: 16', 'batch1: 18', 'batch1: 19', 'batch1: 20', 'batch1: 21', 'batch1: 9', 'batch1: 10', 'batch1: 12', 'batch1: 14', 'batch1: 23', 'batch1: 24', 'batch1: 25', 'batch1: 26', 'batch1: 27', 'batch1: 29', 'batch1: 33', 'batch1: 32', 'batch1: 31', 'batch1: 36', 'batch1: 37', 'batch1: 38', 'batch1: 39', 'batch1: 40', 'batch1: 41', 'batch1: 42', 'batch1: 44', 'batch1: 45', 'batch1: 48', 'batch1: 53', 'batch1: 59']
99
+ }
100
+
101
+ clinical_data = pd.DataFrame(sample_characteristics)
102
+
103
+ selected_clinical_df = geo_select_clinical_features(clinical_data,
104
+ trait=trait,
105
+ trait_row=trait_row,
106
+ convert_trait=convert_trait,
107
+ age_row=age_row,
108
+ convert_age=convert_age,
109
+ gender_row=gender_row,
110
+ convert_gender=convert_
111
+ print("Step 3 cannot be implemented without the output from the previous step that contains:")
112
+ print("1. Sample characteristics dictionary")
113
+ print("2. Background information about the dataset")
114
+ print("3. Preview of the clinical data")
115
+ print("\nPlease provide this information to proceed with proper data analysis.")
116
+ # Get file paths
117
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
118
+
119
+ # Extract gene expression data from matrix file
120
+ gene_data = get_genetic_data(matrix_file)
121
+
122
+ # Print first 20 row IDs and shape of data to help debug
123
+ print("Shape of gene expression data:", gene_data.shape)
124
+ print("\nFirst few rows of data:")
125
+ print(gene_data.head())
126
+ print("\nFirst 20 gene/probe identifiers:")
127
+ print(gene_data.index[:20])
128
+
129
+ # Inspect a snippet of raw file to verify identifier format
130
+ import gzip
131
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
132
+ lines = []
133
+ for i, line in enumerate(f):
134
+ if "!series_matrix_table_begin" in line:
135
+ # Get the next 5 lines after the marker
136
+ for _ in range(5):
137
+ lines.append(next(f).strip())
138
+ break
139
+ print("\nFirst few lines after matrix marker in raw file:")
140
+ for line in lines:
141
+ print(line)
142
+ # The IDs start with "ILMN_" which indicates these are Illumina probe IDs
143
+ # These need to be mapped to official human gene symbols
144
+ requires_gene_mapping = True
145
+ # Extract gene annotation from SOFT file
146
+ gene_annotation = get_gene_annotation(soft_file)
147
+
148
+ # Preview annotation dataframe structure
149
+ print("Gene Annotation Preview:")
150
+ print("Column names:", gene_annotation.columns.tolist())
151
+ print("\nFirst few rows as dictionary:")
152
+ print(preview_df(gene_annotation))
153
+ # 1. Identify mapping columns:
154
+ # 'ID' in annotation matches the probe IDs like 'ILMN_1343291' in gene expression data
155
+ # 'Symbol' contains the gene symbols we want to map to
156
+
157
+ # 2. Extract mapping between probe IDs and gene symbols
158
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
159
+
160
+ # 3. Convert probe measurements to gene expression data
161
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
162
+
163
+ # Inspect the result
164
+ print("Mapped gene expression data shape:", gene_data.shape)
165
+ print("\nFirst few rows of mapped data:")
166
+ print(gene_data.head())
167
+ print("\nFirst 20 mapped gene symbols:")
168
+ print(gene_data.index[:20])
169
+ # Re-run gene mapping to restore gene_data
170
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
171
+ gene_data = apply_gene_mapping(expression_df, mapping_df)
172
+
173
+ # 1. Normalize gene symbols
174
+ gene_data = normalize_gene_symbols_in_index(gene_data)
175
+
176
+ # Save normalized gene data
177
+ os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
178
+ gene_data.to_csv(out_gene_data_file)
179
+
180
+ # Get clinical features from sample characteristics
181
+ trait_row = 3 # From 'dx' field
182
+
183
+ def convert_trait(value):
184
+ if not isinstance(value, str):
185
+ return None
186
+ val = value.split(": ")[-1]
187
+ # Anxiety disorder can be comorbid with OCD, so consider OCD cases as anxiety cases
188
+ if val in ["OCD", "Tics"]:
189
+ return 1
190
+ elif val == "Control":
191
+ return 0
192
+ return None
193
+
194
+ age_row = 5
195
+
196
+ def convert_age(value):
197
+ if not isinstance(value, str):
198
+ return None
199
+ try:
200
+ return float(value.split(": ")[-1])
201
+ except:
202
+ return None
203
+
204
+ gender_row = 7
205
+
206
+ def convert_gender(value):
207
+ if not isinstance(value, str):
208
+ return None
209
+ val = value.split(": ")[-1]
210
+ if val == "F":
211
+ return 0
212
+ elif val == "M":
213
+ return 1
214
+ return None
215
+
216
+ # Extract clinical features and save
217
+ clinical_df = geo_select_clinical_features(clinical_data,
218
+ trait=trait,
219
+ trait_row=trait_row,
220
+ convert_trait=convert_trait,
221
+ age_row=age_row,
222
+ convert_age=convert_age,
223
+ gender_row=gender_row,
224
+ convert_gender=convert_gender)
225
+
226
+ # Save clinical data
227
+ os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
228
+ clinical_df.to_csv(out_clinical_data_file)
229
+
230
+ # 2. Link clinical and genetic data
231
+ linked_data = geo_link_clinical_genetic_data(clinical_df, gene_data)
232
+
233
+ # 3. Handle missing values
234
+ linked_data = handle_missing_values(linked_data, trait)
235
+
236
+ # 4. Determine if features are biased
237
+ is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
238
+
239
+ # 5. Validate and save cohort info
240
+ is_usable = validate_and_save_cohort_info(
241
+ is_final=True,
242
+ cohort=cohort,
243
+ info_path=json_path,
244
+ is_gene_available=True,
245
+ is_trait_available=True,
246
+ is_biased=is_trait_biased,
247
+ df=linked_data,
248
+ note="Gene expression data successfully mapped and linked with clinical features"
249
+ )
250
+
251
+ # 6. Save linked data only if usable AND trait is not biased
252
+ if is_usable and not is_trait_biased:
253
+ os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
254
+ linked_data.to_csv(out_data_file)
255
+ # Get file paths
256
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
257
+
258
+ # Extract gene annotation from SOFT file
259
+ gene_annotation = get_gene_annotation(soft_file)
260
+
261
+ # Preview annotation dataframe structure
262
+ print("Gene Annotation Preview:")
263
+ print("Column names:", gene_annotation.columns.tolist())
264
+ print("\nFirst few rows as dictionary:")
265
+ print(preview_df(gene_annotation))
266
+ # Get file paths
267
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
268
+
269
+ # Get genetic data and map to genes
270
+ gene_data = get_genetic_data(matrix_file)
271
+ mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
272
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
273
+
274
+ # 1. Normalize gene symbols and save
275
+ os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
276
+ gene_data = normalize_gene_symbols_in_index(gene_data)
277
+ gene_data.to_csv(out_gene_data_file)
278
+
279
+ # 2. Link clinical and genetic data
280
+ try:
281
+ clinical_data = pd.read_csv(out_clinical_data_file, index_col=0)
282
+ linked_data = geo_link_clinical_genetic_data(clinical_data, gene_data)
283
+
284
+ # 3. Handle missing values
285
+ linked_data = handle_missing_values(linked_data, trait)
286
+
287
+ # 4. Determine if features are biased
288
+ is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
289
+
290
+ # 5. Validate and save cohort info
291
+ is_usable = validate_and_save_cohort_info(
292
+ is_final=True,
293
+ cohort=cohort,
294
+ info_path=json_path,
295
+ is_gene_available=True,
296
+ is_trait_available=True,
297
+ is_biased=is_trait_biased,
298
+ df=linked_data,
299
+ note="Gene expression data successfully mapped and linked with clinical features"
300
+ )
301
+
302
+ # 6. Save linked data if usable
303
+ if is_usable and not is_trait_biased:
304
+ os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
305
+ linked_data.to_csv(out_data_file)
306
+
307
+ except Exception as e:
308
+ print(f"Error in data linking and processing: {str(e)}")
309
+ is_usable = validate_and_save_cohort_info(
310
+ is_final=True,
311
+ cohort=cohort,
312
+ info_path=json_path,
313
+ is_gene_available=True,
314
+ is_trait_available=True,
315
+ is_biased=True,
316
+ df=pd.DataFrame(),
317
+ note=f"Data processing failed: {str(e)}"
318
+ )
319
+ # Get file paths
320
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
321
+
322
+ # Extract gene expression data from matrix file
323
+ gene_data = get_genetic_data(matrix_file)
324
+
325
+ # Print first 20 row IDs and shape of data to help debug
326
+ print("Shape of gene expression data:", gene_data.shape)
327
+ print("\nFirst few rows of data:")
328
+ print(gene_data.head())
329
+ print("\nFirst 20 gene/probe identifiers:")
330
+ print(gene_data.index[:20])
331
+
332
+ # Inspect a snippet of raw file to verify identifier format
333
+ import gzip
334
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
335
+ lines = []
336
+ for i, line in enumerate(f):
337
+ if "!series_matrix_table_begin" in line:
338
+ # Get the next 5 lines after the marker
339
+ for _ in range(5):
340
+ lines.append(next(f).strip())
341
+ break
342
+ print("\nFirst few lines after matrix marker in raw file:")
343
+ for line in lines:
344
+ print(line)
345
+ # Get file paths
346
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
347
+
348
+ # Extract background info and clinical data
349
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file)
350
+
351
+ # Get unique values per clinical feature
352
+ sample_characteristics = get_unique_values_by_row(clinical_data)
353
+
354
+ # Print background info
355
+ print("Dataset Background Information:")
356
+ print(f"{background_info}\n")
357
+
358
+ # Print sample characteristics
359
+ print("Sample Characteristics:")
360
+ for feature, values in sample_characteristics.items():
361
+ print(f"Feature: {feature}")
362
+ print(f"Values: {values}\n")
363
+ # 1. Gene Expression Data Availability
364
+ # Yes, based on the background info showing Illumina HumanHT-12 microarray data
365
+ is_gene_available = True
366
+
367
+ # 2.1 Data Availability & 2.2 Data Type Conversion
368
+ # Trait: Available in feature 1 'ocd' with values like 'ED', 'Control', 'OCD'
369
+ trait_row = 1
370
+ def convert_trait(value):
371
+ # Since we're looking for anxiety disorder, OCD patients are the cases
372
+ if not value or ':' not in value:
373
+ return None
374
+ val = value.split(':')[1].strip()
375
+ if val == 'OCD':
376
+ return 1
377
+ elif val == 'Control':
378
+ return 0
379
+ return None # Other values like 'ED' are not relevant
380
+
381
+ # Age: Available in feature 5
382
+ age_row = 5
383
+ def convert_age(value):
384
+ if not value or ':' not in value:
385
+ return None
386
+ try:
387
+ return float(value.split(':')[1].strip())
388
+ except:
389
+ return None
390
+
391
+ # Gender: Available in feature 7 'Sex'
392
+ gender_row = 7
393
+ def convert_gender(value):
394
+ if not value or ':' not in value:
395
+ return None
396
+ val = value.split(':')[1].strip()
397
+ if val == 'F':
398
+ return 0
399
+ elif val == 'M':
400
+ return 1
401
+ return None
402
+
403
+ # 3. Save Metadata
404
+ is_trait_available = trait_row is not None
405
+ validate_and_save_cohort_info(is_final=False, cohort=cohort, info_path=json_path,
406
+ is_gene_available=is_gene_available,
407
+ is_trait_available=is_trait_available)
408
+
409
+ # 4. Clinical Feature Extraction
410
+ selected_clinical = geo_select_clinical_features(clinical_data, trait, trait_row, convert_trait,
411
+ age_row, convert_age,
412
+ gender_row, convert_gender)
413
+
414
+ print("Preview of selected clinical features:")
415
+ print(preview_df(selected_clinical))
416
+
417
+ selected_clinical.to_csv(out_clinical_data_file)
418
+ # 1. Normalize gene symbols
419
+ gene_data = normalize_gene_symbols_in_index(gene_data)
420
+
421
+ # Save normalized gene data
422
+ gene_data.to_csv(out_gene_data_file)
423
+
424
+ # 2. Link clinical and genetic data
425
+ try:
426
+ clinical_data = pd.read_csv(out_clinical_data_file, index_col=0)
427
+ linked_data = geo_link_clinical_genetic_data(clinical_data, gene_data)
428
+
429
+ # 3. Handle missing values
430
+ linked_data = handle_missing_values(linked_data, trait)
431
+
432
+ # 4. Determine if features are biased
433
+ is_trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
434
+
435
+ # 5. Validate and save cohort info
436
+ is_usable = validate_and_save_cohort_info(
437
+ is_final=True,
438
+ cohort=cohort,
439
+ info_path=json_path,
440
+ is_gene_available=True,
441
+ is_trait_available=True,
442
+ is_biased=is_trait_biased,
443
+ df=linked_data,
444
+ note="Gene expression data successfully mapped and linked with clinical features"
445
+ )
446
+
447
+ # 6. Save linked data only if usable AND trait is not biased
448
+ if is_usable and not is_trait_biased:
449
+ linked_data.to_csv(out_data_file)
450
+
451
+ except Exception as e:
452
+ print(f"Error in data linking and processing: {str(e)}")
453
+ is_usable = validate_and_save_cohort_info(
454
+ is_final=True,
455
+ cohort=cohort,
456
+ info_path=json_path,
457
+ is_gene_available=True,
458
+ is_trait_available=True,
459
+ is_biased=True,
460
+ df=pd.DataFrame(),
461
+ note=f"Data processing failed: {str(e)}"
462
+ )