Bio-RNA-RNAaliSplit

 view release on metacpan or  search on metacpan

lib/Bio/RNA/RNAaliSplit/AliFeature.pm  view on Meta::CPAN

# -*-CPerl-*-
# Last changed Time-stamp: <2019-04-24 00:47:47 mtw>
#
#  Derive features of an alignment, in particular scores to compare
#  different alignments of the same sequences

package Bio::RNA::RNAaliSplit::AliFeature;

use Moose;
use namespace::autoclean;
use version; our $VERSION = qv('0.11');
use diagnostics;
use Data::Dumper;
use Carp;

extends 'Bio::RNA::RNAaliSplit::AliHandler';

has 'sop' => ( # sum of pairs score
	      is => 'rw',
	      isa => 'Int',
	      predicate => 'has_sSOP',
	      init_arg => undef,
	     );

has '_csp' => ( # column sequence positions
	      is => 'ro', # read-only
	      isa => 'ArrayRef',
	      predicate => 'has_sCSP',
	      init_arg => undef,
	      writer => '_cspwriter', # private writer
	      );

has 'csp_hash' => (
		   is => 'ro',
		   isa => 'HashRef',
		   predicate => 'hash_csp_hash',
		   init_arg => undef,
		   writer => '_csp_hash_writer', # private writer 4 ro attribute
		  );

with 'FileDirUtil';

sub BUILD {
  my $self = shift;
   my $this_function = (caller(0))[3];
  confess "ERROR [$this_function] \$self->ifile not available"
    unless ($self->has_ifile);
  $self->alignment({-file => $self->ifile,
		    -format => $self->format,
		    -displayname_flat => 1} ); # discard position in sequence IDs
  $self->next_aln($self->alignment->next_aln);
  $self->next_aln->set_displayname_safe();
  $self->_get_alen();
  $self->_get_nrseq();
  $self->set_ifilebn;

  # compute sum of pairs score
  #$self->compute_sop();
  # compute sequence position for each column
  $self->_get_column_sequence_positions();
  # compute CSP hash
  $self->_csp_hash();
}

# Compute Sum of Pairs scoring for an alignment
sub compute_sop {
  my $self = shift;
  # print "### in ccompute_sop###\n";
  my @alignment=();
  my $sp=0;



( run in 0.687 second using v1.01-cache-2.11-cpan-39bf76dae61 )