Bio-MUST-Apps-OmpaPa
view release on metacpan or search on metacpan
lib/Bio/MUST/Apps/OmpaPa/Roles/Parsable.pm view on Meta::CPAN
->name( $file . '*.json' )
->in( $self->file->dir );
my @sorted = nsort( @files );
# because File::Find::Rule goes recursively in directories
# use the directory of entry file
my @finalsort;
FINALSORT:
for my $f (@sorted) {
my @parts = split m{/}xms, $f;
if ("$parts[0]/" eq $dir) {
push @finalsort, $f;
next FINALSORT;
}
push @finalsort, $f if @parts < 2;
}
return file( $finalsort[-1] );
}
lib/Bio/MUST/Apps/OmpaPa/Roles/Parsable.pm view on Meta::CPAN
}
sub _build_coeffs {
my $self = shift;
my %count_for;
my %coeffs_for;
for my $hit ($self->all_hits) {
# TODO: use SeqId methods: $_->$method // $_->taxon_id
my $org = (split m{\|}xms, $hit->{acc})[0];
$count_for{$org}++;
my $coeff_len = $hit->{len} / $hit->{qlen};
my $coeff_hmm
= ( $hit->{hmm_to} - $hit->{hmm_from} + 1 ) / $hit->{qlen};
my ($index, $label) = $self->scheme
? $self->scheme->icol( $hit->{acc} ) : (undef, undef);
unless (defined $index) {
$index = 0;
lib/Bio/MUST/Apps/OmpaPa/Roles/Parsable.pm view on Meta::CPAN
qlen => $qlen
);
return \%return;
}
sub _org_col {
my $self = shift;
my @ids = map { $_->{acc} } $self->all_hits;
my @orgs = map { (split m{\|}xms, $_)[0] } @ids;
my %count_orgs;
for my $org (@orgs) {
$count_orgs{$org}++;
}
my $nb_org_tot = keys %count_orgs;
my $max = (sort {$a <=> $b} values %count_orgs)[$nb_org_tot-1];
my $color_n = $max; # range scale palette
# limit coloration: 3 (default) or more times the same organism in yellow
( run in 0.967 second using v1.01-cache-2.11-cpan-483215c6ad5 )