我正在使用 BioPerl 模块从一组参数中获取一个字符串。我遵循了HOWTO:Beginners page。该模块显然返回一个哈希对象。如何从哈希对象中获取实际字符串?
use Bio::DB::GenBank;
use Data::Dumper;
my $gb = Bio::DB::GenBank->new(-format => 'Fasta',
-seq_start => 1,
-seq_stop => 251,
-strand => 1
-complexity => 1);
my $seq = $gb->get_Seq_by_acc('NG_016346');
my $sequence_string = lc($seq->seq());
my $seq_obj = Bio::Seq->new(-seq => $sequence_string,
-alphabet => 'dna' );
my $prot_obj = $seq_obj->translate;
print Dumper($prot_obj);
数据转储器打印以下内容:
$VAR1 = bless( {
'primary_seq' => bless( {
'length' => 83,
'_root_verbose' => 0,
'_nowarnonempty' => undef,
'seq' => 'RLCVKEGPWPAVEGTWSWG*HRPGSRACPRWGAPNSVQATSYTPSPTHAPFSVSPIPIC*MSLLEASCWPGSREDGARMSAGM',
'alphabet' => 'protein'
}, 'Bio::PrimarySeq' ),
'_root_verbose' => 0
}, 'Bio::Seq' );
如何获得存储在 'seq' 中的“seq” $prot_obj
?
我试过
print $prot_obj{'primary_seq'}{'seq'};
但它不打印任何东西。数据转储器打印了这个词bless
。Maybeseq
是一个面向对象变量的字段。