File size: 2,009 Bytes
1f52ac2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
52
# Path Configuration
from tools.preprocess import *

# Processing context
trait = "Melanoma"
cohort = "GSE189631"

# Input paths
in_trait_dir = "../DATA/GEO/Melanoma"
in_cohort_dir = "../DATA/GEO/Melanoma/GSE189631"

# Output paths
out_data_file = "./output/preprocess/3/Melanoma/GSE189631.csv"
out_gene_data_file = "./output/preprocess/3/Melanoma/gene_data/GSE189631.csv"
out_clinical_data_file = "./output/preprocess/3/Melanoma/clinical_data/GSE189631.csv"
json_path = "./output/preprocess/3/Melanoma/cohort_info.json"

# Debug: Print paths and directory existence
print("Cohort directory path:", in_cohort_dir)
print("Directory exists:", os.path.exists(in_cohort_dir))
if os.path.exists(in_cohort_dir):
    files = os.listdir(in_cohort_dir)
    print("\nFiles in directory:", files)
    
    # Look for gzipped files if regular files not found
    matrix_files = [f for f in files if ('matrix' in f.lower() and f.endswith('.gz'))]
    soft_files = [f for f in files if ('soft' in f.lower() and f.endswith('.gz'))]
    
    if matrix_files and soft_files:
        matrix_file = os.path.join(in_cohort_dir, matrix_files[0])
        soft_file = os.path.join(in_cohort_dir, soft_files[0])
        print("\nFound files:")
        print("Matrix file:", matrix_file)
        print("SOFT file:", soft_file)
        
        # Get background info and clinical data from the matrix file
        background_info, clinical_data = get_background_and_clinical_data(matrix_file)
        
        # Create dictionary of unique values for each feature
        unique_values_dict = get_unique_values_by_row(clinical_data)
        
        # Print the information
        print("\nDataset Background Information:")
        print(background_info)
        print("\nSample Characteristics:")
        for feature, values in unique_values_dict.items():
            print(f"\n{feature}:")
            print(values)
    else:
        print("\nRequired .gz files not found in directory")
else:
    print("\nDirectory does not exist")