This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Creating a loop to use read.eset in bioconductor

I would like to create a loop to load this files through read.esetof bioconductor. I have one file per chromosome (29) files. I tried that:

{for(k in 1:29){
  expr <- paste0("/home/proj/MT_Nellore/R/eBrowser/Adjusted/LRRadjustedextremes0.5kgchr",k,".txt")
  pdat <- paste0("/home/proj/MT_Nellore/R/eBrowser/Adjusted/Samplesbinary0.5.txt")
  ffdat <- paste0("/home/proj/MT_Nellore/R/LRR/Chr_adjusted/probeslabeladjustedchr",k,".txt")
  eset <- read.eset(exprs.file="expr", pdat.file="/home/proj/MT_Nellore/R/eBrowser/Adjusted/Samplesbinary0.5.txt", fdat.file="ffdat")}

However I get this error:

Error in file(file, "r") : cannot open the connection
In addition: Warning message:
In file(file, "r") : cannot open file 'ffdat': No such file or directory

Any sugestions? Cheers!

bioconductor r

No opening brace before the for, surely?

1 answer

The last line should be:

eset <- read.eset(exprs.file=expr, pdat.file=pdat, fdat.file=ffdat)

You are right! Now it works, but.... I put 4 more lines:

data <- fData(eset)
outfile <- paste0("chr",k,"FCadjusted.txt")
setwd("/home/proj/MT_Nellore/R/eBrowser/Adjusted/FC")
write.table(data, outfile, quote = FALSE, col.names = FALSE)}}

And now the problem is that just files 1 to 8 were writed...

Why files 9 until 29 cannot be written?

It's hard to say without seeing the entirety of the relevant code. You might add a print() line to try and figure out where things are breaking.

If I add print() line this error appears:
##Error in print.default() : argument "x" is missing, with no default

I wasn't being literal before. The general idea behind debugging is to determine exactly where in the code an error occurs. One of the simplest ways to do that is to add an occasional print("got here") or print("A") or something that you can use to identify the last time the code did what you expected.

Log in to answer this question.