[Bioperl-l] Creating Genbank file

Vilanova,David,LAUSANNE,NRC-BS david.vilanova@rdls.nestle.com
Mon, 9 Dec 2002 12:40:52 +0100


Dear all,
I'm trying to reconstruct a genbank annotation file and I have some
problems.
I want to add a subseqfeature. I have the following code. I'm not sure I'm
using it properly but I get an output without the subseqfeature. The rest is
ok.
How can I add subseqfeatures ??? 
 
Thanks,
David
 
 

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

die "Usage: per script.pl Fasta_File Feaures_File" unless @ARGV eq '2';
 
my($seq_file,$feat_file) = @ARGV;
 
my $seq_in = new Bio::SeqIO (-file => $seq_file,
        -format => 'fasta'
        );
$sequence= $seq_in->next_seq;
 
my $seq = new Bio::Seq (-seq =>$sequence->seq(),
   -id => 'Genome_v10,
   -desc =>"My genome",
   -authors =>"List here"
   );
my $feat = new Bio::SeqFeature::Generic ( -start => 1,
       -end => 365,
       -strand => 1,
       -primary =>"Gene",
       -tag    => {
           note => "NOTE here"}
       #-primary => 'CDS',
       );
my $subfeat = new Bio::SeqFeature::Generic (-start =>1,
         -end => 365,
         -strand => 1,
         -primary => 'CDS',
         #-primary => "CDS",
         -tag => {
      note =>"Note Here"}
         );
 
$feat->add_sub_SeqFeature($subfeat);
 
$seq->add_SeqFeature($feat);
 

my $seq_out = new Bio::SeqIO(-file=>">Genome_v10.gbk",
        -format=>"genbank");
 
$seq_out->write_seq($seq);