Bio-RNA-Barriers

 view release on metacpan or  search on metacpan

lib/Bio/RNA/Barriers/Minimum.pm  view on Meta::CPAN

package Bio::RNA::Barriers::Minimum;
our $VERSION = '0.03';

use 5.012;
use strict;
use warnings;

use Moose;
use MooseX::StrictConstructor;
use Moose::Util::TypeConstraints;
use namespace::autoclean;

use autodie qw(:all);
use overload q{""} => 'stringify';

use Scalar::Util    qw(blessed);
use List::Util      qw(max);
use List::MoreUtils qw(zip);

#### Special types for attribute checking.
subtype 'RNAStruct' => (
    as 'Str',
    where { m{ ^ [(.)]+ $ }x },
    message {
        "Only '(', ')', and '.' allowed in structure string, found '$_'"
    },
);

subtype 'DisconSaddle' => (
    as 'Str',
    where { m{ ^ ~+ $ }x },
    message {
        "Only '~' allowed in disconnected saddle string, found '$_'"
    },
);

# index  - index of basins ordered by energy; 1 is lowest
# struct - struct of lowest energy in minimums
# mfe    - free energy of the basin's local minimum
# father_index  - index of father basin (the basin this one is merged to)
# barrier_height - height of energy barrier (in kcal/mol) to minimum this
#                 one is merged to (relative to this minimum)
my @default_attribs = qw( index struct mfe father_index barrier_height);
my @default_attrib_args = (is => 'rw', required => 1);
my %default_attrib_isa
    = &zip(\@default_attribs, [qw(Int RNAStruct Num Int Num)]);
has $_ => (@default_attrib_args, isa => $default_attrib_isa{$_})
    foreach @default_attribs;

# Return true iff this is the mfe basin 1.
sub is_global_min {
    my $self = shift;
    my $is_global_min = $self->index == 1;
    return $is_global_min;
}

# Optional attributes generated by Barriers options --bsize and --saddle.
# Descriptions in quotes are from Barriers tutorial at
# https://www.tbi.univie.ac.at/RNA/tutorial/#sec4_2
# merged_struct_count - 'numbers of structures in the basin we merge with'
#       Given is the number of structures in the *current* basin
#       (including merged ones) *at the time of merging*. For minimum 1,
#       this is close to the total number of input structures (except for
#       disconnected structures and other missing ones (???).
# father_struct_count - 'number of basin which we merge to'
#       Actually, it's the number of *structures* in the basin that we
#       merge to (father basin) *at the time of merging*.
# merged_basin_energy - 'free energy of the basin'
#       This seems to be the free energy of (the partition function of)
#       the basin---including all merged basins---at the time this basin
#       is merged. For minimum 1, this corresponds to the ensemble free



( run in 0.555 second using v1.01-cache-2.11-cpan-5735350b133 )