|
|
|
from tools.preprocess import * |
|
|
|
|
|
trait = "Fibromyalgia" |
|
|
|
|
|
tcga_root_dir = "../DATA/TCGA" |
|
|
|
|
|
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 |
|
|
|
|
|
subdirectories = os.listdir(tcga_root_dir) |
|
|
|
|
|
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 |
|
|
|
|
|
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: |
|
|
|
cohort_path = os.path.join(tcga_root_dir, trait_subdir) |
|
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_path) |
|
|
|
|
|
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) |
|
|
|
|
|
print("Clinical Data Columns:") |
|
print(clinical_df.columns.tolist()) |