[Bio] / FigKernelScripts / process_new_sims.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/process_new_sims.pl

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

revision 1.1, Mon Dec 1 20:46:40 2003 UTC revision 1.2, Fri Mar 11 16:36:51 2005 UTC
# Line 1  Line 1 
1  use FIG;  use FIG;
2    
3  $usage = "usage: process_new_sims NR SimsDir Prefix EnhancedSimsDir";  $usage = "usage: process_new_sims NR peg.synonyms SimsDir Prefix EnhancedSimsDir";
4    
5  (($nr = shift @ARGV) && (-s $nr) &&  (  ($nr  = shift @ARGV) && (-s $nr)
6   ($from_dir = shift @ARGV) &&  && ($syn = shift @ARGV) && (-s $syn)
7   ($prefix = shift @ARGV) &&  && ($from_dir = shift @ARGV)
8   ($to_dir = shift @ARGV)  && ($prefix = shift @ARGV)
9    && ($to_dir = shift @ARGV)
10   ) || die $usage;   ) || die $usage;
11    
12  opendir(FROM,$from_dir) || die "could not open $from_dir";  opendir(FROM,$from_dir) || die "could not open $from_dir";
13  @to_process = grep { $_ !~ /^\./ } readdir(FROM);  @to_process = sort { $a =~ /\.(\d+)(\.gz)?$/; $x = $1;
14                         $b =~ /\.(\d+)(\.gz)?$/; $y = $1; ($x <=> $y) }
15                         grep { $_ !~ /^\./ } readdir(FROM);
16  closedir(FROM);  closedir(FROM);
17    
18  (-d $to_dir) || mkdir($to_dir,0777) || die "could not make $to_dir";  (-d $to_dir) || mkdir($to_dir,0777) || die "could not make $to_dir";
19    
20    open(OUT, "| reduce_sims $syn 300 | reformat_sims $nr | split_sims $to_dir $prefix")
21        || die "could not open output pipeline";
22    
23  foreach $file (@to_process)  foreach $file (@to_process)
24  {  {
25      print STDERR "processing $file\n";      print STDERR "processing $file\n";
26      my $base = ($file =~ /^(\S+).gz$/) ? $1 : $file;  #   my $base = ($file =~ /^(\S+).gz$/) ? $1 : $file;
27    
28      if (-e "$to_dir/$prefix.$base")      if ($file =~ /^\S+\.gz$/)
29      {      {
30          print STDERR "$to_dir/$base already exists - skipping\n";          open(IN, "zcat $from_dir/$file |") || die "Could not pipe-open $from_dir/$file";
31      }      }
32      else      else
33      {      {
34          if ($file =~ /^(\S+)\.gz$/)          open(IN, "<$from_dir/$file") || die "Could not read-open $from_dir/$file";
         {  
             &FIG::run("zcat $from_dir/$file | reduce_sims | reformat_sims $nr > $to_dir/$prefix.$base");  
         }  
         else  
         {  
             &FIG::run("reduce_sims < $from_dir/$file | reformat_sims $nr > $to_dir/$prefix.$file");  
         }  
35      }      }
36    
37        while (defined($entry = <IN>)) { print OUT $entry; }
38  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3