ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cd-hit/post_cluster.pl
Revision: 1.1.1.1 (vendor branch)
Committed: Sat Feb 7 10:55:46 2004 UTC (17 years, 10 months ago) by dmb
Branch: main, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
First import

Line User Rev File contents
1 dmb 1.1 #!/usr/bin/perl
2    
3     # when clustering NR, it core-dumped after writting the database
4     # before output the .clstr file
5     # This script is to generate this .clstr file from .bak.clstr
6    
7     my %cluster = ();
8     while($ll=<>) {
9     chop($ll);
10     my ($i, $v) = split(/\t/,$ll);
11     if ($i < 0 ) {$i = -$i-1;}
12    
13     if (not defined($cluster{$i})) {
14     $cluster{$i} = [$v];
15     }
16     else {
17     push(@{$cluster{$i}},$v);
18     }
19     }
20    
21     my @c = sort {$a <=> $b} keys %cluster;
22    
23     for ($i=0; $i<=$#c; $i++) {
24     print ">Cluster $i\n";
25    
26     $v = $c[$i];
27     for ($j=0; $j<=$#{$cluster{$v}}; $j++) {
28     print "$j\t$cluster{$v}->[$j]\n";
29     }
30     }