-
Notifications
You must be signed in to change notification settings - Fork 2
/
multiAlign.pl
70 lines (58 loc) · 1.85 KB
/
multiAlign.pl
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
#latest version modified by Pablo Cruz-Morales June 2020
use experimental 'smartmatch';
use lib './';
use globals2;
$infile="$NAME2";
$lista="lista.$NUM2";
$Working_dir="$dir2/$infile";
system "mkdir $dir2/$infile/ALIGNMENTS/";
###############################################################################################
##############################################
$TOTAL=`grep \$ $dir2/$infile/lista.ORTHOall -c`;
$NumOrg=$NUM2;
open (LS, "$lista") or die $!;
while (<LS>){
chomp;
print "$_\n";
push(@lista0, $_);
}
my @sorted_orgs = sort { $a <=> $b } @lista0;
print ("@lista0\n");
#line parsing through the contents of folder .lista.orthoall
until ($counter==$TOTAL){
$counter++;
print "I am at $counter\n";
&align($counter);
}
`mkdir $dir2/$infile/CONCATENADOS`;
########
sub align{
system "mafft --quiet $Working_dir/FASTAINTER/$_[0].interFastatodos > $Working_dir/ALIGNMENTS/$_[0].muscle.aln";
$nombre="$Working_dir/ALIGNMENTS/$_[0].muscle.aln";
open(FILE2,$nombre)or die $!;
print("Se abrio el archivo $nombre\n");
@content=<FILE2>;
foreach $line (@content){
if($line =~ />/){
chomp;
$headerFasta=$line;
$org=$line;
chomp $org;
$org=~s/>fig\|*.*.peg.*\|//g; #Obtengo el indicador de organismo
$hashFastaH{$org}=$headerFasta;
}
else{
$hashFastaH{$org}=$hashFastaH{$org}.$line;
}
}
open ORDEN,">$Working_dir/ALIGNMENTS/$_[0].orden.muscle" or die $!;
for ($i=0;$i<=$NumOrg;$i++){
if ($sorted_orgs[$i]~~@lista0){
print ORDEN "$hashFastaH{$sorted_orgs[$i]}";
}
}
close ORDEN;
close(FILE2);
}
############################################
print "finished aligning with mafft\n";