{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "93035d74", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import scanpy as sc\n", "import ToppCellPy as tp\n", "import warnings\n", "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "markdown", "id": "d1e40555", "metadata": {}, "source": [ "### 1. load data" ] }, { "cell_type": "markdown", "id": "23ed8540", "metadata": {}, "source": [ "This PBMC dataset is from [Kang et al.2017](https://www.nature.com/articles/nbt.4042?report=reader), which includes two conditions (IFN stimulation and control) and six cell types. It can be downloaded from GSE96583." ] }, { "cell_type": "code", "execution_count": 2, "id": "f2fdf46b", "metadata": {}, "outputs": [], "source": [ "output_dir = \"/Users/jinmr2/Dropbox/Code/data/toppcell_test/\" # define output folder\n", "adata = sc.read(\"/Users/jinmr2/Dropbox/Code/data/batch2_all_normalized_filtered.h5ad\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "c363f6df", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "AnnData object with n_obs × n_vars = 24673 × 35635\n", " obs: 'tsne1', 'tsne2', 'ind', 'stim', 'cluster', 'cell', 'multiplets'\n", " var: 'gene symbol'\n", " uns: 'log1p'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "adata" ] }, { "cell_type": "code", "execution_count": 4, "id": "aae0c5d1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | tsne1 | \n", "tsne2 | \n", "ind | \n", "stim | \n", "cluster | \n", "cell | \n", "multiplets | \n", "
---|---|---|---|---|---|---|---|
AAACATACATTTCC-1 | \n", "-27.640373 | \n", "14.966629 | \n", "1016 | \n", "ctrl | \n", "9 | \n", "CD14+ Monocytes | \n", "singlet | \n", "
AAACATACCAGAAA-1 | \n", "-27.493646 | \n", "28.924885 | \n", "1256 | \n", "ctrl | \n", "9 | \n", "CD14+ Monocytes | \n", "singlet | \n", "
AAACATACCATGCA-1 | \n", "-10.468194 | \n", "-5.984389 | \n", "1488 | \n", "ctrl | \n", "3 | \n", "CD4 T cells | \n", "singlet | \n", "
AAACATACCTCGCT-1 | \n", "-24.367997 | \n", "20.429285 | \n", "1256 | \n", "ctrl | \n", "9 | \n", "CD14+ Monocytes | \n", "singlet | \n", "
AAACATACCTGGTA-1 | \n", "27.952170 | \n", "24.159738 | \n", "1039 | \n", "ctrl | \n", "4 | \n", "Dendritic cells | \n", "singlet | \n", "