[Bioperl-l] Extracting gene seq from Bio::DB::GFF
Scott Cain
cain at cshl.edu
Fri Aug 11 19:05:54 UTC 2006
Hi Marco,
What you are getting from get_feature_by_name is a list of
Bio::DB::GFF::Feature objects, which are Bio::SeqFeatureI objects. What
you need are Bio::PrimarySeq objects. Fortunately,
Bio::DB::GFF::Feature has a method to get a PrimarySeq out of it; that
method is called seq.
So, you should be able to change your line to
$out->write_seq( $_->seq() ) for @feat;
and it should work. Of course, I haven't test that to make sure that it
does :-)
Scott
On Fri, 2006-08-11 at 11:30 -0700, Marco Blanchette wrote:
> Dear all,
>
> I used to use this very simple script to extract the gene sequence as a
> fasta flat file from a Bio::DB::GFF database containing the GadFly 4.3
> annotations
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use Bio::DB::GFF;
> use Bio::SeqIO;
>
> my $out = Bio::SeqIO->new( -fh => \*STDOUT,
> -format => 'fasta');
>
> my $db = Bio::DB::GFF->new( -adaptor => 'dbi::mysql',
> -dsn => 'dbi:mysql:database=dmel_43_LS');
>
> while (<>){
> chomp;
> my @feat = $db->get_feature_by_name($_);
> $out->write_seq($_) for @feat;
> }
>
> Somehow I now get the following output instead of the actual sequences:
> >FBgn0024988 gene:.(FBgn0024988)
> Bio::PrimarySeq=HASH(0x19fd3d8)
> >FBgn0041184 gene:.(FBgn0041184)
> Bio::PrimarySeq=HASH(0x19fa684)
> >FBgn0033636 gene:.(FBgn0033636)
> Bio::PrimarySeq=HASH(0x19e1908)
>
> What change and what would be the right way to get what I want?
>
> Many thanks
>
> Marco
> ______________________________
> Marco Blanchette, Ph.D.
>
> mblanche at uclink.berkeley.edu
>
> Donald C. Rio's lab
> Department of Molecular and Cell Biology
> 16 Barker Hall
> University of California
> Berkeley, CA 94720-3204
>
> Tel: (510) 642-1084
> Cell: (510) 847-0996
> Fax: (510) 642-6062
--
------------------------------------------------------------------------
Scott Cain, Ph. D. cain at cshl.edu
GMOD Coordinator (http://www.gmod.org/) 216-392-3087
Cold Spring Harbor Laboratory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.open-bio.org/pipermail/bioperl-l/attachments/20060811/07e10115/attachment-0003.bin>
More information about the Bioperl-l
mailing list