annotate PGAP_wrapper2.pl @ 3:bbb2c473664c draft

Uploaded
author dereeper
date Thu, 24 Jun 2021 15:08:13 +0000
parents 041355b97140
children d8c5bea1cce2
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 use Cwd qw(cwd);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
9 my $dir = cwd;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
10
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
11 my $usage = qq~Usage:$0 <args> [<opts>]
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
12
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
13 where <args> are:
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
14
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
15 -g, --genes <list of gene fasta files. Comma separated list>
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
16 -p, --proteins <list of protein fasta files. Comma separated list>
2
041355b97140 Uploaded
dereeper
parents: 1
diff changeset
17 -l, --list <list of samples in the same order. Comma separated list>
0
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
18 -o, --out <output name>
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
19 ~;
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
20 $usage .= "\n";
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
21
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
22 my ($genes,$proteins,$out,$order);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
23
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
24 GetOptions(
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
25 "genes=s" => \$genes,
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
26 "proteins=s" => \$proteins,
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
27 "out=s" => \$out,
2
041355b97140 Uploaded
dereeper
parents: 1
diff changeset
28 "list=s" => \$order
0
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
29 );
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
30
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
31
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
32 die $usage
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
33 if ( !$proteins || !$genes || !$out || !$order);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
34
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
35 my @names = split(",",$order);
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
36 my @list;
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){
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
48 my $particule = $names[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");
83e62a1aeeeb Uploaded
dereeper
parents:
diff changeset
63 my $cmd = "perl $dirname/PGAP-1.2.1/PGAP.pl --input tmpdir$$ --output outdir --cluster --pangenome --variation --evolution --function --strains ".join("+",@list)." --method GF";
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");