• pvalue for go kegg enrichment


     

    Simple, fast implementation of Fisher’s exact test. . For example, for the following table:

    oHaving the propertyNot having the property
    Selected 12 5
    Not selected 29 2

    Perhaps we are interested in whether there is any difference of property in selected vs. non-selected groups, then we can do the Fisher’s exact test.

    def fish_test(sample_hit, pop_hit, sample_count, root_count):
    ### sample_hit: 该样本中基因属于该term下面的个数
    ### pop_hit: 该物种的所有基因属于该term下面的个数
    ### sample_count: 样本中基因的个数
    ### root_count: 该物种在bp/cc/mf root 下基因的个数
    sample_hit = int(sample_hit)
    pop_hit = int(pop_hit)
    sample_count = int(sample_count)
    root_count = int(root_count)
    sample_nhit = sample_count - sample_hit
    pop_nhit = root_count - pop_hit
    n1,n2,n3,n4 = (sample_hit, pop_hit - sample_hit,
    sample_nhit, pop_nhit - sample_nhit)
    p = abs(pvalue(n1,n2,n3,n4).right_tail)
    return p

    使用公式 phyper(k-1,M, N-M, n, lower.tail=FALSE)
         那么做为背景,总体基因为N,属于“化学刺激响应”这个分类的基因有M个。
         现在抽了n个基因,里面有k个基于这个分类,p值为
    针对下面这个通路我做了计算, 和 用Python 包算的一致.
    > phyper(16-1,45,7057-45,98,lower.tail=FALSE)
    [1] 2.503033e-19
    > phyper(11-1,48,7057-48,98,lower.tail=FALSE)
    [1] 3.09068e-11
     
     
    IndexPathway NamePathway IDPvaluePvalue_adjustedGenesCountPop HitList_TotalBackground GenesClass
    1 ABC transporters hsa02010 2.50e-19 4.71e-17 16 45 98 7057 Environmental Information Processing
    2 Fatty acid metabolism hsa01212 3.09e-11 2.91e-09 11 48 98 7057 Metabolism

  • 相关阅读:
    python动态规划解决矩阵连乘
    ISCC2019-digdigdig
    MultiSelectComboBox(一)
    中国地图 xaml Canvas
    NotificationObject.cs
    DelegateCommand.cs
    SQL-PIVOT 数据透视 行列转换
    中国行政区域(省,市,县)SQL
    WCF自定义地址路由映射(不用svc文件)
    java下载安装,环境变量,hello world
  • 原文地址:https://www.cnblogs.com/xiaojikuaipao/p/7922792.html
Copyright © 2020-2023  润新知