Here's just something that came to mind. Instead of using your massive if structure in
ParseAChroms, you could try doing something a lot simpler, such as declaring
what you're looking for in a sort of table:
my %acrhom_prefix = (
BAC => '(.*)\s*',
LENGTH => '(.*)\s*',
OSME => '(.*)\s*',
CHR_START => '(.*)\s*',
BAC_START => '(.*)\s*',
BAC_END => '(.*)\s*',
ORIENTATION => '(\w)\w*\s*',
);
Now, instead of using an "array" of variables, use a hash. This simplifies things massively:
sub ParseAChroms
{
my ($achromref) = @_;
my (%value);
foreach (@$achromref)
{
my ($prefix, $data) = /^(\S+):\s+(.*)/;
if (my $pattern = $achrom_prefix{$prefix})
{
($value{lc $prefix}) = $data =~ /^$pattern$/;
}
}
return @data{qw[ type ac_id length
chr_num chr_start chr_end
bac_start bac_end orient]};
}
Now, I've just typed this into the editor here, so this is really just theory and not tested, but the idea is that this can be applied to a few other areas where you do the same thing.
Further, instead of passing arguments back and forth in a particular
fixed order, why not return a HASH-ref? This makes it easy to add new data to the return value without breaking other functions which use it.