#!/usr/bin/perl -w
# 2005/05/10 - I. Dutour

#
# lecture d'un fichier GenBank
#

$annotations = "";
$sequence = "";

while ($lecture = <>) {
    last
	if ($lecture =~ /^ORIGIN/);
    $annotations .= $lecture;
}

while ($lecture = <>) {
    last
	if ($lecture =~ /^\/\//);
    $sequence .= $lecture;
}
$sequence =~ s/[^agtc]//gi;

#print "$sequence\n";

$partannot = $annotations;
while(($start,$stop) = ($partannot =~ /CDS \s+ (\d+)\.\.(\d+)/))
{
    print "$&\n";
    print "$start $stop\n";
    $partseq = substr($sequence,$start-1,$stop-$start+1);
    print "$partseq\n";
    $partannot = substr($partannot,length($`)+1);
}
