{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "461d7761", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T07:00:18.889703Z", "iopub.status.busy": "2025-03-25T07:00:18.889550Z", "iopub.status.idle": "2025-03-25T07:00:19.056212Z", "shell.execute_reply": "2025-03-25T07:00:19.055827Z" } }, "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 = \"Bone_Density\"\n", "\n", "# Input paths\n", "tcga_root_dir = \"../../input/TCGA\"\n", "\n", "# Output paths\n", "out_data_file = \"../../output/preprocess/Bone_Density/TCGA.csv\"\n", "out_gene_data_file = \"../../output/preprocess/Bone_Density/gene_data/TCGA.csv\"\n", "out_clinical_data_file = \"../../output/preprocess/Bone_Density/clinical_data/TCGA.csv\"\n", "json_path = \"../../output/preprocess/Bone_Density/cohort_info.json\"\n" ] }, { "cell_type": "markdown", "id": "b4e032e6", "metadata": {}, "source": [ "### Step 1: Initial Data Loading" ] }, { "cell_type": "code", "execution_count": 2, "id": "427fe1ea", "metadata": { "execution": { "iopub.execute_input": "2025-03-25T07:00:19.057737Z", "iopub.status.busy": "2025-03-25T07:00:19.057582Z", "iopub.status.idle": "2025-03-25T07:00:19.064119Z", "shell.execute_reply": "2025-03-25T07:00:19.063799Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "No suitable directory found in TCGA for Bone_Density.\n", "TCGA focuses on cancer types, not directly on bone density measurements.\n", "Skipping this trait as recommended in the guidelines.\n" ] }, { "data": { "text/plain": [ "False" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import os\n", "import pandas as pd\n", "\n", "# 1. Find the most relevant directory for Bone Density\n", "subdirectories = os.listdir(tcga_root_dir)\n", "target_trait = trait.lower().replace(\"_\", \" \") # Convert to lowercase for case-insensitive matching\n", "\n", "# Words related to bone density that might appear in directory names\n", "bone_related_terms = [\"bone\", \"density\", \"osteoporosis\", \"skeletal\", \"osseous\"]\n", "\n", "# First try direct matches\n", "matched_dir = None\n", "for subdir in subdirectories:\n", " subdir_lower = subdir.lower()\n", " # Check if any bone-related term is in the directory name\n", " if any(term in subdir_lower for term in bone_related_terms):\n", " matched_dir = subdir\n", " break\n", "\n", "# If no direct match found, look specifically for Sarcoma as it may include bone sarcomas\n", "if not matched_dir:\n", " for subdir in subdirectories:\n", " if \"sarcoma_(sarc)\" in subdir.lower():\n", " matched_dir = subdir\n", " break\n", "\n", "# No suitable directory found - we should skip this trait\n", "print(f\"No suitable directory found in TCGA for {trait}.\")\n", "print(\"TCGA focuses on cancer types, not directly on bone density measurements.\")\n", "print(\"Skipping this trait as recommended in the guidelines.\")\n", "\n", "validate_and_save_cohort_info(\n", " is_final=False,\n", " cohort=\"TCGA\",\n", " info_path=json_path,\n", " is_gene_available=False,\n", " is_trait_available=False\n", ")" ] } ], "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 }