1 2 3
4 5 6
7 8 9
####
2 3 4
4 5 6
7 8 9
##
##
1 2 3
4 5 6
7 8 9
##
##
3 4 5
4 5 6
7 8 9
##
##
1.75 2.75 3.75
x x x
x x x
##
##
#/bin/perl/
use strict;
use warnings;
use autodie;
my $molec = "1ac6";
my $cluster;
my $times;
my $input;
my $path = "/media/RAIDstorage/home/athina/dist-analysis/${molec}/time
+series/test";
my $line;
my @files;
@files = `ls $path\/$molec-times*`;
foreach (@files) {
my $a;
my $b;
my $m_avrg;
my @m_avrg;
undef @m_avrg;
my @list;
my $list;
my $aver;
/${molec}-times-(\d+)-clust(\d{1})/;
$times = $1;
$cluster = $2;
open $input, '<', "$path\/${molec}-times-${times}-clust${cluster}.out
+" or die $!;
while ($line = <$input>) {
chomp $line;
push @list, [split/\s+/, $line];
} # while input
close $input;
for ($a=0; $a<=2; $a++) {
for ($b=0; $b<=2; $b++) {
#print "$list[$a][$b] "; # check matrices
$m_avrg[$a][$b] = ($m_avrg[$a][$b] + $list[$a][$b]);
print "$m_avrg[$a][$b] \n";
}
print " \n";
}
print "average\n";
for ($a=0; $a<=2; $a++) {
for ($b=0; $b<=2; $b++) {
$m_avrg[$a][$b] = $m_avrg[$a][$b] / 4;
print "$m_avrg[$a][$b] ";
}
print "\n";
}
} # foreach file in loop