Angharad has asked for the wisdom of the Perl Monks concerning the following question:
I have two files. A 'sequence' file, which looks like this.
and a set of correponding 'co-ordinate' files. The name of the co-ordinate file that corresponds to a particular sequence in the sequence file is highlighted by '>' a line above the actual sequence. Each of these files is made up of entries. Each entry is numbered. Some co-ordinate files start with entry number 1 but not all. The one below (the co-ordinate file named 'ONE'), for example, starts with an entry numbered 12.>ONE IRLA >TWO REFT >THREE HTED
This corresponds to the first sequence in the sequence file12 14.620 35.834 -16.759 1.00 11.04 13 15.922 36.983 -19.044 1.00 11.22 14 14.326 37.148 -21.240 1.00 11.40 15 11.528 38.248 -23.343 1.00 12.44
I need to assign each letter in that sequence with the corresponding entry in the corresponding co-ordinate file. You read the sequence file from left to right with each letter needing to be mapped to an numbered entry in the co-ordinate file. So .. for the first letter 'R' in the sequence, it has to be mapped to entry number 13 in the co-ordinate file - the second letter in the sequence 'R', it corresponds to the second entry in the co-ordinate file, which in this case is entry 13. The resulting text file should look like thisIRLA
I'm not sure what the best way of going about writing a perl script for this is. Any advice/hints much appreciated. The real examples are obviously far larger than the test case presented hereI 12 R 13 L 14 A 15
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: mapping data between files
by MidLifeXis (Monsignor) on May 05, 2009 at 21:33 UTC | |
by Angharad (Pilgrim) on May 05, 2009 at 21:44 UTC | |
Re: mapping data between files
by citromatik (Curate) on May 06, 2009 at 08:04 UTC |
Back to
Seekers of Perl Wisdom