{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "d4413a94", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:41:01.252916Z", "iopub.status.busy": "2025-03-25T05:41:01.252817Z", "iopub.status.idle": "2025-03-25T05:41:01.424215Z", "shell.execute_reply": "2025-03-25T05:41:01.423872Z" } }, "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 = \"Hemochromatosis\"\n", "cohort = \"GSE159676\"\n", "\n", "# Input paths\n", "in_trait_dir = \"../../input/GEO/Hemochromatosis\"\n", "in_cohort_dir = \"../../input/GEO/Hemochromatosis/GSE159676\"\n", "\n", "# Output paths\n", "out_data_file = \"../../output/preprocess/Hemochromatosis/GSE159676.csv\"\n", "out_gene_data_file = \"../../output/preprocess/Hemochromatosis/gene_data/GSE159676.csv\"\n", "out_clinical_data_file = \"../../output/preprocess/Hemochromatosis/clinical_data/GSE159676.csv\"\n", "json_path = \"../../output/preprocess/Hemochromatosis/cohort_info.json\"\n" ] }, { "cell_type": "markdown", "id": "12114e3a", "metadata": {}, "source": [ "### Step 1: Initial Data Loading" ] }, { "cell_type": "code", "execution_count": 2, "id": "4fef9f8d", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:41:01.425605Z", "iopub.status.busy": "2025-03-25T05:41:01.425471Z", "iopub.status.idle": "2025-03-25T05:41:01.480607Z", "shell.execute_reply": "2025-03-25T05:41:01.480318Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Background Information:\n", "!Series_title\t\"Portal fibroblasts with mesenchymal stem cell features form a reservoir of proliferative myofibroblasts in liver fibrosis\"\n", "!Series_summary\t\"Based on the identification of a transcriptomic signature, including Slit2, characterizing portal mesenchymal stem cells (PMSC) and derived myofibroblast (MF), we examined the gene expression profile of in liver tissue derived from multiple human liver disorders, including primary sclerosing cholangitis (PSC) (n=12), non-alcoholic steatohepatitis (NASH) (n=7) and other liver diseases (i.e., primary biliary cholangitis, autoimmune hepatitis, alcoholic liver disease and haemochromatosis) (n=8) and compared them to healthy controls (tumor free tissue from livers with metastasis from colorectal cancer) (n=5). We found that SLIT2 was overexpressed in the liver of patients with NASH, PSC and other chronic liver diseases. We also examined the microarray data of the human liver tissue samples for the transcriptomic signatures and found that in the different types of liver diseases the gene signature of PMSCs/PMSC-MFs was increased compared to normal liver, and correlated with the expression of ACTA2, COL1A1 and vWF.\"\n", "!Series_overall_design\t\"The RNA used for the microarray experiments was extracted from fresh frozen tissue obtained from explanted livers or diagnostic liver biopsies from 1) normal human liver tissue (tumor free tissue from livers with metastasis from colorectal cancer) (n=5) and 2) liver tissue from patients with chronic liver diseases, including primary sclerosing cholangitis (PSC) (n=12), non-alcoholic steatohepatitis (n=7) or other liver diseases (i.e., primary biliary cholangitis, autoimmune hepatitis, alcoholic liver disease and haemochromatosis) (n=8). The liver specimens were provided by the Norwegian biobank for primary sclerosing cholangitis, Oslo, Norway. The Affymetrix Human Gene 1.0 st array was used.\"\n", "Sample Characteristics Dictionary:\n", "{0: ['condition: Liver tissue healthy', 'condition: Non alcoholic steatohepatitis', 'condition: Primary sclerosing cholangitis', 'condition: Primary biliary cirrhosis', 'condition: Haemochromatosis', 'condition: Autoimmune hepatitis', 'condition: Alcohol related']}\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": "dfead5d8", "metadata": {}, "source": [ "### Step 2: Dataset Analysis and Clinical Feature Extraction" ] }, { "cell_type": "code", "execution_count": 3, "id": "f79922ab", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:41:01.481618Z", "iopub.status.busy": "2025-03-25T05:41:01.481517Z", "iopub.status.idle": "2025-03-25T05:41:01.488609Z", "shell.execute_reply": "2025-03-25T05:41:01.488320Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Preview of selected clinical features:\n", "{0: [0.0]}\n", "Clinical data saved to ../../output/preprocess/Hemochromatosis/clinical_data/GSE159676.csv\n" ] } ], "source": [ "import os\n", "import pandas as pd\n", "import json\n", "from typing import Callable, Optional, Dict, Any\n", "\n", "# Define if gene expression data is available\n", "is_gene_available = True # Based on the background information, this dataset uses microarray data (Affymetrix Human Gene 1.0)\n", "\n", "# Identify the row for trait data in sample characteristics dictionary\n", "trait_row = 0 # The conditions including Hemochromatosis are in row 0\n", "\n", "# Define data type conversion functions for trait (Hemochromatosis)\n", "def convert_trait(value):\n", " if value is None:\n", " return None\n", " # Extract value after colon if present\n", " if ':' in value:\n", " value = value.split(':', 1)[1].strip()\n", " \n", " # Check if the value indicates Hemochromatosis (case-insensitive)\n", " if 'haemochromatosis' in value.lower() or 'hemochromatosis' in value.lower():\n", " return 1\n", " else:\n", " return 0\n", "\n", "# Age and gender data are not available in the provided sample characteristics\n", "age_row = None\n", "gender_row = None\n", "\n", "def convert_age(value):\n", " return None # Not needed as age data is not available\n", "\n", "def convert_gender(value):\n", " return None # Not needed as gender data is not available\n", "\n", "# Determine trait availability\n", "is_trait_available = trait_row is not None\n", "\n", "# Initial validation and save metadata\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", "# If trait data is available, extract clinical features\n", "if trait_row is not None:\n", " # Make sure the clinical_data directory exists\n", " os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n", " \n", " try:\n", " # Create a DataFrame from the sample characteristics dictionary\n", " # Using the sample characteristics dictionary provided in the previous step\n", " sample_char_dict = {0: ['condition: Liver tissue healthy', 'condition: Non alcoholic steatohepatitis', \n", " 'condition: Primary sclerosing cholangitis', 'condition: Primary biliary cirrhosis', \n", " 'condition: Haemochromatosis', 'condition: Autoimmune hepatitis', 'condition: Alcohol related']}\n", " \n", " # Convert the dictionary to a DataFrame\n", " clinical_data = pd.DataFrame()\n", " for key, values in sample_char_dict.items():\n", " clinical_data[key] = values\n", " \n", " # Extract clinical features\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 dataframe\n", " preview = preview_df(selected_clinical_df)\n", " print(\"Preview of selected clinical features:\")\n", " print(preview)\n", " \n", " # Save to CSV\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\"An error occurred when processing clinical data: {e}\")\n", "else:\n", " print(\"No trait data available, skipping clinical feature extraction.\")\n" ] }, { "cell_type": "markdown", "id": "ca15c519", "metadata": {}, "source": [ "### Step 3: Gene Data Extraction" ] }, { "cell_type": "code", "execution_count": 4, "id": "9d4cb345", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:41:01.489614Z", "iopub.status.busy": "2025-03-25T05:41:01.489513Z", "iopub.status.idle": "2025-03-25T05:41:01.549813Z", "shell.execute_reply": "2025-03-25T05:41:01.549456Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Extracting gene data from matrix file:\n", "Successfully extracted gene data with 17046 rows\n", "First 20 gene IDs:\n", "Index(['7896754', '7896759', '7896761', '7896779', '7896798', '7896817',\n", " '7896822', '7896859', '7896863', '7896865', '7896878', '7896882',\n", " '7896908', '7896917', '7896921', '7896929', '7896952', '7896983',\n", " '7896985', '7897026'],\n", " dtype='object', name='ID')\n", "\n", "Gene expression data available: True\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. Extract gene expression data from the matrix file\n", "try:\n", " print(\"Extracting gene data from matrix file:\")\n", " gene_data = get_genetic_data(matrix_file)\n", " if gene_data.empty:\n", " print(\"Extracted gene expression data is empty\")\n", " is_gene_available = False\n", " else:\n", " print(f\"Successfully extracted gene data with {len(gene_data.index)} rows\")\n", " print(\"First 20 gene IDs:\")\n", " print(gene_data.index[:20])\n", " is_gene_available = True\n", "except Exception as e:\n", " print(f\"Error extracting gene data: {e}\")\n", " print(\"This dataset appears to have an empty or malformed gene expression matrix\")\n", " is_gene_available = False\n", "\n", "print(f\"\\nGene expression data available: {is_gene_available}\")\n" ] }, { "cell_type": "markdown", "id": "4a3d7fcc", "metadata": {}, "source": [ "### Step 4: Gene Identifier Review" ] }, { "cell_type": "code", "execution_count": 5, "id": "11bdb58d", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:41:01.551080Z", "iopub.status.busy": "2025-03-25T05:41:01.550960Z", "iopub.status.idle": "2025-03-25T05:41:01.552763Z", "shell.execute_reply": "2025-03-25T05:41:01.552501Z" } }, "outputs": [], "source": [ "# The gene identifiers shown are numeric IDs (like '7896754') which are not standard human gene symbols.\n", "# Human gene symbols typically follow patterns like 'BRCA1', 'TP53', etc.\n", "# These appear to be probe IDs or some other platform-specific identifiers that would need mapping.\n", "\n", "requires_gene_mapping = True\n" ] }, { "cell_type": "markdown", "id": "3f245b70", "metadata": {}, "source": [ "### Step 5: Gene Annotation" ] }, { "cell_type": "code", "execution_count": 6, "id": "e8f50226", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:41:01.553774Z", "iopub.status.busy": "2025-03-25T05:41:01.553679Z", "iopub.status.idle": "2025-03-25T05:41:02.685072Z", "shell.execute_reply": "2025-03-25T05:41:02.684687Z" } }, "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 = GSE159676\n", "Line 6: !Series_title = Portal fibroblasts with mesenchymal stem cell features form a reservoir of proliferative myofibroblasts in liver fibrosis\n", "Line 7: !Series_geo_accession = GSE159676\n", "Line 8: !Series_status = Public on Oct 21 2020\n", "Line 9: !Series_submission_date = Oct 20 2020\n", "Line 10: !Series_last_update_date = Mar 16 2022\n", "Line 11: !Series_pubmed_id = 35278227\n", "Line 12: !Series_summary = Based on the identification of a transcriptomic signature, including Slit2, characterizing portal mesenchymal stem cells (PMSC) and derived myofibroblast (MF), we examined the gene expression profile of in liver tissue derived from multiple human liver disorders, including primary sclerosing cholangitis (PSC) (n=12), non-alcoholic steatohepatitis (NASH) (n=7) and other liver diseases (i.e., primary biliary cholangitis, autoimmune hepatitis, alcoholic liver disease and haemochromatosis) (n=8) and compared them to healthy controls (tumor free tissue from livers with metastasis from colorectal cancer) (n=5). We found that SLIT2 was overexpressed in the liver of patients with NASH, PSC and other chronic liver diseases. We also examined the microarray data of the human liver tissue samples for the transcriptomic signatures and found that in the different types of liver diseases the gene signature of PMSCs/PMSC-MFs was increased compared to normal liver, and correlated with the expression of ACTA2, COL1A1 and vWF.\n", "Line 13: !Series_overall_design = The RNA used for the microarray experiments was extracted from fresh frozen tissue obtained from explanted livers or diagnostic liver biopsies from 1) normal human liver tissue (tumor free tissue from livers with metastasis from colorectal cancer) (n=5) and 2) liver tissue from patients with chronic liver diseases, including primary sclerosing cholangitis (PSC) (n=12), non-alcoholic steatohepatitis (n=7) or other liver diseases (i.e., primary biliary cholangitis, autoimmune hepatitis, alcoholic liver disease and haemochromatosis) (n=8). The liver specimens were provided by the Norwegian biobank for primary sclerosing cholangitis, Oslo, Norway. The Affymetrix Human Gene 1.0 st array was used.\n", "Line 14: !Series_type = Expression profiling by array\n", "Line 15: !Series_contributor = Trine,,Folseraas.\n", "Line 16: !Series_sample_id = GSM4837490\n", "Line 17: !Series_sample_id = GSM4837491\n", "Line 18: !Series_sample_id = GSM4837492\n", "Line 19: !Series_sample_id = GSM4837493\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": "e7e28091", "metadata": {}, "source": [ "### Step 6: Gene Identifier Mapping" ] }, { "cell_type": "code", "execution_count": 7, "id": "2285841e", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:41:02.686407Z", "iopub.status.busy": "2025-03-25T05:41:02.686276Z", "iopub.status.idle": "2025-03-25T05:41:04.032747Z", "shell.execute_reply": "2025-03-25T05:41:04.032146Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Gene identifiers in gene_data are numerical IDs like: Index(['7896754', '7896759', '7896761', '7896779', '7896798'], dtype='object', name='ID')\n", "\n", "Examining gene annotation columns to find appropriate mappings:\n", "Column 'ID': 7896736\n", "Column 'GB_LIST': nan\n", "Column 'SPOT_ID': chr1:53049-54936\n", "Column 'seqname': chr1\n", "Column 'RANGE_GB': NC_000001.10\n", "Column 'RANGE_STRAND': +\n", "Column 'RANGE_START': 53049\n", "Column 'RANGE_STOP': 54936\n", "Column 'total_probes': 7\n", "Column 'gene_assignment': ---\n", "Column 'mrna_assignment': NONHSAT060105 // NONCODE // Non-coding transcript identified by NONCODE // chr1 // 100 // 100 // 7 // 7 // 0\n", "Column 'category': main\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "Preview of mapping dataframe before filtering:\n", " ID Gene\n", "0 7896736 []\n", "1 7896738 [OR4G2P, OR4G11P, OR4G1P]\n", "2 7896740 [OR4F4, OR4F17, OR4F5, BC136848, BC136867, BC1...\n", "3 7896742 [F-, AK298283, AL137655, BC032332, PCMTD2, L-,...\n", "4 7896744 [OR4F29, OR4F3, OR4F16, OR4F21, OR4F7P, OR4F1P...\n", "Total mappings before filtering: 33297\n", "Total mappings after filtering empty genes: 25127\n", "\n", "Sample of successfully extracted genes:\n", "ID: 7896738, Genes: ['OR4G2P', 'OR4G11P', 'OR4G1P']\n", "ID: 7896740, Genes: ['OR4F4', 'OR4F17', 'OR4F5', 'BC136848', 'BC136867', 'BC136907', 'BC136908']\n", "ID: 7896742, Genes: ['F-', 'AK298283', 'AL137655', 'BC032332', 'PCMTD2', 'L-', 'D-', 'O-', 'BC118988', 'BC122537', 'BC131690', 'SEPT14', 'AK301928']\n", "ID: 7896744, Genes: ['OR4F29', 'OR4F3', 'OR4F16', 'OR4F21', 'OR4F7P', 'OR4F1P', 'OR4F2P', 'OR4F28P', 'BC137547', 'BC137568', 'OR4F8P']\n", "ID: 7896746, Genes: ['MT-TM']\n", "\n", "Preview of gene expression data after mapping:\n", "Number of unique genes: 0\n", "No genes were mapped! Checking for potential issues...\n", "\n", "Checking if gene_data indices exist in mapping_df:\n", "\n", "Attempting alternative mapping approach...\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Direct mapping created with 25127 entries\n", "Created new mapping dataframe with 25127 rows\n", "Alternative approach results: 0 genes mapped\n", "Alternative approach also failed to map genes\n", "Empty gene expression data saved to ../../output/preprocess/Hemochromatosis/gene_data/GSE159676.csv\n", "\n", "Shape of gene expression data: (0, 33)\n" ] } ], "source": [ "# 1. First, observe the gene identifiers in gene_data and find matching identifiers in gene annotation\n", "print(\"Gene identifiers in gene_data are numerical IDs like:\", gene_data.index[:5])\n", "print(\"\\nExamining gene annotation columns to find appropriate mappings:\")\n", "for col in gene_annotation.columns:\n", " print(f\"Column '{col}': {gene_annotation[col].iloc[0]}\")\n", "\n", "# Based on observation, the 'ID' column in gene_annotation matches our gene_data index format\n", "# The 'gene_assignment' column contains gene information including gene symbols\n", "\n", "# 2. Create mapping dataframe with ID and Gene columns\n", "# Use the built-in extract_human_gene_symbols function which is designed to parse gene symbols\n", "mapping_df = pd.DataFrame({\n", " 'ID': gene_annotation['ID'].astype(str),\n", " 'Gene': gene_annotation['gene_assignment'].apply(extract_human_gene_symbols)\n", "})\n", "\n", "print(\"\\nPreview of mapping dataframe before filtering:\")\n", "print(mapping_df.head())\n", "print(f\"Total mappings before filtering: {len(mapping_df)}\")\n", "\n", "# Filter out empty gene lists\n", "mapping_df = mapping_df[mapping_df['Gene'].apply(lambda x: len(x) > 0)]\n", "print(f\"Total mappings after filtering empty genes: {len(mapping_df)}\")\n", "\n", "# Print the first few rows with genes to verify extraction\n", "print(\"\\nSample of successfully extracted genes:\")\n", "sample_genes = mapping_df.head(5)\n", "for idx, row in sample_genes.iterrows():\n", " print(f\"ID: {row['ID']}, Genes: {row['Gene']}\")\n", "\n", "# 3. Apply gene mapping to convert probe-level measurements to gene expression data\n", "gene_data = apply_gene_mapping(gene_data, mapping_df)\n", "\n", "print(\"\\nPreview of gene expression data after mapping:\")\n", "print(f\"Number of unique genes: {len(gene_data.index)}\")\n", "if len(gene_data.index) > 0:\n", " print(\"First 10 gene symbols:\")\n", " print(gene_data.index[:10])\n", " # Save the gene data to file\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", "else:\n", " print(\"No genes were mapped! Checking for potential issues...\")\n", " \n", " # Additional diagnostics\n", " print(\"\\nChecking if gene_data indices exist in mapping_df:\")\n", " sample_indices = list(gene_data.index[:5])\n", " for idx in sample_indices:\n", " print(f\"Index {idx} exists in mapping_df: {idx in mapping_df['ID'].values}\")\n", " \n", " # Try an alternative approach with a more direct mapping\n", " print(\"\\nAttempting alternative mapping approach...\")\n", " direct_mapping = {}\n", " for idx, row in mapping_df.iterrows():\n", " probe_id = row['ID']\n", " genes = row['Gene']\n", " if genes:\n", " for gene in genes:\n", " if probe_id not in direct_mapping:\n", " direct_mapping[probe_id] = []\n", " direct_mapping[probe_id].append(gene)\n", " \n", " # Check if we have mappings for some of our gene_data indices\n", " print(f\"Direct mapping created with {len(direct_mapping)} entries\")\n", " for idx in sample_indices:\n", " print(f\"Probe {idx} maps to: {direct_mapping.get(idx, 'No mapping')}\")\n", " \n", " # Create a new mapping dataframe and try again\n", " new_mapping_rows = []\n", " for probe_id, genes in direct_mapping.items():\n", " new_mapping_rows.append({'ID': probe_id, 'Gene': genes})\n", " \n", " if new_mapping_rows:\n", " new_mapping_df = pd.DataFrame(new_mapping_rows)\n", " print(f\"Created new mapping dataframe with {len(new_mapping_df)} rows\")\n", " \n", " # Try applying gene mapping again\n", " gene_data_alt = apply_gene_mapping(gene_data, new_mapping_df)\n", " print(f\"Alternative approach results: {len(gene_data_alt.index)} genes mapped\")\n", " \n", " if len(gene_data_alt.index) > 0:\n", " print(\"First 10 gene symbols from alternative approach:\")\n", " print(gene_data_alt.index[:10])\n", " gene_data = gene_data_alt # Use the alternative results\n", " \n", " # Save the gene data to file\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", " else:\n", " print(\"Alternative approach also failed to map genes\")\n", " # Save empty dataframe as fallback\n", " gene_data.to_csv(out_gene_data_file)\n", " print(f\"Empty gene expression data saved to {out_gene_data_file}\")\n", " else:\n", " print(\"Could not create alternative mapping\")\n", " # Save empty dataframe as fallback\n", " gene_data.to_csv(out_gene_data_file)\n", " print(f\"Empty gene expression data saved to {out_gene_data_file}\")\n", "\n", "print(\"\\nShape of gene expression data:\", gene_data.shape)\n" ] }, { "cell_type": "markdown", "id": "5d89eabe", "metadata": {}, "source": [ "### Step 7: Data Normalization and Linking" ] }, { "cell_type": "code", "execution_count": null, "id": "c167c079", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "08f5a7c2", "metadata": {}, "source": [ "### Step 8: Data Normalization and Linking" ] }, { "cell_type": "code", "execution_count": 8, "id": "766d6303", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T05:41:04.034847Z", "iopub.status.busy": "2025-03-25T05:41:04.034702Z", "iopub.status.idle": "2025-03-25T05:41:04.188016Z", "shell.execute_reply": "2025-03-25T05:41:04.187360Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Gene data shape before normalization: (17047, 33)\n", "Gene data shape after normalization: (0, 33)\n", "Normalized gene data saved to ../../output/preprocess/Hemochromatosis/gene_data/GSE159676.csv\n", "Clinical data saved to ../../output/preprocess/Hemochromatosis/clinical_data/GSE159676.csv\n", "Linked data shape: (33, 1)\n", "Abnormality detected in the cohort: GSE159676. Preprocessing failed.\n", "A new JSON file was created at: ../../output/preprocess/Hemochromatosis/cohort_info.json\n", "Dataset usability: False\n", "Dataset does not contain Height data and cannot be used for association studies.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_39342/939407384.py:13: DtypeWarning: Columns (0) have mixed types. Specify dtype option on import or set low_memory=False.\n", " gene_data = pd.read_csv(file, sep='\\t', index_col=0)\n" ] } ], "source": [ "import numpy as np\n", "import os\n", "import gzip\n", "\n", "# 1. Extract gene expression data using the alternative approach that worked in Step 3\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", " gene_data = pd.read_csv(file, sep='\\t', index_col=0)\n", "\n", "# Check if we have gene data before proceeding\n", "if gene_data.empty:\n", " print(\"No gene expression data found in the matrix file.\")\n", " is_gene_available = False\n", "else:\n", " is_gene_available = True\n", " print(f\"Gene data shape before normalization: {gene_data.shape}\")\n", "\n", " # Normalize gene symbols using the NCBI Gene database information\n", " try:\n", " normalized_gene_data = normalize_gene_symbols_in_index(gene_data)\n", " print(f\"Gene data shape after normalization: {normalized_gene_data.shape}\")\n", " \n", " # Save the normalized gene data to the output file\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", " except Exception as e:\n", " print(f\"Error normalizing gene data: {e}\")\n", " is_gene_available = False\n", " normalized_gene_data = gene_data # Use original data if normalization fails\n", "\n", "# 2. Link clinical and genetic data\n", "# In Step 2, we determined that Height data is not available in this dataset (trait_row = None)\n", "# Create a minimal clinical dataframe with the trait column (containing NaNs)\n", "if is_gene_available:\n", " sample_ids = gene_data.columns\n", " minimal_clinical_df = pd.DataFrame(index=sample_ids)\n", " minimal_clinical_df[trait] = np.nan # Add the trait column with NaN values\n", "\n", " # If we have age and gender data from Step 2, add those columns\n", " if age_row is not None:\n", " minimal_clinical_df['Age'] = get_feature_data(clinical_data, age_row, 'Age', convert_age).iloc[0]\n", "\n", " if gender_row is not None:\n", " minimal_clinical_df['Gender'] = get_feature_data(clinical_data, gender_row, 'Gender', convert_gender).iloc[0]\n", "\n", " minimal_clinical_df.index.name = 'Sample'\n", "\n", " # Save this minimal clinical data for reference\n", " os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n", " minimal_clinical_df.to_csv(out_clinical_data_file)\n", " print(f\"Clinical data saved to {out_clinical_data_file}\")\n", "\n", " # Create a linked dataset \n", " if is_gene_available and normalized_gene_data is not None:\n", " linked_data = pd.concat([minimal_clinical_df, normalized_gene_data.T], axis=1)\n", " linked_data.index.name = 'Sample'\n", " print(f\"Linked data shape: {linked_data.shape}\")\n", " else:\n", " linked_data = minimal_clinical_df\n", " print(\"No gene data to link with clinical data.\")\n", "else:\n", " # Create a minimal dataframe with just the trait for the validation step\n", " linked_data = pd.DataFrame({trait: [np.nan]})\n", " print(\"No gene data available, creating minimal dataframe for validation.\")\n", "\n", "# 4 & 5. Validate and save cohort information\n", "# Since trait_row was None in Step 2, we know Height data is not available\n", "is_trait_available = False # Height data is not available\n", "\n", "note = \"Dataset contains gene expression data but no Height measurements. This dataset is not usable for studying Height associations.\"\n", "\n", "# For datasets without trait data, we set is_biased to False\n", "# This indicates the dataset is not usable due to missing trait data, not due to bias\n", "is_biased = False\n", "\n", "# Final validation\n", "is_usable = validate_and_save_cohort_info(\n", " is_final=True, \n", " cohort=cohort, \n", " info_path=json_path, \n", " is_gene_available=is_gene_available, \n", " is_trait_available=is_trait_available, \n", " is_biased=is_biased,\n", " df=linked_data,\n", " note=note\n", ")\n", "\n", "# 6. Since there is no trait data, the dataset is not usable for our association study\n", "# So we should not save it to out_data_file\n", "print(f\"Dataset usability: {is_usable}\")\n", "if is_usable:\n", " os.makedirs(os.path.dirname(out_data_file), exist_ok=True)\n", " linked_data.to_csv(out_data_file)\n", " print(f\"Linked data saved to {out_data_file}\")\n", "else:\n", " print(\"Dataset does not contain Height data and cannot be used for association studies.\")" ] } ], "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 }