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 +1 -0
- output/preprocess/Eczema/GSE123088.csv +3 -0
- output/preprocess/Epilepsy/code/GSE65106.py +216 -0
- output/preprocess/Epilepsy/code/GSE74571.py +123 -0
- output/preprocess/Epilepsy/code/TCGA.py +53 -0
- output/preprocess/Epilepsy/gene_data/GSE199759.csv +1 -103
- output/preprocess/Esophageal_Cancer/GSE75241.csv +0 -0
- output/preprocess/Esophageal_Cancer/clinical_data/GSE107754.csv +1 -1
- output/preprocess/Esophageal_Cancer/code/GSE100843.py +221 -0
- output/preprocess/Esophageal_Cancer/code/GSE104958.py +196 -0
- output/preprocess/Esophageal_Cancer/code/GSE107754.py +195 -0
- output/preprocess/Esophageal_Cancer/code/GSE131027.py +162 -0
- output/preprocess/Esophageal_Cancer/code/GSE156915.py +215 -0
- output/preprocess/Esophageal_Cancer/code/GSE218109.py +187 -0
- output/preprocess/Esophageal_Cancer/code/GSE55857.py +117 -0
- output/preprocess/Esophageal_Cancer/code/GSE66258.py +123 -0
- output/preprocess/Esophageal_Cancer/code/GSE75241.py +207 -0
- output/preprocess/Esophageal_Cancer/code/GSE77790.py +183 -0
- output/preprocess/Esophageal_Cancer/code/TCGA.py +336 -0
- output/preprocess/Esophageal_Cancer/cohort_info.json +1 -112
- output/preprocess/Esophageal_Cancer/gene_data/GSE75241.csv +19 -14
- output/preprocess/Essential_Thrombocythemia/clinical_data/GSE103237.csv +1 -1
- output/preprocess/Essential_Thrombocythemia/clinical_data/GSE159514.csv +2 -4
- output/preprocess/Essential_Thrombocythemia/clinical_data/GSE61629.csv +1 -1
- output/preprocess/Essential_Thrombocythemia/code/GSE103176.py +364 -0
- output/preprocess/Essential_Thrombocythemia/code/GSE103237.py +219 -0
- output/preprocess/Essential_Thrombocythemia/code/GSE12295.py +211 -0
- output/preprocess/Essential_Thrombocythemia/code/GSE159514.py +215 -0
- output/preprocess/Essential_Thrombocythemia/code/GSE174060.py +199 -0
- output/preprocess/Essential_Thrombocythemia/code/GSE55976.py +194 -0
- output/preprocess/Essential_Thrombocythemia/code/GSE57793.py +201 -0
- output/preprocess/Essential_Thrombocythemia/code/GSE61629.py +200 -0
- output/preprocess/Essential_Thrombocythemia/code/GSE65161.py +119 -0
- output/preprocess/Essential_Thrombocythemia/code/TCGA.py +68 -0
- output/preprocess/Essential_Thrombocythemia/cohort_info.json +1 -102
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/GSE43580.csv +4 -4
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/GSE77563.csv +4 -4
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/GSE28302.py +355 -0
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/GSE43580.py +330 -0
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/GSE68698.py +125 -0
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/GSE77563.py +235 -0
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/TCGA.py +346 -0
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/cohort_info.json +1 -42
- output/preprocess/Gastroesophageal_reflux_disease_(GERD)/gene_data/GSE28302.csv +0 -0
- output/preprocess/Gaucher_Disease/clinical_data/GSE124283.csv +3 -3
- output/preprocess/Gaucher_Disease/code/GSE124283.py +183 -0
- output/preprocess/Gaucher_Disease/code/TCGA.py +65 -0
- output/preprocess/Gaucher_Disease/cohort_info.json +1 -22
- output/preprocess/Generalized_Anxiety_Disorder/clinical_data/GSE61672.csv +1 -1
- output/preprocess/Generalized_Anxiety_Disorder/code/GSE61672.py +199 -0
.gitattributes
CHANGED
|
@@ -2203,3 +2203,4 @@ output/preprocess/Parkinsons_Disease/gene_data/GSE101534.csv filter=lfs diff=lfs
|
|
| 2203 |
output/preprocess/Chronic_kidney_disease/GSE66494.csv filter=lfs diff=lfs merge=lfs -text
|
| 2204 |
output/preprocess/Chronic_kidney_disease/gene_data/GSE180393.csv filter=lfs diff=lfs merge=lfs -text
|
| 2205 |
output/preprocess/Bipolar_disorder/GSE62191.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 2203 |
output/preprocess/Chronic_kidney_disease/GSE66494.csv filter=lfs diff=lfs merge=lfs -text
|
| 2204 |
output/preprocess/Chronic_kidney_disease/gene_data/GSE180393.csv filter=lfs diff=lfs merge=lfs -text
|
| 2205 |
output/preprocess/Bipolar_disorder/GSE62191.csv filter=lfs diff=lfs merge=lfs -text
|
| 2206 |
+
output/preprocess/Eczema/GSE123088.csv filter=lfs diff=lfs merge=lfs -text
|
output/preprocess/Eczema/GSE123088.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:606dd189b14daca7fb28c9c93944796970a8fede139c569197e905f1d5d0bce3
|
| 3 |
+
size 55765473
|
output/preprocess/Epilepsy/code/GSE65106.py
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Epilepsy"
|
| 6 |
+
cohort = "GSE65106"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Epilepsy"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Epilepsy/GSE65106"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Epilepsy/GSE65106.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Epilepsy/gene_data/GSE65106.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Epilepsy/clinical_data/GSE65106.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Epilepsy/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
# Determine data availability based on provided background and characteristics
|
| 40 |
+
is_gene_available = True # Whole-genome microarray gene expression profiling
|
| 41 |
+
trait_row = None # Trait of interest is Epilepsy; this dataset is ASD and excluded seizure disorders
|
| 42 |
+
age_row = 3 # 'donor age'
|
| 43 |
+
gender_row = 4 # 'donor sex'
|
| 44 |
+
|
| 45 |
+
# Conversion functions
|
| 46 |
+
def _extract_value(x):
|
| 47 |
+
if x is None:
|
| 48 |
+
return None
|
| 49 |
+
try:
|
| 50 |
+
s = str(x)
|
| 51 |
+
except Exception:
|
| 52 |
+
return None
|
| 53 |
+
if ':' in s:
|
| 54 |
+
s = s.split(':', 1)[1]
|
| 55 |
+
return s.strip()
|
| 56 |
+
|
| 57 |
+
def convert_trait(x):
|
| 58 |
+
# Binary: 1 = Epilepsy, 0 = Non-epilepsy
|
| 59 |
+
v = _extract_value(x)
|
| 60 |
+
if v is None or v == '':
|
| 61 |
+
return None
|
| 62 |
+
v_low = v.lower()
|
| 63 |
+
# Heuristics for epilepsy mentions
|
| 64 |
+
epilepsy_terms = ['epilepsy', 'seizure', 'temporal lobe epilepsy', 'tle', 'absence epilepsy', 'partial epilepsy']
|
| 65 |
+
if any(term in v_low for term in epilepsy_terms):
|
| 66 |
+
return 1
|
| 67 |
+
# If explicitly normal/control/ASD/WT/etc., treat as non-epilepsy
|
| 68 |
+
non_epilepsy_terms = ['normal', 'control', 'wt', 'asd', 'autism']
|
| 69 |
+
if any(term in v_low for term in non_epilepsy_terms):
|
| 70 |
+
return 0
|
| 71 |
+
return None
|
| 72 |
+
|
| 73 |
+
def convert_age(x):
|
| 74 |
+
# Continuous age in years; non-numeric (e.g., embryonic) -> None
|
| 75 |
+
v = _extract_value(x)
|
| 76 |
+
if v is None or v == '':
|
| 77 |
+
return None
|
| 78 |
+
v_low = v.lower()
|
| 79 |
+
if 'embryonic' in v_low or 'fetal' in v_low:
|
| 80 |
+
return None
|
| 81 |
+
try:
|
| 82 |
+
return float(v)
|
| 83 |
+
except Exception:
|
| 84 |
+
# try to extract leading numeric
|
| 85 |
+
import re
|
| 86 |
+
m = re.search(r'[-+]?\d*\.?\d+', v)
|
| 87 |
+
if m:
|
| 88 |
+
try:
|
| 89 |
+
return float(m.group(0))
|
| 90 |
+
except Exception:
|
| 91 |
+
return None
|
| 92 |
+
return None
|
| 93 |
+
|
| 94 |
+
def convert_gender(x):
|
| 95 |
+
# Binary: Female=0, Male=1
|
| 96 |
+
v = _extract_value(x)
|
| 97 |
+
if v is None or v == '':
|
| 98 |
+
return None
|
| 99 |
+
v_low = v.lower()
|
| 100 |
+
if v_low.startswith('male'):
|
| 101 |
+
return 1
|
| 102 |
+
if v_low.startswith('female'):
|
| 103 |
+
return 0
|
| 104 |
+
return None
|
| 105 |
+
|
| 106 |
+
# Initial filtering and save metadata
|
| 107 |
+
is_trait_available = trait_row is not None
|
| 108 |
+
_ = validate_and_save_cohort_info(
|
| 109 |
+
is_final=False,
|
| 110 |
+
cohort=cohort,
|
| 111 |
+
info_path=json_path,
|
| 112 |
+
is_gene_available=is_gene_available,
|
| 113 |
+
is_trait_available=is_trait_available
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
# Clinical feature extraction (skip if trait not available)
|
| 117 |
+
if trait_row is not None:
|
| 118 |
+
selected_clinical = geo_select_clinical_features(
|
| 119 |
+
clinical_df=clinical_data,
|
| 120 |
+
trait=trait,
|
| 121 |
+
trait_row=trait_row,
|
| 122 |
+
convert_trait=convert_trait,
|
| 123 |
+
age_row=age_row,
|
| 124 |
+
convert_age=convert_age,
|
| 125 |
+
gender_row=gender_row,
|
| 126 |
+
convert_gender=convert_gender
|
| 127 |
+
)
|
| 128 |
+
clinical_preview = preview_df(selected_clinical, n=5)
|
| 129 |
+
# Save clinical features
|
| 130 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 131 |
+
selected_clinical.to_csv(out_clinical_data_file, index=True)
|
| 132 |
+
|
| 133 |
+
# Step 3: Gene Data Extraction
|
| 134 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 135 |
+
gene_data = get_genetic_data(matrix_file)
|
| 136 |
+
|
| 137 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 138 |
+
print(gene_data.index[:20])
|
| 139 |
+
|
| 140 |
+
# Step 4: Gene Identifier Review
|
| 141 |
+
# Identifiers like '7892501' are Affymetrix probe set IDs (numeric), not HGNC gene symbols.
|
| 142 |
+
requires_gene_mapping = True
|
| 143 |
+
print(f"requires_gene_mapping = ({requires_gene_mapping})")
|
| 144 |
+
|
| 145 |
+
# Step 5: Gene Annotation
|
| 146 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 147 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 148 |
+
|
| 149 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 150 |
+
print("Gene annotation preview:")
|
| 151 |
+
print(preview_df(gene_annotation))
|
| 152 |
+
|
| 153 |
+
# Step 6: Gene Identifier Mapping
|
| 154 |
+
# Identify appropriate columns for probe IDs and gene symbols in the annotation
|
| 155 |
+
probe_col = 'ID'
|
| 156 |
+
# Prefer 'gene_assignment' for symbols; fall back to 'mrna_assignment' if needed
|
| 157 |
+
gene_symbol_col = 'gene_assignment' if 'gene_assignment' in gene_annotation.columns else (
|
| 158 |
+
'mrna_assignment' if 'mrna_assignment' in gene_annotation.columns else None
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
if gene_symbol_col is None:
|
| 162 |
+
raise ValueError("No suitable gene symbol column found in annotation (expected 'gene_assignment' or 'mrna_assignment').")
|
| 163 |
+
|
| 164 |
+
# Build mapping dataframe
|
| 165 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
| 166 |
+
|
| 167 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 168 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 169 |
+
|
| 170 |
+
# Step 7: Data Normalization and Linking
|
| 171 |
+
# 1. Normalize gene symbols and save gene-level data
|
| 172 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 173 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 174 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 175 |
+
|
| 176 |
+
# 2-6. Linkage and downstream steps only if trait data is available; otherwise, record metadata and stop.
|
| 177 |
+
is_trait_available = (trait_row is not None)
|
| 178 |
+
|
| 179 |
+
if is_trait_available and 'selected_clinical' in globals():
|
| 180 |
+
# Link clinical and genetic data
|
| 181 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical, normalized_gene_data)
|
| 182 |
+
|
| 183 |
+
# Handle missing values
|
| 184 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 185 |
+
|
| 186 |
+
# Bias check and remove biased demographic features
|
| 187 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 188 |
+
|
| 189 |
+
# Final validation and save metadata
|
| 190 |
+
is_usable = validate_and_save_cohort_info(
|
| 191 |
+
is_final=True,
|
| 192 |
+
cohort=cohort,
|
| 193 |
+
info_path=json_path,
|
| 194 |
+
is_gene_available=True,
|
| 195 |
+
is_trait_available=True,
|
| 196 |
+
is_biased=is_trait_biased,
|
| 197 |
+
df=unbiased_linked_data,
|
| 198 |
+
note="INFO: Clinical features linked and processed."
|
| 199 |
+
)
|
| 200 |
+
|
| 201 |
+
# Save linked data only if usable
|
| 202 |
+
if is_usable:
|
| 203 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 204 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 205 |
+
else:
|
| 206 |
+
# Trait not available: perform final validation only to record metadata; do not link or save linked data
|
| 207 |
+
_ = validate_and_save_cohort_info(
|
| 208 |
+
is_final=True,
|
| 209 |
+
cohort=cohort,
|
| 210 |
+
info_path=json_path,
|
| 211 |
+
is_gene_available=True,
|
| 212 |
+
is_trait_available=False,
|
| 213 |
+
is_biased=False,
|
| 214 |
+
df=normalized_gene_data.T,
|
| 215 |
+
note="INFO: Trait 'Epilepsy' is not recorded in this ASD cohort; clinical linking skipped."
|
| 216 |
+
)
|
output/preprocess/Epilepsy/code/GSE74571.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Epilepsy"
|
| 6 |
+
cohort = "GSE74571"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Epilepsy"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Epilepsy/GSE74571"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Epilepsy/GSE74571.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Epilepsy/gene_data/GSE74571.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Epilepsy/clinical_data/GSE74571.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Epilepsy/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import re
|
| 40 |
+
|
| 41 |
+
# 1) Gene Expression Data Availability
|
| 42 |
+
is_gene_available = True # Based on series summary indicating gene expression profiling on GSCs
|
| 43 |
+
|
| 44 |
+
# 2) Variable Availability and Data Type Conversion
|
| 45 |
+
|
| 46 |
+
# From the provided Sample Characteristics Dictionary:
|
| 47 |
+
# {0: ['cell/tissue type: ...'], 1: ['culture type: ...']}
|
| 48 |
+
# There is no explicit or inferable Epilepsy status, age, or gender information.
|
| 49 |
+
|
| 50 |
+
trait_row = None
|
| 51 |
+
age_row = None
|
| 52 |
+
gender_row = None
|
| 53 |
+
|
| 54 |
+
# Conversion helpers
|
| 55 |
+
def _after_colon(value: str) -> str:
|
| 56 |
+
if value is None:
|
| 57 |
+
return ''
|
| 58 |
+
parts = str(value).split(':', 1)
|
| 59 |
+
return parts[1].strip().lower() if len(parts) > 1 else str(value).strip().lower()
|
| 60 |
+
|
| 61 |
+
def convert_trait(value):
|
| 62 |
+
# Binary: 1 = Epilepsy case, 0 = non-epilepsy control
|
| 63 |
+
v = _after_colon(value)
|
| 64 |
+
if not v:
|
| 65 |
+
return None
|
| 66 |
+
# Positive epilepsy indicators
|
| 67 |
+
if any(term in v for term in ['epilepsy', 'epileptic', 'seizure', 'tle', 'temporal lobe epilepsy']):
|
| 68 |
+
return 1
|
| 69 |
+
# Clear control indicators
|
| 70 |
+
if any(term in v for term in ['control', 'healthy', 'non-epileptic', 'non epileptic', 'no epilepsy']):
|
| 71 |
+
return 0
|
| 72 |
+
# Ambiguous disease terms (e.g., GBM) are not epilepsy; avoid forcing to 0 without context
|
| 73 |
+
return None
|
| 74 |
+
|
| 75 |
+
def convert_age(value):
|
| 76 |
+
# Continuous: extract numeric age in years if present
|
| 77 |
+
v = _after_colon(value)
|
| 78 |
+
if not v:
|
| 79 |
+
return None
|
| 80 |
+
m = re.search(r'(\d+(\.\d+)?)', v)
|
| 81 |
+
if m:
|
| 82 |
+
try:
|
| 83 |
+
return float(m.group(1))
|
| 84 |
+
except Exception:
|
| 85 |
+
return None
|
| 86 |
+
return None
|
| 87 |
+
|
| 88 |
+
def convert_gender(value):
|
| 89 |
+
# Binary: female -> 0, male -> 1
|
| 90 |
+
v = _after_colon(value)
|
| 91 |
+
if not v:
|
| 92 |
+
return None
|
| 93 |
+
if v in ['female', 'f', 'woman', 'girl', 'wmn']:
|
| 94 |
+
return 0
|
| 95 |
+
if v in ['male', 'm', 'man', 'boy']:
|
| 96 |
+
return 1
|
| 97 |
+
return None
|
| 98 |
+
|
| 99 |
+
# 3) Save Metadata (initial filtering)
|
| 100 |
+
is_trait_available = trait_row is not None
|
| 101 |
+
_ = validate_and_save_cohort_info(
|
| 102 |
+
is_final=False,
|
| 103 |
+
cohort=cohort,
|
| 104 |
+
info_path=json_path,
|
| 105 |
+
is_gene_available=is_gene_available,
|
| 106 |
+
is_trait_available=is_trait_available
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
# 4) Clinical Feature Extraction (skip because trait_row is None)
|
| 110 |
+
# If in future data becomes available:
|
| 111 |
+
# if trait_row is not None:
|
| 112 |
+
# selected = geo_select_clinical_features(
|
| 113 |
+
# clinical_df=clinical_data,
|
| 114 |
+
# trait=trait,
|
| 115 |
+
# trait_row=trait_row,
|
| 116 |
+
# convert_trait=convert_trait,
|
| 117 |
+
# age_row=age_row,
|
| 118 |
+
# convert_age=convert_age,
|
| 119 |
+
# gender_row=gender_row,
|
| 120 |
+
# convert_gender=convert_gender
|
| 121 |
+
# )
|
| 122 |
+
# preview = preview_df(selected, n=5)
|
| 123 |
+
# selected.to_csv(out_clinical_data_file, index=True)
|
output/preprocess/Epilepsy/code/TCGA.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Epilepsy"
|
| 6 |
+
|
| 7 |
+
# Input paths
|
| 8 |
+
tcga_root_dir = "../DATA/TCGA"
|
| 9 |
+
|
| 10 |
+
# Output paths
|
| 11 |
+
out_data_file = "./output/z3/preprocess/Epilepsy/TCGA.csv"
|
| 12 |
+
out_gene_data_file = "./output/z3/preprocess/Epilepsy/gene_data/TCGA.csv"
|
| 13 |
+
out_clinical_data_file = "./output/z3/preprocess/Epilepsy/clinical_data/TCGA.csv"
|
| 14 |
+
json_path = "./output/z3/preprocess/Epilepsy/cohort_info.json"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Step 1: Initial Data Loading
|
| 18 |
+
import os
|
| 19 |
+
|
| 20 |
+
# Step 1: Select the most relevant TCGA cohort directory for the trait "Epilepsy"
|
| 21 |
+
synonyms = ["epilepsy", "seizure", "seizures", "ictal", "epileptic"]
|
| 22 |
+
all_dirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
| 23 |
+
matched_dirs = [d for d in all_dirs if any(s in d.lower() for s in synonyms)]
|
| 24 |
+
|
| 25 |
+
selected_cohort_dirname = None
|
| 26 |
+
if matched_dirs:
|
| 27 |
+
# Prefer exact 'epilepsy' match if present; otherwise take the first matched
|
| 28 |
+
prioritized = sorted(matched_dirs, key=lambda d: (0 if "epilepsy" in d.lower() else 1, d.lower()))
|
| 29 |
+
selected_cohort_dirname = prioritized[0]
|
| 30 |
+
|
| 31 |
+
if selected_cohort_dirname is None:
|
| 32 |
+
print("No suitable TCGA cohort found for the trait 'Epilepsy'. Skipping this trait.")
|
| 33 |
+
# Record unusable dataset status
|
| 34 |
+
_ = validate_and_save_cohort_info(
|
| 35 |
+
is_final=False,
|
| 36 |
+
cohort="TCGA",
|
| 37 |
+
info_path=json_path,
|
| 38 |
+
is_gene_available=False,
|
| 39 |
+
is_trait_available=False
|
| 40 |
+
)
|
| 41 |
+
clinical_df = None
|
| 42 |
+
gene_df = None
|
| 43 |
+
else:
|
| 44 |
+
# Step 2: Identify clinical and genetic data file paths
|
| 45 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_cohort_dirname)
|
| 46 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
| 47 |
+
|
| 48 |
+
# Step 3: Load both files as DataFrames
|
| 49 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0, low_memory=False, compression='infer')
|
| 50 |
+
gene_df = pd.read_csv(genetic_file_path, sep='\t', index_col=0, low_memory=False, compression='infer')
|
| 51 |
+
|
| 52 |
+
# Step 4: Print column names of the clinical data
|
| 53 |
+
print(list(clinical_df.columns))
|
output/preprocess/Epilepsy/gene_data/GSE199759.csv
CHANGED
|
@@ -1,103 +1 @@
|
|
| 1 |
-
|
| 2 |
-
A2ML1,-5.0603805,-3.7812428,-3.6631508,-4.109809,-3.8587713,-3.5930219,-4.490974,-4.3031635,-3.208416,-4.582319,-3.3812447,-3.5965142,-3.7585878,-2.928594,-2.872188,-1.1039696,-2.4899487,-2.4995818,-3.7593775,-3.1711535,-3.5947657,-2.747736,-3.0448432,-3.8759775,-4.0852747
|
| 3 |
-
A4GALT,-1.7683821,-1.9622822,-1.7939067,-1.3063498,-1.3852987,-2.450118,-1.774756,-1.7259665,-1.5607686,-2.4001632,-2.1647158,-2.2580414,-4.300986,-3.585343,-1.9080658,-1.4024825,-2.8209352,-3.9656296,-1.3022623,-4.418452,-1.3821878,-3.6736636,-3.455083,-3.4636517,-2.547381
|
| 4 |
-
AKAP4,3.7417364,3.480812,3.5530586,3.4801798,3.3479729,3.9426384,3.7758665,3.6065435,4.09863,4.162154,3.717309,3.3785677,3.9541054,3.8520432,3.736002,3.9748878,4.205145,4.064996,3.4801512,3.5895405,3.241249,3.7557192,4.2269144,3.8101177,3.4586945
|
| 5 |
-
ARID2,-2.6798697,-2.5276594,-2.2530107,-3.2358217,-2.49831,-2.3390212,-2.4517398,-2.95537,-1.9904518,-2.0659075,-1.3423176,-1.4213543,-2.0433426,-1.6748772,-1.8702517,-0.6617451,-1.864984,-1.1319752,-2.4111624,-1.6218386,-1.7719316,-1.2252584,-2.0252814,-1.8186898,-2.0057435
|
| 6 |
-
ASCC2,-3.3553357,-1.2852459,-1.5014758,-2.9991784,-1.786932,-2.739201,-4.3411613,-3.432331,-3.6765585,-2.19982,-3.2936954,-4.2360687,-3.1315002,-1.9391232,-2.5173035,-1.1784859,-1.9945555,-2.8981667,-2.4825172,-6.105052,-4.5192766,-4.3320265,-4.079235,-2.5185142,-4.063537
|
| 7 |
-
ATF7IP,-2.947196,-4.412384,-3.514485,-3.1242418,-3.3725224,-4.3325577,-4.0823884,-3.9385643,-4.6257825,-4.8591833,-4.1142263,-4.2994857,-3.111559,-1.6767435,-3.0617213,-2.6995654,-2.990213,-2.6005192,-4.130119,-6.7968817,-6.8616643,-4.563813,-4.3898416,-5.2235146,-5.4429784
|
| 8 |
-
ATP6V0D1,-1.7829375,-3.9933152,-3.3769822,-2.788393,-3.3985481,-3.7052383,-2.3409119,-2.3864164,-3.4887056,-2.9749131,-2.588059,-3.0455108,-2.5458422,-1.708775,-2.489521,-1.5581698,-2.4676986,-2.1774964,-2.9326634,-3.3572464,-1.9299769,-2.080471,-2.5872388,-3.9474688,-3.5824337
|
| 9 |
-
AVIL,-0.16482067,-0.809474,-0.96407604,-0.92655563,-0.9153795,-0.4148569,-0.893445,-0.69970703,-0.74034023,-0.3167429,-0.018641472,-0.887146,-0.34176064,0.6120949,-0.06810284,0.6253958,0.22262001,0.4663887,-0.8347025,-0.29446507,-0.7968197,-0.0839653,-0.22068024,-0.89472675,-1.6996512
|
| 10 |
-
C11orf68,-4.3835993,-3.8961067,-3.9383817,-3.7539601,-4.2367706,-4.7726374,-3.8802657,-3.621933,-4.4103804,-4.1559925,-4.0868382,-4.7178206,-2.9851847,-2.9985304,-2.9609613,-3.0066648,-3.2480178,-3.3521905,-4.297116,-6.2090297,-5.3435407,-5.795953,-5.2807674,-5.0016527,-5.1680098
|
| 11 |
-
CCDC8,-1.8504777,-1.3804665,-1.2996168,-1.7854409,-1.528779,-1.0656109,-2.0239344,-1.9040947,-2.3835487,-1.9478807,-2.4390717,-2.0541506,-1.088788,-0.64507294,-1.6883388,-0.81048775,-1.1300611,-1.1491222,-1.4522924,-1.7473779,-1.554491,-0.34681034,-0.16363144,-1.7087269,-1.6749792
|
| 12 |
-
CCL1,-4.7879796,-2.5028863,-1.8121896,-1.3314843,-1.5831828,-2.225634,-3.0010276,-2.2517452,-1.221746,-2.5627508,-3.1827035,-2.7814507,-3.3466501,-2.5620732,-3.1756678,-3.1728988,-2.7941508,-3.2183337,-2.4316654,-2.1795974,-3.3685622,-1.8921361,-2.4198694,-2.235642,-2.6366272
|
| 13 |
-
CD109,0.86255455,0.77608204,0.8289547,0.5767231,0.7714281,1.344389,0.7258892,0.7632427,1.9973564,1.6245852,1.36798,1.0740404,1.371213,1.6714258,1.6011286,2.1766949,1.6886282,1.6031904,0.92252827,0.8252888,1.475317,1.5876179,1.6573477,1.0114021,0.42642212
|
| 14 |
-
CD8A,-1.5585995,-1.6234145,-2.022696,-2.076425,-1.6787949,-1.5317373,-2.0936537,-2.0462813,-1.6653724,-1.8806129,-1.8033261,-2.163066,-2.0756845,-0.95136213,-1.8225751,-0.9011698,-1.2384295,-1.0536399,-1.7480221,-2.1733875,-2.3054295,-1.5311508,-1.5638242,-1.7524676,-2.5137358
|
| 15 |
-
CENPK,-1.9887357,-2.6838417,-2.9322839,-2.5305614,-2.009922,-2.199645,-2.3806453,-2.497795,-1.4593983,-2.457325,-0.7504635,-0.5781946,-1.7870336,-0.4846053,-1.285327,-0.65431976,-1.0700717,-0.714262,-1.7480145,-0.8372431,-0.6093035,-0.6829405,-1.0730362,-1.6211224,-1.6431952
|
| 16 |
-
CENPV,-1.6705713,-0.88896847,-0.6388922,-0.9276781,-0.88716507,-0.9937825,-1.2964239,-1.1253586,-1.3144097,-0.7757797,-1.325551,-1.9358907,-1.1059561,-0.5282073,-1.2114372,-0.3309555,-0.3962698,-0.80544615,-1.0660877,-2.0100102,-2.14043,-1.3557162,-0.4611082,-1.4770737,-1.568636
|
| 17 |
-
CKAP4,-3.3117485,-3.0535479,-2.335835,-1.6237321,-2.2719712,-3.0663385,-2.6371446,-3.1369777,-4.390237,-2.3278913,-4.836965,-4.805159,-3.2845101,-2.3563566,-3.2773075,-1.9392271,-2.6553435,-3.5550733,-2.4485054,-3.1927772,-3.6547909,-3.465331,-4.326194,-2.3876433,-4.2612743
|
| 18 |
-
CMC4,-0.55748177,-0.8528414,-1.132227,-0.84935474,-0.9884968,-0.74525833,-0.46340942,-0.5515251,-0.98068666,-0.9199667,-0.5270643,-0.7713537,-0.4011383,0.4753971,-0.158247,1.3272915,0.34671688,0.67173195,-0.96053314,-1.3889751,-1.0778484,-0.053131104,-0.33448887,-0.9931555,-1.6033363
|
| 19 |
-
CNTNAP1,0.057948112,-0.56516457,-1.0331964,-0.77948666,-0.6417179,-0.30146122,-0.22401047,-0.45709038,-0.23637581,-0.660347,-0.49609756,-0.16784859,-0.8442116,-0.07304382,-0.13508987,0.09883118,0.14271355,0.4445982,-0.3697815,-0.63183594,0.120695114,-0.10475445,0.21338177,-0.16024208,-0.49489212
|
| 20 |
-
CYP2B6,-2.2876782,-1.0210075,-1.7780232,-1.1653738,-1.4909797,-2.2275386,-1.8267689,-1.131465,-1.8092647,-2.3443084,-2.8010082,-2.7548308,-2.5152297,-1.5844617,-1.8501649,-1.0757723,-2.1396623,-2.1528988,-1.8166056,-0.89184,-3.529581,-1.3020048,-1.4522762,-0.9380722,-2.3939872
|
| 21 |
-
DCTN4,2.3150902,2.119564,2.5808268,1.9371138,2.0306845,2.2240906,1.8970184,2.126317,1.8219242,2.526847,1.540309,1.4784842,2.4842577,2.8295765,2.271164,2.9872818,2.9744415,2.707656,1.834382,1.123702,0.9407425,2.2293587,2.623516,2.2704,1.7763472
|
| 22 |
-
DDX17,-1.1065359,-1.3361864,-1.4302378,-1.3131576,-1.2342062,-1.8184257,-0.37124157,-0.90354824,-1.9192448,-1.6677237,-2.0886726,-1.5678172,-1.0821342,-1.2080579,-2.9619431,-2.2912965,-0.71636105,-1.6809411,-1.5634613,-2.16322,-1.900527,-0.778903,-1.1983509,-2.291298,-1.9159627
|
| 23 |
-
DENND2B,-1.3507504,-0.13756943,-0.05255413,-0.7166624,-0.10295868,-0.4795599,-0.97588253,-0.899518,-0.01406765,-0.7496691,-0.45613956,0.2130909,-0.29325485,0.092513084,-0.7656622,-0.10852146,-0.58821917,-0.1553731,-0.6192169,-2.267374,-1.5507722,-1.4726257,-0.34667397,-1.307157,-0.6049204
|
| 24 |
-
EIF3A,-3.2728450999999996,-3.00270605,-2.9826951,-3.57522545,-2.73187975,-2.4369929,-3.36372515,-3.5090824000000005,-1.84702656,-2.74826335,-2.44559885,-3.1627175999999997,-3.6812061,-1.88450095,-1.95470335,-2.3374782,-1.90933685,-2.92085145,-2.4426837,-3.6467176,-2.6652384000000002,-2.632122,-2.02501513,-3.61799665,-3.1269705
|
| 25 |
-
EP300,-1.4219556,-1.3789587,-1.3748655,-1.9044847,-1.8286695,-2.0525603,-2.3406324,-1.8081627,-2.0683208,-1.3767915,-2.1614332,-2.2096968,-1.6175032,-0.93731594,-1.5392766,-1.607523,-1.257597,-0.87550545,-2.1180153,-0.9687462,-2.9068432,-1.8500233,-2.9104776,-1.5247345,-3.2340293
|
| 26 |
-
EP400,2.206256,2.5221825,2.3661442,2.7328815,2.8368073,1.9280443,2.1563501,2.5412025,2.6783218,1.7396889,2.1339636,2.495696,1.7646275,-1.238512,1.5161953,1.1374655,0.31485367,0.75855637,1.8148909,1.7361336,2.406742,1.1686335,0.0532341,2.6957932,2.63655
|
| 27 |
-
EXOSC3,0.8921976,0.735487,0.27308464,0.45484734,0.5107527,0.4659853,0.6034622,0.4390087,0.6922445,0.3722887,0.84189415,0.9338465,0.050980568,0.84969425,1.3223362,1.7800789,1.0456238,0.86774254,0.7707796,0.80988884,1.251647,1.0002432,0.5738764,0.50185776,0.8626175
|
| 28 |
-
EXOSC6,-2.1609888,-2.8133488,-3.6481643,-3.277182,-2.8948321,-4.305608,-3.1442366,-3.076367,-3.2243886,-3.6336722,-3.7870178,-3.4197145,-4.559766,-2.3328156,-1.9803629,-0.89991474,-1.6627774,-2.4430127,-2.5624166,-3.152298,-2.476348,-2.104072,-3.65583,-4.207381,-3.3913722
|
| 29 |
-
EXOSC8,1.779624,1.5261555,1.1368904,0.8452263,1.6509447,-0.20444107,1.5387936,0.30620766,-0.39866638,0.5649595,-0.31795025,0.93284035,-1.0348148,-0.24638891,0.25548363,2.029725,1.1662436,-0.45435047,1.4717808,-2.1716986,1.2904873,0.14787388,-0.5383959,-1.6923618,-0.599905
|
| 30 |
-
FRMD3,0.9296818,2.5415716,2.0139208,2.658368,2.5794983,2.8841372,2.1186123,2.0842295,0.9519615,2.328785,0.6545477,0.6528559,1.8698273,2.3743162,0.78828526,1.5898991,2.8238726,1.9054079,2.1396742,0.4067831,1.0073338,2.6806297,1.8079805,1.6228333,2.044654
|
| 31 |
-
GATAD2B,-3.0375452,-3.9246378,-2.7162385,-3.928307,-2.7842903,-3.046441,-2.4730544,-2.6357236,-2.4819288,-2.9653363,-2.0521073,-2.267323,-2.7865667,-1.8413973,-2.3551435,-1.255907,-1.7795186,-2.0136056,-3.1181011,-1.3305893,-1.6867657,-1.2343097,-2.862875,-1.745223,-3.8668265
|
| 32 |
-
GEMIN4,-2.4647827,-2.514069,-3.0695515,-3.3439927,-3.0735564,-2.4835482,-3.7682261,-3.0988002,-3.2447605,-2.8601103,-3.1634412,-4.3552113,-2.7443824,-2.0375419,-1.7675037,-1.2297039,-2.403287,-2.6715055,-2.372611,-2.4564018,-4.1395664,-2.721601,-3.4473462,0.18791103,-2.8588529
|
| 33 |
-
GOLIM4,-2.0863953,-3.377222,-3.2129955,-3.1111484,-3.251676,-2.2512488,-3.4664173,-3.5297208,-2.953065,-3.092681,-2.8555298,-3.039877,-2.7652078,-1.3113451,-2.0157084,-0.4156208,-1.8004642,-1.6959634,-2.742073,-3.6862402,-3.079073,-2.0275583,-2.61664,-2.7356648,-3.6509523
|
| 34 |
-
H3C9P,-3.8760538,-4.2028155,-3.4044719,-4.4735413,-4.78402,-3.4161272,-4.31337,-4.6684523,-2.4439359,-3.4745817,-2.2035336,-3.836688,-3.332295,-3.4483366,-2.6847801,-2.1971235,-3.411961,-3.5010648,-4.1814294,-2.2702675,-2.4860559,-2.8882017,-2.9121866,-3.908465,-4.6937976
|
| 35 |
-
H3P10,3.1629515,4.024496,3.8848295,3.8964243,4.0490065,3.9917202,3.8306093,4.166013,4.5894394,3.9228535,3.272626,3.532175,3.2170134,2.9349213,3.2652044,3.2929134,3.017313,2.5613422,3.824253,3.0717697,3.5699492,3.4878864,2.988575,3.9925995,3.786745
|
| 36 |
-
H3P11,0.118821144,-0.552618,-0.42336082,-0.5263386,-0.3154049,-0.5518036,-1.0686388,0.08796692,-1.8151336,-0.30031586,-1.1896782,-1.2329736,-0.52809334,-0.881547,-1.0588388,-1.0597801,-0.432137,-0.68905497,-0.3056383,-0.24771595,-1.1815958,-1.0206046,-1.1726775,-0.71199703,-1.0347652
|
| 37 |
-
H3P12,-1.6482048,-0.36242676,-1.2417021,0.10468006,-0.45571136,-2.0802317,-2.0316095,-1.5713749,-0.11336994,-0.9014492,-1.5787153,-1.252451,-1.4539824,0.096601486,-0.33380032,0.5070076,-0.8894682,-0.112306595,-0.48901367,-3.5261006,-1.650456,-0.8123846,-0.2749691,-1.4388876,-1.911582
|
| 38 |
-
H3P13,-0.76815367,0.23287773,-0.254323,0.5004797,-0.12890434,-0.8219948,-0.51501274,-0.57452106,0.6179018,-0.16930485,-0.5502653,-0.21926403,-0.03675556,0.5260639,0.18685627,0.71001625,0.122820854,0.1441698,-0.042087555,-1.0809355,-0.2668209,0.28165913,0.37725735,-0.43414307,-0.055701256
|
| 39 |
-
H3P14,0.34837723,1.6777077,0.78243256,2.124837,1.6752167,0.54621124,0.045448303,0.32555485,2.6077147,1.2978611,1.3509407,1.6458101,0.5618458,1.2428284,0.9971981,1.2516136,0.18939018,1.182065,1.3091955,-0.66446877,1.3856077,1.0669947,1.9279737,1.3300896,0.9291811
|
| 40 |
-
H3P16,-1.7236176,-0.680563,-1.317131,-1.2363968,-0.8627548,-1.146421,-0.9977541,-1.1959982,-1.2667041,-0.8448744,-0.8416109,-1.0096169,-1.1534157,-0.39124537,-1.0175619,-0.7302904,-0.19950008,0.27273083,-1.3827057,-1.6698141,-1.7066064,-1.012353,-0.5962162,-0.889822,-1.5559406
|
| 41 |
-
H3P19,-3.4817605,-3.8678136,-3.4340796,-4.8043375,-3.4429917,-3.600307,-5.008458,-4.592385,-1.4970021,-2.3917446,-1.367302,-2.1454096,-3.3330388,-2.7415752,-1.8890667,-1.3562608,-3.1984463,-3.7555962,-3.0444317,-1.2096939,-0.6311407,-2.483265,-3.3675303,-4.3926296,-4.3451467
|
| 42 |
-
H3P22,-0.35166168,0.28062344,0.29047394,-0.5241909,0.04175949,-0.23333263,0.50341797,-0.61962795,-0.6598358,0.14792442,0.049552917,-0.665143,0.26089668,0.36888027,0.052096367,0.5730629,0.28029537,0.4305601,-0.24028015,-0.5794096,-0.33320427,-0.44474316,-0.13541412,-0.090084076,-0.037550926
|
| 43 |
-
H3P23,-3.786625,-3.5378132,-3.6138272,-3.7128258,-3.6793714,-3.6215677,-3.3108244,-3.7316475,-1.9024601,-3.2558794,-2.1292553,-3.278741,-3.1224594,-2.570447,-2.457796,-1.8257899,-2.8209662,-2.4985666,-3.3381767,-2.6479125,-1.6080928,-2.2818203,-2.5233073,-3.1883912,-3.121707
|
| 44 |
-
H3P24,-2.4304671,-2.885223,-3.1108537,-2.8555255,-2.5225582,-2.3761463,-2.7584472,-3.0509896,-1.5310893,-3.1271658,-1.5486107,-2.0594544,-2.5851169,-2.1354938,-1.7626157,-1.6125407,-2.078248,-2.483059,-2.3174844,-2.2038903,-1.3393955,-1.7764444,-2.021779,-2.4734354,-2.2317972
|
| 45 |
-
H3P27,-2.8973746,-2.8370647,-2.5040617,-2.9780283,-2.5160036,-2.2499561,-2.2178946,-2.8205166,-2.2804704,-2.476925,-1.8837113,-2.3385963,-3.0193086,-2.1962652,-2.1442232,-0.724782,-2.4382029,-2.789772,-2.3315678,-2.8561234,-2.5228748,-2.4257622,-2.1183233,-2.3328414,-2.4390416
|
| 46 |
-
H3P28,-0.08210468,-0.69119453,-0.9288969,-0.771225,-0.92964363,-0.32362175,-1.1767054,-1.0159378,-1.0812507,-0.69817734,-1.3444653,-1.247025,-1.3380842,-0.043774605,-0.8436508,0.1368761,-0.18187141,-0.23954725,-0.7520399,-2.5553074,-1.7076764,-0.5935278,-0.54487705,-1.3133183,-1.9800949
|
| 47 |
-
H3P30,-1.4595575,-2.5752711,-2.666801,-2.2868886,-2.670434,-2.8465028,-4.077838,-2.6155577,-4.102567,-2.6931329,-3.096262,-3.6954312,-3.0072746,-1.8649931,-3.0837631,-2.2868981,-2.2260695,-2.3872552,-2.465972,-3.782631,-3.5464368,-2.9358249,-3.2683525,-1.7089696,-4.0699053
|
| 48 |
-
H3P33,-3.71657,-2.7704678,-2.836782,-2.9958205,-2.7883043,-2.434822,-2.9870877,-2.692222,-2.8267422,-2.6968646,-3.0033827,-3.5892043,-2.6813598,-1.5037932,-2.724288,-1.2852154,-1.9816337,-1.749589,-3.0998826,-4.0720463,-3.868763,-2.1152725,-2.0384846,-1.7963839,-3.7942924
|
| 49 |
-
H3P37,-2.535008,-3.906745,-3.6869116,-3.1080008,-3.3003874,-3.996841,-4.960901,-3.883336,-2.558486,-3.6086345,-2.3254457,-2.6059437,-2.6856713,-1.8431253,-2.3697882,-2.4780493,-4.310782,-3.906318,-3.5154529,-2.4727712,-2.524603,-3.6048903,-6.10395,-2.4232874,-2.790835
|
| 50 |
-
H3P38,-1.120441,-3.523107,-3.0233293,-2.8030891,-3.0119348,-3.3410583,-2.9793549,-4.6952477,-2.1978636,-3.9171925,-0.78495693,-1.1807241,-1.1400404,-2.3779688,-1.0491238,-1.9410868,-5.850545,-4.759824,-2.8532424,-0.19743347,-0.25144005,-3.0444617,-6.970093,-1.4736376,-0.24742126
|
| 51 |
-
H3P39,-2.4712195,-3.4154978,-3.2989888,-2.9300823,-3.1977286,-3.3340883,-3.2482967,-3.29672,-2.6869912,-3.7996411,-2.1517572,-3.2381492,-2.041132,-1.4031549,-1.9928775,-1.4924212,-2.326994,-2.2752204,-3.358055,-2.212184,-2.186656,-3.0156999,-3.3063898,-2.5916357,-2.034926
|
| 52 |
-
H3P40,-0.6896124,-1.9843926,-2.2447343,-1.5172181,-1.6966743,-1.9438095,-2.5972557,-2.3140817,-0.5322037,-2.0372472,0.013230324,-0.5061493,-0.12067032,0.88706875,-0.42491436,0.55229664,-1.3244748,-0.16566372,-1.4289746,0.58226967,0.012366295,-0.009976387,-1.7627592,0.09175396,-0.04300785
|
| 53 |
-
H3P43,-1.2283711,-0.9608698,-0.8124924,-0.8237114,-0.9610071,-0.796608,-0.9032068,-0.893178,-0.56445885,-0.52586555,-0.09753132,-0.54950714,-1.0998478,-0.10195255,-0.05629444,0.46330547,-0.42472935,-0.2841735,-0.6942787,-0.54021645,-0.2731352,-0.5185194,0.07833862,-1.0238199,-1.420434
|
| 54 |
-
H3P44,-0.93073416,-1.3107824,-1.5387406,-1.4931054,-1.7165036,-1.3274264,-1.5982523,-1.7993441,-0.9471159,-1.1022396,-0.40996265,-1.0300045,-1.6318741,-0.39232826,-0.7581701,-0.17810345,-0.56371164,-0.53896284,-1.153902,-0.8086157,-0.6082468,-0.34635353,-0.5803156,-1.4492936,-1.5595207
|
| 55 |
-
H3P45,-1.2014508,-1.6438289,-0.86570454,-1.3430433,-0.94428444,-1.5743995,-1.8390007,-0.8391819,-5.2948127,-1.2980957,-3.369228,-4.3280187,-0.7830343,-2.3584752,-3.7052078,-3.4763312,-1.9407248,-2.2396011,-2.0131807,-1.1573496,-3.1514306,-2.075171,-1.9990387,1.1485701,-1.9644017
|
| 56 |
-
H3P5,-4.701174,-2.023265,-2.282362,-3.645863,-2.4169693,-4.7796054,-4.400659,-3.438591,-2.0298548,-4.483681,-4.555165,-3.9971557,-4.3928685,-0.8131099,0.35885906,1.2167416,-0.9497161,-0.69243,-0.8978014,-6.368207,-3.0031862,-2.6484618,-4.447288,-4.8093553,-4.7127566
|
| 57 |
-
H3P6,-3.0053606,-0.7485094,-0.74493694,-1.4106975,-0.6932545,-2.8184648,-1.0004606,-1.5954409,-1.8807569,-2.0427823,-3.3174787,-2.033152,-2.926711,-2.6740928,-0.9909344,-1.6986208,-3.0876484,-3.131023,-1.7617693,-3.9360247,-2.1706252,-3.0083537,-3.3446164,-3.3283062,-2.3056283
|
| 58 |
-
H3P8,1.5605526,1.4138975,1.5276346,1.70362,0.8424549,1.1091566,1.1730394,1.6902189,1.9358091,0.5237713,0.26294613,1.0504856,0.20002651,0.39560032,0.81533813,-0.43380165,0.67685795,0.15053606,1.5147057,0.6052246,1.364728,0.9524307,0.5835428,0.8835411,0.8782387
|
| 59 |
-
H3P9,2.778741,2.4473705,2.0896873,2.4110107,2.4459,2.456234,2.6382475,3.0760756,1.8793688,2.5840921,1.6466722,2.143403,1.6255693,0.5901871,1.7372751,0.91744804,1.9640713,0.77248764,2.847478,2.8099003,2.5013332,1.6567678,1.1831589,2.2919893,2.5540953
|
| 60 |
-
HERC1,0.1112487499999999,0.21727800000000008,-0.45884945,-0.06162785000000004,-0.21588035000000005,0.10391094999999995,-0.1671739000000001,-0.1294875499999999,-0.4514572499999998,-0.3908992000000001,0.21789334999999999,-1.08531715,0.9133629999999999,0.449136475,0.5734198500000001,-0.12930320000000006,-0.019529600000000036,0.8927305,-0.3938822500000001,-1.47549627,-0.6066761,0.12137264999999986,0.08831405000000014,0.08453035000000009,-0.42067149999999986
|
| 61 |
-
HERC2,-1.3558259,-1.5100479,-1.6507797,-1.9286599,-1.6496754,-1.6347027,-1.6921701,-1.5019722,-1.9724879,-1.4418163,-2.10647,-2.0738325,-1.2415676,-0.13247585,-1.0595684,-0.67293453,-0.748888,-0.35694408,-1.8296733,-3.6043558,-2.960453,-1.373898,-1.368732,-2.0954428,-2.6343699
|
| 62 |
-
IMMT,0.506686685,1.10550929,1.3802252,1.09335804,1.3765120400000002,0.8411836500000001,0.8398995149999999,1.04360436,1.5885586649999999,0.91556168,1.098311415,1.081968805,1.18074892,1.74214505,1.3593940500000001,1.87347935,1.55251885,1.33265925,1.43422889,0.884887205,0.948767175,1.54106855,1.15290501,0.9962959224999999,1.07561063
|
| 63 |
-
MED25,-0.39754963,-1.0721884,-1.3724766,-1.0171385,-1.1244516,-1.0200009,-1.2547998,-0.95774174,-1.4551978,-0.95567703,-1.4689717,-1.7616768,-1.0116348,0.33555508,-0.7068758,-0.02587986,-0.1267891,-0.05987978,-1.2803731,-2.9207058,-2.6081052,-1.4312034,-1.595058,-1.7291803,-2.4413
|
| 64 |
-
MICOS13,1.4801226,2.0945606,1.8653517,1.0572815,1.5047283,1.6158447,2.2216854,1.1203814,0.3766451,1.3952827,2.8289595,4.032633,2.306983,0.4402113,2.9527388,1.318717,2.6366625,2.1783733,1.5378389,2.9509277,2.6947498,1.3923988,1.7421188,2.2516546,3.5521622
|
| 65 |
-
NBN,-1.3671165,-1.0358448,-0.86011124,-0.7183771,-0.77064323,-0.5592985,-1.0580187,-0.8282366,-0.21473312,-0.6960888,-1.6089053,-1.0891867,-1.602684,-0.61303806,-0.17631245,0.4754076,-0.6628251,-0.6127815,-0.7062168,-2.3093972,-0.8672581,-1.8114762,-1.6023917,-1.5174665,-1.8869648
|
| 66 |
-
NREP,-2.6544237,-2.1666732,-1.6228504,-0.88461494,-1.2171459,-1.5649233,-2.323072,-1.4069319,-3.2926025,-0.81414986,-2.3181763,-3.0808291,-1.316885,-1.5329309,-2.263917,-1.8510227,-1.8419409,-0.993588,-2.3870573,-2.6769338,-3.1568213,-2.3328905,-2.769898,-4.3013883,-3.2495346
|
| 67 |
-
NSUN5,-3.843028,-3.1717877,-2.061183,-3.812912,-1.6063099,-4.1904488,-3.327879,-2.650608,-5.021612,-3.0253162,-5.654264,-4.1898355,-3.2440486,-3.2363834,-3.3722663,-2.3522196,-2.3183784,-5.2657933,-3.1885152,-0.6073885,-5.0433044,-4.065819,-2.3309422,-3.235139,-4.6490884
|
| 68 |
-
PARP4,-2.6575818,-3.018506,-2.5888824,-3.1099958,-2.4790878,-3.1850295,-2.977798,-2.7566862,-2.0447283,-2.8098125,-3.031839,-3.0467553,-2.3346572,-1.3081393,-2.0451365,-0.7613659,-1.4715943,-1.9699521,-2.8894272,-4.796636,-4.233842,-2.807671,-2.5856729,-3.4986367,-3.5856843
|
| 69 |
-
PELP1,-0.31276417,-0.6056099,-0.62588024,-1.406487,-0.8146372,-1.4765062,-0.6180382,-0.50604534,-1.1242657,-1.0421505,-1.6649318,-1.994997,-0.2041645,-0.16986418,-0.5321026,0.3426838,-0.34304428,-0.81780386,-0.8069477,0.069563866,-1.9118476,-0.23250389,-0.6660824,-1.0218983,-0.05621147
|
| 70 |
-
PHB2,1.2781181,0.7703152,1.0794373,0.65952015,1.066186,1.0861597,0.8649626,0.93487453,1.3127985,1.1178226,1.3333645,0.743618,1.0741434,2.6223183,1.7014275,2.1150799,2.1958685,2.1957283,1.177597,0.95867825,1.0748777,2.0673876,2.08813,0.73352337,0.7003565
|
| 71 |
-
PIK3R4,1.5865107,1.887536,1.7066736,1.357727,1.4096079,1.6998653,2.0440903,1.4147635,1.8307028,1.9034262,2.0515146,2.1727915,1.5247021,1.4094238,1.6866436,1.0327597,1.3877792,1.206707,1.5271435,1.6466951,1.924305,1.244977,0.8570099,1.9546967,1.7294807
|
| 72 |
-
PIK3R5,-2.5522866,-1.5274143,-1.4926572,-2.2439737,-2.2333765,-2.1507645,-2.8839545,-2.4325867,-2.8107219,-2.1458445,-2.2145085,-3.130125,-2.8258214,-1.0740609,-1.8786888,-0.5446024,-1.6906891,-1.7089257,-2.297995,-3.3941927,-2.8297758,-2.36017,-2.1714845,-3.0666728,-3.4089417
|
| 73 |
-
PLBD2,0.28774834,0.94585323,1.3232813,-0.3903923,0.5693073,0.5907812,1.5181303,1.9796333,-2.2893934,0.3360405,1.6847095,1.3967781,1.7153978,0.7136564,-0.010919571,1.2868547,-0.14916801,1.1707058,0.5845909,0.6518345,-0.24318218,0.004423142,-0.6778741,0.6571913,-0.21194649
|
| 74 |
-
POM121,0.5640402,0.2794323,0.49732876,0.42366123,0.53339005,0.77688026,0.3721218,0.5117445,0.5938568,0.7163725,1.1030836,1.211751,0.45205402,0.61271286,0.81160164,1.1597128,0.74816895,0.891798,0.45997906,0.5532274,0.7512579,0.6426363,0.5823889,0.75677204,0.4405241
|
| 75 |
-
PPP1R10,0.061976433,0.3084612,1.2081242,-0.33730602,-0.13553524,0.45788574,-0.3088932,-0.18496895,-0.25271416,0.79391575,0.7151108,-0.10418224,0.42586994,1.1171036,0.23860073,1.0998116,0.9457474,0.8384886,-0.3300953,-0.5291176,-0.715785,0.1163187,0.5008669,-0.03502941,-0.44084454
|
| 76 |
-
PPP1R12C,-2.2340093,-4.386175,-4.62963,-2.7165613,-3.0475464,-2.4850526,-3.22331,-2.878141,-5.1390038,-2.7409,-1.9010534,-3.7777796,-3.1485047,-2.77065,-3.7755442,-3.3973827,-3.886808,-3.2475657,-2.7584305,-2.775268,-3.8956237,-2.767458,-4.3641367,-4.637122,-5.139879
|
| 77 |
-
PRKDC,4.8105173,4.4831676,4.352833,4.357258,4.451868,4.684948,4.5342035,4.577262,4.492882,4.5521145,4.795824,4.8986626,4.17313,3.7880287,4.803664,4.1882668,4.445717,4.3026752,4.5708656,4.7668476,5.0985794,4.132949,4.589141,4.8817863,4.7568483
|
| 78 |
-
PSMD1,-2.8632312,-3.6603365,-3.22718,-3.599115,-3.3831277,-3.5525723,-3.5816011,-3.614449,-2.1440554,-4.067902,-2.1700397,-3.1363783,-2.9295702,-2.5915556,-0.90456104,-1.2256832,-1.9715629,-2.2644095,-2.9502983,1.7301893,-0.7615881,-2.146977,-3.1661606,-2.0776215,-3.0129933
|
| 79 |
-
QRFP,-2.7525482,-3.5154428,-3.157403,-2.9740586,-3.4012332,-3.2094154,-3.3780727,-2.7188907,-3.5655718,-2.9409523,-3.4779963,-3.023666,-3.1536765,-2.3415627,-2.8277693,-2.4162307,-2.5831375,-2.3822837,-3.4488678,-3.3390155,-3.8219085,-2.5603309,-2.9551926,-4.579433,-3.9880605
|
| 80 |
-
RALY,1.4563246,1.8403025,3.2951078,1.5047827,2.7073832,2.4825964,2.9084997,2.747408,2.7704334,2.0492477,2.3526936,2.819934,1.5609303,0.6155319,1.3882389,0.8698082,1.8062286,1.0409336,3.0098448,2.6245203,2.0910273,1.7421885,1.4974728,2.410674,2.4093256
|
| 81 |
-
RHOBTB2,-1.832253,-1.5063133,-1.1796112,-2.0472245,-1.1299891,-1.7516255,-1.4074392,-1.5722122,-3.604165,-1.750031,-2.7742982,-1.9944539,-0.8755007,-2.0892873,-2.886025,-0.549284,-1.530571,-2.966803,-1.4637151,0.06523323,-2.2328343,0.3050251,-1.2314453,-0.99544144,-2.0939555
|
| 82 |
-
RPLP2,1.838069,1.7674246,1.8997841,2.0884075,1.3108244,1.3802509,1.387578,2.0119143,2.2999077,1.1393471,0.68625927,1.3202934,0.30909443,0.9546604,1.1092682,-0.18908882,0.8832998,0.39875984,1.9353056,0.88450336,1.5642748,0.8896923,0.61433697,1.0629921,1.0816231
|
| 83 |
-
RSF1,-1.9206858,-2.0386362,-2.5290918,-1.9147143,-2.0851574,-2.1139932,-2.388914,-2.6027975,-2.6254125,-1.6757421,-2.5134974,-2.5765715,-2.7340755,-1.2037468,-1.8349524,-2.202115,-1.3093348,-1.1327233,-2.3713279,-4.199798,-3.2804532,-2.5657983,-2.7961206,-3.28787,-3.425675
|
| 84 |
-
S100A12,-0.9795666,-0.9169264,-0.23578262,-0.013917923,0.2592907,-0.78363705,-0.36348343,-0.7209549,-0.5189924,-0.8074198,-0.7965107,-1.0794001,-2.5327435,-1.2082634,-0.98039246,-0.010405541,-1.3736186,-1.7495494,-0.014544487,-3.1103253,-0.4738741,-2.046773,-1.5395403,-2.5390606,-1.6717491
|
| 85 |
-
SCYL1,-2.138184,-2.4742022,-2.4220552,-2.504921,-2.3639393,-2.158101,-2.54491,-2.4341693,-2.6346302,-2.1286092,-2.5238352,-2.6321597,-2.404005,-0.78158617,-1.8274136,-0.39675522,-1.0209389,-1.2877941,-2.3106766,-3.533145,-3.085709,-2.2657595,-1.8376751,-2.8786135,-3.2072406
|
| 86 |
-
SIGLEC7,0.45037937,0.9903393,1.4872494,-0.20650578,0.700799,0.76119804,1.6480417,2.1803875,-2.0673366,0.48643398,1.7836437,1.5580864,1.8397713,0.9367533,0.18220043,1.426486,0.3484497,1.481451,0.6404333,0.7880945,-0.07780647,0.46734905,-0.17970085,0.76915264,-0.14917946
|
| 87 |
-
SIRPA,-1.567164,-2.0889678,-1.6160421,-1.419179,-1.5017767,-2.0089493,-2.2745671,-1.7945971,-2.9211173,-2.003963,-1.1488419,-1.4289799,-1.8757253,-1.0734673,-2.3038468,-0.37960148,-1.3829088,-1.2769704,-2.0179715,-1.1492691,-0.53282547,-0.5650749,-1.5571823,-0.81377983,-2.560566
|
| 88 |
-
SKP2,-1.6367321,-1.0694561,-1.1327934,-1.1050458,-1.1601195,-0.8655729,-1.4605293,-1.4517121,-0.38599586,-0.81640625,-1.1279116,-0.92416763,-1.6233187,-0.46342182,0.14515305,0.39041138,-0.5679369,-0.5792532,-0.5688925,-0.5346832,-0.8868704,-1.6325145,-1.6236186,-1.2999673,-1.6626186
|
| 89 |
-
SLC10A4,2.1612272,2.9653177,3.316104,2.5996532,3.0798712,3.2202082,3.3031092,3.3397093,3.8420649,2.8132124,2.0399055,2.6822891,2.0106106,1.2159233,2.095913,1.4557066,1.8570032,1.0514975,3.3811302,1.9441919,2.3621464,2.2662497,2.6914654,3.1353292,3.013692
|
| 90 |
-
SLC10A5,-0.014458656,0.8496609,1.0471411,0.90099716,1.4783392,1.0958843,0.8233795,0.96562386,1.912466,0.92652893,0.62596416,0.47899914,-0.059116364,-1.0356293,0.068899155,-0.32632637,-0.5652399,-1.8235297,1.1831369,0.3220482,0.5996084,-0.058831215,0.93300724,1.230155,1.0552378
|
| 91 |
-
SLC10A7,-0.9832463,-0.06646252,-0.16755009,0.22119904,0.769969,0.51374626,-0.7300091,0.04800892,0.3726282,0.08155918,0.4201193,-0.005788803,-0.9647503,0.3618784,0.44333935,0.6320772,-0.41966343,0.4169569,0.1529913,-2.1949787,0.70668125,-0.5108681,-1.0237126,-1.6348019,0.017000198
|
| 92 |
-
STAT2,-0.49074745,-1.3185997,-1.096096,-1.0748825,-0.9660187,-0.8599701,-1.3527851,-1.0012197,-1.7432408,-1.0074339,-1.9169521,-2.0952868,-0.91782475,-0.22719336,-0.81662846,-0.54617023,-0.52378464,-0.40653658,-1.3327303,-3.2376451,-3.0048714,-1.8075533,-1.6795645,-1.6235418,-2.6000438
|
| 93 |
-
STXBP1,-0.61876106,-0.71982,-0.5972185,-0.4529152,-0.52488136,-0.6273174,-0.8471451,-0.90009594,0.66257,-0.3740635,0.45323658,0.12947178,-0.41966534,0.34312057,0.13851929,0.6311264,-0.12590027,-0.07662964,-0.42781067,-0.2625494,0.7462559,0.45916653,0.5588074,0.04758644,-0.52272034
|
| 94 |
-
SYF2,-3.7854567,-4.6311564,-2.3888035,-4.033697,-4.048156,-3.4443402,-3.6040425,-4.294682,-3.933671,-3.9472861,-2.3932576,-3.0150914,-4.16758,-3.0453386,-2.6257248,-1.982028,-2.6854029,-3.109676,-3.40441,-3.1578922,-3.288519,-3.1972628,-2.4317136,-5.2635403,-4.2593794
|
| 95 |
-
TCF12,0.3933096,1.1712837,1.1927576,0.60725975,1.3627825,-0.12587166,-0.7550602,0.5071621,-2.691166,0.6981678,-2.5162988,-1.5842562,-0.24387836,-2.8886795,-2.2705765,-1.9631081,-0.07928276,-2.4902778,0.7218399,0.49437618,-1.5591474,-2.6083221,-2.2858577,0.7673292,-1.6518345
|
| 96 |
-
TMED9,-0.8429804,-0.27010727,-0.56217194,-0.627635,-0.5583706,-0.6051607,-0.3369236,-0.2297926,-0.80725384,-0.18383884,-0.34996986,-0.533659,-0.1966238,0.22755527,-0.20144272,0.73785686,0.30351162,0.09365511,-0.64953995,-1.381876,-1.0571995,-0.22433949,-0.23695374,-0.6250067,-1.0813112
|
| 97 |
-
TP53BP1,-2.4532495,-1.4690571,-1.9768343,-2.598464,-2.4302258,-1.5352068,-2.805304,-2.5475187,-2.4068308,-1.7335682,-2.2052627,-1.7738285,-1.9737711,-1.6521254,-1.8851748,-1.823328,-1.951149,-1.263134,-2.6410646,-3.6440883,-3.480844,-1.6386347,-2.338715,-2.2863898,-3.110221
|
| 98 |
-
UBR4,-5.666684,-2.9719338,-2.5243802,-2.0259795,-2.4838972,-2.6990705,-3.5819635,-2.218319,-3.9261832,-2.8966994,-4.77277,-4.621647,-4.2476077,-2.7787461,-4.6005325,-3.2112536,-3.0609307,-4.7999687,-3.4225202,-6.576048,-6.2218294,-3.8687663,-2.3844953,-4.2610536,-6.067845
|
| 99 |
-
UBXN2B,-1.2430329,-1.3407459,-1.1740885,-1.1938701,-1.4363222,-1.227838,-1.4682436,-1.3390856,0.14845467,-1.4699359,0.06992245,-0.23861217,-0.7142248,0.28921127,-0.32892227,0.32052898,-0.24151039,-0.16046715,-1.3247943,-0.04263401,-0.17340946,-0.18067646,0.1395092,-0.42342186,-1.0376854
|
| 100 |
-
UPK3B,1.743084,1.4452248,1.1479502,1.1459122,1.2307568,1.4222012,1.5184784,0.8902874,1.3479872,1.6714697,1.9560966,1.6090555,0.9911642,1.8639345,2.0044565,2.3542824,1.6656418,1.6554298,1.4086657,1.8645315,2.1438227,1.5526285,1.2194691,1.3667173,0.9906368
|
| 101 |
-
USE1,3.306407,3.3272896,3.15913,3.1353416,3.2443361,3.3585558,3.5317593,3.474306,3.391698,3.4201927,3.612423,3.9309168,2.8174114,3.3504314,3.3953552,3.064395,3.2703161,3.433978,3.3317976,3.350089,3.4349937,3.510275,4.0564938,3.8109207,3.338314
|
| 102 |
-
ZC3H12D,-2.0860105,-1.9535084,-1.8340406,-2.362392,-2.0383344,-1.7143817,-1.9987903,-2.3675466,1.8938017,-1.760787,-1.0060482,-1.8275056,-1.8505378,-0.89105797,-1.4130716,-0.10095596,-0.94480515,-1.0448942,-1.6161385,-1.1525288,-0.8864069,-0.9663749,-0.9704876,-2.3378024,-2.6291208
|
| 103 |
-
ZNF398,-4.0970597,-3.5297546,-3.4323487,-3.5309024,-3.3309321,-4.1229386,-3.6333404,-4.1616035,-3.3457546,-4.267276,-3.6161513,-4.0436945,-4.3293295,-1.9774194,-1.7139125,-0.986948,-2.7029362,-2.4590259,-2.6680126,-3.561699,-3.6502604,-2.342462,-3.197341,-4.619508,-4.899833
|
|
|
|
| 1 |
+
Gene,GSM5984016,GSM5984017,GSM5984018,GSM5984019,GSM5984020,GSM5984021,GSM5984022,GSM5984023,GSM5984024,GSM5984025,GSM5984026,GSM5984027,GSM5984028,GSM5984029,GSM5984030,GSM5984031,GSM5984032,GSM5984033,GSM5984034,GSM5984035,GSM5984036,GSM5984037,GSM5984038,GSM5984039,GSM5984040
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Esophageal_Cancer/GSE75241.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
output/preprocess/Esophageal_Cancer/clinical_data/GSE107754.csv
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
,GSM2878070,GSM2878071,GSM2878072,GSM2878073,GSM2878074,GSM2878075,GSM2878076,GSM2878077,GSM2878078,GSM2878079,GSM2878080,GSM2878081,GSM2878082,GSM2891194,GSM2891195,GSM2891196,GSM2891197,GSM2891198,GSM2891199,GSM2891200,GSM2891201,GSM2891202,GSM2891203,GSM2891204,GSM2891205,GSM2891206,GSM2891207,GSM2891208,GSM2891209,GSM2891210,GSM2891211,GSM2891212,GSM2891213,GSM2891214,GSM2891215,GSM2891216,GSM2891217,GSM2891218,GSM2891219,GSM2891220,GSM2891221,GSM2891222,GSM2891223,GSM2891224,GSM2891225,GSM2891226,GSM2891227,GSM2891228,GSM2891229,GSM2891230,GSM2891231,GSM2891232,GSM2891233,GSM2891234,GSM2891235,GSM2891236,GSM2891237,GSM2891238,GSM2891239,GSM2891240,GSM2891241,GSM2891242,GSM2891243,GSM2891244,GSM2891245,GSM2891246,GSM2891247,GSM2891248,GSM2891249,GSM2891250,GSM2891251,GSM2891252,GSM2891253,GSM2891254,GSM2891255,GSM2891256,GSM2891257,GSM2891258,GSM2891259,GSM2891260,GSM2891261,GSM2891262,GSM2891263,GSM2891264
|
| 2 |
-
Esophageal_Cancer,
|
| 3 |
Gender,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,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,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0
|
|
|
|
| 1 |
,GSM2878070,GSM2878071,GSM2878072,GSM2878073,GSM2878074,GSM2878075,GSM2878076,GSM2878077,GSM2878078,GSM2878079,GSM2878080,GSM2878081,GSM2878082,GSM2891194,GSM2891195,GSM2891196,GSM2891197,GSM2891198,GSM2891199,GSM2891200,GSM2891201,GSM2891202,GSM2891203,GSM2891204,GSM2891205,GSM2891206,GSM2891207,GSM2891208,GSM2891209,GSM2891210,GSM2891211,GSM2891212,GSM2891213,GSM2891214,GSM2891215,GSM2891216,GSM2891217,GSM2891218,GSM2891219,GSM2891220,GSM2891221,GSM2891222,GSM2891223,GSM2891224,GSM2891225,GSM2891226,GSM2891227,GSM2891228,GSM2891229,GSM2891230,GSM2891231,GSM2891232,GSM2891233,GSM2891234,GSM2891235,GSM2891236,GSM2891237,GSM2891238,GSM2891239,GSM2891240,GSM2891241,GSM2891242,GSM2891243,GSM2891244,GSM2891245,GSM2891246,GSM2891247,GSM2891248,GSM2891249,GSM2891250,GSM2891251,GSM2891252,GSM2891253,GSM2891254,GSM2891255,GSM2891256,GSM2891257,GSM2891258,GSM2891259,GSM2891260,GSM2891261,GSM2891262,GSM2891263,GSM2891264
|
| 2 |
+
Esophageal_Cancer,,,,,,,,,,,,,,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,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
|
| 3 |
Gender,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,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,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0
|
output/preprocess/Esophageal_Cancer/code/GSE100843.py
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE100843"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE100843"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE100843.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE100843.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE100843.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression data availability (from background: microarrays for global gene expression)
|
| 43 |
+
is_gene_available = True
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability assessment based on the provided Sample Characteristics Dictionary
|
| 46 |
+
# Sample Characteristics Dictionary (from previous step output)
|
| 47 |
+
sample_char_dict = {
|
| 48 |
+
0: ["tissue: Barrett's esophagus segment", "tissue: Normal esophageal squamous mucosa"],
|
| 49 |
+
1: ["arm: Arm B", "arm: Arm A"],
|
| 50 |
+
2: ["timepoint (t0=before, t1=after): T0", "timepoint (t0=before, t1=after): T1"],
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
# Trait is Esophageal_Cancer; this dataset contains Barrett's esophagus and normal squamous tissue,
|
| 54 |
+
# with vitamin D intervention timepoints and arms. There is no explicit or inferable esophageal cancer status.
|
| 55 |
+
trait_row = None
|
| 56 |
+
|
| 57 |
+
# No age or gender fields exist in the sample characteristics dictionary.
|
| 58 |
+
age_row = None
|
| 59 |
+
gender_row = None
|
| 60 |
+
|
| 61 |
+
# 2.2 Conversion functions
|
| 62 |
+
def _after_colon(value: str) -> str:
|
| 63 |
+
if value is None:
|
| 64 |
+
return ""
|
| 65 |
+
if isinstance(value, (int, float)):
|
| 66 |
+
return str(value)
|
| 67 |
+
parts = str(value).split(":", 1)
|
| 68 |
+
val = parts[1] if len(parts) == 2 else parts[0]
|
| 69 |
+
return val.strip()
|
| 70 |
+
|
| 71 |
+
def convert_trait(value):
|
| 72 |
+
# Binary mapping for Esophageal_Cancer if ever present: cancer=1, non-cancer/control=0; else None
|
| 73 |
+
v = _after_colon(value).lower()
|
| 74 |
+
if not v:
|
| 75 |
+
return None
|
| 76 |
+
# Positive indicators
|
| 77 |
+
pos_markers = ["esophageal cancer", "esophageal carcinoma", "escc", "eac", "adenocarcinoma", "squamous cell carcinoma"]
|
| 78 |
+
if any(m in v for m in pos_markers):
|
| 79 |
+
return 1
|
| 80 |
+
# Negative indicators
|
| 81 |
+
neg_markers = ["control", "normal", "healthy", "no cancer", "benign"]
|
| 82 |
+
if any(m in v for m in neg_markers):
|
| 83 |
+
return 0
|
| 84 |
+
return None
|
| 85 |
+
|
| 86 |
+
def convert_age(value):
|
| 87 |
+
v = _after_colon(value)
|
| 88 |
+
if not v:
|
| 89 |
+
return None
|
| 90 |
+
# extract first number (years) if present
|
| 91 |
+
m = re.search(r"[-+]?\d*\.?\d+", v)
|
| 92 |
+
if not m:
|
| 93 |
+
return None
|
| 94 |
+
try:
|
| 95 |
+
return float(m.group(0))
|
| 96 |
+
except Exception:
|
| 97 |
+
return None
|
| 98 |
+
|
| 99 |
+
def convert_gender(value):
|
| 100 |
+
v = _after_colon(value).lower()
|
| 101 |
+
if not v:
|
| 102 |
+
return None
|
| 103 |
+
if v in ["female", "f", "woman", "women"]:
|
| 104 |
+
return 0
|
| 105 |
+
if v in ["male", "m", "man", "men"]:
|
| 106 |
+
return 1
|
| 107 |
+
# handle common encodings
|
| 108 |
+
if v.startswith("fem"):
|
| 109 |
+
return 0
|
| 110 |
+
if v.startswith("mal"):
|
| 111 |
+
return 1
|
| 112 |
+
return None
|
| 113 |
+
|
| 114 |
+
# 3) Save metadata (initial filtering)
|
| 115 |
+
is_trait_available = trait_row is not None
|
| 116 |
+
_ = validate_and_save_cohort_info(
|
| 117 |
+
is_final=False,
|
| 118 |
+
cohort=cohort,
|
| 119 |
+
info_path=json_path,
|
| 120 |
+
is_gene_available=is_gene_available,
|
| 121 |
+
is_trait_available=is_trait_available
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
# 4) Clinical feature extraction (skip because trait_row is None -> clinical variable not available)
|
| 125 |
+
if trait_row is not None:
|
| 126 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 127 |
+
clinical_df=clinical_data,
|
| 128 |
+
trait=trait,
|
| 129 |
+
trait_row=trait_row,
|
| 130 |
+
convert_trait=convert_trait,
|
| 131 |
+
age_row=age_row,
|
| 132 |
+
convert_age=convert_age,
|
| 133 |
+
gender_row=gender_row,
|
| 134 |
+
convert_gender=convert_gender
|
| 135 |
+
)
|
| 136 |
+
preview = preview_df(selected_clinical_df, n=5)
|
| 137 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 138 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 139 |
+
|
| 140 |
+
# Step 3: Gene Data Extraction
|
| 141 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 142 |
+
gene_data = get_genetic_data(matrix_file)
|
| 143 |
+
|
| 144 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 145 |
+
print(gene_data.index[:20])
|
| 146 |
+
|
| 147 |
+
# Step 4: Gene Identifier Review
|
| 148 |
+
requires_gene_mapping = True
|
| 149 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 150 |
+
|
| 151 |
+
# Step 5: Gene Annotation
|
| 152 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 153 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 154 |
+
|
| 155 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 156 |
+
print("Gene annotation preview:")
|
| 157 |
+
print(preview_df(gene_annotation))
|
| 158 |
+
|
| 159 |
+
# Step 6: Gene Identifier Mapping
|
| 160 |
+
# Determine appropriate columns for probe IDs and gene symbols from gene_annotation
|
| 161 |
+
probe_col = 'ID'
|
| 162 |
+
gene_symbol_col = 'gene_assignment' if 'gene_assignment' in gene_annotation.columns else (
|
| 163 |
+
'mrna_assignment' if 'mrna_assignment' in gene_annotation.columns else None
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
if gene_symbol_col is None:
|
| 167 |
+
raise ValueError("Could not find a suitable gene symbol column in gene annotation.")
|
| 168 |
+
|
| 169 |
+
# 2. Get mapping dataframe: probe ID -> gene symbols (embedded text to be parsed by helper)
|
| 170 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
| 171 |
+
|
| 172 |
+
# 3. Apply mapping to convert probe-level measurements to gene-level expression
|
| 173 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 174 |
+
|
| 175 |
+
# Step 7: Data Normalization and Linking
|
| 176 |
+
import os
|
| 177 |
+
import pandas as pd
|
| 178 |
+
|
| 179 |
+
# 1. Normalize gene symbols and save gene data
|
| 180 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 181 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 182 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 183 |
+
|
| 184 |
+
# 2-6. Link and downstream steps only if clinical data exists
|
| 185 |
+
if 'selected_clinical_data' in locals() and isinstance(selected_clinical_data, pd.DataFrame):
|
| 186 |
+
# 2. Link clinical and genetic data
|
| 187 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
| 188 |
+
|
| 189 |
+
# 3. Handle missing values
|
| 190 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 191 |
+
|
| 192 |
+
# 4. Bias check and remove biased demographic features
|
| 193 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 194 |
+
|
| 195 |
+
# 5. Final quality validation and save metadata
|
| 196 |
+
note = "INFO: Clinical traits available and linked; bias assessed and demographics filtered if biased."
|
| 197 |
+
is_usable = 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=True,
|
| 203 |
+
is_biased=is_trait_biased,
|
| 204 |
+
df=unbiased_linked_data,
|
| 205 |
+
note=note
|
| 206 |
+
)
|
| 207 |
+
|
| 208 |
+
# 6. Save linked data if usable
|
| 209 |
+
if is_usable:
|
| 210 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 211 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 212 |
+
else:
|
| 213 |
+
# Clinical/trait data unavailable; skip linking and record initial filtering status without triggering final validation
|
| 214 |
+
print("Skipping linking and downstream steps: trait/clinical data unavailable. Gene expression data was processed and saved.")
|
| 215 |
+
_ = validate_and_save_cohort_info(
|
| 216 |
+
is_final=False,
|
| 217 |
+
cohort=cohort,
|
| 218 |
+
info_path=json_path,
|
| 219 |
+
is_gene_available=True,
|
| 220 |
+
is_trait_available=False
|
| 221 |
+
)
|
output/preprocess/Esophageal_Cancer/code/GSE104958.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE104958"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE104958"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE104958.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE104958.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE104958.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import pandas as pd
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression availability (based on DNA microarray description in background)
|
| 43 |
+
is_gene_available = True
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability and converters
|
| 46 |
+
# From the Sample Characteristics Dictionary, trait (Esophageal_Cancer) can be inferred from 'tissue: cancer tissue' vs 'tissue: normal tissue' at key 1
|
| 47 |
+
trait_row = 1
|
| 48 |
+
age_row = None
|
| 49 |
+
gender_row = None
|
| 50 |
+
|
| 51 |
+
def convert_trait(x):
|
| 52 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 53 |
+
return None
|
| 54 |
+
s = str(x)
|
| 55 |
+
if ':' in s:
|
| 56 |
+
s = s.split(':', 1)[1]
|
| 57 |
+
s = s.strip().lower()
|
| 58 |
+
if s in {'', 'na', 'n/a', 'nan', 'unknown', 'none'}:
|
| 59 |
+
return None
|
| 60 |
+
# Map normal to 0
|
| 61 |
+
if 'normal' in s and 'abnormal' not in s:
|
| 62 |
+
return 0
|
| 63 |
+
# Map cancer/tumor-related terms to 1
|
| 64 |
+
cancer_terms = ['cancer', 'tumor', 'tumour', 'carcinoma', 'malignan']
|
| 65 |
+
if any(term in s for term in cancer_terms):
|
| 66 |
+
return 1
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
def convert_age(x):
|
| 70 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 71 |
+
return None
|
| 72 |
+
s = str(x)
|
| 73 |
+
if ':' in s:
|
| 74 |
+
s = s.split(':', 1)[1]
|
| 75 |
+
s = s.strip().lower().replace('years', '').replace('year', '').replace('yrs', '').replace('yr', '').replace('y/o', '').replace('yo', '').replace('y', '')
|
| 76 |
+
s = s.replace('~', '').replace('about', '').replace('approximately', '').strip()
|
| 77 |
+
# Keep only digits, decimal point, and minus sign
|
| 78 |
+
filtered = ''.join(ch for ch in s if (ch.isdigit() or ch in {'.', '-'}))
|
| 79 |
+
try:
|
| 80 |
+
val = float(filtered)
|
| 81 |
+
if 0 < val < 120:
|
| 82 |
+
return val
|
| 83 |
+
return None
|
| 84 |
+
except Exception:
|
| 85 |
+
return None
|
| 86 |
+
|
| 87 |
+
def convert_gender(x):
|
| 88 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 89 |
+
return None
|
| 90 |
+
s = str(x)
|
| 91 |
+
if ':' in s:
|
| 92 |
+
s = s.split(':', 1)[1]
|
| 93 |
+
s = s.strip().lower()
|
| 94 |
+
if s in {'', 'na', 'n/a', 'nan', 'unknown', 'none'}:
|
| 95 |
+
return None
|
| 96 |
+
if s in {'female', 'f', 'woman', 'women', 'girl'}:
|
| 97 |
+
return 0
|
| 98 |
+
if s in {'male', 'm', 'man', 'men', 'boy'}:
|
| 99 |
+
return 1
|
| 100 |
+
# Heuristics
|
| 101 |
+
if 'female' in s:
|
| 102 |
+
return 0
|
| 103 |
+
if 'male' in s:
|
| 104 |
+
return 1
|
| 105 |
+
return None
|
| 106 |
+
|
| 107 |
+
# 3) Save metadata (initial filtering)
|
| 108 |
+
is_trait_available = trait_row is not None
|
| 109 |
+
_ = validate_and_save_cohort_info(
|
| 110 |
+
is_final=False,
|
| 111 |
+
cohort=cohort,
|
| 112 |
+
info_path=json_path,
|
| 113 |
+
is_gene_available=is_gene_available,
|
| 114 |
+
is_trait_available=is_trait_available
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
# 4) Clinical feature extraction (only if trait_row is available)
|
| 118 |
+
if trait_row is not None:
|
| 119 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 120 |
+
clinical_df=clinical_data,
|
| 121 |
+
trait=trait,
|
| 122 |
+
trait_row=trait_row,
|
| 123 |
+
convert_trait=convert_trait,
|
| 124 |
+
age_row=age_row,
|
| 125 |
+
convert_age=convert_age if age_row is not None else None,
|
| 126 |
+
gender_row=gender_row,
|
| 127 |
+
convert_gender=convert_gender if gender_row is not None else None
|
| 128 |
+
)
|
| 129 |
+
clinical_preview = preview_df(selected_clinical_df)
|
| 130 |
+
print(clinical_preview)
|
| 131 |
+
|
| 132 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 133 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 134 |
+
|
| 135 |
+
# Step 3: Gene Data Extraction
|
| 136 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 137 |
+
gene_data = get_genetic_data(matrix_file)
|
| 138 |
+
|
| 139 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 140 |
+
print(gene_data.index[:20])
|
| 141 |
+
|
| 142 |
+
# Step 4: Gene Identifier Review
|
| 143 |
+
print("requires_gene_mapping = True")
|
| 144 |
+
|
| 145 |
+
# Step 5: Gene Annotation
|
| 146 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 147 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 148 |
+
|
| 149 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 150 |
+
print("Gene annotation preview:")
|
| 151 |
+
print(preview_df(gene_annotation))
|
| 152 |
+
|
| 153 |
+
# Step 6: Gene Identifier Mapping
|
| 154 |
+
# Identify columns for probe IDs and gene symbols based on the annotation preview
|
| 155 |
+
probe_col = 'ID'
|
| 156 |
+
gene_col = 'GENE_SYMBOL'
|
| 157 |
+
|
| 158 |
+
# Build probe-to-gene mapping dataframe
|
| 159 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_col)
|
| 160 |
+
|
| 161 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 162 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
| 163 |
+
|
| 164 |
+
# Step 7: Data Normalization and Linking
|
| 165 |
+
import os
|
| 166 |
+
|
| 167 |
+
# 1. Normalize gene symbols and save gene expression data
|
| 168 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 169 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 170 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 171 |
+
|
| 172 |
+
# 2. Link the clinical and genetic data
|
| 173 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 174 |
+
|
| 175 |
+
# 3. Handle missing values
|
| 176 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 177 |
+
|
| 178 |
+
# 4. Bias check and remove biased demographic features
|
| 179 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 180 |
+
|
| 181 |
+
# 5. Final validation and save cohort info
|
| 182 |
+
is_usable = validate_and_save_cohort_info(
|
| 183 |
+
True,
|
| 184 |
+
cohort,
|
| 185 |
+
json_path,
|
| 186 |
+
True,
|
| 187 |
+
True,
|
| 188 |
+
is_trait_biased,
|
| 189 |
+
unbiased_linked_data,
|
| 190 |
+
note="INFO: Age and Gender not available; trait derived from tissue field."
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
+
# 6. Save linked data if usable
|
| 194 |
+
if is_usable:
|
| 195 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 196 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Esophageal_Cancer/code/GSE107754.py
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE107754"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE107754"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE107754.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE107754.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE107754.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import pandas as pd
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression data availability
|
| 43 |
+
is_gene_available = True # Whole human genome gene expression microarrays per series description.
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability and converters
|
| 46 |
+
|
| 47 |
+
# Determine rows from the Sample Characteristics Dictionary
|
| 48 |
+
trait_row = 2 # 'tissue: Esophagus cancer' present among diverse tissues
|
| 49 |
+
age_row = None # No age information found
|
| 50 |
+
gender_row = 0 # 'gender: Female' / 'gender: Male'
|
| 51 |
+
|
| 52 |
+
# Converters
|
| 53 |
+
def convert_trait(x):
|
| 54 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 55 |
+
return None
|
| 56 |
+
s = str(x)
|
| 57 |
+
parts = s.split(":", 1)
|
| 58 |
+
header = parts[0].strip().lower() if len(parts) > 1 else ""
|
| 59 |
+
value = parts[1].strip().lower() if len(parts) > 1 else s.strip().lower()
|
| 60 |
+
# Heuristic mapping:
|
| 61 |
+
# - Positive (1): any 'tissue' entry mentioning esoph (covers esophagus/esophageal)
|
| 62 |
+
# - Negative (0): other 'tissue' entries
|
| 63 |
+
# - Unknown (None): entries that are not about tissue (e.g., biopsy location)
|
| 64 |
+
if header == "tissue":
|
| 65 |
+
if "esoph" in value:
|
| 66 |
+
return 1
|
| 67 |
+
# Any other tissue is considered non-esophageal cancer
|
| 68 |
+
return 0
|
| 69 |
+
# Not a tissue field -> cannot infer trait confidently
|
| 70 |
+
return None
|
| 71 |
+
|
| 72 |
+
def convert_gender(x):
|
| 73 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 74 |
+
return None
|
| 75 |
+
s = str(x)
|
| 76 |
+
parts = s.split(":", 1)
|
| 77 |
+
value = parts[1].strip().lower() if len(parts) > 1 else s.strip().lower()
|
| 78 |
+
if value in ["male", "m"]:
|
| 79 |
+
return 1
|
| 80 |
+
if value in ["female", "f"]:
|
| 81 |
+
return 0
|
| 82 |
+
return None
|
| 83 |
+
|
| 84 |
+
def convert_age(x):
|
| 85 |
+
# Not used because age_row is None; included for completeness.
|
| 86 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 87 |
+
return None
|
| 88 |
+
s = str(x)
|
| 89 |
+
parts = s.split(":", 1)
|
| 90 |
+
value = parts[1].strip() if len(parts) > 1 else s.strip()
|
| 91 |
+
# Extract leading numeric
|
| 92 |
+
try:
|
| 93 |
+
# Remove common non-numeric trailing characters
|
| 94 |
+
value_clean = "".join(ch for ch in value if (ch.isdigit() or ch == "." or ch == "-"))
|
| 95 |
+
return float(value_clean) if value_clean not in ["", "-", "."] else None
|
| 96 |
+
except Exception:
|
| 97 |
+
return None
|
| 98 |
+
|
| 99 |
+
# 3) Save metadata (initial filtering)
|
| 100 |
+
is_trait_available = trait_row is not None
|
| 101 |
+
_ = validate_and_save_cohort_info(
|
| 102 |
+
is_final=False,
|
| 103 |
+
cohort=cohort,
|
| 104 |
+
info_path=json_path,
|
| 105 |
+
is_gene_available=is_gene_available,
|
| 106 |
+
is_trait_available=is_trait_available
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
# 4) Clinical Feature Extraction (only if trait data is available)
|
| 110 |
+
if trait_row is not None:
|
| 111 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 112 |
+
clinical_df=clinical_data,
|
| 113 |
+
trait=trait,
|
| 114 |
+
trait_row=trait_row,
|
| 115 |
+
convert_trait=convert_trait,
|
| 116 |
+
age_row=age_row,
|
| 117 |
+
convert_age=convert_age,
|
| 118 |
+
gender_row=gender_row,
|
| 119 |
+
convert_gender=convert_gender
|
| 120 |
+
)
|
| 121 |
+
# Preview
|
| 122 |
+
preview = preview_df(selected_clinical_df, n=5)
|
| 123 |
+
print(preview)
|
| 124 |
+
|
| 125 |
+
# Ensure output directory exists and save
|
| 126 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 127 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 128 |
+
|
| 129 |
+
# Step 3: Gene Data Extraction
|
| 130 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 131 |
+
gene_data = get_genetic_data(matrix_file)
|
| 132 |
+
|
| 133 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 134 |
+
print(gene_data.index[:20])
|
| 135 |
+
|
| 136 |
+
# Step 4: Gene Identifier Review
|
| 137 |
+
print("requires_gene_mapping = True")
|
| 138 |
+
|
| 139 |
+
# Step 5: Gene Annotation
|
| 140 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 141 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 142 |
+
|
| 143 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 144 |
+
print("Gene annotation preview:")
|
| 145 |
+
print(preview_df(gene_annotation))
|
| 146 |
+
|
| 147 |
+
# Step 6: Gene Identifier Mapping
|
| 148 |
+
# Identify the appropriate columns for mapping: probe ID ('ID') and gene symbol ('GENE_SYMBOL')
|
| 149 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
|
| 150 |
+
|
| 151 |
+
# Preserve the original probe-level data and apply mapping to obtain gene-level expression
|
| 152 |
+
probe_level_data = gene_data
|
| 153 |
+
gene_data = apply_gene_mapping(probe_level_data, mapping_df)
|
| 154 |
+
|
| 155 |
+
# Step 7: Data Normalization and Linking
|
| 156 |
+
import os
|
| 157 |
+
|
| 158 |
+
# 1. Normalize gene symbols and save gene expression data
|
| 159 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 160 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 161 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 162 |
+
|
| 163 |
+
# 2. Link clinical and genetic data (fix variable name)
|
| 164 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 165 |
+
|
| 166 |
+
# 3. Handle missing values
|
| 167 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 168 |
+
|
| 169 |
+
# 4. Bias check and remove biased covariates
|
| 170 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 171 |
+
|
| 172 |
+
# 5. Final validation and save cohort info
|
| 173 |
+
covariate_cols = [trait, 'Age', 'Gender']
|
| 174 |
+
gene_cols = [c for c in unbiased_linked_data.columns if c not in covariate_cols]
|
| 175 |
+
is_gene_available_final = (len(unbiased_linked_data) > 0) and (len(gene_cols) > 0)
|
| 176 |
+
is_trait_available_final = (trait in unbiased_linked_data.columns) and (len(unbiased_linked_data) > 0)
|
| 177 |
+
|
| 178 |
+
note = ("INFO: Trait inferred as esophageal cancer (1) vs. other tissues (0) from 'tissue' field within a heterogeneous "
|
| 179 |
+
"metastatic cohort; age unavailable; gender present. Gene symbols normalized via NCBI synonyms.")
|
| 180 |
+
|
| 181 |
+
is_usable = validate_and_save_cohort_info(
|
| 182 |
+
is_final=True,
|
| 183 |
+
cohort=cohort,
|
| 184 |
+
info_path=json_path,
|
| 185 |
+
is_gene_available=is_gene_available_final,
|
| 186 |
+
is_trait_available=is_trait_available_final,
|
| 187 |
+
is_biased=is_trait_biased,
|
| 188 |
+
df=unbiased_linked_data,
|
| 189 |
+
note=note
|
| 190 |
+
)
|
| 191 |
+
|
| 192 |
+
# 6. Save linked dataset if usable
|
| 193 |
+
if is_usable:
|
| 194 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 195 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Esophageal_Cancer/code/GSE131027.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE131027"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE131027"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE131027.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE131027.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE131027.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
|
| 41 |
+
# 1) Gene expression availability
|
| 42 |
+
is_gene_available = True # Overall design mentions "expression features", suggesting mRNA expression data.
|
| 43 |
+
|
| 44 |
+
# 2) Variable availability and converters
|
| 45 |
+
|
| 46 |
+
# Trait: use cancer type to define Esophageal_Cancer (binary: esophageal vs others)
|
| 47 |
+
trait_row = 1 # 'cancer: ...'
|
| 48 |
+
age_row = None
|
| 49 |
+
gender_row = None
|
| 50 |
+
|
| 51 |
+
def convert_trait(x):
|
| 52 |
+
if x is None:
|
| 53 |
+
return None
|
| 54 |
+
s = str(x).strip()
|
| 55 |
+
# Extract value after the first colon if present
|
| 56 |
+
if ':' in s:
|
| 57 |
+
_, val = s.split(':', 1)
|
| 58 |
+
else:
|
| 59 |
+
val = s
|
| 60 |
+
v = val.strip().lower()
|
| 61 |
+
if v in {'', 'na', 'n/a', 'none', 'unknown'}:
|
| 62 |
+
return None
|
| 63 |
+
# Positive if esophageal/oesophageal cancer
|
| 64 |
+
if ('oesoph' in v) or ('esoph' in v):
|
| 65 |
+
return 1
|
| 66 |
+
return 0
|
| 67 |
+
|
| 68 |
+
# Age and Gender not available
|
| 69 |
+
convert_age = None
|
| 70 |
+
convert_gender = None
|
| 71 |
+
|
| 72 |
+
# 3) Save metadata (initial filtering)
|
| 73 |
+
is_trait_available = trait_row is not None
|
| 74 |
+
_ = validate_and_save_cohort_info(
|
| 75 |
+
is_final=False,
|
| 76 |
+
cohort=cohort,
|
| 77 |
+
info_path=json_path,
|
| 78 |
+
is_gene_available=is_gene_available,
|
| 79 |
+
is_trait_available=is_trait_available
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
# 4) Clinical Feature Extraction (only if trait is available)
|
| 83 |
+
if trait_row is not None:
|
| 84 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 85 |
+
clinical_df=clinical_data,
|
| 86 |
+
trait=trait,
|
| 87 |
+
trait_row=trait_row,
|
| 88 |
+
convert_trait=convert_trait,
|
| 89 |
+
age_row=age_row,
|
| 90 |
+
convert_age=convert_age,
|
| 91 |
+
gender_row=gender_row,
|
| 92 |
+
convert_gender=convert_gender
|
| 93 |
+
)
|
| 94 |
+
preview_selected_clinical = preview_df(selected_clinical_df)
|
| 95 |
+
|
| 96 |
+
# Save clinical data
|
| 97 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 98 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 99 |
+
|
| 100 |
+
# Step 3: Gene Data Extraction
|
| 101 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 102 |
+
gene_data = get_genetic_data(matrix_file)
|
| 103 |
+
|
| 104 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 105 |
+
print(gene_data.index[:20])
|
| 106 |
+
|
| 107 |
+
# Step 4: Gene Identifier Review
|
| 108 |
+
requires_gene_mapping = True
|
| 109 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 110 |
+
|
| 111 |
+
# Step 5: Gene Annotation
|
| 112 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 113 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 114 |
+
|
| 115 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 116 |
+
print("Gene annotation preview:")
|
| 117 |
+
print(preview_df(gene_annotation))
|
| 118 |
+
|
| 119 |
+
# Step 6: Gene Identifier Mapping
|
| 120 |
+
# Identify the relevant columns for mapping
|
| 121 |
+
id_col = 'ID' # Probe IDs in annotation match probe IDs in expression data
|
| 122 |
+
gene_symbol_col = 'Gene Symbol' # Column containing gene symbols
|
| 123 |
+
|
| 124 |
+
# Build the mapping dataframe (probe -> gene symbol)
|
| 125 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=id_col, gene_col=gene_symbol_col)
|
| 126 |
+
|
| 127 |
+
# Apply mapping to convert probe-level data to gene-level data
|
| 128 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 129 |
+
|
| 130 |
+
# Step 7: Data Normalization and Linking
|
| 131 |
+
import os
|
| 132 |
+
|
| 133 |
+
# 1. Normalize gene symbols and save gene expression data
|
| 134 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 135 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 136 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 137 |
+
|
| 138 |
+
# 2. Link clinical and genetic data
|
| 139 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 140 |
+
|
| 141 |
+
# 3. Handle missing values
|
| 142 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 143 |
+
|
| 144 |
+
# 4. Assess bias and remove biased covariates
|
| 145 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 146 |
+
|
| 147 |
+
# 5. Final validation and save cohort info
|
| 148 |
+
is_usable = validate_and_save_cohort_info(
|
| 149 |
+
is_final=True,
|
| 150 |
+
cohort=cohort,
|
| 151 |
+
info_path=json_path,
|
| 152 |
+
is_gene_available=True,
|
| 153 |
+
is_trait_available=True,
|
| 154 |
+
is_biased=is_trait_biased,
|
| 155 |
+
df=unbiased_linked_data,
|
| 156 |
+
note="INFO: Probe-to-gene mapping via platform annotation; gene symbols normalized using NCBI synonyms."
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
# 6. Save linked data if usable
|
| 160 |
+
if is_usable:
|
| 161 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 162 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Esophageal_Cancer/code/GSE156915.py
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE156915"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE156915"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE156915.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE156915.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE156915.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import re
|
| 40 |
+
|
| 41 |
+
# 1) Gene expression data availability
|
| 42 |
+
is_gene_available = True # Whole transcriptome mentioned in background info
|
| 43 |
+
|
| 44 |
+
# 2) Variable availability and conversion functions
|
| 45 |
+
|
| 46 |
+
# Since this cohort is colorectal cancer and contains no explicit esophageal cancer status,
|
| 47 |
+
# no usable trait/age/gender fields are present in the sample characteristics dictionary.
|
| 48 |
+
trait_row = None
|
| 49 |
+
age_row = None
|
| 50 |
+
gender_row = None
|
| 51 |
+
|
| 52 |
+
def _extract_value(x):
|
| 53 |
+
if x is None:
|
| 54 |
+
return None
|
| 55 |
+
if isinstance(x, str):
|
| 56 |
+
parts = x.split(":", 1)
|
| 57 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 58 |
+
return val.strip()
|
| 59 |
+
return x
|
| 60 |
+
|
| 61 |
+
def convert_trait(x):
|
| 62 |
+
"""
|
| 63 |
+
Map esophageal cancer presence to binary: 1 for esophageal/oesophageal cancer, 0 for others.
|
| 64 |
+
Unknown/ambiguous -> None.
|
| 65 |
+
"""
|
| 66 |
+
val = _extract_value(x)
|
| 67 |
+
if val is None or val == "":
|
| 68 |
+
return None
|
| 69 |
+
s = str(val).lower()
|
| 70 |
+
# Positive indicators for esophageal cancer
|
| 71 |
+
if any(k in s for k in ["esophageal", "oesophageal", "esophagus", "oesophagus"]):
|
| 72 |
+
# Exclude explicit normal controls if present
|
| 73 |
+
if any(k in s for k in ["normal", "control", "healthy", "adjacent normal"]):
|
| 74 |
+
return 0
|
| 75 |
+
return 1
|
| 76 |
+
# If explicitly other cancers or non-esophageal tissues
|
| 77 |
+
if any(k in s for k in ["colorectal", "crc", "colon", "rectal", "stomach", "gastric", "breast", "lung", "liver", "kidney"]):
|
| 78 |
+
return 0
|
| 79 |
+
# Generic normal/control indications
|
| 80 |
+
if any(k in s for k in ["normal", "control", "healthy", "adjacent normal"]):
|
| 81 |
+
return 0
|
| 82 |
+
return None
|
| 83 |
+
|
| 84 |
+
def convert_age(x):
|
| 85 |
+
"""
|
| 86 |
+
Convert age to continuous float in years.
|
| 87 |
+
Extract numbers from strings; return None if missing or invalid.
|
| 88 |
+
"""
|
| 89 |
+
val = _extract_value(x)
|
| 90 |
+
if val is None or val == "":
|
| 91 |
+
return None
|
| 92 |
+
s = str(val).lower()
|
| 93 |
+
# Find first number (int or float)
|
| 94 |
+
m = re.search(r"[-+]?\d*\.?\d+", s)
|
| 95 |
+
if not m:
|
| 96 |
+
return None
|
| 97 |
+
try:
|
| 98 |
+
age = float(m.group())
|
| 99 |
+
# Simple sanity check for human age
|
| 100 |
+
if 0 <= age <= 120:
|
| 101 |
+
return age
|
| 102 |
+
return None
|
| 103 |
+
except Exception:
|
| 104 |
+
return None
|
| 105 |
+
|
| 106 |
+
def convert_gender(x):
|
| 107 |
+
"""
|
| 108 |
+
Map gender to binary: female -> 0, male -> 1. Unknown -> None.
|
| 109 |
+
"""
|
| 110 |
+
val = _extract_value(x)
|
| 111 |
+
if val is None or val == "":
|
| 112 |
+
return None
|
| 113 |
+
s = str(val).strip().lower()
|
| 114 |
+
if s in ["male", "m"]:
|
| 115 |
+
return 1
|
| 116 |
+
if s in ["female", "f"]:
|
| 117 |
+
return 0
|
| 118 |
+
# Handle common encodings
|
| 119 |
+
if "male" in s:
|
| 120 |
+
return 1
|
| 121 |
+
if "female" in s:
|
| 122 |
+
return 0
|
| 123 |
+
return None
|
| 124 |
+
|
| 125 |
+
# 3) Save metadata (initial filtering)
|
| 126 |
+
is_trait_available = trait_row is not None
|
| 127 |
+
_ = validate_and_save_cohort_info(
|
| 128 |
+
is_final=False,
|
| 129 |
+
cohort=cohort,
|
| 130 |
+
info_path=json_path,
|
| 131 |
+
is_gene_available=is_gene_available,
|
| 132 |
+
is_trait_available=is_trait_available
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
# 4) Clinical feature extraction (skip if trait_row is None)
|
| 136 |
+
if trait_row is not None:
|
| 137 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 138 |
+
clinical_df=clinical_data,
|
| 139 |
+
trait=trait,
|
| 140 |
+
trait_row=trait_row,
|
| 141 |
+
convert_trait=convert_trait,
|
| 142 |
+
age_row=age_row,
|
| 143 |
+
convert_age=convert_age,
|
| 144 |
+
gender_row=gender_row,
|
| 145 |
+
convert_gender=convert_gender
|
| 146 |
+
)
|
| 147 |
+
preview = preview_df(selected_clinical_df)
|
| 148 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 149 |
+
|
| 150 |
+
# Step 3: Gene Data Extraction
|
| 151 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 152 |
+
gene_data = get_genetic_data(matrix_file)
|
| 153 |
+
|
| 154 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 155 |
+
print(gene_data.index[:20])
|
| 156 |
+
|
| 157 |
+
# Step 4: Gene Identifier Review
|
| 158 |
+
print("requires_gene_mapping = False")
|
| 159 |
+
|
| 160 |
+
# Step 5: Data Normalization and Linking
|
| 161 |
+
import os
|
| 162 |
+
|
| 163 |
+
# 1. Normalize gene symbols and save
|
| 164 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 165 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 166 |
+
|
| 167 |
+
# Guard based on trait availability from Step 2
|
| 168 |
+
if 'trait_row' in globals() and trait_row is None:
|
| 169 |
+
# No clinical/trait data available: skip linking and downstream steps
|
| 170 |
+
linked_data = None # For safety, define the variable
|
| 171 |
+
note = ("WARNING: Trait clinical data is unavailable for this cohort; "
|
| 172 |
+
"skipping linking, missing-value handling, and bias assessment. "
|
| 173 |
+
"Only normalized gene expression was saved.")
|
| 174 |
+
# Final metadata validation (dataset not usable due to missing trait)
|
| 175 |
+
_ = validate_and_save_cohort_info(
|
| 176 |
+
is_final=True,
|
| 177 |
+
cohort=cohort,
|
| 178 |
+
info_path=json_path,
|
| 179 |
+
is_gene_available=True,
|
| 180 |
+
is_trait_available=False,
|
| 181 |
+
is_biased=False, # Placeholder; trait not available
|
| 182 |
+
df=normalized_gene_data.T, # Use samples as rows for validation shape
|
| 183 |
+
note=note
|
| 184 |
+
)
|
| 185 |
+
else:
|
| 186 |
+
# 2. Link clinical and genetic data
|
| 187 |
+
if 'selected_clinical_df' not in globals():
|
| 188 |
+
# Try to load if it was saved in Step 2
|
| 189 |
+
if os.path.exists(out_clinical_data_file):
|
| 190 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 191 |
+
else:
|
| 192 |
+
raise RuntimeError("Clinical data not found for linking despite trait_row not being None.")
|
| 193 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 194 |
+
|
| 195 |
+
# 3. Handle missing values
|
| 196 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 197 |
+
|
| 198 |
+
# 4. Bias assessment and removal of biased demographic features
|
| 199 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 200 |
+
|
| 201 |
+
# 5. Final validation and cohort info saving
|
| 202 |
+
is_usable = validate_and_save_cohort_info(
|
| 203 |
+
is_final=True,
|
| 204 |
+
cohort=cohort,
|
| 205 |
+
info_path=json_path,
|
| 206 |
+
is_gene_available=True,
|
| 207 |
+
is_trait_available=True,
|
| 208 |
+
is_biased=is_trait_biased,
|
| 209 |
+
df=unbiased_linked_data,
|
| 210 |
+
note="INFO: Linked data generated and quality-checked."
|
| 211 |
+
)
|
| 212 |
+
|
| 213 |
+
# 6. Save usable linked dataset
|
| 214 |
+
if is_usable:
|
| 215 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Esophageal_Cancer/code/GSE218109.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE218109"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE218109"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE218109.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE218109.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE218109.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
# 1) Gene expression data availability
|
| 40 |
+
is_gene_available = True # Transcriptional profiling of ESCC tumors implies gene expression data
|
| 41 |
+
|
| 42 |
+
# 2) Variable availability
|
| 43 |
+
trait_row = None # All samples are ESCC tumors; no case-control variation for Esophageal_Cancer
|
| 44 |
+
age_row = 1 # 'age: <number>'
|
| 45 |
+
gender_row = 0 # 'Sex: M' / 'Sex: F'
|
| 46 |
+
|
| 47 |
+
# 2.2) Conversion functions
|
| 48 |
+
def _after_colon(x):
|
| 49 |
+
if x is None:
|
| 50 |
+
return None
|
| 51 |
+
# Extract substring after the first colon
|
| 52 |
+
parts = str(x).split(":", 1)
|
| 53 |
+
return parts[1].strip() if len(parts) == 2 else str(x).strip()
|
| 54 |
+
|
| 55 |
+
def convert_trait(x):
|
| 56 |
+
# Not used because trait_row is None, but provide a safe stub returning None
|
| 57 |
+
return None
|
| 58 |
+
|
| 59 |
+
def convert_age(x):
|
| 60 |
+
v = _after_colon(x)
|
| 61 |
+
if v is None or v == "" or v.lower() in {"na", "n/a", "none", "nan"}:
|
| 62 |
+
return None
|
| 63 |
+
try:
|
| 64 |
+
return int(float(v))
|
| 65 |
+
except Exception:
|
| 66 |
+
return None
|
| 67 |
+
|
| 68 |
+
def convert_gender(x):
|
| 69 |
+
v = _after_colon(x)
|
| 70 |
+
if not v:
|
| 71 |
+
return None
|
| 72 |
+
v_low = v.strip().lower()
|
| 73 |
+
if v_low in {"f", "female", "woman", "women"}:
|
| 74 |
+
return 0
|
| 75 |
+
if v_low in {"m", "male", "man", "men"}:
|
| 76 |
+
return 1
|
| 77 |
+
return None
|
| 78 |
+
|
| 79 |
+
# 3) Save metadata (initial filtering)
|
| 80 |
+
is_trait_available = trait_row is not None
|
| 81 |
+
validate_and_save_cohort_info(
|
| 82 |
+
is_final=False,
|
| 83 |
+
cohort=cohort,
|
| 84 |
+
info_path=json_path,
|
| 85 |
+
is_gene_available=is_gene_available,
|
| 86 |
+
is_trait_available=is_trait_available
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
# 4) Clinical feature extraction
|
| 90 |
+
# Skipped because trait_row is None (no usable trait variation for Esophageal_Cancer in this cohort)
|
| 91 |
+
|
| 92 |
+
# Step 3: Gene Data Extraction
|
| 93 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 94 |
+
gene_data = get_genetic_data(matrix_file)
|
| 95 |
+
|
| 96 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 97 |
+
print(gene_data.index[:20])
|
| 98 |
+
|
| 99 |
+
# Step 4: Gene Identifier Review
|
| 100 |
+
print("requires_gene_mapping = True")
|
| 101 |
+
|
| 102 |
+
# Step 5: Gene Annotation
|
| 103 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 104 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 105 |
+
|
| 106 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 107 |
+
print("Gene annotation preview:")
|
| 108 |
+
print(preview_df(gene_annotation))
|
| 109 |
+
|
| 110 |
+
# Step 6: Gene Identifier Mapping
|
| 111 |
+
# Decide mapping columns based on observed identifiers
|
| 112 |
+
probe_col = 'ID' # Matches the numeric probe IDs seen in gene_data index
|
| 113 |
+
gene_symbol_col = 'GENE_SYMBOL' # Gene symbols column in annotation
|
| 114 |
+
|
| 115 |
+
# Build mapping dataframe
|
| 116 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
| 117 |
+
|
| 118 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 119 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
| 120 |
+
|
| 121 |
+
# Step 7: Data Normalization and Linking
|
| 122 |
+
import os
|
| 123 |
+
import pandas as pd
|
| 124 |
+
|
| 125 |
+
# 1. Normalize the obtained gene data and save
|
| 126 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 127 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 128 |
+
|
| 129 |
+
# 2. Link the clinical and genetic data if clinical trait data exists
|
| 130 |
+
linked_data = None
|
| 131 |
+
selected_clinical = None
|
| 132 |
+
|
| 133 |
+
# Try to use in-memory clinical data if present
|
| 134 |
+
if 'selected_clinical_data' in globals():
|
| 135 |
+
selected_clinical = globals()['selected_clinical_data']
|
| 136 |
+
|
| 137 |
+
# If not in memory, try to load from file
|
| 138 |
+
if selected_clinical is None and os.path.exists(out_clinical_data_file):
|
| 139 |
+
try:
|
| 140 |
+
selected_clinical = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 141 |
+
except Exception:
|
| 142 |
+
selected_clinical = None
|
| 143 |
+
|
| 144 |
+
# Only link if trait row exists in clinical data
|
| 145 |
+
if isinstance(selected_clinical, pd.DataFrame) and (trait in selected_clinical.index):
|
| 146 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical, normalized_gene_data)
|
| 147 |
+
|
| 148 |
+
# 3-6. Handle two workflows depending on clinical trait availability
|
| 149 |
+
if linked_data is not None:
|
| 150 |
+
# 3. Missing value handling
|
| 151 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 152 |
+
|
| 153 |
+
# 4. Bias checks
|
| 154 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 155 |
+
|
| 156 |
+
# 5. Final validation and save cohort info
|
| 157 |
+
is_usable = validate_and_save_cohort_info(
|
| 158 |
+
is_final=True,
|
| 159 |
+
cohort=cohort,
|
| 160 |
+
info_path=json_path,
|
| 161 |
+
is_gene_available=True,
|
| 162 |
+
is_trait_available=True,
|
| 163 |
+
is_biased=is_trait_biased,
|
| 164 |
+
df=unbiased_linked_data,
|
| 165 |
+
note="INFO: Clinical trait, age, and gender were linked successfully."
|
| 166 |
+
)
|
| 167 |
+
|
| 168 |
+
# 6. Save linked data only if usable
|
| 169 |
+
if is_usable:
|
| 170 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 171 |
+
|
| 172 |
+
else:
|
| 173 |
+
# Trait data unavailable (no usable trait row). Record metadata and skip linking/analysis.
|
| 174 |
+
# Provide a non-empty df (gene-only) to avoid 'abnormality' override.
|
| 175 |
+
df_for_record = normalized_gene_data.T # samples x genes
|
| 176 |
+
|
| 177 |
+
is_usable = validate_and_save_cohort_info(
|
| 178 |
+
is_final=True,
|
| 179 |
+
cohort=cohort,
|
| 180 |
+
info_path=json_path,
|
| 181 |
+
is_gene_available=True,
|
| 182 |
+
is_trait_available=False,
|
| 183 |
+
is_biased=False,
|
| 184 |
+
df=df_for_record,
|
| 185 |
+
note="INFO: Trait (Esophageal_Cancer) is unavailable/constant in this cohort (all ESCC tumors; NS+ vs NS- design). Clinical extraction for trait was skipped."
|
| 186 |
+
)
|
| 187 |
+
# Do not save out_data_file when unusable
|
output/preprocess/Esophageal_Cancer/code/GSE55857.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE55857"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE55857"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE55857.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE55857.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE55857.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression data availability (SuperSeries of small non-coding RNAs -> not suitable mRNA expression)
|
| 43 |
+
is_gene_available = False
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability and conversion functions
|
| 46 |
+
|
| 47 |
+
# Trait (Esophageal_Cancer): inferred from 'tissue: ESCC normal' vs 'tissue: ESCC tumor'
|
| 48 |
+
trait_row = 1 # available
|
| 49 |
+
age_row = None # not available
|
| 50 |
+
gender_row = None # not available
|
| 51 |
+
|
| 52 |
+
def _after_colon(x):
|
| 53 |
+
if x is None:
|
| 54 |
+
return None
|
| 55 |
+
s = str(x)
|
| 56 |
+
parts = s.split(":", 1)
|
| 57 |
+
return parts[1].strip() if len(parts) == 2 else s.strip()
|
| 58 |
+
|
| 59 |
+
def convert_trait(x):
|
| 60 |
+
v = _after_colon(x)
|
| 61 |
+
if v is None or v == '':
|
| 62 |
+
return None
|
| 63 |
+
vl = v.lower()
|
| 64 |
+
# ESCC tumor -> 1, ESCC normal/control -> 0
|
| 65 |
+
if any(k in vl for k in ["tumor", "cancer", "carcinoma", "malignant"]):
|
| 66 |
+
# guard against phrases like "non-tumor"
|
| 67 |
+
if "non-tumor" in vl or "non tumor" in vl or "benign" in vl or "normal" in vl or "control" in vl:
|
| 68 |
+
return 0
|
| 69 |
+
return 1
|
| 70 |
+
if any(k in vl for k in ["normal", "control", "adjacent normal", "healthy", "non-tumor", "non tumor", "benign"]):
|
| 71 |
+
return 0
|
| 72 |
+
return None
|
| 73 |
+
|
| 74 |
+
def convert_age(x):
|
| 75 |
+
v = _after_colon(x)
|
| 76 |
+
if v is None or v == '':
|
| 77 |
+
return None
|
| 78 |
+
m = re.search(r"(\d+(\.\d+)?)", v)
|
| 79 |
+
return float(m.group(1)) if m else None
|
| 80 |
+
|
| 81 |
+
def convert_gender(x):
|
| 82 |
+
v = _after_colon(x)
|
| 83 |
+
if v is None or v == '':
|
| 84 |
+
return None
|
| 85 |
+
vl = v.lower()
|
| 86 |
+
if vl in ["m", "male"]:
|
| 87 |
+
return 1
|
| 88 |
+
if vl in ["f", "female", "woman", "women"]:
|
| 89 |
+
return 0
|
| 90 |
+
return None
|
| 91 |
+
|
| 92 |
+
# 3) Save metadata (initial filtering)
|
| 93 |
+
is_trait_available = trait_row is not None
|
| 94 |
+
_ = validate_and_save_cohort_info(
|
| 95 |
+
is_final=False,
|
| 96 |
+
cohort=cohort,
|
| 97 |
+
info_path=json_path,
|
| 98 |
+
is_gene_available=is_gene_available,
|
| 99 |
+
is_trait_available=is_trait_available
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
# 4) Clinical Feature Extraction (only if trait available)
|
| 103 |
+
if trait_row is not None:
|
| 104 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 105 |
+
clinical_df=clinical_data,
|
| 106 |
+
trait=trait,
|
| 107 |
+
trait_row=trait_row,
|
| 108 |
+
convert_trait=convert_trait,
|
| 109 |
+
age_row=age_row,
|
| 110 |
+
convert_age=convert_age,
|
| 111 |
+
gender_row=gender_row,
|
| 112 |
+
convert_gender=convert_gender
|
| 113 |
+
)
|
| 114 |
+
preview = preview_df(selected_clinical_df)
|
| 115 |
+
print(preview)
|
| 116 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 117 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
output/preprocess/Esophageal_Cancer/code/GSE66258.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE66258"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE66258"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE66258.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE66258.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE66258.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import re
|
| 40 |
+
import pandas as pd
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression availability (sncRNA-only => not suitable)
|
| 43 |
+
is_gene_available = False
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability
|
| 46 |
+
# From the provided sample characteristics:
|
| 47 |
+
# 0 -> tissue: esophageal squamous cell carcinoma (constant)
|
| 48 |
+
# 1 -> sample id: 1..30 (identifier, not a phenotype)
|
| 49 |
+
trait_row = None
|
| 50 |
+
age_row = None
|
| 51 |
+
gender_row = None
|
| 52 |
+
|
| 53 |
+
# 2.2 Converters
|
| 54 |
+
def _after_colon(x):
|
| 55 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 56 |
+
return None
|
| 57 |
+
s = str(x).strip()
|
| 58 |
+
if ':' in s:
|
| 59 |
+
s = s.split(':', 1)[1].strip()
|
| 60 |
+
return s if s != '' else None
|
| 61 |
+
|
| 62 |
+
def convert_trait(x):
|
| 63 |
+
v = _after_colon(x)
|
| 64 |
+
if v is None:
|
| 65 |
+
return None
|
| 66 |
+
s = v.lower()
|
| 67 |
+
# Map tumor/cancer/ESCC to case=1; normal/control to 0
|
| 68 |
+
if any(k in s for k in ['esophageal squamous cell carcinoma', 'escc', 'tumor', 'cancer', 'carcinoma']):
|
| 69 |
+
return 1
|
| 70 |
+
if any(k in s for k in ['normal', 'control', 'adjacent', 'non-tumor', 'non tumor', 'healthy']):
|
| 71 |
+
return 0
|
| 72 |
+
return None
|
| 73 |
+
|
| 74 |
+
def convert_age(x):
|
| 75 |
+
v = _after_colon(x)
|
| 76 |
+
if v is None:
|
| 77 |
+
return None
|
| 78 |
+
s = v.lower()
|
| 79 |
+
# Extract the first number (handles formats like "65", "65 years", "60-70")
|
| 80 |
+
m = re.search(r'(\d+(\.\d+)?)', s)
|
| 81 |
+
if not m:
|
| 82 |
+
return None
|
| 83 |
+
try:
|
| 84 |
+
val = float(m.group(1))
|
| 85 |
+
return int(val) if val.is_integer() else val
|
| 86 |
+
except Exception:
|
| 87 |
+
return None
|
| 88 |
+
|
| 89 |
+
def convert_gender(x):
|
| 90 |
+
v = _after_colon(x)
|
| 91 |
+
if v is None:
|
| 92 |
+
return None
|
| 93 |
+
s = v.strip().lower()
|
| 94 |
+
if s in ['male', 'm', 'man', 'boy']:
|
| 95 |
+
return 1
|
| 96 |
+
if s in ['female', 'f', 'woman', 'girl']:
|
| 97 |
+
return 0
|
| 98 |
+
return None
|
| 99 |
+
|
| 100 |
+
# 3) Save metadata (initial filtering)
|
| 101 |
+
is_trait_available = trait_row is not None
|
| 102 |
+
_ = validate_and_save_cohort_info(
|
| 103 |
+
is_final=False,
|
| 104 |
+
cohort=cohort,
|
| 105 |
+
info_path=json_path,
|
| 106 |
+
is_gene_available=is_gene_available,
|
| 107 |
+
is_trait_available=is_trait_available
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
# 4) Clinical feature extraction (skip because trait_row is None)
|
| 111 |
+
# If trait_row were available:
|
| 112 |
+
# selected_clinical_df = geo_select_clinical_features(
|
| 113 |
+
# clinical_df=clinical_data,
|
| 114 |
+
# trait=trait,
|
| 115 |
+
# trait_row=trait_row,
|
| 116 |
+
# convert_trait=convert_trait,
|
| 117 |
+
# age_row=age_row,
|
| 118 |
+
# convert_age=convert_age,
|
| 119 |
+
# gender_row=gender_row,
|
| 120 |
+
# convert_gender=convert_gender
|
| 121 |
+
# )
|
| 122 |
+
# preview = preview_df(selected_clinical_df)
|
| 123 |
+
# selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
output/preprocess/Esophageal_Cancer/code/GSE75241.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE75241"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE75241"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE75241.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE75241.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE75241.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
import pandas as pd
|
| 42 |
+
|
| 43 |
+
# 1) Gene expression data availability
|
| 44 |
+
is_gene_available = True # Based on series title/summary indicating gene expression profiling (ESCC vs mucosa)
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability and conversion functions
|
| 47 |
+
# From the sample characteristics, tissue status (tumor vs nonmalignant mucosa) is available at key 1
|
| 48 |
+
trait_row = 1
|
| 49 |
+
age_row = None
|
| 50 |
+
gender_row = None
|
| 51 |
+
|
| 52 |
+
def convert_trait(x):
|
| 53 |
+
if pd.isna(x):
|
| 54 |
+
return None
|
| 55 |
+
s = str(x)
|
| 56 |
+
if ':' in s:
|
| 57 |
+
s = s.split(':', 1)[1]
|
| 58 |
+
s = s.strip().lower()
|
| 59 |
+
# Check normal first to avoid substring confounding (e.g., "non-tumor" contains "tumor")
|
| 60 |
+
normal_markers = ['nonmalignant', 'non-malignant', 'non tumor', 'non-tumor', 'normal', 'adjacent normal', 'surrounding mucosa']
|
| 61 |
+
if any(m in s for m in normal_markers):
|
| 62 |
+
return 0
|
| 63 |
+
cancer_markers = ['tumor', 'carcinoma', 'cancer', 'escc', 'scc']
|
| 64 |
+
if any(m in s for m in cancer_markers):
|
| 65 |
+
return 1
|
| 66 |
+
return None
|
| 67 |
+
|
| 68 |
+
def convert_age(x):
|
| 69 |
+
if pd.isna(x):
|
| 70 |
+
return None
|
| 71 |
+
s = str(x)
|
| 72 |
+
if ':' in s:
|
| 73 |
+
s = s.split(':', 1)[1]
|
| 74 |
+
s = s.strip().lower()
|
| 75 |
+
m = re.search(r'(\d+(\.\d+)?)', s)
|
| 76 |
+
if m:
|
| 77 |
+
try:
|
| 78 |
+
return float(m.group(1))
|
| 79 |
+
except Exception:
|
| 80 |
+
return None
|
| 81 |
+
return None
|
| 82 |
+
|
| 83 |
+
def convert_gender(x):
|
| 84 |
+
if pd.isna(x):
|
| 85 |
+
return None
|
| 86 |
+
s = str(x)
|
| 87 |
+
if ':' in s:
|
| 88 |
+
s = s.split(':', 1)[1]
|
| 89 |
+
s = s.strip().lower()
|
| 90 |
+
if s in ['male', 'm', 'man', 'boy']:
|
| 91 |
+
return 1
|
| 92 |
+
if s in ['female', 'f', 'woman', 'girl']:
|
| 93 |
+
return 0
|
| 94 |
+
return None
|
| 95 |
+
|
| 96 |
+
# 3) Save metadata (initial filtering)
|
| 97 |
+
is_trait_available = trait_row is not None
|
| 98 |
+
_ = validate_and_save_cohort_info(
|
| 99 |
+
is_final=False,
|
| 100 |
+
cohort=cohort,
|
| 101 |
+
info_path=json_path,
|
| 102 |
+
is_gene_available=is_gene_available,
|
| 103 |
+
is_trait_available=is_trait_available
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
# 4) Clinical feature extraction (since trait_row is available)
|
| 107 |
+
if trait_row is not None:
|
| 108 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 109 |
+
clinical_df=clinical_data,
|
| 110 |
+
trait=trait,
|
| 111 |
+
trait_row=trait_row,
|
| 112 |
+
convert_trait=convert_trait,
|
| 113 |
+
age_row=age_row,
|
| 114 |
+
convert_age=convert_age,
|
| 115 |
+
gender_row=gender_row,
|
| 116 |
+
convert_gender=convert_gender
|
| 117 |
+
)
|
| 118 |
+
preview = preview_df(selected_clinical_df)
|
| 119 |
+
print(preview)
|
| 120 |
+
|
| 121 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 122 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 123 |
+
|
| 124 |
+
# Step 3: Gene Data Extraction
|
| 125 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 126 |
+
gene_data = get_genetic_data(matrix_file)
|
| 127 |
+
|
| 128 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 129 |
+
print(gene_data.index[:20])
|
| 130 |
+
|
| 131 |
+
# Step 4: Gene Identifier Review
|
| 132 |
+
print("requires_gene_mapping = True")
|
| 133 |
+
|
| 134 |
+
# Step 5: Gene Annotation
|
| 135 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 136 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 137 |
+
|
| 138 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 139 |
+
print("Gene annotation preview:")
|
| 140 |
+
print(preview_df(gene_annotation))
|
| 141 |
+
|
| 142 |
+
# Step 6: Gene Identifier Mapping
|
| 143 |
+
import pandas as pd
|
| 144 |
+
|
| 145 |
+
# Decide columns: probe IDs are in 'ID'; gene symbols are embedded in 'gene_assignment' or 'mrna_assignment'
|
| 146 |
+
ann = gene_annotation.copy()
|
| 147 |
+
# Ensure columns exist
|
| 148 |
+
if 'gene_assignment' not in ann.columns:
|
| 149 |
+
ann['gene_assignment'] = pd.NA
|
| 150 |
+
if 'mrna_assignment' not in ann.columns:
|
| 151 |
+
ann['mrna_assignment'] = pd.NA
|
| 152 |
+
|
| 153 |
+
# Replace placeholder '---' with NA and prioritize gene_assignment, then fallback to mrna_assignment
|
| 154 |
+
ann['gene_assignment'] = ann['gene_assignment'].replace('---', pd.NA)
|
| 155 |
+
ann['mrna_assignment'] = ann['mrna_assignment'].replace('---', pd.NA)
|
| 156 |
+
ann['GENE_TEXT'] = ann['gene_assignment'].combine_first(ann['mrna_assignment'])
|
| 157 |
+
|
| 158 |
+
# 2) Build mapping dataframe (probe ID -> gene symbol text)
|
| 159 |
+
mapping_df = get_gene_mapping(ann, prob_col='ID', gene_col='GENE_TEXT')
|
| 160 |
+
|
| 161 |
+
# 3) Apply mapping to convert probe-level to gene-level data
|
| 162 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 163 |
+
|
| 164 |
+
# Step 7: Data Normalization and Linking
|
| 165 |
+
import os
|
| 166 |
+
import pandas as pd
|
| 167 |
+
|
| 168 |
+
# 1) Normalize gene symbols and save gene-level data
|
| 169 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 170 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 171 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 172 |
+
|
| 173 |
+
# 2) Ensure clinical features are available in this session
|
| 174 |
+
if 'selected_clinical_df' not in globals():
|
| 175 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 176 |
+
|
| 177 |
+
# Link clinical and genetic data
|
| 178 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 179 |
+
|
| 180 |
+
# Derive availability flags and cast to native Python bool
|
| 181 |
+
is_gene_available_final = bool((normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0))
|
| 182 |
+
is_trait_available_final = bool((trait in linked_data.columns) and bool(linked_data[trait].notna().any()))
|
| 183 |
+
|
| 184 |
+
# 3) Handle missing values
|
| 185 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 186 |
+
|
| 187 |
+
# 4) Bias check and remove biased demographic features if needed
|
| 188 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 189 |
+
is_trait_biased = bool(is_trait_biased)
|
| 190 |
+
|
| 191 |
+
# 5) Final validation and save cohort info
|
| 192 |
+
note = "INFO: Paired ESCC tumor vs adjacent mucosa; Age/Gender not provided; Genes normalized via NCBI synonyms."
|
| 193 |
+
is_usable = validate_and_save_cohort_info(
|
| 194 |
+
is_final=True,
|
| 195 |
+
cohort=cohort,
|
| 196 |
+
info_path=json_path,
|
| 197 |
+
is_gene_available=is_gene_available_final,
|
| 198 |
+
is_trait_available=is_trait_available_final,
|
| 199 |
+
is_biased=is_trait_biased,
|
| 200 |
+
df=unbiased_linked_data,
|
| 201 |
+
note=note
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
+
# 6) Save linked dataset if usable
|
| 205 |
+
if is_usable:
|
| 206 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 207 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Esophageal_Cancer/code/GSE77790.py
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
cohort = "GSE77790"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Esophageal_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Esophageal_Cancer/GSE77790"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/GSE77790.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/GSE77790.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/GSE77790.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
|
| 41 |
+
# 1) Gene expression data availability
|
| 42 |
+
is_gene_available = True # Agilent whole genome microarrays -> mRNA gene expression
|
| 43 |
+
|
| 44 |
+
# 2) Variable availability and conversion functions
|
| 45 |
+
# From the sample characteristics dictionary, esophageal cancer status can be inferred from key 1 ("cell type: ...")
|
| 46 |
+
trait_row = 1
|
| 47 |
+
age_row = None
|
| 48 |
+
gender_row = None
|
| 49 |
+
|
| 50 |
+
def _extract_value(x):
|
| 51 |
+
if x is None:
|
| 52 |
+
return None
|
| 53 |
+
s = str(x)
|
| 54 |
+
if ':' in s:
|
| 55 |
+
s = s.split(':', 1)[1]
|
| 56 |
+
return s.strip()
|
| 57 |
+
|
| 58 |
+
def convert_trait(x):
|
| 59 |
+
val = _extract_value(x)
|
| 60 |
+
if not val:
|
| 61 |
+
return None
|
| 62 |
+
s = val.lower()
|
| 63 |
+
if s in {'na', 'n/a', 'unknown', 'nan'}:
|
| 64 |
+
return None
|
| 65 |
+
# Esophageal cancer vs. others
|
| 66 |
+
if 'esoph' in s:
|
| 67 |
+
return 1
|
| 68 |
+
# Map any other known cell types to 0
|
| 69 |
+
return 0
|
| 70 |
+
|
| 71 |
+
def convert_age(x):
|
| 72 |
+
# Not used (age_row is None), but define for interface completeness
|
| 73 |
+
val = _extract_value(x)
|
| 74 |
+
if not val:
|
| 75 |
+
return None
|
| 76 |
+
s = val.lower().replace('years', '').replace('year', '').strip()
|
| 77 |
+
try:
|
| 78 |
+
return float(s)
|
| 79 |
+
except Exception:
|
| 80 |
+
return None
|
| 81 |
+
|
| 82 |
+
def convert_gender(x):
|
| 83 |
+
# Not used (gender_row is None), but define for interface completeness
|
| 84 |
+
val = _extract_value(x)
|
| 85 |
+
if not val:
|
| 86 |
+
return None
|
| 87 |
+
s = val.lower()
|
| 88 |
+
if s in {'female', 'f', 'woman', 'women'}:
|
| 89 |
+
return 0
|
| 90 |
+
if s in {'male', 'm', 'man', 'men'}:
|
| 91 |
+
return 1
|
| 92 |
+
return None
|
| 93 |
+
|
| 94 |
+
# 3) Save metadata (initial filtering)
|
| 95 |
+
is_trait_available = trait_row is not None
|
| 96 |
+
_ = validate_and_save_cohort_info(
|
| 97 |
+
is_final=False,
|
| 98 |
+
cohort=cohort,
|
| 99 |
+
info_path=json_path,
|
| 100 |
+
is_gene_available=is_gene_available,
|
| 101 |
+
is_trait_available=is_trait_available
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
# 4) Clinical Feature Extraction (only if trait is available)
|
| 105 |
+
if trait_row is not None:
|
| 106 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 107 |
+
clinical_df=clinical_data,
|
| 108 |
+
trait=trait,
|
| 109 |
+
trait_row=trait_row,
|
| 110 |
+
convert_trait=convert_trait,
|
| 111 |
+
age_row=age_row,
|
| 112 |
+
convert_age=convert_age,
|
| 113 |
+
gender_row=gender_row,
|
| 114 |
+
convert_gender=convert_gender
|
| 115 |
+
)
|
| 116 |
+
preview = preview_df(selected_clinical_df)
|
| 117 |
+
print(preview)
|
| 118 |
+
|
| 119 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 120 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 121 |
+
|
| 122 |
+
# Step 3: Gene Data Extraction
|
| 123 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 124 |
+
gene_data = get_genetic_data(matrix_file)
|
| 125 |
+
|
| 126 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 127 |
+
print(gene_data.index[:20])
|
| 128 |
+
|
| 129 |
+
# Step 4: Gene Identifier Review
|
| 130 |
+
print("requires_gene_mapping = True")
|
| 131 |
+
|
| 132 |
+
# Step 5: Gene Annotation
|
| 133 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 134 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 135 |
+
|
| 136 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 137 |
+
print("Gene annotation preview:")
|
| 138 |
+
print(preview_df(gene_annotation))
|
| 139 |
+
|
| 140 |
+
# Step 6: Gene Identifier Mapping
|
| 141 |
+
# 1-2. Identify columns for mapping and create mapping dataframe
|
| 142 |
+
# Expression data row identifiers are numeric strings matching the 'ID' column in the annotation.
|
| 143 |
+
# Gene symbols are stored in the 'GENE_SYMBOL' column.
|
| 144 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE_SYMBOL')
|
| 145 |
+
|
| 146 |
+
# 3. Apply mapping to convert probe-level data to gene-level expression
|
| 147 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 148 |
+
|
| 149 |
+
# Step 7: Data Normalization and Linking
|
| 150 |
+
import os
|
| 151 |
+
|
| 152 |
+
# 1. Normalize gene symbols and save gene data
|
| 153 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 154 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 155 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 156 |
+
|
| 157 |
+
# 2. Link clinical and genetic data
|
| 158 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 159 |
+
|
| 160 |
+
# 3. Handle missing values
|
| 161 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 162 |
+
|
| 163 |
+
# 4. Bias assessment and removal of biased demographic features
|
| 164 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 165 |
+
|
| 166 |
+
# 5. Final validation and cohort info saving
|
| 167 |
+
note = ("INFO: Cell line microarray dataset; trait indicates esophageal cancer cell type inferred from 'cell type'. "
|
| 168 |
+
"Trait distribution appears imbalanced based on preview.")
|
| 169 |
+
is_usable = validate_and_save_cohort_info(
|
| 170 |
+
is_final=True,
|
| 171 |
+
cohort=cohort,
|
| 172 |
+
info_path=json_path,
|
| 173 |
+
is_gene_available=True,
|
| 174 |
+
is_trait_available=True,
|
| 175 |
+
is_biased=is_trait_biased,
|
| 176 |
+
df=unbiased_linked_data,
|
| 177 |
+
note=note
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
# 6. Save linked data if usable
|
| 181 |
+
if is_usable:
|
| 182 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 183 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Esophageal_Cancer/code/TCGA.py
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Esophageal_Cancer"
|
| 6 |
+
|
| 7 |
+
# Input paths
|
| 8 |
+
tcga_root_dir = "../DATA/TCGA"
|
| 9 |
+
|
| 10 |
+
# Output paths
|
| 11 |
+
out_data_file = "./output/z3/preprocess/Esophageal_Cancer/TCGA.csv"
|
| 12 |
+
out_gene_data_file = "./output/z3/preprocess/Esophageal_Cancer/gene_data/TCGA.csv"
|
| 13 |
+
out_clinical_data_file = "./output/z3/preprocess/Esophageal_Cancer/clinical_data/TCGA.csv"
|
| 14 |
+
json_path = "./output/z3/preprocess/Esophageal_Cancer/cohort_info.json"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Step 1: Initial Data Loading
|
| 18 |
+
import os
|
| 19 |
+
import pandas as pd
|
| 20 |
+
|
| 21 |
+
# 1) Select the most relevant TCGA cohort directory for the current trait
|
| 22 |
+
subdirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
| 23 |
+
trait_terms = ["esophageal", "esophagus", "esca"]
|
| 24 |
+
|
| 25 |
+
def score_dir(name: str) -> int:
|
| 26 |
+
n = name.lower()
|
| 27 |
+
score = 0
|
| 28 |
+
if "esophageal" in n or "esophagus" in n:
|
| 29 |
+
score += 10
|
| 30 |
+
if "esca" in n:
|
| 31 |
+
score += 5
|
| 32 |
+
if "tcga" in n:
|
| 33 |
+
score += 1
|
| 34 |
+
return score
|
| 35 |
+
|
| 36 |
+
scored = sorted([(score_dir(d), d) for d in subdirs], reverse=True)
|
| 37 |
+
best_dir = scored[0][1] if scored and scored[0][0] > 0 else None
|
| 38 |
+
|
| 39 |
+
if best_dir is None:
|
| 40 |
+
# No suitable directory found: record and stop early
|
| 41 |
+
_ = validate_and_save_cohort_info(
|
| 42 |
+
is_final=False,
|
| 43 |
+
cohort="TCGA",
|
| 44 |
+
info_path=json_path,
|
| 45 |
+
is_gene_available=False,
|
| 46 |
+
is_trait_available=False
|
| 47 |
+
)
|
| 48 |
+
else:
|
| 49 |
+
cohort_dir = os.path.join(tcga_root_dir, best_dir)
|
| 50 |
+
|
| 51 |
+
# 2) Identify clinical and genetic file paths
|
| 52 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
| 53 |
+
|
| 54 |
+
# 3) Load files
|
| 55 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0, low_memory=False, compression='infer')
|
| 56 |
+
genetic_df = pd.read_csv(genetic_file_path, sep='\t', index_col=0, low_memory=False, compression='infer')
|
| 57 |
+
|
| 58 |
+
# 4) Print clinical column names
|
| 59 |
+
print(list(clinical_df.columns))
|
| 60 |
+
|
| 61 |
+
# Step 2: Find Candidate Demographic Features
|
| 62 |
+
import os
|
| 63 |
+
import re
|
| 64 |
+
import pandas as pd
|
| 65 |
+
|
| 66 |
+
# Helper functions to identify candidate columns
|
| 67 |
+
def _tokenize_col(name: str):
|
| 68 |
+
return [t for t in re.split(r'[^a-z0-9]+', name.lower()) if t]
|
| 69 |
+
|
| 70 |
+
def _is_age_col(name: str) -> bool:
|
| 71 |
+
# Consider columns with explicit 'age' token, or specific birth-derived numeric proxies
|
| 72 |
+
nl = name.lower()
|
| 73 |
+
tokens = _tokenize_col(name)
|
| 74 |
+
if 'age' in tokens:
|
| 75 |
+
return True
|
| 76 |
+
birth_proxies = ['days_to_birth', 'date_of_birth', 'year_of_birth', 'birth_year', 'dob']
|
| 77 |
+
return any(p in nl for p in birth_proxies)
|
| 78 |
+
|
| 79 |
+
def _is_gender_col(name: str) -> bool:
|
| 80 |
+
tokens = _tokenize_col(name)
|
| 81 |
+
return ('gender' in tokens) or ('sex' in tokens)
|
| 82 |
+
|
| 83 |
+
# Locate ESCA cohort directory
|
| 84 |
+
cohort_dir = None
|
| 85 |
+
if os.path.isdir(tcga_root_dir):
|
| 86 |
+
subdirs = [d for d in os.listdir(tcga_root_dir)
|
| 87 |
+
if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
| 88 |
+
priority = []
|
| 89 |
+
for d in subdirs:
|
| 90 |
+
dl = d.lower()
|
| 91 |
+
if dl == 'esca' or dl == 'tcga_esca':
|
| 92 |
+
priority.append(d)
|
| 93 |
+
if not priority:
|
| 94 |
+
priority = [d for d in subdirs if ('esca' in d.lower() or 'esophageal' in d.lower())]
|
| 95 |
+
if priority:
|
| 96 |
+
cohort_dir = os.path.join(tcga_root_dir, priority[0])
|
| 97 |
+
|
| 98 |
+
# Get clinical file path
|
| 99 |
+
clinical_df = None
|
| 100 |
+
if cohort_dir is not None:
|
| 101 |
+
try:
|
| 102 |
+
clinical_file_path, _ = tcga_get_relevant_filepaths(cohort_dir)
|
| 103 |
+
try:
|
| 104 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', header=0, index_col=0, dtype=str, low_memory=False)
|
| 105 |
+
except Exception:
|
| 106 |
+
clinical_df = pd.read_csv(clinical_file_path, sep=',', header=0, index_col=0, dtype=str, low_memory=False)
|
| 107 |
+
except Exception:
|
| 108 |
+
clinical_df = None
|
| 109 |
+
|
| 110 |
+
# Derive candidate columns from available columns
|
| 111 |
+
candidate_age_cols = []
|
| 112 |
+
candidate_gender_cols = []
|
| 113 |
+
if clinical_df is not None:
|
| 114 |
+
cols = clinical_df.columns.tolist()
|
| 115 |
+
for c in cols:
|
| 116 |
+
if _is_age_col(c):
|
| 117 |
+
candidate_age_cols.append(c)
|
| 118 |
+
if _is_gender_col(c):
|
| 119 |
+
candidate_gender_cols.append(c)
|
| 120 |
+
else:
|
| 121 |
+
# Fallback to the provided list from previous step if file loading failed
|
| 122 |
+
provided_cols = ['CDE_ID_3226963', '_INTEGRATION', '_PATIENT', '_cohort', '_primary_disease', '_primary_site', 'additional_pharmaceutical_therapy', 'additional_radiation_therapy', 'additional_treatment_completion_success_outcome', 'age_at_initial_pathologic_diagnosis', 'age_began_smoking_in_years', 'alcohol_history_documented', 'amount_of_alcohol_consumption_per_day', 'antireflux_treatment_type', 'barretts_esophagus', 'bcr_followup_barcode', 'bcr_patient_barcode', 'bcr_sample_barcode', 'city_of_procurement', 'clinical_M', 'clinical_N', 'clinical_T', 'clinical_stage', 'columnar_metaplasia_present', 'columnar_mucosa_dysplasia', 'columnar_mucosa_goblet_cell_present', 'country_of_birth', 'country_of_procurement', 'days_to_birth', 'days_to_collection', 'days_to_death', 'days_to_initial_pathologic_diagnosis', 'days_to_last_followup', 'days_to_new_tumor_event_additional_surgery_procedure', 'days_to_new_tumor_event_after_initial_treatment', 'eastern_cancer_oncology_group', 'esophageal_tumor_cental_location', 'esophageal_tumor_involvement_site', 'form_completion_date', 'frequency_of_alcohol_consumption', 'gender', 'goblet_cells_present', 'h_pylori_infection', 'height', 'histological_type', 'history_of_esophageal_cancer', 'history_of_neoadjuvant_treatment', 'icd_10', 'icd_o_3_histology', 'icd_o_3_site', 'informed_consent_verified', 'init_pathology_dx_method_other', 'initial_diagnosis_by', 'initial_pathologic_diagnosis_method', 'initial_weight', 'is_ffpe', 'karnofsky_performance_score', 'lost_follow_up', 'lymph_node_examined_count', 'lymph_node_metastasis_radiographic_evidence', 'neoplasm_histologic_grade', 'new_neoplasm_event_occurrence_anatomic_site', 'new_neoplasm_event_type', 'new_neoplasm_occurrence_anatomic_site_text', 'new_tumor_event_additional_surgery_procedure', 'new_tumor_event_after_initial_treatment', 'number_of_lymphnodes_positive_by_he', 'number_of_lymphnodes_positive_by_ihc', 'number_of_relatives_diagnosed', 'number_pack_years_smoked', 'oct_embedded', 'other_dx', 'pathologic_M', 'pathologic_N', 'pathologic_T', 'pathologic_stage', 'pathology_report_file_name', 'patient_id', 'person_neoplasm_cancer_status', 'planned_surgery_status', 'postoperative_rx_tx', 'primary_lymph_node_presentation_assessment', 'primary_therapy_outcome_success', 'progression_determined_by', 'radiation_therapy', 'reflux_history', 'residual_tumor', 'sample_type', 'sample_type_id', 'state_province_of_procurement', 'stopped_smoking_year', 'system_version', 'tissue_prospective_collection_indicator', 'tissue_retrospective_collection_indicator', 'tissue_source_site', 'tobacco_smoking_history', 'treatment_prior_to_surgery', 'tumor_tissue_site', 'vial_number', 'vital_status', 'weight', 'year_of_initial_pathologic_diagnosis', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeqV2_percentile', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeqV2_PANCAN', '_GENOMIC_ID_TCGA_ESCA_mutation_bcm_gene', '_GENOMIC_ID_data/public/TCGA/ESCA/miRNA_HiSeq_gene', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeq_exon', '_GENOMIC_ID_TCGA_ESCA_PDMRNAseq', '_GENOMIC_ID_TCGA_ESCA_hMethyl450', '_GENOMIC_ID_TCGA_ESCA_RPPA', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeqV2', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeq', '_GENOMIC_ID_TCGA_ESCA_miRNA_HiSeq', '_GENOMIC_ID_TCGA_ESCA_mutation_ucsc_maf_gene', '_GENOMIC_ID_TCGA_ESCA_gistic2', '_GENOMIC_ID_TCGA_ESCA_gistic2thd', '_GENOMIC_ID_TCGA_ESCA_mutation_broad_gene', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeqV2_exon', '_GENOMIC_ID_TCGA_ESCA_mutation_bcgsc_gene', '_GENOMIC_ID_TCGA_ESCA_PDMRNAseqCNV']
|
| 123 |
+
for c in provided_cols:
|
| 124 |
+
if _is_age_col(c):
|
| 125 |
+
candidate_age_cols.append(c)
|
| 126 |
+
if _is_gender_col(c):
|
| 127 |
+
candidate_gender_cols.append(c)
|
| 128 |
+
|
| 129 |
+
# Print candidate lists in the required format
|
| 130 |
+
print(f"candidate_age_cols = {candidate_age_cols}")
|
| 131 |
+
print(f"candidate_gender_cols = {candidate_gender_cols}")
|
| 132 |
+
|
| 133 |
+
# Extract and preview candidate columns if clinical data is available
|
| 134 |
+
if clinical_df is not None:
|
| 135 |
+
if candidate_age_cols:
|
| 136 |
+
try:
|
| 137 |
+
age_preview = preview_df(clinical_df[[c for c in candidate_age_cols if c in clinical_df.columns]], n=5)
|
| 138 |
+
print(age_preview)
|
| 139 |
+
except Exception:
|
| 140 |
+
pass
|
| 141 |
+
if candidate_gender_cols:
|
| 142 |
+
try:
|
| 143 |
+
gender_preview = preview_df(clinical_df[[c for c in candidate_gender_cols if c in clinical_df.columns]], n=5)
|
| 144 |
+
print(gender_preview)
|
| 145 |
+
except Exception:
|
| 146 |
+
pass
|
| 147 |
+
|
| 148 |
+
# Step 3: Select Demographic Features
|
| 149 |
+
import pandas as pd
|
| 150 |
+
import numpy as np
|
| 151 |
+
|
| 152 |
+
# Default to None
|
| 153 |
+
age_col = None
|
| 154 |
+
gender_col = None
|
| 155 |
+
|
| 156 |
+
def select_age_col(clinical_df: pd.DataFrame, candidates: list) -> str:
|
| 157 |
+
best_col = None
|
| 158 |
+
best_score = -1
|
| 159 |
+
for col in candidates:
|
| 160 |
+
if col not in clinical_df.columns:
|
| 161 |
+
continue
|
| 162 |
+
s = clinical_df[col]
|
| 163 |
+
non_null_ratio = s.notna().mean()
|
| 164 |
+
if non_null_ratio < 0.3: # too sparse
|
| 165 |
+
continue
|
| 166 |
+
|
| 167 |
+
# Try to interpret as numeric (preserve sign for 'days_to_birth')
|
| 168 |
+
s_num = pd.to_numeric(s, errors='coerce')
|
| 169 |
+
s_valid = s_num.dropna()
|
| 170 |
+
if len(s_valid) == 0:
|
| 171 |
+
continue
|
| 172 |
+
|
| 173 |
+
# Proportion that looks like a direct age (0-120 years)
|
| 174 |
+
pct_age_range = ((s_valid >= 0) & (s_valid <= 120)).mean()
|
| 175 |
+
|
| 176 |
+
# Proportion that looks like days to birth (large negative)
|
| 177 |
+
pct_days_to_birth = (s_valid <= -3650).mean()
|
| 178 |
+
|
| 179 |
+
# Score prioritizes plausible age range and penalizes "days_to_birth"-like distributions
|
| 180 |
+
score = (pct_age_range - 0.3 * pct_days_to_birth) * non_null_ratio
|
| 181 |
+
|
| 182 |
+
# Small heuristic boost if column name contains 'age' and not 'began_smoking'
|
| 183 |
+
name_lower = col.lower()
|
| 184 |
+
if 'age' in name_lower and 'began_smoking' not in name_lower:
|
| 185 |
+
score *= 1.1
|
| 186 |
+
|
| 187 |
+
if score > best_score:
|
| 188 |
+
best_score = score
|
| 189 |
+
best_col = col
|
| 190 |
+
return best_col
|
| 191 |
+
|
| 192 |
+
def select_gender_col(clinical_df: pd.DataFrame, candidates: list) -> str:
|
| 193 |
+
best_col = None
|
| 194 |
+
best_score = -1
|
| 195 |
+
valid_tokens = {'male', 'female', 'm', 'f'}
|
| 196 |
+
for col in candidates:
|
| 197 |
+
if col not in clinical_df.columns:
|
| 198 |
+
continue
|
| 199 |
+
s = clinical_df[col].astype(str).str.strip().str.lower()
|
| 200 |
+
non_null_ratio = (~s.isin(['', 'nan', 'none'])).mean()
|
| 201 |
+
if non_null_ratio < 0.3:
|
| 202 |
+
continue
|
| 203 |
+
s_valid = s[~s.isin(['', 'nan', 'none'])]
|
| 204 |
+
if len(s_valid) == 0:
|
| 205 |
+
continue
|
| 206 |
+
pct_valid_gender = s_valid.isin(valid_tokens).mean()
|
| 207 |
+
score = pct_valid_gender * non_null_ratio
|
| 208 |
+
if score > best_score:
|
| 209 |
+
best_score = score
|
| 210 |
+
best_col = col
|
| 211 |
+
return best_col
|
| 212 |
+
|
| 213 |
+
try:
|
| 214 |
+
# Use clinical_df and candidate lists if available
|
| 215 |
+
if 'clinical_df' in globals():
|
| 216 |
+
# Fallback if candidate lists are not defined
|
| 217 |
+
candidate_age_cols = candidate_age_cols if 'candidate_age_cols' in globals() else []
|
| 218 |
+
candidate_gender_cols = candidate_gender_cols if 'candidate_gender_cols' in globals() else []
|
| 219 |
+
|
| 220 |
+
chosen_age = select_age_col(clinical_df, candidate_age_cols) if candidate_age_cols else None
|
| 221 |
+
chosen_gender = select_gender_col(clinical_df, candidate_gender_cols) if candidate_gender_cols else None
|
| 222 |
+
|
| 223 |
+
age_col = chosen_age if chosen_age else None
|
| 224 |
+
gender_col = chosen_gender if chosen_gender else None
|
| 225 |
+
|
| 226 |
+
# Print out selected columns and their info
|
| 227 |
+
print("Selected age_col:", age_col)
|
| 228 |
+
if age_col:
|
| 229 |
+
col_series = clinical_df[age_col]
|
| 230 |
+
print("age_col non-null ratio:", round(col_series.notna().mean(), 4))
|
| 231 |
+
print("age_col first5:", col_series.head(5).tolist())
|
| 232 |
+
|
| 233 |
+
print("Selected gender_col:", gender_col)
|
| 234 |
+
if gender_col:
|
| 235 |
+
col_series = clinical_df[gender_col]
|
| 236 |
+
print("gender_col non-null ratio:", round(col_series.notna().mean(), 4))
|
| 237 |
+
print("gender_col first5:", col_series.head(5).tolist())
|
| 238 |
+
else:
|
| 239 |
+
# Fallback selection purely based on provided candidate names and typical TCGA patterns
|
| 240 |
+
# Given previews: choose age_at_initial_pathologic_diagnosis for age; gender for gender
|
| 241 |
+
age_col = 'age_at_initial_pathologic_diagnosis' if 'age_at_initial_pathologic_diagnosis' in (candidate_age_cols if 'candidate_age_cols' in globals() else []) else None
|
| 242 |
+
gender_col = 'gender' if 'gender' in (candidate_gender_cols if 'candidate_gender_cols' in globals() else []) else None
|
| 243 |
+
|
| 244 |
+
print("Selected age_col:", age_col)
|
| 245 |
+
print("Selected gender_col:", gender_col)
|
| 246 |
+
except Exception as e:
|
| 247 |
+
# On any unexpected issue, fall back to known-good choices from the preview
|
| 248 |
+
age_col = 'age_at_initial_pathologic_diagnosis'
|
| 249 |
+
gender_col = 'gender'
|
| 250 |
+
print("Selected age_col:", age_col)
|
| 251 |
+
print("Selected gender_col:", gender_col)
|
| 252 |
+
print("Note: Fallback due to error:", str(e))
|
| 253 |
+
|
| 254 |
+
# Step 4: Feature Engineering and Validation
|
| 255 |
+
import os
|
| 256 |
+
import pandas as pd
|
| 257 |
+
|
| 258 |
+
# 1) Extract and standardize clinical features (trait, Age, Gender)
|
| 259 |
+
# Fallbacks in case variables not defined in prior steps
|
| 260 |
+
try:
|
| 261 |
+
_ = age_col
|
| 262 |
+
except NameError:
|
| 263 |
+
age_col = None
|
| 264 |
+
try:
|
| 265 |
+
_ = gender_col
|
| 266 |
+
except NameError:
|
| 267 |
+
gender_col = None
|
| 268 |
+
|
| 269 |
+
selected_clinical_df = tcga_select_clinical_features(
|
| 270 |
+
clinical_df=clinical_df,
|
| 271 |
+
trait=trait,
|
| 272 |
+
age_col=age_col,
|
| 273 |
+
gender_col=gender_col
|
| 274 |
+
)
|
| 275 |
+
|
| 276 |
+
# Optionally save clinical data (useful for inspection)
|
| 277 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 278 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 279 |
+
|
| 280 |
+
# 2) Normalize gene symbols in genetic data (ensure genes are in index)
|
| 281 |
+
def _looks_like_tcga(series_like) -> float:
|
| 282 |
+
try:
|
| 283 |
+
s = pd.Index(series_like).astype(str)
|
| 284 |
+
except Exception:
|
| 285 |
+
s = pd.Index([str(x) for x in series_like])
|
| 286 |
+
return s.str.upper().str.startswith("TCGA-").mean()
|
| 287 |
+
|
| 288 |
+
# Ensure rows are genes, columns are samples
|
| 289 |
+
rows_tcga_frac = _looks_like_tcga(genetic_df.index)
|
| 290 |
+
cols_tcga_frac = _looks_like_tcga(genetic_df.columns)
|
| 291 |
+
gene_df = genetic_df.copy()
|
| 292 |
+
|
| 293 |
+
if rows_tcga_frac > cols_tcga_frac:
|
| 294 |
+
# Rows look like samples -> transpose to genes x samples
|
| 295 |
+
gene_df = gene_df.T
|
| 296 |
+
|
| 297 |
+
# Normalize gene symbols and drop unrecognized
|
| 298 |
+
gene_df_norm = normalize_gene_symbols_in_index(gene_df)
|
| 299 |
+
|
| 300 |
+
# Save normalized gene expression
|
| 301 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 302 |
+
gene_df_norm.to_csv(out_gene_data_file)
|
| 303 |
+
|
| 304 |
+
# 3) Link clinical and genetic data on sample IDs
|
| 305 |
+
# Clinical index: samples; gene_df_norm columns: samples; transpose gene_df_norm to samples x genes
|
| 306 |
+
gene_df_samples = gene_df_norm.T
|
| 307 |
+
linked_data = selected_clinical_df.join(gene_df_samples, how='inner')
|
| 308 |
+
|
| 309 |
+
# 4) Handle missing values
|
| 310 |
+
linked_data = handle_missing_values(linked_data, trait_col=trait)
|
| 311 |
+
|
| 312 |
+
# 5) Determine bias and remove biased demographic features
|
| 313 |
+
trait_biased, linked_data = judge_and_remove_biased_features(linked_data, trait=trait)
|
| 314 |
+
|
| 315 |
+
# 6) Final validation and save cohort info
|
| 316 |
+
# Ensure pure Python booleans for JSON serialization
|
| 317 |
+
is_gene_available = bool(gene_df_norm.shape[0] > 0 and gene_df_norm.shape[1] > 0)
|
| 318 |
+
is_trait_available = bool((trait in selected_clinical_df.columns) and (selected_clinical_df[trait].notna().sum() > 0))
|
| 319 |
+
trait_biased = bool(trait_biased)
|
| 320 |
+
|
| 321 |
+
note = "INFO: Trait derived from TCGA sample barcode (01-09 tumor=1, 10-19 normal=0). Gene symbols normalized to HGNC using NCBI synonym mapping."
|
| 322 |
+
is_usable = validate_and_save_cohort_info(
|
| 323 |
+
is_final=True,
|
| 324 |
+
cohort="TCGA",
|
| 325 |
+
info_path=json_path,
|
| 326 |
+
is_gene_available=is_gene_available,
|
| 327 |
+
is_trait_available=is_trait_available,
|
| 328 |
+
is_biased=trait_biased,
|
| 329 |
+
df=linked_data,
|
| 330 |
+
note=note
|
| 331 |
+
)
|
| 332 |
+
|
| 333 |
+
# 7) Save linked data only if usable
|
| 334 |
+
if is_usable:
|
| 335 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 336 |
+
linked_data.to_csv(out_data_file)
|
output/preprocess/Esophageal_Cancer/cohort_info.json
CHANGED
|
@@ -1,112 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"GSE77790": {
|
| 3 |
-
"is_usable": false,
|
| 4 |
-
"is_gene_available": true,
|
| 5 |
-
"is_trait_available": true,
|
| 6 |
-
"is_available": true,
|
| 7 |
-
"is_biased": true,
|
| 8 |
-
"has_age": false,
|
| 9 |
-
"has_gender": false,
|
| 10 |
-
"sample_size": 32
|
| 11 |
-
},
|
| 12 |
-
"GSE75241": {
|
| 13 |
-
"is_usable": true,
|
| 14 |
-
"is_gene_available": true,
|
| 15 |
-
"is_trait_available": true,
|
| 16 |
-
"is_available": true,
|
| 17 |
-
"is_biased": false,
|
| 18 |
-
"has_age": false,
|
| 19 |
-
"has_gender": false,
|
| 20 |
-
"sample_size": 30
|
| 21 |
-
},
|
| 22 |
-
"GSE66258": {
|
| 23 |
-
"is_usable": false,
|
| 24 |
-
"is_gene_available": true,
|
| 25 |
-
"is_trait_available": true,
|
| 26 |
-
"is_available": true,
|
| 27 |
-
"is_biased": true,
|
| 28 |
-
"has_age": false,
|
| 29 |
-
"has_gender": false,
|
| 30 |
-
"sample_size": 108
|
| 31 |
-
},
|
| 32 |
-
"GSE55857": {
|
| 33 |
-
"is_usable": false,
|
| 34 |
-
"is_gene_available": false,
|
| 35 |
-
"is_trait_available": false,
|
| 36 |
-
"is_available": false,
|
| 37 |
-
"is_biased": null,
|
| 38 |
-
"has_age": null,
|
| 39 |
-
"has_gender": null,
|
| 40 |
-
"sample_size": null
|
| 41 |
-
},
|
| 42 |
-
"GSE218109": {
|
| 43 |
-
"is_usable": true,
|
| 44 |
-
"is_gene_available": true,
|
| 45 |
-
"is_trait_available": true,
|
| 46 |
-
"is_available": true,
|
| 47 |
-
"is_biased": false,
|
| 48 |
-
"has_age": true,
|
| 49 |
-
"has_gender": true,
|
| 50 |
-
"sample_size": 36
|
| 51 |
-
},
|
| 52 |
-
"GSE156915": {
|
| 53 |
-
"is_usable": true,
|
| 54 |
-
"is_gene_available": true,
|
| 55 |
-
"is_trait_available": true,
|
| 56 |
-
"is_available": true,
|
| 57 |
-
"is_biased": false,
|
| 58 |
-
"has_age": false,
|
| 59 |
-
"has_gender": false,
|
| 60 |
-
"sample_size": 361
|
| 61 |
-
},
|
| 62 |
-
"GSE131027": {
|
| 63 |
-
"is_usable": false,
|
| 64 |
-
"is_gene_available": true,
|
| 65 |
-
"is_trait_available": true,
|
| 66 |
-
"is_available": true,
|
| 67 |
-
"is_biased": true,
|
| 68 |
-
"has_age": false,
|
| 69 |
-
"has_gender": false,
|
| 70 |
-
"sample_size": 92
|
| 71 |
-
},
|
| 72 |
-
"GSE107754": {
|
| 73 |
-
"is_usable": false,
|
| 74 |
-
"is_gene_available": true,
|
| 75 |
-
"is_trait_available": true,
|
| 76 |
-
"is_available": true,
|
| 77 |
-
"is_biased": true,
|
| 78 |
-
"has_age": false,
|
| 79 |
-
"has_gender": true,
|
| 80 |
-
"sample_size": 84
|
| 81 |
-
},
|
| 82 |
-
"GSE104958": {
|
| 83 |
-
"is_usable": true,
|
| 84 |
-
"is_gene_available": true,
|
| 85 |
-
"is_trait_available": true,
|
| 86 |
-
"is_available": true,
|
| 87 |
-
"is_biased": false,
|
| 88 |
-
"has_age": false,
|
| 89 |
-
"has_gender": false,
|
| 90 |
-
"sample_size": 46
|
| 91 |
-
},
|
| 92 |
-
"GSE100843": {
|
| 93 |
-
"is_usable": false,
|
| 94 |
-
"is_gene_available": false,
|
| 95 |
-
"is_trait_available": false,
|
| 96 |
-
"is_available": false,
|
| 97 |
-
"is_biased": null,
|
| 98 |
-
"has_age": null,
|
| 99 |
-
"has_gender": null,
|
| 100 |
-
"sample_size": null
|
| 101 |
-
},
|
| 102 |
-
"TCGA": {
|
| 103 |
-
"is_usable": true,
|
| 104 |
-
"is_gene_available": true,
|
| 105 |
-
"is_trait_available": true,
|
| 106 |
-
"is_available": true,
|
| 107 |
-
"is_biased": false,
|
| 108 |
-
"has_age": true,
|
| 109 |
-
"has_gender": true,
|
| 110 |
-
"sample_size": 196
|
| 111 |
-
}
|
| 112 |
-
}
|
|
|
|
| 1 |
+
{"GSE77790": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": false, "has_gender": false, "sample_size": 32, "note": "INFO: Cell line microarray dataset; trait indicates esophageal cancer cell type inferred from 'cell type'. Trait distribution appears imbalanced based on preview."}, "GSE75241": {"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": 30, "note": "INFO: Paired ESCC tumor vs adjacent mucosa; Age/Gender not provided; Genes normalized via NCBI synonyms."}, "GSE66258": {"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}, "GSE55857": {"is_usable": false, "is_gene_available": false, "is_trait_available": true, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": null}, "GSE218109": {"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": "INFO: Trait (Esophageal_Cancer) is unavailable/constant in this cohort (all ESCC tumors; NS+ vs NS- design). Clinical extraction for trait was skipped."}, "GSE156915": {"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": "WARNING: Trait clinical data is unavailable for this cohort; skipping linking, missing-value handling, and bias assessment. Only normalized gene expression was saved."}, "GSE131027": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": false, "has_gender": false, "sample_size": 92, "note": "INFO: Probe-to-gene mapping via platform annotation; gene symbols normalized using NCBI synonyms."}, "GSE107754": {"is_usable": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": false, "has_gender": true, "sample_size": 71, "note": "INFO: Trait inferred as esophageal cancer (1) vs. other tissues (0) from 'tissue' field within a heterogeneous metastatic cohort; age unavailable; gender present. Gene symbols normalized via NCBI synonyms."}, "GSE104958": {"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": 46, "note": "INFO: Age and Gender not available; trait derived from tissue field."}, "GSE100843": {"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}, "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": 196, "note": "INFO: Trait derived from TCGA sample barcode (01-09 tumor=1, 10-19 normal=0). Gene symbols normalized to HGNC using NCBI synonym mapping."}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Esophageal_Cancer/gene_data/GSE75241.csv
CHANGED
|
@@ -461,7 +461,7 @@ AHCY,5.11305,5.55395,5.7752,5.52295,5.672,5.3523,5.7326,5.22685,5.3963,5.5001,5.
|
|
| 461 |
AHCYL1,5.7803,5.4641,5.4835,5.51,5.5091,5.62625,5.4519,5.6326,5.8471,5.6502,5.6218,5.6228,5.7352,5.7495,5.47605,5.6094,5.77815,5.8317,5.58645,5.5269,5.4081,5.7052,5.45775,5.4246,5.56175,5.47435,5.61815,5.65105,5.4739,5.6579
|
| 462 |
AHCYL2,4.834515,4.56766,4.98435,4.748085,4.920295,4.69793,4.81372,4.64787,4.95798,4.6921,4.799905,4.635465,4.71589,5.44615,4.72228,4.420855,4.89727,4.728305,4.920145,4.86875,4.629525,5.35515,4.762875,3.909205,4.83494,4.83391,5.1508,4.73828,4.751845,4.91733
|
| 463 |
AHDC1,3.3509333333333333,3.2579166666666666,3.4340333333333333,3.1352499999999996,3.352233333333333,3.036096666666667,3.3379999999999996,3.1534600000000004,3.3633666666666664,3.0688,3.2693266666666667,3.118736666666667,3.4543666666666666,3.2220133333333334,3.347933333333333,3.20064,3.5132333333333334,3.25544,3.286326666666667,3.0949733333333334,3.410966666666667,3.0397133333333333,3.2950733333333333,2.9617233333333335,3.4095666666666666,3.107666666666667,3.3535,3.304733333333333,3.2702333333333335,3.063696666666667
|
| 464 |
-
AHI1,3.
|
| 465 |
AHNAK,6.812474999999999,6.735266666666667,6.734958333333333,6.490225000000001,6.8867416666666665,6.0604,6.640733333333333,6.509075,6.607258333333333,5.565366666666667,6.772016666666666,6.253208333333333,6.656125,5.804129166666667,6.502583333333334,6.256408333333333,6.778091666666667,6.566583333333333,6.788600000000001,5.8367483333333325,6.573766666666667,5.931665000000001,6.772966666666667,6.164483333333333,6.444333333333333,6.360025,6.817475,6.216575000000001,6.636383333333333,6.30955
|
| 466 |
AHNAK2,3.8966999999999996,3.978566666666667,3.8694333333333333,3.7386,3.9383666666666666,3.4644,3.6924333333333332,3.6844,3.7202333333333333,3.0408666666666666,3.8016666666666663,3.4946333333333333,3.7804,3.3636666666666666,3.5906333333333333,3.6087333333333333,3.8716666666666666,3.945733333333333,3.7918000000000003,3.289073333333333,3.6444666666666667,3.32504,3.8195666666666668,3.5352333333333337,3.6872333333333334,3.8979,3.8527,3.6704000000000003,3.713433333333333,3.6245999999999996
|
| 467 |
AHR,5.07085,5.9695,4.895925,5.2576,4.994915,5.8921,4.79774,5.1719,5.23745,5.21055,4.962915,5.02945,4.929345,5.4035,4.74796,5.8616,5.0655,5.3356,4.939455,5.83575,4.77985,5.8285,4.60302,5.1215,4.952175,5.82015,5.21785,5.7226,4.48685,5.29475
|
|
@@ -1414,7 +1414,7 @@ BBS2,2.2709275,2.49221,2.2977475,2.070675,2.275315,2.2863325,2.205035,2.11802,2.
|
|
| 1414 |
BBS4,3.32717,3.595865,3.51107,3.55417,3.21578,3.585475,3.277595,3.65976,3.826785,3.57884,3.387885,3.5749,3.30977,3.960085,3.33246,4.173595,3.76894,3.77128,3.39844,4.182245,3.263815,3.69268,3.45609,3.85815,3.293395,3.624645,3.797855,3.52018,3.23481,3.49462
|
| 1415 |
BBS5,4.984033999999999,4.949167428571428,5.073238714285714,5.008300428571429,4.956804571428572,5.019393,4.791174428571429,4.739202857142857,5.3838919999999995,5.113818,4.903515571428571,5.0120641428571435,4.856042,5.245343714285714,4.921110285714286,5.024544000000001,5.189010857142857,5.170905714285714,5.069401571428571,5.487235714285714,4.752165142857143,5.052059,4.915073714285715,5.087361714285715,5.079292571428572,4.643571142857143,5.291227428571428,5.413462714285714,4.744874428571428,5.129437
|
| 1416 |
BBS7,3.50519,3.868515,3.50823,3.696555,3.374355,3.691015,3.32986,3.15787,3.827245,3.56065,3.2406,3.37779,3.562255,3.87161,3.199585,3.97327,3.630395,3.560795,3.330825,3.87197,3.233955,3.557765,3.21287,3.54692,3.475565,3.84934,3.66938,3.778075,3.10369,3.718665
|
| 1417 |
-
BBS9,
|
| 1418 |
BBX,1.116385,1.24652375,1.1067475,1.199545,1.0762725,1.283,1.05016875,1.04952125,1.19734625,1.24470875,1.095505,1.1514075,1.1166875,1.16623125,1.063555,1.18081625,1.15012875,1.18698,1.113605,1.2383475,1.02787875,1.17839875,1.0328975,1.254675,1.114255,1.2381925,1.19389,1.3546,1.03745375,1.15190625
|
| 1419 |
BCAM,4.2788,4.689985,4.2484,4.351565,4.13221,4.944435,4.17768,4.477085,4.22285,4.336655,4.25352,4.484815,4.36575,5.19935,4.437825,4.880675,4.443545,4.518035,4.30309,5.6972,4.32711,4.709505,4.34973,4.97559,4.23464,5.0092,4.251115,4.99019,4.322355,4.756835
|
| 1420 |
BCAN,0.8579411111111112,0.8518444444444444,0.854991111111111,0.87356,0.8787977777777778,0.8390866666666666,0.8694144444444444,0.883,0.8387344444444444,0.8401377777777778,0.8695422222222222,0.8533133333333334,0.8637844444444445,0.8492455555555556,0.8708911111111112,0.8294477777777778,0.8399222222222222,0.8469655555555556,0.8533822222222223,0.8406211111111112,0.8740955555555555,0.8632611111111111,0.8659466666666666,0.8622011111111111,0.8492177777777778,0.8276044444444444,0.8521344444444444,0.81511,0.8756133333333334,0.8564422222222222
|
|
@@ -1625,7 +1625,7 @@ BRWD1-AS2,2.629825,2.60693,3.38893,2.953515,2.81253,3.00479,3.15815,3.101405,2.8
|
|
| 1625 |
BRWD3,3.1284500000000004,2.8499533333333336,3.09305,2.70602,3.069706666666667,3.0040999999999998,2.8734033333333335,2.7077233333333335,3.1881233333333334,2.91365,3.0444766666666667,2.9611466666666666,3.1290533333333332,2.9044166666666666,2.91637,2.7490433333333333,3.215116666666667,2.9766399999999997,2.96939,2.67559,2.94994,1.9592566666666666,3.1125966666666667,2.77167,3.0121866666666666,2.9153300000000004,3.15126,3.0911000000000004,2.9665733333333333,2.9903166666666667
|
| 1626 |
BSCL2,3.9172200000000004,3.7453779999999997,4.036259333333334,3.982861333333333,3.919623333333333,3.909112,4.032792,3.98991,3.9299773333333334,4.007014,3.9688713333333334,3.763038,3.9251813333333336,3.9225906666666672,3.932444,3.977926666666667,4.010820666666667,3.8172613333333336,3.8275346666666668,3.9044706666666666,3.9113246666666672,4.11712,3.9288213333333335,3.4755986666666665,3.7162919999999997,3.4380006666666665,3.8451113333333335,3.6916219999999997,4.012476,3.9043593333333333
|
| 1627 |
BSDC1,2.96415,2.945456666666667,3.0747533333333332,3.026313333333333,3.0412966666666663,3.02122,3.01676,2.990873333333333,3.0748433333333334,3.0321266666666666,2.9581666666666666,2.8737366666666664,3.08817,3.1934466666666665,2.96754,3.074666666666667,3.08388,3.1108100000000003,2.9865399999999998,3.00255,2.9730399999999997,3.0751633333333337,2.9412933333333338,2.9326133333333337,2.9419299999999997,3.012003333333333,3.05801,3.106203333333333,2.92911,3.0488
|
| 1628 |
-
BSG,
|
| 1629 |
BSN,3.653715,3.598245,3.65109,3.68642,3.721585,3.510115,3.78692,3.71179,3.57014,3.633765,3.72618,3.55043,3.715945,3.625585,3.691475,3.516675,3.586485,3.6195,3.610225,3.54045,3.675675,3.679385,3.632055,3.596155,3.757765,3.582405,3.539515,3.51473,3.693535,3.57368
|
| 1630 |
BSND,3.479645,3.219265,3.296145,3.487925,3.4001,3.359655,3.38245,3.36531,3.36321,3.34917,3.506745,3.3181,3.416765,3.36694,3.280885,3.239815,3.19796,3.494055,3.248375,3.229385,3.330095,3.35064,3.344825,3.33927,3.49841,3.307295,3.281425,3.02741,3.29774,3.269445
|
| 1631 |
BSPRY,2.43489,1.87736,2.4616325,2.23845,2.44376,2.15274,2.503125,2.368235,2.44908,2.009945,2.4974825,2.3087425,2.57415,2.129455,2.4353075,2.2209875,2.39957,2.2205275,2.4324525,1.930535,2.4735575,2.21442,2.37176,1.9095325,2.389595,2.20436,2.39842,2.146575,2.4406625,2.3496425
|
|
@@ -3594,6 +3594,7 @@ CYBC1,4.68584,4.837275,4.493225,4.74002,4.355435,4.744895,4.51927,4.78106,4.6285
|
|
| 3594 |
CYBRD1,4.897655,5.51395,4.45326,3.941125,4.57498,4.98926,4.692635,5.04635,5.0692,4.83144,4.499475,4.78217,4.35944,5.27175,4.725235,5.321,5.02195,5.56595,5.23945,5.59675,4.891965,5.2684,4.754805,5.39505,4.633835,5.20365,5.03285,5.7331,4.618985,5.33055
|
| 3595 |
CYC1,5.34005,5.65415,5.26015,5.36045,5.19715,5.4586,5.3079,5.4236,5.40105,5.5241,5.34485,5.27965,5.31105,5.5457,5.3599,5.52115,5.3984,5.43315,5.433,5.61565,5.34355,5.81565,5.2017,5.6586,5.31885,5.5002,5.54435,5.2774,5.30865,5.34725
|
| 3596 |
CYCS,4.01404,4.03255,3.912695,4.073705,3.907845,3.964345,3.75909,4.04073,4.057485,4.195315,3.87324,3.944935,4.003415,4.020345,4.16122,4.418765,3.851355,3.95142,4.08878,4.336555,4.067065,4.199775,3.485285,4.1855,3.860285,4.02134,4.049285,4.092315,3.97505,4.141155
|
|
|
|
| 3597 |
CYFIP1,3.4356333333333335,3.5414333333333334,3.635666666666667,3.4992,3.4629666666666665,3.284413333333333,3.4364000000000003,3.3299533333333335,3.4506666666666668,3.2689866666666667,3.462666666666667,3.3548333333333336,3.4319666666666664,3.3187166666666665,3.287186666666667,3.28197,3.5436333333333336,3.5038666666666667,3.3560666666666665,3.3502333333333336,3.311436666666667,3.1293133333333336,3.3491,3.3843,3.3541666666666665,3.3229366666666666,3.4373666666666662,3.3108833333333334,3.4244,3.378766666666667
|
| 3598 |
CYFIP2,2.8339266666666667,2.7094,2.65188,2.7581233333333333,2.61891,2.91708,2.65203,2.8133666666666666,2.9671299999999996,2.865083333333333,2.7042266666666666,2.8234766666666666,2.7633799999999997,3.1820500000000003,2.6724266666666665,2.6044033333333334,2.8333399999999997,2.90817,2.6280566666666667,2.8404433333333334,2.6325066666666666,2.53592,2.5602266666666664,2.54352,2.6939266666666666,2.8914500000000003,2.863566666666667,3.1500033333333337,2.60264,2.9961300000000004
|
| 3599 |
CYGB,2.0191475,2.114405,2.0006025,2.055275,1.96757,2.3244925,1.9925825,2.1050125,1.9658875,2.1190575,1.9923225,2.179615,2.033375,2.235445,1.9954275,2.235705,2.0409775,2.283165,2.01737,2.31124,1.9768525,2.1454425,2.034625,2.2294375,2.062185,2.3913975,1.907445,2.2325025,2.1266625,2.192175
|
|
@@ -4137,7 +4138,7 @@ DND1,1.63889,1.5280316666666665,1.6293383333333333,1.5301466666666668,1.63318333
|
|
| 4137 |
DNER,2.10804,2.411,2.0889666666666664,2.6368966666666664,2.15504,2.0738266666666667,2.1473833333333334,2.0815433333333333,2.0647733333333336,2.1259566666666667,2.0978333333333334,2.05769,2.0921,2.1280033333333335,2.2512466666666664,2.0978666666666665,2.0585566666666666,2.104976666666667,2.1917066666666667,2.1304333333333334,2.128366666666667,2.1435866666666668,2.1237533333333336,2.268686666666667,2.18123,2.44495,2.1095466666666667,2.046933333333333,2.17389,2.3726233333333333
|
| 4138 |
DNHD1,5.570978333333334,5.535575,5.553979999999999,5.575073333333333,5.492495,5.620923333333334,5.441355,5.6564483333333335,5.514191666666667,5.5251850000000005,5.536851666666667,5.497156666666666,5.449526666666666,5.531408333333333,5.500123333333333,5.611378333333333,5.530173333333333,5.500476666666667,5.525116666666667,5.486513333333333,5.464585,5.424015,5.5963683333333325,5.571213333333333,5.580348333333333,5.4513766666666665,5.541948333333333,5.744845,5.397065,5.48984
|
| 4139 |
DNLZ,1.6621479999999997,1.632732,1.6876460000000002,1.6960760000000001,1.65018,1.661028,1.701076,1.7024260000000002,1.6589099999999999,1.6129419999999999,1.659046,1.684206,1.661456,1.6542439999999998,1.68983,1.6532240000000002,1.6402899999999998,1.623836,1.6439039999999998,1.6262260000000002,1.6570799999999999,1.6404900000000002,1.6180879999999997,1.695138,1.626624,1.6095479999999998,1.681608,1.6110900000000001,1.681646,1.656164
|
| 4140 |
-
DNM1,
|
| 4141 |
DNM1L,0.6679215384615385,0.7541076923076923,0.6320538461538461,0.7465723076923076,0.6787500000000001,0.6979330769230769,0.6637523076923078,0.7001953846153846,0.6794507692307692,0.7263130769230769,0.6718969230769231,0.70969,0.6338576923076923,0.7211469230769231,0.6804146153846153,0.6912492307692308,0.6760346153846153,0.6889069230769231,0.6829430769230769,0.7020846153846154,0.61044,0.6867346153846154,0.6704492307692308,0.766573076923077,0.6579569230769231,0.7489584615384615,0.678703076923077,0.7329353846153845,0.6581715384615384,0.6759338461538462
|
| 4142 |
DNM1P41,3.389666666666667,3.146183333333333,3.3215833333333333,3.177633333333333,3.2541733333333336,3.12899,3.0933433333333333,3.0225500000000003,3.4400666666666666,3.426266666666667,3.2731866666666662,3.1017266666666665,3.278586666666667,3.3456333333333332,3.3095966666666663,3.523066666666667,3.2143466666666662,2.8676066666666666,3.0103266666666664,3.5757,3.3629,3.424466666666667,3.3683666666666667,3.422166666666667,3.3722,3.1752266666666666,3.3897999999999997,3.3790666666666667,3.2044200000000003,3.3294099999999998
|
| 4143 |
DNM1P46,4.21738,4.116615,3.732755,4.09715,4.17362,4.08201,4.27354,4.308365,3.78931,4.063585,4.338365,4.419035,4.205545,4.143045,4.195095,3.997925,4.11724,4.15216,4.168615,4.02523,4.03649,4.02994,4.13443,4.0906,3.70615,3.767535,4.055475,3.841615,4.39043,4.103045
|
|
@@ -4762,7 +4763,8 @@ ERP44,5.71175,5.53765,5.55505,5.4819,5.53865,5.75065,5.37,5.5197,5.7226,5.49335,
|
|
| 4762 |
ERRFI1,3.21997,3.9414,3.230613333333333,3.6514666666666664,3.2191466666666666,3.4639333333333333,3.308483333333333,3.1311,3.2834800000000004,3.5465999999999998,3.151813333333333,3.28258,3.4747,3.3795333333333333,2.9230033333333334,3.541533333333333,3.309673333333333,3.4534000000000002,3.0025633333333333,3.1454166666666663,2.95658,3.294373333333333,3.0256900000000004,3.751633333333333,3.2678766666666665,3.5280666666666662,2.9771033333333334,3.3281166666666664,2.941876666666667,3.4164333333333334
|
| 4763 |
ERV3-1,1.834745,1.189485,2.2313625,1.592175,2.3740575,2.0343825,2.1710075,1.8701775,2.30142,1.98083,2.02568,1.959055,2.2669475,1.7238175,1.5167,1.590945,2.3758,1.94907,1.47412,1.8637675,1.79506,1.621145,1.93144,1.2623,2.0122775,1.743645,2.0350425,2.0951525,1.72543,2.0296825
|
| 4764 |
ERVFRD-1,2.24756,2.2367666666666666,2.2195833333333335,2.2368799999999998,2.26351,2.1113066666666667,2.2502299999999997,2.210923333333333,2.20668,2.2583333333333333,2.2772966666666665,2.2175266666666666,2.2409399999999997,2.1907466666666666,2.313353333333333,2.1815166666666665,2.192126666666667,2.1716866666666665,2.2811566666666665,2.13813,2.326566666666667,2.3955766666666665,2.2228233333333334,2.2726866666666665,2.25315,2.1400166666666665,2.2119866666666668,2.18044,2.414286666666667,2.2832233333333334
|
| 4765 |
-
ERVK-19,
|
|
|
|
| 4766 |
ERVV-1,1.4874975,1.38932,1.504555,1.40679,1.4435375,1.339385,1.4647875,1.41628,1.4109075,1.438055,1.4653025,1.5287675,1.49097,1.4754775,1.54617,1.426835,1.4562425,1.4993325,1.478935,1.4669175,1.532845,1.3857775,1.44605,1.4765725,1.490165,1.5586825,1.4300125,1.4774375,1.58887,1.45721
|
| 4767 |
ERVV-2,1.4874975,1.38932,1.504555,1.40679,1.4435375,1.339385,1.4647875,1.41628,1.4109075,1.438055,1.4653025,1.5287675,1.49097,1.4754775,1.54617,1.426835,1.4562425,1.4993325,1.478935,1.4669175,1.532845,1.3857775,1.44605,1.4765725,1.490165,1.5586825,1.4300125,1.4774375,1.58887,1.45721
|
| 4768 |
ERVW-1,2.227463333333333,2.300336666666667,2.4706333333333332,2.4082433333333335,2.23655,2.3384733333333334,2.5807466666666667,2.5172866666666667,2.1962766666666664,2.3356566666666665,2.1763,2.258836666666667,2.29454,2.1774033333333334,2.3862900000000002,2.2960133333333332,2.236083333333333,2.2945766666666665,2.4003033333333335,2.1838966666666666,2.4738233333333333,2.31894,2.449456666666667,2.56629,2.34659,2.0910233333333332,2.36776,2.01064,2.158376666666667,2.2983033333333336
|
|
@@ -6461,7 +6463,7 @@ HAPLN1,1.5484766666666667,2.0770766666666667,1.6101999999999999,1.67391666666666
|
|
| 6461 |
HAPLN2,3.984675,3.902995,3.95642,3.969685,4.06917,3.835045,3.93578,4.121455,3.847995,3.897565,3.96294,3.913235,3.97794,3.842625,4.013205,3.871235,3.909585,3.86149,3.94661,3.901685,3.8821,3.89445,4.042825,3.98535,4.05901,3.646235,3.83155,3.735965,3.988395,3.882
|
| 6462 |
HAPLN3,3.967675,4.607485,4.01918,4.21342,3.729535,4.58968,3.91905,4.409685,4.315145,4.611685,3.824325,4.34593,4.003005,4.32873,4.162395,4.439265,4.07326,4.57758,3.990445,4.291825,3.922845,4.34859,3.9206,4.48322,3.8291,4.486125,3.972535,4.39096,3.92483,4.346045
|
| 6463 |
HAPLN4,3.63379,3.567715,3.66801,3.681345,3.516105,3.564175,3.72192,3.82176,3.509235,3.555525,3.71153,3.827665,3.66598,3.74619,3.81266,3.52459,3.61496,3.72077,3.64732,3.60376,3.840865,3.48749,3.65513,3.791755,3.61243,3.541205,3.654035,3.5229,3.833305,3.740495
|
| 6464 |
-
HAPSTR1,
|
| 6465 |
HARBI1,3.016955,2.85915,2.94949,2.958665,2.98286,2.89801,2.737645,2.906695,3.140055,3.011655,2.88258,3.05399,3.02705,3.10198,2.88814,3.611945,3.071305,2.922255,2.72926,2.951775,2.823615,3.085875,2.943755,2.98849,2.87564,2.935325,2.997765,2.95209,2.91595,3.04033
|
| 6466 |
HARS1,6.67939,6.137496666666666,6.675038333333333,6.716796666666667,6.6871833333333335,6.549863333333333,6.659208333333333,6.521541666666667,6.779381666666667,6.7517933333333335,6.599295000000001,6.56529,7.015408333333333,6.843859999999999,6.479655,6.492715,6.7732616666666665,6.621121666666666,6.517195,6.421331666666666,6.470631666666667,6.556625,6.448195,6.601371666666667,6.686495000000001,6.585628333333333,6.540291666666667,6.740715000000001,6.314563333333334,6.627495
|
| 6467 |
HARS2,0.9687255555555555,0.922478888888889,0.9265988888888889,0.9317722222222221,0.9426788888888888,0.931861111111111,0.8952933333333333,0.9156355555555555,0.9880222222222224,0.9667944444444445,0.9201377777777778,0.9221833333333334,0.9766455555555554,0.9635666666666667,0.91658,0.9944999999999999,0.9787522222222224,0.9261111111111112,0.9434333333333333,0.9497444444444445,0.9183455555555555,0.975098888888889,0.9139166666666667,0.971588888888889,0.933008888888889,0.9581066666666668,0.9730455555555556,0.9984422222222222,0.8996,0.9325333333333332
|
|
@@ -7098,7 +7100,7 @@ IGKV2D-23,9.109843964285714,9.210389625,9.087270196428571,8.365920642857143,9.24
|
|
| 7098 |
IGKV2D-24,14.722038273809524,15.315149196428571,14.613988958333334,15.163242738095239,13.744427142857143,15.486634464285714,14.002069851190477,15.201741220238095,15.151141398809523,15.442024434523809,13.993539047619048,14.777754940476191,14.419504732142858,15.755719226190477,14.357854970238096,15.404221875000001,14.952970059523809,15.498324821428572,14.38007017857143,15.91608255952381,13.915143392857143,15.98186357142857,14.268703065476192,13.36704,13.646610922619047,15.71681380952381,13.896736904761905,15.071466845238096,14.090083482142857,15.089193779761905
|
| 7099 |
IGKV2D-26,18.01595277930403,18.904609228479853,18.052527928113552,17.857075476190477,18.22978262820513,18.99035798992674,17.990785391483517,18.436011879578754,18.685276206501833,17.53089480540293,17.9893139514652,18.418988424908424,18.124419608516483,18.609788887362637,18.184111852106227,19.12265982371795,18.359868598901098,18.291439935897436,18.589773965201466,18.522849372710624,18.09483026098901,19.179408456959706,18.23308294642857,18.56471333791209,17.972331169871794,18.85368065018315,18.9073623489011,19.120090064102563,18.278584553571427,18.677880107600732
|
| 7100 |
IGKV2D-28,56.423606657243084,57.01123372244259,56.5921096285316,56.61477414593413,55.81336293772894,57.88267270228138,57.067527104273175,57.669530038743936,56.964288053151094,56.363744591806885,56.03402073119528,56.42538545533878,57.507733422570894,56.78877527618786,56.66039116713679,57.79297207803634,57.335481568216096,57.76283981179931,55.86875727215758,55.634223060704,56.4446580613243,57.61757529820832,56.457490609222475,56.062184280064706,55.864117279805164,58.13738415247498,56.70039487313504,56.36126718741553,56.46791367729819,57.041856485168424
|
| 7101 |
-
IGKV2D-30,
|
| 7102 |
IGKV2D-38,1.3340249999999998,1.3701283333333334,1.3747966666666667,1.3875466666666665,1.4525249999999998,1.3374366666666668,1.4176283333333333,1.4103416666666666,1.3510866666666665,1.36588,1.4105433333333333,1.3895233333333332,1.3721683333333334,1.3574233333333332,1.3640316666666665,1.3732616666666668,1.4086716666666668,1.40113,1.3922566666666667,1.3458433333333335,1.40831,1.3866100000000001,1.3713616666666668,1.373195,1.3830433333333334,1.4012916666666666,1.3499333333333334,1.32533,1.4064699999999999,1.3569866666666668
|
| 7103 |
IGKV2D-40,3.3846666666666665,3.472633333333333,3.365766666666667,3.3877333333333333,3.3425,3.328583333333333,3.4003333333333337,3.4069333333333334,3.320653333333333,3.3521,3.3856,3.3836666666666666,3.3291,3.3539999999999996,3.4418666666666664,3.3982666666666668,3.2950233333333334,3.4111,3.429866666666667,3.4073666666666664,3.4923,3.4012333333333333,3.391966666666667,3.4448333333333334,3.385066666666667,3.3283233333333335,3.3679666666666663,3.3711333333333333,3.401566666666667,3.4156666666666666
|
| 7104 |
IGKV3-31,3.338325,3.085225,3.395575,3.347675,3.39685,3.184375,3.374525,3.281325,3.36625,3.169,3.370725,3.2428,3.446775,3.164525,3.33835,3.0891,3.41565,3.2103,3.3358,2.8796,3.369625,3.17185,3.3312,3.05995,3.373875,3.234675,3.3312,3.029275,3.3809,3.387525
|
|
@@ -7231,7 +7233,7 @@ IL36B,3.348505,2.67184,3.53748,3.381775,3.58226,2.576175,3.533965,3.17809,3.9854
|
|
| 7231 |
IL36G,5.1504,6.0705,4.108475,6.49085,3.90576,5.158,4.014105,5.20165,4.63144,4.62208,3.67051,4.49816,5.0613,5.95995,3.645265,6.11115,3.961415,5.395,4.22429,4.754825,3.175765,4.64737,3.755655,3.524995,3.85884,6.13185,3.318245,5.0641,3.97124,5.61955
|
| 7232 |
IL36RN,5.22165,3.88119,5.07445,5.3154,4.978885,4.16197,4.718075,4.778065,5.0368,3.749765,4.35618,4.041775,4.94825,3.778015,4.456115,5.1267,5.2698,4.931035,4.58029,3.89843,4.74447,3.63124,4.396555,3.55998,4.98824,5.075,3.924585,3.254545,4.23486,4.900905
|
| 7233 |
IL37,2.867265,2.92217,2.818085,2.883955,2.849185,2.82075,2.851885,2.83184,2.74706,2.86168,2.857865,3.004525,2.79051,2.821445,3.083915,2.80623,2.7031,2.93893,2.89583,2.80542,2.940765,2.770855,2.971135,2.93769,3.06386,2.856535,2.79099,2.76016,2.85844,3.194215
|
| 7234 |
-
IL4,
|
| 7235 |
IL4I1,1.2112414285714286,1.2768057142857143,1.21153,1.276882857142857,1.164794285714286,1.3199514285714287,1.1567642857142857,1.2412114285714286,1.2236157142857143,1.3337357142857142,1.1935185714285714,1.267737142857143,1.1821985714285714,1.2790942857142855,1.1672228571428571,1.2913142857142856,1.2230785714285715,1.2866771428571429,1.2060057142857143,1.3140657142857144,1.1986085714285715,1.2729300000000001,1.2154214285714284,1.2953314285714286,1.2049414285714286,1.2987471428571429,1.22623,1.3165342857142857,1.167007142857143,1.2313100000000001
|
| 7236 |
IL4R,5.1853,4.783665,5.02745,5.65665,4.8593,5.3474,4.79963,5.15155,5.323,4.96761,4.922295,5.2822,5.16285,5.084,4.917595,5.32945,5.32445,5.18445,5.053,4.594265,4.793165,5.3861,5.01045,5.25135,4.991415,5.7015,4.95942,4.72733,4.819825,5.1973
|
| 7237 |
IL5,1.949425,1.988185,1.920625,2.069825,2.01393,1.94271,2.154285,1.945005,2.08751,1.9607,2.15071,1.92599,2.020225,1.929365,2.326275,1.90434,1.882785,1.996155,2.06041,2.070255,1.9398,1.921815,2.045285,1.963645,2.04781,1.75254,2.07655,1.924845,2.01824,1.99865
|
|
@@ -8109,7 +8111,7 @@ LAMP5,3.070405,3.456465,2.89437,2.988865,2.905325,3.136235,3.099655,3.101655,3.1
|
|
| 8109 |
LAMTOR1,5.09645,5.7105,5.55605,5.6366,5.313,4.99163,5.42355,5.60145,5.4766,5.38505,5.285,5.0528,5.3961,5.405,5.2429,5.10365,5.55495,5.2384,5.1122,5.1518,5.1449,6.00045,5.15195,5.27815,5.1321,5.41115,5.21155,4.90922,5.10815,5.19735
|
| 8110 |
LAMTOR2,4.639435,4.92323,4.667985,4.74046,4.62721,4.73338,4.62199,4.88179,4.768325,4.642805,4.71434,4.69951,4.650865,4.596755,4.767785,4.91994,4.703075,4.642785,4.801,4.79632,4.669765,4.964805,4.65787,4.688785,4.555775,4.56245,4.86076,4.861365,4.69185,4.70409
|
| 8111 |
LAMTOR3,3.471766666666667,3.2214233333333335,3.4834333333333336,3.456466666666667,3.4931666666666668,3.3953,3.4675999999999996,3.3094433333333337,3.6234333333333333,3.4748,3.5751000000000004,3.4105333333333334,3.6435333333333335,3.32324,3.5565333333333338,3.502166666666667,3.579833333333333,3.252963333333333,3.5927666666666664,3.4799333333333333,3.5210333333333335,3.3260133333333335,3.427766666666667,3.319036666666667,3.5292333333333334,3.4039333333333333,3.6424333333333334,3.3588,3.5089666666666663,3.5847333333333338
|
| 8112 |
-
LAMTOR5,
|
| 8113 |
LANCL1,3.3115133333333335,3.3841,3.27136,3.079003333333333,3.30369,3.1078033333333335,3.1923133333333333,3.0545233333333335,3.4483,3.3273966666666666,3.186246666666667,3.1006666666666667,3.1623933333333336,3.4150666666666667,3.281776666666667,2.9423366666666664,3.3646,3.383766666666667,3.3906333333333336,3.5236,3.264746666666667,3.22319,3.274763333333333,3.198423333333333,3.2062866666666667,3.0686633333333333,3.5723000000000003,3.4995333333333334,3.2505333333333333,3.340066666666667
|
| 8114 |
LANCL2,2.29679,2.7659,2.2864625,2.2163425,2.285395,2.3476475,2.253825,2.272695,2.4033,2.59745,2.2740725,2.21402,2.1752325,2.47103,2.252115,2.3925075,2.4000425,2.31769,2.3317575,2.906075,2.2152375,2.2635675,2.228515,2.31922,2.20778,2.2355225,2.4245575,2.22695,2.24899,2.37043
|
| 8115 |
LANCL3,2.4270033333333334,2.1132433333333336,2.44548,2.1275133333333334,2.3693766666666667,2.0833833333333334,2.3348733333333334,2.30077,2.45052,2.471006666666667,2.27753,2.1658166666666667,2.4725966666666666,2.114196666666667,2.26476,2.1973433333333334,2.4605966666666665,2.4160666666666666,2.390006666666667,1.9730033333333334,2.4316866666666668,2.18313,2.3650100000000003,1.98543,2.2893,1.9517166666666668,2.412436666666667,2.272276666666667,2.3383133333333332,2.3653233333333334
|
|
@@ -9702,7 +9704,7 @@ MTREX,4.358685,4.41093,4.373165,4.411255,4.33363,4.18411,4.21,4.4094,4.456845,4.
|
|
| 9702 |
MTRF1,3.2557,3.706535,3.513975,3.234175,3.238895,3.518825,3.304645,3.439015,3.578935,3.288375,3.35669,3.266805,3.11451,3.37193,3.065695,4.065825,3.488985,3.34429,3.316325,3.5402,2.93725,3.65723,3.34466,3.603915,3.2465,2.627635,3.65513,3.430245,3.12594,3.277085
|
| 9703 |
MTRF1L,2.28187,2.688325,2.335495,2.853945,2.710215,3.031195,2.975095,2.902585,2.848085,2.825045,2.75306,2.33674,3.046855,2.81124,2.881705,3.417,2.54335,3.08959,2.2354,2.47136,2.69147,2.58094,3.098435,2.690355,2.09346,2.845495,2.629455,2.285555,3.16837,2.555645
|
| 9704 |
MTRFR,2.95488,3.047005,3.204825,3.05527,2.92902,3.229695,3.05907,3.14685,3.214025,3.369475,3.09699,3.1388,2.820195,3.25952,3.13079,3.114435,3.19608,3.067365,2.920055,3.305105,2.97541,3.29587,3.03742,3.231155,3.027545,3.26233,3.27136,3.512735,2.93486,3.1519
|
| 9705 |
-
MTRNR2L1,
|
| 9706 |
MTRR,4.81617,5.21735,4.64337,4.746625,4.5668,5.26085,4.47405,4.79783,4.824375,4.990715,4.444455,4.53585,4.62706,5.1682,4.42552,5.33385,4.764345,4.98803,4.439415,5.22085,4.35671,5.50485,4.28188,5.15775,4.57144,5.3393,4.76132,5.3239,4.180925,4.873335
|
| 9707 |
MTSS1,5.36515,5.3617,5.20035,5.66275,5.042,5.13705,4.952565,4.880005,5.2237,4.55868,4.97439,4.95872,5.07205,4.93417,4.93856,5.70535,5.25805,5.23925,5.2046,4.58625,4.854275,5.2451,5.31305,4.64638,5.14145,5.3503,5.1898,4.61646,5.0979,5.1653
|
| 9708 |
MTSS2,4.94426,4.854695,5.19905,4.99131,4.99295,5.02135,5.0226,4.71386,4.922545,4.957325,4.93171,5.0372,5.0326,5.023,5.0591,5.1395,5.00555,4.946715,5.0975,5.0519,5.1327,5.2819,5.03565,5.3197,5.0839,5.06025,5.2725,4.893615,5.12125,5.00875
|
|
@@ -12322,6 +12324,7 @@ PRMT9,4.10997,3.72164,3.909945,3.65143,3.925335,3.98714,3.69155,3.448535,4.26978
|
|
| 12322 |
PRND,2.833075,2.806425,2.987085,2.94591,2.785455,2.926555,2.9559,2.86961,2.839135,2.892775,3.0509,2.807595,2.694785,2.80559,2.369865,2.786345,2.845885,2.86661,2.92976,2.809505,3.00231,2.9962,2.845865,2.8636,2.73659,2.646745,2.82908,2.84196,3.03864,2.8574
|
| 12323 |
PRNP,5.70115,6.28965,5.44875,6.2552,5.30385,6.27095,5.3554,5.898,5.708,6.05265,5.4432,5.9071,5.6681,6.1265,5.3928,6.51095,5.60415,5.87885,5.67195,6.245,5.4517,5.89815,5.6491,6.057,5.564,6.5905,5.5929,6.2388,5.2497,5.9863
|
| 12324 |
PRNT,2.748241666666667,2.6606475,2.65001,2.721645,2.6289783333333334,2.75652,2.5486208333333336,2.486190833333333,2.664225,2.637364166666667,2.7004908333333333,2.6442533333333333,2.6385183333333333,2.6325700000000003,2.6164658333333333,2.7248550000000002,2.7273083333333332,2.6555341666666665,2.5965941666666668,2.7724458333333333,2.5306141666666666,2.80441,2.6504691666666664,2.6839158333333337,2.6083516666666666,2.9271416666666665,2.6769225,2.8106999999999998,2.6330358333333335,2.734776666666667
|
|
|
|
| 12325 |
PROC,3.87129,3.99069,3.83711,4.032095,3.82191,4.025855,3.79461,3.980375,3.777005,3.70971,3.877065,3.831435,3.817035,3.91623,4.04786,4.06978,3.65936,3.687085,3.927815,4.03748,3.92853,3.995075,3.844315,4.096365,3.944305,3.93808,3.853125,3.927735,3.84014,3.8697
|
| 12326 |
PROCA1,2.7414366666666665,2.55062,2.7596166666666666,2.6500833333333333,2.7005466666666664,2.6311466666666665,2.7049466666666664,2.7412266666666665,2.6441133333333333,2.6675866666666668,2.674046666666667,2.7241199999999997,2.6880966666666666,2.6087700000000003,2.75141,2.5991666666666666,2.65028,2.764863333333333,2.6629,2.55886,2.660346666666667,2.5843766666666665,2.689853333333333,2.6486566666666667,2.69562,2.5969366666666667,2.6147933333333335,2.5334266666666667,2.678433333333333,2.66929
|
| 12327 |
PROCR,3.731865,4.639915,3.649725,4.021675,3.721635,4.44978,3.738925,4.023985,3.75335,4.02499,3.690335,3.98801,3.783225,3.80314,3.77596,4.481515,3.7671,4.81553,3.77158,3.884265,3.87238,4.05682,3.76569,4.52104,3.793275,3.95547,3.83402,4.09108,3.83182,3.96756
|
|
@@ -12484,7 +12487,7 @@ PSMD13,4.677635,4.675165,4.59675,4.689005,4.49449,4.72128,4.445675,4.503955,4.74
|
|
| 12484 |
PSMD14,2.6025,2.53265,2.45484,2.60415,2.4292025,2.518275,2.41406,2.42522,2.603925,2.611125,2.4755375,2.527975,2.565275,2.648375,2.47614,2.90105,2.55535,2.578925,2.563,2.700675,2.4539075,2.72785,2.4451075,2.7182,2.546375,2.712575,2.58335,2.83685,2.417565,2.69585
|
| 12485 |
PSMD2,5.41505,5.49355,5.2464,5.81375,5.29135,5.6356,5.27995,5.41345,5.40115,5.24695,5.3999,5.60255,5.6351,6.01055,5.259,5.85325,5.4292,5.45805,5.3315,5.64455,5.16245,5.8526,5.201,5.82025,5.2386,5.7743,5.2829,6.09965,5.12535,5.42395
|
| 12486 |
PSMD3,5.3699,5.61325,5.3778,5.5129,5.25115,5.83385,5.23595,5.48615,5.41595,5.58735,5.28175,5.5291,5.43355,6.00345,5.19755,5.6062,5.4686,5.4797,5.30165,5.5451,5.25065,5.96645,5.3925,5.59595,5.2618,5.46245,5.35005,5.8307,5.1553,5.51415
|
| 12487 |
-
PSMD4,
|
| 12488 |
PSMD5,5.1785,5.09185,5.05305,4.75573,4.915675,5.14965,4.76725,4.99373,5.24875,4.783075,4.984985,4.99692,4.946465,4.859675,4.789185,5.23965,5.196,5.24805,4.873955,5.206,4.726545,5.00325,4.988145,5.2107,4.98832,5.31375,5.13195,5.0186,4.88314,5.0455
|
| 12489 |
PSMD6,6.159159166666667,5.518034166666666,5.871605833333334,5.670170000000001,5.951785833333334,5.624180833333334,5.918584166666667,5.85717,6.3373525,5.9850683333333325,5.950537499999999,5.558449166666667,5.8221475,5.763065,5.745119166666667,6.067354999999999,6.011796666666667,5.940345833333334,6.074183333333333,6.046335,6.1519525,5.91067,5.9027875000000005,5.7187141666666665,5.866265833333333,5.6454450000000005,6.156757499999999,6.03685,5.8560324999999995,5.862695
|
| 12490 |
PSMD7,5.6707,5.6595,5.46335,5.50465,5.50575,5.739,5.42395,5.5453,5.631,5.94275,5.63245,5.62565,5.4703,5.51095,5.6707,6.2133,5.6303,5.53595,5.75565,5.8265,5.70195,6.2368,5.7629,5.8538,5.53615,5.95655,5.7897,5.5148,5.69175,5.65005
|
|
@@ -13324,6 +13327,7 @@ RNPC3,2.2161408333333337,2.1387525000000003,2.2425499999999996,2.165739166666666
|
|
| 13324 |
RNPEP,5.46495,5.2897,5.7568,5.2487,5.59085,5.48115,5.5612,5.55715,5.62235,5.3868,5.48095,5.2704,5.5141,5.44465,5.37385,5.45805,5.65025,5.33265,5.3837,5.2162,5.416,5.407,5.43815,5.14445,5.3992,5.145,5.5913,5.42845,5.58855,5.55305
|
| 13325 |
RNPEPL1,5.14355,4.85278,5.27705,5.1429,5.26825,5.0267,5.265,5.04905,5.2311,4.9659,5.2011,4.957555,5.22425,4.905405,5.2141,4.83557,5.2887,5.1311,5.18625,5.27035,5.26585,5.148,5.1283,5.07955,5.2592,4.89874,5.23335,5.04245,5.31255,5.1714
|
| 13326 |
RNPS1,3.8609299999999998,3.9606624999999998,3.9908825,4.066262500000001,3.8293600000000003,4.260384999999999,3.718705,3.8919675,4.1816475,4.3862725,3.792735,3.9483675000000003,3.703175,3.999905,3.6230824999999998,4.265969999999999,4.0546875,4.0846975,3.997175,4.441905,3.3966575,4.110469999999999,3.6841725000000003,4.00983,3.6910175,4.0593,3.8792524999999998,4.08198,3.64725,3.8716150000000003
|
|
|
|
| 13327 |
RNU1-1,3.2092533333333333,3.294363333333333,3.2016899999999997,3.2579533333333335,3.171193333333333,3.29754,3.15817,3.2431666666666668,3.1548133333333332,3.302046666666667,3.1729000000000003,3.3505000000000003,3.1603733333333337,3.31652,3.1988233333333334,3.3920666666666666,3.1856033333333333,3.238023333333333,3.259593333333333,3.4431,3.19313,3.306236666666667,3.174656666666667,3.3517333333333332,3.2276433333333334,3.2128366666666666,3.31053,3.3645333333333336,3.1511266666666664,3.2661033333333336
|
| 13328 |
RNU11,5.678605833333334,5.709906666666667,5.5954775,5.59758,5.406257500000001,5.63757,5.386194166666667,5.704666666666666,5.7729025,6.011525000000001,5.663470833333333,5.781365,5.545636666666667,5.724796666666666,5.2993175,5.900318333333333,5.614860833333333,5.4559125,5.453860833333334,6.092619999999999,5.326714166666666,5.890065,5.520930833333334,5.7041458333333335,5.171871666666666,5.713425833333334,5.765091666666667,5.877646666666667,5.538296666666667,5.8901625
|
| 13329 |
RNU12-2P,5.678605833333334,5.709906666666667,5.5954775,5.59758,5.406257500000001,5.63757,5.386194166666667,5.704666666666666,5.7729025,6.011525000000001,5.663470833333333,5.781365,5.545636666666667,5.724796666666666,5.2993175,5.900318333333333,5.614860833333333,5.4559125,5.453860833333334,6.092619999999999,5.326714166666666,5.890065,5.520930833333334,5.7041458333333335,5.171871666666666,5.713425833333334,5.765091666666667,5.877646666666667,5.538296666666667,5.8901625
|
|
@@ -13462,7 +13466,7 @@ RPS18,1.952102,1.957958,1.964806,1.996686,1.96889,1.9271280000000002,1.909298000
|
|
| 13462 |
RPS18P9,1.952102,1.957958,1.964806,1.996686,1.96889,1.9271280000000002,1.9092980000000002,1.973638,1.985592,1.917192,1.956314,1.9146640000000001,1.938476,1.9460000000000002,1.9656600000000002,1.9142219999999999,1.98366,1.9760300000000002,1.973742,1.9566880000000002,1.9514479999999998,1.9545480000000002,1.9061800000000002,1.999428,1.9467780000000001,1.9175280000000001,2.0442799999999997,1.9619039999999999,1.943336,1.9469699999999999
|
| 13463 |
RPS19,7.6636050000000004,7.121848333333333,7.45002,7.455326666666667,7.527995,6.886003333333333,7.23215,7.584043333333333,7.40456,7.428331666666667,7.33474,7.327398333333333,6.796925,7.31665,7.575388333333334,7.48085,7.298246666666667,7.064361666666667,7.362451666666667,7.010556666666666,7.78312,7.467141666666667,7.042423333333334,7.3226466666666665,7.114958333333334,6.933776666666667,6.993195,7.1071599999999995,6.932548333333333,7.513303333333333
|
| 13464 |
RPS19BP1,3.1480633333333334,3.2070333333333334,3.099906666666667,3.266306666666667,3.0851433333333333,3.13116,3.1171966666666666,3.184893333333333,3.152003333333333,3.18037,3.172093333333333,3.130186666666667,3.13487,3.322896666666667,3.1962333333333333,3.2940466666666666,3.182096666666667,3.0885599999999998,3.21259,3.1380966666666663,3.157383333333333,3.4116999999999997,3.2759466666666666,3.14795,3.0599333333333334,3.0741300000000003,3.159243333333333,3.12918,3.0861133333333335,3.2543466666666667
|
| 13465 |
-
RPS2,5.
|
| 13466 |
RPS20,3.4009850000000004,3.5628516666666665,3.428773333333333,3.5341966666666664,3.3115500000000004,3.544391666666667,3.4127433333333332,3.3836549999999996,3.429108333333333,3.496478333333333,3.4559450000000003,3.47807,3.34598,3.5534383333333337,3.4600633333333333,3.4904116666666667,3.406185,3.4157800000000003,3.4644049999999997,3.5622233333333333,3.357945,3.4937683333333336,3.42367,3.5794266666666665,3.4046133333333333,3.3455883333333336,3.4706550000000003,3.321405,3.3047933333333335,3.377796666666667
|
| 13467 |
RPS20P27,1.7389299999999999,1.8287833333333332,1.7727466666666667,1.8689133333333334,1.70454,1.8065033333333333,1.7496866666666666,1.69715,1.7841766666666665,1.9173166666666666,1.8069300000000001,1.7617,1.75636,1.8801166666666667,1.8001666666666667,1.8151433333333333,1.78585,1.83716,1.88849,1.9381266666666666,1.78745,1.8449766666666667,1.70854,1.9184133333333333,1.8190266666666668,1.8082166666666666,1.88863,1.7908099999999998,1.7069466666666668,1.7467933333333334
|
| 13468 |
RPS21,2.7497390476190477,2.8643076190476187,2.805715238095238,2.7427238095238096,2.6993252380952377,2.678315238095238,2.6666535714285713,2.7358657142857146,2.783404285714286,2.8426414285714285,2.6871823809523807,2.7554847619047624,2.7498142857142858,2.874892380952381,2.59254,2.834674761904762,2.8054066666666664,2.761729523809524,2.8632995238095242,2.8638209523809524,2.581925,2.7521257142857145,2.55206,2.7827776190476188,2.6178933333333334,2.921690952380952,2.7152904761904764,2.8030914285714283,2.595255238095238,2.674609523809524
|
|
@@ -16615,7 +16619,8 @@ TREML5P,0.617092,0.650766,0.633196,0.6207779999999999,0.619531,0.531487,0.645695
|
|
| 16615 |
TRERF1,8.155345,7.645054999999999,7.710139999999999,7.535119999999999,8.42146,8.34437,8.165715,7.896625,8.558495,8.582995,8.299745000000001,7.865460000000001,7.66084,7.041,8.360330000000001,7.9605250000000005,8.524415000000001,7.872345000000001,8.85366,8.556035,8.177655,8.623194999999999,8.253615,8.759905,8.497135,7.775895,9.031965,8.807485,8.39767,7.6373299999999995
|
| 16616 |
TREX1,1.564654,1.600524,1.589142,1.612724,1.596918,1.592274,1.585382,1.597574,1.617298,1.597642,1.543366,1.4993159999999999,1.56549,1.588288,1.612066,1.647898,1.59299,1.601228,1.60883,1.6101400000000001,1.574706,1.60655,1.5916679999999999,1.6163440000000002,1.586208,1.583832,1.6185199999999997,1.6006360000000002,1.599256,1.5841939999999999
|
| 16617 |
TREX2,0.7308981818181818,0.7445209090909092,0.7402527272727273,0.7929245454545455,0.70843,0.7964936363636365,0.7268609090909091,0.7509690909090909,0.7436309090909091,0.7582336363636363,0.7305472727272728,0.7487881818181819,0.7332418181818181,0.7475272727272727,0.725239090909091,0.78067,0.7474445454545454,0.7711372727272727,0.7294927272727272,0.7367818181818181,0.7169972727272728,0.7420763636363635,0.7286845454545454,0.7978181818181818,0.7363672727272728,0.7564927272727272,0.7261772727272727,0.7295336363636363,0.7341627272727272,0.7257981818181819
|
| 16618 |
-
|
|
|
|
| 16619 |
TRGC2,1.902695111111111,1.7552217777777779,1.942818888888889,1.7632564444444445,1.9178051111111112,1.7416153333333333,1.812846,1.9418562222222224,1.8862306666666666,1.7682408888888888,1.8869551111111111,1.819424,1.802813111111111,1.8095577777777776,1.9154504444444447,1.781872888888889,1.871788,1.8392591111111112,1.783244888888889,1.758105111111111,1.8690204444444443,1.8372928888888889,1.8236451111111112,1.8163355555555554,1.8572884444444444,2.036791555555556,1.93415,1.7417951111111112,1.8882526666666668,1.8162806666666667
|
| 16620 |
TRGV11,0.6978711111111111,0.6540277777777779,0.6695888888888889,0.6653044444444444,0.6869211111111111,0.6349233333333334,0.64247,0.7014922222222223,0.6555566666666667,0.6403288888888888,0.6908911111111111,0.65253,0.6509411111111111,0.6751777777777778,0.6922544444444445,0.6413588888888889,0.65986,0.6623511111111111,0.6571988888888889,0.5998411111111112,0.6647744444444444,0.6707988888888888,0.6618111111111111,0.6705055555555556,0.6719644444444444,0.7353155555555556,0.66828,0.6028911111111112,0.6744666666666667,0.6458766666666667
|
| 16621 |
TRGV3,3.14869,2.8815925,2.946225,2.7639924999999996,2.96983,3.041735,2.9285975,3.099065,3.200115,3.2084775,3.1533925,2.87775,2.6973525,2.6892475,2.9450475,3.003815,3.041725,3.0449675000000003,2.9394575,3.1838825,2.8718125,2.9619275,2.97898,2.6886225,3.0569775,2.90825,3.0624425,2.72688,3.0280175,3.0275499999999997
|
|
@@ -17633,7 +17638,7 @@ YBX3,4.558333333333334,4.4910000000000005,4.650066666666667,4.732366666666667,4.
|
|
| 17633 |
YBX3P1,4.558333333333334,4.4910000000000005,4.650066666666667,4.732366666666667,4.5402,4.468966666666667,4.578366666666667,4.563733333333333,4.621066666666667,4.7215,4.606466666666667,4.5244333333333335,4.609566666666667,4.673,4.5748,4.469433333333334,4.648433333333333,4.573933333333334,4.5517666666666665,4.492366666666666,4.471633333333333,4.498833333333333,4.5774333333333335,4.707933333333333,4.4831666666666665,4.570566666666667,4.5214,4.308466666666667,4.6108,4.533166666666667
|
| 17634 |
YEATS2,3.086016666666667,3.5121333333333333,3.082076666666667,3.5239333333333334,2.9792666666666663,3.3706,3.0034733333333334,3.0218133333333337,3.1379900000000003,3.1764666666666668,3.0112400000000004,3.3369666666666666,3.1932266666666664,3.8335000000000004,2.9514899999999997,3.5213,3.1585300000000003,3.4347666666666665,3.028723333333333,3.560033333333333,2.9543633333333332,3.389466666666667,3.023903333333333,3.490133333333333,3.1231166666666668,3.5056,3.11895,3.690633333333333,2.8622533333333333,3.2187133333333335
|
| 17635 |
YEATS4,2.810636666666667,3.1374999999999997,2.82465,2.7925133333333334,2.7023266666666665,3.0602966666666664,2.53832,2.7831333333333332,3.0812633333333337,3.183733333333333,2.743126666666667,2.9571066666666668,2.53236,2.989036666666667,2.85551,3.082686666666667,2.8530033333333336,2.88205,2.8681300000000003,3.2291233333333333,2.71381,3.245433333333333,2.7841466666666665,3.14061,2.73175,2.9105600000000003,2.9547933333333334,3.24842,2.753213333333333,2.966396666666667
|
| 17636 |
-
YES1,3.
|
| 17637 |
YIF1A,4.91462,5.07335,4.905475,5.6345,4.70928,4.924405,4.828665,5.1725,4.964025,5.21535,4.72085,5.125,4.82797,4.98524,4.86551,5.1702,4.92208,4.90122,4.939525,4.87221,4.847695,5.28955,4.94891,5.30585,4.97468,5.35095,5.04455,4.91716,4.84349,5.01675
|
| 17638 |
YIF1B,9.7531,9.85324,9.783395,10.1130475,9.545815,9.46011,9.7991025,9.915992500000002,9.715285000000002,9.04843,9.732420000000001,9.7422675,9.8725875,9.3496225,9.795277500000001,9.4989225,9.79166,9.8309675,9.52915,9.498625,9.7150675,9.691815,9.839329999999999,9.5650725,9.5406975,9.7698325,9.677335,9.331822500000001,9.7026775,9.7032025
|
| 17639 |
YIPF1,4.240655,4.04969,4.2606,4.246555,4.356325,4.35324,4.132145,4.175075,4.555835,4.36505,4.22527,4.0106,4.3851,4.119965,4.25452,4.60271,4.49865,4.312545,4.219365,4.317215,4.170155,4.535835,4.22816,4.309205,4.13395,4.050955,4.438495,4.333365,4.37496,4.57249
|
|
|
|
| 461 |
AHCYL1,5.7803,5.4641,5.4835,5.51,5.5091,5.62625,5.4519,5.6326,5.8471,5.6502,5.6218,5.6228,5.7352,5.7495,5.47605,5.6094,5.77815,5.8317,5.58645,5.5269,5.4081,5.7052,5.45775,5.4246,5.56175,5.47435,5.61815,5.65105,5.4739,5.6579
|
| 462 |
AHCYL2,4.834515,4.56766,4.98435,4.748085,4.920295,4.69793,4.81372,4.64787,4.95798,4.6921,4.799905,4.635465,4.71589,5.44615,4.72228,4.420855,4.89727,4.728305,4.920145,4.86875,4.629525,5.35515,4.762875,3.909205,4.83494,4.83391,5.1508,4.73828,4.751845,4.91733
|
| 463 |
AHDC1,3.3509333333333333,3.2579166666666666,3.4340333333333333,3.1352499999999996,3.352233333333333,3.036096666666667,3.3379999999999996,3.1534600000000004,3.3633666666666664,3.0688,3.2693266666666667,3.118736666666667,3.4543666666666666,3.2220133333333334,3.347933333333333,3.20064,3.5132333333333334,3.25544,3.286326666666667,3.0949733333333334,3.410966666666667,3.0397133333333333,3.2950733333333333,2.9617233333333335,3.4095666666666666,3.107666666666667,3.3535,3.304733333333333,3.2702333333333335,3.063696666666667
|
| 464 |
+
AHI1,3.0446125,3.229635,3.132086,3.0412485,3.0088615,3.1162039999999998,3.1444384999999997,3.0579035,3.1334655,3.293788,3.083642,3.14917,3.1024000000000003,3.1925464999999997,2.9320125,3.291507,3.052683,3.1795195,3.069928,3.084971,3.228033,2.9965905,2.8156705,2.9638945000000003,3.146721,3.5031185000000002,3.1475920000000004,3.3712875,3.094125,3.254849
|
| 465 |
AHNAK,6.812474999999999,6.735266666666667,6.734958333333333,6.490225000000001,6.8867416666666665,6.0604,6.640733333333333,6.509075,6.607258333333333,5.565366666666667,6.772016666666666,6.253208333333333,6.656125,5.804129166666667,6.502583333333334,6.256408333333333,6.778091666666667,6.566583333333333,6.788600000000001,5.8367483333333325,6.573766666666667,5.931665000000001,6.772966666666667,6.164483333333333,6.444333333333333,6.360025,6.817475,6.216575000000001,6.636383333333333,6.30955
|
| 466 |
AHNAK2,3.8966999999999996,3.978566666666667,3.8694333333333333,3.7386,3.9383666666666666,3.4644,3.6924333333333332,3.6844,3.7202333333333333,3.0408666666666666,3.8016666666666663,3.4946333333333333,3.7804,3.3636666666666666,3.5906333333333333,3.6087333333333333,3.8716666666666666,3.945733333333333,3.7918000000000003,3.289073333333333,3.6444666666666667,3.32504,3.8195666666666668,3.5352333333333337,3.6872333333333334,3.8979,3.8527,3.6704000000000003,3.713433333333333,3.6245999999999996
|
| 467 |
AHR,5.07085,5.9695,4.895925,5.2576,4.994915,5.8921,4.79774,5.1719,5.23745,5.21055,4.962915,5.02945,4.929345,5.4035,4.74796,5.8616,5.0655,5.3356,4.939455,5.83575,4.77985,5.8285,4.60302,5.1215,4.952175,5.82015,5.21785,5.7226,4.48685,5.29475
|
|
|
|
| 1414 |
BBS4,3.32717,3.595865,3.51107,3.55417,3.21578,3.585475,3.277595,3.65976,3.826785,3.57884,3.387885,3.5749,3.30977,3.960085,3.33246,4.173595,3.76894,3.77128,3.39844,4.182245,3.263815,3.69268,3.45609,3.85815,3.293395,3.624645,3.797855,3.52018,3.23481,3.49462
|
| 1415 |
BBS5,4.984033999999999,4.949167428571428,5.073238714285714,5.008300428571429,4.956804571428572,5.019393,4.791174428571429,4.739202857142857,5.3838919999999995,5.113818,4.903515571428571,5.0120641428571435,4.856042,5.245343714285714,4.921110285714286,5.024544000000001,5.189010857142857,5.170905714285714,5.069401571428571,5.487235714285714,4.752165142857143,5.052059,4.915073714285715,5.087361714285715,5.079292571428572,4.643571142857143,5.291227428571428,5.413462714285714,4.744874428571428,5.129437
|
| 1416 |
BBS7,3.50519,3.868515,3.50823,3.696555,3.374355,3.691015,3.32986,3.15787,3.827245,3.56065,3.2406,3.37779,3.562255,3.87161,3.199585,3.97327,3.630395,3.560795,3.330825,3.87197,3.233955,3.557765,3.21287,3.54692,3.475565,3.84934,3.66938,3.778075,3.10369,3.718665
|
| 1417 |
+
BBS9,17.544880714285714,18.51793555952381,17.75282488095238,18.021905678571425,17.67402869047619,18.510610452380952,17.795486928571428,18.28704655952381,18.17051719047619,18.947874369047618,17.768321928571428,17.91387757142857,17.747563714285715,18.088645380952382,17.613282416666667,18.275403428571426,17.755614595238093,18.480790821428574,17.83373619047619,18.530436773809523,17.563243226190476,18.554026714285712,17.63495794047619,18.086139273809522,17.575120845238096,18.510641023809523,18.155350357142854,18.860063523809526,17.51114,18.416048297619046
|
| 1418 |
BBX,1.116385,1.24652375,1.1067475,1.199545,1.0762725,1.283,1.05016875,1.04952125,1.19734625,1.24470875,1.095505,1.1514075,1.1166875,1.16623125,1.063555,1.18081625,1.15012875,1.18698,1.113605,1.2383475,1.02787875,1.17839875,1.0328975,1.254675,1.114255,1.2381925,1.19389,1.3546,1.03745375,1.15190625
|
| 1419 |
BCAM,4.2788,4.689985,4.2484,4.351565,4.13221,4.944435,4.17768,4.477085,4.22285,4.336655,4.25352,4.484815,4.36575,5.19935,4.437825,4.880675,4.443545,4.518035,4.30309,5.6972,4.32711,4.709505,4.34973,4.97559,4.23464,5.0092,4.251115,4.99019,4.322355,4.756835
|
| 1420 |
BCAN,0.8579411111111112,0.8518444444444444,0.854991111111111,0.87356,0.8787977777777778,0.8390866666666666,0.8694144444444444,0.883,0.8387344444444444,0.8401377777777778,0.8695422222222222,0.8533133333333334,0.8637844444444445,0.8492455555555556,0.8708911111111112,0.8294477777777778,0.8399222222222222,0.8469655555555556,0.8533822222222223,0.8406211111111112,0.8740955555555555,0.8632611111111111,0.8659466666666666,0.8622011111111111,0.8492177777777778,0.8276044444444444,0.8521344444444444,0.81511,0.8756133333333334,0.8564422222222222
|
|
|
|
| 1625 |
BRWD3,3.1284500000000004,2.8499533333333336,3.09305,2.70602,3.069706666666667,3.0040999999999998,2.8734033333333335,2.7077233333333335,3.1881233333333334,2.91365,3.0444766666666667,2.9611466666666666,3.1290533333333332,2.9044166666666666,2.91637,2.7490433333333333,3.215116666666667,2.9766399999999997,2.96939,2.67559,2.94994,1.9592566666666666,3.1125966666666667,2.77167,3.0121866666666666,2.9153300000000004,3.15126,3.0911000000000004,2.9665733333333333,2.9903166666666667
|
| 1626 |
BSCL2,3.9172200000000004,3.7453779999999997,4.036259333333334,3.982861333333333,3.919623333333333,3.909112,4.032792,3.98991,3.9299773333333334,4.007014,3.9688713333333334,3.763038,3.9251813333333336,3.9225906666666672,3.932444,3.977926666666667,4.010820666666667,3.8172613333333336,3.8275346666666668,3.9044706666666666,3.9113246666666672,4.11712,3.9288213333333335,3.4755986666666665,3.7162919999999997,3.4380006666666665,3.8451113333333335,3.6916219999999997,4.012476,3.9043593333333333
|
| 1627 |
BSDC1,2.96415,2.945456666666667,3.0747533333333332,3.026313333333333,3.0412966666666663,3.02122,3.01676,2.990873333333333,3.0748433333333334,3.0321266666666666,2.9581666666666666,2.8737366666666664,3.08817,3.1934466666666665,2.96754,3.074666666666667,3.08388,3.1108100000000003,2.9865399999999998,3.00255,2.9730399999999997,3.0751633333333337,2.9412933333333338,2.9326133333333337,2.9419299999999997,3.012003333333333,3.05801,3.106203333333333,2.92911,3.0488
|
| 1628 |
+
BSG,7.432639166666666,7.557567083333334,7.4658958333333345,7.579637916666666,7.385345833333333,8.004683333333332,7.596375416666667,7.732619166666666,7.4963879166666665,7.628069166666666,7.4366325,7.476268750000001,7.6177858333333335,7.889622083333334,7.410945,7.63733125,7.533872499999999,7.697964166666667,7.677428333333333,7.914161666666667,7.262655833333333,8.019309166666666,7.491910833333334,7.8370854166666675,7.573845416666667,7.654476666666666,7.793173333333334,7.626831666666667,7.52603375,7.518687916666666
|
| 1629 |
BSN,3.653715,3.598245,3.65109,3.68642,3.721585,3.510115,3.78692,3.71179,3.57014,3.633765,3.72618,3.55043,3.715945,3.625585,3.691475,3.516675,3.586485,3.6195,3.610225,3.54045,3.675675,3.679385,3.632055,3.596155,3.757765,3.582405,3.539515,3.51473,3.693535,3.57368
|
| 1630 |
BSND,3.479645,3.219265,3.296145,3.487925,3.4001,3.359655,3.38245,3.36531,3.36321,3.34917,3.506745,3.3181,3.416765,3.36694,3.280885,3.239815,3.19796,3.494055,3.248375,3.229385,3.330095,3.35064,3.344825,3.33927,3.49841,3.307295,3.281425,3.02741,3.29774,3.269445
|
| 1631 |
BSPRY,2.43489,1.87736,2.4616325,2.23845,2.44376,2.15274,2.503125,2.368235,2.44908,2.009945,2.4974825,2.3087425,2.57415,2.129455,2.4353075,2.2209875,2.39957,2.2205275,2.4324525,1.930535,2.4735575,2.21442,2.37176,1.9095325,2.389595,2.20436,2.39842,2.146575,2.4406625,2.3496425
|
|
|
|
| 3594 |
CYBRD1,4.897655,5.51395,4.45326,3.941125,4.57498,4.98926,4.692635,5.04635,5.0692,4.83144,4.499475,4.78217,4.35944,5.27175,4.725235,5.321,5.02195,5.56595,5.23945,5.59675,4.891965,5.2684,4.754805,5.39505,4.633835,5.20365,5.03285,5.7331,4.618985,5.33055
|
| 3595 |
CYC1,5.34005,5.65415,5.26015,5.36045,5.19715,5.4586,5.3079,5.4236,5.40105,5.5241,5.34485,5.27965,5.31105,5.5457,5.3599,5.52115,5.3984,5.43315,5.433,5.61565,5.34355,5.81565,5.2017,5.6586,5.31885,5.5002,5.54435,5.2774,5.30865,5.34725
|
| 3596 |
CYCS,4.01404,4.03255,3.912695,4.073705,3.907845,3.964345,3.75909,4.04073,4.057485,4.195315,3.87324,3.944935,4.003415,4.020345,4.16122,4.418765,3.851355,3.95142,4.08878,4.336555,4.067065,4.199775,3.485285,4.1855,3.860285,4.02134,4.049285,4.092315,3.97505,4.141155
|
| 3597 |
+
CYCSP52,3.148945,2.85705,2.707335,3.075595,3.05974,2.92649,2.30245,3.14858,3.03571,3.078325,3.043825,2.983845,2.958015,2.880095,2.55918,3.129075,3.06067,3.279345,2.95068,3.138465,2.8442,2.677395,2.89648,2.93885,2.645745,3.06603,2.72648,3.20864,2.86307,2.891905
|
| 3598 |
CYFIP1,3.4356333333333335,3.5414333333333334,3.635666666666667,3.4992,3.4629666666666665,3.284413333333333,3.4364000000000003,3.3299533333333335,3.4506666666666668,3.2689866666666667,3.462666666666667,3.3548333333333336,3.4319666666666664,3.3187166666666665,3.287186666666667,3.28197,3.5436333333333336,3.5038666666666667,3.3560666666666665,3.3502333333333336,3.311436666666667,3.1293133333333336,3.3491,3.3843,3.3541666666666665,3.3229366666666666,3.4373666666666662,3.3108833333333334,3.4244,3.378766666666667
|
| 3599 |
CYFIP2,2.8339266666666667,2.7094,2.65188,2.7581233333333333,2.61891,2.91708,2.65203,2.8133666666666666,2.9671299999999996,2.865083333333333,2.7042266666666666,2.8234766666666666,2.7633799999999997,3.1820500000000003,2.6724266666666665,2.6044033333333334,2.8333399999999997,2.90817,2.6280566666666667,2.8404433333333334,2.6325066666666666,2.53592,2.5602266666666664,2.54352,2.6939266666666666,2.8914500000000003,2.863566666666667,3.1500033333333337,2.60264,2.9961300000000004
|
| 3600 |
CYGB,2.0191475,2.114405,2.0006025,2.055275,1.96757,2.3244925,1.9925825,2.1050125,1.9658875,2.1190575,1.9923225,2.179615,2.033375,2.235445,1.9954275,2.235705,2.0409775,2.283165,2.01737,2.31124,1.9768525,2.1454425,2.034625,2.2294375,2.062185,2.3913975,1.907445,2.2325025,2.1266625,2.192175
|
|
|
|
| 4138 |
DNER,2.10804,2.411,2.0889666666666664,2.6368966666666664,2.15504,2.0738266666666667,2.1473833333333334,2.0815433333333333,2.0647733333333336,2.1259566666666667,2.0978333333333334,2.05769,2.0921,2.1280033333333335,2.2512466666666664,2.0978666666666665,2.0585566666666666,2.104976666666667,2.1917066666666667,2.1304333333333334,2.128366666666667,2.1435866666666668,2.1237533333333336,2.268686666666667,2.18123,2.44495,2.1095466666666667,2.046933333333333,2.17389,2.3726233333333333
|
| 4139 |
DNHD1,5.570978333333334,5.535575,5.553979999999999,5.575073333333333,5.492495,5.620923333333334,5.441355,5.6564483333333335,5.514191666666667,5.5251850000000005,5.536851666666667,5.497156666666666,5.449526666666666,5.531408333333333,5.500123333333333,5.611378333333333,5.530173333333333,5.500476666666667,5.525116666666667,5.486513333333333,5.464585,5.424015,5.5963683333333325,5.571213333333333,5.580348333333333,5.4513766666666665,5.541948333333333,5.744845,5.397065,5.48984
|
| 4140 |
DNLZ,1.6621479999999997,1.632732,1.6876460000000002,1.6960760000000001,1.65018,1.661028,1.701076,1.7024260000000002,1.6589099999999999,1.6129419999999999,1.659046,1.684206,1.661456,1.6542439999999998,1.68983,1.6532240000000002,1.6402899999999998,1.623836,1.6439039999999998,1.6262260000000002,1.6570799999999999,1.6404900000000002,1.6180879999999997,1.695138,1.626624,1.6095479999999998,1.681608,1.6110900000000001,1.681646,1.656164
|
| 4141 |
+
DNM1,5.861057166666667,5.903271333333333,5.855562333333333,5.7141658333333325,5.717154833333334,5.5957555,5.496977333333334,5.61415,5.873973666666666,5.917597166666667,5.771636166666666,5.622061666666667,5.797648166666667,5.9161918333333325,5.851554666666667,6.256483666666667,5.635920666666666,5.411623666666666,5.613731666666666,6.3452649999999995,5.9832695,6.087736666666667,5.913207666666667,6.112576666666667,5.8813525,5.773553166666667,5.883448,6.0216631666666665,5.666596,5.774119
|
| 4142 |
DNM1L,0.6679215384615385,0.7541076923076923,0.6320538461538461,0.7465723076923076,0.6787500000000001,0.6979330769230769,0.6637523076923078,0.7001953846153846,0.6794507692307692,0.7263130769230769,0.6718969230769231,0.70969,0.6338576923076923,0.7211469230769231,0.6804146153846153,0.6912492307692308,0.6760346153846153,0.6889069230769231,0.6829430769230769,0.7020846153846154,0.61044,0.6867346153846154,0.6704492307692308,0.766573076923077,0.6579569230769231,0.7489584615384615,0.678703076923077,0.7329353846153845,0.6581715384615384,0.6759338461538462
|
| 4143 |
DNM1P41,3.389666666666667,3.146183333333333,3.3215833333333333,3.177633333333333,3.2541733333333336,3.12899,3.0933433333333333,3.0225500000000003,3.4400666666666666,3.426266666666667,3.2731866666666662,3.1017266666666665,3.278586666666667,3.3456333333333332,3.3095966666666663,3.523066666666667,3.2143466666666662,2.8676066666666666,3.0103266666666664,3.5757,3.3629,3.424466666666667,3.3683666666666667,3.422166666666667,3.3722,3.1752266666666666,3.3897999999999997,3.3790666666666667,3.2044200000000003,3.3294099999999998
|
| 4144 |
DNM1P46,4.21738,4.116615,3.732755,4.09715,4.17362,4.08201,4.27354,4.308365,3.78931,4.063585,4.338365,4.419035,4.205545,4.143045,4.195095,3.997925,4.11724,4.15216,4.168615,4.02523,4.03649,4.02994,4.13443,4.0906,3.70615,3.767535,4.055475,3.841615,4.39043,4.103045
|
|
|
|
| 4763 |
ERRFI1,3.21997,3.9414,3.230613333333333,3.6514666666666664,3.2191466666666666,3.4639333333333333,3.308483333333333,3.1311,3.2834800000000004,3.5465999999999998,3.151813333333333,3.28258,3.4747,3.3795333333333333,2.9230033333333334,3.541533333333333,3.309673333333333,3.4534000000000002,3.0025633333333333,3.1454166666666663,2.95658,3.294373333333333,3.0256900000000004,3.751633333333333,3.2678766666666665,3.5280666666666662,2.9771033333333334,3.3281166666666664,2.941876666666667,3.4164333333333334
|
| 4764 |
ERV3-1,1.834745,1.189485,2.2313625,1.592175,2.3740575,2.0343825,2.1710075,1.8701775,2.30142,1.98083,2.02568,1.959055,2.2669475,1.7238175,1.5167,1.590945,2.3758,1.94907,1.47412,1.8637675,1.79506,1.621145,1.93144,1.2623,2.0122775,1.743645,2.0350425,2.0951525,1.72543,2.0296825
|
| 4765 |
ERVFRD-1,2.24756,2.2367666666666666,2.2195833333333335,2.2368799999999998,2.26351,2.1113066666666667,2.2502299999999997,2.210923333333333,2.20668,2.2583333333333333,2.2772966666666665,2.2175266666666666,2.2409399999999997,2.1907466666666666,2.313353333333333,2.1815166666666665,2.192126666666667,2.1716866666666665,2.2811566666666665,2.13813,2.326566666666667,2.3955766666666665,2.2228233333333334,2.2726866666666665,2.25315,2.1400166666666665,2.2119866666666668,2.18044,2.414286666666667,2.2832233333333334
|
| 4766 |
+
ERVK-19,15.16721348193473,14.545330463869465,15.268846033799532,14.99033270862471,15.09722818065268,14.85666561013986,15.2603640011655,14.978768416666666,15.202911757575757,14.8142000990676,15.08641062121212,14.729088663170163,15.138608469114219,14.691103614219113,15.207032337412587,14.71784808100233,15.096986847319348,14.758084696969696,15.028029183566433,14.556600703962705,15.247940816433566,14.672685330419581,15.196711634032635,14.853242883449884,15.086429072843822,14.58916166083916,14.7271035,14.492618388694638,15.238710229603731,15.010850206876457
|
| 4767 |
+
ERVK3-2,0.5589681818181819,0.5200363636363636,0.5478372727272727,0.5414645454545455,0.5804381818181819,0.5261481818181818,0.6084581818181818,0.54349,0.5156881818181819,0.5350854545454545,0.5826909090909091,0.5497754545454545,0.5525281818181819,0.5375518181818182,0.5510936363636364,0.5398336363636363,0.5509481818181818,0.5142427272727272,0.5103636363636364,0.5334318181818182,0.5558863636363637,0.5191945454545455,0.5699609090909091,0.5534618181818182,0.5572663636363636,0.5703790909090909,0.51534,0.5587636363636364,0.5752618181818182,0.5312172727272727
|
| 4768 |
ERVV-1,1.4874975,1.38932,1.504555,1.40679,1.4435375,1.339385,1.4647875,1.41628,1.4109075,1.438055,1.4653025,1.5287675,1.49097,1.4754775,1.54617,1.426835,1.4562425,1.4993325,1.478935,1.4669175,1.532845,1.3857775,1.44605,1.4765725,1.490165,1.5586825,1.4300125,1.4774375,1.58887,1.45721
|
| 4769 |
ERVV-2,1.4874975,1.38932,1.504555,1.40679,1.4435375,1.339385,1.4647875,1.41628,1.4109075,1.438055,1.4653025,1.5287675,1.49097,1.4754775,1.54617,1.426835,1.4562425,1.4993325,1.478935,1.4669175,1.532845,1.3857775,1.44605,1.4765725,1.490165,1.5586825,1.4300125,1.4774375,1.58887,1.45721
|
| 4770 |
ERVW-1,2.227463333333333,2.300336666666667,2.4706333333333332,2.4082433333333335,2.23655,2.3384733333333334,2.5807466666666667,2.5172866666666667,2.1962766666666664,2.3356566666666665,2.1763,2.258836666666667,2.29454,2.1774033333333334,2.3862900000000002,2.2960133333333332,2.236083333333333,2.2945766666666665,2.4003033333333335,2.1838966666666666,2.4738233333333333,2.31894,2.449456666666667,2.56629,2.34659,2.0910233333333332,2.36776,2.01064,2.158376666666667,2.2983033333333336
|
|
|
|
| 6463 |
HAPLN2,3.984675,3.902995,3.95642,3.969685,4.06917,3.835045,3.93578,4.121455,3.847995,3.897565,3.96294,3.913235,3.97794,3.842625,4.013205,3.871235,3.909585,3.86149,3.94661,3.901685,3.8821,3.89445,4.042825,3.98535,4.05901,3.646235,3.83155,3.735965,3.988395,3.882
|
| 6464 |
HAPLN3,3.967675,4.607485,4.01918,4.21342,3.729535,4.58968,3.91905,4.409685,4.315145,4.611685,3.824325,4.34593,4.003005,4.32873,4.162395,4.439265,4.07326,4.57758,3.990445,4.291825,3.922845,4.34859,3.9206,4.48322,3.8291,4.486125,3.972535,4.39096,3.92483,4.346045
|
| 6465 |
HAPLN4,3.63379,3.567715,3.66801,3.681345,3.516105,3.564175,3.72192,3.82176,3.509235,3.555525,3.71153,3.827665,3.66598,3.74619,3.81266,3.52459,3.61496,3.72077,3.64732,3.60376,3.840865,3.48749,3.65513,3.791755,3.61243,3.541205,3.654035,3.5229,3.833305,3.740495
|
| 6466 |
+
HAPSTR1,3.703878333333333,3.6241950000000003,3.7939799999999995,3.6317,3.773105,3.574021666666667,3.6352616666666666,3.6136383333333333,3.715186666666667,3.5526383333333333,3.7311283333333334,3.617375,3.6971799999999995,3.4964233333333334,3.6144966666666667,3.7897616666666667,3.8280683333333334,3.510063333333333,3.542381666666667,3.6030366666666667,3.6787633333333334,3.6063366666666665,3.6825166666666664,3.674458333333334,3.6370233333333335,3.69413,3.6325900000000004,3.4622416666666664,3.73191,3.62437
|
| 6467 |
HARBI1,3.016955,2.85915,2.94949,2.958665,2.98286,2.89801,2.737645,2.906695,3.140055,3.011655,2.88258,3.05399,3.02705,3.10198,2.88814,3.611945,3.071305,2.922255,2.72926,2.951775,2.823615,3.085875,2.943755,2.98849,2.87564,2.935325,2.997765,2.95209,2.91595,3.04033
|
| 6468 |
HARS1,6.67939,6.137496666666666,6.675038333333333,6.716796666666667,6.6871833333333335,6.549863333333333,6.659208333333333,6.521541666666667,6.779381666666667,6.7517933333333335,6.599295000000001,6.56529,7.015408333333333,6.843859999999999,6.479655,6.492715,6.7732616666666665,6.621121666666666,6.517195,6.421331666666666,6.470631666666667,6.556625,6.448195,6.601371666666667,6.686495000000001,6.585628333333333,6.540291666666667,6.740715000000001,6.314563333333334,6.627495
|
| 6469 |
HARS2,0.9687255555555555,0.922478888888889,0.9265988888888889,0.9317722222222221,0.9426788888888888,0.931861111111111,0.8952933333333333,0.9156355555555555,0.9880222222222224,0.9667944444444445,0.9201377777777778,0.9221833333333334,0.9766455555555554,0.9635666666666667,0.91658,0.9944999999999999,0.9787522222222224,0.9261111111111112,0.9434333333333333,0.9497444444444445,0.9183455555555555,0.975098888888889,0.9139166666666667,0.971588888888889,0.933008888888889,0.9581066666666668,0.9730455555555556,0.9984422222222222,0.8996,0.9325333333333332
|
|
|
|
| 7100 |
IGKV2D-24,14.722038273809524,15.315149196428571,14.613988958333334,15.163242738095239,13.744427142857143,15.486634464285714,14.002069851190477,15.201741220238095,15.151141398809523,15.442024434523809,13.993539047619048,14.777754940476191,14.419504732142858,15.755719226190477,14.357854970238096,15.404221875000001,14.952970059523809,15.498324821428572,14.38007017857143,15.91608255952381,13.915143392857143,15.98186357142857,14.268703065476192,13.36704,13.646610922619047,15.71681380952381,13.896736904761905,15.071466845238096,14.090083482142857,15.089193779761905
|
| 7101 |
IGKV2D-26,18.01595277930403,18.904609228479853,18.052527928113552,17.857075476190477,18.22978262820513,18.99035798992674,17.990785391483517,18.436011879578754,18.685276206501833,17.53089480540293,17.9893139514652,18.418988424908424,18.124419608516483,18.609788887362637,18.184111852106227,19.12265982371795,18.359868598901098,18.291439935897436,18.589773965201466,18.522849372710624,18.09483026098901,19.179408456959706,18.23308294642857,18.56471333791209,17.972331169871794,18.85368065018315,18.9073623489011,19.120090064102563,18.278584553571427,18.677880107600732
|
| 7102 |
IGKV2D-28,56.423606657243084,57.01123372244259,56.5921096285316,56.61477414593413,55.81336293772894,57.88267270228138,57.067527104273175,57.669530038743936,56.964288053151094,56.363744591806885,56.03402073119528,56.42538545533878,57.507733422570894,56.78877527618786,56.66039116713679,57.79297207803634,57.335481568216096,57.76283981179931,55.86875727215758,55.634223060704,56.4446580613243,57.61757529820832,56.457490609222475,56.062184280064706,55.864117279805164,58.13738415247498,56.70039487313504,56.36126718741553,56.46791367729819,57.041856485168424
|
| 7103 |
+
IGKV2D-30,117.66381268262049,119.33714947395497,117.21099996312756,117.12753415670115,116.20673893635531,118.62258731494649,115.45514038865547,116.66595469641959,118.71352091496983,119.03719800440817,116.99243977669144,116.40947163743446,116.53062031813366,119.44368177758925,116.19804112932736,120.01796368365295,118.52832047307513,121.14043331822344,116.91275727032608,118.61948323516843,115.30688298911872,120.38627269331322,116.40933628515765,116.50271345704051,116.0187747649034,119.37755066505962,119.46921877552431,121.6570413204769,116.71449215267005,118.86742088580945
|
| 7104 |
IGKV2D-38,1.3340249999999998,1.3701283333333334,1.3747966666666667,1.3875466666666665,1.4525249999999998,1.3374366666666668,1.4176283333333333,1.4103416666666666,1.3510866666666665,1.36588,1.4105433333333333,1.3895233333333332,1.3721683333333334,1.3574233333333332,1.3640316666666665,1.3732616666666668,1.4086716666666668,1.40113,1.3922566666666667,1.3458433333333335,1.40831,1.3866100000000001,1.3713616666666668,1.373195,1.3830433333333334,1.4012916666666666,1.3499333333333334,1.32533,1.4064699999999999,1.3569866666666668
|
| 7105 |
IGKV2D-40,3.3846666666666665,3.472633333333333,3.365766666666667,3.3877333333333333,3.3425,3.328583333333333,3.4003333333333337,3.4069333333333334,3.320653333333333,3.3521,3.3856,3.3836666666666666,3.3291,3.3539999999999996,3.4418666666666664,3.3982666666666668,3.2950233333333334,3.4111,3.429866666666667,3.4073666666666664,3.4923,3.4012333333333333,3.391966666666667,3.4448333333333334,3.385066666666667,3.3283233333333335,3.3679666666666663,3.3711333333333333,3.401566666666667,3.4156666666666666
|
| 7106 |
IGKV3-31,3.338325,3.085225,3.395575,3.347675,3.39685,3.184375,3.374525,3.281325,3.36625,3.169,3.370725,3.2428,3.446775,3.164525,3.33835,3.0891,3.41565,3.2103,3.3358,2.8796,3.369625,3.17185,3.3312,3.05995,3.373875,3.234675,3.3312,3.029275,3.3809,3.387525
|
|
|
|
| 7233 |
IL36G,5.1504,6.0705,4.108475,6.49085,3.90576,5.158,4.014105,5.20165,4.63144,4.62208,3.67051,4.49816,5.0613,5.95995,3.645265,6.11115,3.961415,5.395,4.22429,4.754825,3.175765,4.64737,3.755655,3.524995,3.85884,6.13185,3.318245,5.0641,3.97124,5.61955
|
| 7234 |
IL36RN,5.22165,3.88119,5.07445,5.3154,4.978885,4.16197,4.718075,4.778065,5.0368,3.749765,4.35618,4.041775,4.94825,3.778015,4.456115,5.1267,5.2698,4.931035,4.58029,3.89843,4.74447,3.63124,4.396555,3.55998,4.98824,5.075,3.924585,3.254545,4.23486,4.900905
|
| 7235 |
IL37,2.867265,2.92217,2.818085,2.883955,2.849185,2.82075,2.851885,2.83184,2.74706,2.86168,2.857865,3.004525,2.79051,2.821445,3.083915,2.80623,2.7031,2.93893,2.89583,2.80542,2.940765,2.770855,2.971135,2.93769,3.06386,2.856535,2.79099,2.76016,2.85844,3.194215
|
| 7236 |
+
IL4,1.9154866666666668,2.0055075,2.0228333333333333,1.9524,1.9222958333333333,1.9348958333333335,1.922425,2.0422883333333335,2.08885,2.027356666666667,1.9235116666666667,1.9930308333333335,2.0128441666666665,1.90242,1.9350266666666665,1.9170725000000002,2.098071666666667,1.9456600000000002,2.012295,1.9603058333333334,1.99082,1.9060783333333333,1.83054,1.8963116666666666,1.9706200000000003,2.3339058333333336,1.8458275000000002,2.0449766666666664,2.043985,1.89465
|
| 7237 |
IL4I1,1.2112414285714286,1.2768057142857143,1.21153,1.276882857142857,1.164794285714286,1.3199514285714287,1.1567642857142857,1.2412114285714286,1.2236157142857143,1.3337357142857142,1.1935185714285714,1.267737142857143,1.1821985714285714,1.2790942857142855,1.1672228571428571,1.2913142857142856,1.2230785714285715,1.2866771428571429,1.2060057142857143,1.3140657142857144,1.1986085714285715,1.2729300000000001,1.2154214285714284,1.2953314285714286,1.2049414285714286,1.2987471428571429,1.22623,1.3165342857142857,1.167007142857143,1.2313100000000001
|
| 7238 |
IL4R,5.1853,4.783665,5.02745,5.65665,4.8593,5.3474,4.79963,5.15155,5.323,4.96761,4.922295,5.2822,5.16285,5.084,4.917595,5.32945,5.32445,5.18445,5.053,4.594265,4.793165,5.3861,5.01045,5.25135,4.991415,5.7015,4.95942,4.72733,4.819825,5.1973
|
| 7239 |
IL5,1.949425,1.988185,1.920625,2.069825,2.01393,1.94271,2.154285,1.945005,2.08751,1.9607,2.15071,1.92599,2.020225,1.929365,2.326275,1.90434,1.882785,1.996155,2.06041,2.070255,1.9398,1.921815,2.045285,1.963645,2.04781,1.75254,2.07655,1.924845,2.01824,1.99865
|
|
|
|
| 8111 |
LAMTOR1,5.09645,5.7105,5.55605,5.6366,5.313,4.99163,5.42355,5.60145,5.4766,5.38505,5.285,5.0528,5.3961,5.405,5.2429,5.10365,5.55495,5.2384,5.1122,5.1518,5.1449,6.00045,5.15195,5.27815,5.1321,5.41115,5.21155,4.90922,5.10815,5.19735
|
| 8112 |
LAMTOR2,4.639435,4.92323,4.667985,4.74046,4.62721,4.73338,4.62199,4.88179,4.768325,4.642805,4.71434,4.69951,4.650865,4.596755,4.767785,4.91994,4.703075,4.642785,4.801,4.79632,4.669765,4.964805,4.65787,4.688785,4.555775,4.56245,4.86076,4.861365,4.69185,4.70409
|
| 8113 |
LAMTOR3,3.471766666666667,3.2214233333333335,3.4834333333333336,3.456466666666667,3.4931666666666668,3.3953,3.4675999999999996,3.3094433333333337,3.6234333333333333,3.4748,3.5751000000000004,3.4105333333333334,3.6435333333333335,3.32324,3.5565333333333338,3.502166666666667,3.579833333333333,3.252963333333333,3.5927666666666664,3.4799333333333333,3.5210333333333335,3.3260133333333335,3.427766666666667,3.319036666666667,3.5292333333333334,3.4039333333333333,3.6424333333333334,3.3588,3.5089666666666663,3.5847333333333338
|
| 8114 |
+
LAMTOR5,7.451205,7.5100549999999995,8.01025,7.907375,8.059075,7.747665,7.938715,7.48837,8.20568,8.185545,7.92005,7.723955,7.93139,7.983219999999999,7.12895,7.486835,8.03498,7.84089,7.58567,7.70808,7.63804,8.0005,7.4349799999999995,6.958805,7.3144,7.1405650000000005,7.62853,7.657705,7.62622,7.683135
|
| 8115 |
LANCL1,3.3115133333333335,3.3841,3.27136,3.079003333333333,3.30369,3.1078033333333335,3.1923133333333333,3.0545233333333335,3.4483,3.3273966666666666,3.186246666666667,3.1006666666666667,3.1623933333333336,3.4150666666666667,3.281776666666667,2.9423366666666664,3.3646,3.383766666666667,3.3906333333333336,3.5236,3.264746666666667,3.22319,3.274763333333333,3.198423333333333,3.2062866666666667,3.0686633333333333,3.5723000000000003,3.4995333333333334,3.2505333333333333,3.340066666666667
|
| 8116 |
LANCL2,2.29679,2.7659,2.2864625,2.2163425,2.285395,2.3476475,2.253825,2.272695,2.4033,2.59745,2.2740725,2.21402,2.1752325,2.47103,2.252115,2.3925075,2.4000425,2.31769,2.3317575,2.906075,2.2152375,2.2635675,2.228515,2.31922,2.20778,2.2355225,2.4245575,2.22695,2.24899,2.37043
|
| 8117 |
LANCL3,2.4270033333333334,2.1132433333333336,2.44548,2.1275133333333334,2.3693766666666667,2.0833833333333334,2.3348733333333334,2.30077,2.45052,2.471006666666667,2.27753,2.1658166666666667,2.4725966666666666,2.114196666666667,2.26476,2.1973433333333334,2.4605966666666665,2.4160666666666666,2.390006666666667,1.9730033333333334,2.4316866666666668,2.18313,2.3650100000000003,1.98543,2.2893,1.9517166666666668,2.412436666666667,2.272276666666667,2.3383133333333332,2.3653233333333334
|
|
|
|
| 9704 |
MTRF1,3.2557,3.706535,3.513975,3.234175,3.238895,3.518825,3.304645,3.439015,3.578935,3.288375,3.35669,3.266805,3.11451,3.37193,3.065695,4.065825,3.488985,3.34429,3.316325,3.5402,2.93725,3.65723,3.34466,3.603915,3.2465,2.627635,3.65513,3.430245,3.12594,3.277085
|
| 9705 |
MTRF1L,2.28187,2.688325,2.335495,2.853945,2.710215,3.031195,2.975095,2.902585,2.848085,2.825045,2.75306,2.33674,3.046855,2.81124,2.881705,3.417,2.54335,3.08959,2.2354,2.47136,2.69147,2.58094,3.098435,2.690355,2.09346,2.845495,2.629455,2.285555,3.16837,2.555645
|
| 9706 |
MTRFR,2.95488,3.047005,3.204825,3.05527,2.92902,3.229695,3.05907,3.14685,3.214025,3.369475,3.09699,3.1388,2.820195,3.25952,3.13079,3.114435,3.19608,3.067365,2.920055,3.305105,2.97541,3.29587,3.03742,3.231155,3.027545,3.26233,3.27136,3.512735,2.93486,3.1519
|
| 9707 |
+
MTRNR2L1,6.153662499999999,5.96301875,6.40795,6.2994125,6.17168125,6.3165625,6.257043749999999,6.242475000000001,6.352531249999999,6.2654499999999995,6.15181875,6.2145,6.386262500000001,5.9508937500000005,6.15841875,6.22151875,6.30014375,6.134356250000001,6.14375625,6.1114375,6.213025,6.73950625,6.3446,6.398524999999999,6.10029375,6.309774999999999,6.188075,6.449681249999999,6.1958,6.25484375
|
| 9708 |
MTRR,4.81617,5.21735,4.64337,4.746625,4.5668,5.26085,4.47405,4.79783,4.824375,4.990715,4.444455,4.53585,4.62706,5.1682,4.42552,5.33385,4.764345,4.98803,4.439415,5.22085,4.35671,5.50485,4.28188,5.15775,4.57144,5.3393,4.76132,5.3239,4.180925,4.873335
|
| 9709 |
MTSS1,5.36515,5.3617,5.20035,5.66275,5.042,5.13705,4.952565,4.880005,5.2237,4.55868,4.97439,4.95872,5.07205,4.93417,4.93856,5.70535,5.25805,5.23925,5.2046,4.58625,4.854275,5.2451,5.31305,4.64638,5.14145,5.3503,5.1898,4.61646,5.0979,5.1653
|
| 9710 |
MTSS2,4.94426,4.854695,5.19905,4.99131,4.99295,5.02135,5.0226,4.71386,4.922545,4.957325,4.93171,5.0372,5.0326,5.023,5.0591,5.1395,5.00555,4.946715,5.0975,5.0519,5.1327,5.2819,5.03565,5.3197,5.0839,5.06025,5.2725,4.893615,5.12125,5.00875
|
|
|
|
| 12324 |
PRND,2.833075,2.806425,2.987085,2.94591,2.785455,2.926555,2.9559,2.86961,2.839135,2.892775,3.0509,2.807595,2.694785,2.80559,2.369865,2.786345,2.845885,2.86661,2.92976,2.809505,3.00231,2.9962,2.845865,2.8636,2.73659,2.646745,2.82908,2.84196,3.03864,2.8574
|
| 12325 |
PRNP,5.70115,6.28965,5.44875,6.2552,5.30385,6.27095,5.3554,5.898,5.708,6.05265,5.4432,5.9071,5.6681,6.1265,5.3928,6.51095,5.60415,5.87885,5.67195,6.245,5.4517,5.89815,5.6491,6.057,5.564,6.5905,5.5929,6.2388,5.2497,5.9863
|
| 12326 |
PRNT,2.748241666666667,2.6606475,2.65001,2.721645,2.6289783333333334,2.75652,2.5486208333333336,2.486190833333333,2.664225,2.637364166666667,2.7004908333333333,2.6442533333333333,2.6385183333333333,2.6325700000000003,2.6164658333333333,2.7248550000000002,2.7273083333333332,2.6555341666666665,2.5965941666666668,2.7724458333333333,2.5306141666666666,2.80441,2.6504691666666664,2.6839158333333337,2.6083516666666666,2.9271416666666665,2.6769225,2.8106999999999998,2.6330358333333335,2.734776666666667
|
| 12327 |
+
PRO2268,0.9578225,0.9405925,0.9798425,1.003645,1.0209525,1.0332825,0.943695,1.0793925,1.0324875,1.02562,1.00124,0.981675,0.9854375,0.98007,1.0706525,1.0469725,1.05949,1.0211825,0.960305,1.01928,1.0320925,1.0761725,1.01361,0.9905425,1.1247175,1.1083425,0.9916275,0.97462,1.091275,1.0517475
|
| 12328 |
PROC,3.87129,3.99069,3.83711,4.032095,3.82191,4.025855,3.79461,3.980375,3.777005,3.70971,3.877065,3.831435,3.817035,3.91623,4.04786,4.06978,3.65936,3.687085,3.927815,4.03748,3.92853,3.995075,3.844315,4.096365,3.944305,3.93808,3.853125,3.927735,3.84014,3.8697
|
| 12329 |
PROCA1,2.7414366666666665,2.55062,2.7596166666666666,2.6500833333333333,2.7005466666666664,2.6311466666666665,2.7049466666666664,2.7412266666666665,2.6441133333333333,2.6675866666666668,2.674046666666667,2.7241199999999997,2.6880966666666666,2.6087700000000003,2.75141,2.5991666666666666,2.65028,2.764863333333333,2.6629,2.55886,2.660346666666667,2.5843766666666665,2.689853333333333,2.6486566666666667,2.69562,2.5969366666666667,2.6147933333333335,2.5334266666666667,2.678433333333333,2.66929
|
| 12330 |
PROCR,3.731865,4.639915,3.649725,4.021675,3.721635,4.44978,3.738925,4.023985,3.75335,4.02499,3.690335,3.98801,3.783225,3.80314,3.77596,4.481515,3.7671,4.81553,3.77158,3.884265,3.87238,4.05682,3.76569,4.52104,3.793275,3.95547,3.83402,4.09108,3.83182,3.96756
|
|
|
|
| 12487 |
PSMD14,2.6025,2.53265,2.45484,2.60415,2.4292025,2.518275,2.41406,2.42522,2.603925,2.611125,2.4755375,2.527975,2.565275,2.648375,2.47614,2.90105,2.55535,2.578925,2.563,2.700675,2.4539075,2.72785,2.4451075,2.7182,2.546375,2.712575,2.58335,2.83685,2.417565,2.69585
|
| 12488 |
PSMD2,5.41505,5.49355,5.2464,5.81375,5.29135,5.6356,5.27995,5.41345,5.40115,5.24695,5.3999,5.60255,5.6351,6.01055,5.259,5.85325,5.4292,5.45805,5.3315,5.64455,5.16245,5.8526,5.201,5.82025,5.2386,5.7743,5.2829,6.09965,5.12535,5.42395
|
| 12489 |
PSMD3,5.3699,5.61325,5.3778,5.5129,5.25115,5.83385,5.23595,5.48615,5.41595,5.58735,5.28175,5.5291,5.43355,6.00345,5.19755,5.6062,5.4686,5.4797,5.30165,5.5451,5.25065,5.96645,5.3925,5.59595,5.2618,5.46245,5.35005,5.8307,5.1553,5.51415
|
| 12490 |
+
PSMD4,6.28121,6.366743333333334,6.553036666666666,6.75568,6.420025,6.7029716666666666,6.536666666666667,6.915031666666667,6.330735000000001,6.573131666666667,6.39204,6.627808333333333,6.50977,6.667398333333333,6.586991666666666,6.450265,6.652868333333333,6.592463333333333,6.3960566666666665,6.363203333333333,6.209585000000001,6.621831666666667,6.428731666666667,6.924953333333333,6.442828333333333,6.487559999999999,6.198075,6.591754999999999,6.44092,6.466271666666667
|
| 12491 |
PSMD5,5.1785,5.09185,5.05305,4.75573,4.915675,5.14965,4.76725,4.99373,5.24875,4.783075,4.984985,4.99692,4.946465,4.859675,4.789185,5.23965,5.196,5.24805,4.873955,5.206,4.726545,5.00325,4.988145,5.2107,4.98832,5.31375,5.13195,5.0186,4.88314,5.0455
|
| 12492 |
PSMD6,6.159159166666667,5.518034166666666,5.871605833333334,5.670170000000001,5.951785833333334,5.624180833333334,5.918584166666667,5.85717,6.3373525,5.9850683333333325,5.950537499999999,5.558449166666667,5.8221475,5.763065,5.745119166666667,6.067354999999999,6.011796666666667,5.940345833333334,6.074183333333333,6.046335,6.1519525,5.91067,5.9027875000000005,5.7187141666666665,5.866265833333333,5.6454450000000005,6.156757499999999,6.03685,5.8560324999999995,5.862695
|
| 12493 |
PSMD7,5.6707,5.6595,5.46335,5.50465,5.50575,5.739,5.42395,5.5453,5.631,5.94275,5.63245,5.62565,5.4703,5.51095,5.6707,6.2133,5.6303,5.53595,5.75565,5.8265,5.70195,6.2368,5.7629,5.8538,5.53615,5.95655,5.7897,5.5148,5.69175,5.65005
|
|
|
|
| 13327 |
RNPEP,5.46495,5.2897,5.7568,5.2487,5.59085,5.48115,5.5612,5.55715,5.62235,5.3868,5.48095,5.2704,5.5141,5.44465,5.37385,5.45805,5.65025,5.33265,5.3837,5.2162,5.416,5.407,5.43815,5.14445,5.3992,5.145,5.5913,5.42845,5.58855,5.55305
|
| 13328 |
RNPEPL1,5.14355,4.85278,5.27705,5.1429,5.26825,5.0267,5.265,5.04905,5.2311,4.9659,5.2011,4.957555,5.22425,4.905405,5.2141,4.83557,5.2887,5.1311,5.18625,5.27035,5.26585,5.148,5.1283,5.07955,5.2592,4.89874,5.23335,5.04245,5.31255,5.1714
|
| 13329 |
RNPS1,3.8609299999999998,3.9606624999999998,3.9908825,4.066262500000001,3.8293600000000003,4.260384999999999,3.718705,3.8919675,4.1816475,4.3862725,3.792735,3.9483675000000003,3.703175,3.999905,3.6230824999999998,4.265969999999999,4.0546875,4.0846975,3.997175,4.441905,3.3966575,4.110469999999999,3.6841725000000003,4.00983,3.6910175,4.0593,3.8792524999999998,4.08198,3.64725,3.8716150000000003
|
| 13330 |
+
RNR2,0.8826125,0.88396875,0.8842,0.8717125,0.89193125,0.8902625,0.88844375,0.874875,0.88283125,0.8755,0.88556875,0.8945,0.8795625,0.87969375,0.87591875,0.87941875,0.88604375,0.87575625,0.87560625,0.8881375,0.872175,0.88165625,0.8809,0.863375,0.87649375,0.875925,0.888175,0.89618125,0.86195,0.87494375
|
| 13331 |
RNU1-1,3.2092533333333333,3.294363333333333,3.2016899999999997,3.2579533333333335,3.171193333333333,3.29754,3.15817,3.2431666666666668,3.1548133333333332,3.302046666666667,3.1729000000000003,3.3505000000000003,3.1603733333333337,3.31652,3.1988233333333334,3.3920666666666666,3.1856033333333333,3.238023333333333,3.259593333333333,3.4431,3.19313,3.306236666666667,3.174656666666667,3.3517333333333332,3.2276433333333334,3.2128366666666666,3.31053,3.3645333333333336,3.1511266666666664,3.2661033333333336
|
| 13332 |
RNU11,5.678605833333334,5.709906666666667,5.5954775,5.59758,5.406257500000001,5.63757,5.386194166666667,5.704666666666666,5.7729025,6.011525000000001,5.663470833333333,5.781365,5.545636666666667,5.724796666666666,5.2993175,5.900318333333333,5.614860833333333,5.4559125,5.453860833333334,6.092619999999999,5.326714166666666,5.890065,5.520930833333334,5.7041458333333335,5.171871666666666,5.713425833333334,5.765091666666667,5.877646666666667,5.538296666666667,5.8901625
|
| 13333 |
RNU12-2P,5.678605833333334,5.709906666666667,5.5954775,5.59758,5.406257500000001,5.63757,5.386194166666667,5.704666666666666,5.7729025,6.011525000000001,5.663470833333333,5.781365,5.545636666666667,5.724796666666666,5.2993175,5.900318333333333,5.614860833333333,5.4559125,5.453860833333334,6.092619999999999,5.326714166666666,5.890065,5.520930833333334,5.7041458333333335,5.171871666666666,5.713425833333334,5.765091666666667,5.877646666666667,5.538296666666667,5.8901625
|
|
|
|
| 13466 |
RPS18P9,1.952102,1.957958,1.964806,1.996686,1.96889,1.9271280000000002,1.9092980000000002,1.973638,1.985592,1.917192,1.956314,1.9146640000000001,1.938476,1.9460000000000002,1.9656600000000002,1.9142219999999999,1.98366,1.9760300000000002,1.973742,1.9566880000000002,1.9514479999999998,1.9545480000000002,1.9061800000000002,1.999428,1.9467780000000001,1.9175280000000001,2.0442799999999997,1.9619039999999999,1.943336,1.9469699999999999
|
| 13467 |
RPS19,7.6636050000000004,7.121848333333333,7.45002,7.455326666666667,7.527995,6.886003333333333,7.23215,7.584043333333333,7.40456,7.428331666666667,7.33474,7.327398333333333,6.796925,7.31665,7.575388333333334,7.48085,7.298246666666667,7.064361666666667,7.362451666666667,7.010556666666666,7.78312,7.467141666666667,7.042423333333334,7.3226466666666665,7.114958333333334,6.933776666666667,6.993195,7.1071599999999995,6.932548333333333,7.513303333333333
|
| 13468 |
RPS19BP1,3.1480633333333334,3.2070333333333334,3.099906666666667,3.266306666666667,3.0851433333333333,3.13116,3.1171966666666666,3.184893333333333,3.152003333333333,3.18037,3.172093333333333,3.130186666666667,3.13487,3.322896666666667,3.1962333333333333,3.2940466666666666,3.182096666666667,3.0885599999999998,3.21259,3.1380966666666663,3.157383333333333,3.4116999999999997,3.2759466666666666,3.14795,3.0599333333333334,3.0741300000000003,3.159243333333333,3.12918,3.0861133333333335,3.2543466666666667
|
| 13469 |
+
RPS2,5.551650833333333,5.557618333333334,5.5643775,5.8704350000000005,5.2663891666666665,5.538391666666667,5.244485,5.473650833333333,5.630546666666667,5.8230025,5.762930000000001,5.86832,5.580004166666667,5.7764375,5.539001666666667,5.5637475,5.673395833333333,5.669225,5.556971666666667,5.667051666666667,5.557654166666667,5.6822325,5.637264166666666,6.040538333333333,5.729008333333334,5.983394166666667,5.713539999999999,5.415473333333333,5.401838333333333,5.6202775
|
| 13470 |
RPS20,3.4009850000000004,3.5628516666666665,3.428773333333333,3.5341966666666664,3.3115500000000004,3.544391666666667,3.4127433333333332,3.3836549999999996,3.429108333333333,3.496478333333333,3.4559450000000003,3.47807,3.34598,3.5534383333333337,3.4600633333333333,3.4904116666666667,3.406185,3.4157800000000003,3.4644049999999997,3.5622233333333333,3.357945,3.4937683333333336,3.42367,3.5794266666666665,3.4046133333333333,3.3455883333333336,3.4706550000000003,3.321405,3.3047933333333335,3.377796666666667
|
| 13471 |
RPS20P27,1.7389299999999999,1.8287833333333332,1.7727466666666667,1.8689133333333334,1.70454,1.8065033333333333,1.7496866666666666,1.69715,1.7841766666666665,1.9173166666666666,1.8069300000000001,1.7617,1.75636,1.8801166666666667,1.8001666666666667,1.8151433333333333,1.78585,1.83716,1.88849,1.9381266666666666,1.78745,1.8449766666666667,1.70854,1.9184133333333333,1.8190266666666668,1.8082166666666666,1.88863,1.7908099999999998,1.7069466666666668,1.7467933333333334
|
| 13472 |
RPS21,2.7497390476190477,2.8643076190476187,2.805715238095238,2.7427238095238096,2.6993252380952377,2.678315238095238,2.6666535714285713,2.7358657142857146,2.783404285714286,2.8426414285714285,2.6871823809523807,2.7554847619047624,2.7498142857142858,2.874892380952381,2.59254,2.834674761904762,2.8054066666666664,2.761729523809524,2.8632995238095242,2.8638209523809524,2.581925,2.7521257142857145,2.55206,2.7827776190476188,2.6178933333333334,2.921690952380952,2.7152904761904764,2.8030914285714283,2.595255238095238,2.674609523809524
|
|
|
|
| 16619 |
TRERF1,8.155345,7.645054999999999,7.710139999999999,7.535119999999999,8.42146,8.34437,8.165715,7.896625,8.558495,8.582995,8.299745000000001,7.865460000000001,7.66084,7.041,8.360330000000001,7.9605250000000005,8.524415000000001,7.872345000000001,8.85366,8.556035,8.177655,8.623194999999999,8.253615,8.759905,8.497135,7.775895,9.031965,8.807485,8.39767,7.6373299999999995
|
| 16620 |
TREX1,1.564654,1.600524,1.589142,1.612724,1.596918,1.592274,1.585382,1.597574,1.617298,1.597642,1.543366,1.4993159999999999,1.56549,1.588288,1.612066,1.647898,1.59299,1.601228,1.60883,1.6101400000000001,1.574706,1.60655,1.5916679999999999,1.6163440000000002,1.586208,1.583832,1.6185199999999997,1.6006360000000002,1.599256,1.5841939999999999
|
| 16621 |
TREX2,0.7308981818181818,0.7445209090909092,0.7402527272727273,0.7929245454545455,0.70843,0.7964936363636365,0.7268609090909091,0.7509690909090909,0.7436309090909091,0.7582336363636363,0.7305472727272728,0.7487881818181819,0.7332418181818181,0.7475272727272727,0.725239090909091,0.78067,0.7474445454545454,0.7711372727272727,0.7294927272727272,0.7367818181818181,0.7169972727272728,0.7420763636363635,0.7286845454545454,0.7978181818181818,0.7363672727272728,0.7564927272727272,0.7261772727272727,0.7295336363636363,0.7341627272727272,0.7257981818181819
|
| 16622 |
+
TRG,2.614895,3.19042,2.68513,2.62316,2.50776,2.9909,2.60276,2.6319,2.746065,2.868645,2.62211,3.077545,2.427945,2.591535,2.520115,3.08587,2.171235,2.82236,2.880905,3.358445,2.36361,2.8538,2.223225,2.639265,2.62613,2.911425,2.50687,3.204925,2.105645,2.853525
|
| 16623 |
+
TRGC1,39.93169210606061,40.07110269264069,39.17631904545455,40.149258571428575,39.067863714285714,40.94984950649351,38.72941831818182,39.92454294372294,40.441822067099565,41.0679386038961,38.49300919264069,39.82630977922078,38.530145023809524,39.77799874675325,38.76785791991342,41.560991502164505,39.462190926406926,41.744935251082254,38.96554531601732,40.403968982683985,38.728407108225106,41.68626835714286,39.01083065584415,40.999371658008656,38.71685097186147,40.62643585930736,39.26385388961039,41.50589216233766,38.30387157142857,40.19302542207792
|
| 16624 |
TRGC2,1.902695111111111,1.7552217777777779,1.942818888888889,1.7632564444444445,1.9178051111111112,1.7416153333333333,1.812846,1.9418562222222224,1.8862306666666666,1.7682408888888888,1.8869551111111111,1.819424,1.802813111111111,1.8095577777777776,1.9154504444444447,1.781872888888889,1.871788,1.8392591111111112,1.783244888888889,1.758105111111111,1.8690204444444443,1.8372928888888889,1.8236451111111112,1.8163355555555554,1.8572884444444444,2.036791555555556,1.93415,1.7417951111111112,1.8882526666666668,1.8162806666666667
|
| 16625 |
TRGV11,0.6978711111111111,0.6540277777777779,0.6695888888888889,0.6653044444444444,0.6869211111111111,0.6349233333333334,0.64247,0.7014922222222223,0.6555566666666667,0.6403288888888888,0.6908911111111111,0.65253,0.6509411111111111,0.6751777777777778,0.6922544444444445,0.6413588888888889,0.65986,0.6623511111111111,0.6571988888888889,0.5998411111111112,0.6647744444444444,0.6707988888888888,0.6618111111111111,0.6705055555555556,0.6719644444444444,0.7353155555555556,0.66828,0.6028911111111112,0.6744666666666667,0.6458766666666667
|
| 16626 |
TRGV3,3.14869,2.8815925,2.946225,2.7639924999999996,2.96983,3.041735,2.9285975,3.099065,3.200115,3.2084775,3.1533925,2.87775,2.6973525,2.6892475,2.9450475,3.003815,3.041725,3.0449675000000003,2.9394575,3.1838825,2.8718125,2.9619275,2.97898,2.6886225,3.0569775,2.90825,3.0624425,2.72688,3.0280175,3.0275499999999997
|
|
|
|
| 17638 |
YBX3P1,4.558333333333334,4.4910000000000005,4.650066666666667,4.732366666666667,4.5402,4.468966666666667,4.578366666666667,4.563733333333333,4.621066666666667,4.7215,4.606466666666667,4.5244333333333335,4.609566666666667,4.673,4.5748,4.469433333333334,4.648433333333333,4.573933333333334,4.5517666666666665,4.492366666666666,4.471633333333333,4.498833333333333,4.5774333333333335,4.707933333333333,4.4831666666666665,4.570566666666667,4.5214,4.308466666666667,4.6108,4.533166666666667
|
| 17639 |
YEATS2,3.086016666666667,3.5121333333333333,3.082076666666667,3.5239333333333334,2.9792666666666663,3.3706,3.0034733333333334,3.0218133333333337,3.1379900000000003,3.1764666666666668,3.0112400000000004,3.3369666666666666,3.1932266666666664,3.8335000000000004,2.9514899999999997,3.5213,3.1585300000000003,3.4347666666666665,3.028723333333333,3.560033333333333,2.9543633333333332,3.389466666666667,3.023903333333333,3.490133333333333,3.1231166666666668,3.5056,3.11895,3.690633333333333,2.8622533333333333,3.2187133333333335
|
| 17640 |
YEATS4,2.810636666666667,3.1374999999999997,2.82465,2.7925133333333334,2.7023266666666665,3.0602966666666664,2.53832,2.7831333333333332,3.0812633333333337,3.183733333333333,2.743126666666667,2.9571066666666668,2.53236,2.989036666666667,2.85551,3.082686666666667,2.8530033333333336,2.88205,2.8681300000000003,3.2291233333333333,2.71381,3.245433333333333,2.7841466666666665,3.14061,2.73175,2.9105600000000003,2.9547933333333334,3.24842,2.753213333333333,2.966396666666667
|
| 17641 |
+
YES1,3.3493431666666664,3.310661,3.3050213333333334,3.3494018333333333,3.214196166666667,3.4611029999999996,3.195133666666667,3.289517,3.4737166666666663,3.6099930000000002,3.2388461666666664,3.3602796666666666,3.3257513333333333,3.4455918333333337,3.1067845,3.4088928333333333,3.394214166666667,3.3812794999999998,3.1668998333333334,3.435532666666667,3.1747268333333336,3.3493353333333333,3.208249,3.4329565,3.4094773333333332,3.5298165,3.3599645000000002,3.7233473333333333,3.1559600000000003,3.432812333333333
|
| 17642 |
YIF1A,4.91462,5.07335,4.905475,5.6345,4.70928,4.924405,4.828665,5.1725,4.964025,5.21535,4.72085,5.125,4.82797,4.98524,4.86551,5.1702,4.92208,4.90122,4.939525,4.87221,4.847695,5.28955,4.94891,5.30585,4.97468,5.35095,5.04455,4.91716,4.84349,5.01675
|
| 17643 |
YIF1B,9.7531,9.85324,9.783395,10.1130475,9.545815,9.46011,9.7991025,9.915992500000002,9.715285000000002,9.04843,9.732420000000001,9.7422675,9.8725875,9.3496225,9.795277500000001,9.4989225,9.79166,9.8309675,9.52915,9.498625,9.7150675,9.691815,9.839329999999999,9.5650725,9.5406975,9.7698325,9.677335,9.331822500000001,9.7026775,9.7032025
|
| 17644 |
YIPF1,4.240655,4.04969,4.2606,4.246555,4.356325,4.35324,4.132145,4.175075,4.555835,4.36505,4.22527,4.0106,4.3851,4.119965,4.25452,4.60271,4.49865,4.312545,4.219365,4.317215,4.170155,4.535835,4.22816,4.309205,4.13395,4.050955,4.438495,4.333365,4.37496,4.57249
|
output/preprocess/Essential_Thrombocythemia/clinical_data/GSE103237.csv
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
,GSM2758679,GSM2758680,GSM2758681,GSM2758682,GSM2758683,GSM2758684,GSM2758685,GSM2758686,GSM2758687,GSM2758688,GSM2758689,GSM2758690,GSM2758691,GSM2758692,GSM2758693,GSM2758694,GSM2758695,GSM2758696,GSM2758697,GSM2758698,GSM2758699,GSM2758700,GSM2758701,GSM2758702,GSM2758703,GSM2758704,GSM2758705,GSM2758706,GSM2758707,GSM2758708,GSM2758709,GSM2758710,GSM2758711,GSM2758712,GSM2758713,GSM2758714,GSM2758715,GSM2758716,GSM2758717,GSM2758718,GSM2758719,GSM2758720,GSM2758721,GSM2758722,GSM2758723,GSM2758724,GSM2758725,GSM2758726,GSM2758727,GSM2758728,GSM2758729,GSM2758730,GSM2758731,GSM2758732,GSM2758733,GSM2758734,GSM2758735,GSM2758736,GSM2758737,GSM2758738,GSM2758739,GSM2758740,GSM2758741,GSM2758742,GSM2758743
|
| 2 |
-
Essential_Thrombocythemia,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,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
|
| 3 |
Gender,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,,,,,,,,,,,,,,,
|
|
|
|
| 1 |
,GSM2758679,GSM2758680,GSM2758681,GSM2758682,GSM2758683,GSM2758684,GSM2758685,GSM2758686,GSM2758687,GSM2758688,GSM2758689,GSM2758690,GSM2758691,GSM2758692,GSM2758693,GSM2758694,GSM2758695,GSM2758696,GSM2758697,GSM2758698,GSM2758699,GSM2758700,GSM2758701,GSM2758702,GSM2758703,GSM2758704,GSM2758705,GSM2758706,GSM2758707,GSM2758708,GSM2758709,GSM2758710,GSM2758711,GSM2758712,GSM2758713,GSM2758714,GSM2758715,GSM2758716,GSM2758717,GSM2758718,GSM2758719,GSM2758720,GSM2758721,GSM2758722,GSM2758723,GSM2758724,GSM2758725,GSM2758726,GSM2758727,GSM2758728,GSM2758729,GSM2758730,GSM2758731,GSM2758732,GSM2758733,GSM2758734,GSM2758735,GSM2758736,GSM2758737,GSM2758738,GSM2758739,GSM2758740,GSM2758741,GSM2758742,GSM2758743
|
| 2 |
+
Essential_Thrombocythemia,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
| 3 |
Gender,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,,,,,,,,,,,,,,,
|
output/preprocess/Essential_Thrombocythemia/clinical_data/GSE159514.csv
CHANGED
|
@@ -1,4 +1,2 @@
|
|
| 1 |
-
|
| 2 |
-
Essential_Thrombocythemia
|
| 3 |
-
Age
|
| 4 |
-
Gender
|
|
|
|
| 1 |
+
,GSM4831515,GSM4831516,GSM4831517,GSM4831518,GSM4831519,GSM4831520,GSM4831521,GSM4831522,GSM4831523,GSM4831524,GSM4831525,GSM4831526,GSM4831527,GSM4831528,GSM4831529,GSM4831530,GSM4831531,GSM4831532,GSM4831533,GSM4831534,GSM4831535,GSM4831536,GSM4831537,GSM4831538,GSM4831539,GSM4831540,GSM4831541,GSM4831542,GSM4831543,GSM4831544,GSM4831545,GSM4831546,GSM4831547,GSM4831548,GSM4831549,GSM4831550,GSM4831551,GSM4831552,GSM4831553,GSM4831554,GSM4831555,GSM4831556,GSM4831557,GSM4831558,GSM4831559,GSM4831560,GSM4831561,GSM4831562,GSM4831563,GSM4831564,GSM4831565,GSM4831566,GSM4831567,GSM4831568,GSM4831569,GSM4831570,GSM4831571,GSM4831572,GSM4831573,GSM4831574,GSM4831575,GSM4831576,GSM4831577,GSM4831578,GSM4831579,GSM4831580,GSM4831581,GSM4831582,GSM4831583,GSM4831584,GSM4831585,GSM4831586,GSM4831587,GSM4831588,GSM4831589,GSM4831590,GSM4831591,GSM4831592,GSM4831593,GSM4831594,GSM4831595,GSM4831596,GSM4831597,GSM4831598,GSM4831599,GSM4831600,GSM4831601,GSM4831602,GSM4831603,GSM4831604,GSM4831605,GSM4831606,GSM4831607,GSM4831608,GSM4831609,GSM4831610,GSM4831611,GSM4831612,GSM4831613,GSM4831614,GSM4831615,GSM4831616,GSM4831617,GSM4831618,GSM4831619,GSM4831620,GSM4831621,GSM4831622,GSM4831623,GSM4831624,GSM4831625,GSM4831626,GSM4831627,GSM4831628
|
| 2 |
+
Essential_Thrombocythemia,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.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,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
|
|
|
|
|
|
output/preprocess/Essential_Thrombocythemia/clinical_data/GSE61629.csv
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
,GSM1388566,GSM1388567,GSM1388568,GSM1388569,GSM1388570,GSM1388571,GSM1388577,GSM1388579,GSM1388582,GSM1388584,GSM1388585,GSM1388587,GSM1388590,GSM1388591,GSM1388592,GSM1388593,GSM1388594,GSM1388595,GSM1388596,GSM1388598,GSM1388599,GSM1388600,GSM1388601,GSM1388603,GSM1388604,GSM1388605,GSM1388606,GSM1388607,GSM1388608,GSM1388614,GSM1388616,GSM1388623,GSM1388624,GSM1509517,GSM1509518,GSM1509519,GSM1509520,GSM1509521,GSM1509522,GSM1509523,GSM1509524,GSM1509525,GSM1509526,GSM1509527,GSM1509528,GSM1509529,GSM1509530,GSM1509531,GSM1509532,GSM1509533,GSM1509534,GSM1509535,GSM1509536,GSM1509537
|
| 2 |
-
Essential_Thrombocythemia,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,
|
|
|
|
| 1 |
,GSM1388566,GSM1388567,GSM1388568,GSM1388569,GSM1388570,GSM1388571,GSM1388577,GSM1388579,GSM1388582,GSM1388584,GSM1388585,GSM1388587,GSM1388590,GSM1388591,GSM1388592,GSM1388593,GSM1388594,GSM1388595,GSM1388596,GSM1388598,GSM1388599,GSM1388600,GSM1388601,GSM1388603,GSM1388604,GSM1388605,GSM1388606,GSM1388607,GSM1388608,GSM1388614,GSM1388616,GSM1388623,GSM1388624,GSM1509517,GSM1509518,GSM1509519,GSM1509520,GSM1509521,GSM1509522,GSM1509523,GSM1509524,GSM1509525,GSM1509526,GSM1509527,GSM1509528,GSM1509529,GSM1509530,GSM1509531,GSM1509532,GSM1509533,GSM1509534,GSM1509535,GSM1509536,GSM1509537
|
| 2 |
+
Essential_Thrombocythemia,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
|
output/preprocess/Essential_Thrombocythemia/code/GSE103176.py
ADDED
|
@@ -0,0 +1,364 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE103176"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE103176"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE103176.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE103176.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE103176.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
import pandas as pd
|
| 42 |
+
|
| 43 |
+
# 1) Gene expression availability
|
| 44 |
+
is_gene_available = True # Title indicates both gene and miRNA expression; gene expression likely available.
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability
|
| 47 |
+
trait_row = 3 # disease: PV / ET / healthy control
|
| 48 |
+
age_row = None # No age field found in provided characteristics
|
| 49 |
+
gender_row = 1 # Sex: M / F / not provided
|
| 50 |
+
|
| 51 |
+
# 2) Conversion functions
|
| 52 |
+
def _after_colon(x):
|
| 53 |
+
if x is None:
|
| 54 |
+
return None
|
| 55 |
+
s = str(x)
|
| 56 |
+
parts = s.split(":", 1)
|
| 57 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 58 |
+
return val.strip()
|
| 59 |
+
|
| 60 |
+
def convert_trait(x):
|
| 61 |
+
v = _after_colon(x)
|
| 62 |
+
if v is None:
|
| 63 |
+
return None
|
| 64 |
+
v_low = v.strip().lower()
|
| 65 |
+
# Positive (Essential Thrombocythemia)
|
| 66 |
+
if v_low in {"et", "essential thrombocythemia"}:
|
| 67 |
+
return 1
|
| 68 |
+
# Negative: other diseases or controls
|
| 69 |
+
if v_low in {"pv", "polycythemia vera", "healthy control", "control", "ctr", "normal", "healthy"}:
|
| 70 |
+
return 0
|
| 71 |
+
# Heuristic: if the word 'thrombocythemia' appears, consider ET
|
| 72 |
+
if "thrombocythemia" in v_low:
|
| 73 |
+
return 1
|
| 74 |
+
# Otherwise treat as non-ET if explicitly non-ET MPN (e.g., pv)
|
| 75 |
+
if "polycythemia" in v_low or "vera" in v_low:
|
| 76 |
+
return 0
|
| 77 |
+
return None
|
| 78 |
+
|
| 79 |
+
def convert_age(x):
|
| 80 |
+
# Not used (age_row is None), but provided for completeness
|
| 81 |
+
v = _after_colon(x)
|
| 82 |
+
if v is None:
|
| 83 |
+
return None
|
| 84 |
+
v_low = v.lower()
|
| 85 |
+
if any(tok in v_low for tok in ["not provided", "na", "n/a", "unknown"]):
|
| 86 |
+
return None
|
| 87 |
+
# extract first number (years)
|
| 88 |
+
m = re.search(r"(\d+(\.\d+)?)", v_low)
|
| 89 |
+
if m:
|
| 90 |
+
try:
|
| 91 |
+
val = float(m.group(1))
|
| 92 |
+
return val
|
| 93 |
+
except:
|
| 94 |
+
return None
|
| 95 |
+
return None
|
| 96 |
+
|
| 97 |
+
def convert_gender(x):
|
| 98 |
+
v = _after_colon(x)
|
| 99 |
+
if v is None:
|
| 100 |
+
return None
|
| 101 |
+
v_low = v.strip().lower()
|
| 102 |
+
if v_low in {"m", "male"}:
|
| 103 |
+
return 1
|
| 104 |
+
if v_low in {"f", "female"}:
|
| 105 |
+
return 0
|
| 106 |
+
if "not provided" in v_low or v_low in {"na", "n/a", "unknown"}:
|
| 107 |
+
return None
|
| 108 |
+
# Heuristic: start with 'm' or 'f'
|
| 109 |
+
if v_low.startswith("m"):
|
| 110 |
+
return 1
|
| 111 |
+
if v_low.startswith("f"):
|
| 112 |
+
return 0
|
| 113 |
+
return None
|
| 114 |
+
|
| 115 |
+
# 3) Save metadata (initial filtering)
|
| 116 |
+
is_trait_available = trait_row is not None
|
| 117 |
+
_ = validate_and_save_cohort_info(
|
| 118 |
+
is_final=False,
|
| 119 |
+
cohort=cohort,
|
| 120 |
+
info_path=json_path,
|
| 121 |
+
is_gene_available=is_gene_available,
|
| 122 |
+
is_trait_available=is_trait_available
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
# 4) Clinical feature extraction (if available)
|
| 126 |
+
if trait_row is not None:
|
| 127 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 128 |
+
clinical_df=clinical_data,
|
| 129 |
+
trait=trait,
|
| 130 |
+
trait_row=trait_row,
|
| 131 |
+
convert_trait=convert_trait,
|
| 132 |
+
age_row=age_row,
|
| 133 |
+
convert_age=convert_age,
|
| 134 |
+
gender_row=gender_row,
|
| 135 |
+
convert_gender=convert_gender
|
| 136 |
+
)
|
| 137 |
+
clinical_preview = preview_df(selected_clinical_df)
|
| 138 |
+
|
| 139 |
+
# Save clinical data
|
| 140 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 141 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 142 |
+
|
| 143 |
+
# Step 3: Gene Data Extraction
|
| 144 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 145 |
+
gene_data = get_genetic_data(matrix_file)
|
| 146 |
+
|
| 147 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 148 |
+
print(gene_data.index[:20])
|
| 149 |
+
|
| 150 |
+
# Step 4: Gene Identifier Review
|
| 151 |
+
# Based on the observed identifiers like '14qI-1_st' and suffixes '_st'/'_x_st',
|
| 152 |
+
# these are probe/set identifiers (e.g., Affymetrix-style), not human gene symbols.
|
| 153 |
+
print("requires_gene_mapping = True")
|
| 154 |
+
|
| 155 |
+
# Step 5: Gene Annotation
|
| 156 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 157 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 158 |
+
|
| 159 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 160 |
+
print("Gene annotation preview:")
|
| 161 |
+
print(preview_df(gene_annotation))
|
| 162 |
+
|
| 163 |
+
# Step 6: Gene Identifier Mapping
|
| 164 |
+
import os
|
| 165 |
+
import pandas as pd
|
| 166 |
+
|
| 167 |
+
# Helper to evaluate candidate ID and symbol columns for a given annotation dataframe
|
| 168 |
+
def choose_id_and_symbol_cols(annotation_df: pd.DataFrame, expr_index: pd.Index):
|
| 169 |
+
expr_ids = pd.Index(expr_index.astype(str))
|
| 170 |
+
obj_cols = [c for c in annotation_df.columns if annotation_df[c].dtype == 'object']
|
| 171 |
+
|
| 172 |
+
# Candidate gene symbol columns in order of preference
|
| 173 |
+
symbol_candidates = [
|
| 174 |
+
'Gene Symbol', 'Gene symbol', 'GeneSymbol', 'Gene Symbols', 'Symbol', 'SYMBOL',
|
| 175 |
+
'HGNC symbol', 'Approved Symbol', 'gene_assignment'
|
| 176 |
+
]
|
| 177 |
+
gene_symbol_col = None
|
| 178 |
+
for c in symbol_candidates:
|
| 179 |
+
if c in annotation_df.columns:
|
| 180 |
+
gene_symbol_col = c
|
| 181 |
+
break
|
| 182 |
+
if gene_symbol_col is None and obj_cols:
|
| 183 |
+
gene_symbol_col = obj_cols[0]
|
| 184 |
+
|
| 185 |
+
# Identify best ID column by overlap with expression IDs, with tie-break on ST-like suffix rate
|
| 186 |
+
best = {'col': None, 'overlap': -1, 'st_rate': -1.0}
|
| 187 |
+
for col in obj_cols:
|
| 188 |
+
col_vals = annotation_df[col].astype(str).str.strip()
|
| 189 |
+
overlap = col_vals.isin(expr_ids).sum()
|
| 190 |
+
st_rate = (col_vals.str.endswith('_st') | col_vals.str.endswith('_x_st') | col_vals.str.endswith('_s_st')).mean()
|
| 191 |
+
# Prefer higher overlap; if tie, prefer higher st_rate
|
| 192 |
+
if (overlap > best['overlap']) or (overlap == best['overlap'] and st_rate > best['st_rate']):
|
| 193 |
+
best = {'col': col, 'overlap': overlap, 'st_rate': float(st_rate)}
|
| 194 |
+
|
| 195 |
+
return best['col'], gene_symbol_col, best['overlap'], best['st_rate']
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
# Iterate over all SOFT files in the cohort directory and pick the best-matching annotation
|
| 199 |
+
soft_files = [os.path.join(in_cohort_dir, f) for f in os.listdir(in_cohort_dir) if 'soft' in f.lower()]
|
| 200 |
+
|
| 201 |
+
best_choice = {
|
| 202 |
+
'file': None, 'id_col': None, 'sym_col': None,
|
| 203 |
+
'matched_ann': 0, 'total_ann': 0, 'matched_expr': 0, 'total_expr': len(gene_data.index), 'st_rate': -1.0,
|
| 204 |
+
'mapping_df': None
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
for sf in soft_files:
|
| 208 |
+
try:
|
| 209 |
+
ann_df = get_gene_annotation(sf)
|
| 210 |
+
if ann_df is None or len(ann_df) == 0:
|
| 211 |
+
continue
|
| 212 |
+
|
| 213 |
+
id_col, sym_col, raw_overlap, st_rate = choose_id_and_symbol_cols(ann_df, gene_data.index)
|
| 214 |
+
if id_col is None or sym_col is None:
|
| 215 |
+
continue
|
| 216 |
+
|
| 217 |
+
# Build mapping and compute precise overlaps
|
| 218 |
+
candidate_mapping = get_gene_mapping(ann_df, prob_col=id_col, gene_col=sym_col)
|
| 219 |
+
if candidate_mapping is None or len(candidate_mapping) == 0:
|
| 220 |
+
continue
|
| 221 |
+
|
| 222 |
+
# Normalize ID column to string/stripped
|
| 223 |
+
candidate_mapping['ID'] = candidate_mapping['ID'].astype(str).str.strip()
|
| 224 |
+
expr_ids = pd.Index(gene_data.index.astype(str))
|
| 225 |
+
matched_ann = candidate_mapping['ID'].isin(expr_ids).sum()
|
| 226 |
+
total_ann = len(candidate_mapping)
|
| 227 |
+
matched_expr = expr_ids.isin(set(candidate_mapping['ID'])).sum()
|
| 228 |
+
total_expr = len(expr_ids)
|
| 229 |
+
|
| 230 |
+
# Diagnostics for this SOFT file
|
| 231 |
+
ann_rate = matched_ann / total_ann if total_ann > 0 else 0.0
|
| 232 |
+
expr_rate = matched_expr / total_expr if total_expr > 0 else 0.0
|
| 233 |
+
print(f"[Annotation scan] File: {os.path.basename(sf)}")
|
| 234 |
+
print(f" Chosen ID column: {id_col} | Gene Symbol column: {sym_col}")
|
| 235 |
+
print(f" ST-like ID rate in chosen column: {st_rate:.2%}")
|
| 236 |
+
print(f" Matched annotation IDs: {matched_ann} / {total_ann} ({ann_rate:.2%})")
|
| 237 |
+
print(f" Matched expression IDs: {matched_expr} / {total_expr} ({expr_rate:.2%})")
|
| 238 |
+
|
| 239 |
+
# Update best choice: prioritize matched_ann, then matched_expr, then st_rate
|
| 240 |
+
better = False
|
| 241 |
+
if matched_ann > best_choice['matched_ann']:
|
| 242 |
+
better = True
|
| 243 |
+
elif matched_ann == best_choice['matched_ann']:
|
| 244 |
+
if matched_expr > best_choice['matched_expr']:
|
| 245 |
+
better = True
|
| 246 |
+
elif matched_expr == best_choice['matched_expr'] and st_rate > best_choice['st_rate']:
|
| 247 |
+
better = True
|
| 248 |
+
|
| 249 |
+
if better:
|
| 250 |
+
best_choice.update({
|
| 251 |
+
'file': sf, 'id_col': id_col, 'sym_col': sym_col,
|
| 252 |
+
'matched_ann': matched_ann, 'total_ann': total_ann,
|
| 253 |
+
'matched_expr': matched_expr, 'total_expr': total_expr,
|
| 254 |
+
'st_rate': st_rate, 'mapping_df': candidate_mapping
|
| 255 |
+
})
|
| 256 |
+
|
| 257 |
+
except Exception as e:
|
| 258 |
+
print(f"[Annotation scan] Skipped {os.path.basename(sf)} due to error: {e}")
|
| 259 |
+
continue
|
| 260 |
+
|
| 261 |
+
# Apply the best mapping if overlap is non-zero; else warn and keep original gene_data unchanged
|
| 262 |
+
if best_choice['mapping_df'] is not None and best_choice['matched_ann'] > 0:
|
| 263 |
+
print("\n[Mapping selection]")
|
| 264 |
+
print(f"Selected annotation file: {os.path.basename(best_choice['file'])}")
|
| 265 |
+
ann_rate = best_choice['matched_ann'] / best_choice['total_ann'] if best_choice['total_ann'] > 0 else 0.0
|
| 266 |
+
expr_rate = best_choice['matched_expr'] / best_choice['total_expr'] if best_choice['total_expr'] > 0 else 0.0
|
| 267 |
+
print(f" Using ID column: {best_choice['id_col']} | Gene Symbol column: {best_choice['sym_col']}")
|
| 268 |
+
print(f" Matched annotation IDs: {best_choice['matched_ann']} / {best_choice['total_ann']} ({ann_rate:.2%})")
|
| 269 |
+
print(f" Matched expression IDs: {best_choice['matched_expr']} / {best_choice['total_expr']} ({expr_rate:.2%})")
|
| 270 |
+
|
| 271 |
+
# Restrict mapping to IDs present in expression to speed up apply
|
| 272 |
+
mapping_df = best_choice['mapping_df']
|
| 273 |
+
mapping_df = mapping_df[mapping_df['ID'].isin(gene_data.index.astype(str))].copy()
|
| 274 |
+
|
| 275 |
+
# Apply mapping to convert probe-level expression to gene-level expression
|
| 276 |
+
mapped_gene_data = apply_gene_mapping(gene_data, mapping_df)
|
| 277 |
+
|
| 278 |
+
# Guard against accidental empty result
|
| 279 |
+
if mapped_gene_data is not None and mapped_gene_data.shape[0] > 0 and mapped_gene_data.shape[1] > 0:
|
| 280 |
+
gene_data = mapped_gene_data
|
| 281 |
+
print(f"[Mapping] Gene-level data shape: {gene_data.shape[0]} genes x {gene_data.shape[1]} samples")
|
| 282 |
+
else:
|
| 283 |
+
print("[Warning] Mapping produced empty gene-level data. Keeping original probe-level data.")
|
| 284 |
+
else:
|
| 285 |
+
print("\n[Warning] No usable annotation mapping found (zero overlap). Keeping original probe-level data without mapping.")
|
| 286 |
+
|
| 287 |
+
# Step 7: Data Normalization and Linking
|
| 288 |
+
import os
|
| 289 |
+
import pandas as pd
|
| 290 |
+
|
| 291 |
+
# 1. Normalize gene symbols
|
| 292 |
+
# Guard: gene_data should exist from previous steps
|
| 293 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 294 |
+
|
| 295 |
+
# Ensure output directory exists and save normalized gene data (may be empty if mapping failed)
|
| 296 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 297 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 298 |
+
|
| 299 |
+
# Ensure clinical features are available (load from CSV if variable not in scope)
|
| 300 |
+
try:
|
| 301 |
+
selected_clinical_df
|
| 302 |
+
except NameError:
|
| 303 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 304 |
+
|
| 305 |
+
# 2. Link clinical and genetic data
|
| 306 |
+
is_gene_available = normalized_gene_data.shape[0] > 0
|
| 307 |
+
is_trait_available = trait in selected_clinical_df.index
|
| 308 |
+
|
| 309 |
+
if is_gene_available:
|
| 310 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 311 |
+
else:
|
| 312 |
+
# Fallback linking with clinical-only data to allow downstream processing/validation
|
| 313 |
+
linked_data = selected_clinical_df.T.copy()
|
| 314 |
+
|
| 315 |
+
# 3. Handle missing values
|
| 316 |
+
covariate_cols = [trait, 'Age', 'Gender']
|
| 317 |
+
gene_cols_present = [c for c in linked_data.columns if c not in covariate_cols]
|
| 318 |
+
|
| 319 |
+
if len(gene_cols_present) > 0:
|
| 320 |
+
processed_linked = handle_missing_values(linked_data, trait_col=trait)
|
| 321 |
+
else:
|
| 322 |
+
# No gene features present: perform covariate-only missing handling
|
| 323 |
+
df = linked_data.copy()
|
| 324 |
+
# Drop samples with missing trait
|
| 325 |
+
df = df.dropna(subset=[trait])
|
| 326 |
+
# Impute Age with mean if present
|
| 327 |
+
if 'Age' in df.columns:
|
| 328 |
+
df['Age'] = pd.to_numeric(df['Age'], errors='coerce')
|
| 329 |
+
df['Age'] = df['Age'].fillna(df['Age'].mean())
|
| 330 |
+
# Impute Gender with mode if present
|
| 331 |
+
if 'Gender' in df.columns:
|
| 332 |
+
mode_result = df['Gender'].mode()
|
| 333 |
+
if len(mode_result) > 0:
|
| 334 |
+
df['Gender'] = df['Gender'].fillna(mode_result[0])
|
| 335 |
+
else:
|
| 336 |
+
df = df.drop(columns=['Gender'])
|
| 337 |
+
processed_linked = df
|
| 338 |
+
|
| 339 |
+
# 4. Bias check and removal of biased demographics
|
| 340 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(processed_linked, trait)
|
| 341 |
+
|
| 342 |
+
# 5. Final validation and cohort info saving
|
| 343 |
+
if is_gene_available:
|
| 344 |
+
note = "INFO: Gene-level data normalization completed."
|
| 345 |
+
else:
|
| 346 |
+
note = ("ERROR: Gene identifier mapping/normalization failed. Probe/set IDs (e.g., '14qI-*_st') "
|
| 347 |
+
"did not map to human gene symbols in the available SOFT annotation; normalization removed all gene rows. "
|
| 348 |
+
"Gene expression unavailable for analysis.")
|
| 349 |
+
|
| 350 |
+
is_usable = validate_and_save_cohort_info(
|
| 351 |
+
is_final=True,
|
| 352 |
+
cohort=cohort,
|
| 353 |
+
info_path=json_path,
|
| 354 |
+
is_gene_available=is_gene_available,
|
| 355 |
+
is_trait_available=is_trait_available,
|
| 356 |
+
is_biased=is_trait_biased,
|
| 357 |
+
df=unbiased_linked_data,
|
| 358 |
+
note=note
|
| 359 |
+
)
|
| 360 |
+
|
| 361 |
+
# 6. Save linked data only if usable
|
| 362 |
+
if is_usable:
|
| 363 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 364 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Essential_Thrombocythemia/code/GSE103237.py
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE103237"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE103237"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE103237.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE103237.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE103237.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import pandas as pd
|
| 41 |
+
import re
|
| 42 |
+
|
| 43 |
+
# 1) Gene Expression Data Availability
|
| 44 |
+
# Series states: "This series includes only the GEP samples." -> gene expression available
|
| 45 |
+
is_gene_available = True
|
| 46 |
+
|
| 47 |
+
# 2) Variable Availability and Data Type Conversion
|
| 48 |
+
|
| 49 |
+
# 2.1 Data Availability
|
| 50 |
+
# Trait (Essential Thrombocythemia) can be derived from disease field
|
| 51 |
+
trait_row = 3 # 'disease: PV', 'disease: ET', 'disease: healthy control'
|
| 52 |
+
|
| 53 |
+
# No explicit age field in the sample characteristics dictionary
|
| 54 |
+
age_row = None
|
| 55 |
+
|
| 56 |
+
# Gender field present
|
| 57 |
+
gender_row = 1 # 'Sex: M', 'Sex: F', 'Sex: not provided'
|
| 58 |
+
|
| 59 |
+
# 2.2 Data Type Conversion
|
| 60 |
+
def _after_colon(val):
|
| 61 |
+
if val is None:
|
| 62 |
+
return None
|
| 63 |
+
if not isinstance(val, str):
|
| 64 |
+
return str(val)
|
| 65 |
+
parts = val.split(":", 1)
|
| 66 |
+
return parts[1].strip() if len(parts) == 2 else val.strip()
|
| 67 |
+
|
| 68 |
+
def convert_trait(x):
|
| 69 |
+
"""
|
| 70 |
+
Map ET to 1, others (PV, healthy/control) to 0. Unknown -> None.
|
| 71 |
+
"""
|
| 72 |
+
v = _after_colon(x)
|
| 73 |
+
if v is None:
|
| 74 |
+
return None
|
| 75 |
+
v_norm = v.strip().lower()
|
| 76 |
+
# Normalize common forms
|
| 77 |
+
if v_norm in {"et", "essential thrombocythemia", "essential thrombocythaemia"}:
|
| 78 |
+
return 1
|
| 79 |
+
if v_norm in {"pv", "polycythemia vera", "polycythaemia vera", "healthy control", "control", "ctr", "healthy"}:
|
| 80 |
+
return 0
|
| 81 |
+
# Heuristics
|
| 82 |
+
if "thrombocythem" in v_norm and "essential" in v_norm:
|
| 83 |
+
return 1
|
| 84 |
+
if "polycythem" in v_norm or "healthy" in v_norm or "control" in v_norm:
|
| 85 |
+
return 0
|
| 86 |
+
return None
|
| 87 |
+
|
| 88 |
+
def convert_age(x):
|
| 89 |
+
"""
|
| 90 |
+
Return age as float if available, else None.
|
| 91 |
+
"""
|
| 92 |
+
v = _after_colon(x)
|
| 93 |
+
if v is None:
|
| 94 |
+
return None
|
| 95 |
+
v = v.strip()
|
| 96 |
+
# Remove common units or text
|
| 97 |
+
v = re.sub(r"[^\d\.]", " ", v)
|
| 98 |
+
v = re.sub(r"\s+", " ", v).strip()
|
| 99 |
+
try:
|
| 100 |
+
return float(v)
|
| 101 |
+
except:
|
| 102 |
+
return None
|
| 103 |
+
|
| 104 |
+
def convert_gender(x):
|
| 105 |
+
"""
|
| 106 |
+
Female -> 0, Male -> 1, Unknown/Not provided -> None.
|
| 107 |
+
"""
|
| 108 |
+
v = _after_colon(x)
|
| 109 |
+
if v is None:
|
| 110 |
+
return None
|
| 111 |
+
v_norm = v.strip().lower()
|
| 112 |
+
if v_norm in {"m", "male"}:
|
| 113 |
+
return 1
|
| 114 |
+
if v_norm in {"f", "female"}:
|
| 115 |
+
return 0
|
| 116 |
+
if "not provided" in v_norm or v_norm in {"na", "n/a", "unknown", ""}:
|
| 117 |
+
return None
|
| 118 |
+
# Heuristic
|
| 119 |
+
if v_norm.startswith("m"):
|
| 120 |
+
return 1
|
| 121 |
+
if v_norm.startswith("f"):
|
| 122 |
+
return 0
|
| 123 |
+
return None
|
| 124 |
+
|
| 125 |
+
# 3) Save Metadata (initial filtering)
|
| 126 |
+
is_trait_available = trait_row is not None
|
| 127 |
+
_ = validate_and_save_cohort_info(
|
| 128 |
+
is_final=False,
|
| 129 |
+
cohort=cohort,
|
| 130 |
+
info_path=json_path,
|
| 131 |
+
is_gene_available=is_gene_available,
|
| 132 |
+
is_trait_available=is_trait_available
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
# 4) Clinical Feature Extraction (only if clinical data is available)
|
| 136 |
+
if trait_row is not None:
|
| 137 |
+
# Extract clinical features
|
| 138 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 139 |
+
clinical_df=clinical_data,
|
| 140 |
+
trait=trait,
|
| 141 |
+
trait_row=trait_row,
|
| 142 |
+
convert_trait=convert_trait,
|
| 143 |
+
age_row=age_row,
|
| 144 |
+
convert_age=convert_age if age_row is not None else None,
|
| 145 |
+
gender_row=gender_row,
|
| 146 |
+
convert_gender=convert_gender
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
# Preview and save
|
| 150 |
+
preview = preview_df(selected_clinical_df)
|
| 151 |
+
print(preview)
|
| 152 |
+
|
| 153 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 154 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 155 |
+
|
| 156 |
+
# Step 3: Gene Data Extraction
|
| 157 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 158 |
+
gene_data = get_genetic_data(matrix_file)
|
| 159 |
+
|
| 160 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 161 |
+
print(gene_data.index[:20])
|
| 162 |
+
|
| 163 |
+
# Step 4: Gene Identifier Review
|
| 164 |
+
print("requires_gene_mapping = True")
|
| 165 |
+
|
| 166 |
+
# Step 5: Gene Annotation
|
| 167 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 168 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 169 |
+
|
| 170 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 171 |
+
print("Gene annotation preview:")
|
| 172 |
+
print(preview_df(gene_annotation))
|
| 173 |
+
|
| 174 |
+
# Step 6: Gene Identifier Mapping
|
| 175 |
+
# Map probe IDs to gene symbols using annotation columns 'ID' and 'Gene Symbol'
|
| 176 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
| 177 |
+
|
| 178 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 179 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 180 |
+
|
| 181 |
+
# Step 7: Data Normalization and Linking
|
| 182 |
+
import os
|
| 183 |
+
|
| 184 |
+
# 1. Normalize gene symbols and save
|
| 185 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 186 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 187 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 188 |
+
|
| 189 |
+
# Optional sanity check
|
| 190 |
+
print(f"Normalized gene data shape: {normalized_gene_data.shape}")
|
| 191 |
+
|
| 192 |
+
# 2. Link clinical and genetic data
|
| 193 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 194 |
+
print(f"Linked data shape (before missing handling): {linked_data.shape}")
|
| 195 |
+
|
| 196 |
+
# 3. Handle missing values
|
| 197 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 198 |
+
print(f"Linked data shape (after missing handling): {linked_data.shape}")
|
| 199 |
+
|
| 200 |
+
# 4. Bias check and remove biased demographic features
|
| 201 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 202 |
+
|
| 203 |
+
# 5. Final validation and save cohort info
|
| 204 |
+
note = "INFO: Gene symbols normalized via NCBI synonyms; probe-to-gene mapped with equal-split; missing values handled per protocol."
|
| 205 |
+
is_usable = validate_and_save_cohort_info(
|
| 206 |
+
is_final=True,
|
| 207 |
+
cohort=cohort,
|
| 208 |
+
info_path=json_path,
|
| 209 |
+
is_gene_available=True,
|
| 210 |
+
is_trait_available=True,
|
| 211 |
+
is_biased=is_trait_biased,
|
| 212 |
+
df=unbiased_linked_data,
|
| 213 |
+
note=note
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
# 6. Save linked data if usable
|
| 217 |
+
if is_usable:
|
| 218 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 219 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Essential_Thrombocythemia/code/GSE12295.py
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE12295"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE12295"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE12295.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE12295.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE12295.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
import pandas as pd
|
| 42 |
+
|
| 43 |
+
# 1) Gene expression data availability
|
| 44 |
+
is_gene_available = True # Platelet-focused spotted oligonucleotide arrays -> mRNA expression
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability and conversion functions
|
| 47 |
+
|
| 48 |
+
# Keys in the sample characteristics dictionary
|
| 49 |
+
trait_row = 0
|
| 50 |
+
age_row = None
|
| 51 |
+
gender_row = None
|
| 52 |
+
|
| 53 |
+
def _extract_value(x):
|
| 54 |
+
if x is None:
|
| 55 |
+
return None
|
| 56 |
+
s = str(x).strip()
|
| 57 |
+
parts = s.split(":", 1)
|
| 58 |
+
return parts[1].strip() if len(parts) == 2 else s
|
| 59 |
+
|
| 60 |
+
def convert_trait(x):
|
| 61 |
+
v = _extract_value(x)
|
| 62 |
+
if v is None:
|
| 63 |
+
return None
|
| 64 |
+
v_low = v.lower().strip()
|
| 65 |
+
# Normalize
|
| 66 |
+
v_clean = re.sub(r'[^a-z\s]', ' ', v_low)
|
| 67 |
+
v_clean = re.sub(r'\s+', ' ', v_clean).strip()
|
| 68 |
+
|
| 69 |
+
# Binary: ET = 1, others (Normal/RT) = 0
|
| 70 |
+
if 'essential thromb' in v_clean:
|
| 71 |
+
return 1
|
| 72 |
+
if 'reactive thrombocytosis' in v_clean or 'reactive thrombocythaemia' in v_clean or v_clean == 'rt':
|
| 73 |
+
return 0
|
| 74 |
+
if 'normal' in v_clean or 'control' in v_clean:
|
| 75 |
+
return 0
|
| 76 |
+
return None
|
| 77 |
+
|
| 78 |
+
def convert_age(x):
|
| 79 |
+
# Not available in this cohort; robust converter provided for completeness
|
| 80 |
+
v = _extract_value(x)
|
| 81 |
+
if v is None:
|
| 82 |
+
return None
|
| 83 |
+
# Extract first number that looks like age
|
| 84 |
+
m = re.search(r'(\d+(\.\d+)?)', str(v))
|
| 85 |
+
if not m:
|
| 86 |
+
return None
|
| 87 |
+
try:
|
| 88 |
+
age = float(m.group(1))
|
| 89 |
+
# Filter out impossible ages
|
| 90 |
+
if 0 < age < 120:
|
| 91 |
+
return age
|
| 92 |
+
except Exception:
|
| 93 |
+
pass
|
| 94 |
+
return None
|
| 95 |
+
|
| 96 |
+
def convert_gender(x):
|
| 97 |
+
# Not available in this cohort; robust converter provided for completeness
|
| 98 |
+
v = _extract_value(x)
|
| 99 |
+
if v is None:
|
| 100 |
+
return None
|
| 101 |
+
v_low = v.lower().strip()
|
| 102 |
+
# Handle common encodings
|
| 103 |
+
if v_low in {'male', 'm', 'man', 'boy'}:
|
| 104 |
+
return 1
|
| 105 |
+
if v_low in {'female', 'f', 'woman', 'girl'}:
|
| 106 |
+
return 0
|
| 107 |
+
# Token-based fallback
|
| 108 |
+
if 'male' in v_low and 'female' not in v_low:
|
| 109 |
+
return 1
|
| 110 |
+
if 'female' in v_low and 'male' not in v_low:
|
| 111 |
+
return 0
|
| 112 |
+
return None
|
| 113 |
+
|
| 114 |
+
# 3) Save metadata: initial filtering
|
| 115 |
+
is_trait_available = trait_row is not None
|
| 116 |
+
_ = validate_and_save_cohort_info(
|
| 117 |
+
is_final=False,
|
| 118 |
+
cohort=cohort,
|
| 119 |
+
info_path=json_path,
|
| 120 |
+
is_gene_available=is_gene_available,
|
| 121 |
+
is_trait_available=is_trait_available
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
# 4) Clinical feature extraction, preview, and save
|
| 125 |
+
if trait_row is not None:
|
| 126 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 127 |
+
clinical_df=clinical_data,
|
| 128 |
+
trait=trait,
|
| 129 |
+
trait_row=trait_row,
|
| 130 |
+
convert_trait=convert_trait,
|
| 131 |
+
age_row=age_row,
|
| 132 |
+
convert_age=convert_age,
|
| 133 |
+
gender_row=gender_row,
|
| 134 |
+
convert_gender=convert_gender
|
| 135 |
+
)
|
| 136 |
+
preview = preview_df(selected_clinical_df)
|
| 137 |
+
print("Selected clinical features preview:", preview)
|
| 138 |
+
|
| 139 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 140 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 141 |
+
|
| 142 |
+
# Step 3: Gene Data Extraction
|
| 143 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 144 |
+
gene_data = get_genetic_data(matrix_file)
|
| 145 |
+
|
| 146 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 147 |
+
print(gene_data.index[:20])
|
| 148 |
+
|
| 149 |
+
# Step 4: Gene Identifier Review
|
| 150 |
+
print("requires_gene_mapping = True")
|
| 151 |
+
|
| 152 |
+
# Step 5: Gene Annotation
|
| 153 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 154 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 155 |
+
|
| 156 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 157 |
+
print("Gene annotation preview:")
|
| 158 |
+
print(preview_df(gene_annotation))
|
| 159 |
+
|
| 160 |
+
# Step 6: Gene Identifier Mapping
|
| 161 |
+
# Decide the columns: probe IDs match 'ID' in annotation; gene symbols in 'Gene Symbol'
|
| 162 |
+
id_col, gene_col = 'ID', 'Gene Symbol'
|
| 163 |
+
assert id_col in gene_annotation.columns and gene_col in gene_annotation.columns
|
| 164 |
+
|
| 165 |
+
# Build mapping dataframe
|
| 166 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=id_col, gene_col=gene_col)
|
| 167 |
+
|
| 168 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 169 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
| 170 |
+
|
| 171 |
+
# Step 7: Data Normalization and Linking
|
| 172 |
+
import os
|
| 173 |
+
|
| 174 |
+
# 1. Normalize gene symbols and save gene expression data
|
| 175 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 176 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 177 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 178 |
+
|
| 179 |
+
# 2. Link clinical and genetic data
|
| 180 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 181 |
+
|
| 182 |
+
# 3. Handle missing values
|
| 183 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 184 |
+
|
| 185 |
+
# 4. Assess bias and remove biased demographic features
|
| 186 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 187 |
+
|
| 188 |
+
# 5. Final validation and save cohort info
|
| 189 |
+
# Ensure native Python bools to avoid JSON serialization issues
|
| 190 |
+
is_gene_available = bool((normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0))
|
| 191 |
+
trait_col_exists = bool(trait in unbiased_linked_data.columns)
|
| 192 |
+
trait_has_non_na = bool(unbiased_linked_data[trait].notna().any()) if trait_col_exists else False
|
| 193 |
+
is_trait_available = bool(trait_col_exists and trait_has_non_na)
|
| 194 |
+
is_trait_biased_bool = bool(is_trait_biased)
|
| 195 |
+
|
| 196 |
+
note = "INFO: Age and Gender not available; cohort mixes ET, RT, and normal controls; trait binarized as ET vs others."
|
| 197 |
+
is_usable = validate_and_save_cohort_info(
|
| 198 |
+
is_final=True,
|
| 199 |
+
cohort=cohort,
|
| 200 |
+
info_path=json_path,
|
| 201 |
+
is_gene_available=is_gene_available,
|
| 202 |
+
is_trait_available=is_trait_available,
|
| 203 |
+
is_biased=is_trait_biased_bool,
|
| 204 |
+
df=unbiased_linked_data,
|
| 205 |
+
note=note
|
| 206 |
+
)
|
| 207 |
+
|
| 208 |
+
# 6. Save linked data if usable
|
| 209 |
+
if is_usable:
|
| 210 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 211 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Essential_Thrombocythemia/code/GSE159514.py
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE159514"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE159514"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE159514.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE159514.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE159514.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
import pandas as pd
|
| 42 |
+
|
| 43 |
+
# 1) Gene expression data availability (Affymetrix GEP per background)
|
| 44 |
+
is_gene_available = True
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability and converters
|
| 47 |
+
# From the sample characteristics:
|
| 48 |
+
# 0: disease: Overt-PMF, Pre-PMF, PET, PPV
|
| 49 |
+
# 1: driver mutation: ...
|
| 50 |
+
trait_row = 0 # disease info available; we will infer ET trait from 'PET' (post-ET MF)
|
| 51 |
+
age_row = None
|
| 52 |
+
gender_row = None
|
| 53 |
+
|
| 54 |
+
def _extract_after_colon(x: str) -> str:
|
| 55 |
+
if x is None:
|
| 56 |
+
return ""
|
| 57 |
+
if not isinstance(x, str):
|
| 58 |
+
try:
|
| 59 |
+
x = str(x)
|
| 60 |
+
except Exception:
|
| 61 |
+
return ""
|
| 62 |
+
parts = x.split(":", 1)
|
| 63 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 64 |
+
return val.strip()
|
| 65 |
+
|
| 66 |
+
def convert_trait(x):
|
| 67 |
+
"""
|
| 68 |
+
Map disease to ET-related (1) if post-ET myelofibrosis (PET), else 0.
|
| 69 |
+
Unknown -> None.
|
| 70 |
+
"""
|
| 71 |
+
val = _extract_after_colon(x).lower()
|
| 72 |
+
if not val:
|
| 73 |
+
return None
|
| 74 |
+
# direct known labels
|
| 75 |
+
if val in {"pet"}:
|
| 76 |
+
return 1
|
| 77 |
+
if val in {"ppv", "overt-pmf", "pre-pmf"}:
|
| 78 |
+
return 0
|
| 79 |
+
# heuristic fallbacks
|
| 80 |
+
if "post-et" in val or "post essential thrombocythemia" in val or "post et" in val:
|
| 81 |
+
return 1
|
| 82 |
+
if "post pv" in val or "pmf" in val:
|
| 83 |
+
return 0
|
| 84 |
+
return None
|
| 85 |
+
|
| 86 |
+
def convert_age(x):
|
| 87 |
+
"""
|
| 88 |
+
Convert age to continuous float if present; else None.
|
| 89 |
+
Not used here since age_row is None.
|
| 90 |
+
"""
|
| 91 |
+
val = _extract_after_colon(x)
|
| 92 |
+
if not val:
|
| 93 |
+
return None
|
| 94 |
+
# remove non-digit except dot
|
| 95 |
+
m = re.findall(r"[\d.]+", val)
|
| 96 |
+
if not m:
|
| 97 |
+
return None
|
| 98 |
+
try:
|
| 99 |
+
return float(m[0])
|
| 100 |
+
except Exception:
|
| 101 |
+
return None
|
| 102 |
+
|
| 103 |
+
def convert_gender(x):
|
| 104 |
+
"""
|
| 105 |
+
Convert gender to binary: female->0, male->1; else None.
|
| 106 |
+
Not used here since gender_row is None.
|
| 107 |
+
"""
|
| 108 |
+
val = _extract_after_colon(x).lower()
|
| 109 |
+
if not val:
|
| 110 |
+
return None
|
| 111 |
+
if val in {"f", "female", "woman", "women"}:
|
| 112 |
+
return 0
|
| 113 |
+
if val in {"m", "male", "man", "men"}:
|
| 114 |
+
return 1
|
| 115 |
+
return None
|
| 116 |
+
|
| 117 |
+
# 3) Initial filtering and metadata saving
|
| 118 |
+
is_trait_available = trait_row is not None
|
| 119 |
+
_ = validate_and_save_cohort_info(
|
| 120 |
+
is_final=False,
|
| 121 |
+
cohort=cohort,
|
| 122 |
+
info_path=json_path,
|
| 123 |
+
is_gene_available=is_gene_available,
|
| 124 |
+
is_trait_available=is_trait_available
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
# 4) Clinical feature extraction (only if clinical trait data available)
|
| 128 |
+
if trait_row is not None:
|
| 129 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 130 |
+
clinical_df=clinical_data,
|
| 131 |
+
trait=trait,
|
| 132 |
+
trait_row=trait_row,
|
| 133 |
+
convert_trait=convert_trait,
|
| 134 |
+
age_row=age_row,
|
| 135 |
+
convert_age=convert_age,
|
| 136 |
+
gender_row=gender_row,
|
| 137 |
+
convert_gender=convert_gender
|
| 138 |
+
)
|
| 139 |
+
clinical_preview = preview_df(selected_clinical_df)
|
| 140 |
+
print({"clinical_preview": clinical_preview})
|
| 141 |
+
|
| 142 |
+
# Ensure output directory exists and save
|
| 143 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 144 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 145 |
+
|
| 146 |
+
# Step 3: Gene Data Extraction
|
| 147 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 148 |
+
gene_data = get_genetic_data(matrix_file)
|
| 149 |
+
|
| 150 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 151 |
+
print(gene_data.index[:20])
|
| 152 |
+
|
| 153 |
+
# Step 4: Gene Identifier Review
|
| 154 |
+
# Affymetrix probe set IDs detected (e.g., '11715100_at'); mapping to human gene symbols is required.
|
| 155 |
+
print("requires_gene_mapping = True")
|
| 156 |
+
|
| 157 |
+
# Step 5: Gene Annotation
|
| 158 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 159 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 160 |
+
|
| 161 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 162 |
+
print("Gene annotation preview:")
|
| 163 |
+
print(preview_df(gene_annotation))
|
| 164 |
+
|
| 165 |
+
# Step 6: Gene Identifier Mapping
|
| 166 |
+
# 1) Identify the appropriate columns for probe IDs and gene symbols in the annotation
|
| 167 |
+
probe_col = 'ID'
|
| 168 |
+
gene_symbol_col = 'Gene Symbol'
|
| 169 |
+
|
| 170 |
+
# 2) Build the probe-to-gene mapping dataframe
|
| 171 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
| 172 |
+
|
| 173 |
+
# 3) Apply the mapping to convert probe-level data to gene-level expression
|
| 174 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 175 |
+
|
| 176 |
+
# Step 7: Data Normalization and Linking
|
| 177 |
+
import os
|
| 178 |
+
|
| 179 |
+
# 1. Normalize gene symbols and save gene matrix
|
| 180 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 181 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 182 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 183 |
+
|
| 184 |
+
# 2. Link clinical and genetic data
|
| 185 |
+
# Use in-memory clinical df if available; otherwise load from saved file
|
| 186 |
+
try:
|
| 187 |
+
clinical_df_to_use = selected_clinical_df
|
| 188 |
+
except NameError:
|
| 189 |
+
clinical_df_to_use = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 190 |
+
|
| 191 |
+
linked_data = geo_link_clinical_genetic_data(clinical_df_to_use, normalized_gene_data)
|
| 192 |
+
|
| 193 |
+
# 3. Handle missing values
|
| 194 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 195 |
+
|
| 196 |
+
# 4. Bias checks and removal of biased covariates
|
| 197 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 198 |
+
|
| 199 |
+
# 5. Final validation and metadata saving
|
| 200 |
+
note = "INFO: Trait defined as PET (post-ET MF) vs other MF subtypes. Age and Gender not available in series matrix."
|
| 201 |
+
is_usable = validate_and_save_cohort_info(
|
| 202 |
+
is_final=True,
|
| 203 |
+
cohort=cohort,
|
| 204 |
+
info_path=json_path,
|
| 205 |
+
is_gene_available=True,
|
| 206 |
+
is_trait_available=True,
|
| 207 |
+
is_biased=is_trait_biased,
|
| 208 |
+
df=unbiased_linked_data,
|
| 209 |
+
note=note
|
| 210 |
+
)
|
| 211 |
+
|
| 212 |
+
# 6. Save linked data if usable
|
| 213 |
+
if is_usable:
|
| 214 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 215 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Essential_Thrombocythemia/code/GSE174060.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE174060"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE174060"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE174060.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE174060.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE174060.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import pandas as pd
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression availability (based on series description)
|
| 43 |
+
is_gene_available = True
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability
|
| 46 |
+
trait_row = 4 # diagnosis
|
| 47 |
+
age_row = 2 # age
|
| 48 |
+
gender_row = 3 # Sex
|
| 49 |
+
|
| 50 |
+
def _after_colon(value):
|
| 51 |
+
if value is None:
|
| 52 |
+
return None
|
| 53 |
+
s = str(value)
|
| 54 |
+
parts = s.split(":", 1)
|
| 55 |
+
v = parts[1] if len(parts) > 1 else parts[0]
|
| 56 |
+
return v.strip()
|
| 57 |
+
|
| 58 |
+
# 2.2 Converters
|
| 59 |
+
def convert_trait(x):
|
| 60 |
+
v = _after_colon(x)
|
| 61 |
+
if v is None or v == "":
|
| 62 |
+
return None
|
| 63 |
+
v_low = v.lower().strip()
|
| 64 |
+
# Positive ET definitions
|
| 65 |
+
et_pos = {"et", "essential thrombocythemia", "essential thrombocythaemia"}
|
| 66 |
+
# Explicit negatives seen in this dataset and common variants
|
| 67 |
+
negatives = {
|
| 68 |
+
"healthy control", "control",
|
| 69 |
+
"pv", "polycythemia vera",
|
| 70 |
+
"pmf", "primary myelofibrosis",
|
| 71 |
+
"ppv-mf", "pet-mf", "smf", "secondary mf",
|
| 72 |
+
"post-pv-mf", "post-et-mf"
|
| 73 |
+
}
|
| 74 |
+
if v_low in et_pos:
|
| 75 |
+
return 1
|
| 76 |
+
if v_low in negatives:
|
| 77 |
+
return 0
|
| 78 |
+
# Heuristics: avoid mapping post-ET-MF (contains et but is not ET)
|
| 79 |
+
if v_low.startswith("post-et") or "post-et" in v_low or "p et" in v_low or "pet-mf" in v_low:
|
| 80 |
+
return 0
|
| 81 |
+
# If it contains 'polycythemia' or 'myelofibrosis' it is not ET
|
| 82 |
+
if "polycythemia" in v_low or "myelofibrosis" in v_low:
|
| 83 |
+
return 0
|
| 84 |
+
# Unknown diagnosis -> None
|
| 85 |
+
return None
|
| 86 |
+
|
| 87 |
+
def convert_age(x):
|
| 88 |
+
v = _after_colon(x)
|
| 89 |
+
if v is None or v == "":
|
| 90 |
+
return None
|
| 91 |
+
v = v.strip()
|
| 92 |
+
if v.lower() in {"na", "n/a", "unknown"}:
|
| 93 |
+
return None
|
| 94 |
+
try:
|
| 95 |
+
return float(v)
|
| 96 |
+
except Exception:
|
| 97 |
+
return None
|
| 98 |
+
|
| 99 |
+
def convert_gender(x):
|
| 100 |
+
v = _after_colon(x)
|
| 101 |
+
if v is None or v == "":
|
| 102 |
+
return None
|
| 103 |
+
v_low = v.lower().strip()
|
| 104 |
+
if v_low in {"f", "female"}:
|
| 105 |
+
return 0
|
| 106 |
+
if v_low in {"m", "male"}:
|
| 107 |
+
return 1
|
| 108 |
+
return None
|
| 109 |
+
|
| 110 |
+
# 3) Save metadata (initial filtering)
|
| 111 |
+
is_trait_available = trait_row is not None
|
| 112 |
+
validate_and_save_cohort_info(
|
| 113 |
+
is_final=False,
|
| 114 |
+
cohort=cohort,
|
| 115 |
+
info_path=json_path,
|
| 116 |
+
is_gene_available=is_gene_available,
|
| 117 |
+
is_trait_available=is_trait_available
|
| 118 |
+
)
|
| 119 |
+
|
| 120 |
+
# 4) Clinical feature extraction (only if trait_row available)
|
| 121 |
+
if trait_row is not None:
|
| 122 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 123 |
+
clinical_df=clinical_data,
|
| 124 |
+
trait=trait,
|
| 125 |
+
trait_row=trait_row,
|
| 126 |
+
convert_trait=convert_trait,
|
| 127 |
+
age_row=age_row,
|
| 128 |
+
convert_age=convert_age,
|
| 129 |
+
gender_row=gender_row,
|
| 130 |
+
convert_gender=convert_gender
|
| 131 |
+
)
|
| 132 |
+
preview = preview_df(selected_clinical_df)
|
| 133 |
+
print(preview)
|
| 134 |
+
|
| 135 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 136 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 137 |
+
|
| 138 |
+
# Step 3: Gene Data Extraction
|
| 139 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 140 |
+
gene_data = get_genetic_data(matrix_file)
|
| 141 |
+
|
| 142 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 143 |
+
print(gene_data.index[:20])
|
| 144 |
+
|
| 145 |
+
# Step 4: Gene Identifier Review
|
| 146 |
+
requires_gene_mapping = True
|
| 147 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 148 |
+
|
| 149 |
+
# Step 5: Gene Annotation
|
| 150 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 151 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 152 |
+
|
| 153 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 154 |
+
print("Gene annotation preview:")
|
| 155 |
+
print(preview_df(gene_annotation))
|
| 156 |
+
|
| 157 |
+
# Step 6: Gene Identifier Mapping
|
| 158 |
+
# Identify the appropriate columns for mapping:
|
| 159 |
+
# - Probe/ID column matches the expression data index: 'ID'
|
| 160 |
+
# - Gene symbol information is embedded in 'gene_assignment'
|
| 161 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
|
| 162 |
+
|
| 163 |
+
# Apply mapping to convert probe-level data to gene-level data
|
| 164 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 165 |
+
|
| 166 |
+
# Step 7: Data Normalization and Linking
|
| 167 |
+
import os
|
| 168 |
+
|
| 169 |
+
# 1. Normalize gene symbols and save gene expression data
|
| 170 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 171 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 172 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 173 |
+
|
| 174 |
+
# 2. Link clinical and genetic data
|
| 175 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 176 |
+
|
| 177 |
+
# 3. Handle missing values
|
| 178 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 179 |
+
|
| 180 |
+
# 4. Bias checking and removal of biased demographic features
|
| 181 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 182 |
+
|
| 183 |
+
# 5. Final validation and save cohort info
|
| 184 |
+
note = "INFO: Affymetrix transcript-cluster IDs mapped via 'gene_assignment'; trait is ET vs others; included Age and Gender."
|
| 185 |
+
is_usable = validate_and_save_cohort_info(
|
| 186 |
+
is_final=True,
|
| 187 |
+
cohort=cohort,
|
| 188 |
+
info_path=json_path,
|
| 189 |
+
is_gene_available=True,
|
| 190 |
+
is_trait_available=True,
|
| 191 |
+
is_biased=is_trait_biased,
|
| 192 |
+
df=unbiased_linked_data,
|
| 193 |
+
note=note
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
# 6. Save linked data if usable
|
| 197 |
+
if is_usable:
|
| 198 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 199 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Essential_Thrombocythemia/code/GSE55976.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE55976"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE55976"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE55976.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE55976.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE55976.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
|
| 42 |
+
# 1) Gene Expression Data Availability
|
| 43 |
+
is_gene_available = True # cDNA microarray gene expression profiling per series summary
|
| 44 |
+
|
| 45 |
+
# 2) Variable Availability and Converters
|
| 46 |
+
# From the sample characteristics dictionary:
|
| 47 |
+
# 0: subject condition (contains ET and non-ET labels)
|
| 48 |
+
# 1: cell type (not needed for this step)
|
| 49 |
+
trait_row = 0
|
| 50 |
+
age_row = None
|
| 51 |
+
gender_row = None
|
| 52 |
+
|
| 53 |
+
def convert_trait(x):
|
| 54 |
+
if x is None:
|
| 55 |
+
return None
|
| 56 |
+
s = str(x)
|
| 57 |
+
if ':' in s:
|
| 58 |
+
s = s.split(':', 1)[1]
|
| 59 |
+
val = s.strip().lower()
|
| 60 |
+
# Map ET (both JAK2+/-) to 1, other conditions (including healthy) to 0
|
| 61 |
+
if ('essential thrombocythemia' in val) or ('essential thrombocytosis' in val) or re.search(r'\bet\b', val):
|
| 62 |
+
return 1
|
| 63 |
+
known_non_et_terms = [
|
| 64 |
+
'healthy', 'polycythemia vera', 'pv', 'primary myelofibrosis', 'pmf',
|
| 65 |
+
'chronic myelogenous leukemia', 'cml'
|
| 66 |
+
]
|
| 67 |
+
if any(k in val for k in known_non_et_terms):
|
| 68 |
+
return 0
|
| 69 |
+
return None
|
| 70 |
+
|
| 71 |
+
def convert_age(x):
|
| 72 |
+
if x is None:
|
| 73 |
+
return None
|
| 74 |
+
s = str(x)
|
| 75 |
+
if ':' in s:
|
| 76 |
+
s = s.split(':', 1)[1]
|
| 77 |
+
s = s.strip()
|
| 78 |
+
m = re.search(r'[-+]?\d*\.?\d+', s)
|
| 79 |
+
return float(m.group()) if m else None
|
| 80 |
+
|
| 81 |
+
def convert_gender(x):
|
| 82 |
+
if x is None:
|
| 83 |
+
return None
|
| 84 |
+
s = str(x)
|
| 85 |
+
if ':' in s:
|
| 86 |
+
s = s.split(':', 1)[1]
|
| 87 |
+
val = s.strip().lower()
|
| 88 |
+
if val in ['female', 'f', 'woman', 'women', 'girl']:
|
| 89 |
+
return 0
|
| 90 |
+
if val in ['male', 'm', 'man', 'men', 'boy']:
|
| 91 |
+
return 1
|
| 92 |
+
return None
|
| 93 |
+
|
| 94 |
+
# 3) Save Metadata (initial filtering)
|
| 95 |
+
is_trait_available = trait_row is not None
|
| 96 |
+
_ = validate_and_save_cohort_info(
|
| 97 |
+
is_final=False,
|
| 98 |
+
cohort=cohort,
|
| 99 |
+
info_path=json_path,
|
| 100 |
+
is_gene_available=is_gene_available,
|
| 101 |
+
is_trait_available=is_trait_available
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
# 4) Clinical Feature Extraction (only if trait_row is available)
|
| 105 |
+
if trait_row is not None:
|
| 106 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 107 |
+
clinical_df=clinical_data,
|
| 108 |
+
trait=trait,
|
| 109 |
+
trait_row=trait_row,
|
| 110 |
+
convert_trait=convert_trait,
|
| 111 |
+
age_row=age_row,
|
| 112 |
+
convert_age=convert_age,
|
| 113 |
+
gender_row=gender_row,
|
| 114 |
+
convert_gender=convert_gender
|
| 115 |
+
)
|
| 116 |
+
preview = preview_df(selected_clinical_df)
|
| 117 |
+
print("Selected clinical features preview:", preview)
|
| 118 |
+
|
| 119 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 120 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 121 |
+
|
| 122 |
+
# Step 3: Gene Data Extraction
|
| 123 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 124 |
+
gene_data = get_genetic_data(matrix_file)
|
| 125 |
+
|
| 126 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 127 |
+
print(gene_data.index[:20])
|
| 128 |
+
|
| 129 |
+
# Step 4: Gene Identifier Review
|
| 130 |
+
# The provided identifiers are numeric strings (e.g., '6590728'), not standard human gene symbols.
|
| 131 |
+
requires_gene_mapping = True
|
| 132 |
+
print("requires_gene_mapping = True")
|
| 133 |
+
|
| 134 |
+
# Step 5: Gene Annotation
|
| 135 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 136 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 137 |
+
|
| 138 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 139 |
+
print("Gene annotation preview:")
|
| 140 |
+
print(preview_df(gene_annotation))
|
| 141 |
+
|
| 142 |
+
# Step 6: Gene Identifier Mapping
|
| 143 |
+
# Map probe IDs to gene symbols based on annotation preview:
|
| 144 |
+
# Probe identifier column: 'ID' (matches numeric strings like '6590728')
|
| 145 |
+
# Gene symbol column: 'GENE SYMBOL'
|
| 146 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='GENE SYMBOL')
|
| 147 |
+
|
| 148 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 149 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
| 150 |
+
|
| 151 |
+
# Step 7: Data Normalization and Linking
|
| 152 |
+
import os
|
| 153 |
+
|
| 154 |
+
# 1) Normalize gene symbols and save gene expression data
|
| 155 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 156 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 157 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 158 |
+
|
| 159 |
+
# 2) Link clinical and genetic data
|
| 160 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 161 |
+
|
| 162 |
+
# 3) Handle missing values
|
| 163 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 164 |
+
|
| 165 |
+
# 4) Assess bias and drop biased demographics
|
| 166 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 167 |
+
|
| 168 |
+
# 5) Final validation and metadata saving
|
| 169 |
+
# Ensure native Python types for JSON serialization
|
| 170 |
+
is_gene_available = bool((normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0))
|
| 171 |
+
is_trait_available = bool((trait in linked_data.columns) and (linked_data[trait].notna().sum() > 0))
|
| 172 |
+
is_trait_biased = bool(is_trait_biased)
|
| 173 |
+
note = str("INFO: Trait derived from 'subject condition' (ET vs non-ET). "
|
| 174 |
+
"No age/gender fields available in annotations. "
|
| 175 |
+
"Samples include mixed cell types (CD34+ and granulocytes).")
|
| 176 |
+
|
| 177 |
+
# Ensure the metadata directory exists (file creation is handled inside the function)
|
| 178 |
+
os.makedirs(os.path.dirname(json_path), exist_ok=True)
|
| 179 |
+
|
| 180 |
+
is_usable = validate_and_save_cohort_info(
|
| 181 |
+
is_final=True,
|
| 182 |
+
cohort=cohort,
|
| 183 |
+
info_path=json_path,
|
| 184 |
+
is_gene_available=is_gene_available,
|
| 185 |
+
is_trait_available=is_trait_available,
|
| 186 |
+
is_biased=is_trait_biased,
|
| 187 |
+
df=unbiased_linked_data,
|
| 188 |
+
note=note
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
# 6) Save linked data if usable
|
| 192 |
+
if is_usable:
|
| 193 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 194 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Essential_Thrombocythemia/code/GSE57793.py
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE57793"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE57793"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE57793.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE57793.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE57793.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
import pandas as pd
|
| 42 |
+
|
| 43 |
+
# 1) Gene expression availability (based on series description: microarray gene expression)
|
| 44 |
+
is_gene_available = True
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability and conversion functions
|
| 47 |
+
|
| 48 |
+
# Trait (Essential Thrombocythemia) is determined from "disease state" at row 0
|
| 49 |
+
trait_row = 0
|
| 50 |
+
|
| 51 |
+
# Age and Gender are not present in the sample characteristics dictionary
|
| 52 |
+
age_row = None
|
| 53 |
+
gender_row = None
|
| 54 |
+
|
| 55 |
+
def _extract_value(x):
|
| 56 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 57 |
+
return None
|
| 58 |
+
if not isinstance(x, str):
|
| 59 |
+
x = str(x)
|
| 60 |
+
parts = x.split(":", 1)
|
| 61 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 62 |
+
return val.strip() if val is not None else None
|
| 63 |
+
|
| 64 |
+
def convert_trait(x):
|
| 65 |
+
val = _extract_value(x)
|
| 66 |
+
if val is None:
|
| 67 |
+
return None
|
| 68 |
+
v = val.strip().lower()
|
| 69 |
+
# Normalize common spellings
|
| 70 |
+
v = v.replace('thrombocythaemia', 'thrombocythemia')
|
| 71 |
+
# Map ET to 1, others (PV, PMF) to 0
|
| 72 |
+
if re.search(r'\bet\b', v) or 'essential thrombocythemia' in v:
|
| 73 |
+
return 1
|
| 74 |
+
if re.search(r'\bpv\b', v) or 'polycythemia vera' in v:
|
| 75 |
+
return 0
|
| 76 |
+
if re.search(r'\bpmf\b', v) or 'primary myelofibrosis' in v or 'myelofibrosis' in v:
|
| 77 |
+
return 0
|
| 78 |
+
return None
|
| 79 |
+
|
| 80 |
+
def convert_age(x):
|
| 81 |
+
val = _extract_value(x)
|
| 82 |
+
if val is None:
|
| 83 |
+
return None
|
| 84 |
+
# Extract first number as age
|
| 85 |
+
m = re.search(r'(\d+(\.\d+)?)', val)
|
| 86 |
+
if m:
|
| 87 |
+
try:
|
| 88 |
+
return float(m.group(1))
|
| 89 |
+
except Exception:
|
| 90 |
+
return None
|
| 91 |
+
return None
|
| 92 |
+
|
| 93 |
+
def convert_gender(x):
|
| 94 |
+
val = _extract_value(x)
|
| 95 |
+
if val is None:
|
| 96 |
+
return None
|
| 97 |
+
v = val.strip().lower()
|
| 98 |
+
if v in ['male', 'm', 'man']:
|
| 99 |
+
return 1
|
| 100 |
+
if v in ['female', 'f', 'woman']:
|
| 101 |
+
return 0
|
| 102 |
+
return None
|
| 103 |
+
|
| 104 |
+
# 3) Save metadata (initial filtering)
|
| 105 |
+
is_trait_available = trait_row is not None
|
| 106 |
+
_ = validate_and_save_cohort_info(
|
| 107 |
+
is_final=False,
|
| 108 |
+
cohort=cohort,
|
| 109 |
+
info_path=json_path,
|
| 110 |
+
is_gene_available=is_gene_available,
|
| 111 |
+
is_trait_available=is_trait_available
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
# 4) Clinical Feature Extraction (only if trait is available)
|
| 115 |
+
if trait_row is not None:
|
| 116 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 117 |
+
clinical_df=clinical_data,
|
| 118 |
+
trait=trait,
|
| 119 |
+
trait_row=trait_row,
|
| 120 |
+
convert_trait=convert_trait,
|
| 121 |
+
age_row=age_row,
|
| 122 |
+
convert_age=None,
|
| 123 |
+
gender_row=gender_row,
|
| 124 |
+
convert_gender=None
|
| 125 |
+
)
|
| 126 |
+
clinical_preview = preview_df(selected_clinical_df)
|
| 127 |
+
print("Clinical data preview:", clinical_preview)
|
| 128 |
+
|
| 129 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 130 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 131 |
+
|
| 132 |
+
# Step 3: Gene Data Extraction
|
| 133 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 134 |
+
gene_data = get_genetic_data(matrix_file)
|
| 135 |
+
|
| 136 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 137 |
+
print(gene_data.index[:20])
|
| 138 |
+
|
| 139 |
+
# Step 4: Gene Identifier Review
|
| 140 |
+
requires_gene_mapping = True
|
| 141 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 142 |
+
|
| 143 |
+
# Step 5: Gene Annotation
|
| 144 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 145 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 146 |
+
|
| 147 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 148 |
+
print("Gene annotation preview:")
|
| 149 |
+
print(preview_df(gene_annotation))
|
| 150 |
+
|
| 151 |
+
# Step 6: Gene Identifier Mapping
|
| 152 |
+
# Identify the appropriate columns for probe IDs and gene symbols based on the annotation preview
|
| 153 |
+
probe_id_col = 'ID'
|
| 154 |
+
gene_symbol_col = 'Gene Symbol'
|
| 155 |
+
|
| 156 |
+
# 2. Build the mapping dataframe
|
| 157 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_id_col, gene_col=gene_symbol_col)
|
| 158 |
+
|
| 159 |
+
# 3. Apply mapping to convert probe-level data to gene-level data
|
| 160 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 161 |
+
|
| 162 |
+
# Step 7: Data Normalization and Linking
|
| 163 |
+
import os
|
| 164 |
+
import pandas as pd
|
| 165 |
+
|
| 166 |
+
# 1. Normalize gene symbols and save
|
| 167 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 168 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 169 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 170 |
+
|
| 171 |
+
# 2. Link clinical and genetic data
|
| 172 |
+
# Ensure clinical data is available in the current session; if not, reload it
|
| 173 |
+
try:
|
| 174 |
+
selected_clinical_df
|
| 175 |
+
except NameError:
|
| 176 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 177 |
+
|
| 178 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 179 |
+
|
| 180 |
+
# 3. Handle missing values
|
| 181 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 182 |
+
|
| 183 |
+
# 4. Bias check and remove biased demographic features if necessary
|
| 184 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 185 |
+
|
| 186 |
+
# 5. Final validation and save cohort info
|
| 187 |
+
is_usable = validate_and_save_cohort_info(
|
| 188 |
+
is_final=True,
|
| 189 |
+
cohort=cohort,
|
| 190 |
+
info_path=json_path,
|
| 191 |
+
is_gene_available=True,
|
| 192 |
+
is_trait_available=True,
|
| 193 |
+
is_biased=is_trait_biased,
|
| 194 |
+
df=unbiased_linked_data,
|
| 195 |
+
note="INFO: ET vs non-ET across MPN subtypes; no age/gender available."
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
# 6. Conditionally save linked data
|
| 199 |
+
if is_usable:
|
| 200 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 201 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Essential_Thrombocythemia/code/GSE61629.py
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE61629"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE61629"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE61629.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE61629.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE61629.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression data availability
|
| 43 |
+
is_gene_available = True # Microarray gene expression per background info
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability and data type conversion
|
| 46 |
+
|
| 47 |
+
# From Sample Characteristics Dictionary:
|
| 48 |
+
# {0: ['disease state: control', 'disease state: PV', 'disease state: ET', 'disease state: PMF'],
|
| 49 |
+
# 1: ['treatment: untreated', 'tissue: blood'],
|
| 50 |
+
# 2: ['tissue: Whole blood']}
|
| 51 |
+
|
| 52 |
+
# Availability
|
| 53 |
+
trait_row = 0
|
| 54 |
+
age_row = None
|
| 55 |
+
gender_row = None
|
| 56 |
+
|
| 57 |
+
# Converters
|
| 58 |
+
def convert_trait(x):
|
| 59 |
+
if x is None:
|
| 60 |
+
return None
|
| 61 |
+
if isinstance(x, str):
|
| 62 |
+
part = x.split(":", 1)[-1].strip().lower() if ":" in x else x.strip().lower()
|
| 63 |
+
# Map ET vs control; PV/PMF treated as not our target (None)
|
| 64 |
+
if part in ["et", "essential thrombocythemia", "essential thrombocythaemia"]:
|
| 65 |
+
return 1
|
| 66 |
+
if part in ["control", "healthy", "normal"]:
|
| 67 |
+
return 0
|
| 68 |
+
if part in ["pv", "polycythemia vera", "polycythaemia vera", "pmf", "primary myelofibrosis"]:
|
| 69 |
+
return None
|
| 70 |
+
# Token-based fallback
|
| 71 |
+
tokens = re.split(r"[^\w]+", part)
|
| 72 |
+
if "et" in tokens:
|
| 73 |
+
return 1
|
| 74 |
+
if "control" in tokens or "healthy" in tokens or "normal" in tokens:
|
| 75 |
+
return 0
|
| 76 |
+
return None
|
| 77 |
+
|
| 78 |
+
def convert_age(x):
|
| 79 |
+
if x is None:
|
| 80 |
+
return None
|
| 81 |
+
if isinstance(x, str):
|
| 82 |
+
part = x.split(":", 1)[-1] if ":" in x else x
|
| 83 |
+
nums = re.findall(r"\d+\.?\d*", part)
|
| 84 |
+
if nums:
|
| 85 |
+
try:
|
| 86 |
+
return float(nums[0])
|
| 87 |
+
except:
|
| 88 |
+
return None
|
| 89 |
+
if isinstance(x, (int, float)):
|
| 90 |
+
return float(x)
|
| 91 |
+
return None
|
| 92 |
+
|
| 93 |
+
def convert_gender(x):
|
| 94 |
+
if x is None:
|
| 95 |
+
return None
|
| 96 |
+
if isinstance(x, str):
|
| 97 |
+
part = x.split(":", 1)[-1].strip().lower() if ":" in x else x.strip().lower()
|
| 98 |
+
if part in ["male", "m", "man"]:
|
| 99 |
+
return 1
|
| 100 |
+
if part in ["female", "f", "woman", "women"]:
|
| 101 |
+
return 0
|
| 102 |
+
return None
|
| 103 |
+
|
| 104 |
+
# 3) Save Metadata (initial filtering)
|
| 105 |
+
is_trait_available = trait_row is not None
|
| 106 |
+
_ = validate_and_save_cohort_info(
|
| 107 |
+
is_final=False,
|
| 108 |
+
cohort=cohort,
|
| 109 |
+
info_path=json_path,
|
| 110 |
+
is_gene_available=is_gene_available,
|
| 111 |
+
is_trait_available=is_trait_available
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
# 4) Clinical Feature Extraction (only if trait data available)
|
| 115 |
+
if trait_row is not None:
|
| 116 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 117 |
+
clinical_df=clinical_data,
|
| 118 |
+
trait=trait,
|
| 119 |
+
trait_row=trait_row,
|
| 120 |
+
convert_trait=convert_trait,
|
| 121 |
+
age_row=age_row,
|
| 122 |
+
convert_age=convert_age if age_row is not None else None,
|
| 123 |
+
gender_row=gender_row,
|
| 124 |
+
convert_gender=convert_gender if gender_row is not None else None
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
# Preview and save
|
| 128 |
+
preview = preview_df(selected_clinical_df)
|
| 129 |
+
print("Clinical features preview:", preview)
|
| 130 |
+
|
| 131 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 132 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 133 |
+
|
| 134 |
+
# Step 3: Gene Data Extraction
|
| 135 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 136 |
+
gene_data = get_genetic_data(matrix_file)
|
| 137 |
+
|
| 138 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 139 |
+
print(gene_data.index[:20])
|
| 140 |
+
|
| 141 |
+
# Step 4: Gene Identifier Review
|
| 142 |
+
requires_gene_mapping = True
|
| 143 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 144 |
+
|
| 145 |
+
# Step 5: Gene Annotation
|
| 146 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 147 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 148 |
+
|
| 149 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 150 |
+
print("Gene annotation preview:")
|
| 151 |
+
print(preview_df(gene_annotation))
|
| 152 |
+
|
| 153 |
+
# Step 6: Gene Identifier Mapping
|
| 154 |
+
# Identify columns for mapping: probe IDs in gene_data index match 'ID' in annotation; gene symbols are in 'Gene Symbol'
|
| 155 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Gene Symbol')
|
| 156 |
+
|
| 157 |
+
# Apply mapping: convert probe-level data to gene-level data
|
| 158 |
+
probe_level_data = gene_data
|
| 159 |
+
gene_data = apply_gene_mapping(expression_df=probe_level_data, mapping_df=mapping_df)
|
| 160 |
+
|
| 161 |
+
# Step 7: Data Normalization and Linking
|
| 162 |
+
import os
|
| 163 |
+
|
| 164 |
+
# 1. Normalize gene symbols and save gene-level data
|
| 165 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 166 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 167 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 168 |
+
|
| 169 |
+
# 2. Link the clinical and genetic data
|
| 170 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 171 |
+
|
| 172 |
+
# 3. Handle missing values
|
| 173 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 174 |
+
|
| 175 |
+
# 4. Determine bias and remove biased demographic features
|
| 176 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 177 |
+
|
| 178 |
+
# Prepare flags for final validation (ensure pure Python bools for JSON serialization)
|
| 179 |
+
is_gene_available_final = bool((normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0))
|
| 180 |
+
is_trait_available_final = bool((trait in selected_clinical_df.index) and bool(selected_clinical_df.loc[trait].notna().any()))
|
| 181 |
+
is_trait_biased_flag = bool(is_trait_biased)
|
| 182 |
+
|
| 183 |
+
note = "INFO: Non-ET disease states (PV/PMF) were treated as missing trait and excluded during linking/cleanup."
|
| 184 |
+
|
| 185 |
+
# 5. Final validation and save cohort info
|
| 186 |
+
is_usable = validate_and_save_cohort_info(
|
| 187 |
+
is_final=True,
|
| 188 |
+
cohort=cohort,
|
| 189 |
+
info_path=json_path,
|
| 190 |
+
is_gene_available=is_gene_available_final,
|
| 191 |
+
is_trait_available=is_trait_available_final,
|
| 192 |
+
is_biased=is_trait_biased_flag,
|
| 193 |
+
df=unbiased_linked_data,
|
| 194 |
+
note=note
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
# 6. Save linked data if usable
|
| 198 |
+
if is_usable:
|
| 199 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 200 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Essential_Thrombocythemia/code/GSE65161.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
cohort = "GSE65161"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Essential_Thrombocythemia"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Essential_Thrombocythemia/GSE65161"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/GSE65161.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/GSE65161.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/GSE65161.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
# Determine data availability based on provided sample characteristics and background info
|
| 40 |
+
# Given cell lines (AML/CML) and treatments, there is no Essential Thrombocythemia phenotype variation in this dataset.
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression data availability (non-miRNA/methylation, likely expression profiling given the study focus)
|
| 43 |
+
is_gene_available = True
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability
|
| 46 |
+
trait_row = None # No ET-related trait variation present in sample characteristics (all AML/CML cell lines)
|
| 47 |
+
age_row = None # No age information for cell lines
|
| 48 |
+
gender_row = None # No gender information for cell lines
|
| 49 |
+
|
| 50 |
+
# 2.2) Conversion functions
|
| 51 |
+
def _after_colon(val):
|
| 52 |
+
if val is None:
|
| 53 |
+
return None
|
| 54 |
+
if isinstance(val, (int, float)):
|
| 55 |
+
return val
|
| 56 |
+
s = str(val)
|
| 57 |
+
parts = s.split(":", 1)
|
| 58 |
+
s = parts[1] if len(parts) == 2 else parts[0]
|
| 59 |
+
return s.strip()
|
| 60 |
+
|
| 61 |
+
def convert_trait(x):
|
| 62 |
+
# Binary: 1 = Essential Thrombocythemia, 0 = Non-ET; unknown -> None
|
| 63 |
+
v = _after_colon(x)
|
| 64 |
+
if v is None:
|
| 65 |
+
return None
|
| 66 |
+
v_low = v.lower()
|
| 67 |
+
# Positive mappings
|
| 68 |
+
if any(k in v_low for k in ["essential thrombocythemia", "essential-thrombocythemia", "et (essential thrombocythemia)"]):
|
| 69 |
+
return 1
|
| 70 |
+
# Negative mappings (common myeloid malignancies distinct from ET)
|
| 71 |
+
if any(k in v_low for k in ["aml", "acute myeloid", "cml", "chronic myelogenous", "ml-l af9", "mll-af9", "mll-af4"]):
|
| 72 |
+
return 0
|
| 73 |
+
# If explicitly says control/healthy and the trait is ET, treat as 0
|
| 74 |
+
if any(k in v_low for k in ["control", "healthy", "normal"]):
|
| 75 |
+
return 0
|
| 76 |
+
return None
|
| 77 |
+
|
| 78 |
+
def convert_age(x):
|
| 79 |
+
# Continuous age in years; extract numeric value if present, else None
|
| 80 |
+
v = _after_colon(x)
|
| 81 |
+
if v is None:
|
| 82 |
+
return None
|
| 83 |
+
import re
|
| 84 |
+
nums = re.findall(r"[0-9]+\.?[0-9]*", str(v))
|
| 85 |
+
if not nums:
|
| 86 |
+
return None
|
| 87 |
+
try:
|
| 88 |
+
return float(nums[0])
|
| 89 |
+
except Exception:
|
| 90 |
+
return None
|
| 91 |
+
|
| 92 |
+
def convert_gender(x):
|
| 93 |
+
# Binary: female=0, male=1; unknown -> None
|
| 94 |
+
v = _after_colon(x)
|
| 95 |
+
if v is None:
|
| 96 |
+
return None
|
| 97 |
+
v_low = str(v).strip().lower()
|
| 98 |
+
if v_low in ["male", "m", "man", "boy"]:
|
| 99 |
+
return 1
|
| 100 |
+
if v_low in ["female", "f", "woman", "girl"]:
|
| 101 |
+
return 0
|
| 102 |
+
# Sometimes values like '1'/'0' are used
|
| 103 |
+
if v_low == "1":
|
| 104 |
+
return 1
|
| 105 |
+
if v_low == "0":
|
| 106 |
+
return 0
|
| 107 |
+
return None
|
| 108 |
+
|
| 109 |
+
# 3) Initial filtering and save metadata
|
| 110 |
+
is_trait_available = trait_row is not None
|
| 111 |
+
validate_and_save_cohort_info(
|
| 112 |
+
is_final=False,
|
| 113 |
+
cohort=cohort,
|
| 114 |
+
info_path=json_path,
|
| 115 |
+
is_gene_available=is_gene_available,
|
| 116 |
+
is_trait_available=is_trait_available
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
# 4) Clinical feature extraction is skipped because trait_row is None (no clinical trait data available for ET).
|
output/preprocess/Essential_Thrombocythemia/code/TCGA.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Essential_Thrombocythemia"
|
| 6 |
+
|
| 7 |
+
# Input paths
|
| 8 |
+
tcga_root_dir = "../DATA/TCGA"
|
| 9 |
+
|
| 10 |
+
# Output paths
|
| 11 |
+
out_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/TCGA.csv"
|
| 12 |
+
out_gene_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/gene_data/TCGA.csv"
|
| 13 |
+
out_clinical_data_file = "./output/z3/preprocess/Essential_Thrombocythemia/clinical_data/TCGA.csv"
|
| 14 |
+
json_path = "./output/z3/preprocess/Essential_Thrombocythemia/cohort_info.json"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Step 1: Initial Data Loading
|
| 18 |
+
import os
|
| 19 |
+
import pandas as pd
|
| 20 |
+
|
| 21 |
+
# Step 1: Review subdirectories and select the best match for Essential Thrombocythemia (ET)
|
| 22 |
+
provided_subdirs = [
|
| 23 |
+
'TCGA_lower_grade_glioma_and_glioblastoma_(GBMLGG)', 'TCGA_Uterine_Carcinosarcoma_(UCS)',
|
| 24 |
+
'TCGA_Thyroid_Cancer_(THCA)', 'TCGA_Thymoma_(THYM)', 'TCGA_Testicular_Cancer_(TGCT)',
|
| 25 |
+
'TCGA_Stomach_Cancer_(STAD)', 'TCGA_Sarcoma_(SARC)', 'TCGA_Rectal_Cancer_(READ)',
|
| 26 |
+
'TCGA_Prostate_Cancer_(PRAD)', 'TCGA_Pheochromocytoma_Paraganglioma_(PCPG)',
|
| 27 |
+
'TCGA_Pancreatic_Cancer_(PAAD)', 'TCGA_Ovarian_Cancer_(OV)', 'TCGA_Ocular_melanomas_(UVM)',
|
| 28 |
+
'TCGA_Mesothelioma_(MESO)', 'TCGA_Melanoma_(SKCM)', 'TCGA_Lung_Squamous_Cell_Carcinoma_(LUSC)',
|
| 29 |
+
'TCGA_Lung_Cancer_(LUNG)', 'TCGA_Lung_Adenocarcinoma_(LUAD)', 'TCGA_Lower_Grade_Glioma_(LGG)',
|
| 30 |
+
'TCGA_Liver_Cancer_(LIHC)', 'TCGA_Large_Bcell_Lymphoma_(DLBC)', 'TCGA_Kidney_Papillary_Cell_Carcinoma_(KIRP)',
|
| 31 |
+
'TCGA_Kidney_Clear_Cell_Carcinoma_(KIRC)', 'TCGA_Kidney_Chromophobe_(KICH)',
|
| 32 |
+
'TCGA_Head_and_Neck_Cancer_(HNSC)', 'TCGA_Glioblastoma_(GBM)', 'TCGA_Esophageal_Cancer_(ESCA)',
|
| 33 |
+
'TCGA_Endometrioid_Cancer_(UCEC)', 'TCGA_Colon_and_Rectal_Cancer_(COADREAD)',
|
| 34 |
+
'TCGA_Colon_Cancer_(COAD)', 'TCGA_Cervical_Cancer_(CESC)', 'TCGA_Breast_Cancer_(BRCA)',
|
| 35 |
+
'TCGA_Bladder_Cancer_(BLCA)', 'TCGA_Bile_Duct_Cancer_(CHOL)', 'TCGA_Adrenocortical_Cancer_(ACC)',
|
| 36 |
+
'TCGA_Acute_Myeloid_Leukemia_(LAML)'
|
| 37 |
+
]
|
| 38 |
+
|
| 39 |
+
# Define trait-related keywords for ET; avoid broad terms that could incorrectly match unrelated cohorts
|
| 40 |
+
keywords = ['essential thrombocythemia', 'thrombocythemia', 'myeloproliferative', 'mpn', 'polycythemia', 'myelofibrosis']
|
| 41 |
+
|
| 42 |
+
selected_subdirs = [d for d in provided_subdirs if any(k in d.lower() for k in keywords)]
|
| 43 |
+
selected_subdir = selected_subdirs[0] if selected_subdirs else None
|
| 44 |
+
|
| 45 |
+
clinical_df = None
|
| 46 |
+
genetic_df = None
|
| 47 |
+
|
| 48 |
+
if selected_subdir is None:
|
| 49 |
+
# No suitable TCGA cohort for Essential Thrombocythemia; record skip and finish
|
| 50 |
+
_ = validate_and_save_cohort_info(
|
| 51 |
+
is_final=False,
|
| 52 |
+
cohort="TCGA",
|
| 53 |
+
info_path=json_path,
|
| 54 |
+
is_gene_available=False,
|
| 55 |
+
is_trait_available=False
|
| 56 |
+
)
|
| 57 |
+
print("No suitable TCGA cohort found for Essential Thrombocythemia. Skipping.")
|
| 58 |
+
else:
|
| 59 |
+
# Step 2: Identify clinical and genetic file paths
|
| 60 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_subdir)
|
| 61 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
| 62 |
+
|
| 63 |
+
# Step 3: Load both files as DataFrames
|
| 64 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0, low_memory=False)
|
| 65 |
+
genetic_df = pd.read_csv(genetic_file_path, sep='\t', index_col=0, low_memory=False)
|
| 66 |
+
|
| 67 |
+
# Step 4: Print clinical columns
|
| 68 |
+
print(clinical_df.columns.tolist())
|
output/preprocess/Essential_Thrombocythemia/cohort_info.json
CHANGED
|
@@ -1,102 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"GSE65161": {
|
| 3 |
-
"is_usable": true,
|
| 4 |
-
"is_gene_available": true,
|
| 5 |
-
"is_trait_available": true,
|
| 6 |
-
"is_available": true,
|
| 7 |
-
"is_biased": false,
|
| 8 |
-
"has_age": false,
|
| 9 |
-
"has_gender": false,
|
| 10 |
-
"sample_size": 24
|
| 11 |
-
},
|
| 12 |
-
"GSE61629": {
|
| 13 |
-
"is_usable": true,
|
| 14 |
-
"is_gene_available": true,
|
| 15 |
-
"is_trait_available": true,
|
| 16 |
-
"is_available": true,
|
| 17 |
-
"is_biased": false,
|
| 18 |
-
"has_age": false,
|
| 19 |
-
"has_gender": false,
|
| 20 |
-
"sample_size": 54
|
| 21 |
-
},
|
| 22 |
-
"GSE57793": {
|
| 23 |
-
"is_usable": true,
|
| 24 |
-
"is_gene_available": true,
|
| 25 |
-
"is_trait_available": true,
|
| 26 |
-
"is_available": true,
|
| 27 |
-
"is_biased": false,
|
| 28 |
-
"has_age": false,
|
| 29 |
-
"has_gender": false,
|
| 30 |
-
"sample_size": 66
|
| 31 |
-
},
|
| 32 |
-
"GSE55976": {
|
| 33 |
-
"is_usable": true,
|
| 34 |
-
"is_gene_available": true,
|
| 35 |
-
"is_trait_available": true,
|
| 36 |
-
"is_available": true,
|
| 37 |
-
"is_biased": false,
|
| 38 |
-
"has_age": false,
|
| 39 |
-
"has_gender": false,
|
| 40 |
-
"sample_size": 39
|
| 41 |
-
},
|
| 42 |
-
"GSE174060": {
|
| 43 |
-
"is_usable": true,
|
| 44 |
-
"is_gene_available": true,
|
| 45 |
-
"is_trait_available": true,
|
| 46 |
-
"is_available": true,
|
| 47 |
-
"is_biased": false,
|
| 48 |
-
"has_age": true,
|
| 49 |
-
"has_gender": true,
|
| 50 |
-
"sample_size": 36
|
| 51 |
-
},
|
| 52 |
-
"GSE159514": {
|
| 53 |
-
"is_usable": false,
|
| 54 |
-
"is_gene_available": false,
|
| 55 |
-
"is_trait_available": false,
|
| 56 |
-
"is_available": false,
|
| 57 |
-
"is_biased": null,
|
| 58 |
-
"has_age": null,
|
| 59 |
-
"has_gender": null,
|
| 60 |
-
"sample_size": null
|
| 61 |
-
},
|
| 62 |
-
"GSE12295": {
|
| 63 |
-
"is_usable": true,
|
| 64 |
-
"is_gene_available": true,
|
| 65 |
-
"is_trait_available": true,
|
| 66 |
-
"is_available": true,
|
| 67 |
-
"is_biased": false,
|
| 68 |
-
"has_age": false,
|
| 69 |
-
"has_gender": false,
|
| 70 |
-
"sample_size": 95
|
| 71 |
-
},
|
| 72 |
-
"GSE103237": {
|
| 73 |
-
"is_usable": true,
|
| 74 |
-
"is_gene_available": true,
|
| 75 |
-
"is_trait_available": true,
|
| 76 |
-
"is_available": true,
|
| 77 |
-
"is_biased": false,
|
| 78 |
-
"has_age": false,
|
| 79 |
-
"has_gender": true,
|
| 80 |
-
"sample_size": 39
|
| 81 |
-
},
|
| 82 |
-
"GSE103176": {
|
| 83 |
-
"is_usable": false,
|
| 84 |
-
"is_gene_available": false,
|
| 85 |
-
"is_trait_available": false,
|
| 86 |
-
"is_available": false,
|
| 87 |
-
"is_biased": null,
|
| 88 |
-
"has_age": null,
|
| 89 |
-
"has_gender": null,
|
| 90 |
-
"sample_size": null
|
| 91 |
-
},
|
| 92 |
-
"TCGA": {
|
| 93 |
-
"is_usable": false,
|
| 94 |
-
"is_gene_available": true,
|
| 95 |
-
"is_trait_available": true,
|
| 96 |
-
"is_available": true,
|
| 97 |
-
"is_biased": true,
|
| 98 |
-
"has_age": true,
|
| 99 |
-
"has_gender": true,
|
| 100 |
-
"sample_size": 79
|
| 101 |
-
}
|
| 102 |
-
}
|
|
|
|
| 1 |
+
{"GSE65161": {"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}, "GSE61629": {"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": 29, "note": "INFO: Non-ET disease states (PV/PMF) were treated as missing trait and excluded during linking/cleanup."}, "GSE57793": {"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": 66, "note": "INFO: ET vs non-ET across MPN subtypes; no age/gender available."}, "GSE55976": {"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": 39, "note": "INFO: Trait derived from 'subject condition' (ET vs non-ET). No age/gender fields available in annotations. Samples include mixed cell types (CD34+ and granulocytes)."}, "GSE174060": {"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": 36, "note": "INFO: Affymetrix transcript-cluster IDs mapped via 'gene_assignment'; trait is ET vs others; included Age and Gender."}, "GSE159514": {"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": 114, "note": "INFO: Trait defined as PET (post-ET MF) vs other MF subtypes. Age and Gender not available in series matrix."}, "GSE12295": {"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": 95, "note": "INFO: Age and Gender not available; cohort mixes ET, RT, and normal controls; trait binarized as ET vs others."}, "GSE103237": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": true, "sample_size": 65, "note": "INFO: Gene symbols normalized via NCBI synonyms; probe-to-gene mapped with equal-split; missing values handled per protocol."}, "GSE103176": {"is_usable": false, "is_gene_available": false, "is_trait_available": true, "is_available": false, "is_biased": null, "has_age": null, "has_gender": null, "sample_size": null, "note": "ERROR: Gene identifier mapping/normalization failed. Probe/set IDs (e.g., '14qI-*_st') did not map to human gene symbols in the available SOFT annotation; normalization removed all gene rows. Gene expression unavailable for analysis."}, "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}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/GSE43580.csv
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
GSM1065725,GSM1065726,GSM1065727,GSM1065728,GSM1065729,GSM1065730,GSM1065731,GSM1065732,GSM1065733,GSM1065734,GSM1065735,GSM1065736,GSM1065737,GSM1065738,GSM1065739,GSM1065740,GSM1065741,GSM1065742,GSM1065743,GSM1065744,GSM1065745,GSM1065746,GSM1065747,GSM1065748,GSM1065749,GSM1065750,GSM1065751,GSM1065752,GSM1065753,GSM1065754,GSM1065755,GSM1065756,GSM1065757,GSM1065758,GSM1065759,GSM1065760,GSM1065761,GSM1065762,GSM1065763,GSM1065764,GSM1065765,GSM1065766,GSM1065767,GSM1065768,GSM1065769,GSM1065770,GSM1065771,GSM1065772,GSM1065773,GSM1065774,GSM1065775,GSM1065776,GSM1065777,GSM1065778,GSM1065779,GSM1065780,GSM1065781,GSM1065782,GSM1065783,GSM1065784,GSM1065785,GSM1065786,GSM1065787,GSM1065788,GSM1065789,GSM1065790,GSM1065791,GSM1065792,GSM1065793,GSM1065794,GSM1065795,GSM1065796,GSM1065797,GSM1065798,GSM1065799,GSM1065800,GSM1065801,GSM1065802,GSM1065803,GSM1065804,GSM1065805,GSM1065806,GSM1065807,GSM1065808,GSM1065809,GSM1065810,GSM1065811,GSM1065812,GSM1065813,GSM1065814,GSM1065815,GSM1065816,GSM1065817,GSM1065818,GSM1065819,GSM1065820,GSM1065821,GSM1065822,GSM1065823,GSM1065824,GSM1065825,GSM1065826,GSM1065827,GSM1065828,GSM1065829,GSM1065830,GSM1065831,GSM1065832,GSM1065833,GSM1065834,GSM1065835,GSM1065836,GSM1065837,GSM1065838,GSM1065839,GSM1065840,GSM1065841,GSM1065842,GSM1065843,GSM1065844,GSM1065845,GSM1065846,GSM1065847,GSM1065848,GSM1065849,GSM1065850,GSM1065851,GSM1065852,GSM1065853,GSM1065854,GSM1065855,GSM1065856,GSM1065857,GSM1065858,GSM1065859,GSM1065860,GSM1065861,GSM1065862,GSM1065863,GSM1065864,GSM1065865,GSM1065866,GSM1065867,GSM1065868,GSM1065869,GSM1065870,GSM1065871,GSM1065872,GSM1065873,GSM1065874
|
| 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,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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 |
-
65.0,61.0,43.0,44.0,60.0,58.0,67.0,52.0,43.0,66.0,47.0,56.0,62.0,69.0,60.0,47.0,69.0,49.0,68.0,65.0,52.0,67.0,70.0,60.0,46.0,52.0,66.0,63.0,57.0,56.0,39.0,63.0,68.0,55.0,71.0,55.0,54.0,72.0,74.0,59.0,73.0,55.0,52.0,62.0,46.0,70.0,54.0,67.0,52.0,56.0,52.0,77.0,52.0,57.0,69.0,55.0,71.0,71.0,61.0,53.0,49.0,51.0,65.0,58.0,55.0,59.0,53.0,42.0,57.0,55.0,49.0,49.0,52.0,52.0,70.0,55.0,61.0,42.0,57.0,81.0,49.0,62.0,72.0,46.0,64.0,61.0,79.0,56.0,,79.0,54.0,57.0,54.0,42.0,71.0,76.0,60.0,53.0,48.0,73.0,48.0,69.0,64.0,58.0,55.0,56.0,54.0,73.0,77.0,51.0,55.0,59.0,58.0,65.0,66.0,55.0,68.0,64.0,70.0,64.0,52.0,62.0,63.0,62.0,58.0,58.0,56.0,55.0,68.0,69.0,62.0,64.0,70.0,,77.0,65.0,71.0,54.0,69.0,72.0,80.0,57.0,69.0,53.0,53.0,64.0,58.0,64.0,46.0,56.0
|
| 4 |
-
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0
|
|
|
|
| 1 |
+
,GSM1065725,GSM1065726,GSM1065727,GSM1065728,GSM1065729,GSM1065730,GSM1065731,GSM1065732,GSM1065733,GSM1065734,GSM1065735,GSM1065736,GSM1065737,GSM1065738,GSM1065739,GSM1065740,GSM1065741,GSM1065742,GSM1065743,GSM1065744,GSM1065745,GSM1065746,GSM1065747,GSM1065748,GSM1065749,GSM1065750,GSM1065751,GSM1065752,GSM1065753,GSM1065754,GSM1065755,GSM1065756,GSM1065757,GSM1065758,GSM1065759,GSM1065760,GSM1065761,GSM1065762,GSM1065763,GSM1065764,GSM1065765,GSM1065766,GSM1065767,GSM1065768,GSM1065769,GSM1065770,GSM1065771,GSM1065772,GSM1065773,GSM1065774,GSM1065775,GSM1065776,GSM1065777,GSM1065778,GSM1065779,GSM1065780,GSM1065781,GSM1065782,GSM1065783,GSM1065784,GSM1065785,GSM1065786,GSM1065787,GSM1065788,GSM1065789,GSM1065790,GSM1065791,GSM1065792,GSM1065793,GSM1065794,GSM1065795,GSM1065796,GSM1065797,GSM1065798,GSM1065799,GSM1065800,GSM1065801,GSM1065802,GSM1065803,GSM1065804,GSM1065805,GSM1065806,GSM1065807,GSM1065808,GSM1065809,GSM1065810,GSM1065811,GSM1065812,GSM1065813,GSM1065814,GSM1065815,GSM1065816,GSM1065817,GSM1065818,GSM1065819,GSM1065820,GSM1065821,GSM1065822,GSM1065823,GSM1065824,GSM1065825,GSM1065826,GSM1065827,GSM1065828,GSM1065829,GSM1065830,GSM1065831,GSM1065832,GSM1065833,GSM1065834,GSM1065835,GSM1065836,GSM1065837,GSM1065838,GSM1065839,GSM1065840,GSM1065841,GSM1065842,GSM1065843,GSM1065844,GSM1065845,GSM1065846,GSM1065847,GSM1065848,GSM1065849,GSM1065850,GSM1065851,GSM1065852,GSM1065853,GSM1065854,GSM1065855,GSM1065856,GSM1065857,GSM1065858,GSM1065859,GSM1065860,GSM1065861,GSM1065862,GSM1065863,GSM1065864,GSM1065865,GSM1065866,GSM1065867,GSM1065868,GSM1065869,GSM1065870,GSM1065871,GSM1065872,GSM1065873,GSM1065874
|
| 2 |
+
Gastroesophageal_reflux_disease_(GERD),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
| 3 |
+
Age,65.0,61.0,43.0,44.0,60.0,58.0,67.0,52.0,43.0,66.0,47.0,56.0,62.0,69.0,60.0,47.0,69.0,49.0,68.0,65.0,52.0,67.0,70.0,60.0,46.0,52.0,66.0,63.0,57.0,56.0,39.0,63.0,68.0,55.0,71.0,55.0,54.0,72.0,74.0,59.0,73.0,55.0,52.0,62.0,46.0,70.0,54.0,67.0,52.0,56.0,52.0,77.0,52.0,57.0,69.0,55.0,71.0,71.0,61.0,53.0,49.0,51.0,65.0,58.0,55.0,59.0,53.0,42.0,57.0,55.0,49.0,49.0,52.0,52.0,70.0,55.0,61.0,42.0,57.0,81.0,49.0,62.0,72.0,46.0,64.0,61.0,79.0,56.0,,79.0,54.0,57.0,54.0,42.0,71.0,76.0,60.0,53.0,48.0,73.0,48.0,69.0,64.0,58.0,55.0,56.0,54.0,73.0,77.0,51.0,55.0,59.0,58.0,65.0,66.0,55.0,68.0,64.0,70.0,64.0,52.0,62.0,63.0,62.0,58.0,58.0,56.0,55.0,68.0,69.0,62.0,64.0,70.0,,77.0,65.0,71.0,54.0,69.0,72.0,80.0,57.0,69.0,53.0,53.0,64.0,58.0,64.0,46.0,56.0
|
| 4 |
+
Gender,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,,1.0,1.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/GSE77563.csv
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
| 1 |
+
GSM2054504,GSM2054505,GSM2054506,GSM2054507,GSM2054508,GSM2054509,GSM2054510,GSM2054511,GSM2054512,GSM2054513,GSM2054514,GSM2054515,GSM2054516,GSM2054517,GSM2054518,GSM2054519,GSM2054520,GSM2054521,GSM2054522,GSM2054523,GSM2054524,GSM2054525,GSM2054526,GSM2054527,GSM2054528,GSM2054529,GSM2054530,GSM2054531,GSM2054532,GSM2054533,GSM2054534,GSM2054535,GSM2054536,GSM2054537,GSM2054538,GSM2054539,GSM2054540,GSM2054541,GSM2054542,GSM2054543
|
| 2 |
+
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.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,1.0,0.0,1.0,1.0,1.0,1.0
|
| 3 |
+
56.0,53.0,62.0,62.0,56.0,63.0,79.0,75.0,71.0,54.0,59.0,54.0,60.0,64.0,77.0,64.0,61.0,52.0,62.0,50.0,63.0,50.0,58.0,50.0,60.0,60.0,59.0,51.0,54.0,53.0,53.0,53.0,59.0,83.0,61.0,71.0,77.0,84.0,45.0,81.0
|
| 4 |
+
0.0,1.0,1.0,1.0,0.0,1.0,1.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,0.0,1.0,1.0,1.0,0.0,1.0
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/GSE28302.py
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Gastroesophageal_reflux_disease_(GERD)"
|
| 6 |
+
cohort = "GSE28302"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Gastroesophageal_reflux_disease_(GERD)"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Gastroesophageal_reflux_disease_(GERD)/GSE28302"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/GSE28302.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/gene_data/GSE28302.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/GSE28302.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import re
|
| 40 |
+
|
| 41 |
+
# 1) Gene Expression Data Availability
|
| 42 |
+
is_gene_available = True # Illumina whole-genome expression profiling on total RNA (gene expression microarray)
|
| 43 |
+
|
| 44 |
+
# 2) Variable Availability and Data Type Conversion
|
| 45 |
+
|
| 46 |
+
# Trait (GERD) is not explicitly available; tissue type (row 0) does not reliably indicate GERD status.
|
| 47 |
+
trait_row = None
|
| 48 |
+
|
| 49 |
+
def convert_trait(x):
|
| 50 |
+
# Trait not available for this cohort
|
| 51 |
+
return None
|
| 52 |
+
|
| 53 |
+
# Age
|
| 54 |
+
age_row = 4
|
| 55 |
+
def convert_age(x):
|
| 56 |
+
if x is None:
|
| 57 |
+
return None
|
| 58 |
+
s = str(x)
|
| 59 |
+
if ':' in s:
|
| 60 |
+
s = s.split(':', 1)[1]
|
| 61 |
+
s = s.strip()
|
| 62 |
+
m = re.search(r'[-+]?\d+(\.\d+)?', s)
|
| 63 |
+
if not m:
|
| 64 |
+
return None
|
| 65 |
+
try:
|
| 66 |
+
val = float(m.group(0))
|
| 67 |
+
return val
|
| 68 |
+
except Exception:
|
| 69 |
+
return None
|
| 70 |
+
|
| 71 |
+
# Gender
|
| 72 |
+
gender_row = 3
|
| 73 |
+
def convert_gender(x):
|
| 74 |
+
if x is None:
|
| 75 |
+
return None
|
| 76 |
+
s = str(x)
|
| 77 |
+
if ':' in s:
|
| 78 |
+
s = s.split(':', 1)[1]
|
| 79 |
+
s = s.strip().lower()
|
| 80 |
+
if s in ['female', 'f']:
|
| 81 |
+
return 0
|
| 82 |
+
if s in ['male', 'm']:
|
| 83 |
+
return 1
|
| 84 |
+
return None
|
| 85 |
+
|
| 86 |
+
# 3) Save Metadata (initial filtering)
|
| 87 |
+
is_trait_available = trait_row is not None
|
| 88 |
+
_ = validate_and_save_cohort_info(
|
| 89 |
+
is_final=False,
|
| 90 |
+
cohort=cohort,
|
| 91 |
+
info_path=json_path,
|
| 92 |
+
is_gene_available=is_gene_available,
|
| 93 |
+
is_trait_available=is_trait_available
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
# 4) Clinical Feature Extraction (skip because trait_row is None)
|
| 97 |
+
if trait_row is not None:
|
| 98 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 99 |
+
clinical_df=clinical_data,
|
| 100 |
+
trait=trait,
|
| 101 |
+
trait_row=trait_row,
|
| 102 |
+
convert_trait=convert_trait,
|
| 103 |
+
age_row=age_row,
|
| 104 |
+
convert_age=convert_age,
|
| 105 |
+
gender_row=gender_row,
|
| 106 |
+
convert_gender=convert_gender
|
| 107 |
+
)
|
| 108 |
+
_ = preview_df(selected_clinical_df)
|
| 109 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 110 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 111 |
+
|
| 112 |
+
# Step 3: Gene Data Extraction
|
| 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 |
+
|
| 119 |
+
# Step 4: Gene Identifier Review
|
| 120 |
+
print("requires_gene_mapping = True")
|
| 121 |
+
|
| 122 |
+
# Step 5: Gene Annotation
|
| 123 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 124 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 125 |
+
|
| 126 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 127 |
+
print("Gene annotation preview:")
|
| 128 |
+
print(preview_df(gene_annotation))
|
| 129 |
+
|
| 130 |
+
# Step 6: Gene Identifier Mapping
|
| 131 |
+
# Heuristic selection of identifier and gene columns with robust fallback to RefSeq accessions when symbols are unavailable.
|
| 132 |
+
|
| 133 |
+
import re
|
| 134 |
+
|
| 135 |
+
# Preserve original expression data
|
| 136 |
+
expr_df = gene_data.copy()
|
| 137 |
+
|
| 138 |
+
# 1) Decide identifier column by maximal overlap with probe IDs in expr_df
|
| 139 |
+
id_overlap_counts = {}
|
| 140 |
+
for col in gene_annotation.columns:
|
| 141 |
+
try:
|
| 142 |
+
overlap = gene_annotation[col].astype(str).isin(expr_df.index).sum()
|
| 143 |
+
except Exception:
|
| 144 |
+
overlap = 0
|
| 145 |
+
id_overlap_counts[col] = overlap
|
| 146 |
+
|
| 147 |
+
id_col = max(id_overlap_counts, key=id_overlap_counts.get)
|
| 148 |
+
|
| 149 |
+
# 2) Decide gene symbol column by maximizing the proportion of cells from which human gene symbols can be extracted
|
| 150 |
+
candidate_gene_cols = [c for c in gene_annotation.columns if c != id_col]
|
| 151 |
+
|
| 152 |
+
def column_symbol_coverage(series, sample_n=2000):
|
| 153 |
+
s = series.astype(str)
|
| 154 |
+
if len(s) > sample_n:
|
| 155 |
+
s = s.sample(sample_n, random_state=1)
|
| 156 |
+
parsed = s.map(lambda x: len(extract_human_gene_symbols(x)) > 0)
|
| 157 |
+
return float(parsed.mean())
|
| 158 |
+
|
| 159 |
+
coverage_scores = {}
|
| 160 |
+
for col in candidate_gene_cols:
|
| 161 |
+
try:
|
| 162 |
+
coverage_scores[col] = column_symbol_coverage(gene_annotation[col])
|
| 163 |
+
except Exception:
|
| 164 |
+
coverage_scores[col] = 0.0
|
| 165 |
+
|
| 166 |
+
preferred_order = sorted(coverage_scores.items(), key=lambda x: x[1], reverse=True)
|
| 167 |
+
gene_col = preferred_order[0][0] if preferred_order else None
|
| 168 |
+
|
| 169 |
+
# If symbol coverage is very low, prefer explicit gene symbol-like column names; else we'll likely fallback later
|
| 170 |
+
if gene_col is None or coverage_scores.get(gene_col, 0.0) < 0.05:
|
| 171 |
+
for cand in ['Gene Symbol', 'Symbol', 'SYMBOL', 'GeneSymbol', 'GENE_SYMBOL', 'Gene Symbols', 'GENE_SYMBOLS', 'Gene']:
|
| 172 |
+
if cand in candidate_gene_cols:
|
| 173 |
+
gene_col = cand
|
| 174 |
+
break
|
| 175 |
+
# If still not found, default to GB_ACC (RefSeq accessions) as a fallback gene identifier
|
| 176 |
+
if gene_col is None and 'GB_ACC' in candidate_gene_cols:
|
| 177 |
+
gene_col = 'GB_ACC'
|
| 178 |
+
elif gene_col is None and candidate_gene_cols:
|
| 179 |
+
gene_col = candidate_gene_cols[0]
|
| 180 |
+
elif gene_col is None:
|
| 181 |
+
gene_col = id_col # extreme fallback
|
| 182 |
+
|
| 183 |
+
print(f"Selected id_col: {id_col}")
|
| 184 |
+
print(f"Selected gene_col (initial): {gene_col}")
|
| 185 |
+
|
| 186 |
+
# 3) Build mapping
|
| 187 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=id_col, gene_col=gene_col)
|
| 188 |
+
print(f"Initial mapping_df rows: {len(mapping_df)}")
|
| 189 |
+
|
| 190 |
+
# 4) Try mapping to HGNC symbols first
|
| 191 |
+
gene_data_symbol = None
|
| 192 |
+
try:
|
| 193 |
+
gene_data_symbol = apply_gene_mapping(expression_df=expr_df, mapping_df=mapping_df)
|
| 194 |
+
except Exception as e:
|
| 195 |
+
print(f"WARNING: Symbol mapping failed with error: {e}")
|
| 196 |
+
gene_data_symbol = None
|
| 197 |
+
|
| 198 |
+
# 5) If symbol mapping is empty or failed, fallback to RefSeq accession mapping (using GB_ACC)
|
| 199 |
+
def build_refseq_expression_from_gbacc(annotation_df, prob_col, gbacc_col, expression_df):
|
| 200 |
+
# Parse GB_ACC into list of base RefSeq accessions (version-stripped), allow multiple per probe
|
| 201 |
+
def parse_refseqs(val: str):
|
| 202 |
+
if val is None:
|
| 203 |
+
return []
|
| 204 |
+
s = str(val)
|
| 205 |
+
# Normalize common delimiters
|
| 206 |
+
s = s.replace('///', ';').replace(',', ';')
|
| 207 |
+
parts = re.split(r'[;\s]+', s)
|
| 208 |
+
parts = [p for p in parts if p] # remove empty
|
| 209 |
+
# Keep plausible RefSeq-like tokens and strip version
|
| 210 |
+
keep = []
|
| 211 |
+
for p in parts:
|
| 212 |
+
# Accept common RefSeq prefixes
|
| 213 |
+
if re.match(r'^(?:N[MRP]|X[MR])_\d+(\.\d+)?$', p):
|
| 214 |
+
p_base = p.split('.', 1)[0]
|
| 215 |
+
keep.append(p_base)
|
| 216 |
+
# Deduplicate
|
| 217 |
+
return list(dict.fromkeys(keep))
|
| 218 |
+
|
| 219 |
+
ref_map = annotation_df.loc[:, [prob_col, gbacc_col]].dropna()
|
| 220 |
+
if ref_map.empty:
|
| 221 |
+
return pd.DataFrame()
|
| 222 |
+
|
| 223 |
+
ref_map = ref_map.rename(columns={prob_col: 'ID', gbacc_col: 'RefSeq'})
|
| 224 |
+
ref_map['ID'] = ref_map['ID'].astype(str).str.strip()
|
| 225 |
+
ref_map = ref_map[ref_map['ID'].isin(expression_df.index)]
|
| 226 |
+
if ref_map.empty:
|
| 227 |
+
return pd.DataFrame()
|
| 228 |
+
|
| 229 |
+
ref_map['RefSeq'] = ref_map['RefSeq'].map(parse_refseqs)
|
| 230 |
+
ref_map['num_genes'] = ref_map['RefSeq'].map(lambda x: len(x) if isinstance(x, list) else 0)
|
| 231 |
+
ref_map = ref_map[ref_map['num_genes'] > 0]
|
| 232 |
+
if ref_map.empty:
|
| 233 |
+
return pd.DataFrame()
|
| 234 |
+
|
| 235 |
+
ref_map = ref_map.explode('RefSeq').dropna(subset=['RefSeq'])
|
| 236 |
+
ref_map.set_index('ID', inplace=True)
|
| 237 |
+
|
| 238 |
+
merged = ref_map.join(expression_df, how='inner')
|
| 239 |
+
if merged.empty:
|
| 240 |
+
return pd.DataFrame()
|
| 241 |
+
|
| 242 |
+
expr_cols = [c for c in merged.columns if c not in ['RefSeq', 'num_genes']]
|
| 243 |
+
merged[expr_cols] = merged[expr_cols].div(merged['num_genes'].replace(0, 1), axis=0)
|
| 244 |
+
refseq_expr = merged.groupby('RefSeq')[expr_cols].sum()
|
| 245 |
+
return refseq_expr
|
| 246 |
+
|
| 247 |
+
use_symbol_mapping = False
|
| 248 |
+
if gene_data_symbol is not None and len(gene_data_symbol) > 0:
|
| 249 |
+
gene_data = gene_data_symbol
|
| 250 |
+
use_symbol_mapping = True
|
| 251 |
+
else:
|
| 252 |
+
# Fallback to GB_ACC-based features
|
| 253 |
+
if 'GB_ACC' in gene_annotation.columns:
|
| 254 |
+
gene_data_refseq = build_refseq_expression_from_gbacc(
|
| 255 |
+
annotation_df=gene_annotation,
|
| 256 |
+
prob_col=id_col,
|
| 257 |
+
gbacc_col='GB_ACC',
|
| 258 |
+
expression_df=expr_df
|
| 259 |
+
)
|
| 260 |
+
if len(gene_data_refseq) > 0:
|
| 261 |
+
gene_data = gene_data_refseq
|
| 262 |
+
print("WARNING: Symbol mapping unavailable; using RefSeq (GB_ACC, version-stripped) as features.")
|
| 263 |
+
else:
|
| 264 |
+
# Last resort: keep probe-level features
|
| 265 |
+
gene_data = expr_df
|
| 266 |
+
print("WARNING: Mapping to symbols and RefSeq failed; using probe IDs as features.")
|
| 267 |
+
else:
|
| 268 |
+
gene_data = expr_df
|
| 269 |
+
print("WARNING: No GB_ACC column; using probe IDs as features.")
|
| 270 |
+
|
| 271 |
+
print(f"Final gene_data shape: {gene_data.shape} | Mapped to symbols: {use_symbol_mapping}")
|
| 272 |
+
|
| 273 |
+
# Step 7: Data Normalization and Linking
|
| 274 |
+
# Step 7: Data Normalization and Linking with correct metadata handling for missing trait
|
| 275 |
+
|
| 276 |
+
import os
|
| 277 |
+
import re
|
| 278 |
+
|
| 279 |
+
# 1) Normalize only if we truly have HGNC symbols; otherwise keep RefSeq/probe features
|
| 280 |
+
def _is_refseq_index(idx) -> bool:
|
| 281 |
+
arr = list(idx[:1000]) if len(idx) > 1000 else list(idx)
|
| 282 |
+
if len(arr) == 0:
|
| 283 |
+
return False
|
| 284 |
+
ref_count = 0
|
| 285 |
+
for s in arr:
|
| 286 |
+
s = str(s)
|
| 287 |
+
if re.match(r'^(?:N[MRP]|X[MR])_\d+(\.\d+)?$', s):
|
| 288 |
+
ref_count += 1
|
| 289 |
+
return (ref_count / len(arr)) >= 0.5
|
| 290 |
+
|
| 291 |
+
use_symbol_mapping_inferred = False
|
| 292 |
+
try:
|
| 293 |
+
use_symbol_mapping_inferred = bool(use_symbol_mapping)
|
| 294 |
+
except NameError:
|
| 295 |
+
use_symbol_mapping_inferred = not _is_refseq_index(gene_data.index)
|
| 296 |
+
|
| 297 |
+
if use_symbol_mapping_inferred:
|
| 298 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 299 |
+
else:
|
| 300 |
+
normalized_gene_data = gene_data.copy()
|
| 301 |
+
|
| 302 |
+
# Ensure output directory exists and save gene matrix
|
| 303 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 304 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 305 |
+
|
| 306 |
+
# 2-6) Proceed only if trait is available; otherwise, record initial metadata and skip linking
|
| 307 |
+
if 'trait_row' in globals() and trait_row is not None:
|
| 308 |
+
# Prepare clinical features if not already done
|
| 309 |
+
if 'selected_clinical_data' not in globals():
|
| 310 |
+
selected_clinical_data = geo_select_clinical_features(
|
| 311 |
+
clinical_df=clinical_data,
|
| 312 |
+
trait=trait,
|
| 313 |
+
trait_row=trait_row,
|
| 314 |
+
convert_trait=convert_trait,
|
| 315 |
+
age_row=age_row if 'age_row' in globals() else None,
|
| 316 |
+
convert_age=convert_age if 'convert_age' in globals() else None,
|
| 317 |
+
gender_row=gender_row if 'gender_row' in globals() else None,
|
| 318 |
+
convert_gender=convert_gender if 'convert_gender' in globals() else None
|
| 319 |
+
)
|
| 320 |
+
|
| 321 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
| 322 |
+
|
| 323 |
+
# Handle missing values
|
| 324 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 325 |
+
|
| 326 |
+
# Bias assessment
|
| 327 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 328 |
+
|
| 329 |
+
# Final validation and metadata
|
| 330 |
+
note = f"INFO: Trait available; mapped_to_symbols={use_symbol_mapping_inferred}; genes={normalized_gene_data.shape[0]}"
|
| 331 |
+
is_usable = validate_and_save_cohort_info(
|
| 332 |
+
is_final=True,
|
| 333 |
+
cohort=cohort,
|
| 334 |
+
info_path=json_path,
|
| 335 |
+
is_gene_available=True,
|
| 336 |
+
is_trait_available=True,
|
| 337 |
+
is_biased=is_trait_biased,
|
| 338 |
+
df=unbiased_linked_data,
|
| 339 |
+
note=note
|
| 340 |
+
)
|
| 341 |
+
|
| 342 |
+
if is_usable:
|
| 343 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 344 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 345 |
+
|
| 346 |
+
else:
|
| 347 |
+
# Trait unavailable: record initial filtering outcome; do not trigger final validation on empty df
|
| 348 |
+
print("INFO: Trait variable unavailable; linking skipped. Saved gene matrix only.")
|
| 349 |
+
_ = validate_and_save_cohort_info(
|
| 350 |
+
is_final=False,
|
| 351 |
+
cohort=cohort,
|
| 352 |
+
info_path=json_path,
|
| 353 |
+
is_gene_available=True,
|
| 354 |
+
is_trait_available=False
|
| 355 |
+
)
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/GSE43580.py
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Gastroesophageal_reflux_disease_(GERD)"
|
| 6 |
+
cohort = "GSE43580"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Gastroesophageal_reflux_disease_(GERD)"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Gastroesophageal_reflux_disease_(GERD)/GSE43580"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/GSE43580.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/gene_data/GSE43580.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/GSE43580.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
import os
|
| 21 |
+
import pandas as pd
|
| 22 |
+
from tools.preprocess import *
|
| 23 |
+
|
| 24 |
+
# 1. Identify the paths to the SOFT file and the matrix file, prioritizing files containing the cohort accession
|
| 25 |
+
files = os.listdir(in_cohort_dir)
|
| 26 |
+
soft_candidates = [f for f in files if ('soft' in f.lower()) and (cohort in f)]
|
| 27 |
+
matrix_candidates = [f for f in files if ('matrix' in f.lower()) and (cohort in f)]
|
| 28 |
+
|
| 29 |
+
if not soft_candidates:
|
| 30 |
+
soft_candidates = [f for f in files if 'soft' in f.lower()]
|
| 31 |
+
if not matrix_candidates:
|
| 32 |
+
matrix_candidates = [f for f in files if 'matrix' in f.lower()]
|
| 33 |
+
|
| 34 |
+
assert len(soft_candidates) > 0 and len(matrix_candidates) > 0
|
| 35 |
+
soft_file = os.path.join(in_cohort_dir, soft_candidates[0])
|
| 36 |
+
matrix_file = os.path.join(in_cohort_dir, matrix_candidates[0])
|
| 37 |
+
|
| 38 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 39 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 40 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 41 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 42 |
+
|
| 43 |
+
# 3. Create an informative clinical features dictionary with feature names as keys
|
| 44 |
+
clinical_df = clinical_data.copy()
|
| 45 |
+
|
| 46 |
+
# Keep only characteristics rows and drop the identifier column
|
| 47 |
+
if '!Sample_geo_accession' in clinical_df.columns:
|
| 48 |
+
characteristics_mask = clinical_df['!Sample_geo_accession'].astype(str).str.contains('!Sample_characteristics_ch1', na=False)
|
| 49 |
+
clinical_df = clinical_df[characteristics_mask].copy()
|
| 50 |
+
clinical_df = clinical_df.drop(columns=['!Sample_geo_accession'], errors='ignore')
|
| 51 |
+
|
| 52 |
+
# Derive feature names from the text before the colon in the first non-null value per row
|
| 53 |
+
new_index = []
|
| 54 |
+
seen = {}
|
| 55 |
+
for i, row in clinical_df.iterrows():
|
| 56 |
+
vals = [v for v in row.tolist() if pd.notnull(v)]
|
| 57 |
+
label = None
|
| 58 |
+
for v in vals:
|
| 59 |
+
if isinstance(v, str) and (':' in v):
|
| 60 |
+
label = v.split(':', 1)[0].strip()
|
| 61 |
+
break
|
| 62 |
+
if label is None:
|
| 63 |
+
label = f"feature_{i}"
|
| 64 |
+
count = seen.get(label, 0)
|
| 65 |
+
final_label = f"{label}#{count+1}" if count > 0 else label
|
| 66 |
+
seen[label] = count + 1
|
| 67 |
+
new_index.append(final_label)
|
| 68 |
+
|
| 69 |
+
clinical_df.index = new_index
|
| 70 |
+
|
| 71 |
+
# Limit number of unique values per feature explicitly
|
| 72 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_df, max_len=30)
|
| 73 |
+
|
| 74 |
+
# 4. Print background information and the sample characteristics dictionary
|
| 75 |
+
print("Background Information:")
|
| 76 |
+
print(background_info)
|
| 77 |
+
print("Sample Characteristics Dictionary:")
|
| 78 |
+
print(sample_characteristics_dict)
|
| 79 |
+
|
| 80 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 81 |
+
import os
|
| 82 |
+
import pandas as pd
|
| 83 |
+
import numpy as np
|
| 84 |
+
|
| 85 |
+
# 1) Determine gene expression availability from background info
|
| 86 |
+
is_gene_available = True # Series explicitly states "Gene Expression Profiles"
|
| 87 |
+
|
| 88 |
+
# Helper: extract header (text before colon) in a cell
|
| 89 |
+
def _extract_header_from_cell(x: str) -> str:
|
| 90 |
+
if not isinstance(x, str):
|
| 91 |
+
return None
|
| 92 |
+
if ':' in x:
|
| 93 |
+
return x.split(':', 1)[0].strip().lower()
|
| 94 |
+
return None
|
| 95 |
+
|
| 96 |
+
# Build a map from row index to header (by inspecting the first valid cell in each row)
|
| 97 |
+
row_header_map = {}
|
| 98 |
+
for ridx, row in clinical_data.iterrows():
|
| 99 |
+
header = None
|
| 100 |
+
for v in row.values:
|
| 101 |
+
header = _extract_header_from_cell(v)
|
| 102 |
+
if header:
|
| 103 |
+
break
|
| 104 |
+
row_header_map[ridx] = header
|
| 105 |
+
|
| 106 |
+
# Utility: find row by exact header or by predicate
|
| 107 |
+
def find_row_by_header(targets_exact=None, contains_any=None):
|
| 108 |
+
targets_exact = [t.lower() for t in (targets_exact or [])]
|
| 109 |
+
contains_any = [t.lower() for t in (contains_any or [])]
|
| 110 |
+
# exact match first
|
| 111 |
+
for ridx, header in row_header_map.items():
|
| 112 |
+
if header and header in targets_exact:
|
| 113 |
+
return ridx
|
| 114 |
+
# then contains_any
|
| 115 |
+
for ridx, header in row_header_map.items():
|
| 116 |
+
if header and any(tok in header for tok in contains_any):
|
| 117 |
+
return ridx
|
| 118 |
+
return None
|
| 119 |
+
|
| 120 |
+
# 2) Identify rows for trait (GERD), age, gender
|
| 121 |
+
|
| 122 |
+
# Trait row: look for 'clinical diagnosis patient' or similar, then ensure GERD is representable
|
| 123 |
+
trait_row = find_row_by_header(
|
| 124 |
+
targets_exact=['clinical diagnosis patient'],
|
| 125 |
+
contains_any=['diagnosis', 'diagnoses']
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
# Age row: prioritize 'age at excision (years)', otherwise fall back to typical age headers
|
| 129 |
+
age_row = None
|
| 130 |
+
preferred_age_headers = [
|
| 131 |
+
'age at excision (years)', 'age at diagnosis (years)', 'age at collection (years)',
|
| 132 |
+
'age (years)', 'age'
|
| 133 |
+
]
|
| 134 |
+
age_row = find_row_by_header(targets_exact=preferred_age_headers, contains_any=['age'])
|
| 135 |
+
|
| 136 |
+
# Gender row: look for 'gender' or 'sex'
|
| 137 |
+
gender_row = find_row_by_header(targets_exact=['gender', 'sex'], contains_any=['gender', 'sex'])
|
| 138 |
+
|
| 139 |
+
# 2.2 Converters
|
| 140 |
+
|
| 141 |
+
def _after_colon(value):
|
| 142 |
+
if not isinstance(value, str):
|
| 143 |
+
return None
|
| 144 |
+
if ':' in value:
|
| 145 |
+
return value.split(':', 1)[1].strip()
|
| 146 |
+
return value.strip() if value.strip() else None
|
| 147 |
+
|
| 148 |
+
def convert_trait(x):
|
| 149 |
+
val = _after_colon(x)
|
| 150 |
+
if val is None:
|
| 151 |
+
return None
|
| 152 |
+
s = val.lower()
|
| 153 |
+
# Treat explicit unknowns as None
|
| 154 |
+
if s in {'na', 'n/a', 'not available', 'unknown', ''}:
|
| 155 |
+
return None
|
| 156 |
+
# Positive if GERD explicitly present
|
| 157 |
+
if ('gastroesophageal reflux disease' in s) or ('gastro-oesophageal reflux disease' in s) or ('gerd' in s):
|
| 158 |
+
return 1
|
| 159 |
+
# Otherwise negative (no GERD mentioned among diagnoses)
|
| 160 |
+
return 0
|
| 161 |
+
|
| 162 |
+
def convert_age(x):
|
| 163 |
+
val = _after_colon(x)
|
| 164 |
+
if val is None:
|
| 165 |
+
return None
|
| 166 |
+
s = val.lower()
|
| 167 |
+
if s in {'na', 'n/a', 'not available', 'unknown', ''}:
|
| 168 |
+
return None
|
| 169 |
+
try:
|
| 170 |
+
f = float(val)
|
| 171 |
+
# filter out implausible placeholders
|
| 172 |
+
if f <= 0 or f > 120:
|
| 173 |
+
return None
|
| 174 |
+
return f
|
| 175 |
+
except Exception:
|
| 176 |
+
return None
|
| 177 |
+
|
| 178 |
+
def convert_gender(x):
|
| 179 |
+
val = _after_colon(x)
|
| 180 |
+
if val is None:
|
| 181 |
+
return None
|
| 182 |
+
s = val.lower()
|
| 183 |
+
if s in {'female', 'f'}:
|
| 184 |
+
return 0
|
| 185 |
+
if s in {'male', 'm'}:
|
| 186 |
+
return 1
|
| 187 |
+
if s in {'na', 'n/a', 'unknown', 'not available', ''}:
|
| 188 |
+
return None
|
| 189 |
+
return None
|
| 190 |
+
|
| 191 |
+
# 2.1 Validate availability by checking variation (constant features are useless)
|
| 192 |
+
def check_variation(row_idx, convert_fn):
|
| 193 |
+
if row_idx is None:
|
| 194 |
+
return None, set()
|
| 195 |
+
series = clinical_data.loc[row_idx]
|
| 196 |
+
converted = [convert_fn(v) for v in series.values]
|
| 197 |
+
uniq = {v for v in converted if v is not None}
|
| 198 |
+
if len(uniq) <= 1:
|
| 199 |
+
return None, uniq # treat as unavailable if constant or all None
|
| 200 |
+
return row_idx, uniq
|
| 201 |
+
|
| 202 |
+
# If trait_row candidate exists, ensure GERD signal is present (some 1s)
|
| 203 |
+
if trait_row is not None:
|
| 204 |
+
# Ensure at least one positive exists; else treat as unavailable
|
| 205 |
+
converted_vals = [convert_trait(v) for v in clinical_data.loc[trait_row].values]
|
| 206 |
+
uniq_trait = {v for v in converted_vals if v is not None}
|
| 207 |
+
if uniq_trait == {0} or len(uniq_trait) <= 1:
|
| 208 |
+
trait_row = None # no variation or no positives
|
| 209 |
+
|
| 210 |
+
age_row, uniq_age = check_variation(age_row, convert_age)
|
| 211 |
+
gender_row, uniq_gender = check_variation(gender_row, convert_gender)
|
| 212 |
+
|
| 213 |
+
# 3) Initial filtering metadata
|
| 214 |
+
is_trait_available = trait_row is not None
|
| 215 |
+
_ = validate_and_save_cohort_info(
|
| 216 |
+
is_final=False,
|
| 217 |
+
cohort=cohort,
|
| 218 |
+
info_path=json_path,
|
| 219 |
+
is_gene_available=is_gene_available,
|
| 220 |
+
is_trait_available=is_trait_available
|
| 221 |
+
)
|
| 222 |
+
|
| 223 |
+
# 4) Clinical feature extraction (only if trait is available)
|
| 224 |
+
if trait_row is not None:
|
| 225 |
+
# Extract and save
|
| 226 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 227 |
+
clinical_df=clinical_data,
|
| 228 |
+
trait=trait,
|
| 229 |
+
trait_row=trait_row,
|
| 230 |
+
convert_trait=convert_trait,
|
| 231 |
+
age_row=age_row,
|
| 232 |
+
convert_age=convert_age if age_row is not None else None,
|
| 233 |
+
gender_row=gender_row,
|
| 234 |
+
convert_gender=convert_gender if gender_row is not None else None
|
| 235 |
+
)
|
| 236 |
+
|
| 237 |
+
# Preview and save
|
| 238 |
+
preview = preview_df(selected_clinical_df, n=5)
|
| 239 |
+
print("Preview of selected clinical features:", preview)
|
| 240 |
+
|
| 241 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 242 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 243 |
+
else:
|
| 244 |
+
print("Trait data not available; skipping clinical feature extraction.")
|
| 245 |
+
|
| 246 |
+
# Step 3: Gene Data Extraction
|
| 247 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 248 |
+
gene_data = get_genetic_data(matrix_file)
|
| 249 |
+
|
| 250 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 251 |
+
print(gene_data.index[:20])
|
| 252 |
+
|
| 253 |
+
# Step 4: Gene Identifier Review
|
| 254 |
+
requires_gene_mapping = True
|
| 255 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 256 |
+
|
| 257 |
+
# Step 5: Gene Annotation
|
| 258 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 259 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 260 |
+
|
| 261 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 262 |
+
print("Gene annotation preview:")
|
| 263 |
+
print(preview_df(gene_annotation))
|
| 264 |
+
|
| 265 |
+
# Step 6: Gene Identifier Mapping
|
| 266 |
+
# Identify mapping columns from annotation:
|
| 267 |
+
# - Probe/ID column matches expression row IDs: 'ID'
|
| 268 |
+
# - Gene symbol column: 'Gene Symbol'
|
| 269 |
+
probe_col = 'ID'
|
| 270 |
+
gene_symbol_col = 'Gene Symbol'
|
| 271 |
+
|
| 272 |
+
# Build mapping dataframe
|
| 273 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
| 274 |
+
|
| 275 |
+
# Apply mapping: convert probe-level data to gene-level data
|
| 276 |
+
probe_level_df = gene_data # keep original probe-level data
|
| 277 |
+
gene_data = apply_gene_mapping(probe_level_df, mapping_df)
|
| 278 |
+
|
| 279 |
+
# Step 7: Data Normalization and Linking
|
| 280 |
+
import os
|
| 281 |
+
import pandas as pd
|
| 282 |
+
|
| 283 |
+
# 1. Normalize gene symbols and save gene-level data
|
| 284 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 285 |
+
|
| 286 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 287 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 288 |
+
|
| 289 |
+
# 2. Ensure clinical dataframe is available; load from disk if not in memory
|
| 290 |
+
try:
|
| 291 |
+
selected_clinical_df
|
| 292 |
+
except NameError:
|
| 293 |
+
if os.path.exists(out_clinical_data_file):
|
| 294 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 295 |
+
else:
|
| 296 |
+
raise FileNotFoundError("Clinical data not found in memory or on disk.")
|
| 297 |
+
|
| 298 |
+
# Link clinical and genetic data
|
| 299 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 300 |
+
|
| 301 |
+
# 3. Handle missing values
|
| 302 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 303 |
+
|
| 304 |
+
# 4. Bias check and removal of biased demographic features
|
| 305 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 306 |
+
|
| 307 |
+
# Derive availability flags from actual data; cast to built-in bool to avoid numpy.bool_ in JSON
|
| 308 |
+
is_gene_available = bool((normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0))
|
| 309 |
+
is_trait_available = bool((trait in linked_data.columns) and bool(linked_data[trait].notna().any()))
|
| 310 |
+
is_trait_biased = bool(is_trait_biased)
|
| 311 |
+
|
| 312 |
+
# 5. Final validation and save cohort info
|
| 313 |
+
note = ("INFO: Dataset is a lung cancer cohort; GERD appears as a comorbidity in a small subset. "
|
| 314 |
+
"Trait may be imbalanced after filtering/imputation.")
|
| 315 |
+
is_usable = validate_and_save_cohort_info(
|
| 316 |
+
is_final=True,
|
| 317 |
+
cohort=cohort,
|
| 318 |
+
info_path=json_path,
|
| 319 |
+
is_gene_available=is_gene_available,
|
| 320 |
+
is_trait_available=is_trait_available,
|
| 321 |
+
is_biased=is_trait_biased,
|
| 322 |
+
df=unbiased_linked_data,
|
| 323 |
+
note=note
|
| 324 |
+
)
|
| 325 |
+
is_usable = bool(is_usable)
|
| 326 |
+
|
| 327 |
+
# 6. Save linked data only if usable
|
| 328 |
+
if is_usable:
|
| 329 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 330 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/GSE68698.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Gastroesophageal_reflux_disease_(GERD)"
|
| 6 |
+
cohort = "GSE68698"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Gastroesophageal_reflux_disease_(GERD)"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Gastroesophageal_reflux_disease_(GERD)/GSE68698"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/GSE68698.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/gene_data/GSE68698.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/GSE68698.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import re
|
| 40 |
+
import pandas as pd
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression availability
|
| 43 |
+
is_gene_available = True # Series summary explicitly states "Gene expression was measured"
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability and conversion functions
|
| 46 |
+
# From the provided Sample Characteristics Dictionary:
|
| 47 |
+
# 0: case/control (for SSc, not GERD), 1: tissue (constant), 2: biopsy site, 3: batch, 4: SSc subtype, 5: patient/control id
|
| 48 |
+
# No GERD status, no age, no gender available.
|
| 49 |
+
trait_row = None
|
| 50 |
+
age_row = None
|
| 51 |
+
gender_row = None
|
| 52 |
+
|
| 53 |
+
def _after_colon(x: str) -> str:
|
| 54 |
+
if x is None:
|
| 55 |
+
return ""
|
| 56 |
+
parts = str(x).split(":", 1)
|
| 57 |
+
return parts[1].strip() if len(parts) == 2 else str(x).strip()
|
| 58 |
+
|
| 59 |
+
def convert_trait(x):
|
| 60 |
+
# Binary: 1 = GERD present, 0 = GERD absent
|
| 61 |
+
# Conservative mapping for GERD; do NOT map generic "case" because in this dataset "case" = SSc, not GERD.
|
| 62 |
+
val = _after_colon(x).lower()
|
| 63 |
+
if val in {"na", "nan", "", "unknown", "undetermined"}:
|
| 64 |
+
return None
|
| 65 |
+
positives = [
|
| 66 |
+
"gerd", "gastroesophageal reflux", "gastro-oesophageal reflux", "reflux disease",
|
| 67 |
+
"gastroesophageal reflux disease", "gastro-oesophageal reflux disease", "ger"
|
| 68 |
+
]
|
| 69 |
+
negatives = ["control", "healthy", "no gerd", "none", "no"]
|
| 70 |
+
if any(p in val for p in positives):
|
| 71 |
+
return 1
|
| 72 |
+
if any(n == val for n in negatives):
|
| 73 |
+
return 0
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
def convert_age(x):
|
| 77 |
+
# Continuous: extract numeric age in years
|
| 78 |
+
val = _after_colon(x)
|
| 79 |
+
if val.lower() in {"na", "nan", "", "unknown"}:
|
| 80 |
+
return None
|
| 81 |
+
m = re.search(r"(\d+(\.\d+)?)", val)
|
| 82 |
+
if m:
|
| 83 |
+
try:
|
| 84 |
+
return float(m.group(1))
|
| 85 |
+
except Exception:
|
| 86 |
+
return None
|
| 87 |
+
return None
|
| 88 |
+
|
| 89 |
+
def convert_gender(x):
|
| 90 |
+
# Binary: female=0, male=1
|
| 91 |
+
val = _after_colon(x).lower()
|
| 92 |
+
if val in {"na", "nan", "", "unknown"}:
|
| 93 |
+
return None
|
| 94 |
+
if val in {"male", "m"}:
|
| 95 |
+
return 1
|
| 96 |
+
if val in {"female", "f"}:
|
| 97 |
+
return 0
|
| 98 |
+
return None
|
| 99 |
+
|
| 100 |
+
# 3) Initial filtering and save metadata
|
| 101 |
+
is_trait_available = trait_row is not None
|
| 102 |
+
_ = validate_and_save_cohort_info(
|
| 103 |
+
is_final=False,
|
| 104 |
+
cohort=cohort,
|
| 105 |
+
info_path=json_path,
|
| 106 |
+
is_gene_available=is_gene_available,
|
| 107 |
+
is_trait_available=is_trait_available
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
# 4) Clinical feature extraction (skip because trait data not available)
|
| 111 |
+
# If trait_row were available:
|
| 112 |
+
if trait_row is not None:
|
| 113 |
+
selected = geo_select_clinical_features(
|
| 114 |
+
clinical_df=clinical_data,
|
| 115 |
+
trait=trait,
|
| 116 |
+
trait_row=trait_row,
|
| 117 |
+
convert_trait=convert_trait,
|
| 118 |
+
age_row=age_row,
|
| 119 |
+
convert_age=convert_age,
|
| 120 |
+
gender_row=gender_row,
|
| 121 |
+
convert_gender=convert_gender
|
| 122 |
+
)
|
| 123 |
+
preview = preview_df(selected, n=5)
|
| 124 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 125 |
+
selected.to_csv(out_clinical_data_file, index=True)
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/GSE77563.py
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Gastroesophageal_reflux_disease_(GERD)"
|
| 6 |
+
cohort = "GSE77563"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Gastroesophageal_reflux_disease_(GERD)"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Gastroesophageal_reflux_disease_(GERD)/GSE77563"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/GSE77563.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/gene_data/GSE77563.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/GSE77563.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
import pandas as pd
|
| 42 |
+
|
| 43 |
+
# 1) Gene expression availability (Affymetrix Human Gene 2.1 ST arrays => gene expression microarray)
|
| 44 |
+
is_gene_available = True
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability
|
| 47 |
+
trait_row = 5 # 'gastroesophageal reflux disease (gerd) status: GERD' / 'No GERD'
|
| 48 |
+
age_row = 1 # 'age (yr): <num>'
|
| 49 |
+
gender_row = 2 # 'gender: male' / 'gender: female'
|
| 50 |
+
|
| 51 |
+
# 2.2) Converters
|
| 52 |
+
def _after_colon(x):
|
| 53 |
+
if x is None:
|
| 54 |
+
return None
|
| 55 |
+
try:
|
| 56 |
+
s = str(x)
|
| 57 |
+
# Take the substring after the last colon to be safe
|
| 58 |
+
if ':' in s:
|
| 59 |
+
s = s.split(':', 1)[1]
|
| 60 |
+
return s.strip()
|
| 61 |
+
except Exception:
|
| 62 |
+
return None
|
| 63 |
+
|
| 64 |
+
def convert_trait(x):
|
| 65 |
+
v = _after_colon(x)
|
| 66 |
+
if v is None or v == '':
|
| 67 |
+
return None
|
| 68 |
+
v_lower = v.lower()
|
| 69 |
+
# Map GERD presence to 1, absence to 0
|
| 70 |
+
if any(tok in v_lower for tok in ['unknown', 'na', 'n/a']):
|
| 71 |
+
return None
|
| 72 |
+
# Explicit negatives
|
| 73 |
+
if 'no gerd' in v_lower or v_lower in ['no', 'none', 'control']:
|
| 74 |
+
return 0
|
| 75 |
+
# Positives
|
| 76 |
+
if 'gerd' in v_lower or v_lower in ['yes', 'case']:
|
| 77 |
+
# Guard against explicit "no gerd" handled above
|
| 78 |
+
return 1
|
| 79 |
+
return None
|
| 80 |
+
|
| 81 |
+
def convert_age(x):
|
| 82 |
+
v = _after_colon(x)
|
| 83 |
+
if v is None or v == '':
|
| 84 |
+
return None
|
| 85 |
+
# Extract numeric age
|
| 86 |
+
m = re.search(r'[-+]?\d*\.?\d+', v)
|
| 87 |
+
if m:
|
| 88 |
+
try:
|
| 89 |
+
return float(m.group())
|
| 90 |
+
except Exception:
|
| 91 |
+
return None
|
| 92 |
+
return None
|
| 93 |
+
|
| 94 |
+
def convert_gender(x):
|
| 95 |
+
v = _after_colon(x)
|
| 96 |
+
if v is None or v == '':
|
| 97 |
+
return None
|
| 98 |
+
v_lower = v.lower()
|
| 99 |
+
if any(tok in v_lower for tok in ['unknown', 'na', 'n/a']):
|
| 100 |
+
return None
|
| 101 |
+
# Female -> 0, Male -> 1
|
| 102 |
+
if v_lower in ['female', 'f', 'woman', 'women']:
|
| 103 |
+
return 0
|
| 104 |
+
if v_lower in ['male', 'm', 'man', 'men']:
|
| 105 |
+
return 1
|
| 106 |
+
return None
|
| 107 |
+
|
| 108 |
+
# 3) Save metadata (initial filtering)
|
| 109 |
+
is_trait_available = trait_row is not None
|
| 110 |
+
_ = validate_and_save_cohort_info(
|
| 111 |
+
is_final=False,
|
| 112 |
+
cohort=cohort,
|
| 113 |
+
info_path=json_path,
|
| 114 |
+
is_gene_available=is_gene_available,
|
| 115 |
+
is_trait_available=is_trait_available
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
# 4) Clinical feature extraction (only if trait data available)
|
| 119 |
+
if trait_row is not None:
|
| 120 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 121 |
+
clinical_df=clinical_data,
|
| 122 |
+
trait=trait,
|
| 123 |
+
trait_row=trait_row,
|
| 124 |
+
convert_trait=convert_trait,
|
| 125 |
+
age_row=age_row,
|
| 126 |
+
convert_age=convert_age,
|
| 127 |
+
gender_row=gender_row,
|
| 128 |
+
convert_gender=convert_gender
|
| 129 |
+
)
|
| 130 |
+
clinical_preview = preview_df(selected_clinical_df, n=5)
|
| 131 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 132 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
| 133 |
+
|
| 134 |
+
# Step 3: Gene Data Extraction
|
| 135 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 136 |
+
gene_data = get_genetic_data(matrix_file)
|
| 137 |
+
|
| 138 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 139 |
+
print(gene_data.index[:20])
|
| 140 |
+
|
| 141 |
+
# Step 4: Gene Identifier Review
|
| 142 |
+
# The observed identifiers are numeric probe IDs (e.g., Illumina ProbeID), not human gene symbols.
|
| 143 |
+
requires_gene_mapping = True
|
| 144 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 145 |
+
|
| 146 |
+
# Step 5: Gene Annotation
|
| 147 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 148 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 149 |
+
|
| 150 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 151 |
+
print("Gene annotation preview:")
|
| 152 |
+
print(preview_df(gene_annotation))
|
| 153 |
+
|
| 154 |
+
# Step 6: Gene Identifier Mapping
|
| 155 |
+
# Determine the appropriate columns for mapping
|
| 156 |
+
probe_col = 'ID' # Matches the probe IDs in the expression data
|
| 157 |
+
gene_col = 'gene_assignment' # Contains gene information including symbols
|
| 158 |
+
|
| 159 |
+
# Build mapping dataframe (Probe ID -> Gene annotation text)
|
| 160 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_col)
|
| 161 |
+
|
| 162 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 163 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 164 |
+
|
| 165 |
+
# Step 7: Data Normalization and Linking
|
| 166 |
+
import os
|
| 167 |
+
import pandas as pd
|
| 168 |
+
|
| 169 |
+
# 1) Normalize gene symbols and save normalized gene expression data
|
| 170 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 171 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 172 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 173 |
+
|
| 174 |
+
# 2) Ensure clinical features are available in this scope; reconstruct robustly
|
| 175 |
+
if 'selected_clinical_df' not in globals():
|
| 176 |
+
rebuilt = False
|
| 177 |
+
try:
|
| 178 |
+
# Prefer reconstructing directly from clinical_data if available
|
| 179 |
+
if 'clinical_data' in globals():
|
| 180 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 181 |
+
clinical_df=clinical_data,
|
| 182 |
+
trait=trait,
|
| 183 |
+
trait_row=trait_row,
|
| 184 |
+
convert_trait=convert_trait,
|
| 185 |
+
age_row=age_row,
|
| 186 |
+
convert_age=convert_age,
|
| 187 |
+
gender_row=gender_row,
|
| 188 |
+
convert_gender=convert_gender
|
| 189 |
+
)
|
| 190 |
+
rebuilt = True
|
| 191 |
+
except Exception:
|
| 192 |
+
rebuilt = False
|
| 193 |
+
|
| 194 |
+
if not rebuilt:
|
| 195 |
+
# Fallback: load from CSV saved in step 2 and assign expected index
|
| 196 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file)
|
| 197 |
+
# Assign the expected feature index in the correct order
|
| 198 |
+
expected_idx = [trait, 'Age', 'Gender']
|
| 199 |
+
selected_clinical_df.index = expected_idx[: len(selected_clinical_df)]
|
| 200 |
+
|
| 201 |
+
# 3) Link clinical and genetic data
|
| 202 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 203 |
+
|
| 204 |
+
# 4) Handle missing values systematically
|
| 205 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 206 |
+
|
| 207 |
+
# 5) Assess bias and remove biased demographic features
|
| 208 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 209 |
+
|
| 210 |
+
# 6) Determine availability flags using native Python bool
|
| 211 |
+
is_gene_available = bool((normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0))
|
| 212 |
+
trait_in_index = bool(trait in selected_clinical_df.index)
|
| 213 |
+
trait_has_data = False
|
| 214 |
+
if trait_in_index:
|
| 215 |
+
# Ensure Python bool, not numpy.bool_
|
| 216 |
+
trait_has_data = bool(selected_clinical_df.loc[trait].notna().any())
|
| 217 |
+
is_trait_available = bool(trait_in_index and trait_has_data)
|
| 218 |
+
|
| 219 |
+
# 7) Final validation and save cohort info
|
| 220 |
+
note = "INFO: Affymetrix probe IDs mapped to gene symbols; symbols normalized via NCBI synonym list."
|
| 221 |
+
is_usable = validate_and_save_cohort_info(
|
| 222 |
+
is_final=True,
|
| 223 |
+
cohort=cohort,
|
| 224 |
+
info_path=json_path,
|
| 225 |
+
is_gene_available=bool(is_gene_available),
|
| 226 |
+
is_trait_available=bool(is_trait_available),
|
| 227 |
+
is_biased=bool(is_trait_biased),
|
| 228 |
+
df=unbiased_linked_data,
|
| 229 |
+
note=note
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
# 8) Save linked data if usable
|
| 233 |
+
if is_usable:
|
| 234 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 235 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/code/TCGA.py
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Gastroesophageal_reflux_disease_(GERD)"
|
| 6 |
+
|
| 7 |
+
# Input paths
|
| 8 |
+
tcga_root_dir = "../DATA/TCGA"
|
| 9 |
+
|
| 10 |
+
# Output paths
|
| 11 |
+
out_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/TCGA.csv"
|
| 12 |
+
out_gene_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/gene_data/TCGA.csv"
|
| 13 |
+
out_clinical_data_file = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/clinical_data/TCGA.csv"
|
| 14 |
+
json_path = "./output/z3/preprocess/Gastroesophageal_reflux_disease_(GERD)/cohort_info.json"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Step 1: Initial Data Loading
|
| 18 |
+
import os
|
| 19 |
+
import pandas as pd
|
| 20 |
+
|
| 21 |
+
# 1) Select the most relevant TCGA cohort directory for GERD (organ/phenotype overlap)
|
| 22 |
+
subdirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
| 23 |
+
lower_map = {d: d.lower() for d in subdirs}
|
| 24 |
+
|
| 25 |
+
# Define matching keywords with simple weighting to prefer esophageal-related cohorts
|
| 26 |
+
high_priority = ['gastroesophageal', 'gerd', 'reflux', 'esophag', 'esophageal']
|
| 27 |
+
secondary = ['stomach', 'gastric']
|
| 28 |
+
|
| 29 |
+
scores = {}
|
| 30 |
+
for d, name in lower_map.items():
|
| 31 |
+
score = 0
|
| 32 |
+
score += sum(2 for k in high_priority if k in name)
|
| 33 |
+
score += sum(1 for k in secondary if k in name)
|
| 34 |
+
scores[d] = score
|
| 35 |
+
|
| 36 |
+
# Pick the best match (expect ESCA to be selected)
|
| 37 |
+
selected_dir_name = max(scores, key=lambda k: scores[k]) if scores else None
|
| 38 |
+
if selected_dir_name is None or scores[selected_dir_name] == 0:
|
| 39 |
+
# No suitable TCGA cohort found; mark as skipped for this trait
|
| 40 |
+
validate_and_save_cohort_info(
|
| 41 |
+
is_final=False,
|
| 42 |
+
cohort="TCGA",
|
| 43 |
+
info_path=json_path,
|
| 44 |
+
is_gene_available=False,
|
| 45 |
+
is_trait_available=False
|
| 46 |
+
)
|
| 47 |
+
# Print an empty list for columns to adhere to the instruction
|
| 48 |
+
print([])
|
| 49 |
+
else:
|
| 50 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_dir_name)
|
| 51 |
+
|
| 52 |
+
# 2) Identify clinical and genetic file paths
|
| 53 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
| 54 |
+
|
| 55 |
+
# 3) Load both files
|
| 56 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0, low_memory=False, compression='infer')
|
| 57 |
+
genetic_df = pd.read_csv(genetic_file_path, sep='\t', index_col=0, low_memory=False, compression='infer')
|
| 58 |
+
|
| 59 |
+
# 4) Print clinical column names
|
| 60 |
+
print(list(clinical_df.columns))
|
| 61 |
+
|
| 62 |
+
# Step 2: Find Candidate Demographic Features
|
| 63 |
+
import re
|
| 64 |
+
|
| 65 |
+
# Column names from the previous step
|
| 66 |
+
columns = ['CDE_ID_3226963', '_INTEGRATION', '_PATIENT', '_cohort', '_primary_disease', '_primary_site', 'additional_pharmaceutical_therapy', 'additional_radiation_therapy', 'additional_treatment_completion_success_outcome', 'age_at_initial_pathologic_diagnosis', 'age_began_smoking_in_years', 'alcohol_history_documented', 'amount_of_alcohol_consumption_per_day', 'antireflux_treatment_type', 'barretts_esophagus', 'bcr_followup_barcode', 'bcr_patient_barcode', 'bcr_sample_barcode', 'city_of_procurement', 'clinical_M', 'clinical_N', 'clinical_T', 'clinical_stage', 'columnar_metaplasia_present', 'columnar_mucosa_dysplasia', 'columnar_mucosa_goblet_cell_present', 'country_of_birth', 'country_of_procurement', 'days_to_birth', 'days_to_collection', 'days_to_death', 'days_to_initial_pathologic_diagnosis', 'days_to_last_followup', 'days_to_new_tumor_event_additional_surgery_procedure', 'days_to_new_tumor_event_after_initial_treatment', 'eastern_cancer_oncology_group', 'esophageal_tumor_cental_location', 'esophageal_tumor_involvement_site', 'form_completion_date', 'frequency_of_alcohol_consumption', 'gender', 'goblet_cells_present', 'h_pylori_infection', 'height', 'histological_type', 'history_of_esophageal_cancer', 'history_of_neoadjuvant_treatment', 'icd_10', 'icd_o_3_histology', 'icd_o_3_site', 'informed_consent_verified', 'init_pathology_dx_method_other', 'initial_diagnosis_by', 'initial_pathologic_diagnosis_method', 'initial_weight', 'is_ffpe', 'karnofsky_performance_score', 'lost_follow_up', 'lymph_node_examined_count', 'lymph_node_metastasis_radiographic_evidence', 'neoplasm_histologic_grade', 'new_neoplasm_event_occurrence_anatomic_site', 'new_neoplasm_event_type', 'new_neoplasm_occurrence_anatomic_site_text', 'new_tumor_event_additional_surgery_procedure', 'new_tumor_event_after_initial_treatment', 'number_of_lymphnodes_positive_by_he', 'number_of_lymphnodes_positive_by_ihc', 'number_of_relatives_diagnosed', 'number_pack_years_smoked', 'oct_embedded', 'other_dx', 'pathologic_M', 'pathologic_N', 'pathologic_T', 'pathologic_stage', 'pathology_report_file_name', 'patient_id', 'person_neoplasm_cancer_status', 'planned_surgery_status', 'postoperative_rx_tx', 'primary_lymph_node_presentation_assessment', 'primary_therapy_outcome_success', 'progression_determined_by', 'radiation_therapy', 'reflux_history', 'residual_tumor', 'sample_type', 'sample_type_id', 'state_province_of_procurement', 'stopped_smoking_year', 'system_version', 'tissue_prospective_collection_indicator', 'tissue_retrospective_collection_indicator', 'tissue_source_site', 'tobacco_smoking_history', 'treatment_prior_to_surgery', 'tumor_tissue_site', 'vial_number', 'vital_status', 'weight', 'year_of_initial_pathologic_diagnosis', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeqV2_percentile', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeqV2_PANCAN', '_GENOMIC_ID_TCGA_ESCA_mutation_bcm_gene', '_GENOMIC_ID_data/public/TCGA/ESCA/miRNA_HiSeq_gene', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeq_exon', '_GENOMIC_ID_TCGA_ESCA_PDMRNAseq', '_GENOMIC_ID_TCGA_ESCA_hMethyl450', '_GENOMIC_ID_TCGA_ESCA_RPPA', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeqV2', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeq', '_GENOMIC_ID_TCGA_ESCA_miRNA_HiSeq', '_GENOMIC_ID_TCGA_ESCA_mutation_ucsc_maf_gene', '_GENOMIC_ID_TCGA_ESCA_gistic2', '_GENOMIC_ID_TCGA_ESCA_gistic2thd', '_GENOMIC_ID_TCGA_ESCA_mutation_broad_gene', '_GENOMIC_ID_TCGA_ESCA_exp_HiSeqV2_exon', '_GENOMIC_ID_TCGA_ESCA_mutation_bcgsc_gene', '_GENOMIC_ID_TCGA_ESCA_PDMRNAseqCNV']
|
| 67 |
+
|
| 68 |
+
def find_candidate_age_cols(cols):
|
| 69 |
+
res = []
|
| 70 |
+
for c in cols:
|
| 71 |
+
l = c.lower()
|
| 72 |
+
if (
|
| 73 |
+
'days_to_birth' in l or
|
| 74 |
+
l.startswith('age') or
|
| 75 |
+
'age_' in l or
|
| 76 |
+
l.endswith('_age') or
|
| 77 |
+
l == 'age'
|
| 78 |
+
):
|
| 79 |
+
res.append(c)
|
| 80 |
+
return res
|
| 81 |
+
|
| 82 |
+
def find_candidate_gender_cols(cols):
|
| 83 |
+
res = []
|
| 84 |
+
for c in cols:
|
| 85 |
+
l = c.lower()
|
| 86 |
+
if ('gender' in l) or re.search(r'(^|[_\W])sex([_\W]|$)', l):
|
| 87 |
+
res.append(c)
|
| 88 |
+
return res
|
| 89 |
+
|
| 90 |
+
candidate_age_cols = find_candidate_age_cols(columns)
|
| 91 |
+
candidate_gender_cols = find_candidate_gender_cols(columns)
|
| 92 |
+
|
| 93 |
+
print(f"candidate_age_cols = {candidate_age_cols}")
|
| 94 |
+
print(f"candidate_gender_cols = {candidate_gender_cols}")
|
| 95 |
+
|
| 96 |
+
# Preview extracted data if clinical_df exists and columns are present
|
| 97 |
+
try:
|
| 98 |
+
_ = clinical_df # check existence
|
| 99 |
+
age_cols_present = [c for c in candidate_age_cols if c in clinical_df.columns]
|
| 100 |
+
gender_cols_present = [c for c in candidate_gender_cols if c in clinical_df.columns]
|
| 101 |
+
|
| 102 |
+
if age_cols_present:
|
| 103 |
+
age_preview = preview_df(clinical_df[age_cols_present])
|
| 104 |
+
print(age_preview)
|
| 105 |
+
if gender_cols_present:
|
| 106 |
+
gender_preview = preview_df(clinical_df[gender_cols_present])
|
| 107 |
+
print(gender_preview)
|
| 108 |
+
except NameError:
|
| 109 |
+
pass
|
| 110 |
+
|
| 111 |
+
# Step 3: Select Demographic Features
|
| 112 |
+
import math
|
| 113 |
+
|
| 114 |
+
# Use previously created preview dicts if they exist; otherwise, set to None
|
| 115 |
+
try:
|
| 116 |
+
age_preview = age_preview_dict if isinstance(age_preview_dict, dict) else None
|
| 117 |
+
except NameError:
|
| 118 |
+
age_preview = None
|
| 119 |
+
|
| 120 |
+
try:
|
| 121 |
+
gender_preview = gender_preview_dict if isinstance(gender_preview_dict, dict) else None
|
| 122 |
+
except NameError:
|
| 123 |
+
gender_preview = None
|
| 124 |
+
|
| 125 |
+
def is_missing(val):
|
| 126 |
+
if val is None:
|
| 127 |
+
return True
|
| 128 |
+
if isinstance(val, float):
|
| 129 |
+
try:
|
| 130 |
+
return math.isnan(val)
|
| 131 |
+
except Exception:
|
| 132 |
+
return False
|
| 133 |
+
if isinstance(val, str) and val.strip() == "":
|
| 134 |
+
return True
|
| 135 |
+
return False
|
| 136 |
+
|
| 137 |
+
def fraction_missing(samples):
|
| 138 |
+
if not samples:
|
| 139 |
+
return 1.0
|
| 140 |
+
missing = sum(1 for v in samples if is_missing(v))
|
| 141 |
+
return missing / len(samples)
|
| 142 |
+
|
| 143 |
+
# Determine if previews are usable (non-empty and contain at least one sample list with items)
|
| 144 |
+
def preview_available(preview_dict):
|
| 145 |
+
if not isinstance(preview_dict, dict):
|
| 146 |
+
return False
|
| 147 |
+
for v in preview_dict.values():
|
| 148 |
+
if isinstance(v, list) and len(v) > 0:
|
| 149 |
+
return True
|
| 150 |
+
return False
|
| 151 |
+
|
| 152 |
+
age_col = None
|
| 153 |
+
gender_col = None
|
| 154 |
+
|
| 155 |
+
# AGE: Prefer 'age_at_initial_pathologic_diagnosis' over 'days_to_birth' if both present
|
| 156 |
+
preferred_age_cols = [c for c in ['age_at_initial_pathologic_diagnosis', 'days_to_birth'] if c in candidate_age_cols]
|
| 157 |
+
|
| 158 |
+
if preview_available(age_preview):
|
| 159 |
+
# Evaluate preferred candidates with simple plausibility checks
|
| 160 |
+
for col in preferred_age_cols:
|
| 161 |
+
samples = age_preview.get(col, [])
|
| 162 |
+
miss_frac = fraction_missing(samples)
|
| 163 |
+
|
| 164 |
+
if col == 'age_at_initial_pathologic_diagnosis':
|
| 165 |
+
valid_vals = []
|
| 166 |
+
for v in samples:
|
| 167 |
+
if is_missing(v):
|
| 168 |
+
continue
|
| 169 |
+
try:
|
| 170 |
+
fv = float(v)
|
| 171 |
+
valid_vals.append(fv)
|
| 172 |
+
except Exception:
|
| 173 |
+
pass
|
| 174 |
+
plaus_count = sum(1 for fv in valid_vals if 0 <= fv <= 120)
|
| 175 |
+
if miss_frac < 0.6 and plaus_count >= max(1, len(samples) // 2):
|
| 176 |
+
age_col = col
|
| 177 |
+
break
|
| 178 |
+
|
| 179 |
+
elif col == 'days_to_birth':
|
| 180 |
+
valid_vals = []
|
| 181 |
+
for v in samples:
|
| 182 |
+
if is_missing(v):
|
| 183 |
+
continue
|
| 184 |
+
try:
|
| 185 |
+
fv = float(v)
|
| 186 |
+
valid_vals.append(fv)
|
| 187 |
+
except Exception:
|
| 188 |
+
pass
|
| 189 |
+
# Typical days_to_birth are negative with magnitude of years in days
|
| 190 |
+
plaus_count = sum(1 for fv in valid_vals if fv <= -3650) # at least ~10 years in magnitude
|
| 191 |
+
if miss_frac < 0.6 and plaus_count >= max(1, len(samples) // 2):
|
| 192 |
+
age_col = col
|
| 193 |
+
break
|
| 194 |
+
|
| 195 |
+
# If still None, try any other candidate that looks like a plausible age (0-120)
|
| 196 |
+
if age_col is None:
|
| 197 |
+
for col in candidate_age_cols:
|
| 198 |
+
if col in preferred_age_cols:
|
| 199 |
+
continue
|
| 200 |
+
samples = age_preview.get(col, [])
|
| 201 |
+
miss_frac = fraction_missing(samples)
|
| 202 |
+
valid_vals = []
|
| 203 |
+
for v in samples:
|
| 204 |
+
if is_missing(v):
|
| 205 |
+
continue
|
| 206 |
+
try:
|
| 207 |
+
fv = float(v)
|
| 208 |
+
valid_vals.append(fv)
|
| 209 |
+
except Exception:
|
| 210 |
+
pass
|
| 211 |
+
plaus_count = sum(1 for fv in valid_vals if 0 <= fv <= 120)
|
| 212 |
+
if miss_frac < 0.6 and plaus_count >= max(1, len(samples) // 2):
|
| 213 |
+
age_col = col
|
| 214 |
+
break
|
| 215 |
+
else:
|
| 216 |
+
# Robust fallback when previews are unavailable
|
| 217 |
+
if 'age_at_initial_pathologic_diagnosis' in candidate_age_cols:
|
| 218 |
+
age_col = 'age_at_initial_pathologic_diagnosis'
|
| 219 |
+
elif 'days_to_birth' in candidate_age_cols:
|
| 220 |
+
age_col = 'days_to_birth'
|
| 221 |
+
else:
|
| 222 |
+
age_col = None
|
| 223 |
+
|
| 224 |
+
# GENDER: Prefer 'gender'
|
| 225 |
+
if preview_available(gender_preview):
|
| 226 |
+
# Validate 'gender' if present; otherwise, scan other candidates
|
| 227 |
+
scan_cols = ['gender'] if 'gender' in candidate_gender_cols else list(candidate_gender_cols)
|
| 228 |
+
for col in scan_cols:
|
| 229 |
+
samples = gender_preview.get(col, [])
|
| 230 |
+
miss_frac = fraction_missing(samples)
|
| 231 |
+
if miss_frac >= 0.6:
|
| 232 |
+
continue
|
| 233 |
+
valid_mapped = 0
|
| 234 |
+
for v in samples:
|
| 235 |
+
mapped = tcga_convert_gender(v)
|
| 236 |
+
if mapped in (0, 1):
|
| 237 |
+
valid_mapped += 1
|
| 238 |
+
if valid_mapped >= max(1, len(samples) // 2):
|
| 239 |
+
gender_col = col
|
| 240 |
+
break
|
| 241 |
+
else:
|
| 242 |
+
# Robust fallback when previews are unavailable
|
| 243 |
+
if 'gender' in candidate_gender_cols:
|
| 244 |
+
gender_col = 'gender'
|
| 245 |
+
else:
|
| 246 |
+
gender_col = None
|
| 247 |
+
|
| 248 |
+
print(f"Selected age_col: {age_col}, samples: {age_preview.get(age_col) if (age_col and preview_available(age_preview)) else None}")
|
| 249 |
+
print(f"Selected gender_col: {gender_col}, samples: {gender_preview.get(gender_col) if (gender_col and preview_available(gender_preview)) else None}")
|
| 250 |
+
|
| 251 |
+
# Step 4: Feature Engineering and Validation
|
| 252 |
+
import os
|
| 253 |
+
import pandas as pd
|
| 254 |
+
|
| 255 |
+
# 1) Extract and standardize clinical features (trait, Age, Gender)
|
| 256 |
+
# Fall back if previous step variables are not in scope or invalid
|
| 257 |
+
try:
|
| 258 |
+
_ = age_col
|
| 259 |
+
except NameError:
|
| 260 |
+
age_col = None
|
| 261 |
+
try:
|
| 262 |
+
_ = gender_col
|
| 263 |
+
except NameError:
|
| 264 |
+
gender_col = None
|
| 265 |
+
|
| 266 |
+
if age_col not in clinical_df.columns:
|
| 267 |
+
age_col = None
|
| 268 |
+
if gender_col not in clinical_df.columns:
|
| 269 |
+
gender_col = None
|
| 270 |
+
|
| 271 |
+
selected_clinical_df = tcga_select_clinical_features(
|
| 272 |
+
clinical_df=clinical_df,
|
| 273 |
+
trait=trait,
|
| 274 |
+
age_col=age_col,
|
| 275 |
+
gender_col=gender_col
|
| 276 |
+
)
|
| 277 |
+
|
| 278 |
+
# 2) Normalize gene symbols in gene expression data and save
|
| 279 |
+
gene_expr = genetic_df.copy()
|
| 280 |
+
|
| 281 |
+
def frac_startswith_tcga(x):
|
| 282 |
+
if len(x) == 0:
|
| 283 |
+
return 0.0
|
| 284 |
+
return sum(1 for v in x if isinstance(v, str) and v.startswith("TCGA-")) / len(x)
|
| 285 |
+
|
| 286 |
+
# Ensure orientation: rows=genes, cols=samples
|
| 287 |
+
cols_tcga_frac = frac_startswith_tcga(gene_expr.columns)
|
| 288 |
+
idx_tcga_frac = frac_startswith_tcga(gene_expr.index)
|
| 289 |
+
|
| 290 |
+
if idx_tcga_frac > cols_tcga_frac:
|
| 291 |
+
# Likely samples are in index and genes in columns; transpose
|
| 292 |
+
gene_expr = gene_expr.T
|
| 293 |
+
|
| 294 |
+
# Now, rows are genes, columns are TCGA sample barcodes
|
| 295 |
+
# Make sure values are numeric where possible
|
| 296 |
+
gene_expr = gene_expr.apply(pd.to_numeric, errors='coerce')
|
| 297 |
+
|
| 298 |
+
# Normalize gene symbols and aggregate duplicates
|
| 299 |
+
gene_expr_norm = normalize_gene_symbols_in_index(gene_expr)
|
| 300 |
+
|
| 301 |
+
# Save normalized gene expression (genes x samples)
|
| 302 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 303 |
+
gene_expr_norm.to_csv(out_gene_data_file)
|
| 304 |
+
|
| 305 |
+
# 3) Link clinical and gene data on sample IDs
|
| 306 |
+
common_samples = selected_clinical_df.index.intersection(gene_expr_norm.columns)
|
| 307 |
+
linked_data = pd.concat(
|
| 308 |
+
[
|
| 309 |
+
selected_clinical_df.loc[common_samples],
|
| 310 |
+
gene_expr_norm.T.loc[common_samples]
|
| 311 |
+
],
|
| 312 |
+
axis=1
|
| 313 |
+
)
|
| 314 |
+
|
| 315 |
+
# 4) Handle missing values systematically
|
| 316 |
+
processed_df = handle_missing_values(linked_data, trait_col=trait)
|
| 317 |
+
|
| 318 |
+
# 5) Determine bias and remove biased demographic features if needed
|
| 319 |
+
trait_biased, processed_df = judge_and_remove_biased_features(processed_df, trait)
|
| 320 |
+
trait_biased = bool(trait_biased) # ensure native bool
|
| 321 |
+
|
| 322 |
+
# 6) Final validation and save cohort info
|
| 323 |
+
is_gene_available = bool((gene_expr_norm.shape[0] > 0) and (gene_expr_norm.shape[1] > 0))
|
| 324 |
+
is_trait_available = bool((trait in selected_clinical_df.columns) and bool(selected_clinical_df[trait].notna().any()))
|
| 325 |
+
|
| 326 |
+
note = (
|
| 327 |
+
"INFO: Cohort selected is TCGA ESCA. Trait encoded as tumor(1)/normal(0) via TCGA sample type. "
|
| 328 |
+
f"Age source: {age_col if age_col else 'None'}, Gender source: {gender_col if gender_col else 'None'}. "
|
| 329 |
+
"Gene symbols normalized using NCBI synonyms; duplicates aggregated by mean."
|
| 330 |
+
)
|
| 331 |
+
|
| 332 |
+
is_usable = validate_and_save_cohort_info(
|
| 333 |
+
is_final=True,
|
| 334 |
+
cohort="TCGA",
|
| 335 |
+
info_path=json_path,
|
| 336 |
+
is_gene_available=is_gene_available,
|
| 337 |
+
is_trait_available=is_trait_available,
|
| 338 |
+
is_biased=trait_biased,
|
| 339 |
+
df=processed_df,
|
| 340 |
+
note=note
|
| 341 |
+
)
|
| 342 |
+
|
| 343 |
+
# 7) Save linked data only if usable
|
| 344 |
+
if is_usable:
|
| 345 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 346 |
+
processed_df.to_csv(out_data_file)
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/cohort_info.json
CHANGED
|
@@ -1,42 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"GSE77563": {
|
| 3 |
-
"is_usable": true,
|
| 4 |
-
"is_gene_available": true,
|
| 5 |
-
"is_trait_available": true,
|
| 6 |
-
"is_available": true,
|
| 7 |
-
"is_biased": false,
|
| 8 |
-
"has_age": true,
|
| 9 |
-
"has_gender": true,
|
| 10 |
-
"sample_size": 40
|
| 11 |
-
},
|
| 12 |
-
"GSE68698": {
|
| 13 |
-
"is_usable": true,
|
| 14 |
-
"is_gene_available": true,
|
| 15 |
-
"is_trait_available": true,
|
| 16 |
-
"is_available": true,
|
| 17 |
-
"is_biased": false,
|
| 18 |
-
"has_age": false,
|
| 19 |
-
"has_gender": false,
|
| 20 |
-
"sample_size": 46
|
| 21 |
-
},
|
| 22 |
-
"GSE43580": {
|
| 23 |
-
"is_usable": false,
|
| 24 |
-
"is_gene_available": true,
|
| 25 |
-
"is_trait_available": true,
|
| 26 |
-
"is_available": true,
|
| 27 |
-
"is_biased": true,
|
| 28 |
-
"has_age": false,
|
| 29 |
-
"has_gender": false,
|
| 30 |
-
"sample_size": 150
|
| 31 |
-
},
|
| 32 |
-
"TCGA": {
|
| 33 |
-
"is_usable": true,
|
| 34 |
-
"is_gene_available": true,
|
| 35 |
-
"is_trait_available": true,
|
| 36 |
-
"is_available": true,
|
| 37 |
-
"is_biased": false,
|
| 38 |
-
"has_age": true,
|
| 39 |
-
"has_gender": true,
|
| 40 |
-
"sample_size": 450
|
| 41 |
-
}
|
| 42 |
-
}
|
|
|
|
| 1 |
+
{"GSE77563": {"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": 40, "note": "INFO: Affymetrix probe IDs mapped to gene symbols; symbols normalized via NCBI synonym list."}, "GSE68698": {"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}, "GSE43580": {"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": 149, "note": "INFO: Dataset is a lung cancer cohort; GERD appears as a comorbidity in a small subset. Trait may be imbalanced after filtering/imputation."}, "GSE28302": {"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}, "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": 196, "note": "INFO: Cohort selected is TCGA ESCA. Trait encoded as tumor(1)/normal(0) via TCGA sample type. Age source: age_at_initial_pathologic_diagnosis, Gender source: gender. Gene symbols normalized using NCBI synonyms; duplicates aggregated by mean."}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Gastroesophageal_reflux_disease_(GERD)/gene_data/GSE28302.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
output/preprocess/Gaucher_Disease/clinical_data/GSE124283.csv
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
0.0,,,,,,,1.0,1.0,,,,,,,,,,,,,,,,,,,,,
|
| 3 |
-
1.0,0.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
|
|
| 1 |
+
,GSM3526881,GSM3526882,GSM3526883,GSM3526884,GSM3526885,GSM3526886,GSM3526887,GSM3526888,GSM3526889,GSM3526890,GSM3526891,GSM3526892,GSM3526893,GSM3526894,GSM3526895,GSM3526896,GSM3526897,GSM3526898,GSM3526899,GSM3526900,GSM3526901,GSM3526902,GSM3526903,GSM3526904,GSM3526905,GSM3526906,GSM3526907,GSM3526908,GSM3526909,GSM3526910,GSM3526911,GSM3526912,GSM3526913,GSM3526914,GSM3526915,GSM3526916,GSM3526917,GSM3526918,GSM3526919,GSM3526920,GSM3526921,GSM3526922,GSM3526923,GSM3526924,GSM3526925,GSM3526926,GSM3526927,GSM3526928,GSM3526929,GSM3526930,GSM3526931,GSM3526932,GSM3526933,GSM3526934,GSM3526935,GSM3526936,GSM3526937,GSM3526938,GSM3526939,GSM3526940,GSM3526941,GSM3526942,GSM3526943,GSM3526944,GSM3526945,GSM3526946,GSM3526947,GSM3526948,GSM3526949,GSM3526950,GSM3526951,GSM3526952,GSM3526953,GSM3526954,GSM3526955,GSM3526956,GSM3526957,GSM3526958,GSM3526959,GSM3526960,GSM3526961,GSM3526962,GSM3526963,GSM3526964,GSM3526965,GSM3526966,GSM3526967,GSM3526968,GSM3526969,GSM3526970,GSM3526971,GSM3526972,GSM3526973,GSM3526974,GSM3526975,GSM3526976,GSM3526977,GSM3526978,GSM3526979,GSM3526980,GSM3526981,GSM3526982,GSM3526983,GSM3526984,GSM3526985,GSM3526986,GSM3526987,GSM3526988,GSM3526989,GSM3526990,GSM3526991,GSM3526992,GSM3526993,GSM3526994,GSM3526995,GSM3526996,GSM3526997,GSM3526998,GSM3526999,GSM3527000,GSM3527001,GSM3527002,GSM3527003,GSM3527004,GSM3527005,GSM3527006,GSM3527007,GSM3527008,GSM3527009,GSM3527010,GSM3527011,GSM3527012,GSM3527013,GSM3527014,GSM3527015,GSM3527016,GSM3527017,GSM3527018,GSM3527019,GSM3527020,GSM3527021,GSM3527022,GSM3527023,GSM3527024
|
| 2 |
+
Gaucher_Disease,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,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,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,0.0,0.0,0.0,0.0,0.0,0.0
|
| 3 |
+
Gender,1.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,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.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,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,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,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,,0.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0,1.0
|
output/preprocess/Gaucher_Disease/code/GSE124283.py
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Gaucher_Disease"
|
| 6 |
+
cohort = "GSE124283"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Gaucher_Disease"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Gaucher_Disease/GSE124283"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Gaucher_Disease/GSE124283.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Gaucher_Disease/gene_data/GSE124283.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Gaucher_Disease/clinical_data/GSE124283.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Gaucher_Disease/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
import os
|
| 40 |
+
import re
|
| 41 |
+
import pandas as pd
|
| 42 |
+
|
| 43 |
+
# 1) Gene expression availability
|
| 44 |
+
is_gene_available = True # Illumina whole-genome microarray on fibroblasts -> gene expression data is available
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability
|
| 47 |
+
trait_row = 2 # 'condition' contains Gaucher vs others
|
| 48 |
+
age_row = None # No age field present in the characteristics
|
| 49 |
+
gender_row = 3 # 'gender' field
|
| 50 |
+
|
| 51 |
+
# 2.2) Converters
|
| 52 |
+
def _extract_value(x):
|
| 53 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 54 |
+
return None
|
| 55 |
+
s = str(x)
|
| 56 |
+
if ':' in s:
|
| 57 |
+
s = s.split(':', 1)[1]
|
| 58 |
+
return s.strip()
|
| 59 |
+
|
| 60 |
+
def convert_trait(x):
|
| 61 |
+
val = _extract_value(x)
|
| 62 |
+
if val is None:
|
| 63 |
+
return None
|
| 64 |
+
v = val.lower()
|
| 65 |
+
if 'gaucher' in v:
|
| 66 |
+
return 1
|
| 67 |
+
if v in {'n/a', 'na', ''}:
|
| 68 |
+
return None
|
| 69 |
+
# All other specified conditions here are non-Gaucher (e.g., Control, NPC variants)
|
| 70 |
+
return 0
|
| 71 |
+
|
| 72 |
+
def convert_age(x):
|
| 73 |
+
val = _extract_value(x)
|
| 74 |
+
if val is None or val.lower() in {'n/a', 'na', ''}:
|
| 75 |
+
return None
|
| 76 |
+
# Extract the first number that looks like age
|
| 77 |
+
m = re.search(r'[-+]?\d*\.?\d+', val)
|
| 78 |
+
if not m:
|
| 79 |
+
return None
|
| 80 |
+
try:
|
| 81 |
+
age = float(m.group())
|
| 82 |
+
if 0 <= age <= 120:
|
| 83 |
+
return age
|
| 84 |
+
return None
|
| 85 |
+
except Exception:
|
| 86 |
+
return None
|
| 87 |
+
|
| 88 |
+
def convert_gender(x):
|
| 89 |
+
val = _extract_value(x)
|
| 90 |
+
if val is None:
|
| 91 |
+
return None
|
| 92 |
+
v = val.strip().lower()
|
| 93 |
+
# Map female to 0, male to 1. 'K' (Polish 'kobieta') -> female.
|
| 94 |
+
if v in {'female', 'f', 'kobieta', 'k'}:
|
| 95 |
+
return 0
|
| 96 |
+
if v in {'male', 'm', 'mężczyzna', 'mezczyzna'}:
|
| 97 |
+
return 1
|
| 98 |
+
if v in {'n/a', 'na', '', 'unknown'}:
|
| 99 |
+
return None
|
| 100 |
+
# Fallback heuristics
|
| 101 |
+
if v.startswith('f'):
|
| 102 |
+
return 0
|
| 103 |
+
if v.startswith('m'):
|
| 104 |
+
return 1
|
| 105 |
+
return None
|
| 106 |
+
|
| 107 |
+
# 3) Initial filtering metadata
|
| 108 |
+
is_trait_available = trait_row is not None
|
| 109 |
+
_ = validate_and_save_cohort_info(
|
| 110 |
+
is_final=False,
|
| 111 |
+
cohort=cohort,
|
| 112 |
+
info_path=json_path,
|
| 113 |
+
is_gene_available=is_gene_available,
|
| 114 |
+
is_trait_available=is_trait_available
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
# 4) Clinical feature extraction and save
|
| 118 |
+
if trait_row is not None:
|
| 119 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 120 |
+
clinical_df=clinical_data,
|
| 121 |
+
trait=trait,
|
| 122 |
+
trait_row=trait_row,
|
| 123 |
+
convert_trait=convert_trait,
|
| 124 |
+
age_row=age_row,
|
| 125 |
+
convert_age=convert_age,
|
| 126 |
+
gender_row=gender_row,
|
| 127 |
+
convert_gender=convert_gender
|
| 128 |
+
)
|
| 129 |
+
preview = preview_df(selected_clinical_df)
|
| 130 |
+
print("Preview of selected clinical features:", preview)
|
| 131 |
+
|
| 132 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 133 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 134 |
+
|
| 135 |
+
# Step 3: Gene Data Extraction
|
| 136 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 137 |
+
gene_data = get_genetic_data(matrix_file)
|
| 138 |
+
|
| 139 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 140 |
+
print(gene_data.index[:20])
|
| 141 |
+
|
| 142 |
+
# Step 4: Gene Identifier Review
|
| 143 |
+
requires_gene_mapping = False
|
| 144 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 145 |
+
|
| 146 |
+
# Step 5: Data Normalization and Linking
|
| 147 |
+
import os
|
| 148 |
+
|
| 149 |
+
# 1. Normalize gene symbols and save
|
| 150 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 151 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 152 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 153 |
+
|
| 154 |
+
# 2. Link clinical and genetic data
|
| 155 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 156 |
+
|
| 157 |
+
# 3. Handle missing values
|
| 158 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 159 |
+
|
| 160 |
+
# 4. Bias check and remove biased demographic features
|
| 161 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 162 |
+
|
| 163 |
+
# 5. Final validation and save cohort info
|
| 164 |
+
note = (
|
| 165 |
+
f"INFO: Genes before/after normalization: {gene_data.shape[0]}/{normalized_gene_data.shape[0]}; "
|
| 166 |
+
f"Samples after filtering: {unbiased_linked_data.shape[0]}; "
|
| 167 |
+
f"Features after filtering: {unbiased_linked_data.shape[1]}."
|
| 168 |
+
)
|
| 169 |
+
is_usable = validate_and_save_cohort_info(
|
| 170 |
+
is_final=True,
|
| 171 |
+
cohort=cohort,
|
| 172 |
+
info_path=json_path,
|
| 173 |
+
is_gene_available=True,
|
| 174 |
+
is_trait_available=True,
|
| 175 |
+
is_biased=is_trait_biased,
|
| 176 |
+
df=unbiased_linked_data,
|
| 177 |
+
note=note
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
# 6. Save linked data if usable
|
| 181 |
+
if is_usable:
|
| 182 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 183 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Gaucher_Disease/code/TCGA.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Gaucher_Disease"
|
| 6 |
+
|
| 7 |
+
# Input paths
|
| 8 |
+
tcga_root_dir = "../DATA/TCGA"
|
| 9 |
+
|
| 10 |
+
# Output paths
|
| 11 |
+
out_data_file = "./output/z3/preprocess/Gaucher_Disease/TCGA.csv"
|
| 12 |
+
out_gene_data_file = "./output/z3/preprocess/Gaucher_Disease/gene_data/TCGA.csv"
|
| 13 |
+
out_clinical_data_file = "./output/z3/preprocess/Gaucher_Disease/clinical_data/TCGA.csv"
|
| 14 |
+
json_path = "./output/z3/preprocess/Gaucher_Disease/cohort_info.json"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Step 1: Initial Data Loading
|
| 18 |
+
import os
|
| 19 |
+
import pandas as pd
|
| 20 |
+
|
| 21 |
+
# Step 1: Identify the most relevant TCGA cohort for Gaucher disease (likely none)
|
| 22 |
+
subdirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
| 23 |
+
|
| 24 |
+
# Synonyms/related terms for Gaucher disease; conservative to avoid false matches
|
| 25 |
+
synonyms = [
|
| 26 |
+
"gaucher", "lysosomal", "sphingolipid", "glucocerebrosid", "gba", "glucosylceramide", "acid beta-glucosidase"
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
def score_dir(name: str, keys):
|
| 30 |
+
lname = name.lower()
|
| 31 |
+
return sum(1 for k in keys if k in lname)
|
| 32 |
+
|
| 33 |
+
scored = [(d, score_dir(d, synonyms)) for d in subdirs]
|
| 34 |
+
scored.sort(key=lambda x: x[1], reverse=True)
|
| 35 |
+
|
| 36 |
+
selected_tcga_subdir = None
|
| 37 |
+
if scored and scored[0][1] > 0:
|
| 38 |
+
selected_tcga_subdir = scored[0][0]
|
| 39 |
+
|
| 40 |
+
clinical_df = None
|
| 41 |
+
genetic_df = None
|
| 42 |
+
|
| 43 |
+
if selected_tcga_subdir is None:
|
| 44 |
+
print(f"No suitable TCGA cohort found for trait '{trait}'. Skipping this trait.")
|
| 45 |
+
# Record metadata as not available and mark completed
|
| 46 |
+
_ = validate_and_save_cohort_info(
|
| 47 |
+
is_final=False,
|
| 48 |
+
cohort="TCGA",
|
| 49 |
+
info_path=json_path,
|
| 50 |
+
is_gene_available=False,
|
| 51 |
+
is_trait_available=False
|
| 52 |
+
)
|
| 53 |
+
else:
|
| 54 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_tcga_subdir)
|
| 55 |
+
clinical_path, genetic_path = tcga_get_relevant_filepaths(cohort_dir)
|
| 56 |
+
|
| 57 |
+
def read_any(path):
|
| 58 |
+
compression = 'gzip' if path.endswith('.gz') else None
|
| 59 |
+
return pd.read_csv(path, sep='\t', index_col=0, low_memory=False, compression=compression)
|
| 60 |
+
|
| 61 |
+
clinical_df = read_any(clinical_path)
|
| 62 |
+
genetic_df = read_any(genetic_path)
|
| 63 |
+
|
| 64 |
+
print("Clinical data columns:")
|
| 65 |
+
print(clinical_df.columns.tolist())
|
output/preprocess/Gaucher_Disease/cohort_info.json
CHANGED
|
@@ -1,22 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"GSE124283": {
|
| 3 |
-
"is_usable": false,
|
| 4 |
-
"is_gene_available": false,
|
| 5 |
-
"is_trait_available": false,
|
| 6 |
-
"is_available": false,
|
| 7 |
-
"is_biased": null,
|
| 8 |
-
"has_age": null,
|
| 9 |
-
"has_gender": null,
|
| 10 |
-
"sample_size": null
|
| 11 |
-
},
|
| 12 |
-
"TCGA": {
|
| 13 |
-
"is_usable": true,
|
| 14 |
-
"is_gene_available": true,
|
| 15 |
-
"is_trait_available": true,
|
| 16 |
-
"is_available": true,
|
| 17 |
-
"is_biased": false,
|
| 18 |
-
"has_age": true,
|
| 19 |
-
"has_gender": true,
|
| 20 |
-
"sample_size": 423
|
| 21 |
-
}
|
| 22 |
-
}
|
|
|
|
| 1 |
+
{"GSE124283": {"is_usable": true, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": false, "has_age": false, "has_gender": true, "sample_size": 143, "note": "INFO: Genes before/after normalization: 31424/20747; Samples after filtering: 143; Features after filtering: 20749."}, "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}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Generalized_Anxiety_Disorder/clinical_data/GSE61672.csv
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
,GSM1510561,GSM1510562,GSM1510563,GSM1510564,GSM1510565,GSM1510566,GSM1510567,GSM1510568,GSM1510569,GSM1510570,GSM1510571,GSM1510572,GSM1510573,GSM1510574,GSM1510575,GSM1510576,GSM1510577,GSM1510578,GSM1510579,GSM1510580,GSM1510581,GSM1510582,GSM1510583,GSM1510584,GSM1510585,GSM1510586,GSM1510587,GSM1510588,GSM1510589,GSM1510590,GSM1510591,GSM1510592,GSM1510593,GSM1510594,GSM1510595,GSM1510596,GSM1510597,GSM1510598,GSM1510599,GSM1510600,GSM1510601,GSM1510602,GSM1510603,GSM1510604,GSM1510605,GSM1510606,GSM1510607,GSM1510608,GSM1510609,GSM1510610,GSM1510611,GSM1510612,GSM1510613,GSM1510614,GSM1510615,GSM1510616,GSM1510617,GSM1510618,GSM1510619,GSM1510620,GSM1510621,GSM1510622,GSM1510623,GSM1510624,GSM1510625,GSM1510626,GSM1510627,GSM1510628,GSM1510629,GSM1510630,GSM1510631,GSM1510632,GSM1510633,GSM1510634,GSM1510635,GSM1510636,GSM1510637,GSM1510638,GSM1510639,GSM1510640,GSM1510641,GSM1510642,GSM1510643,GSM1510644,GSM1510645,GSM1510646,GSM1510647,GSM1510648,GSM1510649,GSM1510650,GSM1510651,GSM1510652,GSM1510653,GSM1510654,GSM1510655,GSM1510656,GSM1510657,GSM1510658,GSM1510659,GSM1510660,GSM1510661,GSM1510662,GSM1510663,GSM1510664,GSM1510665,GSM1510666,GSM1510667,GSM1510668,GSM1510669,GSM1510670,GSM1510671,GSM1510672,GSM1510673,GSM1510674,GSM1510675,GSM1510676,GSM1510677,GSM1510678,GSM1510679,GSM1510680,GSM1510681,GSM1510682,GSM1510683,GSM1510684,GSM1510685,GSM1510686,GSM1510687,GSM1510688,GSM1510689,GSM1510690,GSM1510691,GSM1510692,GSM1510693,GSM1510694,GSM1510695,GSM1510696,GSM1510697,GSM1510698,GSM1510699,GSM1510700,GSM1510701,GSM1510702,GSM1510703,GSM1510704,GSM1510705,GSM1510706,GSM1510707,GSM1510708,GSM1510709,GSM1510710,GSM1510711,GSM1510712,GSM1510713,GSM1510714,GSM1510715,GSM1510716,GSM1510717,GSM1510718,GSM1510719,GSM1510720,GSM1510721,GSM1510722,GSM1510723,GSM1510724,GSM1510725,GSM1510726,GSM1510727,GSM1510728,GSM1510729,GSM1510730,GSM1510731,GSM1510732,GSM1510733,GSM1510734,GSM1510735,GSM1510736,GSM1510737,GSM1510738,GSM1510739,GSM1510740,GSM1510741,GSM1510742,GSM1510743,GSM1510744,GSM1510745,GSM1510746,GSM1510747,GSM1510748,GSM1510749,GSM1510750,GSM1510751,GSM1510752,GSM1510753,GSM1510754,GSM1510755,GSM1510756,GSM1510757,GSM1510758,GSM1510759,GSM1510760,GSM1510761,GSM1510762,GSM1510763,GSM1510764,GSM1510765,GSM1510766,GSM1510767,GSM1510768,GSM1510769,GSM1510770,GSM1510771,GSM1510772,GSM1510773,GSM1510774,GSM1510775,GSM1510776,GSM1510777,GSM1510778,GSM1510779,GSM1510780,GSM1510781,GSM1510782,GSM1510783,GSM1510784,GSM1510785,GSM1510786,GSM1510787,GSM1510788,GSM1510789,GSM1510790,GSM1510791,GSM1510792,GSM1510793,GSM1510794,GSM1510795,GSM1510796,GSM1510797,GSM1510798,GSM1510799,GSM1510800,GSM1510801,GSM1510802,GSM1510803,GSM1510804,GSM1510805,GSM1510806,GSM1510807,GSM1510808,GSM1510809,GSM1510810,GSM1510811,GSM1510812,GSM1510813,GSM1510814,GSM1510815,GSM1510816,GSM1510817,GSM1510818,GSM1510819,GSM1510820,GSM1510821,GSM1510822,GSM1510823,GSM1510824,GSM1510825,GSM1510826,GSM1510827,GSM1510828,GSM1510829,GSM1510830,GSM1510831,GSM1510832,GSM1510833,GSM1510834,GSM1510835,GSM1510836,GSM1510837,GSM1510838,GSM1510839,GSM1510840,GSM1510841,GSM1510842,GSM1510843,GSM1510844,GSM1510845,GSM1510846,GSM1510847,GSM1510848,GSM1510849,GSM1510850,GSM1510851,GSM1510852,GSM1510853,GSM1510854,GSM1510855,GSM1510856,GSM1510857,GSM1510858,GSM1510859,GSM1510860,GSM1510861,GSM1510862,GSM1510863,GSM1510864,GSM1510865,GSM1510866,GSM1510867,GSM1510868,GSM1510869,GSM1510870,GSM1510871,GSM1510872,GSM1510873,GSM1510874,GSM1510875,GSM1510876,GSM1510877,GSM1510878,GSM1510879,GSM1510880,GSM1510881,GSM1510882,GSM1510883,GSM1510884,GSM1510885,GSM1510886,GSM1510887,GSM1510888,GSM1510889,GSM1510890,GSM1510891,GSM1510892,GSM1510893,GSM1510894,GSM1510895,GSM1510896,GSM1510897,GSM1510898,GSM1510899,GSM1510900,GSM1510901,GSM1510902,GSM1510903,GSM1510904,GSM1510905,GSM1510906,GSM1510907,GSM1510908,GSM1510909,GSM1510910,GSM1510911,GSM1510912,GSM1510913,GSM1510914,GSM1510915,GSM1510916,GSM1510917,GSM1510918,GSM1510919,GSM1510920,GSM1510921,GSM1510922,GSM1510923,GSM1510924,GSM1510925,GSM1510926,GSM1510927,GSM1510928,GSM1510929,GSM1510930,GSM1510931,GSM1510932,GSM1510933,GSM1510934,GSM1510935,GSM1510936,GSM1510937,GSM1510938,GSM1510939,GSM1510940,GSM1510941,GSM1510942,GSM1510943,GSM1510944,GSM1510945,GSM1510946,GSM1510947,GSM1510948,GSM1510949,GSM1510950,GSM1510951,GSM1510952,GSM1510953,GSM1510954,GSM1510955,GSM1510956,GSM1510957,GSM1510958,GSM1510959,GSM1510960,GSM1510961,GSM1510962,GSM1510963,GSM1510964,GSM1510965,GSM1510966,GSM1510967,GSM1510968,GSM1510969,GSM1510970,GSM1510971,GSM1510972,GSM1510973,GSM1510974,GSM1510975,GSM1510976,GSM1510977,GSM1510978,GSM1510979,GSM1510980,GSM1510981,GSM1510982,GSM1510983,GSM1510984,GSM1510985,GSM1510986,GSM1510987,GSM1510988,GSM1510989,GSM1510990,GSM1510991,GSM1510992,GSM1510993,GSM1510994,GSM1510995,GSM1510996,GSM1510997,GSM1510998,GSM1510999,GSM1511000,GSM1511001,GSM1511002,GSM1511003,GSM1511004,GSM1511005,GSM1511006,GSM1511007,GSM1511008,GSM1511009,GSM1511010,GSM1511011,GSM1511012,GSM1511013,GSM1511014,GSM1511015,GSM1511016,GSM1511017,GSM1511018,GSM1511019,GSM1511020,GSM1511021,GSM1511022,GSM1511023,GSM1511024,GSM1511025,GSM1511026,GSM1511027,GSM1511028,GSM1511029,GSM1511030,GSM1511031,GSM1511032,GSM1511033,GSM1511034,GSM1511035,GSM1511036,GSM1511037,GSM1511038,GSM1511039,GSM1511040,GSM1511041,GSM1511042,GSM1511043,GSM1511044,GSM1511045,GSM1511046,GSM1511047,GSM1511048,GSM1511049,GSM1511050,GSM1511051,GSM1511052,GSM1511053,GSM1511054,GSM1511055,GSM1511056,GSM1511057,GSM1511058,GSM1511059,GSM1511060,GSM1511061,GSM1511062,GSM1511063,GSM1511064,GSM1511065,GSM1511066,GSM1511067,GSM1511068,GSM1511069,GSM1511070,GSM1511071,GSM1511072,GSM1511073,GSM1511074,GSM1511075,GSM1511076,GSM1511077,GSM1511078,GSM1511079,GSM1511080,GSM1511081,GSM1511082,GSM1511083,GSM1511084,GSM1511085,GSM1511086,GSM1511087,GSM1511088,GSM1511089,GSM1511090,GSM1511091,GSM1511092,GSM1511093,GSM1511094,GSM1511095,GSM1511096,GSM1511097,GSM1511098,GSM1511099,GSM1511100,GSM1511101,GSM1511102,GSM1511103,GSM1511104,GSM1511105,GSM1511106
|
| 2 |
-
Generalized_Anxiety_Disorder,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1.0,0.0,0.0,,,,1.0,0.0,0.0,1.0,1.0,,1.0,0.0,,1.0,,0.0,1.0,0.0,0.0,0.0,0.0,1.0,,,1.0,,,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,,1.0,0.0,1.0,,,,,1.0,1.0,0.0,1.0,0.0,0.0,0.0,,0.0,,,,,,1.0,0.0,1.0,1.0,0.0,,,0.0,0.0,1.0,,,0.0,1.0,1.0,,0.0,0.0,0.0,,1.0,0.0,0.0,0.0,,0.0,1.0,1.0,,0.0,0.0,1.0,,,,1.0,0.0,0.0,,0.0,0.0,,0.0,1.0,0.0,,,1.0,0.0,1.0,,1.0,,0.0,,,1.0,1.0,0.0,,0.0,1.0,0.0,1.0,,,0.0,1.0,0.0,0.0,,,1.0,0.0,0.0,0.0,1.0,0.0,1.0,,,,0.0,1.0,,0.0,0.0,1.0,0.0,0.0,,0.0,0.0,0.0,,1.0,1.0,1.0,0.0,0.0,0.0,,,0.0,,,1.0,,,0.0,,1.0,0.0,1.0,,,0.0,0.0,0.0,0.0,1.0,,1.0,,,0.0,0.0,,,1.0,1.0,0.0,,1.0,,1.0,1.0,1.0,,1.0
|
| 3 |
Age,44.0,59.0,44.0,39.0,64.0,58.0,45.0,37.0,40.0,39.0,57.0,52.0,59.0,57.0,62.0,62.0,55.0,55.0,53.0,47.0,48.0,49.0,35.0,58.0,46.0,54.0,67.0,47.0,51.0,34.0,58.0,58.0,57.0,64.0,55.0,60.0,62.0,41.0,53.0,47.0,44.0,53.0,38.0,54.0,37.0,44.0,73.0,28.0,56.0,34.0,71.0,41.0,51.0,47.0,35.0,45.0,55.0,50.0,50.0,55.0,38.0,57.0,57.0,57.0,48.0,52.0,51.0,42.0,51.0,51.0,65.0,31.0,44.0,50.0,58.0,64.0,49.0,52.0,46.0,53.0,45.0,32.0,50.0,63.0,52.0,54.0,28.0,55.0,59.0,56.0,39.0,46.0,60.0,61.0,45.0,44.0,41.0,56.0,53.0,50.0,56.0,78.0,62.0,47.0,40.0,63.0,55.0,55.0,53.0,34.0,48.0,46.0,58.0,52.0,47.0,62.0,45.0,51.0,38.0,38.0,51.0,59.0,56.0,39.0,29.0,58.0,57.0,45.0,33.0,46.0,35.0,57.0,55.0,66.0,51.0,59.0,61.0,56.0,65.0,37.0,65.0,45.0,45.0,74.0,50.0,39.0,26.0,44.0,49.0,52.0,47.0,37.0,40.0,39.0,40.0,31.0,48.0,59.0,39.0,37.0,59.0,54.0,49.0,57.0,50.0,55.0,50.0,68.0,43.0,67.0,47.0,45.0,56.0,62.0,48.0,39.0,39.0,41.0,63.0,51.0,48.0,50.0,61.0,35.0,50.0,52.0,44.0,45.0,33.0,61.0,58.0,38.0,36.0,50.0,45.0,60.0,55.0,53.0,52.0,47.0,43.0,41.0,47.0,59.0,54.0,52.0,64.0,41.0,46.0,38.0,48.0,43.0,63.0,53.0,60.0,58.0,53.0,52.0,25.0,60.0,27.0,56.0,47.0,40.0,35.0,50.0,56.0,35.0,18.0,52.0,41.0,45.0,54.0,64.0,35.0,48.0,57.0,73.0,46.0,52.0,34.0,19.0,56.0,54.0,46.0,54.0,44.0,19.0,61.0,29.0,48.0,34.0,50.0,39.0,62.0,25.0,18.0,60.0,51.0,58.0,61.0,33.0,50.0,52.0,52.0,59.0,54.0,31.0,60.0,43.0,28.0,34.0,46.0,51.0,43.0,53.0,51.0,48.0,43.0,69.0,48.0,53.0,58.0,57.0,54.0,47.0,60.0,56.0,45.0,35.0,44.0,53.0,43.0,50.0,53.0,69.0,35.0,45.0,57.0,50.0,36.0,33.0,42.0,68.0,57.0,32.0,47.0,54.0,54.0,54.0,41.0,59.0,66.0,29.0,60.0,41.0,53.0,49.0,56.0,59.0,50.0,60.0,53.0,44.0,41.0,56.0,52.0,38.0,47.0,32.0,44.0,39.0,60.0,54.0,50.0,31.0,43.0,58.0,47.0,52.0,44.0,53.0,55.0,38.0,47.0,58.0,30.0,51.0,48.0,54.0,63.0,34.0,36.0,55.0,60.0,53.0,52.0,51.0,36.0,53.0,51.0,55.0,50.0,40.0,43.0,42.0,64.0,71.0,30.0,39.0,60.0,39.0,49.0,56.0,46.0,55.0,34.0,64.0,26.0,59.0,46.0,50.0,20.0,53.0,47.0,46.0,37.0,18.0,37.0,47.0,55.0,41.0,56.0,48.0,51.0,54.0,59.0,53.0,41.0,42.0,42.0,35.0,58.0,41.0,58.0,32.0,31.0,60.0,36.0,78.0,22.0,42.0,35.0,51.0,54.0,39.0,40.0,18.0,47.0,49.0,34.0,49.0,46.0,58.0,44.0,36.0,62.0,59.0,58.0,44.0,52.0,36.0,46.0,51.0,37.0,55.0,63.0,44.0,36.0,51.0,40.0,62.0,41.0,42.0,49.0,63.0,73.0,43.0,49.0,53.0,44.0,30.0,61.0,41.0,41.0,57.0,30.0,50.0,41.0,49.0,37.0,54.0,41.0,37.0,44.0,58.0,39.0,54.0,57.0,36.0,37.0,56.0,37.0,59.0,41.0,48.0,41.0,35.0,52.0,54.0,47.0,57.0,48.0,67.0,55.0,55.0,36.0,55.0,35.0,56.0,48.0,50.0,43.0,59.0,35.0,82.0,51.0,34.0,48.0,58.0,58.0,52.0,59.0,26.0,42.0,55.0,58.0,46.0,44.0,55.0,48.0,50.0,49.0,57.0,30.0,43.0,62.0,42.0,36.0,48.0,38.0,50.0,29.0,53.0,53.0,40.0,36.0,57.0,44.0,41.0,59.0,28.0,35.0,53.0,56.0,44.0,58.0,58.0,57.0,56.0,54.0,59.0,57.0,56.0,56.0,37.0
|
| 4 |
Gender,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
|
|
| 1 |
,GSM1510561,GSM1510562,GSM1510563,GSM1510564,GSM1510565,GSM1510566,GSM1510567,GSM1510568,GSM1510569,GSM1510570,GSM1510571,GSM1510572,GSM1510573,GSM1510574,GSM1510575,GSM1510576,GSM1510577,GSM1510578,GSM1510579,GSM1510580,GSM1510581,GSM1510582,GSM1510583,GSM1510584,GSM1510585,GSM1510586,GSM1510587,GSM1510588,GSM1510589,GSM1510590,GSM1510591,GSM1510592,GSM1510593,GSM1510594,GSM1510595,GSM1510596,GSM1510597,GSM1510598,GSM1510599,GSM1510600,GSM1510601,GSM1510602,GSM1510603,GSM1510604,GSM1510605,GSM1510606,GSM1510607,GSM1510608,GSM1510609,GSM1510610,GSM1510611,GSM1510612,GSM1510613,GSM1510614,GSM1510615,GSM1510616,GSM1510617,GSM1510618,GSM1510619,GSM1510620,GSM1510621,GSM1510622,GSM1510623,GSM1510624,GSM1510625,GSM1510626,GSM1510627,GSM1510628,GSM1510629,GSM1510630,GSM1510631,GSM1510632,GSM1510633,GSM1510634,GSM1510635,GSM1510636,GSM1510637,GSM1510638,GSM1510639,GSM1510640,GSM1510641,GSM1510642,GSM1510643,GSM1510644,GSM1510645,GSM1510646,GSM1510647,GSM1510648,GSM1510649,GSM1510650,GSM1510651,GSM1510652,GSM1510653,GSM1510654,GSM1510655,GSM1510656,GSM1510657,GSM1510658,GSM1510659,GSM1510660,GSM1510661,GSM1510662,GSM1510663,GSM1510664,GSM1510665,GSM1510666,GSM1510667,GSM1510668,GSM1510669,GSM1510670,GSM1510671,GSM1510672,GSM1510673,GSM1510674,GSM1510675,GSM1510676,GSM1510677,GSM1510678,GSM1510679,GSM1510680,GSM1510681,GSM1510682,GSM1510683,GSM1510684,GSM1510685,GSM1510686,GSM1510687,GSM1510688,GSM1510689,GSM1510690,GSM1510691,GSM1510692,GSM1510693,GSM1510694,GSM1510695,GSM1510696,GSM1510697,GSM1510698,GSM1510699,GSM1510700,GSM1510701,GSM1510702,GSM1510703,GSM1510704,GSM1510705,GSM1510706,GSM1510707,GSM1510708,GSM1510709,GSM1510710,GSM1510711,GSM1510712,GSM1510713,GSM1510714,GSM1510715,GSM1510716,GSM1510717,GSM1510718,GSM1510719,GSM1510720,GSM1510721,GSM1510722,GSM1510723,GSM1510724,GSM1510725,GSM1510726,GSM1510727,GSM1510728,GSM1510729,GSM1510730,GSM1510731,GSM1510732,GSM1510733,GSM1510734,GSM1510735,GSM1510736,GSM1510737,GSM1510738,GSM1510739,GSM1510740,GSM1510741,GSM1510742,GSM1510743,GSM1510744,GSM1510745,GSM1510746,GSM1510747,GSM1510748,GSM1510749,GSM1510750,GSM1510751,GSM1510752,GSM1510753,GSM1510754,GSM1510755,GSM1510756,GSM1510757,GSM1510758,GSM1510759,GSM1510760,GSM1510761,GSM1510762,GSM1510763,GSM1510764,GSM1510765,GSM1510766,GSM1510767,GSM1510768,GSM1510769,GSM1510770,GSM1510771,GSM1510772,GSM1510773,GSM1510774,GSM1510775,GSM1510776,GSM1510777,GSM1510778,GSM1510779,GSM1510780,GSM1510781,GSM1510782,GSM1510783,GSM1510784,GSM1510785,GSM1510786,GSM1510787,GSM1510788,GSM1510789,GSM1510790,GSM1510791,GSM1510792,GSM1510793,GSM1510794,GSM1510795,GSM1510796,GSM1510797,GSM1510798,GSM1510799,GSM1510800,GSM1510801,GSM1510802,GSM1510803,GSM1510804,GSM1510805,GSM1510806,GSM1510807,GSM1510808,GSM1510809,GSM1510810,GSM1510811,GSM1510812,GSM1510813,GSM1510814,GSM1510815,GSM1510816,GSM1510817,GSM1510818,GSM1510819,GSM1510820,GSM1510821,GSM1510822,GSM1510823,GSM1510824,GSM1510825,GSM1510826,GSM1510827,GSM1510828,GSM1510829,GSM1510830,GSM1510831,GSM1510832,GSM1510833,GSM1510834,GSM1510835,GSM1510836,GSM1510837,GSM1510838,GSM1510839,GSM1510840,GSM1510841,GSM1510842,GSM1510843,GSM1510844,GSM1510845,GSM1510846,GSM1510847,GSM1510848,GSM1510849,GSM1510850,GSM1510851,GSM1510852,GSM1510853,GSM1510854,GSM1510855,GSM1510856,GSM1510857,GSM1510858,GSM1510859,GSM1510860,GSM1510861,GSM1510862,GSM1510863,GSM1510864,GSM1510865,GSM1510866,GSM1510867,GSM1510868,GSM1510869,GSM1510870,GSM1510871,GSM1510872,GSM1510873,GSM1510874,GSM1510875,GSM1510876,GSM1510877,GSM1510878,GSM1510879,GSM1510880,GSM1510881,GSM1510882,GSM1510883,GSM1510884,GSM1510885,GSM1510886,GSM1510887,GSM1510888,GSM1510889,GSM1510890,GSM1510891,GSM1510892,GSM1510893,GSM1510894,GSM1510895,GSM1510896,GSM1510897,GSM1510898,GSM1510899,GSM1510900,GSM1510901,GSM1510902,GSM1510903,GSM1510904,GSM1510905,GSM1510906,GSM1510907,GSM1510908,GSM1510909,GSM1510910,GSM1510911,GSM1510912,GSM1510913,GSM1510914,GSM1510915,GSM1510916,GSM1510917,GSM1510918,GSM1510919,GSM1510920,GSM1510921,GSM1510922,GSM1510923,GSM1510924,GSM1510925,GSM1510926,GSM1510927,GSM1510928,GSM1510929,GSM1510930,GSM1510931,GSM1510932,GSM1510933,GSM1510934,GSM1510935,GSM1510936,GSM1510937,GSM1510938,GSM1510939,GSM1510940,GSM1510941,GSM1510942,GSM1510943,GSM1510944,GSM1510945,GSM1510946,GSM1510947,GSM1510948,GSM1510949,GSM1510950,GSM1510951,GSM1510952,GSM1510953,GSM1510954,GSM1510955,GSM1510956,GSM1510957,GSM1510958,GSM1510959,GSM1510960,GSM1510961,GSM1510962,GSM1510963,GSM1510964,GSM1510965,GSM1510966,GSM1510967,GSM1510968,GSM1510969,GSM1510970,GSM1510971,GSM1510972,GSM1510973,GSM1510974,GSM1510975,GSM1510976,GSM1510977,GSM1510978,GSM1510979,GSM1510980,GSM1510981,GSM1510982,GSM1510983,GSM1510984,GSM1510985,GSM1510986,GSM1510987,GSM1510988,GSM1510989,GSM1510990,GSM1510991,GSM1510992,GSM1510993,GSM1510994,GSM1510995,GSM1510996,GSM1510997,GSM1510998,GSM1510999,GSM1511000,GSM1511001,GSM1511002,GSM1511003,GSM1511004,GSM1511005,GSM1511006,GSM1511007,GSM1511008,GSM1511009,GSM1511010,GSM1511011,GSM1511012,GSM1511013,GSM1511014,GSM1511015,GSM1511016,GSM1511017,GSM1511018,GSM1511019,GSM1511020,GSM1511021,GSM1511022,GSM1511023,GSM1511024,GSM1511025,GSM1511026,GSM1511027,GSM1511028,GSM1511029,GSM1511030,GSM1511031,GSM1511032,GSM1511033,GSM1511034,GSM1511035,GSM1511036,GSM1511037,GSM1511038,GSM1511039,GSM1511040,GSM1511041,GSM1511042,GSM1511043,GSM1511044,GSM1511045,GSM1511046,GSM1511047,GSM1511048,GSM1511049,GSM1511050,GSM1511051,GSM1511052,GSM1511053,GSM1511054,GSM1511055,GSM1511056,GSM1511057,GSM1511058,GSM1511059,GSM1511060,GSM1511061,GSM1511062,GSM1511063,GSM1511064,GSM1511065,GSM1511066,GSM1511067,GSM1511068,GSM1511069,GSM1511070,GSM1511071,GSM1511072,GSM1511073,GSM1511074,GSM1511075,GSM1511076,GSM1511077,GSM1511078,GSM1511079,GSM1511080,GSM1511081,GSM1511082,GSM1511083,GSM1511084,GSM1511085,GSM1511086,GSM1511087,GSM1511088,GSM1511089,GSM1511090,GSM1511091,GSM1511092,GSM1511093,GSM1511094,GSM1511095,GSM1511096,GSM1511097,GSM1511098,GSM1511099,GSM1511100,GSM1511101,GSM1511102,GSM1511103,GSM1511104,GSM1511105,GSM1511106
|
| 2 |
+
Generalized_Anxiety_Disorder,0.0,0.0,0.0,0.0,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,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,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,1.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,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,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,,,,1.0,0.0,0.0,1.0,1.0,,1.0,0.0,,1.0,,0.0,1.0,0.0,0.0,0.0,0.0,1.0,,,1.0,,,0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,,0.0,0.0,,1.0,0.0,1.0,,,,,1.0,1.0,0.0,1.0,0.0,0.0,0.0,,0.0,,,,,,1.0,0.0,1.0,1.0,0.0,,,0.0,0.0,1.0,,,0.0,1.0,1.0,,0.0,0.0,0.0,,1.0,0.0,0.0,0.0,,0.0,1.0,1.0,,0.0,0.0,1.0,,,,1.0,0.0,0.0,,0.0,0.0,,0.0,1.0,0.0,,,1.0,0.0,1.0,,1.0,,0.0,,,1.0,1.0,0.0,,0.0,1.0,0.0,1.0,,,0.0,1.0,0.0,0.0,,,1.0,0.0,0.0,0.0,1.0,0.0,1.0,,,,0.0,1.0,,0.0,0.0,1.0,0.0,0.0,,0.0,0.0,0.0,,1.0,1.0,1.0,0.0,0.0,0.0,,,0.0,,,1.0,,,0.0,,1.0,0.0,1.0,,,0.0,0.0,0.0,0.0,1.0,,1.0,,,0.0,0.0,,,1.0,1.0,0.0,,1.0,,1.0,1.0,1.0,,1.0
|
| 3 |
Age,44.0,59.0,44.0,39.0,64.0,58.0,45.0,37.0,40.0,39.0,57.0,52.0,59.0,57.0,62.0,62.0,55.0,55.0,53.0,47.0,48.0,49.0,35.0,58.0,46.0,54.0,67.0,47.0,51.0,34.0,58.0,58.0,57.0,64.0,55.0,60.0,62.0,41.0,53.0,47.0,44.0,53.0,38.0,54.0,37.0,44.0,73.0,28.0,56.0,34.0,71.0,41.0,51.0,47.0,35.0,45.0,55.0,50.0,50.0,55.0,38.0,57.0,57.0,57.0,48.0,52.0,51.0,42.0,51.0,51.0,65.0,31.0,44.0,50.0,58.0,64.0,49.0,52.0,46.0,53.0,45.0,32.0,50.0,63.0,52.0,54.0,28.0,55.0,59.0,56.0,39.0,46.0,60.0,61.0,45.0,44.0,41.0,56.0,53.0,50.0,56.0,78.0,62.0,47.0,40.0,63.0,55.0,55.0,53.0,34.0,48.0,46.0,58.0,52.0,47.0,62.0,45.0,51.0,38.0,38.0,51.0,59.0,56.0,39.0,29.0,58.0,57.0,45.0,33.0,46.0,35.0,57.0,55.0,66.0,51.0,59.0,61.0,56.0,65.0,37.0,65.0,45.0,45.0,74.0,50.0,39.0,26.0,44.0,49.0,52.0,47.0,37.0,40.0,39.0,40.0,31.0,48.0,59.0,39.0,37.0,59.0,54.0,49.0,57.0,50.0,55.0,50.0,68.0,43.0,67.0,47.0,45.0,56.0,62.0,48.0,39.0,39.0,41.0,63.0,51.0,48.0,50.0,61.0,35.0,50.0,52.0,44.0,45.0,33.0,61.0,58.0,38.0,36.0,50.0,45.0,60.0,55.0,53.0,52.0,47.0,43.0,41.0,47.0,59.0,54.0,52.0,64.0,41.0,46.0,38.0,48.0,43.0,63.0,53.0,60.0,58.0,53.0,52.0,25.0,60.0,27.0,56.0,47.0,40.0,35.0,50.0,56.0,35.0,18.0,52.0,41.0,45.0,54.0,64.0,35.0,48.0,57.0,73.0,46.0,52.0,34.0,19.0,56.0,54.0,46.0,54.0,44.0,19.0,61.0,29.0,48.0,34.0,50.0,39.0,62.0,25.0,18.0,60.0,51.0,58.0,61.0,33.0,50.0,52.0,52.0,59.0,54.0,31.0,60.0,43.0,28.0,34.0,46.0,51.0,43.0,53.0,51.0,48.0,43.0,69.0,48.0,53.0,58.0,57.0,54.0,47.0,60.0,56.0,45.0,35.0,44.0,53.0,43.0,50.0,53.0,69.0,35.0,45.0,57.0,50.0,36.0,33.0,42.0,68.0,57.0,32.0,47.0,54.0,54.0,54.0,41.0,59.0,66.0,29.0,60.0,41.0,53.0,49.0,56.0,59.0,50.0,60.0,53.0,44.0,41.0,56.0,52.0,38.0,47.0,32.0,44.0,39.0,60.0,54.0,50.0,31.0,43.0,58.0,47.0,52.0,44.0,53.0,55.0,38.0,47.0,58.0,30.0,51.0,48.0,54.0,63.0,34.0,36.0,55.0,60.0,53.0,52.0,51.0,36.0,53.0,51.0,55.0,50.0,40.0,43.0,42.0,64.0,71.0,30.0,39.0,60.0,39.0,49.0,56.0,46.0,55.0,34.0,64.0,26.0,59.0,46.0,50.0,20.0,53.0,47.0,46.0,37.0,18.0,37.0,47.0,55.0,41.0,56.0,48.0,51.0,54.0,59.0,53.0,41.0,42.0,42.0,35.0,58.0,41.0,58.0,32.0,31.0,60.0,36.0,78.0,22.0,42.0,35.0,51.0,54.0,39.0,40.0,18.0,47.0,49.0,34.0,49.0,46.0,58.0,44.0,36.0,62.0,59.0,58.0,44.0,52.0,36.0,46.0,51.0,37.0,55.0,63.0,44.0,36.0,51.0,40.0,62.0,41.0,42.0,49.0,63.0,73.0,43.0,49.0,53.0,44.0,30.0,61.0,41.0,41.0,57.0,30.0,50.0,41.0,49.0,37.0,54.0,41.0,37.0,44.0,58.0,39.0,54.0,57.0,36.0,37.0,56.0,37.0,59.0,41.0,48.0,41.0,35.0,52.0,54.0,47.0,57.0,48.0,67.0,55.0,55.0,36.0,55.0,35.0,56.0,48.0,50.0,43.0,59.0,35.0,82.0,51.0,34.0,48.0,58.0,58.0,52.0,59.0,26.0,42.0,55.0,58.0,46.0,44.0,55.0,48.0,50.0,49.0,57.0,30.0,43.0,62.0,42.0,36.0,48.0,38.0,50.0,29.0,53.0,53.0,40.0,36.0,57.0,44.0,41.0,59.0,28.0,35.0,53.0,56.0,44.0,58.0,58.0,57.0,56.0,54.0,59.0,57.0,56.0,56.0,37.0
|
| 4 |
Gender,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
output/preprocess/Generalized_Anxiety_Disorder/code/GSE61672.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Generalized_Anxiety_Disorder"
|
| 6 |
+
cohort = "GSE61672"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Generalized_Anxiety_Disorder"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Generalized_Anxiety_Disorder/GSE61672"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z3/preprocess/Generalized_Anxiety_Disorder/GSE61672.csv"
|
| 14 |
+
out_gene_data_file = "./output/z3/preprocess/Generalized_Anxiety_Disorder/gene_data/GSE61672.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z3/preprocess/Generalized_Anxiety_Disorder/clinical_data/GSE61672.csv"
|
| 16 |
+
json_path = "./output/z3/preprocess/Generalized_Anxiety_Disorder/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
from tools.preprocess import *
|
| 21 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 22 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 23 |
+
|
| 24 |
+
# 2. Read the matrix file to obtain background information and sample characteristics data
|
| 25 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 26 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 27 |
+
background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)
|
| 28 |
+
|
| 29 |
+
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
|
| 30 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
|
| 31 |
+
|
| 32 |
+
# 4. Explicitly print out all the background information and the sample characteristics dictionary
|
| 33 |
+
print("Background Information:")
|
| 34 |
+
print(background_info)
|
| 35 |
+
print("Sample Characteristics Dictionary:")
|
| 36 |
+
print(sample_characteristics_dict)
|
| 37 |
+
|
| 38 |
+
# Step 2: Dataset Analysis and Clinical Feature Extraction
|
| 39 |
+
# 1) Gene expression availability
|
| 40 |
+
is_gene_available = True # Based on series title/summary: blood genome-wide gene expression
|
| 41 |
+
|
| 42 |
+
# 2) Identify rows in the Sample Characteristics Dictionary
|
| 43 |
+
trait_row = 4 # contains 'anxiety case/control: case/control' and gad7 scores
|
| 44 |
+
age_row = 0 # contains 'age: <number>'
|
| 45 |
+
gender_row = 1 # contains 'Sex: F/M'
|
| 46 |
+
|
| 47 |
+
# 2.2) Converters
|
| 48 |
+
def _after_colon(x):
|
| 49 |
+
if x is None:
|
| 50 |
+
return None
|
| 51 |
+
try:
|
| 52 |
+
parts = str(x).split(":", 1)
|
| 53 |
+
if len(parts) == 2:
|
| 54 |
+
return parts[0].strip().lower(), parts[1].strip()
|
| 55 |
+
else:
|
| 56 |
+
return "", str(x).strip()
|
| 57 |
+
except Exception:
|
| 58 |
+
return "", None
|
| 59 |
+
|
| 60 |
+
def convert_trait(x):
|
| 61 |
+
key, val = _after_colon(x)
|
| 62 |
+
if val is None or val in {"", ".", "na", "n/a", "nan", "none", "unknown"}:
|
| 63 |
+
return None
|
| 64 |
+
vlow = val.strip().lower()
|
| 65 |
+
# Prefer explicit case/control if present
|
| 66 |
+
if "anxiety case/control" in key:
|
| 67 |
+
if vlow in {"case", "cases", "gad", "anxiety", "patient"}:
|
| 68 |
+
return 1
|
| 69 |
+
if vlow in {"control", "controls", "healthy", "non-anxiety", "non anxiety", "no anxiety"}:
|
| 70 |
+
return 0
|
| 71 |
+
return None
|
| 72 |
+
# If only GAD7 score is present in this row, infer binary using a common clinical threshold (>=10 -> likely GAD)
|
| 73 |
+
if "gad7" in key:
|
| 74 |
+
try:
|
| 75 |
+
score = float(vlow)
|
| 76 |
+
return 1 if score >= 10 else 0
|
| 77 |
+
except Exception:
|
| 78 |
+
return None
|
| 79 |
+
return None
|
| 80 |
+
|
| 81 |
+
def convert_age(x):
|
| 82 |
+
key, val = _after_colon(x)
|
| 83 |
+
if val is None:
|
| 84 |
+
return None
|
| 85 |
+
if "age" in key:
|
| 86 |
+
v = val.replace("years", "").replace("year", "").strip()
|
| 87 |
+
try:
|
| 88 |
+
return float(v)
|
| 89 |
+
except Exception:
|
| 90 |
+
return None
|
| 91 |
+
return None
|
| 92 |
+
|
| 93 |
+
def convert_gender(x):
|
| 94 |
+
key, val = _after_colon(x)
|
| 95 |
+
if val is None:
|
| 96 |
+
return None
|
| 97 |
+
if "sex" in key or "gender" in key:
|
| 98 |
+
v = val.strip().lower()
|
| 99 |
+
if v in {"f", "female", "woman", "girl"}:
|
| 100 |
+
return 0
|
| 101 |
+
if v in {"m", "male", "man", "boy"}:
|
| 102 |
+
return 1
|
| 103 |
+
return None
|
| 104 |
+
return None
|
| 105 |
+
|
| 106 |
+
# 3) Save metadata (initial filtering)
|
| 107 |
+
is_trait_available = trait_row is not None
|
| 108 |
+
_ = validate_and_save_cohort_info(
|
| 109 |
+
is_final=False,
|
| 110 |
+
cohort=cohort,
|
| 111 |
+
info_path=json_path,
|
| 112 |
+
is_gene_available=is_gene_available,
|
| 113 |
+
is_trait_available=is_trait_available
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
# 4) Clinical Feature Extraction (only if clinical data available)
|
| 117 |
+
if trait_row is not None:
|
| 118 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 119 |
+
clinical_df=clinical_data,
|
| 120 |
+
trait=trait,
|
| 121 |
+
trait_row=trait_row,
|
| 122 |
+
convert_trait=convert_trait,
|
| 123 |
+
age_row=age_row,
|
| 124 |
+
convert_age=convert_age,
|
| 125 |
+
gender_row=gender_row,
|
| 126 |
+
convert_gender=convert_gender
|
| 127 |
+
)
|
| 128 |
+
preview = preview_df(selected_clinical_df, n=5)
|
| 129 |
+
print("Preview of selected clinical features:", preview)
|
| 130 |
+
# Save clinical data
|
| 131 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 132 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 133 |
+
|
| 134 |
+
# Step 3: Gene Data Extraction
|
| 135 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 136 |
+
gene_data = get_genetic_data(matrix_file)
|
| 137 |
+
|
| 138 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 139 |
+
print(gene_data.index[:20])
|
| 140 |
+
|
| 141 |
+
# Step 4: Gene Identifier Review
|
| 142 |
+
# Illumina probe IDs (e.g., ILMN_1343291) are not human gene symbols and require mapping.
|
| 143 |
+
requires_gene_mapping = True
|
| 144 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 145 |
+
|
| 146 |
+
# Step 5: Gene Annotation
|
| 147 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 148 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 149 |
+
|
| 150 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 151 |
+
print("Gene annotation preview:")
|
| 152 |
+
print(preview_df(gene_annotation))
|
| 153 |
+
|
| 154 |
+
# Step 6: Gene Identifier Mapping
|
| 155 |
+
# Identify appropriate columns for mapping
|
| 156 |
+
# Probe IDs in expression data are 'ILMN_...' and match the 'ID' column in annotation.
|
| 157 |
+
# Gene symbols are stored in the 'Symbol' column.
|
| 158 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')
|
| 159 |
+
|
| 160 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 161 |
+
probe_data = gene_data # from previous step
|
| 162 |
+
gene_data = apply_gene_mapping(expression_df=probe_data, mapping_df=mapping_df)
|
| 163 |
+
|
| 164 |
+
# Step 7: Data Normalization and Linking
|
| 165 |
+
# 1. Normalize gene symbols and save gene expression data
|
| 166 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 167 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 168 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 169 |
+
|
| 170 |
+
# 2. Link clinical and genetic data
|
| 171 |
+
# Load clinical data from saved file to ensure availability
|
| 172 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 173 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 174 |
+
|
| 175 |
+
# 3. Handle missing values
|
| 176 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 177 |
+
|
| 178 |
+
# 4. Assess bias and remove biased demographic features
|
| 179 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 180 |
+
|
| 181 |
+
# 5. Final validation and save cohort info
|
| 182 |
+
is_gene_available_flag = (normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0)
|
| 183 |
+
is_trait_available_flag = (trait in linked_data.columns) and (not linked_data[trait].isna().all())
|
| 184 |
+
|
| 185 |
+
is_usable = validate_and_save_cohort_info(
|
| 186 |
+
is_final=True,
|
| 187 |
+
cohort=cohort,
|
| 188 |
+
info_path=json_path,
|
| 189 |
+
is_gene_available=is_gene_available_flag,
|
| 190 |
+
is_trait_available=is_trait_available_flag,
|
| 191 |
+
is_biased=is_trait_biased,
|
| 192 |
+
df=unbiased_linked_data,
|
| 193 |
+
note="INFO: Illumina probe IDs mapped to gene symbols; trait from case/control with GAD7>=10 fallback."
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
# 6. Save linked dataset if usable
|
| 197 |
+
if is_usable:
|
| 198 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 199 |
+
unbiased_linked_data.to_csv(out_data_file)
|