Using Perl script including R script to retrive Go annotations for list of accesion number -
i have wrote perl script retrieve go annotations (molecular function go id). retrieve go annotation use chunck r can in few lines, , use perl format output. it's not working.
i have got error:
global symbol "$lines" requires explicit package name (did forget declare "my $lines"?) @ go_perl_r line 21. global symbol "$lines" requires explicit package name (did forget declare "my $lines"?) @ go_perl_r line 22. global symbol "$hits" requires explicit package name (did forget declare "my $hits"?) @ go_perl_r line 22. global symbol "$go" requires explicit package name (did forget declare "my $go"?) @ go_perl_r line 24. global symbol "@mf" requires explicit package name (did forget declare "my @mf"?) @ go_perl_r line 24. global symbol "$id" requires explicit package name (did forget declare "my $id"?) @ go_perl_r line 24. global symbol "$lines" requires explicit package name (did forget declare "my $lines"?) @ go_perl_r line 25. global symbol "$go" requires explicit package name (did forget declare "my $go"?) @ go_perl_r line 25. global symbol "@mf" requires explicit package name (did forget declare "my @mf"?) @ go_perl_r line 25. global symbol "@id" requires explicit package name (did forget declare "my @id"?) @ go_perl_r line 25. global symbol "$go" requires explicit package name (did forget declare "my $go"?) @ go_perl_r line 25. global symbol "@mf" requires explicit package name (did forget declare "my @mf"?) @ go_perl_r line 25. global symbol "@term" requires explicit package name (did forget declare "my @term"?) @ go_perl_r line 25. execution of go_perl_r aborted due compilation errors.
this code :
#! usr/bin/perl use warnings; use strict; use statistics::r; $r = statistics::r->new(); $i = 1; # open 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 reach purpose using perl script, r script or merging both should useful.
the output file format :
p10214 go:xxxxxxx "aaaaaaaaaaaaaaaaaaaaa" go:zzzzzzzz "bbbbbbbbbbbbbbbbbbbbb" ................... q34f56 go:fffffffffff "ccccccccccccccccccccccc" go:gggggg "hhhhhhhhhhhhhhhhhhhh" ...................
thanks much.
in double quoted strings, perl interpolates variables. qq`...`
double-quoted string, $lines
interpreted perl variable, hasn't been declared my
anywhere, hence error.
btw,
while (my @lines=<acc>) { chomp($_); }
is wrong. iterates once, <>
used in list context returns lines of filehandle. inside loop, $_
chomped, $_
hasn't been populated there. instead, maybe wanted
chomp( @lines = <acc> );
Comments
Post a Comment