aboutsummaryrefslogtreecommitdiffstats
path: root/pairwise.pl
blob: f72157540ead6542074e6d63a5ad656aec860079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env perl

use strict;
use warnings;

die "usage: $0 threshold file […]\n" unless $#ARGV > 0;

my $threshold = shift;

my $header = <>;
chomp $header;
my @headers = split /,/, $header;
while (<>) {
  chomp;
  my @parts = split /,/;
  for (my $i=1; $i <= $#headers; $i++) {
    if (defined $parts[$i]) {
      my $similarity = $parts[$i];
      print "$parts[0],$headers[$i]\n" if $similarity >= $threshold;
    }
  }
}