forked from wang-q/withncbi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkaks.pl
67 lines (50 loc) · 1.43 KB
/
kaks.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
use YAML qw(Dump Load DumpFile LoadFile);
use FindBin;
use lib "$FindBin::Bin/../lib";
use MyKaKs;
#----------------------------------------------------------#
# GetOpt section
#----------------------------------------------------------#
my $input = 'cdna.fasta';
my $output;
my $man = 0;
my $help = 0;
GetOptions(
'help|?' => \$help,
'man' => \$man,
'input=s' => \$input,
'output=s' => \$output,
) or pod2usage(2);
pod2usage(1) if $help;
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man;
$output ||= $input . ".csv";
#----------------------------------------------------------#
# run
#----------------------------------------------------------#
my $kaks = AlignDB::KaKs->new(fasta => $input);
$kaks->run;
open my $out_fh, ">", $output or die "cannot open output file: $!\n";
print {$out_fh}
join( ",", qw{ Seq1 Seq2 Ka Ks Ka/Ks Prot_PercentID cDNA_PercentID } ),
"\n";
for my $result (@{$kaks->results}) {
print {$out_fh} join( ",", @$result), "\n";
}
close $out_fh;
__END__
=head1 NAME
kaks.pl - Calculate Ka/Ks for cDNA
=head1 SYNOPSIS
kaks.pl [options]
Options:
--help brief help message
--man full documentation
--input input cdna filename
--output output filename
--localtmp use cwd as temporary dir
=cut