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)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM