How can I print the first occurrence of a protein sequence? For this query I get four results and I want only the first.
use Bio::DB::GenBank;
use Bio::DB::Query::GenBank;
$query = "LEGK";
$query_obj = Bio::DB::Query::GenBank->new(
-db => 'protein',
-query => $query
);
$gb_obj = Bio::DB::GenBank->new;
$stream_obj = $gb_obj->get_Stream_by_query( $query_obj );
while ( $seq_obj = $stream_obj->next_seq ) {
# do something with the sequence object
print
">$query", ' ',
$seq_obj->display_id, ' ',
$seq_obj->desc, "\n",
$seq_obj->seq[, '\n';
That while
loop should look like this
while ( $seq_obj = $stream_obj->next_seq ) {
# do something with the sequence object
print $seq_obj->display_id, "\t", $seq_obj->length, "\n";
}