File size: 1,703 Bytes
7623c74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Path Configuration
from tools.preprocess import *

# Processing context
trait = "Liver_Cancer"
cohort = "GSE209875"

# Input paths
in_trait_dir = "../DATA/GEO/Liver_Cancer"
in_cohort_dir = "../DATA/GEO/Liver_Cancer/GSE209875"

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

# First print directory contents
print("Files in directory:")
print(os.listdir(in_cohort_dir))

# Get file paths for soft and matrix files 
files = os.listdir(in_cohort_dir)
soft_files = [f for f in files if ('soft' in f.lower() or 'soft.gz' in f.lower())]
matrix_files = [f for f in files if ('matrix' in f.lower() or 'matrix.gz' in f.lower())]
print("\nFound files:")
print("SOFT files:", soft_files)
print("Matrix files:", matrix_files)

if len(soft_files) > 0 and len(matrix_files) > 0:
    soft_file = os.path.join(in_cohort_dir, soft_files[0])
    matrix_file = os.path.join(in_cohort_dir, matrix_files[0])

    # Get background info and clinical data from matrix file
    background_info, clinical_data = get_background_and_clinical_data(matrix_file)

    # Get unique values for each clinical feature row 
    clinical_features = get_unique_values_by_row(clinical_data)

    # Print background info
    print("\nBackground Information:")
    print(background_info)
    print("\nClinical Features and Sample Values:")
    print(json.dumps(clinical_features, indent=2))
else:
    print("\nRequired SOFT and/or matrix files not found in directory")