Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.

by roarce92 (Acolyte)
on Apr 17, 2020 at 14:41 UTC ( #11115688=perlquestion: print w/replies, xml ) Need Help??

roarce92 has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone! I'm trying to run a command in perl and I recive the same error all time. The files I use were generated by the same module I am receiving the error. My command is

use Seeder::Finder; my $finder = Seeder::Finder->new( seed_width => "6", strand => "revcom", motif_width => "12", n_motif => "10", hd_index_file => "6.index", seq_file => "Potato_FldvsWTinC_INDUCED_gene_list_promoters.fa +a", bkgd_file => "Potato_genome_promoters.bkgd", out_file => "Potato_FldvsWTinC_INDUCED_gene_list_promoters.fa +a", ); $finder->find_motifs;

And the output is:

Use of uninitialized value in subroutine entry at /home/roarce/perl5/p +erlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line +476, <IN> line 8192. Use of uninitialized value in subroutine entry at /home/roarce/perl5/p +erlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line +476, <IN> line 8192. Use of uninitialized value in subroutine entry at /home/roarce/perl5/p +erlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line +476, <IN> line 8192.

A lot of times and finally:

Can't use an undefined value as an ARRAY reference at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 611, <IN> line 8192.

I installed perl yesterday, I checked the module and it is ok. The files too. I don't know what else to change in this command, could you help me? Thank you in advance!

  • Comment on Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.
  • Select or Download Code

Replies are listed 'Best First'.
Re: Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.
by davido (Cardinal) on Apr 17, 2020 at 14:58 UTC

    It feels like your input data is corrupt, or not in the format expected by this module. And it's possible the format error is around line 8192 of the input file.


    Dave

      Thanks Dave. The problem is the input file has only 7000 lines.

      Could it be that filehandle IN is related to an intermediate file created by the program? Given that the other bug mentioned is also about the same line.

      A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Use of uninitialized value in subroutine entry (Seeder::Finder)
by hippo (Chancellor) on Apr 17, 2020 at 15:43 UTC

    That looks very much like this bug, doesn't it?

      Hi hippo! Yes, I'm trying to do the same analysis. How could I see the answers?

        There are no answers to that bug.

Re: Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.
by haj (Curate) on Apr 17, 2020 at 15:24 UTC
    It seems that your out_file parameter is the same as your seq_file - so perhaps you're overwriting your input file while it is still processed. Try with a different output file.

      Thanks haj. I changed the output name and the error keeps showing up :(

Re: Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.
by bliako (Prior) on Apr 18, 2020 at 16:10 UTC

    Looking at the source, the message "<IN> line 8192." is irrelevant if not misleading because IN was never closed as it should. In sub _read_bkgd(). So, all subsequent warns report it and rightly so as it is still open, alas they are irrelevant.

    Line 476 of the source file is:

    sub _get_seed { my $self = shift; my $n_bkgd_seq = List::Util::sum( @{ $self->{bkgd_ref}->[0] } ); my @hd_sum; for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) { $hd_sum[$oligo_indice] = List::Util::sum( @{ $self->{hd_matrix_ref}->[$oligo_indice +] } ); # 476 }

    Which suggests that there is something wrong with $self->{hd_matrix_ref}->[$oligo_indice]. Either $self->{hd_matrix_ref} is not an arrayref or if it is, the index $oligo_indice exceeds its size, or $self->{hd_matrix_ref}->[$oligo_indice] is not an arrayref. The construction of $self->{hd_matrix_ref} is done in line 325 (sub _build_hd_matrix).

    From a glance at line 325, I think the first and second hypotheses can be ruled out because the index spans the exact same range as in line 476, that is:

    for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) {

    That is, the array has correct dimensions but may contain "holes" or has undef in its 2D span. (Edit: by "holes" i mean array elements which were never set to a value, as opposed to the "undef" which means array elemets were set to an undef value which was the result of a calculation/transformation which went wrong, and was not detected, or just bad input).

    If you want to debug this, then perhaps you can add a couple of debug prints to see what's going on with that array. I would start just before line 387 (before return), with this (untested):

    for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) { print "index: $oligo_indice ("; for my $count_indice ( 0 .. $#{ $self->{count_matrix_ref} } ) { if( ! defined $hd_matrix[$oligo_indice][$count_indice] ){ die "prob +lem at [$oligo_indice][$count_indice]" } print $hd_matrix[$oligo_indice][$count_indice]."," } print "\n"; }

    bw, bliako

      Thanks so much Bliako!

      Hi Bliako, sorry for the delay of time. I tried your suggestion and it did not work. Could you help me with other solution to that? I'd appreciate so much. Rocío

        Hi Rocio, start by inserting the above print statements I suggested to the relevant Perl file and report the output. Only you can sort this out because you have the data files and you can run them to see what the debugging messages report. One of those debugging messages will cause the program to exit if there are undefined values. So watch out for that too. See also if you can run it successfully with some datafiles and if yes, what's the difference between failed and successful data files. If you could also reduce the data files to the absolute minimum it would make debugging easier. Anyway, start by inserting those debug messages, run it and let us know.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11115688]
Approved by stevieb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2021-05-09 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (100 votes). Check out past polls.

    Notices?