[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.421, Fri Jan 13 20:22:39 2006 UTC revision 1.422, Fri Jan 13 22:15:35 2006 UTC
# Line 6269  Line 6269 
6269    
6270      my $genome = $self->genome_of($fid);      my $genome = $self->genome_of($fid);
6271    
6272        #  Just to make this a little less fragile, convert user of form
6273        #  master:name to master. -- GJO
6274    
6275        $user =~ s/^master\:.*$/master/;
6276    
6277      $function =~ s/\s+/ /sg;      $function =~ s/\s+/ /sg;
6278      $function =~ s/^\s+//;      $function =~ s/^\s+//;
6279      $function =~ s/\s+$//;      $function =~ s/\s+$//;
# Line 6308  Line 6313 
6313    
6314      my $funcQ = quotemeta $function;      my $funcQ = quotemeta $function;
6315      $rdbH->SQL("INSERT INTO assigned_functions ( prot, made_by, assigned_function, quality, org ) VALUES ( \'$fid\', \'$user\', \'$funcQ\', \'$confidence\', \'$genome\' )");      $rdbH->SQL("INSERT INTO assigned_functions ( prot, made_by, assigned_function, quality, org ) VALUES ( \'$fid\', \'$user\', \'$funcQ\', \'$confidence\', \'$genome\' )");
     $rdbH->SQL("DELETE FROM roles WHERE ( prot = \'$fid\' AND made_by = \'$user\' )");  
6316    
6317        $rdbH->SQL("DELETE FROM roles WHERE ( prot = \'$fid\' AND made_by = \'$user\' )");
6318      foreach $role (&roles_of_function($function))      foreach $role (&roles_of_function($function))
6319      {      {
6320          $roleQ = quotemeta $role;          $roleQ = quotemeta $role;
6321          $rdbH->SQL("INSERT INTO roles ( prot, role, made_by, org ) VALUES ( \'$fid\', '$roleQ\', \'$user\',  \'$genome\' )");          $rdbH->SQL("INSERT INTO roles ( prot, role, made_by, org ) VALUES ( \'$fid\', '$roleQ\', \'$user\',  \'$genome\' )");
6322      }      }
6323    
6324      &verify_dir("$FIG_Config::organisms/$genome/UserModels");      my $file;
6325      if ($user ne "master")      if ( $user eq "master" )
6326      {      {
6327            $file = "$FIG_Config::organisms/$genome/assigned_functions";
6328        }
6329        else
6330        {
6331            &verify_dir("$FIG_Config::organisms/$genome/UserModels");
6332          &verify_dir("$FIG_Config::organisms/$genome/UserModels/$user");          &verify_dir("$FIG_Config::organisms/$genome/UserModels/$user");
6333            $file = "$FIG_Config::organisms/$genome/UserModels/$user/assigned_functions";
6334      }      }
6335    
6336      my $file;      if ( ! open( TMP, ">>$file" ) )
     if ((($user eq "master") && ($file = "$FIG_Config::organisms/$genome/assigned_functions") && open(TMP,">>$file")) ||  
         (($user ne "master") && ($file = "$FIG_Config::organisms/$genome/UserModels/$user/assigned_functions") && open(TMP,">>$file")))  
6337      {      {
6338            print STDERR "FAILED ASSIGNMENT: $fid\t$function\t$confidence\n";
6339            return 0;
6340        }
6341    
6342          flock(TMP,LOCK_EX) || confess "cannot lock assigned_functions";          flock(TMP,LOCK_EX) || confess "cannot lock assigned_functions";
6343        #  Is there a reason for the seek when the file was openned for append?
6344        #  Does flock have a side effect?
6345          seek(TMP,0,2)      || confess "failed to seek to the end of the file";          seek(TMP,0,2)      || confess "failed to seek to the end of the file";
6346          print TMP "$fid\t$function\t$confidence\n";          print TMP "$fid\t$function\t$confidence\n";
6347          close(TMP);          close(TMP);
6348          chmod(0777,$file);          chmod(0777,$file);
6349    
6350          return 1;          return 1;
6351      }      }
     else  
     {  
         print STDERR "FAILED ASSIGNMENT: $fid\t$function\t$confidence\n";  
     }  
     return 0;  
 }  
6352    
6353    
6354  sub hypo {  sub hypo {

Legend:
Removed from v.1.421  
changed lines
  Added in v.1.422

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3