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

View of /FigKernelScripts/process_new_sims.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Fri Mar 11 16:36:51 2005 UTC (15 years, 3 months ago) by overbeek
Branch: MAIN
CVS Tags: merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, caBIG-dataload-0, merge-trunktag-bobdev_news-1, merge-bodev_news-3, efrank-preMakefileToStandardMk, caBIG-00-00-00, merge-bobdev_news-2, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news
Changes since 1.1: +20 -19 lines
Significant changes to syntax and structure. -- /gdp

use FIG;

$usage = "usage: process_new_sims NR peg.synonyms SimsDir Prefix EnhancedSimsDir";

(  ($nr  = shift @ARGV) && (-s $nr) 
&& ($syn = shift @ARGV) && (-s $syn) 
&& ($from_dir = shift @ARGV) 
&& ($prefix = shift @ARGV) 
&& ($to_dir = shift @ARGV)
)  || die $usage;

opendir(FROM,$from_dir) || die "could not open $from_dir";
@to_process = sort { $a =~ /\.(\d+)(\.gz)?$/; $x = $1; 
		     $b =~ /\.(\d+)(\.gz)?$/; $y = $1; ($x <=> $y) } 
                     grep { $_ !~ /^\./ } readdir(FROM);
closedir(FROM);

(-d $to_dir) || mkdir($to_dir,0777) || die "could not make $to_dir";

open(OUT, "| reduce_sims $syn 300 | reformat_sims $nr | split_sims $to_dir $prefix")
    || die "could not open output pipeline";

foreach $file (@to_process)
{
    print STDERR "processing $file\n";
#   my $base = ($file =~ /^(\S+).gz$/) ? $1 : $file;
    
    if ($file =~ /^\S+\.gz$/)
    {
	open(IN, "zcat $from_dir/$file |") || die "Could not pipe-open $from_dir/$file";
    }
    else
    {
	open(IN, "<$from_dir/$file") || die "Could not read-open $from_dir/$file";
    }
    
    while (defined($entry = <IN>)) { print OUT $entry; }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3