{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Loading CCI results\n", "\n", "This tutorial shows how to load CCI results from different CCI tools" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import mmcci" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## stLearn\n", "\n", "We can load stLearn outputs from the path of the `h5ad` file that has been run through stLearn" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "stlearn = mmcci.io.read_stLearn('/path/to/stLearn.h5ad')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also convert AnnData objects that have been processed with stLearn" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "stlearn = mmcci.io.convert_stLearn(adata)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## CellPhoneDB\n", "\n", "We can load CellPhoneDB outputs from the interaction scores text file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cellphonedb = mmcci.io.read_CellPhoneDB('/path/to/interaction_scores.txt')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Squidpy\n", "\n", "We can load Squidpy results from running `squidpy.gr.ligrec`, which is a Python dict.\n", "This can be saved as a pkl file and loaded in." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pickle\n", "\n", "with open('/path/to/squidpy_dict.pkl', 'rb') as f:\n", " squidpy_dict = pickle.load(f)\n", "\n", "squidpy = mmcci.io.read_Squidpy(squidpy_dict)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also load single networks such as `squidpy.gr.interaction_matrix`" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "squidpy = mmcci.io.read_network('/path/to/network.csv')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## CellChat\n", "\n", "We can load CellChat outputs from the path of the `cellchat_out@dr`, saved as a `csv` file." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cellchat = mmcci.io.read_CellChat('/path/to/cellchat_dr.csv')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## NATMI\n", "\n", "We can load NATMI outputs from the `Edges_lrc2p.csv` file that is outputted from NATMI" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "natmi = mmcci.io.read_NATMI('/path/to/Edges_lrc2p.csv')" ] } ], "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.9.undefined" } }, "nbformat": 4, "nbformat_minor": 2 }