[Bioperl-l] New Bioperl dependency? Sort::Naturally

Chris Fields cjfields at illinois.edu
Sat May 8 20:33:36 UTC 2010


I don't have a problem with this personally, seeing how complex the code can get for natural sorting.  It would become a recommended module, though, not a full dependency.

chris

On May 7, 2010, at 11:42 PM, Florent Angly wrote:

> Hi all,
> 
> I am working on updating some of the Bio::Assembly::* modules right now.
> I need to sort a list of IDs. These IDs could be numbers, "words" or a mix of the two, for example:         @arr = ('singlet1', 'contig10', 'contig2',  '101', '3');
> 
> I cannot sort them with the numerical sort: sort { $a <=> $b } @array
> This would generates warnings because some of'singlet1' the IDs are numbers.
> 
> I cannot sort them lexically: sort @array
> Lexical sorting would not take into account numbers properly and result in:
>    singlet1 contig10 contig2 3 101
> 
> So, what I really need is natural sorting, which is not in any core function of Perl. I'd like to use the CPAN module Sort::Naturally for this purpose: nsort @arr
> The results would be what we expect, i.e.:
>    3 101 contig2 contig10 singlet1
> 
> Can I add this module as an additional dependency of BioPerl? I imagine that some other modules might want to use this. On the assembly side, it would be used by the writing methods of Bio::Assembly::IO::tigr and ace. Or maybe there is an easy way around my problem that doesn't require any external module?
> 
> Florent
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list