|
|
|
from tools.preprocess import * |
|
|
|
|
|
trait = "Lactose_Intolerance" |
|
|
|
|
|
tcga_root_dir = "../DATA/TCGA" |
|
|
|
|
|
out_data_file = "./output/preprocess/3/Lactose_Intolerance/TCGA.csv" |
|
out_gene_data_file = "./output/preprocess/3/Lactose_Intolerance/gene_data/TCGA.csv" |
|
out_clinical_data_file = "./output/preprocess/3/Lactose_Intolerance/clinical_data/TCGA.csv" |
|
json_path = "./output/preprocess/3/Lactose_Intolerance/cohort_info.json" |
|
|
|
|
|
|
|
cohort_dir = os.path.join(tcga_root_dir, 'TCGA_Stomach_Cancer_(STAD)') |
|
|
|
|
|
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir) |
|
|
|
|
|
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') |
|
|
|
|
|
print("Clinical data columns:") |
|
print(clinical_df.columns.tolist()) |
|
|
|
candidate_age_cols = ['age_at_initial_pathologic_diagnosis', 'days_to_birth'] |
|
candidate_gender_cols = ['gender'] |
|
|
|
|
|
clinical_file_path, _ = tcga_get_relevant_filepaths(os.path.join(tcga_root_dir, "STAD")) |
|
clinical_df = pd.read_csv(clinical_file_path, index_col=0) |
|
|
|
|
|
age_preview = preview_df(clinical_df[candidate_age_cols]) |
|
print("Age columns preview:") |
|
print(age_preview) |
|
|
|
|
|
gender_preview = preview_df(clinical_df[candidate_gender_cols]) |
|
print("\nGender columns preview:") |
|
print(gender_preview) |
|
|
|
|
|
cohort_dir = os.path.join(tcga_root_dir, 'TCGA_Stomach_Cancer_(STAD)') |
|
|
|
|
|
clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir) |
|
|
|
|
|
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') |
|
|
|
|
|
print("Clinical data columns:") |
|
print(clinical_df.columns.tolist()) |
|
|
|
candidate_age_cols = ['age_at_initial_pathologic_diagnosis', 'days_to_birth'] |
|
candidate_gender_cols = ['gender'] |
|
|
|
|
|
cohort_dir = os.path.join(tcga_root_dir, "STAD") |
|
clinical_file_path, _ = tcga_get_relevant_filepaths(cohort_dir) |
|
|
|
|
|
clinical_df = pd.read_csv(clinical_file_path, index_col=0, sep='\t') |
|
|
|
age_preview = {} |
|
for col in candidate_age_cols: |
|
if col in clinical_df.columns: |
|
age_preview[col] = clinical_df[col].head().tolist() |
|
|
|
gender_preview = {} |
|
for col in candidate_gender_cols: |
|
if col in clinical_df.columns: |
|
gender_preview[col] = clinical_df[col].head().tolist() |
|
|
|
print("Age columns preview:") |
|
print(age_preview) |
|
print("\nGender columns preview:") |
|
print(gender_preview) |
|
|
|
|
|
is_usable = validate_and_save_cohort_info( |
|
is_final=False, |
|
cohort="TCGA_STAD", |
|
info_path=json_path, |
|
is_gene_available=True, |
|
is_trait_available=False, |
|
is_biased=None, |
|
df=None, |
|
note="TCGA datasets focus on cancer diagnoses and do not contain reliable information about lactose intolerance. Cannot use stomach cancer status as proxy since there's no established relationship between these conditions." |
|
) |
|
|
|
print("Lactose intolerance trait cannot be studied using TCGA data.") |