File size: 1,821 Bytes
25a2692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = "Allergies"
cohort = "GSE184382"

# Input paths
in_trait_dir = "../DATA/GEO/Allergies"
in_cohort_dir = "../DATA/GEO/Allergies/GSE184382"

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

# First print all files to see what's available
print("All files in directory:")
print(os.listdir(in_cohort_dir))
print()

# Get file paths with expanded pattern matching for compressed files
files = os.listdir(in_cohort_dir)
soft_files = [f for f in files if ('soft' in f.lower() or 'family' in f.lower() or 'annot' in f.lower()) 
              and (f.endswith('.gz') or f.endswith('.txt'))]
matrix_files = [f for f in files if ('matrix' in f.lower() or 'series' in f.lower()) 
                and (f.endswith('.gz') or f.endswith('.txt'))]

print("Found files:")
print(f"SOFT files: {soft_files}")
print(f"Matrix files: {matrix_files}\n")

# Get full file paths
soft_file = os.path.join(in_cohort_dir, soft_files[0])
matrix_file = os.path.join(in_cohort_dir, matrix_files[0])

# Extract background info and clinical data
background_info, clinical_data = get_background_and_clinical_data(matrix_file)

# Get unique values per clinical feature 
sample_characteristics = get_unique_values_by_row(clinical_data)

# Print background info
print("Dataset Background Information:")
print(f"{background_info}\n")

# Print sample characteristics
print("Sample Characteristics:")
for feature, values in sample_characteristics.items():
    print(f"Feature: {feature}") 
    print(f"Values: {values}\n")