{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "b329ea69", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:48:45.551924Z", "iopub.status.busy": "2025-03-25T05:48:45.551816Z", "iopub.status.idle": "2025-03-25T05:48:45.714774Z", "shell.execute_reply": "2025-03-25T05:48:45.714417Z" } }, "outputs": [], "source": [ "import sys\n", "import os\n", "sys.path.append(os.path.abspath(os.path.join(os.getcwd(), '../..')))\n", "\n", "# Path Configuration\n", "from tools.preprocess import *\n", "\n", "# Processing context\n", "trait = \"Hypertension\"\n", "cohort = \"GSE149256\"\n", "\n", "# Input paths\n", "in_trait_dir = \"../../input/GEO/Hypertension\"\n", "in_cohort_dir = \"../../input/GEO/Hypertension/GSE149256\"\n", "\n", "# Output paths\n", "out_data_file = \"../../output/preprocess/Hypertension/GSE149256.csv\"\n", "out_gene_data_file = \"../../output/preprocess/Hypertension/gene_data/GSE149256.csv\"\n", "out_clinical_data_file = \"../../output/preprocess/Hypertension/clinical_data/GSE149256.csv\"\n", "json_path = \"../../output/preprocess/Hypertension/cohort_info.json\"\n" ] }, { "cell_type": "markdown", "id": "62ae16fd", "metadata": {}, "source": [ "### Step 1: Initial Data Loading" ] }, { "cell_type": "code", "execution_count": 2, "id": "a1e979b4", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:48:45.716253Z", "iopub.status.busy": "2025-03-25T05:48:45.716101Z", "iopub.status.idle": "2025-03-25T05:48:45.809615Z", "shell.execute_reply": "2025-03-25T05:48:45.809301Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Background Information:\n", "!Series_title\t\"The Association between Poverty and Gene Expression within Immune Cells in a Diverse Baltimore City Cohort\"\n", "!Series_summary\t\"Socioeconomic status (SES), living in poverty, and other social determinants of health contribute to health disparities in the United States. African American (AA) men living below poverty in Baltimore City have a higher incidence of mortality when compared to either white males or AA females living below poverty. Previous studies in our laboratory and elsewhere suggest that environmental conditions are associated with differential gene expression (DGE) patterns in white blood cells, and this may contribute to the onset of diseases in the immune or cardiovascular systems. DGE have also been associated with hypertension and cardiovascular disease (CVD) and correlate with race and gender. However, no studies have investigated how poverty status associates with DGE between male and female AAs and whites living in Baltimore City. We examined DGE in 52 AA and white participants of the Healthy Aging in Neighborhoods of Diversity across the Life Span (HANDLS) cohort, who were living above or below 125% of the 2004 federal poverty line at time of sample collection. We performed a microarray to assess DGE patterns in peripheral blood mononuclear cells (PBMCs) from these participants. AA males and females living in poverty had the most genes differentially-expressed compared with above poverty controls. Gene ontology (GO) analysis identified unique and overlapping pathways related to the endosome, single-stranded RNA binding, long-chain fatty-acyl-CoA biosynthesis, toll-like receptor signaling, and others within AA males and females living in poverty and compared with their above poverty controls. We performed RT-qPCR to validate top differentially-expressed genes in AA males. We found that KLF6, DUSP2, RBM34, and CD19 are expressed at significantly lower levels in AA males in poverty and KCTD12 is higher compared to above poverty controls. This study serves as initial link to better understand the biological mechanisms of poverty status with health outcomes and disparities.\"\n", "!Series_overall_design\t\"Total RNA from peripheral blood mononuclear cells (PBMCs) from 52 African-American (AA) and White female (F) and male (M) individuals 125% above or below the 2014 federal poverty line (N = 6-7 for each ethnicity, gender and poverty status group) were used to examine differential gene expression profiles by microarray analysis.\"\n", "Sample Characteristics Dictionary:\n", "{0: ['gender: Male', 'gender: Female'], 1: ['ethnicity: White', 'ethnicity: African-American'], 2: ['poverty status: Above', 'poverty status: Below'], 3: ['age: 42.2', 'age: 49.9', 'age: 35.3', 'age: 58.4', 'age: 51.6', 'age: 56.5', 'age: 56.4', 'age: 46.7', 'age: 52.1', 'age: 51.0', 'age: 63.2', 'age: 51.2', 'age: 49.6', 'age: 51.8', 'age: 60.5', 'age: 47.1', 'age: 39.7', 'age: 52.6', 'age: 54.9', 'age: 56.3', 'age: 42.0', 'age: 49.2', 'age: 32.1', 'age: 38.2', 'age: 39.9', 'age: 53.3', 'age: 62.4', 'age: 47.6', 'age: 55.7', 'age: 36.5'], 4: ['tissue: PBMCs']}\n" ] } ], "source": [ "from tools.preprocess import *\n", "# 1. Identify the paths to the SOFT file and the matrix file\n", "soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n", "\n", "# 2. Read the matrix file to obtain background information and sample characteristics data\n", "background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']\n", "clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']\n", "background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)\n", "\n", "# 3. Obtain the sample characteristics dictionary from the clinical dataframe\n", "sample_characteristics_dict = get_unique_values_by_row(clinical_data)\n", "\n", "# 4. Explicitly print out all the background information and the sample characteristics dictionary\n", "print(\"Background Information:\")\n", "print(background_info)\n", "print(\"Sample Characteristics Dictionary:\")\n", "print(sample_characteristics_dict)\n" ] }, { "cell_type": "markdown", "id": "043c70d7", "metadata": {}, "source": [ "### Step 2: Dataset Analysis and Clinical Feature Extraction" ] }, { "cell_type": "code", "execution_count": 3, "id": "44d57238", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:48:45.810757Z", "iopub.status.busy": "2025-03-25T05:48:45.810646Z", "iopub.status.idle": "2025-03-25T05:48:45.815140Z", "shell.execute_reply": "2025-03-25T05:48:45.814841Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "import os\n", "import json\n", "from typing import Callable, Optional, Dict, Any\n", "\n", "# 1. Check Gene Expression Availability\n", "# Based on background info, this is a microarray study on PBMCs examining gene expression profiles\n", "is_gene_available = True \n", "\n", "# 2. Variable Availability and Data Type Conversion\n", "# 2.1 Data Availability\n", "# After reviewing the sample characteristics, we don't have direct hypertension data\n", "# The study focuses on poverty status and gene expression, not specifically hypertension\n", "trait_row = None # No direct hypertension data in this dataset\n", "\n", "age_row = 3 # Age is available with various values\n", "gender_row = 0 # Gender is available\n", "\n", "# 2.2 Data Type Conversion Functions\n", "def convert_trait(value: str) -> int:\n", " \"\"\"Convert trait string to binary (0 for negative, 1 for positive).\"\"\"\n", " if value is None:\n", " return None\n", " \n", " # Extract value after colon\n", " if ':' in value:\n", " value = value.split(':', 1)[1].strip()\n", " \n", " # Since we don't have direct hypertension data, this function won't be used\n", " # but we define it to maintain the code structure\n", " return None\n", "\n", "def convert_age(value: str) -> float:\n", " \"\"\"Convert age string to float.\"\"\"\n", " if value is None:\n", " return None\n", " \n", " # Extract value after colon\n", " if ':' in value:\n", " value = value.split(':', 1)[1].strip()\n", " \n", " try:\n", " return float(value)\n", " except (ValueError, TypeError):\n", " return None\n", "\n", "def convert_gender(value: str) -> int:\n", " \"\"\"Convert gender string to binary (0 for female, 1 for male).\"\"\"\n", " if value is None:\n", " return None\n", " \n", " # Extract value after colon\n", " if ':' in value:\n", " value = value.split(':', 1)[1].strip()\n", " \n", " if value.lower() == 'female':\n", " return 0\n", " elif value.lower() == 'male':\n", " return 1\n", " else:\n", " return None\n", "\n", "# 3. Save Metadata\n", "is_trait_available = trait_row is not None\n", "validate_and_save_cohort_info(\n", " is_final=False,\n", " cohort=cohort,\n", " info_path=json_path,\n", " is_gene_available=is_gene_available,\n", " is_trait_available=is_trait_available\n", ")\n", "\n", "# 4. Clinical Feature Extraction (if trait data is available)\n", "# Since trait_row is None, we skip this substep\n", "if trait_row is not None:\n", " # This block won't execute since trait_row is None\n", " # But we keep it for completeness\n", " pass\n" ] }, { "cell_type": "markdown", "id": "123172f5", "metadata": {}, "source": [ "### Step 3: Gene Data Extraction" ] }, { "cell_type": "code", "execution_count": 4, "id": "eb2a12f3", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:48:45.816166Z", "iopub.status.busy": "2025-03-25T05:48:45.816057Z", "iopub.status.idle": "2025-03-25T05:48:45.984133Z", "shell.execute_reply": "2025-03-25T05:48:45.983718Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Index(['ILMN_1343061', 'ILMN_1343291', 'ILMN_1343295', 'ILMN_1343321',\n", " 'ILMN_1343339', 'ILMN_1343553', 'ILMN_1343567', 'ILMN_1343638',\n", " 'ILMN_1343668', 'ILMN_1343782', 'ILMN_1343835', 'ILMN_1343841',\n", " 'ILMN_1343872', 'ILMN_1343914', 'ILMN_1343977', 'ILMN_1344038',\n", " 'ILMN_1344055', 'ILMN_1344056', 'ILMN_1651199', 'ILMN_1651209'],\n", " dtype='object', name='ID')\n" ] } ], "source": [ "# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.\n", "gene_data = get_genetic_data(matrix_file)\n", "\n", "# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.\n", "print(gene_data.index[:20])\n" ] }, { "cell_type": "markdown", "id": "6fb3ffb2", "metadata": {}, "source": [ "### Step 4: Gene Identifier Review" ] }, { "cell_type": "code", "execution_count": 5, "id": "c0cfa5fc", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:48:45.985506Z", "iopub.status.busy": "2025-03-25T05:48:45.985383Z", "iopub.status.idle": "2025-03-25T05:48:45.987343Z", "shell.execute_reply": "2025-03-25T05:48:45.987014Z" } }, "outputs": [], "source": [ "# Looking at the gene identifiers, I notice they start with \"ILMN_\" which indicates they are Illumina \n", "# BeadArray probe IDs, not standard human gene symbols. These IDs need to be mapped to standard gene symbols\n", "# for proper analysis.\n", "\n", "requires_gene_mapping = True\n" ] }, { "cell_type": "markdown", "id": "3b7c8620", "metadata": {}, "source": [ "### Step 5: Gene Annotation" ] }, { "cell_type": "code", "execution_count": 6, "id": "d6f304de", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:48:45.988767Z", "iopub.status.busy": "2025-03-25T05:48:45.988661Z", "iopub.status.idle": "2025-03-25T05:48:50.761236Z", "shell.execute_reply": "2025-03-25T05:48:50.760593Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Gene annotation preview:\n", "{'ID': ['ILMN_1343061', 'ILMN_1343291', 'ILMN_1343295', 'ILMN_1343321', 'ILMN_1343339'], 'ARRAY_ADDRESS_ID': ['2900397', '3450719', '4490161', '5390750', '4780100'], 'TRANSCRIPT': ['ILMN_160461', 'ILMN_137991', 'ILMN_137405', 'ILMN_160027', 'ILMN_160401'], 'ILMN_GENE': ['CY3_HYB:HIGH_1_MM2', 'EEF1A1', 'GAPDH', 'NEGATIVE_0971', 'NEGATIVE_0953'], 'PA_Call': [1.0, 1.0, 1.0, 0.0, 0.0], 'TARGETID': ['CY3_HYB:HIGH_1_MM2', 'EEF1A1', 'GAPDH', 'NEGATIVE_0971', 'NEGATIVE_0953'], 'SPECIES': ['ILMN Controls', 'Homo sapiens', 'Homo sapiens', 'ILMN Controls', 'ILMN Controls'], 'SOURCE': ['ILMN_Controls', 'RefSeq', 'RefSeq', 'ILMN_Controls', 'ILMN_Controls'], 'SEARCH_KEY': ['cy3_hyb:high_1_mm2', 'NM_001402.4', nan, 'negative_0971', 'negative_0953'], 'SOURCE_REFERENCE_ID': ['cy3_hyb:high_1_mm2', 'NM_001402.4', 'NM_002046.2', 'negative_0971', 'negative_0953'], 'REFSEQ_ID': [nan, 'NM_001402.4', 'NM_002046.2', nan, nan], 'UNIGENE_ID': [nan, nan, nan, nan, nan], 'ENTREZ_GENE_ID': [nan, 1915.0, 2597.0, nan, nan], 'GI': [nan, 25453469.0, 7669491.0, nan, nan], 'ACCESSION': ['cy3_hyb:high_1_mm2', 'NM_001402.4', 'NM_002046.2', 'negative_0971', 'negative_0953'], 'SYMBOL': ['cy3_hyb:high_1_mm2', 'EEF1A1', 'GAPDH', 'negative_0971', 'negative_0953'], 'PROTEIN_PRODUCT': [nan, 'NP_001393.1', 'NP_002037.2', nan, nan], 'PROBE_TYPE': ['S', 'S', 'S', 'S', 'S'], 'PROBE_START': [1.0, 1293.0, 930.0, 1.0, 1.0], 'SEQUENCE': ['AATTAAAACGATGCACTCAGGGTTTAGCGCGTAGACGTATTGCATTATGC', 'TGTGTTGAGAGCTTCTCAGACTATCCACCTTTGGGTCGCTTTGCTGTTCG', 'CTTCAACAGCGACACCCACTCCTCCACCTTTGACGCTGGGGCTGGCATTG', 'TCCCTACTGTAAGCTGGAGGGTAGAATGGGGTCGACGGGGCGCTCTTAAT', 'ACGTGGCGGTGGTGTCCTTCGGTTTTAGTGCATCTCCGTCCTCTTCCCCT'], 'CHROMOSOME': [nan, '6', '12', nan, nan], 'PROBE_CHR_ORIENTATION': [nan, '-', '+', nan, nan], 'PROBE_COORDINATES': [nan, '74284362-74284378:74284474-74284506', '6517340-6517389', nan, nan], 'CYTOBAND': [nan, '6q13c', '12p13.31d', nan, nan], 'DEFINITION': [nan, 'Homo sapiens eukaryotic translation elongation factor 1 alpha 1 (EEF1A1)', 'Homo sapiens glyceraldehyde-3-phosphate dehydrogenase (GAPDH)', nan, nan], 'ONTOLOGY_COMPONENT': [nan, 'mRNA.', 'mRNA.', nan, nan], 'ONTOLOGY_PROCESS': [nan, 'All of the contents of a cell excluding the plasma membrane and nucleus', 'All of the contents of a cell excluding the plasma membrane and nucleus', nan, nan], 'ONTOLOGY_FUNCTION': [nan, 'but including other subcellular structures [goid 5737] [evidence NAS]', 'but including other subcellular structures [goid 5737] [evidence NAS]', nan, nan], 'SYNONYMS': [nan, 'The chemical reactions and pathways resulting in the formation of a protein. This is a ribosome-mediated process in which the information in messenger RNA (mRNA) is used to specify the sequence of amino acids in the protein [goid 6412] [evidence IEA]; The successive addition of amino acid residues to a nascent polypeptide chain during protein biosynthesis [goid 6414] [pmid 3570288] [evidence NAS]', 'The chemical reactions and pathways involving glucose', nan, nan], 'OBSOLETE_PROBE_ID': [nan, 'Interacting selectively with a nucleotide', 'the aldohexose gluco-hexose. D-glucose is dextrorotatory and is sometimes known as dextrose; it is an important source of energy for living organisms and is found free as well as combined in homo- and hetero-oligosaccharides and polysaccharides [goid 6006] [evidence IEA]; The chemical reactions and pathways resulting in the breakdown of a monosaccharide (generally glucose) into pyruvate', nan, nan], 'GB_ACC': [nan, 'NM_001402.4', 'NM_002046.2', nan, nan]}\n" ] } ], "source": [ "# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.\n", "gene_annotation = get_gene_annotation(soft_file)\n", "\n", "# 2. Use the 'preview_df' function from the library to preview the data and print out the results.\n", "print(\"Gene annotation preview:\")\n", "print(preview_df(gene_annotation))\n" ] }, { "cell_type": "markdown", "id": "c5af67f5", "metadata": {}, "source": [ "### Step 6: Gene Identifier Mapping" ] }, { "cell_type": "code", "execution_count": 7, "id": "960c855f", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:48:50.763142Z", "iopub.status.busy": "2025-03-25T05:48:50.763011Z", "iopub.status.idle": "2025-03-25T05:48:50.990872Z", "shell.execute_reply": "2025-03-25T05:48:50.990249Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Preview of gene mapping:\n", " ID Gene\n", "0 ILMN_1343061 cy3_hyb:high_1_mm2\n", "1 ILMN_1343291 EEF1A1\n", "2 ILMN_1343295 GAPDH\n", "3 ILMN_1343321 negative_0971\n", "4 ILMN_1343339 negative_0953\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "Preview of gene expression data after mapping:\n", " GSM4494979 GSM4494980 GSM4494981 GSM4494982 GSM4494983 GSM4494984 \\\n", "Gene \n", "A1BG -0.82 -1.04 -0.95 -0.94 -0.80 -0.71 \n", "A2BP1 -2.19 -2.08 -2.07 -2.37 -2.09 -2.28 \n", "A2LD1 0.15 0.12 0.18 -0.02 -0.01 0.00 \n", "A2M -0.53 -0.71 -0.50 -0.68 -0.59 -0.51 \n", "A2ML1 -0.58 -0.54 -0.54 -0.60 -0.42 -0.60 \n", "\n", " GSM4494985 GSM4494986 GSM4494987 GSM4494988 ... GSM4495021 \\\n", "Gene ... \n", "A1BG -0.82 -1.02 -0.65 -0.97 ... -0.91 \n", "A2BP1 -2.30 -2.37 -1.98 -2.41 ... -2.08 \n", "A2LD1 -0.15 -0.04 -0.34 0.01 ... -0.07 \n", "A2M -0.51 -0.58 -0.60 -0.49 ... -0.62 \n", "A2ML1 -0.71 -0.70 -0.65 -0.68 ... -0.67 \n", "\n", " GSM4495022 GSM4495023 GSM4495024 GSM4495025 GSM4495026 GSM4495027 \\\n", "Gene \n", "A1BG -0.61 -0.65 -0.93 -0.97 -0.85 -0.82 \n", "A2BP1 -2.02 -2.07 -2.20 -2.18 -2.13 -1.97 \n", "A2LD1 0.03 -0.29 0.01 0.03 0.03 0.15 \n", "A2M -0.54 -0.55 -0.53 -0.55 -0.46 -0.57 \n", "A2ML1 -0.69 -0.52 -0.63 -0.52 -0.64 -0.62 \n", "\n", " GSM4495028 GSM4495029 GSM4495030 \n", "Gene \n", "A1BG -0.75 -0.91 -0.78 \n", "A2BP1 -2.26 -2.44 -2.26 \n", "A2LD1 0.13 0.20 0.00 \n", "A2M -0.52 -0.55 -0.61 \n", "A2ML1 -0.62 -0.60 -0.58 \n", "\n", "[5 rows x 52 columns]\n" ] } ], "source": [ "# 1. After observing the gene expression data and gene annotation data:\n", "# - The gene expression data index contains identifiers like 'ILMN_1343061'\n", "# - In the gene annotation, 'ID' column has the same identifiers\n", "# - The 'SYMBOL' column contains the gene symbols we need to map to\n", "\n", "# 2. Create gene mapping dataframe using get_gene_mapping function\n", "gene_mapping = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='SYMBOL')\n", "\n", "# Display first few rows of the mapping\n", "print(\"Preview of gene mapping:\")\n", "print(gene_mapping.head())\n", "\n", "# 3. Apply gene mapping to convert probe-level measurements to gene-level expression\n", "# The apply_gene_mapping function handles the many-to-many relationship as specified\n", "gene_data = apply_gene_mapping(gene_data, gene_mapping)\n", "\n", "# Display the first few rows of the converted gene expression data\n", "print(\"\\nPreview of gene expression data after mapping:\")\n", "print(gene_data.head())\n" ] }, { "cell_type": "markdown", "id": "85254e4d", "metadata": {}, "source": [ "### Step 7: Data Normalization and Linking" ] }, { "cell_type": "code", "execution_count": 8, "id": "9688e4fb", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:48:50.992792Z", "iopub.status.busy": "2025-03-25T05:48:50.992650Z", "iopub.status.idle": "2025-03-25T05:48:51.488331Z", "shell.execute_reply": "2025-03-25T05:48:51.487697Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Normalized gene data saved to ../../output/preprocess/Hypertension/gene_data/GSE149256.csv\n", "Clinical data (age and gender only) saved to ../../output/preprocess/Hypertension/clinical_data/GSE149256.csv\n", "Abnormality detected in the cohort: GSE149256. Preprocessing failed.\n", "Dataset is not usable for hypertension-gene association studies as it doesn't contain trait information.\n" ] } ], "source": [ "# 1. Normalize the obtained gene data with the 'normalize_gene_symbols_in_index' function from the library.\n", "normalized_gene_data = normalize_gene_symbols_in_index(gene_data)\n", "os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)\n", "normalized_gene_data.to_csv(out_gene_data_file)\n", "print(f\"Normalized gene data saved to {out_gene_data_file}\")\n", "\n", "# 2. Since trait_row is None (hypertension data is not available), we can't extract clinical features\n", "# for our trait of interest. We'll still save age and gender if available.\n", "if trait_row is None:\n", " # Create a simple clinical dataframe with just age and gender if available\n", " feature_list = []\n", " \n", " if age_row is not None:\n", " age_data = get_feature_data(clinical_data, age_row, 'Age', convert_age)\n", " feature_list.append(age_data)\n", " if gender_row is not None:\n", " gender_data = get_feature_data(clinical_data, gender_row, 'Gender', convert_gender)\n", " feature_list.append(gender_data)\n", " \n", " if feature_list:\n", " selected_clinical_df = pd.concat(feature_list, axis=0)\n", " os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n", " selected_clinical_df.to_csv(out_clinical_data_file)\n", " print(f\"Clinical data (age and gender only) saved to {out_clinical_data_file}\")\n", " else:\n", " selected_clinical_df = pd.DataFrame()\n", " print(\"No clinical data available to save.\")\n", "else:\n", " # This branch would handle the case if trait data were available\n", " # but since trait_row is None, this code won't execute\n", " pass\n", "\n", "# 3. Since trait data is not available, we can't perform a trait-gene association\n", "# For validation purposes, create a valid DataFrame with the gene data\n", "df_for_validation = pd.DataFrame(index=normalized_gene_data.columns)\n", "# Add age and gender if available\n", "if 'Age' in locals() and 'age_data' in locals():\n", " df_for_validation['Age'] = age_data.iloc[0]\n", "if 'Gender' in locals() and 'gender_data' in locals():\n", " df_for_validation['Gender'] = gender_data.iloc[0]\n", "\n", "# Save information about why this dataset isn't usable\n", "note = \"Dataset from a study on poverty and gene expression in Baltimore. No hypertension trait information available.\"\n", "validate_and_save_cohort_info(\n", " is_final=True, \n", " cohort=cohort, \n", " info_path=json_path, \n", " is_gene_available=True, \n", " is_trait_available=False, \n", " is_biased=False, # Set to False as we can't determine bias without trait data\n", " df=df_for_validation, # Use a concrete DataFrame for validation\n", " note=note\n", ")\n", "\n", "print(\"Dataset is not usable for hypertension-gene association studies as it doesn't contain trait information.\")" ] } ], "metadata": { "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.16" } }, "nbformat": 4, "nbformat_minor": 5 }