Bio-RNA-BarMap

 view release on metacpan or  search on metacpan

lib/Bio/RNA/BarMap/Mapping/MinMappingEntry.pm  view on Meta::CPAN


package Bio::RNA::BarMap::Mapping::MinMappingEntry;
our $VERSION = '0.04';

use 5.012;
use warnings;

use Moose;
use namespace::autoclean;

use Scalar::Util qw( weaken );

use Bio::RNA::BarMap::Mapping::Type;
use Bio::RNA::BarMap::Mapping::Set;


has 'index' => (is => 'ro', required => 1);

has 'to_type' => (
    is => 'rw',
    isa => 'Bio::RNA::BarMap::Mapping::Type',

lib/Bio/RNA/BarMap/Mapping/MinMappingEntry.pm  view on Meta::CPAN

);

has 'to' => (
    is          => 'rw',
    weak_ref    => 1,
    predicate   => 'has_to',
    isa         => __PACKAGE__,             # another entry
);

# Always use this method to add 'from' minima. This ensures the refs
# are weakened and no memory leaks arise.
sub add_from {
    my ($self, @from) = @_;
    weaken $_ foreach @from;                # turn into weak references
    $self->_from->insert(@from);
}

sub get_from {
    my ($self) = @_;
    my @from = $self->_from->elements;
    return @from;
}

__PACKAGE__->meta->make_immutable;

lib/Bio/RNA/BarMap/Mapping/MinMappingEntry.pm  view on Meta::CPAN

Returns the entry this minimum is being mapped to. May be C<undef>.

=head2 $entry->to($to_min_entry)

Sets the C<to> attribute to point to C<$to_min_entry>.

=head2 $entry->add_from(@from_entries)

Adds entries to the set of source minima, i. e. those that are mapped to this
minimum. This method makes sure that the stored references are properly
weakened and no memory leaks arise.

=head2 $entry->get_from

Returns the entries of minima that are mapped to this minimum, as stored in
the source minima set.

=head1 AUTHOR

Felix Kuehnl, C<< <felix at bioinf.uni-leipzig.de> >>



( run in 0.653 second using v1.01-cache-2.11-cpan-65fba6d93b7 )