in reply to Re: Help with function, count matches and store in hash & retrieve sorted
in thread Help with function, count matches and store in hash & retrieve sorted

hello all and thanks for the help,so far. I have made sure that a query sequence is being provided. By running the debug statement suggested above I have found that I have undef max values. How can I get around this? Thank you very much everyone!

$VAR1 = [ { 'bar' => 'TATCCTCT', 'max' => undef }, { 'bar' => 'CTCTCTAT', 'max' => undef }, { 'bar' => 'AGCGTAGC', 'max' => undef }, { 'bar' => 'AGAGTAGA', 'max' => undef }, { 'max' => undef, 'bar' => 'CTAAGCCT' }, { 'bar' => 'CATGCCTA', 'max' => undef }, { 'bar' => 'TTCTGCCT', 'max' => undef }, { 'max' => undef, 'bar' => 'GCTCAGGA' }, { 'max' => undef, 'bar' => 'TCGCCTTA' }, { 'max' => undef, 'bar' => 'CCTCTCTG' }, { 'bar' => 'TAGATCGC', 'max' => undef }, { 'max' => undef, 'bar' => 'ACTGCATA' }, { 'bar' => 'GCGTAAGA', 'max' => undef }, { 'bar' => 'CTAGTACG', 'max' => undef }, { 'bar' => 'AAGGAGTA', 'max' => undef }, { 'max' => undef, 'bar' => 'GTAGAGAG' } ]; DEBUG: [TATCCTCT]=>[11] DEBUG: [CTCTCTAT]=>[10] DEBUG: [AGCGTAGC]=>[5] DEBUG: [AGAGTAGA]=>[12] DEBUG: [CTAAGCCT]=>[16] DEBUG: [CATGCCTA]=>[6] DEBUG: [TTCTGCCT]=>[3] DEBUG: [GCTCAGGA]=>[4] DEBUG: [TCGCCTTA]=>[1] DEBUG: [CCTCTCTG]=>[8] DEBUG: [TAGATCGC]=>[9] DEBUG: [ACTGCATA]=>[14] DEBUG: [GCGTAAGA]=>[13] DEBUG: [CTAGTACG]=>[2] DEBUG: [AAGGAGTA]=>[15] DEBUG: [GTAGAGAG]=>[7]
  • Comment on Re^2: Help with function, count matches and store in hash & retrieve sorted
  • Download Code

Replies are listed 'Best First'.
Re^3: Help with function, count matches and store in hash & retrieve sorted
by Marshall (Canon) on Jul 03, 2017 at 00:50 UTC
    I updated my post Re: Help with function, count matches and store in hash & retrieve sorted, is that helpful to you?

    Well, after looking yet again, I am still not sure. Can you give use the exact inputs that you are using so that we can run and exactly replicate your error with your data?

    I am a bit puzzled about how you can get an undef value for $max_count? Which is assigned to the key "max". Of course:

    my $element; $element->{bar} = $key; $element->{max} = $max_count; $element->{max} //= 0; #### adding this prevents undef push @match_count, $element;
    I guess I have the Sunday brain cramp.