File size: 1,334 Bytes
187fbda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Path Configuration
from tools.preprocess import *

# Processing context
trait = "Atrial_Fibrillation"

# Input paths
tcga_root_dir = "../DATA/TCGA"

# Output paths
out_data_file = "./output/preprocess/1/Atrial_Fibrillation/TCGA.csv"
out_gene_data_file = "./output/preprocess/1/Atrial_Fibrillation/gene_data/TCGA.csv"
out_clinical_data_file = "./output/preprocess/1/Atrial_Fibrillation/clinical_data/TCGA.csv"
json_path = "./output/preprocess/1/Atrial_Fibrillation/cohort_info.json"

import os

# Step 1: Check directories in tcga_root_dir for anything relevant to "Atrial_Fibrillation"
dir_list = os.listdir(tcga_root_dir)
matching_dir = None

# We'll perform a simple match check (case-insensitive)
# If we had any subdirectory name containing "atrial" or "fibrillation", we would choose it.
for d in dir_list:
    if "atrial" in d.lower() or "fibrillation" in d.lower():
        matching_dir = d
        break

# If no suitable directory is found, mark trait as skipped
if matching_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:
    # Normally we'd proceed with file loading, but per instructions,
    # no directory matches the trait. Thus this block won't execute.
    pass