in reply to Re: taking a subset of HoHoA, retaining relative structure?
in thread taking a subset of HoHoA, retaining relative structure?
As for the variable names, I was only using $a and $b in the example. As it stands, in my program, the keys corresponding to the RomanNumerals, and the letters, are actually created on the fly via iterations. And yes, I do use use strict
So, I think I actually figured out a way to do it myself. I haven't tried this or denugged it, but it logically seems to do what want, if inelegantly. I just use for keys... to go through each hash and sub-hash until I get to the elements, and then I compare that to each individual element with another set of for keys... calls.
Here's the crux of it, sorry if all the variable names are hard to follow, I'm just in a bit of a rush and aren't up to fixing it for logical readability right now....
Thanks all for the help so far,sub WEED { # this sets up that we will perform this for each fasta sequence in w +hatever # file. makes the rest of the sub one step simpler. FASTA: for my $fastaseq (keys %matches) { $setscounter = 0; SITE: for my $site (sort {$a <=> $b } keys %{$matches{$fastaseq}}) +{ ELEM: for my $i (@{$matches{$fastaseq}{$site}}) { $lowerlimit = $matches{$fastaseq}{$site}[$i]; $upperlimit = $span + $lowerlimit; SITEKEY: for my $sitekey (sort {$a <=> $b } keys %{$matches{$fa +staseq}}) { SET: for $setcount (@{$matches{$fastaseq}{$sitekey}}) { if ($setcount >= $lowerlimit || $_ <= $upperlimit) { push @{$sets{$fastaseq}[$setscounter]{$sitekey}}, $setcou +nt; #closes If setcount } next SET; #closes For setcount } next SITEKEY; #closes SITEKEY } next ELEM; # closes for my i } $setscounter++; next SITE; #closes for my site } next FASTA; #closes for my fastaseq } return %sets; #closes subroutine }
|
|---|