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

Diff of /FigKernelPackages/FIG.pm

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

revision 1.15, Tue Dec 30 05:21:24 2003 UTC revision 1.16, Sat Jan 3 06:03:43 2004 UTC
# Line 2739  Line 2739 
2739              chmod 0777, $file;              chmod 0777, $file;
2740              my $ln = $seek2 - $seek1;              my $ln = $seek2 - $seek1;
2741              my $rdbH = $self->db_handle;              my $rdbH = $self->db_handle;
2742              if ($rdbH->SQL("INSERT INTO annotation_seeks ( fid, fileno, seek, len ) VALUES ( \'$feature_id\', $fileno, $seek1, $ln )"))              if ($rdbH->SQL("INSERT INTO annotation_seeks ( fid, dateof, who, fileno, seek, len ) VALUES ( \'$feature_id\', $time_made, \'$user\', $fileno, $seek1, $ln )"))
2743              {              {
2744                  return 1;                  return 1;
2745              }              }
# Line 2762  Line 2762 
2762    
2763  sub feature_annotations {  sub feature_annotations {
2764      my($self,$feature_id) = @_;      my($self,$feature_id) = @_;
2765      my($tuple,$fileN,$seek,$ln,$readN,$readC,$annotation,$feature_idQ);      my($tuple,$fileN,$seek,$ln,$annotation,$feature_idQ);
2766      my($file,$fh);      my($file,$fh);
2767    
2768      my $rdbH = $self->db_handle;      my $rdbH = $self->db_handle;
# Line 2772  Line 2772 
2772      foreach $tuple (@$relational_db_response)      foreach $tuple (@$relational_db_response)
2773      {      {
2774          ($fileN,$seek,$ln) = @$tuple;          ($fileN,$seek,$ln) = @$tuple;
2775          $file = $self->N2file($fileN);          $annotation = $self->read_annotation($fileN,$seek,$ln);
         $fh   = $self->openF($file);  
         if (! $fh)  
         {  
             confess "could not open annotations for $file";  
         }  
         seek($fh,$seek,0);  
         $readN = read($fh,$readC,$ln);  
         ($readN == $ln)  
             || confess "could not read the block of annotations at $seek for $ln characters; $readN actually read from $file\n$readC";  
2776          $feature_idQ = quotemeta $feature_id;          $feature_idQ = quotemeta $feature_id;
         foreach $annotation (split(/\n\/\/\n/, $readC))  
         {  
2777              if ($annotation =~ /^$feature_idQ\n(\d+)\n([^\n]+)\n(.*)/s)              if ($annotation =~ /^$feature_idQ\n(\d+)\n([^\n]+)\n(.*)/s)
2778              {              {
2779                  push(@annotations,[$feature_id,$1,$2,$3]);                  push(@annotations,[$feature_id,$1,$2,$3]);
# Line 2794  Line 2783 
2783                  print STDERR "malformed annotation\n$annotation\n";                  print STDERR "malformed annotation\n$annotation\n";
2784              }              }
2785          }          }
     }  
2786      return map { $_->[1] = localtime($_->[1]); $_ } sort { $a->[1] <=> $b->[1] } @annotations;      return map { $_->[1] = localtime($_->[1]); $_ } sort { $a->[1] <=> $b->[1] } @annotations;
2787  }  }
2788    
2789    sub read_annotation {
2790        my($self,$fileN,$seek,$ln) = @_;
2791        my($readN,$readC);
2792    
2793        my $file = $self->N2file($fileN);
2794        my $fh   = $self->openF($file);
2795        if (! $fh)
2796        {
2797            confess "could not open annotations for $file";
2798        }
2799        seek($fh,$seek,0);
2800        $readN = read($fh,$readC,$ln);
2801        ($readN == $ln)
2802            || confess "could not read the block of annotations at $seek for $ln characters; $readN actually read from $file\n$readC";
2803        return $readC;
2804    }
2805    
2806  ################################# Indexing Features and Functional Roles  ####################################  ################################# Indexing Features and Functional Roles  ####################################
2807    
2808  =pod  =pod

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3