使用Perl脚本(包括R脚本)检索访问编号列表的Go注释
我已经编写了一个Perl脚本来检索Go注释(分子函数,特别是带有Go id的函数)。为了检索go注释,我使用了一个来自R的chunck,它可以在几行中完成这项工作,并使用Perl格式化输出。但它不起作用 我有一个错误:使用Perl脚本(包括R脚本)检索访问编号列表的Go注释,r,perl,R,Perl,我已经编写了一个Perl脚本来检索Go注释(分子函数,特别是带有Go id的函数)。为了检索go注释,我使用了一个来自R的chunck,它可以在几行中完成这项工作,并使用Perl格式化输出。但它不起作用 我有一个错误: Global symbol "$lines" requires explicit package name (did you forget to declare "my $lines"?) at GO_Perl_R line 21. Global symbol "$lines"
Global symbol "$lines" requires explicit package name (did you forget to declare "my $lines"?) at GO_Perl_R line 21. Global symbol "$lines" requires explicit package name (did you forget to declare "my $lines"?) at GO_Perl_R line 22. Global symbol "$hits" requires explicit package name (did you forget to declare "my $hits"?) at GO_Perl_R line 22. Global symbol "$go" requires explicit package name (did you forget to declare "my $go"?) at GO_Perl_R line 24. Global symbol "@MF" requires explicit package name (did you forget to declare "my @MF"?) at GO_Perl_R line 24. Global symbol "$id" requires explicit package name (did you forget to declare "my $id"?) at GO_Perl_R line
24. Global symbol "$lines" requires explicit package name (did you forget to declare "my $lines"?) at GO_Perl_R line 25. Global symbol "$go" requires explicit package name (did you forget to declare "my $go"?) at GO_Perl_R line 25. Global symbol "@MF" requires explicit package name (did you forget to declare "my @MF"?) at GO_Perl_R line
25. Global symbol "@id" requires explicit package name (did you forget to declare "my @id"?) at GO_Perl_R line 25. Global symbol "$go" requires explicit package name (did you forget to declare "my $go"?) at GO_Perl_R line 25. Global symbol "@MF" requires explicit package name (did you forget to declare "my @MF"?) at GO_Perl_R line 25. Global symbol "@term" requires explicit package name (did you forget to declare "my @term"?) at GO_Perl_R line 25. Execution of GO_Perl_R aborted due to compilation errors.
这是我的代码:
#! usr/bin/perl
use warnings;
use strict;
use Statistics::R;
my $R = Statistics::R->new();
my $i = 1;
# open the file containing uniprot accession numbers
open (ACC, "acc_numbers.txt") or die "Can't open acc_numbers.txt: $!\n";
while (my @lines=<ACC>) {
chomp($_);
}
$R -> startR;
$R -> send('library(mygene);');
$R -> run (q`sink('GO_MF.txt')`);
$R -> run (q`sink()`);
$R -> run (
qq`while($lines){
res<-query($lines,fields='go')$hits,
sink('GO_MF.txt', append=TRUE),
while($i <= length(res$go$MF[[1]]$id) {
print(paste($lines,"\n",res$go$MF[[1]]$id[$i],"\t",res$go$MF[[1]]$term[$i],"\n"),
sink(),
}
}`
);
exit 0;
非常感谢。在双引号字符串中,Perl插入变量
qq```
是一个双引号字符串,因此$lines
被解释为一个Perl变量,但它没有在任何地方用my
声明,因此出现了错误
顺便说一句
P10214
GO:xxxxxxx "aaaaaaaaaaaaaaaaaaaaa"
GO:zzzzzzzz "bbbbbbbbbbbbbbbbbbbbb"
...................
Q34F56
GO:fffffffffff "ccccccccccccccccccccccc"
GO:gggggg "hhhhhhhhhhhhhhhhhhhh"
...................
while (my @lines=<ACC>) {
chomp($_);
}
chomp( my @lines = <ACC> );