[Bioperl-l] Fwd: SimpleAlign bug?
Sendu Bala
bix at sendu.me.uk
Wed Apr 11 16:09:54 UTC 2007
Kevin Brown wrote:
>> but even if the idea is to sort
>> numerically this dos not work since the sort function as is
>> will put 10 before 2, so that
>> ->select_noncont(1,2,3,4,5,6,7,8,9,10) would reorder the sequences in
>> the alignment to be 1, 10, 2, 3, 4,5, 6, 7, 8,9 .
>
> Not sure why 10 would come before 2 since perl would interpret that list
> as a series of integers even if they were entered as strings and do the
> sort.
The default sort for sort() is { $a cmp $b } (standard string comparison
order): 10 comes before 2.
The fix was to explicitly say sort { $a <=> $b } for a numeric sort.
More information about the Bioperl-l
mailing list