in reply to Re: Re: Selecting a random number, and back calculating to chromosome and contig!
in thread Selecting a random number, and back calculating to chromosome and contig!
Another idea that you may look into as you learn more is by representing your data and operations on this data in the form of objects. For a reference, check out this short example on OO programming in Perl.
As you develop your code more and more, you may want to begin abstracting your useful code into subroutines. Here's an example that relies on thor's hash-based data structure shown above:
By modularizing your code every way, you avoid having to change the methodology of changing your code in many places every time you'd like to modify your program.sub print_contig_information { my $number = shift; foreach my $key (sort { $a <=> $b } keys %master) { if ($number < $key) { my $chromosome = $master{$key}{chromosome}; my $contig = $master{$key}{contig}; #do whatever processing here; I'll just print print "chromosome = $chromosome, contig = $contig\n"; } } }
Hope that this helps. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Selecting a random number, and back calculating to chromosome and contig!
by Sameet (Beadle) on May 04, 2004 at 05:57 UTC | |
by tedrek (Pilgrim) on May 05, 2004 at 19:12 UTC | |
by Sameet (Beadle) on May 06, 2004 at 07:06 UTC |