[Bioperl-l] retreive all seq of a species

Mark Johnson mjohnson at watson.wustl.edu
Wed Jun 9 16:09:55 EDT 2004


Works, but will only get you 500 sequences ( That's what I get, anway.  Or
am I on some special NCBI blacklist? 8) )with a stock version of
1.4...which is fine for Antheraea mylitta, only 10 records come back.  If
you expect more than 500 records, try (untested):

#!/usr/bin/perl (or wherever your perl is)

use Bio::DB::Query::GenBank;
use Bio::DB::GenBank;

my $query_string = qq{"Antheraea mylitta"[ORGN]};

my $query = Bio::DB::Query::GenBank->new(
                                         -db => 'nucleotide',
                                         -query => $query_string
                                        );

my @ids = $query->ids();

while (my @batch = splice(@ids, 0, 500)) {

    my $gb = Bio::DB::GenBank->new();
    my $stream = $gb->get_Stream_by_id([@batch]);

    while (my $seq = $stream->next_seq()) {

        ## Do Stuff Here

    }

}


> Something like this should work:
>
> use Bio::DB::Query::GenBank;
> use Bio::DB::GenBank;
>
> open(OUT,">test");
> my $query_string = '"Antheraea mylitta"[Organism]';
> my $query = Bio::DB::Query::GenBank->new(
>
> -db=>'nucleotide',
>
> -query=>$query_string,
>                                                                  );
> my $gb = new Bio::DB::GenBank;
> my $stream = $gb->get_Stream_by_query($query);
> while (my $seq = $stream->next_seq) {
>      print OUT ">" , $seq->display_id , "\n" , $seq->seq , "\n\n";
> }
>
>  > Using bio perl modules how i can retreive all the
>  > nucleotide sequences submitted in genbank for a
>  > particular species (eg. Antheraea mylitta) .
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>



More information about the Bioperl-l mailing list