/usr/lib/x86_64-linux-gnu/perl5/5.24/TFBS/_Iterator/_MatrixSetIterator.pm is in libtfbs-perl 0.7.0+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | package TFBS::_Iterator::_MatrixSetIterator;
use vars '@ISA';
use strict;
use Carp;
use TFBS::_Iterator;
@ISA = qw(TFBS::_Iterator);
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 =
(class => sub { $a->class() cmp $b->class()
||
$a->name() cmp $b->name()
||
$a->ID() cmp $b->ID()
},
id => sub { $a->ID() cmp $b->ID()
},
ID => sub { $a->ID() cmp $b->ID()
},
name => sub { $a->name() cmp $b->name() ||
$a->class() cmp $b->class() ||
$a->ID() cmp $b->ID()
},
species => sub { $a->tag('species') cmp $b->tag('species') ||
$a->class() cmp $b->class() ||
$a->ID() cmp $b->ID()
},
total_ic => sub { $b->total_ic() <=> $a->total_ic()
||
$a->name() cmp $b->name()
}
);
if (defined (my $sort_function = $sort_fn{lc $sort_by})) {
$self->{'_iterator_array_ref'} =
[ sort $sort_function @{$self->{'_orig_array_ref'}} ];
}
else {
#order by tag derived value
$self->{'_iterator_array_ref'}= [ sort { $a->tag($self->{_sort_by}) cmp $b->tag( $self->{_sort_by}) ||
$a->class() cmp $b->class() ||
$a->ID() cmp $b->ID()
} @{$self->{'_orig_array_ref'}} ] || $self->throw("Cannot sort ".ref($self)." object by '$sort_by'.");
}
}
|