Given a tab-delimited .txt file where data comes in pairs of lines, such as:
1 7 848773 75 A 74 1 7 848576 74 A 0 2 16 785802 75 A 0 2 16 786009 75 A 74 3 7 848576 75 A 74 3 7 848773 74 A 0
I wish to tally the frequency of all unique number combinations - in the above example the desired output is:
7 848576 848773 2 16 785802 786009 1
848773-848576 being the same as 848576-848773.
I'm not sure how to solve this problem. I'm accessing each pair of lines via:my @F2 = split("\t", $_); my $partner = <$IN2>; my @F3 = split("\t", $partner);
And then thought to use a multi-dimensional hash:
However this would not handle equivalent pairs - which is the part i'm not sure how to do or how I would then print it out easily. What would be a good way to do it?my %count; $count{$F2[1]}{$F2[2]}{$F3[2]}++;
In reply to Tallying co-occurence of numbers by K_Edw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |