From 0dbe8dfa45ff15db86cf18fb610ec94f4e1fea2b Mon Sep 17 00:00:00 2001 From: Shen Ling Date: Wed, 2 Dec 2020 11:58:11 +0000 Subject: [PATCH] fix bug --- ...udy_Mouse-intestinal-epithelium_1906.ipynb | 84 +++---------------- 1 file changed, 13 insertions(+), 71 deletions(-) diff --git a/latest_notebook/Case-study_Mouse-intestinal-epithelium_1906.ipynb b/latest_notebook/Case-study_Mouse-intestinal-epithelium_1906.ipynb index ec67843..457ae18 100644 --- a/latest_notebook/Case-study_Mouse-intestinal-epithelium_1906.ipynb +++ b/latest_notebook/Case-study_Mouse-intestinal-epithelium_1906.ipynb @@ -110,10 +110,10 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "scanpy==1.4.3+80.g740c557 anndata==0.6.22rc1 umap==0.3.9 numpy==1.16.2 scipy==1.3.0 pandas==0.24.1 scikit-learn==0.20.2 statsmodels==0.10.0rc2 python-igraph==0.7.1 louvain==0.6.1\n" + "scanpy==1.4.6 anndata==0.7.1 umap==0.4.0 numpy==1.18.2 scipy==1.4.1 pandas==1.0.3 scikit-learn==0.22.2.post1 statsmodels==0.11.1 python-igraph==0.8.0 louvain==0.6.1\n" ] } ], @@ -204,8 +204,8 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836573_Regional_Duo_M1_matrix.h5ad\n" ] @@ -247,75 +247,16 @@ "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836574_Regional_Duo_M2_matrix.h5ad\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Making variable names unique for controlled concatenation.\n", - "Observation names are not unique. To make them unique, call `.obs_names_make_unique`.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836575_Regional_Jej_M1_matrix.h5ad\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Observation names are not unique. To make them unique, call `.obs_names_make_unique`.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836576_Regional_Jej_M2_matrix.h5ad\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Observation names are not unique. To make them unique, call `.obs_names_make_unique`.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836577_Regional_Il_M1_matrix.h5ad\n" - ] - }, - { - "name": "stderr", "output_type": "stream", - "text": [ - "Observation names are not unique. To make them unique, call `.obs_names_make_unique`.\n" - ] - }, - { "name": "stdout", - "output_type": "stream", "text": [ + "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836574_Regional_Duo_M2_matrix.h5ad\n", + "Making variable names unique for controlled concatenation.\n", + "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836575_Regional_Jej_M1_matrix.h5ad\n", + "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836576_Regional_Jej_M2_matrix.h5ad\n", + "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836577_Regional_Il_M1_matrix.h5ad\n", "... reading from cache file cache/..-data-Haber-et-al_mouse-intestinal-epithelium-GSE92332_RAW-GSM2836578_Regional_Il_M2_matrix.h5ad\n" ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Observation names are not unique. To make them unique, call `.obs_names_make_unique`.\n" - ] } ], "source": [ @@ -351,8 +292,9 @@ "\n", " # Concatenate to main adata object\n", " adata = adata.concatenate(adata_tmp, batch_key='sample_id')\n", - " adata.var['gene_id'] = adata.var['gene_id-1']\n", - " adata.var.drop(columns = ['gene_id-1', 'gene_id-0'], inplace=True)\n", + " if 'gene_id_1' in adata.var.columns:\n", + " adata.var['gene_id'] = adata.var['gene_id-1']\n", + " adata.var.drop(columns = ['gene_id-1', 'gene_id-0'], inplace=True)\n", " adata.obs.drop(columns=['sample_id'], inplace=True)\n", " adata.obs_names = [c.split(\"-\")[0] for c in adata.obs_names]\n", " adata.obs_names_make_unique(join='_')" @@ -6532,7 +6474,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.7.7-final" }, "toc": { "base_numbering": "0", @@ -6584,4 +6526,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file