{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Junction-Level Differential Gene Analysis (JDEG)\n", "\n", "In this section, we perform junction-level differential gene analysis using the adjacency matrix. \n", "This analysis aims to identify genes that exhibit significant differences in junction-level expression \n", "between different conditions or cell types.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Step 1: Identify Junction Markers Using MAST\n", "\n", "This step is identical to [Step1](./step7_1_MAST.ipynb)of the EDEG analysis. \n", "The only difference is that the input_anndata file is changed to AdjacencyComp_PDAC.h5ad, which contains junction-level features instead of exon-level ones.\n", "The rest of the analysis pipeline remains the same, including the use of the MAST model through Seurat." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Step 2: Identify Junction-Level Markers Using Exon-Level Information\n", "\n", "To determine gene-level differential expression, we now aggregate exon marker information by gene, enabling a higher-level view of differences.\n", "\n", "The following function converts junction-level marker results from Seurat into gene-level statistical information. It uses the Stouffer method to combine junction p-values, and also computes average log2 fold changes.\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from DOLPHIN.EDEG.generate_JDEG import run_jdeg" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "pd_JDEG = run_jdeg(seurat_output = \"/mnt/data/kailu/00_scExon/10_GO_PDAC/02_model/02_exon_adj/MAST/AdjacencyComp_MAST_ductal.csv\", \n", " output = \"./PDAC_MAST_ductal_junction_final.csv\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Exon_namesp_valavg_log2FCpct.1pct.2p_val_adjGene_namesMAST_abs_avg_log2FCMAST_stouffer_pvalMAST_stouffer_pval_adj_bonf
0RPS26-124.578045e-194-2.6277070.9490.9896.177248e-189RPS261.9239626.474450e-1536.062675e-149
1FXYD2-225.593814e-170-4.9294070.2990.9947.547845e-165FXYD24.1195120.000000e+000.000000e+00
2FXYD2-323.611924e-162-4.7671750.2260.9944.873642e-157FXYD24.1195120.000000e+000.000000e+00
3RPL34-85.754681e-156-2.0056950.9961.0007.764906e-151RPL342.0078405.145729e-1434.818461e-139
4FXYD2-421.697355e-154-4.5205030.1650.9892.290275e-149FXYD24.1195120.000000e+000.000000e+00
\n", "
" ], "text/plain": [ " Exon_names p_val avg_log2FC pct.1 pct.2 p_val_adj \\\n", "0 RPS26-12 4.578045e-194 -2.627707 0.949 0.989 6.177248e-189 \n", "1 FXYD2-22 5.593814e-170 -4.929407 0.299 0.994 7.547845e-165 \n", "2 FXYD2-32 3.611924e-162 -4.767175 0.226 0.994 4.873642e-157 \n", "3 RPL34-8 5.754681e-156 -2.005695 0.996 1.000 7.764906e-151 \n", "4 FXYD2-42 1.697355e-154 -4.520503 0.165 0.989 2.290275e-149 \n", "\n", " Gene_names MAST_abs_avg_log2FC MAST_stouffer_pval \\\n", "0 RPS26 1.923962 6.474450e-153 \n", "1 FXYD2 4.119512 0.000000e+00 \n", "2 FXYD2 4.119512 0.000000e+00 \n", "3 RPL34 2.007840 5.145729e-143 \n", "4 FXYD2 4.119512 0.000000e+00 \n", "\n", " MAST_stouffer_pval_adj_bonf \n", "0 6.062675e-149 \n", "1 0.000000e+00 \n", "2 0.000000e+00 \n", "3 4.818461e-139 \n", "4 0.000000e+00 " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd_JDEG.head()" ] } ], "metadata": { "kernelspec": { "display_name": "DOLPHIN", "language": "python", "name": "python3" }, "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.15" } }, "nbformat": 4, "nbformat_minor": 2 }