X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fgrab;h=8533a4ea3bcff4f398863b6113f7819203a80f9a;hb=66e37f15fc46a64b40b7eee01b0b9fa48ef91ddc;hp=1be030a34e1ab4b451f386d5ad8443a3959436f9;hpb=5aed4676ad1bf35abbade6215ac90ee591e6d8fe;p=biopieces.git diff --git a/bp_bin/grab b/bp_bin/grab index 1be030a..8533a4e 100755 --- a/bp_bin/grab +++ b/bp_bin/grab @@ -26,7 +26,9 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +use warnings; use strict; +use Data::Dumper; use Maasha::Biopieces; use Maasha::Common; use Maasha::Patscan; @@ -147,7 +149,7 @@ sub grab_lookup if ( $keys ) { - map { return 1 if exists $lookup_hash->{ $record->{ $_ } } } @{ $keys }; + map { return 1 if defined $record->{ $_ } and exists $lookup_hash->{ $record->{ $_ } } } @{ $keys }; } else { @@ -156,7 +158,7 @@ sub grab_lookup } if ( not $keys_only ) { - map { return 1 if exists $lookup_hash->{ $record->{ $_ } } } keys %{ $record }; + map { return 1 if defined $record->{ $_ } and exists $lookup_hash->{ $record->{ $_ } } } keys %{ $record }; } } @@ -180,13 +182,17 @@ sub grab_patterns # Returns boolean. - my ( $pattern ); + my ( $pattern, $key ); foreach $pattern ( @{ $patterns } ) { if ( $keys ) { - map { return 1 if index( $record->{ $_ }, $pattern ) >= 0 } @{ $keys }; + foreach $key ( @{ $keys } ) + { + return 0 if not exists $record->{ $key }; + return 1 if index( $record->{ $key }, $pattern ) >= 0; + } } else { @@ -222,7 +228,7 @@ sub grab_regex if ( $keys ) { - map { return 1 if $record->{ $_ } =~ /$regex/ } @{ $keys }; + map { return 1 if exists $record->{ $_ } and $record->{ $_ } =~ /$regex/ } @{ $keys }; } else {