[Bioperl-l] Problem to download files from the NCBI database with BioPerl

Michelle da Costa mychellys2 at gmail.com
Thu Mar 13 14:42:13 UTC 2014


Hi,
I'm making a script to download the revised files of Homo sapiens database 
of NCBI using BioPerl. 
The script works, but is not downloading the 21431 files, it downloads only 
10000. If someone can help me:

#!/usr/bin/perl
    use strict;
    use warnings;
    use Bio::DB::GenBank;
    use Bio::DB::Query::GenBank;
    use Bio::SeqIO;
    use Data::Dumper;
    use Bio::Seq;
    
    my $cont = 1;
    
    my $outfile = Bio::SeqIO->new(-file => '>teste.gb', -format => 
'genbank');
    
    # get a stream via a query string
    my $query = Bio::DB::Query::GenBank->new
        (-query   => 'Homo sapiens[organism] AND 
srcdb_refseq_reviewed[prop] AND biomol_mRNA[PROP]',
         -db      => 'nucleotide');
         
    my $gb = Bio::DB::GenBank->new( );
    my $seqio = $gb->get_Stream_by_query($query);
    
    while( my $seq =  $seqio->next_seq ) {
      print "ACCESSION: ", $cont++, " ", $seq->accession_number,"\n";
      $outfile->write_seq($seq);
    }

    my $count = $query->count;
    print "Total de arquivos recuperados:", $count, "\n";

Thank you 



More information about the Bioperl-l mailing list