comparison Rooting/Rooting.pl @ 1:420b57c3c185 draft

Uploaded
author dereeper
date Fri, 10 Jul 2015 04:39:30 -0400
parents
children
comparison
equal deleted inserted replaced
0:3e19d0dfcf3e 1:420b57c3c185
1 #!/usr/bin/perl
2
3 use strict;
4 use Switch;
5 use Getopt::Long;
6 use Bio::SeqIO;
7 use Cwd ;
8 use FindBin qw ( $Bin $Script );
9
10 my $CURRENT_DIR = $Bin;
11
12 my $ROOTING_EXE = "java -jar ". $CURRENT_DIR . "/Rootings_54.jar";
13
14 my $usage = qq~Usage:$0 <args> [<opts>]
15 where <args> are:
16 -i, --input <newick input>
17 -o, --output <newick output>
18 ~;
19 $usage .= "\n";
20
21 my ($input,$outfile);
22
23
24 GetOptions(
25 "input=s" => \$input,
26 "output=s" => \$outfile
27 );
28
29
30 die $usage
31 if ( !$input || !$outfile);
32
33 my $treefile = $input;
34
35
36 # replace negative values by 0
37 open(T,$treefile);
38 open(T2,">$treefile.2");
39 while(<T>)
40 {
41 my $line = $_;
42 $line =~s/\-\d+\.*\d*\,/0,/g;
43 $line =~s/\-\d+\.*\d*\)/0\)/g;
44 print T2 $line;
45 }
46 close(T);
47 close(T2);
48
49 my $rooting_command = $ROOTING_EXE . " -input $treefile.2 -output $treefile.all -midpoint $treefile.midpoint >>$treefile.rooting.log 2>&1";
50 system($rooting_command);
51
52 unlink("$treefile.all");
53 unlink("$treefile.2");
54 rename("$treefile.midpoint",$outfile);
55
56
57
58
59