[Bioperl-l] Getting refseq (contigs) from Genbank

Wiepert, Mathieu Wiepert.Mathieu@mayo.edu
Wed, 31 Oct 2001 11:05:59 -0600


Jason,
Thanks for the help, still no luck?  I tried this now

#!/usr/local/bin/perl
use Bio::DB::GenBank;
use Bio::SeqIO;

$gb = new Bio::DB::GenBank(-retrievaltype => 'tempfile' ,
                               -format => 'Fasta');
$gb->request_format('fasta');
my $seq = $gb->get_Seq_by_acc('NT_004348');

$out = Bio::SeqIO->new('-file' => ">NT_004348.seq",
                         '-format' => 'fasta');
$out->write_seq($seq); 

But get:
-------------------- EXCEPTION --------------------
MSG: Attempting to set the sequence to [<html] which does not look healthy
STACK Bio::PrimarySeq::seq
/usr/lib/perl5/site_perl/5.6.0/Bio/PrimarySeq.pm:243
STACK Bio::PrimarySeq::new
/usr/lib/perl5/site_perl/5.6.0/Bio/PrimarySeq.pm:218
STACK Bio::Seq::new /usr/lib/perl5/site_perl/5.6.0/Bio/Seq.pm:132
STACK Bio::SeqIO::fasta::next_primary_seq
/usr/lib/perl5/site_perl/5.6.0/Bio/SeqIO/fasta.pm:130
STACK Bio::SeqIO::fasta::next_seq
/usr/lib/perl5/site_perl/5.6.0/Bio/SeqIO/fasta.pm:85
STACK Bio::DB::WebDBSeqI::get_Seq_by_acc
/usr/lib/perl5/site_perl/5.6.0/Bio/DB/WebDBSeqI.pm:159
STACK toplevel getcontigs.pl:8
-------------------------------------------

I tried with and without the $gb->request_format('fasta'); line, same error.
I got that from the help on DB::GenBank

"Note that when querying for GenBank accessions starting with 'NT_' you will
need to call $gb->request_format('fasta') beforehand, because in GenBank
format (the default) the sequence part will be left out (the reason is that
NT contigs are rather annotation with references to clones). "