【问题标题】:Fisher exact test for each gene每个基因的Fisher精确检验
【发布时间】:2018-12-10 13:33:33
【问题描述】:

我想为几个基因做 rna seq 数据,在对照和治疗中进行测试。 要进行fisher.test,我需要每个基因的列联表,有没有办法在R中做到这一点,而不是为每个基因计算列联表? 我是新手,所以任何建议都会有所帮助。

我有计数数据和样本信息数据,

                control1 treated1 control2 treat2 control3 treat3
ENSG00000000003        723        486        904        445       1170       1097  
ENSG00000000005          0          0          0          0          0          0 
ENSG00000000419        467        523        616        371        582        781 

ENSG 是基因

【问题讨论】:

    标签: r


    【解决方案1】:

    读取您的数据:

    dd <- read.table(header=TRUE,text="
                  control1 treated1 control2 treat2 control3 treat3
    ENSG00000000003        723        486        904        445       1170       1097  
    ENSG00000000005          0          0          0          0          0          0 
    ENSG00000000419        467        523        616        371        582        781 
    ")
    

    运行for 循环,并采取一些保护措施:

    results <- list()
    for (i in 1:nrow(dd)) {
        m <- matrix(unlist(dd[i,]),nrow=2)
        if (any(m>0)) {
           results[[i]] <- fisher.test(m)
        } else {
            results[[i]] <- NA
        }
    }
    names(results) <- rownames(dd)
    

    【讨论】:

      猜你喜欢
      • 2021-11-11
      • 1970-01-01
      • 1970-01-01
      • 2016-04-29
      • 2017-07-29
      • 1970-01-01
      • 1970-01-01
      • 2014-01-26
      • 1970-01-01
      相关资源
      最近更新 更多