【问题标题】:R ExpressionSet filter NA valuesR ExpressionSet过滤器NA值
【发布时间】:2015-09-17 23:51:58
【问题描述】:

我想在 R 中创建以下 ExpressionSet:

dataDirectory <- system.file("extdata", package = "Biobase")
exprsFile <- "path to expression data.txt"
exprs <- as.matrix(read.table(exprsFile, header = TRUE, sep = "\t", row.names = 1, as.is = TRUE))

pDataFile <- "path to phenotype data.txt"
pData <- read.table(pDataFile, row.names=1, header=TRUE, sep="\t")
phenoData <- new("AnnotatedDataFrame",data=pData)

现在从 expr 中删除那些 NA 值超过 80% 的列

exprs <- exprs[,colSums(is.na(exprs)) < 0.8]

在执行以下代码并构建 ExpressionSet 之前,我必须删除 phenoData (=samples) 中与 exprs 中上述已删除列匹配的所有行。我怎样才能做到这一点?

exampleSet <- ExpressionSet(assayData=exprs, phenoData=phenoData)
exampleSet

【问题讨论】:

    标签: r bioconductor


    【解决方案1】:

    构建 ExpressionSet(不过滤)

    exampleSet <- ExpressionSet(assayData=exprs, phenoData=phenoData)
    

    然后是子集,使用exprs() 函数来处理表达式值的基础矩阵:

    exampleSet[, colSums(is.na(exprs(exampleSet))) < 0.8]
    

    在 Bioconductor support site 上询问有关 Bioconductor 封装的问题。

    【讨论】:

    • 感谢您的解决方案!
    猜你喜欢
    • 2017-08-19
    • 2017-01-23
    • 2021-11-29
    • 2014-12-09
    • 2011-08-17
    • 1970-01-01
    • 2021-11-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多