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

View of /FigKernelScripts/sort_and_split_bbhs.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Mon Sep 19 03:08:59 2005 UTC (14 years, 2 months ago) by overbeek
Branch: MAIN
CVS Tags: caBIG-dataload-0, caBIG-00-00-00
Changes since 1.2: +1 -1 lines
fixes in BBH generation

use FIG;

$usage = "usage: sort_and_split_bbhs BBHs Dir";

(
 ($bbhs = shift @ARGV) &&
 ($dir  = shift @ARGV)
)
    || die $usage;

&FIG::verify_dir($dir);

open(BBHS,"sort -u $bbhs |") || die "could not open $bbhs";
$last = "";
$bbh = <BBHS>;
while ($bbh && ($bbh =~ /^(\S+)/))
{
    $curr = $1;
    if (($genome = &FIG::genome_of($curr)) ne $last)
    {
	if ($last)
	{
	    close(BYGENOME);
	}
	$last = $genome;
	open(BYGENOME,">>$dir/$genome") || die "could not open $dir/$genome";
    }
    while ($bbh && ($bbh =~ /^(\S+)/) && ($1 eq $curr))
    {
	print BYGENOME $bbh;
	$bbh = <BBHS>;
    }
}
close(BYGENOME);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3