|
|
|
from tools.preprocess import * |
|
|
|
|
|
trait = "Liver_Cancer" |
|
cohort = "GSE209875" |
|
|
|
|
|
in_trait_dir = "../DATA/GEO/Liver_Cancer" |
|
in_cohort_dir = "../DATA/GEO/Liver_Cancer/GSE209875" |
|
|
|
|
|
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" |
|
|
|
|
|
print("Files in directory:") |
|
print(os.listdir(in_cohort_dir)) |
|
|
|
|
|
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]) |
|
|
|
|
|
background_info, clinical_data = get_background_and_clinical_data(matrix_file) |
|
|
|
|
|
clinical_features = get_unique_values_by_row(clinical_data) |
|
|
|
|
|
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") |