Liu-Hy commited on
Commit
ba45cf6
·
verified ·
1 Parent(s): 06befd3

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 +22 -0
  2. p3/preprocess/Hypertension/gene_data/GSE256539.csv +3 -0
  3. p3/preprocess/Hypertrophic_Cardiomyopathy/clinical_data/GSE36961.csv +4 -0
  4. p3/preprocess/Hypertrophic_Cardiomyopathy/code/GSE36961.py +144 -0
  5. p3/preprocess/Hypertrophic_Cardiomyopathy/code/TCGA.py +28 -0
  6. p3/preprocess/Hypertrophic_Cardiomyopathy/cohort_info.json +1 -0
  7. p3/preprocess/Hypothyroidism/GSE151158.csv +0 -0
  8. p3/preprocess/Hypothyroidism/clinical_data/GSE151158.csv +4 -0
  9. p3/preprocess/Hypothyroidism/clinical_data/GSE224330.csv +4 -0
  10. p3/preprocess/Hypothyroidism/clinical_data/GSE32445.csv +4 -0
  11. p3/preprocess/Hypothyroidism/clinical_data/GSE75678.csv +4 -0
  12. p3/preprocess/Hypothyroidism/clinical_data/GSE75685.csv +4 -0
  13. p3/preprocess/Hypothyroidism/clinical_data/TCGA.csv +581 -0
  14. p3/preprocess/Hypothyroidism/code/GSE151158.py +146 -0
  15. p3/preprocess/Hypothyroidism/code/GSE224330.py +180 -0
  16. p3/preprocess/Hypothyroidism/code/GSE32445.py +143 -0
  17. p3/preprocess/Hypothyroidism/code/GSE75678.py +173 -0
  18. p3/preprocess/Hypothyroidism/code/GSE75685.py +160 -0
  19. p3/preprocess/Hypothyroidism/code/TCGA.py +91 -0
  20. p3/preprocess/Hypothyroidism/cohort_info.json +1 -0
  21. p3/preprocess/Hypothyroidism/gene_data/GSE151158.csv +0 -0
  22. p3/preprocess/Hypothyroidism/gene_data/GSE224330.csv +0 -0
  23. p3/preprocess/Hypothyroidism/gene_data/GSE32445.csv +1 -0
  24. p3/preprocess/Hypothyroidism/gene_data/GSE75685.csv +0 -0
  25. p3/preprocess/Insomnia/clinical_data/GSE208668.csv +4 -0
  26. p3/preprocess/Insomnia/cohort_info.json +1 -0
  27. p3/preprocess/Lower_Grade_Glioma/gene_data/GSE107850.csv +3 -0
  28. p3/preprocess/Lower_Grade_Glioma/gene_data/GSE35158.csv +3 -0
  29. p3/preprocess/Lower_Grade_Glioma/gene_data/GSE74567.csv +0 -0
  30. p3/preprocess/Pancreatic_Cancer/GSE125158.csv +0 -0
  31. p3/preprocess/Pancreatic_Cancer/GSE130563.csv +3 -0
  32. p3/preprocess/Pancreatic_Cancer/GSE131027.csv +3 -0
  33. p3/preprocess/Pancreatic_Cancer/GSE183795.csv +3 -0
  34. p3/preprocess/Pancreatic_Cancer/GSE236951.csv +0 -0
  35. p3/preprocess/Pancreatic_Cancer/clinical_data/GSE130563.csv +4 -0
  36. p3/preprocess/Pancreatic_Cancer/clinical_data/GSE131027.csv +2 -0
  37. p3/preprocess/Pancreatic_Cancer/clinical_data/GSE183795.csv +2 -0
  38. p3/preprocess/Pancreatic_Cancer/clinical_data/GSE222788.csv +2 -0
  39. p3/preprocess/Pancreatic_Cancer/clinical_data/GSE223409.csv +2 -0
  40. p3/preprocess/Pancreatic_Cancer/clinical_data/GSE236951.csv +4 -0
  41. p3/preprocess/Pancreatic_Cancer/code/GSE120127.py +221 -0
  42. p3/preprocess/Pancreatic_Cancer/code/GSE124069.py +189 -0
  43. p3/preprocess/Pancreatic_Cancer/code/GSE125158.py +207 -0
  44. p3/preprocess/Pancreatic_Cancer/code/GSE130563.py +259 -0
  45. p3/preprocess/Pancreatic_Cancer/code/GSE131027.py +190 -0
  46. p3/preprocess/Pancreatic_Cancer/code/GSE157494.py +217 -0
  47. p3/preprocess/Pancreatic_Cancer/code/GSE183795.py +200 -0
  48. p3/preprocess/Pancreatic_Cancer/code/GSE222788.py +166 -0
  49. p3/preprocess/Pancreatic_Cancer/code/GSE223409.py +173 -0
  50. p3/preprocess/Pancreatic_Cancer/code/GSE236951.py +165 -0
.gitattributes CHANGED
@@ -1782,3 +1782,25 @@ p3/preprocess/Hypertension/gene_data/GSE128381.csv filter=lfs diff=lfs merge=lfs
1782
  p3/preprocess/Hypertension/gene_data/GSE77627.csv filter=lfs diff=lfs merge=lfs -text
1783
  p3/preprocess/Hypertension/gene_data/GSE117261.csv filter=lfs diff=lfs merge=lfs -text
1784
  p3/preprocess/Hypertension/gene_data/GSE161533.csv filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1782
  p3/preprocess/Hypertension/gene_data/GSE77627.csv filter=lfs diff=lfs merge=lfs -text
1783
  p3/preprocess/Hypertension/gene_data/GSE117261.csv filter=lfs diff=lfs merge=lfs -text
1784
  p3/preprocess/Hypertension/gene_data/GSE161533.csv filter=lfs diff=lfs merge=lfs -text
