-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildptp.pl
More file actions
77 lines (70 loc) · 2.3 KB
/
buildptp.pl
File metadata and controls
77 lines (70 loc) · 2.3 KB
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
#!/usr/bin/perl
my $usage = "First run buildchar.pl then buildptp.pl infile Cod > outfile \n";
my $Cod = shift or die $usage;
# @out = array com os nomes dos filos
#checa se há os arquivos temporários
$file = "Nomes_$Cod.txt"; #nome das sequencias e filos
$file2 = "Filos_$Cod.txt"; #filos únicos
###################################################################
# coloca os filos em array
###################################################################
open (MYFILE, "$file2");
while (<MYFILE>) {
chomp;
push(@out, $_);
}
close (MYFILE);
#monta o bloco de comandos
$matrix = 0;
print ">>>>>>>>>>>>>>>>>>>>COPY FROM HERE<<<<<<<<<<<<<<<<<<<<\n\n";
while ($matrix < 300) {
###################################################################
# Início do cabeçalho
###################################################################
print "BEGIN CHARACTERS;\n";
print " \tTITLE ", $matrix,";\n";
print " \tDIMENSIONS NCHAR=1;\n";
print " \tFORMAT DATATYPE = STANDARD GAP = - MISSING = ? SYMBOLS = \"";
#monta o número de caracteres sendo que "0" já está definido como Streptophyta
$conta = A;
foreach $i (@out) {
print " $conta";
push(@filo, $conta);#coloca as letras dos filos no array
$conta ++,
}
print "\"\; CHARSTATELABELS\n";
print "\t\t 1 Bact \/ ";
#monta os nomes dos caracteres
foreach $i (@out) {
print "\U$i\E ";
}
print "\;\n\tMATRIX\n";
###################################################################
# Fim do cabeçalho
###################################################################
###################################################################
# Inicio da matrix de dados
###################################################################
open (MYFILE, "$file");
while (<MYFILE>) {
chomp;
#troca os nomes dos caracteres pelos números
#$conta = A;
#$Quantos = scalar(@out); #conta quantos filos tem no arquivo
foreach $i (@out) {
#@abc = (A .. Z)[0..$quantos];#gera array com $quantos letras
$draw = @filo[rand @filo]; #pega uma letra aleatória no @abc
$_ =~ s/$i/$draw/g;
#$conta ++;
}
print "$_\n";
}
close (MYFILE);
print "\;\n";
print "\tEND\;\n";
$matrix ++;
}; # fecha loop para montagem da matriz
print "\n\n>>>>>>>>>>>>>>>>>>>>COPY UNTIL HERE<<<<<<<<<<<<<<<<<<<<\n\n";
#apaga arquivo temporário
#unlink($file);
exit;