comparison PGAP_wrapper2.pl @ 0:83e62a1aeeeb draft

Uploaded
author dereeper
date Thu, 24 Jun 2021 13:51:52 +0000
parents
children 6d3580552457
comparison
equal deleted inserted replaced
-1:000000000000 0:83e62a1aeeeb
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 use Cwd qw(cwd);
9 my $dir = cwd;
10
11 my $usage = qq~Usage:$0 <args> [<opts>]
12
13 where <args> are:
14
15 -g, --genes <list of gene fasta files. Comma separated list>
16 -p, --proteins <list of protein fasta files. Comma separated list>
17 -o, --order <list of samples in the same order. Comma separated list>
18 -o, --out <output name>
19 ~;
20 $usage .= "\n";
21
22 my ($genes,$proteins,$out,$order);
23
24 GetOptions(
25 "genes=s" => \$genes,
26 "proteins=s" => \$proteins,
27 "out=s" => \$out,
28 "order=s" => \$order
29 );
30
31
32 die $usage
33 if ( !$proteins || !$genes || !$out || !$order);
34
35 my @names = split(",",$order);
36 my @list;
37 mkdir("tmpdir$$");
38 my @gene_files = split(/,/,$genes);
39 my $n = 0;
40 foreach my $gene_file(@gene_files){
41 my $particule = $names[$i];
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){
48 my $particule = $names[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");
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";
64 system($cmd);
65 system("cp -rf outdir/1.Orthologs_Cluster.txt $out");