Open Carolingien opened 2 years ago
If your sample size is large, you may need to modify the parameter min.sample, my experiment contains more than 200 samples, min.sample = 100 when the program can run normally. ex <- recMissComp(ex, min.samples = 100,free.model = FALSE) I hope it can solve your problem.
如果你的样本量很大,可能需要修改参数min.sample,我的实验包含200多个样本,min.sample = 100时程序可以正常运行。
ex <- recMissComp(ex, min.samples = 100,free.model = FALSE)
我希望它能解决你的问题。
With a MeOH fraction dataset I get an error when I run the recMissComp function :
erah.out2 <-recMissComp(erah.out, min.samples=3)
Error in sampleRD@data[window.start:window.end, ] : only zeros may be mixed with negative indexes
I tried to understand what was going wrong by running the code step by step :
lost.factor <- fit.model.in.data.tosd(sampleRD, erah.out,lost.FactorID, free.model)
Error in sampleRD@data[window.start:window.end, ] : only zeros may be mixed with negative indexesSo the error is happening in the fit.model.in.data.tosd function.
maxMZ <- sampleRD@max.mz minMZ <- sampleRD@min.mz lost.factor.index <- which(erah.out@Results@Alignment[,"AlignID"]==lost.factor.alignId) lost.factor.position <- erah.out@Results@Alignment[lost.factor.index,"tmean"]*sampleRD@scans.per.second*60-sampleRD@start.time*sampleRD@scans.per.second min.peak.width <- sampleRD@min.peak.width max.time.dist <- erah.out@Results@Parameters@Alignment$max.time.dist*sampleRD@scans.per.second*60 window.start <- as.integer(lost.factor.position - max.time.dist - min.peak.width*4) if(window.start<=0) window.start <- 1 if(window.start>nrow(sampleRD@data)) window.start <- as.integer(nrow(sampleRD@data) - max.time.dist - min.peak.width*4) window.end <- as.integer(lost.factor.position + max.time.dist + min.peak.width*4) if(window.end>nrow(sampleRD@data)) window.end <- nrow(sampleRD@data) analysis.window <- sampleRD@data[window.start:window.end,]
Error in sampleRD@data[window.start:window.end, ] : only zeros may be mixed with negative indexes
I know that the problem is sampleRD@data[window.start:window.end,] should not have positive and negative values in the '[n;m]' but 2 negative, 2 positive or 0 and postive , 0 and negative ... But I am not good enought to really understand what is wrong here and what I can do to make it work.
Thank you for your help.