4
|
1 #!/usr/bin/perl -w
|
|
2
|
|
3 # usage : perl script.pl <FASTA file> <method01> <method02> <method03> $dnd $msf_aln $clustalw_aln $pir_aln $fasta_aln $phylip $pir_seq $fasta_seq $score_ascii $score_html
|
|
4
|
|
5 #Chain wich will contains the paramater -output with the formats
|
|
6 my $outputFormat = "";
|
|
7 #Chain wich will contains the paramater for the -newtree, if the user wants
|
|
8 my $outputTree = "";
|
|
9 #Chain wich will contains the method of alignment of the process
|
|
10 my $total = "";
|
|
11 #Array where place the names of the formats, for the flag -output
|
|
12 my @formats = ("msf_aln", "clustalw_aln", "pir_aln", "fasta_aln", "phylip", "pir_seq", "fasta_seq", "score_ascii", "score_html");
|
|
13 #Array with the inputs for the methods of alignments
|
|
14 my @array = ($ARGV[1], $ARGV[2], $ARGV[3]);
|
|
15 #Array where will be placed the output files wich the user generate
|
|
16 my @files;
|
|
17
|
|
18 #Firstly the input methods of alignments are saved, if they exists (they aren't none), in the chain total, separated by commas
|
|
19 for (my $i = 0; $i < int(@array); $i++){
|
|
20 if ($array[$i] ne "None"){
|
|
21 $total.=$array[$i].",";
|
|
22 }
|
|
23 }
|
|
24
|
|
25 #If the user has selected the option of the tree, the chain of the tree will contains the file for the tree
|
|
26 if ($ARGV[4] ne "None") {
|
|
27 $outputTree = "-newtree ".$ARGV[4]." ";
|
|
28 }
|
|
29
|
|
30 #copy is a variable which save the file and the extension of each output file ([0]:file1.dat, [1]:extension_file1, [2]:file2.dat, [3]extension_file2, ...)
|
|
31 my $copy = -1;
|
|
32 @array = ($ARGV[5],$ARGV[6],$ARGV[7],$ARGV[8],$ARGV[9],$ARGV[10],$ARGV[11],$ARGV[12],$ARGV[13]);
|
|
33 for (my $i = 0; $i < int(@array); $i++){
|
|
34 if ($array[$i] ne "None"){
|
|
35 $outputFormat.=$formats[$i].",";
|
|
36 $copy++;
|
|
37 $files[$copy]=$array[$i];
|
|
38 $copy++;
|
|
39 $files[$copy]=$formats[$i];
|
|
40 }
|
|
41 }
|
|
42
|
|
43 #if $total contains some method, we added the flag, and remove the last comma
|
|
44 if ($total ne "") {
|
|
45 chop($total);
|
|
46 $total = "-method ".$total;
|
|
47 }
|
|
48
|
|
49 #if $outputFormat contains some output, we added the flag, and remove the last comma
|
|
50 #the outfile will be the first output file
|
|
51 #tcoffee will generate a first file without extension, with the name indicated in -outfile, but the other files will be named like this first file and the extension of the format
|
|
52 if ($outputFormat ne "") {
|
|
53 chop($outputFormat);
|
|
54 $outputFormat = "-output ".$outputFormat." -outfile $files[0]";
|
|
55 }
|
|
56
|
|
57 #execution of the tcoffee; if there are not any method or output, this chains will be empty, so anything will be ejecuted in that flag
|
|
58 system("t_coffee $ARGV[0] $total $outputTree $outputFormat -quiet");
|
|
59
|
|
60 #finally, as tcoffee added an extension, we have to change the extension of the files and delete it (but not from the first file, that do not add any extension)
|
|
61 my $fi;
|
|
62 if ($copy > 1) {
|
|
63 for (my $i = 2; $i < int(@files); $i+=2){
|
|
64 $fi = $files[0].".".$files[$i+1];
|
|
65 system ("mv $fi $files[$i]");
|
|
66 }
|
|
67 }
|