{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "8e845772", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T04:04:52.571923Z", "iopub.status.busy": "2025-03-25T04:04:52.571453Z", "iopub.status.idle": "2025-03-25T04:04:52.736403Z", "shell.execute_reply": "2025-03-25T04:04:52.736025Z" } }, "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 = \"Stroke\"\n", "cohort = \"GSE38571\"\n", "\n", "# Input paths\n", "in_trait_dir = \"../../input/GEO/Stroke\"\n", "in_cohort_dir = \"../../input/GEO/Stroke/GSE38571\"\n", "\n", "# Output paths\n", "out_data_file = \"../../output/preprocess/Stroke/GSE38571.csv\"\n", "out_gene_data_file = \"../../output/preprocess/Stroke/gene_data/GSE38571.csv\"\n", "out_clinical_data_file = \"../../output/preprocess/Stroke/clinical_data/GSE38571.csv\"\n", "json_path = \"../../output/preprocess/Stroke/cohort_info.json\"\n" ] }, { "cell_type": "markdown", "id": "3b8e60e6", "metadata": {}, "source": [ "### Step 1: Initial Data Loading" ] }, { "cell_type": "code", "execution_count": 2, "id": "b7faa64e", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T04:04:52.737927Z", "iopub.status.busy": "2025-03-25T04:04:52.737777Z", "iopub.status.idle": "2025-03-25T04:04:52.838158Z", "shell.execute_reply": "2025-03-25T04:04:52.837818Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Background Information:\n", "!Series_title\t\"Integrated transcriptomic and epigenomic analysis of primary human lung cell differentiation\"\n", "!Series_summary\t\"This SuperSeries is composed of the SubSeries listed below.\"\n", "!Series_overall_design\t\"Refer to individual Series\"\n", "Sample Characteristics Dictionary:\n", "{0: ['time: D6', 'time: D4', 'time: D0', 'time: D2', 'time: D8'], 1: ['cell type: AT cell', 'cell type: AT cell (AT2)', 'cell type: AT cell (AT1-like)'], 2: ['Sex: female'], 3: ['age (y): 49', 'age (y): 61', 'age (y): 66'], 4: ['smoker: non-smoker'], 5: ['cod: Anoxia', 'cod: CVA-Stroke', 'cod: ICH-Stroke']}\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": "87258f54", "metadata": {}, "source": [ "### Step 2: Dataset Analysis and Clinical Feature Extraction" ] }, { "cell_type": "code", "execution_count": 3, "id": "61e551a1", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T04:04:52.839179Z", "iopub.status.busy": "2025-03-25T04:04:52.839065Z", "iopub.status.idle": "2025-03-25T04:04:52.846212Z", "shell.execute_reply": "2025-03-25T04:04:52.845893Z" } }, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# 1. Gene Expression Data Availability\n", "# Based on the background information, this dataset is about cell differentiation\n", "# and includes transcriptomic analysis, which indicates gene expression data is available\n", "is_gene_available = True\n", "\n", "# 2. Variable Availability and Data Type Conversion\n", "# 2.1 Data Availability\n", "# Looking at the sample characteristics dictionary\n", "# No direct mention of stroke in the dictionary, but we may need to infer it\n", "# Time and cell type information is available, but no direct stroke information\n", "trait_row = None # Stroke data is not available in this dataset\n", "\n", "# Age information is not present in the sample characteristics\n", "age_row = None\n", "\n", "# Gender is available at key 2, but it shows only \"Sex: male\" which indicates a constant value\n", "gender_row = None # Although gender is mentioned, it's constant (only male)\n", "\n", "# 2.2 Data Type Conversion Functions\n", "# Since trait data is not available, we still define a conversion function for completeness\n", "def convert_trait(value):\n", " if value is None:\n", " return None\n", " value = value.lower() if isinstance(value, str) else str(value).lower()\n", " # Extract value after colon if present\n", " if ':' in value:\n", " value = value.split(':', 1)[1].strip()\n", " \n", " # Binary conversion for stroke status\n", " if 'stroke' in value or 'case' in value:\n", " return 1\n", " elif 'control' in value or 'healthy' in value or 'normal' in value:\n", " return 0\n", " return None\n", "\n", "# Age conversion function - not needed but defined for completeness\n", "def convert_age(value):\n", " if value is None:\n", " return None\n", " value = value.lower() if isinstance(value, str) else str(value).lower()\n", " # Extract value after colon if present\n", " if ':' in value:\n", " value = value.split(':', 1)[1].strip()\n", " \n", " try:\n", " # Try to convert to float for continuous age\n", " return float(value)\n", " except:\n", " return None\n", "\n", "# Gender conversion function - not needed but defined for completeness\n", "def convert_gender(value):\n", " if value is None:\n", " return None\n", " value = value.lower() if isinstance(value, str) else str(value).lower()\n", " # Extract value after colon if present\n", " if ':' in value:\n", " value = value.split(':', 1)[1].strip()\n", " \n", " # Binary conversion for gender\n", " if 'female' in value or 'f' in value:\n", " return 0\n", " elif 'male' in value or 'm' in value:\n", " return 1\n", " return None\n", "\n", "# 3. Save Metadata\n", "# Determine trait data availability (is_trait_available)\n", "is_trait_available = trait_row is not None\n", "\n", "# Validate and save cohort information - initial filtering\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\n", "# Since trait_row is None, skip this substep\n" ] }, { "cell_type": "markdown", "id": "afae402d", "metadata": {}, "source": [ "### Step 3: Gene Data Extraction" ] }, { "cell_type": "code", "execution_count": 4, "id": "ca22be55", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T04:04:52.847237Z", "iopub.status.busy": "2025-03-25T04:04:52.847126Z", "iopub.status.idle": "2025-03-25T04:04:52.951288Z", "shell.execute_reply": "2025-03-25T04:04:52.950915Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Matrix file found: ../../input/GEO/Stroke/GSE38571/GSE38571-GPL10558_series_matrix.txt.gz\n", "Gene data shape: (47231, 17)\n", "First 20 gene/probe identifiers:\n", "Index(['ILMN_1343291', 'ILMN_1343295', 'ILMN_1651199', 'ILMN_1651209',\n", " 'ILMN_1651210', 'ILMN_1651221', 'ILMN_1651228', 'ILMN_1651229',\n", " 'ILMN_1651230', 'ILMN_1651232', 'ILMN_1651235', 'ILMN_1651236',\n", " 'ILMN_1651237', 'ILMN_1651238', 'ILMN_1651249', 'ILMN_1651253',\n", " 'ILMN_1651254', 'ILMN_1651259', 'ILMN_1651260', 'ILMN_1651262'],\n", " dtype='object', name='ID')\n" ] } ], "source": [ "# 1. Get the SOFT and matrix file paths again \n", "soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n", "print(f\"Matrix file found: {matrix_file}\")\n", "\n", "# 2. Use the get_genetic_data function from the library to get the gene_data\n", "try:\n", " gene_data = get_genetic_data(matrix_file)\n", " print(f\"Gene data shape: {gene_data.shape}\")\n", " \n", " # 3. Print the first 20 row IDs (gene or probe identifiers)\n", " print(\"First 20 gene/probe identifiers:\")\n", " print(gene_data.index[:20])\n", "except Exception as e:\n", " print(f\"Error extracting gene data: {e}\")\n" ] }, { "cell_type": "markdown", "id": "1e7dc03e", "metadata": {}, "source": [ "### Step 4: Gene Identifier Review" ] }, { "cell_type": "code", "execution_count": 5, "id": "9480869f", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T04:04:52.952615Z", "iopub.status.busy": "2025-03-25T04:04:52.952494Z", "iopub.status.idle": "2025-03-25T04:04:52.954426Z", "shell.execute_reply": "2025-03-25T04:04:52.954108Z" } }, "outputs": [], "source": [ "# These identifiers are Illumina probe IDs (starting with ILMN_), not human gene symbols\n", "# They need to be mapped to standard gene symbols for analysis\n", "\n", "requires_gene_mapping = True\n" ] }, { "cell_type": "markdown", "id": "d475f026", "metadata": {}, "source": [ "### Step 5: Gene Annotation" ] }, { "cell_type": "code", "execution_count": 6, "id": "fc202899", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T04:04:52.955601Z", "iopub.status.busy": "2025-03-25T04:04:52.955492Z", "iopub.status.idle": "2025-03-25T04:04:56.140241Z", "shell.execute_reply": "2025-03-25T04:04:56.139817Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Gene annotation preview:\n", "Columns in gene annotation: ['ID', 'Species', 'Source', 'Search_Key', 'Transcript', 'ILMN_Gene', 'Source_Reference_ID', 'RefSeq_ID', 'Unigene_ID', 'Entrez_Gene_ID', 'GI', 'Accession', 'Symbol', 'Protein_Product', 'Array_Address_Id', 'Probe_Type', 'Probe_Start', 'SEQUENCE', 'Chromosome', 'Probe_Chr_Orientation', 'Probe_Coordinates', 'Definition', 'Ontology_Component', 'Ontology_Process', 'Ontology_Function', 'Synonyms', 'GB_ACC', 'SPOT_ID']\n", "{'ID': ['ILMN_1356720', 'ILMN_1355539', 'ILMN_1365415', 'ILMN_1373448', 'ILMN_1353631'], 'Species': ['Rattus norvegicus', 'Rattus norvegicus', 'Rattus norvegicus', 'Rattus norvegicus', 'Rattus norvegicus'], 'Source': ['RefSeq', 'RefSeq', 'RefSeq', 'RefSeq', 'RefSeq'], 'Search_Key': ['GI_62644958-S', 'GI_62643181-S', 'GI_20301967-S', 'GI_62647669-S', 'GI_62658996-S'], 'Transcript': ['ILMN_57573', 'ILMN_58017', 'ILMN_297955', 'ILMN_54533', 'ILMN_289444'], 'ILMN_Gene': ['LOC499782', 'LOC502515', 'PRSS8', 'WBP1', 'COX6A1'], 'Source_Reference_ID': ['XM_575115.1', 'XM_577999.1', 'NM_138836.1', 'XM_216198.4', 'NM_012814.1'], 'RefSeq_ID': ['XM_575115.1', 'XM_577999.1', 'NM_138836.1', 'XM_216198.4', 'NM_012814.1'], 'Unigene_ID': [nan, nan, nan, nan, nan], 'Entrez_Gene_ID': [499782.0, 502515.0, 192107.0, 297381.0, 25282.0], 'GI': [62644958.0, 62643181.0, 20301967.0, 109472229.0, 77736543.0], 'Accession': ['XM_575115.1', 'XM_577999.1', 'NM_138836.1', 'XM_216198.4', 'NM_012814.1'], 'Symbol': ['LOC499782', 'LOC502515', 'Prss8', 'Wbp1', 'Cox6a1'], 'Protein_Product': ['XP_575115.1', 'XP_577999.1', 'NP_620191.1', 'XP_216198.3', 'NP_036946.1'], 'Array_Address_Id': [1570300.0, 6840575.0, 4200670.0, 6620576.0, 730300.0], 'Probe_Type': ['S', 'S', 'S', 'S', 'S'], 'Probe_Start': [167.0, 4804.0, 2079.0, 1750.0, 393.0], 'SEQUENCE': ['GAGAGTTGAGCTTTTCGGCCTATATCCGGCGTGGGCGGAGCAACATCCGT', 'CACACTGCCTGGAGGGGGACAGGAAGATTGAACTGGACATCCTGGTGATG', 'GGTTTCACCTTCACGGGATGAGAACAAAAGGGAGCTTTGGACCTGGGGGG', 'TAGTCAAGGAGCTGAGGGCTAGTGCCACCCAACCAGACCTGGAGGACCAT', 'CCACAGCACTGATTTGGACCCTGACTCTTGTGTGTGGACCACGAAAGCCC'], 'Chromosome': ['3', '2', '1', '4', '12'], 'Probe_Chr_Orientation': ['+', '+', '-', '-', '+'], 'Probe_Coordinates': ['11951869-11951918', '79187406-79187455', '187210635-187210684', '117331447-117331496', '42532988-42533037'], 'Definition': ['PREDICTED: Rattus norvegicus similar to 60S ribosomal protein L12 (LOC499782), mRNA.', 'PREDICTED: Rattus norvegicus similar to AFL095Wp (LOC502515), mRNA.', 'Rattus norvegicus protease, serine, 8 (prostasin) (Prss8), mRNA.', 'PREDICTED: Rattus norvegicus WW domain binding protein 1 (Wbp1), mRNA.', 'Rattus norvegicus cytochrome c oxidase, subunit VIa, polypeptide 1 (Cox6a1), mRNA.'], 'Ontology_Component': [nan, nan, 'integral to membrane [goid 16021] [evidence IEA]; extracellular space [goid 5615] [evidence IEA]', nan, 'membrane [goid 16020] [evidence IEA]; mitochondrion [goid 5739] [evidence IEA]; integral to membrane [goid 16021] [evidence IEA]'], 'Ontology_Process': [nan, nan, nan, nan, 'electron transport [goid 6118] [evidence ISS]'], 'Ontology_Function': [nan, nan, 'serine-type endopeptidase activity [goid 4252] [evidence IEA]; serine-type peptidase activity [goid 8236] [pmid 11373334] [evidence IMP]; hydrolase activity [goid 16787] [evidence IEA]; trypsin activity [goid 4295] [evidence IEA]; chymotrypsin activity [goid 4263] [evidence IEA]; peptidase activity [goid 8233] [evidence IEA]', nan, 'oxidoreductase activity [goid 16491] [evidence IEA]; cytochrome-c oxidase activity [goid 4129] [evidence ISS]'], 'Synonyms': [nan, nan, nan, nan, 'COX6AL'], 'GB_ACC': ['XM_575115.1', 'XM_577999.1', 'NM_138836.1', 'XM_216198.4', 'NM_012814.1'], 'SPOT_ID': [nan, nan, nan, nan, nan]}\n", "\n", "Searching for platform information in SOFT file:\n", "!Series_platform_id = GPL6101\n", "\n", "Searching for gene symbol information in SOFT file:\n", "Found references to gene symbols:\n", "#ILMN_Gene = Internal gene symbol\n", "#Symbol = Gene symbol from the source database\n", "#Synonyms = Gene symbol synonyms from Refseq\n", "ID\tSpecies\tSource\tSearch_Key\tTranscript\tILMN_Gene\tSource_Reference_ID\tRefSeq_ID\tUnigene_ID\tEntrez_Gene_ID\tGI\tAccession\tSymbol\tProtein_Product\tArray_Address_Id\tProbe_Type\tProbe_Start\tSEQUENCE\tChromosome\tProbe_Chr_Orientation\tProbe_Coordinates\tDefinition\tOntology_Component\tOntology_Process\tOntology_Function\tSynonyms\tGB_ACC\tSPOT_ID\n", "\n", "Checking for additional annotation files in the directory:\n", "['GSE38571-GPL10558_series_matrix.txt.gz', 'GSE38571-GPL6101_series_matrix.txt.gz']\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. Analyze the gene annotation dataframe to identify which columns contain the gene identifiers and gene symbols\n", "print(\"\\nGene annotation preview:\")\n", "print(f\"Columns in gene annotation: {gene_annotation.columns.tolist()}\")\n", "print(preview_df(gene_annotation, n=5))\n", "\n", "# Let's look for platform information in the SOFT file to understand the annotation better\n", "print(\"\\nSearching for platform information in SOFT file:\")\n", "with gzip.open(soft_file, 'rt') as f:\n", " for i, line in enumerate(f):\n", " if '!Series_platform_id' in line:\n", " print(line.strip())\n", " break\n", " if i > 100: # Limit search to first 100 lines\n", " print(\"Platform ID not found in first 100 lines\")\n", " break\n", "\n", "# Check if the SOFT file includes any reference to gene symbols\n", "print(\"\\nSearching for gene symbol information in SOFT file:\")\n", "with gzip.open(soft_file, 'rt') as f:\n", " gene_symbol_lines = []\n", " for i, line in enumerate(f):\n", " if 'GENE_SYMBOL' in line or 'gene_symbol' in line.lower() or 'symbol' in line.lower():\n", " gene_symbol_lines.append(line.strip())\n", " if i > 1000 and len(gene_symbol_lines) > 0: # Limit search but ensure we found something\n", " break\n", " \n", " if gene_symbol_lines:\n", " print(\"Found references to gene symbols:\")\n", " for line in gene_symbol_lines[:5]: # Show just first 5 matches\n", " print(line)\n", " else:\n", " print(\"No explicit gene symbol references found in first 1000 lines\")\n", "\n", "# Look for alternative annotation files or references in the directory\n", "print(\"\\nChecking for additional annotation files in the directory:\")\n", "all_files = os.listdir(in_cohort_dir)\n", "print([f for f in all_files if 'annotation' in f.lower() or 'platform' in f.lower() or 'gpl' in f.lower()])\n" ] }, { "cell_type": "markdown", "id": "7472dcd8", "metadata": {}, "source": [ "### Step 6: Gene Identifier Mapping" ] }, { "cell_type": "code", "execution_count": 7, "id": "bbbfb4f3", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T04:04:56.141459Z", "iopub.status.busy": "2025-03-25T04:04:56.141347Z", "iopub.status.idle": "2025-03-25T04:04:56.210212Z", "shell.execute_reply": "2025-03-25T04:04:56.209718Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Gene mapping dataframe shape: (23190, 2)\n", "Gene mapping preview:\n", " ID Gene\n", "0 ILMN_1356720 LOC499782\n", "1 ILMN_1355539 LOC502515\n", "2 ILMN_1365415 Prss8\n", "3 ILMN_1373448 Wbp1\n", "4 ILMN_1353631 Cox6a1\n", "Number of probes with gene symbol mapping: 23190\n", "Gene expression data shape after mapping: (0, 17)\n", "First few gene symbols:\n", "Index([], dtype='object', name='Gene')\n", "Gene expression data saved to ../../output/preprocess/Stroke/gene_data/GSE38571.csv\n", "\n", "Note: This dataset (GSE38571) contains rat gene expression data, not human data.\n", "This is not suitable for human stroke studies.\n" ] } ], "source": [ "# 1. Identify the columns in gene_annotation that store probe IDs and gene symbols\n", "# From the previous output, we can see:\n", "# - 'ID' column contains the Illumina probe IDs (e.g., ILMN_1356720)\n", "# - 'Symbol' column contains the gene symbols (e.g., LOC499782, Prss8, Cox6a1)\n", "\n", "# However, there's an important observation - the species is \"Rattus norvegicus\" (rat)\n", "# rather than human, so we need to be careful about interpreting these results\n", "\n", "# 2. Get a gene mapping dataframe by extracting probe IDs and gene symbols\n", "mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='Symbol')\n", "print(f\"Gene mapping dataframe shape: {mapping_df.shape}\")\n", "print(\"Gene mapping preview:\")\n", "print(mapping_df.head())\n", "\n", "# Check how many probes map to genes (non-empty mapping)\n", "print(f\"Number of probes with gene symbol mapping: {len(mapping_df)}\")\n", "\n", "# 3. Convert probe-level measurements to gene expression data\n", "gene_data = apply_gene_mapping(gene_data, mapping_df)\n", "print(f\"Gene expression data shape after mapping: {gene_data.shape}\")\n", "print(\"First few gene symbols:\")\n", "print(gene_data.index[:10])\n", "\n", "# Save the processed gene data\n", "os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)\n", "gene_data.to_csv(out_gene_data_file)\n", "print(f\"Gene expression data saved to {out_gene_data_file}\")\n", "\n", "# Set final metadata and conclude\n", "print(\"\\nNote: This dataset (GSE38571) contains rat gene expression data, not human data.\")\n", "print(\"This is not suitable for human stroke studies.\")\n" ] }, { "cell_type": "markdown", "id": "92c7c55a", "metadata": {}, "source": [ "### Step 7: Data Normalization and Linking" ] }, { "cell_type": "code", "execution_count": 8, "id": "98fe5fc4", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T04:04:56.211668Z", "iopub.status.busy": "2025-03-25T04:04:56.211556Z", "iopub.status.idle": "2025-03-25T04:04:56.272628Z", "shell.execute_reply": "2025-03-25T04:04:56.272086Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Original gene data shape: (0, 17)\n", "Gene data shape after normalization: (0, 17)\n", "Normalized gene expression data saved to ../../output/preprocess/Stroke/gene_data/GSE38571.csv\n", "No trait data available. Can't proceed with linking clinical and genetic data.\n", "Abnormality detected in the cohort: GSE38571. Preprocessing failed.\n", "Dataset deemed not usable due to missing trait data.\n" ] } ], "source": [ "# 1. Normalize gene symbols in the obtained gene expression data\n", "# Use the gene_data variable that was already loaded in Step 4\n", "print(f\"Original gene data shape: {gene_data.shape}\")\n", "\n", "# Normalize gene symbols\n", "gene_data_normalized = normalize_gene_symbols_in_index(gene_data)\n", "print(f\"Gene data shape after normalization: {gene_data_normalized.shape}\")\n", "\n", "# Save the normalized gene expression data\n", "os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)\n", "gene_data_normalized.to_csv(out_gene_data_file)\n", "print(f\"Normalized gene expression data saved to {out_gene_data_file}\")\n", "\n", "# 2. No clinical data available (trait_row is None from previous steps)\n", "# We can't proceed with linking clinical and genetic data\n", "print(\"No trait data available. Can't proceed with linking clinical and genetic data.\")\n", "\n", "# Create a minimal dataframe for validation purposes \n", "# (since we need a valid DataFrame when is_final=True)\n", "empty_df = pd.DataFrame({\"dummy\": [0]})\n", "\n", "# Since trait data is not available, the dataset is not usable for our purposes\n", "# We pass is_biased=True to indicate unusable data\n", "is_usable = 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=True, # Setting is_biased to True since missing trait data makes dataset unusable\n", " df=empty_df,\n", " note=\"No stroke-specific trait data available in this dataset. Contains gene expression data from peripheral blood of older adults, but without clear stroke indicators.\"\n", ")\n", "print(\"Dataset deemed not usable due to missing trait data.\")" ] } ], "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 }