sva-devel
sva-devel copied to clipboard
Error in while (change > conv) { : missing value where TRUE/FALSE needed
hello,
I got errors when I use some gene express matrix by counts when I use Combat
my script is :
sample <- row.names(Pheno_complete) batch <- Pheno_complete$Batch_num condition <- Pheno_complete$Stage_num modmatrix <- model.matrix(~as.factor(condition), data=pdata) Combat_D1_log2 <- ComBat(dat=RNAseq, batch=batch, mod=modmatrix)
and I got errors
Error in while (change > conv) { : missing value where TRUE/FALSE needed
How could I do, I have already filter rowSum ==0 and rowVars == 0
but still errors!
thankyou !
Okay, the best thing for you to do is to find out which row(s) are causing this error. It may be that yo have all 0 values for one of your batches/treatment groups.
On Mar 30, 2020, at 10:26 AM, huangl07 [email protected] wrote:
hello,
I got errors when I use some gene express matrix by counts when I use Combat
my script is : sample <- row.names(Pheno_complete) batch <- Pheno_complete$Batch_num condition <- Pheno_complete$Stage_num modmatrix <- model.matrix(~as.factor(condition), data=pdata) Combat_D1_log2 <- ComBat(dat=RNAseq, batch=batch, mod=modmatrix)
and I got errors
Error in while (change > conv) { : missing value where TRUE/FALSE needed
How could I do, I have already filter rowSum ==0 and rowVars == 0
but still errors!
thankyou !
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jtleek/sva-devel/issues/42, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMBWPBO5BT7PCQIM7UNV3TRKCTXRANCNFSM4LWUETYA.
well I filter all data which have all 0 values for one batches,but the error is same,I have check the smallest data : control_1 control_2 control_3 dopamine_1 dopamine_2 dopamine_3 ENSMUST00000166088 0 0 0 0 1 0 ENSMUST00000110582 291 268 289 279 295 313 ENSMUST00000110583 133 113 0 130 0 104 ENSMUST00000192674 0 0 0 0 0 49 ENSMUST00000110585 599 792 712 863 573 735 ENSMUST00000110586 465 214 262 275 322 197 ENSMUST00000135559 137 100 68 121 76 92 ENSMUST00000135556 2 13 9 8 7 10 ENSMUST00000166082 1001 452 1128 146 120 162 ENSMUST00000135555 1 1 1 0 1 1 ENSMUST00000166084 12 3 5 5 1 5 ENSMUST00000135550 73 56 67 54 17 64 ENSMUST00000135551 0 15 12 7 0 13 MSTRG.7048.21 256 253 265 205 279 312 ENSMUST00000195253 2 2 0 2 8 1 ENSMUST00000207025 1 1 1 0 1 1 ENSMUST00000135558 2 4 0 2 1 2 ENSMUST00000192677 2 3 0 2 0 0 ENSMUST00000090457 16 13 8 19 13 16 ENSMUST00000207029 39 20 21 15 35 29 ENSMUST00000192678 0 2 3 0 1 1 ENSMUST00000206998 1 1 1 1 1 2 MSTRG.22509.1 1 0 0 0 0 0 ENSMUST00000206995 15 15 26 19 17 25 ENSMUST00000206997 1 3 2 4 0 3 ENSMUST00000206996 51 56 61 60 59 64 ENSMUST00000206990 1 4 2 2 1 2
as the 1:26,all results its okey,but include last line the error ocur
thankyou!
I have figure that in ComBat the funtion :
gamma.hat <- solve(crossprod(batch.design), tcrossprod(t(batch.design), as.matrix(s.data)))
there are some zero result in gamma.hat
Hi @huangl07, would you let us know the batch and condition variables, so we can run a diagnosis on your example?
@zhangyuqing sorry for forget that, my batch is c(1,2,3,1,2,3), group is c(1,1,1,2,2,2) thank you!
@huangl07 I do not have the issue from my end, using sva version 3.33.2. I've attached a snapshot for my code and execution, as well as the data you provided, copied from the comment above.
Which version of sva are you using? It could be an issue in the old version, which we have addressed in the latest package.
`
while I was using 3.30.1 from bioconductor
I will update and try again thank you !
Well I have already use 3.34 but error occor in next line
I hope you could get all my data and retry!
thank you! transcript_count2.zip
is there any one solve this or any propose?
i have meet the same question as you, just adjust "rowVars(data) > 2", filter some data, then it's work out. However, i also don't konw why.
Dear all,
I have a similar problem. When I run Combat from the version sva_3.33.2 of the R-package I don't get any error.
Found 5693 genes with uniform expression within a single batch (all zeros); these will not be adjusted for batch. Found2batches Adjusting for0covariate(s) or covariate level(s) Standardizing Data across genes Fitting L/S model and finding priors Finding parametric adjustments Adjusting the Data
I have tried to run recently Combat from versions sva_3.34.0 and sva_3.35.2 and I get error:
combat_res <- ComBat(dat=input_combat, batch=batch) Found2batches Adjusting for0covariate(s) or covariate level(s) Standardizing Data across genes Fitting L/S model and finding priors Finding parametric adjustments Error in while (change > conv) { : missing value where TRUE/FALSE needed
Edit I have resolved as follow:
1) Run this code:
dat <- as.matrix(merge_bulk_with_sc[,-1])
dat <- as.matrix(dat)
batch <- as.factor(batch)
zero.rows.lst <- lapply(levels(batch), function(batch_level) {
if (sum(batch == batch_level) > 1) {
return(which(apply(dat[, batch == batch_level], 1,
function(x) {
var(x) == 0
})))
}else {
return(which(rep(1, 3) == 2))
}
})
zero.rows <- Reduce(union, zero.rows.lst)
keep.rows <- setdiff(1:nrow(dat), zero.rows)
if (length(zero.rows) > 0) {
cat(sprintf("Found %d genes with uniform expression within a single batch (all zeros); these will not be adjusted for batch.\n",
length(zero.rows)))
dat.orig <- dat
dat <- dat[keep.rows, ]
}
2) Call Combat:
combat_res <- ComBat(dat=input_combat, batch=batch)
However, I really would like to know the opinion of the authors about this, only to understand if this procedure is technically correct.
Many thanks,
Best,
Guidantonio