#!/usr/local/bin/perl -w

# read a .intron file and count distinct predicted intron per sequences

while (<STDIN>)
{
    if (($seq_id, $I) = (/^seq(\d+)\s+(\[[^\[]+\])/))
    {
	$introns{int($seq_id)}{$I} = "";;
    }
}

@sequenses = sort {$a <=> $b} keys %introns;
foreach $s (@sequenses)
{
    @dummy = keys %{$introns{$s}};
    printf "seq%03d\t%d\n", $s, $#dummy + 1;
}
