Liu-Hy's picture
Add files using upload-large-folder tool
25a2692 verified
# 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")