微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python scipy包进行GO富集分析p值计算

最近总是有需要单独对某一个类型的通路进行超几何分布的p值计算,这里记录一下python包的计算方法

使用scipy的stat里面的hypergeom.sf方法进行富集分析的p值计算

hsaxxxxx AA and Linoleic Metabolism KEGG pathways Pathways KEGG (Homo sapiens (human)) 59 17 3586 141 3.32E-11

------------ set in set background in background
pathway 59 17 3586 141
description k x m+n m

x: the number of white balls drawn without replacement from an urn which contains both black and white balls.
m: the number of white balls in the urn
n: the number of black balls in the urn
k: number of balls drawn from the urn

from scipy import stats
#需要注意的是16是由17-1得到的
stats.hypergeom.sf(16,3586,141,59)

R中的实现方式

phyper(x,m,n,k,lower.tail=FALSE)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