为什么perl程序运行后没结果输出但又没出现错误提示
#!/usr/bin/perl-wusestrict;my@gene_number=("ref|NP_001036834.1|aminopeptidaseN[Bombyx...
#!/usr/bin/perl -w
use strict;
my @gene_number = ("ref|NP_001036834.1| aminopeptidase N [Bombyx mori]","ref|NP_001037013.1| aminopeptidase N [Bombyx mori]","ref|NP_001104835.1| aminopeptidase N3 [Bombyx mori]","ref|NP_001108470.1| leucyl aminopeptidase-like protein [Bombyx mori]","ref|NP_001040416.1| leukotriene A4 hydrolase [Bombyx mori]",);
my $i;
my $n = @gene_number;
my $infile1 = "result_ami.txt";
my $infile2 = "aminopeptidasetxid.txt";
open (IN, "$infile1") || die " can not open $infile1";
open (INP, "$infile2") || die " can not open $infile2";
open (OUT, ">lastami.txt") || die " can not open lastami.txt";
my @line=<INP>;
my $c = @line;
my $j;
my @seq_data = <IN>;
my $len = @seq_data;
my $b;
for ($i = 0 ; $i <= $n-1; $i++)
{ chomp ($gene_number[$i]);
print OUT"\n>$gene_number[$i]\n";
for ($j = 0 ; $j <= $c-1; $j++)
{ chomp ($line[$j]);
if ($line[$j] =~/$gene_number[$i]/)
{print OUT"$line[$j+1]";}
}
for ($b = 0 ; $b <= $len-1; $b++)
{chomp ($seq_data[$b]);
if ($seq_data[$b] eq $gene_number[$i])
{print OUT ">$seq_data[$b-1]\n";
print OUT "$seq_data[$b+1]\n";
}
}
}
close IN;
close INP;
close OUT;
很感谢各位的回答!
我都按你们说的改过了但运行时还是出现一样的错误提示:Unrecognized character \xA3 at d:\2.pl line5.(line5是my @gene_number =……这行),究竟是什么原因呢? 展开
use strict;
my @gene_number = ("ref|NP_001036834.1| aminopeptidase N [Bombyx mori]","ref|NP_001037013.1| aminopeptidase N [Bombyx mori]","ref|NP_001104835.1| aminopeptidase N3 [Bombyx mori]","ref|NP_001108470.1| leucyl aminopeptidase-like protein [Bombyx mori]","ref|NP_001040416.1| leukotriene A4 hydrolase [Bombyx mori]",);
my $i;
my $n = @gene_number;
my $infile1 = "result_ami.txt";
my $infile2 = "aminopeptidasetxid.txt";
open (IN, "$infile1") || die " can not open $infile1";
open (INP, "$infile2") || die " can not open $infile2";
open (OUT, ">lastami.txt") || die " can not open lastami.txt";
my @line=<INP>;
my $c = @line;
my $j;
my @seq_data = <IN>;
my $len = @seq_data;
my $b;
for ($i = 0 ; $i <= $n-1; $i++)
{ chomp ($gene_number[$i]);
print OUT"\n>$gene_number[$i]\n";
for ($j = 0 ; $j <= $c-1; $j++)
{ chomp ($line[$j]);
if ($line[$j] =~/$gene_number[$i]/)
{print OUT"$line[$j+1]";}
}
for ($b = 0 ; $b <= $len-1; $b++)
{chomp ($seq_data[$b]);
if ($seq_data[$b] eq $gene_number[$i])
{print OUT ">$seq_data[$b-1]\n";
print OUT "$seq_data[$b+1]\n";
}
}
}
close IN;
close INP;
close OUT;
很感谢各位的回答!
我都按你们说的改过了但运行时还是出现一样的错误提示:Unrecognized character \xA3 at d:\2.pl line5.(line5是my @gene_number =……这行),究竟是什么原因呢? 展开
5个回答
展开全部
第五行赋值里面的所有"改成',看你编码应该有C基础的,自己想想就明白了.另外
for ($i = 0 ; $i <= $n-1; $i++)
{ chomp ($gene_number[$i]);
建议使用foreach结构,$gene_number[$i]是C的风格,perl应该写为$_,或者直接print OUT chomp;
for ($i = 0 ; $i <= $n-1; $i++)
{ chomp ($gene_number[$i]);
建议使用foreach结构,$gene_number[$i]是C的风格,perl应该写为$_,或者直接print OUT chomp;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
处理序列的数据啊? 这段代码你要用来干嘛的阿?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不都写到文件里了吗。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询