Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: Population of HoAoA based on file contents

by state-o-dis-array (Hermit)
on May 25, 2012 at 14:35 UTC ( #972445=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Population of HoAoA based on file contents
in thread Population of HoAoA based on file contents

Hmm, based on your expectation for your data, I'm guessing what you probably need is to add:

next unless ref( $data{$id}[$window] ) eq "ARRAY";
just before the line getting the error.


Comment on Re^4: Population of HoAoA based on file contents
Download Code
Re^5: Population of HoAoA based on file contents
by iangibson (Scribe) on May 25, 2012 at 17:05 UTC

    That appears to have fixed that problem. However, now I'm getting errors from the module:

    Can't call method "isa" on unblessed reference at /usr/local/share/per +l/5.14.2/Bio/PopGen/Statistics.pm line 901, <GEN0> line 182.

    I went back and re-ran my simpler code from earlier (i.e. where I just passed a file without building windows), and I'm now getting a similar error on this too, whereas before it successfully gave me output.

    This is very strange, so I'll have to investigate further to see how to proceed.

      Hi again. I don't know if anyone can give me suggestions on this. I've been trying to work out what's going on here.

      I'm getting the following error message.. :

      Can't call method "isa" on unblessed reference at /usr/local/share/per +l/5.14.2/Bio/PopGen/Statistics.pm line 901, <GEN0> line 182.

      ..when I re-run my earlier, smaller, no-windows script. I am 99% certain that I successfully ran this script earlier, and got some statistics back.

      When I run my new, larger script with the 100kb windows, that you guys helped me with, I get a different error:

      Can't call method "isa" without a package or object reference at /usr/local/share/perl/5.14.2/Bio/PopGen/Statistics.pm line 901.

      Is this a problem with my own code, or with the module that the errors are originating from?

        I don't know if anyone is still reading this thread, but I think that the problem that's making the program crash is the undef values in the data structure

        I've written some code to attempt to replace each undef with some fake data that flags a window as undef, but what I've written doesn't seem to be modifying the output. Perhaps someone can tell me how to fix this:

        while (<$in_file>) { chomp; if (/^SAMPLE/) { my ( $placeholder, @coords ) = split /,/; foreach my $coord (@coords) { push @snp_bins, int( $coord / 100_000 ); } } else { my ( $id, @snps ) = split /,/; foreach my $snp (@snps) { # (@snps[0..$#snps-1] $snp =~ s/$snp/$snp,/ # put commas back in (preserve cs +v format) } foreach my $index ( 0 .. $#snp_bins ) { if ( $snps[$index] ) { push( @{ $data{$id}[ $snp_bins[$index] ] }, $snps[$index] +); # see note [1] } else { # replace 'undef' elements with f +lag data my @ones_array; foreach ( 1 .. 100) { push @ones_array, "1 1,"; } push( @{ $data{$id}[ $snp_bins[$index] ] }, @ones_arra +y ) } } } }

        I am assuming that the problem lies with the line

        if ( $snps[$index] )

        Is this the case, and if so how can I fix it? Help appreciated.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2014-09-03 04:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls