[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.2 - (view) (download) (as text)

1 : overbeek 1.1 use FIG;
2 :    
3 :     $usage = "usage: sort_and_split_bbhs BBHs Dir";
4 :    
5 :     (
6 :     ($bbhs = shift @ARGV) &&
7 :     ($dir = shift @ARGV)
8 :     )
9 :     || die $usage;
10 :    
11 :     &FIG::verify_dir($dir);
12 :    
13 :     open(BBHS,"sort -u $bbhs |") || die "could not open $bbhs";
14 :     $last = "";
15 :     $bbh = <BBHS>;
16 :     while ($bbh && ($bbh =~ /^(\S+)/))
17 :     {
18 :     $curr = $1;
19 :     if (($genome = &FIG::genome_of($curr)) ne $last)
20 :     {
21 :     if ($last)
22 :     {
23 :     close(BYGENOME);
24 :     }
25 :     $last = $genome;
26 :     open(BYGENOME,">$dir/$genome") || die "could not open $dir/$genome";
27 :     }
28 :     while ($bbh && ($bbh =~ /^(\S+)/) && ($1 eq $curr))
29 :     {
30 :     print BYGENOME $bbh;
31 :     $bbh = <BBHS>;
32 :     }
33 :     }
34 :     close(BYGENOME);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3