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

Diff of /FigKernelPackages/P2Pupdate.pm

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

revision 1.51, Mon Aug 8 21:54:39 2005 UTC revision 1.52, Thu Sep 1 18:14:53 2005 UTC
# Line 390  Line 390 
390      my($fig,$who,$date,$genomes,$file) = @_;      my($fig,$who,$date,$genomes,$file) = @_;
391      my $fig_base = "$FIG_Config::fig_disk/FIG";      my $fig_base = "$FIG_Config::fig_disk/FIG";
392    
393        if (!open(ANNOTATIONS,">$file"))
394        {
395            die "Cannot open annotations file $file for writing: $!";
396        }
397    
398    
399        my $annos = $fig->annotations_made_fast($genomes, $date, undef, $who);
400    
401        #
402        # $annos is a list of pairs [$genome, $genomeannos]
403        # $genomeannos is a hash keyed on peg. value is a list of lists [$peg, $time, $who, $anno].
404        #
405    
406        my @annos = sort { my($ga, $sa) = split(/\./, $a->[0]);
407                           my($gb, $sb) = split(/\./, $b->[0]);
408                           $ga <=> $gb or $sa <=> $sb } @$annos;
409    
410        for my $gent (@annos)
411        {
412            my($genome, $alist) = @$gent;
413    
414            for my $peg (sort { &FIG::by_fig_id($a, $b) } keys %$alist)
415            {
416                for my $aent (@{$alist->{$peg}})
417                {
418                    chomp $aent->[$#$aent];
419                    print ANNOTATIONS join("\n", @$aent) . "\n///\n";
420                }
421            }
422    
423        }
424        for my $gent (@annos)
425        {
426            my($genome, $alist) = @$gent;
427    
428            for my $peg (sort { &FIG::by_fig_id($a, $b) } keys %$alist)
429            {
430                for my $aent (@{$alist->{$peg}})
431                {
432                    chomp $aent->[$#$aent];
433                    print ANNOTATIONS join("\n", @$aent) . "\n///\n";
434                }
435            }
436    
437        }
438        print ANNOTATIONS "//\n";
439        for my $gent (@annos)
440        {
441            my($genome, $alist) = @$gent;
442            my $gs = $fig->genus_species($genome);
443    
444            for my $peg (sort { &FIG::by_fig_id($a, $b) } keys %$alist)
445            {
446                my @aliases = grep { $_ =~ /^(sp\||gi\||pirnr\||kegg\||N[PGZ]_)/ } $fig->feature_aliases($peg);
447                print ANNOTATIONS join("\t",($peg,join(",",@aliases),$gs,scalar $fig->function_of($peg))) . "\n";
448            }
449        }
450        print ANNOTATIONS "//\n";
451        for my $gent (@annos)
452        {
453            my($genome, $alist) = @$gent;
454    
455            for my $peg (sort { &FIG::by_fig_id($a, $b) } keys %$alist)
456            {
457                my $seq = $fig->get_translation($peg);
458                &FIG::display_id_and_seq($peg,\$seq,\*ANNOTATIONS);
459            }
460    
461        }
462    
463        close(ANNOTATIONS);
464    }
465    
466    sub package_annotations2 {
467        my($fig,$who,$date,$genomes,$file) = @_;
468        my $fig_base = "$FIG_Config::fig_disk/FIG";
469    
470      if (open(ANNOTATIONS,">$file"))      if (open(ANNOTATIONS,">$file"))
471      {      {
472          my @annotations = sort { $a->[0] cmp $b->[0] } $fig->annotations_made($genomes,$who,$date);          my @annotations = sort { $a->[0] cmp $b->[0] } $fig->annotations_made($genomes,$who,$date);

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3