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

Annotation of /FigKernelScripts/process_new_sims.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3