Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +22 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE162635.csv +3 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE208662.csv +0 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE212331.csv +3 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE21359.csv +3 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/code/GSE32030.py +147 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/code/GSE64593.py +144 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/code/TCGA.py +113 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE162635.csv +3 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE175616.csv +0 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE208662.csv +0 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE212331.csv +3 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE21359.csv +3 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE32030.csv +3 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE64593.csv +0 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE64599.csv +0 -0
- p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE84046.csv +3 -0
- p1/preprocess/Fibromyalgia/GSE67311.csv +3 -0
- p1/preprocess/Fibromyalgia/clinical_data/GSE67311.csv +2 -0
- p1/preprocess/Fibromyalgia/code/GSE67311.py +219 -0
- p1/preprocess/Fibromyalgia/code/TCGA.py +55 -0
- p1/preprocess/Fibromyalgia/cohort_info.json +1 -0
- p1/preprocess/Fibromyalgia/gene_data/GSE67311.csv +3 -0
- p1/preprocess/Glioblastoma/TCGA.csv +3 -0
- p1/preprocess/Glioblastoma/gene_data/TCGA.csv +3 -0
- p1/preprocess/Head_and_Neck_Cancer/TCGA.csv +3 -0
- p1/preprocess/Head_and_Neck_Cancer/gene_data/TCGA.csv +3 -0
- p1/preprocess/Hemochromatosis/TCGA.csv +3 -0
- p1/preprocess/Hemochromatosis/gene_data/TCGA.csv +3 -0
- p1/preprocess/Huntingtons_Disease/gene_data/GSE71220.csv +3 -0
- p1/preprocess/Hypertension/gene_data/GSE256539.csv +3 -0
- p1/preprocess/Hypertrophic_Cardiomyopathy/GSE36961.csv +3 -0
- p1/preprocess/Hypertrophic_Cardiomyopathy/clinical_data/GSE36961.csv +4 -0
- p1/preprocess/Hypertrophic_Cardiomyopathy/code/GSE36961.py +147 -0
- p1/preprocess/Hypertrophic_Cardiomyopathy/code/TCGA.py +50 -0
- p1/preprocess/Hypertrophic_Cardiomyopathy/cohort_info.json +1 -0
- p1/preprocess/Hypertrophic_Cardiomyopathy/gene_data/GSE36961.csv +3 -0
- p1/preprocess/Hypothyroidism/GSE151158.csv +0 -0
- p1/preprocess/Hypothyroidism/clinical_data/GSE151158.csv +4 -0
- p1/preprocess/Hypothyroidism/clinical_data/GSE224330.csv +4 -0
- p1/preprocess/Hypothyroidism/clinical_data/GSE75678.csv +3 -0
- p1/preprocess/Hypothyroidism/clinical_data/GSE75685.csv +3 -0
- p1/preprocess/Hypothyroidism/clinical_data/TCGA.csv +573 -0
- p1/preprocess/Hypothyroidism/code/GSE151158.py +147 -0
- p1/preprocess/Hypothyroidism/code/GSE224330.py +162 -0
- p1/preprocess/Hypothyroidism/code/GSE32445.py +109 -0
- p1/preprocess/Hypothyroidism/code/GSE75678.py +153 -0
- p1/preprocess/Hypothyroidism/code/GSE75685.py +175 -0
- p1/preprocess/Hypothyroidism/code/TCGA.py +111 -0
- p1/preprocess/Hypothyroidism/cohort_info.json +1 -0
.gitattributes
CHANGED
@@ -1172,3 +1172,25 @@ p1/preprocess/Hypertension/gene_data/GSE117261.csv filter=lfs diff=lfs merge=lfs
|
|
1172 |
p1/preprocess/Huntingtons_Disease/gene_data/GSE135589.csv filter=lfs diff=lfs merge=lfs -text
|
1173 |
p1/preprocess/Hypertension/gene_data/GSE71994.csv filter=lfs diff=lfs merge=lfs -text
|
1174 |
p1/preprocess/Hypertension/gene_data/GSE77627.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1172 |
p1/preprocess/Huntingtons_Disease/gene_data/GSE135589.csv filter=lfs diff=lfs merge=lfs -text
|
1173 |
p1/preprocess/Hypertension/gene_data/GSE71994.csv filter=lfs diff=lfs merge=lfs -text
|
1174 |
p1/preprocess/Hypertension/gene_data/GSE77627.csv filter=lfs diff=lfs merge=lfs -text
|
1175 |
+
p1/preprocess/Hypertension/gene_data/GSE256539.csv filter=lfs diff=lfs merge=lfs -text
|
1176 |
+
p1/preprocess/Huntingtons_Disease/gene_data/GSE71220.csv filter=lfs diff=lfs merge=lfs -text
|
1177 |
+
p1/preprocess/Head_and_Neck_Cancer/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1178 |
+
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE84046.csv filter=lfs diff=lfs merge=lfs -text
|
1179 |
+
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE212331.csv filter=lfs diff=lfs merge=lfs -text
|
1180 |
+
p1/preprocess/Glioblastoma/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1181 |
+
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE21359.csv filter=lfs diff=lfs merge=lfs -text
|
1182 |
+
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE212331.csv filter=lfs diff=lfs merge=lfs -text
|
1183 |
+
p1/preprocess/Lupus_(Systemic_Lupus_Erythematosus)/GSE112943.csv filter=lfs diff=lfs merge=lfs -text
|
1184 |
+
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE21359.csv filter=lfs diff=lfs merge=lfs -text
|
1185 |
+
p1/preprocess/Glioblastoma/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1186 |
+
p1/preprocess/Hemochromatosis/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1187 |
+
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE162635.csv filter=lfs diff=lfs merge=lfs -text
|
1188 |
+
p1/preprocess/Head_and_Neck_Cancer/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1189 |
+
p1/preprocess/Fibromyalgia/GSE67311.csv filter=lfs diff=lfs merge=lfs -text
|
1190 |
+
p1/preprocess/Hemochromatosis/gene_data/TCGA.csv filter=lfs diff=lfs merge=lfs -text
|
1191 |
+
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE32030.csv filter=lfs diff=lfs merge=lfs -text
|
1192 |
+
p1/preprocess/Hypertrophic_Cardiomyopathy/gene_data/GSE36961.csv filter=lfs diff=lfs merge=lfs -text
|
1193 |
+
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE162635.csv filter=lfs diff=lfs merge=lfs -text
|
1194 |
+
p1/preprocess/Fibromyalgia/gene_data/GSE67311.csv filter=lfs diff=lfs merge=lfs -text
|
1195 |
+
p1/preprocess/Lupus_(Systemic_Lupus_Erythematosus)/gene_data/GSE112943.csv filter=lfs diff=lfs merge=lfs -text
|
1196 |
+
p1/preprocess/Hypertrophic_Cardiomyopathy/GSE36961.csv filter=lfs diff=lfs merge=lfs -text
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE162635.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3159e5b7325e26c201fcc441d373f29ab81b9c0648b2002785f0daa5c91e1dd0
|
3 |
+
size 45984037
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE208662.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE212331.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c6066a5b8bd07cff45e504dd0131c29d77f948593e2ad8500981cb22d2df4b06
|
3 |
+
size 22262575
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/GSE21359.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ba7450fc67ee50cb7c2d08f0b714336059d09cd9bb664432157a417c4b0f56e7
|
3 |
+
size 27474937
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/code/GSE32030.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Chronic_obstructive_pulmonary_disease_(COPD)"
|
6 |
+
cohort = "GSE32030"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Chronic_obstructive_pulmonary_disease_(COPD)"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Chronic_obstructive_pulmonary_disease_(COPD)/GSE32030"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/GSE32030.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE32030.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/clinical_data/GSE32030.csv"
|
16 |
+
json_path = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1) Gene Expression Data Availability
|
37 |
+
is_gene_available = True # Based on background info indicating microarray gene expression data
|
38 |
+
|
39 |
+
# 2) Variable Availability
|
40 |
+
# Checking the sample characteristics dictionary, 'copd status' only appears as "yes", no variation.
|
41 |
+
# No explicit age or gender info is provided in the dictionary. Thus, all are considered unavailable.
|
42 |
+
trait_row = None
|
43 |
+
age_row = None
|
44 |
+
gender_row = None
|
45 |
+
|
46 |
+
# 2.2 Data Type Conversion Functions
|
47 |
+
def convert_trait(value: str) -> int:
|
48 |
+
# For demonstration, but will not be used because trait_row is None
|
49 |
+
# e.g., return 1 if the string (after the colon) indicates COPD, else 0 or None
|
50 |
+
parts = str(value).split(':', 1)
|
51 |
+
val = parts[1].strip().lower() if len(parts) > 1 else ''
|
52 |
+
if val == 'yes':
|
53 |
+
return 1
|
54 |
+
elif val == 'no':
|
55 |
+
return 0
|
56 |
+
return None
|
57 |
+
|
58 |
+
def convert_age(value: str) -> float:
|
59 |
+
# For demonstration, but will not be used because age_row is None
|
60 |
+
parts = str(value).split(':', 1)
|
61 |
+
val = parts[1].strip().lower() if len(parts) > 1 else ''
|
62 |
+
try:
|
63 |
+
return float(val)
|
64 |
+
except ValueError:
|
65 |
+
return None
|
66 |
+
|
67 |
+
def convert_gender(value: str) -> int:
|
68 |
+
# For demonstration, but will not be used because gender_row is None
|
69 |
+
parts = str(value).split(':', 1)
|
70 |
+
val = parts[1].strip().lower() if len(parts) > 1 else ''
|
71 |
+
if val in ['m', 'male']:
|
72 |
+
return 1
|
73 |
+
elif val in ['f', 'female']:
|
74 |
+
return 0
|
75 |
+
return None
|
76 |
+
|
77 |
+
# 3) Save Metadata with initial filtering
|
78 |
+
is_trait_available = (trait_row is not None)
|
79 |
+
_ = validate_and_save_cohort_info(
|
80 |
+
is_final=False,
|
81 |
+
cohort=cohort,
|
82 |
+
info_path=json_path,
|
83 |
+
is_gene_available=is_gene_available,
|
84 |
+
is_trait_available=is_trait_available
|
85 |
+
)
|
86 |
+
|
87 |
+
# 4) Clinical Feature Extraction - skip since trait_row is None
|
88 |
+
# STEP3
|
89 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
90 |
+
gene_data = get_genetic_data(matrix_file)
|
91 |
+
|
92 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
93 |
+
print(gene_data.index[:20])
|
94 |
+
# These identifiers (e.g., "1007_s_at", "1053_at") are probe set IDs (commonly used by Affymetrix microarray platforms).
|
95 |
+
# Therefore, they are not standard human gene symbols and do require mapping.
|
96 |
+
print("\nrequires_gene_mapping = True")
|
97 |
+
# STEP5
|
98 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
99 |
+
gene_annotation = get_gene_annotation(soft_file)
|
100 |
+
|
101 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
102 |
+
print("Gene annotation preview:")
|
103 |
+
print(preview_df(gene_annotation))
|
104 |
+
# STEP: Gene Identifier Mapping
|
105 |
+
|
106 |
+
# 1. Identify the columns in gene_annotation corresponding to the same identifiers as in gene_data and the gene symbols.
|
107 |
+
# From the preview, "ID" matches the probe IDs in gene_data, and "Gene Symbol" holds the gene symbols.
|
108 |
+
|
109 |
+
# 2. Get the gene mapping dataframe using the 'get_gene_mapping' function.
|
110 |
+
mapping_df = get_gene_mapping(
|
111 |
+
annotation=gene_annotation,
|
112 |
+
prob_col="ID", # Probe ID column
|
113 |
+
gene_col="Gene Symbol" # Gene symbol column
|
114 |
+
)
|
115 |
+
|
116 |
+
# 3. Convert probe-level measurements to gene-level expression data by applying the mapping.
|
117 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
118 |
+
|
119 |
+
# For verification, let's print the shape of the mapped gene_data and a small slice.
|
120 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
121 |
+
print(gene_data.iloc[:5, :5])
|
122 |
+
# STEP7
|
123 |
+
|
124 |
+
# In a previous step, we determined that trait data is not available, which means
|
125 |
+
# is_trait_available = False. Hence, clinical feature extraction was skipped
|
126 |
+
# and "selected_clinical_df" was never created.
|
127 |
+
|
128 |
+
# 1) Normalize gene symbols using synonym information from NCBI, then save the result.
|
129 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
130 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
131 |
+
|
132 |
+
# 2) Since the trait is unavailable, we skip linking clinical data (no "selected_clinical_df").
|
133 |
+
|
134 |
+
# 3), 4), 5) Provide final validation. The library requires 'is_biased' to be a boolean.
|
135 |
+
# Since the dataset has no trait, we set is_biased=False.
|
136 |
+
is_usable = validate_and_save_cohort_info(
|
137 |
+
is_final=True,
|
138 |
+
cohort=cohort,
|
139 |
+
info_path=json_path,
|
140 |
+
is_gene_available=True,
|
141 |
+
is_trait_available=False,
|
142 |
+
is_biased=False,
|
143 |
+
df=normalized_gene_data,
|
144 |
+
note="Trait data unavailable; only gene expression data was processed."
|
145 |
+
)
|
146 |
+
|
147 |
+
# 6) Without trait data, we cannot perform further trait-based analysis, so no final linked dataset is saved.
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/code/GSE64593.py
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Chronic_obstructive_pulmonary_disease_(COPD)"
|
6 |
+
cohort = "GSE64593"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Chronic_obstructive_pulmonary_disease_(COPD)"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Chronic_obstructive_pulmonary_disease_(COPD)/GSE64593"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/GSE64593.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE64593.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/clinical_data/GSE64593.csv"
|
16 |
+
json_path = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1. Gene Expression Data Availability
|
37 |
+
is_gene_available = True # Because the dataset is from an Affymetrix microarray, which typically measures gene expression.
|
38 |
+
|
39 |
+
# 2. Variable Availability and Data Type Conversion
|
40 |
+
|
41 |
+
# From the sample characteristics dictionary:
|
42 |
+
# {0: ['smoking status: smoker'],
|
43 |
+
# 1: ['disease state: HIV+', 'disease state: HIV-'],
|
44 |
+
# 2: ['cell type: alveolar macrophage']}
|
45 |
+
# None of the keys mentions COPD explicitly, nor is there age or gender information.
|
46 |
+
# Hence no variation for COPD, age, or gender can be found.
|
47 |
+
|
48 |
+
trait_row = None
|
49 |
+
age_row = None
|
50 |
+
gender_row = None
|
51 |
+
|
52 |
+
# Define conversion functions (though no data is available for actual use):
|
53 |
+
def convert_trait(value: str):
|
54 |
+
# Typically we'd parse the string for COPD vs. non-COPD.
|
55 |
+
# This dataset does not provide COPD info; default to None.
|
56 |
+
return None
|
57 |
+
|
58 |
+
def convert_age(value: str):
|
59 |
+
# Typically we'd parse the string for numeric age.
|
60 |
+
# No age data is present; default to None.
|
61 |
+
return None
|
62 |
+
|
63 |
+
def convert_gender(value: str):
|
64 |
+
# Typically we'd parse the string for 'male' or 'female'.
|
65 |
+
# No gender data is present; default to None.
|
66 |
+
return None
|
67 |
+
|
68 |
+
# 3. Save Metadata (initial filtering)
|
69 |
+
# Trait data is not available => is_trait_available = False
|
70 |
+
is_usable = validate_and_save_cohort_info(
|
71 |
+
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 |
+
|
78 |
+
# 4. Clinical Feature Extraction
|
79 |
+
# Skip because trait_row is None (no trait data available).
|
80 |
+
# STEP3
|
81 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
82 |
+
gene_data = get_genetic_data(matrix_file)
|
83 |
+
|
84 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
85 |
+
print(gene_data.index[:20])
|
86 |
+
# The given identifiers (e.g., "1007_s_at", "1053_at", etc.) represent Affymetrix probe set IDs,
|
87 |
+
# which are not standard human gene symbols and thus require mapping to gene symbols.
|
88 |
+
|
89 |
+
print("requires_gene_mapping = True")
|
90 |
+
# STEP5
|
91 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
92 |
+
gene_annotation = get_gene_annotation(soft_file)
|
93 |
+
|
94 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
95 |
+
print("Gene annotation preview:")
|
96 |
+
print(preview_df(gene_annotation))
|
97 |
+
# STEP6: Gene Identifier Mapping
|
98 |
+
|
99 |
+
# 1 & 2. From the preview, the gene expression data uses the "ID" column (e.g., "1007_s_at"),
|
100 |
+
# and the corresponding column in gene_annotation that stores gene symbols is "Gene Symbol".
|
101 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
102 |
+
|
103 |
+
# 3. Convert probe-level measurements to gene-level data.
|
104 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
105 |
+
import pandas as pd
|
106 |
+
|
107 |
+
# STEP7
|
108 |
+
# 1. Normalize the obtained gene data with the 'normalize_gene_symbols_in_index' function.
|
109 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
110 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
111 |
+
|
112 |
+
# Because we determined in earlier steps that there is no trait data (trait_row=None),
|
113 |
+
# we have no clinical data to link. Hence, we define an empty DataFrame for clinical data.
|
114 |
+
selected_clinical_df = pd.DataFrame()
|
115 |
+
|
116 |
+
# We also know there is no trait information, so is_trait_available is False.
|
117 |
+
# According to the instructions, if there is no trait data, we cannot proceed with
|
118 |
+
# linking, missing-value handling (which depends on trait), or bias checking.
|
119 |
+
# Instead, we finalize and record the metadata accordingly.
|
120 |
+
|
121 |
+
# 2. (Skip linking clinical and genetic data due to no trait)
|
122 |
+
|
123 |
+
# 3. (Skip missing value handling because trait column does not exist)
|
124 |
+
|
125 |
+
# 4. (Skip bias checking since there's no trait column)
|
126 |
+
|
127 |
+
# 5. Perform final quality validation and save the metadata.
|
128 |
+
# Since no trait is available, we must pass a boolean for is_biased.
|
129 |
+
# We'll set is_biased=False because we cannot check bias on nonexistent trait data.
|
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=False,
|
136 |
+
is_biased=False,
|
137 |
+
df=pd.DataFrame(),
|
138 |
+
note="No trait data detected; dataset is not suitable for trait association analysis."
|
139 |
+
)
|
140 |
+
|
141 |
+
# 6. Because no trait data is available, the dataset is not usable, so we do not save linked data.
|
142 |
+
if is_usable:
|
143 |
+
# In principle, this should not happen because is_trait_available=False implies is_usable=False
|
144 |
+
print("Unexpectedly marked as usable despite lacking trait data.")
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/code/TCGA.py
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Chronic_obstructive_pulmonary_disease_(COPD)"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/1/Chronic_obstructive_pulmonary_disease_(COPD)/cohort_info.json"
|
15 |
+
|
16 |
+
import os
|
17 |
+
import pandas as pd
|
18 |
+
|
19 |
+
# 1. Identify a suitable subdirectory for "Chronic_obstructive_pulmonary_disease_(COPD)"
|
20 |
+
subdirs = [
|
21 |
+
'CrawlData.ipynb', '.DS_Store', 'TCGA_lower_grade_glioma_and_glioblastoma_(GBMLGG)',
|
22 |
+
'TCGA_Uterine_Carcinosarcoma_(UCS)', 'TCGA_Thyroid_Cancer_(THCA)', 'TCGA_Thymoma_(THYM)',
|
23 |
+
'TCGA_Testicular_Cancer_(TGCT)', 'TCGA_Stomach_Cancer_(STAD)', 'TCGA_Sarcoma_(SARC)',
|
24 |
+
'TCGA_Rectal_Cancer_(READ)', 'TCGA_Prostate_Cancer_(PRAD)', 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)',
|
25 |
+
'TCGA_Pancreatic_Cancer_(PAAD)', 'TCGA_Ovarian_Cancer_(OV)', 'TCGA_Ocular_melanomas_(UVM)',
|
26 |
+
'TCGA_Mesothelioma_(MESO)', 'TCGA_Melanoma_(SKCM)', 'TCGA_Lung_Squamous_Cell_Carcinoma_(LUSC)',
|
27 |
+
'TCGA_Lung_Cancer_(LUNG)', 'TCGA_Lung_Adenocarcinoma_(LUAD)', 'TCGA_Lower_Grade_Glioma_(LGG)',
|
28 |
+
'TCGA_Liver_Cancer_(LIHC)', 'TCGA_Large_Bcell_Lymphoma_(DLBC)', 'TCGA_Kidney_Papillary_Cell_Carcinoma_(KIRP)',
|
29 |
+
'TCGA_Kidney_Clear_Cell_Carcinoma_(KIRC)', 'TCGA_Kidney_Chromophobe_(KICH)', 'TCGA_Head_and_Neck_Cancer_(HNSC)',
|
30 |
+
'TCGA_Glioblastoma_(GBM)', 'TCGA_Esophageal_Cancer_(ESCA)', 'TCGA_Endometrioid_Cancer_(UCEC)',
|
31 |
+
'TCGA_Colon_and_Rectal_Cancer_(COADREAD)', 'TCGA_Colon_Cancer_(COAD)', 'TCGA_Cervical_Cancer_(CESC)',
|
32 |
+
'TCGA_Breast_Cancer_(BRCA)', 'TCGA_Bladder_Cancer_(BLCA)', 'TCGA_Bile_Duct_Cancer_(CHOL)',
|
33 |
+
'TCGA_Adrenocortical_Cancer_(ACC)', 'TCGA_Acute_Myeloid_Leukemia_(LAML)'
|
34 |
+
]
|
35 |
+
|
36 |
+
# Looking for "lung" as a proxy for COPD-related data
|
37 |
+
candidate_subdirs = [s for s in subdirs if 'lung' in s.lower()]
|
38 |
+
|
39 |
+
if not candidate_subdirs:
|
40 |
+
print("No matching subdirectory found for Chronic_obstructive_pulmonary_disease_(COPD). Skipping this trait.")
|
41 |
+
else:
|
42 |
+
# Choose the most general lung-related directory if multiple exist
|
43 |
+
# Here, "TCGA_Lung_Cancer_(LUNG)" is the most general match
|
44 |
+
chosen_subdir = "TCGA_Lung_Cancer_(LUNG)"
|
45 |
+
if chosen_subdir not in candidate_subdirs:
|
46 |
+
chosen_subdir = candidate_subdirs[0] # fallback if not found
|
47 |
+
|
48 |
+
cohort_dir = os.path.join(tcga_root_dir, chosen_subdir)
|
49 |
+
|
50 |
+
# 2. Identify file paths for clinical and genetic data
|
51 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
52 |
+
|
53 |
+
# 3. Load data into Pandas DataFrames
|
54 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
|
55 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
|
56 |
+
|
57 |
+
# 4. Print the column names of the clinical data
|
58 |
+
print("Clinical Data Columns:", clinical_df.columns.tolist())
|
59 |
+
candidate_age_cols = ["age_at_initial_pathologic_diagnosis", "days_to_birth"]
|
60 |
+
candidate_gender_cols = ["gender"]
|
61 |
+
|
62 |
+
# Extract and preview the candidate columns
|
63 |
+
columns_to_extract = candidate_age_cols + candidate_gender_cols
|
64 |
+
df_extracted = clinical_df.loc[:, columns_to_extract]
|
65 |
+
preview_result = preview_df(df_extracted, n=5, max_items=200)
|
66 |
+
print(preview_result)
|
67 |
+
age_col = "age_at_initial_pathologic_diagnosis"
|
68 |
+
gender_col = "gender"
|
69 |
+
|
70 |
+
print(f"Chosen age column: {age_col}")
|
71 |
+
print(f"Chosen gender column: {gender_col}")
|
72 |
+
# 1) Extract and standardize clinical features
|
73 |
+
age_col = "age_at_initial_pathologic_diagnosis" # Updated valid age column
|
74 |
+
gender_col = "gender" # Remains valid
|
75 |
+
|
76 |
+
selected_clinical_df = tcga_select_clinical_features(
|
77 |
+
clinical_df=clinical_df,
|
78 |
+
trait=trait,
|
79 |
+
age_col=age_col,
|
80 |
+
gender_col=gender_col
|
81 |
+
)
|
82 |
+
|
83 |
+
# 2) Normalize gene symbols and save
|
84 |
+
normalized_gene_df = normalize_gene_symbols_in_index(genetic_df)
|
85 |
+
normalized_gene_df.to_csv(out_gene_data_file)
|
86 |
+
|
87 |
+
# 3) Link the clinical and genetic data
|
88 |
+
linked_data = selected_clinical_df.join(normalized_gene_df, how='inner')
|
89 |
+
|
90 |
+
# 4) Handle missing values
|
91 |
+
processed_linked_data = handle_missing_values(linked_data, trait)
|
92 |
+
|
93 |
+
# 5) Determine whether the trait/demographic features are biased
|
94 |
+
is_trait_biased, final_data = judge_and_remove_biased_features(processed_linked_data, trait)
|
95 |
+
|
96 |
+
# 6) Conduct final validation
|
97 |
+
is_usable = validate_and_save_cohort_info(
|
98 |
+
is_final=True,
|
99 |
+
cohort="TCGA",
|
100 |
+
info_path=json_path,
|
101 |
+
is_gene_available=True,
|
102 |
+
is_trait_available=True,
|
103 |
+
is_biased=is_trait_biased,
|
104 |
+
df=final_data,
|
105 |
+
note="Preprocessing complete for Chronic_kidney_disease (TCGA)."
|
106 |
+
)
|
107 |
+
|
108 |
+
# 7) If usable, save the final linked data and clinical subset
|
109 |
+
if is_usable:
|
110 |
+
final_data.to_csv(out_data_file)
|
111 |
+
clinical_cols = [c for c in [trait, "Age", "Gender"] if c in final_data.columns]
|
112 |
+
if clinical_cols:
|
113 |
+
final_data[clinical_cols].to_csv(out_clinical_data_file)
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE162635.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:082997e1f591180b3c875e2e8f3ce10c7bf06f5751db4676fb85864b0fe2acb3
|
3 |
+
size 45983176
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE175616.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE208662.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE212331.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:967fcad06150eef5443e19636e1b06db24f74f4d4fd127fa0ccec7133deb4f05
|
3 |
+
size 22261392
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE21359.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a449edf4d094d7479ffb0808221c001aecaab141df3e23788d9e6083a87d5b8a
|
3 |
+
size 27473130
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE32030.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:93ddebab0c0d764da823fcc3341c93271f75ef43390e3ed99bba86d40fed528f
|
3 |
+
size 42395312
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE64593.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE64599.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/preprocess/Chronic_obstructive_pulmonary_disease_(COPD)/gene_data/GSE84046.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d28cbd17a3b8fde7cad97fdd235a4eb7f60a848d6819c231ae2f861172439408
|
3 |
+
size 12843969
|
p1/preprocess/Fibromyalgia/GSE67311.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:11c8d40a52cd9eea5a300fd608b53b476b0e9df60aab092539a162387bc03ddb
|
3 |
+
size 33089399
|
p1/preprocess/Fibromyalgia/clinical_data/GSE67311.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
GSM1644447,GSM1644448,GSM1644449,GSM1644450,GSM1644451,GSM1644452,GSM1644453,GSM1644454,GSM1644455,GSM1644456,GSM1644457,GSM1644458,GSM1644459,GSM1644460,GSM1644461,GSM1644462,GSM1644463,GSM1644464,GSM1644465,GSM1644466,GSM1644467,GSM1644468,GSM1644469,GSM1644470,GSM1644471,GSM1644472,GSM1644473,GSM1644474,GSM1644475,GSM1644476,GSM1644477,GSM1644478,GSM1644479,GSM1644480,GSM1644481,GSM1644482,GSM1644483,GSM1644484,GSM1644485,GSM1644486,GSM1644487,GSM1644488,GSM1644489,GSM1644490,GSM1644491,GSM1644492,GSM1644493,GSM1644494,GSM1644495,GSM1644496,GSM1644497,GSM1644498,GSM1644499,GSM1644500,GSM1644501,GSM1644502,GSM1644503,GSM1644504,GSM1644505,GSM1644506,GSM1644507,GSM1644508,GSM1644509,GSM1644510,GSM1644511,GSM1644512,GSM1644513,GSM1644514,GSM1644515,GSM1644516,GSM1644517,GSM1644518,GSM1644519,GSM1644520,GSM1644521,GSM1644522,GSM1644523,GSM1644524,GSM1644525,GSM1644526,GSM1644527,GSM1644528,GSM1644529,GSM1644530,GSM1644531,GSM1644532,GSM1644533,GSM1644534,GSM1644535,GSM1644536,GSM1644537,GSM1644538,GSM1644539,GSM1644540,GSM1644541,GSM1644542,GSM1644543,GSM1644544,GSM1644545,GSM1644546,GSM1644547,GSM1644548,GSM1644549,GSM1644550,GSM1644551,GSM1644552,GSM1644553,GSM1644554,GSM1644555,GSM1644556,GSM1644557,GSM1644558,GSM1644559,GSM1644560,GSM1644561,GSM1644562,GSM1644563,GSM1644564,GSM1644565,GSM1644566,GSM1644567,GSM1644568,GSM1644569,GSM1644570,GSM1644571,GSM1644572,GSM1644573,GSM1644574,GSM1644575,GSM1644576,GSM1644577,GSM1644578,GSM1644579,GSM1644580,GSM1644581,GSM1644582,GSM1644583,GSM1644584,GSM1644585,GSM1644586,GSM1644587,GSM1644588
|
2 |
+
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
p1/preprocess/Fibromyalgia/code/GSE67311.py
ADDED
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Fibromyalgia"
|
6 |
+
cohort = "GSE67311"
|
7 |
+
|
8 |
+
# Input paths
|
9 |
+
in_trait_dir = "../DATA/GEO/Fibromyalgia"
|
10 |
+
in_cohort_dir = "../DATA/GEO/Fibromyalgia/GSE67311"
|
11 |
+
|
12 |
+
# Output paths
|
13 |
+
out_data_file = "./output/preprocess/1/Fibromyalgia/GSE67311.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Fibromyalgia/gene_data/GSE67311.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Fibromyalgia/clinical_data/GSE67311.csv"
|
16 |
+
json_path = "./output/preprocess/1/Fibromyalgia/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1. Determine if gene expression data is available
|
37 |
+
is_gene_available = True # From the background info, this is a gene expression dataset
|
38 |
+
|
39 |
+
# 2. Identify row keys for trait, age, and gender, and define conversion functions
|
40 |
+
|
41 |
+
# We see that sample characteristics dictionary at row 0 includes:
|
42 |
+
# 'diagnosis: fibromyalgia', 'diagnosis: healthy control'.
|
43 |
+
# This matches our trait-of-interest (Fibromyalgia) vs. Healthy control cohorts, so:
|
44 |
+
trait_row = 0
|
45 |
+
|
46 |
+
# There's no apparent age or gender data in the dictionary, so:
|
47 |
+
age_row = None
|
48 |
+
gender_row = None
|
49 |
+
|
50 |
+
# Define trait conversion function (binary: fibromyalgia=1, healthy=0)
|
51 |
+
def convert_trait(value: str):
|
52 |
+
if ':' in value:
|
53 |
+
value = value.split(':', 1)[1].strip()
|
54 |
+
val_lower = value.lower()
|
55 |
+
if val_lower == 'fibromyalgia':
|
56 |
+
return 1
|
57 |
+
elif val_lower == 'healthy control':
|
58 |
+
return 0
|
59 |
+
return None
|
60 |
+
|
61 |
+
# Age and gender are unavailable, so set the converting functions to None
|
62 |
+
convert_age = None
|
63 |
+
convert_gender = None
|
64 |
+
|
65 |
+
# 3. Save metadata using initial filtering
|
66 |
+
is_trait_available = (trait_row is not None)
|
67 |
+
is_usable = validate_and_save_cohort_info(
|
68 |
+
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 |
+
|
75 |
+
# 4. Clinical feature extraction if trait data is available
|
76 |
+
if trait_row is not None:
|
77 |
+
selected_clinical_df = geo_select_clinical_features(
|
78 |
+
clinical_df=clinical_data,
|
79 |
+
trait=trait,
|
80 |
+
trait_row=trait_row,
|
81 |
+
convert_trait=convert_trait,
|
82 |
+
age_row=age_row,
|
83 |
+
convert_age=convert_age,
|
84 |
+
gender_row=gender_row,
|
85 |
+
convert_gender=convert_gender
|
86 |
+
)
|
87 |
+
|
88 |
+
# Preview and save extracted clinical features
|
89 |
+
preview_result = preview_df(selected_clinical_df)
|
90 |
+
print("Preview of selected clinical features:", preview_result)
|
91 |
+
|
92 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
93 |
+
# STEP3
|
94 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
95 |
+
gene_data = get_genetic_data(matrix_file)
|
96 |
+
|
97 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
98 |
+
print(gene_data.index[:20])
|
99 |
+
# The given identifiers look like numeric probe IDs rather than standard human gene symbols,
|
100 |
+
# so they likely require mapping to gene symbols.
|
101 |
+
|
102 |
+
print("requires_gene_mapping = True")
|
103 |
+
# STEP5
|
104 |
+
import pandas as pd
|
105 |
+
import io
|
106 |
+
|
107 |
+
# 1. Extract the lines that do NOT start with '^', '!', or '#', but do NOT parse them into a DataFrame yet.
|
108 |
+
annotation_text, _ = filter_content_by_prefix(
|
109 |
+
source=soft_file,
|
110 |
+
prefixes_a=['^', '!', '#'],
|
111 |
+
unselect=True,
|
112 |
+
source_type='file',
|
113 |
+
return_df_a=False,
|
114 |
+
return_df_b=False
|
115 |
+
)
|
116 |
+
|
117 |
+
# 2. Manually parse the filtered text into a DataFrame, specifying engine="python" to avoid buffer overflow issues.
|
118 |
+
gene_annotation = pd.read_csv(
|
119 |
+
io.StringIO(annotation_text),
|
120 |
+
delimiter='\t',
|
121 |
+
on_bad_lines='skip',
|
122 |
+
engine='python'
|
123 |
+
)
|
124 |
+
|
125 |
+
print("Gene annotation preview:")
|
126 |
+
print(preview_df(gene_annotation))
|
127 |
+
# STEP: Gene Identifier Mapping
|
128 |
+
|
129 |
+
# 1. Identify which columns in the gene_annotation dataframe match our probe identifiers and gene symbols.
|
130 |
+
# From the preview, the "ID" column in gene_annotation corresponds to the same probe IDs
|
131 |
+
# used in gene_data (both numeric, e.g. '7896736', '7896738'), and "gene_assignment" stores text containing gene symbols.
|
132 |
+
|
133 |
+
# 2. Get a gene mapping dataframe: extract the "ID" column (probe ID) and "gene_assignment" column (gene text).
|
134 |
+
mapping_df = get_gene_mapping(
|
135 |
+
annotation=gene_annotation,
|
136 |
+
prob_col="ID",
|
137 |
+
gene_col="gene_assignment"
|
138 |
+
)
|
139 |
+
|
140 |
+
# 3. Apply the probe-to-gene mapping to convert probe-level data into gene-level expression.
|
141 |
+
gene_data = apply_gene_mapping(
|
142 |
+
expression_df=gene_data,
|
143 |
+
mapping_df=mapping_df
|
144 |
+
)
|
145 |
+
|
146 |
+
print("Gene-level expression data shape:", gene_data.shape)
|
147 |
+
import os
|
148 |
+
import pandas as pd
|
149 |
+
|
150 |
+
# STEP7
|
151 |
+
|
152 |
+
# 1) Normalize gene symbols and save
|
153 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
154 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
155 |
+
|
156 |
+
# 2) Try reading the clinical CSV file (trait data). If it's empty or unreadable, treat trait as unavailable.
|
157 |
+
if os.path.exists(out_clinical_data_file):
|
158 |
+
try:
|
159 |
+
tmp_df = pd.read_csv(out_clinical_data_file, header=0)
|
160 |
+
# If successfully read, check the number of rows to rename their index properly.
|
161 |
+
row_count = tmp_df.shape[0]
|
162 |
+
if row_count == 1:
|
163 |
+
tmp_df.index = [trait]
|
164 |
+
elif row_count == 2:
|
165 |
+
tmp_df.index = [trait, "Gender"]
|
166 |
+
|
167 |
+
selected_clinical_df = tmp_df
|
168 |
+
|
169 |
+
# Link the clinical and gene expression data
|
170 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
171 |
+
|
172 |
+
# 3) Handle missing values
|
173 |
+
final_data = handle_missing_values(linked_data, trait_col=trait)
|
174 |
+
|
175 |
+
# 4) Evaluate bias in the trait (and remove biased demographics if any)
|
176 |
+
trait_biased, final_data = judge_and_remove_biased_features(final_data, trait)
|
177 |
+
|
178 |
+
# 5) Final validation
|
179 |
+
is_usable = validate_and_save_cohort_info(
|
180 |
+
is_final=True,
|
181 |
+
cohort=cohort,
|
182 |
+
info_path=json_path,
|
183 |
+
is_gene_available=True,
|
184 |
+
is_trait_available=True,
|
185 |
+
is_biased=trait_biased,
|
186 |
+
df=final_data,
|
187 |
+
note="Trait and gender rows found; no age row."
|
188 |
+
)
|
189 |
+
|
190 |
+
# 6) If the dataset is usable, save
|
191 |
+
if is_usable:
|
192 |
+
final_data.to_csv(out_data_file)
|
193 |
+
|
194 |
+
except (pd.errors.EmptyDataError, ValueError):
|
195 |
+
# If file is present but empty or invalid, treat trait data as unavailable
|
196 |
+
empty_df = pd.DataFrame()
|
197 |
+
validate_and_save_cohort_info(
|
198 |
+
is_final=True,
|
199 |
+
cohort=cohort,
|
200 |
+
info_path=json_path,
|
201 |
+
is_gene_available=True,
|
202 |
+
is_trait_available=False,
|
203 |
+
is_biased=True,
|
204 |
+
df=empty_df,
|
205 |
+
note="Trait file is empty or invalid; linking and final dataset output are skipped."
|
206 |
+
)
|
207 |
+
else:
|
208 |
+
# If the clinical file does not exist at all, the trait is unavailable
|
209 |
+
empty_df = pd.DataFrame()
|
210 |
+
validate_and_save_cohort_info(
|
211 |
+
is_final=True,
|
212 |
+
cohort=cohort,
|
213 |
+
info_path=json_path,
|
214 |
+
is_gene_available=True,
|
215 |
+
is_trait_available=False,
|
216 |
+
is_biased=True,
|
217 |
+
df=empty_df,
|
218 |
+
note="No trait data file was found; linking and final dataset output are skipped."
|
219 |
+
)
|
p1/preprocess/Fibromyalgia/code/TCGA.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Path Configuration
|
2 |
+
from tools.preprocess import *
|
3 |
+
|
4 |
+
# Processing context
|
5 |
+
trait = "Fibromyalgia"
|
6 |
+
|
7 |
+
# Input paths
|
8 |
+
tcga_root_dir = "../DATA/TCGA"
|
9 |
+
|
10 |
+
# Output paths
|
11 |
+
out_data_file = "./output/preprocess/1/Fibromyalgia/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/1/Fibromyalgia/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/1/Fibromyalgia/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/1/Fibromyalgia/cohort_info.json"
|
15 |
+
|
16 |
+
import os
|
17 |
+
import pandas as pd
|
18 |
+
|
19 |
+
# 1. Identify subdirectories under tcga_root_dir
|
20 |
+
subdirectories = os.listdir(tcga_root_dir)
|
21 |
+
|
22 |
+
# Search terms related to "Fibromyalgia"
|
23 |
+
search_terms = ["fibromyalgia", "fibro", "myalgia", "chronic_widespread_pain", "cwp"]
|
24 |
+
|
25 |
+
trait_subdir = None
|
26 |
+
for d in subdirectories:
|
27 |
+
d_lower = d.lower()
|
28 |
+
if any(term in d_lower for term in search_terms):
|
29 |
+
trait_subdir = d
|
30 |
+
break
|
31 |
+
|
32 |
+
# 2. If none found, skip this trait
|
33 |
+
if not trait_subdir:
|
34 |
+
print(f"No suitable subdirectory found for trait '{trait}'. Skipping...")
|
35 |
+
is_gene_available = False
|
36 |
+
is_trait_available = False
|
37 |
+
validate_and_save_cohort_info(
|
38 |
+
is_final=False,
|
39 |
+
cohort="TCGA",
|
40 |
+
info_path=json_path,
|
41 |
+
is_gene_available=is_gene_available,
|
42 |
+
is_trait_available=is_trait_available
|
43 |
+
)
|
44 |
+
else:
|
45 |
+
# 2. Identify file paths
|
46 |
+
cohort_path = os.path.join(tcga_root_dir, trait_subdir)
|
47 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_path)
|
48 |
+
|
49 |
+
# 3. Load both files as dataframes
|
50 |
+
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t', low_memory=False)
|
51 |
+
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t', low_memory=False)
|
52 |
+
|
53 |
+
# 4. Print the column names of the clinical data
|
54 |
+
print("Clinical Data Columns:")
|
55 |
+
print(clinical_df.columns.tolist())
|
p1/preprocess/Fibromyalgia/cohort_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"GSE67311": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": false, "sample_size": 142, "note": "Trait and gender rows found; no age row."}, "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}}
|
p1/preprocess/Fibromyalgia/gene_data/GSE67311.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fdc80550137956d622d2ec9a5baefec581baacd4c28f983c456b9d007fbd70b7
|
3 |
+
size 33088822
|
p1/preprocess/Glioblastoma/TCGA.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5170e381783cf867e23ecb4790f0c49eff21d537ecb0607fc90621f2ce31281b
|
3 |
+
size 203624113
|
p1/preprocess/Glioblastoma/gene_data/TCGA.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ca538730424e09dc117dcbf2b9e361e18a559838fbd5166c65c39e001c215c63
|
3 |
+
size 203622702
|
p1/preprocess/Head_and_Neck_Cancer/TCGA.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0a9b72fb349ad95e08acaebe045aa49a7d95ad31aae83e577f590fd9a3056abc
|
3 |
+
size 169988287
|
p1/preprocess/Head_and_Neck_Cancer/gene_data/TCGA.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ebda0991a4c4e9b1b7e992e8c4f50e2908e2645936891de033875c79b30d9d3a
|
3 |
+
size 169983153
|
p1/preprocess/Hemochromatosis/TCGA.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eec160b54aa9855ceddc4988ca780752ff5298e5566b4d67b0234c972fbcc3d1
|
3 |
+
size 126898644
|
p1/preprocess/Hemochromatosis/gene_data/TCGA.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fda4b7e0eb1b7d3ae8ef43544fbcfc1289fc40b4c948499e0a55cde48b1cf574
|
3 |
+
size 126894803
|
p1/preprocess/Huntingtons_Disease/gene_data/GSE71220.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f4f0575f14ea122261d0572e8589b41ae150b12d772014d41c58d99724519df8
|
3 |
+
size 70795998
|
p1/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
|
p1/preprocess/Hypertrophic_Cardiomyopathy/GSE36961.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e0f2c7c618224cd61d0c3265ce233974df4bcff562b6310f301a944862d35f59
|
3 |
+
size 31702635
|
p1/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 |
+
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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 |
+
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 |
+
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
|
p1/preprocess/Hypertrophic_Cardiomyopathy/code/GSE36961.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/1/Hypertrophic_Cardiomyopathy/GSE36961.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Hypertrophic_Cardiomyopathy/gene_data/GSE36961.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Hypertrophic_Cardiomyopathy/clinical_data/GSE36961.csv"
|
16 |
+
json_path = "./output/preprocess/1/Hypertrophic_Cardiomyopathy/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1. Gene Expression Data Availability
|
37 |
+
is_gene_available = True # This is a gene expression (mRNA) study
|
38 |
+
|
39 |
+
# 2. Variable Availability
|
40 |
+
trait_row = 3 # "disease state: hypertrophic cardiomyopathy (HCM)" vs "sample type: control"
|
41 |
+
age_row = 1 # "age (yrs): 9, 10, 11, ... 51"
|
42 |
+
gender_row = 0 # "Sex: male", "Sex: female"
|
43 |
+
|
44 |
+
# 2.2 Data Type Conversion
|
45 |
+
def convert_trait(value: str):
|
46 |
+
if not isinstance(value, str):
|
47 |
+
return None
|
48 |
+
parts = value.split(':', 1)
|
49 |
+
if len(parts) > 1:
|
50 |
+
raw_val = parts[1].strip().lower()
|
51 |
+
else:
|
52 |
+
raw_val = value.strip().lower()
|
53 |
+
if "cardiomyopathy" in raw_val:
|
54 |
+
return 1
|
55 |
+
elif "control" in raw_val:
|
56 |
+
return 0
|
57 |
+
else:
|
58 |
+
return None
|
59 |
+
|
60 |
+
def convert_age(value: str):
|
61 |
+
if not isinstance(value, str):
|
62 |
+
return None
|
63 |
+
parts = value.split(':', 1)
|
64 |
+
if len(parts) > 1:
|
65 |
+
raw_val = parts[1].strip()
|
66 |
+
else:
|
67 |
+
raw_val = value.strip()
|
68 |
+
try:
|
69 |
+
return float(raw_val)
|
70 |
+
except:
|
71 |
+
return None
|
72 |
+
|
73 |
+
def convert_gender(value: str):
|
74 |
+
if not isinstance(value, str):
|
75 |
+
return None
|
76 |
+
parts = value.split(':', 1)
|
77 |
+
if len(parts) > 1:
|
78 |
+
raw_val = parts[1].strip().lower()
|
79 |
+
else:
|
80 |
+
raw_val = value.strip().lower()
|
81 |
+
if "female" in raw_val:
|
82 |
+
return 0
|
83 |
+
elif "male" in raw_val:
|
84 |
+
return 1
|
85 |
+
else:
|
86 |
+
return None
|
87 |
+
|
88 |
+
# 3. Save Metadata (initial filtering)
|
89 |
+
is_trait_available = (trait_row is not None)
|
90 |
+
usable_init = validate_and_save_cohort_info(
|
91 |
+
is_final=False,
|
92 |
+
cohort=cohort,
|
93 |
+
info_path=json_path,
|
94 |
+
is_gene_available=is_gene_available,
|
95 |
+
is_trait_available=is_trait_available
|
96 |
+
)
|
97 |
+
|
98 |
+
# 4. Clinical Feature Extraction (only if trait_row is not None)
|
99 |
+
if trait_row is not None:
|
100 |
+
selected_clinical_df = geo_select_clinical_features(
|
101 |
+
clinical_data,
|
102 |
+
trait,
|
103 |
+
trait_row,
|
104 |
+
convert_trait,
|
105 |
+
age_row,
|
106 |
+
convert_age,
|
107 |
+
gender_row,
|
108 |
+
convert_gender
|
109 |
+
)
|
110 |
+
print("Preview of selected clinical features:")
|
111 |
+
print(preview_df(selected_clinical_df, 5))
|
112 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
113 |
+
# STEP3
|
114 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
115 |
+
gene_data = get_genetic_data(matrix_file)
|
116 |
+
|
117 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
118 |
+
print(gene_data.index[:20])
|
119 |
+
print("Based on the gene identifier list, they appear to be standard gene symbols.\nrequires_gene_mapping = False")
|
120 |
+
# STEP5
|
121 |
+
# 1. Normalize gene symbols using the NCBI Gene database synonym information.
|
122 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
123 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
124 |
+
|
125 |
+
# 2. Link the clinical and genetic data.
|
126 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
127 |
+
|
128 |
+
# 3. Handle missing values.
|
129 |
+
linked_data = handle_missing_values(linked_data, trait)
|
130 |
+
|
131 |
+
# 4. Determine bias in the trait and demographic features.
|
132 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
133 |
+
|
134 |
+
# 5. Final quality validation and metadata saving.
|
135 |
+
is_usable = validate_and_save_cohort_info(
|
136 |
+
is_final=True,
|
137 |
+
cohort=cohort,
|
138 |
+
info_path=json_path,
|
139 |
+
is_gene_available=True,
|
140 |
+
is_trait_available=True,
|
141 |
+
is_biased=is_trait_biased,
|
142 |
+
df=unbiased_linked_data
|
143 |
+
)
|
144 |
+
|
145 |
+
# 6. Save the fully processed data only if it's usable.
|
146 |
+
if is_usable:
|
147 |
+
unbiased_linked_data.to_csv(out_data_file)
|
p1/preprocess/Hypertrophic_Cardiomyopathy/code/TCGA.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/1/Hypertrophic_Cardiomyopathy/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/1/Hypertrophic_Cardiomyopathy/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/1/Hypertrophic_Cardiomyopathy/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/1/Hypertrophic_Cardiomyopathy/cohort_info.json"
|
15 |
+
|
16 |
+
import os
|
17 |
+
|
18 |
+
# 1. Identify subdirectories in tcga_root_dir
|
19 |
+
subdirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
20 |
+
|
21 |
+
# 2. Attempt to find a match to "Hypertrophic_Cardiomyopathy"
|
22 |
+
trait_keywords = ["hypertrophic", "cardiomyopathy", "heart", "cardiac"]
|
23 |
+
matched_dirs = []
|
24 |
+
for d in subdirs:
|
25 |
+
lower_d = d.lower()
|
26 |
+
if any(keyword in lower_d for keyword in trait_keywords):
|
27 |
+
matched_dirs.append(d)
|
28 |
+
|
29 |
+
# 3. If no suitable directories found, skip this trait and mark the task completed
|
30 |
+
if not matched_dirs:
|
31 |
+
print("No suitable TCGA subdirectory found for trait:", trait)
|
32 |
+
validate_and_save_cohort_info(
|
33 |
+
is_final=False,
|
34 |
+
cohort="TCGA",
|
35 |
+
info_path=json_path,
|
36 |
+
is_gene_available=False,
|
37 |
+
is_trait_available=False,
|
38 |
+
note="No matched subdirectory found for this trait."
|
39 |
+
)
|
40 |
+
else:
|
41 |
+
# Normally, we'd pick the best match if multiple. For now, pick the first.
|
42 |
+
chosen_dir = matched_dirs[0]
|
43 |
+
chosen_path = os.path.join(tcga_root_dir, chosen_dir)
|
44 |
+
# 2. Identify data file paths
|
45 |
+
clinical_file, genetic_file = tcga_get_relevant_filepaths(chosen_path)
|
46 |
+
# 3. Load both files as dataframes
|
47 |
+
clinical_df = pd.read_csv(clinical_file, index_col=0, sep='\t')
|
48 |
+
genetic_df = pd.read_csv(genetic_file, index_col=0, sep='\t')
|
49 |
+
# 4. Print the clinical data columns
|
50 |
+
print("Clinical data columns:", clinical_df.columns.tolist())
|
p1/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": true, "has_gender": true, "sample_size": 142, "note": ""}, "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}}
|
p1/preprocess/Hypertrophic_Cardiomyopathy/gene_data/GSE36961.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0fd3cb153e8a94a03d27a8048601cf21af7c6b47d562397e7c7c0d3e9e2ed1bf
|
3 |
+
size 32368017
|
p1/preprocess/Hypothyroidism/GSE151158.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
p1/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 |
+
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 |
+
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 |
+
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,,,,,
|
p1/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 |
+
1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
3 |
+
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 |
+
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
|
p1/preprocess/Hypothyroidism/clinical_data/GSE75678.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
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 |
+
0.0,0.0,0.0,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 |
+
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
|
p1/preprocess/Hypothyroidism/clinical_data/GSE75685.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
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 |
+
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 |
+
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
|
p1/preprocess/Hypothyroidism/clinical_data/TCGA.csv
ADDED
@@ -0,0 +1,573 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,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-A28V-01,1,80,0
|
27 |
+
TCGA-BJ-A28W-01,1,32,0
|
28 |
+
TCGA-BJ-A28W-11,0,32,0
|
29 |
+
TCGA-BJ-A28X-01,1,32,0
|
30 |
+
TCGA-BJ-A28X-11,0,32,0
|
31 |
+
TCGA-BJ-A28Z-01,1,46,0
|
32 |
+
TCGA-BJ-A290-01,1,70,1
|
33 |
+
TCGA-BJ-A290-11,0,70,1
|
34 |
+
TCGA-BJ-A291-01,1,56,0
|
35 |
+
TCGA-BJ-A2N7-01,1,30,0
|
36 |
+
TCGA-BJ-A2N7-11,0,30,0
|
37 |
+
TCGA-BJ-A2N8-01,1,30,0
|
38 |
+
TCGA-BJ-A2N8-11,0,30,0
|
39 |
+
TCGA-BJ-A2N9-01,1,42,0
|
40 |
+
TCGA-BJ-A2N9-11,0,42,0
|
41 |
+
TCGA-BJ-A2NA-01,1,77,1
|
42 |
+
TCGA-BJ-A2NA-11,0,77,1
|
43 |
+
TCGA-BJ-A2P4-01,1,29,0
|
44 |
+
TCGA-BJ-A3EZ-01,1,51,1
|
45 |
+
TCGA-BJ-A3F0-01,1,64,0
|
46 |
+
TCGA-BJ-A3PR-01,1,69,0
|
47 |
+
TCGA-BJ-A3PR-11,0,69,0
|
48 |
+
TCGA-BJ-A3PT-01,1,51,0
|
49 |
+
TCGA-BJ-A3PU-01,1,52,1
|
50 |
+
TCGA-BJ-A3PU-11,0,52,1
|
51 |
+
TCGA-BJ-A45C-01,1,78,1
|
52 |
+
TCGA-BJ-A45D-01,1,36,1
|
53 |
+
TCGA-BJ-A45E-01,1,46,0
|
54 |
+
TCGA-BJ-A45F-01,1,59,0
|
55 |
+
TCGA-BJ-A45G-01,1,48,0
|
56 |
+
TCGA-BJ-A45H-01,1,45,1
|
57 |
+
TCGA-BJ-A45I-01,1,51,0
|
58 |
+
TCGA-BJ-A45J-01,1,39,0
|
59 |
+
TCGA-BJ-A45K-01,1,33,1
|
60 |
+
TCGA-BJ-A4O8-01,1,47,1
|
61 |
+
TCGA-BJ-A4O9-01,1,51,0
|
62 |
+
TCGA-CE-A13K-01,1,30,0
|
63 |
+
TCGA-CE-A27D-01,1,28,0
|
64 |
+
TCGA-CE-A3MD-01,1,31,1
|
65 |
+
TCGA-CE-A3ME-01,1,51,0
|
66 |
+
TCGA-CE-A481-01,1,41,0
|
67 |
+
TCGA-CE-A482-01,1,27,0
|
68 |
+
TCGA-CE-A483-01,1,34,0
|
69 |
+
TCGA-CE-A484-01,1,37,0
|
70 |
+
TCGA-CE-A485-01,1,32,1
|
71 |
+
TCGA-DE-A0XZ-01,1,65,0
|
72 |
+
TCGA-DE-A0Y2-01,1,30,0
|
73 |
+
TCGA-DE-A0Y3-01,1,60,0
|
74 |
+
TCGA-DE-A2OL-01,1,44,0
|
75 |
+
TCGA-DE-A3KN-01,1,49,0
|
76 |
+
TCGA-DE-A4M8-01,1,61,0
|
77 |
+
TCGA-DE-A4M9-01,1,28,1
|
78 |
+
TCGA-DE-A4MA-01,1,52,0
|
79 |
+
TCGA-DE-A4MB-01,1,79,0
|
80 |
+
TCGA-DE-A4MC-01,1,43,0
|
81 |
+
TCGA-DE-A4MD-01,1,71,1
|
82 |
+
TCGA-DE-A4MD-06,1,71,1
|
83 |
+
TCGA-DE-A69J-01,1,34,0
|
84 |
+
TCGA-DE-A69K-01,1,58,0
|
85 |
+
TCGA-DE-A7U5-01,1,36,0
|
86 |
+
TCGA-DJ-A13L-01,1,85,1
|
87 |
+
TCGA-DJ-A13M-01,1,28,0
|
88 |
+
TCGA-DJ-A13O-01,1,56,1
|
89 |
+
TCGA-DJ-A13P-01,1,52,0
|
90 |
+
TCGA-DJ-A13R-01,1,50,1
|
91 |
+
TCGA-DJ-A13S-01,1,19,0
|
92 |
+
TCGA-DJ-A13T-01,1,37,0
|
93 |
+
TCGA-DJ-A13U-01,1,60,1
|
94 |
+
TCGA-DJ-A13V-01,1,21,0
|
95 |
+
TCGA-DJ-A13W-01,1,45,0
|
96 |
+
TCGA-DJ-A13X-01,1,51,0
|
97 |
+
TCGA-DJ-A1QD-01,1,20,0
|
98 |
+
TCGA-DJ-A1QE-01,1,62,0
|
99 |
+
TCGA-DJ-A1QF-01,1,61,0
|
100 |
+
TCGA-DJ-A1QG-01,1,62,1
|
101 |
+
TCGA-DJ-A1QH-01,1,58,0
|
102 |
+
TCGA-DJ-A1QI-01,1,63,0
|
103 |
+
TCGA-DJ-A1QL-01,1,70,1
|
104 |
+
TCGA-DJ-A1QM-01,1,42,1
|
105 |
+
TCGA-DJ-A1QN-01,1,42,0
|
106 |
+
TCGA-DJ-A1QO-01,1,69,1
|
107 |
+
TCGA-DJ-A1QQ-01,1,43,1
|
108 |
+
TCGA-DJ-A2PN-01,1,70,0
|
109 |
+
TCGA-DJ-A2PO-01,1,54,1
|
110 |
+
TCGA-DJ-A2PP-01,1,47,1
|
111 |
+
TCGA-DJ-A2PQ-01,1,26,1
|
112 |
+
TCGA-DJ-A2PR-01,1,27,1
|
113 |
+
TCGA-DJ-A2PS-01,1,40,0
|
114 |
+
TCGA-DJ-A2PT-01,1,70,0
|
115 |
+
TCGA-DJ-A2PU-01,1,52,0
|
116 |
+
TCGA-DJ-A2PV-01,1,53,0
|
117 |
+
TCGA-DJ-A2PW-01,1,65,1
|
118 |
+
TCGA-DJ-A2PX-01,1,55,0
|
119 |
+
TCGA-DJ-A2PY-01,1,46,0
|
120 |
+
TCGA-DJ-A2PZ-01,1,63,1
|
121 |
+
TCGA-DJ-A2Q0-01,1,57,0
|
122 |
+
TCGA-DJ-A2Q1-01,1,44,0
|
123 |
+
TCGA-DJ-A2Q2-01,1,57,0
|
124 |
+
TCGA-DJ-A2Q3-01,1,61,0
|
125 |
+
TCGA-DJ-A2Q4-01,1,53,1
|
126 |
+
TCGA-DJ-A2Q5-01,1,51,1
|
127 |
+
TCGA-DJ-A2Q6-01,1,38,0
|
128 |
+
TCGA-DJ-A2Q7-01,1,52,0
|
129 |
+
TCGA-DJ-A2Q9-01,1,65,0
|
130 |
+
TCGA-DJ-A2QA-01,1,56,0
|
131 |
+
TCGA-DJ-A2QB-01,1,53,0
|
132 |
+
TCGA-DJ-A2QC-01,1,70,0
|
133 |
+
TCGA-DJ-A3UK-01,1,35,0
|
134 |
+
TCGA-DJ-A3UM-01,1,45,0
|
135 |
+
TCGA-DJ-A3UN-01,1,51,0
|
136 |
+
TCGA-DJ-A3UO-01,1,63,1
|
137 |
+
TCGA-DJ-A3UP-01,1,38,0
|
138 |
+
TCGA-DJ-A3UQ-01,1,45,0
|
139 |
+
TCGA-DJ-A3UR-01,1,51,0
|
140 |
+
TCGA-DJ-A3US-01,1,37,0
|
141 |
+
TCGA-DJ-A3UT-01,1,43,0
|
142 |
+
TCGA-DJ-A3UU-01,1,49,0
|
143 |
+
TCGA-DJ-A3UV-01,1,18,0
|
144 |
+
TCGA-DJ-A3UW-01,1,50,0
|
145 |
+
TCGA-DJ-A3UX-01,1,46,0
|
146 |
+
TCGA-DJ-A3UY-01,1,32,0
|
147 |
+
TCGA-DJ-A3UZ-01,1,70,0
|
148 |
+
TCGA-DJ-A3V0-01,1,56,1
|
149 |
+
TCGA-DJ-A3V2-01,1,44,0
|
150 |
+
TCGA-DJ-A3V3-01,1,57,0
|
151 |
+
TCGA-DJ-A3V4-01,1,60,0
|
152 |
+
TCGA-DJ-A3V5-01,1,76,0
|
153 |
+
TCGA-DJ-A3V6-01,1,54,1
|
154 |
+
TCGA-DJ-A3V7-01,1,44,0
|
155 |
+
TCGA-DJ-A3V8-01,1,28,0
|
156 |
+
TCGA-DJ-A3V9-01,1,50,0
|
157 |
+
TCGA-DJ-A3VA-01,1,39,0
|
158 |
+
TCGA-DJ-A3VB-01,1,52,1
|
159 |
+
TCGA-DJ-A3VD-01,1,32,0
|
160 |
+
TCGA-DJ-A3VE-01,1,50,1
|
161 |
+
TCGA-DJ-A3VF-01,1,60,0
|
162 |
+
TCGA-DJ-A3VG-01,1,40,1
|
163 |
+
TCGA-DJ-A3VI-01,1,52,0
|
164 |
+
TCGA-DJ-A3VJ-01,1,22,1
|
165 |
+
TCGA-DJ-A3VK-01,1,63,1
|
166 |
+
TCGA-DJ-A3VL-01,1,38,1
|
167 |
+
TCGA-DJ-A3VM-01,1,68,0
|
168 |
+
TCGA-DJ-A4UL-01,1,68,0
|
169 |
+
TCGA-DJ-A4UP-01,1,15,0
|
170 |
+
TCGA-DJ-A4UQ-01,1,60,1
|
171 |
+
TCGA-DJ-A4UR-01,1,36,0
|
172 |
+
TCGA-DJ-A4UT-01,1,32,0
|
173 |
+
TCGA-DJ-A4UW-01,1,34,0
|
174 |
+
TCGA-DJ-A4V0-01,1,36,0
|
175 |
+
TCGA-DJ-A4V2-01,1,38,0
|
176 |
+
TCGA-DJ-A4V4-01,1,48,0
|
177 |
+
TCGA-DJ-A4V5-01,1,55,1
|
178 |
+
TCGA-DO-A1JZ-01,1,23,0
|
179 |
+
TCGA-DO-A1JZ-11,0,23,0
|
180 |
+
TCGA-DO-A1K0-01,1,30,0
|
181 |
+
TCGA-DO-A2HM-01,1,49,1
|
182 |
+
TCGA-E3-A3DY-01,1,37,1
|
183 |
+
TCGA-E3-A3DZ-01,1,55,0
|
184 |
+
TCGA-E3-A3E0-01,1,34,0
|
185 |
+
TCGA-E3-A3E1-01,1,46,0
|
186 |
+
TCGA-E3-A3E2-01,1,34,0
|
187 |
+
TCGA-E3-A3E3-01,1,49,0
|
188 |
+
TCGA-E3-A3E5-01,1,57,1
|
189 |
+
TCGA-E8-A242-01,1,56,0
|
190 |
+
TCGA-E8-A2EA-01,1,52,0
|
191 |
+
TCGA-E8-A2JQ-01,1,18,0
|
192 |
+
TCGA-E8-A2JQ-11,0,18,0
|
193 |
+
TCGA-E8-A3X7-01,1,57,0
|
194 |
+
TCGA-E8-A413-01,1,38,0
|
195 |
+
TCGA-E8-A414-01,1,45,0
|
196 |
+
TCGA-E8-A415-01,1,39,0
|
197 |
+
TCGA-E8-A416-01,1,51,0
|
198 |
+
TCGA-E8-A417-01,1,38,0
|
199 |
+
TCGA-E8-A418-01,1,75,0
|
200 |
+
TCGA-E8-A419-01,1,30,0
|
201 |
+
TCGA-E8-A432-01,1,57,0
|
202 |
+
TCGA-E8-A433-01,1,25,0
|
203 |
+
TCGA-E8-A434-01,1,56,0
|
204 |
+
TCGA-E8-A436-01,1,53,0
|
205 |
+
TCGA-E8-A437-01,1,57,0
|
206 |
+
TCGA-E8-A438-01,1,23,0
|
207 |
+
TCGA-E8-A44K-01,1,50,0
|
208 |
+
TCGA-E8-A44M-01,1,23,0
|
209 |
+
TCGA-EL-A3CL-01,1,70,0
|
210 |
+
TCGA-EL-A3CM-01,1,64,0
|
211 |
+
TCGA-EL-A3CN-01,1,47,0
|
212 |
+
TCGA-EL-A3CO-01,1,88,1
|
213 |
+
TCGA-EL-A3CP-01,1,50,0
|
214 |
+
TCGA-EL-A3CR-01,1,78,0
|
215 |
+
TCGA-EL-A3CS-01,1,62,0
|
216 |
+
TCGA-EL-A3CT-01,1,78,0
|
217 |
+
TCGA-EL-A3CU-01,1,70,0
|
218 |
+
TCGA-EL-A3CV-01,1,40,1
|
219 |
+
TCGA-EL-A3CW-01,1,87,0
|
220 |
+
TCGA-EL-A3CX-01,1,22,0
|
221 |
+
TCGA-EL-A3CY-01,1,28,1
|
222 |
+
TCGA-EL-A3CZ-01,1,37,0
|
223 |
+
TCGA-EL-A3D0-01,1,61,1
|
224 |
+
TCGA-EL-A3D1-01,1,39,1
|
225 |
+
TCGA-EL-A3D4-01,1,62,1
|
226 |
+
TCGA-EL-A3D5-01,1,44,0
|
227 |
+
TCGA-EL-A3D6-01,1,51,0
|
228 |
+
TCGA-EL-A3GO-01,1,31,0
|
229 |
+
TCGA-EL-A3GP-01,1,70,1
|
230 |
+
TCGA-EL-A3GQ-01,1,72,0
|
231 |
+
TCGA-EL-A3GR-01,1,31,0
|
232 |
+
TCGA-EL-A3GS-01,1,37,0
|
233 |
+
TCGA-EL-A3GU-01,1,72,0
|
234 |
+
TCGA-EL-A3GV-01,1,65,0
|
235 |
+
TCGA-EL-A3GW-01,1,37,0
|
236 |
+
TCGA-EL-A3GX-01,1,41,0
|
237 |
+
TCGA-EL-A3GY-01,1,40,0
|
238 |
+
TCGA-EL-A3GZ-01,1,34,0
|
239 |
+
TCGA-EL-A3GZ-11,0,34,0
|
240 |
+
TCGA-EL-A3H1-01,1,66,0
|
241 |
+
TCGA-EL-A3H1-11,0,66,0
|
242 |
+
TCGA-EL-A3H2-01,1,58,1
|
243 |
+
TCGA-EL-A3H2-11,0,58,1
|
244 |
+
TCGA-EL-A3H3-01,1,19,0
|
245 |
+
TCGA-EL-A3H4-01,1,46,0
|
246 |
+
TCGA-EL-A3H5-01,1,57,0
|
247 |
+
TCGA-EL-A3H7-01,1,36,0
|
248 |
+
TCGA-EL-A3H7-11,0,36,0
|
249 |
+
TCGA-EL-A3H8-01,1,35,0
|
250 |
+
TCGA-EL-A3MW-01,1,55,0
|
251 |
+
TCGA-EL-A3MW-11,0,55,0
|
252 |
+
TCGA-EL-A3MX-01,1,66,0
|
253 |
+
TCGA-EL-A3MX-11,0,66,0
|
254 |
+
TCGA-EL-A3MY-01,1,81,1
|
255 |
+
TCGA-EL-A3MY-11,0,81,1
|
256 |
+
TCGA-EL-A3MZ-01,1,66,1
|
257 |
+
TCGA-EL-A3N2-01,1,24,0
|
258 |
+
TCGA-EL-A3N2-11,0,24,0
|
259 |
+
TCGA-EL-A3N3-01,1,53,0
|
260 |
+
TCGA-EL-A3N3-11,0,53,0
|
261 |
+
TCGA-EL-A3T0-01,1,45,0
|
262 |
+
TCGA-EL-A3T0-11,0,45,0
|
263 |
+
TCGA-EL-A3T1-01,1,38,0
|
264 |
+
TCGA-EL-A3T1-11,0,38,0
|
265 |
+
TCGA-EL-A3T2-01,1,55,0
|
266 |
+
TCGA-EL-A3T2-11,0,55,0
|
267 |
+
TCGA-EL-A3T3-01,1,63,1
|
268 |
+
TCGA-EL-A3T3-11,0,63,1
|
269 |
+
TCGA-EL-A3T6-01,1,34,0
|
270 |
+
TCGA-EL-A3T6-11,0,34,0
|
271 |
+
TCGA-EL-A3T7-01,1,47,0
|
272 |
+
TCGA-EL-A3T7-11,0,47,0
|
273 |
+
TCGA-EL-A3T8-01,1,36,1
|
274 |
+
TCGA-EL-A3T8-11,0,36,1
|
275 |
+
TCGA-EL-A3T9-01,1,69,0
|
276 |
+
TCGA-EL-A3TA-01,1,42,1
|
277 |
+
TCGA-EL-A3TA-11,0,42,1
|
278 |
+
TCGA-EL-A3TB-01,1,47,0
|
279 |
+
TCGA-EL-A3TB-11,0,47,0
|
280 |
+
TCGA-EL-A3ZG-01,1,15,1
|
281 |
+
TCGA-EL-A3ZG-11,0,15,1
|
282 |
+
TCGA-EL-A3ZH-01,1,42,0
|
283 |
+
TCGA-EL-A3ZH-11,0,42,0
|
284 |
+
TCGA-EL-A3ZK-01,1,41,0
|
285 |
+
TCGA-EL-A3ZK-11,0,41,0
|
286 |
+
TCGA-EL-A3ZL-01,1,34,0
|
287 |
+
TCGA-EL-A3ZL-11,0,34,0
|
288 |
+
TCGA-EL-A3ZM-01,1,60,1
|
289 |
+
TCGA-EL-A3ZM-11,0,60,1
|
290 |
+
TCGA-EL-A3ZN-01,1,28,0
|
291 |
+
TCGA-EL-A3ZO-01,1,79,0
|
292 |
+
TCGA-EL-A3ZO-11,0,79,0
|
293 |
+
TCGA-EL-A3ZP-01,1,19,1
|
294 |
+
TCGA-EL-A3ZP-11,0,19,1
|
295 |
+
TCGA-EL-A3ZQ-01,1,78,0
|
296 |
+
TCGA-EL-A3ZQ-11,0,78,0
|
297 |
+
TCGA-EL-A3ZR-01,1,46,0
|
298 |
+
TCGA-EL-A3ZR-11,0,46,0
|
299 |
+
TCGA-EL-A3ZS-01,1,22,0
|
300 |
+
TCGA-EL-A3ZS-11,0,22,0
|
301 |
+
TCGA-EL-A3ZT-01,1,35,1
|
302 |
+
TCGA-EL-A3ZT-11,0,35,1
|
303 |
+
TCGA-EL-A4JV-01,1,41,0
|
304 |
+
TCGA-EL-A4JW-01,1,38,0
|
305 |
+
TCGA-EL-A4JX-01,1,31,0
|
306 |
+
TCGA-EL-A4JZ-01,1,55,0
|
307 |
+
TCGA-EL-A4K0-01,1,54,0
|
308 |
+
TCGA-EL-A4K1-01,1,68,0
|
309 |
+
TCGA-EL-A4K2-01,1,43,0
|
310 |
+
TCGA-EL-A4K4-01,1,33,0
|
311 |
+
TCGA-EL-A4K6-01,1,75,1
|
312 |
+
TCGA-EL-A4K7-01,1,74,1
|
313 |
+
TCGA-EL-A4K9-01,1,68,1
|
314 |
+
TCGA-EL-A4KD-01,1,41,1
|
315 |
+
TCGA-EL-A4KG-01,1,35,0
|
316 |
+
TCGA-EL-A4KH-01,1,36,0
|
317 |
+
TCGA-EL-A4KI-01,1,63,1
|
318 |
+
TCGA-EM-A1CS-01,1,55,0
|
319 |
+
TCGA-EM-A1CS-11,0,55,0
|
320 |
+
TCGA-EM-A1CT-01,1,76,1
|
321 |
+
TCGA-EM-A1CT-11,0,76,1
|
322 |
+
TCGA-EM-A1CU-01,1,31,1
|
323 |
+
TCGA-EM-A1CU-11,0,31,1
|
324 |
+
TCGA-EM-A1CV-01,1,32,0
|
325 |
+
TCGA-EM-A1CV-11,0,32,0
|
326 |
+
TCGA-EM-A1CW-01,1,39,0
|
327 |
+
TCGA-EM-A1CW-11,0,39,0
|
328 |
+
TCGA-EM-A1YA-01,1,74,0
|
329 |
+
TCGA-EM-A1YB-01,1,73,0
|
330 |
+
TCGA-EM-A1YC-01,1,71,0
|
331 |
+
TCGA-EM-A1YC-11,0,71,0
|
332 |
+
TCGA-EM-A1YD-01,1,53,0
|
333 |
+
TCGA-EM-A1YE-01,1,47,0
|
334 |
+
TCGA-EM-A22I-01,1,52,0
|
335 |
+
TCGA-EM-A22J-01,1,56,0
|
336 |
+
TCGA-EM-A22K-01,1,46,0
|
337 |
+
TCGA-EM-A22L-01,1,33,0
|
338 |
+
TCGA-EM-A22M-01,1,52,1
|
339 |
+
TCGA-EM-A22N-01,1,68,0
|
340 |
+
TCGA-EM-A22O-01,1,75,1
|
341 |
+
TCGA-EM-A22P-01,1,64,1
|
342 |
+
TCGA-EM-A22Q-01,1,36,1
|
343 |
+
TCGA-EM-A2CJ-01,1,49,0
|
344 |
+
TCGA-EM-A2CK-01,1,28,1
|
345 |
+
TCGA-EM-A2CL-01,1,31,1
|
346 |
+
TCGA-EM-A2CM-01,1,62,0
|
347 |
+
TCGA-EM-A2CN-01,1,62,1
|
348 |
+
TCGA-EM-A2CO-01,1,77,0
|
349 |
+
TCGA-EM-A2CP-01,1,26,0
|
350 |
+
TCGA-EM-A2CQ-01,1,40,0
|
351 |
+
TCGA-EM-A2CR-01,1,46,0
|
352 |
+
TCGA-EM-A2CS-01,1,51,0
|
353 |
+
TCGA-EM-A2CS-06,1,51,0
|
354 |
+
TCGA-EM-A2CT-01,1,20,0
|
355 |
+
TCGA-EM-A2CU-01,1,47,0
|
356 |
+
TCGA-EM-A2OV-01,1,64,0
|
357 |
+
TCGA-EM-A2OW-01,1,37,0
|
358 |
+
TCGA-EM-A2OX-01,1,46,1
|
359 |
+
TCGA-EM-A2OY-01,1,46,0
|
360 |
+
TCGA-EM-A2OZ-01,1,66,1
|
361 |
+
TCGA-EM-A2P0-01,1,33,1
|
362 |
+
TCGA-EM-A2P1-01,1,33,1
|
363 |
+
TCGA-EM-A2P1-06,1,33,1
|
364 |
+
TCGA-EM-A2P2-01,1,46,1
|
365 |
+
TCGA-EM-A2P3-01,1,47,0
|
366 |
+
TCGA-EM-A3AI-01,1,67,0
|
367 |
+
TCGA-EM-A3AJ-01,1,39,1
|
368 |
+
TCGA-EM-A3AK-01,1,62,0
|
369 |
+
TCGA-EM-A3AL-01,1,45,0
|
370 |
+
TCGA-EM-A3AN-01,1,36,0
|
371 |
+
TCGA-EM-A3AO-01,1,61,1
|
372 |
+
TCGA-EM-A3AP-01,1,31,0
|
373 |
+
TCGA-EM-A3AQ-01,1,85,0
|
374 |
+
TCGA-EM-A3AR-01,1,41,1
|
375 |
+
TCGA-EM-A3FJ-01,1,24,0
|
376 |
+
TCGA-EM-A3FK-01,1,30,0
|
377 |
+
TCGA-EM-A3FL-01,1,63,0
|
378 |
+
TCGA-EM-A3FM-01,1,57,1
|
379 |
+
TCGA-EM-A3FN-01,1,42,0
|
380 |
+
TCGA-EM-A3FO-01,1,40,1
|
381 |
+
TCGA-EM-A3FP-01,1,71,0
|
382 |
+
TCGA-EM-A3FQ-01,1,19,0
|
383 |
+
TCGA-EM-A3FQ-06,1,19,0
|
384 |
+
TCGA-EM-A3FR-01,1,55,0
|
385 |
+
TCGA-EM-A3O3-01,1,83,0
|
386 |
+
TCGA-EM-A3O6-01,1,54,0
|
387 |
+
TCGA-EM-A3O7-01,1,46,0
|
388 |
+
TCGA-EM-A3O8-01,1,33,0
|
389 |
+
TCGA-EM-A3O9-01,1,40,1
|
390 |
+
TCGA-EM-A3OA-01,1,55,0
|
391 |
+
TCGA-EM-A3OB-01,1,33,0
|
392 |
+
TCGA-EM-A3ST-01,1,62,0
|
393 |
+
TCGA-EM-A3ST-11,0,62,0
|
394 |
+
TCGA-EM-A3SU-01,1,43,0
|
395 |
+
TCGA-EM-A3SU-06,1,43,0
|
396 |
+
TCGA-EM-A3SX-01,1,28,0
|
397 |
+
TCGA-EM-A3SY-01,1,36,1
|
398 |
+
TCGA-EM-A3SZ-01,1,42,0
|
399 |
+
TCGA-EM-A4FF-01,1,40,0
|
400 |
+
TCGA-EM-A4FH-01,1,69,1
|
401 |
+
TCGA-EM-A4FK-01,1,33,0
|
402 |
+
TCGA-EM-A4FM-01,1,59,0
|
403 |
+
TCGA-EM-A4FN-01,1,49,0
|
404 |
+
TCGA-EM-A4FO-01,1,72,1
|
405 |
+
TCGA-EM-A4FQ-01,1,42,0
|
406 |
+
TCGA-EM-A4FR-01,1,28,1
|
407 |
+
TCGA-EM-A4FU-01,1,35,1
|
408 |
+
TCGA-EM-A4FV-01,1,64,0
|
409 |
+
TCGA-EM-A4G1-01,1,26,0
|
410 |
+
TCGA-ET-A25G-01,1,56,0
|
411 |
+
TCGA-ET-A25I-01,1,37,0
|
412 |
+
TCGA-ET-A25J-01,1,40,0
|
413 |
+
TCGA-ET-A25K-01,1,36,0
|
414 |
+
TCGA-ET-A25L-01,1,52,0
|
415 |
+
TCGA-ET-A25M-01,1,33,1
|
416 |
+
TCGA-ET-A25N-01,1,28,0
|
417 |
+
TCGA-ET-A25O-01,1,35,0
|
418 |
+
TCGA-ET-A25P-01,1,24,0
|
419 |
+
TCGA-ET-A25R-01,1,51,0
|
420 |
+
TCGA-ET-A2MX-01,1,27,1
|
421 |
+
TCGA-ET-A2MX-11,0,27,1
|
422 |
+
TCGA-ET-A2MY-01,1,72,0
|
423 |
+
TCGA-ET-A2MZ-01,1,39,1
|
424 |
+
TCGA-ET-A2N0-01,1,51,0
|
425 |
+
TCGA-ET-A2N3-01,1,34,0
|
426 |
+
TCGA-ET-A2N4-01,1,53,0
|
427 |
+
TCGA-ET-A2N5-01,1,46,0
|
428 |
+
TCGA-ET-A2N5-11,0,46,0
|
429 |
+
TCGA-ET-A39I-01,1,83,0
|
430 |
+
TCGA-ET-A39J-01,1,23,0
|
431 |
+
TCGA-ET-A39K-01,1,48,0
|
432 |
+
TCGA-ET-A39L-01,1,20,0
|
433 |
+
TCGA-ET-A39M-01,1,34,1
|
434 |
+
TCGA-ET-A39N-01,1,35,0
|
435 |
+
TCGA-ET-A39O-01,1,39,1
|
436 |
+
TCGA-ET-A39P-01,1,73,0
|
437 |
+
TCGA-ET-A39R-01,1,24,0
|
438 |
+
TCGA-ET-A39S-01,1,27,0
|
439 |
+
TCGA-ET-A39T-01,1,55,0
|
440 |
+
TCGA-ET-A3BN-01,1,33,0
|
441 |
+
TCGA-ET-A3BO-01,1,44,0
|
442 |
+
TCGA-ET-A3BP-01,1,34,0
|
443 |
+
TCGA-ET-A3BQ-01,1,27,0
|
444 |
+
TCGA-ET-A3BS-01,1,42,1
|
445 |
+
TCGA-ET-A3BT-01,1,60,0
|
446 |
+
TCGA-ET-A3BU-01,1,28,1
|
447 |
+
TCGA-ET-A3BV-01,1,47,0
|
448 |
+
TCGA-ET-A3BW-01,1,30,0
|
449 |
+
TCGA-ET-A3BX-01,1,24,1
|
450 |
+
TCGA-ET-A3DO-01,1,33,0
|
451 |
+
TCGA-ET-A3DP-01,1,43,0
|
452 |
+
TCGA-ET-A3DP-11,0,43,0
|
453 |
+
TCGA-ET-A3DQ-01,1,43,0
|
454 |
+
TCGA-ET-A3DR-01,1,42,0
|
455 |
+
TCGA-ET-A3DS-01,1,33,0
|
456 |
+
TCGA-ET-A3DT-01,1,23,0
|
457 |
+
TCGA-ET-A3DU-01,1,21,0
|
458 |
+
TCGA-ET-A3DV-01,1,68,0
|
459 |
+
TCGA-ET-A3DW-01,1,64,1
|
460 |
+
TCGA-ET-A3DW-11,0,64,1
|
461 |
+
TCGA-ET-A40P-01,1,32,0
|
462 |
+
TCGA-ET-A40Q-01,1,38,1
|
463 |
+
TCGA-ET-A40R-01,1,24,0
|
464 |
+
TCGA-ET-A40S-01,1,62,1
|
465 |
+
TCGA-ET-A40T-01,1,26,0
|
466 |
+
TCGA-ET-A4KN-01,1,51,0
|
467 |
+
TCGA-ET-A4KQ-01,1,45,0
|
468 |
+
TCGA-FE-A22Z-01,1,61,0
|
469 |
+
TCGA-FE-A230-01,1,30,0
|
470 |
+
TCGA-FE-A231-01,1,70,1
|
471 |
+
TCGA-FE-A232-01,1,44,0
|
472 |
+
TCGA-FE-A233-01,1,18,0
|
473 |
+
TCGA-FE-A234-01,1,26,0
|
474 |
+
TCGA-FE-A235-01,1,26,0
|
475 |
+
TCGA-FE-A236-01,1,33,1
|
476 |
+
TCGA-FE-A237-01,1,19,0
|
477 |
+
TCGA-FE-A238-01,1,36,0
|
478 |
+
TCGA-FE-A239-01,1,82,1
|
479 |
+
TCGA-FE-A23A-01,1,27,0
|
480 |
+
TCGA-FE-A3PA-01,1,16,1
|
481 |
+
TCGA-FE-A3PB-01,1,33,0
|
482 |
+
TCGA-FE-A3PC-01,1,37,0
|
483 |
+
TCGA-FE-A3PD-01,1,17,0
|
484 |
+
TCGA-FK-A3S3-01,1,43,0
|
485 |
+
TCGA-FK-A3SB-01,1,28,0
|
486 |
+
TCGA-FK-A3SD-01,1,61,0
|
487 |
+
TCGA-FK-A3SE-01,1,31,0
|
488 |
+
TCGA-FK-A3SG-01,1,21,0
|
489 |
+
TCGA-FK-A3SH-01,1,50,0
|
490 |
+
TCGA-FK-A4UB-01,1,51,1
|
491 |
+
TCGA-FY-A2QD-01,1,61,0
|
492 |
+
TCGA-FY-A3BL-01,1,29,1
|
493 |
+
TCGA-FY-A3I4-01,1,34,0
|
494 |
+
TCGA-FY-A3I5-01,1,64,0
|
495 |
+
TCGA-FY-A3NM-01,1,48,0
|
496 |
+
TCGA-FY-A3NN-01,1,48,0
|
497 |
+
TCGA-FY-A3NP-01,1,69,1
|
498 |
+
TCGA-FY-A3ON-01,1,20,1
|
499 |
+
TCGA-FY-A3R6-01,1,57,0
|
500 |
+
TCGA-FY-A3R7-01,1,50,0
|
501 |
+
TCGA-FY-A3R8-01,1,62,0
|
502 |
+
TCGA-FY-A3R9-01,1,66,0
|
503 |
+
TCGA-FY-A3RA-01,1,21,0
|
504 |
+
TCGA-FY-A3TY-01,1,61,0
|
505 |
+
TCGA-FY-A3TY-11,0,61,0
|
506 |
+
TCGA-FY-A3W9-01,1,66,0
|
507 |
+
TCGA-FY-A3WA-01,1,52,0
|
508 |
+
TCGA-FY-A3YR-01,1,64,0
|
509 |
+
TCGA-FY-A40K-01,1,46,0
|
510 |
+
TCGA-FY-A40L-01,1,55,0
|
511 |
+
TCGA-FY-A40M-01,1,51,0
|
512 |
+
TCGA-FY-A40N-01,1,55,0
|
513 |
+
TCGA-FY-A4B0-01,1,76,1
|
514 |
+
TCGA-FY-A4B3-01,1,51,1
|
515 |
+
TCGA-FY-A4B4-01,1,62,0
|
516 |
+
TCGA-FY-A76V-01,1,54,1
|
517 |
+
TCGA-GE-A2C6-01,1,33,0
|
518 |
+
TCGA-GE-A2C6-11,0,33,0
|
519 |
+
TCGA-H2-A26U-01,1,54,0
|
520 |
+
TCGA-H2-A2K9-01,1,25,1
|
521 |
+
TCGA-H2-A2K9-11,0,25,1
|
522 |
+
TCGA-H2-A3RH-01,1,41,0
|
523 |
+
TCGA-H2-A3RI-01,1,29,0
|
524 |
+
TCGA-H2-A3RI-11,0,29,0
|
525 |
+
TCGA-H2-A421-01,1,34,0
|
526 |
+
TCGA-H2-A422-01,1,40,0
|
527 |
+
TCGA-IM-A3EB-01,1,32,0
|
528 |
+
TCGA-IM-A3ED-01,1,58,0
|
529 |
+
TCGA-IM-A3U2-01,1,89,0
|
530 |
+
TCGA-IM-A3U3-01,1,55,0
|
531 |
+
TCGA-IM-A41Y-01,1,42,0
|
532 |
+
TCGA-IM-A41Z-01,1,37,0
|
533 |
+
TCGA-IM-A420-01,1,39,0
|
534 |
+
TCGA-IM-A4EB-01,1,37,1
|
535 |
+
TCGA-J8-A3NZ-01,1,52,0
|
536 |
+
TCGA-J8-A3O0-01,1,38,1
|
537 |
+
TCGA-J8-A3O1-01,1,33,0
|
538 |
+
TCGA-J8-A3O2-01,1,39,1
|
539 |
+
TCGA-J8-A3O2-06,1,39,1
|
540 |
+
TCGA-J8-A3YD-01,1,47,0
|
541 |
+
TCGA-J8-A3YE-01,1,31,0
|
542 |
+
TCGA-J8-A3YF-01,1,83,1
|
543 |
+
TCGA-J8-A3YG-01,1,54,0
|
544 |
+
TCGA-J8-A3YH-01,1,39,1
|
545 |
+
TCGA-J8-A3YH-06,1,39,1
|
546 |
+
TCGA-J8-A42S-01,1,45,1
|
547 |
+
TCGA-J8-A4HW-01,1,59,0
|
548 |
+
TCGA-J8-A4HW-06,1,59,0
|
549 |
+
TCGA-J8-A4HY-01,1,68,0
|
550 |
+
TCGA-KS-A41F-01,1,37,0
|
551 |
+
TCGA-KS-A41I-01,1,47,0
|
552 |
+
TCGA-KS-A41I-11,0,47,0
|
553 |
+
TCGA-KS-A41J-01,1,28,0
|
554 |
+
TCGA-KS-A41J-11,0,28,0
|
555 |
+
TCGA-KS-A41L-01,1,39,0
|
556 |
+
TCGA-KS-A41L-11,0,39,0
|
557 |
+
TCGA-KS-A4I1-01,1,37,0
|
558 |
+
TCGA-KS-A4I3-01,1,41,1
|
559 |
+
TCGA-KS-A4I5-01,1,49,0
|
560 |
+
TCGA-KS-A4I7-01,1,61,0
|
561 |
+
TCGA-KS-A4I9-01,1,46,0
|
562 |
+
TCGA-KS-A4IB-01,1,41,0
|
563 |
+
TCGA-KS-A4IC-01,1,45,0
|
564 |
+
TCGA-KS-A4ID-01,1,55,0
|
565 |
+
TCGA-L6-A4EP-01,1,41,0
|
566 |
+
TCGA-L6-A4EQ-01,1,47,1
|
567 |
+
TCGA-L6-A4ET-01,1,49,0
|
568 |
+
TCGA-L6-A4EU-01,1,58,0
|
569 |
+
TCGA-MK-A4N6-01,1,35,1
|
570 |
+
TCGA-MK-A4N7-01,1,20,0
|
571 |
+
TCGA-MK-A4N9-01,1,41,0
|
572 |
+
TCGA-MK-A84Z-01,1,74,1
|
573 |
+
TCGA-QD-A8IV-01,1,50,0
|
p1/preprocess/Hypothyroidism/code/GSE151158.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/1/Hypothyroidism/GSE151158.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Hypothyroidism/gene_data/GSE151158.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Hypothyroidism/clinical_data/GSE151158.csv"
|
16 |
+
json_path = "./output/preprocess/1/Hypothyroidism/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1. Gene Expression Data Availability
|
37 |
+
is_gene_available = True # The series uses RNA from liver tissue and measures expression of ~594 genes.
|
38 |
+
|
39 |
+
# 2. Variable Availability and Data Type Conversion
|
40 |
+
# 2.1 Identify keys for trait, age, gender
|
41 |
+
trait_row = 12 # "hypothyroidism: N", "hypothyroidism: Y" => multiple values => available
|
42 |
+
age_row = 1 # "age: 53", "age: 40", etc. => multiple numeric values => available
|
43 |
+
gender_row = 2 # "Sex: F", "Sex: M", etc. => multiple values => available
|
44 |
+
|
45 |
+
# 2.2 Define conversion functions
|
46 |
+
def convert_trait(val):
|
47 |
+
if not isinstance(val, str):
|
48 |
+
return None
|
49 |
+
parts = val.split(":")
|
50 |
+
if len(parts) < 2:
|
51 |
+
return None
|
52 |
+
v = parts[1].strip().upper()
|
53 |
+
if v == 'Y':
|
54 |
+
return 1
|
55 |
+
elif v == 'N':
|
56 |
+
return 0
|
57 |
+
return None
|
58 |
+
|
59 |
+
def convert_age(val):
|
60 |
+
if not isinstance(val, str):
|
61 |
+
return None
|
62 |
+
parts = val.split(":")
|
63 |
+
if len(parts) < 2:
|
64 |
+
return None
|
65 |
+
v = parts[1].strip()
|
66 |
+
try:
|
67 |
+
return float(v)
|
68 |
+
except ValueError:
|
69 |
+
return None
|
70 |
+
|
71 |
+
def convert_gender(val):
|
72 |
+
if not isinstance(val, str):
|
73 |
+
return None
|
74 |
+
parts = val.split(":")
|
75 |
+
if len(parts) < 2:
|
76 |
+
return None
|
77 |
+
v = parts[1].strip().upper()
|
78 |
+
if v == 'M':
|
79 |
+
return 1
|
80 |
+
elif v == 'F':
|
81 |
+
return 0
|
82 |
+
return None
|
83 |
+
|
84 |
+
# 3. Save Metadata (initial filtering)
|
85 |
+
is_trait_available = (trait_row is not None)
|
86 |
+
is_final = False
|
87 |
+
validate_and_save_cohort_info(
|
88 |
+
is_final=is_final,
|
89 |
+
cohort=cohort,
|
90 |
+
info_path=json_path,
|
91 |
+
is_gene_available=is_gene_available,
|
92 |
+
is_trait_available=is_trait_available
|
93 |
+
)
|
94 |
+
|
95 |
+
# 4. Clinical Feature Extraction (only if trait data is available)
|
96 |
+
if trait_row is not None:
|
97 |
+
selected_clinical_df = geo_select_clinical_features(
|
98 |
+
clinical_data,
|
99 |
+
trait=trait,
|
100 |
+
trait_row=trait_row,
|
101 |
+
convert_trait=convert_trait,
|
102 |
+
age_row=age_row,
|
103 |
+
convert_age=convert_age,
|
104 |
+
gender_row=gender_row,
|
105 |
+
convert_gender=convert_gender
|
106 |
+
)
|
107 |
+
# Preview extracted clinical features
|
108 |
+
preview = preview_df(selected_clinical_df, n=5)
|
109 |
+
print("Preview of selected clinical features:", preview)
|
110 |
+
# Save to CSV
|
111 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
112 |
+
# STEP3
|
113 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
114 |
+
gene_data = get_genetic_data(matrix_file)
|
115 |
+
|
116 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
117 |
+
print(gene_data.index[:20])
|
118 |
+
# Based on the observed list of gene identifiers, these appear to be standard human gene symbols.
|
119 |
+
print("requires_gene_mapping = False")
|
120 |
+
# STEP5
|
121 |
+
# 1. Normalize gene symbols using the NCBI Gene database synonym information.
|
122 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
123 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
124 |
+
|
125 |
+
# 2. Link the clinical and genetic data.
|
126 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
127 |
+
|
128 |
+
# 3. Handle missing values.
|
129 |
+
linked_data = handle_missing_values(linked_data, trait)
|
130 |
+
|
131 |
+
# 4. Determine bias in the trait and demographic features.
|
132 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
133 |
+
|
134 |
+
# 5. Final quality validation and metadata saving.
|
135 |
+
is_usable = validate_and_save_cohort_info(
|
136 |
+
is_final=True,
|
137 |
+
cohort=cohort,
|
138 |
+
info_path=json_path,
|
139 |
+
is_gene_available=True,
|
140 |
+
is_trait_available=True,
|
141 |
+
is_biased=is_trait_biased,
|
142 |
+
df=unbiased_linked_data
|
143 |
+
)
|
144 |
+
|
145 |
+
# 6. Save the fully processed data only if it's usable.
|
146 |
+
if is_usable:
|
147 |
+
unbiased_linked_data.to_csv(out_data_file)
|
p1/preprocess/Hypothyroidism/code/GSE224330.py
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/1/Hypothyroidism/GSE224330.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Hypothyroidism/gene_data/GSE224330.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Hypothyroidism/clinical_data/GSE224330.csv"
|
16 |
+
json_path = "./output/preprocess/1/Hypothyroidism/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1. Gene Expression Data Availability
|
37 |
+
is_gene_available = True # Based on the background info indicating gene expression data
|
38 |
+
|
39 |
+
# 2. Variable Availability
|
40 |
+
trait_row = 3
|
41 |
+
age_row = 1
|
42 |
+
gender_row = 2
|
43 |
+
|
44 |
+
# 2.2 Data Type Conversion
|
45 |
+
def convert_trait(value):
|
46 |
+
if not isinstance(value, str):
|
47 |
+
return 0
|
48 |
+
parts = value.split(':', 1)
|
49 |
+
if len(parts) < 2:
|
50 |
+
return 0
|
51 |
+
val = parts[1].strip().lower()
|
52 |
+
return 1 if 'hypothyroidism' in val else 0
|
53 |
+
|
54 |
+
def convert_age(value):
|
55 |
+
if not isinstance(value, str):
|
56 |
+
return None
|
57 |
+
parts = value.split(':', 1)
|
58 |
+
if len(parts) < 2:
|
59 |
+
return None
|
60 |
+
val = parts[1].strip().lower().replace('y', '')
|
61 |
+
try:
|
62 |
+
return float(val)
|
63 |
+
except ValueError:
|
64 |
+
return None
|
65 |
+
|
66 |
+
def convert_gender(value):
|
67 |
+
if not isinstance(value, str):
|
68 |
+
return None
|
69 |
+
parts = value.split(':', 1)
|
70 |
+
if len(parts) < 2:
|
71 |
+
return None
|
72 |
+
val = parts[1].strip().lower()
|
73 |
+
if val == 'female':
|
74 |
+
return 0
|
75 |
+
elif val == 'male':
|
76 |
+
return 1
|
77 |
+
return None
|
78 |
+
|
79 |
+
# 3. Save Metadata with initial filtering
|
80 |
+
is_trait_available = (trait_row is not None)
|
81 |
+
_ = validate_and_save_cohort_info(
|
82 |
+
is_final=False,
|
83 |
+
cohort=cohort,
|
84 |
+
info_path=json_path,
|
85 |
+
is_gene_available=is_gene_available,
|
86 |
+
is_trait_available=is_trait_available
|
87 |
+
)
|
88 |
+
|
89 |
+
# 4. Clinical Feature Extraction (only if trait data is available)
|
90 |
+
if trait_row is not None:
|
91 |
+
selected_clinical_df = geo_select_clinical_features(
|
92 |
+
clinical_data,
|
93 |
+
trait,
|
94 |
+
trait_row,
|
95 |
+
convert_trait,
|
96 |
+
age_row,
|
97 |
+
convert_age,
|
98 |
+
gender_row,
|
99 |
+
convert_gender
|
100 |
+
)
|
101 |
+
preview = preview_df(selected_clinical_df)
|
102 |
+
print("Clinical Data Preview:", preview)
|
103 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
104 |
+
# STEP3
|
105 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
106 |
+
gene_data = get_genetic_data(matrix_file)
|
107 |
+
|
108 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
109 |
+
print(gene_data.index[:20])
|
110 |
+
# Based on the provided IDs (e.g., A_19_P00315452), they appear to be microarray probe IDs rather than standard human gene symbols.
|
111 |
+
# Hence, they likely require mapping to proper gene symbols.
|
112 |
+
print("requires_gene_mapping = True")
|
113 |
+
# STEP5
|
114 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
115 |
+
gene_annotation = get_gene_annotation(soft_file)
|
116 |
+
|
117 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
118 |
+
print("Gene annotation preview:")
|
119 |
+
print(preview_df(gene_annotation))
|
120 |
+
# STEP6: Gene Identifier Mapping
|
121 |
+
|
122 |
+
# 1. Observe columns in the gene annotation dataframe preview:
|
123 |
+
# The 'ID' column matches our probe IDs (like 'A_19_P00315452'),
|
124 |
+
# and 'GENE_SYMBOL' column holds the corresponding gene symbols.
|
125 |
+
|
126 |
+
# 2. Get a gene mapping dataframe for these two columns.
|
127 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
|
128 |
+
|
129 |
+
# 3. Convert probe-level measurements to gene expression data by applying the gene mapping.
|
130 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
131 |
+
|
132 |
+
# For verification, let's print the shape of the mapped gene_data
|
133 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
134 |
+
print("Mapped gene_data index sample:", gene_data.index[:10])
|
135 |
+
# STEP5
|
136 |
+
# 1. Normalize gene symbols using the NCBI Gene database synonym information.
|
137 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
138 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
139 |
+
|
140 |
+
# 2. Link the clinical and genetic data.
|
141 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
142 |
+
|
143 |
+
# 3. Handle missing values.
|
144 |
+
linked_data = handle_missing_values(linked_data, trait)
|
145 |
+
|
146 |
+
# 4. Determine bias in the trait and demographic features.
|
147 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
148 |
+
|
149 |
+
# 5. Final quality validation and metadata saving.
|
150 |
+
is_usable = validate_and_save_cohort_info(
|
151 |
+
is_final=True,
|
152 |
+
cohort=cohort,
|
153 |
+
info_path=json_path,
|
154 |
+
is_gene_available=True,
|
155 |
+
is_trait_available=True,
|
156 |
+
is_biased=is_trait_biased,
|
157 |
+
df=unbiased_linked_data
|
158 |
+
)
|
159 |
+
|
160 |
+
# 6. Save the fully processed data only if it's usable.
|
161 |
+
if is_usable:
|
162 |
+
unbiased_linked_data.to_csv(out_data_file)
|
p1/preprocess/Hypothyroidism/code/GSE32445.py
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/1/Hypothyroidism/GSE32445.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Hypothyroidism/gene_data/GSE32445.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Hypothyroidism/clinical_data/GSE32445.csv"
|
16 |
+
json_path = "./output/preprocess/1/Hypothyroidism/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1. Gene Expression Data Availability
|
37 |
+
# Based on the series title mentioning "gene regulation patterns", it is likely gene expression data is available.
|
38 |
+
is_gene_available = True
|
39 |
+
|
40 |
+
# 2. Variable Availability and Data Type Conversion
|
41 |
+
|
42 |
+
# From the sample characteristics:
|
43 |
+
# {0: ['strain: C57/Bl6'], 1: ['gender: male'], 2: ['age: 9 months'], 3: ['tissue: liver']}
|
44 |
+
# - The data is from mice, not humans, so no valid human trait information is present.
|
45 |
+
# - The "gender" and "age" in this dictionary each have only one unique value ("male", "9 months"), so these are constant.
|
46 |
+
# We consider them not available for associative studies.
|
47 |
+
trait_row = None
|
48 |
+
age_row = None
|
49 |
+
gender_row = None
|
50 |
+
|
51 |
+
def convert_trait(val: str) -> int:
|
52 |
+
# No trait data available in this dataset.
|
53 |
+
return None
|
54 |
+
|
55 |
+
def convert_age(val: str) -> float:
|
56 |
+
# No human age data available; single constant value for mice.
|
57 |
+
return None
|
58 |
+
|
59 |
+
def convert_gender(val: str) -> int:
|
60 |
+
# No human gender data available; single constant value observed (all male mice).
|
61 |
+
return None
|
62 |
+
|
63 |
+
# 3. Save Metadata using initial filtering
|
64 |
+
is_trait_available = (trait_row is not None)
|
65 |
+
validate_and_save_cohort_info(
|
66 |
+
is_final=False,
|
67 |
+
cohort=cohort,
|
68 |
+
info_path=json_path,
|
69 |
+
is_gene_available=is_gene_available,
|
70 |
+
is_trait_available=is_trait_available
|
71 |
+
)
|
72 |
+
|
73 |
+
# 4. Clinical Feature Extraction
|
74 |
+
# Since trait_row is None, clinical data extraction is skipped.
|
75 |
+
# STEP3
|
76 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
77 |
+
gene_data = get_genetic_data(matrix_file)
|
78 |
+
|
79 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
80 |
+
print(gene_data.index[:20])
|
81 |
+
# The gene identifiers (e.g., ILMN_1212602) are typical Illumina probe IDs,
|
82 |
+
# which are not standard human gene symbols and need to be mapped.
|
83 |
+
print("\nrequires_gene_mapping = True")
|
84 |
+
# STEP5
|
85 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
86 |
+
gene_annotation = get_gene_annotation(soft_file)
|
87 |
+
|
88 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
89 |
+
print("Gene annotation preview:")
|
90 |
+
print(preview_df(gene_annotation))
|
91 |
+
# STEP6
|
92 |
+
# 1. Identify which columns in the annotation correspond to the Illumina probe IDs in gene_data and to gene symbols.
|
93 |
+
# However, from the preview we see "ID" in gene_annotation has entries like "1007_s_at" (Affymetrix),
|
94 |
+
# but gene_data uses "ILMN_xxxxxxx" (Illumina). They do not match.
|
95 |
+
|
96 |
+
# 2. Attempt to extract the mapping between probe IDs ("ID") and gene symbols ("Gene Symbol").
|
97 |
+
gene_mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="Gene Symbol")
|
98 |
+
|
99 |
+
# Check overlap between the annotation and the expression probe IDs.
|
100 |
+
common_probes = set(gene_mapping_df["ID"]).intersection(gene_data.index)
|
101 |
+
if len(common_probes) == 0:
|
102 |
+
print("No valid Illumina annotation found for these probe IDs. Skipping mapping step.")
|
103 |
+
else:
|
104 |
+
# 3. Convert the probe-level data to gene-level data by applying the mapping if there is overlap.
|
105 |
+
gene_data = apply_gene_mapping(gene_data, gene_mapping_df)
|
106 |
+
|
107 |
+
# Print a brief shape and a few row indices to confirm the transformed data (if any).
|
108 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
109 |
+
print("First 20 gene symbols/probes after potential mapping:", gene_data.index[:20])
|
p1/preprocess/Hypothyroidism/code/GSE75678.py
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/1/Hypothyroidism/GSE75678.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Hypothyroidism/gene_data/GSE75678.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Hypothyroidism/clinical_data/GSE75678.csv"
|
16 |
+
json_path = "./output/preprocess/1/Hypothyroidism/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1) Check if gene expression data is available.
|
37 |
+
# Based on the background text: "Gene Expression of Mexican Patients with Breast Cancer"
|
38 |
+
# it is indeed gene expression data (not miRNA or methylation).
|
39 |
+
is_gene_available = True
|
40 |
+
|
41 |
+
# 2) Determine variable availability and define row indices.
|
42 |
+
# We search for "Hypothyroidism" in row 21. The presence of "personal pathological hystory: Hypothyroidism"
|
43 |
+
# implies we can interpret that row as indicating whether a sample has hypothyroidism or not.
|
44 |
+
trait_row = 21 # row for hypothyroidism = personal pathological hystory
|
45 |
+
# Age is available at row 19: "age at diagnosis: ..."
|
46 |
+
age_row = 19
|
47 |
+
# Gender row (row 1) has only one unique value "female"; no variation => not useful for association.
|
48 |
+
gender_row = None
|
49 |
+
|
50 |
+
# 2.2) Functions to convert the data into the chosen types.
|
51 |
+
|
52 |
+
def convert_trait(value: str):
|
53 |
+
"""
|
54 |
+
Convert personal pathological history data to a binary indicator for Hypothyroidism.
|
55 |
+
Return 1 if 'Hypothyroidism' is in the string, else 0.
|
56 |
+
If the string is unparseable or unknown, return None.
|
57 |
+
"""
|
58 |
+
# Split on ":", take the second part if exists
|
59 |
+
parts = value.split(":")
|
60 |
+
if len(parts) < 2:
|
61 |
+
return None
|
62 |
+
val_str = parts[1].strip().lower() # e.g. "hypothyroidism", or "rheumatoid arthritis"
|
63 |
+
return 1 if "hypothyroidism" in val_str else 0
|
64 |
+
|
65 |
+
def convert_age(value: str):
|
66 |
+
"""
|
67 |
+
Convert strings like 'age at diagnosis: 45' to a continuous float representing age.
|
68 |
+
Unknown or invalid values become None.
|
69 |
+
"""
|
70 |
+
parts = value.split(":")
|
71 |
+
if len(parts) < 2:
|
72 |
+
return None
|
73 |
+
val_str = parts[1].strip()
|
74 |
+
try:
|
75 |
+
return float(val_str)
|
76 |
+
except ValueError:
|
77 |
+
return None
|
78 |
+
|
79 |
+
# Since gender has no variation, we do not need a conversion function.
|
80 |
+
convert_gender = None
|
81 |
+
|
82 |
+
# 3) Perform initial filtering and save metadata.
|
83 |
+
# Trait data availability depends on whether 'trait_row' is None.
|
84 |
+
is_trait_available = (trait_row is not None)
|
85 |
+
|
86 |
+
is_usable = validate_and_save_cohort_info(
|
87 |
+
is_final=False,
|
88 |
+
cohort=cohort,
|
89 |
+
info_path=json_path,
|
90 |
+
is_gene_available=is_gene_available,
|
91 |
+
is_trait_available=is_trait_available
|
92 |
+
)
|
93 |
+
|
94 |
+
# 4) If trait is available, extract clinical features and save them.
|
95 |
+
if trait_row is not None:
|
96 |
+
selected_clinical_df = geo_select_clinical_features(
|
97 |
+
clinical_data,
|
98 |
+
trait="Hypothyroidism",
|
99 |
+
trait_row=trait_row,
|
100 |
+
convert_trait=convert_trait,
|
101 |
+
age_row=age_row,
|
102 |
+
convert_age=convert_age,
|
103 |
+
gender_row=gender_row,
|
104 |
+
convert_gender=convert_gender
|
105 |
+
)
|
106 |
+
preview_output = preview_df(selected_clinical_df)
|
107 |
+
print("Preview of selected clinical features:", preview_output)
|
108 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
109 |
+
# STEP3
|
110 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
111 |
+
gene_data = get_genetic_data(matrix_file)
|
112 |
+
|
113 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
114 |
+
print(gene_data.index[:20])
|
115 |
+
print("requires_gene_mapping = True")
|
116 |
+
# STEP5
|
117 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
118 |
+
gene_annotation = get_gene_annotation(soft_file)
|
119 |
+
|
120 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
121 |
+
print("Gene annotation preview:")
|
122 |
+
print(preview_df(gene_annotation))
|
123 |
+
# Gene Identifier Mapping
|
124 |
+
mapping_df = get_gene_mapping(gene_annotation, "ID", "GENE_SYMBOL")
|
125 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
126 |
+
# STEP5
|
127 |
+
# 1. Normalize gene symbols using the NCBI Gene database synonym information.
|
128 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
129 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
130 |
+
|
131 |
+
# 2. Link the clinical and genetic data.
|
132 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
133 |
+
|
134 |
+
# 3. Handle missing values.
|
135 |
+
linked_data = handle_missing_values(linked_data, trait)
|
136 |
+
|
137 |
+
# 4. Determine bias in the trait and demographic features.
|
138 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
139 |
+
|
140 |
+
# 5. Final quality validation and metadata saving.
|
141 |
+
is_usable = validate_and_save_cohort_info(
|
142 |
+
is_final=True,
|
143 |
+
cohort=cohort,
|
144 |
+
info_path=json_path,
|
145 |
+
is_gene_available=True,
|
146 |
+
is_trait_available=True,
|
147 |
+
is_biased=is_trait_biased,
|
148 |
+
df=unbiased_linked_data
|
149 |
+
)
|
150 |
+
|
151 |
+
# 6. Save the fully processed data only if it's usable.
|
152 |
+
if is_usable:
|
153 |
+
unbiased_linked_data.to_csv(out_data_file)
|
p1/preprocess/Hypothyroidism/code/GSE75685.py
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/1/Hypothyroidism/GSE75685.csv"
|
14 |
+
out_gene_data_file = "./output/preprocess/1/Hypothyroidism/gene_data/GSE75685.csv"
|
15 |
+
out_clinical_data_file = "./output/preprocess/1/Hypothyroidism/clinical_data/GSE75685.csv"
|
16 |
+
json_path = "./output/preprocess/1/Hypothyroidism/cohort_info.json"
|
17 |
+
|
18 |
+
# STEP1
|
19 |
+
from tools.preprocess import *
|
20 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
21 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
22 |
+
|
23 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
24 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
25 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
26 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
27 |
+
|
28 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
29 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
30 |
+
|
31 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
32 |
+
print("Background Information:")
|
33 |
+
print(background_info)
|
34 |
+
print("Sample Characteristics Dictionary:")
|
35 |
+
print(sample_characteristics_dict)
|
36 |
+
# 1. Gene Expression Data Availability
|
37 |
+
is_gene_available = True # Based on the metadata, it appears to be an mRNA expression dataset.
|
38 |
+
|
39 |
+
# 2. Variable Availability and Data Type Conversion
|
40 |
+
# 2.1 Data Availability
|
41 |
+
# We identified that "personal pathological hystory: Hypothyroidism" is under key 21.
|
42 |
+
trait_row = 21 # multiple unique entries, including "Hypothyroidism"
|
43 |
+
# Age at diagnosis is under key 19 with multiple values.
|
44 |
+
age_row = 19
|
45 |
+
# Gender is under key 1, but it's always 'Female', hence considered not available.
|
46 |
+
gender_row = None
|
47 |
+
|
48 |
+
# 2.2 Data Type Conversion
|
49 |
+
|
50 |
+
def convert_trait(value: str):
|
51 |
+
"""
|
52 |
+
Convert personal pathological history to a binary indicator of Hypothyroidism.
|
53 |
+
1 if 'Hypothyroidism' is present, else 0.
|
54 |
+
"""
|
55 |
+
# Extract the substring after the first colon, lowercase it:
|
56 |
+
val = value.split(':', 1)[-1].strip().lower()
|
57 |
+
if 'hypothyroidism' in val:
|
58 |
+
return 1
|
59 |
+
elif val in {'na', 'n/a', ''}:
|
60 |
+
return None
|
61 |
+
else:
|
62 |
+
return 0
|
63 |
+
|
64 |
+
def convert_age(value: str):
|
65 |
+
"""
|
66 |
+
Convert age at diagnosis to an integer (continuous).
|
67 |
+
"""
|
68 |
+
val = value.split(':', 1)[-1].strip()
|
69 |
+
try:
|
70 |
+
return int(val)
|
71 |
+
except ValueError:
|
72 |
+
return None
|
73 |
+
|
74 |
+
def convert_gender(value: str):
|
75 |
+
"""
|
76 |
+
Convert gender to binary (female=0, male=1).
|
77 |
+
Not used here because gender_row=None, but defined for completeness.
|
78 |
+
"""
|
79 |
+
val = value.split(':', 1)[-1].strip().lower()
|
80 |
+
if 'female' in val:
|
81 |
+
return 0
|
82 |
+
elif 'male' in val:
|
83 |
+
return 1
|
84 |
+
else:
|
85 |
+
return None
|
86 |
+
|
87 |
+
# Check if trait data is available
|
88 |
+
is_trait_available = (trait_row is not None)
|
89 |
+
|
90 |
+
# 3. Save initial metadata
|
91 |
+
is_usable = validate_and_save_cohort_info(
|
92 |
+
is_final=False,
|
93 |
+
cohort=cohort,
|
94 |
+
info_path=json_path,
|
95 |
+
is_gene_available=is_gene_available,
|
96 |
+
is_trait_available=is_trait_available
|
97 |
+
)
|
98 |
+
|
99 |
+
# 4. Clinical Feature Extraction
|
100 |
+
if trait_row is not None:
|
101 |
+
# 'clinical_data' is assumed to be the DataFrame containing the parsed sample characteristics
|
102 |
+
selected_clinical_df = geo_select_clinical_features(
|
103 |
+
clinical_df=clinical_data,
|
104 |
+
trait=trait,
|
105 |
+
trait_row=trait_row,
|
106 |
+
convert_trait=convert_trait,
|
107 |
+
age_row=age_row,
|
108 |
+
convert_age=convert_age,
|
109 |
+
gender_row=gender_row,
|
110 |
+
convert_gender=convert_gender
|
111 |
+
)
|
112 |
+
|
113 |
+
# Preview the extracted clinical features
|
114 |
+
preview_result = preview_df(selected_clinical_df)
|
115 |
+
print("Preview of selected clinical features:", preview_result)
|
116 |
+
|
117 |
+
# Save to CSV
|
118 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
119 |
+
# STEP3
|
120 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
121 |
+
gene_data = get_genetic_data(matrix_file)
|
122 |
+
|
123 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
124 |
+
print(gene_data.index[:20])
|
125 |
+
# The given identifiers are numeric indices and not standard human gene symbols.
|
126 |
+
# Therefore, mapping to human gene symbols is required.
|
127 |
+
print("requires_gene_mapping = True")
|
128 |
+
# STEP5
|
129 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
130 |
+
gene_annotation = get_gene_annotation(soft_file)
|
131 |
+
|
132 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
133 |
+
print("Gene annotation preview:")
|
134 |
+
print(preview_df(gene_annotation))
|
135 |
+
# STEP: Gene Identifier Mapping
|
136 |
+
|
137 |
+
# 1. Decide columns for probe identifier and gene symbol in the annotation dataframe
|
138 |
+
# From observation, "ID" stores the probe identifiers matching the gene_data index,
|
139 |
+
# and "GENE_SYMBOL" seems to store the gene symbols.
|
140 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col="ID", gene_col="GENE_SYMBOL")
|
141 |
+
|
142 |
+
# 2. Convert probe-level data to gene-level data using the mapping
|
143 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
144 |
+
|
145 |
+
# Print basic information about the resulting gene_data
|
146 |
+
print("Gene data shape after mapping:", gene_data.shape)
|
147 |
+
print("Preview of mapped gene indices:", gene_data.index[:20])
|
148 |
+
# STEP5
|
149 |
+
# 1. Normalize gene symbols using the NCBI Gene database synonym information.
|
150 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
151 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
152 |
+
|
153 |
+
# 2. Link the clinical and genetic data.
|
154 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
155 |
+
|
156 |
+
# 3. Handle missing values.
|
157 |
+
linked_data = handle_missing_values(linked_data, trait)
|
158 |
+
|
159 |
+
# 4. Determine bias in the trait and demographic features.
|
160 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
161 |
+
|
162 |
+
# 5. Final quality validation and metadata saving.
|
163 |
+
is_usable = validate_and_save_cohort_info(
|
164 |
+
is_final=True,
|
165 |
+
cohort=cohort,
|
166 |
+
info_path=json_path,
|
167 |
+
is_gene_available=True,
|
168 |
+
is_trait_available=True,
|
169 |
+
is_biased=is_trait_biased,
|
170 |
+
df=unbiased_linked_data
|
171 |
+
)
|
172 |
+
|
173 |
+
# 6. Save the fully processed data only if it's usable.
|
174 |
+
if is_usable:
|
175 |
+
unbiased_linked_data.to_csv(out_data_file)
|
p1/preprocess/Hypothyroidism/code/TCGA.py
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/1/Hypothyroidism/TCGA.csv"
|
12 |
+
out_gene_data_file = "./output/preprocess/1/Hypothyroidism/gene_data/TCGA.csv"
|
13 |
+
out_clinical_data_file = "./output/preprocess/1/Hypothyroidism/clinical_data/TCGA.csv"
|
14 |
+
json_path = "./output/preprocess/1/Hypothyroidism/cohort_info.json"
|
15 |
+
|
16 |
+
import os
|
17 |
+
|
18 |
+
# 1. Identify subdirectories in tcga_root_dir
|
19 |
+
subdirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
20 |
+
|
21 |
+
# Use trait-specific or relevant keywords for 'Hypothyroidism'
|
22 |
+
trait_keywords = ["hypothyroid", "thyroid"]
|
23 |
+
|
24 |
+
matched_dirs = []
|
25 |
+
for d in subdirs:
|
26 |
+
lower_d = d.lower()
|
27 |
+
if any(keyword in lower_d for keyword in trait_keywords):
|
28 |
+
matched_dirs.append(d)
|
29 |
+
|
30 |
+
# 3. If no suitable directories found, skip this trait and mark the task completed
|
31 |
+
if not matched_dirs:
|
32 |
+
print("No suitable TCGA subdirectory found for trait:", trait)
|
33 |
+
validate_and_save_cohort_info(
|
34 |
+
is_final=False,
|
35 |
+
cohort="TCGA",
|
36 |
+
info_path=json_path,
|
37 |
+
is_gene_available=False,
|
38 |
+
is_trait_available=False,
|
39 |
+
note="No matched subdirectory found for this trait."
|
40 |
+
)
|
41 |
+
else:
|
42 |
+
# Normally, we'd pick the best match if multiple. For now, pick the first.
|
43 |
+
chosen_dir = matched_dirs[0]
|
44 |
+
chosen_path = os.path.join(tcga_root_dir, chosen_dir)
|
45 |
+
# 2. Identify data file paths
|
46 |
+
clinical_file, genetic_file = tcga_get_relevant_filepaths(chosen_path)
|
47 |
+
# 3. Load both files as dataframes
|
48 |
+
clinical_df = pd.read_csv(clinical_file, index_col=0, sep='\t')
|
49 |
+
genetic_df = pd.read_csv(genetic_file, index_col=0, sep='\t')
|
50 |
+
# 4. Print the clinical data columns
|
51 |
+
print("Clinical data columns:", clinical_df.columns.tolist())
|
52 |
+
# Step 1: Identify columns
|
53 |
+
candidate_age_cols = ["age_at_initial_pathologic_diagnosis", "days_to_birth"]
|
54 |
+
candidate_gender_cols = ["gender"]
|
55 |
+
print(f"candidate_age_cols = {candidate_age_cols}")
|
56 |
+
print(f"candidate_gender_cols = {candidate_gender_cols}")
|
57 |
+
|
58 |
+
# Step 2: Extract and preview the data from clinical_df
|
59 |
+
if candidate_age_cols:
|
60 |
+
age_preview = preview_df(clinical_df[candidate_age_cols], n=5)
|
61 |
+
print(age_preview)
|
62 |
+
if candidate_gender_cols:
|
63 |
+
gender_preview = preview_df(clinical_df[candidate_gender_cols], n=5)
|
64 |
+
print(gender_preview)
|
65 |
+
age_col = "age_at_initial_pathologic_diagnosis"
|
66 |
+
gender_col = "gender"
|
67 |
+
|
68 |
+
print("Chosen age_col:", age_col)
|
69 |
+
print("Chosen gender_col:", gender_col)
|
70 |
+
# 1. Extract and standardize the clinical features
|
71 |
+
selected_clinical_df = tcga_select_clinical_features(
|
72 |
+
clinical_df,
|
73 |
+
trait=trait,
|
74 |
+
age_col=age_col,
|
75 |
+
gender_col=gender_col
|
76 |
+
)
|
77 |
+
|
78 |
+
# 2. Normalize gene symbols and save the normalized gene expression data
|
79 |
+
normalized_genetic_df = normalize_gene_symbols_in_index(genetic_df)
|
80 |
+
normalized_genetic_df.to_csv(out_gene_data_file)
|
81 |
+
|
82 |
+
# 3. Link clinical and genetic data by sample IDs
|
83 |
+
transposed_genetic_df = normalized_genetic_df.T
|
84 |
+
linked_data = selected_clinical_df.join(transposed_genetic_df, how='inner')
|
85 |
+
|
86 |
+
# 4. Handle missing values in the linked data
|
87 |
+
cleaned_data = handle_missing_values(linked_data, trait_col=trait)
|
88 |
+
|
89 |
+
# 5. Determine trait bias (and remove any heavily biased demographic features)
|
90 |
+
is_trait_biased, final_data = judge_and_remove_biased_features(cleaned_data, trait)
|
91 |
+
|
92 |
+
# 6. Final validation and cohort info recording
|
93 |
+
is_usable = validate_and_save_cohort_info(
|
94 |
+
is_final=True,
|
95 |
+
cohort="TCGA",
|
96 |
+
info_path=json_path,
|
97 |
+
is_gene_available=True,
|
98 |
+
is_trait_available=True,
|
99 |
+
is_biased=is_trait_biased,
|
100 |
+
df=final_data,
|
101 |
+
note="No specific notes."
|
102 |
+
)
|
103 |
+
|
104 |
+
# 7. Save final data if usable
|
105 |
+
if is_usable:
|
106 |
+
# Save final clinical subset
|
107 |
+
demographic_cols = [col for col in [trait, 'Age', 'Gender'] if col in final_data.columns]
|
108 |
+
final_data[demographic_cols].to_csv(out_clinical_data_file)
|
109 |
+
|
110 |
+
# Save the entire linked dataset
|
111 |
+
final_data.to_csv(out_data_file)
|
p1/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": ""}, "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": ""}, "GSE32445": {"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}, "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": 31, "note": ""}, "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": ""}, "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": "No specific notes."}}
|