[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.36, Tue Jul 17 19:04:56 2007 UTC revision 1.37, Tue Jul 17 20:27:31 2007 UTC
# Line 512  Line 512 
512      }      }
513      else      else
514      {      {
515          my $contig_lengths = {};          my $contig_lengths = $self->{_contig_len_index};
516    
517            if (!$contig_lengths)
518            {
519                 $contig_lengths = {};
520          if (open(CONTIGS,"<$newGdir/contigs"))          if (open(CONTIGS,"<$newGdir/contigs"))
521          {          {
522              $/ = "\n>";              $/ = "\n>";
# Line 529  Line 533 
533              close(CONTIGS);              close(CONTIGS);
534              $/ = "\n";              $/ = "\n";
535          }          }
536            }
537          return $contig_lengths;          return $contig_lengths;
538      }      }
539  }  }
# Line 546  Line 551 
551      }      }
552      else      else
553      {      {
554            my $contig_len = $self->{_contig_len_index};
555    
556            if ($contig_len)
557            {
558                return $contig_len->{$contig};
559            }
560    
561          if (open(CONTIGS,"<$newGdir/contigs"))          if (open(CONTIGS,"<$newGdir/contigs"))
562          {          {
563              local $/ = "\n>";              local $/ = "\n>";
# Line 583  Line 595 
595      else      else
596      {      {
597          my @out;          my @out;
598          $self->load_contigs();          $self->load_contigs_index();
599    
600          my $contigs = $self->{_contigs_index};          my $contigs = $self->{_contigs_index};
601          if ($contigs)          if ($contigs)
# Line 1776  Line 1788 
1788    
1789      my $contig_index_file = "$newGdir/contigs.btree";      my $contig_index_file = "$newGdir/contigs.btree";
1790      my $contig_index = {};      my $contig_index = {};
1791        my $contig_len_index_file = "$newGdir/contig_len.btree";
1792        my $contig_len_index = {};
1793    
1794      my $tied = tie %$contig_index, 'DB_File', $contig_index_file, O_RDONLY, 0666, $DB_BTREE;      my $tied = tie %$contig_index, 'DB_File', $contig_index_file, O_RDONLY, 0666, $DB_BTREE;
1795        if (not $tied)
1796        {
1797            warn "Cannot tie contig index $contig_index_file: $!\n";
1798        }
1799    
1800        my $ltied = tie %$contig_len_index, 'DB_File', $contig_len_index_file, O_RDONLY, 0666, $DB_BTREE;
1801        if (not $ltied)
1802        {
1803            warn "Cannot tie contig length index $contig_len_index_file: $!\n";
1804        }
1805    
1806      #      #
1807      # Set these even if failed so we don't keep trying to open and failing.      # Set these even if failed so we don't keep trying to open and failing.
1808      #      #
1809      $self->{_contig_index} = $contig_index;      $self->{_contigs_index} = $contig_index;
1810      $self->{_contig_tie} = $tied;      $self->{_contigs_tie} = $tied;
1811        $self->{_contig_len_index} = $contig_len_index;
1812        $self->{_contig_len_tie} = $ltied;
1813    
     if (not $tied)  
     {  
         warn "Cannot tie contig index $contig_index_file: $!\n";  
     }  
1814  }  }
1815    
1816  sub load_sims_index  sub load_sims_index

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3