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

Annotation of /FigKernelScripts/sort_and_split_bbhs.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.4 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : overbeek 1.1 use FIG;
19 :    
20 :     $usage = "usage: sort_and_split_bbhs BBHs Dir";
21 :    
22 :     (
23 :     ($bbhs = shift @ARGV) &&
24 :     ($dir = shift @ARGV)
25 :     )
26 :     || die $usage;
27 :    
28 :     &FIG::verify_dir($dir);
29 :    
30 : olson 1.5 open(BBHS,"sort $ENV{SORT_ARGS} -u $bbhs |") || die "could not open $bbhs";
31 : overbeek 1.1 $last = "";
32 :     $bbh = <BBHS>;
33 :     while ($bbh && ($bbh =~ /^(\S+)/))
34 :     {
35 :     $curr = $1;
36 :     if (($genome = &FIG::genome_of($curr)) ne $last)
37 :     {
38 :     if ($last)
39 :     {
40 :     close(BYGENOME);
41 :     }
42 :     $last = $genome;
43 : overbeek 1.3 open(BYGENOME,">>$dir/$genome") || die "could not open $dir/$genome";
44 : overbeek 1.1 }
45 :     while ($bbh && ($bbh =~ /^(\S+)/) && ($1 eq $curr))
46 :     {
47 :     print BYGENOME $bbh;
48 :     $bbh = <BBHS>;
49 :     }
50 :     }
51 :     close(BYGENOME);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3