{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "75baecd1", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:11:48.036570Z", "iopub.status.busy": "2025-03-25T05:11:48.036412Z", "iopub.status.idle": "2025-03-25T05:11:48.203876Z", "shell.execute_reply": "2025-03-25T05:11:48.203558Z" } }, "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 = \"Esophageal_Cancer\"\n", "cohort = \"GSE100843\"\n", "\n", "# Input paths\n", "in_trait_dir = \"../../input/GEO/Esophageal_Cancer\"\n", "in_cohort_dir = \"../../input/GEO/Esophageal_Cancer/GSE100843\"\n", "\n", "# Output paths\n", "out_data_file = \"../../output/preprocess/Esophageal_Cancer/GSE100843.csv\"\n", "out_gene_data_file = \"../../output/preprocess/Esophageal_Cancer/gene_data/GSE100843.csv\"\n", "out_clinical_data_file = \"../../output/preprocess/Esophageal_Cancer/clinical_data/GSE100843.csv\"\n", "json_path = \"../../output/preprocess/Esophageal_Cancer/cohort_info.json\"\n" ] }, { "cell_type": "markdown", "id": "7bcd8d54", "metadata": {}, "source": [ "### Step 1: Initial Data Loading" ] }, { "cell_type": "code", "execution_count": 2, "id": "b4318991", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:11:48.205528Z", "iopub.status.busy": "2025-03-25T05:11:48.205358Z", "iopub.status.idle": "2025-03-25T05:11:48.381110Z", "shell.execute_reply": "2025-03-25T05:11:48.380751Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Background Information:\n", "!Series_title\t\"Expression data from nonrandomized trial of vitamin D in Barrett's esophagus\"\n", "!Series_summary\t\"Vitamin D deficiency has been associated with increased esophageal cancer risk. Vitamin D controls many downstream regulators of cellular processes including proliferation, apoptosis, and differentiation. We evaluated the effects of vitamin D supplementation on global gene expression in patients with Barrett's esophagus.\"\n", "!Series_summary\t\"We used microarrays to assess global gene expression in Barrett's esophagus patients who received vitamin D supplementation.\"\n", "!Series_overall_design\t\"Patients in Arm A with Barrett's esophagus with high grade dysplasia were given vitamin D3 50,000 IU weekly for 2 weeks. Patients in Arm B with Barrett's esophagus with low grade dysplasia or no dysplasia were given vitamin D3 50,000 IU weekly for 12 weeks. In both arms, biopsies were obtained from two sites: Barrett's esophagus segment (IM) and normal squamous mucosa (NSQ) proximal to the segment at 2 timepoints: before (T0) and after (T1) vitamin D supplementation.\"\n", "Sample Characteristics Dictionary:\n", "{0: [\"tissue: Barrett's esophagus segment\", 'tissue: Normal esophageal squamous mucosa'], 1: ['arm: Arm A', 'arm: Arm B'], 2: ['timepoint (t0=before, t1=after): T0', 'timepoint (t0=before, t1=after): T1']}\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": "fdb4d07a", "metadata": {}, "source": [ "### Step 2: Dataset Analysis and Clinical Feature Extraction" ] }, { "cell_type": "code", "execution_count": 3, "id": "28e84f9d", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:11:48.382800Z", "iopub.status.busy": "2025-03-25T05:11:48.382664Z", "iopub.status.idle": "2025-03-25T05:11:48.391124Z", "shell.execute_reply": "2025-03-25T05:11:48.390804Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Preview of extracted clinical data:\n", "{0: [1.0], 1: [nan], 2: [nan]}\n", "Clinical data saved to ../../output/preprocess/Esophageal_Cancer/clinical_data/GSE100843.csv\n" ] } ], "source": [ "import os\n", "import json\n", "import pandas as pd\n", "from typing import Callable, Optional, Dict, Any\n", "\n", "# Step 1: Determine gene expression data availability\n", "# From the background information, we can see they used microarrays for gene expression in Barrett's esophagus patients\n", "is_gene_available = True # Microarray data typically contains gene expression data\n", "\n", "# Step 2: Identify row numbers for trait, age, and gender\n", "# From sample characteristics, we see information about tissue, arm, and timepoint\n", "\n", "# For trait data, we can use the 'tissue' information as it tells us whether it's Barrett's esophagus or normal tissue\n", "trait_row = 0 # The tissue information is in row 0\n", "\n", "# Age and gender are not available in the sample characteristics\n", "age_row = None\n", "gender_row = None\n", "\n", "# Step 2.2: Define conversion functions\n", "def convert_trait(value_str):\n", " \"\"\"Convert tissue information to binary trait value (1 for Barrett's esophagus, 0 for normal)\"\"\"\n", " if not isinstance(value_str, str):\n", " return None\n", " \n", " # Extract the value after the colon\n", " if \":\" in value_str:\n", " value = value_str.split(\":\", 1)[1].strip()\n", " else:\n", " value = value_str.strip()\n", " \n", " if \"Barrett's esophagus\" in value:\n", " return 1 # Barrett's esophagus (pathological condition)\n", " elif \"Normal\" in value:\n", " return 0 # Normal esophageal squamous mucosa\n", " else:\n", " return None\n", "\n", "def convert_age(value_str):\n", " \"\"\"Placeholder function as age data is not available\"\"\"\n", " return None\n", "\n", "def convert_gender(value_str):\n", " \"\"\"Placeholder function as gender data is not available\"\"\"\n", " return None\n", "\n", "# Step 3: Save metadata about dataset usability\n", "is_trait_available = trait_row is not None\n", "\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", "# Step 4: Extract clinical features if trait_row is not None\n", "if trait_row is not None:\n", " # Create a DataFrame from the sample characteristics dictionary provided in the previous step\n", " # The dictionary has row numbers as keys and lists of characteristic values as values\n", " sample_chars = {\n", " 0: [\"tissue: Barrett's esophagus segment\", 'tissue: Normal esophageal squamous mucosa'], \n", " 1: ['arm: Arm A', 'arm: Arm B'], \n", " 2: ['timepoint (t0=before, t1=after): T0', 'timepoint (t0=before, t1=after): T1']\n", " }\n", " \n", " try:\n", " # Convert the dictionary to a format suitable for geo_select_clinical_features\n", " # Each row in the dictionary becomes a column in the DataFrame\n", " clinical_data = pd.DataFrame()\n", " for key, values in sample_chars.items():\n", " # Create a series for each characteristic\n", " clinical_data[key] = values\n", " \n", " # Extract clinical features using the library function\n", " selected_clinical_df = geo_select_clinical_features(\n", " clinical_df=clinical_data,\n", " trait=trait,\n", " trait_row=trait_row,\n", " convert_trait=convert_trait,\n", " age_row=age_row,\n", " convert_age=convert_age,\n", " gender_row=gender_row,\n", " convert_gender=convert_gender\n", " )\n", " \n", " # Preview the extracted clinical data\n", " preview = preview_df(selected_clinical_df)\n", " print(\"Preview of extracted clinical data:\")\n", " print(preview)\n", " \n", " # Create the output directory if it doesn't exist\n", " os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n", " \n", " # Save the extracted clinical data\n", " selected_clinical_df.to_csv(out_clinical_data_file, index=False)\n", " print(f\"Clinical data saved to {out_clinical_data_file}\")\n", " except Exception as e:\n", " print(f\"Error processing clinical data: {e}\")\n", "else:\n", " print(\"Trait data is not available. Skipping clinical feature extraction.\")\n" ] }, { "cell_type": "markdown", "id": "c391cb49", "metadata": {}, "source": [ "### Step 3: Gene Data Extraction" ] }, { "cell_type": "code", "execution_count": 4, "id": "512051be", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:11:48.392090Z", "iopub.status.busy": "2025-03-25T05:11:48.391973Z", "iopub.status.idle": "2025-03-25T05:11:48.660025Z", "shell.execute_reply": "2025-03-25T05:11:48.659630Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Found data marker at line 64\n", "Header line: \"ID_REF\"\t\"GSM2694849\"\t\"GSM2694850\"\t\"GSM2694851\"\t\"GSM2694852\"\t\"GSM2694853\"\t\"GSM2694854\"\t\"GSM2694855\"\t\"GSM2694856\"\t\"GSM2694857\"\t\"GSM2694858\"\t\"GSM2694859\"\t\"GSM2694860\"\t\"GSM2694861\"\t\"GSM2694862\"\t\"GSM2694863\"\t\"GSM2694864\"\t\"GSM2694865\"\t\"GSM2694866\"\t\"GSM2694867\"\t\"GSM2694868\"\t\"GSM2694869\"\t\"GSM2694870\"\t\"GSM2694871\"\t\"GSM2694872\"\t\"GSM2694873\"\t\"GSM2694874\"\t\"GSM2694875\"\t\"GSM2694876\"\t\"GSM2694877\"\t\"GSM2694878\"\t\"GSM2694879\"\t\"GSM2694880\"\t\"GSM2694881\"\t\"GSM2694882\"\t\"GSM2694883\"\t\"GSM2694884\"\t\"GSM2694885\"\t\"GSM2694886\"\t\"GSM2694887\"\t\"GSM2694888\"\t\"GSM2694889\"\t\"GSM2694890\"\t\"GSM2694891\"\t\"GSM2694892\"\t\"GSM2694893\"\t\"GSM2694894\"\t\"GSM2694895\"\t\"GSM2694896\"\t\"GSM2694897\"\t\"GSM2694898\"\t\"GSM2694899\"\t\"GSM2694900\"\t\"GSM2694901\"\t\"GSM2694902\"\t\"GSM2694903\"\t\"GSM2694904\"\t\"GSM2694905\"\t\"GSM2694906\"\t\"GSM2694907\"\t\"GSM2694908\"\t\"GSM2694909\"\t\"GSM2694910\"\t\"GSM2694911\"\t\"GSM2694912\"\t\"GSM2694913\"\t\"GSM2694914\"\t\"GSM2694915\"\t\"GSM2694916\"\t\"GSM2694917\"\t\"GSM2694918\"\t\"GSM2694919\"\t\"GSM2694920\"\t\"GSM2694921\"\t\"GSM2694922\"\t\"GSM2694923\"\t\"GSM2694924\"\n", "First data line: 7892501\t3.398631627\t3.464622982\t3.819329576\t3.54726664\t4.372728292\t4.005182731\t3.580611758\t3.484274002\t3.572563019\t3.853759137\t3.834269525\t3.771435235\t3.701265409\t3.775290851\t3.763615815\t3.652581476\t3.390109976\t3.877028066\t3.268195599\t3.838363704\t3.496450436\t4.038807869\t3.595268513\t3.888283129\t3.620973485\t4.092445818\t3.58034849\t3.704407231\t3.483703072\t3.618764668\t3.628694828\t3.696671085\t3.647390352\t3.815859698\t4.101673355\t4.250557122\t3.820872572\t3.976187922\t3.741956394\t3.786392705\t3.807877935\t3.813879653\t3.809149694\t3.540056077\t5.032102133\t3.596134785\t3.803431585\t3.490813012\t3.790779436\t3.527891225\t3.783955866\t3.434754273\t3.610670242\t3.8805058\t4.387400737\t3.500280421\t3.629632304\t3.922236418\t4.425519645\t3.634407255\t4.405922522\t3.815022062\t3.46131541\t3.443781463\t3.543499136\t3.654112146\t3.557347223\t4.058295293\t3.608630365\t4.710210221\t3.847579291\t3.856559436\t3.716984817\t3.80231157\t3.917799135\t3.59612307\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Index(['7892501', '7892502', '7892503', '7892504', '7892505', '7892506',\n", " '7892507', '7892508', '7892509', '7892510', '7892511', '7892512',\n", " '7892513', '7892514', '7892515', '7892516', '7892517', '7892518',\n", " '7892519', '7892520'],\n", " dtype='object', name='ID')\n" ] } ], "source": [ "# 1. Get the file paths for the SOFT file and matrix file\n", "soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n", "\n", "# 2. First, let's examine the structure of the matrix file to understand its format\n", "import gzip\n", "\n", "# Peek at the first few lines of the file to understand its structure\n", "with gzip.open(matrix_file, 'rt') as file:\n", " # Read first 100 lines to find the header structure\n", " for i, line in enumerate(file):\n", " if '!series_matrix_table_begin' in line:\n", " print(f\"Found data marker at line {i}\")\n", " # Read the next line which should be the header\n", " header_line = next(file)\n", " print(f\"Header line: {header_line.strip()}\")\n", " # And the first data line\n", " first_data_line = next(file)\n", " print(f\"First data line: {first_data_line.strip()}\")\n", " break\n", " if i > 100: # Limit search to first 100 lines\n", " print(\"Matrix table marker not found in first 100 lines\")\n", " break\n", "\n", "# 3. Now try to get the genetic data with better error handling\n", "try:\n", " gene_data = get_genetic_data(matrix_file)\n", " print(gene_data.index[:20])\n", "except KeyError as e:\n", " print(f\"KeyError: {e}\")\n", " \n", " # Alternative approach: manually extract the data\n", " print(\"\\nTrying alternative approach to read the gene data:\")\n", " with gzip.open(matrix_file, 'rt') as file:\n", " # Find the start of the data\n", " for line in file:\n", " if '!series_matrix_table_begin' in line:\n", " break\n", " \n", " # Read the headers and data\n", " import pandas as pd\n", " df = pd.read_csv(file, sep='\\t', index_col=0)\n", " print(f\"Column names: {df.columns[:5]}\")\n", " print(f\"First 20 row IDs: {df.index[:20]}\")\n", " gene_data = df\n" ] }, { "cell_type": "markdown", "id": "8d2550fe", "metadata": {}, "source": [ "### Step 4: Gene Identifier Review" ] }, { "cell_type": "code", "execution_count": 5, "id": "a7348a65", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:11:48.661846Z", "iopub.status.busy": "2025-03-25T05:11:48.661720Z", "iopub.status.idle": "2025-03-25T05:11:48.663668Z", "shell.execute_reply": "2025-03-25T05:11:48.663374Z" } }, "outputs": [], "source": [ "# Examine the identifiers in the gene expression data\n", "# Based on the preview, we see identifiers like 7892501, 7892502, etc.\n", "# These are numeric identifiers, not standard human gene symbols (which would be like BRCA1, TP53, etc.)\n", "# These appear to be probe IDs from a microarray platform that need to be mapped to gene symbols\n", "\n", "requires_gene_mapping = True\n" ] }, { "cell_type": "markdown", "id": "846b467e", "metadata": {}, "source": [ "### Step 5: Gene Annotation" ] }, { "cell_type": "code", "execution_count": 6, "id": "5fce5b82", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:11:48.665461Z", "iopub.status.busy": "2025-03-25T05:11:48.665326Z", "iopub.status.idle": "2025-03-25T05:11:49.783442Z", "shell.execute_reply": "2025-03-25T05:11:49.782993Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Examining SOFT file structure:\n", "Line 0: ^DATABASE = GeoMiame\n", "Line 1: !Database_name = Gene Expression Omnibus (GEO)\n", "Line 2: !Database_institute = NCBI NLM NIH\n", "Line 3: !Database_web_link = http://www.ncbi.nlm.nih.gov/geo\n", "Line 4: !Database_email = geo@ncbi.nlm.nih.gov\n", "Line 5: ^SERIES = GSE100843\n", "Line 6: !Series_title = Expression data from nonrandomized trial of vitamin D in Barrett's esophagus\n", "Line 7: !Series_geo_accession = GSE100843\n", "Line 8: !Series_status = Public on Jul 06 2017\n", "Line 9: !Series_submission_date = Jul 05 2017\n", "Line 10: !Series_last_update_date = Jul 25 2021\n", "Line 11: !Series_pubmed_id = 28922414\n", "Line 12: !Series_summary = Vitamin D deficiency has been associated with increased esophageal cancer risk. Vitamin D controls many downstream regulators of cellular processes including proliferation, apoptosis, and differentiation. We evaluated the effects of vitamin D supplementation on global gene expression in patients with Barrett's esophagus.\n", "Line 13: !Series_summary = We used microarrays to assess global gene expression in Barrett's esophagus patients who received vitamin D supplementation.\n", "Line 14: !Series_overall_design = Patients in Arm A with Barrett's esophagus with high grade dysplasia were given vitamin D3 50,000 IU weekly for 2 weeks. Patients in Arm B with Barrett's esophagus with low grade dysplasia or no dysplasia were given vitamin D3 50,000 IU weekly for 12 weeks. In both arms, biopsies were obtained from two sites: Barrett's esophagus segment (IM) and normal squamous mucosa (NSQ) proximal to the segment at 2 timepoints: before (T0) and after (T1) vitamin D supplementation.\n", "Line 15: !Series_type = Expression profiling by array\n", "Line 16: !Series_contributor = Linda,C,Cummings\n", "Line 17: !Series_contributor = Patrick,,Leahy\n", "Line 18: !Series_sample_id = GSM2694849\n", "Line 19: !Series_sample_id = GSM2694850\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "Gene annotation preview:\n", "{'ID': [7896736, 7896738, 7896740, 7896742, 7896744], 'GB_LIST': [nan, nan, 'NM_001004195,NM_001005240,NM_001005484,BC136848,BC136867,BC136907,BC136908', 'NR_024437,XM_006711854,XM_006726377,XR_430662,AK298283,AL137655,BC032332,BC118988,BC122537,BC131690,NM_207366,AK301928,BC071667', 'NM_001005221,NM_001005224,NM_001005277,NM_001005504,BC137547,BC137568'], 'SPOT_ID': ['chr1:53049-54936', 'chr1:63015-63887', 'chr1:69091-70008', 'chr1:334129-334296', 'chr1:367659-368597'], 'seqname': ['chr1', 'chr1', 'chr1', 'chr1', 'chr1'], 'RANGE_GB': ['NC_000001.10', 'NC_000001.10', 'NC_000001.10', 'NC_000001.10', 'NC_000001.10'], 'RANGE_STRAND': ['+', '+', '+', '+', '+'], 'RANGE_START': ['53049', '63015', '69091', '334129', '367659'], 'RANGE_STOP': ['54936', '63887', '70008', '334296', '368597'], 'total_probes': [7, 31, 24, 6, 36], 'gene_assignment': ['---', 'ENST00000328113 // OR4G2P // olfactory receptor, family 4, subfamily G, member 2 pseudogene // --- // --- /// ENST00000492842 // OR4G11P // olfactory receptor, family 4, subfamily G, member 11 pseudogene // --- // --- /// ENST00000588632 // OR4G1P // olfactory receptor, family 4, subfamily G, member 1 pseudogene // --- // ---', 'NM_001004195 // OR4F4 // olfactory receptor, family 4, subfamily F, member 4 // 15q26.3 // 26682 /// NM_001005240 // OR4F17 // olfactory receptor, family 4, subfamily F, member 17 // 19p13.3 // 81099 /// NM_001005484 // OR4F5 // olfactory receptor, family 4, subfamily F, member 5 // 1p36.33 // 79501 /// ENST00000318050 // OR4F17 // olfactory receptor, family 4, subfamily F, member 17 // 19p13.3 // 81099 /// ENST00000326183 // OR4F4 // olfactory receptor, family 4, subfamily F, member 4 // 15q26.3 // 26682 /// ENST00000335137 // OR4F5 // olfactory receptor, family 4, subfamily F, member 5 // 1p36.33 // 79501 /// ENST00000585993 // OR4F17 // olfactory receptor, family 4, subfamily F, member 17 // 19p13.3 // 81099 /// BC136848 // OR4F17 // olfactory receptor, family 4, subfamily F, member 17 // 19p13.3 // 81099 /// BC136867 // OR4F17 // olfactory receptor, family 4, subfamily F, member 17 // 19p13.3 // 81099 /// BC136907 // OR4F4 // olfactory receptor, family 4, subfamily F, member 4 // 15q26.3 // 26682 /// BC136908 // OR4F4 // olfactory receptor, family 4, subfamily F, member 4 // 15q26.3 // 26682', 'NR_024437 // LOC728323 // uncharacterized LOC728323 // 2q37.3 // 728323 /// XM_006711854 // LOC101060626 // F-box only protein 25-like // --- // 101060626 /// XM_006726377 // LOC101060626 // F-box only protein 25-like // --- // 101060626 /// XR_430662 // LOC101927097 // uncharacterized LOC101927097 // --- // 101927097 /// ENST00000279067 // LINC00266-1 // long intergenic non-protein coding RNA 266-1 // 20q13.33 // 140849 /// ENST00000431812 // LOC101928706 // uncharacterized LOC101928706 // --- // 101928706 /// ENST00000431812 // LOC101929823 // uncharacterized LOC101929823 // --- // 101929823 /// ENST00000433444 // LOC728323 // uncharacterized LOC728323 // 2q37.3 // 728323 /// ENST00000436899 // LINC00266-3 // long intergenic non-protein coding RNA 266-3 // --- // --- /// ENST00000445252 // LINC00266-1 // long intergenic non-protein coding RNA 266-1 // 20q13.33 // 140849 /// ENST00000455207 // LOC101928706 // uncharacterized LOC101928706 // --- // 101928706 /// ENST00000455207 // LOC101929823 // uncharacterized LOC101929823 // --- // 101929823 /// ENST00000455464 // LOC101928706 // uncharacterized LOC101928706 // --- // 101928706 /// ENST00000455464 // LOC101929823 // uncharacterized LOC101929823 // --- // 101929823 /// ENST00000456398 // LOC728323 // uncharacterized LOC728323 // 2q37.3 // 728323 /// ENST00000601814 // LOC101928706 // uncharacterized LOC101928706 // --- // 101928706 /// ENST00000601814 // LOC101929823 // uncharacterized LOC101929823 // --- // 101929823 /// AK298283 // LOC728323 // uncharacterized LOC728323 // 2q37.3 // 728323 /// AL137655 // LOC100134822 // uncharacterized LOC100134822 // --- // 100134822 /// BC032332 // PCMTD2 // protein-L-isoaspartate (D-aspartate) O-methyltransferase domain containing 2 // 20q13.33 // 55251 /// BC118988 // LINC00266-1 // long intergenic non-protein coding RNA 266-1 // 20q13.33 // 140849 /// BC122537 // LINC00266-1 // long intergenic non-protein coding RNA 266-1 // 20q13.33 // 140849 /// BC131690 // LOC728323 // uncharacterized LOC728323 // 2q37.3 // 728323 /// NM_207366 // SEPT14 // septin 14 // 7p11.2 // 346288 /// ENST00000388975 // SEPT14 // septin 14 // 7p11.2 // 346288 /// ENST00000427373 // LINC00266-4P // long intergenic non-protein coding RNA 266-4, pseudogene // --- // --- /// ENST00000431796 // LOC728323 // uncharacterized LOC728323 // 2q37.3 // 728323 /// ENST00000509776 // LINC00266-2P // long intergenic non-protein coding RNA 266-2, pseudogene // --- // --- /// ENST00000570230 // LOC101929008 // uncharacterized LOC101929008 // --- // 101929008 /// ENST00000570230 // LOC101929038 // uncharacterized LOC101929038 // --- // 101929038 /// ENST00000570230 // LOC101930130 // uncharacterized LOC101930130 // --- // 101930130 /// ENST00000570230 // LOC101930567 // uncharacterized LOC101930567 // --- // 101930567 /// AK301928 // SEPT14 // septin 14 // 7p11.2 // 346288', 'NM_001005221 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// NM_001005224 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// NM_001005277 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// NM_001005504 // OR4F21 // olfactory receptor, family 4, subfamily F, member 21 // 8p23.3 // 441308 /// ENST00000320901 // OR4F21 // olfactory receptor, family 4, subfamily F, member 21 // 8p23.3 // 441308 /// ENST00000332831 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// ENST00000332831 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// ENST00000332831 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// ENST00000402444 // OR4F7P // olfactory receptor, family 4, subfamily F, member 7 pseudogene // --- // --- /// ENST00000405102 // OR4F1P // olfactory receptor, family 4, subfamily F, member 1 pseudogene // --- // --- /// ENST00000424047 // OR4F2P // olfactory receptor, family 4, subfamily F, member 2 pseudogene // --- // --- /// ENST00000426406 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// ENST00000426406 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// ENST00000426406 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// ENST00000456475 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// ENST00000456475 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// ENST00000456475 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// ENST00000559128 // OR4F28P // olfactory receptor, family 4, subfamily F, member 28 pseudogene // --- // --- /// BC137547 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// BC137547 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// BC137547 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// BC137568 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// BC137568 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// BC137568 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// ENST00000589943 // OR4F8P // olfactory receptor, family 4, subfamily F, member 8 pseudogene // --- // ---'], 'mrna_assignment': ['NONHSAT060105 // NONCODE // Non-coding transcript identified by NONCODE // chr1 // 100 // 100 // 7 // 7 // 0', 'ENST00000328113 // ENSEMBL // havana:known chromosome:GRCh38:15:101926805:101927707:-1 gene:ENSG00000183909 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 100 // 100 // 31 // 31 // 0 /// ENST00000492842 // ENSEMBL // havana:known chromosome:GRCh38:1:62948:63887:1 gene:ENSG00000240361 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 100 // 100 // 31 // 31 // 0 /// ENST00000588632 // ENSEMBL // havana:known chromosome:GRCh38:19:104535:105471:1 gene:ENSG00000267310 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 100 // 100 // 31 // 31 // 0 /// NONHSAT000016 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 31 // 31 // 0 /// NONHSAT051704 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 31 // 31 // 0 /// NONHSAT060106 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 31 // 31 // 0', 'NM_001004195 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 4 (OR4F4), mRNA. // chr1 // 100 // 100 // 24 // 24 // 0 /// NM_001005240 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 17 (OR4F17), mRNA. // chr1 // 100 // 100 // 24 // 24 // 0 /// NM_001005484 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 5 (OR4F5), mRNA. // chr1 // 100 // 100 // 24 // 24 // 0 /// ENST00000318050 // ENSEMBL // ensembl:known chromosome:GRCh38:19:110643:111696:1 gene:ENSG00000176695 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 24 // 24 // 0 /// ENST00000326183 // ENSEMBL // ensembl_havana_transcript:known chromosome:GRCh38:15:101922042:101923095:-1 gene:ENSG00000177693 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 24 // 24 // 0 /// ENST00000335137 // ENSEMBL // ensembl_havana_transcript:known chromosome:GRCh38:1:69091:70008:1 gene:ENSG00000186092 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 24 // 24 // 0 /// ENST00000585993 // ENSEMBL // havana:known chromosome:GRCh38:19:107461:111696:1 gene:ENSG00000176695 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 24 // 24 // 0 /// BC136848 // GenBank // Homo sapiens olfactory receptor, family 4, subfamily F, member 17, mRNA (cDNA clone MGC:168462 IMAGE:9020839), complete cds. // chr1 // 100 // 100 // 24 // 24 // 0 /// BC136867 // GenBank // Homo sapiens olfactory receptor, family 4, subfamily F, member 17, mRNA (cDNA clone MGC:168481 IMAGE:9020858), complete cds. // chr1 // 100 // 100 // 24 // 24 // 0 /// BC136907 // GenBank // Homo sapiens olfactory receptor, family 4, subfamily F, member 4, mRNA (cDNA clone MGC:168521 IMAGE:9020898), complete cds. // chr1 // 100 // 100 // 24 // 24 // 0 /// BC136908 // GenBank // Homo sapiens olfactory receptor, family 4, subfamily F, member 4, mRNA (cDNA clone MGC:168522 IMAGE:9020899), complete cds. // chr1 // 100 // 100 // 24 // 24 // 0 /// ENST00000618231 // ENSEMBL // havana:known chromosome:GRCh38:19:110613:111417:1 gene:ENSG00000176695 gene_biotype:protein_coding transcript_biotype:retained_intron // chr1 // 100 // 88 // 21 // 21 // 0', 'NR_024437 // RefSeq // Homo sapiens uncharacterized LOC728323 (LOC728323), long non-coding RNA. // chr1 // 100 // 100 // 6 // 6 // 0 /// XM_006711854 // RefSeq // PREDICTED: Homo sapiens F-box only protein 25-like (LOC101060626), partial mRNA. // chr1 // 100 // 100 // 6 // 6 // 0 /// XM_006726377 // RefSeq // PREDICTED: Homo sapiens F-box only protein 25-like (LOC101060626), partial mRNA. // chr1 // 100 // 100 // 6 // 6 // 0 /// XR_430662 // RefSeq // PREDICTED: Homo sapiens uncharacterized LOC101927097 (LOC101927097), misc_RNA. // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000279067 // ENSEMBL // ensembl_havana_transcript:known chromosome:GRCh38:20:64290385:64303559:1 gene:ENSG00000149656 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000431812 // ENSEMBL // havana:known chromosome:GRCh38:1:485066:489553:-1 gene:ENSG00000237094 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000433444 // ENSEMBL // havana:putative chromosome:GRCh38:2:242122293:242138888:1 gene:ENSG00000220804 gene_biotype:transcribed_unprocessed_pseudogene transcript_biotype:processed_transcript // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000436899 // ENSEMBL // havana:known chromosome:GRCh38:6:131910:144885:-1 gene:ENSG00000170590 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000445252 // ENSEMBL // havana:known chromosome:GRCh38:20:64294897:64311371:1 gene:ENSG00000149656 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000455207 // ENSEMBL // havana:known chromosome:GRCh38:1:373182:485208:-1 gene:ENSG00000237094 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000455464 // ENSEMBL // havana:known chromosome:GRCh38:1:476531:497259:-1 gene:ENSG00000237094 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000456398 // ENSEMBL // havana:known chromosome:GRCh38:2:242088633:242140638:1 gene:ENSG00000220804 gene_biotype:transcribed_unprocessed_pseudogene transcript_biotype:processed_transcript // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000601814 // ENSEMBL // havana:known chromosome:GRCh38:1:484832:495476:-1 gene:ENSG00000237094 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// AK298283 // GenBank // Homo sapiens cDNA FLJ60027 complete cds, moderately similar to F-box only protein 25. // chr1 // 100 // 100 // 6 // 6 // 0 /// AL137655 // GenBank // Homo sapiens mRNA; cDNA DKFZp434B2016 (from clone DKFZp434B2016). // chr1 // 100 // 100 // 6 // 6 // 0 /// BC032332 // GenBank // Homo sapiens protein-L-isoaspartate (D-aspartate) O-methyltransferase domain containing 2, mRNA (cDNA clone MGC:40288 IMAGE:5169056), complete cds. // chr1 // 100 // 100 // 6 // 6 // 0 /// BC118988 // GenBank // Homo sapiens chromosome 20 open reading frame 69, mRNA (cDNA clone MGC:141807 IMAGE:40035995), complete cds. // chr1 // 100 // 100 // 6 // 6 // 0 /// BC122537 // GenBank // Homo sapiens chromosome 20 open reading frame 69, mRNA (cDNA clone MGC:141808 IMAGE:40035996), complete cds. // chr1 // 100 // 100 // 6 // 6 // 0 /// BC131690 // GenBank // Homo sapiens similar to bA476I15.3 (novel protein similar to septin), mRNA (cDNA clone IMAGE:40119684), partial cds. // chr1 // 100 // 100 // 6 // 6 // 0 /// NM_207366 // RefSeq // Homo sapiens septin 14 (SEPT14), mRNA. // chr1 // 50 // 100 // 3 // 6 // 0 /// ENST00000388975 // ENSEMBL // ensembl_havana_transcript:known chromosome:GRCh38:7:55793544:55862789:-1 gene:ENSG00000154997 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 50 // 100 // 3 // 6 // 0 /// ENST00000427373 // ENSEMBL // havana:known chromosome:GRCh38:Y:25378300:25394719:-1 gene:ENSG00000228786 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 67 // 100 // 4 // 6 // 0 /// ENST00000431796 // ENSEMBL // havana:known chromosome:GRCh38:2:242088693:242122405:1 gene:ENSG00000220804 gene_biotype:transcribed_unprocessed_pseudogene transcript_biotype:processed_transcript // chr1 // 60 // 83 // 3 // 5 // 0 /// ENST00000509776 // ENSEMBL // havana:known chromosome:GRCh38:Y:24278681:24291346:1 gene:ENSG00000248792 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 67 // 100 // 4 // 6 // 0 /// ENST00000570230 // ENSEMBL // havana:known chromosome:GRCh38:16:90157932:90178344:1 gene:ENSG00000260528 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 67 // 100 // 4 // 6 // 0 /// AK301928 // GenBank // Homo sapiens cDNA FLJ59065 complete cds, moderately similar to Septin-10. // chr1 // 50 // 100 // 3 // 6 // 0 /// ENST00000413839 // ENSEMBL // havana:known chromosome:GRCh38:7:45816557:45821064:1 gene:ENSG00000226838 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000414688 // ENSEMBL // havana:known chromosome:GRCh38:1:711342:720200:-1 gene:ENSG00000230021 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000419394 // ENSEMBL // havana:known chromosome:GRCh38:1:703685:720194:-1 gene:ENSG00000230021 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000420830 // ENSEMBL // havana:known chromosome:GRCh38:1:243031272:243047869:-1 gene:ENSG00000231512 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000428915 // ENSEMBL // havana:known chromosome:GRCh38:10:38453181:38466176:1 gene:ENSG00000203496 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000439401 // ENSEMBL // havana:known chromosome:GRCh38:3:198228194:198228376:1 gene:ENSG00000226008 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000440200 // ENSEMBL // havana:known chromosome:GRCh38:1:601436:720200:-1 gene:ENSG00000230021 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000441245 // ENSEMBL // havana:known chromosome:GRCh38:1:701936:720150:-1 gene:ENSG00000230021 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 67 // 4 // 4 // 0 /// ENST00000445840 // ENSEMBL // havana:known chromosome:GRCh38:1:485032:485211:-1 gene:ENSG00000224813 gene_biotype:transcribed_unprocessed_pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000447954 // ENSEMBL // havana:known chromosome:GRCh38:1:720058:724550:-1 gene:ENSG00000230021 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000450226 // ENSEMBL // havana:known chromosome:GRCh38:1:243038914:243047875:-1 gene:ENSG00000231512 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000453405 // ENSEMBL // havana:known chromosome:GRCh38:2:242122287:242122469:1 gene:ENSG00000244528 gene_biotype:processed_pseudogene transcript_biotype:processed_pseudogene // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000477740 // ENSEMBL // havana:known chromosome:GRCh38:1:92230:129217:-1 gene:ENSG00000238009 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000508026 // ENSEMBL // havana:known chromosome:GRCh38:8:200385:200562:-1 gene:ENSG00000255464 gene_biotype:processed_pseudogene transcript_biotype:processed_pseudogene // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000509192 // ENSEMBL // havana:known chromosome:GRCh38:5:181329241:181342213:1 gene:ENSG00000250765 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000513445 // ENSEMBL // havana:known chromosome:GRCh38:4:118640673:118640858:1 gene:ENSG00000251155 gene_biotype:processed_pseudogene transcript_biotype:processed_pseudogene // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000523795 // ENSEMBL // havana:known chromosome:GRCh38:8:192091:200563:-1 gene:ENSG00000250210 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000529266 // ENSEMBL // havana:known chromosome:GRCh38:11:121279:125784:-1 gene:ENSG00000254468 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000587432 // ENSEMBL // havana:known chromosome:GRCh38:19:191212:195696:-1 gene:ENSG00000267237 gene_biotype:transcribed_unprocessed_pseudogene transcript_biotype:processed_transcript // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000610542 // ENSEMBL // ensembl:known chromosome:GRCh38:1:120725:133723:-1 gene:ENSG00000238009 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 83 // 100 // 5 // 6 // 0 /// ENST00000612088 // ENSEMBL // ensembl:known chromosome:GRCh38:10:38453181:38466176:1 gene:ENSG00000203496 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000612214 // ENSEMBL // havana:known chromosome:GRCh38:19:186371:191429:-1 gene:ENSG00000267237 gene_biotype:transcribed_unprocessed_pseudogene transcript_biotype:processed_transcript // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000613471 // ENSEMBL // ensembl:known chromosome:GRCh38:1:476738:489710:-1 gene:ENSG00000237094 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000615295 // ENSEMBL // ensembl:known chromosome:GRCh38:5:181329241:181342213:1 gene:ENSG00000250765 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000616585 // ENSEMBL // ensembl:known chromosome:GRCh38:1:711715:724707:-1 gene:ENSG00000230021 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000618096 // ENSEMBL // havana:known chromosome:GRCh38:19:191178:191354:-1 gene:ENSG00000267237 gene_biotype:transcribed_unprocessed_pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000618222 // ENSEMBL // ensembl:known chromosome:GRCh38:6:131910:144885:-1 gene:ENSG00000170590 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000622435 // ENSEMBL // havana:known chromosome:GRCh38:2:242088684:242159382:1 gene:ENSG00000220804 gene_biotype:transcribed_unprocessed_pseudogene transcript_biotype:processed_transcript // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000622626 // ENSEMBL // ensembl:known chromosome:GRCh38:11:112967:125927:-1 gene:ENSG00000254468 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 6 // 6 // 0 /// GENSCAN00000007486 // ENSEMBL // cdna:genscan chromosome:GRCh38:2:242089132:242175655:1 transcript_biotype:protein_coding // chr1 // 100 // 100 // 6 // 6 // 0 /// GENSCAN00000023775 // ENSEMBL // cdna:genscan chromosome:GRCh38:7:45812479:45856081:1 transcript_biotype:protein_coding // chr1 // 100 // 100 // 6 // 6 // 0 /// GENSCAN00000045845 // ENSEMBL // cdna:genscan chromosome:GRCh38:8:166086:213433:-1 transcript_biotype:protein_coding // chr1 // 100 // 100 // 6 // 6 // 0 /// BC071667 // GenBank HTC // Homo sapiens cDNA clone IMAGE:4384656, **** WARNING: chimeric clone ****. // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT000053 // NONCODE // Non-coding transcript identified by NONCODE: Sense No Exonic // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT000055 // NONCODE // Non-coding transcript identified by NONCODE: Sense No Exonic // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT000063 // NONCODE // Non-coding transcript identified by NONCODE: Sense No Exonic // chr1 // 83 // 100 // 5 // 6 // 0 /// NONHSAT000064 // NONCODE // Non-coding transcript identified by NONCODE // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT000065 // NONCODE // Non-coding transcript identified by NONCODE: Sense No Exonic // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT000086 // NONCODE // Non-coding transcript identified by NONCODE: Sense No Exonic // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT000097 // NONCODE // Non-coding transcript identified by NONCODE: Sense No Exonic // chr1 // 100 // 67 // 4 // 4 // 0 /// NONHSAT000098 // NONCODE // Non-coding transcript identified by NONCODE: Sense No Exonic // chr1 // 83 // 100 // 5 // 6 // 0 /// NONHSAT010578 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 83 // 100 // 5 // 6 // 0 /// NONHSAT012829 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT017180 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT060112 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT078034 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT078035 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT078039 // NONCODE // Non-coding transcript identified by NONCODE // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT078040 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT078041 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT081035 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT081036 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT094494 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT094497 // NONCODE // Non-coding transcript identified by NONCODE // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT098010 // NONCODE // Non-coding transcript identified by NONCODE // chr1 // 83 // 100 // 5 // 6 // 0 /// NONHSAT105956 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT105968 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 100 // 100 // 6 // 6 // 0 /// NONHSAT120472 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 83 // 100 // 5 // 6 // 0 /// NONHSAT124571 // NONCODE // Non-coding transcript identified by NONCODE // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00001800-XLOC_l2_001331 // Broad TUCP // linc-TP53BP2-4 chr1:-:224133091-224222680 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00001926-XLOC_l2_000004 // Broad TUCP // linc-OR4F16-1 chr1:+:329783-334271 // chr1 // 83 // 100 // 5 // 6 // 0 /// TCONS_l2_00001927-XLOC_l2_000004 // Broad TUCP // linc-OR4F16-1 chr1:+:334139-342806 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00002370-XLOC_l2_000720 // Broad TUCP // linc-ZNF692-5 chr1:-:92229-129217 // chr1 // 83 // 100 // 5 // 6 // 0 /// TCONS_l2_00002386-XLOC_l2_000726 // Broad TUCP // linc-OR4F29-1 chr1:-:637315-655530 // chr1 // 100 // 67 // 4 // 4 // 0 /// TCONS_l2_00002387-XLOC_l2_000726 // Broad TUCP // linc-OR4F29-1 chr1:-:639064-655574 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00002388-XLOC_l2_000726 // Broad TUCP // linc-OR4F29-1 chr1:-:646721-655580 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00002389-XLOC_l2_000726 // Broad TUCP // linc-OR4F29-1 chr1:-:655437-659930 // chr1 // 83 // 100 // 5 // 6 // 0 /// TCONS_l2_00002812-XLOC_l2_001398 // Broad TUCP // linc-PLD5-4 chr1:-:243194573-243211171 // chr1 // 83 // 100 // 5 // 6 // 0 /// TCONS_l2_00003949-XLOC_l2_001561 // Broad TUCP // linc-BMS1-9 chr10:+:38742108-38755311 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00003950-XLOC_l2_001561 // Broad TUCP // linc-BMS1-9 chr10:+:38742265-38764837 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00014349-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030831-243101574 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00014350-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030855-243102147 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00014351-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030868-243101569 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00014352-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030886-243064759 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00014354-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030931-243067562 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00014355-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030941-243102157 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00014357-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243037045-243101538 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00014358-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243058329-243064628 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00015637-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030783-243082789 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00015638-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030843-243065243 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00015639-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030843-243102469 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00015640-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030843-243102469 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00015641-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243030843-243102469 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00015643-XLOC_l2_007835 // Broad TUCP // linc-ORC6-14 chr2:+:243064443-243081039 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00016828-XLOC_l2_008724 // Broad TUCP // linc-HNF1B-4 chr20:+:62921737-62934707 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00020055-XLOC_l2_010084 // Broad TUCP // linc-MCMBP-2 chr3:+:197937115-197955676 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00025304-XLOC_l2_012836 // Broad TUCP // linc-PDCD2-1 chr6:-:131909-144885 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00025849-XLOC_l2_013383 // Broad TUCP // linc-IGFBP1-1 chr7:+:45831387-45863181 // chr1 // 100 // 100 // 6 // 6 // 0 /// TCONS_l2_00025850-XLOC_l2_013383 // Broad TUCP // linc-IGFBP1-1 chr7:+:45836951-45863174 // chr1 // 100 // 100 // 6 // 6 // 0 /// ENST00000437691 // ENSEMBL // havana:known chromosome:GRCh38:1:243047737:243052252:-1 gene:ENSG00000231512 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 67 // 100 // 4 // 6 // 0 /// ENST00000447236 // ENSEMBL // havana:known chromosome:GRCh38:7:56360362:56360541:-1 gene:ENSG00000231299 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 50 // 100 // 3 // 6 // 0 /// ENST00000453576 // ENSEMBL // havana:known chromosome:GRCh38:1:129081:133566:-1 gene:ENSG00000238009 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 67 // 100 // 4 // 6 // 0 /// ENST00000611754 // ENSEMBL // ensembl:known chromosome:GRCh38:Y:25378671:25391610:-1 gene:ENSG00000228786 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 67 // 100 // 4 // 6 // 0 /// ENST00000617978 // ENSEMBL // havana:known chromosome:GRCh38:1:227980051:227980227:1 gene:ENSG00000274886 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 67 // 100 // 4 // 6 // 0 /// ENST00000621799 // ENSEMBL // ensembl:known chromosome:GRCh38:16:90173217:90186204:1 gene:ENSG00000260528 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 67 // 100 // 4 // 6 // 0 /// NONHSAT000022 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 67 // 100 // 4 // 6 // 0 /// NONHSAT010579 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 67 // 100 // 4 // 6 // 0 /// NONHSAT010580 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 67 // 100 // 4 // 6 // 0 /// NONHSAT120743 // NONCODE // Non-coding transcript identified by NONCODE // chr1 // 50 // 100 // 3 // 6 // 0 /// NONHSAT139746 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 67 // 100 // 4 // 6 // 0 /// NONHSAT144650 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 67 // 100 // 4 // 6 // 0 /// NONHSAT144655 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 67 // 100 // 4 // 6 // 0 /// TCONS_l2_00002372-XLOC_l2_000720 // Broad TUCP // linc-ZNF692-5 chr1:-:129080-133566 // chr1 // 67 // 100 // 4 // 6 // 0 /// TCONS_l2_00002813-XLOC_l2_001398 // Broad TUCP // linc-PLD5-4 chr1:-:243202215-243211826 // chr1 // 67 // 100 // 4 // 6 // 0 /// TCONS_l2_00002814-XLOC_l2_001398 // Broad TUCP // linc-PLD5-4 chr1:-:243211038-243215554 // chr1 // 67 // 100 // 4 // 6 // 0 /// TCONS_l2_00010440-XLOC_l2_005352 // Broad TUCP // linc-RBM11-5 chr16:+:90244124-90289080 // chr1 // 67 // 100 // 4 // 6 // 0 /// TCONS_l2_00031062-XLOC_l2_015962 // Broad TUCP // linc-BPY2B-4 chrY:-:27524446-27540866 // chr1 // 67 // 100 // 4 // 6 // 0', 'NM_001005221 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 29 (OR4F29), mRNA. // chr1 // 100 // 100 // 36 // 36 // 0 /// NM_001005224 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 3 (OR4F3), mRNA. // chr1 // 100 // 100 // 36 // 36 // 0 /// NM_001005277 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 16 (OR4F16), mRNA. // chr1 // 100 // 100 // 36 // 36 // 0 /// NM_001005504 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 21 (OR4F21), mRNA. // chr1 // 89 // 100 // 32 // 36 // 0 /// ENST00000320901 // ENSEMBL // ensembl_havana_transcript:known chromosome:GRCh38:8:166049:167043:-1 gene:ENSG00000176269 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 89 // 100 // 32 // 36 // 0 /// ENST00000332831 // ENSEMBL // ensembl_havana_transcript:known chromosome:GRCh38:1:685716:686654:-1 gene:ENSG00000273547 gene_biotype:protein_coding transcript_biotype:protein_coding gene:ENSG00000185097 // chr1 // 100 // 100 // 36 // 36 // 0 /// ENST00000402444 // ENSEMBL // havana:known chromosome:GRCh38:6:170639606:170640536:1 gene:ENSG00000217874 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 78 // 100 // 28 // 36 // 0 /// ENST00000405102 // ENSEMBL // havana:known chromosome:GRCh38:6:105919:106856:-1 gene:ENSG00000220212 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 81 // 100 // 29 // 36 // 0 /// ENST00000424047 // ENSEMBL // havana:known chromosome:GRCh38:11:86649:87586:-1 gene:ENSG00000224777 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 78 // 100 // 28 // 36 // 0 /// ENST00000426406 // ENSEMBL // ensembl_havana_transcript:known chromosome:GRCh38:1:450740:451678:-1 gene:ENSG00000278566 gene_biotype:protein_coding transcript_biotype:protein_coding gene:ENSG00000235249 // chr1 // 100 // 100 // 36 // 36 // 0 /// ENST00000456475 // ENSEMBL // ensembl_havana_transcript:known chromosome:GRCh38:5:181367268:181368262:1 gene:ENSG00000230178 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 36 // 36 // 0 /// ENST00000559128 // ENSEMBL // havana:known chromosome:GRCh38:15:101875964:101876901:1 gene:ENSG00000257109 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 83 // 100 // 30 // 36 // 0 /// BC137547 // GenBank // Homo sapiens olfactory receptor, family 4, subfamily F, member 3, mRNA (cDNA clone MGC:169170 IMAGE:9021547), complete cds. // chr1 // 100 // 100 // 36 // 36 // 0 /// BC137568 // GenBank // Homo sapiens olfactory receptor, family 4, subfamily F, member 3, mRNA (cDNA clone MGC:169191 IMAGE:9021568), complete cds. // chr1 // 100 // 100 // 36 // 36 // 0 /// ENST00000589943 // ENSEMBL // havana:known chromosome:GRCh38:19:156279:157215:-1 gene:ENSG00000266971 gene_biotype:unprocessed_pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 72 // 100 // 26 // 36 // 0 /// GENSCAN00000011446 // ENSEMBL // cdna:genscan chromosome:GRCh38:5:181367527:181368225:1 transcript_biotype:protein_coding // chr1 // 100 // 64 // 23 // 23 // 0 /// GENSCAN00000017675 // ENSEMBL // cdna:genscan chromosome:GRCh38:1:685716:686414:-1 transcript_biotype:protein_coding // chr1 // 100 // 64 // 23 // 23 // 0 /// GENSCAN00000017679 // ENSEMBL // cdna:genscan chromosome:GRCh38:1:450740:451438:-1 transcript_biotype:protein_coding // chr1 // 100 // 64 // 23 // 23 // 0 /// GENSCAN00000045845 // ENSEMBL // cdna:genscan chromosome:GRCh38:8:166086:213433:-1 transcript_biotype:protein_coding // chr1 // 87 // 83 // 26 // 30 // 0 /// NONHSAT051700 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 83 // 100 // 30 // 36 // 0 /// NONHSAT051701 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 83 // 100 // 30 // 36 // 0 /// NONHSAT105966 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 81 // 100 // 29 // 36 // 0 /// NONHSAT060109 // NONCODE // Non-coding transcript identified by NONCODE: Linc // chr1 // 72 // 100 // 26 // 36 // 0'], 'category': ['main', 'main', 'main', 'main', 'main']}\n" ] } ], "source": [ "# 1. Let's first examine the structure of the SOFT file before trying to parse it\n", "import gzip\n", "\n", "# Look at the first few lines of the SOFT file to understand its structure\n", "print(\"Examining SOFT file structure:\")\n", "try:\n", " with gzip.open(soft_file, 'rt') as file:\n", " # Read first 20 lines to understand the file structure\n", " for i, line in enumerate(file):\n", " if i < 20:\n", " print(f\"Line {i}: {line.strip()}\")\n", " else:\n", " break\n", "except Exception as e:\n", " print(f\"Error reading SOFT file: {e}\")\n", "\n", "# 2. Now let's try a more robust approach to extract the gene annotation\n", "# Instead of using the library function which failed, we'll implement a custom approach\n", "try:\n", " # First, look for the platform section which contains gene annotation\n", " platform_data = []\n", " with gzip.open(soft_file, 'rt') as file:\n", " in_platform_section = False\n", " for line in file:\n", " if line.startswith('^PLATFORM'):\n", " in_platform_section = True\n", " continue\n", " if in_platform_section and line.startswith('!platform_table_begin'):\n", " # Next line should be the header\n", " header = next(file).strip()\n", " platform_data.append(header)\n", " # Read until the end of the platform table\n", " for table_line in file:\n", " if table_line.startswith('!platform_table_end'):\n", " break\n", " platform_data.append(table_line.strip())\n", " break\n", " \n", " # If we found platform data, convert it to a DataFrame\n", " if platform_data:\n", " import pandas as pd\n", " import io\n", " platform_text = '\\n'.join(platform_data)\n", " gene_annotation = pd.read_csv(io.StringIO(platform_text), delimiter='\\t', \n", " low_memory=False, on_bad_lines='skip')\n", " print(\"\\nGene annotation preview:\")\n", " print(preview_df(gene_annotation))\n", " else:\n", " print(\"Could not find platform table in SOFT file\")\n", " \n", " # Try an alternative approach - extract mapping from other sections\n", " with gzip.open(soft_file, 'rt') as file:\n", " for line in file:\n", " if 'ANNOTATION information' in line or 'annotation information' in line:\n", " print(f\"Found annotation information: {line.strip()}\")\n", " if line.startswith('!Platform_title') or line.startswith('!platform_title'):\n", " print(f\"Platform title: {line.strip()}\")\n", " \n", "except Exception as e:\n", " print(f\"Error processing gene annotation: {e}\")\n" ] }, { "cell_type": "markdown", "id": "185b0b13", "metadata": {}, "source": [ "### Step 6: Gene Identifier Mapping" ] }, { "cell_type": "code", "execution_count": 7, "id": "9a1c620b", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:11:49.785291Z", "iopub.status.busy": "2025-03-25T05:11:49.785145Z", "iopub.status.idle": "2025-03-25T05:11:50.227890Z", "shell.execute_reply": "2025-03-25T05:11:50.227539Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example gene assignment entries:\n", "- ---...\n", "- ENST00000328113 // OR4G2P // olfactory receptor, family 4, subfamily G, member 2 pseudogene // --- /...\n", "- NM_001004195 // OR4F4 // olfactory receptor, family 4, subfamily F, member 4 // 15q26.3 // 26682 ///...\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Gene mapping dataframe shape: (33297, 2)\n", "First few rows of mapping data with extracted gene symbols:\n", "ID: 7896736, Genes: []\n", "ID: 7896738, Genes: ['OR4G2P', 'OR4G11P', 'OR4G1P']\n", "ID: 7896740, Genes: ['OR4F4', 'OR4F17', 'OR4F5', 'OR4F17', 'OR4F4', 'OR4F5', 'OR4F17', 'OR4F17', 'OR4F17', 'OR4F4', 'OR4F4']\n", "ID: 7896742, Genes: ['LINC00266-1', 'LINC00266-3', 'LINC00266-1', 'PCMTD2', 'LINC00266-1', 'LINC00266-1', 'SEPT14', 'SEPT14', 'LINC00266-4P', 'LINC00266-2P', 'SEPT14']\n", "ID: 7896744, Genes: ['OR4F29', 'OR4F3', 'OR4F16', 'OR4F21', 'OR4F21', 'OR4F3', 'OR4F16', 'OR4F29', 'OR4F7P', 'OR4F1P', 'OR4F2P', 'OR4F3', 'OR4F16', 'OR4F29', 'OR4F3', 'OR4F16', 'OR4F29', 'OR4F28P', 'OR4F3', 'OR4F16', 'OR4F29', 'OR4F3', 'OR4F16', 'OR4F29', 'OR4F8P']\n", "Number of probes with valid gene mappings: 24436\n", "Gene expression dataframe shape before normalization: (0, 76)\n", "First few gene symbols in the gene expression data:\n", "Index([], dtype='object', name='Gene')\n", "Gene expression data saved to ../../output/preprocess/Esophageal_Cancer/gene_data/GSE100843.csv\n" ] } ], "source": [ "# 1. Determine which columns in the gene annotation data correspond to probe IDs and gene symbols\n", "prob_col = 'ID' # This is the column with the probe identifiers matching the gene expression data\n", "gene_col = 'gene_assignment' # This column contains gene symbol information\n", "\n", "# First, let's examine what the gene_assignment column actually contains\n", "print(\"Example gene assignment entries:\")\n", "for entry in gene_annotation[gene_col].head(3):\n", " print(f\"- {entry[:100]}...\")\n", "\n", "# 2. Get the gene mapping dataframe by extracting these two columns\n", "import re\n", "\n", "# Let's define a better function to extract gene symbols from the gene_assignment field\n", "def extract_gene_symbols_from_assignment(assignment_text):\n", " if not isinstance(assignment_text, str) or assignment_text == '---':\n", " return []\n", " \n", " # The format appears to be: ID // SYMBOL // DESCRIPTION // LOCATION // GENE_ID\n", " # We want to extract SYMBOL\n", " genes = []\n", " # Split by /// which separates multiple gene entries\n", " for entry in assignment_text.split('///'):\n", " # Apply regex to extract gene symbol between first and second //\n", " match = re.search(r'//\\s+([A-Z0-9-]+)\\s+//', entry)\n", " if match:\n", " gene_symbol = match.group(1)\n", " # Filter out common non-gene entries and limit to likely human gene symbols\n", " if (gene_symbol not in ['---', 'LOC'] and \n", " not gene_symbol.startswith('LOC') and \n", " re.match(r'^[A-Z][A-Z0-9-]{1,15}$', gene_symbol)):\n", " genes.append(gene_symbol)\n", " \n", " return genes\n", "\n", "# Use a custom function when creating the mapping\n", "mapping_data = gene_annotation[[prob_col, gene_col]].copy()\n", "mapping_data = mapping_data.dropna()\n", "mapping_data['Gene'] = mapping_data[gene_col].apply(extract_gene_symbols_from_assignment)\n", "mapping_data = mapping_data[[prob_col, 'Gene']]\n", "mapping_data = mapping_data.astype({prob_col: 'str'})\n", "\n", "print(f\"Gene mapping dataframe shape: {mapping_data.shape}\")\n", "print(\"First few rows of mapping data with extracted gene symbols:\")\n", "for idx, row in mapping_data.head(5).iterrows():\n", " print(f\"ID: {row[prob_col]}, Genes: {row['Gene']}\")\n", "\n", "# Check if we have enough valid gene mappings\n", "valid_mappings = mapping_data[mapping_data['Gene'].apply(len) > 0]\n", "print(f\"Number of probes with valid gene mappings: {len(valid_mappings)}\")\n", "\n", "# 3. Apply the gene mapping to convert probe-level measurements to gene expression data\n", "gene_data = apply_gene_mapping(gene_data, mapping_data)\n", "\n", "print(f\"Gene expression dataframe shape before normalization: {gene_data.shape}\")\n", "print(\"First few gene symbols in the gene expression data:\")\n", "print(gene_data.index[:10])\n", "\n", "# Skip the normalization step for now as it's causing data loss\n", "# Instead of: gene_data = normalize_gene_symbols_in_index(gene_data)\n", "\n", "# Save the processed gene expression 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" ] }, { "cell_type": "markdown", "id": "e8740812", "metadata": {}, "source": [ "### Step 7: Data Normalization and Linking" ] }, { "cell_type": "code", "execution_count": 8, "id": "9ad6bd21", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:11:50.229645Z", "iopub.status.busy": "2025-03-25T05:11:50.229530Z", "iopub.status.idle": "2025-03-25T05:11:50.471123Z", "shell.execute_reply": "2025-03-25T05:11:50.470778Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Normalized gene data shape: (0, 76)\n", "First few genes with their expression values after normalization:\n", "Empty DataFrame\n", "Columns: [GSM2694849, GSM2694850, GSM2694851, GSM2694852, GSM2694853, GSM2694854, GSM2694855, GSM2694856, GSM2694857, GSM2694858, GSM2694859, GSM2694860, GSM2694861, GSM2694862, GSM2694863, GSM2694864, GSM2694865, GSM2694866, GSM2694867, GSM2694868, GSM2694869, GSM2694870, GSM2694871, GSM2694872, GSM2694873, GSM2694874, GSM2694875, GSM2694876, GSM2694877, GSM2694878, GSM2694879, GSM2694880, GSM2694881, GSM2694882, GSM2694883, GSM2694884, GSM2694885, GSM2694886, GSM2694887, GSM2694888, GSM2694889, GSM2694890, GSM2694891, GSM2694892, GSM2694893, GSM2694894, GSM2694895, GSM2694896, GSM2694897, GSM2694898, GSM2694899, GSM2694900, GSM2694901, GSM2694902, GSM2694903, GSM2694904, GSM2694905, GSM2694906, GSM2694907, GSM2694908, GSM2694909, GSM2694910, GSM2694911, GSM2694912, GSM2694913, GSM2694914, GSM2694915, GSM2694916, GSM2694917, GSM2694918, GSM2694919, GSM2694920, GSM2694921, GSM2694922, GSM2694923, GSM2694924]\n", "Index: []\n", "\n", "[0 rows x 76 columns]\n", "Normalized gene data saved to ../../output/preprocess/Esophageal_Cancer/gene_data/GSE100843.csv\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Raw clinical data shape: (3, 77)\n", "Clinical features:\n", " GSM2694849 GSM2694850 GSM2694851 GSM2694852 GSM2694853 \\\n", "Esophageal_Cancer 1.0 1.0 0.0 0.0 1.0 \n", "\n", " GSM2694854 GSM2694855 GSM2694856 GSM2694857 GSM2694858 \\\n", "Esophageal_Cancer 0.0 1.0 0.0 1.0 0.0 \n", "\n", " ... GSM2694915 GSM2694916 GSM2694917 GSM2694918 \\\n", "Esophageal_Cancer ... 1.0 0.0 1.0 0.0 \n", "\n", " GSM2694919 GSM2694920 GSM2694921 GSM2694922 GSM2694923 \\\n", "Esophageal_Cancer 1.0 0.0 1.0 0.0 1.0 \n", "\n", " GSM2694924 \n", "Esophageal_Cancer 0.0 \n", "\n", "[1 rows x 76 columns]\n", "Clinical features saved to ../../output/preprocess/Esophageal_Cancer/clinical_data/GSE100843.csv\n", "Linked data shape: (76, 1)\n", "Linked data preview (first 5 rows, first 5 columns):\n", " Esophageal_Cancer\n", "GSM2694849 1.0\n", "GSM2694850 1.0\n", "GSM2694851 0.0\n", "GSM2694852 0.0\n", "GSM2694853 1.0\n", "Missing values before handling:\n", " Trait (Esophageal_Cancer) missing: 0 out of 76\n", " Genes with >20% missing: 0\n", " Samples with >5% missing genes: 0\n", "Data shape after handling missing values: (0, 1)\n", "No data remains after handling missing values.\n", "Abnormality detected in the cohort: GSE100843. Preprocessing failed.\n", "A new JSON file was created at: ../../output/preprocess/Esophageal_Cancer/cohort_info.json\n", "Data was determined to be unusable or empty and was not saved\n" ] } ], "source": [ "# 1. Normalize gene symbols in the gene expression data\n", "normalized_gene_data = normalize_gene_symbols_in_index(gene_data)\n", "print(f\"Normalized gene data shape: {normalized_gene_data.shape}\")\n", "print(\"First few genes with their expression values after normalization:\")\n", "print(normalized_gene_data.head())\n", "\n", "# Save the normalized 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. Check if trait data is available before proceeding with clinical data extraction\n", "if trait_row is None:\n", " print(\"Trait row is None. Cannot extract trait information from clinical data.\")\n", " # Create an empty dataframe for clinical features\n", " clinical_features = pd.DataFrame()\n", " \n", " # Create an empty dataframe for linked data\n", " linked_data = pd.DataFrame()\n", " \n", " # Validate and save cohort info\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, # Trait data is not available\n", " is_biased=True, # Not applicable but required\n", " df=pd.DataFrame(), # Empty dataframe\n", " note=\"Dataset contains gene expression data but lacks clear trait indicators for Duchenne Muscular Dystrophy status.\"\n", " )\n", " print(\"Data was determined to be unusable due to missing trait indicators and was not saved\")\n", "else:\n", " try:\n", " # Get the file paths for the matrix file to extract clinical data\n", " _, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n", " \n", " # Get raw clinical data from the matrix file\n", " _, clinical_raw = get_background_and_clinical_data(matrix_file)\n", " \n", " # Verify clinical data structure\n", " print(\"Raw clinical data shape:\", clinical_raw.shape)\n", " \n", " # Extract clinical features using the defined conversion functions\n", " clinical_features = geo_select_clinical_features(\n", " clinical_df=clinical_raw,\n", " trait=trait,\n", " trait_row=trait_row,\n", " convert_trait=convert_trait,\n", " age_row=age_row,\n", " convert_age=convert_age,\n", " gender_row=gender_row,\n", " convert_gender=convert_gender\n", " )\n", " \n", " print(\"Clinical features:\")\n", " print(clinical_features)\n", " \n", " # Save clinical features to file\n", " os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n", " clinical_features.to_csv(out_clinical_data_file)\n", " print(f\"Clinical features saved to {out_clinical_data_file}\")\n", " \n", " # 3. Link clinical and genetic data\n", " linked_data = geo_link_clinical_genetic_data(clinical_features, normalized_gene_data)\n", " print(f\"Linked data shape: {linked_data.shape}\")\n", " print(\"Linked data preview (first 5 rows, first 5 columns):\")\n", " print(linked_data.iloc[:5, :5])\n", " \n", " # 4. Handle missing values\n", " print(\"Missing values before handling:\")\n", " print(f\" Trait ({trait}) missing: {linked_data[trait].isna().sum()} out of {len(linked_data)}\")\n", " if 'Age' in linked_data.columns:\n", " print(f\" Age missing: {linked_data['Age'].isna().sum()} out of {len(linked_data)}\")\n", " if 'Gender' in linked_data.columns:\n", " print(f\" Gender missing: {linked_data['Gender'].isna().sum()} out of {len(linked_data)}\")\n", " \n", " gene_cols = [col for col in linked_data.columns if col not in [trait, 'Age', 'Gender']]\n", " print(f\" Genes with >20% missing: {sum(linked_data[gene_cols].isna().mean() > 0.2)}\")\n", " print(f\" Samples with >5% missing genes: {sum(linked_data[gene_cols].isna().mean(axis=1) > 0.05)}\")\n", " \n", " cleaned_data = handle_missing_values(linked_data, trait)\n", " print(f\"Data shape after handling missing values: {cleaned_data.shape}\")\n", " \n", " # 5. Evaluate bias in trait and demographic features\n", " is_trait_biased = False\n", " if len(cleaned_data) > 0:\n", " trait_biased, cleaned_data = judge_and_remove_biased_features(cleaned_data, trait)\n", " is_trait_biased = trait_biased\n", " else:\n", " print(\"No data remains after handling missing values.\")\n", " is_trait_biased = True\n", " \n", " # 6. Final validation and save\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=True, \n", " is_biased=is_trait_biased, \n", " df=cleaned_data,\n", " note=\"Dataset contains gene expression data comparing Duchenne muscular dystrophy vs healthy samples.\"\n", " )\n", " \n", " # 7. Save if usable\n", " if is_usable and len(cleaned_data) > 0:\n", " os.makedirs(os.path.dirname(out_data_file), exist_ok=True)\n", " cleaned_data.to_csv(out_data_file)\n", " print(f\"Linked data saved to {out_data_file}\")\n", " else:\n", " print(\"Data was determined to be unusable or empty and was not saved\")\n", " \n", " except Exception as e:\n", " print(f\"Error processing data: {e}\")\n", " # Handle the error case by still recording cohort info\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, # Mark as not available due to processing issues\n", " is_biased=True, \n", " df=pd.DataFrame(), # Empty dataframe\n", " note=f\"Error processing data: {str(e)}\"\n", " )\n", " print(\"Data was determined to be unusable and was not saved\")" ] } ], "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 }