From 902e6685c3e78198e071d7e4f707f7481ed78138 Mon Sep 17 00:00:00 2001 From: Shawn Boyette Date: Mon, 1 Dec 2008 15:39:32 +0000 Subject: [PATCH] comments added for understanding --- match_fingerprints.pl | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/match_fingerprints.pl b/match_fingerprints.pl index c8b3f88..5bc66f7 100755 --- a/match_fingerprints.pl +++ b/match_fingerprints.pl @@ -15,6 +15,8 @@ my %match; my %candidate_match; my %score; + +# create HOL of incumbent{fingerprint}[ids] open FILE, $match_to; while (my $line = ) { chomp $line; @@ -26,6 +28,7 @@ while (my $line = ) { } close FILE; +# do the same for incoming open FILE, $match_these; while (my $line = ) { chomp $line; @@ -37,6 +40,7 @@ while (my $line = ) { } close FILE; +# scoring file stuffs, which i have never used foreach my $file ( $match_to_score, $match_from_score ) { open FILE, $file; while (my $line = ) { @@ -50,13 +54,18 @@ foreach my $file ( $match_to_score, $match_from_score ) { close FILE; } + open RECORD_IDS, ">match.record_ids"; foreach my $fp ( keys %incoming ) { - - if (defined $pines{ $fp }) { # match! + # for each incoming fingerprint, + if (defined $pines{ $fp }) { + # if there is a matching incumbent fingerprint foreach my $id ( @{ $incoming{ $fp } } ) { + # print all incoming record ids print RECORD_IDS "$id\n"; if ( ! defined $candidate_match{ $id } ) + # and create a mapping of incoming ids to fingerprints + # (used for scoring) { $candidate_match{ $id } = []; } push @{ $candidate_match{ $id } }, $fp; } @@ -64,8 +73,11 @@ foreach my $fp ( keys %incoming ) { } close RECORD_IDS; + +# scoring section, which i have never used foreach my $id ( keys %candidate_match ) { my $subtitle; + # if score{id} exists set subtitle to the sc if (defined $score{ $id }) { $subtitle = $score{ $id }[1]; } @@ -99,7 +111,11 @@ foreach my $id ( keys %candidate_match ) { } } } + + # this will silently fail, as the filehandle has been closed, but strict + # is not enabled print RECORD_IDS "$best_pines_id\n"; + if (! defined $match{ $best_pines_id } ) { $match{ $best_pines_id } = [ $best_pines_id ]; } push @{ $match{ $best_pines_id } }, $id; -- 1.7.2.5