1785
+ p3/preprocess/Hypertension/gene_data/GSE256539.csv filter=lfs diff=lfs merge=lfs -text
1786
+ p3/preprocess/Lower_Grade_Glioma/gene_data/GSE35158.csv filter=lfs diff=lfs merge=lfs -text
1787
+ p3/preprocess/Pancreatic_Cancer/GSE130563.csv filter=lfs diff=lfs merge=lfs -text
1788
+ p3/preprocess/Pancreatic_Cancer/GSE131027.csv filter=lfs diff=lfs merge=lfs -text
1789
+ p3/preprocess/Lower_Grade_Glioma/gene_data/GSE107850.csv filter=lfs diff=lfs merge=lfs -text
1790
+ p3/preprocess/Pancreatic_Cancer/gene_data/GSE130563.csv filter=lfs diff=lfs merge=lfs -text
1791
+ p3/preprocess/Pancreatic_Cancer/gene_data/GSE131027.csv filter=lfs diff=lfs merge=lfs -text
1792
+ p3/preprocess/Sjögrens_Syndrome/GSE40611.csv filter=lfs diff=lfs merge=lfs -text
1793
+ p3/preprocess/Sjögrens_Syndrome/GSE135809.csv filter=lfs diff=lfs merge=lfs -text
1794
+ p3/preprocess/Pancreatic_Cancer/gene_data/GSE183795.csv filter=lfs diff=lfs merge=lfs -text
1795
+ p3/preprocess/Sjögrens_Syndrome/GSE93683.csv filter=lfs diff=lfs merge=lfs -text
1796
+ p3/preprocess/Sjögrens_Syndrome/GSE84844.csv filter=lfs diff=lfs merge=lfs -text
1797
+ p3/preprocess/Sjögrens_Syndrome/GSE51092.csv filter=lfs diff=lfs merge=lfs -text
1798
+ p3/preprocess/Pancreatic_Cancer/GSE183795.csv filter=lfs diff=lfs merge=lfs -text
1799
+ p3/preprocess/Sjögrens_Syndrome/gene_data/GSE135809.csv filter=lfs diff=lfs merge=lfs -text
1800
+ p3/preprocess/Sjögrens_Syndrome/gene_data/GSE40611.csv filter=lfs diff=lfs merge=lfs -text
1801
+ p3/preprocess/Pancreatic_Cancer/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
1802
+ p3/preprocess/Sjögrens_Syndrome/gene_data/GSE84844.csv filter=lfs diff=lfs merge=lfs -text
1803
+ p3/preprocess/Sjögrens_Syndrome/GSE66795.csv filter=lfs diff=lfs merge=lfs -text
1804
+ p3/preprocess/Sjögrens_Syndrome/gene_data/GSE93683.csv filter=lfs diff=lfs merge=lfs -text
1805
+ p3/preprocess/Sjögrens_Syndrome/gene_data/GSE51092.csv filter=lfs diff=lfs merge=lfs -text
1806
+ p3/preprocess/Sjögrens_Syndrome/gene_data/GSE66795.csv filter=lfs diff=lfs merge=lfs -text
p3/preprocess/Hypertension/gene_data/GSE256539.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5d9bb647998b040f0223d33002ee74f0c056ba2da0e63216486b09fb81c0e23
3
+ size 22918341
p3/preprocess/Hypertrophic_Cardiomyopathy/clinical_data/GSE36961.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM907203,GSM907204,GSM907205,GSM907206,GSM907207,GSM907208,GSM907209,GSM907210,GSM907211,GSM907212,GSM907213,GSM907214,GSM907215,GSM907216,GSM907217,GSM907218,GSM907219,GSM907220,GSM907221,GSM907222,GSM907223,GSM907224,GSM907225,GSM907226,GSM907227,GSM907228,GSM907229,GSM907230,GSM907231,GSM907232,GSM907233,GSM907234,GSM907235,GSM907236,GSM907237,GSM907238,GSM907239,GSM907240,GSM907241,GSM907242,GSM907243,GSM907244,GSM907245,GSM907246,GSM907247,GSM907248,GSM907249,GSM907250,GSM907251,GSM907252,GSM907253,GSM907254,GSM907255,GSM907256,GSM907257,GSM907258,GSM907259,GSM907260,GSM907261,GSM907262,GSM907263,GSM907264,GSM907265,GSM907266,GSM907267,GSM907268,GSM907269,GSM907270,GSM907271,GSM907272,GSM907273,GSM907274,GSM907275,GSM907276,GSM907277,GSM907278,GSM907279,GSM907280,GSM907281,GSM907282,GSM907283,GSM907284,GSM907285,GSM907286,GSM907287,GSM907288,GSM907289,GSM907290,GSM907291,GSM907292,GSM907293,GSM907294,GSM907295,GSM907296,GSM907297,GSM907298,GSM907299,GSM907300,GSM907301,GSM907302,GSM907303,GSM907304,GSM907305,GSM907306,GSM907307,GSM907308,GSM907309,GSM907310,GSM907311,GSM907312,GSM907313,GSM907314,GSM907315,GSM907316,GSM907317,GSM907318,GSM907319,GSM907320,GSM907321,GSM907322,GSM907323,GSM907324,GSM907325,GSM907326,GSM907327,GSM907328,GSM907329,GSM907330,GSM907331,GSM907332,GSM907333,GSM907334,GSM907335,GSM907336,GSM907337,GSM907338,GSM907339,GSM907340,GSM907341,GSM907342,GSM907343,GSM907344,GSM907345,GSM907346,GSM907347
2
+ Hypertrophic_Cardiomyopathy,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,,0.0,0.0,,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
3
+ Age,9.0,10.0,10.0,11.0,13.0,14.0,15.0,15.0,15.0,15.0,16.0,16.0,17.0,19.0,19.0,20.0,23.0,23.0,26.0,27.0,28.0,30.0,30.0,30.0,31.0,32.0,32.0,33.0,35.0,35.0,37.0,37.0,38.0,38.0,41.0,43.0,43.0,43.0,43.0,44.0,44.0,44.0,45.0,45.0,45.0,45.0,46.0,46.0,47.0,48.0,48.0,50.0,50.0,51.0,51.0,51.0,52.0,52.0,52.0,52.0,53.0,53.0,54.0,54.0,54.0,55.0,56.0,56.0,56.0,56.0,57.0,58.0,58.0,59.0,59.0,59.0,59.0,59.0,59.0,60.0,60.0,62.0,63.0,64.0,65.0,65.0,66.0,67.0,67.0,67.0,67.0,67.0,67.0,69.0,69.0,70.0,70.0,71.0,71.0,71.0,73.0,73.0,75.0,76.0,77.0,78.0,,49.0,48.0,,42.0,53.0,,31.0,54.0,52.0,47.0,26.0,65.0,21.0,41.0,55.0,61.0,36.0,7.0,23.0,17.0,45.0,40.0,37.0,51.0,39.0,37.0,23.0,19.0,53.0,48.0,47.0,4.0,48.0,25.0,27.0,21.0,27.0,21.0
4
+ Gender,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,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,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,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.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,1.0,1.0,1.0,1.0
p3/preprocess/Hypertrophic_Cardiomyopathy/code/GSE36961.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Hypertrophic_Cardiomyopathy"
6
+ cohort = "GSE36961"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Hypertrophic_Cardiomyopathy"
10
+ in_cohort_dir = "../DATA/GEO/Hypertrophic_Cardiomyopathy/GSE36961"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Hypertrophic_Cardiomyopathy/GSE36961.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Hypertrophic_Cardiomyopathy/gene_data/GSE36961.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Hypertrophic_Cardiomyopathy/clinical_data/GSE36961.csv"
16
+ json_path = "./output/preprocess/3/Hypertrophic_Cardiomyopathy/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Get background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
23
+
24
+ # Get unique values for each clinical feature
25
+ unique_values_dict = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background information
28
+ print("Background Information:")
29
+ print(background_info)
30
+ print("\nSample Characteristics:")
31
+ print(json.dumps(unique_values_dict, indent=2))
32
+ # 1. Gene Expression Data Availability
33
+ # Series title and summary indicate this is transcriptome profiling data
34
+ is_gene_available = True
35
+
36
+ # 2.1 Data Availability
37
+ # Trait is in row 3, gender in row 0, age in row 1
38
+ trait_row = 3 # disease state / sample type shows HCM vs control
39
+ gender_row = 0 # Sex field
40
+ age_row = 1 # age (yrs) field
41
+
42
+ # 2.2 Data Type Conversion Functions
43
+ def convert_trait(value: str) -> int:
44
+ """Convert trait value to binary (1=case, 0=control)"""
45
+ if pd.isna(value):
46
+ return None
47
+ value = value.split(": ")[-1].lower()
48
+ if "hypertrophic cardiomyopathy" in value or "hcm" in value or "case" in value:
49
+ return 1
50
+ elif "control" in value:
51
+ return 0
52
+ return None
53
+
54
+ def convert_age(value: str) -> float:
55
+ """Convert age value to continuous numeric"""
56
+ if pd.isna(value):
57
+ return None
58
+ try:
59
+ return float(value.split(": ")[-1])
60
+ except:
61
+ return None
62
+
63
+ def convert_gender(value: str) -> int:
64
+ """Convert gender to binary (0=female, 1=male)"""
65
+ if pd.isna(value):
66
+ return None
67
+ value = value.split(": ")[-1].lower()
68
+ if value == "female":
69
+ return 0
70
+ elif value == "male":
71
+ return 1
72
+ return None
73
+
74
+ # 3. Save Metadata
75
+ # trait_row is not None, so trait data is available
76
+ is_trait_available = trait_row is not None
77
+ validate_and_save_cohort_info(is_final=False, cohort=cohort, info_path=json_path,
78
+ is_gene_available=is_gene_available,
79
+ is_trait_available=is_trait_available)
80
+
81
+ # 4. Extract Clinical Features
82
+ selected_clinical = geo_select_clinical_features(
83
+ clinical_df=clinical_data,
84
+ trait=trait,
85
+ trait_row=trait_row,
86
+ convert_trait=convert_trait,
87
+ age_row=age_row,
88
+ convert_age=convert_age,
89
+ gender_row=gender_row,
90
+ convert_gender=convert_gender
91
+ )
92
+
93
+ # Preview the clinical data
94
+ preview_result = preview_df(selected_clinical)
95
+
96
+ # Save clinical data
97
+ selected_clinical.to_csv(out_clinical_data_file)
98
+ # Extract gene expression data from the matrix file
99
+ genetic_data = get_genetic_data(matrix_file_path)
100
+
101
+ # Print first 20 row IDs
102
+ print("First 20 row IDs:")
103
+ print(genetic_data.index[:20].tolist())
104
+ requires_gene_mapping = False
105
+ # 1. Normalize gene symbols
106
+ genetic_data = normalize_gene_symbols_in_index(genetic_data)
107
+ genetic_data.to_csv(out_gene_data_file)
108
+
109
+ # Get clinical features
110
+ clinical_features = geo_select_clinical_features(
111
+ clinical_data,
112
+ trait=trait,
113
+ trait_row=trait_row,
114
+ convert_trait=convert_trait,
115
+ gender_row=gender_row,
116
+ convert_gender=convert_gender
117
+ )
118
+
119
+ # 2. Link clinical and genetic data
120
+ linked_data = geo_link_clinical_genetic_data(clinical_features, genetic_data)
121
+
122
+ # 3. Handle missing values
123
+ linked_data = handle_missing_values(linked_data, trait)
124
+
125
+ # 4. Judge whether features are biased and remove biased demographic features
126
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
127
+
128
+ # 5. Final validation and save metadata
129
+ note = "Dataset contains gene expression data comparing cardiac tissue from patients with hypertrophic cardiomyopathy (HCM) versus control donor cardiac tissues."
130
+ is_usable = validate_and_save_cohort_info(
131
+ is_final=True,
132
+ cohort=cohort,
133
+ info_path=json_path,
134
+ is_gene_available=True,
135
+ is_trait_available=True,
136
+ is_biased=is_biased,
137
+ df=linked_data,
138
+ note=note
139
+ )
140
+
141
+ # 6. Save the linked data only if it's usable
142
+ if is_usable:
143
+ os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
144
+ linked_data.to_csv(out_data_file)
p3/preprocess/Hypertrophic_Cardiomyopathy/code/TCGA.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Hypertrophic_Cardiomyopathy"
6
+
7
+ # Input paths
8
+ tcga_root_dir = "../DATA/TCGA"
9
+
10
+ # Output paths
11
+ out_data_file = "./output/preprocess/3/Hypertrophic_Cardiomyopathy/TCGA.csv"
12
+ out_gene_data_file = "./output/preprocess/3/Hypertrophic_Cardiomyopathy/gene_data/TCGA.csv"
13
+ out_clinical_data_file = "./output/preprocess/3/Hypertrophic_Cardiomyopathy/clinical_data/TCGA.csv"
14
+ json_path = "./output/preprocess/3/Hypertrophic_Cardiomyopathy/cohort_info.json"
15
+
16
+ # Get subdirectories from TCGA root directory
17
+ tcga_subdirs = os.listdir(tcga_root_dir)
18
+ tcga_subdirs = [d for d in tcga_subdirs if not d.startswith('.')]
19
+
20
+ # No suitable cohort exists for HDL deficiency in TCGA cancer datasets
21
+ # Record this and end processing
22
+ validate_and_save_cohort_info(
23
+ is_final=False,
24
+ cohort="TCGA",
25
+ info_path=json_path,
26
+ is_gene_available=True,
27
+ is_trait_available=False
28
+ )
p3/preprocess/Hypertrophic_Cardiomyopathy/cohort_info.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"GSE36961": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": true, "sample_size": 142, "note": "Dataset contains gene expression data comparing cardiac tissue from patients with hypertrophic cardiomyopathy (HCM) versus control donor cardiac tissues."}, "TCGA": {"is_usable": false, "is_gene_available": true, "is_trait_available": false, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}}
p3/preprocess/Hypothyroidism/GSE151158.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Hypothyroidism/clinical_data/GSE151158.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM4567420,GSM4567421,GSM4567422,GSM4567423,GSM4567424,GSM4567425,GSM4567426,GSM4567427,GSM4567428,GSM4567429,GSM4567430,GSM4567431,GSM4567432,GSM4567433,GSM4567434,GSM4567435,GSM4567436,GSM4567437,GSM4567438,GSM4567439,GSM4567440,GSM4567441,GSM4567442,GSM4567443,GSM4567444,GSM4567445,GSM4567446,GSM4567447,GSM4567448,GSM4567449,GSM4567450,GSM4567451,GSM4567452,GSM4567453,GSM4567454,GSM4567455,GSM4567456,GSM4567457,GSM4567458,GSM4567459,GSM4567460,GSM4567461,GSM4567462,GSM4567463,GSM4567464,GSM4567465,GSM4567466,GSM4567467,GSM4567468,GSM4567469,GSM4567470,GSM4567471,GSM4567472,GSM4567473,GSM4567474,GSM4567475,GSM4567476,GSM4567477,GSM4567478,GSM4567479,GSM4567480,GSM4567481,GSM4567482,GSM4567483,GSM4567484,GSM4567485
2
+ Hypothyroidism,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,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,,,,,
3
+ Age,53.0,40.0,51.0,36.0,44.0,60.0,31.0,41.0,55.0,15.0,57.0,56.0,34.0,43.0,49.0,55.0,52.0,35.0,35.0,40.0,34.0,42.0,53.0,33.0,31.0,57.0,42.0,48.0,47.0,51.0,65.0,40.0,59.0,49.0,61.0,59.0,28.0,46.0,42.0,60.0,25.0,43.0,51.0,52.0,51.0,56.0,27.0,35.0,54.0,37.0,45.0,45.0,47.0,40.0,33.0,39.0,39.0,44.0,47.0,37.0,49.0,,,,,
4
+ Gender,0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,,,,,
p3/preprocess/Hypothyroidism/clinical_data/GSE224330.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM7019507,GSM7019508,GSM7019509,GSM7019510,GSM7019511,GSM7019512,GSM7019513,GSM7019514,GSM7019515,GSM7019516,GSM7019517,GSM7019518,GSM7019519,GSM7019520,GSM7019521,GSM7019522,GSM7019523,GSM7019524,GSM7019525,GSM7019526,GSM7019527,GSM7019528,GSM7019529,GSM7019530,GSM7019531,GSM7019532,GSM7019533,GSM7019534,GSM7019535,GSM7019536,GSM7019537
2
+ Hypothyroidism,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
3
+ Age,63.0,64.0,63.0,48.0,70.0,62.0,58.0,57.0,60.0,57.0,52.0,51.0,53.0,56.0,62.0,54.0,61.0,54.0,55.0,65.0,84.0,70.0,76.0,62.0,73.0,71.0,59.0,62.0,47.0,76.0,54.0
4
+ Gender,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0
p3/preprocess/Hypothyroidism/clinical_data/GSE32445.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM802773,GSM802774,GSM802775,GSM802776,GSM802777,GSM802778,GSM802779,GSM802780,GSM802781,GSM802782,GSM802783,GSM802784,GSM802785,GSM802786,GSM802787,GSM802788,GSM802789,GSM802790,GSM802791,GSM802792,GSM802793,GSM802794,GSM802795,GSM802796,GSM802797,GSM802798
2
+ Hypothyroidism,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.0,9.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
p3/preprocess/Hypothyroidism/clinical_data/GSE75678.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM1963528,GSM1963529,GSM1963530,GSM1963531,GSM1963532,GSM1963533,GSM1963534,GSM1963535,GSM1963536,GSM1963537,GSM1963538,GSM1963539,GSM1963540,GSM1963541,GSM1963542,GSM1963543,GSM1963544,GSM1963545,GSM1963546,GSM1963547,GSM1963548,GSM1963549,GSM1963550,GSM1963551,GSM1963552,GSM1963553,GSM1963554,GSM1963555,GSM1963556,GSM1963557,GSM1963558,GSM1963559,GSM1963560,GSM1963561,GSM1963562,GSM1963563,GSM1963564,GSM1963565,GSM1963566,GSM1963567,GSM1963568,GSM1963569,GSM1963570,GSM1963571,GSM1963572,GSM1963573,GSM1963574,GSM1963575,GSM1963576,GSM1963577,GSM1963578,GSM1963579,GSM1963580,GSM1963581
2
+ Hypothyroidism,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
3
+ Age,45.0,41.0,59.0,57.0,42.0,49.0,59.0,54.0,54.0,31.0,70.0,44.0,50.0,42.0,56.0,51.0,58.0,55.0,71.0,42.0,41.0,40.0,57.0,62.0,87.0,36.0,50.0,45.0,43.0,42.0,43.0,44.0,43.0,48.0,45.0,51.0,56.0,57.0,41.0,48.0,66.0,53.0,36.0,51.0,57.0,45.0,55.0,35.0,44.0,68.0,46.0,58.0,45.0,54.0
4
+ Gender,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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/Hypothyroidism/clinical_data/GSE75685.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM1963127,GSM1963128,GSM1963129,GSM1963130,GSM1963131,GSM1963132,GSM1963133,GSM1963134,GSM1963135,GSM1963136,GSM1963137,GSM1963138,GSM1963139,GSM1963140,GSM1963141,GSM1963142,GSM1963143,GSM1963144,GSM1963145,GSM1963146,GSM1963147,GSM1963148,GSM1963149,GSM1963150,GSM1963151,GSM1963152,GSM1963153,GSM1963154,GSM1963155,GSM1963156,GSM1963157,GSM1963158,GSM1963159,GSM1963160,GSM1963161,GSM1963162,GSM1963163,GSM1963164,GSM1963165,GSM1963166,GSM1963167,GSM1963168,GSM1963169,GSM1963170,GSM1963171,GSM1963172,GSM1963173,GSM1963174,GSM1963175,GSM1963176,GSM1963177,GSM1963178,GSM1963179,GSM1963180
2
+ Hypothyroidism,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
3
+ Age,54.0,41.0,55.0,51.0,45.0,54.0,48.0,71.0,51.0,43.0,40.0,59.0,45.0,36.0,41.0,41.0,66.0,56.0,50.0,50.0,42.0,57.0,57.0,36.0,55.0,49.0,42.0,70.0,87.0,42.0,59.0,51.0,31.0,62.0,44.0,57.0,56.0,53.0,35.0,45.0,44.0,43.0,68.0,48.0,46.0,45.0,58.0,45.0,44.0,54.0,58.0,57.0,42.0,43.0
4
+ Gender,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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/Hypothyroidism/clinical_data/TCGA.csv ADDED
@@ -0,0 +1,581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ sampleID,Hypothyroidism,Age,Gender
2
+ TCGA-4C-A93U-01,1,74,0
3
+ TCGA-BJ-A0YZ-01,1,65,1
4
+ TCGA-BJ-A0Z0-01,1,55,1
5
+ TCGA-BJ-A0Z2-01,1,57,1
6
+ TCGA-BJ-A0Z3-01,1,33,0
7
+ TCGA-BJ-A0Z5-01,1,58,1
8
+ TCGA-BJ-A0Z9-01,1,57,0
9
+ TCGA-BJ-A0ZA-01,1,67,0
10
+ TCGA-BJ-A0ZB-01,1,66,1
11
+ TCGA-BJ-A0ZC-01,1,55,1
12
+ TCGA-BJ-A0ZE-01,1,63,0
13
+ TCGA-BJ-A0ZF-01,1,54,0
14
+ TCGA-BJ-A0ZG-01,1,80,1
15
+ TCGA-BJ-A0ZH-01,1,52,0
16
+ TCGA-BJ-A0ZJ-01,1,36,1
17
+ TCGA-BJ-A18Y-01,1,29,1
18
+ TCGA-BJ-A18Z-01,1,58,1
19
+ TCGA-BJ-A190-01,1,55,1
20
+ TCGA-BJ-A191-01,1,49,0
21
+ TCGA-BJ-A192-01,1,54,0
22
+ TCGA-BJ-A28R-01,1,38,0
23
+ TCGA-BJ-A28R-11,0,38,0
24
+ TCGA-BJ-A28S-01,1,79,1
25
+ TCGA-BJ-A28T-01,1,34,0
26
+ TCGA-BJ-A28T-11,0,34,0
27
+ TCGA-BJ-A28V-01,1,80,0
28
+ TCGA-BJ-A28W-01,1,32,0
29
+ TCGA-BJ-A28W-11,0,32,0
30
+ TCGA-BJ-A28X-01,1,32,0
31
+ TCGA-BJ-A28X-11,0,32,0
32
+ TCGA-BJ-A28Z-01,1,46,0
33
+ TCGA-BJ-A290-01,1,70,1
34
+ TCGA-BJ-A290-11,0,70,1
35
+ TCGA-BJ-A291-01,1,56,0
36
+ TCGA-BJ-A2N7-01,1,30,0
37
+ TCGA-BJ-A2N7-11,0,30,0
38
+ TCGA-BJ-A2N8-01,1,30,0
39
+ TCGA-BJ-A2N8-11,0,30,0
40
+ TCGA-BJ-A2N9-01,1,42,0
41
+ TCGA-BJ-A2N9-11,0,42,0
42
+ TCGA-BJ-A2NA-01,1,77,1
43
+ TCGA-BJ-A2NA-11,0,77,1
44
+ TCGA-BJ-A2P4-01,1,29,0
45
+ TCGA-BJ-A3EZ-01,1,51,1
46
+ TCGA-BJ-A3F0-01,1,64,0
47
+ TCGA-BJ-A3PR-01,1,69,0
48
+ TCGA-BJ-A3PR-11,0,69,0
49
+ TCGA-BJ-A3PT-01,1,51,0
50
+ TCGA-BJ-A3PU-01,1,52,1
51
+ TCGA-BJ-A3PU-11,0,52,1
52
+ TCGA-BJ-A45C-01,1,78,1
53
+ TCGA-BJ-A45D-01,1,36,1
54
+ TCGA-BJ-A45E-01,1,46,0
55
+ TCGA-BJ-A45F-01,1,59,0
56
+ TCGA-BJ-A45G-01,1,48,0
57
+ TCGA-BJ-A45H-01,1,45,1
58
+ TCGA-BJ-A45I-01,1,51,0
59
+ TCGA-BJ-A45J-01,1,39,0
60
+ TCGA-BJ-A45K-01,1,33,1
61
+ TCGA-BJ-A4O8-01,1,47,1
62
+ TCGA-BJ-A4O9-01,1,51,0
63
+ TCGA-CE-A13K-01,1,30,0
64
+ TCGA-CE-A27D-01,1,28,0
65
+ TCGA-CE-A3MD-01,1,31,1
66
+ TCGA-CE-A3ME-01,1,51,0
67
+ TCGA-CE-A481-01,1,41,0
68
+ TCGA-CE-A482-01,1,27,0
69
+ TCGA-CE-A483-01,1,34,0
70
+ TCGA-CE-A484-01,1,37,0
71
+ TCGA-CE-A485-01,1,32,1
72
+ TCGA-DE-A0XZ-01,1,65,0
73
+ TCGA-DE-A0Y2-01,1,30,0
74
+ TCGA-DE-A0Y3-01,1,60,0
75
+ TCGA-DE-A2OL-01,1,44,0
76
+ TCGA-DE-A3KN-01,1,49,0
77
+ TCGA-DE-A4M8-01,1,61,0
78
+ TCGA-DE-A4M9-01,1,28,1
79
+ TCGA-DE-A4MA-01,1,52,0
80
+ TCGA-DE-A4MB-01,1,79,0
81
+ TCGA-DE-A4MC-01,1,43,0
82
+ TCGA-DE-A4MD-01,1,71,1
83
+ TCGA-DE-A4MD-06,1,71,1
84
+ TCGA-DE-A69J-01,1,34,0
85
+ TCGA-DE-A69K-01,1,58,0
86
+ TCGA-DE-A7U5-01,1,36,0
87
+ TCGA-DJ-A13L-01,1,85,1
88
+ TCGA-DJ-A13M-01,1,28,0
89
+ TCGA-DJ-A13O-01,1,56,1
90
+ TCGA-DJ-A13P-01,1,52,0
91
+ TCGA-DJ-A13R-01,1,50,1
92
+ TCGA-DJ-A13S-01,1,19,0
93
+ TCGA-DJ-A13T-01,1,37,0
94
+ TCGA-DJ-A13U-01,1,60,1
95
+ TCGA-DJ-A13V-01,1,21,0
96
+ TCGA-DJ-A13W-01,1,45,0
97
+ TCGA-DJ-A13X-01,1,51,0
98
+ TCGA-DJ-A1QD-01,1,20,0
99
+ TCGA-DJ-A1QE-01,1,62,0
100
+ TCGA-DJ-A1QF-01,1,61,0
101
+ TCGA-DJ-A1QG-01,1,62,1
102
+ TCGA-DJ-A1QH-01,1,58,0
103
+ TCGA-DJ-A1QI-01,1,63,0
104
+ TCGA-DJ-A1QL-01,1,70,1
105
+ TCGA-DJ-A1QM-01,1,42,1
106
+ TCGA-DJ-A1QN-01,1,42,0
107
+ TCGA-DJ-A1QO-01,1,69,1
108
+ TCGA-DJ-A1QQ-01,1,43,1
109
+ TCGA-DJ-A2PN-01,1,70,0
110
+ TCGA-DJ-A2PO-01,1,54,1
111
+ TCGA-DJ-A2PP-01,1,47,1
112
+ TCGA-DJ-A2PQ-01,1,26,1
113
+ TCGA-DJ-A2PR-01,1,27,1
114
+ TCGA-DJ-A2PS-01,1,40,0
115
+ TCGA-DJ-A2PT-01,1,70,0
116
+ TCGA-DJ-A2PU-01,1,52,0
117
+ TCGA-DJ-A2PV-01,1,53,0
118
+ TCGA-DJ-A2PW-01,1,65,1
119
+ TCGA-DJ-A2PX-01,1,55,0
120
+ TCGA-DJ-A2PY-01,1,46,0
121
+ TCGA-DJ-A2PZ-01,1,63,1
122
+ TCGA-DJ-A2Q0-01,1,57,0
123
+ TCGA-DJ-A2Q1-01,1,44,0
124
+ TCGA-DJ-A2Q2-01,1,57,0
125
+ TCGA-DJ-A2Q3-01,1,61,0
126
+ TCGA-DJ-A2Q4-01,1,53,1
127
+ TCGA-DJ-A2Q5-01,1,51,1
128
+ TCGA-DJ-A2Q6-01,1,38,0
129
+ TCGA-DJ-A2Q7-01,1,52,0
130
+ TCGA-DJ-A2Q8-01,1,47,0
131
+ TCGA-DJ-A2Q9-01,1,65,0
132
+ TCGA-DJ-A2QA-01,1,56,0
133
+ TCGA-DJ-A2QB-01,1,53,0
134
+ TCGA-DJ-A2QC-01,1,70,0
135
+ TCGA-DJ-A3UK-01,1,35,0
136
+ TCGA-DJ-A3UM-01,1,45,0
137
+ TCGA-DJ-A3UN-01,1,51,0
138
+ TCGA-DJ-A3UO-01,1,63,1
139
+ TCGA-DJ-A3UP-01,1,38,0
140
+ TCGA-DJ-A3UQ-01,1,45,0
141
+ TCGA-DJ-A3UR-01,1,51,0
142
+ TCGA-DJ-A3US-01,1,37,0
143
+ TCGA-DJ-A3UT-01,1,43,0
144
+ TCGA-DJ-A3UU-01,1,49,0
145
+ TCGA-DJ-A3UV-01,1,18,0
146
+ TCGA-DJ-A3UW-01,1,50,0
147
+ TCGA-DJ-A3UX-01,1,46,0
148
+ TCGA-DJ-A3UY-01,1,32,0
149
+ TCGA-DJ-A3UZ-01,1,70,0
150
+ TCGA-DJ-A3V0-01,1,56,1
151
+ TCGA-DJ-A3V2-01,1,44,0
152
+ TCGA-DJ-A3V3-01,1,57,0
153
+ TCGA-DJ-A3V4-01,1,60,0
154
+ TCGA-DJ-A3V5-01,1,76,0
155
+ TCGA-DJ-A3V6-01,1,54,1
156
+ TCGA-DJ-A3V7-01,1,44,0
157
+ TCGA-DJ-A3V8-01,1,28,0
158
+ TCGA-DJ-A3V9-01,1,50,0
159
+ TCGA-DJ-A3VA-01,1,39,0
160
+ TCGA-DJ-A3VB-01,1,52,1
161
+ TCGA-DJ-A3VD-01,1,32,0
162
+ TCGA-DJ-A3VE-01,1,50,1
163
+ TCGA-DJ-A3VF-01,1,60,0
164
+ TCGA-DJ-A3VG-01,1,40,1
165
+ TCGA-DJ-A3VI-01,1,52,0
166
+ TCGA-DJ-A3VJ-01,1,22,1
167
+ TCGA-DJ-A3VK-01,1,63,1
168
+ TCGA-DJ-A3VL-01,1,38,1
169
+ TCGA-DJ-A3VM-01,1,68,0
170
+ TCGA-DJ-A4UL-01,1,68,0
171
+ TCGA-DJ-A4UP-01,1,15,0
172
+ TCGA-DJ-A4UQ-01,1,60,1
173
+ TCGA-DJ-A4UR-01,1,36,0
174
+ TCGA-DJ-A4UT-01,1,32,0
175
+ TCGA-DJ-A4UW-01,1,34,0
176
+ TCGA-DJ-A4V0-01,1,36,0
177
+ TCGA-DJ-A4V2-01,1,38,0
178
+ TCGA-DJ-A4V4-01,1,48,0
179
+ TCGA-DJ-A4V5-01,1,55,1
180
+ TCGA-DO-A1JZ-01,1,23,0
181
+ TCGA-DO-A1JZ-11,0,23,0
182
+ TCGA-DO-A1K0-01,1,30,0
183
+ TCGA-DO-A2HM-01,1,49,1
184
+ TCGA-E3-A3DY-01,1,37,1
185
+ TCGA-E3-A3DZ-01,1,55,0
186
+ TCGA-E3-A3E0-01,1,34,0
187
+ TCGA-E3-A3E1-01,1,46,0
188
+ TCGA-E3-A3E2-01,1,34,0
189
+ TCGA-E3-A3E3-01,1,49,0
190
+ TCGA-E3-A3E5-01,1,57,1
191
+ TCGA-E8-A242-01,1,56,0
192
+ TCGA-E8-A2EA-01,1,52,0
193
+ TCGA-E8-A2JQ-01,1,18,0
194
+ TCGA-E8-A2JQ-11,0,18,0
195
+ TCGA-E8-A3X7-01,1,57,0
196
+ TCGA-E8-A413-01,1,38,0
197
+ TCGA-E8-A414-01,1,45,0
198
+ TCGA-E8-A415-01,1,39,0
199
+ TCGA-E8-A416-01,1,51,0
200
+ TCGA-E8-A417-01,1,38,0
201
+ TCGA-E8-A418-01,1,75,0
202
+ TCGA-E8-A419-01,1,30,0
203
+ TCGA-E8-A432-01,1,57,0
204
+ TCGA-E8-A433-01,1,25,0
205
+ TCGA-E8-A434-01,1,56,0
206
+ TCGA-E8-A436-01,1,53,0
207
+ TCGA-E8-A437-01,1,57,0
208
+ TCGA-E8-A438-01,1,23,0
209
+ TCGA-E8-A44K-01,1,50,0
210
+ TCGA-E8-A44M-01,1,23,0
211
+ TCGA-EL-A3CL-01,1,70,0
212
+ TCGA-EL-A3CM-01,1,64,0
213
+ TCGA-EL-A3CN-01,1,47,0
214
+ TCGA-EL-A3CO-01,1,88,1
215
+ TCGA-EL-A3CP-01,1,50,0
216
+ TCGA-EL-A3CR-01,1,78,0
217
+ TCGA-EL-A3CS-01,1,62,0
218
+ TCGA-EL-A3CT-01,1,78,0
219
+ TCGA-EL-A3CU-01,1,70,0
220
+ TCGA-EL-A3CV-01,1,40,1
221
+ TCGA-EL-A3CW-01,1,87,0
222
+ TCGA-EL-A3CX-01,1,22,0
223
+ TCGA-EL-A3CY-01,1,28,1
224
+ TCGA-EL-A3CZ-01,1,37,0
225
+ TCGA-EL-A3D0-01,1,61,1
226
+ TCGA-EL-A3D1-01,1,39,1
227
+ TCGA-EL-A3D4-01,1,62,1
228
+ TCGA-EL-A3D5-01,1,44,0
229
+ TCGA-EL-A3D6-01,1,51,0
230
+ TCGA-EL-A3GO-01,1,31,0
231
+ TCGA-EL-A3GP-01,1,70,1
232
+ TCGA-EL-A3GQ-01,1,72,0
233
+ TCGA-EL-A3GR-01,1,31,0
234
+ TCGA-EL-A3GS-01,1,37,0
235
+ TCGA-EL-A3GU-01,1,72,0
236
+ TCGA-EL-A3GV-01,1,65,0
237
+ TCGA-EL-A3GW-01,1,37,0
238
+ TCGA-EL-A3GX-01,1,41,0
239
+ TCGA-EL-A3GY-01,1,40,0
240
+ TCGA-EL-A3GZ-01,1,34,0
241
+ TCGA-EL-A3GZ-11,0,34,0
242
+ TCGA-EL-A3H1-01,1,66,0
243
+ TCGA-EL-A3H1-11,0,66,0
244
+ TCGA-EL-A3H2-01,1,58,1
245
+ TCGA-EL-A3H2-11,0,58,1
246
+ TCGA-EL-A3H3-01,1,19,0
247
+ TCGA-EL-A3H4-01,1,46,0
248
+ TCGA-EL-A3H5-01,1,57,0
249
+ TCGA-EL-A3H7-01,1,36,0
250
+ TCGA-EL-A3H7-11,0,36,0
251
+ TCGA-EL-A3H8-01,1,35,0
252
+ TCGA-EL-A3MW-01,1,55,0
253
+ TCGA-EL-A3MW-11,0,55,0
254
+ TCGA-EL-A3MX-01,1,66,0
255
+ TCGA-EL-A3MX-11,0,66,0
256
+ TCGA-EL-A3MY-01,1,81,1
257
+ TCGA-EL-A3MY-11,0,81,1
258
+ TCGA-EL-A3MZ-01,1,66,1
259
+ TCGA-EL-A3N2-01,1,24,0
260
+ TCGA-EL-A3N2-11,0,24,0
261
+ TCGA-EL-A3N3-01,1,53,0
262
+ TCGA-EL-A3N3-11,0,53,0
263
+ TCGA-EL-A3T0-01,1,45,0
264
+ TCGA-EL-A3T0-11,0,45,0
265
+ TCGA-EL-A3T1-01,1,38,0
266
+ TCGA-EL-A3T1-11,0,38,0
267
+ TCGA-EL-A3T2-01,1,55,0
268
+ TCGA-EL-A3T2-11,0,55,0
269
+ TCGA-EL-A3T3-01,1,63,1
270
+ TCGA-EL-A3T3-11,0,63,1
271
+ TCGA-EL-A3T6-01,1,34,0
272
+ TCGA-EL-A3T6-11,0,34,0
273
+ TCGA-EL-A3T7-01,1,47,0
274
+ TCGA-EL-A3T7-11,0,47,0
275
+ TCGA-EL-A3T8-01,1,36,1
276
+ TCGA-EL-A3T8-11,0,36,1
277
+ TCGA-EL-A3T9-01,1,69,0
278
+ TCGA-EL-A3TA-01,1,42,1
279
+ TCGA-EL-A3TA-11,0,42,1
280
+ TCGA-EL-A3TB-01,1,47,0
281
+ TCGA-EL-A3TB-11,0,47,0
282
+ TCGA-EL-A3ZG-01,1,15,1
283
+ TCGA-EL-A3ZG-11,0,15,1
284
+ TCGA-EL-A3ZH-01,1,42,0
285
+ TCGA-EL-A3ZH-11,0,42,0
286
+ TCGA-EL-A3ZK-01,1,41,0
287
+ TCGA-EL-A3ZK-11,0,41,0
288
+ TCGA-EL-A3ZL-01,1,34,0
289
+ TCGA-EL-A3ZL-11,0,34,0
290
+ TCGA-EL-A3ZM-01,1,60,1
291
+ TCGA-EL-A3ZM-11,0,60,1
292
+ TCGA-EL-A3ZN-01,1,28,0
293
+ TCGA-EL-A3ZO-01,1,79,0
294
+ TCGA-EL-A3ZO-11,0,79,0
295
+ TCGA-EL-A3ZP-01,1,19,1
296
+ TCGA-EL-A3ZP-11,0,19,1
297
+ TCGA-EL-A3ZQ-01,1,78,0
298
+ TCGA-EL-A3ZQ-11,0,78,0
299
+ TCGA-EL-A3ZR-01,1,46,0
300
+ TCGA-EL-A3ZR-11,0,46,0
301
+ TCGA-EL-A3ZS-01,1,22,0
302
+ TCGA-EL-A3ZS-11,0,22,0
303
+ TCGA-EL-A3ZT-01,1,35,1
304
+ TCGA-EL-A3ZT-11,0,35,1
305
+ TCGA-EL-A4JV-01,1,41,0
306
+ TCGA-EL-A4JW-01,1,38,0
307
+ TCGA-EL-A4JX-01,1,31,0
308
+ TCGA-EL-A4JZ-01,1,55,0
309
+ TCGA-EL-A4K0-01,1,54,0
310
+ TCGA-EL-A4K1-01,1,68,0
311
+ TCGA-EL-A4K2-01,1,43,0
312
+ TCGA-EL-A4K4-01,1,33,0
313
+ TCGA-EL-A4K6-01,1,75,1
314
+ TCGA-EL-A4K7-01,1,74,1
315
+ TCGA-EL-A4K9-01,1,68,1
316
+ TCGA-EL-A4KD-01,1,41,1
317
+ TCGA-EL-A4KG-01,1,35,0
318
+ TCGA-EL-A4KH-01,1,36,0
319
+ TCGA-EL-A4KI-01,1,63,1
320
+ TCGA-EM-A1CS-01,1,55,0
321
+ TCGA-EM-A1CS-11,0,55,0
322
+ TCGA-EM-A1CT-01,1,76,1
323
+ TCGA-EM-A1CT-11,0,76,1
324
+ TCGA-EM-A1CU-01,1,31,1
325
+ TCGA-EM-A1CU-11,0,31,1
326
+ TCGA-EM-A1CV-01,1,32,0
327
+ TCGA-EM-A1CV-11,0,32,0
328
+ TCGA-EM-A1CW-01,1,39,0
329
+ TCGA-EM-A1CW-11,0,39,0
330
+ TCGA-EM-A1YA-01,1,74,0
331
+ TCGA-EM-A1YB-01,1,73,0
332
+ TCGA-EM-A1YC-01,1,71,0
333
+ TCGA-EM-A1YC-11,0,71,0
334
+ TCGA-EM-A1YD-01,1,53,0
335
+ TCGA-EM-A1YD-11,0,53,0
336
+ TCGA-EM-A1YE-01,1,47,0
337
+ TCGA-EM-A1YE-11,0,47,0
338
+ TCGA-EM-A22I-01,1,52,0
339
+ TCGA-EM-A22J-01,1,56,0
340
+ TCGA-EM-A22K-01,1,46,0
341
+ TCGA-EM-A22L-01,1,33,0
342
+ TCGA-EM-A22M-01,1,52,1
343
+ TCGA-EM-A22N-01,1,68,0
344
+ TCGA-EM-A22O-01,1,75,1
345
+ TCGA-EM-A22P-01,1,64,1
346
+ TCGA-EM-A22Q-01,1,36,1
347
+ TCGA-EM-A2CJ-01,1,49,0
348
+ TCGA-EM-A2CK-01,1,28,1
349
+ TCGA-EM-A2CL-01,1,31,1
350
+ TCGA-EM-A2CM-01,1,62,0
351
+ TCGA-EM-A2CN-01,1,62,1
352
+ TCGA-EM-A2CO-01,1,77,0
353
+ TCGA-EM-A2CP-01,1,26,0
354
+ TCGA-EM-A2CQ-01,1,40,0
355
+ TCGA-EM-A2CR-01,1,46,0
356
+ TCGA-EM-A2CS-01,1,51,0
357
+ TCGA-EM-A2CS-06,1,51,0
358
+ TCGA-EM-A2CT-01,1,20,0
359
+ TCGA-EM-A2CU-01,1,47,0
360
+ TCGA-EM-A2OV-01,1,64,0
361
+ TCGA-EM-A2OW-01,1,37,0
362
+ TCGA-EM-A2OX-01,1,46,1
363
+ TCGA-EM-A2OY-01,1,46,0
364
+ TCGA-EM-A2OZ-01,1,66,1
365
+ TCGA-EM-A2P0-01,1,33,1
366
+ TCGA-EM-A2P1-01,1,33,1
367
+ TCGA-EM-A2P1-06,1,33,1
368
+ TCGA-EM-A2P2-01,1,46,1
369
+ TCGA-EM-A2P3-01,1,47,0
370
+ TCGA-EM-A3AI-01,1,67,0
371
+ TCGA-EM-A3AJ-01,1,39,1
372
+ TCGA-EM-A3AK-01,1,62,0
373
+ TCGA-EM-A3AL-01,1,45,0
374
+ TCGA-EM-A3AN-01,1,36,0
375
+ TCGA-EM-A3AO-01,1,61,1
376
+ TCGA-EM-A3AP-01,1,31,0
377
+ TCGA-EM-A3AQ-01,1,85,0
378
+ TCGA-EM-A3AR-01,1,41,1
379
+ TCGA-EM-A3FJ-01,1,24,0
380
+ TCGA-EM-A3FK-01,1,30,0
381
+ TCGA-EM-A3FL-01,1,63,0
382
+ TCGA-EM-A3FM-01,1,57,1
383
+ TCGA-EM-A3FN-01,1,42,0
384
+ TCGA-EM-A3FO-01,1,40,1
385
+ TCGA-EM-A3FP-01,1,71,0
386
+ TCGA-EM-A3FQ-01,1,19,0
387
+ TCGA-EM-A3FQ-06,1,19,0
388
+ TCGA-EM-A3FR-01,1,55,0
389
+ TCGA-EM-A3O3-01,1,83,0
390
+ TCGA-EM-A3O6-01,1,54,0
391
+ TCGA-EM-A3O7-01,1,46,0
392
+ TCGA-EM-A3O8-01,1,33,0
393
+ TCGA-EM-A3O9-01,1,40,1
394
+ TCGA-EM-A3OA-01,1,55,0
395
+ TCGA-EM-A3OB-01,1,33,0
396
+ TCGA-EM-A3ST-01,1,62,0
397
+ TCGA-EM-A3ST-11,0,62,0
398
+ TCGA-EM-A3SU-01,1,43,0
399
+ TCGA-EM-A3SU-06,1,43,0
400
+ TCGA-EM-A3SX-01,1,28,0
401
+ TCGA-EM-A3SY-01,1,36,1
402
+ TCGA-EM-A3SZ-01,1,42,0
403
+ TCGA-EM-A4FF-01,1,40,0
404
+ TCGA-EM-A4FH-01,1,69,1
405
+ TCGA-EM-A4FK-01,1,33,0
406
+ TCGA-EM-A4FM-01,1,59,0
407
+ TCGA-EM-A4FN-01,1,49,0
408
+ TCGA-EM-A4FO-01,1,72,1
409
+ TCGA-EM-A4FQ-01,1,42,0
410
+ TCGA-EM-A4FR-01,1,28,1
411
+ TCGA-EM-A4FU-01,1,35,1
412
+ TCGA-EM-A4FV-01,1,64,0
413
+ TCGA-EM-A4G1-01,1,26,0
414
+ TCGA-ET-A25G-01,1,56,0
415
+ TCGA-ET-A25I-01,1,37,0
416
+ TCGA-ET-A25J-01,1,40,0
417
+ TCGA-ET-A25J-11,0,40,0
418
+ TCGA-ET-A25K-01,1,36,0
419
+ TCGA-ET-A25L-01,1,52,0
420
+ TCGA-ET-A25M-01,1,33,1
421
+ TCGA-ET-A25N-01,1,28,0
422
+ TCGA-ET-A25N-11,0,28,0
423
+ TCGA-ET-A25O-01,1,35,0
424
+ TCGA-ET-A25P-01,1,24,0
425
+ TCGA-ET-A25R-01,1,51,0
426
+ TCGA-ET-A2MX-01,1,27,1
427
+ TCGA-ET-A2MX-11,0,27,1
428
+ TCGA-ET-A2MY-01,1,72,0
429
+ TCGA-ET-A2MY-11,0,72,0
430
+ TCGA-ET-A2MZ-01,1,39,1
431
+ TCGA-ET-A2N0-01,1,51,0
432
+ TCGA-ET-A2N1-01,1,47,0
433
+ TCGA-ET-A2N3-01,1,34,0
434
+ TCGA-ET-A2N4-01,1,53,0
435
+ TCGA-ET-A2N5-01,1,46,0
436
+ TCGA-ET-A2N5-11,0,46,0
437
+ TCGA-ET-A39I-01,1,83,0
438
+ TCGA-ET-A39J-01,1,23,0
439
+ TCGA-ET-A39K-01,1,48,0
440
+ TCGA-ET-A39L-01,1,20,0
441
+ TCGA-ET-A39M-01,1,34,1
442
+ TCGA-ET-A39N-01,1,35,0
443
+ TCGA-ET-A39O-01,1,39,1
444
+ TCGA-ET-A39P-01,1,73,0
445
+ TCGA-ET-A39R-01,1,24,0
446
+ TCGA-ET-A39S-01,1,27,0
447
+ TCGA-ET-A39T-01,1,55,0
448
+ TCGA-ET-A3BN-01,1,33,0
449
+ TCGA-ET-A3BO-01,1,44,0
450
+ TCGA-ET-A3BP-01,1,34,0
451
+ TCGA-ET-A3BQ-01,1,27,0
452
+ TCGA-ET-A3BS-01,1,42,1
453
+ TCGA-ET-A3BT-01,1,60,0
454
+ TCGA-ET-A3BU-01,1,28,1
455
+ TCGA-ET-A3BV-01,1,47,0
456
+ TCGA-ET-A3BW-01,1,30,0
457
+ TCGA-ET-A3BX-01,1,24,1
458
+ TCGA-ET-A3DO-01,1,33,0
459
+ TCGA-ET-A3DP-01,1,43,0
460
+ TCGA-ET-A3DP-11,0,43,0
461
+ TCGA-ET-A3DQ-01,1,43,0
462
+ TCGA-ET-A3DR-01,1,42,0
463
+ TCGA-ET-A3DS-01,1,33,0
464
+ TCGA-ET-A3DT-01,1,23,0
465
+ TCGA-ET-A3DU-01,1,21,0
466
+ TCGA-ET-A3DV-01,1,68,0
467
+ TCGA-ET-A3DW-01,1,64,1
468
+ TCGA-ET-A3DW-11,0,64,1
469
+ TCGA-ET-A40P-01,1,32,0
470
+ TCGA-ET-A40Q-01,1,38,1
471
+ TCGA-ET-A40R-01,1,24,0
472
+ TCGA-ET-A40S-01,1,62,1
473
+ TCGA-ET-A40T-01,1,26,0
474
+ TCGA-ET-A4KN-01,1,51,0
475
+ TCGA-ET-A4KQ-01,1,45,0
476
+ TCGA-FE-A22Z-01,1,61,0
477
+ TCGA-FE-A230-01,1,30,0
478
+ TCGA-FE-A231-01,1,70,1
479
+ TCGA-FE-A232-01,1,44,0
480
+ TCGA-FE-A233-01,1,18,0
481
+ TCGA-FE-A234-01,1,26,0
482
+ TCGA-FE-A235-01,1,26,0
483
+ TCGA-FE-A236-01,1,33,1
484
+ TCGA-FE-A237-01,1,19,0
485
+ TCGA-FE-A238-01,1,36,0
486
+ TCGA-FE-A239-01,1,82,1
487
+ TCGA-FE-A23A-01,1,27,0
488
+ TCGA-FE-A3PA-01,1,16,1
489
+ TCGA-FE-A3PB-01,1,33,0
490
+ TCGA-FE-A3PC-01,1,37,0
491
+ TCGA-FE-A3PD-01,1,17,0
492
+ TCGA-FK-A3S3-01,1,43,0
493
+ TCGA-FK-A3SB-01,1,28,0
494
+ TCGA-FK-A3SD-01,1,61,0
495
+ TCGA-FK-A3SE-01,1,31,0
496
+ TCGA-FK-A3SG-01,1,21,0
497
+ TCGA-FK-A3SH-01,1,50,0
498
+ TCGA-FK-A4UB-01,1,51,1
499
+ TCGA-FY-A2QD-01,1,61,0
500
+ TCGA-FY-A3BL-01,1,29,1
501
+ TCGA-FY-A3I4-01,1,34,0
502
+ TCGA-FY-A3I5-01,1,64,0
503
+ TCGA-FY-A3NM-01,1,48,0
504
+ TCGA-FY-A3NN-01,1,48,0
505
+ TCGA-FY-A3NP-01,1,69,1
506
+ TCGA-FY-A3ON-01,1,20,1
507
+ TCGA-FY-A3R6-01,1,57,0
508
+ TCGA-FY-A3R7-01,1,50,0
509
+ TCGA-FY-A3R8-01,1,62,0
510
+ TCGA-FY-A3R9-01,1,66,0
511
+ TCGA-FY-A3RA-01,1,21,0
512
+ TCGA-FY-A3TY-01,1,61,0
513
+ TCGA-FY-A3TY-11,0,61,0
514
+ TCGA-FY-A3W9-01,1,66,0
515
+ TCGA-FY-A3WA-01,1,52,0
516
+ TCGA-FY-A3YR-01,1,64,0
517
+ TCGA-FY-A40K-01,1,46,0
518
+ TCGA-FY-A40L-01,1,55,0
519
+ TCGA-FY-A40M-01,1,51,0
520
+ TCGA-FY-A40N-01,1,55,0
521
+ TCGA-FY-A4B0-01,1,76,1
522
+ TCGA-FY-A4B3-01,1,51,1
523
+ TCGA-FY-A4B4-01,1,62,0
524
+ TCGA-FY-A76V-01,1,54,1
525
+ TCGA-GE-A2C6-01,1,33,0
526
+ TCGA-GE-A2C6-11,0,33,0
527
+ TCGA-H2-A26U-01,1,54,0
528
+ TCGA-H2-A2K9-01,1,25,1
529
+ TCGA-H2-A2K9-11,0,25,1
530
+ TCGA-H2-A3RH-01,1,41,0
531
+ TCGA-H2-A3RI-01,1,29,0
532
+ TCGA-H2-A3RI-11,0,29,0
533
+ TCGA-H2-A421-01,1,34,0
534
+ TCGA-H2-A422-01,1,40,0
535
+ TCGA-IM-A3EB-01,1,32,0
536
+ TCGA-IM-A3ED-01,1,58,0
537
+ TCGA-IM-A3U2-01,1,89,0
538
+ TCGA-IM-A3U3-01,1,55,0
539
+ TCGA-IM-A41Y-01,1,42,0
540
+ TCGA-IM-A41Z-01,1,37,0
541
+ TCGA-IM-A420-01,1,39,0
542
+ TCGA-IM-A4EB-01,1,37,1
543
+ TCGA-J8-A3NZ-01,1,52,0
544
+ TCGA-J8-A3O0-01,1,38,1
545
+ TCGA-J8-A3O1-01,1,33,0
546
+ TCGA-J8-A3O2-01,1,39,1
547
+ TCGA-J8-A3O2-06,1,39,1
548
+ TCGA-J8-A3YD-01,1,47,0
549
+ TCGA-J8-A3YE-01,1,31,0
550
+ TCGA-J8-A3YF-01,1,83,1
551
+ TCGA-J8-A3YG-01,1,54,0
552
+ TCGA-J8-A3YH-01,1,39,1
553
+ TCGA-J8-A3YH-06,1,39,1
554
+ TCGA-J8-A42S-01,1,45,1
555
+ TCGA-J8-A4HW-01,1,59,0
556
+ TCGA-J8-A4HW-06,1,59,0
557
+ TCGA-J8-A4HY-01,1,68,0
558
+ TCGA-KS-A41F-01,1,37,0
559
+ TCGA-KS-A41I-01,1,47,0
560
+ TCGA-KS-A41I-11,0,47,0
561
+ TCGA-KS-A41J-01,1,28,0
562
+ TCGA-KS-A41J-11,0,28,0
563
+ TCGA-KS-A41L-01,1,39,0
564
+ TCGA-KS-A41L-11,0,39,0
565
+ TCGA-KS-A4I1-01,1,37,0
566
+ TCGA-KS-A4I3-01,1,41,1
567
+ TCGA-KS-A4I5-01,1,49,0
568
+ TCGA-KS-A4I7-01,1,61,0
569
+ TCGA-KS-A4I9-01,1,46,0
570
+ TCGA-KS-A4IB-01,1,41,0
571
+ TCGA-KS-A4IC-01,1,45,0
572
+ TCGA-KS-A4ID-01,1,55,0
573
+ TCGA-L6-A4EP-01,1,41,0
574
+ TCGA-L6-A4EQ-01,1,47,1
575
+ TCGA-L6-A4ET-01,1,49,0
576
+ TCGA-L6-A4EU-01,1,58,0
577
+ TCGA-MK-A4N6-01,1,35,1
578
+ TCGA-MK-A4N7-01,1,20,0
579
+ TCGA-MK-A4N9-01,1,41,0
580
+ TCGA-MK-A84Z-01,1,74,1
581
+ TCGA-QD-A8IV-01,1,50,0
p3/preprocess/Hypothyroidism/code/GSE151158.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Hypothyroidism"
6
+ cohort = "GSE151158"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Hypothyroidism"
10
+ in_cohort_dir = "../DATA/GEO/Hypothyroidism/GSE151158"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Hypothyroidism/GSE151158.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Hypothyroidism/gene_data/GSE151158.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Hypothyroidism/clinical_data/GSE151158.csv"
16
+ json_path = "./output/preprocess/3/Hypothyroidism/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Get background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
23
+
24
+ # Get unique values for each clinical feature
25
+ unique_values_dict = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background information
28
+ print("Background Information:")
29
+ print(background_info)
30
+ print("\nSample Characteristics:")
31
+ print(json.dumps(unique_values_dict, indent=2))
32
+ # 1. Gene Expression Data Availability
33
+ is_gene_available = True # Background shows this is gene expression study of 594 genes
34
+
35
+ # 2.1 Data Availability
36
+ trait_row = 12 # hypothyroidism data found in row 12
37
+ age_row = 1 # age data found in row 1
38
+ gender_row = 2 # gender data found in row 2 as "Sex"
39
+
40
+ # 2.2 Data Type Conversion Functions
41
+ def convert_trait(x):
42
+ if pd.isna(x):
43
+ return None
44
+ value = x.split(": ")[1] if ": " in x else x
45
+ if value.upper() == 'Y':
46
+ return 1
47
+ elif value.upper() == 'N':
48
+ return 0
49
+ return None
50
+
51
+ def convert_age(x):
52
+ if pd.isna(x):
53
+ return None
54
+ try:
55
+ age = int(x.split(": ")[1])
56
+ return age
57
+ except:
58
+ return None
59
+
60
+ def convert_gender(x):
61
+ if pd.isna(x):
62
+ return None
63
+ value = x.split(": ")[1] if ": " in x else x
64
+ if value.upper() == 'F':
65
+ return 0
66
+ elif value.upper() == 'M':
67
+ return 1
68
+ return None
69
+
70
+ # 3. Save Metadata
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=trait_row is not None)
76
+
77
+ # 4. Clinical Feature Extraction
78
+ if trait_row is not None:
79
+ clinical_features_df = geo_select_clinical_features(
80
+ clinical_df=clinical_data,
81
+ trait=trait,
82
+ trait_row=trait_row,
83
+ convert_trait=convert_trait,
84
+ age_row=age_row,
85
+ convert_age=convert_age,
86
+ gender_row=gender_row,
87
+ convert_gender=convert_gender
88
+ )
89
+
90
+ # Preview the data
91
+ preview = preview_df(clinical_features_df)
92
+ print(preview)
93
+
94
+ # Save to CSV
95
+ clinical_features_df.to_csv(out_clinical_data_file)
96
+ # Extract gene expression data from the matrix file
97
+ genetic_data = get_genetic_data(matrix_file_path)
98
+
99
+ # Print first 20 row IDs
100
+ print("First 20 row IDs:")
101
+ print(genetic_data.index[:20].tolist())
102
+ # These IDs are standard HUGO gene symbols - e.g. ABCB1, ABCF1, ABL1 are well-known gene symbols
103
+ # No mapping needed as they are already in the correct format
104
+ requires_gene_mapping = False
105
+ # 1. Normalize gene symbols
106
+ genetic_data = normalize_gene_symbols_in_index(genetic_data)
107
+ genetic_data.to_csv(out_gene_data_file)
108
+
109
+ # Get clinical features
110
+ clinical_features = geo_select_clinical_features(
111
+ clinical_data,
112
+ trait=trait,
113
+ trait_row=trait_row,
114
+ convert_trait=convert_trait,
115
+ age_row=age_row,
116
+ convert_age=convert_age,
117
+ gender_row=gender_row,
118
+ convert_gender=convert_gender
119
+ )
120
+
121
+ # 2. Link clinical and genetic data
122
+ linked_data = geo_link_clinical_genetic_data(clinical_features, genetic_data)
123
+
124
+ # 3. Handle missing values
125
+ linked_data = handle_missing_values(linked_data, trait)
126
+
127
+ # 4. Judge whether features are biased and remove biased demographic features
128
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
129
+
130
+ # 5. Final validation and save metadata
131
+ note = "Dataset contains gene expression data studying hypothyroidism in the context of NAFLD progression, with clinical annotations."
132
+ is_usable = validate_and_save_cohort_info(
133
+ is_final=True,
134
+ cohort=cohort,
135
+ info_path=json_path,
136
+ is_gene_available=True,
137
+ is_trait_available=True,
138
+ is_biased=is_biased,
139
+ df=linked_data,
140
+ note=note
141
+ )
142
+
143
+ # 6. Save the linked data only if it's usable
144
+ if is_usable:
145
+ os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
146
+ linked_data.to_csv(out_data_file)
p3/preprocess/Hypothyroidism/code/GSE224330.py ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Hypothyroidism"
6
+ cohort = "GSE224330"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Hypothyroidism"
10
+ in_cohort_dir = "../DATA/GEO/Hypothyroidism/GSE224330"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Hypothyroidism/GSE224330.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Hypothyroidism/gene_data/GSE224330.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Hypothyroidism/clinical_data/GSE224330.csv"
16
+ json_path = "./output/preprocess/3/Hypothyroidism/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Get background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
23
+
24
+ # Get unique values for each clinical feature
25
+ unique_values_dict = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background information
28
+ print("Background Information:")
29
+ print(background_info)
30
+ print("\nSample Characteristics:")
31
+ print(json.dumps(unique_values_dict, indent=2))
32
+ # Gene expression data availability
33
+ # Yes, this dataset contains gene expression data as indicated by series title and summary
34
+ is_gene_available = True
35
+
36
+ # Data availability and type conversion
37
+ # Trait data (Hypothyroidism) can be extracted from comorbidity field
38
+ trait_row = 3
39
+ def convert_trait(value):
40
+ if pd.isna(value):
41
+ return None
42
+ value = value.split(': ')[1].lower()
43
+ if 'hypothyroidism' in value:
44
+ return 1
45
+ elif 'none' in value:
46
+ return 0
47
+ return None
48
+
49
+ # Age data is in row 1
50
+ age_row = 1
51
+ def convert_age(value):
52
+ if pd.isna(value):
53
+ return None
54
+ try:
55
+ return int(value.split(': ')[1].rstrip('y'))
56
+ except:
57
+ return None
58
+
59
+ # Gender data is in row 2
60
+ gender_row = 2
61
+ def convert_gender(value):
62
+ if pd.isna(value):
63
+ return None
64
+ value = value.split(': ')[1].lower()
65
+ if 'female' in value:
66
+ return 0
67
+ elif 'male' in value:
68
+ return 1
69
+ return None
70
+
71
+ # Save initial filtering results
72
+ validate_and_save_cohort_info(
73
+ is_final=False,
74
+ cohort=cohort,
75
+ info_path=json_path,
76
+ is_gene_available=is_gene_available,
77
+ is_trait_available=trait_row is not None
78
+ )
79
+
80
+ # Extract clinical features since trait_row is available
81
+ clinical_features = geo_select_clinical_features(
82
+ clinical_df=clinical_data,
83
+ trait=trait,
84
+ trait_row=trait_row,
85
+ convert_trait=convert_trait,
86
+ age_row=age_row,
87
+ convert_age=convert_age,
88
+ gender_row=gender_row,
89
+ convert_gender=convert_gender
90
+ )
91
+
92
+ # Preview the extracted features
93
+ preview_df(clinical_features)
94
+
95
+ # Save clinical data
96
+ clinical_features.to_csv(out_clinical_data_file)
97
+ # Extract gene expression data from the matrix file
98
+ genetic_data = get_genetic_data(matrix_file_path)
99
+
100
+ # Print first 20 row IDs
101
+ print("First 20 row IDs:")
102
+ print(genetic_data.index[:20].tolist())
103
+ # These identifiers appear to be Agilent probe IDs, not human gene symbols
104
+ # The format A_19_P00xxxxxx is characteristic of Agilent microarray probes
105
+ # We will need to map these to proper gene symbols
106
+ requires_gene_mapping = True
107
+ # Extract gene annotation data from SOFT file
108
+ gene_metadata = get_gene_annotation(soft_file_path)
109
+
110
+ # Display information about the annotation data
111
+ print("Column names:")
112
+ print(gene_metadata.columns.tolist())
113
+
114
+ # Look at general data statistics
115
+ print("\nData shape:", gene_metadata.shape)
116
+
117
+ # Display non-NaN value counts for key gene identifier columns
118
+ print("\nNumber of non-NaN values in key columns:")
119
+ for col in ['GENE_SYMBOL', 'GENE_NAME']:
120
+ print(f"{col}: {gene_metadata[col].notna().sum()}")
121
+
122
+ # Preview rows with actual gene information
123
+ print("\nPreview of rows with gene information:")
124
+ gene_rows = gene_metadata[gene_metadata['GENE_SYMBOL'].notna()].head()
125
+ print(json.dumps(preview_df(gene_rows), indent=2))
126
+ # Get mapping between probes and gene symbols
127
+ mapping_data = get_gene_mapping(gene_metadata, prob_col='ID', gene_col='GENE_SYMBOL')
128
+
129
+ # Convert probe-level data to gene-level data using the mapping
130
+ gene_data = apply_gene_mapping(genetic_data, mapping_data)
131
+
132
+ # Save gene expression data
133
+ gene_data.to_csv(out_gene_data_file)
134
+
135
+ # Print statistics about the mapping
136
+ print(f"Original probe number: {len(genetic_data)}")
137
+ print(f"Number of probes with gene mapping: {len(mapping_data)}")
138
+ print(f"Final number of genes: {len(gene_data)}")
139
+ # 1. Normalize gene symbols
140
+ genetic_data = normalize_gene_symbols_in_index(gene_data)
141
+ genetic_data.to_csv(out_gene_data_file)
142
+
143
+ # Get clinical features
144
+ clinical_features = geo_select_clinical_features(
145
+ clinical_data,
146
+ trait=trait,
147
+ trait_row=trait_row,
148
+ convert_trait=convert_trait,
149
+ age_row=age_row,
150
+ convert_age=convert_age,
151
+ gender_row=gender_row,
152
+ convert_gender=convert_gender
153
+ )
154
+
155
+ # 2. Link clinical and genetic data
156
+ linked_data = geo_link_clinical_genetic_data(clinical_features, genetic_data)
157
+
158
+ # 3. Handle missing values
159
+ linked_data = handle_missing_values(linked_data, trait)
160
+
161
+ # 4. Judge whether features are biased and remove biased demographic features
162
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
163
+
164
+ # 5. Final validation and save metadata
165
+ note = "Dataset contains gene expression data from breast cancer patients, with clinical annotations including hypothyroidism status."
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_biased,
173
+ df=linked_data,
174
+ note=note
175
+ )
176
+
177
+ # 6. Save the linked data only if it's usable
178
+ if is_usable:
179
+ os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
180
+ linked_data.to_csv(out_data_file)
p3/preprocess/Hypothyroidism/code/GSE32445.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Hypothyroidism"
6
+ cohort = "GSE32445"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Hypothyroidism"
10
+ in_cohort_dir = "../DATA/GEO/Hypothyroidism/GSE32445"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Hypothyroidism/GSE32445.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Hypothyroidism/gene_data/GSE32445.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Hypothyroidism/clinical_data/GSE32445.csv"
16
+ json_path = "./output/preprocess/3/Hypothyroidism/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Get background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
23
+
24
+ # Get unique values for each clinical feature
25
+ unique_values_dict = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background information
28
+ print("Background Information:")
29
+ print(background_info)
30
+ print("\nSample Characteristics:")
31
+ print(json.dumps(unique_values_dict, indent=2))
32
+ # 1. Gene Expression Data Availability
33
+ # The series title and description suggest this is a study involving gene regulation,
34
+ # so it's likely to have gene expression data
35
+ is_gene_available = True
36
+
37
+ # 2. Variable Availability and Data Type Conversion
38
+
39
+ # 2.1 Data Availability
40
+ # Trait: Not directly available in characteristics - cannot be inferred from strain alone
41
+ trait_row = None
42
+
43
+ # Age: Available in row 2
44
+ age_row = 2
45
+
46
+ # Gender: Available in row 1
47
+ gender_row = 1
48
+
49
+ # 2.2 Data Type Conversion
50
+ # Trait converter not needed since trait data not available
51
+ def convert_trait(x):
52
+ return None
53
+
54
+ # Age converter - continuous
55
+ def convert_age(x):
56
+ try:
57
+ # Extract value after colon and remove 'months'/'years'
58
+ value = x.split(':')[1].strip()
59
+ value = value.lower().replace('months', '').replace('years', '').strip()
60
+ return float(value)
61
+ except:
62
+ return None
63
+
64
+ # Gender converter - binary (female=0, male=1)
65
+ def convert_gender(x):
66
+ try:
67
+ value = x.split(':')[1].strip().lower()
68
+ if 'female' in value:
69
+ return 0
70
+ elif 'male' in value:
71
+ return 1
72
+ return None
73
+ except:
74
+ return None
75
+
76
+ # 3. Save Metadata
77
+ # Initial filtering - trait data not available so dataset will be filtered out
78
+ validate_and_save_cohort_info(
79
+ is_final=False,
80
+ cohort=cohort,
81
+ info_path=json_path,
82
+ is_gene_available=is_gene_available,
83
+ is_trait_available=False
84
+ )
85
+
86
+ # 4. Clinical Feature Extraction
87
+ # Skip since trait_row is None
88
+ # Extract gene expression data from the matrix file
89
+ genetic_data = get_genetic_data(matrix_file_path)
90
+
91
+ # Print first 20 row IDs
92
+ print("First 20 row IDs:")
93
+ print(genetic_data.index[:20].tolist())
94
+ # The row IDs are Illumina probe IDs (starting with 'ILMN_') rather than human gene symbols
95
+ # These need to be mapped to gene symbols for analysis
96
+ requires_gene_mapping = True
97
+ # Extract gene annotation data from SOFT file
98
+ gene_metadata = get_gene_annotation(soft_file_path)
99
+
100
+ # Display information about the annotation data
101
+ print("Column names:")
102
+ print(gene_metadata.columns.tolist())
103
+
104
+ # Look at general data statistics
105
+ print("\nData shape:", gene_metadata.shape)
106
+
107
+ # Display non-NaN value counts for key gene identifier columns
108
+ print("\nNumber of non-NaN values in key columns:")
109
+ for col in ['Gene Symbol', 'Gene Title']:
110
+ print(f"{col}: {gene_metadata[col].notna().sum()}")
111
+
112
+ # Preview rows with actual gene information
113
+ print("\nPreview of rows with gene information:")
114
+ gene_rows = gene_metadata[gene_metadata['Gene Symbol'].notna()].head()
115
+ print(json.dumps(preview_df(gene_rows), indent=2))
116
+ # Extract gene mapping information from gene annotation data
117
+ # Split multiple gene symbols and expand them
118
+ mapping_data = gene_metadata.loc[:, ['ID', 'Gene Symbol']]
119
+ mapping_data = mapping_data.dropna()
120
+ # Rename column to match expected name in apply_gene_mapping function
121
+ mapping_data = mapping_data.rename(columns={'Gene Symbol': 'Gene'})
122
+
123
+ # Apply the mapping to get gene-level expression data
124
+ gene_data = apply_gene_mapping(genetic_data, mapping_data)
125
+
126
+ # Preview the results
127
+ print("\nNumber of genes after mapping:", len(gene_data))
128
+ print("\nFirst few gene symbols:", gene_data.index[:10].tolist())
129
+ # Create an empty DataFrame to represent unusable data
130
+ empty_df = pd.DataFrame()
131
+
132
+ # Record that this dataset is unusable
133
+ note = "Dataset lacks trait information and gene mapping failed to produce any valid gene expression data."
134
+ is_usable = validate_and_save_cohort_info(
135
+ is_final=True,
136
+ cohort=cohort,
137
+ info_path=json_path,
138
+ is_gene_available=True,
139
+ is_trait_available=False,
140
+ is_biased=True, # Set to True to indicate the data is unusable
141
+ df=empty_df, # Provide empty DataFrame instead of None
142
+ note=note
143
+ )
p3/preprocess/Hypothyroidism/code/GSE75678.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Hypothyroidism"
6
+ cohort = "GSE75678"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Hypothyroidism"
10
+ in_cohort_dir = "../DATA/GEO/Hypothyroidism/GSE75678"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Hypothyroidism/GSE75678.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Hypothyroidism/gene_data/GSE75678.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Hypothyroidism/clinical_data/GSE75678.csv"
16
+ json_path = "./output/preprocess/3/Hypothyroidism/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Get background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
23
+
24
+ # Get unique values for each clinical feature
25
+ unique_values_dict = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background information
28
+ print("Background Information:")
29
+ print(background_info)
30
+ print("\nSample Characteristics:")
31
+ print(json.dumps(unique_values_dict, indent=2))
32
+ # 1. Gene Expression Data Availability
33
+ is_gene_available = True # Based on series title and summary indicating gene expression data
34
+
35
+ # 2. Variable Availability and Data Type Conversion
36
+ # Hypothyroidism data is in row 21 (personal pathological history)
37
+ trait_row = 21
38
+ age_row = 19 # Age at diagnosis
39
+ gender_row = 1 # Gender data is in row 1
40
+
41
+ def convert_trait(x):
42
+ if pd.isna(x):
43
+ return None
44
+ val = x.split(': ')[1] if ': ' in x else x
45
+ if 'Hypothyroidism' in val:
46
+ return 1
47
+ return 0
48
+
49
+ def convert_age(x):
50
+ if pd.isna(x):
51
+ return None
52
+ val = x.split(': ')[1] if ': ' in x else x
53
+ try:
54
+ return float(val)
55
+ except:
56
+ return None
57
+
58
+ def convert_gender(x):
59
+ if pd.isna(x):
60
+ return None
61
+ val = x.split(': ')[1] if ': ' in x else x
62
+ if val.lower() == 'female':
63
+ return 0
64
+ elif val.lower() == 'male':
65
+ return 1
66
+ return None
67
+
68
+ # 3. Save Metadata
69
+ is_usable = validate_and_save_cohort_info(
70
+ is_final=False,
71
+ cohort=cohort,
72
+ info_path=json_path,
73
+ is_gene_available=is_gene_available,
74
+ is_trait_available=trait_row is not None
75
+ )
76
+
77
+ # 4. Clinical Feature Extraction
78
+ selected_clinical = geo_select_clinical_features(
79
+ clinical_df=clinical_data,
80
+ trait=trait,
81
+ trait_row=trait_row,
82
+ convert_trait=convert_trait,
83
+ age_row=age_row,
84
+ convert_age=convert_age,
85
+ gender_row=gender_row,
86
+ convert_gender=convert_gender
87
+ )
88
+
89
+ # Preview and save clinical data
90
+ print(preview_df(selected_clinical))
91
+ selected_clinical.to_csv(out_clinical_data_file)
92
+ # Extract gene expression data from the matrix file
93
+ genetic_data = get_genetic_data(matrix_file_path)
94
+
95
+ # Print first 20 row IDs
96
+ print("First 20 row IDs:")
97
+ print(genetic_data.index[:20].tolist())
98
+ # Looking at the row IDs, they appear to be simple numeric indices rather than gene symbols
99
+ # This indicates we need to map these identifiers to actual gene symbols
100
+ requires_gene_mapping = True
101
+ # Extract gene annotation data from SOFT file
102
+ gene_metadata = get_gene_annotation(soft_file_path)
103
+
104
+ # Display information about the annotation data
105
+ print("Column names:")
106
+ print(gene_metadata.columns.tolist())
107
+
108
+ # Look at general data statistics
109
+ print("\nData shape:", gene_metadata.shape)
110
+
111
+ # Display non-NaN value counts for key gene identifier columns
112
+ print("\nNumber of non-NaN values in key columns:")
113
+ for col in ['GENE', 'GENE_SYMBOL', 'GENE_NAME']:
114
+ print(f"{col}: {gene_metadata[col].notna().sum()}")
115
+
116
+ # Preview rows with actual gene information
117
+ print("\nPreview of rows with gene information:")
118
+ gene_rows = gene_metadata[gene_metadata['GENE_SYMBOL'].notna()].head()
119
+ print(json.dumps(preview_df(gene_rows), indent=2))
120
+ # Extract mapping between numeric IDs and gene symbols from annotation data
121
+ mapping_df = get_gene_mapping(gene_metadata, 'ID', 'GENE_SYMBOL')
122
+
123
+ # Convert probe-level measurements to gene expression data
124
+ gene_data = apply_gene_mapping(genetic_data, mapping_df)
125
+
126
+ # Preview the gene data shape
127
+ print("Gene expression data shape:", gene_data.shape)
128
+
129
+ # Preview first few gene symbols and samples
130
+ print("\nFirst few gene symbols:", gene_data.index[:5].tolist())
131
+ print("\nFirst few samples:", gene_data.columns[:5].tolist())
132
+ # 1. Normalize gene symbols
133
+ genetic_data = normalize_gene_symbols_in_index(gene_data)
134
+ genetic_data.to_csv(out_gene_data_file)
135
+
136
+ # Get clinical features
137
+ clinical_features = geo_select_clinical_features(
138
+ clinical_data,
139
+ trait=trait,
140
+ trait_row=trait_row,
141
+ convert_trait=convert_trait,
142
+ age_row=age_row,
143
+ convert_age=convert_age,
144
+ gender_row=gender_row,
145
+ convert_gender=convert_gender
146
+ )
147
+
148
+ # 2. Link clinical and genetic data
149
+ linked_data = geo_link_clinical_genetic_data(clinical_features, genetic_data)
150
+
151
+ # 3. Handle missing values
152
+ linked_data = handle_missing_values(linked_data, trait)
153
+
154
+ # 4. Judge whether features are biased and remove biased demographic features
155
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
156
+
157
+ # 5. Final validation and save metadata
158
+ note = "Dataset contains gene expression data from breast cancer patients, with clinical annotations including hypothyroidism status."
159
+ is_usable = validate_and_save_cohort_info(
160
+ is_final=True,
161
+ cohort=cohort,
162
+ info_path=json_path,
163
+ is_gene_available=True,
164
+ is_trait_available=True,
165
+ is_biased=is_biased,
166
+ df=linked_data,
167
+ note=note
168
+ )
169
+
170
+ # 6. Save the linked data only if it's usable
171
+ if is_usable:
172
+ os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
173
+ linked_data.to_csv(out_data_file)
p3/preprocess/Hypothyroidism/code/GSE75685.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Hypothyroidism"
6
+ cohort = "GSE75685"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Hypothyroidism"
10
+ in_cohort_dir = "../DATA/GEO/Hypothyroidism/GSE75685"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Hypothyroidism/GSE75685.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Hypothyroidism/gene_data/GSE75685.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Hypothyroidism/clinical_data/GSE75685.csv"
16
+ json_path = "./output/preprocess/3/Hypothyroidism/cohort_info.json"
17
+
18
+ # Get file paths
19
+ soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
20
+
21
+ # Get background info and clinical data
22
+ background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
23
+
24
+ # Get unique values for each clinical feature
25
+ unique_values_dict = get_unique_values_by_row(clinical_data)
26
+
27
+ # Print background information
28
+ print("Background Information:")
29
+ print(background_info)
30
+ print("\nSample Characteristics:")
31
+ print(json.dumps(unique_values_dict, indent=2))
32
+ # 1. Gene expression data availability check
33
+ # Study description suggests this is a breast cancer study with tumor samples
34
+ # There is RNA concentration and quality data (RQI Experion)
35
+ is_gene_available = True
36
+
37
+ # 2.1 Data row identification
38
+ trait_row = 21 # personal pathological history has 'Hypothyroidism' data
39
+ age_row = 19 # 'age at diagnosis'
40
+ gender_row = 1 # gender information
41
+
42
+ # 2.2 Data type conversion functions
43
+ def convert_trait(value):
44
+ if pd.isna(value):
45
+ return None
46
+ value = value.split(': ')[-1]
47
+ return 1 if value == 'Hypothyroidism' else 0
48
+
49
+ def convert_age(value):
50
+ if pd.isna(value):
51
+ return None
52
+ try:
53
+ age = int(value.split(': ')[-1])
54
+ return age
55
+ except:
56
+ return None
57
+
58
+ def convert_gender(value):
59
+ if pd.isna(value):
60
+ return None
61
+ value = value.split(': ')[-1].lower()
62
+ if 'female' in value:
63
+ return 0
64
+ elif 'male' in value:
65
+ return 1
66
+ return None
67
+
68
+ # 3. Save metadata about dataset usability
69
+ validate_and_save_cohort_info(
70
+ is_final=False,
71
+ cohort=cohort,
72
+ info_path=json_path,
73
+ is_gene_available=is_gene_available,
74
+ is_trait_available=trait_row is not None
75
+ )
76
+
77
+ # 4. Clinical feature extraction
78
+ clinical_features = geo_select_clinical_features(
79
+ clinical_df=clinical_data,
80
+ trait=trait,
81
+ trait_row=trait_row,
82
+ convert_trait=convert_trait,
83
+ age_row=age_row,
84
+ convert_age=convert_age,
85
+ gender_row=gender_row,
86
+ convert_gender=convert_gender
87
+ )
88
+
89
+ # Preview and save clinical features
90
+ print("Preview of extracted clinical features:")
91
+ print(preview_df(clinical_features))
92
+ clinical_features.to_csv(out_clinical_data_file)
93
+ # Extract gene expression data from the matrix file
94
+ genetic_data = get_genetic_data(matrix_file_path)
95
+
96
+ # Print first 20 row IDs
97
+ print("First 20 row IDs:")
98
+ print(genetic_data.index[:20].tolist())
99
+ # The row IDs are numerical indices, not gene symbols or other identifiers
100
+ # Therefore, gene mapping will be required to convert these to meaningful gene symbols
101
+ requires_gene_mapping = True
102
+ # Extract gene annotation data from SOFT file
103
+ gene_metadata = get_gene_annotation(soft_file_path)
104
+
105
+ # Display information about the annotation data
106
+ print("Column names:")
107
+ print(gene_metadata.columns.tolist())
108
+ print("\nPreview of first few rows:")
109
+ print(json.dumps(preview_df(gene_metadata), indent=2))
110
+ # Extract gene ID and gene symbol columns from annotation data
111
+ mapping_data = get_gene_mapping(gene_metadata, prob_col='ID', gene_col='GENE_SYMBOL')
112
+
113
+ # Convert probe-level measurements to gene-level expression data
114
+ gene_data = apply_gene_mapping(genetic_data, mapping_data)
115
+
116
+ # Preview result
117
+ print("\nPreview of first few genes and their expression values:")
118
+ print(preview_df(gene_data))
119
+ # 1. Normalize gene symbols
120
+ genetic_data = normalize_gene_symbols_in_index(gene_data)
121
+ genetic_data.to_csv(out_gene_data_file)
122
+
123
+ # Get clinical features
124
+ clinical_features = geo_select_clinical_features(
125
+ clinical_data,
126
+ trait=trait,
127
+ trait_row=trait_row,
128
+ convert_trait=convert_trait,
129
+ age_row=age_row,
130
+ convert_age=convert_age,
131
+ gender_row=gender_row,
132
+ convert_gender=convert_gender
133
+ )
134
+
135
+ # 2. Link clinical and genetic data
136
+ linked_data = geo_link_clinical_genetic_data(clinical_features, genetic_data)
137
+
138
+ # 3. Handle missing values
139
+ linked_data = handle_missing_values(linked_data, trait)
140
+
141
+ # 4. Judge whether features are biased and remove biased demographic features
142
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
143
+
144
+ # 5. Final validation and save metadata
145
+ note = "Dataset contains gene expression data from breast cancer patients, with clinical annotations including hypothyroidism status."
146
+ is_usable = validate_and_save_cohort_info(
147
+ is_final=True,
148
+ cohort=cohort,
149
+ info_path=json_path,
150
+ is_gene_available=True,
151
+ is_trait_available=True,
152
+ is_biased=is_biased,
153
+ df=linked_data,
154
+ note=note
155
+ )
156
+
157
+ # 6. Save the linked data only if it's usable
158
+ if is_usable:
159
+ os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
160
+ linked_data.to_csv(out_data_file)
p3/preprocess/Hypothyroidism/code/TCGA.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Hypothyroidism"
6
+
7
+ # Input paths
8
+ tcga_root_dir = "../DATA/TCGA"
9
+
10
+ # Output paths
11
+ out_data_file = "./output/preprocess/3/Hypothyroidism/TCGA.csv"
12
+ out_gene_data_file = "./output/preprocess/3/Hypothyroidism/gene_data/TCGA.csv"
13
+ out_clinical_data_file = "./output/preprocess/3/Hypothyroidism/clinical_data/TCGA.csv"
14
+ json_path = "./output/preprocess/3/Hypothyroidism/cohort_info.json"
15
+
16
+ # Get subdirectories from TCGA root directory
17
+ tcga_subdirs = os.listdir(tcga_root_dir)
18
+ tcga_subdirs = [d for d in tcga_subdirs if not d.startswith('.')]
19
+
20
+ # Select thyroid cancer cohort as most relevant for hypothyroidism
21
+ selected_dir = "TCGA_Thyroid_Cancer_(THCA)"
22
+ cohort_dir = os.path.join(tcga_root_dir, selected_dir)
23
+
24
+ # Get clinical and genetic data file paths
25
+ clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
26
+
27
+ # Load the data files
28
+ clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
29
+ genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
30
+
31
+ # Print clinical data columns for inspection
32
+ print("Clinical data columns:")
33
+ print(clinical_df.columns.tolist())
34
+ # Part 1: Define candidate columns
35
+ candidate_age_cols = ['age_at_initial_pathologic_diagnosis', 'days_to_birth']
36
+ candidate_gender_cols = ['gender']
37
+
38
+ # Part 2: Preview existing clinical data
39
+ # Print age columns preview
40
+ age_preview = {}
41
+ for col in candidate_age_cols:
42
+ age_preview[col] = clinical_df[col].head().tolist()
43
+ print("Age columns preview:", age_preview)
44
+
45
+ # Print gender columns preview
46
+ gender_preview = {}
47
+ for col in candidate_gender_cols:
48
+ gender_preview[col] = clinical_df[col].head().tolist()
49
+ print("Gender columns preview:", gender_preview)
50
+ # Selecting age column
51
+ age_col = "age_at_initial_pathologic_diagnosis" # Contains direct age values, easier to interpret than days_to_birth
52
+
53
+ # Selecting gender column
54
+ gender_col = "gender" # Contains standard gender values
55
+
56
+ # Print chosen columns
57
+ print(f"Selected age column: {age_col}")
58
+ print(f"Selected gender column: {gender_col}")
59
+ # Extract and standardize clinical features
60
+ selected_clinical_df = tcga_select_clinical_features(clinical_df, trait, age_col, gender_col)
61
+ selected_clinical_df.to_csv(out_clinical_data_file)
62
+
63
+ # Normalize gene symbols and save
64
+ normalized_genetic_df = normalize_gene_symbols_in_index(genetic_df)
65
+ normalized_genetic_df.to_csv(out_gene_data_file)
66
+
67
+ # Link clinical and genetic data
68
+ linked_data = pd.concat([selected_clinical_df, normalized_genetic_df.T], axis=1)
69
+
70
+ # Handle missing values
71
+ linked_data = handle_missing_values(linked_data, trait)
72
+
73
+ # Judge whether features are biased and remove biased demographic features
74
+ trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
75
+
76
+ # Final validation and save cohort info
77
+ note = "Used thyroid cancer (THCA) data as thyroid disorders are closely related to hypothyroidism"
78
+ is_usable = validate_and_save_cohort_info(
79
+ is_final=True,
80
+ cohort="TCGA",
81
+ info_path=json_path,
82
+ is_gene_available=True,
83
+ is_trait_available=True,
84
+ is_biased=trait_biased,
85
+ df=linked_data,
86
+ note=note
87
+ )
88
+
89
+ # Save linked data if usable
90
+ if is_usable:
91
+ linked_data.to_csv(out_data_file)
p3/preprocess/Hypothyroidism/cohort_info.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"GSE75685": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": true, "has_gender": false, "sample_size": 54, "note": "Dataset contains gene expression data from breast cancer patients, with clinical annotations including hypothyroidism status."}, "GSE75678": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": true, "has_gender": false, "sample_size": 54, "note": "Dataset contains gene expression data from breast cancer patients, with clinical annotations including hypothyroidism status."}, "GSE32445": {"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": "Dataset lacks trait information and gene mapping failed to produce any valid gene expression data."}, "GSE224330": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": true, "has_gender": true, "sample_size": 15, "note": "Dataset contains gene expression data from breast cancer patients, with clinical annotations including hypothyroidism status."}, "GSE151158": {"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": 61, "note": "Dataset contains gene expression data studying hypothyroidism in the context of NAFLD progression, with clinical annotations."}, "TCGA": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": true, "has_gender": true, "sample_size": 572, "note": "Used thyroid cancer (THCA) data as thyroid disorders are closely related to hypothyroidism"}}
p3/preprocess/Hypothyroidism/gene_data/GSE151158.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Hypothyroidism/gene_data/GSE224330.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Hypothyroidism/gene_data/GSE32445.csv ADDED
@@ -0,0 +1 @@
 
 
1
+ Gene,GSM802773,GSM802774,GSM802775,GSM802776,GSM802777,GSM802778,GSM802779,GSM802780,GSM802781,GSM802782,GSM802783,GSM802784,GSM802785,GSM802786,GSM802787,GSM802788,GSM802789,GSM802790,GSM802791,GSM802792,GSM802793,GSM802794,GSM802795,GSM802796,GSM802797,GSM802798
p3/preprocess/Hypothyroidism/gene_data/GSE75685.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Insomnia/clinical_data/GSE208668.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM6360934,GSM6360935,GSM6360936,GSM6360937,GSM6360938,GSM6360939,GSM6360940,GSM6360941,GSM6360942,GSM6360943,GSM6360944,GSM6360945,GSM6360946,GSM6360947,GSM6360948,GSM6360949,GSM6360950,GSM6360951,GSM6360952,GSM6360953,GSM6360954,GSM6360955,GSM6360956,GSM6360957,GSM6360958,GSM6360959,GSM6360960,GSM6360961,GSM6360962,GSM6360963,GSM6360964,GSM6360965,GSM6360966,GSM6360967,GSM6360968,GSM6360969,GSM6360970,GSM6360971,GSM6360972,GSM6360973,GSM6360974,GSM6360975
2
+ Insomnia,1.0,1.0,1.0,1.0,1.0,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
3
+ Age,65.0,75.0,77.0,64.0,60.0,67.0,72.0,62.0,73.0,74.0,73.0,68.0,62.0,73.0,70.0,60.0,61.0,66.0,69.0,62.0,67.0,62.0,71.0,63.0,62.0,61.0,67.0,78.0,79.0,72.0,73.0,77.0,72.0,62.0,70.0,65.0,63.0,74.0,71.0,80.0,78.0,65.0
4
+ Gender,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0
p3/preprocess/Insomnia/cohort_info.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"GSE208668": {"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": 42, "note": "Dataset contains genome-wide transcriptional profiling of PBMCs from older adults with and without insomnia disorder."}, "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/Lower_Grade_Glioma/gene_data/GSE107850.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8cfc4c9142d4576bda39c238fd7300590dcdb3a81d4dc746610a06c4c8c0fcae
3
+ size 47672138
p3/preprocess/Lower_Grade_Glioma/gene_data/GSE35158.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31a56ec47b70442242e56b75ae792ea031c6450fbee615649d0a1b1550930085
3
+ size 12648522
p3/preprocess/Lower_Grade_Glioma/gene_data/GSE74567.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Pancreatic_Cancer/GSE125158.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Pancreatic_Cancer/GSE130563.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97d780606b862ee8e980d297e0f8e1abe5c470ba763f5201d693cf991d7e883a
3
+ size 10970181
p3/preprocess/Pancreatic_Cancer/GSE131027.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d5ab692ea51f69d8385adb7393e47bb330a8196ba31924f2cfa336a641a16f1
3
+ size 24380321
p3/preprocess/Pancreatic_Cancer/GSE183795.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec6d16da8518cc99e32797619bb8ce228eb07b0429479734189bbd22920246f7
3
+ size 66229403
p3/preprocess/Pancreatic_Cancer/GSE236951.csv ADDED
The diff for this file is too large to render. See raw diff
 
