[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.244, Mon Mar 14 19:17:37 2005 UTC revision 1.245, Tue Mar 15 23:56:53 2005 UTC
# Line 17  Line 17 
17  use Construct;  use Construct;
18  use FIGRules;  use FIGRules;
19  use Tracer;  use Tracer;
20  use FigGFF;  eval { require FigGFF; };
21    
22  #  #
23  # Conditionally evaluate this in case its prerequisites are not available.  # Conditionally evaluate this in case its prerequisites are not available.
# Line 5056  Line 5056 
5056      return @annotations;      return @annotations;
5057  }  }
5058    
5059    sub annotations_made_fast
5060    {
5061        my($self, $genomes, $start_time, $end_time) = @_;
5062    
5063        my $group = $FIG_Config::group;
5064    
5065        $group = 'FIG' unless $group;
5066    
5067        my $annos;
5068        my $pegs = {};
5069    
5070        #
5071        # We originally used a query to get the PEGs that needed to have annotations
5072        # sent. Unfortunately, this performed very poorly due to all of the resultant
5073        # seeking around in the annotations files.
5074        #
5075        # The code below just runs through all of the anno files looking for annos.
5076        #
5077        # A better way to do this would be to do a query to retrieve the genome id's for
5078        # genomes that have updates. The problem here is that the annotation_seeks
5079        # table doesn't have an explicit genome field.
5080        #
5081        # Surprisingly, to me anyway, the following query appers to run quickly, in both
5082        # postgres and mysql:
5083        #
5084        # SELECT distinct(substring(fid from 5 for position('.peg.' in fid) - 5))
5085        # FROM annotation_seeks
5086        # WHERE dateof > some-date.
5087        #
5088        # The output of that can be parsed to get the genome id and just those
5089        # annotations files searched.
5090        #
5091    
5092        for my $genome (@$genomes)
5093        {
5094            my $genome_dir = "$FIG_Config::organisms/$genome";
5095            next unless -d $genome_dir;
5096            my $gpegs = {};
5097    
5098            my $afh;
5099            if (open($afh, "$genome_dir/annotations"))
5100            {
5101                my($fid, $anno_time, $who, $anno_text);
5102                local($/);
5103                $/ = "//\n";
5104                while (my $ann = <$afh>)
5105                {
5106                    chomp $ann;
5107    
5108                    if ((($fid, $anno_time, $who, $anno_text) =
5109                         ($ann =~ /^(fig\|\d+\.\d+\.peg\.\d+)\n(\d+)\n(\S+)\n(.*\S)/s)) and
5110                        $anno_time >= $start_time and
5111                        $anno_time <= $end_time)
5112    
5113                    {
5114                        #
5115                        # Update users list.
5116                        #
5117    
5118    
5119                        $anno_text =~ s/Set master function to/Set $group function to/;
5120    
5121                        my $anno = [$fid, $anno_time, $who, $anno_text];
5122    
5123                        push(@{$gpegs->{$fid}}, $anno);
5124                    }
5125                }
5126    
5127            }
5128            push(@$annos, [$genome, $gpegs]);
5129        }
5130        return $annos;
5131    }
5132    
5133    
5134  ################################### ATTRIBUTES  ################################### ATTRIBUTES
5135    
5136  =head1 Attributes  =head1 Attributes

Legend:
Removed from v.1.244  
changed lines
  Added in v.1.245

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3