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()内部是怎么实现的

相关推荐
向科→向总工→空间动态计系统17 分钟前
机器人大脑系统
开发语言·人工智能·python·机器人
染指111018 分钟前
194.DeepAgents-在DeepAgents中使用自定义沙盒环境OpenSandBox
网络·人工智能·python·langchain·deepagents
m0_646429971 小时前
LangGraph 学习笔记(一):StateGraph 与状态管理
python·langgraph
Dmz丶1 小时前
前端转 AI 100 天 Day 57:RAG 项目实战(六)——上线后迭代,从“能用”到“越用越好”
python
小小-猿2 小时前
用 Python 写昇腾算子:pyasc 是怎么回事
开发语言·python·昇腾·cann·pyasc
蓝蓝的代码人3 小时前
用 Python、Qt 和 Vue 做一个 Windows 股票看盘工具,观潮的行情小窗与桌面提醒
vue.js·python·qt·开源·桌面应用
富贵儿9983 小时前
NL2SQL 实践手记 10:从命令行到网页查询——把整个系列串起来
数据库·python·sql·ai·自然语言处理·langchain
fengkai45453 小时前
Python对接LangChain智能体开发(Tool工具调用与 Agent智能体)
运维·开发语言·python·langchain·llm·ai agent·tool
小白的高手之路3 小时前
【LeetCode 热题 100】560. 和为 K 的子数组|前缀和、哈希表(Python)
数据结构·笔记·python·算法·leetcode·力扣·散列表
专注仿真4 小时前
仿真智能体训练(评估篇):鲁棒性/泛化测试算法详解与实战
人工智能·python·算法·afsim智能体训练·评估算法·鲁棒性算法·泛化测试算法