in reply to help needed in modifying the code for counting possible combinations
ok, maybe way off here but I'll give it a try
#!/usr/bin/perl # use Data::Dumper; my $datafile = "test.dat"; my %finalQ = (); open(FH, "<$datafile") || die ; my %combined = (); while( <FH> ){ chomp; my ($key,$value) = sort (split(/\t/,$_)); $combined{$key}=$value; } my %count = (); my %reverse = reverse(%combined); foreach my $key (sort %combined) { print "$key => $combined{$key}\n"; if ( exists $reverse{$key} ) { $count{"$key\t$reverse{$key}"}+=2; print "$key => $reverse{$key} :: match\n"; } else { $count{"$key\t$combined{$key}"}++; } } print Dumper(%count);
output
$VAR1 = ' '; $VAR2 = 4; $VAR3 = 'NP_05 NP_04'; $VAR4 = 2; $VAR5 = 'YP_01 NP_03'; $VAR6 = 2; $VAR7 = 'NP_03 NP_02'; $VAR8 = 4; $VAR9 = 'NP_02 NP_03'; $VAR10 = 1; $VAR11 = 'NP_04 NP_05'; $VAR12 = 1;
|
|---|