sc.tl.rank_genes_groups()问题

今天被问到了一个关于sc.tl.rank_genes_groups()的奇怪的问题

复制代码
import scanpy as sc
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt 
# from CellDART import da_cellfraction
# from CellDART.utils import random_mix
from sklearn.manifold import TSNE

ref_adata = sc.read_h5ad("./scRNA.h5ad")
ref_adata
复制代码
ref_adata.var_names_make_unique()  
sc.pp.normalize_total(ref_adata)
sc.pp.log1p(ref_adata)

#PCA and clustering 
sc.tl.pca(ref_adata, svd_solver='arpack')
sc.pp.neighbors(ref_adata, n_neighbors=6, n_pcs=40)
sc.tl.umap(ref_adata)
sc.tl.leiden(ref_adata, resolution = 0.5)
sc.pl.umap(ref_adata, color=['leiden','cellType'])
复制代码
sc.tl.rank_genes_groups(ref_adata, 'cellType', method='wilcoxon')
sc.pl.rank_genes_groups(ref_adata, n_genes=15, sharey=False)


可以看到这里的检验结果是以数字的形式显示,而不是以基因的形式显示的

解决办法

这个需要注意,有时间可以研究一下sc.tl.rank_genes_groups()内部是怎么实现的

相关推荐
databook1 小时前
探索视觉的边界:用 Manim 重现有趣的知觉错觉
python·动效
明月_清风2 小时前
Python 性能微观世界:列表推导式 vs for 循环
后端·python
明月_清风2 小时前
Python 性能翻身仗:从 O(n) 到 O(1) 的工程实践
后端·python
helloweilei18 小时前
python 抽象基类
python
用户83562907805119 小时前
Python 实现 PPT 转 HTML
后端·python
zone77391 天前
004:RAG 入门-LangChain读取PDF
后端·python·面试
zone77391 天前
005:RAG 入门-LangChain读取表格数据
后端·python·agent
树獭非懒2 天前
AI大模型小白手册|Embedding 与向量数据库
后端·python·llm
唐叔在学习2 天前
就算没有服务器,我照样能够同步数据
后端·python·程序员
曲幽2 天前
FastAPI流式输出实战与避坑指南:让AI像人一样“边想边说”
python·ai·fastapi·web·stream·chat·async·generator·ollama