/usr/share/perl5/Bio/Graphics/Util.pm is in libbio-graphics-perl 2.40-2.
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 | package Bio::Graphics::Util;
# Non object-oriented utilities used here-and-there in Bio::Graphics modules
=head1 NAME
Bio::Graphics::Util - non-object-oriented utilities used in Bio::Graphics modules
=cut
use strict;
require Exporter;
use base qw(Exporter);
use vars '@EXPORT','@EXPORT_OK';
@EXPORT = 'frame_and_offset';
use Bio::Root::Version;
=over 4
=item ($frame,$offset) = frame_and_offset($pos,$strand,$phase)
Calculate the reading frame for a given genomic position, strand and
phase. The offset is the offset from $pos to the first nucleotide
of the reading frame.
In a scalar context, returns the frame only.
=back
=cut
sub frame_and_offset {
my ($pos,$strand,$phase) = @_;
$strand ||= +1;
$phase ||= 0;
my $codon_start = $strand >= 0
? $pos + $phase
: $pos - $phase; # probably wrong
my $frame = ($codon_start-1) % 3;
my $offset = $strand >= 0 ? $phase : -$phase;
return wantarray ? ($frame,$offset) : $frame;
}
1;
|