perl - How can I download the entire GenBank file with just an accession number? -


i've got array full of accession numbers, , i'm wondering if there's way automatically save genbank files using bioperl. know can grab sequence information, want entire genbank record.

#!/usr/bin/env perl use strict; use warnings; use bio::db::genbank;  @accession; open (refined, "./refine.txt") || die "could not open: $!";  while(<refined>){     if(/^(\d+)\|(.*?)\|/){     push(@accession, $2);     } } close refined; foreach $number(@accession){      $db_obj = bio::db::genbank->new;     } 

you can save full genbank records using bio::db::eutilities. here example take list of ids , save genbank records each in file called myseqs.gb:

#!/usr/bin/env perl  use strict; use warnings; use bio::db::eutilities;  @ids = qw(1621261 89318838 68536103 20807972 730439);  $factory = bio::db::eutilities->new(-eutil   => 'efetch',                                        -db      => 'protein',                                        -rettype => 'gb',                                        -email   => 'mymail@foo.bar',                                        -id      => \@ids);  $file = 'myseqs.gb';  # dump http::response content file (not retained in memory) $factory->get_response(-file => $file); 

if want split individual records returned instead of having them in 1 file, can done bio::seqio. check out eutilities howto , eutilities cookbook more examples , explanation.


Comments