[Bio] / FigKernelPackages / FIGV.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIGV.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15, Tue Dec 5 22:43:07 2006 UTC revision 1.16, Wed Dec 13 05:51:32 2006 UTC
# Line 1088  Line 1088 
1088      $self->{_functions} = $functions;      $self->{_functions} = $functions;
1089  }  }
1090    
1091    
1092    sub bbhs
1093    {
1094        my($self,$peg,$cutoff) = @_;
1095    
1096        my $fig     = $self->{_fig};
1097        my $newG    = $self->{_genome};
1098        my $newGdir = $self->{_orgdir};
1099    
1100        $self->load_bbh_index();
1101    
1102        $cutoff = 1.0e-10 unless defined($cutoff);
1103    
1104        my $tie = $self->{_bbh_tie};
1105    
1106        my @bbhs = $tie->get_dup($peg);
1107    
1108        # @bbhs now a list of comma-separated tuples (id2, score, bitscore)
1109    #    print Dumper(\@bbhs);
1110    
1111        @bbhs = grep { $_->[1] < $cutoff } map { [split(/,/)] } @bbhs;
1112    
1113        if (not ($peg =~ /^fig\|(\d+\.\d+)/ && ($1 eq $newG)))
1114        {
1115            #
1116            # If this isn't one of our pegs, we retrieve the bbhs from the underlying
1117            # SEED and merge in the bbhs that we have here.
1118            #
1119    
1120            my @fbbhs = $fig->bbhs($peg, $cutoff);
1121    #       print Dumper(\@fbbhs);
1122            push(@bbhs, @fbbhs);
1123        }
1124        return sort { $a->[1] <=> $b->[1] } @bbhs;
1125    }
1126    
1127  sub sims  sub sims
1128  {  {
1129      my($self,$peg,$max,$maxP,$select) = @_;      my($self,$peg,$max,$maxP,$select) = @_;
# Line 1198  Line 1234 
1234      }      }
1235  }  }
1236    
1237    sub load_bbh_index
1238    {
1239        my($self) = @_;
1240    
1241        return if defined($self->{_bbh_index});
1242    
1243        my $fig     = $self->{_fig};
1244        my $newG    = $self->{_genome};
1245        my $newGdir = $self->{_orgdir};
1246    
1247        my $bbh_file = "$newGdir/bbhs";
1248        my $bbh_index_file = "$bbh_file.index";
1249        my $bbh_index = {};
1250    
1251        my $tied = tie %$bbh_index, 'DB_File', $bbh_index_file, O_RDONLY, 0666, $DB_BTREE;
1252    
1253        #
1254        # Set these even if failed so we don't keep trying to open and failing.
1255        #
1256        $self->{_bbh_index} = $bbh_index;
1257        $self->{_bbh_tie} = $tied;
1258    
1259        if (not $tied)
1260        {
1261            warn "Cannot tie bbh index $bbh_index_file: $!\n";
1262        }
1263    }
1264    
1265  sub load_sims_index  sub load_sims_index
1266  {  {
1267      my($self) = @_;      my($self) = @_;

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3