Mercurial > repos > dereeper > pgap
diff PGAP_wrapper2.pl @ 0:83e62a1aeeeb draft
Uploaded
author | dereeper |
---|---|
date | Thu, 24 Jun 2021 13:51:52 +0000 |
parents | |
children | 6d3580552457 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PGAP_wrapper2.pl Thu Jun 24 13:51:52 2021 +0000 @@ -0,0 +1,65 @@ +#!/usr/bin/perl + +use strict; +use Getopt::Long; +use Bio::SeqIO; +use File::Basename; +my $dirname = dirname(__FILE__); +use Cwd qw(cwd); +my $dir = cwd; + +my $usage = qq~Usage:$0 <args> [<opts>] + +where <args> are: + + -g, --genes <list of gene fasta files. Comma separated list> + -p, --proteins <list of protein fasta files. Comma separated list> + -o, --order <list of samples in the same order. Comma separated list> + -o, --out <output name> +~; +$usage .= "\n"; + +my ($genes,$proteins,$out,$order); + +GetOptions( +"genes=s" => \$genes, +"proteins=s" => \$proteins, +"out=s" => \$out, +"order=s" => \$order +); + + +die $usage + if ( !$proteins || !$genes || !$out || !$order); + +my @names = split(",",$order); +my @list; +mkdir("tmpdir$$"); +my @gene_files = split(/,/,$genes); +my $n = 0; +foreach my $gene_file(@gene_files){ + my $particule = $names[$i]; + system("cp $gene_file tmpdir$$/$particule.nuc"); + $n++; +} +$n = 0; +my @protein_files = split(/,/,$proteins); +foreach my $protein_file(@protein_files){ + my $particule = $names[0]; + system("cp $protein_file tmpdir$$/$particule.pep"); + open(F,"$protein_file"); + open(F2,">tmpdir$$/$particule.function"); + while(<F>){ + if (/>(.*)/){ + print F2 "$1 - unknown\n"; + } + } + close(F); + close(F2); + $n++; +} + +#chdir("$dirname/PGAP-1.2.1"); +my $cmd = "perl $dirname/PGAP-1.2.1/PGAP.pl --input tmpdir$$ --output outdir --cluster --pangenome --variation --evolution --function --strains ".join("+",@list)." --method GF"; +system($cmd); +system("cp -rf outdir/1.Orthologs_Cluster.txt $out");