1#!/usr/local/bin/perl 2 3$rep = ""; 4$no = 0; 5while($ll=<>){ 6 if ($ll =~ /^>/) { 7 if ($no) { 8 print "$cid\t$rep\t$no\n"; 9 } 10 $cid = ""; 11 if ($ll =~ /^>Cluster (\d+)/) {$cid = $1;} 12 elsif ($ll =~ /^>Clstr (\d+)/) {$cid = $1;} 13 else {die "format error $ll"} 14 $rep = ""; 15 $no = 0; 16 } 17 else { 18 if ($ll =~ /\*$/) { 19 $rep = ""; 20 if ($ll =~ /aa, >(.+)\.\.\./) { 21 $rep = $1; 22 } 23 else { 24 die "format error $ll"; 25 } 26 } 27 $no++; 28 } 29} 30 if ($no) { 31 print "$cid\t$rep\t$no\n"; 32 } 33