|
|
|
from tools.preprocess import * |
|
|
|
|
|
trait = "Breast_Cancer" |
|
cohort = "GSE153316" |
|
|
|
|
|
in_trait_dir = "../DATA/GEO/Breast_Cancer" |
|
in_cohort_dir = "../DATA/GEO/Breast_Cancer/GSE153316" |
|
|
|
|
|
out_data_file = "./output/preprocess/3/Breast_Cancer/GSE153316.csv" |
|
out_gene_data_file = "./output/preprocess/3/Breast_Cancer/gene_data/GSE153316.csv" |
|
out_clinical_data_file = "./output/preprocess/3/Breast_Cancer/clinical_data/GSE153316.csv" |
|
json_path = "./output/preprocess/3/Breast_Cancer/cohort_info.json" |
|
|
|
|
|
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir) |
|
|
|
|
|
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path) |
|
|
|
|
|
unique_values_dict = get_unique_values_by_row(clinical_data) |
|
|
|
|
|
print("Dataset Background Information:") |
|
print(background_info) |
|
print("\nSample Characteristics:") |
|
for feature, values in unique_values_dict.items(): |
|
print(f"\n{feature}:") |
|
print(values) |
|
|
|
|
|
is_gene_available = True |
|
|
|
|
|
|
|
|
|
trait_row = None |
|
|
|
|
|
age_row = 2 |
|
|
|
def convert_age(value): |
|
if not value or ':' not in value: |
|
return None |
|
age = value.split(':')[1].strip() |
|
try: |
|
return float(age) |
|
except: |
|
return None |
|
|
|
|
|
|
|
gender_row = None |
|
|
|
|
|
|
|
validate_and_save_cohort_info( |
|
is_final=False, |
|
cohort=cohort, |
|
info_path=json_path, |
|
is_gene_available=is_gene_available, |
|
is_trait_available=False |
|
) |
|
|
|
|
|
|
|
genetic_data = get_genetic_data(matrix_file_path) |
|
|
|
|
|
print("First 20 gene/probe IDs:") |
|
print(list(genetic_data.index[:20])) |
|
|
|
|
|
|
|
requires_gene_mapping = True |
|
|
|
gene_metadata = get_gene_annotation(soft_file_path) |
|
|
|
|
|
preview = preview_df(gene_metadata) |
|
print("\nGene annotation columns and sample values:") |
|
print(preview) |
|
|
|
platform_info, _ = filter_content_by_prefix( |
|
soft_file_path, |
|
prefixes_a=["!Platform_title"], |
|
source_type='file', |
|
return_df_a=False |
|
) |
|
|
|
print("\nPlatform Information:") |
|
print(platform_info) |
|
|
|
|
|
|
|
validate_and_save_cohort_info( |
|
is_final=False, |
|
cohort=cohort, |
|
info_path=json_path, |
|
is_gene_available=False, |
|
is_trait_available=False, |
|
note="Gene annotation data does not match probe IDs in expression data" |
|
) |