大神,看到您解决了很多perl难题,我这边也被难住了,脑壳快折腾
perl吧
全部回复
仅看楼主
level 1
大神,看到您解决了很多perl难题,我这边也被难住了,脑壳快折腾坏了,大神帮个忙吧
perl代码:
use strict;
use warnings;
my %hash=();
open(RF,"ann.txt") or die $!;
while(my $line=<RF>)
{
chomp($line);
my @arr=split(/\t/,$line);
$hash{$arr[0]}=$arr[1];
}
close(RF);
open(RF,"input.txt") or die $!;
open(WF,">out.txt") or die $!;
while(my $line=<RF>){
chomp($line);
if($.==1){
print WF "$line\tSymbol\n";
}
my @arr=split(/\t/,$line);
if(exists $hash{$arr[0]}){
print WF "$line\t$hash{$arr[0]}\n";
}
elsif(exists $hash{$arr[11]}){
print WF "$line\t$hash{$arr[11]}\n";
}
elsif(exists $hash{$arr[13]}){
print WF "$line\t$hash{$arr[13]}\n";
}
else{
}
}
close(WF);
close(WF);
运行后报错:C:\Users\girlc\Desktop\premature ovarian failure\Human Growth Hormone>perl addSymbol.pl
Use of uninitialized value $arr[11] in exists at addSymbol.pl line 28, <RF> line 2.
Use of uninitialized value $arr[13] in exists at addSymbol.pl line 31, <RF> line 2.
等等,后面还有很多行,请大神赐教,
2021年06月07日 09点06分 1
level 1
你好,看到你的帖子,我也遇到同样的问题,相似的脚本,请问你的解决了吗
2022年02月10日 06点02分 2
level 2
ann应该是转换探针吧
2022年02月17日 17点02分 3
1