0

这段代码工作正常,但现在它抱怨,genbank 结构改变了吗?

#!/usr/bin/perl -w                                                                                                                                                                 
#use strinct ;                                                                                                                                                                     

use Bio::SeqIO;
use Bio::Seq;
use Bio::DB::EUtilities;


    @refSeqIDs=qw(NC_000915.1 NC_017379.1 NC_017371.1 NC_017354.1);
    foreach my $refSeqIDs (@refSeqIDs){
        my $factory = Bio::DB::EUtilities->new(-eutil   => 'efetch',-db=> 'protein',-  rettype => 'gb',
                                           -email   => 'x@y.com',-id=> $refSeqIDs);
        my $rawfile = "$refSeqIDs.gbk";
        $factory->get_Response(-file =>"$refSeqIDs.gbk");
        my $seqio_object = Bio::SeqIO->new(-format=>"Genbank",-file =>"$refSeqIDs.gbk");
        while ( my $seq_object=$seqio_object->next_seq){
            $sequence=$seq_object->seq;
            print ("$sequence\n");
        }
    }
4

1 回答 1

0

您的$sequence变量为空,因为这些 genbank 记录中没有序列。如果您只想下载这些 ID 的完整基因组序列,只需指定您需要 fasta 而不是 genbank 记录。

#!/usr/bin/env perl

use strict;
use warnings;
use Bio::DB::EUtilities;


my @refSeqIDs = qw(NC_000915.1 NC_017379.1 NC_017371.1 NC_017354.1);

my $factory = Bio::DB::EUtilities->new(-eutil   => 'efetch', 
                                       -db      => 'nucleotide', 
                                       -rettype => 'fasta',
                                       -email   => 'x@y.com',
                                       -id      => \@refSeqIDs);

print $factory->get_Response->content;

如果您想要不同的东西,请说明您要获取的内容。此外,最好始终将use strict;use warnings;放在脚本的顶部以诊断这些类型的消息。

于 2013-06-27T17:26:47.823 回答