Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
So, if I understand correctly, you want your results to look something like:
$data{"HG00553"}[162][16287215] = "0 0" $data{"HG00553"}[162][16287226] = "0 0" ... $data{"HG00638"}[162][16287851] = "1 1" ...
First, I'd suggest you do a little debug work to understand what your code is doing. Specifically:
while (<$in_file>) { print "$_"; chomp; my @snp_bins; if (/^SAMPLE/) { my ( $placeholder, @coords ) = split /,/; foreach my $coord (@coords) { push @snp_bins, int( $coord / 100_000 ); } } else { my ( $id, @snps ) = split /,/; push @individuals, $id; foreach my $individual (@individuals) { print "working on $individual\n"; foreach my $snp (@snps) { my $snp_bin = shift @snp_bins; print "snp_bin $snp_bin\n"; $data{$individual}[ [ $snp_bin ] ] = $snp; } } print "snp_bins: @snp_bins\n"; } }
I think that you'll find some things which you didn't expect. Also, I think that you might be better off using HoHoH instead. I believe that doing:
$data{$individual}[162] = "something"
will result in:
$data{$individual}[0..162]
even though you are only concerned with the former. So it would probably be better to:
$data{$individual}{162}{16287215} = "0 0"

In reply to Re: Population of HoAoA based on file contents by state-o-dis-array
in thread Population of HoAoA based on file contents by iangibson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-20 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found