我正在尝试在2个批次的数据集上运行ComBat脚本,但我收到错误,我不知道如何检查代码,因为我是R新手。
我正在以这种方式运行ComBat方法:
# Load sva
library(sva)
# Read expression values
dat = read.table('dataset.xls', header=TRUE, sep='\t')
# Read sample information file about batches
sif = read.delim('sif.tsv', header=TRUE, sep='\t')
# Call ComBat
ComBat(dat=dat,batch=sif$Batch, mod=NULL)
无论如何我的输出是:
Found 2 batches
Found 0 categorical covariate(s)
Found 54675 Missing Data Values
Standardizing Data across genes
Error in solve(t(des) %*% des) %*% t(des) %*% y1 :
requires numeric/complex matrix/vector arguments
dat的数据格式为:
probe set <sample1> ... <sampleN>
<gene_name> <value1> ... <valueN>
...
sif的数据格式为:
Array name Sample name Batch
<Array1> <Sample1> <Batch1>
...
任何提示都表示赞赏。如果需要,我会提供更多信息。
由于
答案 0 :(得分:1)
看起来当你在阅读信息时,它并没有以你期望的格式存储它。
根据错误,ComBat
预计matrix
的值为numeric
或complex
。来自记忆的read.table
将为您提供data.frame
。
所以试试跑步:
dat <- as.matrix(dat)
ComBat(dat=dat,batch=sif$Batch, mod=NULL)
答案 1 :(得分:0)
我已经想出了怎么做,添加:
# Remove NA from end of lines
l_dat = length(dat)
dat[l_dat] <- NULL
# Remove probe set from beginning of lines
dat[1] <- NULL
就在ComBat电话会议之前。这是因为最后一列包含NA
值(下一个警告消失:
Found 54675 Missing Data Values
),第一列包含引发下一个错误的探针集(非数字值):
Error in solve(t(des) %*% des) %*% t(des) %*% y1 :
requires numeric/complex matrix/vector arguments