[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.3, Fri Dec 19 20:04:52 2003 UTC revision 1.4, Sat Dec 20 15:19:21 2003 UTC
# Line 461  Line 461 
461  =cut  =cut
462    
463  sub package_assignments {  sub package_assignments {
464      my($fig_base,$who,$genomes,$file) = @_;      my($fig_base,$who,$date,$genomes,$file) = @_;
465    
466  # We should condition the package on the $who parameter, but we do not (for now)      $who   = $who ? $who : "master";
 #  
467    
468      &force_absolute($fig_base);      &force_absolute($fig_base);
469      &force_absolute($file);      &force_absolute($file);
# Line 473  Line 472 
472      foreach $genome (@$genomes)      foreach $genome (@$genomes)
473      {      {
474          print STDERR "packaging $genome\n";          print STDERR "packaging $genome\n";
475            my @possible = ();
476          mkdir("$fig_base/Tmp/Assignments/$genome",0777) || die "could not make $fig_base/Tmp/Assignments/$genome";          mkdir("$fig_base/Tmp/Assignments/$genome",0777) || die "could not make $fig_base/Tmp/Assignments/$genome";
477    
478          if (-s "$fig_base/Data/Organisms/$genome/assigned_functions")          if (($who eq "master") && (-s "$fig_base/Data/Organisms/$genome/assigned_functions"))
479          {          {
             open(TMPOUT,">$fig_base/Tmp/Assignments/$genome/master")|| die "could not open $fig_base/Tmp/Assignments/$genome/master";  
480              my %seen;              my %seen;
481              my($assignment,$id);              my($assignment,$id);
482              foreach $assignment (reverse `cat $fig_base/Data/Organisms/$genome/assigned_functions`)              foreach $assignment (reverse `cat $fig_base/Data/Organisms/$genome/assigned_functions`)
483              {              {
484                  if (($assignment =~ /^(\S+)/) && (! $seen{$1}))                  if (($assignment =~ /^(\S+)\t(\S.*\S)/) && (! $seen{$1}))
485                  {                  {
486                      $seen{$1} = 1;                      $seen{$1} = 1;
487                      print TMPOUT $assignment;                      push(@possible,["master",$1,$2]);
488                  }                  }
489              }              }
             close(TMPOUT);  
490          }          }
491    
492          if (0) # For now, no syncs on users other than "master" (-d "$fig_base/Data/Organisms/$genome/UserModels")          if (($who ne "master") && (-s "$fig_base/Data/Organisms/$genome/UserModels/$who/assigned_functions"))
493          {          {
494              opendir(TMP,"$fig_base/Data/Organisms/$genome/UserModels")              my %seen;
495                  || die "could not open $fig_base/Data/Organisms/$genome/UserModels";              my($assignment,$id);
496              @users = grep { $_ !~ /^\./ } readdir(TMP);              foreach $assignment (reverse `cat $fig_base/Data/Organisms/$genome/UserModels/$who/assigned_functions`)
             closedir(TMP);  
             foreach $user (@users)  
497              {              {
498                  if (-s "$fig_base/Data/Organisms/$genome/UserModels/$user/assigned_functions")                  if (($assignment =~ /^(\S+)\t(\S.*\S)/) && (! $seen{$1}))
499                  {                  {
500                      &FIG::run("cp $fig_base/Data/Organisms/$genome/UserModels/$user/assigned_functions $fig_base/Tmp/Assignments/$genome/$user");                      $seen{$1} = 1;
501                        push(@possible,[$who,$1,$2]);
502                  }                  }
503              }              }
504          }          }
505    
506            if (@poss > 0)
507            {
508                if ($date)
509                {
510    ####
511                }
512            }
513      }      }
514      &FIG::run("cd $fig_base/Tmp; tar czf $file Assignments; rm -rf Assignments");      &FIG::run("cd $fig_base/Tmp; tar czf $file Assignments; rm -rf Assignments");
515  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3