[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.4 - (download) (as text) (annotate)
Mon Dec 5 18:56:38 2005 UTC (14 years ago) by olson
Branch: MAIN
CVS Tags: caBIG-05Apr06-00, caBIG-13Feb06-00
Changes since 1.3: +17 -0 lines
Add license words.

#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#

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