File size: 1,711 Bytes
a5a8278 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# Path Configuration
from tools.preprocess import *
# Processing context
trait = "Autoinflammatory_Disorders"
# Input paths
tcga_root_dir = "../DATA/TCGA"
# Output paths
out_data_file = "./output/preprocess/1/Autoinflammatory_Disorders/TCGA.csv"
out_gene_data_file = "./output/preprocess/1/Autoinflammatory_Disorders/gene_data/TCGA.csv"
out_clinical_data_file = "./output/preprocess/1/Autoinflammatory_Disorders/clinical_data/TCGA.csv"
json_path = "./output/preprocess/1/Autoinflammatory_Disorders/cohort_info.json"
import os
import pandas as pd
# Step 1: Check directories in tcga_root_dir for anything relevant to "Autoinflammatory_Disorders"
search_terms = ["autoinflammatory", "inflam"]
dir_list = os.listdir(tcga_root_dir)
matching_dir = None
for d in dir_list:
d_lower = d.lower()
if any(term in d_lower for term in search_terms):
# Found a match, select this directory
matching_dir = d
break
if matching_dir is None:
# No matching directory found. Mark trait as skipped.
validate_and_save_cohort_info(
is_final=False,
cohort="TCGA",
info_path=json_path,
is_gene_available=False,
is_trait_available=False
)
else:
# 2. Identify the clinicalMatrix and PANCAN files
cohort_dir = os.path.join(tcga_root_dir, matching_dir)
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)
# 3. Load both data files
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t')
genetic_df = pd.read_csv(genetic_file_path, index_col=0, sep='\t')
# 4. Print the column names of the clinical data
print("Clinical Data Columns:")
print(clinical_df.columns.tolist()) |