TFBS::_Iterator

_SiteSetIterator

Included libraries Package variables General documentation Methods

Package variables top
No package variables defined.
Included modulestop
Carp
TFBS::_Iterator
strict
Inherit top
TFBS::_Iterator
Synopsistop
No synopsis!
Descriptiontop
No description!
Methodstop
_sortNo descriptionCode

Methods description


Methods code

_sortdescriptiontopprevnext
sub _sort {
    my ($self, $sort_by) = @_;
    $sort_by or $sort_by = $self->{_sort_by} or  $sort_by = 'name';

    ## we can sort by name, start, end, score
my %sort_fn = (start => sub { $a->start() <=> $b->start() || $a->pattern() cmp $b->pattern() || $a->strand() <=> $b->strand() }, end => sub { $a->end() <=> $b->end() || $a->pattern() cmp $b->pattern() || $a->strand() <=> $b->strand() }, ID => sub { $a->pattern() cmp $b->pattern() || $a->start() <=> $b->start() || $a->end() <=> $b->end() || $a->strand() <=> $b->strand() }, name => sub { $a->pattern() cmp $b->pattern() || $a->start() <=> $b->start() || $a->end() <=> $b->end() || $a->strand() <=> $b->strand() }, score => sub { $b->score() <=> $a->score() || $a->pattern() cmp $b->pattern() || $a->strand() <=> $b->strand() } ); if (defined (my $sort_function = $sort_fn{lc $sort_by})) { $self->{'_iterator_array_ref'} = [ sort $sort_function @{$self->{'_orig_array_ref'}} ]; } else { $self->throw("Cannot sort ".ref($self)." object by '$sort_by'."); }
}

General documentation

No general documentation available.