Liu-Hy's picture
Add files using upload-large-folder tool
ee94703 verified
raw
history blame
3.01 kB
# Path Configuration
from tools.preprocess import *
# Processing context
trait = "Age-Related_Macular_Degeneration"
cohort = "GSE45485"
# Input paths
in_trait_dir = "../DATA/GEO/Age-Related_Macular_Degeneration"
in_cohort_dir = "../DATA/GEO/Age-Related_Macular_Degeneration/GSE45485"
# Output paths
out_data_file = "./output/preprocess/1/Age-Related_Macular_Degeneration/GSE45485.csv"
out_gene_data_file = "./output/preprocess/1/Age-Related_Macular_Degeneration/gene_data/GSE45485.csv"
out_clinical_data_file = "./output/preprocess/1/Age-Related_Macular_Degeneration/clinical_data/GSE45485.csv"
json_path = "./output/preprocess/1/Age-Related_Macular_Degeneration/cohort_info.json"
# STEP1
from tools.preprocess import *
# 1. Identify the paths to the SOFT file and the matrix file
soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)
# 2. Read the matrix file to obtain background information and sample characteristics data
background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']
clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']
background_info, clinical_data = get_background_and_clinical_data(
matrix_file,
background_prefixes,
clinical_prefixes
)
# 3. Obtain the sample characteristics dictionary from the clinical dataframe
sample_characteristics_dict = get_unique_values_by_row(clinical_data)
# 4. Explicitly print out all the background information and the sample characteristics dictionary
print("Background Information:")
print(background_info)
print("Sample Characteristics Dictionary:")
print(sample_characteristics_dict)
# 1. Gene Expression Data Availability
# Based on the provided background, it involves "Gene expression and intrinsic subset assignment ... in SSc patients"
# This suggests gene expression data is indeed present.
is_gene_available = True
# 2. Variable Availability and Data Type Conversion
# Examining the Sample Characteristics Dictionary, there is no mention of AMD, age, or gender.
# Hence, none of these variables can be extracted (all become None).
trait_row = None
age_row = None
gender_row = None
# Define the required conversion functions (although they will not be used here, we must still define them).
def convert_trait(value: str):
# Since data for the trait is not found, return None for all inputs.
return None
def convert_age(value: str):
# No age data is found. Return None for all inputs.
return None
def convert_gender(value: str):
# No gender data is found. Return None for all inputs.
return None
# 3. Save Metadata via initial filtering
# If trait_row is None, it implies that trait data is unavailable.
is_trait_available = (trait_row is not None)
validate_and_save_cohort_info(
is_final=False,
cohort=cohort,
info_path=json_path,
is_gene_available=is_gene_available,
is_trait_available=is_trait_available
)
# 4. Clinical Feature Extraction
# Skip this step because trait_row is None (no clinical data for trait).