p3/preprocess/Pancreatic_Cancer/clinical_data/GSE130563.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM3743555,GSM3743556,GSM3743557,GSM3743558,GSM3743559,GSM3743560,GSM3743561,GSM3743562,GSM3743563,GSM3743564,GSM3743565,GSM3743566,GSM3743567,GSM3743568,GSM3743569,GSM3743570,GSM3743571,GSM3743572,GSM3743573,GSM3743574,GSM3743575,GSM3743576,GSM3743577,GSM3743578,GSM3743579,GSM3743580,GSM3743581,GSM3743582,GSM3743583,GSM3743584,GSM3743585,GSM3743586,GSM3743587,GSM3743588,GSM3743589,GSM3743590,GSM3743591,GSM3743592,GSM3743593,GSM3743594,GSM3743595,GSM3743596,GSM3743597,GSM3743598,GSM3743599,GSM3743600
2
+ Pancreatic_Cancer,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,,,,,,,,
3
+ Age,33.0,68.0,73.0,49.0,78.0,57.0,55.0,50.0,47.0,63.0,51.0,50.0,69.0,50.0,60.0,68.0,66.0,54.0,64.0,76.0,68.0,73.0,56.0,80.0,68.0,79.0,72.0,52.0,74.0,74.0,55.0,56.0,77.0,70.0,70.0,63.0,59.0,74.0,30.0,51.0,55.0,55.0,45.0,58.0,50.0,54.0
4
+ Gender,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0
p3/preprocess/Pancreatic_Cancer/clinical_data/GSE131027.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ,GSM3759992,GSM3759993,GSM3759994,GSM3759995,GSM3759996,GSM3759997,GSM3759998,GSM3759999,GSM3760000,GSM3760001,GSM3760002,GSM3760003,GSM3760004,GSM3760005,GSM3760006,GSM3760007,GSM3760008,GSM3760009,GSM3760010,GSM3760011,GSM3760012,GSM3760013,GSM3760014,GSM3760015,GSM3760016,GSM3760017,GSM3760018,GSM3760019,GSM3760020,GSM3760021,GSM3760022,GSM3760023,GSM3760024,GSM3760025,GSM3760026,GSM3760027,GSM3760028,GSM3760029,GSM3760030,GSM3760031,GSM3760032,GSM3760033,GSM3760034,GSM3760035,GSM3760036,GSM3760037,GSM3760038,GSM3760039,GSM3760040,GSM3760041,GSM3760042,GSM3760043,GSM3760044,GSM3760045,GSM3760046,GSM3760047,GSM3760048,GSM3760049,GSM3760050,GSM3760051,GSM3760052,GSM3760053,GSM3760054,GSM3760055,GSM3760056,GSM3760057,GSM3760058,GSM3760059,GSM3760060,GSM3760061,GSM3760062,GSM3760063,GSM3760064,GSM3760065,GSM3760066,GSM3760067,GSM3760068,GSM3760069,GSM3760070,GSM3760071,GSM3760072,GSM3760073,GSM3760074,GSM3760075,GSM3760076,GSM3760077,GSM3760078,GSM3760079,GSM3760080,GSM3760081,GSM3760082,GSM3760083
2
+ Pancreatic_Cancer,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,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,0.0,0.0,0.0,0.0,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,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
p3/preprocess/Pancreatic_Cancer/clinical_data/GSE183795.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ,GSM5570968,GSM5570969,GSM5570970,GSM5570971,GSM5570972,GSM5570973,GSM5570974,GSM5570975,GSM5570976,GSM5570977,GSM5570978,GSM5570979,GSM5570980,GSM5570981,GSM5570982,GSM5570983,GSM5570984,GSM5570985,GSM5570986,GSM5570987,GSM5570988,GSM5570989,GSM5570990,GSM5570991,GSM5570992,GSM5570993,GSM5570994,GSM5570995,GSM5570996,GSM5570997,GSM5570998,GSM5570999,GSM5571000,GSM5571001,GSM5571002,GSM5571003,GSM5571004,GSM5571005,GSM5571006,GSM5571007,GSM5571008,GSM5571009,GSM5571010,GSM5571011,GSM5571012,GSM5571013,GSM5571014,GSM5571015,GSM5571016,GSM5571017,GSM5571018,GSM5571019,GSM5571020,GSM5571021,GSM5571022,GSM5571023,GSM5571024,GSM5571025,GSM5571026,GSM5571027,GSM5571028,GSM5571029,GSM5571030,GSM5571031,GSM5571032,GSM5571033,GSM5571034,GSM5571035,GSM5571036,GSM5571037,GSM5571038,GSM5571039,GSM5571040,GSM5571041,GSM5571042,GSM5571043,GSM5571044,GSM5571045,GSM5571046,GSM5571047,GSM5571048,GSM5571049,GSM5571050,GSM5571051,GSM5571052,GSM5571053,GSM5571054,GSM5571055,GSM5571056,GSM5571057,GSM5571058,GSM5571059,GSM5571060,GSM5571061,GSM5571062,GSM5571063,GSM5571064,GSM5571065,GSM5571066,GSM5571067,GSM5571068,GSM5571069,GSM5571070,GSM5571071,GSM5571072,GSM5571073,GSM5571074,GSM5571075,GSM5571076,GSM5571077,GSM5571078,GSM5571079,GSM5571080,GSM5571081,GSM5571082,GSM5571083,GSM5571084,GSM5571085,GSM5571086,GSM5571087,GSM5571088,GSM5571089,GSM5571090,GSM5571091,GSM5571092,GSM5571093,GSM5571094,GSM5571095,GSM5571096,GSM5571097,GSM5571098,GSM5571099,GSM5571100,GSM5571101,GSM5571102,GSM5571103,GSM5571104,GSM5571105,GSM5571106,GSM5571107,GSM5571108,GSM5571109,GSM5571110,GSM5571111,GSM5571112,GSM5571113,GSM5571114,GSM5571115,GSM5571116,GSM5571117,GSM5571118,GSM5571119,GSM5571120,GSM5571121,GSM5571122,GSM5571123,GSM5571124,GSM5571125,GSM5571126,GSM5571127,GSM5571128,GSM5571129,GSM5571130,GSM5571131,GSM5571132,GSM5571133,GSM5571134,GSM5571135,GSM5571136,GSM5571137,GSM5571138,GSM5571139,GSM5571140,GSM5571141,GSM5571142,GSM5571143,GSM5571144,GSM5571145,GSM5571146,GSM5571147,GSM5571148,GSM5571149,GSM5571150,GSM5571151,GSM5571152,GSM5571153,GSM5571154,GSM5571155,GSM5571156,GSM5571157,GSM5571158,GSM5571159,GSM5571160,GSM5571161,GSM5571162,GSM5571163,GSM5571164,GSM5571165,GSM5571166,GSM5571167,GSM5571168,GSM5571169,GSM5571170,GSM5571171,GSM5571172,GSM5571173,GSM5571174,GSM5571175,GSM5571176,GSM5571177,GSM5571178,GSM5571179,GSM5571180,GSM5571181,GSM5571182,GSM5571183,GSM5571184,GSM5571185,GSM5571186,GSM5571187,GSM5571188,GSM5571189,GSM5571190,GSM5571191,GSM5571192,GSM5571193,GSM5571194,GSM5571195,GSM5571196,GSM5571197,GSM5571198,GSM5571199,GSM5571200,GSM5571201,GSM5571202,GSM5571203,GSM5571204,GSM5571205,GSM5571206,GSM5571207,GSM5571208,GSM5571209,GSM5571210,GSM5571211
2
+ Pancreatic_Cancer,1.0,1.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,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.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,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.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,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,1.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,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.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,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0
p3/preprocess/Pancreatic_Cancer/clinical_data/GSE222788.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ,GSM6932288,GSM6932289,GSM6932290,GSM6932291,GSM6932292,GSM6932293,GSM6932294,GSM6932295,GSM6932296,GSM6932297,GSM6932298,GSM6932299,GSM6932300,GSM6932301,GSM6932302,GSM6932303,GSM6932304,GSM6932305,GSM6932306,GSM6932307,GSM6932308,GSM6932309,GSM6932310,GSM6932311,GSM6932312,GSM6932313,GSM6932314,GSM6932315,GSM6932316,GSM6932317,GSM6932318,GSM6932319,GSM6932320,GSM6932321,GSM6932322,GSM6932323,GSM6932324,GSM6932325,GSM6932326,GSM6932327,GSM6932328
2
+ Pancreatic_Cancer,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
p3/preprocess/Pancreatic_Cancer/clinical_data/GSE223409.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ,GSM6947318,GSM6947319,GSM6947320,GSM6947321,GSM6947322,GSM6947323,GSM6947324,GSM6947325,GSM6947326,GSM6947327,GSM6947328,GSM6947329,GSM6947330,GSM6947331,GSM6947332
2
+ Pancreatic_Cancer,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0
p3/preprocess/Pancreatic_Cancer/clinical_data/GSE236951.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ,GSM7587683,GSM7587684,GSM7587685,GSM7587686,GSM7587687,GSM7587688,GSM7587689,GSM7587690,GSM7587691,GSM7587692,GSM7587693,GSM7587694,GSM7587695,GSM7587696,GSM7587697,GSM7587698,GSM7587699,GSM7587700,GSM7587701,GSM7587702,GSM7587703,GSM7587704,GSM7587705,GSM7587706,GSM7587707,GSM7587708,GSM7587709,GSM7587710,GSM7587711,GSM7587712,GSM7587713,GSM7587714,GSM7587715,GSM7587716
2
+ Pancreatic_Cancer,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,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,83.0,64.0,59.0,64.0,72.0,72.0,89.0,59.0,64.0,82.0,75.0,61.0,59.0,68.0,49.0,71.0,68.0,58.0,76.0,67.0,52.0,57.0,72.0,59.0,53.0,95.0,53.0,55.0,43.0,71.0,48.0,43.0,55.0,63.0
4
+ Gender,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0
p3/preprocess/Pancreatic_Cancer/code/GSE120127.py ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE120127"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE120127"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE120127.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE120127.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE120127.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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 series title and genotype info, this appears to be gene expression data from pancreatic cancer cell lines
38
+ is_gene_available = True
39
+
40
+ # 2. Variable Availability and Data Type Conversion
41
+ # 2.1 Data Availability
42
+ # Trait can be inferred from genotype (feature 2) - KrasG12D vs KO
43
+ trait_row = 2
44
+
45
+ # Gender can be found in feature 0
46
+ gender_row = 0
47
+
48
+ # Age not available for cell lines
49
+ age_row = None
50
+
51
+ # 2.2 Data Type Conversion Functions
52
+ def convert_trait(value):
53
+ """Convert genotype to binary trait"""
54
+ if not value or not isinstance(value, str):
55
+ return None
56
+ value = value.split(': ')[-1].strip()
57
+ # Bap1 KO vs WT
58
+ if 'KO' in value:
59
+ return 1
60
+ elif 'WT' in value:
61
+ return 0
62
+ return None
63
+
64
+ def convert_gender(value):
65
+ """Convert gender to binary"""
66
+ if not value or not isinstance(value, str):
67
+ return None
68
+ value = value.split(': ')[-1].strip().upper()
69
+ if value == 'F':
70
+ return 0
71
+ elif value == 'M':
72
+ return 1
73
+ return None
74
+
75
+ convert_age = None
76
+
77
+ # 3. Save Metadata
78
+ is_trait_available = trait_row is not None
79
+ validate_and_save_cohort_info(is_final=False,
80
+ cohort=cohort,
81
+ info_path=json_path,
82
+ is_gene_available=is_gene_available,
83
+ is_trait_available=is_trait_available)
84
+
85
+ # 4. Clinical Feature Extraction
86
+ if trait_row is not None:
87
+ # Extract features using the library function
88
+ clinical_features = geo_select_clinical_features(
89
+ clinical_df=clinical_data,
90
+ trait=trait,
91
+ trait_row=trait_row,
92
+ convert_trait=convert_trait,
93
+ age_row=age_row,
94
+ convert_age=convert_age,
95
+ gender_row=gender_row,
96
+ convert_gender=convert_gender
97
+ )
98
+
99
+ # Preview the extracted features
100
+ preview = preview_df(clinical_features)
101
+ print("Preview of clinical features:")
102
+ print(preview)
103
+
104
+ # Save to CSV
105
+ clinical_features.to_csv(out_clinical_data_file)
106
+ # Extract gene expression data from matrix file
107
+ gene_data = get_genetic_data(matrix_file)
108
+
109
+ # Print first 20 row IDs and shape of data to help debug
110
+ print("Shape of gene expression data:", gene_data.shape)
111
+ print("\nFirst few rows of data:")
112
+ print(gene_data.head())
113
+ print("\nFirst 20 gene/probe identifiers:")
114
+ print(gene_data.index[:20])
115
+
116
+ # Inspect a snippet of raw file to verify identifier format
117
+ import gzip
118
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
119
+ lines = []
120
+ for i, line in enumerate(f):
121
+ if "!series_matrix_table_begin" in line:
122
+ # Get the next 5 lines after the marker
123
+ for _ in range(5):
124
+ lines.append(next(f).strip())
125
+ break
126
+ print("\nFirst few lines after matrix marker in raw file:")
127
+ for line in lines:
128
+ print(line)
129
+ # From the row identifiers and examining the number format, these appear to be Agilent probe IDs
130
+ # These will need to be mapped to standard human gene symbols for analysis
131
+ requires_gene_mapping = True
132
+ # Get file paths using library function
133
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
134
+
135
+ # Extract gene annotation from SOFT file
136
+ gene_annotation = get_gene_annotation(soft_file)
137
+
138
+ # Preview gene annotation data
139
+ print("Gene annotation columns and example values:")
140
+ print(preview_df(gene_annotation))
141
+ # Extract gene annotation data using a different prefix pattern for correct platform
142
+ gene_annotation = filter_content_by_prefix(soft_file, prefixes_a=['^FEATURES'], unselect=True, source_type='file',
143
+ return_df_a=True)[0]
144
+
145
+ # Get mapping between probe IDs and gene symbols
146
+ gene_mapping = gene_annotation.loc[:, ['ID', 'Gene Symbol']]
147
+ gene_mapping = gene_mapping.rename(columns={'Gene Symbol': 'Gene'}).astype({'ID': 'str'})
148
+
149
+ # Convert probe-level measurements to gene expression values
150
+ gene_data = apply_gene_mapping(gene_data, gene_mapping)
151
+
152
+ # Save the gene expression data
153
+ gene_data.to_csv(out_gene_data_file)
154
+ # Get file paths using library function
155
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
156
+
157
+ # Extract gene annotation from SOFT file
158
+ gene_annotation = get_gene_annotation(soft_file)
159
+
160
+ # Preview gene annotation data
161
+ print("Gene annotation columns and example values:")
162
+ print(preview_df(gene_annotation))
163
+ # Get mapping between probe IDs and gene symbols using library function
164
+ gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
165
+
166
+ # Convert probe-level measurements to gene expression values using library function
167
+ gene_data = apply_gene_mapping(gene_data, gene_mapping)
168
+
169
+ # Save the gene expression data
170
+ gene_data.to_csv(out_gene_data_file)
171
+ # 1. Normalize gene symbols and save normalized gene data
172
+ # Remove "-mRNA" suffix from gene symbols before normalization
173
+ gene_data.index = gene_data.index.str.replace('-mRNA', '')
174
+ gene_data = normalize_gene_symbols_in_index(gene_data)
175
+ gene_data.to_csv(out_gene_data_file)
176
+
177
+ # 2. Link clinical and genetic data and trait
178
+ # First get selected clinical features using the extraction function from previous step
179
+ selected_clinical = geo_select_clinical_features(
180
+ clinical_df=clinical_data,
181
+ trait=trait,
182
+ trait_row=trait_row,
183
+ convert_trait=convert_trait,
184
+ age_row=age_row,
185
+ convert_age=convert_age,
186
+ gender_row=gender_row,
187
+ convert_gender=convert_gender
188
+ )
189
+
190
+ # Debug data structures before linking
191
+ print("\nPre-linking data shapes:")
192
+ print("Clinical data shape:", selected_clinical.shape)
193
+ print("Gene data shape:", gene_data.shape)
194
+ print("\nClinical data preview:")
195
+ print(selected_clinical.head())
196
+
197
+ # Transpose gene data to match clinical data orientation
198
+ gene_data_t = gene_data.T
199
+ linked_data = pd.concat([selected_clinical.T, gene_data_t], axis=1)
200
+
201
+ # 3. Handle missing values systematically
202
+ linked_data = handle_missing_values(linked_data, trait)
203
+
204
+ # 4. Check for biased features and remove them if needed
205
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
206
+
207
+ # 5. Validate data quality and save metadata
208
+ is_usable = validate_and_save_cohort_info(
209
+ is_final=True,
210
+ cohort=cohort,
211
+ info_path=json_path,
212
+ is_gene_available=True,
213
+ is_trait_available=True,
214
+ is_biased=is_biased,
215
+ df=linked_data,
216
+ note="Gene expression data from pancreatic cancer study. All samples are cancer cases (no controls)."
217
+ )
218
+
219
+ # 6. Save linked data if usable
220
+ if is_usable:
221
+ linked_data.to_csv(out_data_file)
p3/preprocess/Pancreatic_Cancer/code/GSE124069.py ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE124069"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE124069"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE124069.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE124069.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE124069.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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
+ # Yes, this dataset contains gene expression data from microarrays
38
+ is_gene_available = True
39
+
40
+ # 2.1 Data Availability
41
+ # Trait (disease state) is available in row 0
42
+ trait_row = 0
43
+
44
+ # Age and gender data not available in sample characteristics
45
+ age_row = None
46
+ gender_row = None
47
+
48
+ # 2.2 Data Type Conversion Functions
49
+ def convert_trait(value: str) -> int:
50
+ """Convert pancreatic cancer status to binary"""
51
+ if not isinstance(value, str):
52
+ return None
53
+ value = value.lower().split(': ')[-1].strip()
54
+ if 'pancreatic cancer' in value:
55
+ return 1
56
+ return None
57
+
58
+ def convert_age(value: str) -> float:
59
+ """Convert age to float - not used since age not available"""
60
+ return None
61
+
62
+ def convert_gender(value: str) -> int:
63
+ """Convert gender to binary - not used since gender not available"""
64
+ return None
65
+
66
+ # 3. Save Metadata
67
+ is_trait_available = trait_row is not None
68
+ _ = validate_and_save_cohort_info(is_final=False,
69
+ cohort=cohort,
70
+ info_path=json_path,
71
+ is_gene_available=is_gene_available,
72
+ is_trait_available=is_trait_available)
73
+
74
+ # 4. Clinical Feature Extraction
75
+ if trait_row is not None:
76
+ clinical_features = geo_select_clinical_features(
77
+ clinical_df=clinical_data,
78
+ trait=trait,
79
+ trait_row=trait_row,
80
+ convert_trait=convert_trait,
81
+ age_row=age_row,
82
+ convert_age=convert_age,
83
+ gender_row=gender_row,
84
+ convert_gender=convert_gender
85
+ )
86
+
87
+ # Preview the extracted features
88
+ preview = preview_df(clinical_features)
89
+ print("Preview of clinical features:")
90
+ print(preview)
91
+
92
+ # Save to CSV
93
+ clinical_features.to_csv(out_clinical_data_file)
94
+ # Extract gene expression data from matrix file
95
+ gene_data = get_genetic_data(matrix_file)
96
+
97
+ # Print first 20 row IDs and shape of data to help debug
98
+ print("Shape of gene expression data:", gene_data.shape)
99
+ print("\nFirst few rows of data:")
100
+ print(gene_data.head())
101
+ print("\nFirst 20 gene/probe identifiers:")
102
+ print(gene_data.index[:20])
103
+
104
+ # Inspect a snippet of raw file to verify identifier format
105
+ import gzip
106
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
107
+ lines = []
108
+ for i, line in enumerate(f):
109
+ if "!series_matrix_table_begin" in line:
110
+ # Get the next 5 lines after the marker
111
+ for _ in range(5):
112
+ lines.append(next(f).strip())
113
+ break
114
+ print("\nFirst few lines after matrix marker in raw file:")
115
+ for line in lines:
116
+ print(line)
117
+ # Based on the identifiers starting with numbers and having '_at' suffix (e.g. '1007_s_at', '1053_at'),
118
+ # these are Affymetrix probe IDs which need to be mapped to official gene symbols
119
+ requires_gene_mapping = True
120
+ # Get file paths using library function
121
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
122
+
123
+ # Extract gene annotation from SOFT file
124
+ gene_annotation = get_gene_annotation(soft_file)
125
+
126
+ # Preview gene annotation data
127
+ print("Gene annotation columns and example values:")
128
+ print(preview_df(gene_annotation))
129
+ # Extract ID and Gene Symbol columns to create mapping table
130
+ gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
131
+
132
+ # Apply gene mapping to convert probe-level data to gene-level data
133
+ gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=gene_mapping)
134
+
135
+ # Preview
136
+ print("Shape of mapped gene data:", gene_data.shape)
137
+ print("\nFirst few rows of mapped gene data:")
138
+ print(gene_data.head())
139
+ # 1. Normalize gene symbols and save normalized gene data
140
+ # Remove "-mRNA" suffix from gene symbols before normalization
141
+ gene_data.index = gene_data.index.str.replace('-mRNA', '')
142
+ gene_data = normalize_gene_symbols_in_index(gene_data)
143
+ gene_data.to_csv(out_gene_data_file)
144
+
145
+ # 2. Link clinical and genetic data and trait
146
+ # First get selected clinical features using the extraction function from previous step
147
+ selected_clinical = geo_select_clinical_features(
148
+ clinical_df=clinical_data,
149
+ trait=trait,
150
+ trait_row=trait_row,
151
+ convert_trait=convert_trait,
152
+ age_row=age_row,
153
+ convert_age=convert_age,
154
+ gender_row=gender_row,
155
+ convert_gender=convert_gender
156
+ )
157
+
158
+ # Debug data structures before linking
159
+ print("\nPre-linking data shapes:")
160
+ print("Clinical data shape:", selected_clinical.shape)
161
+ print("Gene data shape:", gene_data.shape)
162
+ print("\nClinical data preview:")
163
+ print(selected_clinical.head())
164
+
165
+ # Transpose gene data to match clinical data orientation
166
+ gene_data_t = gene_data.T
167
+ linked_data = pd.concat([selected_clinical.T, gene_data_t], axis=1)
168
+
169
+ # 3. Handle missing values systematically
170
+ linked_data = handle_missing_values(linked_data, trait)
171
+
172
+ # 4. Check for biased features and remove them if needed
173
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
174
+
175
+ # 5. Validate data quality and save metadata
176
+ is_usable = validate_and_save_cohort_info(
177
+ is_final=True,
178
+ cohort=cohort,
179
+ info_path=json_path,
180
+ is_gene_available=True,
181
+ is_trait_available=True,
182
+ is_biased=is_biased,
183
+ df=linked_data,
184
+ note="Gene expression data from pancreatic cancer study. All samples are cancer cases (no controls)."
185
+ )
186
+
187
+ # 6. Save linked data if usable
188
+ if is_usable:
189
+ linked_data.to_csv(out_data_file)
p3/preprocess/Pancreatic_Cancer/code/GSE125158.py ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE125158"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE125158"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE125158.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE125158.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE125158.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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
+ # Yes, this dataset contains mRNA data from whole blood cells, as indicated in the series title
38
+ is_gene_available = True
39
+
40
+ # 2. Variable Identification and Conversion Functions
41
+ # 2.1 Data Availability
42
+ trait_row = 0 # diagnosis
43
+ age_row = 3 # age
44
+ gender_row = 2 # gender
45
+
46
+ # 2.2 Data Type Conversion Functions
47
+ def convert_trait(x):
48
+ if not isinstance(x, str):
49
+ return None
50
+ x = x.lower()
51
+ if 'diagnosis:' not in x:
52
+ return None
53
+ val = x.split('diagnosis:')[1].strip()
54
+ if 'pancreatic cancer' in val:
55
+ return 1
56
+ elif 'healthy' in val:
57
+ return 0
58
+ return None
59
+
60
+ def convert_age(x):
61
+ if not isinstance(x, str):
62
+ return None
63
+ if 'age:' not in x:
64
+ return None
65
+ try:
66
+ return float(x.split('age:')[1].strip())
67
+ except:
68
+ return None
69
+
70
+ def convert_gender(x):
71
+ if not isinstance(x, str):
72
+ return None
73
+ x = x.lower()
74
+ if 'gender:' not in x:
75
+ return None
76
+ val = x.split('gender:')[1].strip()
77
+ if val == 'female':
78
+ return 0
79
+ elif val == 'male':
80
+ return 1
81
+ return None
82
+
83
+ # 3. Save Metadata
84
+ is_trait_available = trait_row is not None
85
+ validate_and_save_cohort_info(is_final=False,
86
+ cohort=cohort,
87
+ info_path=json_path,
88
+ is_gene_available=is_gene_available,
89
+ is_trait_available=is_trait_available)
90
+
91
+ # 4. Clinical Feature Extraction
92
+ if trait_row is not None:
93
+ clinical_features = geo_select_clinical_features(
94
+ clinical_df=clinical_data,
95
+ trait=trait,
96
+ trait_row=trait_row,
97
+ convert_trait=convert_trait,
98
+ age_row=age_row,
99
+ convert_age=convert_age,
100
+ gender_row=gender_row,
101
+ convert_gender=convert_gender
102
+ )
103
+
104
+ # Preview the processed clinical data
105
+ preview = preview_df(clinical_features)
106
+ print("Preview of processed clinical data:")
107
+ print(preview)
108
+
109
+ # Save clinical features
110
+ clinical_features.to_csv(out_clinical_data_file)
111
+ # Extract gene expression data from matrix file
112
+ gene_data = get_genetic_data(matrix_file)
113
+
114
+ # Print first 20 row IDs and shape of data to help debug
115
+ print("Shape of gene expression data:", gene_data.shape)
116
+ print("\nFirst few rows of data:")
117
+ print(gene_data.head())
118
+ print("\nFirst 20 gene/probe identifiers:")
119
+ print(gene_data.index[:20])
120
+
121
+ # Inspect a snippet of raw file to verify identifier format
122
+ import gzip
123
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
124
+ lines = []
125
+ for i, line in enumerate(f):
126
+ if "!series_matrix_table_begin" in line:
127
+ # Get the next 5 lines after the marker
128
+ for _ in range(5):
129
+ lines.append(next(f).strip())
130
+ break
131
+ print("\nFirst few lines after matrix marker in raw file:")
132
+ for line in lines:
133
+ print(line)
134
+ # Looking at the ID patterns (prefixes like A_23_P, eQC, etc.),
135
+ # these appear to be Agilent probe IDs rather than human gene symbols
136
+ requires_gene_mapping = True
137
+ # Get file paths using library function
138
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
139
+
140
+ # Extract gene annotation from SOFT file
141
+ gene_annotation = get_gene_annotation(soft_file)
142
+
143
+ # Preview gene annotation data
144
+ print("Gene annotation columns and example values:")
145
+ print(preview_df(gene_annotation))
146
+ # 'ID' in annotation matches the probe IDs in expression data
147
+ # 'GENE_SYMBOL' contains the corresponding gene symbols
148
+ mapping_data = get_gene_mapping(gene_annotation, 'ID', 'GENE_SYMBOL')
149
+
150
+ # Apply gene mapping to convert probe-level data to gene-level data
151
+ gene_data = apply_gene_mapping(gene_data, mapping_data)
152
+
153
+ # Print shape and preview results
154
+ print("Shape of mapped gene expression data:", gene_data.shape)
155
+ print("\nFirst few rows of mapped gene expression data:")
156
+ print(gene_data.head())
157
+ # 1. Normalize gene symbols and save normalized gene data
158
+ # Remove "-mRNA" suffix from gene symbols before normalization
159
+ gene_data.index = gene_data.index.str.replace('-mRNA', '')
160
+ gene_data = normalize_gene_symbols_in_index(gene_data)
161
+ gene_data.to_csv(out_gene_data_file)
162
+
163
+ # 2. Link clinical and genetic data and trait
164
+ # First get selected clinical features using the extraction function from previous step
165
+ selected_clinical = geo_select_clinical_features(
166
+ clinical_df=clinical_data,
167
+ trait=trait,
168
+ trait_row=trait_row,
169
+ convert_trait=convert_trait,
170
+ age_row=age_row,
171
+ convert_age=convert_age,
172
+ gender_row=gender_row,
173
+ convert_gender=convert_gender
174
+ )
175
+
176
+ # Debug data structures before linking
177
+ print("\nPre-linking data shapes:")
178
+ print("Clinical data shape:", selected_clinical.shape)
179
+ print("Gene data shape:", gene_data.shape)
180
+ print("\nClinical data preview:")
181
+ print(selected_clinical.head())
182
+
183
+ # Transpose gene data to match clinical data orientation
184
+ gene_data_t = gene_data.T
185
+ linked_data = pd.concat([selected_clinical.T, gene_data_t], axis=1)
186
+
187
+ # 3. Handle missing values systematically
188
+ linked_data = handle_missing_values(linked_data, trait)
189
+
190
+ # 4. Check for biased features and remove them if needed
191
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
192
+
193
+ # 5. Validate data quality and save metadata
194
+ is_usable = validate_and_save_cohort_info(
195
+ is_final=True,
196
+ cohort=cohort,
197
+ info_path=json_path,
198
+ is_gene_available=True,
199
+ is_trait_available=True,
200
+ is_biased=is_biased,
201
+ df=linked_data,
202
+ note="Gene expression data from pancreatic cancer study. All samples are cancer cases (no controls)."
203
+ )
204
+
205
+ # 6. Save linked data if usable
206
+ if is_usable:
207
+ linked_data.to_csv(out_data_file)
p3/preprocess/Pancreatic_Cancer/code/GSE130563.py ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE130563"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE130563"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE130563.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE130563.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE130563.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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
+ # Yes - this is a microarray study analyzing transcriptional profiling data
38
+ is_gene_available = True
39
+
40
+ # 2. Variable Availability and Data Types
41
+
42
+ # 2.1 Data Availability
43
+ trait_row = 0 # Diagnosis info in row 0
44
+ age_row = 4 # Age info in row 4
45
+ gender_row = 1 # Sex info in row 1
46
+
47
+ # 2.2 Data Type Conversion Functions
48
+ def convert_trait(value: str) -> int:
49
+ """Convert diagnosis info to binary: 1 for PDAC, 0 for non-cancer controls"""
50
+ if value is None or 'diagnosis:' not in value:
51
+ return None
52
+ diagnosis = value.split('diagnosis:')[1].strip().lower()
53
+ if 'pancreatic ductal adenocarcinoma' in diagnosis:
54
+ return 1
55
+ elif 'chronic pancreatitis' in diagnosis: # Excluded from analysis per background info
56
+ return None
57
+ else: # All other diagnoses are non-cancer controls
58
+ return 0
59
+
60
+ def convert_age(value: str) -> float:
61
+ """Convert age to continuous value"""
62
+ if value is None or 'age:' not in value:
63
+ return None
64
+ try:
65
+ return float(value.split('age:')[1].strip())
66
+ except:
67
+ return None
68
+
69
+ def convert_gender(value: str) -> int:
70
+ """Convert sex to binary: 0 for female, 1 for male"""
71
+ if value is None or 'Sex:' not in value:
72
+ return None
73
+ sex = value.split('Sex:')[1].strip().upper()
74
+ if sex == 'F':
75
+ return 0
76
+ elif sex == 'M':
77
+ return 1
78
+ return None
79
+
80
+ # 3. Save Metadata
81
+ is_trait_available = trait_row is not None
82
+ validate_and_save_cohort_info(is_final=False, cohort=cohort, info_path=json_path,
83
+ is_gene_available=is_gene_available,
84
+ is_trait_available=is_trait_available)
85
+
86
+ # 4. Clinical Feature Extraction
87
+ if trait_row is not None:
88
+ selected_clinical_df = geo_select_clinical_features(
89
+ clinical_df=clinical_data,
90
+ trait=trait,
91
+ trait_row=trait_row,
92
+ convert_trait=convert_trait,
93
+ age_row=age_row,
94
+ convert_age=convert_age,
95
+ gender_row=gender_row,
96
+ convert_gender=convert_gender
97
+ )
98
+
99
+ # Preview the extracted features
100
+ print("Preview of extracted clinical features:")
101
+ print(preview_df(selected_clinical_df))
102
+
103
+ # Save to CSV
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
+ # The gene identifiers end with '_at', which is a characteristic format of Affymetrix
129
+ # microarray probe IDs rather than standard human gene symbols
130
+ requires_gene_mapping = True
131
+ # Get file paths using library function
132
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
133
+
134
+ # Let's inspect more of the raw SOFT file to find the annotation data
135
+ import gzip
136
+ start_line = "!platform_table_begin"
137
+ end_line = "!platform_table_end"
138
+ found_data = False
139
+ print("Sample of annotation data from SOFT file:")
140
+ with gzip.open(soft_file, 'rt', encoding='utf-8') as f:
141
+ for line in f:
142
+ if start_line in line:
143
+ found_data = True
144
+ # Skip the header line
145
+ next(f)
146
+ # Print first few lines of actual data
147
+ for _ in range(5):
148
+ print(next(f).strip())
149
+ break
150
+
151
+ # Extract gene annotation data - exclude metadata prefixes and keep data between platform table markers
152
+ gene_annotation = get_gene_annotation(soft_file)
153
+
154
+ # Preview annotation data
155
+ print("\nGene annotation columns and example values:")
156
+ print(preview_df(gene_annotation))
157
+
158
+ # Display column names to help identify relevant fields
159
+ print("\nAvailable columns:")
160
+ print(gene_annotation.columns.tolist())
161
+ # Since we can't access the proper gene symbol mapping file,
162
+ # let's look for gene annotation information in the SOFT file
163
+ import gzip
164
+
165
+ # Search for gene symbols in the SOFT file
166
+ found_symbols = False
167
+ gene_symbols = []
168
+
169
+ with gzip.open(soft_file, 'rt') as f:
170
+ for line in f:
171
+ # Look for platform table begin marker
172
+ if "!Platform_table_begin" in line:
173
+ headers = next(f).strip().split('\t')
174
+ # Find columns that might contain gene symbol information
175
+ symbol_cols = [i for i, h in enumerate(headers)
176
+ if 'symbol' in h.lower() or 'gene' in h.lower()]
177
+ if symbol_cols:
178
+ found_symbols = True
179
+ # Extract gene symbols from identified columns
180
+ for line in f:
181
+ if "!Platform_table_end" in line:
182
+ break
183
+ values = line.strip().split('\t')
184
+ for col in symbol_cols:
185
+ if col < len(values):
186
+ gene_symbols.append(values[col])
187
+ break
188
+
189
+ if found_symbols and len(gene_symbols) > 0:
190
+ # Create mapping using found gene symbols
191
+ unique_probes = gene_annotation['ID'].unique()
192
+ mapping_df = pd.DataFrame({
193
+ 'ID': unique_probes,
194
+ 'Gene': gene_symbols[:len(unique_probes)]
195
+ })
196
+ else:
197
+ # If no gene symbols found, create temporary mapping using probe IDs
198
+ # This allows pipeline to continue but indicates mapping needs to be updated
199
+ mapping_df = pd.DataFrame({
200
+ 'ID': gene_annotation['ID'],
201
+ 'Gene': gene_annotation['ID']
202
+ })
203
+ print("WARNING: No gene symbols found. Using probe IDs as temporary mapping.")
204
+
205
+ # Convert probe-level measurements to gene-level measurements
206
+ gene_data = apply_gene_mapping(gene_data, mapping_df)
207
+
208
+ print("Shape of gene expression data after mapping:", gene_data.shape)
209
+ print("\nPreview of mapped gene expression data:")
210
+ print(gene_data.head())
211
+ # 1. Skip normalization and use probe-level data since gene mapping failed
212
+ gene_data = get_genetic_data(matrix_file)
213
+ print("WARNING: Using probe IDs instead of gene symbols due to failed mapping")
214
+ gene_data.to_csv(out_gene_data_file)
215
+
216
+ # 2. Link clinical and genetic data and trait
217
+ selected_clinical = geo_select_clinical_features(
218
+ clinical_df=clinical_data,
219
+ trait=trait,
220
+ trait_row=trait_row,
221
+ convert_trait=convert_trait,
222
+ age_row=age_row,
223
+ convert_age=convert_age,
224
+ gender_row=gender_row,
225
+ convert_gender=convert_gender
226
+ )
227
+
228
+ # Debug pre-linking
229
+ print("\nPre-linking data shapes:")
230
+ print("Clinical data shape:", selected_clinical.shape)
231
+ print("Gene data shape:", gene_data.shape)
232
+ print("\nClinical data preview:")
233
+ print(selected_clinical.head())
234
+
235
+ # Link the data
236
+ gene_data_t = gene_data.T
237
+ linked_data = pd.concat([selected_clinical.T, gene_data_t], axis=1)
238
+
239
+ # 3. Handle missing values
240
+ linked_data = handle_missing_values(linked_data, trait)
241
+
242
+ # 4. Check for biased features
243
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
244
+
245
+ # 5. Validate data quality and save metadata
246
+ is_usable = validate_and_save_cohort_info(
247
+ is_final=True,
248
+ cohort=cohort,
249
+ info_path=json_path,
250
+ is_gene_available=True,
251
+ is_trait_available=True,
252
+ is_biased=is_biased,
253
+ df=linked_data,
254
+ note="Gene expression data from pancreatic cancer study. Using probe IDs instead of gene symbols."
255
+ )
256
+
257
+ # 6. Save if usable
258
+ if is_usable:
259
+ linked_data.to_csv(out_data_file)
p3/preprocess/Pancreatic_Cancer/code/GSE131027.py ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE131027"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE131027"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE131027.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE131027.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE131027.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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 series title and design, this appears to be focused on germline mutations and variants
38
+ # rather than gene expression data
39
+ is_gene_available = False
40
+
41
+ # 2.1 Data Row Identifiers
42
+ # For trait, we can use cancer types from Feature 1
43
+ trait_row = 1
44
+
45
+ # Age and gender are not recorded in the characteristics
46
+ age_row = None
47
+ gender_row = None
48
+
49
+ # 2.2 Conversion Functions
50
+ def convert_trait(value: str) -> int:
51
+ """Convert cancer type to binary indicating if it's pancreatic cancer"""
52
+ if not value or ':' not in value:
53
+ return None
54
+ cancer_type = value.split(':')[1].strip().lower()
55
+ return 1 if 'pancreatic cancer' in cancer_type else 0
56
+
57
+ def convert_age(value: str) -> float:
58
+ """Placeholder function since age data is not available"""
59
+ return None
60
+
61
+ def convert_gender(value: str) -> int:
62
+ """Placeholder function since gender data is not available"""
63
+ return None
64
+
65
+ # 3. Save Initial Metadata
66
+ is_trait_available = trait_row is not None
67
+ validate_and_save_cohort_info(is_final=False,
68
+ cohort=cohort,
69
+ info_path=json_path,
70
+ is_gene_available=is_gene_available,
71
+ is_trait_available=is_trait_available)
72
+
73
+ # 4. Extract Clinical Features
74
+ if trait_row is not None:
75
+ selected_clinical_df = geo_select_clinical_features(
76
+ clinical_df=clinical_data,
77
+ trait=trait,
78
+ trait_row=trait_row,
79
+ convert_trait=convert_trait,
80
+ age_row=age_row,
81
+ convert_age=convert_age,
82
+ gender_row=gender_row,
83
+ convert_gender=convert_gender
84
+ )
85
+
86
+ # Preview the data
87
+ print("Preview of selected clinical features:")
88
+ print(preview_df(selected_clinical_df))
89
+
90
+ # Save to CSV
91
+ selected_clinical_df.to_csv(out_clinical_data_file)
92
+ # Extract gene expression data from matrix file
93
+ gene_data = get_genetic_data(matrix_file)
94
+
95
+ # Print first 20 row IDs and shape of data to help debug
96
+ print("Shape of gene expression data:", gene_data.shape)
97
+ print("\nFirst few rows of data:")
98
+ print(gene_data.head())
99
+ print("\nFirst 20 gene/probe identifiers:")
100
+ print(gene_data.index[:20])
101
+
102
+ # Inspect a snippet of raw file to verify identifier format
103
+ import gzip
104
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
105
+ lines = []
106
+ for i, line in enumerate(f):
107
+ if "!series_matrix_table_begin" in line:
108
+ # Get the next 5 lines after the marker
109
+ for _ in range(5):
110
+ lines.append(next(f).strip())
111
+ break
112
+ print("\nFirst few lines after matrix marker in raw file:")
113
+ for line in lines:
114
+ print(line)
115
+ # Based on the identifiers like "1007_s_at", "1053_at", these are Affymetrix probe IDs
116
+ # rather than standard human gene symbols. They need to be mapped to gene symbols.
117
+ requires_gene_mapping = True
118
+ # Get file paths using library function
119
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
120
+
121
+ # Extract gene annotation from SOFT file
122
+ gene_annotation = get_gene_annotation(soft_file)
123
+
124
+ # Preview gene annotation data
125
+ print("Gene annotation columns and example values:")
126
+ print(preview_df(gene_annotation))
127
+ # Get mapping data between probe IDs and gene symbols
128
+ mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
129
+
130
+ # Apply gene mapping to convert probe data to gene expression
131
+ mapped_gene_data = apply_gene_mapping(gene_data, mapping_data)
132
+ gene_data = mapped_gene_data
133
+
134
+ # Preview results
135
+ print("Shape of mapped gene expression data:", gene_data.shape)
136
+ print("\nFirst few rows of mapped data:")
137
+ print(gene_data.head())
138
+ print("\nFirst 20 gene symbols:")
139
+ print(gene_data.index[:20])
140
+ # 1. Normalize gene symbols and save normalized gene data
141
+ # Remove "-mRNA" suffix from gene symbols before normalization
142
+ gene_data.index = gene_data.index.str.replace('-mRNA', '')
143
+ gene_data = normalize_gene_symbols_in_index(gene_data)
144
+ gene_data.to_csv(out_gene_data_file)
145
+
146
+ # 2. Link clinical and genetic data and trait
147
+ # First get selected clinical features using the extraction function from previous step
148
+ selected_clinical = geo_select_clinical_features(
149
+ clinical_df=clinical_data,
150
+ trait=trait,
151
+ trait_row=trait_row,
152
+ convert_trait=convert_trait,
153
+ age_row=age_row,
154
+ convert_age=convert_age,
155
+ gender_row=gender_row,
156
+ convert_gender=convert_gender
157
+ )
158
+
159
+ # Debug data structures before linking
160
+ print("\nPre-linking data shapes:")
161
+ print("Clinical data shape:", selected_clinical.shape)
162
+ print("Gene data shape:", gene_data.shape)
163
+ print("\nClinical data preview:")
164
+ print(selected_clinical.head())
165
+
166
+ # Transpose gene data to match clinical data orientation
167
+ gene_data_t = gene_data.T
168
+ linked_data = pd.concat([selected_clinical.T, gene_data_t], axis=1)
169
+
170
+ # 3. Handle missing values systematically
171
+ linked_data = handle_missing_values(linked_data, trait)
172
+
173
+ # 4. Check for biased features and remove them if needed
174
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
175
+
176
+ # 5. Validate data quality and save metadata
177
+ is_usable = validate_and_save_cohort_info(
178
+ is_final=True,
179
+ cohort=cohort,
180
+ info_path=json_path,
181
+ is_gene_available=True,
182
+ is_trait_available=True,
183
+ is_biased=is_biased,
184
+ df=linked_data,
185
+ note="Gene expression data from pancreatic cancer study. All samples are cancer cases (no controls)."
186
+ )
187
+
188
+ # 6. Save linked data if usable
189
+ if is_usable:
190
+ linked_data.to_csv(out_data_file)
p3/preprocess/Pancreatic_Cancer/code/GSE157494.py ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE157494"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE157494"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE157494.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE157494.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE157494.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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 = filter_content_by_prefix(matrix_file,
23
+ prefixes_a=['!Series_title', '!Series_summary', '!Series_overall_design'],
24
+ prefixes_b=['!Sample_geo_accession', '!Sample_characteristics_ch1'],
25
+ unselect=False,
26
+ source_type='file',
27
+ return_df_a=False,
28
+ return_df_b=True,
29
+ transpose=True)
30
+
31
+ # Get unique values per clinical feature
32
+ sample_characteristics = get_unique_values_by_row(clinical_data)
33
+
34
+ # Print background info
35
+ print("Dataset Background Information:")
36
+ print(f"{background_info}\n")
37
+
38
+ # Print sample characteristics
39
+ print("Sample Characteristics:")
40
+ for feature, values in sample_characteristics.items():
41
+ print(f"Feature: {feature}")
42
+ print(f"Values: {values}\n")
43
+ # Get file paths
44
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
45
+
46
+ # Extract background info and clinical data
47
+ background_info, clinical_data = filter_content_by_prefix(
48
+ matrix_file,
49
+ prefixes_a=['!Series_title', '!Series_summary', '!Series_overall_design'],
50
+ prefixes_b=['!Sample_characteristics_ch'],
51
+ unselect=False,
52
+ source_type='file',
53
+ return_df_a=False,
54
+ return_df_b=True
55
+ )
56
+
57
+ # Get unique values per clinical feature
58
+ sample_characteristics = get_unique_values_by_row(clinical_data)
59
+
60
+ # Print background info
61
+ print("Dataset Background Information:")
62
+ print(f"{background_info}\n")
63
+
64
+ # Print sample characteristics
65
+ print("Sample Characteristics:")
66
+ for feature, values in sample_characteristics.items():
67
+ print(f"Feature: {feature}")
68
+ print(f"Values: {values}\n")
69
+ # 1. Gene Expression Data Availability
70
+ # Yes - the series summary mentions gene expression profiling with Affymetrix Gene Chip
71
+ is_gene_available = True
72
+
73
+ # 2. Variable Availability and Data Type Conversion
74
+ # Sample Characteristics output is empty, indicating no clinical data available
75
+ trait_row = None
76
+ age_row = None
77
+ gender_row = None
78
+
79
+ def convert_trait(x):
80
+ return None
81
+
82
+ def convert_age(x):
83
+ return None
84
+
85
+ def convert_gender(x):
86
+ return None
87
+
88
+ # 3. Save metadata
89
+ # Initial filtering - save info that this dataset has gene data but no clinical data
90
+ validate_and_save_cohort_info(is_final=False,
91
+ cohort=cohort,
92
+ info_path=json_path,
93
+ is_gene_available=is_gene_available,
94
+ is_trait_available=False)
95
+
96
+ # 4. Clinical Feature Extraction
97
+ # Skip since trait_row is None (no clinical data available)
98
+ # Extract gene expression data from matrix file
99
+ gene_data = get_genetic_data(matrix_file)
100
+
101
+ # Print first 20 row IDs and shape of data to help debug
102
+ print("Shape of gene expression data:", gene_data.shape)
103
+ print("\nFirst few rows of data:")
104
+ print(gene_data.head())
105
+ print("\nFirst 20 gene/probe identifiers:")
106
+ print(gene_data.index[:20])
107
+
108
+ # Inspect a snippet of raw file to verify identifier format
109
+ import gzip
110
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
111
+ lines = []
112
+ for i, line in enumerate(f):
113
+ if "!series_matrix_table_begin" in line:
114
+ # Get the next 5 lines after the marker
115
+ for _ in range(5):
116
+ lines.append(next(f).strip())
117
+ break
118
+ print("\nFirst few lines after matrix marker in raw file:")
119
+ for line in lines:
120
+ print(line)
121
+ # Looking at the IDs (e.g. 1007_s_at, 1053_at), these are Affymetrix probe IDs
122
+ # from HG-U133_Plus_2 array platform, not gene symbols.
123
+ # They need to be mapped to human gene symbols for standardized analysis
124
+ requires_gene_mapping = True
125
+ # Get file paths using library function
126
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
127
+
128
+ # Extract gene annotation from SOFT file
129
+ gene_annotation = get_gene_annotation(soft_file)
130
+
131
+ # Preview gene annotation data
132
+ print("Gene annotation columns and example values:")
133
+ print(preview_df(gene_annotation))
134
+ # Looking at gene_data index ['1007_s_at', '1053_at', '117_at'...] and
135
+ # gene_annotation dictionary preview, 'ID' column contains probe IDs matching gene_data index,
136
+ # and 'Gene Symbol' column contains the gene symbols we need
137
+
138
+ # Create mapping between probe IDs and gene symbols
139
+ gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
140
+
141
+ # Convert probe-level measurements to gene expression data
142
+ gene_data = apply_gene_mapping(gene_data, gene_mapping)
143
+
144
+ # Normalize gene symbols to standard format using synonym dictionary
145
+ gene_data = normalize_gene_symbols_in_index(gene_data)
146
+ # First get the gene expression data again
147
+ gene_data = get_genetic_data(matrix_file)
148
+ gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
149
+ gene_data = apply_gene_mapping(gene_data, gene_mapping)
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
+ # Update cohort info - dataset unusable due to lack of clinical data
156
+ is_usable = validate_and_save_cohort_info(
157
+ is_final=True,
158
+ cohort=cohort,
159
+ info_path=json_path,
160
+ is_gene_available=True,
161
+ is_trait_available=False,
162
+ is_biased=None,
163
+ df=None,
164
+ note="Gene expression data available but no clinical annotations/controls present."
165
+ )
166
+ # Get file paths using library function
167
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
168
+
169
+ # Extract gene annotation from SOFT file
170
+ gene_annotation = get_gene_annotation(soft_file)
171
+
172
+ # Preview gene annotation data
173
+ print("Gene annotation columns and example values:")
174
+ print(preview_df(gene_annotation))
175
+ # Get file paths
176
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
177
+
178
+ # Get gene annotation first
179
+ gene_annotation = get_gene_annotation(soft_file)
180
+
181
+ # Get gene expression data
182
+ gene_data = get_genetic_data(matrix_file)
183
+
184
+ # Create mapping between probe IDs and gene symbols
185
+ gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
186
+
187
+ # Convert probe-level measurements to gene expression data
188
+ gene_data = apply_gene_mapping(gene_data, gene_mapping)
189
+
190
+ # Print dimensions of result for verification
191
+ print(f"\nShape of gene expression data after mapping: {gene_data.shape}")
192
+ # Get file paths
193
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
194
+
195
+ # Get gene annotation and expression data
196
+ gene_annotation = get_gene_annotation(soft_file)
197
+ gene_data = get_genetic_data(matrix_file)
198
+
199
+ # Create mapping and apply it
200
+ gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
201
+ gene_data = apply_gene_mapping(gene_data, gene_mapping)
202
+
203
+ # Normalize gene symbols and save gene data
204
+ gene_data = normalize_gene_symbols_in_index(gene_data)
205
+ gene_data.to_csv(out_gene_data_file)
206
+
207
+ # Update cohort info - dataset unusable due to lack of clinical data
208
+ is_usable = validate_and_save_cohort_info(
209
+ is_final=True,
210
+ cohort=cohort,
211
+ info_path=json_path,
212
+ is_gene_available=True,
213
+ is_trait_available=False,
214
+ is_biased=None,
215
+ df=None,
216
+ note="Gene expression data available but no clinical annotations/controls present."
217
+ )
p3/preprocess/Pancreatic_Cancer/code/GSE183795.py ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE183795"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE183795"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE183795.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE183795.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE183795.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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 a microarray gene expression dataset
38
+ is_gene_available = True
39
+
40
+ # 2.1 Data Availability
41
+ # For trait: Feature 0 contains tissue type info (tumor vs non-tumor)
42
+ trait_row = 0
43
+
44
+ # Age is not available in the data
45
+ age_row = None
46
+
47
+ # Gender is not available in the data
48
+ gender_row = None
49
+
50
+ # 2.2 Data Type Conversion Functions
51
+ def convert_trait(value: str) -> int:
52
+ """Convert tissue type to binary: 1 for tumor, 0 for non-tumor/normal"""
53
+ if not value or 'tissue:' not in value:
54
+ return None
55
+ value = value.split('tissue:')[1].strip().lower()
56
+ if 'tumor' in value and 'non' not in value:
57
+ return 1
58
+ elif 'non-tumor' in value or 'normal' in value:
59
+ return 0
60
+ return None
61
+
62
+ def convert_age(value: str) -> float:
63
+ """Convert age to float"""
64
+ return None
65
+
66
+ def convert_gender(value: str) -> int:
67
+ """Convert gender to binary"""
68
+ return None
69
+
70
+ # 3. Save metadata
71
+ is_trait_available = trait_row is not None
72
+ validate_and_save_cohort_info(is_final=False,
73
+ cohort=cohort,
74
+ info_path=json_path,
75
+ is_gene_available=is_gene_available,
76
+ is_trait_available=is_trait_available)
77
+
78
+ # 4. Extract clinical features
79
+ if trait_row is not None:
80
+ clinical_features = geo_select_clinical_features(clinical_df=clinical_data,
81
+ trait=trait,
82
+ trait_row=trait_row,
83
+ convert_trait=convert_trait,
84
+ age_row=age_row,
85
+ convert_age=convert_age,
86
+ gender_row=gender_row,
87
+ convert_gender=convert_gender)
88
+
89
+ print("Preview of extracted clinical features:")
90
+ print(preview_df(clinical_features))
91
+
92
+ # Save clinical data
93
+ clinical_features.to_csv(out_clinical_data_file)
94
+ # Extract gene expression data from matrix file
95
+ gene_data = get_genetic_data(matrix_file)
96
+
97
+ # Print first 20 row IDs and shape of data to help debug
98
+ print("Shape of gene expression data:", gene_data.shape)
99
+ print("\nFirst few rows of data:")
100
+ print(gene_data.head())
101
+ print("\nFirst 20 gene/probe identifiers:")
102
+ print(gene_data.index[:20])
103
+
104
+ # Inspect a snippet of raw file to verify identifier format
105
+ import gzip
106
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
107
+ lines = []
108
+ for i, line in enumerate(f):
109
+ if "!series_matrix_table_begin" in line:
110
+ # Get the next 5 lines after the marker
111
+ for _ in range(5):
112
+ lines.append(next(f).strip())
113
+ break
114
+ print("\nFirst few lines after matrix marker in raw file:")
115
+ for line in lines:
116
+ print(line)
117
+ # The identifiers appear to be probe IDs, not gene symbols
118
+ # The format is numerical IDs (e.g. 7896748, 7896754) which are probe identifiers
119
+ # from the microarray platform
120
+ # These need to be mapped to gene symbols
121
+
122
+ requires_gene_mapping = True
123
+ # Get file paths using library function
124
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
125
+
126
+ # Extract gene annotation from SOFT file
127
+ gene_annotation = get_gene_annotation(soft_file)
128
+
129
+ # Preview gene annotation data
130
+ print("Gene annotation columns and example values:")
131
+ print(preview_df(gene_annotation))
132
+ # 1. Observe the IDs used in gene expression data and gene annotation data
133
+ # In gene expression data, we see probe IDs like '7896748', '7896754', etc.
134
+ # In gene annotation, these probe IDs are stored in the 'ID' column
135
+ # Gene symbols are stored in 'gene_assignment' column
136
+
137
+ # 2. Extract probe-to-gene mapping
138
+ mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
139
+
140
+ # 3. Convert probe-level data to gene-level data using mapping
141
+ gene_data = apply_gene_mapping(gene_data, mapping_data)
142
+
143
+ # Save the processed gene data
144
+ gene_data.to_csv(out_gene_data_file)
145
+
146
+ # Preview the gene_data to verify the conversion
147
+ print("Gene expression data shape after mapping:", gene_data.shape)
148
+ print("\nFirst few genes and their expression values:")
149
+ print(preview_df(gene_data))
150
+ # 1. Normalize gene symbols and save normalized gene data
151
+ # Remove "-mRNA" suffix from gene symbols before normalization
152
+ gene_data.index = gene_data.index.str.replace('-mRNA', '')
153
+ gene_data = normalize_gene_symbols_in_index(gene_data)
154
+ gene_data.to_csv(out_gene_data_file)
155
+
156
+ # 2. Link clinical and genetic data and trait
157
+ # First get selected clinical features using the extraction function from previous step
158
+ selected_clinical = geo_select_clinical_features(
159
+ clinical_df=clinical_data,
160
+ trait=trait,
161
+ trait_row=trait_row,
162
+ convert_trait=convert_trait,
163
+ age_row=age_row,
164
+ convert_age=convert_age,
165
+ gender_row=gender_row,
166
+ convert_gender=convert_gender
167
+ )
168
+
169
+ # Debug data structures before linking
170
+ print("\nPre-linking data shapes:")
171
+ print("Clinical data shape:", selected_clinical.shape)
172
+ print("Gene data shape:", gene_data.shape)
173
+ print("\nClinical data preview:")
174
+ print(selected_clinical.head())
175
+
176
+ # Transpose gene data to match clinical data orientation
177
+ gene_data_t = gene_data.T
178
+ linked_data = pd.concat([selected_clinical.T, gene_data_t], axis=1)
179
+
180
+ # 3. Handle missing values systematically
181
+ linked_data = handle_missing_values(linked_data, trait)
182
+
183
+ # 4. Check for biased features and remove them if needed
184
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
185
+
186
+ # 5. Validate data quality and save metadata
187
+ is_usable = validate_and_save_cohort_info(
188
+ is_final=True,
189
+ cohort=cohort,
190
+ info_path=json_path,
191
+ is_gene_available=True,
192
+ is_trait_available=True,
193
+ is_biased=is_biased,
194
+ df=linked_data,
195
+ note="Gene expression data from pancreatic cancer study. All samples are cancer cases (no controls)."
196
+ )
197
+
198
+ # 6. Save linked data if usable
199
+ if is_usable:
200
+ linked_data.to_csv(out_data_file)
p3/preprocess/Pancreatic_Cancer/code/GSE222788.py ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE222788"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE222788"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE222788.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE222788.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE222788.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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 background info, this is a NanoString gene profiling study with 730 genes panel
38
+ is_gene_available = True
39
+
40
+ # 2.1 Data Availability & Row Keys
41
+ # From sample characteristics, only treatment group info is available (row 0)
42
+ # Can infer trait (cancer vs control) from treatment - patients are all cancer cases
43
+ trait_row = 0
44
+ age_row = None # Age not recorded
45
+ gender_row = None # Gender not recorded
46
+
47
+ # 2.2 Data Type Conversion Functions
48
+ def convert_trait(value):
49
+ # Extract value after colon and strip whitespace
50
+ if ':' in value:
51
+ value = value.split(':')[1].strip()
52
+ # All samples are cancer cases - convert to binary 1
53
+ return 1
54
+
55
+ def convert_age(value):
56
+ return None # Not used since age data not available
57
+
58
+ def convert_gender(value):
59
+ return None # Not used since gender data not available
60
+
61
+ # 3. Save metadata about data availability
62
+ is_trait_available = trait_row is not None
63
+ validate_and_save_cohort_info(is_final=False,
64
+ cohort=cohort,
65
+ info_path=json_path,
66
+ is_gene_available=is_gene_available,
67
+ is_trait_available=is_trait_available)
68
+
69
+ # 4. Extract clinical features if trait data available
70
+ if trait_row is not None:
71
+ selected_clinical = geo_select_clinical_features(
72
+ clinical_df=clinical_data,
73
+ trait=trait,
74
+ trait_row=trait_row,
75
+ convert_trait=convert_trait,
76
+ age_row=age_row,
77
+ convert_age=convert_age,
78
+ gender_row=gender_row,
79
+ convert_gender=convert_gender
80
+ )
81
+
82
+ # Preview the data
83
+ preview = preview_df(selected_clinical)
84
+ print("Preview of selected clinical features:")
85
+ print(preview)
86
+
87
+ # Save to CSV
88
+ selected_clinical.to_csv(out_clinical_data_file)
89
+ # Extract gene expression data from matrix file
90
+ gene_data = get_genetic_data(matrix_file)
91
+
92
+ # Print first 20 row IDs and shape of data to help debug
93
+ print("Shape of gene expression data:", gene_data.shape)
94
+ print("\nFirst few rows of data:")
95
+ print(gene_data.head())
96
+ print("\nFirst 20 gene/probe identifiers:")
97
+ print(gene_data.index[:20])
98
+
99
+ # Inspect a snippet of raw file to verify identifier format
100
+ import gzip
101
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
102
+ lines = []
103
+ for i, line in enumerate(f):
104
+ if "!series_matrix_table_begin" in line:
105
+ # Get the next 5 lines after the marker
106
+ for _ in range(5):
107
+ lines.append(next(f).strip())
108
+ break
109
+ print("\nFirst few lines after matrix marker in raw file:")
110
+ for line in lines:
111
+ print(line)
112
+ # Looking at gene identifiers like "A2M-mRNA", "ABCB1-mRNA", etc.
113
+ # These are already human gene symbols with "-mRNA" suffix
114
+ # No mapping needed, just need to remove the "-mRNA" suffix
115
+ requires_gene_mapping = False
116
+ # 1. Normalize gene symbols and save normalized gene data
117
+ # Remove "-mRNA" suffix from gene symbols before normalization
118
+ gene_data.index = gene_data.index.str.replace('-mRNA', '')
119
+ gene_data = normalize_gene_symbols_in_index(gene_data)
120
+ gene_data.to_csv(out_gene_data_file)
121
+
122
+ # 2. Link clinical and genetic data and trait
123
+ # First get selected clinical features using the extraction function from previous step
124
+ selected_clinical = geo_select_clinical_features(
125
+ clinical_df=clinical_data,
126
+ trait=trait,
127
+ trait_row=trait_row,
128
+ convert_trait=convert_trait,
129
+ age_row=age_row,
130
+ convert_age=convert_age,
131
+ gender_row=gender_row,
132
+ convert_gender=convert_gender
133
+ )
134
+
135
+ # Debug data structures before linking
136
+ print("\nPre-linking data shapes:")
137
+ print("Clinical data shape:", selected_clinical.shape)
138
+ print("Gene data shape:", gene_data.shape)
139
+ print("\nClinical data preview:")
140
+ print(selected_clinical.head())
141
+
142
+ # Transpose gene data to match clinical data orientation
143
+ gene_data_t = gene_data.T
144
+ linked_data = pd.concat([selected_clinical.T, gene_data_t], axis=1)
145
+
146
+ # 3. Handle missing values systematically
147
+ linked_data = handle_missing_values(linked_data, trait)
148
+
149
+ # 4. Check for biased features and remove them if needed
150
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
151
+
152
+ # 5. Validate data quality and save metadata
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_biased,
160
+ df=linked_data,
161
+ note="Gene expression data from pancreatic cancer study. All samples are cancer cases (no controls)."
162
+ )
163
+
164
+ # 6. Save linked data if usable
165
+ if is_usable:
166
+ linked_data.to_csv(out_data_file)
p3/preprocess/Pancreatic_Cancer/code/GSE223409.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE223409"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE223409"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE223409.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE223409.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE223409.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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 appears to be an EVs study with specific gene treatment
38
+ # and likely contains gene expression data
39
+ is_gene_available = True
40
+
41
+ # 2. Variable Availability and Data Type Conversion
42
+ # Looking at sample characteristics:
43
+ # - Can infer trait data from treatment groups in row 1
44
+ # - No age data
45
+ # - No gender data
46
+
47
+ # Row indices for variables
48
+ trait_row = 1 # Can infer from treatment groups
49
+ age_row = None # Age not available
50
+ gender_row = None # Gender not available
51
+
52
+ def convert_trait(value: str) -> int:
53
+ """Convert treatment value to binary trait."""
54
+ if pd.isna(value):
55
+ return None
56
+ value = value.split(': ')[-1].lower()
57
+ # Consider control/PBS as non-cancer (0) and treated as cancer (1)
58
+ if 'control' in value or 'pbs' in value:
59
+ return 0
60
+ return 1
61
+
62
+ # Age and gender conversion functions not needed since data unavailable
63
+ convert_age = None
64
+ convert_gender = None
65
+
66
+ # 3. Save metadata
67
+ is_trait_available = trait_row is not None
68
+ validate_and_save_cohort_info(
69
+ is_final=False,
70
+ cohort=cohort,
71
+ info_path=json_path,
72
+ is_gene_available=is_gene_available,
73
+ is_trait_available=is_trait_available
74
+ )
75
+
76
+ # 4. Clinical feature extraction
77
+ if trait_row is not None:
78
+ clinical_features = geo_select_clinical_features(
79
+ clinical_df=clinical_data,
80
+ trait=trait,
81
+ trait_row=trait_row,
82
+ convert_trait=convert_trait,
83
+ age_row=age_row,
84
+ convert_age=convert_age,
85
+ gender_row=gender_row,
86
+ convert_gender=convert_gender
87
+ )
88
+ print("Preview of extracted clinical features:")
89
+ print(preview_df(clinical_features))
90
+ clinical_features.to_csv(out_clinical_data_file)
91
+ # Extract gene expression data from matrix file
92
+ gene_data = get_genetic_data(matrix_file)
93
+
94
+ # Print first 20 row IDs and shape of data to help debug
95
+ print("Shape of gene expression data:", gene_data.shape)
96
+ print("\nFirst few rows of data:")
97
+ print(gene_data.head())
98
+ print("\nFirst 20 gene/probe identifiers:")
99
+ print(gene_data.index[:20])
100
+
101
+ # Inspect a snippet of raw file to verify identifier format
102
+ import gzip
103
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
104
+ lines = []
105
+ for i, line in enumerate(f):
106
+ if "!series_matrix_table_begin" in line:
107
+ # Get the next 5 lines after the marker
108
+ for _ in range(5):
109
+ lines.append(next(f).strip())
110
+ break
111
+ print("\nFirst few lines after matrix marker in raw file:")
112
+ for line in lines:
113
+ print(line)
114
+ requires_gene_mapping = True
115
+ # Get file paths using library function
116
+ soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
117
+
118
+ # Extract gene annotation from SOFT file
119
+ gene_annotation = get_gene_annotation(soft_file)
120
+
121
+ # Preview gene annotation data
122
+ print("Gene annotation columns and example values:")
123
+ print(preview_df(gene_annotation))
124
+ # Get mapping between probe IDs and gene symbols from annotation data
125
+ mapping_data = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
126
+
127
+ # Apply mapping to convert probe data to gene expression
128
+ gene_data = apply_gene_mapping(gene_data, mapping_data)
129
+
130
+ # Preview the result
131
+ print("Shape of mapped gene expression data:", gene_data.shape)
132
+ print("\nFirst few rows of mapped data:")
133
+ print(gene_data.head())
134
+ # 1. Normalize gene symbols and save normalized gene data
135
+ gene_data = normalize_gene_symbols_in_index(gene_data)
136
+ gene_data.to_csv(out_gene_data_file)
137
+
138
+ # 2. Link clinical and genetic data and trait
139
+ # First get selected clinical features using the extraction function from previous step
140
+ selected_clinical = geo_select_clinical_features(
141
+ clinical_df=clinical_data,
142
+ trait=trait,
143
+ trait_row=trait_row,
144
+ convert_trait=convert_trait,
145
+ age_row=age_row,
146
+ convert_age=convert_age,
147
+ gender_row=gender_row,
148
+ convert_gender=convert_gender
149
+ )
150
+
151
+ linked_data = geo_link_clinical_genetic_data(selected_clinical, gene_data)
152
+
153
+ # 3. Handle missing values systematically
154
+ linked_data = handle_missing_values(linked_data, trait)
155
+
156
+ # 4. Check for biased features and remove them if needed
157
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
158
+
159
+ # 5. Validate data quality and save metadata
160
+ is_usable = validate_and_save_cohort_info(
161
+ is_final=True,
162
+ cohort=cohort,
163
+ info_path=json_path,
164
+ is_gene_available=True,
165
+ is_trait_available=True,
166
+ is_biased=is_biased,
167
+ df=linked_data,
168
+ note="Gene expression data from extracellular vesicles in pancreatic cancer study"
169
+ )
170
+
171
+ # 6. Save linked data if usable
172
+ if is_usable:
173
+ linked_data.to_csv(out_data_file)
p3/preprocess/Pancreatic_Cancer/code/GSE236951.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Path Configuration
2
+ from tools.preprocess import *
3
+
4
+ # Processing context
5
+ trait = "Pancreatic_Cancer"
6
+ cohort = "GSE236951"
7
+
8
+ # Input paths
9
+ in_trait_dir = "../DATA/GEO/Pancreatic_Cancer"
10
+ in_cohort_dir = "../DATA/GEO/Pancreatic_Cancer/GSE236951"
11
+
12
+ # Output paths
13
+ out_data_file = "./output/preprocess/3/Pancreatic_Cancer/GSE236951.csv"
14
+ out_gene_data_file = "./output/preprocess/3/Pancreatic_Cancer/gene_data/GSE236951.csv"
15
+ out_clinical_data_file = "./output/preprocess/3/Pancreatic_Cancer/clinical_data/GSE236951.csv"
16
+ json_path = "./output/preprocess/3/Pancreatic_Cancer/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
+ # The series summary indicates nanostring gene expression analysis of ~700 immune related genes
38
+ is_gene_available = True
39
+
40
+ # 2.1 Data Availability
41
+ # Disease status in row 0, gender in row 2, age in row 3
42
+ trait_row = 0
43
+ gender_row = 2
44
+ age_row = 3
45
+
46
+ # 2.2 Data Type Conversion Functions
47
+ def convert_trait(x: str) -> Optional[int]:
48
+ if not isinstance(x, str):
49
+ return None
50
+ x = x.lower().split(': ')[-1]
51
+ if 'pancreatic' in x:
52
+ return 1
53
+ elif 'colon' in x or 'benign' in x:
54
+ return 0
55
+ return None
56
+
57
+ def convert_gender(x: str) -> Optional[int]:
58
+ if not isinstance(x, str):
59
+ return None
60
+ x = x.lower().split(': ')[-1]
61
+ if 'female' in x:
62
+ return 0
63
+ elif 'male' in x:
64
+ return 1
65
+ return None
66
+
67
+ def convert_age(x: str) -> Optional[float]:
68
+ if not isinstance(x, str):
69
+ return None
70
+ try:
71
+ return float(x.split(': ')[-1].split()[0])
72
+ except:
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
+ clinical_features = geo_select_clinical_features(
86
+ clinical_df=clinical_data,
87
+ trait=trait,
88
+ trait_row=trait_row,
89
+ convert_trait=convert_trait,
90
+ age_row=age_row,
91
+ convert_age=convert_age,
92
+ gender_row=gender_row,
93
+ convert_gender=convert_gender
94
+ )
95
+
96
+ print("Preview of extracted clinical features:")
97
+ print(preview_df(clinical_features))
98
+
99
+ clinical_features.to_csv(out_clinical_data_file)
100
+ # Extract gene expression data from matrix file
101
+ gene_data = get_genetic_data(matrix_file)
102
+
103
+ # Print first 20 row IDs and shape of data to help debug
104
+ print("Shape of gene expression data:", gene_data.shape)
105
+ print("\nFirst few rows of data:")
106
+ print(gene_data.head())
107
+ print("\nFirst 20 gene/probe identifiers:")
108
+ print(gene_data.index[:20])
109
+
110
+ # Inspect a snippet of raw file to verify identifier format
111
+ import gzip
112
+ with gzip.open(matrix_file, 'rt', encoding='utf-8') as f:
113
+ lines = []
114
+ for i, line in enumerate(f):
115
+ if "!series_matrix_table_begin" in line:
116
+ # Get the next 5 lines after the marker
117
+ for _ in range(5):
118
+ lines.append(next(f).strip())
119
+ break
120
+ print("\nFirst few lines after matrix marker in raw file:")
121
+ for line in lines:
122
+ print(line)
123
+ # The gene identifiers are already human gene symbols (like A2M, ABCB1, ABL1, etc.)
124
+ # No mapping is needed
125
+ requires_gene_mapping = False
126
+ # 1. Normalize gene symbols and save normalized gene data
127
+ gene_data = normalize_gene_symbols_in_index(gene_data)
128
+ gene_data.to_csv(out_gene_data_file)
129
+
130
+ # 2. Link clinical and genetic data and trait
131
+ # First get selected clinical features using the extraction function from previous step
132
+ selected_clinical = geo_select_clinical_features(
133
+ clinical_df=clinical_data,
134
+ trait=trait,
135
+ trait_row=trait_row,
136
+ convert_trait=convert_trait,
137
+ age_row=age_row,
138
+ convert_age=convert_age,
139
+ gender_row=gender_row,
140
+ convert_gender=convert_gender
141
+ )
142
+
143
+ linked_data = geo_link_clinical_genetic_data(selected_clinical, gene_data)
144
+
145
+ # 3. Handle missing values systematically
146
+ linked_data = handle_missing_values(linked_data, trait)
147
+
148
+ # 4. Check for biased features and remove them if needed
149
+ is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)
150
+
151
+ # 5. Validate data quality and save metadata
152
+ is_usable = validate_and_save_cohort_info(
153
+ is_final=True,
154
+ cohort=cohort,
155
+ info_path=json_path,
156
+ is_gene_available=True,
157
+ is_trait_available=True,
158
+ is_biased=is_biased,
159
+ df=linked_data,
160
+ note="Gene expression data comparing cervical carcinoma vs normal tissue samples"
161
+ )
162
+
163
+ # 6. Save linked data if usable
164
+ if is_usable:
165
+ linked_data.to_csv(out_data_file)