| |
| from tools.preprocess import * |
|
|
| |
| trait = "Angelman_Syndrome" |
|
|
| |
| tcga_root_dir = "../DATA/TCGA" |
|
|
| |
| out_data_file = "./output/z1/preprocess/Angelman_Syndrome/TCGA.csv" |
| out_gene_data_file = "./output/z1/preprocess/Angelman_Syndrome/gene_data/TCGA.csv" |
| out_clinical_data_file = "./output/z1/preprocess/Angelman_Syndrome/clinical_data/TCGA.csv" |
| json_path = "./output/z1/preprocess/Angelman_Syndrome/cohort_info.json" |
|
|
|
|
| |
| import os |
| import pandas as pd |
|
|
| |
| available_dirs = [d for d in os.listdir(tcga_root_dir) if os.path.isdir(os.path.join(tcga_root_dir, d))] |
| search_terms = {"angelman", "ube3a"} |
| matching_dirs = [d for d in available_dirs if any(term in d.lower() for term in search_terms)] |
|
|
| selected_dir = None |
| if matching_dirs: |
| |
| selected_dir = sorted(matching_dirs, key=len, reverse=True)[0] |
|
|
| if selected_dir is None: |
| |
| _ = validate_and_save_cohort_info( |
| is_final=False, |
| cohort="TCGA", |
| info_path=json_path, |
| is_gene_available=False, |
| is_trait_available=False |
| ) |
| else: |
| cohort_dir = os.path.join(tcga_root_dir, selected_dir) |
|
|
| |
| clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir) |
|
|
| |
| clinical_df = pd.read_csv(clinical_file_path, sep='\t', index_col=0, low_memory=False, compression='infer') |
| genetic_df = pd.read_csv(genetic_file_path, sep='\t', index_col=0, low_memory=False, compression='infer') |
|
|
| |
| print(clinical_df.columns.tolist()) |