# Path Configuration from tools.preprocess import * # Processing context trait = "Breast_Cancer" cohort = "GSE153316" # Input paths in_trait_dir = "../DATA/GEO/Breast_Cancer" in_cohort_dir = "../DATA/GEO/Breast_Cancer/GSE153316" # Output paths out_data_file = "./output/preprocess/3/Breast_Cancer/GSE153316.csv" out_gene_data_file = "./output/preprocess/3/Breast_Cancer/gene_data/GSE153316.csv" out_clinical_data_file = "./output/preprocess/3/Breast_Cancer/clinical_data/GSE153316.csv" json_path = "./output/preprocess/3/Breast_Cancer/cohort_info.json" # Get file paths for SOFT and matrix files soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir) # Get background info and clinical data from the matrix file background_info, clinical_data = get_background_and_clinical_data(matrix_file_path) # Create dictionary of unique values for each feature unique_values_dict = get_unique_values_by_row(clinical_data) # Print the information print("Dataset Background Information:") print(background_info) print("\nSample Characteristics:") for feature, values in unique_values_dict.items(): print(f"\n{feature}:") print(values) # 1. Gene Expression Data Availability # Based on series title/summary mentioning "gene expression profiles", this dataset contains gene expression data is_gene_available = True # 2. Data Availability and Type Conversion # Trait (Breast Cancer): All samples are from breast cancer patients (see subject status) # Since all are cancer patients, there is no variance in trait values trait_row = None # Age data is available in row 2 age_row = 2 def convert_age(value): if not value or ':' not in value: return None age = value.split(':')[1].strip() try: return float(age) except: return None # Gender: Not explicitly stated but all patients underwent mastectomy, # which is a surgery primarily for female breast cancer patients gender_row = None # We found that trait data is not available (trait_row is None), indicating this dataset is not usable # Save this information validate_and_save_cohort_info( is_final=False, cohort=cohort, info_path=json_path, is_gene_available=is_gene_available, is_trait_available=False ) # Since trait_row is None, we skip the clinical feature extraction step # Extract gene expression data from matrix file genetic_data = get_genetic_data(matrix_file_path) # Print first 20 row IDs print("First 20 gene/probe IDs:") print(list(genetic_data.index[:20])) # These identifiers are from Affymetrix array probes starting with "AFFX-" prefix, # not standard human gene symbols. They need to be mapped to gene symbols. requires_gene_mapping = True # Extract gene annotation data gene_metadata = get_gene_annotation(soft_file_path) # Preview column names and first few values preview = preview_df(gene_metadata) print("\nGene annotation columns and sample values:") print(preview) # Extract available platform IDs to see what annotation is present platform_info, _ = filter_content_by_prefix( soft_file_path, prefixes_a=["!Platform_title"], source_type='file', return_df_a=False ) print("\nPlatform Information:") print(platform_info) # Since we found a mismatch between probe IDs in expression data ("AFFX-" format) # and annotation data, we need to record this as a data quality issue validate_and_save_cohort_info( is_final=False, cohort=cohort, info_path=json_path, is_gene_available=False, is_trait_available=False, note="Gene annotation data does not match probe IDs in expression data" )