# @gene_pairs contains the pairs of numbers e.g, 1304 1509 # @rep1_pids, @rep2_pids and @rep3_pids are where the numbers came from. foreach my $pair (@gene_pairs) { my @pair = $pair; my $p = join ('', @pair); @pair = split (/\t/, $pair); for (my $i=0; $i<@rep1_pids; $i++) { if ($pair[0] == $rep1_pids[$i]) { push @locations, "rep1 "; push @new_gp, "$rep1_pids[$i] "; } if ($pair[1] == $rep1_pids[$i]) { push @locations, "rep1 "; push @new_gp, "$rep1_pids[$i] "; } } for (my $i=0; $i<@rep2_pids; $i++) { if ($pair[0] == $rep2_pids[$i]) { push @locations, "rep2 "; push @new_gp, "$rep2_pids[$i] "; } if ($pair[1] == $rep2_pids[$i]) { push @locations, "rep2 "; push @new_gp, "$rep2_pids[$i] "; } } for (my $i=0; $i<@rep3_pids; $i++) { if ($pair[0] == $rep3_pids[$i]) { push @locations, "rep3 "; push @new_gp, "$rep3_pids[$i] "; } if ($pair[1] == $rep3_pids[$i]) { push @locations, "rep3 "; push @new_gp, "$rep3_pids[$i] "; } } } print "@new_gp\n"; my (@paired_genes1, @paired_genes2); my @pairs2 = @new_gp; print "@pairs2\n"; while (my ($one, $two) = splice(@pairs2,0,2)) { #print "$one ---- $two\n"; push @paired_genes1, "$one "; push @paired_genes2, "$two "; }