annotate PGAP_wrapper2.pl @ 11:e0c913351502 draft default tip

Uploaded
author dereeper
date Thu, 01 Jul 2021 12:22:53 +0000
parents 1085c917d850
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
1 #!/usr/bin/perl
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
2
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
3 use strict;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
4 use Getopt::Long;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
5 use Bio::SeqIO;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
6 use File::Basename;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
7 my $dirname = dirname(__FILE__);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
8
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
9 my $usage = qq~Usage:$0 <args> [<opts>]
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
10
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
11 where <args> are:
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
12
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
13 -g, --genes <list of gene fasta files. Comma separated list>
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
14 -p, --proteins <list of protein fasta files. Comma separated list>
2
041355b97140 Uploaded
dereeper
parents: 1
diff changeset
15 -l, --list <list of samples in the same order. Comma separated list>
0
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
16 -o, --out <output name>
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
17 ~;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
18 $usage .= "\n";
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
19
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
20 my ($genes,$proteins,$out,$order);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
21
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
22 GetOptions(
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
23 "genes=s" => \$genes,
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
24 "proteins=s" => \$proteins,
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
25 "out=s" => \$out,
2
041355b97140 Uploaded
dereeper
parents: 1
diff changeset
26 "list=s" => \$order
0
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
27 );
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
28
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
29
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
30 die $usage
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
31 if ( !$proteins || !$genes || !$out || !$order);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
32
5
d8c5bea1cce2 Uploaded
dereeper
parents: 2
diff changeset
33 if ($order =~/^,(.*)$/){
d8c5bea1cce2 Uploaded
dereeper
parents: 2
diff changeset
34 $order = $1;
d8c5bea1cce2 Uploaded
dereeper
parents: 2
diff changeset
35 }
0
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
36 my @names = split(",",$order);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
37 mkdir("tmpdir$$");
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
38 my @gene_files = split(/,/,$genes);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
39 my $n = 0;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
40 foreach my $gene_file(@gene_files){
1
6d3580552457 Uploaded
dereeper
parents: 0
diff changeset
41 my $particule = $names[$n];
0
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
42 system("cp $gene_file tmpdir$$/$particule.nuc");
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
43 $n++;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
44 }
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
45 $n = 0;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
46 my @protein_files = split(/,/,$proteins);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
47 foreach my $protein_file(@protein_files){
5
d8c5bea1cce2 Uploaded
dereeper
parents: 2
diff changeset
48 my $particule = $names[$n];
0
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
49 system("cp $protein_file tmpdir$$/$particule.pep");
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
50 open(F,"$protein_file");
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
51 open(F2,">tmpdir$$/$particule.function");
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
52 while(<F>){
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
53 if (/>(.*)/){
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
54 print F2 "$1 - unknown\n";
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
55 }
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
56 }
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
57 close(F);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
58 close(F2);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
59 $n++;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
60 }
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
61
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
62 #chdir("$dirname/PGAP-1.2.1");
5
d8c5bea1cce2 Uploaded
dereeper
parents: 2
diff changeset
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
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
64 system($cmd);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
65 system("cp -rf outdir/1.Orthologs_Cluster.txt $out");
7
1085c917d850 Uploaded
dereeper
parents: 5
diff changeset
66 system("cat outdir/0.error.message");