我正在尝试编写一个脚本,根据先前生成的文件搜索 BLAST 输出,该文件给出每个 GI 编号的基因组位置。但是,我收到三个与关闭 IF 语句相关的语法错误。作为 Perl 的新手,我不知道如何解决这个问题。谁能帮我?我已经复制了代码并标记了有问题的右括号。我确实做了一个快速检查以确保所有分隔符都是平衡的。
#!/usr/bin/perl -w
#decided to have input file entered in command line
#call program followed by genome name.
#the program assumes that a file with the extensions ptt and faa exist in the same dirctory.
#####INPUT Name of multiple seq file containing ORF of genome, open file and assign IN filehandle #############
unless(@ARGV==2) {die "usage: perl nucnums.pl BLAST_output_filename query.ref subject.ref\n\nSubject is the database you made with FormatDB or MakeBlastDB.\n\nQuery is the other file";}
$blastname=$ARGV[0];
$queryname=$ARGV[1];
$subjectname=$ARGV[2];
@nameparts=split(/\./, $blastname);
$ofilename="$blastname[0]"."pos";
open(INBLAST, "< $blastname") or die "cannot open $blastname:$!";
open(OUT, "> $ofilename") or die "cannot open $ofilename:$!";
$line=<INBLAST>;
print OUT $line;
while (defined ($line=<INBLAST>)){ # read through rest of table line by line
if ($line=/^g/){
@parts=split/\t/,$line;
@girefq=split/\|/,$parts[0];
$ginumq = ($girefq[1]);
$postartq = $parts[6];
@girefs=split/|/,$parts[1];
$ginums = ($girefs[1]);
$postarts = $parts[8];
open(INQUER, "< $queryname") or die "cannot open $queryname:$!";
open(INSUBJ, "< $subjectname") or die "cannot open $subjectname:$!";
SCOOP: while (defined ($locq=<INQUER>)){
@locsq=split/\t/,$locq
if $locsq[0] = $ginumq{
$posq = $locsq[1] + $postartq - 1;
} # <- Syntax error
}
close(INQUER);
SLOOP: while (defined ($locs=<INSUBJ>)){
@locsq=split/\t/,$locs
if $locss[0] = $ginums {
$poss = $locss[1] + $postarts - 1;
} # <- Syntax error
}
close(INSUBJ);
print "$ginumq at position $posq matches with $ginums at position $poss \n" or die "Failed to find a match, try changing the order of the REF files";
print OUT "$ginumq\t$posq\t$ginums\t$poss\t$parts[2]\t$parts[3]\t$parts[4]\t$parts[5]\t$parts[6]\t$parts[7]\t$parts[8]\t$parts[9]\t$parts[10]\t$parts[11]\t$parts[12]\n";
} # <- Syntax error
}
close(OUT);
close(INBLAST);