|
|
|
from tools.preprocess import * |
|
|
|
|
|
trait = "Cystic_Fibrosis" |
|
|
|
|
|
tcga_root_dir = "../DATA/TCGA" |
|
|
|
|
|
out_data_file = "./output/preprocess/1/Cystic_Fibrosis/TCGA.csv" |
|
out_gene_data_file = "./output/preprocess/1/Cystic_Fibrosis/gene_data/TCGA.csv" |
|
out_clinical_data_file = "./output/preprocess/1/Cystic_Fibrosis/clinical_data/TCGA.csv" |
|
json_path = "./output/preprocess/1/Cystic_Fibrosis/cohort_info.json" |
|
|
|
import os |
|
import pandas as pd |
|
|
|
|
|
subdirectories = os.listdir(tcga_root_dir) |
|
|
|
|
|
|
|
trait_subdir = None |
|
for d in subdirectories: |
|
lower_d = d.lower().replace('_', ' ') |
|
if "cystic" in lower_d and "fibrosis" in lower_d: |
|
trait_subdir = d |
|
break |
|
|
|
|
|
if not trait_subdir: |
|
print("No suitable subdirectory found for trait 'Cystic_Fibrosis'. 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: |
|
|
|
full_subdir_path = os.path.join(tcga_root_dir, trait_subdir) |
|
clinical_path, genetic_path = tcga_get_relevant_filepaths(full_subdir_path) |
|
|
|
|
|
clinical_df = pd.read_csv(clinical_path, index_col=0, sep='\t') |
|
genetic_df = pd.read_csv(genetic_path, index_col=0, sep='\t') |
|
|
|
|
|
print("Clinical Data Columns:") |
|
print(clinical_df.columns.tolist()) |