Hi everyone,
I have wrote a perl script to retrieve Go annotations (Molecular Function especially with go id). To retrieve go annotation i use a chunck from R that can do this in few lines, and use Perl to format the output. But it's not working.
I have got this error:
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.
This is my code :
#! 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;
Any solution to reach my purpose using Perl script, R script or merging both should be useful.
The output file format is like :
P10214
GO:xxxxxxx "aaaaaaaaaaaaaaaaaaaaa"
GO:zzzzzzzz "bbbbbbbbbbbbbbbbbbbbb"
...................
Q34F56
GO:fffffffffff "ccccccccccccccccccccccc"
GO:gggggg "hhhhhhhhhhhhhhhhhhhh"
...................
Thanks you so much
Not using strict is not recommended for beginners as this leads to more issues and make these more difficult to track. The OP should just read the error messages in full. They give helpful hints.