0

次のように以前にインデックスが作成された perl のプレインデックス ファイルをリロードしたいと思います。

./first_script.pl hg19.fa

use Bio::DB::Fasta;

my $db = Bio::DB::Fasta->new($file_fasta);

...

別のスクリプトで、既存のインデックス付きファイルを再読み込みしたいと思います。

./script.pl hg19.fa.index 入力

#!/usr/bin/perl

use warnings;
use strict;

use Bio::DB::Fasta;

my $fasta_index_file = $ARGV[0];
my $input_file = $ARGV[1];

open(FH,"<$input_file");

my $db->index_file($fasta_index_file);

説明ではそれはsyas

 Title   : index_file
Usage   : $db->index_file($filename)
Function: (re)loads a sequence file and indexes sequences offsets in the file
Returns : seq offsets in the file
Args    : filename,
           boolean to force reloading a file

しかし、次のエラーが返されます。

Can't call method "index_file" on an undefined value at script.pl line

もう一度使用する場合は、2 番目のスクリプトで:

my $db = Bio::DB::Fasta->new($file_fasta);

すぐに次のステップに進みます。すでに存在を認識しているということですか?

4

1 に答える 1

1

$db2 番目のスクリプトのどこにも定義していません。

よくあることですが、これはuse strict;明らかであり、トラブルシューティングの最初のステップとなるはずです。

于 2015-04-10T12:13:51.197 に答える