无法从R的sva库运行ComBat脚本 [英] Unable to run ComBat script from R's sva library
问题描述
我试图在具有2个批处理的数据集上运行ComBat脚本,但是由于我是R新手,因此出现错误,并且我不知道如何检查代码.
I am trying to run ComBat script on a dataset with 2 batches, but I am getting errors and I do not know how to inspect code since I am an R newbie.
我以这种方式运行ComBat方法:
I am running ComBat method in this way:
# 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)
无论如何,我的输出是:
Anyway my output is:
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
数据的数据格式为:
probe set <sample1> ... <sampleN>
<gene_name> <value1> ... <valueN>
...
sif的数据格式为:
Data format for sif is:
Array name Sample name Batch
<Array1> <Sample1> <Batch1>
...
任何提示都值得赞赏.如有需要,我会提供更多信息.
Any hint is appreciated. I'll provide more info if needed.
谢谢
推荐答案
我已经弄清楚了如何做,并添加了:
I have figured out how to do it, adding:
# 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
值(下一条警告消失了:
just before the ComBat call. This because last column contains NA
values (next warning goes away:
Found 54675 Missing Data Values
),第一列包含引发下一个错误的探针集(非数值):
), and first column contains probe set (non numeric values) that raise next error:
Error in solve(t(des) %*% des) %*% t(des) %*% y1 :
requires numeric/complex matrix/vector arguments
这篇关于无法从R的sva库运行ComBat脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!