# Path Configuration from tools.preprocess import * # Processing context trait = "Fibromyalgia" # Input paths tcga_root_dir = "../DATA/TCGA" # Output paths out_data_file = "./output/preprocess/1/Fibromyalgia/TCGA.csv" out_gene_data_file = "./output/preprocess/1/Fibromyalgia/gene_data/TCGA.csv" out_clinical_data_file = "./output/preprocess/1/Fibromyalgia/clinical_data/TCGA.csv" json_path = "./output/preprocess/1/Fibromyalgia/cohort_info.json" import os import pandas as pd # 1. Identify subdirectories under tcga_root_dir subdirectories = os.listdir(tcga_root_dir) # Search terms related to "Fibromyalgia" search_terms = ["fibromyalgia", "fibro", "myalgia", "chronic_widespread_pain", "cwp"] trait_subdir = None for d in subdirectories: d_lower = d.lower() if any(term in d_lower for term in search_terms): trait_subdir = d break # 2. If none found, skip this trait if not trait_subdir: print(f"No suitable subdirectory found for trait '{trait}'. Skipping...") is_gene_available = False is_trait_available = False validate_and_save_cohort_info( is_final=False, cohort="TCGA", info_path=json_path, is_gene_available=is_gene_available, is_trait_available=is_trait_available ) else: # 2. Identify file paths cohort_path = os.path.join(tcga_root_dir, trait_subdir) clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_path) # 3. Load both files as dataframes clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t', low_memory=False) genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t', low_memory=False) # 4. Print the column names of the clinical data print("Clinical Data Columns:") print(clinical_df.columns.tolist())