{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Pathway perturbation" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/mnt/md0/yumin/UNAGI_old/src/perturbation_general.py:39: ImplicitModificationWarning: Trying to modify attribute `.obs` of view, initializing view as actual.\n", " adata.obs['leiden'] = adata.obs['leiden'].astype('string')\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/mnt/md0/yumin/UNAGI_old/src/perturbation_general.py:39: ImplicitModificationWarning: Trying to modify attribute `.obs` of view, initializing view as actual.\n", " adata.obs['leiden'] = adata.obs['leiden'].astype('string')\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/mnt/md0/yumin/UNAGI_old/src/perturbation_general.py:39: ImplicitModificationWarning: Trying to modify attribute `.obs` of view, initializing view as actual.\n", " adata.obs['leiden'] = adata.obs['leiden'].astype('string')\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/mnt/md0/yumin/UNAGI_old/src/perturbation_general.py:39: ImplicitModificationWarning: Trying to modify attribute `.obs` of view, initializing view as actual.\n", " adata.obs['leiden'] = adata.obs['leiden'].astype('string')\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n", "/home/yumin/anaconda3/envs/wks/lib/python3.9/site-packages/anndata/_core/anndata.py:1118: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n", " if not is_categorical_dtype(df_full[k]):\n" ] } ], "source": [ "#pathway perturbation results\n", "import scanpy as sc\n", "import numpy as np\n", "import pickle\n", "from UNAGI.speedup_perturbation import perturbation\n", "adata = sc.read_h5ad('dataset.h5ad')\n", "uns = pickle.load(open('attribute.pkl', 'rb'))\n", "keys = list(uns['random_background_perturbation_deltaD']['0.5'].keys()).copy()\n", "del uns['random_background_perturbation_deltaD']['0.5']\n", "del uns['random_background_perturbation_deltaD']['2.0']\n", "del uns['pathway_perturbation_score']\n", "\n", "adata.uns = uns\n", "#pathway median gene len: 4\n", "#pathway mean gene len: 8\n", "a = perturbation(adata, 'model_save/mes_4.pth','idrem')\n", "\n", "\n", "a.run('random_background',0.5,random_genes=20,random_times=1000,inplace=True)\n", "a.run('pathway',0.5,inplace=True)\n", "a.analysis('pathway',0.5)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "pd.DataFrame.from_dict(adata.uns['pathway_perturbation_score']['0.5']['total']['top_pathways']).to_csv('pathway_results.csv')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Drug perturbation" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#drug perturbation results\n", "import scanpy as sc\n", "import numpy as np\n", "import pickle\n", "from UNAGI.speedup_perturbation import perturbation\n", "adata = sc.read_h5ad('dataset.h5ad')\n", "uns = pickle.load(open('attribute.pkl', 'rb'))\n", "keys = list(uns['random_background_perturbation_deltaD']['0.5'].keys()).copy()\n", "del uns['random_background_perturbation_deltaD']['0.5']\n", "del uns['random_background_perturbation_deltaD']['2.0']\n", "del uns['pathway_perturbation_score']\n", "\n", "adata.uns = uns\n", "#drug median gene len: 2\n", "#drug mean gene len: 2\n", "a = perturbation(adata, 'model_save/mes_4.pth','idrem')\n", "\n", "a.run('random_background',0.5,random_genes=20,random_times=1000,inplace=True)\n", "a.run('drug',0.5,inplace=True)\n", "a.analysis('drug',0.5)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "pd.DataFrame.from_dict(adata.uns['drug_perturbation_score']['0.5']['total']['top_compounds']).to_csv('drug_results.csv')" ] } ], "metadata": { "kernelspec": { "display_name": "wks", "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.18" } }, "nbformat": 4, "nbformat_minor": 2 }