[Bioperl-l] BioPerl newbie question about exporting sub_SeqFe atures

Gosink, Mark (SEA) Mark.Gosink@sea.celltechgroup.com
Tue, 17 Apr 2001 12:28:04 -0700


Thanks for the suggestion, unfortunately it didn't seem to work for more
than 1 sub_feature. Here is the script with multiple sub_features:

use Bio::SeqFeature::Generic;
use Bio::Seq;
use Bio::SeqIO;

my $feat = Bio::SeqFeature::Generic->new(-primary => "test");
my $seq = Bio::Seq->new(-seq => "agctacgaccttgatcgcta", -id =>"test01");

# add sub-features to the feature
$feat->add_sub_SeqFeature(Bio::SeqFeature::Generic->new(-start => 2, -end =>
4, -primary => "sub1"), EXPAND);
$feat->add_sub_SeqFeature(Bio::SeqFeature::Generic->new(-start => 6, -end =>
8, -primary => "sub2"), EXPAND);
# could add more

# attach to sequence
$seq->add_SeqFeature($feat);

# print in GenBank format (note that there is lots of stuff missing, like
species etc)
my $seqout = Bio::SeqIO->new(-fh => \*STDOUT, -format => "genbank");

$seqout->write_seq($seq);

$seqout->close();

And here's the results:

LOCUS       test01            20 bp     DNA  UNK     
DEFINITION  
ACCESSION   unknown
FEATURES             Location/Qualifiers
     sub1            2..4
     sub2            6..8
     test            Bio::SeqFeature::Generic=HASH(0xd58d0)..4
BASE COUNT        5 a      6 c      4 g      5 t
ORIGIN
        1 agctacgacc ttgatcgcta 
//

> -----Original Message-----
> From: Hilmar Lapp [mailto:hilmarl@yahoo.com]
> Sent: Tuesday, April 17, 2001 11:06 AM
> To: Gosink, Mark (SEA)
> Cc: 'bioperl-l@bioperl.org'
> Subject: Re: [Bioperl-l] BioPerl newbie question about exporting
> sub_SeqFeatures
> 
> 
> "Gosink, Mark (SEA)" wrote:
> > 
> > Hello all,
> >         Does anyone have any example of adding a feature 
> with sub_features
> > to a sequence and then saving that as a GenBank/EMBL/other? 
> When I try, I
> > get a HASH feature.
> > Thanks for any tips,
> 
> use Bio::SeqFeature::Generic;
> use Bio::Seq;
> use Bio::SeqIO;
> 
> my $feat = Bio::SeqFeature::Generic->new(-start => 1, -end => 5,
> -primary => "test");
> my $seq = Bio::Seq->new(-seq => "agctacgaccttgatcgcta", -id =>
> "test01");
> 
> # add sub-features to the feature
> $feat->add_SeqFeature(Bio::SeqFeature::Generic->new(-start => 2,
> -end => 4, -primary => "sub1"));
> # could add more
> 
> # attach to sequence
> $seq->add_SeqFeature($feat);
> 
> # print in GenBank format (note that there is lots of stuff
> missing, like species etc)
> my $seqout = Bio::SeqIO->new(-fh => \*STDOUT, -format =>
> "genbank");
> $seqout->write_seq($seq);
> 
> $seqout->close();
> 
> 
> This works for me. The two features come out as top-level features
> though, because Genbank does not have subfeatures of features (in
> Genbank features can only have annotation in the form of tag/value
> pairs).
> 
> Does this answer your question? If not, please provide your code
> and the output it produces on which input.
> 
> 	Hilmar
> -- 
> -----------------------------------------------------------------
> Hilmar Lapp                              email: hilmarl@yahoo.com
> GNF, San Diego, Ca. 92122                phone: +1 858 812 1757
> -----------------------------------------------------------------
> 


The information contained in this email is intended for the
personal and confidential use of the addressee only. It may
also be privileged information. If you are not the intended
recipient then you are hereby notified that you have received
this document in error and that any review, distribution or
copying of this document is strictly prohibited. If you have
received  this communication in error, please notify Celltech
Group immediately on:

+44 (0)1753 534655, or email 'is@celltech.co.uk'

Celltech Group plc
216 Bath Road, Slough, SL1 4EN, Berkshire, UK

Registered Office as above. Registered in England No. 2159282