[Bioperl-l] saving amino acids sequence to file
Dave Messina
David.Messina at sbc.su.se
Tue Oct 4 10:12:51 UTC 2011
[Sent this yesterday just to Roey by accident; reposting to the list now.]
Hi Roey,
>From the feature table, I think you can only get the amino acid sequence as
a string. If you'd like to be able to use the SeqIO methods on it, you'll
need to create a Bio::Seq object from it first. For examples, look at the
'To and From a String' section of the SeqIO HOWTO:
http://www.bioperl.org/wiki/HOWTO:SeqIO
But if you just want Fasta, plain ol' print statements are often sufficient.
Dave
On Mon, Oct 3, 2011 at 19:27, roey.angel <angel at mpi-marburg.mpg.de> wrote:
> Hi,
>
>> I'm trying to save the amino acid sequence from a sequence object I
>
>> retrieved from GenBank.
>
>> I can easily save the nucleotide sequence with:
>
>>
> my $out_nuc = Bio::SeqIO->new(-format => 'fasta', -file => '>out.nuc');
>
>> $out_nuc -> write_seq($seq_object);
>
>>
> And I also managed to extract the amino acid sequence with:
>
>>
> for my $feat_object ($seq_object->get_SeqFeatures) { # obtain
>
>> features from seq object
>
>> if ($feat_object->primary_tag eq "CDS") { # look for CDS
>
>> features
>
>> if ($feat_object->has_tag('translation')) { # look for
>
>> amino acids
>
>> for my $val
>
>> ($feat_object->get_tag_values('translation')){
>
>> }
>
>> }
>
>> }
>
>> }
>
>>
> But is there a way to save that sequence into a file using write_seq or a
>
>> similar method?
>
>>
> Thanks in advance,
>
>> Roey
> --
> View this message in context:
> http://old.nabble.com/saving-amino-acids-sequence-to-file-tp32583843p32583843.html
> Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
More information about the Bioperl-l
mailing list