[Bioperl-l] Errors with Bio::Seq objects

De-Jian Zhao dejian.zhao at gmail.com
Thu Jul 12 01:04:54 EDT 2012


Thank you, Peng. That's great! Actually I am wondering how to get the 
whole content of an object these days; "Dumping it" is a good solution.

On 2012-7-12 2:03, Peng Zhou wrote:
> Hi,
>
> I guess that's what the commands are supposed to do: the get_SeqFeatures()
> method return an array of Bio::SeqFeature objects, and the translate()
> method returns a Bio::Seq object. And you can't simply "print" an object in
> perl - you can "dump" it though:
>
> $ perl -e ' use Bio::SeqIO; use Data::Dumper; my
> $seqio=Bio::SeqIO->new(-file=>shift);
> print Dumper($seqio->next_seq()->get_SeqFeatures()); ' nt.gb
>
> $ perl -e ' use Bio::SeqIO; use Data::Dumper; my
> $seqio=Bio::SeqIO->new(-file=>shift);
> print Dumper($seqio->next_seq()->translate()); ' nt.gb
>
> On Wednesday, July 11, 2012 12:31:37 PM UTC-5, De-Jian Zhao wrote:
>> Hi,
>>
>> I downloaded a nucleotide sequence from Genbank (file name: nt.gb) and
>> tested the Bio::SeqIO module as follows. The first 3 commands succeeded;
>> however the last 2 failed.
>>
>> I think $seqio->next_seq() produces a Bio::Seq object which contains the
>> sequence, features and annotation (according to the DESCRIPTION of
>> "perldoc Bio::Seq") and thus the invocation of the methods
>> get_SeqFeatures() and translate() should be valid. However, the results
>> denied this idea.
>>
>> Will anyone explain what happened to the last 2 commands? I have
>> encountered numerous cases of failures when testing the bioperl methods.
>> I want to translate the mRNA sequence and extract the sequence features.
>> What are the right commands? Thanks a lot!
>>
>> Best,
>> Dejian
>>
>>
>>
>> PS: The commands and results
>>
>> $ perl -e ' use Bio::SeqIO; my $seqio=Bio::SeqIO->new(-file=>shift);
>> print $seqio->next_seq()->display_id(); ' nt.gb
>> NM_053056
>>
>> $ perl -e ' use Bio::SeqIO; my $seqio=Bio::SeqIO->new(-file=>shift);
>> print $seqio->next_seq()->molecule(); ' nt.gb
>> mRNA
>>
>> $ perl -e ' use Bio::SeqIO; my $seqio=Bio::SeqIO->new(-file=>shift);
>> print $seqio->next_seq()->subseq(1,6); ' nt.gb
>> CACACG
>>
>> $ perl -e ' use Bio::SeqIO; my $seqio=Bio::SeqIO->new(-file=>shift);
>> print $seqio->next_seq()->get_SeqFeatures(); ' nt.gb
>> Bio::SeqFeature::Generic=HASH(0x20a30898)Bio::SeqFeature::Generic=HASH(0x20a30bb0)Bio::SeqFeature::Generic=HASH(0x20a30cd0)Bio::SeqFeature::Generic=HASH(0x20a317b0)Bio::SeqFeature::Generic=HASH(0x20a31720)Bio::SeqFeature::Generic=HASH(0x20a39a18)Bio::SeqFeature::Generic=HASH(0x20a317e0)Bio::SeqFeature::Generic=HASH(0x20a398b0)Bio::SeqFeature::Generic=HASH(0x20a39838)Bio::SeqFeature::Generic=HASH(0x20a39e98)Bio::SeqFeature::Generic=HASH(0x20a3b898)Bio::SeqFeature::Generic=HASH(0x20a3a120)Bio::SeqFeature::Generic=HASH(0x20a3bda8)Bio::SeqFeature::Generic=HASH(0x20a3c030)Bio::SeqFeature::Generic=HASH(0x20a3c2b8)Bio::SeqFeature::Generic=HASH(0x20a3be20)Bio::SeqFeature::Generic=HASH(0x20a3c0a8)Bio::SeqFeature::Generic=HASH(0x20a3bb98)Bio::SeqFeature::Generic=HASH(0x20a3c300)Bio::SeqFeature::Generic=HASH(0x20a3c588)Bio::SeqFeature::Generic=HASH(0x20a3d838)Bio::SeqFeature::Generic=HASH(0x20a3dfb8)Bio::SeqFeature::Generic=HASH(0x20a3dd18)
>>
>>
>> $ perl -e ' use Bio::SeqIO; my $seqio=Bio::SeqIO->new(-file=>shift);
>> print $seqio->next_seq()->translate(); ' nt.gb
>> Bio::Seq::RichSeq=HASH(0x20a3e7b0)
>>





More information about the Bioperl-l mailing list