-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtranslate_6frames.pl
More file actions
executable file
·50 lines (37 loc) · 986 Bytes
/
Copy pathtranslate_6frames.pl
File metadata and controls
executable file
·50 lines (37 loc) · 986 Bytes
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
#!/usr/bin/env perl
## Author: reubwn Jan 2019
use strict;
use warnings;
use Bio::Seq;
use Bio::SeqIO;
use Bio::SeqUtils;
use Getopt::Long;
my $usage = "
translate_6frames.pl
====================
Translates a genome fasta into all 6 forward and reverse coding frames, e.g. for
a 'BLASTX-like' analysis using HMMER.
USAGE:
translate_6frames.pl -f <fasta> > FILE
OPTIONS:
-f|--fasta [FILE] : fasta file of contigs [required]
-h|--help : prints this help message
\n\n";
## other args
my ($fasta,$help);
GetOptions (
'f|fasta=s' => \$fasta,
'h|help' => \$help,
);
die $usage if $help;
die $usage unless ($fasta);
## open fasta
my $in = Bio::SeqIO -> new ( -file => $fasta, -format => "fasta" );
my $stream = Bio::SeqIO->newFh( -fh => \*STDOUT, -format => "fasta" );
while ( my $seq_obj = $in->next_seq() ) {
my @translated = Bio::SeqUtils->translate_6frames($seq_obj);
foreach (@translated) {
print $stream $_;
}
}
print STDERR `date`;