Skip to main content
Topic: "object 'xset' not found" (Read 3023 times) previous topic - next topic

"object 'xset' not found"

I've recently started using XCMS and R. I'm working on a rather large dataset (~40 files each 1gb) so I've made a "for loop" to split the computing into chunks:

for (i in 1:ceiling(length(datafiles)/blkSize))
  {ind <- ((i - 1) * blkSize + 1):min((i * blkSize),nfiles); xset[] <- xcmsSet(datafiles[ind],phenoData = design2[ind,,drop = FALSE])}; xset <- do.call(c,xSet)

when I execute this it runs the xcmsSet command for the first 4 files (for blkSize=4) and then gives the error message:

Error in xset[] <- xcmsSet(datafiles[ind], phenoData = design2[ind,  :
  object 'xset' not found

I've tried pre-creating an object named xset, the only type I got it to accept was an empty list, but that meant it loaded the entire list to memory negating the point of the loop.

Am i going at this the wrong way? I've seen others use similar loops and they don't appear to have the same problem.
Any help is appreciated.

Re: "object 'xset' not found"

Reply #1
I'm really not sure what you are trying to accomplish...
Seems like you are trying to do one subset at a time and merge with c. I don't see how that could help. XCMS does one file at a time anyway (unless using multithreading, nSlaves).

Forgetting the question of whether this makes sense if you don't want to keep all the data somewhere until after the loop you need to merge inside the loop. So something like when i=1 assign to xset. When it is not 1 assign to new_xset and do xset <- c(xset,new_xset).

1 GB is a lot for a data file. Are you sure it is in centroid mode?
Blog: stanstrup.github.io