{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### custom signatures and ssGSEA method" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from GSVA import gmt_to_dataframe\n", "import gseapy as gp" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Gene Symbols Conversion for the GMT file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "custom_signatures = gmt_to_dataframe(\"tests/extdata/enrichr.KEGG_2016.gmt\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### ssGSEA method\n", "ref: https://gseapy.readthedocs.io/en/latest/singlecell_example.html" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "res = gp.gsea(data=adata.to_df().T, # row -> genes, column-> samples\n", " gene_sets=\"tests/extdata/enrichr.KEGG_2016.gmt\",\n", " cls=adata.obs.stim,\n", " permutation_num=1000,\n", " permutation_type='phenotype',\n", " outdir=None,\n", " method='s2n', # signal_to_noise\n", " threads= 16)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }