Liu-Hy's picture
Add files using upload-large-folder tool
4144951 verified
# Path Configuration
from tools.preprocess import *
# Processing context
trait = "Vitamin_D_Levels"
cohort = "GSE33544"
# Input paths
in_trait_dir = "../DATA/GEO/Vitamin_D_Levels"
in_cohort_dir = "../DATA/GEO/Vitamin_D_Levels/GSE33544"
# Output paths
out_data_file = "./output/preprocess/3/Vitamin_D_Levels/GSE33544.csv"
out_gene_data_file = "./output/preprocess/3/Vitamin_D_Levels/gene_data/GSE33544.csv"
out_clinical_data_file = "./output/preprocess/3/Vitamin_D_Levels/clinical_data/GSE33544.csv"
json_path = "./output/preprocess/3/Vitamin_D_Levels/cohort_info.json"
# Get file paths
soft_file_path, matrix_file_path = geo_get_relevant_filepaths(in_cohort_dir)
# Get background info and clinical data
background_info, clinical_data = get_background_and_clinical_data(matrix_file_path)
# Print shape and first few rows to verify data
print("Background Information:")
print(background_info)
print("\nClinical Data Shape:", clinical_data.shape)
print("\nFirst few rows of Clinical Data:")
print(clinical_data.head())
print("\nSample Characteristics:")
# Get dictionary of unique values per row
unique_values_dict = get_unique_values_by_row(clinical_data)
for row, values in unique_values_dict.items():
print(f"\n{row}:")
print(values)
# 1. Gene Expression Data Availability
# This dataset studies B cell receptor light chain expression, which involves gene expression
is_gene_available = True
# 2.1 Data Availability
# Trait (Vitamin D) is not available in this dataset
trait_row = None
# Age and gender are not available in the sample characteristics
age_row = None
gender_row = None
# 2.2 Data Type Conversion Functions
# Not needed since clinical data is not available
# 3. Save Metadata
# Initial filtering - only check data availability at this stage
validate_and_save_cohort_info(
is_final=False,
cohort=cohort,
info_path=json_path,
is_gene_available=is_gene_available,
is_trait_available=False
)
# 4. Clinical Feature Extraction
# Skip since trait_row is None and no clinical data is available
# Extract gene expression data from matrix file
genetic_data = get_genetic_data(matrix_file_path)
# Print first 20 row IDs
print("First 20 gene/probe IDs:")
print(list(genetic_data.index[:20]))
# Based on the shown gene identifiers, which are just numeric indices,
# we need to map them to actual human gene symbols
requires_gene_mapping = True
# No need to extract gene annotation since we now know this is not gene expression data
# Instead, let's document this finding and update our dataset status
# Update is_gene_available since this is sequence data, not gene expression
is_gene_available = False
# Save updated metadata about dataset usability
validate_and_save_cohort_info(
is_final=False,
cohort=cohort,
info_path=json_path,
is_gene_available=is_gene_available,
is_trait_available=False
)