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

Remo Sanges sanges@biogem.it
Fri, 08 Nov 2002 12:21:47 +0100


Qiang Tu wrote:

> Oh, thanks, it works now :)
> 
> Is it a bug of Bio::SeqIO::genbank? I am not sure, but I think the sequence 
> object has the correct  alphabet, then the SeqIO should write the sequence 
> without other codes. 


I thing the code that you post

if( !$seq->can('molecule') || ! defined ($mol = $seq->molecule()) ) {
                      $mol = $seq->alphabet || 'DNA';
                      }


mandatory needs the specification of 'molecule' in your seqobj if this
is different from DNA.
However the change from protein to dna in your case is only in the LOCUS
line sequence remain in aa.
I thing this isn' t a bug but only a way to define some defaults.

Yes?

bye




> 
> best,
> 
> suhoiy
> 
> ---Original Message---
> From: Remo Sanges<sanges@biogem.it>
> Subject: Re: [Bioperl-l] write protein sequence by Bio::SeqIO
>  
> 
>>suhoiy wrote:
>>
>>
>>>No, it did not work. :( In fact, the $seq from $in has the correct alphabet 
>>>"protein", but the write_seq method will change it to "dna".
>>>
>>
>>I have try
>>you then can add a line whit the function molecule for the seq object
>>
>>my $seq = $in->next_seq;
>>
>>
>>#adding this work well    ###
>>
>>#############################
>>
>>$seq->molecule('protein');###
>>
>>#############################
>>$out->write_seq($seq);
>>
>>
>>
>>>thansk anyway. :)
>>>
>>
>>nothing
>>
>>
>>
>>>
>>>---Original Message---
>>>From: Remo Sanges<sanges@biogem.it>
>>>Subject: Re: [Bioperl-l] write protein sequence by Bio::SeqIO
>>> 
>>>
>>>
>>>>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
>>>>__________________________________
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>> 
>>>---End of Message---
>>>
>>>
>>>
>>__________________________________
>>Remo Sanges
>>
>>BioGeM
>>Gene Expression Core Lab
>>Via Pietro Castellino 111
>>80131 NaplesItaly
>>+39 081 6132303
>>sanges@biogem.it
>>sanges@iigb.na.cnr.it
>>__________________________________
>>
>>
>>
>>
> 
>  
> ---End of Message---
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
> 
>