Skip to content

[Help]:How to use "loop" to achieve this aim?

3 messages · karena, qcshare, Jeffrey Spies

#
try:ch
----------------------
for(i in 1:22) {
chrn <- paste("chr",i,sep="")

chrn=MEDIPS.readAlignedSeqences(BSgenome="hg19", file="chrn",numrows= )
chrn=MEDIPS.genomeVector(data=chrn, bin_size=50,extend=250)
...
...
write.table(frameschrn.frame500.step250, file="frames.chrn.meth.txt",
sep="\T", quote=F, col.names=T, row.names=F)
}
#
Correcting Karena's solution:

for(i in 1:22) {
chrn <- paste("chr",i,sep="")

chrn=MEDIPS.readAlignedSeqences(BSgenome="hg19", file=chrn,numrows=
?????)  # no quotes around chrn
chrn=MEDIPS.genomeVector(data=chrn, bin_size=50,extend=250)
frames=????? # I don't know how you get this variable
...
out_file <- paste("frames.chr", i, ".meth.txt", sep="") # dynamic file name
write.table(frames, file=out_file, sep="\t", quote=F, col.names=T,
row.names=F) # use var you just made
}

Replace the ???s.

Jeff.
On Fri, Oct 1, 2010 at 11:27 AM, qcshare <qcshare at gmail.com> wrote: