File size: 1,899 Bytes
fcf7aea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
# Path Configuration
from tools.preprocess import *

# Processing context
trait = "Angelman_Syndrome"

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

# Output paths
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"


# Step 1: Initial Data Loading
import os
import pandas as pd

# Step 1: Identify the most relevant TCGA cohort directory for Angelman Syndrome (none expected)
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:
    # If multiple, choose the most specific (heuristic: longest name)
    selected_dir = sorted(matching_dirs, key=len, reverse=True)[0]

if selected_dir is None:
    # No suitable TCGA cancer cohort matches Angelman Syndrome; record and stop
    _ = 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)

    # Step 2: Identify clinical and genetic file paths
    clinical_file_path, genetic_file_path = tcga_get_relevant_filepaths(cohort_dir)

    # Step 3: Load both files as DataFrames
    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')

    # Step 4: Print clinical column names
    print(clinical_df.columns.tolist())