aboutsummaryrefslogtreecommitdiffstats
path: root/pairwise.pl
diff options
context:
space:
mode:
Diffstat (limited to 'pairwise.pl')
-rwxr-xr-xpairwise.pl22
1 files changed, 22 insertions, 0 deletions
diff --git a/pairwise.pl b/pairwise.pl
new file mode 100755
index 0000000..f721575
--- /dev/null
+++ b/pairwise.pl
@@ -0,0 +1,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;
+ }
+ }
+}