/usr/lib/perl5/ALTree/SiteSensPerTree.pm is in altree 1.3.1-1.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | package ALTree::SiteSensPerTree;
################################################################
################################################################
####################### SiteSensPerTree ########################
################################################################
################################################################
use base qw(ALTree::Base ALTree::SiteSens);
# Structure SiteSens
# "site_struct" -> Site
# "sens_label" -> String
# "node_list" -> Array of (Node)
# "m_it" -> Interger # nb mutation of this chage in the tree
# "R_it" -> Interger # nb co-mutations of this change with character S
# "V_it" -> Integer # (R_it-E_it)/sqrt(E_it)
sub New { # [classe] sens_label site_struct
my $class=shift;
my $self={};
my $sens=shift;
my $site=shift;
bless($self, $class);
$self->InitSiteSens($sens, $site);
$self->_init("node_list" => [], "R_it" => 0, @_);
return $self;
}
# Appelé par Node->AddApo
sub _AddNode {
my $self=shift;
my $node=shift;
if (exists($self->{"m_it"})) {
die "_AddNode called after GetMit";
}
push @{$self->{"node_list"}}, $node;
}
# Appelé par Node->DeleteAllApo
sub _DeleteNode {
my $self=shift;
my $node=shift;
my @new_node_list=grep { $_ != $node } @{$self->{"node_list"}};
if (scalar(@new_node_list)+1 != $self->NbNodes()) {
die "Error while removing a node from a SiteSensPerTree";
}
$self->{"node_list"}=\@new_node_list;
}
sub NbNodes {
my $self=shift;
return scalar (@{$self->{"node_list"}});
}
sub GetNode {
my $self=shift;
my $index=shift;
return $self->{"node_list"}->[$index];
}
sub GetNodesList {
my $self=shift;
return @{$self->{"node_list"}};
}
sub SetStep {
my $self=shift;
my $step=shift;
$self->{"Step"}=$step;
}
sub GetStep {
my $self=shift;
my $step=shift;
return $self->{"Step"};
}
sub GetMit {
my($self)=shift;
if (not exists($self->{"m_it"})) {
$self->{"m_it"}=$self->NbNodes();
}
return ($self->{"m_it"});
}
sub IncRit {
my($self)=shift;
if (exists($self->{"V_it"})) {
die "IncRit called after GetVit";
}
$self->{"R_it"}++;
}
sub GetRit {
my($self)=shift;
return ($self->{"R_it"});
}
sub GetVit {
my $self=shift;
my $Rit=$self->GetRit();
my $Eit=$self->GetEit();
if (not exists($self->{"V_it"})) {
if ($Eit == 0) {
$self->{"V_it"}=0;
} else {
$self->{"V_it"}=($Rit-$Eit)/sqrt($Eit);
}
}
return ($self->{"V_it"});
}
sub SetEit {
my($self)=shift;
my($value)=shift;
if (exists($self->{"V_it"})) {
die "SetEit called after GetVit";
}
$self->{"E_it"}=$value;
}
sub GetEit {
my($self)=shift;
return ($self->{"E_it"});
}
1;
|