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

Debs Majumdar debs_stata at yahoo.com
Fri Oct 21 23:32:17 CEST 2011



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




More information about the R-help mailing list