b00mIR has asked for the wisdom of the Perl Monks concerning the following question:
I've created a hash which looks as follows
keys values 5302 0 C 1 T 9046 0 G 1 A 11110 0 T 1 C 12640 0 T 1 C 18262 0 A 1 G 21994 0 A 1 G 25713 0 A 1 G 26638 0 T 1 G 28194 0 A 1 G 29841 0 G 1 A 30475 0 T 1 C 31503 0 A 1 C 32211 0 G 1 A 37138 0 G 1 A 41088 0 G 1 A 42626 0 A 1 G
using this I was hoping to replace values in another file which looks as so.
# ID 1005.csv 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1... 0 1 1 1 0 1 1 0 1 1 1 0 0 0 0 0 1 1 0... # ID 1009.csv 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1... 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1... etc...
each line of the hash represents the values of the file i want to alter in order i.e. the first line of the hash represents the first value in each line, the second line of the hash represents the second value in each line.
What I would like to achieve is at each position of each line replace the value (either 1 or 0) with the letter code that is represented by it's related line on the hash.
I've been bashing at this for days without any luck.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Hashes to replace values
by JavaFan (Canon) on Mar 07, 2012 at 11:25 UTC | |
|
Re: Using Hashes to replace values
by choroba (Cardinal) on Mar 07, 2012 at 11:13 UTC | |
by b00mIR (Initiate) on Mar 07, 2012 at 12:04 UTC | |
by choroba (Cardinal) on Mar 07, 2012 at 12:16 UTC | |
|
Re: Using Hashes to replace values
by Anonymous Monk on Mar 07, 2012 at 11:14 UTC | |
|
Re: Using Hashes to replace values
by roboticus (Chancellor) on Mar 07, 2012 at 13:03 UTC |