[R] Reading in and modifying multiple datasets in a loop

Debs Majumdar
2011-10-21T21:32:17Z

Hi,

? I have been given a set of around 300 files where there are 5 files
corresponding to each chunk.

E.g. Chunk 1 for chr1 contains these 5 files:

? ? ??? chr1.one.phased.impute2.chunk1
??????? chr1.one.phased.impute2.chunk1_info
??????? chr1.one.phased.impute2.chunk1_info_by_sample
??????? chr1.one.phased.impute2.chunk1_summary
??????? chr1.one.phased.impute2.chunk1_warnings

For chr 1 there are 47 chunks, chr2 has 42 chunks...and it ends at chr22 with 23
chunks.

I am using the DatABEL package to? convert them databel format using the
following command:


impute2databel(genofile="chr1.one.phased.impute2.chunk1",
samplefile="chr1.one.phased.impute2.chunk1_info",
outfile="chr1.chunk1", makeprob=TRUE, old=FALSE)?

which uses two files per chunk.


Is there a way I can automate this so that the code goes through each chunk of
each chromosome and does the conversion to databel format.


Thanks,

?-Debs