Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- output/preprocess/Lower_Grade_Glioma/code/GSE24072.py +238 -0
- output/preprocess/Lower_Grade_Glioma/code/GSE35158.py +204 -0
- output/preprocess/Lower_Grade_Glioma/code/GSE74567.py +95 -0
- output/preprocess/Lower_Grade_Glioma/code/TCGA.py +234 -0
- output/preprocess/Lung_Cancer/GSE244647.csv +0 -0
- output/preprocess/Lung_Cancer/GSE248830.csv +0 -0
- output/preprocess/Lung_Cancer/GSE280643.csv +0 -0
- output/preprocess/Lung_Cancer/clinical_data/GSE244645.csv +1 -1
- output/preprocess/Lung_Cancer/clinical_data/GSE244647.csv +1 -1
- output/preprocess/Lung_Cancer/clinical_data/GSE249262.csv +2 -2
- output/preprocess/Lung_Cancer/code/GSE21359.py +136 -0
- output/preprocess/Lung_Cancer/code/GSE222124.py +118 -0
- output/preprocess/Lung_Cancer/code/GSE244117.py +130 -0
- output/preprocess/Lung_Cancer/code/GSE244123.py +134 -0
- output/preprocess/Lung_Cancer/code/GSE244645.py +207 -0
- output/preprocess/Lung_Cancer/code/GSE244647.py +400 -0
- output/preprocess/Lung_Cancer/code/GSE248830.py +175 -0
- output/preprocess/Lung_Cancer/code/GSE249262.py +300 -0
- output/preprocess/Lung_Cancer/code/GSE249568.py +201 -0
- output/preprocess/Lung_Cancer/code/GSE280643.py +280 -0
- output/preprocess/Lung_Cancer/code/TCGA.py +266 -0
- output/preprocess/Lung_Cancer/cohort_info.json +1 -102
- output/preprocess/Lung_Cancer/gene_data/GSE280643.csv +0 -0
- output/preprocess/Melanoma/clinical_data/GSE144296.csv +0 -0
- output/preprocess/Melanoma/clinical_data/GSE148319.csv +1 -1
- output/preprocess/Melanoma/clinical_data/TCGA.csv +482 -1130
- output/preprocess/Melanoma/code/GSE144296.py +223 -0
- output/preprocess/Melanoma/code/GSE146264.py +123 -0
- output/preprocess/Melanoma/code/GSE148319.py +194 -0
- output/preprocess/Melanoma/code/GSE148949.py +291 -0
- output/preprocess/Melanoma/code/GSE157738.py +245 -0
- output/preprocess/Melanoma/code/GSE189631.py +127 -0
- output/preprocess/Melanoma/code/GSE200904.py +152 -0
- output/preprocess/Melanoma/code/GSE202806.py +214 -0
- output/preprocess/Melanoma/code/GSE215868.py +186 -0
- output/preprocess/Melanoma/code/GSE244984.py +114 -0
- output/preprocess/Melanoma/code/GSE261347.py +130 -0
- output/preprocess/Melanoma/code/TCGA.py +684 -0
- output/preprocess/Melanoma/cohort_info.json +1 -92
- output/preprocess/Mesothelioma/GSE117668.csv +0 -0
- output/preprocess/Mesothelioma/clinical_data/GSE107754.csv +3 -85
- output/preprocess/Mesothelioma/clinical_data/GSE112154.csv +2 -51
- output/preprocess/Mesothelioma/clinical_data/GSE117668.csv +2 -49
- output/preprocess/Mesothelioma/clinical_data/GSE131027.csv +2 -93
- output/preprocess/Mesothelioma/clinical_data/GSE68950.csv +1 -1
- output/preprocess/Mesothelioma/code/GSE107754.py +207 -0
- output/preprocess/Mesothelioma/code/GSE112154.py +190 -0
- output/preprocess/Mesothelioma/code/GSE117668.py +194 -0
- output/preprocess/Mesothelioma/code/GSE131027.py +219 -0
- output/preprocess/Mesothelioma/code/GSE163720.py +206 -0
output/preprocess/Lower_Grade_Glioma/code/GSE24072.py
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lower_Grade_Glioma"
|
| 6 |
+
cohort = "GSE24072"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lower_Grade_Glioma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lower_Grade_Glioma/GSE24072"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/GSE24072.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/gene_data/GSE24072.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/clinical_data/GSE24072.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lower_Grade_Glioma/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 based on series description (Affymetrix HU-133A expression arrays)
|
| 43 |
+
is_gene_available = True
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability inferred from the sample characteristics dictionary shown
|
| 46 |
+
trait_row = None # Series is high-grade glioma/GBM; target trait Lower_Grade_Glioma not available/constant absent
|
| 47 |
+
age_row = 1
|
| 48 |
+
gender_row = 0
|
| 49 |
+
|
| 50 |
+
def _after_colon(x: str) -> str:
|
| 51 |
+
if x is None:
|
| 52 |
+
return ""
|
| 53 |
+
parts = str(x).split(":", 1)
|
| 54 |
+
return parts[1].strip() if len(parts) > 1 else str(x).strip()
|
| 55 |
+
|
| 56 |
+
def convert_trait(x):
|
| 57 |
+
"""
|
| 58 |
+
Convert diagnosis/grade-like text to binary Lower_Grade_Glioma (LGG) indicator.
|
| 59 |
+
1 => LGG (likely WHO grade II/III or LGG histologies), 0 => not LGG (e.g., GBM/grade IV).
|
| 60 |
+
Unknown/unusable -> None.
|
| 61 |
+
"""
|
| 62 |
+
v = _after_colon(x).lower()
|
| 63 |
+
if not v:
|
| 64 |
+
return None
|
| 65 |
+
# Positive (LGG) hints
|
| 66 |
+
lgg_hints = [
|
| 67 |
+
"low grade glioma", "lgg", "grade ii", "grade 2", "grade iii", "grade 3",
|
| 68 |
+
"oligodendroglioma", "oligoastrocytoma", "astrocytoma", "anaplastic oligodendroglioma", "anaplastic astrocytoma"
|
| 69 |
+
]
|
| 70 |
+
# Negative (not LGG) hints
|
| 71 |
+
hgg_hints = ["glioblastoma", "gbm", "grade iv", "grade 4", "high-grade glioma", "hgg"]
|
| 72 |
+
if any(h in v for h in hgg_hints):
|
| 73 |
+
return 0
|
| 74 |
+
if any(h in v for h in lgg_hints):
|
| 75 |
+
return 1
|
| 76 |
+
return None
|
| 77 |
+
|
| 78 |
+
def convert_age(x):
|
| 79 |
+
v = _after_colon(x)
|
| 80 |
+
if not v:
|
| 81 |
+
return None
|
| 82 |
+
m = re.search(r"(\d+(\.\d+)?)", v)
|
| 83 |
+
if not m:
|
| 84 |
+
return None
|
| 85 |
+
try:
|
| 86 |
+
return float(m.group(1))
|
| 87 |
+
except Exception:
|
| 88 |
+
return None
|
| 89 |
+
|
| 90 |
+
def convert_gender(x):
|
| 91 |
+
v = _after_colon(x).lower()
|
| 92 |
+
if not v:
|
| 93 |
+
return None
|
| 94 |
+
if v in {"male", "m"}:
|
| 95 |
+
return 1
|
| 96 |
+
if v in {"female", "f"}:
|
| 97 |
+
return 0
|
| 98 |
+
return None
|
| 99 |
+
|
| 100 |
+
# 3) Save initial filtering 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_row is None
|
| 111 |
+
# (If in other cohorts trait_row is available, the following pattern would be used)
|
| 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_df(selected)
|
| 124 |
+
# os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 125 |
+
# selected.to_csv(out_clinical_data_file)
|
| 126 |
+
|
| 127 |
+
# Step 3: Gene Data Extraction
|
| 128 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 129 |
+
gene_data = get_genetic_data(matrix_file)
|
| 130 |
+
|
| 131 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 132 |
+
print(gene_data.index[:20])
|
| 133 |
+
|
| 134 |
+
# Step 4: Gene Identifier Review
|
| 135 |
+
requires_gene_mapping = True
|
| 136 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 137 |
+
|
| 138 |
+
# Step 5: Gene Annotation
|
| 139 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 140 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 141 |
+
|
| 142 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 143 |
+
print("Gene annotation preview:")
|
| 144 |
+
print(preview_df(gene_annotation))
|
| 145 |
+
|
| 146 |
+
# Step 6: Gene Identifier Mapping
|
| 147 |
+
# Decide mapping columns based on annotation preview: probe IDs are in 'ID', gene symbols in 'Gene Symbol'
|
| 148 |
+
prob_col = 'ID'
|
| 149 |
+
gene_col = 'Gene Symbol'
|
| 150 |
+
|
| 151 |
+
# Build probe-to-gene mapping dataframe
|
| 152 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=prob_col, gene_col=gene_col)
|
| 153 |
+
|
| 154 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 155 |
+
gene_data = apply_gene_mapping(gene_data, mapping_df)
|
| 156 |
+
|
| 157 |
+
# Step 7: Data Normalization and Linking
|
| 158 |
+
import os
|
| 159 |
+
import pandas as pd
|
| 160 |
+
|
| 161 |
+
# 1. Normalize gene symbols and save gene expression data
|
| 162 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 163 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 164 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 165 |
+
|
| 166 |
+
# Determine trait availability from previous step context
|
| 167 |
+
try:
|
| 168 |
+
is_trait_available = (trait_row is not None)
|
| 169 |
+
except NameError:
|
| 170 |
+
is_trait_available = False
|
| 171 |
+
|
| 172 |
+
if is_trait_available:
|
| 173 |
+
# Ensure selected_clinical_data exists; if not, build it from prior clinical_data and converters
|
| 174 |
+
if 'selected_clinical_data' not in globals():
|
| 175 |
+
# Safeguard for optional covariates
|
| 176 |
+
try:
|
| 177 |
+
_age_row = age_row
|
| 178 |
+
except NameError:
|
| 179 |
+
_age_row = None
|
| 180 |
+
try:
|
| 181 |
+
_gender_row = gender_row
|
| 182 |
+
except NameError:
|
| 183 |
+
_gender_row = None
|
| 184 |
+
# Build clinical features
|
| 185 |
+
selected_clinical_data = geo_select_clinical_features(
|
| 186 |
+
clinical_df=clinical_data,
|
| 187 |
+
trait=trait,
|
| 188 |
+
trait_row=trait_row,
|
| 189 |
+
convert_trait=convert_trait,
|
| 190 |
+
age_row=_age_row,
|
| 191 |
+
convert_age=convert_age if _age_row is not None else None,
|
| 192 |
+
gender_row=_gender_row,
|
| 193 |
+
convert_gender=convert_gender if _gender_row is not None else None
|
| 194 |
+
)
|
| 195 |
+
# Save clinical features
|
| 196 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 197 |
+
selected_clinical_data.to_csv(out_clinical_data_file)
|
| 198 |
+
|
| 199 |
+
# 2. Link clinical and genetic data
|
| 200 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
| 201 |
+
|
| 202 |
+
# 3. Handle missing values
|
| 203 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 204 |
+
|
| 205 |
+
# 4. Assess bias and remove biased demographic covariates
|
| 206 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 207 |
+
|
| 208 |
+
# 5. Final validation and metadata saving
|
| 209 |
+
is_usable = validate_and_save_cohort_info(
|
| 210 |
+
is_final=True,
|
| 211 |
+
cohort=cohort,
|
| 212 |
+
info_path=json_path,
|
| 213 |
+
is_gene_available=True,
|
| 214 |
+
is_trait_available=True,
|
| 215 |
+
is_biased=is_trait_biased,
|
| 216 |
+
df=unbiased_linked_data,
|
| 217 |
+
note="INFO: Linked clinical and gene expression data processed with missing value handling."
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
# 6. Save linked data only if usable
|
| 221 |
+
if is_usable:
|
| 222 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 223 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 224 |
+
else:
|
| 225 |
+
# Trait not available; skip linking and mark accordingly in final validation.
|
| 226 |
+
# Pass a non-empty df to avoid false 'gene unavailable' override in validation.
|
| 227 |
+
placeholder_df = normalized_gene_data.T # samples x genes
|
| 228 |
+
_ = validate_and_save_cohort_info(
|
| 229 |
+
is_final=True,
|
| 230 |
+
cohort=cohort,
|
| 231 |
+
info_path=json_path,
|
| 232 |
+
is_gene_available=True,
|
| 233 |
+
is_trait_available=False,
|
| 234 |
+
is_biased=False,
|
| 235 |
+
df=placeholder_df,
|
| 236 |
+
note="WARNING: Trait not available in clinical annotations; unable to link gene expression to target trait."
|
| 237 |
+
)
|
| 238 |
+
# Do not save linked data since it's not usable without trait.
|
output/preprocess/Lower_Grade_Glioma/code/GSE35158.py
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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# Processing context
|
| 5 |
+
trait = "Lower_Grade_Glioma"
|
| 6 |
+
cohort = "GSE35158"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lower_Grade_Glioma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lower_Grade_Glioma/GSE35158"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/GSE35158.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/gene_data/GSE35158.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/clinical_data/GSE35158.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lower_Grade_Glioma/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 # Based on "Expression profiling" and transcriptional analysis
|
| 43 |
+
|
| 44 |
+
# 2. Variable Availability and Data Type Conversion
|
| 45 |
+
|
| 46 |
+
# 2.1 Identify rows in Sample Characteristics Dictionary
|
| 47 |
+
trait_row = 0 # 'tumor type: diffuse astrocytic glioma' vs 'tumor type: normal brain'
|
| 48 |
+
age_row = None # Not available in the provided dictionary
|
| 49 |
+
gender_row = None # Not available in the provided dictionary
|
| 50 |
+
|
| 51 |
+
# 2.2 Conversion functions
|
| 52 |
+
def _extract_value(x):
|
| 53 |
+
if x is None:
|
| 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.strip().lower()
|
| 65 |
+
if v in ['diffuse astrocytic glioma', 'glioma', 'tumor', 'tumour']:
|
| 66 |
+
return 1
|
| 67 |
+
if v in ['normal brain', 'normal', 'control']:
|
| 68 |
+
return 0
|
| 69 |
+
return None
|
| 70 |
+
|
| 71 |
+
def convert_age(x):
|
| 72 |
+
# Not used (no age data), but defined for completeness
|
| 73 |
+
val = _extract_value(x)
|
| 74 |
+
if val is None or val.lower() in ['na', 'n/a', 'nan', '']:
|
| 75 |
+
return None
|
| 76 |
+
# Try to parse numeric age
|
| 77 |
+
try:
|
| 78 |
+
# Remove common text artifacts
|
| 79 |
+
v = ''.join(ch for ch in val if (ch.isdigit() or ch == '.' or ch == '-'))
|
| 80 |
+
return float(v) if v != '' else None
|
| 81 |
+
except Exception:
|
| 82 |
+
return None
|
| 83 |
+
|
| 84 |
+
def convert_gender(x):
|
| 85 |
+
# Not used (no gender data), but defined for completeness
|
| 86 |
+
val = _extract_value(x)
|
| 87 |
+
if val is None:
|
| 88 |
+
return None
|
| 89 |
+
v = val.strip().lower()
|
| 90 |
+
if v in ['female', 'f', 'woman', 'women']:
|
| 91 |
+
return 0
|
| 92 |
+
if v in ['male', 'm', 'man', 'men']:
|
| 93 |
+
return 1
|
| 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
|
| 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 |
+
clinical_preview = preview_df(selected_clinical_df)
|
| 119 |
+
print("Selected clinical features preview:", clinical_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 |
+
# Decide columns for mapping based on previews:
|
| 144 |
+
# - Probe/ID in expression data: 'ILMN_...' -> matches 'ID' column in annotation
|
| 145 |
+
# - Gene symbol in annotation: 'Symbol' column
|
| 146 |
+
|
| 147 |
+
# Optionally filter to human probes to exclude controls
|
| 148 |
+
annotation_for_mapping = gene_annotation.copy()
|
| 149 |
+
if 'Species' in annotation_for_mapping.columns:
|
| 150 |
+
annotation_for_mapping = annotation_for_mapping[
|
| 151 |
+
annotation_for_mapping['Species'].astype(str).str.contains('Homo sapiens', case=False, na=False)
|
| 152 |
+
]
|
| 153 |
+
|
| 154 |
+
# Build mapping dataframe
|
| 155 |
+
mapping_df = get_gene_mapping(annotation_for_mapping, prob_col='ID', gene_col='Symbol')
|
| 156 |
+
|
| 157 |
+
# Apply mapping: convert probe-level to gene-level expression
|
| 158 |
+
expression_df = gene_data # preserve original probe-level
|
| 159 |
+
gene_data = apply_gene_mapping(expression_df=expression_df, mapping_df=mapping_df)
|
| 160 |
+
|
| 161 |
+
# Step 7: Data Normalization and Linking
|
| 162 |
+
import os
|
| 163 |
+
|
| 164 |
+
# 1. Normalize the obtained gene data with the 'normalize_gene_symbols_in_index' function from the library.
|
| 165 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 166 |
+
|
| 167 |
+
# Save normalized gene data if non-empty
|
| 168 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 169 |
+
if normalized_gene_data.shape[0] > 0 and normalized_gene_data.shape[1] > 0:
|
| 170 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 171 |
+
|
| 172 |
+
# 2. Link the clinical and genetic data with the 'geo_link_clinical_genetic_data' function from the library.
|
| 173 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 174 |
+
|
| 175 |
+
# 3. Handle missing values in the linked data
|
| 176 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 177 |
+
|
| 178 |
+
# 4. Determine whether the trait and some demographic features are severely biased, and remove biased features.
|
| 179 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 180 |
+
|
| 181 |
+
# Prepare a note about class imbalance and missing demographics
|
| 182 |
+
note_parts = []
|
| 183 |
+
# Pre-filter class counts from clinical extraction to document imbalance
|
| 184 |
+
try:
|
| 185 |
+
s = selected_clinical_df.T[trait].dropna()
|
| 186 |
+
n_case = int((s == 1).sum())
|
| 187 |
+
n_ctrl = int((s == 0).sum())
|
| 188 |
+
note_parts.append(f"Trait distribution before filtering: cases={n_case}, controls={n_ctrl}.")
|
| 189 |
+
except Exception:
|
| 190 |
+
pass
|
| 191 |
+
if 'Age' not in unbiased_linked_data.columns and 'Gender' not in unbiased_linked_data.columns:
|
| 192 |
+
note_parts.append("No age/gender annotations available.")
|
| 193 |
+
imbalance_msg = "Trait is highly imbalanced." if 'n_ctrl' in locals() and n_ctrl <= 2 else "Trait imbalance not extreme."
|
| 194 |
+
note = "WARNING: " + " ".join([imbalance_msg] + note_parts)
|
| 195 |
+
|
| 196 |
+
# 5. Conduct quality check and save the cohort information.
|
| 197 |
+
is_usable = validate_and_save_cohort_info(
|
| 198 |
+
True, cohort, json_path, True, True, is_trait_biased, unbiased_linked_data, note
|
| 199 |
+
)
|
| 200 |
+
|
| 201 |
+
# 6. If the linked data is usable, save it as a CSV file to 'out_data_file'.
|
| 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)
|
output/preprocess/Lower_Grade_Glioma/code/GSE74567.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lower_Grade_Glioma"
|
| 6 |
+
cohort = "GSE74567"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lower_Grade_Glioma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lower_Grade_Glioma/GSE74567"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/GSE74567.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/gene_data/GSE74567.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/clinical_data/GSE74567.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lower_Grade_Glioma/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 # Transcriptome (gene expression) study on astrocytoma cell lines
|
| 41 |
+
|
| 42 |
+
# 2) Variable availability and converters
|
| 43 |
+
# Based on the sample characteristics, there is no human clinical trait, age, or gender information.
|
| 44 |
+
trait_row = None # No human Lower_Grade_Glioma status available; cell line experiment only
|
| 45 |
+
age_row = None # No age information
|
| 46 |
+
gender_row = None # No gender information
|
| 47 |
+
|
| 48 |
+
# Converters (not used since rows are None, but defined for interface completeness)
|
| 49 |
+
def _extract_value(x):
|
| 50 |
+
if x is None:
|
| 51 |
+
return None
|
| 52 |
+
if isinstance(x, str):
|
| 53 |
+
parts = x.split(":", 1)
|
| 54 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 55 |
+
val = val.strip()
|
| 56 |
+
return val if val not in {"", "NA", "na", "NaN", "null", "None", "unknown", "Unknown"} else None
|
| 57 |
+
return None
|
| 58 |
+
|
| 59 |
+
def convert_trait(x):
|
| 60 |
+
# Not available; return None
|
| 61 |
+
return None
|
| 62 |
+
|
| 63 |
+
def convert_age(x):
|
| 64 |
+
# Not available; return None
|
| 65 |
+
return None
|
| 66 |
+
|
| 67 |
+
def convert_gender(x):
|
| 68 |
+
# Not available; return None
|
| 69 |
+
return None
|
| 70 |
+
|
| 71 |
+
# 3) Save metadata (initial filtering)
|
| 72 |
+
is_trait_available = trait_row is not None
|
| 73 |
+
_ = validate_and_save_cohort_info(
|
| 74 |
+
is_final=False,
|
| 75 |
+
cohort=cohort,
|
| 76 |
+
info_path=json_path,
|
| 77 |
+
is_gene_available=is_gene_available,
|
| 78 |
+
is_trait_available=is_trait_available
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
# 4) Clinical Feature Extraction (skip since trait_row is None)
|
| 82 |
+
if trait_row is not None:
|
| 83 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 84 |
+
clinical_df=clinical_data,
|
| 85 |
+
trait=trait,
|
| 86 |
+
trait_row=trait_row,
|
| 87 |
+
convert_trait=convert_trait,
|
| 88 |
+
age_row=age_row,
|
| 89 |
+
convert_age=convert_age,
|
| 90 |
+
gender_row=gender_row,
|
| 91 |
+
convert_gender=convert_gender
|
| 92 |
+
)
|
| 93 |
+
clinical_preview = preview_df(selected_clinical_df)
|
| 94 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 95 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
output/preprocess/Lower_Grade_Glioma/code/TCGA.py
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lower_Grade_Glioma"
|
| 6 |
+
|
| 7 |
+
# Input paths
|
| 8 |
+
tcga_root_dir = "../DATA/TCGA"
|
| 9 |
+
|
| 10 |
+
# Output paths
|
| 11 |
+
out_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/TCGA.csv"
|
| 12 |
+
out_gene_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/gene_data/TCGA.csv"
|
| 13 |
+
out_clinical_data_file = "./output/z4/preprocess/Lower_Grade_Glioma/clinical_data/TCGA.csv"
|
| 14 |
+
json_path = "./output/z4/preprocess/Lower_Grade_Glioma/cohort_info.json"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Step 1: Initial Data Loading
|
| 18 |
+
import os
|
| 19 |
+
import pandas as pd
|
| 20 |
+
|
| 21 |
+
# Step 1: Select the most relevant TCGA cohort directory for the trait
|
| 22 |
+
def _normalize_name(name: str) -> str:
|
| 23 |
+
return name.lower().replace(' ', '_').replace('-', '_')
|
| 24 |
+
|
| 25 |
+
def _select_tcga_cohort_dir(root_dir: str, trait_name: str) -> str:
|
| 26 |
+
if not os.path.isdir(root_dir):
|
| 27 |
+
return None
|
| 28 |
+
entries = [d for d in os.listdir(root_dir) if os.path.isdir(os.path.join(root_dir, d))]
|
| 29 |
+
norm_trait = _normalize_name(trait_name) # "lower_grade_glioma"
|
| 30 |
+
candidates = []
|
| 31 |
+
for d in entries:
|
| 32 |
+
dn = _normalize_name(d)
|
| 33 |
+
candidates.append((d, dn))
|
| 34 |
+
|
| 35 |
+
# Priority 1: exact trait phrase
|
| 36 |
+
exact = [d for d, dn in candidates if norm_trait in dn]
|
| 37 |
+
if exact:
|
| 38 |
+
# Prefer LGG single-cohort over combined GBMLGG
|
| 39 |
+
lgg_only = [d for d in exact if 'gbmlgg' not in _normalize_name(d)]
|
| 40 |
+
if lgg_only:
|
| 41 |
+
return os.path.join(root_dir, sorted(lgg_only)[0])
|
| 42 |
+
return os.path.join(root_dir, sorted(exact)[0])
|
| 43 |
+
|
| 44 |
+
# Priority 2: LGG token without GBM
|
| 45 |
+
lgg_like = [d for d, dn in candidates if ('lgg' in dn and 'gbm' not in dn)]
|
| 46 |
+
if lgg_like:
|
| 47 |
+
return os.path.join(root_dir, sorted(lgg_like)[0])
|
| 48 |
+
|
| 49 |
+
# Priority 3: fallback to combined GBMLGG
|
| 50 |
+
gbmlgg = [d for d, dn in candidates if 'gbmlgg' in dn]
|
| 51 |
+
if gbmlgg:
|
| 52 |
+
return os.path.join(root_dir, sorted(gbmlgg)[0])
|
| 53 |
+
|
| 54 |
+
return None
|
| 55 |
+
|
| 56 |
+
selected_cohort_dir = _select_tcga_cohort_dir(tcga_root_dir, trait)
|
| 57 |
+
|
| 58 |
+
# If no suitable directory found, record and stop further processing in this run
|
| 59 |
+
if selected_cohort_dir is None:
|
| 60 |
+
validate_and_save_cohort_info(
|
| 61 |
+
is_final=False,
|
| 62 |
+
cohort="TCGA",
|
| 63 |
+
info_path=json_path,
|
| 64 |
+
is_gene_available=False,
|
| 65 |
+
is_trait_available=False
|
| 66 |
+
)
|
| 67 |
+
else:
|
| 68 |
+
# Step 2: Identify clinical and genetic file paths
|
| 69 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(selected_cohort_dir)
|
| 70 |
+
|
| 71 |
+
# Step 3: Load both files
|
| 72 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0, low_memory=False, compression='infer')
|
| 73 |
+
genetic_df = pd.read_csv(genetic_file_path, sep='\t', index_col=0, low_memory=False, compression='infer')
|
| 74 |
+
|
| 75 |
+
# Step 4: Print clinical column names for further analysis
|
| 76 |
+
print(list(clinical_df.columns))
|
| 77 |
+
|
| 78 |
+
# Step 2: Find Candidate Demographic Features
|
| 79 |
+
import re
|
| 80 |
+
|
| 81 |
+
# Previously obtained list of column names
|
| 82 |
+
cols = ['_INTEGRATION', '_PATIENT', '_cohort', '_primary_disease', '_primary_site', 'additional_pharmaceutical_therapy', 'additional_radiation_therapy', 'additional_surgery_locoregional_procedure', 'additional_surgery_metastatic_procedure', 'age_at_initial_pathologic_diagnosis', 'animal_insect_allergy_history', 'animal_insect_allergy_types', 'asthma_history', 'bcr_followup_barcode', 'bcr_patient_barcode', 'bcr_sample_barcode', 'days_to_additional_surgery_locoregional_procedure', 'days_to_additional_surgery_metastatic_procedure', 'days_to_birth', 'days_to_collection', 'days_to_death', 'days_to_initial_pathologic_diagnosis', 'days_to_last_followup', 'days_to_new_tumor_event_after_initial_treatment', 'days_to_performance_status_assessment', 'eastern_cancer_oncology_group', 'eczema_history', 'family_history_of_cancer', 'family_history_of_primary_brain_tumor', 'first_diagnosis_age_asth_ecz_hay_fev_mold_dust', 'first_diagnosis_age_of_animal_insect_allergy', 'first_diagnosis_age_of_food_allergy', 'first_presenting_symptom', 'first_presenting_symptom_longest_duration', 'followup_case_report_form_submission_reason', 'followup_treatment_success', 'food_allergy_history', 'food_allergy_types', 'form_completion_date', 'gender', 'hay_fever_history', 'headache_history', 'histological_type', 'history_ionizing_rt_to_head', 'history_of_neoadjuvant_treatment', 'icd_10', 'icd_o_3_histology', 'icd_o_3_site', 'informed_consent_verified', 'inherited_genetic_syndrome_found', 'inherited_genetic_syndrome_result', 'initial_weight', 'intermediate_dimension', 'is_ffpe', 'karnofsky_performance_score', 'laterality', 'ldh1_mutation_found', 'ldh1_mutation_test_method', 'ldh1_mutation_tested', 'longest_dimension', 'lost_follow_up', 'mental_status_changes', 'mold_or_dust_allergy_history', 'motor_movement_changes', 'neoplasm_histologic_grade', 'new_tumor_event_after_initial_treatment', 'oct_embedded', 'other_dx', 'pathology_report_file_name', 'patient_id', 'performance_status_scale_timing', 'person_neoplasm_cancer_status', 'preoperative_antiseizure_meds', 'preoperative_corticosteroids', 'primary_therapy_outcome_success', 'radiation_therapy', 'sample_type', 'sample_type_id', 'seizure_history', 'sensory_changes', 'shortest_dimension', 'supratentorial_localization', 'targeted_molecular_therapy', 'tissue_prospective_collection_indicator', 'tissue_retrospective_collection_indicator', 'tissue_source_site', 'tumor_location', 'tumor_tissue_site', 'vial_number', 'visual_changes', 'vital_status', 'year_of_initial_pathologic_diagnosis', '_GENOMIC_ID_TCGA_LGG_mutation', '_GENOMIC_ID_TCGA_LGG_PDMRNAseq', '_GENOMIC_ID_TCGA_LGG_RPPA', '_GENOMIC_ID_TCGA_LGG_mutation_broad_gene', '_GENOMIC_ID_TCGA_LGG_gistic2', '_GENOMIC_ID_TCGA_LGG_exp_HiSeqV2_exon', '_GENOMIC_ID_TCGA_LGG_miRNA_HiSeq', '_GENOMIC_ID_TCGA_LGG_PDMarrayCNV', '_GENOMIC_ID_data/public/TCGA/LGG/miRNA_HiSeq_gene', '_GENOMIC_ID_TCGA_LGG_mutation_curated_broad_gene', '_GENOMIC_ID_TCGA_LGG_exp_HiSeqV2_percentile', '_GENOMIC_ID_TCGA_LGG_hMethyl450_MethylMix', '_GENOMIC_ID_TCGA_LGG_PDMRNAseqCNV', '_GENOMIC_ID_TCGA_LGG_mutation_bcm_gene', '_GENOMIC_ID_TCGA_LGG_hMethyl450', '_GENOMIC_ID_TCGA_LGG_PDMarray', '_GENOMIC_ID_TCGA_LGG_exp_HiSeqV2', '_GENOMIC_ID_TCGA_LGG_G4502A_07_3', '_GENOMIC_ID_TCGA_LGG_exp_HiSeqV2_PANCAN', '_GENOMIC_ID_TCGA_LGG_gistic2thd', '_GENOMIC_ID_TCGA_LGG_mutation_ucsc_maf_gene']
|
| 83 |
+
|
| 84 |
+
def is_age_col(name: str) -> bool:
|
| 85 |
+
n = name.lower()
|
| 86 |
+
# Include common age/birth tokens
|
| 87 |
+
tokens = ['age', 'birth', 'yob', 'dob', 'year_of_birth', 'birth_year']
|
| 88 |
+
return any(tok in n for tok in tokens)
|
| 89 |
+
|
| 90 |
+
def is_gender_col(name: str) -> bool:
|
| 91 |
+
n = name.lower()
|
| 92 |
+
if 'gender' in n:
|
| 93 |
+
return True
|
| 94 |
+
return re.search(r'(^|[^a-zA-Z])sex([^a-zA-Z]|$)', n) is not None
|
| 95 |
+
|
| 96 |
+
candidate_age_cols = [c for c in cols if is_age_col(c)]
|
| 97 |
+
candidate_gender_cols = [c for c in cols if is_gender_col(c)]
|
| 98 |
+
|
| 99 |
+
print(f"candidate_age_cols = {candidate_age_cols}")
|
| 100 |
+
print(f"candidate_gender_cols = {candidate_gender_cols}")
|
| 101 |
+
|
| 102 |
+
# Optional preview: only if a clinical_df is already available
|
| 103 |
+
try:
|
| 104 |
+
clinical_df # noqa: F821
|
| 105 |
+
has_df = True
|
| 106 |
+
except NameError:
|
| 107 |
+
has_df = False
|
| 108 |
+
|
| 109 |
+
if has_df:
|
| 110 |
+
from tools.preprocess import preview_df # ensure available if not already imported
|
| 111 |
+
|
| 112 |
+
age_cols_in_df = [c for c in candidate_age_cols if c in clinical_df.columns]
|
| 113 |
+
gender_cols_in_df = [c for c in candidate_gender_cols if c in clinical_df.columns]
|
| 114 |
+
|
| 115 |
+
if age_cols_in_df:
|
| 116 |
+
print(preview_df(clinical_df[age_cols_in_df], n=5))
|
| 117 |
+
if gender_cols_in_df:
|
| 118 |
+
print(preview_df(clinical_df[gender_cols_in_df], n=5))
|
| 119 |
+
|
| 120 |
+
# Step 3: Select Demographic Features
|
| 121 |
+
# Robust selection of demographic columns without relying on preview dictionaries
|
| 122 |
+
candidate_age_cols = globals().get('candidate_age_cols', []) or []
|
| 123 |
+
candidate_gender_cols = globals().get('candidate_gender_cols', []) or []
|
| 124 |
+
|
| 125 |
+
age_col = None
|
| 126 |
+
gender_col = None
|
| 127 |
+
|
| 128 |
+
# Prefer explicit age at diagnosis, then days_to_birth; else None
|
| 129 |
+
if 'age_at_initial_pathologic_diagnosis' in candidate_age_cols:
|
| 130 |
+
age_col = 'age_at_initial_pathologic_diagnosis'
|
| 131 |
+
elif 'days_to_birth' in candidate_age_cols:
|
| 132 |
+
age_col = 'days_to_birth'
|
| 133 |
+
else:
|
| 134 |
+
age_col = None
|
| 135 |
+
|
| 136 |
+
# Prefer standard gender column; else None
|
| 137 |
+
if 'gender' in candidate_gender_cols:
|
| 138 |
+
gender_col = 'gender'
|
| 139 |
+
elif 'sex' in candidate_gender_cols:
|
| 140 |
+
gender_col = 'sex'
|
| 141 |
+
else:
|
| 142 |
+
gender_col = None
|
| 143 |
+
|
| 144 |
+
print(f"Selected age_col: {age_col}")
|
| 145 |
+
print(f"Selected gender_col: {gender_col}")
|
| 146 |
+
|
| 147 |
+
# Step 4: Feature Engineering and Validation
|
| 148 |
+
import os
|
| 149 |
+
import pandas as pd
|
| 150 |
+
|
| 151 |
+
# 1) Extract and standardize clinical features (trait, Age, Gender)
|
| 152 |
+
selected_clinical_df = tcga_select_clinical_features(
|
| 153 |
+
clinical_df=clinical_df,
|
| 154 |
+
trait=trait,
|
| 155 |
+
age_col=age_col,
|
| 156 |
+
gender_col=gender_col
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
# Optionally save standardized clinical features for traceability
|
| 160 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 161 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 162 |
+
|
| 163 |
+
# 2) Prepare and normalize gene expression data
|
| 164 |
+
def _looks_like_tcga(ids) -> int:
|
| 165 |
+
return sum(isinstance(x, str) and x.startswith("TCGA-") for x in ids)
|
| 166 |
+
|
| 167 |
+
gene_df = genetic_df.copy()
|
| 168 |
+
|
| 169 |
+
# Detect orientation: samples as columns vs index
|
| 170 |
+
cols_tcga = _looks_like_tcga(gene_df.columns)
|
| 171 |
+
idx_tcga = _looks_like_tcga(gene_df.index)
|
| 172 |
+
if idx_tcga > cols_tcga:
|
| 173 |
+
gene_df = gene_df.T
|
| 174 |
+
|
| 175 |
+
# Keep only TCGA sample columns
|
| 176 |
+
tcga_sample_cols = [c for c in gene_df.columns if isinstance(c, str) and c.startswith("TCGA-")]
|
| 177 |
+
if len(tcga_sample_cols) > 0:
|
| 178 |
+
gene_df = gene_df[tcga_sample_cols]
|
| 179 |
+
|
| 180 |
+
# Coerce to numeric
|
| 181 |
+
gene_df = gene_df.apply(pd.to_numeric, errors='coerce')
|
| 182 |
+
|
| 183 |
+
# Normalize gene symbols in the index, drop unrecognized, and aggregate
|
| 184 |
+
gene_df_norm = normalize_gene_symbols_in_index(gene_df)
|
| 185 |
+
|
| 186 |
+
# Save normalized gene expression matrix
|
| 187 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 188 |
+
gene_df_norm.to_csv(out_gene_data_file)
|
| 189 |
+
|
| 190 |
+
# 3) Link clinical and genetic data on sample IDs
|
| 191 |
+
common_samples = selected_clinical_df.index.intersection(gene_df_norm.columns)
|
| 192 |
+
linked_data = selected_clinical_df.loc[common_samples].join(gene_df_norm[common_samples].T, how='inner')
|
| 193 |
+
|
| 194 |
+
# 4) Handle missing values systematically
|
| 195 |
+
processed_df = handle_missing_values(df=linked_data, trait_col=trait)
|
| 196 |
+
|
| 197 |
+
# Ensure Gender is an integer type if present (after imputation it may be float)
|
| 198 |
+
if 'Gender' in processed_df.columns:
|
| 199 |
+
# Only cast non-missing; if all were dropped earlier it's fine
|
| 200 |
+
processed_df['Gender'] = processed_df['Gender'].round().astype('Int64').astype('float').astype(int)
|
| 201 |
+
|
| 202 |
+
# 5) Determine bias in trait and demographic features; drop biased demographics
|
| 203 |
+
is_biased, processed_df = judge_and_remove_biased_features(processed_df, trait)
|
| 204 |
+
|
| 205 |
+
# 6) Final validation and save cohort info
|
| 206 |
+
gene_cols_after = [c for c in processed_df.columns if c not in [trait, 'Age', 'Gender']]
|
| 207 |
+
# Explicitly cast to native Python bools to avoid numpy.bool_ leaking into JSON
|
| 208 |
+
is_gene_available = bool(len(gene_cols_after) > 0)
|
| 209 |
+
is_trait_available = bool((trait in processed_df.columns) and (processed_df[trait].notna().sum() > 0))
|
| 210 |
+
is_biased = bool(is_biased)
|
| 211 |
+
|
| 212 |
+
note = (
|
| 213 |
+
f"INFO: Selected age_col='{age_col}', gender_col='{gender_col}'. "
|
| 214 |
+
f"Gene orientation auto-detected (samples-as-{'columns' if cols_tcga >= idx_tcga else 'rows'}). "
|
| 215 |
+
f"Initial clinical samples={len(selected_clinical_df)}, gene samples={gene_df_norm.shape[1]}; "
|
| 216 |
+
f"linked samples={len(linked_data)}; final samples after QC={len(processed_df)}; "
|
| 217 |
+
f"final genes={len(gene_cols_after)}."
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
is_usable = validate_and_save_cohort_info(
|
| 221 |
+
is_final=True,
|
| 222 |
+
cohort="TCGA",
|
| 223 |
+
info_path=json_path,
|
| 224 |
+
is_gene_available=is_gene_available,
|
| 225 |
+
is_trait_available=is_trait_available,
|
| 226 |
+
is_biased=is_biased,
|
| 227 |
+
df=processed_df,
|
| 228 |
+
note=note
|
| 229 |
+
)
|
| 230 |
+
|
| 231 |
+
# 7) Save linked data only if usable
|
| 232 |
+
if is_usable:
|
| 233 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 234 |
+
processed_df.to_csv(out_data_file)
|
output/preprocess/Lung_Cancer/GSE244647.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
output/preprocess/Lung_Cancer/GSE248830.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
output/preprocess/Lung_Cancer/GSE280643.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
output/preprocess/Lung_Cancer/clinical_data/GSE244645.csv
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
,GSM7823140,GSM7823141,GSM7823142,GSM7823143,GSM7823144,GSM7823145,GSM7823146,GSM7823147,GSM7823148,GSM7823149,GSM7823150,GSM7823151,GSM7823152,GSM7823153,GSM7823154,GSM7823155,GSM7823156,GSM7823157,GSM7823158,GSM7823159,GSM7823160,GSM7823161,GSM7823162,GSM7823163,GSM7823164,GSM7823165,GSM7823166,GSM7823167,GSM7823168,GSM7823169,GSM7823170,GSM7823171,GSM7823172,GSM7823173,GSM7823174,GSM7823175,GSM7823176,GSM7823177,GSM7823178,GSM7823179,GSM7823180,GSM7823181,GSM7823182,GSM7823183,GSM7823184,GSM7823185,GSM7823186,GSM7823187,GSM7823188,GSM7823189,GSM7823190,GSM7823191,GSM7823192,GSM7823193,GSM7823194,GSM7823195,GSM7823196,GSM7823197,GSM7823198,GSM7823199,GSM7823200,GSM7823201,GSM7823202,GSM7823203,GSM7823204,GSM7823205,GSM7823206,GSM7823207,GSM7823208
|
| 2 |
-
Lung_Cancer,1.0,1.0,1.0,
|
| 3 |
Age,68.0,71.0,56.0,56.0,64.0,64.0,58.0,58.0,67.0,67.0,64.0,64.0,77.0,57.0,68.0,68.0,61.0,61.0,75.0,75.0,65.0,65.0,69.0,69.0,65.0,65.0,50.0,70.0,57.0,57.0,55.0,55.0,68.0,72.0,72.0,44.0,54.0,54.0,47.0,47.0,69.0,69.0,43.0,43.0,57.0,57.0,53.0,53.0,45.0,46.0,46.0,56.0,56.0,67.0,67.0,70.0,70.0,61.0,61.0,68.0,68.0,56.0,56.0,39.0,39.0,61.0,61.0,48.0,48.0
|
| 4 |
Gender,1.0,0.0,1.0,1.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,0.0,0.0,1.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,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,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
|
|
|
|
| 1 |
,GSM7823140,GSM7823141,GSM7823142,GSM7823143,GSM7823144,GSM7823145,GSM7823146,GSM7823147,GSM7823148,GSM7823149,GSM7823150,GSM7823151,GSM7823152,GSM7823153,GSM7823154,GSM7823155,GSM7823156,GSM7823157,GSM7823158,GSM7823159,GSM7823160,GSM7823161,GSM7823162,GSM7823163,GSM7823164,GSM7823165,GSM7823166,GSM7823167,GSM7823168,GSM7823169,GSM7823170,GSM7823171,GSM7823172,GSM7823173,GSM7823174,GSM7823175,GSM7823176,GSM7823177,GSM7823178,GSM7823179,GSM7823180,GSM7823181,GSM7823182,GSM7823183,GSM7823184,GSM7823185,GSM7823186,GSM7823187,GSM7823188,GSM7823189,GSM7823190,GSM7823191,GSM7823192,GSM7823193,GSM7823194,GSM7823195,GSM7823196,GSM7823197,GSM7823198,GSM7823199,GSM7823200,GSM7823201,GSM7823202,GSM7823203,GSM7823204,GSM7823205,GSM7823206,GSM7823207,GSM7823208
|
| 2 |
+
Lung_Cancer,1.0,1.0,1.0,,1.0,,1.0,,1.0,,1.0,,1.0,1.0,1.0,,1.0,,1.0,,1.0,,1.0,,1.0,,0.0,0.0,0.0,,0.0,,0.0,0.0,,,0.0,,0.0,,0.0,,0.0,,0.0,,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,68.0,71.0,56.0,56.0,64.0,64.0,58.0,58.0,67.0,67.0,64.0,64.0,77.0,57.0,68.0,68.0,61.0,61.0,75.0,75.0,65.0,65.0,69.0,69.0,65.0,65.0,50.0,70.0,57.0,57.0,55.0,55.0,68.0,72.0,72.0,44.0,54.0,54.0,47.0,47.0,69.0,69.0,43.0,43.0,57.0,57.0,53.0,53.0,45.0,46.0,46.0,56.0,56.0,67.0,67.0,70.0,70.0,61.0,61.0,68.0,68.0,56.0,56.0,39.0,39.0,61.0,61.0,48.0,48.0
|
| 4 |
Gender,1.0,0.0,1.0,1.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,0.0,0.0,1.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,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,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
|
output/preprocess/Lung_Cancer/clinical_data/GSE244647.csv
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
,GSM7823140,GSM7823141,GSM7823142,GSM7823143,GSM7823144,GSM7823145,GSM7823146,GSM7823147,GSM7823148,GSM7823149,GSM7823150,GSM7823151,GSM7823152,GSM7823153,GSM7823154,GSM7823155,GSM7823156,GSM7823157,GSM7823158,GSM7823159,GSM7823160,GSM7823161,GSM7823162,GSM7823163,GSM7823164,GSM7823165,GSM7823166,GSM7823167,GSM7823168,GSM7823169,GSM7823170,GSM7823171,GSM7823172,GSM7823173,GSM7823174,GSM7823175,GSM7823176,GSM7823177,GSM7823178,GSM7823179,GSM7823180,GSM7823181,GSM7823182,GSM7823183,GSM7823184,GSM7823185,GSM7823186,GSM7823187,GSM7823188,GSM7823189,GSM7823190,GSM7823191,GSM7823192,GSM7823193,GSM7823194,GSM7823195,GSM7823196,GSM7823197,GSM7823198,GSM7823199,GSM7823200,GSM7823201,GSM7823202,GSM7823203,GSM7823204,GSM7823205,GSM7823206,GSM7823207,GSM7823208
|
| 2 |
-
Lung_Cancer,1.0,1.0,1.0,
|
| 3 |
Age,68.0,71.0,56.0,56.0,64.0,64.0,58.0,58.0,67.0,67.0,64.0,64.0,77.0,57.0,68.0,68.0,61.0,61.0,75.0,75.0,65.0,65.0,69.0,69.0,65.0,65.0,50.0,70.0,57.0,57.0,55.0,55.0,68.0,72.0,72.0,44.0,54.0,54.0,47.0,47.0,69.0,69.0,43.0,43.0,57.0,57.0,53.0,53.0,45.0,46.0,46.0,56.0,56.0,67.0,67.0,70.0,70.0,61.0,61.0,68.0,68.0,56.0,56.0,39.0,39.0,61.0,61.0,48.0,48.0
|
| 4 |
Gender,1.0,0.0,1.0,1.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,0.0,0.0,1.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,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,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
|
|
|
|
| 1 |
,GSM7823140,GSM7823141,GSM7823142,GSM7823143,GSM7823144,GSM7823145,GSM7823146,GSM7823147,GSM7823148,GSM7823149,GSM7823150,GSM7823151,GSM7823152,GSM7823153,GSM7823154,GSM7823155,GSM7823156,GSM7823157,GSM7823158,GSM7823159,GSM7823160,GSM7823161,GSM7823162,GSM7823163,GSM7823164,GSM7823165,GSM7823166,GSM7823167,GSM7823168,GSM7823169,GSM7823170,GSM7823171,GSM7823172,GSM7823173,GSM7823174,GSM7823175,GSM7823176,GSM7823177,GSM7823178,GSM7823179,GSM7823180,GSM7823181,GSM7823182,GSM7823183,GSM7823184,GSM7823185,GSM7823186,GSM7823187,GSM7823188,GSM7823189,GSM7823190,GSM7823191,GSM7823192,GSM7823193,GSM7823194,GSM7823195,GSM7823196,GSM7823197,GSM7823198,GSM7823199,GSM7823200,GSM7823201,GSM7823202,GSM7823203,GSM7823204,GSM7823205,GSM7823206,GSM7823207,GSM7823208
|
| 2 |
+
Lung_Cancer,1.0,1.0,1.0,,1.0,,1.0,,1.0,,1.0,,1.0,1.0,1.0,,1.0,,1.0,,1.0,,1.0,,1.0,,0.0,0.0,0.0,,0.0,,0.0,0.0,,,0.0,,0.0,,0.0,,0.0,,0.0,,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,68.0,71.0,56.0,56.0,64.0,64.0,58.0,58.0,67.0,67.0,64.0,64.0,77.0,57.0,68.0,68.0,61.0,61.0,75.0,75.0,65.0,65.0,69.0,69.0,65.0,65.0,50.0,70.0,57.0,57.0,55.0,55.0,68.0,72.0,72.0,44.0,54.0,54.0,47.0,47.0,69.0,69.0,43.0,43.0,57.0,57.0,53.0,53.0,45.0,46.0,46.0,56.0,56.0,67.0,67.0,70.0,70.0,61.0,61.0,68.0,68.0,56.0,56.0,39.0,39.0,61.0,61.0,48.0,48.0
|
| 4 |
Gender,1.0,0.0,1.0,1.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,0.0,0.0,1.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,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,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
|
output/preprocess/Lung_Cancer/clinical_data/GSE249262.csv
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
,GSM7932467,GSM7932468,GSM7932469,GSM7932470,GSM7932471,GSM7932472,GSM7932473,GSM7932474,GSM7932475,GSM7932476,GSM7932477,GSM7932478,GSM7932479,GSM7932480,GSM7932481,GSM7932482,GSM7932483,GSM7932484,GSM7932485,GSM7932486,GSM7932487,GSM7932488,GSM7932489,GSM7932490,GSM7932491,GSM7932492,GSM7932493,GSM7932494,GSM7932495,GSM7932496,GSM7932497,GSM7932498,GSM7932499,GSM7932500,GSM7932501,GSM7932502,GSM7932503,GSM7932504,GSM7932505,GSM7932506,GSM7932507,GSM7932508,GSM7932509,GSM7932510,GSM7932511,GSM7932512,GSM7932513,GSM7932514,GSM7932515,GSM7932516,GSM7932517,GSM7932518,GSM7932519,GSM7932520,GSM7932521,GSM7932522,GSM7932523,GSM7932524,GSM7932525,GSM7932526,GSM7932527,
|
| 2 |
-
Lung_Cancer,1.0,1.0,
|
|
|
|
| 1 |
+
,GSM7932467,GSM7932468,GSM7932469,GSM7932470,GSM7932471,GSM7932472,GSM7932473,GSM7932474,GSM7932475,GSM7932476,GSM7932477,GSM7932478,GSM7932479,GSM7932480,GSM7932481,GSM7932482,GSM7932483,GSM7932484,GSM7932485,GSM7932486,GSM7932487,GSM7932488,GSM7932489,GSM7932490,GSM7932491,GSM7932492,GSM7932493,GSM7932494,GSM7932495,GSM7932496,GSM7932497,GSM7932498,GSM7932499,GSM7932500,GSM7932501,GSM7932502,GSM7932503,GSM7932504,GSM7932505,GSM7932506,GSM7932507,GSM7932508,GSM7932509,GSM7932510,GSM7932511,GSM7932512,GSM7932513,GSM7932514,GSM7932515,GSM7932516,GSM7932517,GSM7932518,GSM7932519,GSM7932520,GSM7932521,GSM7932522,GSM7932523,GSM7932524,GSM7932525,GSM7932526,GSM7932527,GSM7932534,GSM7932535,GSM7932536,GSM7932537,GSM7932538,GSM7932539,GSM7932540,GSM7932541,GSM7932542
|
| 2 |
+
Lung_Cancer,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.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
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lung_Cancer"
|
| 6 |
+
cohort = "GSE21359"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE21359"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE21359.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE21359.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE21359.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 math
|
| 41 |
+
import pandas as pd
|
| 42 |
+
from typing import Optional
|
| 43 |
+
|
| 44 |
+
# 1) Gene expression data availability
|
| 45 |
+
# Affymetrix arrays used for airway epithelium gene expression => mRNA microarray
|
| 46 |
+
is_gene_available = True
|
| 47 |
+
|
| 48 |
+
# 2) Variable Availability and Conversion Functions
|
| 49 |
+
|
| 50 |
+
# Trait (Lung_Cancer): not present in sample characteristics; cannot be reliably inferred
|
| 51 |
+
trait_row: Optional[int] = None
|
| 52 |
+
|
| 53 |
+
# Age is available under key 0
|
| 54 |
+
age_row: Optional[int] = 0
|
| 55 |
+
|
| 56 |
+
# Gender is available under key 1
|
| 57 |
+
gender_row: Optional[int] = 1
|
| 58 |
+
|
| 59 |
+
def _extract_value_after_colon(x):
|
| 60 |
+
if x is None or (isinstance(x, float) and math.isnan(x)):
|
| 61 |
+
return None
|
| 62 |
+
s = str(x).strip()
|
| 63 |
+
parts = s.split(':', 1)
|
| 64 |
+
return parts[1].strip() if len(parts) > 1 else s
|
| 65 |
+
|
| 66 |
+
def convert_trait(x):
|
| 67 |
+
# Lung cancer status not available in this dataset; return None
|
| 68 |
+
return None
|
| 69 |
+
|
| 70 |
+
def convert_age(x):
|
| 71 |
+
val = _extract_value_after_colon(x)
|
| 72 |
+
if val is None:
|
| 73 |
+
return None
|
| 74 |
+
# Extract first numeric token
|
| 75 |
+
num = None
|
| 76 |
+
tmp = ''
|
| 77 |
+
for ch in val:
|
| 78 |
+
if ch.isdigit():
|
| 79 |
+
tmp += ch
|
| 80 |
+
elif tmp:
|
| 81 |
+
break
|
| 82 |
+
if tmp == '':
|
| 83 |
+
return None
|
| 84 |
+
try:
|
| 85 |
+
num = int(tmp)
|
| 86 |
+
except Exception:
|
| 87 |
+
return None
|
| 88 |
+
if 0 <= num <= 120:
|
| 89 |
+
return num
|
| 90 |
+
return None
|
| 91 |
+
|
| 92 |
+
def convert_gender(x):
|
| 93 |
+
val = _extract_value_after_colon(x)
|
| 94 |
+
if val is None:
|
| 95 |
+
return None
|
| 96 |
+
v = val.strip().lower()
|
| 97 |
+
if v in {'m', 'male'}:
|
| 98 |
+
return 1
|
| 99 |
+
if v in {'f', 'female'}:
|
| 100 |
+
return 0
|
| 101 |
+
# Heuristic for occasional typos
|
| 102 |
+
if v.startswith('m'):
|
| 103 |
+
return 1
|
| 104 |
+
if v.startswith('f'):
|
| 105 |
+
return 0
|
| 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 (skip if trait_row is None)
|
| 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 |
+
preview = preview_df(selected_clinical_df, n=5)
|
| 131 |
+
print("Preview of selected clinical features:", preview)
|
| 132 |
+
|
| 133 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 134 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 135 |
+
else:
|
| 136 |
+
print("Trait data not available for this cohort; skipping clinical feature extraction.")
|
output/preprocess/Lung_Cancer/code/GSE222124.py
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lung_Cancer"
|
| 6 |
+
cohort = "GSE222124"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE222124"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE222124.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE222124.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE222124.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 |
+
# Determine data availability based on provided background and sample characteristics
|
| 40 |
+
is_gene_available = True # Series explicitly mentions "Gene expression alterations", not miRNA-only or methylation-only
|
| 41 |
+
trait_row = None # No human Lung_Cancer phenotype; this is a cell-line treatment study
|
| 42 |
+
age_row = None # No age information present
|
| 43 |
+
gender_row = None # No gender information present
|
| 44 |
+
|
| 45 |
+
# Define conversion functions (not used here because trait_row/age_row/gender_row are None)
|
| 46 |
+
def _after_colon(value):
|
| 47 |
+
if value is None:
|
| 48 |
+
return None
|
| 49 |
+
if isinstance(value, str):
|
| 50 |
+
parts = value.split(":", 1)
|
| 51 |
+
v = parts[1] if len(parts) == 2 else parts[0]
|
| 52 |
+
v = v.strip().strip('"').strip()
|
| 53 |
+
return v if v != "" else None
|
| 54 |
+
return value
|
| 55 |
+
|
| 56 |
+
def convert_trait(v):
|
| 57 |
+
# Binary: 1 = Lung cancer case; 0 = control/normal. Heuristic keyword-based mapping for human data.
|
| 58 |
+
val = _after_colon(v)
|
| 59 |
+
if val is None:
|
| 60 |
+
return None
|
| 61 |
+
s = str(val).lower()
|
| 62 |
+
# Positive (cancer)
|
| 63 |
+
cancer_keys = ["nsclc", "non-small-cell", "non small cell", "lung cancer", "adenocarcinoma", "squamous", "tumor", "cancer", "carcinoma"]
|
| 64 |
+
# Negative (control)
|
| 65 |
+
control_keys = ["normal", "control", "healthy", "adjacent normal", "non-cancer", "non cancer", "noncancer"]
|
| 66 |
+
if any(k in s for k in cancer_keys):
|
| 67 |
+
return 1
|
| 68 |
+
if any(k in s for k in control_keys):
|
| 69 |
+
return 0
|
| 70 |
+
# Unknown or irrelevant fields (e.g., cell-line treatment) -> None
|
| 71 |
+
return None
|
| 72 |
+
|
| 73 |
+
def convert_age(v):
|
| 74 |
+
# Continuous age in years
|
| 75 |
+
val = _after_colon(v)
|
| 76 |
+
if val is None:
|
| 77 |
+
return None
|
| 78 |
+
s = str(val).lower()
|
| 79 |
+
# Extract first float/integer from the string
|
| 80 |
+
import re
|
| 81 |
+
m = re.search(r"(\d+(\.\d+)?)", s)
|
| 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(v):
|
| 90 |
+
# Binary: female=0, male=1
|
| 91 |
+
val = _after_colon(v)
|
| 92 |
+
if val is None:
|
| 93 |
+
return None
|
| 94 |
+
s = str(val).strip().lower()
|
| 95 |
+
if s in {"male", "m", "man"}:
|
| 96 |
+
return 1
|
| 97 |
+
if s in {"female", "f", "woman"}:
|
| 98 |
+
return 0
|
| 99 |
+
return None
|
| 100 |
+
|
| 101 |
+
# Initial filtering and save metadata
|
| 102 |
+
is_trait_available = trait_row is not None
|
| 103 |
+
_ = validate_and_save_cohort_info(
|
| 104 |
+
is_final=False,
|
| 105 |
+
cohort=cohort,
|
| 106 |
+
info_path=json_path,
|
| 107 |
+
is_gene_available=is_gene_available,
|
| 108 |
+
is_trait_available=is_trait_available
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
# Clinical feature extraction is skipped because trait_row is None (no human clinical data available)
|
| 112 |
+
# If in a different scenario trait_row were not None, we would use:
|
| 113 |
+
# selected_clinical_df = geo_select_clinical_features(clinical_data, trait, trait_row, convert_trait,
|
| 114 |
+
# age_row=age_row, convert_age=convert_age,
|
| 115 |
+
# gender_row=gender_row, convert_gender=convert_gender)
|
| 116 |
+
# preview = preview_df(selected_clinical_df)
|
| 117 |
+
# os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 118 |
+
# selected_clinical_df.to_csv(out_clinical_data_file)
|
output/preprocess/Lung_Cancer/code/GSE244117.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lung_Cancer"
|
| 6 |
+
cohort = "GSE244117"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE244117"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE244117.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE244117.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE244117.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 |
+
# Step 1: Determine gene expression availability
|
| 40 |
+
# Based on NanoString GeoMx DSP Whole Transcriptome Atlas (WTA), this is gene expression data.
|
| 41 |
+
is_gene_available = True
|
| 42 |
+
|
| 43 |
+
# Step 2: Variable availability and converters
|
| 44 |
+
# From Sample Characteristics Dictionary:
|
| 45 |
+
# 0: tissue (all ONB) -> not relevant to Lung_Cancer status
|
| 46 |
+
# 1: grade (II/III/IV/normal) -> not Lung_Cancer; cohort not about lung cancer
|
| 47 |
+
# 2: Stage (A/C/D/na) -> not Lung_Cancer
|
| 48 |
+
# 3: location -> not Lung_Cancer
|
| 49 |
+
# 4: Sex: M/F -> gender available
|
| 50 |
+
# 5: age: numbers -> age available
|
| 51 |
+
|
| 52 |
+
trait_row = None # No Lung_Cancer status available in this ONB dataset
|
| 53 |
+
age_row = 5
|
| 54 |
+
gender_row = 4
|
| 55 |
+
|
| 56 |
+
def _after_colon(x):
|
| 57 |
+
if x is None:
|
| 58 |
+
return None
|
| 59 |
+
if isinstance(x, str):
|
| 60 |
+
parts = x.split(":", 1)
|
| 61 |
+
return parts[1].strip() if len(parts) == 2 else x.strip()
|
| 62 |
+
return x
|
| 63 |
+
|
| 64 |
+
# Choose data types:
|
| 65 |
+
# trait: binary (case/control) – not available
|
| 66 |
+
# age: continuous
|
| 67 |
+
# gender: binary (female=0, male=1)
|
| 68 |
+
|
| 69 |
+
def convert_trait(x):
|
| 70 |
+
# Trait (Lung_Cancer) not available in this dataset; return None for any input.
|
| 71 |
+
return None
|
| 72 |
+
|
| 73 |
+
def convert_age(x):
|
| 74 |
+
v = _after_colon(x)
|
| 75 |
+
if v is None:
|
| 76 |
+
return None
|
| 77 |
+
v = str(v).strip()
|
| 78 |
+
if v.lower() in {"na", "n/a", "nan", "none", "unknown", ""}:
|
| 79 |
+
return None
|
| 80 |
+
# Keep only leading numeric portion
|
| 81 |
+
try:
|
| 82 |
+
val = float(v)
|
| 83 |
+
return val
|
| 84 |
+
except Exception:
|
| 85 |
+
# Attempt to extract digits
|
| 86 |
+
import re
|
| 87 |
+
m = re.search(r"[-+]?\d*\.?\d+", v)
|
| 88 |
+
if m:
|
| 89 |
+
try:
|
| 90 |
+
return float(m.group(0))
|
| 91 |
+
except Exception:
|
| 92 |
+
return None
|
| 93 |
+
return None
|
| 94 |
+
|
| 95 |
+
def convert_gender(x):
|
| 96 |
+
v = _after_colon(x)
|
| 97 |
+
if v is None:
|
| 98 |
+
return None
|
| 99 |
+
v = str(v).strip().lower()
|
| 100 |
+
if v in {"f", "female", "woman", "women"}:
|
| 101 |
+
return 0
|
| 102 |
+
if v in {"m", "male", "man", "men"}:
|
| 103 |
+
return 1
|
| 104 |
+
return None
|
| 105 |
+
|
| 106 |
+
# Step 3: Initial filtering 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 |
+
# Step 4: Clinical feature extraction (skip because trait_row is None)
|
| 117 |
+
# If trait_row were available:
|
| 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)
|
| 129 |
+
# os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 130 |
+
# selected_clinical_df.to_csv(out_clinical_data_file)
|
output/preprocess/Lung_Cancer/code/GSE244123.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lung_Cancer"
|
| 6 |
+
cohort = "GSE244123"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE244123"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE244123.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE244123.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE244123.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 json
|
| 41 |
+
|
| 42 |
+
# 1) Gene expression data availability
|
| 43 |
+
is_gene_available = True # Likely gene expression data; not miRNA/methylation based on context.
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability
|
| 46 |
+
# From the provided Sample Characteristics Dictionary:
|
| 47 |
+
# 0: tissue (constant, and not lung cancer) -> not usable for Lung_Cancer trait
|
| 48 |
+
# 5: age, 4: Sex
|
| 49 |
+
trait_row = None # No usable Lung_Cancer case/control variation present
|
| 50 |
+
age_row = 5
|
| 51 |
+
gender_row = 4
|
| 52 |
+
|
| 53 |
+
# 2.2) Converters
|
| 54 |
+
def _extract_value(x: str) -> str:
|
| 55 |
+
if x is None:
|
| 56 |
+
return ""
|
| 57 |
+
parts = str(x).split(":", 1)
|
| 58 |
+
return parts[1].strip() if len(parts) == 2 else str(x).strip()
|
| 59 |
+
|
| 60 |
+
def convert_trait(x) -> int:
|
| 61 |
+
"""
|
| 62 |
+
Convert to binary Lung_Cancer: 1=yes, 0=no.
|
| 63 |
+
Heuristic keyword detection; not used here since trait_row is None.
|
| 64 |
+
"""
|
| 65 |
+
val = _extract_value(x).lower()
|
| 66 |
+
if not val:
|
| 67 |
+
return None
|
| 68 |
+
# Positive lung cancer indicators
|
| 69 |
+
pos_kw = [
|
| 70 |
+
"lung cancer", "lung", "pulmonary", "bronch", "sclc", "small cell lung",
|
| 71 |
+
"nsclc", "adenocarcinoma", "squamous cell", "luad", "lusc"
|
| 72 |
+
]
|
| 73 |
+
# Negative indicators commonly seen in this dataset
|
| 74 |
+
neg_kw = ["olfactory neuroblastoma", "onb", "normal"]
|
| 75 |
+
if any(k in val for k in pos_kw):
|
| 76 |
+
# Avoid false positives where 'lung' appears as part of neg terms
|
| 77 |
+
if any(k in val for k in neg_kw):
|
| 78 |
+
return 0
|
| 79 |
+
return 1
|
| 80 |
+
if any(k in val for k in neg_kw):
|
| 81 |
+
return 0
|
| 82 |
+
# Unknown context -> None
|
| 83 |
+
return None
|
| 84 |
+
|
| 85 |
+
def convert_age(x):
|
| 86 |
+
val = _extract_value(x)
|
| 87 |
+
if not val:
|
| 88 |
+
return None
|
| 89 |
+
m = re.search(r"[-+]?\d*\.?\d+", val)
|
| 90 |
+
if not m:
|
| 91 |
+
return None
|
| 92 |
+
try:
|
| 93 |
+
a = float(m.group())
|
| 94 |
+
# Return int if it's a whole number to keep dataset clean
|
| 95 |
+
return int(a) if a.is_integer() else a
|
| 96 |
+
except Exception:
|
| 97 |
+
return None
|
| 98 |
+
|
| 99 |
+
def convert_gender(x):
|
| 100 |
+
val = _extract_value(x).lower()
|
| 101 |
+
if not val:
|
| 102 |
+
return None
|
| 103 |
+
if val in {"m", "male"}:
|
| 104 |
+
return 1
|
| 105 |
+
if val in {"f", "female"}:
|
| 106 |
+
return 0
|
| 107 |
+
return None
|
| 108 |
+
|
| 109 |
+
# 3) Save metadata (initial filtering)
|
| 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 (skip if trait not available)
|
| 120 |
+
if trait_row is not None:
|
| 121 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 122 |
+
clinical_df=clinical_data,
|
| 123 |
+
trait=trait,
|
| 124 |
+
trait_row=trait_row,
|
| 125 |
+
convert_trait=convert_trait,
|
| 126 |
+
age_row=age_row,
|
| 127 |
+
convert_age=convert_age,
|
| 128 |
+
gender_row=gender_row,
|
| 129 |
+
convert_gender=convert_gender
|
| 130 |
+
)
|
| 131 |
+
preview = preview_df(selected_clinical_df)
|
| 132 |
+
print(json.dumps(preview, indent=2))
|
| 133 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 134 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=False)
|
output/preprocess/Lung_Cancer/code/GSE244645.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lung_Cancer"
|
| 6 |
+
cohort = "GSE244645"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE244645"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE244645.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE244645.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE244645.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 # Microarray-based platelet gene expression
|
| 43 |
+
|
| 44 |
+
# 2) Variable availability and converters
|
| 45 |
+
trait_row = 2 # histology
|
| 46 |
+
age_row = 5 # age
|
| 47 |
+
gender_row = 4 # Sex
|
| 48 |
+
|
| 49 |
+
def _after_colon(x):
|
| 50 |
+
if x is None:
|
| 51 |
+
return ''
|
| 52 |
+
s = str(x)
|
| 53 |
+
parts = s.split(':', 1)
|
| 54 |
+
return parts[1].strip() if len(parts) > 1 else s.strip()
|
| 55 |
+
|
| 56 |
+
def convert_trait(x):
|
| 57 |
+
v = _after_colon(x).lower()
|
| 58 |
+
# Unknown/placeholder values -> None
|
| 59 |
+
if v in {'', '-', 'na', 'n/a', 'no information', 'none'}:
|
| 60 |
+
return None
|
| 61 |
+
# Lung cancer positive
|
| 62 |
+
if 'lung' in v:
|
| 63 |
+
return 1
|
| 64 |
+
# Non-lung head and neck cancers -> 0
|
| 65 |
+
if any(substr in v for substr in ['larynx', 'orofar', 'head and neck', 'hnscc']):
|
| 66 |
+
return 0
|
| 67 |
+
if 'squamous cell carcinoma' in v and 'lung' not in v:
|
| 68 |
+
return 0
|
| 69 |
+
# Default non-lung
|
| 70 |
+
return 0
|
| 71 |
+
|
| 72 |
+
def convert_age(x):
|
| 73 |
+
v = _after_colon(x)
|
| 74 |
+
try:
|
| 75 |
+
age = float(v)
|
| 76 |
+
return age
|
| 77 |
+
except Exception:
|
| 78 |
+
return None
|
| 79 |
+
|
| 80 |
+
def convert_gender(x):
|
| 81 |
+
v = _after_colon(x).lower()
|
| 82 |
+
if v in {'male', 'm'}:
|
| 83 |
+
return 1
|
| 84 |
+
if v in {'female', 'f'}:
|
| 85 |
+
return 0
|
| 86 |
+
return None
|
| 87 |
+
|
| 88 |
+
# 3) Initial filtering and metadata saving
|
| 89 |
+
is_trait_available = trait_row is not None
|
| 90 |
+
_ = validate_and_save_cohort_info(
|
| 91 |
+
is_final=False,
|
| 92 |
+
cohort=cohort,
|
| 93 |
+
info_path=json_path,
|
| 94 |
+
is_gene_available=is_gene_available,
|
| 95 |
+
is_trait_available=is_trait_available
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
# 4) Clinical feature extraction (only if trait is available)
|
| 99 |
+
if is_trait_available:
|
| 100 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 101 |
+
clinical_df=clinical_data,
|
| 102 |
+
trait=trait,
|
| 103 |
+
trait_row=trait_row,
|
| 104 |
+
convert_trait=convert_trait,
|
| 105 |
+
age_row=age_row,
|
| 106 |
+
convert_age=convert_age,
|
| 107 |
+
gender_row=gender_row,
|
| 108 |
+
convert_gender=convert_gender
|
| 109 |
+
)
|
| 110 |
+
preview = preview_df(selected_clinical_df)
|
| 111 |
+
print(preview)
|
| 112 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 113 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 114 |
+
|
| 115 |
+
# Step 3: Gene Data Extraction
|
| 116 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 117 |
+
gene_data = get_genetic_data(matrix_file)
|
| 118 |
+
|
| 119 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 120 |
+
print(gene_data.index[:20])
|
| 121 |
+
|
| 122 |
+
# Step 4: Gene Identifier Review
|
| 123 |
+
requires_gene_mapping = True
|
| 124 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 125 |
+
|
| 126 |
+
# Step 5: Gene Annotation
|
| 127 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 128 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 129 |
+
|
| 130 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 131 |
+
print("Gene annotation preview:")
|
| 132 |
+
print(preview_df(gene_annotation))
|
| 133 |
+
|
| 134 |
+
# Step 6: Gene Identifier Mapping
|
| 135 |
+
# Determine appropriate columns for probe IDs and gene symbols in the annotation
|
| 136 |
+
probe_id_col = 'ID' if 'ID' in gene_annotation.columns else 'probeset_id'
|
| 137 |
+
|
| 138 |
+
# Prefer explicit gene symbol columns if present; otherwise use the rich annotation field
|
| 139 |
+
gene_symbol_candidates = ['gene_symbol', 'GENE_SYMBOL', 'SYMBOL', 'Gene Symbol', 'gene', 'GeneName', 'SPOT_ID.1']
|
| 140 |
+
gene_symbol_col = next((c for c in gene_symbol_candidates if c in gene_annotation.columns), None)
|
| 141 |
+
if gene_symbol_col is None:
|
| 142 |
+
raise ValueError("No suitable gene symbol column found in gene annotation.")
|
| 143 |
+
|
| 144 |
+
# Build mapping dataframe
|
| 145 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_id_col, gene_col=gene_symbol_col)
|
| 146 |
+
|
| 147 |
+
# Apply mapping to convert probe-level data to gene-level expression
|
| 148 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 149 |
+
|
| 150 |
+
# Step 7: Data Normalization and Linking
|
| 151 |
+
import os
|
| 152 |
+
|
| 153 |
+
# 1. Normalize gene symbols and save gene-level data
|
| 154 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 155 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 156 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 157 |
+
|
| 158 |
+
# 2. Link the clinical and genetic data
|
| 159 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 160 |
+
|
| 161 |
+
# 3. Handle missing values in the linked data
|
| 162 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 163 |
+
|
| 164 |
+
# 4. Determine whether the trait and demographic features are biased; remove biased demos
|
| 165 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 166 |
+
|
| 167 |
+
# Ensure pure-Python booleans to avoid numpy.bool_ serialization issues
|
| 168 |
+
is_gene_available_final = bool(normalized_gene_data.shape[0] > 0)
|
| 169 |
+
is_trait_available_final = bool((trait in linked_data.columns) and bool(linked_data[trait].notna().any()))
|
| 170 |
+
is_trait_biased = bool(is_trait_biased)
|
| 171 |
+
|
| 172 |
+
# 5. Final validation and saving cohort info with robustness against JSON serialization issues
|
| 173 |
+
note = ("INFO: Platelet microarray dataset; trait derived from histology (Lung vs HNSCC). "
|
| 174 |
+
"Samples include pre/post-treatment timepoints.")
|
| 175 |
+
try:
|
| 176 |
+
is_usable = validate_and_save_cohort_info(
|
| 177 |
+
is_final=True,
|
| 178 |
+
cohort=cohort,
|
| 179 |
+
info_path=json_path,
|
| 180 |
+
is_gene_available=is_gene_available_final,
|
| 181 |
+
is_trait_available=is_trait_available_final,
|
| 182 |
+
is_biased=is_trait_biased,
|
| 183 |
+
df=unbiased_linked_data,
|
| 184 |
+
note=note
|
| 185 |
+
)
|
| 186 |
+
except TypeError as e:
|
| 187 |
+
# Handle potential numpy.bool_ or other non-serializable objects lingering in the JSON file
|
| 188 |
+
if 'JSON serializable' in str(e):
|
| 189 |
+
if os.path.exists(json_path):
|
| 190 |
+
os.remove(json_path)
|
| 191 |
+
is_usable = validate_and_save_cohort_info(
|
| 192 |
+
is_final=True,
|
| 193 |
+
cohort=cohort,
|
| 194 |
+
info_path=json_path,
|
| 195 |
+
is_gene_available=is_gene_available_final,
|
| 196 |
+
is_trait_available=is_trait_available_final,
|
| 197 |
+
is_biased=is_trait_biased,
|
| 198 |
+
df=unbiased_linked_data,
|
| 199 |
+
note=note
|
| 200 |
+
)
|
| 201 |
+
else:
|
| 202 |
+
raise
|
| 203 |
+
|
| 204 |
+
# 6. Save the linked data 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/Lung_Cancer/code/GSE244647.py
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
cohort = "GSE244647"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE244647"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE244647.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE244647.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE244647.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 |
+
import numpy as np
|
| 42 |
+
|
| 43 |
+
# 1. Gene expression data availability (based on background info, likely mRNA/RNA-seq rather than pure miRNA/methylation)
|
| 44 |
+
is_gene_available = True
|
| 45 |
+
|
| 46 |
+
# 2. Variable availability
|
| 47 |
+
trait_row = 2 # 'histology' indicates if it's lung cancer vs other cancers
|
| 48 |
+
age_row = 5 # 'age'
|
| 49 |
+
gender_row = 4 # 'Sex'
|
| 50 |
+
|
| 51 |
+
def _after_colon(x):
|
| 52 |
+
if x is None:
|
| 53 |
+
return None
|
| 54 |
+
s = str(x)
|
| 55 |
+
if ":" in s:
|
| 56 |
+
s = s.split(":", 1)[1]
|
| 57 |
+
return s.strip()
|
| 58 |
+
|
| 59 |
+
# 2.2 Data type conversion functions
|
| 60 |
+
def convert_trait(x):
|
| 61 |
+
"""
|
| 62 |
+
Binary: 1 = Lung cancer (histology mentions 'lung'), 0 = non-lung cancer;
|
| 63 |
+
Unknowns like '-', 'no information' -> None
|
| 64 |
+
"""
|
| 65 |
+
v = _after_colon(x)
|
| 66 |
+
if v is None:
|
| 67 |
+
return None
|
| 68 |
+
s = v.strip().lower()
|
| 69 |
+
if s in {"", "-", "no information", "na", "n/a", "none"}:
|
| 70 |
+
return None
|
| 71 |
+
if "lung" in s:
|
| 72 |
+
return 1
|
| 73 |
+
# Any explicit non-lung histology present -> 0
|
| 74 |
+
return 0
|
| 75 |
+
|
| 76 |
+
def convert_age(x):
|
| 77 |
+
"""
|
| 78 |
+
Continuous: numeric age
|
| 79 |
+
"""
|
| 80 |
+
v = _after_colon(x)
|
| 81 |
+
if v is None:
|
| 82 |
+
return None
|
| 83 |
+
s = v.strip()
|
| 84 |
+
try:
|
| 85 |
+
return float(s)
|
| 86 |
+
except Exception:
|
| 87 |
+
return None
|
| 88 |
+
|
| 89 |
+
def convert_gender(x):
|
| 90 |
+
"""
|
| 91 |
+
Binary: female -> 0, male -> 1
|
| 92 |
+
"""
|
| 93 |
+
v = _after_colon(x)
|
| 94 |
+
if v is None:
|
| 95 |
+
return None
|
| 96 |
+
s = v.strip().lower()
|
| 97 |
+
if s in {"male", "m"}:
|
| 98 |
+
return 1
|
| 99 |
+
if s in {"female", "f"}:
|
| 100 |
+
return 0
|
| 101 |
+
return None
|
| 102 |
+
|
| 103 |
+
# 3. Save metadata (initial filtering)
|
| 104 |
+
is_trait_available = trait_row is not None
|
| 105 |
+
_ = validate_and_save_cohort_info(
|
| 106 |
+
is_final=False,
|
| 107 |
+
cohort=cohort,
|
| 108 |
+
info_path=json_path,
|
| 109 |
+
is_gene_available=is_gene_available,
|
| 110 |
+
is_trait_available=is_trait_available
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
# 4. Clinical feature extraction (only if trait data available)
|
| 114 |
+
if trait_row is not None:
|
| 115 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 116 |
+
clinical_df=clinical_data,
|
| 117 |
+
trait=trait,
|
| 118 |
+
trait_row=trait_row,
|
| 119 |
+
convert_trait=convert_trait,
|
| 120 |
+
age_row=age_row,
|
| 121 |
+
convert_age=convert_age,
|
| 122 |
+
gender_row=gender_row,
|
| 123 |
+
convert_gender=convert_gender
|
| 124 |
+
)
|
| 125 |
+
preview = preview_df(selected_clinical_df, n=5)
|
| 126 |
+
print(preview)
|
| 127 |
+
|
| 128 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 129 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 130 |
+
|
| 131 |
+
# Step 3: Gene Data Extraction
|
| 132 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 133 |
+
gene_data = get_genetic_data(matrix_file)
|
| 134 |
+
|
| 135 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 136 |
+
print(gene_data.index[:20])
|
| 137 |
+
|
| 138 |
+
# Step 4: Gene Identifier Review
|
| 139 |
+
print("requires_gene_mapping = True")
|
| 140 |
+
|
| 141 |
+
# Step 5: Gene Annotation
|
| 142 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 143 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 144 |
+
|
| 145 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 146 |
+
print("Gene annotation preview:")
|
| 147 |
+
print(preview_df(gene_annotation))
|
| 148 |
+
|
| 149 |
+
# Step 6: Gene Identifier Mapping
|
| 150 |
+
import os
|
| 151 |
+
import pandas as pd
|
| 152 |
+
|
| 153 |
+
# Build two views of the expression index: full and base-without-suffix (before first dot)
|
| 154 |
+
expr_full = gene_data.copy()
|
| 155 |
+
expr_base = gene_data.copy()
|
| 156 |
+
expr_base.index = expr_base.index.to_series().astype(str).str.split('.', n=1, expand=True)[0]
|
| 157 |
+
expr_base = expr_base.groupby(expr_base.index).mean()
|
| 158 |
+
|
| 159 |
+
expr_ids_full = set(expr_full.index.astype(str))
|
| 160 |
+
expr_ids_base = set(expr_base.index.astype(str))
|
| 161 |
+
|
| 162 |
+
# Enumerate SOFT files in cohort directory
|
| 163 |
+
soft_files = [f for f in os.listdir(in_cohort_dir) if 'soft' in f.lower()]
|
| 164 |
+
|
| 165 |
+
# Helper: strong priority list for gene symbol columns (deterministic; no heuristic unless none found)
|
| 166 |
+
symbol_priority = [
|
| 167 |
+
'Gene Symbol', 'GENE_SYMBOL', 'SYMBOL', 'Symbol', 'gene_symbol',
|
| 168 |
+
'Gene', 'Gene Name', 'Associated Gene Name', 'gene_assignment'
|
| 169 |
+
]
|
| 170 |
+
# Columns we should avoid using as gene symbol sources unless absolutely nothing else works
|
| 171 |
+
banned_symbol_cols = set([
|
| 172 |
+
'Genome Context', 'Alignments', 'Transcript ID(Array Design)', 'Sequence Type',
|
| 173 |
+
'Species Scientific Name', 'Species', 'Organism', 'Sequence', 'Target Genes',
|
| 174 |
+
'Clustered miRNAs within 10kb', 'Accession_ID', 'Accession'
|
| 175 |
+
])
|
| 176 |
+
|
| 177 |
+
def _select_id_column(ann: pd.DataFrame) -> tuple[str, bool, int]:
|
| 178 |
+
"""Return best ID column, whether to use base IDs, and overlap count."""
|
| 179 |
+
best_col, best_overlap, use_base = None, 0, False
|
| 180 |
+
for col in ann.columns:
|
| 181 |
+
col_vals = set(ann[col].astype(str).str.strip())
|
| 182 |
+
over_full = len(col_vals & expr_ids_full)
|
| 183 |
+
over_base = len(col_vals & expr_ids_base)
|
| 184 |
+
if over_full > best_overlap or over_base > best_overlap:
|
| 185 |
+
if over_full >= over_base:
|
| 186 |
+
best_col, best_overlap, use_base = col, over_full, False
|
| 187 |
+
else:
|
| 188 |
+
best_col, best_overlap, use_base = col, over_base, True
|
| 189 |
+
return best_col, use_base, best_overlap
|
| 190 |
+
|
| 191 |
+
def _candidate_symbol_cols(ann: pd.DataFrame) -> list:
|
| 192 |
+
cols = list(ann.columns)
|
| 193 |
+
# First, deterministic priority
|
| 194 |
+
ordered = [c for c in symbol_priority if c in cols]
|
| 195 |
+
# Then, other columns that are not banned
|
| 196 |
+
others = [c for c in cols if c not in ordered and c not in banned_symbol_cols]
|
| 197 |
+
return ordered + others
|
| 198 |
+
|
| 199 |
+
def _try_mapping(annotation_subset: pd.DataFrame, id_col: str, sym_col: str, expression_df: pd.DataFrame) -> tuple[pd.DataFrame, int]:
|
| 200 |
+
"""Apply mapping using a specific symbol column, normalize symbols, and return (df, n_genes)."""
|
| 201 |
+
try:
|
| 202 |
+
mapping_df_raw = get_gene_mapping(annotation_subset, prob_col=id_col, gene_col=sym_col)
|
| 203 |
+
if len(mapping_df_raw) == 0:
|
| 204 |
+
return pd.DataFrame(), 0
|
| 205 |
+
# Filter mapping to IDs present in the expression_df
|
| 206 |
+
mapping_df_raw = mapping_df_raw[mapping_df_raw['ID'].astype(str).isin(expression_df.index.astype(str))]
|
| 207 |
+
if len(mapping_df_raw) == 0:
|
| 208 |
+
return pd.DataFrame(), 0
|
| 209 |
+
gene_expr = apply_gene_mapping(expression_df=expression_df, mapping_df=mapping_df_raw)
|
| 210 |
+
if gene_expr is None or len(gene_expr) == 0:
|
| 211 |
+
return pd.DataFrame(), 0
|
| 212 |
+
# Normalize gene symbols to human canonical symbols and aggregate
|
| 213 |
+
try:
|
| 214 |
+
gene_expr_norm = normalize_gene_symbols_in_index(gene_expr)
|
| 215 |
+
except Exception:
|
| 216 |
+
# If normalization resource missing or fails, fallback to unnormalized
|
| 217 |
+
gene_expr_norm = gene_expr
|
| 218 |
+
n_genes = gene_expr_norm.shape[0]
|
| 219 |
+
return gene_expr_norm, n_genes
|
| 220 |
+
except Exception:
|
| 221 |
+
return pd.DataFrame(), 0
|
| 222 |
+
|
| 223 |
+
best_overall = {
|
| 224 |
+
'soft': None,
|
| 225 |
+
'id_col': None,
|
| 226 |
+
'use_base': False,
|
| 227 |
+
'id_overlap': 0,
|
| 228 |
+
'sym_col': None,
|
| 229 |
+
'n_genes': 0,
|
| 230 |
+
'df': None
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
for sf in soft_files:
|
| 234 |
+
sf_path = os.path.join(in_cohort_dir, sf)
|
| 235 |
+
try:
|
| 236 |
+
ann = get_gene_annotation(sf_path)
|
| 237 |
+
except Exception as e:
|
| 238 |
+
print(f"WARNING: Failed to read annotation from {sf_path}: {e}")
|
| 239 |
+
continue
|
| 240 |
+
|
| 241 |
+
id_col, use_base_ids, id_overlap = _select_id_column(ann)
|
| 242 |
+
if id_col is None or id_overlap == 0:
|
| 243 |
+
continue
|
| 244 |
+
|
| 245 |
+
expression_df = expr_base if use_base_ids else expr_full
|
| 246 |
+
|
| 247 |
+
# Subset to rows with matching probe IDs
|
| 248 |
+
matched_ids = set(ann[id_col].astype(str).str.strip()) & set(expression_df.index.astype(str))
|
| 249 |
+
ann_subset = ann[ann[id_col].astype(str).str.strip().isin(matched_ids)].copy()
|
| 250 |
+
if ann_subset.empty:
|
| 251 |
+
continue
|
| 252 |
+
|
| 253 |
+
# If species column exists, restrict to Homo sapiens
|
| 254 |
+
species_cols = [c for c in ann_subset.columns if 'species' in c.lower() or 'organism' in c.lower()]
|
| 255 |
+
for sc in species_cols:
|
| 256 |
+
# Select rows likely to be human; if no match, keep as is
|
| 257 |
+
mask_hs = ann_subset[sc].astype(str).str.contains('Homo sapiens', case=False, na=False)
|
| 258 |
+
if mask_hs.any():
|
| 259 |
+
ann_subset = ann_subset[mask_hs]
|
| 260 |
+
|
| 261 |
+
# Determine candidate symbol columns (deterministic priority first)
|
| 262 |
+
candidates = _candidate_symbol_cols(ann_subset)
|
| 263 |
+
best_sym_col_for_file = None
|
| 264 |
+
best_df_for_file = None
|
| 265 |
+
best_genes_for_file = 0
|
| 266 |
+
|
| 267 |
+
for sym_col in candidates:
|
| 268 |
+
# Skip blatantly non-gene columns if they sneaked in
|
| 269 |
+
if sym_col in banned_symbol_cols:
|
| 270 |
+
continue
|
| 271 |
+
mapped_df, n_genes = _try_mapping(ann_subset, id_col=id_col, sym_col=sym_col, expression_df=expression_df)
|
| 272 |
+
if n_genes > best_genes_for_file:
|
| 273 |
+
best_sym_col_for_file = sym_col
|
| 274 |
+
best_df_for_file = mapped_df
|
| 275 |
+
best_genes_for_file = n_genes
|
| 276 |
+
# Early accept if sufficiently many genes (robust threshold)
|
| 277 |
+
if n_genes >= 1000:
|
| 278 |
+
break
|
| 279 |
+
|
| 280 |
+
# If nothing workable found with preferred columns, try last-resort columns (still avoid "Genome Context" if possible)
|
| 281 |
+
if best_genes_for_file < 1000:
|
| 282 |
+
for sym_col in ann_subset.columns:
|
| 283 |
+
if sym_col in candidates or sym_col in banned_symbol_cols:
|
| 284 |
+
continue
|
| 285 |
+
mapped_df, n_genes = _try_mapping(ann_subset, id_col=id_col, sym_col=sym_col, expression_df=expression_df)
|
| 286 |
+
if n_genes > best_genes_for_file:
|
| 287 |
+
best_sym_col_for_file = sym_col
|
| 288 |
+
best_df_for_file = mapped_df
|
| 289 |
+
best_genes_for_file = n_genes
|
| 290 |
+
|
| 291 |
+
# Update best overall choice, prioritizing higher ID overlap first, then number of genes
|
| 292 |
+
if (id_overlap > best_overall['id_overlap']) or \
|
| 293 |
+
(id_overlap == best_overall['id_overlap'] and best_genes_for_file > best_overall['n_genes']):
|
| 294 |
+
best_overall.update({
|
| 295 |
+
'soft': sf_path,
|
| 296 |
+
'id_col': id_col,
|
| 297 |
+
'use_base': use_base_ids,
|
| 298 |
+
'id_overlap': id_overlap,
|
| 299 |
+
'sym_col': best_sym_col_for_file,
|
| 300 |
+
'n_genes': best_genes_for_file,
|
| 301 |
+
'df': best_df_for_file
|
| 302 |
+
})
|
| 303 |
+
|
| 304 |
+
print("Selected mapping parameters:")
|
| 305 |
+
print(f" SOFT file: {best_overall['soft']}")
|
| 306 |
+
print(f" ID column: {best_overall['id_col']}, overlap: {best_overall['id_overlap']}, use_base_ids: {best_overall['use_base']}")
|
| 307 |
+
print(f" Symbol column: {best_overall['sym_col']}, mapped unique genes: {best_overall['n_genes']}")
|
| 308 |
+
|
| 309 |
+
# Finalize gene_data
|
| 310 |
+
if best_overall['df'] is not None and best_overall['n_genes'] >= 1000:
|
| 311 |
+
gene_data = best_overall['df']
|
| 312 |
+
else:
|
| 313 |
+
# Fallback: keep probe-level matrix if mapping is insufficient
|
| 314 |
+
gene_data = expr_full
|
| 315 |
+
print("WARNING: Mapping did not yield sufficient human genes; falling back to probe-level data.")
|
| 316 |
+
|
| 317 |
+
# Save gene expression data
|
| 318 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 319 |
+
gene_data.to_csv(out_gene_data_file)
|
| 320 |
+
print(f"Gene expression saved to: {out_gene_data_file}")
|
| 321 |
+
|
| 322 |
+
# Step 7: Data Normalization and Linking
|
| 323 |
+
import os
|
| 324 |
+
import pandas as pd
|
| 325 |
+
|
| 326 |
+
# Ensure clinical data is available in this scope
|
| 327 |
+
try:
|
| 328 |
+
selected_clinical_df
|
| 329 |
+
except NameError:
|
| 330 |
+
if not os.path.exists(out_clinical_data_file):
|
| 331 |
+
raise FileNotFoundError(f"Clinical data file not found: {out_clinical_data_file}")
|
| 332 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 333 |
+
|
| 334 |
+
note_msgs = []
|
| 335 |
+
|
| 336 |
+
# 1. Normalize gene symbols with guard/fallback if normalization yields too few genes
|
| 337 |
+
try:
|
| 338 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data.copy())
|
| 339 |
+
except Exception as e:
|
| 340 |
+
normalized_gene_data = pd.DataFrame()
|
| 341 |
+
note_msgs.append(f"WARNING: Normalization failed with error: {e}")
|
| 342 |
+
|
| 343 |
+
# Decide which gene matrix to use: prefer normalized if it has sufficient genes
|
| 344 |
+
if isinstance(normalized_gene_data, pd.DataFrame) and normalized_gene_data.shape[0] >= 1000:
|
| 345 |
+
used_gene_data = normalized_gene_data
|
| 346 |
+
note_msgs.append("INFO: Using normalized gene-symbol matrix.")
|
| 347 |
+
else:
|
| 348 |
+
used_gene_data = gene_data
|
| 349 |
+
if normalized_gene_data is not None and normalized_gene_data.shape[0] > 0:
|
| 350 |
+
note_msgs.append(
|
| 351 |
+
f"WARNING: Normalized matrix had too few genes ({normalized_gene_data.shape[0]}). "
|
| 352 |
+
"Falling back to probe-level matrix."
|
| 353 |
+
)
|
| 354 |
+
else:
|
| 355 |
+
note_msgs.append("WARNING: Normalization produced empty result. Falling back to probe-level matrix.")
|
| 356 |
+
|
| 357 |
+
# Save the gene data we will use
|
| 358 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 359 |
+
used_gene_data.to_csv(out_gene_data_file)
|
| 360 |
+
|
| 361 |
+
# 2. Link the clinical and genetic data
|
| 362 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, used_gene_data)
|
| 363 |
+
|
| 364 |
+
# 3. Handle missing values in the linked data
|
| 365 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 366 |
+
|
| 367 |
+
# 4. Determine bias and remove biased demographic features
|
| 368 |
+
covariate_cols = [trait, 'Age', 'Gender']
|
| 369 |
+
gene_cols = [c for c in linked_data.columns if c not in covariate_cols]
|
| 370 |
+
is_gene_available_flag = (len(gene_cols) > 0) and (linked_data.shape[0] > 0)
|
| 371 |
+
is_trait_available_flag = (trait in linked_data.columns) and (linked_data.shape[0] > 0) and bool(linked_data[trait].notna().any())
|
| 372 |
+
|
| 373 |
+
# Judge bias only if data is available
|
| 374 |
+
if is_gene_available_flag and is_trait_available_flag:
|
| 375 |
+
is_trait_biased_flag, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 376 |
+
else:
|
| 377 |
+
is_trait_biased_flag = True
|
| 378 |
+
unbiased_linked_data = linked_data
|
| 379 |
+
if not is_trait_available_flag:
|
| 380 |
+
note_msgs.append("ERROR: Trait data unavailable after processing.")
|
| 381 |
+
if not is_gene_available_flag:
|
| 382 |
+
note_msgs.append("ERROR: No usable gene features available after processing.")
|
| 383 |
+
|
| 384 |
+
# 5. Final validation and save cohort info (ensure native Python types for JSON)
|
| 385 |
+
note = " ".join(note_msgs) if note_msgs else ""
|
| 386 |
+
is_usable = validate_and_save_cohort_info(
|
| 387 |
+
is_final=True,
|
| 388 |
+
cohort=cohort,
|
| 389 |
+
info_path=json_path,
|
| 390 |
+
is_gene_available=bool(is_gene_available_flag),
|
| 391 |
+
is_trait_available=bool(is_trait_available_flag),
|
| 392 |
+
is_biased=bool(is_trait_biased_flag),
|
| 393 |
+
df=unbiased_linked_data,
|
| 394 |
+
note=note
|
| 395 |
+
)
|
| 396 |
+
|
| 397 |
+
# 6. Save linked data only if usable
|
| 398 |
+
if is_usable:
|
| 399 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 400 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Lung_Cancer/code/GSE248830.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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= "GSE248830"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE248830"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE248830.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE248830.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE248830.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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
|
| 43 |
+
is_gene_available = True # Targeted gene expression using NanoString panel
|
| 44 |
+
|
| 45 |
+
# 2. Variable Availability and Data Type Conversion
|
| 46 |
+
# Identify rows from the Sample Characteristics Dictionary
|
| 47 |
+
trait_row = 2 # 'histology'
|
| 48 |
+
age_row = 0 # 'age at diagnosis'
|
| 49 |
+
gender_row = 1 # 'Sex'
|
| 50 |
+
|
| 51 |
+
def _after_colon(val: str) -> str:
|
| 52 |
+
if val is None:
|
| 53 |
+
return ''
|
| 54 |
+
parts = str(val).split(':', 1)
|
| 55 |
+
return parts[1].strip() if len(parts) > 1 else str(val).strip()
|
| 56 |
+
|
| 57 |
+
def convert_trait(x):
|
| 58 |
+
v = _after_colon(x).strip().lower()
|
| 59 |
+
if v in {'', 'na', 'n.a', 'n.a.', 'unknown', 'unk'}:
|
| 60 |
+
return None
|
| 61 |
+
# Normalize common typos and variants
|
| 62 |
+
v = v.replace('adenocaricnoma', 'adenocarcinoma')
|
| 63 |
+
# Heuristic mapping:
|
| 64 |
+
# Lung_Cancer (LUAD) vs Breast subtypes (ER/PR/HER2/TNBC)
|
| 65 |
+
if any(k in v for k in ['er', 'pr', 'her2', 'tnbc']):
|
| 66 |
+
return 0
|
| 67 |
+
if any(k in v for k in ['luad', 'lung adenocarcinoma', 'lung adeno', 'adenocarcinoma']):
|
| 68 |
+
return 1
|
| 69 |
+
# If not recognized, return None
|
| 70 |
+
return None
|
| 71 |
+
|
| 72 |
+
def convert_age(x):
|
| 73 |
+
v = _after_colon(x).lower()
|
| 74 |
+
if v in {'', 'na', 'n.a', 'n.a.'}:
|
| 75 |
+
return None
|
| 76 |
+
# Extract first number
|
| 77 |
+
m = re.search(r'[-+]?\d+\.?\d*', v)
|
| 78 |
+
if m:
|
| 79 |
+
try:
|
| 80 |
+
val = float(m.group())
|
| 81 |
+
return int(val) if val.is_integer() else val
|
| 82 |
+
except:
|
| 83 |
+
return None
|
| 84 |
+
return None
|
| 85 |
+
|
| 86 |
+
def convert_gender(x):
|
| 87 |
+
v = _after_colon(x).strip().lower()
|
| 88 |
+
if v in {'female', 'f'}:
|
| 89 |
+
return 0
|
| 90 |
+
if v in {'male', 'm'}:
|
| 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 clinical data 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 |
+
requires_gene_mapping = False
|
| 131 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 132 |
+
|
| 133 |
+
# Step 5: Data Normalization and Linking
|
| 134 |
+
import os
|
| 135 |
+
import pandas as pd
|
| 136 |
+
|
| 137 |
+
# Ensure matrix_file is available; if not, locate it
|
| 138 |
+
try:
|
| 139 |
+
matrix_file
|
| 140 |
+
except NameError:
|
| 141 |
+
_, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 142 |
+
|
| 143 |
+
# Re-extract gene data to avoid dependency on previous steps
|
| 144 |
+
gene_data = get_genetic_data(matrix_file)
|
| 145 |
+
|
| 146 |
+
# 1. Normalize gene symbols and save
|
| 147 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 148 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 149 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 150 |
+
|
| 151 |
+
# 2. Load clinical data saved in Step 2 and link
|
| 152 |
+
clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 153 |
+
linked_data = geo_link_clinical_genetic_data(clinical_df, normalized_gene_data)
|
| 154 |
+
|
| 155 |
+
# 3. Handle missing values
|
| 156 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 157 |
+
|
| 158 |
+
# 4. Assess bias and remove biased demographic features
|
| 159 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 160 |
+
|
| 161 |
+
# 5. Final validation and save cohort info
|
| 162 |
+
is_usable = validate_and_save_cohort_info(
|
| 163 |
+
is_final=True,
|
| 164 |
+
cohort=cohort,
|
| 165 |
+
info_path=json_path,
|
| 166 |
+
is_gene_available=True,
|
| 167 |
+
is_trait_available=True,
|
| 168 |
+
is_biased=is_trait_biased,
|
| 169 |
+
df=unbiased_linked_data
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
# 6. Save linked data if usable
|
| 173 |
+
if is_usable:
|
| 174 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 175 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output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"../DATA/GEO/Lung_Cancer/GSE249262"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE249262.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE249262.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE249262.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 |
+
# Determine data availability
|
| 42 |
+
is_gene_available = True # Microarray gene expression profiling on RNA from CTCs is described in the background
|
| 43 |
+
trait_row = 3 # 'status' with values: Tumor (stable/progression), Healthy, Cell line
|
| 44 |
+
age_row = None # Not available in the sample characteristics
|
| 45 |
+
gender_row = None # Not available in the sample characteristics
|
| 46 |
+
|
| 47 |
+
# Converters
|
| 48 |
+
def _extract_value(x):
|
| 49 |
+
if x is None:
|
| 50 |
+
return None
|
| 51 |
+
s = str(x)
|
| 52 |
+
if ':' in s:
|
| 53 |
+
s = s.split(':', 1)[1]
|
| 54 |
+
s = s.strip()
|
| 55 |
+
if s == '' or s.lower() in {'na', 'n/a', 'nan', 'none', 'null', 'missing', 'unknown'}:
|
| 56 |
+
return None
|
| 57 |
+
return s
|
| 58 |
+
|
| 59 |
+
def convert_trait(x):
|
| 60 |
+
v = _extract_value(x)
|
| 61 |
+
if v is None:
|
| 62 |
+
return None
|
| 63 |
+
vl = v.lower()
|
| 64 |
+
# Map lung cancer patients to 1, healthy controls to 0; exclude cell lines
|
| 65 |
+
if 'cell line' in vl:
|
| 66 |
+
return None
|
| 67 |
+
if 'healthy' in vl:
|
| 68 |
+
return 0
|
| 69 |
+
if 'tumor' in vl or 'cancer' in vl:
|
| 70 |
+
return 1
|
| 71 |
+
return None
|
| 72 |
+
|
| 73 |
+
def convert_age(x):
|
| 74 |
+
# Not available; keep as None
|
| 75 |
+
return None
|
| 76 |
+
|
| 77 |
+
def convert_gender(x):
|
| 78 |
+
# Not available; keep as None
|
| 79 |
+
return None
|
| 80 |
+
|
| 81 |
+
# Clinical feature extraction (if trait is nominally available)
|
| 82 |
+
selected_clinical_df = None
|
| 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 |
+
# Drop non-human or otherwise excluded samples where trait is NA (e.g., cell lines)
|
| 95 |
+
selected_clinical_df = selected_clinical_df.dropna(axis=1, subset=[trait])
|
| 96 |
+
|
| 97 |
+
# Optional: ensure trait is not constant after conversion
|
| 98 |
+
non_na_vals = selected_clinical_df.loc[trait].dropna().unique()
|
| 99 |
+
if len(non_na_vals) < 2:
|
| 100 |
+
# Treat as unavailable if constant
|
| 101 |
+
trait_row = None
|
| 102 |
+
|
| 103 |
+
# Initial filtering and save metadata
|
| 104 |
+
is_trait_available = trait_row is not None
|
| 105 |
+
_ = validate_and_save_cohort_info(
|
| 106 |
+
is_final=False,
|
| 107 |
+
cohort=cohort,
|
| 108 |
+
info_path=json_path,
|
| 109 |
+
is_gene_available=is_gene_available,
|
| 110 |
+
is_trait_available=is_trait_available
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
# Save clinical features if available
|
| 114 |
+
if is_trait_available and selected_clinical_df is not None:
|
| 115 |
+
preview = preview_df(selected_clinical_df)
|
| 116 |
+
print(preview)
|
| 117 |
+
|
| 118 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 119 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 120 |
+
|
| 121 |
+
# Step 3: Gene Data Extraction
|
| 122 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 123 |
+
gene_data = get_genetic_data(matrix_file)
|
| 124 |
+
|
| 125 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 126 |
+
print(gene_data.index[:20])
|
| 127 |
+
|
| 128 |
+
# Step 4: Gene Identifier Review
|
| 129 |
+
print("requires_gene_mapping = True")
|
| 130 |
+
|
| 131 |
+
# Step 5: Gene Annotation
|
| 132 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 133 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 134 |
+
|
| 135 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 136 |
+
print("Gene annotation preview:")
|
| 137 |
+
print(preview_df(gene_annotation))
|
| 138 |
+
|
| 139 |
+
# Step 6: Gene Identifier Mapping
|
| 140 |
+
import os
|
| 141 |
+
|
| 142 |
+
# Prepare expression ID set from previously loaded gene_data
|
| 143 |
+
expr_ids = set(gene_data.index.astype(str))
|
| 144 |
+
|
| 145 |
+
# Search all SOFT files in the cohort directory to find an annotation whose column matches expression IDs
|
| 146 |
+
soft_files = [os.path.join(in_cohort_dir, f) for f in os.listdir(in_cohort_dir) if 'soft' in f.lower()]
|
| 147 |
+
|
| 148 |
+
best = {
|
| 149 |
+
'file': None,
|
| 150 |
+
'df': None,
|
| 151 |
+
'id_col': None,
|
| 152 |
+
'overlap': -1
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
id_keywords = ['id', 'probe', 'probeset', 'id_ref', 'pset', 'transcript']
|
| 156 |
+
|
| 157 |
+
for sf in soft_files:
|
| 158 |
+
try:
|
| 159 |
+
annot_df = get_gene_annotation(sf)
|
| 160 |
+
except Exception as e:
|
| 161 |
+
continue
|
| 162 |
+
|
| 163 |
+
for col in annot_df.columns:
|
| 164 |
+
try:
|
| 165 |
+
vals = annot_df[col].astype(str).str.strip()
|
| 166 |
+
except Exception:
|
| 167 |
+
continue
|
| 168 |
+
unique_vals = set(vals.unique())
|
| 169 |
+
overlap = len(expr_ids & unique_vals)
|
| 170 |
+
|
| 171 |
+
# Prefer columns with ID-like names by adding a small weight
|
| 172 |
+
name_bonus = 5 if any(k in col.lower() for k in id_keywords) else 0
|
| 173 |
+
score = overlap + name_bonus
|
| 174 |
+
|
| 175 |
+
if score > best['overlap']:
|
| 176 |
+
best.update({'file': sf, 'df': annot_df, 'id_col': col, 'overlap': score})
|
| 177 |
+
|
| 178 |
+
# Decide if we found a plausible ID column; require meaningful overlap to avoid spurious matches (e.g., genomic positions)
|
| 179 |
+
MAPPING_MIN_OVERLAP = 50 # conservative to avoid false positives
|
| 180 |
+
mapping_possible = best['overlap'] >= MAPPING_MIN_OVERLAP
|
| 181 |
+
|
| 182 |
+
if not mapping_possible:
|
| 183 |
+
print(f"WARNING: No suitable annotation with sufficient overlap was found among SOFT files. "
|
| 184 |
+
f"Best overlap = {best['overlap']} in column '{best['id_col']}' of file '{best['file']}'. "
|
| 185 |
+
f"Proceeding without probe-to-gene mapping.")
|
| 186 |
+
# Save the original probe-level data to keep pipeline moving
|
| 187 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 188 |
+
gene_data.to_csv(out_gene_data_file)
|
| 189 |
+
else:
|
| 190 |
+
gene_annotation_use = best['df']
|
| 191 |
+
id_col = best['id_col']
|
| 192 |
+
|
| 193 |
+
# Choose a gene symbol column: exclude the selected id_col and select the column with the most extractable gene symbols
|
| 194 |
+
symbol_support = {}
|
| 195 |
+
for col in gene_annotation_use.columns:
|
| 196 |
+
if col == id_col:
|
| 197 |
+
continue
|
| 198 |
+
try:
|
| 199 |
+
series = gene_annotation_use[col].astype(str)
|
| 200 |
+
count = series.apply(lambda x: len(extract_human_gene_symbols(x)) > 0).sum()
|
| 201 |
+
symbol_support[col] = int(count)
|
| 202 |
+
except Exception:
|
| 203 |
+
continue
|
| 204 |
+
|
| 205 |
+
if not symbol_support:
|
| 206 |
+
print("WARNING: No column with recognizable human gene symbols was found in the selected annotation. "
|
| 207 |
+
"Proceeding without mapping.")
|
| 208 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 209 |
+
gene_data.to_csv(out_gene_data_file)
|
| 210 |
+
else:
|
| 211 |
+
gene_col = max(symbol_support, key=symbol_support.get)
|
| 212 |
+
if symbol_support[gene_col] == 0:
|
| 213 |
+
print("WARNING: Selected gene symbol column contains no recognizable symbols. Proceeding without mapping.")
|
| 214 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 215 |
+
gene_data.to_csv(out_gene_data_file)
|
| 216 |
+
else:
|
| 217 |
+
# Build mapping dataframe
|
| 218 |
+
mapping_df = get_gene_mapping(gene_annotation_use, prob_col=id_col, gene_col=gene_col)
|
| 219 |
+
|
| 220 |
+
# Quick sanity preview of mapping_df
|
| 221 |
+
try:
|
| 222 |
+
print("Mapping preview (first 5 rows):")
|
| 223 |
+
print(mapping_df.head(5))
|
| 224 |
+
print(f"ID column: {id_col} | Gene column: {gene_col} | Overlap with expression IDs: {best['overlap']}")
|
| 225 |
+
except Exception:
|
| 226 |
+
pass
|
| 227 |
+
|
| 228 |
+
# Apply mapping to convert probe-level to gene-level expression
|
| 229 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 230 |
+
|
| 231 |
+
# Save gene-level data
|
| 232 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 233 |
+
gene_data.to_csv(out_gene_data_file)
|
| 234 |
+
|
| 235 |
+
# Step 7: Data Normalization and Linking
|
| 236 |
+
import os
|
| 237 |
+
import pandas as pd
|
| 238 |
+
|
| 239 |
+
# 1. Normalize the obtained gene data with the 'normalize_gene_symbols_in_index' function from the library.
|
| 240 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 241 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 242 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 243 |
+
|
| 244 |
+
# Ensure clinical data is available in memory; if not, try loading from disk
|
| 245 |
+
if 'selected_clinical_df' not in globals() or selected_clinical_df is None:
|
| 246 |
+
if os.path.exists(out_clinical_data_file):
|
| 247 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 248 |
+
else:
|
| 249 |
+
selected_clinical_df = None
|
| 250 |
+
|
| 251 |
+
# 2. Link the clinical and genetic data
|
| 252 |
+
if selected_clinical_df is not None:
|
| 253 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 254 |
+
else:
|
| 255 |
+
# If clinical data truly missing, create an empty DataFrame so downstream checks can proceed safely
|
| 256 |
+
linked_data = pd.DataFrame()
|
| 257 |
+
|
| 258 |
+
# Data availability flags for final validation
|
| 259 |
+
is_gene_available = isinstance(normalized_gene_data, pd.DataFrame) and normalized_gene_data.shape[0] > 0
|
| 260 |
+
is_trait_available = (trait in linked_data.columns) if isinstance(linked_data, pd.DataFrame) and linked_data.shape[0] > 0 else False
|
| 261 |
+
|
| 262 |
+
# 3–6 proceed only if trait is available
|
| 263 |
+
if is_trait_available:
|
| 264 |
+
# 3. Handle missing values in the linked data
|
| 265 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 266 |
+
|
| 267 |
+
# 4. Determine whether the trait and some demographic features are severely biased, and remove biased features.
|
| 268 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 269 |
+
|
| 270 |
+
# 5. Conduct quality check and save the cohort information.
|
| 271 |
+
note = ("INFO: Cell line and non-human/irrelevant samples excluded via trait conversion; "
|
| 272 |
+
"Age/Gender not provided in series; CTC-based blood samples from stage III NSCLC and healthy controls.")
|
| 273 |
+
is_usable = validate_and_save_cohort_info(
|
| 274 |
+
is_final=True,
|
| 275 |
+
cohort=cohort,
|
| 276 |
+
info_path=json_path,
|
| 277 |
+
is_gene_available=is_gene_available,
|
| 278 |
+
is_trait_available=is_trait_available,
|
| 279 |
+
is_biased=is_trait_biased,
|
| 280 |
+
df=unbiased_linked_data,
|
| 281 |
+
note=note
|
| 282 |
+
)
|
| 283 |
+
|
| 284 |
+
# 6. If the linked data is usable, save it as a CSV file to 'out_data_file'.
|
| 285 |
+
if is_usable:
|
| 286 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 287 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 288 |
+
else:
|
| 289 |
+
# Trait not available: still record final validation with appropriate flags
|
| 290 |
+
dummy_df = pd.DataFrame()
|
| 291 |
+
is_usable = validate_and_save_cohort_info(
|
| 292 |
+
is_final=True,
|
| 293 |
+
cohort=cohort,
|
| 294 |
+
info_path=json_path,
|
| 295 |
+
is_gene_available=is_gene_available,
|
| 296 |
+
is_trait_available=False,
|
| 297 |
+
is_biased=True, # placeholder; dataset unusable due to missing trait
|
| 298 |
+
df=dummy_df,
|
| 299 |
+
note="WARNING: Trait not available after clinical extraction; final linking skipped."
|
| 300 |
+
)
|
output/preprocess/Lung_Cancer/code/GSE249568.py
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lung_Cancer"
|
| 6 |
+
cohort = "GSE249568"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE249568"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE249568.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE249568.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE249568.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 data availability
|
| 43 |
+
# GeoMx Digital Spatial Profiling with Cancer Transcriptome Atlas indicates mRNA gene expression is available.
|
| 44 |
+
is_gene_available = True
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability based on the provided Sample Characteristics Dictionary: {0: ['tissue: NSCLC']}
|
| 47 |
+
# Only a constant "tissue: NSCLC" is present, so trait, age, and gender are considered unavailable for association studies.
|
| 48 |
+
trait_row = None
|
| 49 |
+
age_row = None
|
| 50 |
+
gender_row = None
|
| 51 |
+
|
| 52 |
+
# 2.2) Data type conversion functions
|
| 53 |
+
def _after_colon(x):
|
| 54 |
+
if pd.isna(x):
|
| 55 |
+
return None
|
| 56 |
+
s = str(x)
|
| 57 |
+
parts = s.split(":", 1)
|
| 58 |
+
s = parts[1] if len(parts) == 2 else parts[0]
|
| 59 |
+
s = s.strip()
|
| 60 |
+
if s.lower() in {"", "na", "n/a", "nan", "none", "unknown", "not available"}:
|
| 61 |
+
return None
|
| 62 |
+
return s
|
| 63 |
+
|
| 64 |
+
def convert_trait(x):
|
| 65 |
+
s = _after_colon(x)
|
| 66 |
+
if s is None:
|
| 67 |
+
return None
|
| 68 |
+
sl = s.lower()
|
| 69 |
+
# Map lung cancer presence to 1, and normal/control to 0
|
| 70 |
+
if any(k in sl for k in ["nsclc", "lung cancer", "lung carcinoma", "adenocarcinoma", "squamous", "metex14"]):
|
| 71 |
+
return 1
|
| 72 |
+
if any(k in sl for k in ["normal", "non-cancer", "control", "adjacent normal", "healthy"]):
|
| 73 |
+
return 0
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
def convert_age(x):
|
| 77 |
+
s = _after_colon(x)
|
| 78 |
+
if s is None:
|
| 79 |
+
return None
|
| 80 |
+
# Extract the first integer or float number as age in years
|
| 81 |
+
m = re.search(r"(\d+(?:\.\d+)?)", s)
|
| 82 |
+
if not m:
|
| 83 |
+
return None
|
| 84 |
+
try:
|
| 85 |
+
return float(m.group(1))
|
| 86 |
+
except Exception:
|
| 87 |
+
return None
|
| 88 |
+
|
| 89 |
+
def convert_gender(x):
|
| 90 |
+
s = _after_colon(x)
|
| 91 |
+
if s is None:
|
| 92 |
+
return None
|
| 93 |
+
sl = s.lower()
|
| 94 |
+
# Female -> 0, Male -> 1
|
| 95 |
+
if sl in {"f", "female", "woman", "women"}:
|
| 96 |
+
return 0
|
| 97 |
+
if sl in {"m", "male", "man", "men"}:
|
| 98 |
+
return 1
|
| 99 |
+
# Handle cases like "sex: Male", "gender: F", etc. already handled by _after_colon
|
| 100 |
+
if "female" in sl:
|
| 101 |
+
return 0
|
| 102 |
+
if "male" in sl:
|
| 103 |
+
return 1
|
| 104 |
+
return None
|
| 105 |
+
|
| 106 |
+
# 3) Save metadata with 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 (skip because trait_row is None)
|
| 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 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 130 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 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 |
+
print("requires_gene_mapping = False")
|
| 141 |
+
|
| 142 |
+
# Step 5: Data Normalization and Linking
|
| 143 |
+
import os
|
| 144 |
+
|
| 145 |
+
# 1. Normalize gene symbols and save
|
| 146 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 147 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 148 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 149 |
+
|
| 150 |
+
# 2-6. Proceed only if trait data is available; otherwise skip linking and record metadata accordingly
|
| 151 |
+
is_trait_available = ('trait_row' in locals()) and (trait_row is not None)
|
| 152 |
+
|
| 153 |
+
linked_data = None # ensure the variable exists per instruction
|
| 154 |
+
if is_trait_available:
|
| 155 |
+
# Reconstruct clinical selection to avoid dependency on a possibly undefined variable from prior step
|
| 156 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 157 |
+
clinical_df=clinical_data,
|
| 158 |
+
trait=trait,
|
| 159 |
+
trait_row=trait_row,
|
| 160 |
+
convert_trait=convert_trait,
|
| 161 |
+
age_row=age_row,
|
| 162 |
+
convert_age=convert_age,
|
| 163 |
+
gender_row=gender_row,
|
| 164 |
+
convert_gender=convert_gender
|
| 165 |
+
)
|
| 166 |
+
|
| 167 |
+
# 2. Link clinical and genetic data
|
| 168 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 169 |
+
|
| 170 |
+
# 3. Handle missing values
|
| 171 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 172 |
+
|
| 173 |
+
# 4. Bias checks and removal of biased demographics
|
| 174 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 175 |
+
|
| 176 |
+
# 5. Final validation and metadata save
|
| 177 |
+
is_usable = validate_and_save_cohort_info(
|
| 178 |
+
is_final=True,
|
| 179 |
+
cohort=cohort,
|
| 180 |
+
info_path=json_path,
|
| 181 |
+
is_gene_available=True,
|
| 182 |
+
is_trait_available=True,
|
| 183 |
+
is_biased=is_trait_biased,
|
| 184 |
+
df=unbiased_linked_data,
|
| 185 |
+
note="INFO: Clinical trait available; gene symbols normalized using NCBI synonyms."
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
# 6. Save linked data if usable
|
| 189 |
+
if is_usable:
|
| 190 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 191 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 192 |
+
|
| 193 |
+
else:
|
| 194 |
+
# Trait unavailable: record initial filtering result and do not attempt linking
|
| 195 |
+
_ = validate_and_save_cohort_info(
|
| 196 |
+
is_final=False,
|
| 197 |
+
cohort=cohort,
|
| 198 |
+
info_path=json_path,
|
| 199 |
+
is_gene_available=True,
|
| 200 |
+
is_trait_available=False
|
| 201 |
+
)
|
output/preprocess/Lung_Cancer/code/GSE280643.py
ADDED
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lung_Cancer"
|
| 6 |
+
cohort = "GSE280643"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Lung_Cancer"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Lung_Cancer/GSE280643"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/GSE280643.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/GSE280643.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/GSE280643.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Lung_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 availability
|
| 44 |
+
is_gene_available = True # Likely mRNA gene expression; not miRNA/methylation based on context.
|
| 45 |
+
|
| 46 |
+
# 2. Variable availability and conversion
|
| 47 |
+
|
| 48 |
+
# From the provided Sample Characteristics Dictionary:
|
| 49 |
+
# {0: ['tissue: small cell lung cancer', 'tissue: normal lung', 'tissue: normal skin']}
|
| 50 |
+
trait_row = 0
|
| 51 |
+
age_row = None
|
| 52 |
+
gender_row = None
|
| 53 |
+
|
| 54 |
+
def convert_trait(x):
|
| 55 |
+
# Binary: 1 = Lung cancer (SCLC/other lung cancer), 0 = normal lung; None = non-lung tissue or unknown
|
| 56 |
+
if x is None:
|
| 57 |
+
return None
|
| 58 |
+
try:
|
| 59 |
+
val = x.split(":", 1)[1].strip().lower() if ":" in x else str(x).strip().lower()
|
| 60 |
+
except Exception:
|
| 61 |
+
val = str(x).strip().lower()
|
| 62 |
+
|
| 63 |
+
# Positive lung cancer labels
|
| 64 |
+
if "small cell lung cancer" in val or "sclc" in val:
|
| 65 |
+
return 1
|
| 66 |
+
if ("lung" in val) and any(k in val for k in ["cancer", "tumor", "carcinoma"]):
|
| 67 |
+
return 1
|
| 68 |
+
|
| 69 |
+
# Explicitly avoid cross-tissue controls: do not treat non-lung normals as 0
|
| 70 |
+
if "skin" in val:
|
| 71 |
+
return None
|
| 72 |
+
|
| 73 |
+
# Lung normals as controls
|
| 74 |
+
if ("lung" in val) and any(k in val for k in ["normal", "healthy", "control", "adjacent normal"]):
|
| 75 |
+
return 0
|
| 76 |
+
|
| 77 |
+
# Other normals without lung context -> unknown for this trait
|
| 78 |
+
if any(k in val for k in ["normal", "healthy", "control"]):
|
| 79 |
+
return None
|
| 80 |
+
|
| 81 |
+
return None
|
| 82 |
+
|
| 83 |
+
def convert_age(x):
|
| 84 |
+
# Continuous age if present; extract numeric value
|
| 85 |
+
if x is None:
|
| 86 |
+
return None
|
| 87 |
+
try:
|
| 88 |
+
val = x.split(":", 1)[1] if ":" in x else str(x)
|
| 89 |
+
m = re.search(r"[-+]?\d*\.?\d+", val)
|
| 90 |
+
return float(m.group()) if m else None
|
| 91 |
+
except Exception:
|
| 92 |
+
return None
|
| 93 |
+
|
| 94 |
+
def convert_gender(x):
|
| 95 |
+
# Binary gender: female=0, male=1
|
| 96 |
+
if x is None:
|
| 97 |
+
return None
|
| 98 |
+
try:
|
| 99 |
+
val = x.split(":", 1)[1].strip().lower() if ":" in x else str(x).strip().lower()
|
| 100 |
+
except Exception:
|
| 101 |
+
val = str(x).strip().lower()
|
| 102 |
+
if val in ["female", "f", "woman", "women", "girl"]:
|
| 103 |
+
return 0
|
| 104 |
+
if val in ["male", "m", "man", "men", "boy"]:
|
| 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 is 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 |
+
preview = preview_df(selected_clinical_df, n=5)
|
| 131 |
+
print(preview)
|
| 132 |
+
# Save
|
| 133 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 134 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 135 |
+
|
| 136 |
+
# Step 3: Gene Data Extraction
|
| 137 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 138 |
+
gene_data = get_genetic_data(matrix_file)
|
| 139 |
+
|
| 140 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 141 |
+
print(gene_data.index[:20])
|
| 142 |
+
|
| 143 |
+
# Step 4: Gene Identifier Review
|
| 144 |
+
# Based on the observed numeric probe-like identifiers (e.g., '23064070'), mapping to human gene symbols is required.
|
| 145 |
+
print("requires_gene_mapping = True")
|
| 146 |
+
|
| 147 |
+
# Step 5: Gene Annotation
|
| 148 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 149 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 150 |
+
|
| 151 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 152 |
+
print("Gene annotation preview:")
|
| 153 |
+
print(preview_df(gene_annotation))
|
| 154 |
+
|
| 155 |
+
# Step 6: Gene Identifier Mapping
|
| 156 |
+
import re
|
| 157 |
+
import pandas as pd
|
| 158 |
+
|
| 159 |
+
# Keep a copy of the raw probe-level data
|
| 160 |
+
expr_df_raw = gene_data.copy()
|
| 161 |
+
|
| 162 |
+
# 1) Decide which columns in gene_annotation correspond to probe IDs and gene symbols.
|
| 163 |
+
expr_ids = set(expr_df_raw.index.astype(str))
|
| 164 |
+
|
| 165 |
+
def count_overlap(series: pd.Series, expr_ids: set) -> int:
|
| 166 |
+
s = series.astype(str)
|
| 167 |
+
s = s.str.replace(r'\.0$', '', regex=True)
|
| 168 |
+
return len(expr_ids.intersection(set(s)))
|
| 169 |
+
|
| 170 |
+
best_id_col = None
|
| 171 |
+
best_match_count = 0
|
| 172 |
+
|
| 173 |
+
# Try direct overlap across all columns
|
| 174 |
+
for col in gene_annotation.columns:
|
| 175 |
+
try:
|
| 176 |
+
matches = count_overlap(gene_annotation[col], expr_ids)
|
| 177 |
+
except Exception:
|
| 178 |
+
matches = 0
|
| 179 |
+
if matches > best_match_count:
|
| 180 |
+
best_match_count = matches
|
| 181 |
+
best_id_col = col
|
| 182 |
+
|
| 183 |
+
# If no useful overlap, try deriving numeric IDs from platform-specific IDs (e.g., TC0100006437.hg.1 -> 6437)
|
| 184 |
+
if best_match_count == 0:
|
| 185 |
+
derived_applied = False
|
| 186 |
+
for cand in ['ID', 'probeset_id']:
|
| 187 |
+
if cand in gene_annotation.columns:
|
| 188 |
+
derived = gene_annotation[cand].astype(str).str.extract(r'^TC0*(\d+)\.hg', expand=False)
|
| 189 |
+
if derived is not None:
|
| 190 |
+
derived = derived.fillna('')
|
| 191 |
+
overlap = len(expr_ids.intersection(set(derived)))
|
| 192 |
+
if overlap > best_match_count and overlap > 0:
|
| 193 |
+
gene_annotation['Derived_ID'] = derived
|
| 194 |
+
best_id_col = 'Derived_ID'
|
| 195 |
+
best_match_count = overlap
|
| 196 |
+
derived_applied = True
|
| 197 |
+
# If still zero, try a more permissive TC pattern
|
| 198 |
+
if best_match_count == 0:
|
| 199 |
+
for cand in ['ID', 'probeset_id']:
|
| 200 |
+
if cand in gene_annotation.columns:
|
| 201 |
+
derived = gene_annotation[cand].astype(str).str.extract(r'TC0*(\d+)', expand=False)
|
| 202 |
+
if derived is not None:
|
| 203 |
+
derived = derived.fillna('')
|
| 204 |
+
overlap = len(expr_ids.intersection(set(derived)))
|
| 205 |
+
if overlap > best_match_count and overlap > 0:
|
| 206 |
+
gene_annotation['Derived_ID'] = derived
|
| 207 |
+
best_id_col = 'Derived_ID'
|
| 208 |
+
best_match_count = overlap
|
| 209 |
+
derived_applied = True
|
| 210 |
+
|
| 211 |
+
# Choose a gene-symbol-related column
|
| 212 |
+
gene_symbol_col = None
|
| 213 |
+
preferred_symbol_cols = [c for c in gene_annotation.columns if any(k in c.lower() for k in ['gene_symbol', 'symbol', 'gene'])]
|
| 214 |
+
if preferred_symbol_cols:
|
| 215 |
+
# Prefer the most explicit-looking symbol column
|
| 216 |
+
gene_symbol_col = preferred_symbol_cols[0]
|
| 217 |
+
elif 'SPOT_ID.1' in gene_annotation.columns:
|
| 218 |
+
gene_symbol_col = 'SPOT_ID.1'
|
| 219 |
+
elif 'SPOT_ID' in gene_annotation.columns:
|
| 220 |
+
gene_symbol_col = 'SPOT_ID'
|
| 221 |
+
else:
|
| 222 |
+
# Fallback to the most text-rich column
|
| 223 |
+
text_lengths = {col: gene_annotation[col].astype(str).str.len().mean() for col in gene_annotation.columns}
|
| 224 |
+
gene_symbol_col = max(text_lengths, key=text_lengths.get)
|
| 225 |
+
|
| 226 |
+
# Diagnostics
|
| 227 |
+
print(f"Total expression IDs: {len(expr_ids)}")
|
| 228 |
+
print(f"Best ID column candidate: {best_id_col} with overlap count: {best_match_count}")
|
| 229 |
+
print(f"Chosen gene symbol column: {gene_symbol_col}")
|
| 230 |
+
|
| 231 |
+
# 2) Build mapping dataframe from the chosen columns, only if we have a non-zero overlap
|
| 232 |
+
mapping_df = None
|
| 233 |
+
if best_id_col is not None and best_match_count > 0:
|
| 234 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=best_id_col, gene_col=gene_symbol_col)
|
| 235 |
+
|
| 236 |
+
# 3) Apply mapping to convert probe-level data to gene-level expression, if possible
|
| 237 |
+
if mapping_df is not None and not mapping_df.empty:
|
| 238 |
+
gene_data = apply_gene_mapping(expr_df_raw, mapping_df)
|
| 239 |
+
print(f"Mapping applied. Gene-level dataframe shape: {gene_data.shape}")
|
| 240 |
+
else:
|
| 241 |
+
# Guard: If no overlap was found, keep the original data and print a clear message.
|
| 242 |
+
print("WARNING: No overlap between matrix probe IDs and annotation IDs. "
|
| 243 |
+
"Gene mapping could not be applied. Retaining probe-level data as-is.")
|
| 244 |
+
gene_data = expr_df_raw
|
| 245 |
+
|
| 246 |
+
# Step 7: Data Normalization and Linking
|
| 247 |
+
import os
|
| 248 |
+
|
| 249 |
+
# 1. Normalize gene symbols and save
|
| 250 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 251 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 252 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 253 |
+
|
| 254 |
+
# 2. Link clinical and genetic data
|
| 255 |
+
if 'selected_clinical_df' not in globals():
|
| 256 |
+
raise NameError("selected_clinical_df not found. Ensure clinical features were extracted earlier.")
|
| 257 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 258 |
+
|
| 259 |
+
# 3. Handle missing values
|
| 260 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 261 |
+
|
| 262 |
+
# 4. Bias assessment and removal of biased demographic features
|
| 263 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 264 |
+
|
| 265 |
+
# 5. Final validation and saving cohort info
|
| 266 |
+
is_usable = validate_and_save_cohort_info(
|
| 267 |
+
is_final=True,
|
| 268 |
+
cohort=cohort,
|
| 269 |
+
info_path=json_path,
|
| 270 |
+
is_gene_available=True,
|
| 271 |
+
is_trait_available=True,
|
| 272 |
+
is_biased=is_trait_biased,
|
| 273 |
+
df=unbiased_linked_data,
|
| 274 |
+
note="INFO: Only lung normals treated as controls; non-lung controls excluded during trait conversion."
|
| 275 |
+
)
|
| 276 |
+
|
| 277 |
+
# 6. Save linked data if usable
|
| 278 |
+
if is_usable:
|
| 279 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 280 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Lung_Cancer/code/TCGA.py
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Lung_Cancer"
|
| 6 |
+
|
| 7 |
+
# Input paths
|
| 8 |
+
tcga_root_dir = "../DATA/TCGA"
|
| 9 |
+
|
| 10 |
+
# Output paths
|
| 11 |
+
out_data_file = "./output/z4/preprocess/Lung_Cancer/TCGA.csv"
|
| 12 |
+
out_gene_data_file = "./output/z4/preprocess/Lung_Cancer/gene_data/TCGA.csv"
|
| 13 |
+
out_clinical_data_file = "./output/z4/preprocess/Lung_Cancer/clinical_data/TCGA.csv"
|
| 14 |
+
json_path = "./output/z4/preprocess/Lung_Cancer/cohort_info.json"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Step 1: Initial Data Loading
|
| 18 |
+
import os
|
| 19 |
+
import pandas as pd
|
| 20 |
+
|
| 21 |
+
# Find candidate TCGA subdirectories
|
| 22 |
+
subdirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
| 23 |
+
|
| 24 |
+
# Select the most relevant cohort directory for Lung_Cancer
|
| 25 |
+
priority_patterns = [
|
| 26 |
+
'tcga_lung_cancer_(lung)',
|
| 27 |
+
'tcga_lung_adenocarcinoma_(luad)',
|
| 28 |
+
'tcga_lung_squamous_cell_carcinoma_(lusc)'
|
| 29 |
+
]
|
| 30 |
+
selected_dir = None
|
| 31 |
+
lower_map = {d.lower(): d for d in subdirs}
|
| 32 |
+
for pat in priority_patterns:
|
| 33 |
+
for d_lower, orig in lower_map.items():
|
| 34 |
+
if pat in d_lower:
|
| 35 |
+
selected_dir = orig
|
| 36 |
+
break
|
| 37 |
+
if selected_dir:
|
| 38 |
+
break
|
| 39 |
+
|
| 40 |
+
if not selected_dir:
|
| 41 |
+
# No suitable cohort found; record and stop further processing for this trait
|
| 42 |
+
_ = validate_and_save_cohort_info(
|
| 43 |
+
is_final=False,
|
| 44 |
+
cohort="TCGA",
|
| 45 |
+
info_path=json_path,
|
| 46 |
+
is_gene_available=False,
|
| 47 |
+
is_trait_available=False
|
| 48 |
+
)
|
| 49 |
+
print("No suitable TCGA cohort directory found for Lung_Cancer. Skipping this trait.")
|
| 50 |
+
else:
|
| 51 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_dir)
|
| 52 |
+
print(f"Selected TCGA cohort directory: {selected_dir}")
|
| 53 |
+
|
| 54 |
+
# Identify clinical and genetic file paths
|
| 55 |
+
clinical_path, genetic_path = tcga_get_relevant_filepaths(cohort_dir)
|
| 56 |
+
print(f"Clinical file: {clinical_path}")
|
| 57 |
+
print(f"Genetic file: {genetic_path}")
|
| 58 |
+
|
| 59 |
+
# Load dataframes
|
| 60 |
+
tcga_clinical_df = pd.read_csv(clinical_path, sep='\t', index_col=0, low_memory=False)
|
| 61 |
+
tcga_genetic_df = pd.read_csv(genetic_path, sep='\t', index_col=0, low_memory=False)
|
| 62 |
+
|
| 63 |
+
# Print clinical columns for inspection
|
| 64 |
+
print(list(tcga_clinical_df.columns))
|
| 65 |
+
|
| 66 |
+
# Step 2: Find Candidate Demographic Features
|
| 67 |
+
import os
|
| 68 |
+
import re
|
| 69 |
+
import pandas as pd
|
| 70 |
+
|
| 71 |
+
# Locate the cohort directory
|
| 72 |
+
subdirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
| 73 |
+
candidates = [d for d in subdirs if '(LUNG)' in d or '(lung)' in d]
|
| 74 |
+
if not candidates:
|
| 75 |
+
candidates = [d for d in subdirs if 'lung_cancer' in d.lower()] or [d for d in subdirs if 'lung' in d.lower()]
|
| 76 |
+
cohort_dir = os.path.join(tcga_root_dir, candidates[0])
|
| 77 |
+
|
| 78 |
+
# Get clinical and genetic file paths
|
| 79 |
+
clinical_file_path, _ = tcga_get_relevant_filepaths(cohort_dir)
|
| 80 |
+
|
| 81 |
+
# Load clinical data
|
| 82 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0, dtype=str)
|
| 83 |
+
|
| 84 |
+
# Identify candidate age and gender columns using robust patterns (avoid matching 'stage')
|
| 85 |
+
cols = list(clinical_df.columns)
|
| 86 |
+
lower_to_original = {c.lower(): c for c in cols}
|
| 87 |
+
|
| 88 |
+
candidate_age_cols_set = set()
|
| 89 |
+
for c in cols:
|
| 90 |
+
cl = c.lower()
|
| 91 |
+
if re.search(r'(^|_)age($|_)', cl) or 'age_at' in cl or cl == 'age':
|
| 92 |
+
candidate_age_cols_set.add(c)
|
| 93 |
+
if cl == 'days_to_birth':
|
| 94 |
+
candidate_age_cols_set.add(c)
|
| 95 |
+
|
| 96 |
+
candidate_gender_cols_set = set()
|
| 97 |
+
for c in cols:
|
| 98 |
+
cl = c.lower()
|
| 99 |
+
if cl in ('gender', 'sex'):
|
| 100 |
+
candidate_gender_cols_set.add(c)
|
| 101 |
+
|
| 102 |
+
candidate_age_cols = sorted(candidate_age_cols_set)
|
| 103 |
+
candidate_gender_cols = sorted(candidate_gender_cols_set)
|
| 104 |
+
|
| 105 |
+
# Print candidate columns in the required strict format
|
| 106 |
+
print(f"candidate_age_cols = {candidate_age_cols}")
|
| 107 |
+
print(f"candidate_gender_cols = {candidate_gender_cols}")
|
| 108 |
+
|
| 109 |
+
# Preview extracted data for age and gender candidates
|
| 110 |
+
if candidate_age_cols:
|
| 111 |
+
age_preview = preview_df(clinical_df[candidate_age_cols], n=5)
|
| 112 |
+
print(age_preview)
|
| 113 |
+
|
| 114 |
+
if candidate_gender_cols:
|
| 115 |
+
gender_preview = preview_df(clinical_df[candidate_gender_cols], n=5)
|
| 116 |
+
print(gender_preview)
|
| 117 |
+
|
| 118 |
+
# Step 3: Select Demographic Features
|
| 119 |
+
# Select the most suitable demographic columns based on candidate previews and typical TCGA conventions
|
| 120 |
+
age_col = None
|
| 121 |
+
gender_col = None
|
| 122 |
+
|
| 123 |
+
# Age: prefer age at diagnosis (years) over days_to_birth (days, negative)
|
| 124 |
+
if 'age_at_initial_pathologic_diagnosis' in candidate_age_cols:
|
| 125 |
+
age_col = 'age_at_initial_pathologic_diagnosis'
|
| 126 |
+
elif 'age' in candidate_age_cols:
|
| 127 |
+
age_col = 'age'
|
| 128 |
+
elif candidate_age_cols:
|
| 129 |
+
age_col = candidate_age_cols[0]
|
| 130 |
+
|
| 131 |
+
# Gender: straightforward if available
|
| 132 |
+
if 'gender' in candidate_gender_cols:
|
| 133 |
+
gender_col = 'gender'
|
| 134 |
+
elif candidate_gender_cols:
|
| 135 |
+
gender_col = candidate_gender_cols[0]
|
| 136 |
+
|
| 137 |
+
# Helper to print preview values from clinical_df or known preview dicts
|
| 138 |
+
def print_preview(col_name: str, kind: str):
|
| 139 |
+
preview_printed = False
|
| 140 |
+
non_missing_prop = None
|
| 141 |
+
|
| 142 |
+
# Try from clinical_df if available
|
| 143 |
+
if col_name and 'clinical_df' in globals() and col_name in clinical_df.columns:
|
| 144 |
+
series = clinical_df[col_name]
|
| 145 |
+
non_missing_prop = float(series.notna().mean())
|
| 146 |
+
print(f"Selected {kind}_col:", col_name)
|
| 147 |
+
print(f"First 5 values: {series.head(5).tolist()}")
|
| 148 |
+
print(f"Non-missing proportion: {non_missing_prop:.3f}")
|
| 149 |
+
preview_printed = True
|
| 150 |
+
|
| 151 |
+
# If clinical_df not available or column missing, try known preview dict names
|
| 152 |
+
if not preview_printed and col_name:
|
| 153 |
+
for dict_name in ['age_values_dict', 'age_preview_dict', 'gender_values_dict', 'gender_preview_dict']:
|
| 154 |
+
if dict_name in globals():
|
| 155 |
+
d = globals()[dict_name]
|
| 156 |
+
if isinstance(d, dict) and col_name in d:
|
| 157 |
+
print(f"Selected {kind}_col:", col_name)
|
| 158 |
+
print(f"First 5 values (from {dict_name}): {d[col_name]}")
|
| 159 |
+
preview_printed = True
|
| 160 |
+
break
|
| 161 |
+
|
| 162 |
+
if not preview_printed:
|
| 163 |
+
print(f"Selected {kind}_col:", col_name)
|
| 164 |
+
print(f"No preview available for {col_name}.")
|
| 165 |
+
|
| 166 |
+
return non_missing_prop
|
| 167 |
+
|
| 168 |
+
# Print and validate age column; if too sparse, set to None
|
| 169 |
+
age_non_missing = print_preview(age_col, "age")
|
| 170 |
+
if age_col and age_non_missing is not None and age_non_missing < 0.5:
|
| 171 |
+
print(f"age_col '{age_col}' has high missingness ({age_non_missing:.3f}); setting age_col to None.")
|
| 172 |
+
age_col = None
|
| 173 |
+
|
| 174 |
+
# Print and validate gender column; if too sparse, set to None
|
| 175 |
+
gender_non_missing = print_preview(gender_col, "gender")
|
| 176 |
+
if gender_col and gender_non_missing is not None and gender_non_missing < 0.5:
|
| 177 |
+
print(f"gender_col '{gender_col}' has high missingness ({gender_non_missing:.3f}); setting gender_col to None.")
|
| 178 |
+
gender_col = None
|
| 179 |
+
|
| 180 |
+
# Step 4: Feature Engineering and Validation
|
| 181 |
+
import os
|
| 182 |
+
import pandas as pd
|
| 183 |
+
|
| 184 |
+
# 1) Extract and standardize clinical features
|
| 185 |
+
if 'clinical_df' in globals():
|
| 186 |
+
_clinical_df = clinical_df
|
| 187 |
+
elif 'tcga_clinical_df' in globals():
|
| 188 |
+
_clinical_df = tcga_clinical_df
|
| 189 |
+
else:
|
| 190 |
+
raise RuntimeError("Clinical dataframe not found. Ensure previous steps loaded TCGA clinical data.")
|
| 191 |
+
|
| 192 |
+
selected_clinical_df = tcga_select_clinical_features(
|
| 193 |
+
clinical_df=_clinical_df,
|
| 194 |
+
trait=trait,
|
| 195 |
+
age_col=age_col if 'age_col' in globals() else None,
|
| 196 |
+
gender_col=gender_col if 'gender_col' in globals() else None
|
| 197 |
+
)
|
| 198 |
+
|
| 199 |
+
# 2) Normalize gene symbols in expression data
|
| 200 |
+
if 'tcga_genetic_df' not in globals():
|
| 201 |
+
raise RuntimeError("Genetic dataframe not found. Ensure previous steps loaded TCGA genetic data.")
|
| 202 |
+
_gene_df_raw = tcga_genetic_df.copy()
|
| 203 |
+
|
| 204 |
+
def _tcga_orientation_fix(df: pd.DataFrame) -> pd.DataFrame:
|
| 205 |
+
idx_tcga_prop = pd.Series(df.index.astype(str)).str.startswith('TCGA-').mean() if len(df.index) else 0.0
|
| 206 |
+
col_tcga_prop = pd.Series(df.columns.astype(str)).str.startswith('TCGA-').mean() if len(df.columns) else 0.0
|
| 207 |
+
return df if col_tcga_prop >= idx_tcga_prop else df.T
|
| 208 |
+
|
| 209 |
+
_gene_df = _tcga_orientation_fix(_gene_df_raw)
|
| 210 |
+
|
| 211 |
+
# Ensure numeric expression values
|
| 212 |
+
_gene_df = _gene_df.apply(pd.to_numeric, errors='coerce')
|
| 213 |
+
|
| 214 |
+
# Normalize gene symbols using synonym mapping; drop unrecognized; aggregate duplicates by mean
|
| 215 |
+
normalized_gene_df = normalize_gene_symbols_in_index(_gene_df)
|
| 216 |
+
|
| 217 |
+
# Save normalized gene expression matrix (genes x samples)
|
| 218 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 219 |
+
normalized_gene_df.to_csv(out_gene_data_file, index=True)
|
| 220 |
+
|
| 221 |
+
# 3) Link clinical and genetic data on sample IDs
|
| 222 |
+
gene_df_samples = normalized_gene_df.T
|
| 223 |
+
common_samples = selected_clinical_df.index.intersection(gene_df_samples.index)
|
| 224 |
+
linked_data = selected_clinical_df.loc[common_samples].join(gene_df_samples.loc[common_samples], how='inner')
|
| 225 |
+
|
| 226 |
+
# 4) Handle missing values
|
| 227 |
+
linked_data_processed = handle_missing_values(linked_data, trait_col=trait)
|
| 228 |
+
|
| 229 |
+
# 5) Determine bias and remove biased demographic features if necessary
|
| 230 |
+
trait_biased, linked_data_final = judge_and_remove_biased_features(linked_data_processed, trait=trait)
|
| 231 |
+
|
| 232 |
+
# 6) Final validation and save cohort info
|
| 233 |
+
covariate_cols = [trait, 'Age', 'Gender']
|
| 234 |
+
gene_cols_final = [c for c in linked_data_final.columns if c not in covariate_cols]
|
| 235 |
+
|
| 236 |
+
# Ensure native Python bools to avoid JSON serialization issues
|
| 237 |
+
is_gene_available = bool(len(gene_cols_final) > 0)
|
| 238 |
+
has_trait_col = bool(trait in linked_data_final.columns)
|
| 239 |
+
has_trait_non_missing = bool(linked_data_final[trait].notna().any()) if has_trait_col else False
|
| 240 |
+
is_trait_available = bool(has_trait_col and has_trait_non_missing)
|
| 241 |
+
trait_biased = bool(trait_biased)
|
| 242 |
+
|
| 243 |
+
note_parts = []
|
| 244 |
+
note_parts.append("INFO: Used TCGA_Lung_Cancer_(LUNG) cohort with trait inferred from sample type codes.")
|
| 245 |
+
if 'age_col' in globals() and age_col:
|
| 246 |
+
note_parts.append(f"INFO: Age column selected: {age_col}.")
|
| 247 |
+
if 'gender_col' in globals() and gender_col:
|
| 248 |
+
note_parts.append(f"INFO: Gender column selected: {gender_col}.")
|
| 249 |
+
note_parts.append(f"INFO: Gene matrix normalized to NCBI Gene synonyms; genes kept: {int(normalized_gene_df.shape[0])}; samples linked: {int(linked_data.shape[0])}.")
|
| 250 |
+
note = " ".join(note_parts)
|
| 251 |
+
|
| 252 |
+
is_usable = validate_and_save_cohort_info(
|
| 253 |
+
is_final=True,
|
| 254 |
+
cohort="TCGA",
|
| 255 |
+
info_path=json_path,
|
| 256 |
+
is_gene_available=is_gene_available,
|
| 257 |
+
is_trait_available=is_trait_available,
|
| 258 |
+
is_biased=trait_biased,
|
| 259 |
+
df=linked_data_final,
|
| 260 |
+
note=note
|
| 261 |
+
)
|
| 262 |
+
|
| 263 |
+
# 7) Save linked data if usable
|
| 264 |
+
if is_usable:
|
| 265 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 266 |
+
linked_data_final.to_csv(out_data_file, index=True)
|
output/preprocess/Lung_Cancer/cohort_info.json
CHANGED
|
@@ -1,102 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"GSE280643": {
|
| 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": 18
|
| 11 |
-
},
|
| 12 |
-
"GSE249568": {
|
| 13 |
-
"is_usable": false,
|
| 14 |
-
"is_gene_available": false,
|
| 15 |
-
"is_trait_available": false,
|
| 16 |
-
"is_available": false,
|
| 17 |
-
"is_biased": null,
|
| 18 |
-
"has_age": null,
|
| 19 |
-
"has_gender": null,
|
| 20 |
-
"sample_size": null
|
| 21 |
-
},
|
| 22 |
-
"GSE248830": {
|
| 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": true,
|
| 29 |
-
"has_gender": true,
|
| 30 |
-
"sample_size": 41
|
| 31 |
-
},
|
| 32 |
-
"GSE244647": {
|
| 33 |
-
"is_usable": false,
|
| 34 |
-
"is_gene_available": false,
|
| 35 |
-
"is_trait_available": true,
|
| 36 |
-
"is_available": false,
|
| 37 |
-
"is_biased": null,
|
| 38 |
-
"has_age": null,
|
| 39 |
-
"has_gender": null,
|
| 40 |
-
"sample_size": null
|
| 41 |
-
},
|
| 42 |
-
"GSE244645": {
|
| 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": 69
|
| 51 |
-
},
|
| 52 |
-
"GSE244123": {
|
| 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": true,
|
| 59 |
-
"has_gender": true,
|
| 60 |
-
"sample_size": 95
|
| 61 |
-
},
|
| 62 |
-
"GSE244117": {
|
| 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": true,
|
| 69 |
-
"has_gender": true,
|
| 70 |
-
"sample_size": 95
|
| 71 |
-
},
|
| 72 |
-
"GSE222124": {
|
| 73 |
-
"is_usable": false,
|
| 74 |
-
"is_gene_available": false,
|
| 75 |
-
"is_trait_available": false,
|
| 76 |
-
"is_available": false,
|
| 77 |
-
"is_biased": null,
|
| 78 |
-
"has_age": null,
|
| 79 |
-
"has_gender": null,
|
| 80 |
-
"sample_size": null
|
| 81 |
-
},
|
| 82 |
-
"GSE21359": {
|
| 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": true,
|
| 89 |
-
"has_gender": true,
|
| 90 |
-
"sample_size": 135
|
| 91 |
-
},
|
| 92 |
-
"TCGA": {
|
| 93 |
-
"is_usable": true,
|
| 94 |
-
"is_gene_available": true,
|
| 95 |
-
"is_trait_available": true,
|
| 96 |
-
"is_available": true,
|
| 97 |
-
"is_biased": false,
|
| 98 |
-
"has_age": true,
|
| 99 |
-
"has_gender": true,
|
| 100 |
-
"sample_size": 1129
|
| 101 |
-
}
|
| 102 |
-
}
|
|
|
|
| 1 |
+
{"GSE280643": {"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": 18, "note": "INFO: Only lung normals treated as controls; non-lung controls excluded during trait conversion."}, "GSE249568": {"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}, "GSE249262": {"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": 70, "note": "INFO: Cell line and non-human/irrelevant samples excluded via trait conversion; Age/Gender not provided in series; CTC-based blood samples from stage III NSCLC and healthy controls."}, "GSE248830": {"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": 41, "note": ""}, "GSE244647": {"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": 38, "note": "WARNING: Normalization produced empty result. Falling back to probe-level matrix."}, "GSE244645": {"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": 38, "note": "INFO: Platelet microarray dataset; trait derived from histology (Lung vs HNSCC). Samples include pre/post-treatment timepoints."}, "GSE244123": {"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}, "GSE244117": {"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}, "GSE222124": {"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}, "GSE21359": {"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": 1129, "note": "INFO: Used TCGA_Lung_Cancer_(LUNG) cohort with trait inferred from sample type codes. INFO: Age column selected: age_at_initial_pathologic_diagnosis. INFO: Gender column selected: gender. INFO: Gene matrix normalized to NCBI Gene synonyms; genes kept: 19848; samples linked: 1129."}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Lung_Cancer/gene_data/GSE280643.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
output/preprocess/Melanoma/clinical_data/GSE144296.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
output/preprocess/Melanoma/clinical_data/GSE148319.csv
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
,GSM4460266,GSM4460267,GSM4460268,GSM4460269,GSM4460270,GSM4460271,GSM4460272,GSM4460273,GSM4460274,GSM4460275,GSM4460276,GSM4460277,GSM4460278,GSM4460279,GSM4460280,GSM4460281,GSM4460282,GSM4460283,GSM4460284,GSM4460285,GSM4460286,GSM4460287,GSM4460288,GSM4460289,GSM4460290,GSM4460291,GSM4460292,GSM4460293,GSM4460294,GSM4460295,GSM4460296,GSM4460297,GSM4460298,GSM4460299,GSM4460300,GSM4460301,GSM4460302,GSM4460303,GSM4460304,GSM4460305,GSM4460306,GSM4460307,GSM4460308,GSM4460309,GSM4460310,GSM4460311,GSM4460312,GSM4460313,GSM4460314,GSM4460315,GSM4460316,GSM4460317,GSM4460318,GSM4460319,GSM4460320,GSM4460321,GSM4460322,GSM4460323,GSM4460324,GSM4460325,GSM4460326,GSM4460327,GSM4460328,GSM4460329,GSM4460330,GSM4460331,GSM4460332,GSM4460333,GSM4460334,GSM4460335,GSM4460336,GSM4460337,GSM4460338,GSM4460339,GSM4460340,GSM4460341,GSM4460342,GSM4460343,GSM4460344,GSM4460345,GSM4460346,GSM4460347,GSM4460348
|
| 2 |
-
Melanoma,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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 |
,GSM4460266,GSM4460267,GSM4460268,GSM4460269,GSM4460270,GSM4460271,GSM4460272,GSM4460273,GSM4460274,GSM4460275,GSM4460276,GSM4460277,GSM4460278,GSM4460279,GSM4460280,GSM4460281,GSM4460282,GSM4460283,GSM4460284,GSM4460285,GSM4460286,GSM4460287,GSM4460288,GSM4460289,GSM4460290,GSM4460291,GSM4460292,GSM4460293,GSM4460294,GSM4460295,GSM4460296,GSM4460297,GSM4460298,GSM4460299,GSM4460300,GSM4460301,GSM4460302,GSM4460303,GSM4460304,GSM4460305,GSM4460306,GSM4460307,GSM4460308,GSM4460309,GSM4460310,GSM4460311,GSM4460312,GSM4460313,GSM4460314,GSM4460315,GSM4460316,GSM4460317,GSM4460318,GSM4460319,GSM4460320,GSM4460321,GSM4460322,GSM4460323,GSM4460324,GSM4460325,GSM4460326,GSM4460327,GSM4460328,GSM4460329,GSM4460330,GSM4460331,GSM4460332,GSM4460333,GSM4460334,GSM4460335,GSM4460336,GSM4460337,GSM4460338,GSM4460339,GSM4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
TCGA-
|
| 100 |
-
TCGA-
|
| 101 |
-
TCGA-
|
| 102 |
-
TCGA-
|
| 103 |
-
TCGA-
|
| 104 |
-
TCGA-
|
| 105 |
-
TCGA-
|
| 106 |
-
TCGA-
|
| 107 |
-
TCGA-
|
| 108 |
-
TCGA-
|
| 109 |
-
TCGA-
|
| 110 |
-
TCGA-
|
| 111 |
-
TCGA-
|
| 112 |
-
TCGA-
|
| 113 |
-
TCGA-
|
| 114 |
-
TCGA-
|
| 115 |
-
TCGA-
|
| 116 |
-
TCGA-
|
| 117 |
-
TCGA-
|
| 118 |
-
TCGA-
|
| 119 |
-
TCGA-
|
| 120 |
-
TCGA-
|
| 121 |
-
TCGA-
|
| 122 |
-
TCGA-
|
| 123 |
-
TCGA-
|
| 124 |
-
TCGA-
|
| 125 |
-
TCGA-
|
| 126 |
-
TCGA-
|
| 127 |
-
TCGA-
|
| 128 |
-
TCGA-
|
| 129 |
-
TCGA-
|
| 130 |
-
TCGA-
|
| 131 |
-
TCGA-
|
| 132 |
-
TCGA-
|
| 133 |
-
TCGA-
|
| 134 |
-
TCGA-
|
| 135 |
-
TCGA-
|
| 136 |
-
TCGA-
|
| 137 |
-
TCGA-
|
| 138 |
-
TCGA-
|
| 139 |
-
TCGA-
|
| 140 |
-
TCGA-
|
| 141 |
-
TCGA-
|
| 142 |
-
TCGA-
|
| 143 |
-
TCGA-
|
| 144 |
-
TCGA-
|
| 145 |
-
TCGA-
|
| 146 |
-
TCGA-
|
| 147 |
-
TCGA-
|
| 148 |
-
TCGA-
|
| 149 |
-
TCGA-
|
| 150 |
-
TCGA-
|
| 151 |
-
TCGA-
|
| 152 |
-
TCGA-
|
| 153 |
-
TCGA-
|
| 154 |
-
TCGA-
|
| 155 |
-
TCGA-
|
| 156 |
-
TCGA-
|
| 157 |
-
TCGA-
|
| 158 |
-
TCGA-
|
| 159 |
-
TCGA-
|
| 160 |
-
TCGA-
|
| 161 |
-
TCGA-
|
| 162 |
-
TCGA-
|
| 163 |
-
TCGA-
|
| 164 |
-
TCGA-
|
| 165 |
-
TCGA-
|
| 166 |
-
TCGA-
|
| 167 |
-
TCGA-
|
| 168 |
-
TCGA-
|
| 169 |
-
TCGA-
|
| 170 |
-
TCGA-
|
| 171 |
-
TCGA-
|
| 172 |
-
TCGA-
|
| 173 |
-
TCGA-
|
| 174 |
-
TCGA-
|
| 175 |
-
TCGA-
|
| 176 |
-
TCGA-
|
| 177 |
-
TCGA-
|
| 178 |
-
TCGA-
|
| 179 |
-
TCGA-
|
| 180 |
-
TCGA-
|
| 181 |
-
TCGA-
|
| 182 |
-
TCGA-
|
| 183 |
-
TCGA-
|
| 184 |
-
TCGA-
|
| 185 |
-
TCGA-
|
| 186 |
-
TCGA-
|
| 187 |
-
TCGA-
|
| 188 |
-
TCGA-
|
| 189 |
-
TCGA-
|
| 190 |
-
TCGA-
|
| 191 |
-
TCGA-
|
| 192 |
-
TCGA-
|
| 193 |
-
TCGA-
|
| 194 |
-
TCGA-
|
| 195 |
-
TCGA-
|
| 196 |
-
TCGA-
|
| 197 |
-
TCGA-
|
| 198 |
-
TCGA-
|
| 199 |
-
TCGA-
|
| 200 |
-
TCGA-
|
| 201 |
-
TCGA-
|
| 202 |
-
TCGA-
|
| 203 |
-
TCGA-
|
| 204 |
-
TCGA-
|
| 205 |
-
TCGA-
|
| 206 |
-
TCGA-
|
| 207 |
-
TCGA-
|
| 208 |
-
TCGA-
|
| 209 |
-
TCGA-
|
| 210 |
-
TCGA-
|
| 211 |
-
TCGA-
|
| 212 |
-
TCGA-
|
| 213 |
-
TCGA-
|
| 214 |
-
TCGA-
|
| 215 |
-
TCGA-
|
| 216 |
-
TCGA-
|
| 217 |
-
TCGA-
|
| 218 |
-
TCGA-
|
| 219 |
-
TCGA-
|
| 220 |
-
TCGA-
|
| 221 |
-
TCGA-
|
| 222 |
-
TCGA-
|
| 223 |
-
TCGA-
|
| 224 |
-
TCGA-
|
| 225 |
-
TCGA-
|
| 226 |
-
TCGA-
|
| 227 |
-
TCGA-
|
| 228 |
-
TCGA-
|
| 229 |
-
TCGA-
|
| 230 |
-
TCGA-
|
| 231 |
-
TCGA-
|
| 232 |
-
TCGA-
|
| 233 |
-
TCGA-
|
| 234 |
-
TCGA-
|
| 235 |
-
TCGA-
|
| 236 |
-
TCGA-
|
| 237 |
-
TCGA-
|
| 238 |
-
TCGA-
|
| 239 |
-
TCGA-
|
| 240 |
-
TCGA-
|
| 241 |
-
TCGA-
|
| 242 |
-
TCGA-
|
| 243 |
-
TCGA-
|
| 244 |
-
TCGA-
|
| 245 |
-
TCGA-
|
| 246 |
-
TCGA-
|
| 247 |
-
TCGA-
|
| 248 |
-
TCGA-
|
| 249 |
-
TCGA-
|
| 250 |
-
TCGA-
|
| 251 |
-
TCGA-
|
| 252 |
-
TCGA-
|
| 253 |
-
TCGA-
|
| 254 |
-
TCGA-
|
| 255 |
-
TCGA-
|
| 256 |
-
TCGA-
|
| 257 |
-
TCGA-
|
| 258 |
-
TCGA-
|
| 259 |
-
TCGA-
|
| 260 |
-
TCGA-
|
| 261 |
-
TCGA-
|
| 262 |
-
TCGA-
|
| 263 |
-
TCGA-
|
| 264 |
-
TCGA-
|
| 265 |
-
TCGA-
|
| 266 |
-
TCGA-
|
| 267 |
-
TCGA-
|
| 268 |
-
TCGA-
|
| 269 |
-
TCGA-
|
| 270 |
-
TCGA-
|
| 271 |
-
TCGA-
|
| 272 |
-
TCGA-
|
| 273 |
-
TCGA-
|
| 274 |
-
TCGA-
|
| 275 |
-
TCGA-
|
| 276 |
-
TCGA-
|
| 277 |
-
TCGA-
|
| 278 |
-
TCGA-
|
| 279 |
-
TCGA-
|
| 280 |
-
TCGA-
|
| 281 |
-
TCGA-
|
| 282 |
-
TCGA-
|
| 283 |
-
TCGA-
|
| 284 |
-
TCGA-
|
| 285 |
-
TCGA-
|
| 286 |
-
TCGA-
|
| 287 |
-
TCGA-
|
| 288 |
-
TCGA-
|
| 289 |
-
TCGA-
|
| 290 |
-
TCGA-
|
| 291 |
-
TCGA-
|
| 292 |
-
TCGA-
|
| 293 |
-
TCGA-
|
| 294 |
-
TCGA-
|
| 295 |
-
TCGA-
|
| 296 |
-
TCGA-
|
| 297 |
-
TCGA-
|
| 298 |
-
TCGA-
|
| 299 |
-
TCGA-
|
| 300 |
-
TCGA-
|
| 301 |
-
TCGA-
|
| 302 |
-
TCGA-
|
| 303 |
-
TCGA-
|
| 304 |
-
TCGA-
|
| 305 |
-
TCGA-
|
| 306 |
-
TCGA-
|
| 307 |
-
TCGA-
|
| 308 |
-
TCGA-
|
| 309 |
-
TCGA-
|
| 310 |
-
TCGA-
|
| 311 |
-
TCGA-
|
| 312 |
-
TCGA-
|
| 313 |
-
TCGA-
|
| 314 |
-
TCGA-
|
| 315 |
-
TCGA-
|
| 316 |
-
TCGA-
|
| 317 |
-
TCGA-
|
| 318 |
-
TCGA-
|
| 319 |
-
TCGA-
|
| 320 |
-
TCGA-
|
| 321 |
-
TCGA-
|
| 322 |
-
TCGA-
|
| 323 |
-
TCGA-
|
| 324 |
-
TCGA-
|
| 325 |
-
TCGA-
|
| 326 |
-
TCGA-
|
| 327 |
-
TCGA-
|
| 328 |
-
TCGA-
|
| 329 |
-
TCGA-
|
| 330 |
-
TCGA-
|
| 331 |
-
TCGA-
|
| 332 |
-
TCGA-
|
| 333 |
-
TCGA-
|
| 334 |
-
TCGA-
|
| 335 |
-
TCGA-
|
| 336 |
-
TCGA-
|
| 337 |
-
TCGA-
|
| 338 |
-
TCGA-
|
| 339 |
-
TCGA-
|
| 340 |
-
TCGA-
|
| 341 |
-
TCGA-
|
| 342 |
-
TCGA-
|
| 343 |
-
TCGA-
|
| 344 |
-
TCGA-
|
| 345 |
-
TCGA-
|
| 346 |
-
TCGA-
|
| 347 |
-
TCGA-
|
| 348 |
-
TCGA-
|
| 349 |
-
TCGA-
|
| 350 |
-
TCGA-
|
| 351 |
-
TCGA-
|
| 352 |
-
TCGA-
|
| 353 |
-
TCGA-
|
| 354 |
-
TCGA-
|
| 355 |
-
TCGA-
|
| 356 |
-
TCGA-
|
| 357 |
-
TCGA-
|
| 358 |
-
TCGA-
|
| 359 |
-
TCGA-
|
| 360 |
-
TCGA-
|
| 361 |
-
TCGA-
|
| 362 |
-
TCGA-
|
| 363 |
-
TCGA-
|
| 364 |
-
TCGA-
|
| 365 |
-
TCGA-
|
| 366 |
-
TCGA-
|
| 367 |
-
TCGA-
|
| 368 |
-
TCGA-
|
| 369 |
-
TCGA-
|
| 370 |
-
TCGA-
|
| 371 |
-
TCGA-
|
| 372 |
-
TCGA-
|
| 373 |
-
TCGA-
|
| 374 |
-
TCGA-
|
| 375 |
-
TCGA-
|
| 376 |
-
TCGA-
|
| 377 |
-
TCGA-
|
| 378 |
-
TCGA-
|
| 379 |
-
TCGA-
|
| 380 |
-
TCGA-
|
| 381 |
-
TCGA-
|
| 382 |
-
TCGA-
|
| 383 |
-
TCGA-
|
| 384 |
-
TCGA-
|
| 385 |
-
TCGA-
|
| 386 |
-
TCGA-
|
| 387 |
-
TCGA-
|
| 388 |
-
TCGA-
|
| 389 |
-
TCGA-
|
| 390 |
-
TCGA-
|
| 391 |
-
TCGA-
|
| 392 |
-
TCGA-
|
| 393 |
-
TCGA-
|
| 394 |
-
TCGA-
|
| 395 |
-
TCGA-
|
| 396 |
-
TCGA-
|
| 397 |
-
TCGA-
|
| 398 |
-
TCGA-
|
| 399 |
-
TCGA-
|
| 400 |
-
TCGA-
|
| 401 |
-
TCGA-
|
| 402 |
-
TCGA-
|
| 403 |
-
TCGA-
|
| 404 |
-
TCGA-
|
| 405 |
-
TCGA-
|
| 406 |
-
TCGA-
|
| 407 |
-
TCGA-
|
| 408 |
-
TCGA-
|
| 409 |
-
TCGA-
|
| 410 |
-
TCGA-
|
| 411 |
-
TCGA-
|
| 412 |
-
TCGA-
|
| 413 |
-
TCGA-
|
| 414 |
-
TCGA-
|
| 415 |
-
TCGA-
|
| 416 |
-
TCGA-
|
| 417 |
-
TCGA-
|
| 418 |
-
TCGA-
|
| 419 |
-
TCGA-
|
| 420 |
-
TCGA-
|
| 421 |
-
TCGA-
|
| 422 |
-
TCGA-
|
| 423 |
-
TCGA-
|
| 424 |
-
TCGA-
|
| 425 |
-
TCGA-
|
| 426 |
-
TCGA-
|
| 427 |
-
TCGA-
|
| 428 |
-
TCGA-
|
| 429 |
-
TCGA-
|
| 430 |
-
TCGA-
|
| 431 |
-
TCGA-
|
| 432 |
-
TCGA-
|
| 433 |
-
TCGA-
|
| 434 |
-
TCGA-
|
| 435 |
-
TCGA-
|
| 436 |
-
TCGA-
|
| 437 |
-
TCGA-
|
| 438 |
-
TCGA-
|
| 439 |
-
TCGA-
|
| 440 |
-
TCGA-
|
| 441 |
-
TCGA-
|
| 442 |
-
TCGA-
|
| 443 |
-
TCGA-
|
| 444 |
-
TCGA-
|
| 445 |
-
TCGA-
|
| 446 |
-
TCGA-
|
| 447 |
-
TCGA-
|
| 448 |
-
TCGA-
|
| 449 |
-
TCGA-
|
| 450 |
-
TCGA-
|
| 451 |
-
TCGA-
|
| 452 |
-
TCGA-
|
| 453 |
-
TCGA-
|
| 454 |
-
TCGA-
|
| 455 |
-
TCGA-
|
| 456 |
-
TCGA-
|
| 457 |
-
TCGA-
|
| 458 |
-
TCGA-
|
| 459 |
-
TCGA-
|
| 460 |
-
TCGA-
|
| 461 |
-
TCGA-
|
| 462 |
-
TCGA-
|
| 463 |
-
TCGA-
|
| 464 |
-
TCGA-
|
| 465 |
-
TCGA-
|
| 466 |
-
TCGA-
|
| 467 |
-
TCGA-
|
| 468 |
-
TCGA-
|
| 469 |
-
TCGA-
|
| 470 |
-
TCGA-
|
| 471 |
-
TCGA-
|
| 472 |
-
TCGA-
|
| 473 |
-
TCGA-
|
| 474 |
-
TCGA-
|
| 475 |
-
TCGA-
|
| 476 |
-
TCGA-
|
| 477 |
-
TCGA-
|
| 478 |
-
TCGA-
|
| 479 |
-
TCGA-
|
| 480 |
-
TCGA-
|
| 481 |
-
TCGA-
|
| 482 |
-
TCGA-
|
| 483 |
-
TCGA-97-8172-01,1,75.0,0.0
|
| 484 |
-
TCGA-L9-A7SV-01,1,69.0,1.0
|
| 485 |
-
TCGA-60-2698-01,1,62.0,1.0
|
| 486 |
-
TCGA-55-7283-01,1,76.0,0.0
|
| 487 |
-
TCGA-91-6830-01,1,65.0,0.0
|
| 488 |
-
TCGA-18-3414-01,1,73.0,1.0
|
| 489 |
-
TCGA-94-7033-01,1,73.0,1.0
|
| 490 |
-
TCGA-49-4512-01,1,69.0,0.0
|
| 491 |
-
TCGA-86-8358-01,1,44.0,1.0
|
| 492 |
-
TCGA-85-8580-01,1,52.0,0.0
|
| 493 |
-
TCGA-50-6673-01,1,84.0,0.0
|
| 494 |
-
TCGA-95-7944-01,1,71.0,1.0
|
| 495 |
-
TCGA-34-A5IX-01,1,80.0,1.0
|
| 496 |
-
TCGA-91-8496-01,1,63.0,0.0
|
| 497 |
-
TCGA-18-3407-01,1,72.0,1.0
|
| 498 |
-
TCGA-95-7948-01,1,42.0,0.0
|
| 499 |
-
TCGA-44-6776-01,1,60.0,0.0
|
| 500 |
-
TCGA-44-2661-11,0,69.0,0.0
|
| 501 |
-
TCGA-50-6594-01,1,79.0,0.0
|
| 502 |
-
TCGA-21-1077-01,1,64.0,1.0
|
| 503 |
-
TCGA-77-8133-01,1,74.0,1.0
|
| 504 |
-
TCGA-92-7341-01,1,71.0,1.0
|
| 505 |
-
TCGA-77-A5G3-01,1,63.0,1.0
|
| 506 |
-
TCGA-34-5928-01,1,83.0,0.0
|
| 507 |
-
TCGA-56-7221-01,1,79.0,1.0
|
| 508 |
-
TCGA-56-7823-01,1,58.0,0.0
|
| 509 |
-
TCGA-21-5787-01,1,65.0,1.0
|
| 510 |
-
TCGA-55-6985-11,0,58.0,0.0
|
| 511 |
-
TCGA-51-6867-01,1,72.0,0.0
|
| 512 |
-
TCGA-96-8170-01,1,75.0,0.0
|
| 513 |
-
TCGA-85-A5B5-01,1,58.0,1.0
|
| 514 |
-
TCGA-O2-A52Q-01,1,44.0,0.0
|
| 515 |
-
TCGA-96-7544-01,1,83.0,1.0
|
| 516 |
-
TCGA-97-7552-01,1,70.0,1.0
|
| 517 |
-
TCGA-55-8302-01,1,54.0,1.0
|
| 518 |
-
TCGA-94-7943-01,1,80.0,1.0
|
| 519 |
-
TCGA-58-8393-01,1,68.0,0.0
|
| 520 |
-
TCGA-73-4659-01,1,66.0,1.0
|
| 521 |
-
TCGA-05-4398-01,1,47.0,0.0
|
| 522 |
-
TCGA-44-7659-01,1,70.0,1.0
|
| 523 |
-
TCGA-55-8620-01,1,60.0,1.0
|
| 524 |
-
TCGA-44-7667-01,1,49.0,0.0
|
| 525 |
-
TCGA-60-2712-01,1,79.0,0.0
|
| 526 |
-
TCGA-66-2782-01,1,71.0,1.0
|
| 527 |
-
TCGA-33-AAS8-01,1,59.0,0.0
|
| 528 |
-
TCGA-50-5932-01,1,75.0,1.0
|
| 529 |
-
TCGA-77-8130-01,1,69.0,1.0
|
| 530 |
-
TCGA-55-6983-01,1,81.0,1.0
|
| 531 |
-
TCGA-18-4721-01,1,74.0,1.0
|
| 532 |
-
TCGA-98-A53D-01,1,68.0,1.0
|
| 533 |
-
TCGA-50-5930-11,0,47.0,1.0
|
| 534 |
-
TCGA-38-4630-01,1,75.0,0.0
|
| 535 |
-
TCGA-77-7338-01,1,64.0,1.0
|
| 536 |
-
TCGA-86-7955-01,1,62.0,1.0
|
| 537 |
-
TCGA-55-6972-01,1,72.0,1.0
|
| 538 |
-
TCGA-NC-A5HL-01,1,73.0,1.0
|
| 539 |
-
TCGA-85-8071-01,1,52.0,1.0
|
| 540 |
-
TCGA-34-7107-01,1,70.0,1.0
|
| 541 |
-
TCGA-22-5479-01,1,64.0,1.0
|
| 542 |
-
TCGA-67-6216-01,1,57.0,0.0
|
| 543 |
-
TCGA-67-3773-01,1,84.0,0.0
|
| 544 |
-
TCGA-44-7672-01,1,52.0,0.0
|
| 545 |
-
TCGA-85-8052-01,1,53.0,1.0
|
| 546 |
-
TCGA-22-4609-01,1,81.0,1.0
|
| 547 |
-
TCGA-50-5939-11,0,85.0,1.0
|
| 548 |
-
TCGA-56-7582-11,0,83.0,1.0
|
| 549 |
-
TCGA-39-5011-01,1,70.0,0.0
|
| 550 |
-
TCGA-05-4433-01,1,82.0,1.0
|
| 551 |
-
TCGA-68-7756-01,1,84.0,1.0
|
| 552 |
-
TCGA-50-6595-01,1,74.0,0.0
|
| 553 |
-
TCGA-37-3789-01,1,65.0,1.0
|
| 554 |
-
TCGA-55-7995-01,1,73.0,0.0
|
| 555 |
-
TCGA-69-7760-01,1,73.0,1.0
|
| 556 |
-
TCGA-49-AAR4-01,1,51.0,1.0
|
| 557 |
-
TCGA-18-4083-01,1,63.0,1.0
|
| 558 |
-
TCGA-49-4488-01,1,74.0,0.0
|
| 559 |
-
TCGA-64-5815-01,1,74.0,1.0
|
| 560 |
-
TCGA-78-7154-01,1,72.0,1.0
|
| 561 |
-
TCGA-21-1075-01,1,57.0,1.0
|
| 562 |
-
TCGA-90-6837-01,1,64.0,1.0
|
| 563 |
-
TCGA-66-2785-01,1,65.0,1.0
|
| 564 |
-
TCGA-49-4507-01,1,73.0,0.0
|
| 565 |
-
TCGA-34-5234-01,1,71.0,0.0
|
| 566 |
-
TCGA-22-5471-11,0,75.0,1.0
|
| 567 |
-
TCGA-78-7542-01,1,56.0,1.0
|
| 568 |
-
TCGA-50-6593-01,1,49.0,0.0
|
| 569 |
-
TCGA-90-7769-01,1,55.0,1.0
|
| 570 |
-
TCGA-34-2596-01,1,70.0,1.0
|
| 571 |
-
TCGA-86-8056-01,1,63.0,0.0
|
| 572 |
-
TCGA-05-4420-01,1,41.0,1.0
|
| 573 |
-
TCGA-77-A5G6-01,1,66.0,1.0
|
| 574 |
-
TCGA-NC-A5HH-01,1,53.0,1.0
|
| 575 |
-
TCGA-66-2755-01,1,63.0,1.0
|
| 576 |
-
TCGA-69-7761-01,1,84.0,1.0
|
| 577 |
-
TCGA-91-7771-01,1,62.0,1.0
|
| 578 |
-
TCGA-55-A4DF-01,1,88.0,1.0
|
| 579 |
-
TCGA-55-6970-01,1,67.0,0.0
|
| 580 |
-
TCGA-60-2709-01,1,69.0,1.0
|
| 581 |
-
TCGA-69-8453-01,1,77.0,1.0
|
| 582 |
-
TCGA-22-5471-01,1,75.0,1.0
|
| 583 |
-
TCGA-22-4607-01,1,75.0,1.0
|
| 584 |
-
TCGA-33-4587-11,0,63.0,0.0
|
| 585 |
-
TCGA-43-3920-01,1,71.0,1.0
|
| 586 |
-
TCGA-MP-A4T9-01,1,54.0,0.0
|
| 587 |
-
TCGA-73-4670-01,1,69.0,0.0
|
| 588 |
-
TCGA-73-4662-01,1,65.0,0.0
|
| 589 |
-
TCGA-L9-A444-01,1,60.0,0.0
|
| 590 |
-
TCGA-44-6776-11,0,60.0,0.0
|
| 591 |
-
TCGA-22-5492-01,1,73.0,0.0
|
| 592 |
-
TCGA-69-8255-01,1,71.0,1.0
|
| 593 |
-
TCGA-97-8176-01,1,63.0,1.0
|
| 594 |
-
TCGA-99-AA5R-01,1,70.0,0.0
|
| 595 |
-
TCGA-99-8033-01,1,74.0,0.0
|
| 596 |
-
TCGA-85-A53L-01,1,63.0,1.0
|
| 597 |
-
TCGA-55-8514-01,1,70.0,0.0
|
| 598 |
-
TCGA-38-4625-11,0,66.0,0.0
|
| 599 |
-
TCGA-55-8619-01,1,72.0,0.0
|
| 600 |
-
TCGA-55-8614-01,1,76.0,1.0
|
| 601 |
-
TCGA-44-6777-01,1,85.0,0.0
|
| 602 |
-
TCGA-78-7537-01,1,72.0,1.0
|
| 603 |
-
TCGA-55-6971-01,1,59.0,0.0
|
| 604 |
-
TCGA-38-4628-01,1,65.0,0.0
|
| 605 |
-
TCGA-50-5044-01,1,72.0,0.0
|
| 606 |
-
TCGA-77-8144-01,1,70.0,1.0
|
| 607 |
-
TCGA-05-5429-01,1,60.0,1.0
|
| 608 |
-
TCGA-91-6847-11,0,62.0,0.0
|
| 609 |
-
TCGA-55-8203-01,1,69.0,0.0
|
| 610 |
-
TCGA-78-7539-01,1,75.0,0.0
|
| 611 |
-
TCGA-93-7348-01,1,75.0,0.0
|
| 612 |
-
TCGA-37-4132-01,1,61.0,0.0
|
| 613 |
-
TCGA-55-6980-01,1,56.0,1.0
|
| 614 |
-
TCGA-55-6969-01,1,52.0,1.0
|
| 615 |
-
TCGA-50-5066-01,1,72.0,1.0
|
| 616 |
-
TCGA-22-5489-11,0,64.0,1.0
|
| 617 |
-
TCGA-MP-A4TI-01,1,72.0,1.0
|
| 618 |
-
TCGA-66-2753-01,1,69.0,1.0
|
| 619 |
-
TCGA-56-A4BY-01,1,66.0,1.0
|
| 620 |
-
TCGA-78-7540-01,1,66.0,0.0
|
| 621 |
-
TCGA-92-7340-11,0,45.0,0.0
|
| 622 |
-
TCGA-55-7570-01,1,60.0,1.0
|
| 623 |
-
TCGA-44-3919-01,1,71.0,0.0
|
| 624 |
-
TCGA-56-7580-01,1,84.0,1.0
|
| 625 |
-
TCGA-44-5644-01,1,51.0,0.0
|
| 626 |
-
TCGA-77-8007-01,1,68.0,1.0
|
| 627 |
-
TCGA-49-4506-01,1,68.0,0.0
|
| 628 |
-
TCGA-75-7030-01,1,66.36272727272727,1.0
|
| 629 |
-
TCGA-73-7499-01,1,81.0,0.0
|
| 630 |
-
TCGA-55-A4DG-01,1,71.0,1.0
|
| 631 |
-
TCGA-44-2666-01,1,43.0,1.0
|
| 632 |
-
TCGA-78-7535-01,1,45.0,1.0
|
| 633 |
-
TCGA-70-6723-01,1,65.0,1.0
|
| 634 |
-
TCGA-55-6984-11,0,71.0,0.0
|
| 635 |
-
TCGA-95-7947-01,1,67.0,1.0
|
| 636 |
-
TCGA-L3-A4E7-01,1,71.0,1.0
|
| 637 |
-
TCGA-55-6986-01,1,74.0,0.0
|
| 638 |
-
TCGA-97-7938-01,1,76.0,0.0
|
| 639 |
-
TCGA-85-8664-01,1,73.0,1.0
|
| 640 |
-
TCGA-50-5939-01,1,85.0,1.0
|
| 641 |
-
TCGA-64-1678-01,1,70.0,0.0
|
| 642 |
-
TCGA-43-5668-01,1,78.0,1.0
|
| 643 |
-
TCGA-43-3394-01,1,52.0,1.0
|
| 644 |
-
TCGA-62-A46R-01,1,54.0,0.0
|
| 645 |
-
TCGA-22-4601-01,1,73.0,0.0
|
| 646 |
-
TCGA-34-8454-01,1,62.0,0.0
|
| 647 |
-
TCGA-MP-A4T8-01,1,68.0,1.0
|
| 648 |
-
TCGA-44-2662-01,1,65.0,1.0
|
| 649 |
-
TCGA-39-5028-01,1,75.0,1.0
|
| 650 |
-
TCGA-85-7843-01,1,50.0,1.0
|
| 651 |
-
TCGA-75-6211-01,1,66.36272727272727,0.0
|
| 652 |
-
TCGA-77-8008-11,0,68.0,1.0
|
| 653 |
-
TCGA-49-4505-01,1,61.0,0.0
|
| 654 |
-
TCGA-66-2792-01,1,58.0,1.0
|
| 655 |
-
TCGA-56-8628-01,1,78.0,1.0
|
| 656 |
-
TCGA-62-A46S-01,1,73.0,1.0
|
| 657 |
-
TCGA-51-4081-11,0,55.0,1.0
|
| 658 |
-
TCGA-56-5897-01,1,74.0,1.0
|
| 659 |
-
TCGA-63-A5MR-01,1,70.0,0.0
|
| 660 |
-
TCGA-85-7697-01,1,49.0,1.0
|
| 661 |
-
TCGA-55-8089-01,1,56.0,1.0
|
| 662 |
-
TCGA-77-7337-01,1,65.0,1.0
|
| 663 |
-
TCGA-93-A4JN-01,1,71.0,1.0
|
| 664 |
-
TCGA-79-5596-01,1,66.36272727272727,1.0
|
| 665 |
-
TCGA-63-A5M9-01,1,66.36272727272727,0.0
|
| 666 |
-
TCGA-33-4533-01,1,76.0,0.0
|
| 667 |
-
TCGA-43-7658-11,0,75.0,0.0
|
| 668 |
-
TCGA-62-8397-01,1,70.0,0.0
|
| 669 |
-
TCGA-95-7567-01,1,61.0,1.0
|
| 670 |
-
TCGA-56-7222-01,1,60.0,1.0
|
| 671 |
-
TCGA-43-8116-01,1,73.0,1.0
|
| 672 |
-
TCGA-J1-A4AH-01,1,70.0,1.0
|
| 673 |
-
TCGA-05-4249-01,1,67.0,1.0
|
| 674 |
-
TCGA-96-8169-01,1,67.0,0.0
|
| 675 |
-
TCGA-91-6828-01,1,70.0,1.0
|
| 676 |
-
TCGA-78-8648-01,1,58.0,0.0
|
| 677 |
-
TCGA-64-5774-01,1,60.0,1.0
|
| 678 |
-
TCGA-62-A46Y-01,1,70.0,0.0
|
| 679 |
-
TCGA-22-4595-01,1,57.0,1.0
|
| 680 |
-
TCGA-34-5231-01,1,72.0,1.0
|
| 681 |
-
TCGA-77-8148-01,1,68.0,1.0
|
| 682 |
-
TCGA-58-A46M-01,1,61.0,1.0
|
| 683 |
-
TCGA-44-3398-01,1,77.0,0.0
|
| 684 |
-
TCGA-77-A5G7-01,1,63.0,1.0
|
| 685 |
-
TCGA-18-5592-01,1,57.0,1.0
|
| 686 |
-
TCGA-51-4080-11,0,65.0,1.0
|
| 687 |
-
TCGA-44-A47B-01,1,79.0,1.0
|
| 688 |
-
TCGA-05-5428-01,1,57.0,1.0
|
| 689 |
-
TCGA-49-4487-01,1,72.0,0.0
|
| 690 |
-
TCGA-66-2789-01,1,73.0,1.0
|
| 691 |
-
TCGA-NC-A5HG-01,1,59.0,1.0
|
| 692 |
-
TCGA-55-A490-01,1,78.0,1.0
|
| 693 |
-
TCGA-22-5482-11,0,81.0,1.0
|
| 694 |
-
TCGA-58-A46L-01,1,73.0,1.0
|
| 695 |
-
TCGA-77-7335-01,1,62.0,0.0
|
| 696 |
-
TCGA-21-1081-01,1,69.0,1.0
|
| 697 |
-
TCGA-55-6978-11,0,81.0,1.0
|
| 698 |
-
TCGA-55-A48Z-01,1,60.0,0.0
|
| 699 |
-
TCGA-56-8304-01,1,73.0,0.0
|
| 700 |
-
TCGA-90-A4ED-01,1,69.0,1.0
|
| 701 |
-
TCGA-50-5942-01,1,67.0,0.0
|
| 702 |
-
TCGA-85-A4QR-01,1,67.0,1.0
|
| 703 |
-
TCGA-22-1002-01,1,69.0,1.0
|
| 704 |
-
TCGA-78-7152-01,1,65.0,1.0
|
| 705 |
-
TCGA-56-8624-01,1,84.0,1.0
|
| 706 |
-
TCGA-77-7465-01,1,58.0,1.0
|
| 707 |
-
TCGA-18-3421-01,1,65.0,1.0
|
| 708 |
-
TCGA-J2-A4AE-01,1,77.0,0.0
|
| 709 |
-
TCGA-85-8070-01,1,71.0,1.0
|
| 710 |
-
TCGA-66-2757-01,1,65.0,0.0
|
| 711 |
-
TCGA-55-8615-01,1,67.0,1.0
|
| 712 |
-
TCGA-33-AASJ-01,1,60.0,1.0
|
| 713 |
-
TCGA-22-1017-01,1,62.0,1.0
|
| 714 |
-
TCGA-50-5072-01,1,74.0,1.0
|
| 715 |
-
TCGA-22-5478-11,0,79.0,1.0
|
| 716 |
-
TCGA-55-7573-01,1,72.0,0.0
|
| 717 |
-
TCGA-43-6773-11,0,76.0,1.0
|
| 718 |
-
TCGA-78-7166-01,1,84.0,1.0
|
| 719 |
-
TCGA-55-8208-01,1,73.0,0.0
|
| 720 |
-
TCGA-78-7633-01,1,67.0,1.0
|
| 721 |
-
TCGA-46-3767-01,1,76.0,1.0
|
| 722 |
-
TCGA-75-6207-01,1,66.36272727272727,1.0
|
| 723 |
-
TCGA-50-5935-11,0,86.0,0.0
|
| 724 |
-
TCGA-97-8175-01,1,55.0,0.0
|
| 725 |
-
TCGA-43-A56V-01,1,61.0,1.0
|
| 726 |
-
TCGA-22-4609-11,0,81.0,1.0
|
| 727 |
-
TCGA-68-8250-01,1,66.0,1.0
|
| 728 |
-
TCGA-60-2711-01,1,64.0,0.0
|
| 729 |
-
TCGA-05-5425-01,1,68.0,1.0
|
| 730 |
-
TCGA-55-6983-11,0,81.0,1.0
|
| 731 |
-
TCGA-85-A4CL-01,1,65.0,1.0
|
| 732 |
-
TCGA-44-2656-01,1,59.0,1.0
|
| 733 |
-
TCGA-22-5483-01,1,74.0,1.0
|
| 734 |
-
TCGA-97-7941-01,1,72.0,0.0
|
| 735 |
-
TCGA-44-3398-11,0,77.0,0.0
|
| 736 |
-
TCGA-49-6761-01,1,68.0,0.0
|
| 737 |
-
TCGA-58-8388-01,1,60.0,1.0
|
| 738 |
-
TCGA-92-8065-01,1,74.0,0.0
|
| 739 |
-
TCGA-55-8301-01,1,58.0,1.0
|
| 740 |
-
TCGA-55-8092-01,1,75.0,1.0
|
| 741 |
-
TCGA-91-6849-11,0,75.0,0.0
|
| 742 |
-
TCGA-77-7142-11,0,59.0,0.0
|
| 743 |
-
TCGA-34-5929-01,1,78.0,0.0
|
| 744 |
-
TCGA-44-A4SU-01,1,67.0,0.0
|
| 745 |
-
TCGA-69-A59K-01,1,60.0,0.0
|
| 746 |
-
TCGA-49-AARR-01,1,68.0,1.0
|
| 747 |
-
TCGA-64-5779-01,1,61.0,1.0
|
| 748 |
-
TCGA-56-7731-11,0,66.0,0.0
|
| 749 |
-
TCGA-66-2780-01,1,65.0,1.0
|
| 750 |
-
TCGA-78-8655-01,1,77.0,0.0
|
| 751 |
-
TCGA-50-8460-01,1,74.0,1.0
|
| 752 |
-
TCGA-98-A53H-01,1,76.0,0.0
|
| 753 |
-
TCGA-22-5474-01,1,74.0,1.0
|
| 754 |
-
TCGA-63-A5MM-01,1,69.0,0.0
|
| 755 |
-
TCGA-55-6982-01,1,79.0,0.0
|
| 756 |
-
TCGA-56-8623-01,1,71.0,1.0
|
| 757 |
-
TCGA-55-6975-11,0,61.0,1.0
|
| 758 |
-
TCGA-05-4430-01,1,59.0,0.0
|
| 759 |
-
TCGA-78-7156-01,1,62.0,1.0
|
| 760 |
-
TCGA-44-6778-01,1,59.0,1.0
|
| 761 |
-
TCGA-58-8392-01,1,70.0,1.0
|
| 762 |
-
TCGA-63-6202-01,1,66.36272727272727,1.0
|
| 763 |
-
TCGA-60-2721-01,1,73.0,1.0
|
| 764 |
-
TCGA-97-8547-01,1,78.0,0.0
|
| 765 |
-
TCGA-58-A46J-01,1,64.0,1.0
|
| 766 |
-
TCGA-66-2793-01,1,68.0,1.0
|
| 767 |
-
TCGA-99-8032-01,1,61.0,1.0
|
| 768 |
-
TCGA-56-A62T-01,1,78.0,1.0
|
| 769 |
-
TCGA-55-6981-11,0,53.0,0.0
|
| 770 |
-
TCGA-75-5126-01,1,66.36272727272727,0.0
|
| 771 |
-
TCGA-05-4426-01,1,71.0,1.0
|
| 772 |
-
TCGA-39-5022-01,1,76.0,1.0
|
| 773 |
-
TCGA-NC-A5HQ-01,1,70.0,1.0
|
| 774 |
-
TCGA-44-6145-11,0,62.0,0.0
|
| 775 |
-
TCGA-69-7974-01,1,54.0,0.0
|
| 776 |
-
TCGA-22-A5C4-01,1,70.0,1.0
|
| 777 |
-
TCGA-50-6591-01,1,63.0,0.0
|
| 778 |
-
TCGA-58-8390-01,1,70.0,1.0
|
| 779 |
-
TCGA-33-4583-01,1,73.0,1.0
|
| 780 |
-
TCGA-97-8171-01,1,81.0,1.0
|
| 781 |
-
TCGA-21-5783-01,1,76.0,1.0
|
| 782 |
-
TCGA-63-A5MV-01,1,69.0,1.0
|
| 783 |
-
TCGA-49-AAQV-01,1,63.0,0.0
|
| 784 |
-
TCGA-55-8621-01,1,75.0,0.0
|
| 785 |
-
TCGA-43-8118-01,1,55.0,0.0
|
| 786 |
-
TCGA-91-6840-01,1,59.0,0.0
|
| 787 |
-
TCGA-63-A5MS-01,1,78.0,1.0
|
| 788 |
-
TCGA-85-8351-01,1,72.0,1.0
|
| 789 |
-
TCGA-55-6969-11,0,52.0,1.0
|
| 790 |
-
TCGA-21-5786-01,1,64.0,1.0
|
| 791 |
-
TCGA-NK-A5CT-01,1,70.0,1.0
|
| 792 |
-
TCGA-55-7914-01,1,71.0,0.0
|
| 793 |
-
TCGA-18-3417-01,1,65.0,1.0
|
| 794 |
-
TCGA-44-2661-01,1,69.0,0.0
|
| 795 |
-
TCGA-77-8154-01,1,67.0,1.0
|
| 796 |
-
TCGA-55-8091-01,1,74.0,1.0
|
| 797 |
-
TCGA-94-A5I6-01,1,62.0,1.0
|
| 798 |
-
TCGA-56-8626-01,1,59.0,1.0
|
| 799 |
-
TCGA-MP-A4TA-01,1,75.0,0.0
|
| 800 |
-
TCGA-49-6745-11,0,82.0,1.0
|
| 801 |
-
TCGA-91-6828-11,0,70.0,1.0
|
| 802 |
-
TCGA-63-A5MU-01,1,48.0,1.0
|
| 803 |
-
TCGA-21-1071-01,1,67.0,1.0
|
| 804 |
-
TCGA-18-3406-01,1,67.0,1.0
|
| 805 |
-
TCGA-49-6744-11,0,64.0,0.0
|
| 806 |
-
TCGA-86-8672-01,1,59.0,1.0
|
| 807 |
-
TCGA-86-8671-01,1,72.0,0.0
|
| 808 |
-
TCGA-60-2695-01,1,74.0,0.0
|
| 809 |
-
TCGA-53-7626-01,1,76.0,0.0
|
| 810 |
-
TCGA-73-4658-01,1,80.0,0.0
|
| 811 |
-
TCGA-77-A5G8-01,1,70.0,1.0
|
| 812 |
-
TCGA-49-4490-01,1,45.0,0.0
|
| 813 |
-
TCGA-18-3419-01,1,73.0,1.0
|
| 814 |
-
TCGA-93-A4JP-01,1,64.0,1.0
|
| 815 |
-
TCGA-44-8117-01,1,54.0,0.0
|
| 816 |
-
TCGA-63-A5MN-01,1,78.0,0.0
|
| 817 |
-
TCGA-55-A494-01,1,61.0,0.0
|
| 818 |
-
TCGA-50-6590-01,1,72.0,0.0
|
| 819 |
-
TCGA-97-7937-01,1,65.0,1.0
|
| 820 |
-
TCGA-22-5482-01,1,81.0,1.0
|
| 821 |
-
TCGA-56-7222-11,0,60.0,1.0
|
| 822 |
-
TCGA-O1-A52J-01,1,74.0,0.0
|
| 823 |
-
TCGA-77-A5FZ-01,1,64.0,1.0
|
| 824 |
-
TCGA-05-4389-01,1,70.0,1.0
|
| 825 |
-
TCGA-50-5068-01,1,59.0,0.0
|
| 826 |
-
TCGA-34-7107-11,0,70.0,1.0
|
| 827 |
-
TCGA-44-A47A-01,1,78.0,0.0
|
| 828 |
-
TCGA-86-8673-01,1,61.0,1.0
|
| 829 |
-
TCGA-77-A5G1-01,1,75.0,1.0
|
| 830 |
-
TCGA-NJ-A4YI-01,1,87.0,0.0
|
| 831 |
-
TCGA-55-8299-01,1,61.0,0.0
|
| 832 |
-
TCGA-86-7714-01,1,61.0,0.0
|
| 833 |
-
TCGA-56-8083-11,0,56.0,1.0
|
| 834 |
-
TCGA-53-7624-01,1,40.0,0.0
|
| 835 |
-
TCGA-78-7536-01,1,69.0,1.0
|
| 836 |
-
TCGA-85-8479-01,1,66.0,1.0
|
| 837 |
-
TCGA-91-8497-01,1,75.0,0.0
|
| 838 |
-
TCGA-18-3415-01,1,77.0,1.0
|
| 839 |
-
TCGA-NC-A5HF-01,1,74.0,1.0
|
| 840 |
-
TCGA-34-5241-01,1,79.0,1.0
|
| 841 |
-
TCGA-86-8280-01,1,54.0,0.0
|
| 842 |
-
TCGA-44-6145-01,1,62.0,0.0
|
| 843 |
-
TCGA-85-A4CN-01,1,56.0,0.0
|
| 844 |
-
TCGA-85-7710-01,1,59.0,0.0
|
| 845 |
-
TCGA-55-6979-01,1,59.0,0.0
|
| 846 |
-
TCGA-77-7138-11,0,67.0,1.0
|
| 847 |
-
TCGA-66-2778-01,1,68.0,0.0
|
| 848 |
-
TCGA-56-8629-01,1,63.0,1.0
|
| 849 |
-
TCGA-35-4123-01,1,38.0,1.0
|
| 850 |
-
TCGA-44-6778-11,0,59.0,1.0
|
| 851 |
-
TCGA-68-7755-01,1,60.0,0.0
|
| 852 |
-
TCGA-64-5775-01,1,71.0,1.0
|
| 853 |
-
TCGA-96-7545-01,1,73.0,1.0
|
| 854 |
-
TCGA-22-5478-01,1,79.0,1.0
|
| 855 |
-
TCGA-05-4390-01,1,58.0,0.0
|
| 856 |
-
TCGA-22-1012-01,1,80.0,0.0
|
| 857 |
-
TCGA-55-6987-01,1,77.0,1.0
|
| 858 |
-
TCGA-50-5049-01,1,70.0,1.0
|
| 859 |
-
TCGA-97-A4M6-01,1,45.0,0.0
|
| 860 |
-
TCGA-77-8143-01,1,76.0,1.0
|
| 861 |
-
TCGA-66-2727-01,1,55.0,0.0
|
| 862 |
-
TCGA-43-8115-01,1,72.0,0.0
|
| 863 |
-
TCGA-43-7657-01,1,68.0,0.0
|
| 864 |
-
TCGA-44-6777-11,0,85.0,0.0
|
| 865 |
-
TCGA-44-7660-01,1,72.0,1.0
|
| 866 |
-
TCGA-NC-A5HR-01,1,75.0,0.0
|
| 867 |
-
TCGA-73-4677-01,1,74.0,1.0
|
| 868 |
-
TCGA-49-4501-01,1,67.0,0.0
|
| 869 |
-
TCGA-22-5483-11,0,74.0,1.0
|
| 870 |
-
TCGA-86-8281-01,1,75.0,1.0
|
| 871 |
-
TCGA-55-7724-01,1,76.0,0.0
|
| 872 |
-
TCGA-44-7661-01,1,69.0,0.0
|
| 873 |
-
TCGA-95-A4VN-01,1,62.0,0.0
|
| 874 |
-
TCGA-77-6842-01,1,79.0,1.0
|
| 875 |
-
TCGA-97-A4M2-01,1,66.0,1.0
|
| 876 |
-
TCGA-49-AARN-01,1,56.0,0.0
|
| 877 |
-
TCGA-49-AAR9-01,1,61.0,1.0
|
| 878 |
-
TCGA-MN-A4N1-01,1,60.0,1.0
|
| 879 |
-
TCGA-86-8074-01,1,62.0,0.0
|
| 880 |
-
TCGA-44-6146-11,0,64.0,1.0
|
| 881 |
-
TCGA-18-3412-01,1,52.0,1.0
|
| 882 |
-
TCGA-77-A5GA-01,1,76.0,1.0
|
| 883 |
-
TCGA-44-7671-01,1,64.0,1.0
|
| 884 |
-
TCGA-05-4418-01,1,69.0,1.0
|
| 885 |
-
TCGA-34-8454-11,0,62.0,0.0
|
| 886 |
-
TCGA-05-4410-01,1,62.0,1.0
|
| 887 |
-
TCGA-38-6178-01,1,70.0,0.0
|
| 888 |
-
TCGA-43-2578-01,1,59.0,0.0
|
| 889 |
-
TCGA-63-7021-01,1,66.36272727272727,1.0
|
| 890 |
-
TCGA-MP-A4TE-01,1,56.0,1.0
|
| 891 |
-
TCGA-46-6025-01,1,71.0,1.0
|
| 892 |
-
TCGA-86-8669-01,1,64.0,1.0
|
| 893 |
-
TCGA-56-7223-01,1,66.0,1.0
|
| 894 |
-
TCGA-46-3768-01,1,58.0,1.0
|
| 895 |
-
TCGA-37-4141-01,1,65.0,0.0
|
| 896 |
-
TCGA-91-6835-01,1,81.0,0.0
|
| 897 |
-
TCGA-85-A4QQ-01,1,68.0,1.0
|
| 898 |
-
TCGA-73-4675-01,1,59.0,1.0
|
| 899 |
-
TCGA-67-6215-01,1,52.0,0.0
|
| 900 |
-
TCGA-98-8022-01,1,61.0,1.0
|
| 901 |
-
TCGA-L9-A50W-01,1,75.0,1.0
|
| 902 |
-
TCGA-56-8308-01,1,79.0,1.0
|
| 903 |
-
TCGA-58-8386-01,1,75.0,1.0
|
| 904 |
-
TCGA-05-5423-01,1,65.0,1.0
|
| 905 |
-
TCGA-NK-A5CX-01,1,73.0,1.0
|
| 906 |
-
TCGA-44-7670-01,1,47.0,0.0
|
| 907 |
-
TCGA-S2-AA1A-01,1,68.0,0.0
|
| 908 |
-
TCGA-05-5420-01,1,67.0,1.0
|
| 909 |
-
TCGA-55-6986-11,0,74.0,0.0
|
| 910 |
-
TCGA-80-5608-01,1,66.36272727272727,0.0
|
| 911 |
-
TCGA-97-8552-01,1,55.0,0.0
|
| 912 |
-
TCGA-44-2657-11,0,74.0,0.0
|
| 913 |
-
TCGA-49-4490-11,0,45.0,0.0
|
| 914 |
-
TCGA-77-7463-01,1,75.0,1.0
|
| 915 |
-
TCGA-55-8096-01,1,67.0,0.0
|
| 916 |
-
TCGA-68-A59I-01,1,73.0,0.0
|
| 917 |
-
TCGA-NK-A5D1-01,1,57.0,1.0
|
| 918 |
-
TCGA-05-4417-01,1,51.0,0.0
|
| 919 |
-
TCGA-56-1622-01,1,58.0,1.0
|
| 920 |
-
TCGA-92-7340-01,1,45.0,0.0
|
| 921 |
-
TCGA-43-2576-01,1,62.0,0.0
|
| 922 |
-
TCGA-37-4129-01,1,52.0,0.0
|
| 923 |
-
TCGA-66-2790-01,1,72.0,1.0
|
| 924 |
-
TCGA-86-7713-01,1,70.0,1.0
|
| 925 |
-
TCGA-75-7031-01,1,66.36272727272727,0.0
|
| 926 |
-
TCGA-60-2725-01,1,74.0,1.0
|
| 927 |
-
TCGA-33-AASI-01,1,65.0,0.0
|
| 928 |
-
TCGA-55-1595-01,1,74.0,0.0
|
| 929 |
-
TCGA-05-4427-01,1,65.0,0.0
|
| 930 |
-
TCGA-71-8520-01,1,60.0,0.0
|
| 931 |
-
TCGA-39-5016-01,1,44.0,1.0
|
| 932 |
-
TCGA-56-A4BW-01,1,55.0,1.0
|
| 933 |
-
TCGA-55-A491-01,1,81.0,0.0
|
| 934 |
-
TCGA-60-2714-01,1,66.0,0.0
|
| 935 |
-
TCGA-85-7699-01,1,73.0,1.0
|
| 936 |
-
TCGA-77-A5GB-01,1,90.0,1.0
|
| 937 |
-
TCGA-85-7844-01,1,71.0,1.0
|
| 938 |
-
TCGA-50-5946-01,1,62.0,1.0
|
| 939 |
-
TCGA-43-6143-11,0,70.0,1.0
|
| 940 |
-
TCGA-55-6980-11,0,56.0,1.0
|
| 941 |
-
TCGA-98-8020-01,1,56.0,0.0
|
| 942 |
-
TCGA-MP-A4TH-01,1,70.0,0.0
|
| 943 |
-
TCGA-86-8076-01,1,42.0,1.0
|
| 944 |
-
TCGA-67-3770-01,1,70.0,0.0
|
| 945 |
-
TCGA-66-2800-01,1,70.0,1.0
|
| 946 |
-
TCGA-NJ-A4YQ-01,1,69.0,0.0
|
| 947 |
-
TCGA-55-8087-01,1,59.0,0.0
|
| 948 |
-
TCGA-43-6647-11,0,69.0,0.0
|
| 949 |
-
TCGA-37-4133-01,1,63.0,1.0
|
| 950 |
-
TCGA-91-6829-01,1,78.0,1.0
|
| 951 |
-
TCGA-NJ-A55R-01,1,67.0,1.0
|
| 952 |
-
TCGA-85-A513-01,1,60.0,0.0
|
| 953 |
-
TCGA-34-2608-01,1,84.0,1.0
|
| 954 |
-
TCGA-38-4627-11,0,64.0,0.0
|
| 955 |
-
TCGA-50-5051-01,1,42.0,0.0
|
| 956 |
-
TCGA-86-8674-01,1,50.0,1.0
|
| 957 |
-
TCGA-99-8025-01,1,72.0,0.0
|
| 958 |
-
TCGA-62-A470-01,1,84.0,1.0
|
| 959 |
-
TCGA-78-7163-01,1,60.0,1.0
|
| 960 |
-
TCGA-86-7711-01,1,70.0,1.0
|
| 961 |
-
TCGA-94-8491-01,1,73.0,1.0
|
| 962 |
-
TCGA-55-7281-01,1,70.0,0.0
|
| 963 |
-
TCGA-85-8072-01,1,60.0,1.0
|
| 964 |
-
TCGA-55-6543-01,1,60.0,0.0
|
| 965 |
-
TCGA-52-7810-01,1,60.0,0.0
|
| 966 |
-
TCGA-75-5125-01,1,66.36272727272727,1.0
|
| 967 |
-
TCGA-49-6743-01,1,81.0,0.0
|
| 968 |
-
TCGA-NC-A5HJ-01,1,59.0,1.0
|
| 969 |
-
TCGA-98-A53B-01,1,69.0,1.0
|
| 970 |
-
TCGA-MP-A4SV-01,1,67.0,1.0
|
| 971 |
-
TCGA-67-4679-01,1,69.0,1.0
|
| 972 |
-
TCGA-78-7162-01,1,75.0,1.0
|
| 973 |
-
TCGA-55-6971-11,0,59.0,0.0
|
| 974 |
-
TCGA-86-8055-01,1,79.0,1.0
|
| 975 |
-
TCGA-43-6143-01,1,70.0,1.0
|
| 976 |
-
TCGA-77-6844-01,1,74.0,1.0
|
| 977 |
-
TCGA-44-5645-01,1,61.0,0.0
|
| 978 |
-
TCGA-66-2770-01,1,79.0,1.0
|
| 979 |
-
TCGA-43-5670-11,0,70.0,1.0
|
| 980 |
-
TCGA-93-A4JO-01,1,70.0,1.0
|
| 981 |
-
TCGA-34-2600-01,1,76.0,0.0
|
| 982 |
-
TCGA-78-7149-01,1,71.0,1.0
|
| 983 |
-
TCGA-91-6835-11,0,81.0,0.0
|
| 984 |
-
TCGA-L3-A524-01,1,45.0,0.0
|
| 985 |
-
TCGA-55-8094-01,1,51.0,1.0
|
| 986 |
-
TCGA-75-6205-01,1,66.36272727272727,0.0
|
| 987 |
-
TCGA-52-7811-01,1,67.0,1.0
|
| 988 |
-
TCGA-51-4080-01,1,65.0,1.0
|
| 989 |
-
TCGA-77-6845-01,1,69.0,1.0
|
| 990 |
-
TCGA-56-A4BX-01,1,70.0,1.0
|
| 991 |
-
TCGA-MP-A5C7-01,1,76.0,0.0
|
| 992 |
-
TCGA-56-8307-01,1,55.0,0.0
|
| 993 |
-
TCGA-56-8082-01,1,80.0,0.0
|
| 994 |
-
TCGA-95-A4VP-01,1,66.0,0.0
|
| 995 |
-
TCGA-60-2715-01,1,51.0,1.0
|
| 996 |
-
TCGA-22-5481-01,1,72.0,0.0
|
| 997 |
-
TCGA-86-8278-01,1,63.0,0.0
|
| 998 |
-
TCGA-38-7271-01,1,72.0,0.0
|
| 999 |
-
TCGA-85-8353-01,1,72.0,1.0
|
| 1000 |
-
TCGA-55-8505-01,1,62.0,1.0
|
| 1001 |
-
TCGA-18-5595-01,1,50.0,1.0
|
| 1002 |
-
TCGA-86-8585-01,1,57.0,1.0
|
| 1003 |
-
TCGA-63-A5MI-01,1,65.0,1.0
|
| 1004 |
-
TCGA-91-6836-11,0,52.0,0.0
|
| 1005 |
-
TCGA-39-5029-01,1,67.0,1.0
|
| 1006 |
-
TCGA-58-8386-11,0,75.0,1.0
|
| 1007 |
-
TCGA-34-5232-01,1,75.0,0.0
|
| 1008 |
-
TCGA-33-6737-11,0,71.0,1.0
|
| 1009 |
-
TCGA-33-4582-01,1,55.0,1.0
|
| 1010 |
-
TCGA-94-8490-01,1,70.0,1.0
|
| 1011 |
-
TCGA-44-3396-01,1,74.0,0.0
|
| 1012 |
-
TCGA-60-2719-01,1,83.0,0.0
|
| 1013 |
-
TCGA-49-AAR3-01,1,69.0,1.0
|
| 1014 |
-
TCGA-75-6206-01,1,66.36272727272727,1.0
|
| 1015 |
-
TCGA-90-6837-11,0,64.0,1.0
|
| 1016 |
-
TCGA-85-A512-01,1,46.0,1.0
|
| 1017 |
-
TCGA-50-5055-01,1,79.0,0.0
|
| 1018 |
-
TCGA-63-A5MW-01,1,76.0,1.0
|
| 1019 |
-
TCGA-J2-A4AG-01,1,66.0,0.0
|
| 1020 |
-
TCGA-97-7554-01,1,83.0,0.0
|
| 1021 |
-
TCGA-39-5031-01,1,76.0,0.0
|
| 1022 |
-
TCGA-92-8064-01,1,58.0,1.0
|
| 1023 |
-
TCGA-56-8623-11,0,71.0,1.0
|
| 1024 |
-
TCGA-97-8179-01,1,72.0,1.0
|
| 1025 |
-
TCGA-L9-A5IP-01,1,40.0,0.0
|
| 1026 |
-
TCGA-96-A4JK-01,1,65.0,1.0
|
| 1027 |
-
TCGA-53-A4EZ-01,1,63.0,1.0
|
| 1028 |
-
TCGA-73-4668-01,1,66.0,0.0
|
| 1029 |
-
TCGA-18-3408-01,1,77.0,0.0
|
| 1030 |
-
TCGA-77-7138-01,1,67.0,1.0
|
| 1031 |
-
TCGA-22-5480-01,1,66.0,0.0
|
| 1032 |
-
TCGA-66-2781-01,1,67.0,1.0
|
| 1033 |
-
TCGA-97-A4M3-01,1,69.0,0.0
|
| 1034 |
-
TCGA-78-7147-01,1,67.0,0.0
|
| 1035 |
-
TCGA-55-7994-01,1,81.0,1.0
|
| 1036 |
-
TCGA-35-3615-01,1,57.0,1.0
|
| 1037 |
-
TCGA-44-3918-01,1,60.0,0.0
|
| 1038 |
-
TCGA-94-A5I4-01,1,61.0,1.0
|
| 1039 |
-
TCGA-46-6026-01,1,81.0,1.0
|
| 1040 |
-
TCGA-64-1680-01,1,63.0,1.0
|
| 1041 |
-
TCGA-55-1592-01,1,65.0,1.0
|
| 1042 |
-
TCGA-49-4494-01,1,77.0,1.0
|
| 1043 |
-
TCGA-49-AAR0-01,1,57.0,1.0
|
| 1044 |
-
TCGA-55-7907-01,1,77.0,1.0
|
| 1045 |
-
TCGA-85-8666-01,1,65.0,1.0
|
| 1046 |
-
TCGA-77-7338-11,0,64.0,1.0
|
| 1047 |
-
TCGA-85-8355-01,1,63.0,1.0
|
| 1048 |
-
TCGA-44-6779-01,1,50.0,0.0
|
| 1049 |
-
TCGA-97-A4M1-01,1,52.0,0.0
|
| 1050 |
-
TCGA-95-7039-01,1,54.0,0.0
|
| 1051 |
-
TCGA-66-2759-01,1,66.0,1.0
|
| 1052 |
-
TCGA-21-1076-01,1,54.0,0.0
|
| 1053 |
-
TCGA-69-7973-01,1,42.0,0.0
|
| 1054 |
-
TCGA-85-8276-01,1,62.0,1.0
|
| 1055 |
-
TCGA-34-8456-01,1,71.0,0.0
|
| 1056 |
-
TCGA-NC-A5HE-01,1,60.0,1.0
|
| 1057 |
-
TCGA-71-6725-01,1,48.0,0.0
|
| 1058 |
-
TCGA-86-7701-01,1,66.0,1.0
|
| 1059 |
-
TCGA-NC-A5HO-01,1,70.0,0.0
|
| 1060 |
-
TCGA-75-6203-01,1,66.36272727272727,0.0
|
| 1061 |
-
TCGA-37-5819-01,1,64.0,1.0
|
| 1062 |
-
TCGA-44-2668-11,0,51.0,1.0
|
| 1063 |
-
TCGA-63-7022-01,1,66.36272727272727,0.0
|
| 1064 |
-
TCGA-55-6984-01,1,71.0,0.0
|
| 1065 |
-
TCGA-63-A5MG-01,1,68.0,1.0
|
| 1066 |
-
TCGA-97-8177-01,1,59.0,0.0
|
| 1067 |
-
TCGA-J2-8192-01,1,65.0,0.0
|
| 1068 |
-
TCGA-98-A53I-01,1,64.0,1.0
|
| 1069 |
-
TCGA-55-7725-01,1,68.0,0.0
|
| 1070 |
-
TCGA-49-AAR2-01,1,64.0,1.0
|
| 1071 |
-
TCGA-55-6712-01,1,71.0,1.0
|
| 1072 |
-
TCGA-39-5035-01,1,72.0,0.0
|
| 1073 |
-
TCGA-56-A4ZK-01,1,76.0,0.0
|
| 1074 |
-
TCGA-55-8506-01,1,62.0,0.0
|
| 1075 |
-
TCGA-22-4596-01,1,69.0,0.0
|
| 1076 |
-
TCGA-56-A5DS-01,1,72.0,0.0
|
| 1077 |
-
TCGA-56-A49D-01,1,67.0,1.0
|
| 1078 |
-
TCGA-37-4135-01,1,68.0,1.0
|
| 1079 |
-
TCGA-62-A472-01,1,70.0,1.0
|
| 1080 |
-
TCGA-60-2710-01,1,67.0,0.0
|
| 1081 |
-
TCGA-73-4676-11,0,45.0,1.0
|
| 1082 |
-
TCGA-66-2756-01,1,68.0,1.0
|
| 1083 |
-
TCGA-85-8350-01,1,61.0,1.0
|
| 1084 |
-
TCGA-64-5778-01,1,60.0,1.0
|
| 1085 |
-
TCGA-60-2709-11,0,69.0,1.0
|
| 1086 |
-
TCGA-05-4415-01,1,57.0,1.0
|
| 1087 |
-
TCGA-66-2744-01,1,71.0,1.0
|
| 1088 |
-
TCGA-56-A5DR-01,1,81.0,1.0
|
| 1089 |
-
TCGA-33-4587-01,1,63.0,0.0
|
| 1090 |
-
TCGA-85-8287-01,1,72.0,1.0
|
| 1091 |
-
TCGA-86-A4JF-01,1,56.0,1.0
|
| 1092 |
-
TCGA-21-5782-01,1,68.0,0.0
|
| 1093 |
-
TCGA-49-AARQ-01,1,41.0,0.0
|
| 1094 |
-
TCGA-55-8097-01,1,60.0,0.0
|
| 1095 |
-
TCGA-85-8584-01,1,71.0,1.0
|
| 1096 |
-
TCGA-91-6831-11,0,66.0,1.0
|
| 1097 |
-
TCGA-22-5485-01,1,58.0,0.0
|
| 1098 |
-
TCGA-63-7023-01,1,66.36272727272727,1.0
|
| 1099 |
-
TCGA-39-5037-01,1,65.0,1.0
|
| 1100 |
-
TCGA-66-2795-01,1,68.0,1.0
|
| 1101 |
-
TCGA-85-8049-01,1,57.0,1.0
|
| 1102 |
-
TCGA-56-7582-01,1,83.0,1.0
|
| 1103 |
-
TCGA-91-6849-01,1,75.0,0.0
|
| 1104 |
-
TCGA-62-A46O-01,1,65.0,0.0
|
| 1105 |
-
TCGA-51-4079-11,0,73.0,0.0
|
| 1106 |
-
TCGA-58-8391-01,1,57.0,0.0
|
| 1107 |
-
TCGA-90-7767-11,0,56.0,1.0
|
| 1108 |
-
TCGA-75-6212-01,1,66.36272727272727,0.0
|
| 1109 |
-
TCGA-60-2713-01,1,64.0,1.0
|
| 1110 |
-
TCGA-69-7980-01,1,70.0,0.0
|
| 1111 |
-
TCGA-22-5491-11,0,74.0,1.0
|
| 1112 |
-
TCGA-77-7141-01,1,64.0,1.0
|
| 1113 |
-
TCGA-55-8512-01,1,41.0,1.0
|
| 1114 |
-
TCGA-44-8119-01,1,73.0,1.0
|
| 1115 |
-
TCGA-63-A5MB-01,1,62.0,1.0
|
| 1116 |
-
TCGA-44-7669-01,1,59.0,1.0
|
| 1117 |
-
TCGA-85-8352-01,1,67.0,1.0
|
| 1118 |
-
TCGA-39-5030-01,1,81.0,0.0
|
| 1119 |
-
TCGA-73-4676-01,1,45.0,1.0
|
| 1120 |
-
TCGA-73-4666-01,1,52.0,0.0
|
| 1121 |
-
TCGA-43-A475-01,1,67.0,0.0
|
| 1122 |
-
TCGA-66-2763-01,1,63.0,0.0
|
| 1123 |
-
TCGA-50-5931-11,0,75.0,0.0
|
| 1124 |
-
TCGA-98-7454-01,1,73.0,1.0
|
| 1125 |
-
TCGA-55-8507-01,1,53.0,1.0
|
| 1126 |
-
TCGA-64-1679-01,1,58.0,0.0
|
| 1127 |
-
TCGA-05-4396-01,1,76.0,1.0
|
| 1128 |
-
TCGA-NC-A5HK-01,1,58.0,0.0
|
| 1129 |
-
TCGA-49-6743-11,0,81.0,0.0
|
| 1130 |
-
TCGA-49-6761-11,0,68.0,0.0
|
|
|
|
| 1 |
+
sampleID,Melanoma,Age,Gender
|
| 2 |
+
TCGA-3N-A9WB-06,1,71.0,1.0
|
| 3 |
+
TCGA-3N-A9WC-06,1,82.0,1.0
|
| 4 |
+
TCGA-3N-A9WD-06,1,82.0,1.0
|
| 5 |
+
TCGA-BF-A1PU-01,1,46.0,0.0
|
| 6 |
+
TCGA-BF-A1PV-01,1,74.0,0.0
|
| 7 |
+
TCGA-BF-A1PX-01,1,56.0,1.0
|
| 8 |
+
TCGA-BF-A1PZ-01,1,71.0,0.0
|
| 9 |
+
TCGA-BF-A1Q0-01,1,80.0,1.0
|
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
|
| 98 |
+
TCGA-D3-A8GN-06,1,27.0,0.0
|
| 99 |
+
TCGA-D3-A8GO-06,1,,0.0
|
| 100 |
+
TCGA-D3-A8GP-06,1,77.0,1.0
|
| 101 |
+
TCGA-D3-A8GQ-06,1,66.0,1.0
|
| 102 |
+
TCGA-D3-A8GR-06,1,54.0,0.0
|
| 103 |
+
TCGA-D3-A8GS-06,1,52.0,1.0
|
| 104 |
+
TCGA-D3-A8GV-06,1,25.0,1.0
|
| 105 |
+
TCGA-D9-A148-06,1,40.0,1.0
|
| 106 |
+
TCGA-D9-A149-06,1,65.0,0.0
|
| 107 |
+
TCGA-D9-A1JW-06,1,82.0,1.0
|
| 108 |
+
TCGA-D9-A1JX-06,1,80.0,0.0
|
| 109 |
+
TCGA-D9-A1X3-01,1,63.0,1.0
|
| 110 |
+
TCGA-D9-A1X3-06,1,63.0,1.0
|
| 111 |
+
TCGA-D9-A3Z1-06,1,66.0,1.0
|
| 112 |
+
TCGA-D9-A3Z3-06,1,39.0,0.0
|
| 113 |
+
TCGA-D9-A3Z4-01,1,54.0,1.0
|
| 114 |
+
TCGA-D9-A4Z2-01,1,50.0,1.0
|
| 115 |
+
TCGA-D9-A4Z3-01,1,73.0,0.0
|
| 116 |
+
TCGA-D9-A4Z5-01,1,68.0,1.0
|
| 117 |
+
TCGA-D9-A4Z6-06,1,54.0,1.0
|
| 118 |
+
TCGA-D9-A6E9-06,1,75.0,0.0
|
| 119 |
+
TCGA-D9-A6EA-06,1,70.0,1.0
|
| 120 |
+
TCGA-D9-A6EC-06,1,56.0,1.0
|
| 121 |
+
TCGA-D9-A6EG-06,1,56.0,1.0
|
| 122 |
+
TCGA-DA-A1HV-06,1,75.0,0.0
|
| 123 |
+
TCGA-DA-A1HW-06,1,37.0,0.0
|
| 124 |
+
TCGA-DA-A1HY-06,1,42.0,1.0
|
| 125 |
+
TCGA-DA-A1I0-06,1,63.0,1.0
|
| 126 |
+
TCGA-DA-A1I1-06,1,55.0,1.0
|
| 127 |
+
TCGA-DA-A1I2-06,1,45.0,1.0
|
| 128 |
+
TCGA-DA-A1I4-06,1,51.0,1.0
|
| 129 |
+
TCGA-DA-A1I5-06,1,27.0,0.0
|
| 130 |
+
TCGA-DA-A1I7-06,1,62.0,1.0
|
| 131 |
+
TCGA-DA-A1I8-06,1,63.0,0.0
|
| 132 |
+
TCGA-DA-A1IA-06,1,32.0,0.0
|
| 133 |
+
TCGA-DA-A1IB-06,1,69.0,0.0
|
| 134 |
+
TCGA-DA-A1IC-06,1,81.0,1.0
|
| 135 |
+
TCGA-DA-A3F2-06,1,55.0,1.0
|
| 136 |
+
TCGA-DA-A3F3-06,1,52.0,1.0
|
| 137 |
+
TCGA-DA-A3F5-06,1,45.0,1.0
|
| 138 |
+
TCGA-DA-A3F8-06,1,39.0,1.0
|
| 139 |
+
TCGA-DA-A95V-06,1,83.0,0.0
|
| 140 |
+
TCGA-DA-A95W-06,1,52.0,1.0
|
| 141 |
+
TCGA-DA-A95X-06,1,62.0,1.0
|
| 142 |
+
TCGA-DA-A95Y-06,1,68.0,1.0
|
| 143 |
+
TCGA-DA-A95Z-06,1,87.0,1.0
|
| 144 |
+
TCGA-DA-A960-01,1,73.0,1.0
|
| 145 |
+
TCGA-EB-A1NK-01,1,48.0,1.0
|
| 146 |
+
TCGA-EB-A24C-01,1,56.0,1.0
|
| 147 |
+
TCGA-EB-A24D-01,1,72.0,1.0
|
| 148 |
+
TCGA-EB-A299-01,1,63.0,1.0
|
| 149 |
+
TCGA-EB-A3HV-01,1,37.0,1.0
|
| 150 |
+
TCGA-EB-A3XB-01,1,63.0,1.0
|
| 151 |
+
TCGA-EB-A3XC-01,1,74.0,1.0
|
| 152 |
+
TCGA-EB-A3XD-01,1,53.0,0.0
|
| 153 |
+
TCGA-EB-A3XE-01,1,77.0,0.0
|
| 154 |
+
TCGA-EB-A3XF-01,1,57.0,1.0
|
| 155 |
+
TCGA-EB-A3Y6-01,1,56.0,0.0
|
| 156 |
+
TCGA-EB-A3Y7-01,1,86.0,0.0
|
| 157 |
+
TCGA-EB-A41A-01,1,90.0,1.0
|
| 158 |
+
TCGA-EB-A41B-01,1,76.0,0.0
|
| 159 |
+
TCGA-EB-A42Y-01,1,73.0,0.0
|
| 160 |
+
TCGA-EB-A42Z-01,1,49.0,1.0
|
| 161 |
+
TCGA-EB-A430-01,1,83.0,1.0
|
| 162 |
+
TCGA-EB-A431-01,1,34.0,1.0
|
| 163 |
+
TCGA-EB-A44N-01,1,59.0,1.0
|
| 164 |
+
TCGA-EB-A44O-01,1,69.0,1.0
|
| 165 |
+
TCGA-EB-A44P-01,1,58.0,0.0
|
| 166 |
+
TCGA-EB-A44Q-06,1,51.0,0.0
|
| 167 |
+
TCGA-EB-A44R-06,1,52.0,1.0
|
| 168 |
+
TCGA-EB-A4IQ-01,1,42.0,0.0
|
| 169 |
+
TCGA-EB-A4IS-01,1,77.0,1.0
|
| 170 |
+
TCGA-EB-A4OY-01,1,65.0,0.0
|
| 171 |
+
TCGA-EB-A4OZ-01,1,41.0,0.0
|
| 172 |
+
TCGA-EB-A4P0-01,1,82.0,1.0
|
| 173 |
+
TCGA-EB-A4XL-01,1,56.0,0.0
|
| 174 |
+
TCGA-EB-A51B-01,1,53.0,1.0
|
| 175 |
+
TCGA-EB-A550-01,1,75.0,0.0
|
| 176 |
+
TCGA-EB-A551-01,1,78.0,0.0
|
| 177 |
+
TCGA-EB-A553-01,1,62.0,1.0
|
| 178 |
+
TCGA-EB-A57M-01,1,56.0,1.0
|
| 179 |
+
TCGA-EB-A5FP-01,1,65.0,0.0
|
| 180 |
+
TCGA-EB-A5KH-06,1,55.0,1.0
|
| 181 |
+
TCGA-EB-A5SE-01,1,73.0,1.0
|
| 182 |
+
TCGA-EB-A5SF-01,1,78.0,0.0
|
| 183 |
+
TCGA-EB-A5SG-06,1,57.0,0.0
|
| 184 |
+
TCGA-EB-A5SH-06,1,60.0,0.0
|
| 185 |
+
TCGA-EB-A5UL-06,1,71.0,1.0
|
| 186 |
+
TCGA-EB-A5UM-01,1,48.0,0.0
|
| 187 |
+
TCGA-EB-A5UN-06,1,49.0,1.0
|
| 188 |
+
TCGA-EB-A5VU-01,1,56.0,1.0
|
| 189 |
+
TCGA-EB-A5VV-06,1,74.0,0.0
|
| 190 |
+
TCGA-EB-A6L9-06,1,55.0,1.0
|
| 191 |
+
TCGA-EB-A6QY-01,1,71.0,1.0
|
| 192 |
+
TCGA-EB-A6QZ-01,1,76.0,0.0
|
| 193 |
+
TCGA-EB-A6R0-01,1,58.0,0.0
|
| 194 |
+
TCGA-EB-A82B-01,1,58.0,0.0
|
| 195 |
+
TCGA-EB-A82C-01,1,70.0,0.0
|
| 196 |
+
TCGA-EB-A85I-01,1,66.0,1.0
|
| 197 |
+
TCGA-EB-A85J-01,1,66.0,0.0
|
| 198 |
+
TCGA-EB-A97M-01,1,66.0,1.0
|
| 199 |
+
TCGA-EE-A17X-06,1,54.0,1.0
|
| 200 |
+
TCGA-EE-A17Y-06,1,69.0,1.0
|
| 201 |
+
TCGA-EE-A17Z-06,1,57.0,1.0
|
| 202 |
+
TCGA-EE-A180-06,1,69.0,1.0
|
| 203 |
+
TCGA-EE-A181-06,1,82.0,0.0
|
| 204 |
+
TCGA-EE-A182-06,1,84.0,0.0
|
| 205 |
+
TCGA-EE-A183-06,1,48.0,1.0
|
| 206 |
+
TCGA-EE-A184-06,1,72.0,1.0
|
| 207 |
+
TCGA-EE-A185-06,1,55.0,0.0
|
| 208 |
+
TCGA-EE-A20B-06,1,66.0,0.0
|
| 209 |
+
TCGA-EE-A20C-06,1,59.0,1.0
|
| 210 |
+
TCGA-EE-A20F-06,1,53.0,1.0
|
| 211 |
+
TCGA-EE-A20H-06,1,56.0,1.0
|
| 212 |
+
TCGA-EE-A20I-06,1,79.0,1.0
|
| 213 |
+
TCGA-EE-A29A-06,1,68.0,1.0
|
| 214 |
+
TCGA-EE-A29B-06,1,67.0,1.0
|
| 215 |
+
TCGA-EE-A29C-06,1,20.0,1.0
|
| 216 |
+
TCGA-EE-A29D-06,1,87.0,1.0
|
| 217 |
+
TCGA-EE-A29E-06,1,54.0,1.0
|
| 218 |
+
TCGA-EE-A29G-06,1,53.0,1.0
|
| 219 |
+
TCGA-EE-A29H-06,1,59.0,0.0
|
| 220 |
+
TCGA-EE-A29L-06,1,78.0,1.0
|
| 221 |
+
TCGA-EE-A29M-06,1,33.0,0.0
|
| 222 |
+
TCGA-EE-A29N-06,1,78.0,1.0
|
| 223 |
+
TCGA-EE-A29P-06,1,73.0,0.0
|
| 224 |
+
TCGA-EE-A29Q-06,1,70.0,0.0
|
| 225 |
+
TCGA-EE-A29R-06,1,48.0,0.0
|
| 226 |
+
TCGA-EE-A29S-06,1,79.0,1.0
|
| 227 |
+
TCGA-EE-A29T-06,1,51.0,0.0
|
| 228 |
+
TCGA-EE-A29V-06,1,85.0,1.0
|
| 229 |
+
TCGA-EE-A29W-06,1,42.0,1.0
|
| 230 |
+
TCGA-EE-A29X-06,1,58.0,0.0
|
| 231 |
+
TCGA-EE-A2A0-06,1,77.0,0.0
|
| 232 |
+
TCGA-EE-A2A1-06,1,46.0,1.0
|
| 233 |
+
TCGA-EE-A2A2-06,1,71.0,1.0
|
| 234 |
+
TCGA-EE-A2A5-06,1,43.0,1.0
|
| 235 |
+
TCGA-EE-A2A6-06,1,43.0,1.0
|
| 236 |
+
TCGA-EE-A2GB-06,1,51.0,1.0
|
| 237 |
+
TCGA-EE-A2GC-06,1,82.0,1.0
|
| 238 |
+
TCGA-EE-A2GD-06,1,58.0,0.0
|
| 239 |
+
TCGA-EE-A2GE-06,1,44.0,1.0
|
| 240 |
+
TCGA-EE-A2GH-06,1,34.0,1.0
|
| 241 |
+
TCGA-EE-A2GI-06,1,39.0,1.0
|
| 242 |
+
TCGA-EE-A2GJ-06,1,83.0,1.0
|
| 243 |
+
TCGA-EE-A2GK-06,1,46.0,0.0
|
| 244 |
+
TCGA-EE-A2GL-06,1,40.0,0.0
|
| 245 |
+
TCGA-EE-A2GM-06,1,70.0,0.0
|
| 246 |
+
TCGA-EE-A2GN-06,1,67.0,1.0
|
| 247 |
+
TCGA-EE-A2GO-06,1,66.0,0.0
|
| 248 |
+
TCGA-EE-A2GP-06,1,80.0,1.0
|
| 249 |
+
TCGA-EE-A2GR-06,1,78.0,1.0
|
| 250 |
+
TCGA-EE-A2GS-06,1,28.0,0.0
|
| 251 |
+
TCGA-EE-A2GT-06,1,77.0,1.0
|
| 252 |
+
TCGA-EE-A2GU-06,1,65.0,0.0
|
| 253 |
+
TCGA-EE-A2M5-06,1,49.0,1.0
|
| 254 |
+
TCGA-EE-A2M6-06,1,61.0,1.0
|
| 255 |
+
TCGA-EE-A2M7-06,1,66.0,1.0
|
| 256 |
+
TCGA-EE-A2M8-06,1,54.0,0.0
|
| 257 |
+
TCGA-EE-A2MC-06,1,73.0,1.0
|
| 258 |
+
TCGA-EE-A2MD-06,1,52.0,1.0
|
| 259 |
+
TCGA-EE-A2ME-06,1,51.0,1.0
|
| 260 |
+
TCGA-EE-A2MF-06,1,39.0,0.0
|
| 261 |
+
TCGA-EE-A2MG-06,1,23.0,1.0
|
| 262 |
+
TCGA-EE-A2MH-06,1,66.0,1.0
|
| 263 |
+
TCGA-EE-A2MI-06,1,43.0,1.0
|
| 264 |
+
TCGA-EE-A2MJ-06,1,60.0,1.0
|
| 265 |
+
TCGA-EE-A2MK-06,1,18.0,0.0
|
| 266 |
+
TCGA-EE-A2ML-06,1,35.0,1.0
|
| 267 |
+
TCGA-EE-A2MM-06,1,63.0,0.0
|
| 268 |
+
TCGA-EE-A2MN-06,1,58.0,1.0
|
| 269 |
+
TCGA-EE-A2MP-06,1,34.0,0.0
|
| 270 |
+
TCGA-EE-A2MQ-06,1,70.0,0.0
|
| 271 |
+
TCGA-EE-A2MR-06,1,61.0,1.0
|
| 272 |
+
TCGA-EE-A2MS-06,1,72.0,1.0
|
| 273 |
+
TCGA-EE-A2MT-06,1,45.0,1.0
|
| 274 |
+
TCGA-EE-A2MU-06,1,71.0,1.0
|
| 275 |
+
TCGA-EE-A3AA-06,1,47.0,1.0
|
| 276 |
+
TCGA-EE-A3AB-06,1,30.0,1.0
|
| 277 |
+
TCGA-EE-A3AC-06,1,47.0,1.0
|
| 278 |
+
TCGA-EE-A3AD-06,1,50.0,1.0
|
| 279 |
+
TCGA-EE-A3AE-06,1,52.0,0.0
|
| 280 |
+
TCGA-EE-A3AF-06,1,48.0,0.0
|
| 281 |
+
TCGA-EE-A3AG-06,1,25.0,1.0
|
| 282 |
+
TCGA-EE-A3AH-06,1,30.0,1.0
|
| 283 |
+
TCGA-EE-A3J3-06,1,42.0,1.0
|
| 284 |
+
TCGA-EE-A3J4-06,1,72.0,1.0
|
| 285 |
+
TCGA-EE-A3J5-06,1,71.0,1.0
|
| 286 |
+
TCGA-EE-A3J7-06,1,43.0,1.0
|
| 287 |
+
TCGA-EE-A3J8-06,1,59.0,1.0
|
| 288 |
+
TCGA-EE-A3JA-06,1,44.0,1.0
|
| 289 |
+
TCGA-EE-A3JB-06,1,60.0,0.0
|
| 290 |
+
TCGA-EE-A3JD-06,1,70.0,1.0
|
| 291 |
+
TCGA-EE-A3JE-06,1,75.0,1.0
|
| 292 |
+
TCGA-EE-A3JH-06,1,54.0,1.0
|
| 293 |
+
TCGA-EE-A3JI-06,1,48.0,1.0
|
| 294 |
+
TCGA-ER-A193-06,1,62.0,1.0
|
| 295 |
+
TCGA-ER-A194-01,1,77.0,1.0
|
| 296 |
+
TCGA-ER-A195-06,1,46.0,1.0
|
| 297 |
+
TCGA-ER-A196-01,1,64.0,0.0
|
| 298 |
+
TCGA-ER-A197-06,1,83.0,0.0
|
| 299 |
+
TCGA-ER-A198-06,1,45.0,1.0
|
| 300 |
+
TCGA-ER-A199-06,1,86.0,0.0
|
| 301 |
+
TCGA-ER-A19A-06,1,79.0,1.0
|
| 302 |
+
TCGA-ER-A19B-06,1,42.0,1.0
|
| 303 |
+
TCGA-ER-A19C-06,1,77.0,1.0
|
| 304 |
+
TCGA-ER-A19D-06,1,46.0,0.0
|
| 305 |
+
TCGA-ER-A19E-06,1,36.0,0.0
|
| 306 |
+
TCGA-ER-A19F-06,1,82.0,1.0
|
| 307 |
+
TCGA-ER-A19G-06,1,48.0,0.0
|
| 308 |
+
TCGA-ER-A19H-06,1,40.0,1.0
|
| 309 |
+
TCGA-ER-A19J-06,1,54.0,1.0
|
| 310 |
+
TCGA-ER-A19K-01,1,79.0,0.0
|
| 311 |
+
TCGA-ER-A19L-06,1,35.0,1.0
|
| 312 |
+
TCGA-ER-A19M-06,1,36.0,1.0
|
| 313 |
+
TCGA-ER-A19N-06,1,47.0,1.0
|
| 314 |
+
TCGA-ER-A19O-06,1,56.0,1.0
|
| 315 |
+
TCGA-ER-A19P-06,1,47.0,0.0
|
| 316 |
+
TCGA-ER-A19Q-06,1,37.0,0.0
|
| 317 |
+
TCGA-ER-A19S-06,1,81.0,0.0
|
| 318 |
+
TCGA-ER-A19T-01,1,51.0,1.0
|
| 319 |
+
TCGA-ER-A19T-06,1,51.0,1.0
|
| 320 |
+
TCGA-ER-A19W-06,1,48.0,0.0
|
| 321 |
+
TCGA-ER-A1A1-06,1,58.0,1.0
|
| 322 |
+
TCGA-ER-A2NB-01,1,57.0,1.0
|
| 323 |
+
TCGA-ER-A2NC-06,1,50.0,1.0
|
| 324 |
+
TCGA-ER-A2ND-06,1,57.0,0.0
|
| 325 |
+
TCGA-ER-A2NE-06,1,39.0,1.0
|
| 326 |
+
TCGA-ER-A2NF-01,1,53.0,1.0
|
| 327 |
+
TCGA-ER-A2NF-06,1,53.0,1.0
|
| 328 |
+
TCGA-ER-A2NG-06,1,43.0,0.0
|
| 329 |
+
TCGA-ER-A2NH-06,1,49.0,1.0
|
| 330 |
+
TCGA-ER-A3ES-06,1,25.0,1.0
|
| 331 |
+
TCGA-ER-A3ET-06,1,64.0,0.0
|
| 332 |
+
TCGA-ER-A3EV-06,1,55.0,1.0
|
| 333 |
+
TCGA-ER-A3PL-06,1,30.0,1.0
|
| 334 |
+
TCGA-ER-A42H-01,1,76.0,1.0
|
| 335 |
+
TCGA-ER-A42K-06,1,40.0,0.0
|
| 336 |
+
TCGA-ER-A42L-06,1,49.0,1.0
|
| 337 |
+
TCGA-FR-A2OS-01,1,49.0,0.0
|
| 338 |
+
TCGA-FR-A3R1-01,1,69.0,1.0
|
| 339 |
+
TCGA-FR-A3YN-06,1,44.0,1.0
|
| 340 |
+
TCGA-FR-A3YO-06,1,,0.0
|
| 341 |
+
TCGA-FR-A44A-06,1,29.0,0.0
|
| 342 |
+
TCGA-FR-A69P-06,1,34.0,0.0
|
| 343 |
+
TCGA-FR-A726-01,1,90.0,1.0
|
| 344 |
+
TCGA-FR-A728-01,1,54.0,0.0
|
| 345 |
+
TCGA-FR-A729-06,1,38.0,0.0
|
| 346 |
+
TCGA-FR-A7U8-06,1,50.0,1.0
|
| 347 |
+
TCGA-FR-A7U9-06,1,63.0,0.0
|
| 348 |
+
TCGA-FR-A7UA-06,1,65.0,0.0
|
| 349 |
+
TCGA-FR-A8YC-06,1,78.0,1.0
|
| 350 |
+
TCGA-FR-A8YD-06,1,56.0,0.0
|
| 351 |
+
TCGA-FR-A8YE-06,1,41.0,1.0
|
| 352 |
+
TCGA-FS-A1YW-06,1,52.0,1.0
|
| 353 |
+
TCGA-FS-A1YX-06,1,39.0,0.0
|
| 354 |
+
TCGA-FS-A1YY-06,1,55.0,0.0
|
| 355 |
+
TCGA-FS-A1Z0-06,1,32.0,0.0
|
| 356 |
+
TCGA-FS-A1Z3-06,1,72.0,0.0
|
| 357 |
+
TCGA-FS-A1Z4-06,1,62.0,1.0
|
| 358 |
+
TCGA-FS-A1Z7-06,1,19.0,1.0
|
| 359 |
+
TCGA-FS-A1ZA-06,1,45.0,0.0
|
| 360 |
+
TCGA-FS-A1ZB-06,1,57.0,1.0
|
| 361 |
+
TCGA-FS-A1ZC-06,1,51.0,1.0
|
| 362 |
+
TCGA-FS-A1ZD-06,1,63.0,1.0
|
| 363 |
+
TCGA-FS-A1ZE-06,1,40.0,1.0
|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,72.0,0.0
|
| 393 |
+
TCGA-FW-A3TV-06,1,57.0,0.0
|
| 394 |
+
TCGA-FW-A5DX-01,1,71.0,1.0
|
| 395 |
+
TCGA-FW-A5DY-06,1,48.0,0.0
|
| 396 |
+
TCGA-GF-A2C7-01,1,48.0,1.0
|
| 397 |
+
TCGA-GF-A3OT-06,1,58.0,0.0
|
| 398 |
+
TCGA-GF-A4EO-06,1,74.0,0.0
|
| 399 |
+
TCGA-GF-A6C8-06,1,62.0,0.0
|
| 400 |
+
TCGA-GF-A6C9-06,1,78.0,1.0
|
| 401 |
+
TCGA-GF-A769-01,1,39.0,1.0
|
| 402 |
+
TCGA-GN-A261-06,1,,
|
| 403 |
+
TCGA-GN-A262-06,1,47.0,0.0
|
| 404 |
+
TCGA-GN-A263-01,1,24.0,1.0
|
| 405 |
+
TCGA-GN-A264-06,1,60.0,1.0
|
| 406 |
+
TCGA-GN-A265-06,1,53.0,1.0
|
| 407 |
+
TCGA-GN-A266-06,1,45.0,1.0
|
| 408 |
+
TCGA-GN-A267-06,1,38.0,1.0
|
| 409 |
+
TCGA-GN-A268-06,1,83.0,0.0
|
| 410 |
+
TCGA-GN-A269-01,1,70.0,1.0
|
| 411 |
+
TCGA-GN-A26A-06,1,63.0,0.0
|
| 412 |
+
TCGA-GN-A26C-01,1,77.0,1.0
|
| 413 |
+
TCGA-GN-A26D-06,1,72.0,0.0
|
| 414 |
+
TCGA-GN-A4U3-06,1,30.0,1.0
|
| 415 |
+
TCGA-GN-A4U4-06,1,73.0,1.0
|
| 416 |
+
TCGA-GN-A4U5-01,1,61.0,0.0
|
| 417 |
+
TCGA-GN-A4U7-06,1,56.0,0.0
|
| 418 |
+
TCGA-GN-A4U8-06,1,51.0,1.0
|
| 419 |
+
TCGA-GN-A4U8-11,0,51.0,1.0
|
| 420 |
+
TCGA-GN-A4U9-06,1,71.0,1.0
|
| 421 |
+
TCGA-GN-A8LK-06,1,70.0,1.0
|
| 422 |
+
TCGA-GN-A8LL-06,1,68.0,0.0
|
| 423 |
+
TCGA-GN-A8LN-01,1,68.0,1.0
|
| 424 |
+
TCGA-GN-A9SD-06,1,59.0,0.0
|
| 425 |
+
TCGA-HR-A2OG-01,1,50.0,0.0
|
| 426 |
+
TCGA-HR-A2OG-06,1,50.0,0.0
|
| 427 |
+
TCGA-HR-A2OH-01,1,46.0,0.0
|
| 428 |
+
TCGA-HR-A2OH-06,1,46.0,0.0
|
| 429 |
+
TCGA-HR-A5NC-01,1,90.0,0.0
|
| 430 |
+
TCGA-IH-A3EA-01,1,61.0,1.0
|
| 431 |
+
TCGA-LH-A9QB-06,1,24.0,0.0
|
| 432 |
+
TCGA-OD-A75X-06,1,49.0,1.0
|
| 433 |
+
TCGA-QB-A6FS-06,1,49.0,1.0
|
| 434 |
+
TCGA-QB-AA9O-06,1,73.0,1.0
|
| 435 |
+
TCGA-RP-A690-06,1,66.0,0.0
|
| 436 |
+
TCGA-RP-A693-06,1,77.0,1.0
|
| 437 |
+
TCGA-RP-A694-06,1,71.0,1.0
|
| 438 |
+
TCGA-RP-A695-06,1,,1.0
|
| 439 |
+
TCGA-RP-A6K9-06,1,,0.0
|
| 440 |
+
TCGA-W3-A824-06,1,63.0,1.0
|
| 441 |
+
TCGA-W3-A825-06,1,60.0,0.0
|
| 442 |
+
TCGA-W3-A828-06,1,66.0,1.0
|
| 443 |
+
TCGA-W3-AA1O-06,1,85.0,1.0
|
| 444 |
+
TCGA-W3-AA1Q-06,1,57.0,1.0
|
| 445 |
+
TCGA-W3-AA1R-06,1,71.0,1.0
|
| 446 |
+
TCGA-W3-AA1V-06,1,63.0,1.0
|
| 447 |
+
TCGA-W3-AA1W-06,1,64.0,1.0
|
| 448 |
+
TCGA-W3-AA21-06,1,26.0,1.0
|
| 449 |
+
TCGA-WE-A8JZ-06,1,70.0,1.0
|
| 450 |
+
TCGA-WE-A8K1-06,1,74.0,1.0
|
| 451 |
+
TCGA-WE-A8K4-01,1,85.0,1.0
|
| 452 |
+
TCGA-WE-A8K5-06,1,65.0,1.0
|
| 453 |
+
TCGA-WE-A8K6-06,1,79.0,1.0
|
| 454 |
+
TCGA-WE-A8ZM-06,1,70.0,1.0
|
| 455 |
+
TCGA-WE-A8ZN-06,1,57.0,1.0
|
| 456 |
+
TCGA-WE-A8ZO-06,1,73.0,0.0
|
| 457 |
+
TCGA-WE-A8ZQ-06,1,48.0,1.0
|
| 458 |
+
TCGA-WE-A8ZR-06,1,49.0,1.0
|
| 459 |
+
TCGA-WE-A8ZT-06,1,25.0,0.0
|
| 460 |
+
TCGA-WE-A8ZX-06,1,45.0,1.0
|
| 461 |
+
TCGA-WE-A8ZY-06,1,62.0,1.0
|
| 462 |
+
TCGA-WE-AA9Y-06,1,37.0,1.0
|
| 463 |
+
TCGA-WE-AAA0-06,1,47.0,1.0
|
| 464 |
+
TCGA-WE-AAA3-06,1,84.0,0.0
|
| 465 |
+
TCGA-WE-AAA4-06,1,56.0,0.0
|
| 466 |
+
TCGA-XV-A9VZ-01,1,90.0,0.0
|
| 467 |
+
TCGA-XV-A9W2-01,1,81.0,1.0
|
| 468 |
+
TCGA-XV-A9W5-01,1,51.0,1.0
|
| 469 |
+
TCGA-XV-AAZV-01,1,56.0,0.0
|
| 470 |
+
TCGA-XV-AAZW-01,1,62.0,0.0
|
| 471 |
+
TCGA-XV-AAZY-01,1,76.0,0.0
|
| 472 |
+
TCGA-XV-AB01-01,1,54.0,0.0
|
| 473 |
+
TCGA-XV-AB01-06,1,54.0,0.0
|
| 474 |
+
TCGA-YD-A89C-06,1,43.0,0.0
|
| 475 |
+
TCGA-YD-A9TA-06,1,75.0,1.0
|
| 476 |
+
TCGA-YD-A9TB-06,1,,0.0
|
| 477 |
+
TCGA-YG-AA3N-01,1,67.0,1.0
|
| 478 |
+
TCGA-YG-AA3O-06,1,62.0,1.0
|
| 479 |
+
TCGA-YG-AA3P-06,1,63.0,0.0
|
| 480 |
+
TCGA-Z2-A8RT-06,1,42.0,0.0
|
| 481 |
+
TCGA-Z2-AA3S-06,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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE144296"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE144296"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE144296.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE144296.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE144296.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 # DNTR-seq includes mRNA-seq; not miRNA-only or methylation-only
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability and conversion
|
| 47 |
+
|
| 48 |
+
# Trait (Melanoma) is inferable from 'cell type' field
|
| 49 |
+
trait_row = 1 # 'cell type: malignant melanoma' vs 'cell type: colorectal carcinoma'
|
| 50 |
+
age_row = None # Not available for cell lines in this dataset
|
| 51 |
+
gender_row = None # Not available for cell lines in this dataset
|
| 52 |
+
|
| 53 |
+
def _extract_value(x):
|
| 54 |
+
if x is None:
|
| 55 |
+
return None
|
| 56 |
+
s = str(x)
|
| 57 |
+
if ':' in s:
|
| 58 |
+
s = s.split(':', 1)[1]
|
| 59 |
+
return s.strip()
|
| 60 |
+
|
| 61 |
+
def convert_trait(x):
|
| 62 |
+
v = _extract_value(x)
|
| 63 |
+
if v is None:
|
| 64 |
+
return None
|
| 65 |
+
lv = v.lower()
|
| 66 |
+
if lv in {"", "na", "n/a", "not available", "unknown"}:
|
| 67 |
+
return None
|
| 68 |
+
# Map melanoma-positive as 1, others as 0
|
| 69 |
+
if "melanoma" in lv:
|
| 70 |
+
return 1
|
| 71 |
+
return 0
|
| 72 |
+
|
| 73 |
+
def convert_age(x):
|
| 74 |
+
v = _extract_value(x)
|
| 75 |
+
if v is None:
|
| 76 |
+
return None
|
| 77 |
+
lv = v.lower()
|
| 78 |
+
if lv in {"", "na", "n/a", "not available", "unknown"}:
|
| 79 |
+
return None
|
| 80 |
+
m = re.search(r'(\d+(\.\d+)?)', lv)
|
| 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(x):
|
| 89 |
+
v = _extract_value(x)
|
| 90 |
+
if v is None:
|
| 91 |
+
return None
|
| 92 |
+
lv = v.lower()
|
| 93 |
+
if lv in {"", "na", "n/a", "not available", "unknown"}:
|
| 94 |
+
return None
|
| 95 |
+
if lv in {"female", "f"}:
|
| 96 |
+
return 0
|
| 97 |
+
if lv in {"male", "m"}:
|
| 98 |
+
return 1
|
| 99 |
+
return None
|
| 100 |
+
|
| 101 |
+
# 3) Save metadata via initial filtering
|
| 102 |
+
is_trait_available = trait_row is not None
|
| 103 |
+
_ = validate_and_save_cohort_info(
|
| 104 |
+
is_final=False,
|
| 105 |
+
cohort=cohort,
|
| 106 |
+
info_path=json_path,
|
| 107 |
+
is_gene_available=is_gene_available,
|
| 108 |
+
is_trait_available=is_trait_available
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
# 4) Clinical feature extraction (only if trait data available)
|
| 112 |
+
if trait_row is not None:
|
| 113 |
+
selected_clinical_df = 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_clinical_df)
|
| 124 |
+
print("Clinical features preview:", preview)
|
| 125 |
+
|
| 126 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 127 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 128 |
+
else:
|
| 129 |
+
print("Trait data not available; skipping clinical feature extraction.")
|
| 130 |
+
|
| 131 |
+
# Step 3: Gene Data Extraction
|
| 132 |
+
import os
|
| 133 |
+
import io
|
| 134 |
+
import gzip
|
| 135 |
+
import pandas as pd
|
| 136 |
+
|
| 137 |
+
# 1. Try extracting gene expression data using the helper first
|
| 138 |
+
gene_data = get_genetic_data(matrix_file)
|
| 139 |
+
|
| 140 |
+
# Fallbacks if extraction failed or is empty
|
| 141 |
+
def manual_parse_series_matrix(file_path: str) -> pd.DataFrame:
|
| 142 |
+
# Manually extract lines between the begin/end markers and parse with pandas
|
| 143 |
+
begin_marker = '!series_matrix_table_begin'
|
| 144 |
+
end_marker = '!series_matrix_table_end'
|
| 145 |
+
lines = []
|
| 146 |
+
with gzip.open(file_path, 'rt') as f:
|
| 147 |
+
all_lines = f.readlines()
|
| 148 |
+
try:
|
| 149 |
+
begin_idx = next(i for i, l in enumerate(all_lines) if begin_marker in l) + 1
|
| 150 |
+
end_idx = next(i for i, l in enumerate(all_lines) if end_marker in l)
|
| 151 |
+
except StopIteration:
|
| 152 |
+
return pd.DataFrame()
|
| 153 |
+
|
| 154 |
+
table_lines = all_lines[begin_idx:end_idx]
|
| 155 |
+
if not table_lines:
|
| 156 |
+
return pd.DataFrame()
|
| 157 |
+
|
| 158 |
+
# Build text buffer
|
| 159 |
+
buf = io.StringIO(''.join(table_lines))
|
| 160 |
+
try:
|
| 161 |
+
df = pd.read_csv(buf, sep='\t', dtype=str)
|
| 162 |
+
except Exception:
|
| 163 |
+
return pd.DataFrame()
|
| 164 |
+
|
| 165 |
+
# Standardize ID column
|
| 166 |
+
if 'ID_REF' in df.columns:
|
| 167 |
+
df = df.rename(columns={'ID_REF': 'ID'})
|
| 168 |
+
if 'ID' not in df.columns:
|
| 169 |
+
return pd.DataFrame()
|
| 170 |
+
|
| 171 |
+
# Clean column names (remove potential quotes)
|
| 172 |
+
df.columns = [str(c).strip().strip('"') for c in df.columns]
|
| 173 |
+
# Set index
|
| 174 |
+
df['ID'] = df['ID'].astype(str).str.strip().str.strip('"')
|
| 175 |
+
df = df.set_index('ID')
|
| 176 |
+
|
| 177 |
+
# Coerce expression values to numeric where possible
|
| 178 |
+
for c in df.columns:
|
| 179 |
+
df[c] = pd.to_numeric(df[c], errors='coerce')
|
| 180 |
+
|
| 181 |
+
# Drop rows that are entirely NaN across samples
|
| 182 |
+
if not df.empty:
|
| 183 |
+
df = df.dropna(how='all')
|
| 184 |
+
|
| 185 |
+
return df
|
| 186 |
+
|
| 187 |
+
if gene_data.empty:
|
| 188 |
+
# Prefer series_matrix files explicitly
|
| 189 |
+
files = os.listdir(in_cohort_dir)
|
| 190 |
+
candidate_files = [f for f in files if 'series_matrix' in f.lower()]
|
| 191 |
+
# If none found, fall back to any 'matrix' files
|
| 192 |
+
if not candidate_files:
|
| 193 |
+
candidate_files = [f for f in files if 'matrix' in f.lower()]
|
| 194 |
+
|
| 195 |
+
tried_paths = []
|
| 196 |
+
# Try library parser on candidates
|
| 197 |
+
for fname in candidate_files:
|
| 198 |
+
alt_path = os.path.join(in_cohort_dir, fname)
|
| 199 |
+
tried_paths.append(alt_path)
|
| 200 |
+
try:
|
| 201 |
+
alt_df = get_genetic_data(alt_path)
|
| 202 |
+
if not alt_df.empty:
|
| 203 |
+
gene_data = alt_df
|
| 204 |
+
break
|
| 205 |
+
except Exception:
|
| 206 |
+
pass
|
| 207 |
+
|
| 208 |
+
# If still empty, try manual parsing
|
| 209 |
+
if gene_data.empty:
|
| 210 |
+
for path in tried_paths:
|
| 211 |
+
alt_df = manual_parse_series_matrix(path)
|
| 212 |
+
if not alt_df.empty:
|
| 213 |
+
gene_data = alt_df
|
| 214 |
+
break
|
| 215 |
+
|
| 216 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 217 |
+
if gene_data.empty:
|
| 218 |
+
print("WARNING: Gene expression table could not be parsed from the series matrix. "
|
| 219 |
+
"This single-cell dataset may not include expression in the series matrix; "
|
| 220 |
+
"it might be available only in supplemental files.")
|
| 221 |
+
print(gene_data.index[:20])
|
| 222 |
+
else:
|
| 223 |
+
print(gene_data.index[:20])
|
output/preprocess/Melanoma/code/GSE146264.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE146264"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE146264"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE146264.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE146264.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE146264.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 # scRNA-seq indicates gene expression data is available
|
| 41 |
+
trait_row = None # No melanoma status in characteristics; dataset is psoriasis/healthy skin
|
| 42 |
+
age_row = None # No age information present
|
| 43 |
+
gender_row = None # No gender information present
|
| 44 |
+
|
| 45 |
+
# Conversion functions (defined for completeness; not used because corresponding rows are None)
|
| 46 |
+
def _after_colon(x):
|
| 47 |
+
if x is None:
|
| 48 |
+
return None
|
| 49 |
+
if isinstance(x, str):
|
| 50 |
+
parts = x.split(":", 1)
|
| 51 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 52 |
+
val = val.strip()
|
| 53 |
+
return val if val not in {"", "NA", "N/A", "na", "n/a", "null", "None"} else None
|
| 54 |
+
return x
|
| 55 |
+
|
| 56 |
+
def convert_trait(x):
|
| 57 |
+
# Binary: melanoma (1) vs non-melanoma (0). Heuristic mapping from general disease/status text.
|
| 58 |
+
v = _after_colon(x)
|
| 59 |
+
if v is None:
|
| 60 |
+
return None
|
| 61 |
+
vl = v.lower()
|
| 62 |
+
if "melanoma" in vl:
|
| 63 |
+
return 1
|
| 64 |
+
if any(k in vl for k in ["healthy", "control", "normal", "psoriasis", "non-melanoma", "benign"]):
|
| 65 |
+
return 0
|
| 66 |
+
return None
|
| 67 |
+
|
| 68 |
+
def convert_age(x):
|
| 69 |
+
# Continuous age in years
|
| 70 |
+
v = _after_colon(x)
|
| 71 |
+
if v is None:
|
| 72 |
+
return None
|
| 73 |
+
vl = v.lower().replace("years", "").replace("year", "").replace("yrs", "").replace("yr", "").strip()
|
| 74 |
+
try:
|
| 75 |
+
return float(vl)
|
| 76 |
+
except Exception:
|
| 77 |
+
# Try to extract leading number
|
| 78 |
+
import re
|
| 79 |
+
m = re.search(r"(\d+(\.\d+)?)", vl)
|
| 80 |
+
if m:
|
| 81 |
+
try:
|
| 82 |
+
return float(m.group(1))
|
| 83 |
+
except Exception:
|
| 84 |
+
return None
|
| 85 |
+
return None
|
| 86 |
+
|
| 87 |
+
def convert_gender(x):
|
| 88 |
+
# Binary: female -> 0, male -> 1
|
| 89 |
+
v = _after_colon(x)
|
| 90 |
+
if v is None:
|
| 91 |
+
return None
|
| 92 |
+
vl = v.lower()
|
| 93 |
+
if vl in {"male", "m"} or vl.startswith("male"):
|
| 94 |
+
return 1
|
| 95 |
+
if vl in {"female", "f"} or vl.startswith("female"):
|
| 96 |
+
return 0
|
| 97 |
+
return None
|
| 98 |
+
|
| 99 |
+
# Initial filtering and save metadata
|
| 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 |
+
# Clinical feature extraction: skip because trait_row is None (no clinical trait data 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 if age_row is not None else None,
|
| 118 |
+
gender_row=gender_row,
|
| 119 |
+
convert_gender=convert_gender if gender_row is not None else None
|
| 120 |
+
)
|
| 121 |
+
_ = preview_df(selected_clinical_df)
|
| 122 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 123 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
output/preprocess/Melanoma/code/GSE148319.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE148319"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE148319.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE148319.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE148319.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 |
+
# Presence of "hybridization batch" and "scan batch" strongly suggests gene expression microarray data.
|
| 45 |
+
is_gene_available = True
|
| 46 |
+
|
| 47 |
+
# 2) Variable availability and converters
|
| 48 |
+
|
| 49 |
+
# Trait (Melanoma) availability:
|
| 50 |
+
# From the sample characteristics dictionary:
|
| 51 |
+
# key 8: 'cell line: VDH15 oral carcinoma cell line', 'cell line: SCC25 oral carcinoma cell line', 'cell line: melanoma cell line'
|
| 52 |
+
# We'll use key 8 to distinguish melanoma (trait=1) vs non-melanoma (trait=0).
|
| 53 |
+
trait_row = 8
|
| 54 |
+
|
| 55 |
+
# No age or gender information in the provided keys
|
| 56 |
+
age_row = None
|
| 57 |
+
gender_row = None
|
| 58 |
+
|
| 59 |
+
def _after_colon(value: str) -> str:
|
| 60 |
+
if value is None:
|
| 61 |
+
return ""
|
| 62 |
+
s = str(value)
|
| 63 |
+
if ':' in s:
|
| 64 |
+
s = s.split(':', 1)[1]
|
| 65 |
+
return s.strip()
|
| 66 |
+
|
| 67 |
+
def convert_trait(value):
|
| 68 |
+
v = _after_colon(value).lower()
|
| 69 |
+
if v in {"", "na", "n/a", "unknown", "nan"}:
|
| 70 |
+
return None
|
| 71 |
+
# Map melanoma to 1, others (oral carcinoma cell lines) to 0
|
| 72 |
+
if "melanoma" in v:
|
| 73 |
+
return 1
|
| 74 |
+
if any(k in v for k in ["oral", "scc25", "vdh", "carcinoma"]):
|
| 75 |
+
return 0
|
| 76 |
+
# Fallback: if clearly not melanoma, set 0; else None
|
| 77 |
+
return 0 if v else None
|
| 78 |
+
|
| 79 |
+
def convert_age(value):
|
| 80 |
+
v = _after_colon(value).lower()
|
| 81 |
+
if v in {"", "na", "n/a", "unknown", "nan"}:
|
| 82 |
+
return None
|
| 83 |
+
# Extract numeric age if present
|
| 84 |
+
nums = re.findall(r"[-+]?\d*\.?\d+", 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(value):
|
| 93 |
+
v = _after_colon(value).lower()
|
| 94 |
+
if v in {"", "na", "n/a", "unknown", "nan"}:
|
| 95 |
+
return None
|
| 96 |
+
if v in {"f", "female", "woman", "women"}:
|
| 97 |
+
return 0
|
| 98 |
+
if v in {"m", "male", "man", "men"}:
|
| 99 |
+
return 1
|
| 100 |
+
return None
|
| 101 |
+
|
| 102 |
+
# 3) Save initial metadata
|
| 103 |
+
is_trait_available = trait_row is not None
|
| 104 |
+
_ = validate_and_save_cohort_info(
|
| 105 |
+
is_final=False,
|
| 106 |
+
cohort=cohort,
|
| 107 |
+
info_path=json_path,
|
| 108 |
+
is_gene_available=is_gene_available,
|
| 109 |
+
is_trait_available=is_trait_available
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
# 4) Clinical feature extraction (only if trait_row is available)
|
| 113 |
+
if trait_row is not None:
|
| 114 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 115 |
+
clinical_df=clinical_data,
|
| 116 |
+
trait=trait,
|
| 117 |
+
trait_row=trait_row,
|
| 118 |
+
convert_trait=convert_trait,
|
| 119 |
+
age_row=age_row,
|
| 120 |
+
convert_age=convert_age if age_row is not None else None,
|
| 121 |
+
gender_row=gender_row,
|
| 122 |
+
convert_gender=convert_gender if gender_row is not None else None
|
| 123 |
+
)
|
| 124 |
+
# Preview and save
|
| 125 |
+
preview = preview_df(selected_clinical_df)
|
| 126 |
+
print("Preview of selected clinical features:", preview)
|
| 127 |
+
|
| 128 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 129 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 130 |
+
|
| 131 |
+
# Step 3: Gene Data Extraction
|
| 132 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 133 |
+
gene_data = get_genetic_data(matrix_file)
|
| 134 |
+
|
| 135 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 136 |
+
print(gene_data.index[:20])
|
| 137 |
+
|
| 138 |
+
# Step 4: Gene Identifier Review
|
| 139 |
+
requires_gene_mapping = True
|
| 140 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 141 |
+
|
| 142 |
+
# Step 5: Gene Annotation
|
| 143 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 144 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 145 |
+
|
| 146 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 147 |
+
print("Gene annotation preview:")
|
| 148 |
+
print(preview_df(gene_annotation))
|
| 149 |
+
|
| 150 |
+
# Step 6: Gene Identifier Mapping
|
| 151 |
+
# Identify the columns for probe IDs and gene symbols in the annotation dataframe
|
| 152 |
+
probe_col = 'ID'
|
| 153 |
+
gene_symbol_col = 'Gene Symbol'
|
| 154 |
+
|
| 155 |
+
# Build the probe-to-gene mapping dataframe
|
| 156 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
| 157 |
+
|
| 158 |
+
# Apply the mapping to convert probe-level data to gene-level expression
|
| 159 |
+
gene_data = apply_gene_mapping(expression_df=gene_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 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 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. Assess bias and remove biased demographic features
|
| 176 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 177 |
+
|
| 178 |
+
# 5. Final validation and save cohort info
|
| 179 |
+
note = "INFO: Trait inferred from cell line type; no Age/Gender available."
|
| 180 |
+
is_usable = validate_and_save_cohort_info(
|
| 181 |
+
is_final=True,
|
| 182 |
+
cohort=cohort,
|
| 183 |
+
info_path=json_path,
|
| 184 |
+
is_gene_available=True,
|
| 185 |
+
is_trait_available=True,
|
| 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/Melanoma/code/GSE148949.py
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE148949"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE148949"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE148949.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE148949.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE148949.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 |
+
# Step 1: Assess gene expression data availability based on background info
|
| 40 |
+
# Agilent whole human genome 2-channel arrays indicate gene expression microarray data.
|
| 41 |
+
is_gene_available = True
|
| 42 |
+
|
| 43 |
+
# Step 2: Variable availability and conversion functions
|
| 44 |
+
# From the provided sample characteristics, there is only one row with a single constant description,
|
| 45 |
+
# which is not per-sample and thus not usable for association analyses. No age or gender data present.
|
| 46 |
+
trait_row = None
|
| 47 |
+
age_row = None
|
| 48 |
+
gender_row = None
|
| 49 |
+
|
| 50 |
+
def _extract_value(cell):
|
| 51 |
+
if cell is None:
|
| 52 |
+
return None
|
| 53 |
+
s = str(cell)
|
| 54 |
+
# Typical GEO annotation looks like "field: value"
|
| 55 |
+
if ':' in s:
|
| 56 |
+
s = s.split(':', 1)[1]
|
| 57 |
+
return s.strip()
|
| 58 |
+
|
| 59 |
+
def convert_trait(cell):
|
| 60 |
+
# Binary: Melanoma (1) vs non-Melanoma (0)
|
| 61 |
+
s = _extract_value(cell)
|
| 62 |
+
if not s:
|
| 63 |
+
return None
|
| 64 |
+
s_low = s.lower()
|
| 65 |
+
if 'melanoma' in s_low:
|
| 66 |
+
return 1
|
| 67 |
+
# If clearly indicates another tissue/cancer, map to 0
|
| 68 |
+
negative_indicators = ['breast', 'tnbc', 'mammary', 'hepatoblastoma', 'cervix', 'embryonal carcinoma',
|
| 69 |
+
'glioblastoma', 'liposarcoma', 'lymphoma', 'leukemia', 'plasmacytoma', 'myeloma',
|
| 70 |
+
'b lymphocyte', 't lymphoblast', 'testis', 'brain', 'liver']
|
| 71 |
+
if any(k in s_low for k in negative_indicators):
|
| 72 |
+
return 0
|
| 73 |
+
# Unknown context
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
def convert_age(cell):
|
| 77 |
+
# Continuous: extract numeric age if present
|
| 78 |
+
s = _extract_value(cell)
|
| 79 |
+
if not s:
|
| 80 |
+
return None
|
| 81 |
+
# Extract first number (can include decimals)
|
| 82 |
+
import re
|
| 83 |
+
m = re.search(r'[-+]?\d*\.?\d+', s)
|
| 84 |
+
if not m:
|
| 85 |
+
return None
|
| 86 |
+
try:
|
| 87 |
+
age_val = float(m.group())
|
| 88 |
+
# Age bounds sanity check (0-120 years)
|
| 89 |
+
if 0 <= age_val <= 120:
|
| 90 |
+
return age_val
|
| 91 |
+
return None
|
| 92 |
+
except Exception:
|
| 93 |
+
return None
|
| 94 |
+
|
| 95 |
+
def convert_gender(cell):
|
| 96 |
+
# Binary: female -> 0, male -> 1
|
| 97 |
+
s = _extract_value(cell)
|
| 98 |
+
if not s:
|
| 99 |
+
return None
|
| 100 |
+
s_low = s.lower()
|
| 101 |
+
if s_low in ['f', 'female', 'woman', 'women']:
|
| 102 |
+
return 0
|
| 103 |
+
if s_low in ['m', 'male', 'man', 'men']:
|
| 104 |
+
return 1
|
| 105 |
+
return None
|
| 106 |
+
|
| 107 |
+
# Step 3: Initial filtering and save 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 |
+
# Step 4: Clinical Feature Extraction (skip because trait_row is None)
|
| 118 |
+
# If trait_row were available:
|
| 119 |
+
# if trait_row is not None:
|
| 120 |
+
# selected_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 |
+
# _ = preview_df(selected_df)
|
| 131 |
+
# os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 132 |
+
# selected_df.to_csv(out_clinical_data_file, index=True)
|
| 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 |
+
print("requires_gene_mapping = True")
|
| 143 |
+
|
| 144 |
+
# Step 5: Gene Annotation
|
| 145 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 146 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 147 |
+
|
| 148 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 149 |
+
print("Gene annotation preview:")
|
| 150 |
+
print(preview_df(gene_annotation))
|
| 151 |
+
|
| 152 |
+
# Step 6: Gene Identifier Mapping
|
| 153 |
+
# Step 6: Gene Identifier Mapping
|
| 154 |
+
|
| 155 |
+
# 1) Decide identifier and gene symbol columns by checking overlap with expression IDs
|
| 156 |
+
expr_ids = set(gene_data.index.astype(str))
|
| 157 |
+
|
| 158 |
+
# Find the annotation column with the largest overlap to use as probe/ID column
|
| 159 |
+
best_probe_col = None
|
| 160 |
+
best_overlap = 0
|
| 161 |
+
for col in gene_annotation.columns:
|
| 162 |
+
ann_values = set(gene_annotation[col].astype(str).str.strip())
|
| 163 |
+
overlap = len(ann_values & expr_ids)
|
| 164 |
+
if overlap > best_overlap:
|
| 165 |
+
best_overlap = overlap
|
| 166 |
+
best_probe_col = col
|
| 167 |
+
|
| 168 |
+
# Heuristic choice for gene symbol column
|
| 169 |
+
symbol_col_candidates = [
|
| 170 |
+
'Gene Symbol', 'GENE_SYMBOL', 'GeneSymbol', 'Symbol', 'SYMBOL',
|
| 171 |
+
'ORF', 'ORF_NAME', 'GENE', 'Gene', 'GB_ACC', 'ENTREZ_GENE_ID'
|
| 172 |
+
]
|
| 173 |
+
gene_symbol_col = None
|
| 174 |
+
for c in symbol_col_candidates:
|
| 175 |
+
if c in gene_annotation.columns:
|
| 176 |
+
gene_symbol_col = c
|
| 177 |
+
break
|
| 178 |
+
# Fallbacks if not found among candidates
|
| 179 |
+
if gene_symbol_col is None:
|
| 180 |
+
if 'ORF' in gene_annotation.columns:
|
| 181 |
+
gene_symbol_col = 'ORF'
|
| 182 |
+
elif 'ID' in gene_annotation.columns:
|
| 183 |
+
gene_symbol_col = 'ID'
|
| 184 |
+
|
| 185 |
+
# 2) Build mapping and apply it. If no plausible probe column found, fall back to extracting symbols from IDs directly.
|
| 186 |
+
mapped = False
|
| 187 |
+
try:
|
| 188 |
+
# Require a minimal overlap to consider the mapping valid
|
| 189 |
+
if best_probe_col is not None and best_overlap > 0 and gene_symbol_col is not None:
|
| 190 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=best_probe_col, gene_col=gene_symbol_col)
|
| 191 |
+
# If after filtering there is still overlap, proceed
|
| 192 |
+
if len(set(mapping_df['ID']).intersection(expr_ids)) > 0:
|
| 193 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 194 |
+
mapped = True
|
| 195 |
+
except Exception as e:
|
| 196 |
+
# Proceed to fallback if anything goes wrong
|
| 197 |
+
mapped = False
|
| 198 |
+
|
| 199 |
+
if not mapped:
|
| 200 |
+
# Fallback: extract gene symbols directly from probe IDs using regex heuristic
|
| 201 |
+
# Build a mapping where 'Gene' column is the original ID string; apply_gene_mapping will extract symbols.
|
| 202 |
+
fallback_mapping = pd.DataFrame({
|
| 203 |
+
'ID': gene_data.index.astype(str),
|
| 204 |
+
'Gene': gene_data.index.astype(str)
|
| 205 |
+
})
|
| 206 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=fallback_mapping)
|
| 207 |
+
|
| 208 |
+
# Normalize gene symbols and aggregate duplicates
|
| 209 |
+
try:
|
| 210 |
+
gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 211 |
+
except Exception:
|
| 212 |
+
# If synonym file missing or any issue, continue with current symbols
|
| 213 |
+
pass
|
| 214 |
+
|
| 215 |
+
# Save mapped gene expression data
|
| 216 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 217 |
+
gene_data.to_csv(out_gene_data_file)
|
| 218 |
+
|
| 219 |
+
# Quick check
|
| 220 |
+
print("Chosen probe column:", best_probe_col)
|
| 221 |
+
print("Chosen symbol column:", gene_symbol_col)
|
| 222 |
+
print("Mapped gene_data shape:", gene_data.shape)
|
| 223 |
+
print("First 20 mapped genes:", list(gene_data.index[:20]))
|
| 224 |
+
|
| 225 |
+
# Step 7: Data Normalization and Linking
|
| 226 |
+
# 1. Normalize gene symbols and save normalized gene expression data
|
| 227 |
+
try:
|
| 228 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 229 |
+
except Exception:
|
| 230 |
+
# If normalization fails (e.g., missing synonym file), fall back to existing gene_data
|
| 231 |
+
normalized_gene_data = gene_data
|
| 232 |
+
|
| 233 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 234 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 235 |
+
|
| 236 |
+
# 2-6. Link clinical and genetic data only if clinical trait data exists; otherwise, record metadata and skip linking
|
| 237 |
+
has_trait = ('trait_row' in locals()) and (trait_row is not None)
|
| 238 |
+
|
| 239 |
+
if has_trait:
|
| 240 |
+
# Ensure clinical features are available (recompute if not already)
|
| 241 |
+
if 'selected_clinical_data' not in locals():
|
| 242 |
+
selected_clinical_data = geo_select_clinical_features(
|
| 243 |
+
clinical_df=clinical_data,
|
| 244 |
+
trait=trait,
|
| 245 |
+
trait_row=trait_row,
|
| 246 |
+
convert_trait=convert_trait,
|
| 247 |
+
age_row=age_row,
|
| 248 |
+
convert_age=convert_age,
|
| 249 |
+
gender_row=gender_row,
|
| 250 |
+
convert_gender=convert_gender
|
| 251 |
+
)
|
| 252 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 253 |
+
selected_clinical_data.to_csv(out_clinical_data_file, index=True)
|
| 254 |
+
|
| 255 |
+
# Link clinical and genetic data
|
| 256 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
| 257 |
+
|
| 258 |
+
# Handle missing values
|
| 259 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 260 |
+
|
| 261 |
+
# Remove biased demographic features; check if trait is biased
|
| 262 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 263 |
+
|
| 264 |
+
# Final validation and save cohort info
|
| 265 |
+
is_usable = validate_and_save_cohort_info(
|
| 266 |
+
is_final=True,
|
| 267 |
+
cohort=cohort,
|
| 268 |
+
info_path=json_path,
|
| 269 |
+
is_gene_available=True,
|
| 270 |
+
is_trait_available=True,
|
| 271 |
+
is_biased=is_trait_biased,
|
| 272 |
+
df=unbiased_linked_data,
|
| 273 |
+
note="INFO: Linked data generated with standardized gene symbols."
|
| 274 |
+
)
|
| 275 |
+
|
| 276 |
+
# Save linked data if usable
|
| 277 |
+
if is_usable:
|
| 278 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 279 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 280 |
+
else:
|
| 281 |
+
# No trait data available; record metadata and do not attempt linking
|
| 282 |
+
_ = validate_and_save_cohort_info(
|
| 283 |
+
is_final=True,
|
| 284 |
+
cohort=cohort,
|
| 285 |
+
info_path=json_path,
|
| 286 |
+
is_gene_available=True,
|
| 287 |
+
is_trait_available=False,
|
| 288 |
+
is_biased=False,
|
| 289 |
+
df=normalized_gene_data.T, # pass a non-empty df to avoid false abnormality override
|
| 290 |
+
note="INFO: No clinical trait data available; skipped linking. Saved normalized gene expression only."
|
| 291 |
+
)
|
output/preprocess/Melanoma/code/GSE157738.py
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE157738"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE157738"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE157738.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE157738.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE157738.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 data availability (Affymetrix Human Gene 2.0 ST Array -> gene expression)
|
| 43 |
+
is_gene_available = True
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability inferred from the provided Sample Characteristics Dictionary
|
| 46 |
+
# Row 1: "patient diagnosis: melanoma" -> constant across all samples; not useful for association -> treat as unavailable
|
| 47 |
+
trait_row = None # constant melanoma diagnosis
|
| 48 |
+
age_row = None # no age field present
|
| 49 |
+
gender_row = None # no gender field present
|
| 50 |
+
|
| 51 |
+
# 2.2) Data type conversion functions
|
| 52 |
+
def _after_colon(value):
|
| 53 |
+
if value is None:
|
| 54 |
+
return None
|
| 55 |
+
parts = str(value).split(":", 1)
|
| 56 |
+
return parts[1].strip() if len(parts) == 2 else str(value).strip()
|
| 57 |
+
|
| 58 |
+
def convert_trait(x):
|
| 59 |
+
"""
|
| 60 |
+
Binary: 1 = melanoma case; 0 = control/healthy/non-melanoma.
|
| 61 |
+
Unknowns -> None.
|
| 62 |
+
"""
|
| 63 |
+
v = _after_colon(x)
|
| 64 |
+
if v is None or v == "":
|
| 65 |
+
return None
|
| 66 |
+
vl = v.lower()
|
| 67 |
+
# Heuristics for cases vs controls
|
| 68 |
+
if any(k in vl for k in ["healthy", "normal", "control", "non-melanoma", "non melanoma", "benign"]):
|
| 69 |
+
return 0
|
| 70 |
+
if "melanoma" in vl:
|
| 71 |
+
return 1
|
| 72 |
+
return None
|
| 73 |
+
|
| 74 |
+
def convert_age(x):
|
| 75 |
+
"""
|
| 76 |
+
Continuous age in years.
|
| 77 |
+
Extract first floating number from the value after colon.
|
| 78 |
+
Unknowns/invalid -> None.
|
| 79 |
+
"""
|
| 80 |
+
v = _after_colon(x)
|
| 81 |
+
if v is None or v == "":
|
| 82 |
+
return None
|
| 83 |
+
m = re.search(r"[-+]?\d*\.\d+|[-+]?\d+", v)
|
| 84 |
+
if m:
|
| 85 |
+
try:
|
| 86 |
+
return float(m.group())
|
| 87 |
+
except Exception:
|
| 88 |
+
return None
|
| 89 |
+
return None
|
| 90 |
+
|
| 91 |
+
def convert_gender(x):
|
| 92 |
+
"""
|
| 93 |
+
Binary: female=0, male=1. Unknown -> None.
|
| 94 |
+
"""
|
| 95 |
+
v = _after_colon(x)
|
| 96 |
+
if v is None or v == "":
|
| 97 |
+
return None
|
| 98 |
+
vl = v.strip().lower()
|
| 99 |
+
if vl in ["female", "f", "woman", "girl", "fem", "femme"]:
|
| 100 |
+
return 0
|
| 101 |
+
if vl in ["male", "m", "man", "boy", "masc"]:
|
| 102 |
+
return 1
|
| 103 |
+
return None
|
| 104 |
+
|
| 105 |
+
# 3) Save metadata with initial filtering
|
| 106 |
+
is_trait_available = trait_row is not None
|
| 107 |
+
_ = validate_and_save_cohort_info(
|
| 108 |
+
is_final=False,
|
| 109 |
+
cohort=cohort,
|
| 110 |
+
info_path=json_path,
|
| 111 |
+
is_gene_available=is_gene_available,
|
| 112 |
+
is_trait_available=is_trait_available
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
# 4) Clinical feature extraction (skip if trait not available)
|
| 116 |
+
if trait_row is not None:
|
| 117 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 118 |
+
clinical_df=clinical_data,
|
| 119 |
+
trait=trait,
|
| 120 |
+
trait_row=trait_row,
|
| 121 |
+
convert_trait=convert_trait,
|
| 122 |
+
age_row=age_row,
|
| 123 |
+
convert_age=convert_age,
|
| 124 |
+
gender_row=gender_row,
|
| 125 |
+
convert_gender=convert_gender
|
| 126 |
+
)
|
| 127 |
+
preview = preview_df(selected_clinical_df)
|
| 128 |
+
print(preview)
|
| 129 |
+
# Save clinical features
|
| 130 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 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 |
+
print("requires_gene_mapping = True")
|
| 141 |
+
|
| 142 |
+
# Step 5: Gene Annotation
|
| 143 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 144 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 145 |
+
|
| 146 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 147 |
+
print("Gene annotation preview:")
|
| 148 |
+
print(preview_df(gene_annotation))
|
| 149 |
+
|
| 150 |
+
# Step 6: Gene Identifier Mapping
|
| 151 |
+
import os
|
| 152 |
+
|
| 153 |
+
# Reuse existing objects: gene_annotation, gene_data, in_cohort_dir
|
| 154 |
+
|
| 155 |
+
# Helper to choose a plausible gene symbol column
|
| 156 |
+
def _score_gene_symbol_column(df, col, max_rows: int = 2000):
|
| 157 |
+
s = df[col].dropna().astype(str).head(max_rows)
|
| 158 |
+
tokens = []
|
| 159 |
+
for v in s:
|
| 160 |
+
tokens.extend(extract_human_gene_symbols(v))
|
| 161 |
+
if not tokens:
|
| 162 |
+
return 0
|
| 163 |
+
bad_tokens = {"DNA", "RNA", "PCR", "EST", "CHR", "NC", "PLUS", "MINUS"}
|
| 164 |
+
uniq = {t for t in tokens if t not in bad_tokens and len(t) >= 2}
|
| 165 |
+
return len(uniq)
|
| 166 |
+
|
| 167 |
+
def _pick_gene_col(df, preferred_cols):
|
| 168 |
+
cols = list(df.columns)
|
| 169 |
+
lower_map = {c.lower(): c for c in cols}
|
| 170 |
+
for key in preferred_cols:
|
| 171 |
+
if key.lower() in lower_map:
|
| 172 |
+
return lower_map[key.lower()]
|
| 173 |
+
# Heuristic scan for any column that looks like it contains many gene symbols
|
| 174 |
+
best_col, best_score = None, -1
|
| 175 |
+
for c in cols:
|
| 176 |
+
if c.lower() == 'id':
|
| 177 |
+
continue
|
| 178 |
+
sc = _score_gene_symbol_column(df, c)
|
| 179 |
+
if sc > best_score:
|
| 180 |
+
best_col, best_score = c, sc
|
| 181 |
+
# Require some minimal evidence
|
| 182 |
+
if best_score >= 10:
|
| 183 |
+
return best_col
|
| 184 |
+
return None
|
| 185 |
+
|
| 186 |
+
# 1) Try mapping using the current gene_annotation first
|
| 187 |
+
probe_col = 'ID' if 'ID' in gene_annotation.columns else gene_annotation.columns[0]
|
| 188 |
+
preferred_gene_cols = [
|
| 189 |
+
'Gene Symbol', 'gene_symbol', 'GENE_SYMBOL', 'Gene Symbols', 'SYMBOL', 'Symbol',
|
| 190 |
+
'gene_assignment', 'Gene assignment', 'GENE_ASSIGNMENT',
|
| 191 |
+
'Gene title', 'GENE', 'GENE_SYMBOLS', 'Associated Gene Name', 'Gene symbol',
|
| 192 |
+
'TargetDescription', 'DESCRIPTION', 'ENTREZ_GENE_SYMBOL', 'HGNC', 'GENE_NAME'
|
| 193 |
+
]
|
| 194 |
+
gene_col = _pick_gene_col(gene_annotation, preferred_gene_cols)
|
| 195 |
+
|
| 196 |
+
expr_df = gene_data.copy()
|
| 197 |
+
mapped_gene_data = None
|
| 198 |
+
|
| 199 |
+
if gene_col is not None:
|
| 200 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_col)
|
| 201 |
+
if len(mapping_df) > 0:
|
| 202 |
+
mapped_gene_data = apply_gene_mapping(expression_df=expr_df, mapping_df=mapping_df)
|
| 203 |
+
|
| 204 |
+
# 2) If mapping failed, search for a GPL/platform SOFT in the cohort directory and try again
|
| 205 |
+
used_file = None
|
| 206 |
+
if mapped_gene_data is None or mapped_gene_data.shape[0] == 0:
|
| 207 |
+
# Identify candidate platform files
|
| 208 |
+
try:
|
| 209 |
+
files = os.listdir(in_cohort_dir)
|
| 210 |
+
except Exception:
|
| 211 |
+
files = []
|
| 212 |
+
gpl_candidates = [f for f in files if ('soft' in f.lower()) and ('gpl' in f.lower())]
|
| 213 |
+
# Try each GPL file
|
| 214 |
+
for fname in gpl_candidates:
|
| 215 |
+
try:
|
| 216 |
+
gpl_path = os.path.join(in_cohort_dir, fname)
|
| 217 |
+
gpl_annot = get_gene_annotation(gpl_path)
|
| 218 |
+
if 'ID' not in gpl_annot.columns:
|
| 219 |
+
continue
|
| 220 |
+
gpl_probe_col = 'ID'
|
| 221 |
+
gpl_gene_col = _pick_gene_col(gpl_annot, preferred_gene_cols)
|
| 222 |
+
if gpl_gene_col is None:
|
| 223 |
+
continue
|
| 224 |
+
gpl_map = get_gene_mapping(gpl_annot, prob_col=gpl_probe_col, gene_col=gpl_gene_col)
|
| 225 |
+
if len(gpl_map) == 0:
|
| 226 |
+
continue
|
| 227 |
+
tmp_mapped = apply_gene_mapping(expression_df=expr_df, mapping_df=gpl_map)
|
| 228 |
+
if tmp_mapped.shape[0] > 0:
|
| 229 |
+
mapped_gene_data = tmp_mapped
|
| 230 |
+
probe_col = gpl_probe_col
|
| 231 |
+
gene_col = gpl_gene_col
|
| 232 |
+
used_file = gpl_path
|
| 233 |
+
break
|
| 234 |
+
except Exception:
|
| 235 |
+
continue
|
| 236 |
+
|
| 237 |
+
# 3) Finalize: use mapped data if available; otherwise keep probe-level data with warning
|
| 238 |
+
if mapped_gene_data is not None and mapped_gene_data.shape[0] > 0:
|
| 239 |
+
gene_data = mapped_gene_data
|
| 240 |
+
src = used_file if used_file is not None else "current SOFT annotation"
|
| 241 |
+
print(f"Mapping succeeded: {expr_df.shape[0]} probes -> {gene_data.shape[0]} genes (using column '{gene_col}' from {src}).")
|
| 242 |
+
else:
|
| 243 |
+
print("WARNING: Probe-to-gene mapping could not be completed due to missing gene symbol annotation.")
|
| 244 |
+
print("Proceeding with probe-level data. Consider adding platform (GPL) SOFT with gene symbols or a RefSeq-to-symbol mapping resource.")
|
| 245 |
+
gene_data = expr_df
|
output/preprocess/Melanoma/code/GSE189631.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE189631"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE189631"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE189631.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE189631.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE189631.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/cohort_info.json"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Step 1: Initial Data Loading
|
| 20 |
+
import os
|
| 21 |
+
import re
|
| 22 |
+
import gzip
|
| 23 |
+
import shutil
|
| 24 |
+
import pandas as pd
|
| 25 |
+
from tools.preprocess import *
|
| 26 |
+
|
| 27 |
+
# 1. Identify the paths to the SOFT file and the matrix file
|
| 28 |
+
soft_file = None
|
| 29 |
+
matrix_file = None
|
| 30 |
+
|
| 31 |
+
try:
|
| 32 |
+
# Try the library helper first
|
| 33 |
+
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
|
| 34 |
+
except AssertionError:
|
| 35 |
+
# Fallback: recursive search with GEO-typical patterns
|
| 36 |
+
def find_files_recursively(root_dir):
|
| 37 |
+
for r, _, fns in os.walk(root_dir):
|
| 38 |
+
for fn in fns:
|
| 39 |
+
yield os.path.join(r, fn)
|
| 40 |
+
|
| 41 |
+
all_files = list(find_files_recursively(in_cohort_dir))
|
| 42 |
+
|
| 43 |
+
def is_matrix(fp: str) -> bool:
|
| 44 |
+
name = os.path.basename(fp).lower()
|
| 45 |
+
return (
|
| 46 |
+
('series_matrix' in name or 'matrix' in name) and
|
| 47 |
+
(name.endswith('.gz') or name.endswith('.txt') or name.endswith('.txt.gz'))
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
def is_soft(fp: str) -> bool:
|
| 51 |
+
name = os.path.basename(fp).lower()
|
| 52 |
+
return (
|
| 53 |
+
('soft' in name) and
|
| 54 |
+
(name.endswith('.gz') or name.endswith('.txt') or name.endswith('.soft') or name.endswith('.soft.gz'))
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
matrix_candidates = [f for f in all_files if is_matrix(f)]
|
| 58 |
+
soft_candidates = [f for f in all_files if is_soft(f)]
|
| 59 |
+
|
| 60 |
+
# Prioritize typical GEO series matrix files
|
| 61 |
+
matrix_candidates = sorted(
|
| 62 |
+
matrix_candidates,
|
| 63 |
+
key=lambda x: (0 if 'series_matrix' in os.path.basename(x).lower() else 1, os.path.basename(x).lower())
|
| 64 |
+
)
|
| 65 |
+
soft_candidates = sorted(soft_candidates, key=lambda x: os.path.basename(x).lower())
|
| 66 |
+
|
| 67 |
+
matrix_file = matrix_candidates[0] if matrix_candidates else None
|
| 68 |
+
soft_file = soft_candidates[0] if soft_candidates else None
|
| 69 |
+
|
| 70 |
+
# Early exit if no matrix file available
|
| 71 |
+
if not matrix_file:
|
| 72 |
+
print("ERROR: No matrix file found in cohort directory.")
|
| 73 |
+
# Record unavailability and exit early for this step
|
| 74 |
+
validate_and_save_cohort_info(
|
| 75 |
+
is_final=False,
|
| 76 |
+
cohort=cohort,
|
| 77 |
+
info_path=json_path,
|
| 78 |
+
is_gene_available=False,
|
| 79 |
+
is_trait_available=False
|
| 80 |
+
)
|
| 81 |
+
print("Background Information:")
|
| 82 |
+
print("")
|
| 83 |
+
print("Sample Characteristics Dictionary:")
|
| 84 |
+
print({})
|
| 85 |
+
else:
|
| 86 |
+
# 2. Ensure the matrix file is gzipped for compatibility with helper functions
|
| 87 |
+
matrix_file_gz = matrix_file
|
| 88 |
+
if not matrix_file.lower().endswith(".gz"):
|
| 89 |
+
os.makedirs("./output/tmp", exist_ok=True)
|
| 90 |
+
gz_path = os.path.join("./output/tmp", os.path.basename(matrix_file) + ".gz")
|
| 91 |
+
try:
|
| 92 |
+
with open(matrix_file, "rb") as fin, gzip.open(gz_path, "wb") as fout:
|
| 93 |
+
shutil.copyfileobj(fin, fout)
|
| 94 |
+
matrix_file_gz = gz_path
|
| 95 |
+
print(f"INFO: Compressed matrix file to gzip: {matrix_file_gz}")
|
| 96 |
+
except Exception as e:
|
| 97 |
+
print(f"ERROR: Failed to gzip the matrix file: {e}")
|
| 98 |
+
matrix_file_gz = matrix_file # fallback (may cause error downstream)
|
| 99 |
+
|
| 100 |
+
# 2. Obtain background information and clinical dataframe from the matrix file
|
| 101 |
+
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
|
| 102 |
+
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
|
| 103 |
+
|
| 104 |
+
try:
|
| 105 |
+
background_info, clinical_data = get_background_and_clinical_data(
|
| 106 |
+
matrix_file_gz, background_prefixes, clinical_prefixes
|
| 107 |
+
)
|
| 108 |
+
except Exception as e:
|
| 109 |
+
print(f"ERROR: Failed to parse matrix file for background/clinical data: {e}")
|
| 110 |
+
background_info = ""
|
| 111 |
+
clinical_data = pd.DataFrame()
|
| 112 |
+
|
| 113 |
+
# 3. Create a dictionary of unique values per clinical feature row
|
| 114 |
+
try:
|
| 115 |
+
sample_characteristics_dict = get_unique_values_by_row(clinical_data, max_len=30) if not clinical_data.empty else {}
|
| 116 |
+
except Exception as e:
|
| 117 |
+
print(f"ERROR: Failed to summarize clinical features: {e}")
|
| 118 |
+
sample_characteristics_dict = {}
|
| 119 |
+
|
| 120 |
+
# 4. Print out background info and the sample characteristics dictionary
|
| 121 |
+
print("Identified files:")
|
| 122 |
+
print(" - SOFT:", soft_file if soft_file else "None")
|
| 123 |
+
print(" - Matrix:", matrix_file_gz)
|
| 124 |
+
print("Background Information:")
|
| 125 |
+
print(background_info)
|
| 126 |
+
print("Sample Characteristics Dictionary:")
|
| 127 |
+
print(sample_characteristics_dict)
|
output/preprocess/Melanoma/code/GSE200904.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE200904"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE200904"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE200904.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE200904.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE200904.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 based on background info (NanoString DSP mRNA expression)
|
| 43 |
+
is_gene_available = True # mRNA gene expression (not miRNA-only or methylation)
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability from Sample Characteristics Dictionary:
|
| 46 |
+
# Provided dictionary indicates only ROI/segment/AOI metrics; no diagnosis, age, or gender.
|
| 47 |
+
trait_row = None # No varying disease/control info; all are melanoma TMAs (constant/implicit)
|
| 48 |
+
age_row = None # No age field present
|
| 49 |
+
gender_row = None # No gender field present
|
| 50 |
+
|
| 51 |
+
# 2.2) Conversion functions
|
| 52 |
+
|
| 53 |
+
def _after_colon(x: str) -> str:
|
| 54 |
+
if x is None:
|
| 55 |
+
return None
|
| 56 |
+
parts = str(x).split(":", 1)
|
| 57 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 58 |
+
return val.strip().strip('"').strip()
|
| 59 |
+
|
| 60 |
+
def convert_trait(x):
|
| 61 |
+
"""
|
| 62 |
+
Binary: 1 = Melanoma cases; 0 = controls/normal/benign.
|
| 63 |
+
Heuristics: map common control terms to 0; melanoma-related to 1; unknown -> None.
|
| 64 |
+
"""
|
| 65 |
+
v = _after_colon(x)
|
| 66 |
+
if v is None or v == "":
|
| 67 |
+
return None
|
| 68 |
+
low = v.lower()
|
| 69 |
+
# Positive melanoma indicators
|
| 70 |
+
pos_terms = ["melanoma", "cutaneous melanoma", "skin melanoma", "tumor", "primary melanoma", "metastatic melanoma"]
|
| 71 |
+
if any(t in low for t in pos_terms):
|
| 72 |
+
return 1
|
| 73 |
+
# Negative/control indicators
|
| 74 |
+
neg_terms = ["control", "normal", "healthy", "adjacent normal", "benign", "nevus", "naevus", "non-tumor", "non tumour"]
|
| 75 |
+
if any(t in low for t in neg_terms):
|
| 76 |
+
return 0
|
| 77 |
+
# If explicitly labeled as case/control
|
| 78 |
+
if low in {"case", "patient", "disease"}:
|
| 79 |
+
return 1
|
| 80 |
+
if low in {"control", "healthy volunteer"}:
|
| 81 |
+
return 0
|
| 82 |
+
return None
|
| 83 |
+
|
| 84 |
+
def convert_age(x):
|
| 85 |
+
"""
|
| 86 |
+
Continuous: age in years (float). Accepts years or months; converts months to years.
|
| 87 |
+
Extracts first numeric occurrence; handles units if present.
|
| 88 |
+
"""
|
| 89 |
+
v = _after_colon(x)
|
| 90 |
+
if v is None or v == "":
|
| 91 |
+
return None
|
| 92 |
+
low = v.lower()
|
| 93 |
+
# Find numeric (int/float)
|
| 94 |
+
m = re.search(r'[-+]?\d*\.?\d+', low)
|
| 95 |
+
if not m:
|
| 96 |
+
return None
|
| 97 |
+
num = float(m.group())
|
| 98 |
+
# Unit handling
|
| 99 |
+
if "month" in low or "mo" in low:
|
| 100 |
+
return num / 12.0
|
| 101 |
+
return num # assume years
|
| 102 |
+
|
| 103 |
+
def convert_gender(x):
|
| 104 |
+
"""
|
| 105 |
+
Binary: female=0, male=1
|
| 106 |
+
"""
|
| 107 |
+
v = _after_colon(x)
|
| 108 |
+
if v is None or v == "":
|
| 109 |
+
return None
|
| 110 |
+
low = v.lower()
|
| 111 |
+
if low in {"male", "m"}:
|
| 112 |
+
return 1
|
| 113 |
+
if low in {"female", "f"}:
|
| 114 |
+
return 0
|
| 115 |
+
return None
|
| 116 |
+
|
| 117 |
+
# 3) Save metadata (initial filtering)
|
| 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 (skip because trait_row is None)
|
| 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 if age_row is not None else None,
|
| 136 |
+
gender_row=gender_row,
|
| 137 |
+
convert_gender=convert_gender if gender_row is not None else None
|
| 138 |
+
)
|
| 139 |
+
# Preview and save
|
| 140 |
+
_ = preview_df(selected_clinical_df)
|
| 141 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 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 |
+
requires_gene_mapping = False
|
| 152 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
output/preprocess/Melanoma/code/GSE202806.py
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE202806"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE202806"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE202806.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE202806.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE202806.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 (based on series summary: multiplex transcriptomic profiling of 770 genes)
|
| 42 |
+
is_gene_available = True
|
| 43 |
+
|
| 44 |
+
# 2) Variable availability and conversion functions
|
| 45 |
+
# From Sample Characteristics:
|
| 46 |
+
# {0: ['tissue: Melanoma'], 1: ['nf1 status: WT', 'nf1 status: MUT']}
|
| 47 |
+
# - Trait = Melanoma: constant across all samples => not useful (set to None)
|
| 48 |
+
# - Age: not present
|
| 49 |
+
# - Gender: not present
|
| 50 |
+
trait_row = None
|
| 51 |
+
age_row = None
|
| 52 |
+
gender_row = None
|
| 53 |
+
|
| 54 |
+
def _extract_value(x):
|
| 55 |
+
if x is None:
|
| 56 |
+
return None
|
| 57 |
+
if isinstance(x, (int, float)):
|
| 58 |
+
return x
|
| 59 |
+
s = str(x).strip()
|
| 60 |
+
# take substring after the last colon if present
|
| 61 |
+
if ':' in s:
|
| 62 |
+
s = s.split(':', 1)[1]
|
| 63 |
+
return s.strip()
|
| 64 |
+
|
| 65 |
+
def convert_trait(x):
|
| 66 |
+
# Binary: melanoma presence (1) vs non-melanoma/normal (0)
|
| 67 |
+
v = _extract_value(x)
|
| 68 |
+
if v is None:
|
| 69 |
+
return None
|
| 70 |
+
v_low = str(v).lower()
|
| 71 |
+
# heuristics
|
| 72 |
+
if any(k in v_low for k in ['melanoma', 'tumor', 'tumour', 'cancer', 'lesion']):
|
| 73 |
+
# If it explicitly says normal/control/adjacent normal, map to 0
|
| 74 |
+
if any(k in v_low for k in ['normal', 'control', 'healthy', 'adjacent normal', 'benign', 'non-tumor', 'non tumour', 'noncancer']):
|
| 75 |
+
return 0
|
| 76 |
+
return 1
|
| 77 |
+
if any(k in v_low for k in ['normal', 'control', 'healthy', 'adjacent normal', 'benign']):
|
| 78 |
+
return 0
|
| 79 |
+
return None
|
| 80 |
+
|
| 81 |
+
def convert_age(x):
|
| 82 |
+
# Continuous age in years
|
| 83 |
+
v = _extract_value(x)
|
| 84 |
+
if v is None:
|
| 85 |
+
return None
|
| 86 |
+
s = str(v).strip().lower()
|
| 87 |
+
# extract number and unit
|
| 88 |
+
m = re.search(r'([0-9]*\.?[0-9]+)', s)
|
| 89 |
+
if not m:
|
| 90 |
+
return None
|
| 91 |
+
num = float(m.group(1))
|
| 92 |
+
# unit handling
|
| 93 |
+
if any(u in s for u in ['year', 'yr', 'y']):
|
| 94 |
+
return num
|
| 95 |
+
if any(u in s for u in ['month', 'mo', 'mth']):
|
| 96 |
+
return num / 12.0
|
| 97 |
+
if any(u in s for u in ['week', 'wk', 'w']):
|
| 98 |
+
return num / 52.0
|
| 99 |
+
if any(u in s for u in ['day', 'd']):
|
| 100 |
+
return num / 365.0
|
| 101 |
+
# default assume years if unit missing but value reasonable
|
| 102 |
+
return num
|
| 103 |
+
|
| 104 |
+
def convert_gender(x):
|
| 105 |
+
# Binary: female->0, male->1
|
| 106 |
+
v = _extract_value(x)
|
| 107 |
+
if v is None:
|
| 108 |
+
return None
|
| 109 |
+
s = str(v).strip().lower()
|
| 110 |
+
if s in ['female', 'f', 'woman', 'women', 'girl']:
|
| 111 |
+
return 0
|
| 112 |
+
if s in ['male', 'm', 'man', 'men', 'boy']:
|
| 113 |
+
return 1
|
| 114 |
+
return None
|
| 115 |
+
|
| 116 |
+
# 3) Save metadata (initial filtering)
|
| 117 |
+
is_trait_available = trait_row is not None
|
| 118 |
+
_ = validate_and_save_cohort_info(
|
| 119 |
+
is_final=False,
|
| 120 |
+
cohort=cohort,
|
| 121 |
+
info_path=json_path,
|
| 122 |
+
is_gene_available=is_gene_available,
|
| 123 |
+
is_trait_available=is_trait_available
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
# 4) Clinical feature extraction (skip because trait_row is None)
|
| 127 |
+
# If, in future, clinical data becomes available for trait, age, or gender, the following block can be enabled:
|
| 128 |
+
if False and (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 |
+
print(preview_df(selected_clinical_df))
|
| 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 |
+
# The provided identifiers (e.g., A2M, AKT1, APOE) are standard human gene symbols (HGNC).
|
| 152 |
+
requires_gene_mapping = False
|
| 153 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 154 |
+
|
| 155 |
+
# Step 5: Data Normalization and Linking
|
| 156 |
+
import os
|
| 157 |
+
|
| 158 |
+
# 1. Normalize gene symbols and save normalized 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-6. If trait is unavailable (trait_row is None), skip linking and downstream steps.
|
| 164 |
+
# Record final metadata accurately (gene available, trait unavailable). Do not save linked data.
|
| 165 |
+
if (globals().get('trait_row', None) is None):
|
| 166 |
+
linked_data = None # explicit for clarity
|
| 167 |
+
is_usable = validate_and_save_cohort_info(
|
| 168 |
+
is_final=True,
|
| 169 |
+
cohort=cohort,
|
| 170 |
+
info_path=json_path,
|
| 171 |
+
is_gene_available=True,
|
| 172 |
+
is_trait_available=False,
|
| 173 |
+
is_biased=False,
|
| 174 |
+
df=normalized_gene_data.T.head(1), # placeholder with sufficient columns to avoid abnormality override
|
| 175 |
+
note="INFO: Trait not available (constant across samples); clinical-genetic linking skipped."
|
| 176 |
+
)
|
| 177 |
+
else:
|
| 178 |
+
# If trait is available, proceed with clinical feature extraction and linking
|
| 179 |
+
selected_clinical_data = geo_select_clinical_features(
|
| 180 |
+
clinical_df=clinical_data,
|
| 181 |
+
trait=trait,
|
| 182 |
+
trait_row=trait_row,
|
| 183 |
+
convert_trait=convert_trait,
|
| 184 |
+
age_row=age_row,
|
| 185 |
+
convert_age=convert_age,
|
| 186 |
+
gender_row=gender_row,
|
| 187 |
+
convert_gender=convert_gender
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
# Link clinical and genetic data
|
| 191 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
| 192 |
+
|
| 193 |
+
# Handle missing values
|
| 194 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 195 |
+
|
| 196 |
+
# Judge bias and remove biased covariates
|
| 197 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 198 |
+
|
| 199 |
+
# Final validation and save cohort info
|
| 200 |
+
is_usable = validate_and_save_cohort_info(
|
| 201 |
+
is_final=True,
|
| 202 |
+
cohort=cohort,
|
| 203 |
+
info_path=json_path,
|
| 204 |
+
is_gene_available=True,
|
| 205 |
+
is_trait_available=True,
|
| 206 |
+
is_biased=is_trait_biased,
|
| 207 |
+
df=unbiased_linked_data,
|
| 208 |
+
note="INFO: Linked dataset processed with missing value handling and bias assessment."
|
| 209 |
+
)
|
| 210 |
+
|
| 211 |
+
# Save linked data only if usable
|
| 212 |
+
if is_usable:
|
| 213 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 214 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Melanoma/code/GSE215868.py
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE215868"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE215868"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE215868.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE215868.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE215868.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 # Transcriptomic gene expression profiling per background info
|
| 41 |
+
|
| 42 |
+
# 2) Variable availability and converters
|
| 43 |
+
# Based on provided sample characteristics, there is no case/control label for Melanoma (all are melanoma tumor samples).
|
| 44 |
+
trait_row = None # No variability for the trait "Melanoma" in this cohort
|
| 45 |
+
age_row = 0 # 'age: <number>' present
|
| 46 |
+
gender_row = None # No gender/sex field present
|
| 47 |
+
|
| 48 |
+
# Converters
|
| 49 |
+
def _extract_after_colon(x):
|
| 50 |
+
if x is None:
|
| 51 |
+
return None
|
| 52 |
+
s = str(x)
|
| 53 |
+
parts = s.split(":", 1)
|
| 54 |
+
v = parts[1] if len(parts) > 1 else parts[0]
|
| 55 |
+
return v.strip()
|
| 56 |
+
|
| 57 |
+
def convert_trait(x):
|
| 58 |
+
"""
|
| 59 |
+
Binary: 1 = melanoma case, 0 = control/non-melanoma.
|
| 60 |
+
Not used here since trait_row is None, but kept for compatibility.
|
| 61 |
+
"""
|
| 62 |
+
v = _extract_after_colon(x)
|
| 63 |
+
if v is None or v == "":
|
| 64 |
+
return None
|
| 65 |
+
vl = v.lower()
|
| 66 |
+
# Map common non-melanoma terms to 0
|
| 67 |
+
non_case_terms = {"control", "normal", "healthy", "benign", "nevus", "non-melanoma", "adjacent normal"}
|
| 68 |
+
if any(term in vl for term in non_case_terms):
|
| 69 |
+
return 0
|
| 70 |
+
# Map melanoma terms to 1
|
| 71 |
+
if "melanoma" in vl:
|
| 72 |
+
return 1
|
| 73 |
+
# If unclear, return None
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
def convert_age(x):
|
| 77 |
+
"""Continuous age in years. Unknowns -> None."""
|
| 78 |
+
v = _extract_after_colon(x)
|
| 79 |
+
if v is None or v == "":
|
| 80 |
+
return None
|
| 81 |
+
vl = v.lower()
|
| 82 |
+
if vl in {"na", "n/a", "unknown", "uk", "null"}:
|
| 83 |
+
return None
|
| 84 |
+
# Remove any non-numeric trailing text
|
| 85 |
+
try:
|
| 86 |
+
# Some ages might be integers
|
| 87 |
+
return float(v)
|
| 88 |
+
except Exception:
|
| 89 |
+
# Try to extract numeric part
|
| 90 |
+
import re
|
| 91 |
+
m = re.search(r"[-+]?\d*\.?\d+", v)
|
| 92 |
+
if m:
|
| 93 |
+
try:
|
| 94 |
+
return float(m.group())
|
| 95 |
+
except Exception:
|
| 96 |
+
return None
|
| 97 |
+
return None
|
| 98 |
+
|
| 99 |
+
def convert_gender(x):
|
| 100 |
+
"""Binary: female=0, male=1. Unknowns -> None."""
|
| 101 |
+
v = _extract_after_colon(x)
|
| 102 |
+
if v is None or v == "":
|
| 103 |
+
return None
|
| 104 |
+
vl = v.lower()
|
| 105 |
+
if vl in {"male", "m", "man", "boy"}:
|
| 106 |
+
return 1
|
| 107 |
+
if vl in {"female", "f", "woman", "girl"}:
|
| 108 |
+
return 0
|
| 109 |
+
# Handle common abbreviations
|
| 110 |
+
if vl in {"na", "n/a", "unknown", "uk", "null"}:
|
| 111 |
+
return None
|
| 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)
|
| 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 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 138 |
+
|
| 139 |
+
# Step 3: Gene Data Extraction
|
| 140 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 141 |
+
gene_data = get_genetic_data(matrix_file)
|
| 142 |
+
|
| 143 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 144 |
+
print(gene_data.index[:20])
|
| 145 |
+
|
| 146 |
+
# Step 4: Gene Identifier Review
|
| 147 |
+
# Based on the observed identifiers (e.g., A2M, ABCF1, ACVR1C, etc.), these are standard human gene symbols (HGNC).
|
| 148 |
+
requires_gene_mapping = False
|
| 149 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 150 |
+
|
| 151 |
+
# Step 5: Data Normalization and Linking
|
| 152 |
+
# 1. Normalize gene symbols and save gene data
|
| 153 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 154 |
+
|
| 155 |
+
import os
|
| 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-6. Link and downstream processing only if trait data is available; otherwise, skip and finalize metadata
|
| 160 |
+
if ('selected_clinical_data' in globals()) and (trait_row is not None):
|
| 161 |
+
# 2. Link clinical and genetic data
|
| 162 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
| 163 |
+
|
| 164 |
+
# 3. Handle missing values
|
| 165 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 166 |
+
|
| 167 |
+
# 4. Judge bias and remove biased covariates
|
| 168 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 169 |
+
|
| 170 |
+
# 5. Final validation and save metadata
|
| 171 |
+
is_usable = validate_and_save_cohort_info(
|
| 172 |
+
True, cohort, json_path, True, True, is_trait_biased, unbiased_linked_data,
|
| 173 |
+
note="INFO: Clinical features extracted and linked successfully."
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
# 6. Save linked data if usable
|
| 177 |
+
if is_usable:
|
| 178 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 179 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 180 |
+
else:
|
| 181 |
+
# Trait not available (trait_row is None or clinical features were not extracted)
|
| 182 |
+
is_usable = validate_and_save_cohort_info(
|
| 183 |
+
True, cohort, json_path, True, False, False, normalized_gene_data,
|
| 184 |
+
note="INFO: Trait not available or constant for this cohort; only gene data saved."
|
| 185 |
+
)
|
| 186 |
+
# Do not save linked_data since it is not usable without trait
|
output/preprocess/Melanoma/code/GSE244984.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE244984"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE244984"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE244984.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE244984.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE244984.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 availability
|
| 42 |
+
# SuperSeries typically do not contain their own expression matrices; data are in subseries.
|
| 43 |
+
is_gene_available = False
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability
|
| 46 |
+
trait_row = None # All samples are melanoma; no case-control variation at this SuperSeries level.
|
| 47 |
+
age_row = None # Not present in provided characteristics.
|
| 48 |
+
gender_row = None # Not present in provided characteristics.
|
| 49 |
+
# Note: key 1 ("resistance") is a non-trait clinical variable for other analyses.
|
| 50 |
+
|
| 51 |
+
# 2) Converters
|
| 52 |
+
def _after_colon(x):
|
| 53 |
+
if x is None:
|
| 54 |
+
return None
|
| 55 |
+
if isinstance(x, (int, float)):
|
| 56 |
+
return str(x)
|
| 57 |
+
s = str(x)
|
| 58 |
+
parts = s.split(":", 1)
|
| 59 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 60 |
+
return val.strip()
|
| 61 |
+
|
| 62 |
+
def convert_trait(x):
|
| 63 |
+
# Binary: Melanoma=1, Control/Normal/Benign=0
|
| 64 |
+
v = _after_colon(x)
|
| 65 |
+
if v is None:
|
| 66 |
+
return None
|
| 67 |
+
vl = v.lower()
|
| 68 |
+
if any(k in vl for k in ["melanoma", "tumor", "tumour", "metastatic", "primary tumor", "stage"]):
|
| 69 |
+
return 1
|
| 70 |
+
if any(k in vl for k in ["normal", "healthy", "control", "benign", "nevus", "naevus", "adjacent normal"]):
|
| 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 |
+
vl = v.lower()
|
| 79 |
+
if vl in {"na", "n/a", "none", "unknown", ""}:
|
| 80 |
+
return None
|
| 81 |
+
m = re.search(r"(\d+(\.\d+)?)", vl)
|
| 82 |
+
if not m:
|
| 83 |
+
return None
|
| 84 |
+
try:
|
| 85 |
+
age = float(m.group(1))
|
| 86 |
+
if age <= 0 or age > 120:
|
| 87 |
+
return None
|
| 88 |
+
return age
|
| 89 |
+
except Exception:
|
| 90 |
+
return None
|
| 91 |
+
|
| 92 |
+
def convert_gender(x):
|
| 93 |
+
# Female -> 0, Male -> 1
|
| 94 |
+
v = _after_colon(x)
|
| 95 |
+
if v is None:
|
| 96 |
+
return None
|
| 97 |
+
vl = v.strip().lower()
|
| 98 |
+
if vl in {"male", "m"}:
|
| 99 |
+
return 1
|
| 100 |
+
if vl in {"female", "f"}:
|
| 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 is skipped because trait_row is None.
|
output/preprocess/Melanoma/code/GSE261347.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Melanoma"
|
| 6 |
+
cohort = "GSE261347"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Melanoma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Melanoma/GSE261347"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Melanoma/GSE261347.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/GSE261347.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/GSE261347.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Melanoma/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 data availability
|
| 43 |
+
# Based on series summary/design (GeoMx transcriptomic profiling with gene identifiers), this is gene expression data.
|
| 44 |
+
is_gene_available = True
|
| 45 |
+
|
| 46 |
+
# 2) Variable availability and conversion functions
|
| 47 |
+
|
| 48 |
+
# From the provided Sample Characteristics Dictionary:
|
| 49 |
+
# {0: ['patient: Pat27', ...], 1: ['resistance: CTLA4res', 'resistance: PD1res']}
|
| 50 |
+
# No explicit melanoma status, age, or gender fields. Melanoma is constant across all samples in this series.
|
| 51 |
+
trait_row = None # Melanoma is constant in this cohort; no usable variability
|
| 52 |
+
age_row = None # Not available
|
| 53 |
+
gender_row = None # Not available
|
| 54 |
+
|
| 55 |
+
def _extract_value(cell):
|
| 56 |
+
if cell is None:
|
| 57 |
+
return None
|
| 58 |
+
if isinstance(cell, str):
|
| 59 |
+
parts = cell.split(":", 1)
|
| 60 |
+
val = parts[1].strip() if len(parts) > 1 else cell.strip()
|
| 61 |
+
return val if val != "" else None
|
| 62 |
+
return cell
|
| 63 |
+
|
| 64 |
+
def convert_trait(x):
|
| 65 |
+
# Binary mapping for melanoma if available: melanoma=1, non-melanoma/control=0
|
| 66 |
+
val = _extract_value(x)
|
| 67 |
+
if val is None:
|
| 68 |
+
return None
|
| 69 |
+
v = val.strip().lower()
|
| 70 |
+
if any(k in v for k in ["melanoma", "tumor", "tumour", "cancer"]):
|
| 71 |
+
return 1
|
| 72 |
+
if any(k in v for k in ["normal", "control", "benign", "nevus", "naevus", "healthy"]):
|
| 73 |
+
return 0
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
def convert_age(x):
|
| 77 |
+
# Continuous age in years if available
|
| 78 |
+
val = _extract_value(x)
|
| 79 |
+
if val is None:
|
| 80 |
+
return None
|
| 81 |
+
# Extract first integer or float in the string
|
| 82 |
+
m = re.search(r"(\d+(\.\d+)?)", val)
|
| 83 |
+
if not m:
|
| 84 |
+
return None
|
| 85 |
+
try:
|
| 86 |
+
num = float(m.group(1))
|
| 87 |
+
# Filter out implausible ages
|
| 88 |
+
if 0 <= num <= 120:
|
| 89 |
+
return num
|
| 90 |
+
except Exception:
|
| 91 |
+
pass
|
| 92 |
+
return None
|
| 93 |
+
|
| 94 |
+
def convert_gender(x):
|
| 95 |
+
# Binary: female=0, male=1
|
| 96 |
+
val = _extract_value(x)
|
| 97 |
+
if val is None:
|
| 98 |
+
return None
|
| 99 |
+
v = val.strip().lower()
|
| 100 |
+
if v in {"f", "female", "woman", "women", "girl"}:
|
| 101 |
+
return 0
|
| 102 |
+
if v in {"m", "male", "man", "men", "boy"}:
|
| 103 |
+
return 1
|
| 104 |
+
return None
|
| 105 |
+
|
| 106 |
+
# 3) Save metadata with 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 (skip because trait_row is None)
|
| 117 |
+
# If trait_row were not None, we would extract and save clinical features as below:
|
| 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 |
+
# os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 130 |
+
# selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
output/preprocess/Melanoma/code/TCGA.py
ADDED
|
@@ -0,0 +1,684 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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root_dir = "../DATA/TCGA"
|
| 9 |
+
|
| 10 |
+
# Output paths
|
| 11 |
+
out_data_file = "./output/z4/preprocess/Melanoma/TCGA.csv"
|
| 12 |
+
out_gene_data_file = "./output/z4/preprocess/Melanoma/gene_data/TCGA.csv"
|
| 13 |
+
out_clinical_data_file = "./output/z4/preprocess/Melanoma/clinical_data/TCGA.csv"
|
| 14 |
+
json_path = "./output/z4/preprocess/Melanoma/cohort_info.json"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Step 1: Initial Data Loading
|
| 18 |
+
import os
|
| 19 |
+
import pandas as pd
|
| 20 |
+
|
| 21 |
+
# List available subdirectories in TCGA root
|
| 22 |
+
all_entries = os.listdir(tcga_root_dir)
|
| 23 |
+
subdirs = [d for d in all_entries if os.path.isdir(os.path.join(tcga_root_dir, d))]
|
| 24 |
+
|
| 25 |
+
# Select the most appropriate cohort directory for Melanoma (prefer SKCM, avoid ocular)
|
| 26 |
+
def cohort_score(name: str) -> int:
|
| 27 |
+
l = name.lower()
|
| 28 |
+
score = 0
|
| 29 |
+
if 'ocular' in l:
|
| 30 |
+
score += 10 # deprioritize ocular melanomas
|
| 31 |
+
if 'skcm' in l:
|
| 32 |
+
score -= 1 # prefer SKCM (Skin Cutaneous Melanoma)
|
| 33 |
+
return score
|
| 34 |
+
|
| 35 |
+
mel_candidates = [d for d in subdirs if 'melanoma' in d.lower()]
|
| 36 |
+
if mel_candidates:
|
| 37 |
+
selected_subdir = sorted(mel_candidates, key=cohort_score)[0]
|
| 38 |
+
else:
|
| 39 |
+
skcm_candidates = [d for d in subdirs if 'skcm' in d.lower()]
|
| 40 |
+
selected_subdir = skcm_candidates[0] if skcm_candidates else None
|
| 41 |
+
|
| 42 |
+
if not selected_subdir:
|
| 43 |
+
# No suitable directory found; mark as unavailable and stop further processing in subsequent steps
|
| 44 |
+
_ = validate_and_save_cohort_info(
|
| 45 |
+
is_final=False,
|
| 46 |
+
cohort="TCGA",
|
| 47 |
+
info_path=json_path,
|
| 48 |
+
is_gene_available=False,
|
| 49 |
+
is_trait_available=False
|
| 50 |
+
)
|
| 51 |
+
clinical_df = pd.DataFrame()
|
| 52 |
+
genetic_df = pd.DataFrame()
|
| 53 |
+
else:
|
| 54 |
+
cohort_dir = os.path.join(tcga_root_dir, selected_subdir)
|
| 55 |
+
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
|
| 56 |
+
|
| 57 |
+
clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0, low_memory=False)
|
| 58 |
+
genetic_df = pd.read_csv(genetic_file_path, sep='\t', index_col=0, low_memory=False)
|
| 59 |
+
|
| 60 |
+
# Print clinical column names for further analysis
|
| 61 |
+
print(list(clinical_df.columns))
|
| 62 |
+
|
| 63 |
+
# Step 2: Find Candidate Demographic Features
|
| 64 |
+
import re
|
| 65 |
+
|
| 66 |
+
# Try to get column names from existing variables; otherwise, fall back to the provided list
|
| 67 |
+
if 'clinical_df' in globals():
|
| 68 |
+
cols = list(clinical_df.columns)
|
| 69 |
+
elif 'clinical_columns' in globals():
|
| 70 |
+
cols = list(clinical_columns)
|
| 71 |
+
else:
|
| 72 |
+
cols = ['_INTEGRATION', '_PATIENT', '_cohort', '_primary_disease', '_primary_site', 'additional_pharmaceutical_therapy', 'additional_radiation_therapy', 'age_at_initial_pathologic_diagnosis', 'bcr_followup_barcode', 'bcr_patient_barcode', 'bcr_sample_barcode', 'breslow_depth_value', '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', 'days_to_submitted_specimen_dx', 'distant_metastasis_anatomic_site', 'followup_case_report_form_submission_reason', 'form_completion_date', 'gender', 'height', 'history_of_neoadjuvant_treatment', 'icd_10', 'icd_o_3_histology', 'icd_o_3_site', 'informed_consent_verified', 'initial_weight', 'interferon_90_day_prior_excision_admin_indicator', 'is_ffpe', 'lactate_dehydrogenase_result', 'lost_follow_up', 'malignant_neoplasm_mitotic_count_rate', 'melanoma_clark_level_value', 'melanoma_origin_skin_anatomic_site', 'melanoma_ulceration_indicator', 'new_neoplasm_event_occurrence_anatomic_site', 'new_neoplasm_event_type', 'new_non_melanoma_event_histologic_type_text', 'new_primary_melanoma_anatomic_site', 'new_tumor_dx_prior_submitted_specimen_dx', 'new_tumor_event_additional_surgery_procedure', 'new_tumor_event_after_initial_treatment', 'new_tumor_metastasis_anatomic_site', 'new_tumor_metastasis_anatomic_site_other_text', 'oct_embedded', 'other_dx', 'pathologic_M', 'pathologic_N', 'pathologic_T', 'pathologic_stage', 'pathology_report_file_name', 'patient_id', 'person_neoplasm_cancer_status', 'postoperative_rx_tx', 'primary_anatomic_site_count', 'primary_melanoma_at_diagnosis_count', 'primary_neoplasm_melanoma_dx', 'primary_tumor_multiple_present_ind', 'prior_systemic_therapy_type', 'radiation_therapy', 'sample_type', 'sample_type_id', 'subsequent_primary_melanoma_during_followup', 'system_version', 'tissue_prospective_collection_indicator', 'tissue_retrospective_collection_indicator', 'tissue_source_site', 'tissue_type', 'tumor_descriptor', 'tumor_tissue_site', 'vial_number', 'vital_status', 'weight', 'year_of_initial_pathologic_diagnosis', '_GENOMIC_ID_TCGA_SKCM_exp_HiSeqV2', '_GENOMIC_ID_TCGA_SKCM_hMethyl450', '_GENOMIC_ID_TCGA_SKCM_exp_HiSeqV2_PANCAN', '_GENOMIC_ID_TCGA_SKCM_miRNA_HiSeq', '_GENOMIC_ID_TCGA_SKCM_gistic2thd', '_GENOMIC_ID_data/public/TCGA/SKCM/miRNA_HiSeq_gene', '_GENOMIC_ID_TCGA_SKCM_RPPA', '_GENOMIC_ID_TCGA_SKCM_mutation_bcm_gene', '_GENOMIC_ID_TCGA_SKCM_mutation_broad_gene', '_GENOMIC_ID_TCGA_SKCM_gistic2', '_GENOMIC_ID_TCGA_SKCM_mutation', '_GENOMIC_ID_TCGA_SKCM_exp_HiSeqV2_exon', '_GENOMIC_ID_TCGA_SKCM_PDMRNAseqCNV', '_GENOMIC_ID_TCGA_SKCM_PDMRNAseq', '_GENOMIC_ID_TCGA_SKCM_exp_HiSeqV2_percentile']
|
| 73 |
+
|
| 74 |
+
# Identify candidate age and gender columns using conservative regex (avoid matching 'stage')
|
| 75 |
+
age_patterns = [re.compile(r'(^|[^A-Za-z])age([^A-Za-z]|$)'),
|
| 76 |
+
re.compile(r'(^|[^A-Za-z])(birth|days_to_birth|dob)([^A-Za-z]|$)')]
|
| 77 |
+
gender_pattern = re.compile(r'(^|[^A-Za-z])(gender|sex)([^A-Za-z]|$)')
|
| 78 |
+
|
| 79 |
+
def is_age_col(col: str) -> bool:
|
| 80 |
+
cl = col.lower()
|
| 81 |
+
return any(p.search(cl) for p in age_patterns)
|
| 82 |
+
|
| 83 |
+
def is_gender_col(col: str) -> bool:
|
| 84 |
+
cl = col.lower()
|
| 85 |
+
return bool(gender_pattern.search(cl))
|
| 86 |
+
|
| 87 |
+
candidate_age_cols = [c for c in cols if is_age_col(c)]
|
| 88 |
+
candidate_gender_cols = [c for c in cols if is_gender_col(c)]
|
| 89 |
+
|
| 90 |
+
# Print required lists in the exact format
|
| 91 |
+
print(f"candidate_age_cols = {candidate_age_cols}")
|
| 92 |
+
print(f"candidate_gender_cols = {candidate_gender_cols}")
|
| 93 |
+
|
| 94 |
+
# Extract and preview from clinical_df if available and candidates exist
|
| 95 |
+
if 'clinical_df' in globals():
|
| 96 |
+
selected_cols = [c for c in candidate_age_cols + candidate_gender_cols if c in clinical_df.columns]
|
| 97 |
+
if selected_cols:
|
| 98 |
+
preview = preview_df(clinical_df[selected_cols], n=5)
|
| 99 |
+
print(preview)
|
| 100 |
+
|
| 101 |
+
# Step 3: Select Demographic Features
|
| 102 |
+
# Select demographic feature columns based on candidate lists and available preview dictionaries
|
| 103 |
+
|
| 104 |
+
# Gather preview values for candidate columns from any dict-like globals
|
| 105 |
+
age_values_dict = {}
|
| 106 |
+
gender_values_dict = {}
|
| 107 |
+
|
| 108 |
+
try:
|
| 109 |
+
for var_name, var_val in globals().items():
|
| 110 |
+
if isinstance(var_val, dict):
|
| 111 |
+
# Collect age candidates
|
| 112 |
+
if 'candidate_age_cols' in globals():
|
| 113 |
+
for col in candidate_age_cols:
|
| 114 |
+
if col in var_val and col not in age_values_dict:
|
| 115 |
+
age_values_dict[col] = var_val[col]
|
| 116 |
+
# Collect gender candidates
|
| 117 |
+
if 'candidate_gender_cols' in globals():
|
| 118 |
+
for col in candidate_gender_cols:
|
| 119 |
+
if col in var_val and col not in gender_values_dict:
|
| 120 |
+
gender_values_dict[col] = var_val[col]
|
| 121 |
+
except Exception:
|
| 122 |
+
pass
|
| 123 |
+
|
| 124 |
+
def is_missing(v):
|
| 125 |
+
try:
|
| 126 |
+
import pandas as _pd # likely already imported; safe if not
|
| 127 |
+
return _pd.isna(v)
|
| 128 |
+
except Exception:
|
| 129 |
+
try:
|
| 130 |
+
return v is None or (isinstance(v, float) and v != v)
|
| 131 |
+
except Exception:
|
| 132 |
+
return v is None
|
| 133 |
+
|
| 134 |
+
def clean_numeric(vals):
|
| 135 |
+
cleaned = [v for v in vals if not is_missing(v)]
|
| 136 |
+
nums = []
|
| 137 |
+
for v in cleaned:
|
| 138 |
+
try:
|
| 139 |
+
nums.append(float(v))
|
| 140 |
+
except Exception:
|
| 141 |
+
continue
|
| 142 |
+
return nums
|
| 143 |
+
|
| 144 |
+
def is_plausible_age_years(vals, min_non_missing_ratio=0.6):
|
| 145 |
+
nums = clean_numeric(vals)
|
| 146 |
+
if not vals:
|
| 147 |
+
return False
|
| 148 |
+
non_missing_ratio = len(nums) / max(1, len([v for v in vals if not is_missing(v)]))
|
| 149 |
+
# If numeric conversion failed, reject
|
| 150 |
+
if len(nums) == 0:
|
| 151 |
+
return False
|
| 152 |
+
within = [0 <= v <= 120 for v in nums]
|
| 153 |
+
# Require majority within range and sufficient non-missing numeric values
|
| 154 |
+
return (sum(within) >= max(1, int(0.6 * len(nums)))) and (len(nums) >= max(1, int(min_non_missing_ratio * len(vals))))
|
| 155 |
+
|
| 156 |
+
def looks_like_days_to_birth(vals, min_non_missing_ratio=0.6):
|
| 157 |
+
nums = clean_numeric(vals)
|
| 158 |
+
if not vals:
|
| 159 |
+
return False
|
| 160 |
+
if len(nums) < max(1, int(min_non_missing_ratio * len(vals))):
|
| 161 |
+
return False
|
| 162 |
+
negatives = [v < 0 for v in nums]
|
| 163 |
+
return (sum(negatives) >= max(1, int(0.6 * len(nums)))) and any(abs(v) > 1000 for v in nums)
|
| 164 |
+
|
| 165 |
+
def is_gender_values(vals, min_valid_ratio=0.6):
|
| 166 |
+
cleaned = [str(v).strip().lower() for v in vals if not is_missing(v)]
|
| 167 |
+
if not vals or not cleaned:
|
| 168 |
+
return False
|
| 169 |
+
allowed = {'male', 'female', 'm', 'f'}
|
| 170 |
+
valid = [v in allowed for v in cleaned]
|
| 171 |
+
return sum(valid) >= max(1, int(min_valid_ratio * len(cleaned)))
|
| 172 |
+
|
| 173 |
+
# Decide age_col
|
| 174 |
+
age_col = None
|
| 175 |
+
if 'candidate_age_cols' in globals():
|
| 176 |
+
# Prefer age in years
|
| 177 |
+
for col in candidate_age_cols:
|
| 178 |
+
vals = age_values_dict.get(col, [])
|
| 179 |
+
if vals and is_plausible_age_years(vals):
|
| 180 |
+
age_col = col
|
| 181 |
+
break
|
| 182 |
+
# Fallback: days_to_birth if plausible
|
| 183 |
+
if age_col is None:
|
| 184 |
+
for col in candidate_age_cols:
|
| 185 |
+
vals = age_values_dict.get(col, [])
|
| 186 |
+
if vals and ('days_to_birth' in col.lower()) and looks_like_days_to_birth(vals):
|
| 187 |
+
age_col = col
|
| 188 |
+
break
|
| 189 |
+
|
| 190 |
+
# Decide gender_col
|
| 191 |
+
gender_col = None
|
| 192 |
+
if 'candidate_gender_cols' in globals():
|
| 193 |
+
# Prefer an explicit 'gender' column if values look right
|
| 194 |
+
if 'gender' in candidate_gender_cols and is_gender_values(gender_values_dict.get('gender', [])):
|
| 195 |
+
gender_col = 'gender'
|
| 196 |
+
else:
|
| 197 |
+
for col in candidate_gender_cols:
|
| 198 |
+
vals = gender_values_dict.get(col, [])
|
| 199 |
+
if vals and is_gender_values(vals):
|
| 200 |
+
gender_col = col
|
| 201 |
+
break
|
| 202 |
+
|
| 203 |
+
# Explicitly print out the information for the chosen columns
|
| 204 |
+
print("Chosen age_col:", age_col)
|
| 205 |
+
if age_col is not None:
|
| 206 |
+
sample_vals = age_values_dict.get(age_col, None)
|
| 207 |
+
if sample_vals is not None:
|
| 208 |
+
print("Sample values for age_col:", sample_vals[:5])
|
| 209 |
+
else:
|
| 210 |
+
print("Sample values for age_col: unavailable")
|
| 211 |
+
else:
|
| 212 |
+
print("Sample values for age_col: unavailable")
|
| 213 |
+
|
| 214 |
+
print("Chosen gender_col:", gender_col)
|
| 215 |
+
if gender_col is not None:
|
| 216 |
+
sample_vals = gender_values_dict.get(gender_col, None)
|
| 217 |
+
if sample_vals is not None:
|
| 218 |
+
print("Sample values for gender_col:", sample_vals[:5])
|
| 219 |
+
else:
|
| 220 |
+
print("Sample values for gender_col: unavailable")
|
| 221 |
+
else:
|
| 222 |
+
print("Sample values for gender_col: unavailable")
|
| 223 |
+
|
| 224 |
+
# Step 4: Select Demographic Features
|
| 225 |
+
# Try to get candidate dictionaries from previous steps if they exist
|
| 226 |
+
age_candidates = globals().get("age_candidates", {}) or {}
|
| 227 |
+
gender_candidates = globals().get("gender_candidates", {}) or {}
|
| 228 |
+
|
| 229 |
+
def _is_iterable_listlike(x):
|
| 230 |
+
return isinstance(x, (list, tuple))
|
| 231 |
+
|
| 232 |
+
def _standardize_candidate_dict(cand):
|
| 233 |
+
# Ensure values are simple lists (first 5 values already provided by previous step; keep as-is)
|
| 234 |
+
std = {}
|
| 235 |
+
if isinstance(cand, dict):
|
| 236 |
+
for k, v in cand.items():
|
| 237 |
+
if _is_iterable_listlike(v):
|
| 238 |
+
std[k] = list(v)
|
| 239 |
+
else:
|
| 240 |
+
# If not a list-like, try to coerce to list safely
|
| 241 |
+
try:
|
| 242 |
+
std[k] = list(v)
|
| 243 |
+
except Exception:
|
| 244 |
+
std[k] = [v]
|
| 245 |
+
return std
|
| 246 |
+
|
| 247 |
+
age_candidates = _standardize_candidate_dict(age_candidates)
|
| 248 |
+
gender_candidates = _standardize_candidate_dict(gender_candidates)
|
| 249 |
+
|
| 250 |
+
def _select_best_age_col(candidates: dict):
|
| 251 |
+
if not candidates:
|
| 252 |
+
return None
|
| 253 |
+
best_col = None
|
| 254 |
+
best_score = -1
|
| 255 |
+
for col, samples in candidates.items():
|
| 256 |
+
if not samples:
|
| 257 |
+
continue
|
| 258 |
+
# Evaluate with tcga_convert_age
|
| 259 |
+
converted = [tcga_convert_age(x) for x in samples]
|
| 260 |
+
valid = [x for x in converted if x is not None and 0 <= x <= 120]
|
| 261 |
+
valid_ratio = len(valid) / max(len(samples), 1)
|
| 262 |
+
# Heuristic: prefer columns with "age" in the name
|
| 263 |
+
name_bonus = 0.2 if "age" in str(col).lower() else 0.0
|
| 264 |
+
score = valid_ratio + name_bonus
|
| 265 |
+
if score > best_score:
|
| 266 |
+
best_score = score
|
| 267 |
+
best_col = col
|
| 268 |
+
# Require at least moderate validity to accept
|
| 269 |
+
if best_col is not None:
|
| 270 |
+
converted = [tcga_convert_age(x) for x in candidates[best_col]]
|
| 271 |
+
valid = [x for x in converted if x is not None and 0 <= x <= 120]
|
| 272 |
+
valid_ratio = len(valid) / max(len(candidates[best_col]), 1)
|
| 273 |
+
if valid_ratio >= 0.6:
|
| 274 |
+
return best_col
|
| 275 |
+
return None
|
| 276 |
+
|
| 277 |
+
def _select_best_gender_col(candidates: dict):
|
| 278 |
+
if not candidates:
|
| 279 |
+
return None
|
| 280 |
+
best_col = None
|
| 281 |
+
best_score = -1
|
| 282 |
+
for col, samples in candidates.items():
|
| 283 |
+
if not samples:
|
| 284 |
+
continue
|
| 285 |
+
converted = [tcga_convert_gender(x) for x in samples]
|
| 286 |
+
valid = [x for x in converted if x in (0, 1)]
|
| 287 |
+
valid_ratio = len(valid) / max(len(samples), 1)
|
| 288 |
+
name_lower = str(col).lower()
|
| 289 |
+
name_bonus = 0.2 if ("gender" in name_lower or "sex" in name_lower) else 0.0
|
| 290 |
+
score = valid_ratio + name_bonus
|
| 291 |
+
if score > best_score:
|
| 292 |
+
best_score = score
|
| 293 |
+
best_col = col
|
| 294 |
+
if best_col is not None:
|
| 295 |
+
converted = [tcga_convert_gender(x) for x in candidates[best_col]]
|
| 296 |
+
valid = [x for x in converted if x in (0, 1)]
|
| 297 |
+
valid_ratio = len(valid) / max(len(candidates[best_col]), 1)
|
| 298 |
+
if valid_ratio >= 0.6:
|
| 299 |
+
return best_col
|
| 300 |
+
return None
|
| 301 |
+
|
| 302 |
+
age_col = _select_best_age_col(age_candidates)
|
| 303 |
+
gender_col = _select_best_gender_col(gender_candidates)
|
| 304 |
+
|
| 305 |
+
# If dictionaries are empty or no suitable column found, set to None explicitly
|
| 306 |
+
if not age_candidates or age_col is None:
|
| 307 |
+
age_col = None
|
| 308 |
+
if not gender_candidates or gender_col is None:
|
| 309 |
+
gender_col = None
|
| 310 |
+
|
| 311 |
+
print(f"Chosen age_col: {age_col if age_col is not None else 'None'}")
|
| 312 |
+
if age_col is not None and age_col in age_candidates:
|
| 313 |
+
print(f"Sample values for age_col: {age_candidates[age_col]}")
|
| 314 |
+
else:
|
| 315 |
+
print("Sample values for age_col: unavailable")
|
| 316 |
+
|
| 317 |
+
print(f"Chosen gender_col: {gender_col if gender_col is not None else 'None'}")
|
| 318 |
+
if gender_col is not None and gender_col in gender_candidates:
|
| 319 |
+
print(f"Sample values for gender_col: {gender_candidates[gender_col]}")
|
| 320 |
+
else:
|
| 321 |
+
print("Sample values for gender_col: unavailable")
|
| 322 |
+
|
| 323 |
+
# Step 5: Select Demographic Features
|
| 324 |
+
# Try to retrieve candidate dictionaries from common variable names first, then fall back to heuristic discovery.
|
| 325 |
+
def _get_candidates_dict(dict_type: str) -> dict:
|
| 326 |
+
assert dict_type in ("age", "gender")
|
| 327 |
+
preferred_varnames = [
|
| 328 |
+
f"{dict_type}_candidates_dict",
|
| 329 |
+
f"{dict_type}_candidates",
|
| 330 |
+
f"{dict_type}_candidate_dict",
|
| 331 |
+
f"{dict_type}_preview",
|
| 332 |
+
f"{dict_type}_columns_samples",
|
| 333 |
+
f"{dict_type}_cols_dict",
|
| 334 |
+
f"{dict_type}_dict",
|
| 335 |
+
f"{dict_type}_preview_dict",
|
| 336 |
+
f"{dict_type}_candidates_preview",
|
| 337 |
+
]
|
| 338 |
+
for name in preferred_varnames:
|
| 339 |
+
if name in globals() and isinstance(globals()[name], dict):
|
| 340 |
+
d = globals()[name]
|
| 341 |
+
# Basic shape check: keys are strings, values are list-like
|
| 342 |
+
if all(isinstance(k, str) for k in d.keys()) and all(isinstance(v, (list, tuple)) for v in d.values()):
|
| 343 |
+
return d
|
| 344 |
+
|
| 345 |
+
# Fallback heuristic: scan globals for likely dicts
|
| 346 |
+
name_keywords_primary = [dict_type]
|
| 347 |
+
name_keywords_secondary = ['candidate', 'candidates', 'dict', 'preview', 'samples', 'values']
|
| 348 |
+
for varname, val in globals().items():
|
| 349 |
+
if isinstance(val, dict):
|
| 350 |
+
lname = varname.lower()
|
| 351 |
+
if all(k in lname for k in name_keywords_primary) and any(s in lname for s in name_keywords_secondary):
|
| 352 |
+
if all(isinstance(k, str) for k in val.keys()) and all(isinstance(v, (list, tuple)) for v in val.values()):
|
| 353 |
+
return val
|
| 354 |
+
return {}
|
| 355 |
+
|
| 356 |
+
age_dict = _get_candidates_dict('age')
|
| 357 |
+
gender_dict = _get_candidates_dict('gender')
|
| 358 |
+
|
| 359 |
+
def _score_age_column(colname: str, samples: list) -> tuple:
|
| 360 |
+
parsed = [tcga_convert_age(x) for x in samples[:5]]
|
| 361 |
+
non_missing = [p for p in parsed if p is not None]
|
| 362 |
+
if len(parsed) == 0:
|
| 363 |
+
return (-1.0, 0, 0.0)
|
| 364 |
+
plausible = [p for p in non_missing if 0 <= p <= 120]
|
| 365 |
+
valid_count = len(plausible)
|
| 366 |
+
prop_valid = valid_count / len(parsed)
|
| 367 |
+
|
| 368 |
+
# Name-based bonuses and preferences
|
| 369 |
+
lname = colname.lower()
|
| 370 |
+
name_bonus = 0.0
|
| 371 |
+
if 'age' in lname:
|
| 372 |
+
name_bonus += 0.15
|
| 373 |
+
# Specific TCGA-like fields
|
| 374 |
+
preferred_names = [
|
| 375 |
+
'age_at_initial_pathologic_diagnosis',
|
| 376 |
+
'age_at_diagnosis',
|
| 377 |
+
'age_at_diagnoses',
|
| 378 |
+
'age_at_index',
|
| 379 |
+
'age'
|
| 380 |
+
]
|
| 381 |
+
# Give small bonus if exact match to a preferred field
|
| 382 |
+
if lname in preferred_names:
|
| 383 |
+
name_bonus += 0.1
|
| 384 |
+
|
| 385 |
+
score = prop_valid + name_bonus
|
| 386 |
+
return (score, valid_count, prop_valid)
|
| 387 |
+
|
| 388 |
+
def _score_gender_column(colname: str, samples: list) -> tuple:
|
| 389 |
+
tokens = [str(x).strip().lower() for x in samples[:5] if x is not None and str(x).strip() != ""]
|
| 390 |
+
if len(tokens) == 0:
|
| 391 |
+
return (-1.0, 0, 0.0)
|
| 392 |
+
valid = [t for t in tokens if t in ('male', 'female')]
|
| 393 |
+
valid_count = len(valid)
|
| 394 |
+
prop_valid = valid_count / len(tokens)
|
| 395 |
+
|
| 396 |
+
lname = colname.lower()
|
| 397 |
+
name_bonus = 0.0
|
| 398 |
+
if 'gender' in lname:
|
| 399 |
+
name_bonus += 0.15
|
| 400 |
+
elif 'sex' in lname:
|
| 401 |
+
name_bonus += 0.1
|
| 402 |
+
|
| 403 |
+
score = prop_valid + name_bonus
|
| 404 |
+
return (score, valid_count, prop_valid)
|
| 405 |
+
|
| 406 |
+
# Select age column with relaxed threshold and tie-breaking
|
| 407 |
+
age_col = None
|
| 408 |
+
age_best = {'col': None, 'score': -1.0, 'valid_count': 0, 'prop_valid': 0.0}
|
| 409 |
+
for col, samples in age_dict.items():
|
| 410 |
+
try:
|
| 411 |
+
score, valid_count, prop_valid = _score_age_column(col, samples)
|
| 412 |
+
except Exception:
|
| 413 |
+
score, valid_count, prop_valid = (-1.0, 0, 0.0)
|
| 414 |
+
# Primary by score, tie-breaker by valid_count, then by name length (shorter often more canonical)
|
| 415 |
+
better = False
|
| 416 |
+
if score > age_best['score']:
|
| 417 |
+
better = True
|
| 418 |
+
elif score == age_best['score'] and valid_count > age_best['valid_count']:
|
| 419 |
+
better = True
|
| 420 |
+
elif score == age_best['score'] and valid_count == age_best['valid_count'] and age_best['col'] is not None:
|
| 421 |
+
better = len(col) < len(age_best['col'])
|
| 422 |
+
if better:
|
| 423 |
+
age_best = {'col': col, 'score': score, 'valid_count': valid_count, 'prop_valid': prop_valid}
|
| 424 |
+
|
| 425 |
+
# Apply relaxed acceptance: prefer prop_valid >= 0.4; if none, accept best with at least one valid value; else None
|
| 426 |
+
if age_best['col'] is not None and (age_best['prop_valid'] >= 0.4 or age_best['valid_count'] >= 1):
|
| 427 |
+
age_col = age_best['col']
|
| 428 |
+
else:
|
| 429 |
+
age_col = None
|
| 430 |
+
|
| 431 |
+
# Select gender column with relaxed threshold and tie-breaking
|
| 432 |
+
gender_col = None
|
| 433 |
+
gender_best = {'col': None, 'score': -1.0, 'valid_count': 0, 'prop_valid': 0.0}
|
| 434 |
+
for col, samples in gender_dict.items():
|
| 435 |
+
try:
|
| 436 |
+
score, valid_count, prop_valid = _score_gender_column(col, samples)
|
| 437 |
+
except Exception:
|
| 438 |
+
score, valid_count, prop_valid = (-1.0, 0, 0.0)
|
| 439 |
+
better = False
|
| 440 |
+
if score > gender_best['score']:
|
| 441 |
+
better = True
|
| 442 |
+
elif score == gender_best['score'] and valid_count > gender_best['valid_count']:
|
| 443 |
+
better = True
|
| 444 |
+
elif score == gender_best['score'] and valid_count == gender_best['valid_count'] and gender_best['col'] is not None:
|
| 445 |
+
better = len(col) < len(gender_best['col'])
|
| 446 |
+
if better:
|
| 447 |
+
gender_best = {'col': col, 'score': score, 'valid_count': valid_count, 'prop_valid': prop_valid}
|
| 448 |
+
|
| 449 |
+
if gender_best['col'] is not None and (gender_best['prop_valid'] >= 0.4 or gender_best['valid_count'] >= 1):
|
| 450 |
+
gender_col = gender_best['col']
|
| 451 |
+
else:
|
| 452 |
+
gender_col = None
|
| 453 |
+
|
| 454 |
+
# Explicitly print the chosen columns and sample values, with basic validity information
|
| 455 |
+
print(f"Chosen age_col: {age_col}")
|
| 456 |
+
if age_col is not None and age_col in age_dict:
|
| 457 |
+
print(f"Sample values for age_col: {age_dict[age_col][:5]}")
|
| 458 |
+
print(f"Age column validity (valid_count/5): {age_best['valid_count']}/5; proportion: {age_best['prop_valid']:.2f}")
|
| 459 |
+
else:
|
| 460 |
+
if not age_dict:
|
| 461 |
+
print("Sample values for age_col: unavailable (no age candidate dictionary found)")
|
| 462 |
+
else:
|
| 463 |
+
print("Sample values for age_col: unavailable")
|
| 464 |
+
|
| 465 |
+
print(f"Chosen gender_col: {gender_col}")
|
| 466 |
+
if gender_col is not None and gender_col in gender_dict:
|
| 467 |
+
print(f"Sample values for gender_col: {gender_dict[gender_col][:5]}")
|
| 468 |
+
print(f"Gender column validity (valid_count/5): {gender_best['valid_count']}/5; proportion: {gender_best['prop_valid']:.2f}")
|
| 469 |
+
else:
|
| 470 |
+
if not gender_dict:
|
| 471 |
+
print("Sample values for gender_col: unavailable (no gender candidate dictionary found)")
|
| 472 |
+
else:
|
| 473 |
+
print("Sample values for gender_col: unavailable")
|
| 474 |
+
|
| 475 |
+
# Step 6: Find Candidate Demographic Features
|
| 476 |
+
import os
|
| 477 |
+
import re
|
| 478 |
+
import pandas as pd
|
| 479 |
+
|
| 480 |
+
# Attempt to locate the Melanoma (SKCM) cohort directory under tcga_root_dir
|
| 481 |
+
def _find_tcga_cohort_with_clinical(root_dir: str, preferred_keywords=None):
|
| 482 |
+
if preferred_keywords is None:
|
| 483 |
+
preferred_keywords = ['skcm', 'melanoma']
|
| 484 |
+
|
| 485 |
+
subdirs = [os.path.join(root_dir, d) for d in os.listdir(root_dir) if os.path.isdir(os.path.join(root_dir, d))]
|
| 486 |
+
|
| 487 |
+
def priority(path):
|
| 488 |
+
name = os.path.basename(path).lower()
|
| 489 |
+
return 0 if any(k in name for k in preferred_keywords) else 1
|
| 490 |
+
|
| 491 |
+
subdirs.sort(key=lambda p: (priority(p), os.path.basename(p).lower()))
|
| 492 |
+
|
| 493 |
+
for cohort_dir in subdirs:
|
| 494 |
+
try:
|
| 495 |
+
clinical_fp, genetic_fp = tcga_get_relevant_filepaths(cohort_dir)
|
| 496 |
+
if os.path.exists(clinical_fp):
|
| 497 |
+
return cohort_dir, clinical_fp
|
| 498 |
+
except Exception:
|
| 499 |
+
continue
|
| 500 |
+
return None, None
|
| 501 |
+
|
| 502 |
+
cohort_dir, clinical_fp = _find_tcga_cohort_with_clinical(tcga_root_dir)
|
| 503 |
+
|
| 504 |
+
clinical_df = None
|
| 505 |
+
if clinical_fp and os.path.exists(clinical_fp):
|
| 506 |
+
try:
|
| 507 |
+
clinical_df = pd.read_csv(clinical_fp, sep='\t', index_col=0, dtype=str, low_memory=False)
|
| 508 |
+
except Exception:
|
| 509 |
+
clinical_df = None
|
| 510 |
+
|
| 511 |
+
candidate_age_cols = []
|
| 512 |
+
candidate_gender_cols = []
|
| 513 |
+
|
| 514 |
+
if clinical_df is not None:
|
| 515 |
+
cols = list(clinical_df.columns)
|
| 516 |
+
|
| 517 |
+
def is_age_col(name: str) -> bool:
|
| 518 |
+
n = str(name).lower()
|
| 519 |
+
# Avoid capturing 'stage'
|
| 520 |
+
if 'stage' in n:
|
| 521 |
+
# Allow explicit age patterns even if 'stage' appears (rare)
|
| 522 |
+
pass
|
| 523 |
+
patterns = [
|
| 524 |
+
r'\bage\b',
|
| 525 |
+
r'\bage[_\s]*at\b',
|
| 526 |
+
r'\bage[\s_]*at[\s_]*diagnosis\b',
|
| 527 |
+
r'\bage[\s_]*at[\s_]*initial[\s_]*pathologic[\s_]*diagnosis\b',
|
| 528 |
+
r'\bage[_\s]*in[_\s]*years\b',
|
| 529 |
+
r'\bdays[\s_]*to[\s_]*birth\b',
|
| 530 |
+
r'\byear[\s_]*of[\s_]*birth\b'
|
| 531 |
+
]
|
| 532 |
+
return any(re.search(p, n) for p in patterns)
|
| 533 |
+
|
| 534 |
+
def is_gender_col(name: str) -> bool:
|
| 535 |
+
n = str(name).lower()
|
| 536 |
+
return bool(re.search(r'(^|[^a-z])(sex|gender)($|[^a-z])', n))
|
| 537 |
+
|
| 538 |
+
for c in cols:
|
| 539 |
+
try:
|
| 540 |
+
if is_age_col(c):
|
| 541 |
+
candidate_age_cols.append(c)
|
| 542 |
+
if is_gender_col(c):
|
| 543 |
+
candidate_gender_cols.append(c)
|
| 544 |
+
except Exception:
|
| 545 |
+
continue
|
| 546 |
+
|
| 547 |
+
# Deduplicate while preserving order
|
| 548 |
+
candidate_age_cols = list(dict.fromkeys(candidate_age_cols))
|
| 549 |
+
candidate_gender_cols = list(dict.fromkeys(candidate_gender_cols))
|
| 550 |
+
|
| 551 |
+
# 1) Print candidate columns in the required format
|
| 552 |
+
print(f"candidate_age_cols = {candidate_age_cols}")
|
| 553 |
+
print(f"candidate_gender_cols = {candidate_gender_cols}")
|
| 554 |
+
|
| 555 |
+
# 2) Extract and preview candidate columns, if applicable
|
| 556 |
+
if clinical_df is not None and candidate_age_cols:
|
| 557 |
+
age_preview = preview_df(clinical_df[candidate_age_cols], n=5)
|
| 558 |
+
print(age_preview)
|
| 559 |
+
|
| 560 |
+
if clinical_df is not None and candidate_gender_cols:
|
| 561 |
+
gender_preview = preview_df(clinical_df[candidate_gender_cols], n=5)
|
| 562 |
+
print(gender_preview)
|
| 563 |
+
|
| 564 |
+
# Step 7: Select Demographic Features
|
| 565 |
+
# Select best columns for age and gender based on candidate lists and typical TCGA conventions
|
| 566 |
+
|
| 567 |
+
age_col = None
|
| 568 |
+
gender_col = None
|
| 569 |
+
|
| 570 |
+
# Prefer explicit age in years when available; fall back to days_to_birth if necessary
|
| 571 |
+
if 'candidate_age_cols' in globals() and isinstance(candidate_age_cols, list):
|
| 572 |
+
if 'age_at_initial_pathologic_diagnosis' in candidate_age_cols:
|
| 573 |
+
age_col = 'age_at_initial_pathologic_diagnosis'
|
| 574 |
+
elif 'age_at_diagnosis' in candidate_age_cols:
|
| 575 |
+
age_col = 'age_at_diagnosis'
|
| 576 |
+
elif 'age' in candidate_age_cols:
|
| 577 |
+
age_col = 'age'
|
| 578 |
+
elif 'days_to_birth' in candidate_age_cols:
|
| 579 |
+
age_col = 'days_to_birth'
|
| 580 |
+
else:
|
| 581 |
+
age_col = None
|
| 582 |
+
|
| 583 |
+
# Gender selection: TCGA typically uses 'gender'
|
| 584 |
+
if 'candidate_gender_cols' in globals() and isinstance(candidate_gender_cols, list):
|
| 585 |
+
if 'gender' in candidate_gender_cols:
|
| 586 |
+
gender_col = 'gender'
|
| 587 |
+
elif len(candidate_gender_cols) > 0:
|
| 588 |
+
gender_col = candidate_gender_cols[0]
|
| 589 |
+
else:
|
| 590 |
+
gender_col = None
|
| 591 |
+
|
| 592 |
+
# Print chosen columns and preview first 5 values when possible
|
| 593 |
+
print(f"Selected age_col: {age_col}")
|
| 594 |
+
if age_col is not None and 'clinical_df' in globals() and age_col in clinical_df.columns:
|
| 595 |
+
try:
|
| 596 |
+
print(f"First 5 values in {age_col}: {clinical_df[age_col].head(5).astype(str).tolist()}")
|
| 597 |
+
except Exception:
|
| 598 |
+
pass
|
| 599 |
+
|
| 600 |
+
print(f"Selected gender_col: {gender_col}")
|
| 601 |
+
if gender_col is not None and 'clinical_df' in globals() and gender_col in clinical_df.columns:
|
| 602 |
+
try:
|
| 603 |
+
print(f"First 5 values in {gender_col}: {clinical_df[gender_col].head(5).astype(str).tolist()}")
|
| 604 |
+
except Exception:
|
| 605 |
+
pass
|
| 606 |
+
|
| 607 |
+
# Step 8: Feature Engineering and Validation
|
| 608 |
+
import os
|
| 609 |
+
import pandas as pd
|
| 610 |
+
|
| 611 |
+
# 1) Extract and standardize clinical features (trait, optional age, gender)
|
| 612 |
+
selected_clinical_df = tcga_select_clinical_features(
|
| 613 |
+
clinical_df=clinical_df,
|
| 614 |
+
trait=trait,
|
| 615 |
+
age_col=age_col if 'age_col' in globals() else None,
|
| 616 |
+
gender_col=gender_col if 'gender_col' in globals() else None
|
| 617 |
+
)
|
| 618 |
+
|
| 619 |
+
# Optional: save selected clinical features for transparency/reuse
|
| 620 |
+
try:
|
| 621 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 622 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 623 |
+
except Exception:
|
| 624 |
+
pass # Non-critical
|
| 625 |
+
|
| 626 |
+
# 2) Normalize gene symbols and save normalized gene expression
|
| 627 |
+
genetic_numeric = genetic_df.apply(pd.to_numeric, errors='coerce')
|
| 628 |
+
gene_df_norm = normalize_gene_symbols_in_index(genetic_numeric)
|
| 629 |
+
|
| 630 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 631 |
+
gene_df_norm.to_csv(out_gene_data_file)
|
| 632 |
+
|
| 633 |
+
# 3) Link clinical and genetic data on sample IDs
|
| 634 |
+
common_samples = selected_clinical_df.index.intersection(gene_df_norm.columns)
|
| 635 |
+
if len(common_samples) > 0:
|
| 636 |
+
linked_data = pd.concat(
|
| 637 |
+
[selected_clinical_df.loc[common_samples], gene_df_norm.loc[:, common_samples].T],
|
| 638 |
+
axis=1
|
| 639 |
+
)
|
| 640 |
+
else:
|
| 641 |
+
# Create an empty linked DataFrame with the expected covariate columns to keep downstream code robust
|
| 642 |
+
linked_data = selected_clinical_df.loc[[]]
|
| 643 |
+
|
| 644 |
+
# 4) Handle missing values systematically
|
| 645 |
+
processed_df = handle_missing_values(linked_data.copy(), trait_col=trait)
|
| 646 |
+
|
| 647 |
+
# 5) Determine bias and remove biased demographic features if needed (guard for empty data)
|
| 648 |
+
if len(processed_df) == 0 or processed_df[trait].dropna().empty:
|
| 649 |
+
trait_biased = True
|
| 650 |
+
else:
|
| 651 |
+
trait_biased, processed_df = judge_and_remove_biased_features(processed_df, trait)
|
| 652 |
+
trait_biased = bool(trait_biased)
|
| 653 |
+
|
| 654 |
+
# 6) Final quality validation and save cohort info
|
| 655 |
+
# Availability flags are assessed on the linked samples
|
| 656 |
+
is_gene_available = bool((gene_df_norm.shape[0] > 0) and (len(common_samples) > 0))
|
| 657 |
+
is_trait_available = bool(selected_clinical_df.loc[common_samples, trait].notna().sum() > 0)
|
| 658 |
+
|
| 659 |
+
note_parts = [
|
| 660 |
+
"INFO: Cohort TCGA SKCM used. Trait encoded from TCGA barcodes (1=tumor 01-09; 0=normal 10-19).",
|
| 661 |
+
f"Age source: {age_col if 'age_col' in globals() and age_col else 'N/A'}.",
|
| 662 |
+
f"Gender source: {gender_col if 'gender_col' in globals() and gender_col else 'N/A'}.",
|
| 663 |
+
f"Linked samples: {len(common_samples)}.",
|
| 664 |
+
"Gene symbols normalized using NCBI synonym mapping; samples linked by exact barcode intersection."
|
| 665 |
+
]
|
| 666 |
+
if len(common_samples) == 0:
|
| 667 |
+
note_parts.append("WARNING: No overlapping samples between clinical and expression data after alignment.")
|
| 668 |
+
note = " ".join(note_parts)
|
| 669 |
+
|
| 670 |
+
is_usable = validate_and_save_cohort_info(
|
| 671 |
+
is_final=True,
|
| 672 |
+
cohort="TCGA",
|
| 673 |
+
info_path=json_path,
|
| 674 |
+
is_gene_available=bool(is_gene_available),
|
| 675 |
+
is_trait_available=bool(is_trait_available),
|
| 676 |
+
is_biased=bool(trait_biased),
|
| 677 |
+
df=processed_df,
|
| 678 |
+
note=note
|
| 679 |
+
)
|
| 680 |
+
|
| 681 |
+
# 7) Save linked data if usable
|
| 682 |
+
if is_usable:
|
| 683 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 684 |
+
processed_df.to_csv(out_data_file)
|
output/preprocess/Melanoma/cohort_info.json
CHANGED
|
@@ -1,92 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"GSE261347": {
|
| 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": 33
|
| 11 |
-
},
|
| 12 |
-
"GSE244984": {
|
| 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": 33
|
| 21 |
-
},
|
| 22 |
-
"GSE215868": {
|
| 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": true,
|
| 29 |
-
"has_gender": false,
|
| 30 |
-
"sample_size": 86
|
| 31 |
-
},
|
| 32 |
-
"GSE202806": {
|
| 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": 52
|
| 41 |
-
},
|
| 42 |
-
"GSE200904": {
|
| 43 |
-
"is_usable": false,
|
| 44 |
-
"is_gene_available": false,
|
| 45 |
-
"is_trait_available": false,
|
| 46 |
-
"is_available": false,
|
| 47 |
-
"is_biased": null,
|
| 48 |
-
"has_age": null,
|
| 49 |
-
"has_gender": null,
|
| 50 |
-
"sample_size": null
|
| 51 |
-
},
|
| 52 |
-
"GSE148949": {
|
| 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 |
-
"GSE148319": {
|
| 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": 83
|
| 71 |
-
},
|
| 72 |
-
"GSE144296": {
|
| 73 |
-
"is_usable": false,
|
| 74 |
-
"is_gene_available": false,
|
| 75 |
-
"is_trait_available": false,
|
| 76 |
-
"is_available": false,
|
| 77 |
-
"is_biased": null,
|
| 78 |
-
"has_age": null,
|
| 79 |
-
"has_gender": null,
|
| 80 |
-
"sample_size": null
|
| 81 |
-
},
|
| 82 |
-
"TCGA": {
|
| 83 |
-
"is_usable": false,
|
| 84 |
-
"is_gene_available": true,
|
| 85 |
-
"is_trait_available": true,
|
| 86 |
-
"is_available": true,
|
| 87 |
-
"is_biased": true,
|
| 88 |
-
"has_age": true,
|
| 89 |
-
"has_gender": true,
|
| 90 |
-
"sample_size": 474
|
| 91 |
-
}
|
| 92 |
-
}
|
|
|
|
| 1 |
+
{"GSE261347": {"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}, "GSE244984": {"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}, "GSE215868": {"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 not available or constant for this cohort; only gene data saved."}, "GSE202806": {"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 not available (constant across samples); clinical-genetic linking skipped."}, "GSE200904": {"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}, "GSE189631": {"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}, "GSE157738": {"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}, "GSE148949": {"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: No clinical trait data available; skipped linking. Saved normalized gene expression only."}, "GSE148319": {"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": 83, "note": "INFO: Trait inferred from cell line type; no Age/Gender available."}, "GSE146264": {"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": false, "is_gene_available": true, "is_trait_available": true, "is_available": true, "is_biased": true, "has_age": true, "has_gender": true, "sample_size": 474, "note": "INFO: Cohort TCGA SKCM used. Trait encoded from TCGA barcodes (1=tumor 01-09; 0=normal 10-19). Age source: age_at_initial_pathologic_diagnosis. Gender source: gender. Linked samples: 474. Gene symbols normalized using NCBI synonym mapping; samples linked by exact barcode intersection."}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Mesothelioma/GSE117668.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
output/preprocess/Mesothelioma/clinical_data/GSE107754.csv
CHANGED
|
@@ -1,85 +1,3 @@
|
|
| 1 |
-
,
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
GSM2878072,1
|
| 5 |
-
GSM2878073,1
|
| 6 |
-
GSM2878074,1
|
| 7 |
-
GSM2878075,1
|
| 8 |
-
GSM2878076,1
|
| 9 |
-
GSM2878077,1
|
| 10 |
-
GSM2878078,1
|
| 11 |
-
GSM2878079,1
|
| 12 |
-
GSM2878080,1
|
| 13 |
-
GSM2878081,1
|
| 14 |
-
GSM2878082,1
|
| 15 |
-
GSM2891194,1
|
| 16 |
-
GSM2891195,1
|
| 17 |
-
GSM2891196,1
|
| 18 |
-
GSM2891197,1
|
| 19 |
-
GSM2891198,1
|
| 20 |
-
GSM2891199,1
|
| 21 |
-
GSM2891200,1
|
| 22 |
-
GSM2891201,1
|
| 23 |
-
GSM2891202,1
|
| 24 |
-
GSM2891203,1
|
| 25 |
-
GSM2891204,1
|
| 26 |
-
GSM2891205,1
|
| 27 |
-
GSM2891206,1
|
| 28 |
-
GSM2891207,1
|
| 29 |
-
GSM2891208,1
|
| 30 |
-
GSM2891209,1
|
| 31 |
-
GSM2891210,1
|
| 32 |
-
GSM2891211,1
|
| 33 |
-
GSM2891212,1
|
| 34 |
-
GSM2891213,1
|
| 35 |
-
GSM2891214,1
|
| 36 |
-
GSM2891215,1
|
| 37 |
-
GSM2891216,1
|
| 38 |
-
GSM2891217,1
|
| 39 |
-
GSM2891218,1
|
| 40 |
-
GSM2891219,1
|
| 41 |
-
GSM2891220,1
|
| 42 |
-
GSM2891221,1
|
| 43 |
-
GSM2891222,1
|
| 44 |
-
GSM2891223,1
|
| 45 |
-
GSM2891224,1
|
| 46 |
-
GSM2891225,1
|
| 47 |
-
GSM2891226,1
|
| 48 |
-
GSM2891227,1
|
| 49 |
-
GSM2891228,1
|
| 50 |
-
GSM2891229,1
|
| 51 |
-
GSM2891230,1
|
| 52 |
-
GSM2891231,1
|
| 53 |
-
GSM2891232,1
|
| 54 |
-
GSM2891233,1
|
| 55 |
-
GSM2891234,1
|
| 56 |
-
GSM2891235,1
|
| 57 |
-
GSM2891236,1
|
| 58 |
-
GSM2891237,1
|
| 59 |
-
GSM2891238,1
|
| 60 |
-
GSM2891239,1
|
| 61 |
-
GSM2891240,1
|
| 62 |
-
GSM2891241,1
|
| 63 |
-
GSM2891242,1
|
| 64 |
-
GSM2891243,1
|
| 65 |
-
GSM2891244,1
|
| 66 |
-
GSM2891245,1
|
| 67 |
-
GSM2891246,1
|
| 68 |
-
GSM2891247,1
|
| 69 |
-
GSM2891248,1
|
| 70 |
-
GSM2891249,1
|
| 71 |
-
GSM2891250,1
|
| 72 |
-
GSM2891251,1
|
| 73 |
-
GSM2891252,1
|
| 74 |
-
GSM2891253,1
|
| 75 |
-
GSM2891254,1
|
| 76 |
-
GSM2891255,1
|
| 77 |
-
GSM2891256,1
|
| 78 |
-
GSM2891257,1
|
| 79 |
-
GSM2891258,1
|
| 80 |
-
GSM2891259,1
|
| 81 |
-
GSM2891260,1
|
| 82 |
-
GSM2891261,1
|
| 83 |
-
GSM2891262,1
|
| 84 |
-
GSM2891263,1
|
| 85 |
-
GSM2891264,1
|
|
|
|
| 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 |
+
Mesothelioma,,,,,,,,,,,,,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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
|
| 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,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
| 18 |
-
GSM3058906,1
|
| 19 |
-
GSM3058907,1
|
| 20 |
-
GSM3058908,1
|
| 21 |
-
GSM3058909,1
|
| 22 |
-
GSM3058910,1
|
| 23 |
-
GSM3058911,1
|
| 24 |
-
GSM3058912,1
|
| 25 |
-
GSM3058913,1
|
| 26 |
-
GSM3058914,1
|
| 27 |
-
GSM3058915,1
|
| 28 |
-
GSM3058916,1
|
| 29 |
-
GSM3058917,1
|
| 30 |
-
GSM3058918,1
|
| 31 |
-
GSM3058919,1
|
| 32 |
-
GSM3058920,1
|
| 33 |
-
GSM3058921,1
|
| 34 |
-
GSM3058922,1
|
| 35 |
-
GSM3058923,1
|
| 36 |
-
GSM3058924,1
|
| 37 |
-
GSM3058925,1
|
| 38 |
-
GSM3058926,1
|
| 39 |
-
GSM3058927,1
|
| 40 |
-
GSM3058928,1
|
| 41 |
-
GSM3058929,1
|
| 42 |
-
GSM3058930,1
|
| 43 |
-
GSM3058931,1
|
| 44 |
-
GSM3058932,1
|
| 45 |
-
GSM3058933,1
|
| 46 |
-
GSM3058934,1
|
| 47 |
-
GSM3058935,1
|
| 48 |
-
GSM3058936,1
|
| 49 |
-
GSM3058937,1
|
| 50 |
-
GSM3058938,1
|
| 51 |
-
GSM3058939,1
|
|
|
|
| 1 |
+
,GSM3058890,GSM3058891,GSM3058892,GSM3058893,GSM3058894,GSM3058895,GSM3058896,GSM3058897,GSM3058898,GSM3058899,GSM3058900,GSM3058901,GSM3058902,GSM3058903,GSM3058904,GSM3058905,GSM3058906,GSM3058907,GSM3058908,GSM3058909,GSM3058910,GSM3058911,GSM3058912,GSM3058913,GSM3058914,GSM3058915,GSM3058916,GSM3058917,GSM3058918,GSM3058919,GSM3058920,GSM3058921,GSM3058922,GSM3058923,GSM3058924,GSM3058925,GSM3058926,GSM3058927,GSM3058928,GSM3058929,GSM3058930,GSM3058931,GSM3058932,GSM3058933,GSM3058934,GSM3058935,GSM3058936,GSM3058937,GSM3058938,GSM3058939
|
| 2 |
+
Mesothelioma,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Mesothelioma/clinical_data/GSE117668.csv
CHANGED
|
@@ -1,49 +1,2 @@
|
|
| 1 |
-
,
|
| 2 |
-
|
| 3 |
-
GSM3305862,1
|
| 4 |
-
GSM3305863,1
|
| 5 |
-
GSM3305864,1
|
| 6 |
-
GSM3305865,1
|
| 7 |
-
GSM3305866,1
|
| 8 |
-
GSM3305867,1
|
| 9 |
-
GSM3305868,1
|
| 10 |
-
GSM3305869,1
|
| 11 |
-
GSM3305870,1
|
| 12 |
-
GSM3305871,1
|
| 13 |
-
GSM3305872,1
|
| 14 |
-
GSM3305873,1
|
| 15 |
-
GSM3305874,1
|
| 16 |
-
GSM3305875,1
|
| 17 |
-
GSM3305876,1
|
| 18 |
-
GSM3305877,1
|
| 19 |
-
GSM3305878,1
|
| 20 |
-
GSM3305879,1
|
| 21 |
-
GSM3305880,1
|
| 22 |
-
GSM3305881,1
|
| 23 |
-
GSM3305882,1
|
| 24 |
-
GSM3305883,1
|
| 25 |
-
GSM3305884,1
|
| 26 |
-
GSM3305885,1
|
| 27 |
-
GSM3305886,1
|
| 28 |
-
GSM3305887,1
|
| 29 |
-
GSM3305888,1
|
| 30 |
-
GSM3305889,1
|
| 31 |
-
GSM3305890,1
|
| 32 |
-
GSM3305891,1
|
| 33 |
-
GSM3305892,1
|
| 34 |
-
GSM3305893,1
|
| 35 |
-
GSM3305894,1
|
| 36 |
-
GSM3305895,1
|
| 37 |
-
GSM3305896,1
|
| 38 |
-
GSM3305897,1
|
| 39 |
-
GSM3305898,1
|
| 40 |
-
GSM3305899,1
|
| 41 |
-
GSM3305900,1
|
| 42 |
-
GSM3305901,1
|
| 43 |
-
GSM3305902,1
|
| 44 |
-
GSM3305903,1
|
| 45 |
-
GSM3305904,1
|
| 46 |
-
GSM3305905,1
|
| 47 |
-
GSM3305906,1
|
| 48 |
-
GSM3305907,1
|
| 49 |
-
GSM3305908,1
|
|
|
|
| 1 |
+
,GSM3305861,GSM3305862,GSM3305863,GSM3305864,GSM3305865,GSM3305866,GSM3305867,GSM3305868,GSM3305869,GSM3305870,GSM3305871,GSM3305872,GSM3305873,GSM3305874,GSM3305875,GSM3305876,GSM3305877,GSM3305878,GSM3305879,GSM3305880,GSM3305881,GSM3305882,GSM3305883,GSM3305884,GSM3305885,GSM3305886,GSM3305887,GSM3305888,GSM3305889,GSM3305890,GSM3305891,GSM3305892,GSM3305893,GSM3305894,GSM3305895,GSM3305896,GSM3305897,GSM3305898,GSM3305899,GSM3305900,GSM3305901,GSM3305902,GSM3305903,GSM3305904,GSM3305905,GSM3305906,GSM3305907,GSM3305908
|
| 2 |
+
Mesothelioma,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Mesothelioma/clinical_data/GSE131027.csv
CHANGED
|
@@ -1,93 +1,2 @@
|
|
| 1 |
-
,
|
| 2 |
-
|
| 3 |
-
GSM3759993,1
|
| 4 |
-
GSM3759994,1
|
| 5 |
-
GSM3759995,1
|
| 6 |
-
GSM3759996,1
|
| 7 |
-
GSM3759997,1
|
| 8 |
-
GSM3759998,1
|
| 9 |
-
GSM3759999,1
|
| 10 |
-
GSM3760000,1
|
| 11 |
-
GSM3760001,1
|
| 12 |
-
GSM3760002,1
|
| 13 |
-
GSM3760003,1
|
| 14 |
-
GSM3760004,1
|
| 15 |
-
GSM3760005,1
|
| 16 |
-
GSM3760006,1
|
| 17 |
-
GSM3760007,1
|
| 18 |
-
GSM3760008,1
|
| 19 |
-
GSM3760009,1
|
| 20 |
-
GSM3760010,1
|
| 21 |
-
GSM3760011,1
|
| 22 |
-
GSM3760012,1
|
| 23 |
-
GSM3760013,1
|
| 24 |
-
GSM3760014,1
|
| 25 |
-
GSM3760015,1
|
| 26 |
-
GSM3760016,1
|
| 27 |
-
GSM3760017,1
|
| 28 |
-
GSM3760018,1
|
| 29 |
-
GSM3760019,1
|
| 30 |
-
GSM3760020,1
|
| 31 |
-
GSM3760021,1
|
| 32 |
-
GSM3760022,1
|
| 33 |
-
GSM3760023,1
|
| 34 |
-
GSM3760024,1
|
| 35 |
-
GSM3760025,1
|
| 36 |
-
GSM3760026,1
|
| 37 |
-
GSM3760027,1
|
| 38 |
-
GSM3760028,1
|
| 39 |
-
GSM3760029,1
|
| 40 |
-
GSM3760030,1
|
| 41 |
-
GSM3760031,1
|
| 42 |
-
GSM3760032,1
|
| 43 |
-
GSM3760033,1
|
| 44 |
-
GSM3760034,1
|
| 45 |
-
GSM3760035,1
|
| 46 |
-
GSM3760036,1
|
| 47 |
-
GSM3760037,1
|
| 48 |
-
GSM3760038,1
|
| 49 |
-
GSM3760039,1
|
| 50 |
-
GSM3760040,1
|
| 51 |
-
GSM3760041,1
|
| 52 |
-
GSM3760042,1
|
| 53 |
-
GSM3760043,1
|
| 54 |
-
GSM3760044,1
|
| 55 |
-
GSM3760045,1
|
| 56 |
-
GSM3760046,1
|
| 57 |
-
GSM3760047,1
|
| 58 |
-
GSM3760048,1
|
| 59 |
-
GSM3760049,1
|
| 60 |
-
GSM3760050,1
|
| 61 |
-
GSM3760051,1
|
| 62 |
-
GSM3760052,1
|
| 63 |
-
GSM3760053,1
|
| 64 |
-
GSM3760054,1
|
| 65 |
-
GSM3760055,1
|
| 66 |
-
GSM3760056,1
|
| 67 |
-
GSM3760057,1
|
| 68 |
-
GSM3760058,1
|
| 69 |
-
GSM3760059,1
|
| 70 |
-
GSM3760060,1
|
| 71 |
-
GSM3760061,1
|
| 72 |
-
GSM3760062,1
|
| 73 |
-
GSM3760063,1
|
| 74 |
-
GSM3760064,1
|
| 75 |
-
GSM3760065,1
|
| 76 |
-
GSM3760066,1
|
| 77 |
-
GSM3760067,1
|
| 78 |
-
GSM3760068,1
|
| 79 |
-
GSM3760069,1
|
| 80 |
-
GSM3760070,1
|
| 81 |
-
GSM3760071,1
|
| 82 |
-
GSM3760072,1
|
| 83 |
-
GSM3760073,1
|
| 84 |
-
GSM3760074,1
|
| 85 |
-
GSM3760075,1
|
| 86 |
-
GSM3760076,1
|
| 87 |
-
GSM3760077,1
|
| 88 |
-
GSM3760078,1
|
| 89 |
-
GSM3760079,1
|
| 90 |
-
GSM3760080,1
|
| 91 |
-
GSM3760081,1
|
| 92 |
-
GSM3760082,1
|
| 93 |
-
GSM3760083,1
|
|
|
|
| 1 |
+
,GSM3759992,GSM3759993,GSM3759994,GSM3759995,GSM3759996,GSM3759997,GSM3759998,GSM3759999,GSM3760000,GSM3760001,GSM3760002,GSM3760003,GSM3760004,GSM3760005,GSM3760006,GSM3760007,GSM3760008,GSM3760009,GSM3760010,GSM3760011,GSM3760012,GSM3760013,GSM3760014,GSM3760015,GSM3760016,GSM3760017,GSM3760018,GSM3760019,GSM3760020,GSM3760021,GSM3760022,GSM3760023,GSM3760024,GSM3760025,GSM3760026,GSM3760027,GSM3760028,GSM3760029,GSM3760030,GSM3760031,GSM3760032,GSM3760033,GSM3760034,GSM3760035,GSM3760036,GSM3760037,GSM3760038,GSM3760039,GSM3760040,GSM3760041,GSM3760042,GSM3760043,GSM3760044,GSM3760045,GSM3760046,GSM3760047,GSM3760048,GSM3760049,GSM3760050,GSM3760051,GSM3760052,GSM3760053,GSM3760054,GSM3760055,GSM3760056,GSM3760057,GSM3760058,GSM3760059,GSM3760060,GSM3760061,GSM3760062,GSM3760063,GSM3760064,GSM3760065,GSM3760066,GSM3760067,GSM3760068,GSM3760069,GSM3760070,GSM3760071,GSM3760072,GSM3760073,GSM3760074,GSM3760075,GSM3760076,GSM3760077,GSM3760078,GSM3760079,GSM3760080,GSM3760081,GSM3760082,GSM3760083
|
| 2 |
+
Mesothelioma,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,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output/preprocess/Mesothelioma/clinical_data/GSE68950.csv
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
,GSM1687570,GSM1687571,GSM1687572,GSM1687573,GSM1687574,GSM1687575,GSM1687576,GSM1687577,GSM1687578,GSM1687579,GSM1687580,GSM1687581,GSM1687582,GSM1687583,GSM1687584,GSM1687585,GSM1687586,GSM1687587,GSM1687588,GSM1687589,GSM1687590,GSM1687591,GSM1687592,GSM1687593,GSM1687594,GSM1687595,GSM1687596,GSM1687597,GSM1687598,GSM1687599,GSM1687600,GSM1687601,GSM1687602,GSM1687603,GSM1687604,GSM1687605,GSM1687606,GSM1687607,GSM1687608,GSM1687609,GSM1687610,GSM1687611,GSM1687612,GSM1687613,GSM1687614,GSM1687615,GSM1687616,GSM1687617,GSM1687618,GSM1687619,GSM1687620,GSM1687621,GSM1687622,GSM1687623,GSM1687624,GSM1687625,GSM1687626,GSM1687627,GSM1687628,GSM1687629,GSM1687630,GSM1687631,GSM1687632,GSM1687633,GSM1687634,GSM1687635,GSM1687636,GSM1687637,GSM1687638,GSM1687639,GSM1687640,GSM1687641,GSM1687642,GSM1687643,GSM1687644,GSM1687645,GSM1687646,GSM1687647,GSM1687648,GSM1687649,GSM1687650,GSM1687651,GSM1687652,GSM1687653,GSM1687654,GSM1687655,GSM1687656,GSM1687657,GSM1687658,GSM1687659,GSM1687660,GSM1687661,GSM1687662,GSM1687663,GSM1687664,GSM1687665,GSM1687666,GSM1687667,GSM1687668,GSM1687669,GSM1687670,GSM1687671,GSM1687672,GSM1687673,GSM1687674,GSM1687675,GSM1687676,GSM1687677,GSM1687678,GSM1687679,GSM1687680,GSM1687681,GSM1687682,GSM1687683,GSM1687684,GSM1687685,GSM1687686,GSM1687687,GSM1687688,GSM1687689,GSM1687690,GSM1687691,GSM1687692,GSM1687693,GSM1687694,GSM1687695,GSM1687696,GSM1687697,GSM1687698,GSM1687699,GSM1687700,GSM1687701,GSM1687702,GSM1687703,GSM1687704,GSM1687705,GSM1687706,GSM1687707,GSM1687708,GSM1687709,GSM1687710,GSM1687711,GSM1687712,GSM1687713,GSM1687714,GSM1687715,GSM1687716,GSM1687717,GSM1687718,GSM1687719,GSM1687720,GSM1687721,GSM1687722,GSM1687723,GSM1687724,GSM1687725,GSM1687726,GSM1687727,GSM1687728,GSM1687729,GSM1687730,GSM1687731,GSM1687732,GSM1687733,GSM1687734,GSM1687735,GSM1687736,GSM1687737,GSM1687738,GSM1687739,GSM1687740,GSM1687741,GSM1687742,GSM1687743,GSM1687744,GSM1687745,GSM1687746,GSM1687747,GSM1687748,GSM1687749,GSM1687750,GSM1687751,GSM1687752,GSM1687753,GSM1687754,GSM1687755,GSM1687756,GSM1687757,GSM1687758,GSM1687759,GSM1687760,GSM1687761,GSM1687762,GSM1687763,GSM1687764,GSM1687765,GSM1687766,GSM1687767,GSM1687768,GSM1687769,GSM1687770,GSM1687771,GSM1687772,GSM1687773,GSM1687774,GSM1687775,GSM1687776,GSM1687777,GSM1687778,GSM1687779,GSM1687780,GSM1687781,GSM1687782,GSM1687783,GSM1687784,GSM1687785,GSM1687786,GSM1687787,GSM1687788,GSM1687789,GSM1687790,GSM1687791,GSM1687792,GSM1687793,GSM1687794,GSM1687795,GSM1687796,GSM1687797,GSM1687798,GSM1687799,GSM1687800,GSM1687801,GSM1687802,GSM1687803,GSM1687804,GSM1687805,GSM1687806,GSM1687807,GSM1687808,GSM1687809,GSM1687810,GSM1687811,GSM1687812,GSM1687813,GSM1687814,GSM1687815,GSM1687816,GSM1687817,GSM1687818,GSM1687819,GSM1687820,GSM1687821,GSM1687822,GSM1687823,GSM1687824,GSM1687825,GSM1687826,GSM1687827,GSM1687828,GSM1687829,GSM1687830,GSM1687831,GSM1687832,GSM1687833,GSM1687834,GSM1687835,GSM1687836,GSM1687837,GSM1687838,GSM1687839,GSM1687840,GSM1687841,GSM1687842,GSM1687843,GSM1687844,GSM1687845,GSM1687846,GSM1687847,GSM1687848,GSM1687849,GSM1687850,GSM1687851,GSM1687852,GSM1687853,GSM1687854,GSM1687855,GSM1687856,GSM1687857,GSM1687858,GSM1687859,GSM1687860,GSM1687861,GSM1687862,GSM1687863,GSM1687864,GSM1687865,GSM1687866,GSM1687867,GSM1687868,GSM1687869,GSM1687870,GSM1687871,GSM1687872,GSM1687873,GSM1687874,GSM1687875,GSM1687876,GSM1687877,GSM1687878,GSM1687879,GSM1687880,GSM1687881,GSM1687882,GSM1687883,GSM1687884,GSM1687885,GSM1687886,GSM1687887,GSM1687888,GSM1687889,GSM1687890,GSM1687891,GSM1687892,GSM1687893,GSM1687894,GSM1687895,GSM1687896,GSM1687897,GSM1687898,GSM1687899,GSM1687900,GSM1687901,GSM1687902,GSM1687903,GSM1687904,GSM1687905,GSM1687906,GSM1687907,GSM1687908,GSM1687909,GSM1687910,GSM1687911,GSM1687912,GSM1687913,GSM1687914,GSM1687915,GSM1687916,GSM1687917,GSM1687918,GSM1687919,GSM1687920,GSM1687921,GSM1687922,GSM1687923,GSM1687924,GSM1687925,GSM1687926,GSM1687927,GSM1687928,GSM1687929,GSM1687930,GSM1687931,GSM1687932,GSM1687933,GSM1687934,GSM1687935,GSM1687936,GSM1687937,GSM1687938,GSM1687939,GSM1687940,GSM1687941,GSM1687942,GSM1687943,GSM1687944,GSM1687945,GSM1687946,GSM1687947,GSM1687948,GSM1687949,GSM1687950,GSM1687951,GSM1687952,GSM1687953,GSM1687954,GSM1687955,GSM1687956,GSM1687957,GSM1687958,GSM1687959,GSM1687960,GSM1687961,GSM1687962,GSM1687963,GSM1687964,GSM1687965,GSM1687966,GSM1687967,GSM1687968,GSM1687969,GSM1687970,GSM1687971,GSM1687972,GSM1687973,GSM1687974,GSM1687975,GSM1687976,GSM1687977,GSM1687978,GSM1687979,GSM1687980,GSM1687981,GSM1687982,GSM1687983,GSM1687984,GSM1687985,GSM1687986,GSM1687987,GSM1687988,GSM1687989,GSM1687990,GSM1687991,GSM1687992,GSM1687993,GSM1687994,GSM1687995,GSM1687996,GSM1687997,GSM1687998,GSM1687999,GSM1688000,GSM1688001,GSM1688002,GSM1688003,GSM1688004,GSM1688005,GSM1688006,GSM1688007,GSM1688008,GSM1688009,GSM1688010,GSM1688011,GSM1688012,GSM1688013,GSM1688014,GSM1688015,GSM1688016,GSM1688017,GSM1688018,GSM1688019,GSM1688020,GSM1688021,GSM1688022,GSM1688023,GSM1688024,GSM1688025,GSM1688026,GSM1688027,GSM1688028,GSM1688029,GSM1688030,GSM1688031,GSM1688032,GSM1688033,GSM1688034,GSM1688035,GSM1688036,GSM1688037,GSM1688038,GSM1688039,GSM1688040,GSM1688041,GSM1688042,GSM1688043,GSM1688044,GSM1688045,GSM1688046,GSM1688047,GSM1688048,GSM1688049,GSM1688050,GSM1688051,GSM1688052,GSM1688053,GSM1688054,GSM1688055,GSM1688056,GSM1688057,GSM1688058,GSM1688059,GSM1688060,GSM1688061,GSM1688062,GSM1688063,GSM1688064,GSM1688065,GSM1688066,GSM1688067,GSM1688068,GSM1688069,GSM1688070,GSM1688071,GSM1688072,GSM1688073,GSM1688074,GSM1688075,GSM1688076,GSM1688077,GSM1688078,GSM1688079,GSM1688080,GSM1688081,GSM1688082,GSM1688083,GSM1688084,GSM1688085,GSM1688086,GSM1688087,GSM1688088,GSM1688089,GSM1688090,GSM1688091,GSM1688092,GSM1688093,GSM1688094,GSM1688095,GSM1688096,GSM1688097,GSM1688098,GSM1688099,GSM1688100,GSM1688101,GSM1688102,GSM1688103,GSM1688104,GSM1688105,GSM1688106,GSM1688107,GSM1688108,GSM1688109,GSM1688110,GSM1688111,GSM1688112,GSM1688113,GSM1688114,GSM1688115,GSM1688116,GSM1688117,GSM1688118,GSM1688119,GSM1688120,GSM1688121,GSM1688122,GSM1688123,GSM1688124,GSM1688125,GSM1688126,GSM1688127,GSM1688128,GSM1688129,GSM1688130,GSM1688131,GSM1688132,GSM1688133,GSM1688134,GSM1688135,GSM1688136,GSM1688137,GSM1688138,GSM1688139,GSM1688140,GSM1688141,GSM1688142,GSM1688143,GSM1688144,GSM1688145,GSM1688146,GSM1688147,GSM1688148,GSM1688149,GSM1688150,GSM1688151,GSM1688152,GSM1688153,GSM1688154,GSM1688155,GSM1688156,GSM1688157,GSM1688158,GSM1688159,GSM1688160,GSM1688161,GSM1688162,GSM1688163,GSM1688164,GSM1688165,GSM1688166,GSM1688167,GSM1688168,GSM1688169,GSM1688170,GSM1688171,GSM1688172,GSM1688173,GSM1688174,GSM1688175,GSM1688176,GSM1688177,GSM1688178,GSM1688179,GSM1688180,GSM1688181,GSM1688182,GSM1688183,GSM1688184,GSM1688185,GSM1688186,GSM1688187,GSM1688188,GSM1688189,GSM1688190,GSM1688191,GSM1688192,GSM1688193,GSM1688194,GSM1688195,GSM1688196,GSM1688197,GSM1688198,GSM1688199,GSM1688200,GSM1688201,GSM1688202,GSM1688203,GSM1688204,GSM1688205,GSM1688206,GSM1688207,GSM1688208,GSM1688209,GSM1688210,GSM1688211,GSM1688212,GSM1688213,GSM1688214,GSM1688215,GSM1688216,GSM1688217,GSM1688218,GSM1688219,GSM1688220,GSM1688221,GSM1688222,GSM1688223,GSM1688224,GSM1688225,GSM1688226,GSM1688227,GSM1688228,GSM1688229,GSM1688230,GSM1688231,GSM1688232,GSM1688233,GSM1688234,GSM1688235,GSM1688236,GSM1688237,GSM1688238,GSM1688239,GSM1688240,GSM1688241,GSM1688242,GSM1688243,GSM1688244,GSM1688245,GSM1688246,GSM1688247,GSM1688248,GSM1688249,GSM1688250,GSM1688251,GSM1688252,GSM1688253,GSM1688254,GSM1688255,GSM1688256,GSM1688257,GSM1688258,GSM1688259,GSM1688260,GSM1688261,GSM1688262,GSM1688263,GSM1688264,GSM1688265,GSM1688266,GSM1688267,GSM1688268,GSM1688269,GSM1688270,GSM1688271,GSM1688272,GSM1688273,GSM1688274,GSM1688275,GSM1688276,GSM1688277,GSM1688278,GSM1688279,GSM1688280,GSM1688281,GSM1688282,GSM1688283,GSM1688284,GSM1688285,GSM1688286,GSM1688287,GSM1688288,GSM1688289,GSM1688290,GSM1688291,GSM1688292,GSM1688293,GSM1688294,GSM1688295,GSM1688296,GSM1688297,GSM1688298,GSM1688299,GSM1688300,GSM1688301,GSM1688302,GSM1688303,GSM1688304,GSM1688305,GSM1688306,GSM1688307,GSM1688308,GSM1688309,GSM1688310,GSM1688311,GSM1688312,GSM1688313,GSM1688314,GSM1688315,GSM1688316,GSM1688317,GSM1688318,GSM1688319,GSM1688320,GSM1688321,GSM1688322,GSM1688323,GSM1688324,GSM1688325,GSM1688326,GSM1688327,GSM1688328,GSM1688329,GSM1688330,GSM1688331,GSM1688332,GSM1688333,GSM1688334,GSM1688335,GSM1688336,GSM1688337,GSM1688338,GSM1688339,GSM1688340,GSM1688341,GSM1688342,GSM1688343,GSM1688344,GSM1688345,GSM1688346,GSM1688347,GSM1688348,GSM1688349,GSM1688350,GSM1688351,GSM1688352,GS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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,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,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,
|
|
|
|
| 1 |
,GSM1687570,GSM1687571,GSM1687572,GSM1687573,GSM1687574,GSM1687575,GSM1687576,GSM1687577,GSM1687578,GSM1687579,GSM1687580,GSM1687581,GSM1687582,GSM1687583,GSM1687584,GSM1687585,GSM1687586,GSM1687587,GSM1687588,GSM1687589,GSM1687590,GSM1687591,GSM1687592,GSM1687593,GSM1687594,GSM1687595,GSM1687596,GSM1687597,GSM1687598,GSM1687599,GSM1687600,GSM1687601,GSM1687602,GSM1687603,GSM1687604,GSM1687605,GSM1687606,GSM1687607,GSM1687608,GSM1687609,GSM1687610,GSM1687611,GSM1687612,GSM1687613,GSM1687614,GSM1687615,GSM1687616,GSM1687617,GSM1687618,GSM1687619,GSM1687620,GSM1687621,GSM1687622,GSM1687623,GSM1687624,GSM1687625,GSM1687626,GSM1687627,GSM1687628,GSM1687629,GSM1687630,GSM1687631,GSM1687632,GSM1687633,GSM1687634,GSM1687635,GSM1687636,GSM1687637,GSM1687638,GSM1687639,GSM1687640,GSM1687641,GSM1687642,GSM1687643,GSM1687644,GSM1687645,GSM1687646,GSM1687647,GSM1687648,GSM1687649,GSM1687650,GSM1687651,GSM1687652,GSM1687653,GSM1687654,GSM1687655,GSM1687656,GSM1687657,GSM1687658,GSM1687659,GSM1687660,GSM1687661,GSM1687662,GSM1687663,GSM1687664,GSM1687665,GSM1687666,GSM1687667,GSM1687668,GSM1687669,GSM1687670,GSM1687671,GSM1687672,GSM1687673,GSM1687674,GSM1687675,GSM1687676,GSM1687677,GSM1687678,GSM1687679,GSM1687680,GSM1687681,GSM1687682,GSM1687683,GSM1687684,GSM1687685,GSM1687686,GSM1687687,GSM1687688,GSM1687689,GSM1687690,GSM1687691,GSM1687692,GSM1687693,GSM1687694,GSM1687695,GSM1687696,GSM1687697,GSM1687698,GSM1687699,GSM1687700,GSM1687701,GSM1687702,GSM1687703,GSM1687704,GSM1687705,GSM1687706,GSM1687707,GSM1687708,GSM1687709,GSM1687710,GSM1687711,GSM1687712,GSM1687713,GSM1687714,GSM1687715,GSM1687716,GSM1687717,GSM1687718,GSM1687719,GSM1687720,GSM1687721,GSM1687722,GSM1687723,GSM1687724,GSM1687725,GSM1687726,GSM1687727,GSM1687728,GSM1687729,GSM1687730,GSM1687731,GSM1687732,GSM1687733,GSM1687734,GSM1687735,GSM1687736,GSM1687737,GSM1687738,GSM1687739,GSM1687740,GSM1687741,GSM1687742,GSM1687743,GSM1687744,GSM1687745,GSM1687746,GSM1687747,GSM1687748,GSM1687749,GSM1687750,GSM1687751,GSM1687752,GSM1687753,GSM1687754,GSM1687755,GSM1687756,GSM1687757,GSM1687758,GSM1687759,GSM1687760,GSM1687761,GSM1687762,GSM1687763,GSM1687764,GSM1687765,GSM1687766,GSM1687767,GSM1687768,GSM1687769,GSM1687770,GSM1687771,GSM1687772,GSM1687773,GSM1687774,GSM1687775,GSM1687776,GSM1687777,GSM1687778,GSM1687779,GSM1687780,GSM1687781,GSM1687782,GSM1687783,GSM1687784,GSM1687785,GSM1687786,GSM1687787,GSM1687788,GSM1687789,GSM1687790,GSM1687791,GSM1687792,GSM1687793,GSM1687794,GSM1687795,GSM1687796,GSM1687797,GSM1687798,GSM1687799,GSM1687800,GSM1687801,GSM1687802,GSM1687803,GSM1687804,GSM1687805,GSM1687806,GSM1687807,GSM1687808,GSM1687809,GSM1687810,GSM1687811,GSM1687812,GSM1687813,GSM1687814,GSM1687815,GSM1687816,GSM1687817,GSM1687818,GSM1687819,GSM1687820,GSM1687821,GSM1687822,GSM1687823,GSM1687824,GSM1687825,GSM1687826,GSM1687827,GSM1687828,GSM1687829,GSM1687830,GSM1687831,GSM1687832,GSM1687833,GSM1687834,GSM1687835,GSM1687836,GSM1687837,GSM1687838,GSM1687839,GSM1687840,GSM1687841,GSM1687842,GSM1687843,GSM1687844,GSM1687845,GSM1687846,GSM1687847,GSM1687848,GSM1687849,GSM1687850,GSM1687851,GSM1687852,GSM1687853,GSM1687854,GSM1687855,GSM1687856,GSM1687857,GSM1687858,GSM1687859,GSM1687860,GSM1687861,GSM1687862,GSM1687863,GSM1687864,GSM1687865,GSM1687866,GSM1687867,GSM1687868,GSM1687869,GSM1687870,GSM1687871,GSM1687872,GSM1687873,GSM1687874,GSM1687875,GSM1687876,GSM1687877,GSM1687878,GSM1687879,GSM1687880,GSM1687881,GSM1687882,GSM1687883,GSM1687884,GSM1687885,GSM1687886,GSM1687887,GSM1687888,GSM1687889,GSM1687890,GSM1687891,GSM1687892,GSM1687893,GSM1687894,GSM1687895,GSM1687896,GSM1687897,GSM1687898,GSM1687899,GSM1687900,GSM1687901,GSM1687902,GSM1687903,GSM1687904,GSM1687905,GSM1687906,GSM1687907,GSM1687908,GSM1687909,GSM1687910,GSM1687911,GSM1687912,GSM1687913,GSM1687914,GSM1687915,GSM1687916,GSM1687917,GSM1687918,GSM1687919,GSM1687920,GSM1687921,GSM1687922,GSM1687923,GSM1687924,GSM1687925,GSM1687926,GSM1687927,GSM1687928,GSM1687929,GSM1687930,GSM1687931,GSM1687932,GSM1687933,GSM1687934,GSM1687935,GSM1687936,GSM1687937,GSM1687938,GSM1687939,GSM1687940,GSM1687941,GSM1687942,GSM1687943,GSM1687944,GSM1687945,GSM1687946,GSM1687947,GSM1687948,GSM1687949,GSM1687950,GSM1687951,GSM1687952,GSM1687953,GSM1687954,GSM1687955,GSM1687956,GSM1687957,GSM1687958,GSM1687959,GSM1687960,GSM1687961,GSM1687962,GSM1687963,GSM1687964,GSM1687965,GSM1687966,GSM1687967,GSM1687968,GSM1687969,GSM1687970,GSM1687971,GSM1687972,GSM1687973,GSM1687974,GSM1687975,GSM1687976,GSM1687977,GSM1687978,GSM1687979,GSM1687980,GSM1687981,GSM1687982,GSM1687983,GSM1687984,GSM1687985,GSM1687986,GSM1687987,GSM1687988,GSM1687989,GSM1687990,GSM1687991,GSM1687992,GSM1687993,GSM1687994,GSM1687995,GSM1687996,GSM1687997,GSM1687998,GSM1687999,GSM1688000,GSM1688001,GSM1688002,GSM1688003,GSM1688004,GSM1688005,GSM1688006,GSM1688007,GSM1688008,GSM1688009,GSM1688010,GSM1688011,GSM1688012,GSM1688013,GSM1688014,GSM1688015,GSM1688016,GSM1688017,GSM1688018,GSM1688019,GSM1688020,GSM1688021,GSM1688022,GSM1688023,GSM1688024,GSM1688025,GSM1688026,GSM1688027,GSM1688028,GSM1688029,GSM1688030,GSM1688031,GSM1688032,GSM1688033,GSM1688034,GSM1688035,GSM1688036,GSM1688037,GSM1688038,GSM1688039,GSM1688040,GSM1688041,GSM1688042,GSM1688043,GSM1688044,GSM1688045,GSM1688046,GSM1688047,GSM1688048,GSM1688049,GSM1688050,GSM1688051,GSM1688052,GSM1688053,GSM1688054,GSM1688055,GSM1688056,GSM1688057,GSM1688058,GSM1688059,GSM1688060,GSM1688061,GSM1688062,GSM1688063,GSM1688064,GSM1688065,GSM1688066,GSM1688067,GSM1688068,GSM1688069,GSM1688070,GSM1688071,GSM1688072,GSM1688073,GSM1688074,GSM1688075,GSM1688076,GSM1688077,GSM1688078,GSM1688079,GSM1688080,GSM1688081,GSM1688082,GSM1688083,GSM1688084,GSM1688085,GSM1688086,GSM1688087,GSM1688088,GSM1688089,GSM1688090,GSM1688091,GSM1688092,GSM1688093,GSM1688094,GSM1688095,GSM1688096,GSM1688097,GSM1688098,GSM1688099,GSM1688100,GSM1688101,GSM1688102,GSM1688103,GSM1688104,GSM1688105,GSM1688106,GSM1688107,GSM1688108,GSM1688109,GSM1688110,GSM1688111,GSM1688112,GSM1688113,GSM1688114,GSM1688115,GSM1688116,GSM1688117,GSM1688118,GSM1688119,GSM1688120,GSM1688121,GSM1688122,GSM1688123,GSM1688124,GSM1688125,GSM1688126,GSM1688127,GSM1688128,GSM1688129,GSM1688130,GSM1688131,GSM1688132,GSM1688133,GSM1688134,GSM1688135,GSM1688136,GSM1688137,GSM1688138,GSM1688139,GSM1688140,GSM1688141,GSM1688142,GSM1688143,GSM1688144,GSM1688145,GSM1688146,GSM1688147,GSM1688148,GSM1688149,GSM1688150,GSM1688151,GSM1688152,GSM1688153,GSM1688154,GSM1688155,GSM1688156,GSM1688157,GSM1688158,GSM1688159,GSM1688160,GSM1688161,GSM1688162,GSM1688163,GSM1688164,GSM1688165,GSM1688166,GSM1688167,GSM1688168,GSM1688169,GSM1688170,GSM1688171,GSM1688172,GSM1688173,GSM1688174,GSM1688175,GSM1688176,GSM1688177,GSM1688178,GSM1688179,GSM1688180,GSM1688181,GSM1688182,GSM1688183,GSM1688184,GSM1688185,GSM1688186,GSM1688187,GSM1688188,GSM1688189,GSM1688190,GSM1688191,GSM1688192,GSM1688193,GSM1688194,GSM1688195,GSM1688196,GSM1688197,GSM1688198,GSM1688199,GSM1688200,GSM1688201,GSM1688202,GSM1688203,GSM1688204,GSM1688205,GSM1688206,GSM1688207,GSM1688208,GSM1688209,GSM1688210,GSM1688211,GSM1688212,GSM1688213,GSM1688214,GSM1688215,GSM1688216,GSM1688217,GSM1688218,GSM1688219,GSM1688220,GSM1688221,GSM1688222,GSM1688223,GSM1688224,GSM1688225,GSM1688226,GSM1688227,GSM1688228,GSM1688229,GSM1688230,GSM1688231,GSM1688232,GSM1688233,GSM1688234,GSM1688235,GSM1688236,GSM1688237,GSM1688238,GSM1688239,GSM1688240,GSM1688241,GSM1688242,GSM1688243,GSM1688244,GSM1688245,GSM1688246,GSM1688247,GSM1688248,GSM1688249,GSM1688250,GSM1688251,GSM1688252,GSM1688253,GSM1688254,GSM1688255,GSM1688256,GSM1688257,GSM1688258,GSM1688259,GSM1688260,GSM1688261,GSM1688262,GSM1688263,GSM1688264,GSM1688265,GSM1688266,GSM1688267,GSM1688268,GSM1688269,GSM1688270,GSM1688271,GSM1688272,GSM1688273,GSM1688274,GSM1688275,GSM1688276,GSM1688277,GSM1688278,GSM1688279,GSM1688280,GSM1688281,GSM1688282,GSM1688283,GSM1688284,GSM1688285,GSM1688286,GSM1688287,GSM1688288,GSM1688289,GSM1688290,GSM1688291,GSM1688292,GSM1688293,GSM1688294,GSM1688295,GSM1688296,GSM1688297,GSM1688298,GSM1688299,GSM1688300,GSM1688301,GSM1688302,GSM1688303,GSM1688304,GSM1688305,GSM1688306,GSM1688307,GSM1688308,GSM1688309,GSM1688310,GSM1688311,GSM1688312,GSM1688313,GSM1688314,GSM1688315,GSM1688316,GSM1688317,GSM1688318,GSM1688319,GSM1688320,GSM1688321,GSM1688322,GSM1688323,GSM1688324,GSM1688325,GSM1688326,GSM1688327,GSM1688328,GSM1688329,GSM1688330,GSM1688331,GSM1688332,GSM1688333,GSM1688334,GSM1688335,GSM1688336,GSM1688337,GSM1688338,GSM1688339,GSM1688340,GSM1688341,GSM1688342,GSM1688343,GSM1688344,GSM1688345,GSM1688346,GSM1688347,GSM1688348,GSM1688349,GSM1688350,GSM1688351,GSM1688352,GSM1688353,GSM1688354,GSM1688355,GSM1688356,GSM1688357,GSM1688358,GSM1688359,GSM1688360,GSM1688361,GSM1688362,GSM1688363,GSM1688364,GSM1688365,GSM1688366,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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Mesothelioma"
|
| 6 |
+
cohort = "GSE107754"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Mesothelioma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Mesothelioma/GSE107754"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Mesothelioma/GSE107754.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Mesothelioma/gene_data/GSE107754.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Mesothelioma/clinical_data/GSE107754.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Mesothelioma/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) Determine availability
|
| 42 |
+
is_gene_available = True # Whole human genome microarrays per background info -> gene expression available
|
| 43 |
+
|
| 44 |
+
# 2) Identify rows and define converters
|
| 45 |
+
trait_row = 2 # 'tissue: Malignant Mesothelioma' appears under key 2 among other tissues
|
| 46 |
+
age_row = None # No age-related key found in the provided dictionary
|
| 47 |
+
gender_row = 0 # 'gender: Female', 'gender: Male'
|
| 48 |
+
|
| 49 |
+
def _parse_header_value(x):
|
| 50 |
+
if x is None:
|
| 51 |
+
return None, None
|
| 52 |
+
s = str(x).strip()
|
| 53 |
+
if ':' in s:
|
| 54 |
+
header, val = s.split(':', 1)
|
| 55 |
+
return header.strip().lower(), val.strip()
|
| 56 |
+
return None, s.strip()
|
| 57 |
+
|
| 58 |
+
def convert_trait(x):
|
| 59 |
+
# Binary: 1 for (Malignant) Mesothelioma, 0 for other tissues; ignore non-tissue fields under this row.
|
| 60 |
+
header, val = _parse_header_value(x)
|
| 61 |
+
if header is None or val is None:
|
| 62 |
+
return None
|
| 63 |
+
header_l = header.lower()
|
| 64 |
+
# Consider common headers that denote diagnosis/tissue; exclude biopsy/site metadata
|
| 65 |
+
relevant = any(k in header_l for k in ['tissue', 'histolog', 'tumor', 'cancer type', 'diagnosis', 'disease'])
|
| 66 |
+
if relevant:
|
| 67 |
+
v = val.lower()
|
| 68 |
+
if 'mesothelioma' in v:
|
| 69 |
+
return 1
|
| 70 |
+
return 0
|
| 71 |
+
return None
|
| 72 |
+
|
| 73 |
+
def convert_gender(x):
|
| 74 |
+
header, val = _parse_header_value(x)
|
| 75 |
+
if val is None:
|
| 76 |
+
return None
|
| 77 |
+
v = val.lower()
|
| 78 |
+
if v in ['female', 'f']:
|
| 79 |
+
return 0
|
| 80 |
+
if v in ['male', 'm']:
|
| 81 |
+
return 1
|
| 82 |
+
return None
|
| 83 |
+
|
| 84 |
+
def convert_age(x):
|
| 85 |
+
# Age not available in this dataset snapshot; return None
|
| 86 |
+
return None
|
| 87 |
+
|
| 88 |
+
# 3) Save initial metadata
|
| 89 |
+
is_trait_available = trait_row is not None
|
| 90 |
+
_ = validate_and_save_cohort_info(
|
| 91 |
+
is_final=False,
|
| 92 |
+
cohort=cohort,
|
| 93 |
+
info_path=json_path,
|
| 94 |
+
is_gene_available=is_gene_available,
|
| 95 |
+
is_trait_available=is_trait_available
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
# 4) Clinical feature extraction (only if clinical data available)
|
| 99 |
+
if is_trait_available:
|
| 100 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 101 |
+
clinical_df=clinical_data,
|
| 102 |
+
trait=trait,
|
| 103 |
+
trait_row=trait_row,
|
| 104 |
+
convert_trait=convert_trait,
|
| 105 |
+
age_row=age_row,
|
| 106 |
+
convert_age=convert_age if age_row is not None else None,
|
| 107 |
+
gender_row=gender_row,
|
| 108 |
+
convert_gender=convert_gender if gender_row is not None else None
|
| 109 |
+
)
|
| 110 |
+
print(preview_df(selected_clinical_df))
|
| 111 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 112 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 113 |
+
|
| 114 |
+
# Step 3: Gene Data Extraction
|
| 115 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 116 |
+
gene_data = get_genetic_data(matrix_file)
|
| 117 |
+
|
| 118 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 119 |
+
print(gene_data.index[:20])
|
| 120 |
+
|
| 121 |
+
# Step 4: Gene Identifier Review
|
| 122 |
+
# Detected identifiers like 'A_23_P...' correspond to Agilent probe IDs, not HUGO gene symbols.
|
| 123 |
+
print("requires_gene_mapping = True")
|
| 124 |
+
|
| 125 |
+
# Step 5: Gene Annotation
|
| 126 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 127 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 128 |
+
|
| 129 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 130 |
+
print("Gene annotation preview:")
|
| 131 |
+
print(preview_df(gene_annotation))
|
| 132 |
+
|
| 133 |
+
# Step 6: Gene Identifier Mapping
|
| 134 |
+
# 1-2) Build mapping between probe IDs and gene symbols using annotation columns
|
| 135 |
+
probe_col = 'ID' # Matches probe identifiers in the expression data (e.g., A_23_P100001)
|
| 136 |
+
gene_symbol_col = 'GENE_SYMBOL' # Column containing HUGO gene symbols
|
| 137 |
+
|
| 138 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
| 139 |
+
|
| 140 |
+
# 3) Apply mapping to convert probe-level data to gene-level expression
|
| 141 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 142 |
+
|
| 143 |
+
# Step 7: Data Normalization and Linking
|
| 144 |
+
import os
|
| 145 |
+
import pandas as pd
|
| 146 |
+
|
| 147 |
+
# 1) Normalize gene symbols and save gene-level data
|
| 148 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 149 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 150 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 151 |
+
|
| 152 |
+
# 2) Link clinical and genetic data
|
| 153 |
+
# Ensure clinical features are available in memory; otherwise load from file
|
| 154 |
+
try:
|
| 155 |
+
selected_clinical_df
|
| 156 |
+
except NameError:
|
| 157 |
+
if not os.path.exists(out_clinical_data_file):
|
| 158 |
+
raise FileNotFoundError(f"Clinical features file not found: {out_clinical_data_file}")
|
| 159 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 160 |
+
|
| 161 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 162 |
+
|
| 163 |
+
# Availability flags (cast to native Python bool to avoid numpy bools in JSON)
|
| 164 |
+
is_gene_available = bool((normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0))
|
| 165 |
+
is_trait_available = bool((trait in linked_data.columns) and (linked_data[trait].notna().any()))
|
| 166 |
+
|
| 167 |
+
# 3) Handle missing values
|
| 168 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 169 |
+
|
| 170 |
+
# 4) Bias check and remove biased demographic features
|
| 171 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 172 |
+
is_trait_biased = bool(is_trait_biased)
|
| 173 |
+
|
| 174 |
+
# Build note
|
| 175 |
+
has_age_row = 'Age' in selected_clinical_df.index
|
| 176 |
+
has_gender_row = 'Gender' in selected_clinical_df.index
|
| 177 |
+
note_bits = []
|
| 178 |
+
if not has_age_row:
|
| 179 |
+
note_bits.append("Age not provided")
|
| 180 |
+
if has_gender_row:
|
| 181 |
+
note_bits.append("Gender available")
|
| 182 |
+
# Add imbalance information if biased
|
| 183 |
+
if is_trait_biased and trait in linked_data.columns:
|
| 184 |
+
try:
|
| 185 |
+
case_n = int((linked_data[trait] == 1).sum())
|
| 186 |
+
total_n = int(len(linked_data))
|
| 187 |
+
note_bits.append(f"Severe trait imbalance; {case_n} case(s) out of {total_n} samples")
|
| 188 |
+
except Exception:
|
| 189 |
+
note_bits.append("Severe trait imbalance detected")
|
| 190 |
+
note = "INFO: " + "; ".join(note_bits) if note_bits else "INFO: Clinical annotations processed."
|
| 191 |
+
|
| 192 |
+
# 5) Final validation and save cohort info
|
| 193 |
+
is_usable = validate_and_save_cohort_info(
|
| 194 |
+
is_final=True,
|
| 195 |
+
cohort=cohort,
|
| 196 |
+
info_path=json_path,
|
| 197 |
+
is_gene_available=bool(is_gene_available),
|
| 198 |
+
is_trait_available=bool(is_trait_available),
|
| 199 |
+
is_biased=bool(is_trait_biased),
|
| 200 |
+
df=unbiased_linked_data,
|
| 201 |
+
note=note
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
+
# 6) Save linked data 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/Mesothelioma/code/GSE112154.py
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Mesothelioma"
|
| 6 |
+
cohort = "GSE112154"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Mesothelioma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Mesothelioma/GSE112154"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Mesothelioma/GSE112154.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Mesothelioma/gene_data/GSE112154.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Mesothelioma/clinical_data/GSE112154.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Mesothelioma/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 # Based on series design: gene expression profiling on tumor, normal, and cell lines.
|
| 44 |
+
|
| 45 |
+
# 2) Variable availability and conversion functions
|
| 46 |
+
|
| 47 |
+
# From Sample Characteristics Dictionary:
|
| 48 |
+
# {0: ['sample type: DMPM frozen tumor specimen', 'sample type: normal peritoneum', 'sample type: DMPM cell line']}
|
| 49 |
+
trait_row = 0
|
| 50 |
+
age_row = None
|
| 51 |
+
gender_row = None
|
| 52 |
+
|
| 53 |
+
def _extract_after_colon(x):
|
| 54 |
+
if x is None or (isinstance(x, float) and pd.isna(x)):
|
| 55 |
+
return None
|
| 56 |
+
s = str(x)
|
| 57 |
+
if ':' in s:
|
| 58 |
+
s = s.split(':', 1)[1]
|
| 59 |
+
s = s.strip()
|
| 60 |
+
return s if s != '' else None
|
| 61 |
+
|
| 62 |
+
def convert_trait(x):
|
| 63 |
+
v = _extract_after_colon(x)
|
| 64 |
+
if v is None:
|
| 65 |
+
return None
|
| 66 |
+
vl = v.lower()
|
| 67 |
+
# Map normal peritoneum to 0; DMPM tumor or mesothelioma cell line to 1
|
| 68 |
+
if 'normal' in vl:
|
| 69 |
+
return 0
|
| 70 |
+
if ('dmpm' in vl) or ('mesothelioma' in vl) or ('tumor' in vl) or ('cell line' in vl):
|
| 71 |
+
return 1
|
| 72 |
+
return None
|
| 73 |
+
|
| 74 |
+
# Placeholders (not used since rows are None)
|
| 75 |
+
def convert_age(x):
|
| 76 |
+
v = _extract_after_colon(x)
|
| 77 |
+
if v is None:
|
| 78 |
+
return None
|
| 79 |
+
# Try to parse numeric age if it ever appears; otherwise None
|
| 80 |
+
try:
|
| 81 |
+
return float(v)
|
| 82 |
+
except Exception:
|
| 83 |
+
return None
|
| 84 |
+
|
| 85 |
+
def convert_gender(x):
|
| 86 |
+
v = _extract_after_colon(x)
|
| 87 |
+
if v is None:
|
| 88 |
+
return None
|
| 89 |
+
vl = v.lower()
|
| 90 |
+
if vl.startswith('f'):
|
| 91 |
+
return 0
|
| 92 |
+
if vl.startswith('m'):
|
| 93 |
+
return 1
|
| 94 |
+
return None
|
| 95 |
+
|
| 96 |
+
# 3) Save metadata via 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 (only if 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=None,
|
| 115 |
+
gender_row=gender_row,
|
| 116 |
+
convert_gender=None
|
| 117 |
+
)
|
| 118 |
+
preview = preview_df(selected_clinical_df, n=5)
|
| 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 |
+
# 1-2. Decide columns and get mapping dataframe
|
| 144 |
+
probe_col = 'ID' # Matches probe IDs like 'ILMN_...'
|
| 145 |
+
symbol_col = 'Symbol' # Gene symbols
|
| 146 |
+
|
| 147 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=symbol_col)
|
| 148 |
+
|
| 149 |
+
# 3. Apply mapping to convert probe-level data to gene-level expression
|
| 150 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 151 |
+
|
| 152 |
+
# Step 7: Data Normalization and Linking
|
| 153 |
+
import os
|
| 154 |
+
import pandas as pd
|
| 155 |
+
|
| 156 |
+
# Ensure clinical features are loaded (avoid cross-step dependency)
|
| 157 |
+
if 'selected_clinical_df' not in globals():
|
| 158 |
+
selected_clinical_df = pd.read_csv(out_clinical_data_file, index_col=0)
|
| 159 |
+
|
| 160 |
+
# 1. Normalize gene symbols and save
|
| 161 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 162 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 163 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 164 |
+
|
| 165 |
+
# 2. Link clinical and genetic data
|
| 166 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 167 |
+
|
| 168 |
+
# 3. Handle missing values
|
| 169 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 170 |
+
|
| 171 |
+
# 4. Assess bias and remove biased demographic features if any
|
| 172 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 173 |
+
|
| 174 |
+
# 5. Final validation and save cohort metadata
|
| 175 |
+
note = "INFO: Trait derived from sample type; age and gender not available in this series."
|
| 176 |
+
is_usable = validate_and_save_cohort_info(
|
| 177 |
+
is_final=True,
|
| 178 |
+
cohort=cohort,
|
| 179 |
+
info_path=json_path,
|
| 180 |
+
is_gene_available=True,
|
| 181 |
+
is_trait_available=True,
|
| 182 |
+
is_biased=is_trait_biased,
|
| 183 |
+
df=unbiased_linked_data,
|
| 184 |
+
note=note
|
| 185 |
+
)
|
| 186 |
+
|
| 187 |
+
# 6. Save linked data only if usable
|
| 188 |
+
if is_usable:
|
| 189 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 190 |
+
unbiased_linked_data.to_csv(out_data_file)
|
output/preprocess/Mesothelioma/code/GSE117668.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Mesothelioma"
|
| 6 |
+
cohort = "GSE117668"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Mesothelioma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Mesothelioma/GSE117668"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Mesothelioma/GSE117668.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Mesothelioma/gene_data/GSE117668.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Mesothelioma/clinical_data/GSE117668.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Mesothelioma/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 series summary
|
| 44 |
+
|
| 45 |
+
# 2. Variable Availability and Converters
|
| 46 |
+
|
| 47 |
+
# Based on sample characteristics, diagnosis is available at key 1
|
| 48 |
+
trait_row = 1
|
| 49 |
+
age_row = None
|
| 50 |
+
gender_row = None
|
| 51 |
+
|
| 52 |
+
def _parse_after_colon(x):
|
| 53 |
+
if x is None:
|
| 54 |
+
return None
|
| 55 |
+
if not isinstance(x, str):
|
| 56 |
+
x = str(x)
|
| 57 |
+
x = x.replace('\xa0', ' ').strip()
|
| 58 |
+
parts = x.split(':', 1)
|
| 59 |
+
val = parts[1] if len(parts) > 1 else parts[0]
|
| 60 |
+
val = val.strip().lower()
|
| 61 |
+
if val in {'', 'na', 'n/a', 'not available', 'unknown', 'none', 'null'}:
|
| 62 |
+
return None
|
| 63 |
+
return val
|
| 64 |
+
|
| 65 |
+
def convert_trait(x):
|
| 66 |
+
# Binary: 1 = Mesothelioma, 0 = Healthy/Control
|
| 67 |
+
val = _parse_after_colon(x)
|
| 68 |
+
if val is None:
|
| 69 |
+
return None
|
| 70 |
+
if 'mesothelioma' in val or 'mpm' in val:
|
| 71 |
+
return 1
|
| 72 |
+
if any(k in val for k in ['healthy', 'normal', 'control']):
|
| 73 |
+
return 0
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
def convert_age(x):
|
| 77 |
+
# Not available in this dataset (cell lines); keep for interface completeness
|
| 78 |
+
val = _parse_after_colon(x)
|
| 79 |
+
if val is None:
|
| 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 |
+
# Not available in this dataset (cell lines); keep for interface completeness
|
| 91 |
+
val = _parse_after_colon(x)
|
| 92 |
+
if val is None:
|
| 93 |
+
return None
|
| 94 |
+
if val in {'male', 'm', 'man'}:
|
| 95 |
+
return 1
|
| 96 |
+
if val in {'female', 'f', 'woman'}:
|
| 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 (only if trait_row is available)
|
| 111 |
+
if trait_row is not None:
|
| 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=None,
|
| 119 |
+
gender_row=gender_row,
|
| 120 |
+
convert_gender=None
|
| 121 |
+
)
|
| 122 |
+
clinical_preview = preview_df(selected_clinical_df)
|
| 123 |
+
|
| 124 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 125 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 126 |
+
|
| 127 |
+
# Step 3: Gene Data Extraction
|
| 128 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 129 |
+
gene_data = get_genetic_data(matrix_file)
|
| 130 |
+
|
| 131 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 132 |
+
print(gene_data.index[:20])
|
| 133 |
+
|
| 134 |
+
# Step 4: Gene Identifier Review
|
| 135 |
+
requires_gene_mapping = True
|
| 136 |
+
print(f"requires_gene_mapping = {requires_gene_mapping}")
|
| 137 |
+
|
| 138 |
+
# Step 5: Gene Annotation
|
| 139 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 140 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 141 |
+
|
| 142 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 143 |
+
print("Gene annotation preview:")
|
| 144 |
+
print(preview_df(gene_annotation))
|
| 145 |
+
|
| 146 |
+
# Step 6: Gene Identifier Mapping
|
| 147 |
+
# Determine columns for probe IDs and gene symbols based on annotation preview:
|
| 148 |
+
# - Probe identifier column: 'ID' (e.g., '100009613_at')
|
| 149 |
+
# - Gene symbol information: 'Description' (contains gene names from which symbols can be extracted)
|
| 150 |
+
|
| 151 |
+
# 2. Build mapping dataframe
|
| 152 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Description')
|
| 153 |
+
|
| 154 |
+
# 3. Apply mapping to convert probe-level data to gene-level expression
|
| 155 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 156 |
+
|
| 157 |
+
# Step 7: Data Normalization and Linking
|
| 158 |
+
import os
|
| 159 |
+
|
| 160 |
+
# 1. Normalize gene symbols and save
|
| 161 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 162 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 163 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 164 |
+
|
| 165 |
+
# 2. Link the clinical and genetic data
|
| 166 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 167 |
+
|
| 168 |
+
# 3. Handle missing values
|
| 169 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 170 |
+
|
| 171 |
+
# 4. Assess bias and remove biased demographic features
|
| 172 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 173 |
+
|
| 174 |
+
# Flags for availability
|
| 175 |
+
is_gene_available_flag = (normalized_gene_data.shape[0] > 0 and normalized_gene_data.shape[1] > 0)
|
| 176 |
+
is_trait_available_flag = True # trait was extracted in Step 2 (trait_row not None) and linked above
|
| 177 |
+
|
| 178 |
+
# 5. Final validation and save cohort info
|
| 179 |
+
note = "INFO: Cell line dataset; age/gender likely unavailable."
|
| 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_flag,
|
| 185 |
+
is_trait_available=is_trait_available_flag,
|
| 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/Mesothelioma/code/GSE131027.py
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Path Configuration
|
| 2 |
+
from tools.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Mesothelioma"
|
| 6 |
+
cohort = "GSE131027"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Mesothelioma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Mesothelioma/GSE131027"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Mesothelioma/GSE131027.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Mesothelioma/gene_data/GSE131027.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Mesothelioma/clinical_data/GSE131027.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Mesothelioma/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 numpy as np
|
| 42 |
+
|
| 43 |
+
# 1. Gene expression data availability
|
| 44 |
+
is_gene_available = True
|
| 45 |
+
|
| 46 |
+
# 2. Variable availability and conversion functions
|
| 47 |
+
trait_row = 1
|
| 48 |
+
age_row = None
|
| 49 |
+
gender_row = None
|
| 50 |
+
|
| 51 |
+
def _after_colon(x: str) -> str:
|
| 52 |
+
parts = str(x).split(':')
|
| 53 |
+
return parts[-1].strip() if len(parts) >= 2 else str(x).strip()
|
| 54 |
+
|
| 55 |
+
def convert_trait(x):
|
| 56 |
+
if x is None or (isinstance(x, float) and np.isnan(x)):
|
| 57 |
+
return None
|
| 58 |
+
val = _after_colon(x).strip().lower()
|
| 59 |
+
if val in {'', 'na', 'n/a', 'null', 'none', 'unknown', 'not available', 'nan', 'missing'}:
|
| 60 |
+
return None
|
| 61 |
+
|
| 62 |
+
# Binary mapping: Mesothelioma = 1, other cancers = 0
|
| 63 |
+
if 'mesot' in val: # captures 'mesothelioma'
|
| 64 |
+
return 1
|
| 65 |
+
|
| 66 |
+
non_meso_tokens = {
|
| 67 |
+
'cancer', 'nsclc', 'cup', 'sarcoma', 'melanoma', 'carcinoma', 'ovarian',
|
| 68 |
+
'prostate', 'urothelial', 'colorectal', 'breast', 'pancreatic', 'bile',
|
| 69 |
+
'cervical', 'renal', 'hepato', 'thymoma', 'oesophageal', 'gastric',
|
| 70 |
+
'neuroendocrine', 'vulvovaginal', 'adenoid cystic', 'head and neck', 'unknown primary', 'others'
|
| 71 |
+
}
|
| 72 |
+
if any(tok in val for tok in non_meso_tokens):
|
| 73 |
+
return 0
|
| 74 |
+
|
| 75 |
+
# Truly unrecognized content
|
| 76 |
+
return None
|
| 77 |
+
|
| 78 |
+
# 3. Save metadata (initial filtering)
|
| 79 |
+
is_trait_available = trait_row is not None
|
| 80 |
+
_ = validate_and_save_cohort_info(
|
| 81 |
+
is_final=False,
|
| 82 |
+
cohort=cohort,
|
| 83 |
+
info_path=json_path,
|
| 84 |
+
is_gene_available=is_gene_available,
|
| 85 |
+
is_trait_available=is_trait_available
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
# 4. Clinical feature extraction
|
| 89 |
+
if trait_row is not None:
|
| 90 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 91 |
+
clinical_df=clinical_data,
|
| 92 |
+
trait=trait,
|
| 93 |
+
trait_row=trait_row,
|
| 94 |
+
convert_trait=convert_trait,
|
| 95 |
+
age_row=age_row,
|
| 96 |
+
convert_age=None,
|
| 97 |
+
gender_row=gender_row,
|
| 98 |
+
convert_gender=None
|
| 99 |
+
)
|
| 100 |
+
clinical_preview = preview_df(selected_clinical_df)
|
| 101 |
+
print(clinical_preview)
|
| 102 |
+
# Save clinical features
|
| 103 |
+
out_dir = os.path.dirname(out_clinical_data_file)
|
| 104 |
+
os.makedirs(out_dir, exist_ok=True)
|
| 105 |
+
selected_clinical_df.to_csv(out_clinical_data_file, index=True)
|
| 106 |
+
|
| 107 |
+
# Step 3: Gene Data Extraction
|
| 108 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 109 |
+
gene_data = get_genetic_data(matrix_file)
|
| 110 |
+
|
| 111 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 112 |
+
print(gene_data.index[:20])
|
| 113 |
+
|
| 114 |
+
# Step 4: Gene Identifier Review
|
| 115 |
+
# Based on the identifiers like '1007_s_at', '1053_at', etc., which are Affymetrix probe set IDs,
|
| 116 |
+
# they are not gene symbols and require mapping to human gene symbols.
|
| 117 |
+
print("requires_gene_mapping = True")
|
| 118 |
+
|
| 119 |
+
# Step 5: Gene Annotation
|
| 120 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 121 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 122 |
+
|
| 123 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 124 |
+
print("Gene annotation preview:")
|
| 125 |
+
print(preview_df(gene_annotation))
|
| 126 |
+
|
| 127 |
+
# Step 6: Gene Identifier Mapping
|
| 128 |
+
# 1-2. Determine columns for probe IDs and gene symbols, and build the mapping dataframe
|
| 129 |
+
probe_col = 'ID'
|
| 130 |
+
gene_symbol_col = 'Gene Symbol'
|
| 131 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col=probe_col, gene_col=gene_symbol_col)
|
| 132 |
+
|
| 133 |
+
# 3. Apply mapping to convert probe-level data to gene-level expression
|
| 134 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 135 |
+
|
| 136 |
+
# Step 7: Data Normalization and Linking
|
| 137 |
+
import os
|
| 138 |
+
|
| 139 |
+
# 1. Normalize gene symbols and save (only if non-empty)
|
| 140 |
+
normalized_gene_data = normalize_gene_symbols_in_index(gene_data)
|
| 141 |
+
if normalized_gene_data.shape[0] > 0 and normalized_gene_data.shape[1] > 0:
|
| 142 |
+
os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)
|
| 143 |
+
normalized_gene_data.to_csv(out_gene_data_file)
|
| 144 |
+
|
| 145 |
+
# 2. Link the clinical and genetic data
|
| 146 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_df, normalized_gene_data)
|
| 147 |
+
|
| 148 |
+
# 3. Handle missing values
|
| 149 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 150 |
+
|
| 151 |
+
# 4. Assess bias and remove biased demographic features
|
| 152 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 153 |
+
|
| 154 |
+
# 5. Final validation and save cohort info
|
| 155 |
+
# Ensure all boolean flags are native Python bool
|
| 156 |
+
is_gene_available_final = bool((normalized_gene_data.shape[0] > 0) and (normalized_gene_data.shape[1] > 0))
|
| 157 |
+
is_trait_available_final = bool((trait in selected_clinical_df.index) and selected_clinical_df.loc[trait].notna().any())
|
| 158 |
+
is_trait_biased = bool(is_trait_biased)
|
| 159 |
+
|
| 160 |
+
try:
|
| 161 |
+
is_usable = validate_and_save_cohort_info(
|
| 162 |
+
is_final=True,
|
| 163 |
+
cohort=cohort,
|
| 164 |
+
info_path=json_path,
|
| 165 |
+
is_gene_available=is_gene_available_final,
|
| 166 |
+
is_trait_available=is_trait_available_final,
|
| 167 |
+
is_biased=is_trait_biased,
|
| 168 |
+
df=unbiased_linked_data,
|
| 169 |
+
note="INFO: GEO series with multiple cancer types; Mesothelioma treated as case=1."
|
| 170 |
+
)
|
| 171 |
+
except TypeError as e:
|
| 172 |
+
# Fallback: manual write with sanitized types if serialization fails
|
| 173 |
+
print(f"validate_and_save_cohort_info failed with TypeError: {e}. Falling back to manual JSON write.")
|
| 174 |
+
# Mirror internal checks from validate_and_save_cohort_info
|
| 175 |
+
_is_gene_avail = bool(is_gene_available_final)
|
| 176 |
+
_is_trait_avail = bool(is_trait_available_final)
|
| 177 |
+
if len(unbiased_linked_data) <= 0 or len(unbiased_linked_data.columns) <= 4:
|
| 178 |
+
_is_gene_avail = False
|
| 179 |
+
if len(unbiased_linked_data) <= 0:
|
| 180 |
+
_is_trait_avail = False
|
| 181 |
+
_is_available = bool(_is_gene_avail and _is_trait_avail)
|
| 182 |
+
_is_usable = bool(_is_available and (not is_trait_biased))
|
| 183 |
+
|
| 184 |
+
new_record = {
|
| 185 |
+
"is_usable": _is_usable,
|
| 186 |
+
"is_gene_available": _is_gene_avail,
|
| 187 |
+
"is_trait_available": _is_trait_avail,
|
| 188 |
+
"is_available": _is_available,
|
| 189 |
+
"is_biased": (False if not _is_available else bool(is_trait_biased)),
|
| 190 |
+
"has_age": (("Age" in unbiased_linked_data.columns) if _is_available else None),
|
| 191 |
+
"has_gender": (("Gender" in unbiased_linked_data.columns) if _is_available else None),
|
| 192 |
+
"sample_size": (int(len(unbiased_linked_data)) if _is_available else None),
|
| 193 |
+
"note": "INFO: GEO series with multiple cancer types; Mesothelioma treated as case=1."
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
trait_directory = os.path.dirname(json_path)
|
| 197 |
+
os.makedirs(trait_directory, exist_ok=True)
|
| 198 |
+
if not os.path.exists(json_path):
|
| 199 |
+
with open(json_path, 'w') as file:
|
| 200 |
+
import json
|
| 201 |
+
json.dump({}, file)
|
| 202 |
+
print(f"A new JSON file was created at: {json_path}")
|
| 203 |
+
|
| 204 |
+
import json
|
| 205 |
+
with open(json_path, "r") as file:
|
| 206 |
+
records = json.load(file)
|
| 207 |
+
records[cohort] = new_record
|
| 208 |
+
|
| 209 |
+
temp_path = json_path + ".tmp"
|
| 210 |
+
with open(temp_path, 'w') as file:
|
| 211 |
+
json.dump(records, file)
|
| 212 |
+
os.replace(temp_path, json_path)
|
| 213 |
+
|
| 214 |
+
is_usable = _is_usable
|
| 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/Mesothelioma/code/GSE163720.py
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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.preprocess import *
|
| 3 |
+
|
| 4 |
+
# Processing context
|
| 5 |
+
trait = "Mesothelioma"
|
| 6 |
+
cohort = "GSE163720"
|
| 7 |
+
|
| 8 |
+
# Input paths
|
| 9 |
+
in_trait_dir = "../DATA/GEO/Mesothelioma"
|
| 10 |
+
in_cohort_dir = "../DATA/GEO/Mesothelioma/GSE163720"
|
| 11 |
+
|
| 12 |
+
# Output paths
|
| 13 |
+
out_data_file = "./output/z4/preprocess/Mesothelioma/GSE163720.csv"
|
| 14 |
+
out_gene_data_file = "./output/z4/preprocess/Mesothelioma/gene_data/GSE163720.csv"
|
| 15 |
+
out_clinical_data_file = "./output/z4/preprocess/Mesothelioma/clinical_data/GSE163720.csv"
|
| 16 |
+
json_path = "./output/z4/preprocess/Mesothelioma/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 background info and sample characteristics
|
| 40 |
+
is_gene_available = True # Microarray tumor gene expression dataset
|
| 41 |
+
trait_row = None # All samples are MPM tumors; no variability for the trait
|
| 42 |
+
age_row = None # No age information in sample characteristics
|
| 43 |
+
gender_row = 2 # 'Sex: F' and 'Sex: M' present
|
| 44 |
+
|
| 45 |
+
# Converters
|
| 46 |
+
def _extract_value(x):
|
| 47 |
+
if x is None:
|
| 48 |
+
return None
|
| 49 |
+
if isinstance(x, str) and ":" in x:
|
| 50 |
+
return x.split(":", 1)[1].strip()
|
| 51 |
+
return str(x).strip() if x is not None else None
|
| 52 |
+
|
| 53 |
+
def convert_trait(x):
|
| 54 |
+
# Not used for this cohort (trait_row is None). Heuristic retained for consistency.
|
| 55 |
+
v = _extract_value(x)
|
| 56 |
+
if v is None or v == "":
|
| 57 |
+
return None
|
| 58 |
+
v_low = v.lower()
|
| 59 |
+
# Map mesothelioma/tumor case to 1, normal/control to 0
|
| 60 |
+
if any(k in v_low for k in ["mesothelioma", "mpm", "tumor", "cancer", "case"]):
|
| 61 |
+
return 1
|
| 62 |
+
if any(k in v_low for k in ["normal", "control", "benign", "healthy", "non-tumor", "non tumor"]):
|
| 63 |
+
return 0
|
| 64 |
+
return None
|
| 65 |
+
|
| 66 |
+
def convert_age(x):
|
| 67 |
+
# No age field in this cohort; keep a robust parser if encountered.
|
| 68 |
+
v = _extract_value(x)
|
| 69 |
+
if v is None or v == "":
|
| 70 |
+
return None
|
| 71 |
+
# Extract leading numeric age if present
|
| 72 |
+
import re
|
| 73 |
+
m = re.search(r"(\d+(\.\d+)?)", v)
|
| 74 |
+
if m:
|
| 75 |
+
try:
|
| 76 |
+
return float(m.group(1))
|
| 77 |
+
except Exception:
|
| 78 |
+
return None
|
| 79 |
+
return None
|
| 80 |
+
|
| 81 |
+
def convert_gender(x):
|
| 82 |
+
v = _extract_value(x)
|
| 83 |
+
if v is None or v == "":
|
| 84 |
+
return None
|
| 85 |
+
v_low = v.lower()
|
| 86 |
+
# Female -> 0, Male -> 1
|
| 87 |
+
if v_low in ["f", "female", "woman", "women"]:
|
| 88 |
+
return 0
|
| 89 |
+
if v_low in ["m", "male", "man", "men"]:
|
| 90 |
+
return 1
|
| 91 |
+
return None
|
| 92 |
+
|
| 93 |
+
# Save metadata (initial filtering)
|
| 94 |
+
is_trait_available = trait_row is not None
|
| 95 |
+
_ = validate_and_save_cohort_info(
|
| 96 |
+
is_final=False,
|
| 97 |
+
cohort=cohort,
|
| 98 |
+
info_path=json_path,
|
| 99 |
+
is_gene_available=is_gene_available,
|
| 100 |
+
is_trait_available=is_trait_available
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
# Clinical feature extraction is skipped because trait_row is None (no variable clinical trait available)
|
| 104 |
+
if trait_row is not None:
|
| 105 |
+
selected_clinical_df = geo_select_clinical_features(
|
| 106 |
+
clinical_df=clinical_data,
|
| 107 |
+
trait=trait,
|
| 108 |
+
trait_row=trait_row,
|
| 109 |
+
convert_trait=convert_trait,
|
| 110 |
+
age_row=age_row,
|
| 111 |
+
convert_age=convert_age,
|
| 112 |
+
gender_row=gender_row,
|
| 113 |
+
convert_gender=convert_gender
|
| 114 |
+
)
|
| 115 |
+
_ = preview_df(selected_clinical_df, n=5)
|
| 116 |
+
os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)
|
| 117 |
+
selected_clinical_df.to_csv(out_clinical_data_file)
|
| 118 |
+
|
| 119 |
+
# Step 3: Gene Data Extraction
|
| 120 |
+
# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.
|
| 121 |
+
gene_data = get_genetic_data(matrix_file)
|
| 122 |
+
|
| 123 |
+
# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.
|
| 124 |
+
print(gene_data.index[:20])
|
| 125 |
+
|
| 126 |
+
# Step 4: Gene Identifier Review
|
| 127 |
+
# The observed identifiers are numeric probe IDs, not human gene symbols.
|
| 128 |
+
requires_gene_mapping = True
|
| 129 |
+
print(f"\nrequires_gene_mapping = {requires_gene_mapping}")
|
| 130 |
+
|
| 131 |
+
# Step 5: Gene Annotation
|
| 132 |
+
# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.
|
| 133 |
+
gene_annotation = get_gene_annotation(soft_file)
|
| 134 |
+
|
| 135 |
+
# 2. Use the 'preview_df' function from the library to preview the data and print out the results.
|
| 136 |
+
print("Gene annotation preview:")
|
| 137 |
+
print(preview_df(gene_annotation))
|
| 138 |
+
|
| 139 |
+
# Step 6: Gene Identifier Mapping
|
| 140 |
+
# Identify the appropriate columns for mapping:
|
| 141 |
+
# - Probe IDs in gene_annotation are in the 'ID' column (matches numeric probe IDs in gene_data)
|
| 142 |
+
# - Gene symbols are embedded in the 'gene_assignment' column
|
| 143 |
+
mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')
|
| 144 |
+
|
| 145 |
+
# Apply mapping to convert probe-level data to gene-level data
|
| 146 |
+
gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)
|
| 147 |
+
|
| 148 |
+
# Step 7: Data Normalization and Linking
|
| 149 |
+
import os
|
| 150 |
+
import pandas as pd
|
| 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 |
+
# Prepare default for linked data variable
|
| 158 |
+
linked_data = None
|
| 159 |
+
|
| 160 |
+
# Determine trait availability from previous step
|
| 161 |
+
trait_available = ('trait_row' in globals()) and (trait_row is not None)
|
| 162 |
+
|
| 163 |
+
if trait_available:
|
| 164 |
+
# 2) Link clinical and genetic data
|
| 165 |
+
linked_data = geo_link_clinical_genetic_data(selected_clinical_data, normalized_gene_data)
|
| 166 |
+
|
| 167 |
+
# 3) Handle missing values
|
| 168 |
+
linked_data = handle_missing_values(linked_data, trait)
|
| 169 |
+
|
| 170 |
+
# 4) Bias checking and removal of biased demographics
|
| 171 |
+
is_trait_biased, unbiased_linked_data = judge_and_remove_biased_features(linked_data, trait)
|
| 172 |
+
|
| 173 |
+
# 5) Final validation and metadata save
|
| 174 |
+
note = "INFO: Linked dataset created with clinical trait and gene expression."
|
| 175 |
+
is_usable = 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=True,
|
| 181 |
+
is_biased=is_trait_biased,
|
| 182 |
+
df=unbiased_linked_data,
|
| 183 |
+
note=note
|
| 184 |
+
)
|
| 185 |
+
|
| 186 |
+
# 6) Save linked data if usable
|
| 187 |
+
if is_usable:
|
| 188 |
+
os.makedirs(os.path.dirname(out_data_file), exist_ok=True)
|
| 189 |
+
unbiased_linked_data.to_csv(out_data_file)
|
| 190 |
+
else:
|
| 191 |
+
# Trait not available; skip linking and association analysis
|
| 192 |
+
# Record final metadata without overriding availability flags due to "abnormal" df.
|
| 193 |
+
# Provide a dummy non-empty DataFrame to avoid the override path in validator.
|
| 194 |
+
dummy_df = pd.DataFrame([[0, 1, 2, 3, 4]], columns=[f"col{i}" for i in range(5)])
|
| 195 |
+
note = ("INFO: Trait unavailable for this cohort (all samples are MPM tumors; no variable Mesothelioma label). "
|
| 196 |
+
"Only gene expression data was processed and saved; no linking performed.")
|
| 197 |
+
_ = validate_and_save_cohort_info(
|
| 198 |
+
is_final=True,
|
| 199 |
+
cohort=cohort,
|
| 200 |
+
info_path=json_path,
|
| 201 |
+
is_gene_available=True,
|
| 202 |
+
is_trait_available=False,
|
| 203 |
+
is_biased=False,
|
| 204 |
+
df=dummy_df,
|
| 205 |
+
note=note
|
| 206 |
+
)
|