Using Perl to Merge Multiple Lines in a File
I've hunted and hunted but nothing seems to apply to what I need. Any help will be much appreciated!
My input file looks like (Unix):
marker,allele1,allele2
RS1002244,1,1
RS1002244,1,3
RS1002244,3,3
RS1003719,2,2
RS1003719,2,4
RS1003719,4,4
Most markers are listed 3 times but a few have 3 alleles and are listed more.
An example of a marker with 3 alleles is:
marker,allele1,allele2
RS757210,2,2
RS757210,2,3
RS757210,2,4
RS757210,3,3
RS757210,3,4
RS757210,4,4
I would like to get output like:
marker,allele1,allele2,allele3
RS1002244,1,3,.
RS1003719,2,4,,
RS757210,2,3,4
Thanks very much in advance, Peggy 10/23 (happy to have this in formats other than Perl, too)