[Bioperl-l] write protein sequence by Bio::SeqIO

Remo Sanges sanges@biogem.it
Fri, 08 Nov 2002 10:43:25 +0100


suhoiy wrote:

> Hello all,
> 
> I am sorry to bother you. There is a problem in my code. I want to write a protein
> sequence in genbank format, but the code change it to nucleic acid sequence. For
> example:
> 
> ========
> my $in   = Bio::SeqIO->new(  '-format' => 'genbank', 
>                                              '-file'   => 'sample.genpept',
> 		             );
> my $out  = Bio::SeqIO->new('-format' => 'genbank',
>                                             '-file' => '>sampleout.genpept',
>                                           );
> my $seq = $in->next_seq;
> $out->write_seq($seq);
> ========


I thing, if the input file is ok and contains protein sequenences, you
should set the '-alphabet' format in the constructor new:

my $in   = Bio::SeqIO->new(  '-format' => 'genbank',
                             '-file'   => 'sample.genpept',
                             'alphabet'=> 'protein'           );

my $out  = Bio::SeqIO->new(  '-format' => 'genbank',
                             '-file' => '>sampleout.genpept',
                             '-alphabet'=> 'protein'          );

my $seq = $in->next_seq;
$out->write_seq($seq);

I havn't try but I thing it should go

Let me know!|

> 
> the locus line of origin sequence is:
> LOCUS       108_LYCES                102 aa            linear   PLN 15-JUL-1999
> 
> while the locus line of the output sequence is:
> LOCUS       108_LYCES                102 bp    linear  linear   PLN 15-JUL-1999
> 
> I use bioperl 1.0.2. there are these lines in the write_seq method in Bio::SeqIO::genbank:
> 
> ========
>     if( !$seq->can('molecule') || ! defined ($mol = $seq->molecule()) ) {
> 	$mol = $seq->alphabet || 'DNA';
>     }
> ========
> 
> many thanks for your help!


you are welcome!


> 
> suhoiy
> 
> 
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
> 
> 
__________________________________
Remo Sanges
BioGeM
Gene Expression Core Lab
Via Pietro Castellino 111
80131 NaplesItaly
+39 081 6132265
sanges@biogem.it
sanges@iigb.na.cnr.it
__________________________________