代码么有错的话,可能是你过滤的太严格了,放低这个值试试:meanFPKM
老师,尝试了您说的方式,但是还是不行。整体步骤:导入数据,检查缺失值后,从5万变成了3万多基因,然后就是过滤,都没有问题,直到datExpr0=datExpr0[1:n,datExpr0[n+1,] > meanFPKM] 这步,运行之后从3万变成了0.
#########check missing value and filter检查缺失值和过滤 ####################
datExpr0
##check missing value
gsg = goodSamplesGenes(datExpr0, verbose = 3)
gsg$allOK
#显示为false,执行如下
if (!gsg$allOK)
# Optionally, print the gene and sample names that were removed:
if (sum(!gsg$goodGenes)>0)
printFlush(paste("Removing genes:", paste(names(datExpr0)[!gsg$goodGenes], collapse = ", ")))
if (sum(!gsg$goodSamples)>0)
printFlush(paste("Removing samples:", paste(rownames(datExpr0)[!gsg$goodSamples], collapse = ", ")))
# Remove the offending genes and samples from the data:
datExpr0 = datExpr0[gsg$goodSamples, gsg$goodGenes]
##filter 过滤低表达量的数据
meanFPKM=0.5 ####the threshold can be changed---过滤标准,可以修改
n=nrow(datExpr0)
datExpr0[n+1,]=apply(datExpr0[c(1:nrow(datExpr0)),],2,mean)
datExpr0[n+1,]
datExpr0=datExpr0[1:n,datExpr0[n+1,] > meanFPKM]