[Bioperl-l] comparing data between hashes
Michael S. Robeson II
popgen23 at mac.com
Sat Oct 23 22:22:17 EDT 2004
I have a several "hash of a hashes" that look like this (sorry if my
formating is a little off):
Human => { # HoH for human
1 => [1,32,54,67] # numbers in [ ] is a string delimited by commas
not separate hash values
2 => [14,52,74,87]
5 => [33,44,64,107]
}
Chimp => { # HoH for Chimp
1 => [1,32,67]
2 => [14,74,87]
5 => [33,44]
}
Note: The numbers in between the [ ] is a STRING delimited by commas
and NOT separate hash values. I already have a working script that
appends these numbers to the appropriate hash separated by a comma or
newline like this:
$class{$position} .= "$pos" . " ,"; #to get: 5 => [33,44,64,107]
And I am having trouble trying to compare data. I want to compare each
number (i.e. 1, 2, & 5) and its data with e the same number in the
other species. For example, I would like to print out a table (see
below) that compares the data between the group "1" in each species.
Alleles for set: 1
Allele: 1 32 54 67
Human 1 1 1 1 # 1 = present
Chimp 1 1 0 1 # 0 = absent
And so on for 2 and 5.
I can most likely do the print formating for the table myself so I do
not need help with that. I just need help with being able to compare
the data within each Hash of a Hash (HoH). I do not know if I should
read this data into yet another Hash (which would be very busy) or an
array somehow? I have been trying to figure this out all week to no
avail.
Any ideas or suggestions?
- Thanks
- Mike
More information about the Bioperl-l
mailing list