0
|
1 #!/usr/bin/perl
|
|
2
|
|
3 use strict;
|
|
4 use Getopt::Long;
|
|
5 use Bio::SeqIO;
|
|
6 use File::Basename;
|
|
7 my $dirname = dirname(__FILE__);
|
|
8
|
|
9 my $usage = qq~Usage:$0 <args> [<opts>]
|
|
10
|
|
11 where <args> are:
|
|
12
|
|
13 -g, --genes <list of gene fasta files. Comma separated list>
|
|
14 -p, --proteins <list of protein fasta files. Comma separated list>
|
2
|
15 -l, --list <list of samples in the same order. Comma separated list>
|
0
|
16 -o, --out <output name>
|
|
17 ~;
|
|
18 $usage .= "\n";
|
|
19
|
|
20 my ($genes,$proteins,$out,$order);
|
|
21
|
|
22 GetOptions(
|
|
23 "genes=s" => \$genes,
|
|
24 "proteins=s" => \$proteins,
|
|
25 "out=s" => \$out,
|
2
|
26 "list=s" => \$order
|
0
|
27 );
|
|
28
|
|
29
|
|
30 die $usage
|
|
31 if ( !$proteins || !$genes || !$out || !$order);
|
|
32
|
5
|
33 if ($order =~/^,(.*)$/){
|
|
34 $order = $1;
|
|
35 }
|
0
|
36 my @names = split(",",$order);
|
|
37 mkdir("tmpdir$$");
|
|
38 my @gene_files = split(/,/,$genes);
|
|
39 my $n = 0;
|
|
40 foreach my $gene_file(@gene_files){
|
1
|
41 my $particule = $names[$n];
|
0
|
42 system("cp $gene_file tmpdir$$/$particule.nuc");
|
|
43 $n++;
|
|
44 }
|
|
45 $n = 0;
|
|
46 my @protein_files = split(/,/,$proteins);
|
|
47 foreach my $protein_file(@protein_files){
|
5
|
48 my $particule = $names[$n];
|
0
|
49 system("cp $protein_file tmpdir$$/$particule.pep");
|
|
50 open(F,"$protein_file");
|
|
51 open(F2,">tmpdir$$/$particule.function");
|
|
52 while(<F>){
|
|
53 if (/>(.*)/){
|
|
54 print F2 "$1 - unknown\n";
|
|
55 }
|
|
56 }
|
|
57 close(F);
|
|
58 close(F2);
|
|
59 $n++;
|
|
60 }
|
|
61
|
|
62 #chdir("$dirname/PGAP-1.2.1");
|
5
|
63 my $cmd = "perl $dirname/PGAP-1.2.1/PGAP.pl --input tmpdir$$ --output outdir --cluster --pangenome --variation --evolution --function --strains ".join("+",@names)." --method GF";
|
0
|
64 system($cmd);
|
|
65 system("cp -rf outdir/1.Orthologs_Cluster.txt $out");
|
7
|
66 system("cat outdir/0.error.message");
|