-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathtranslate_seq.pl
executable file
·38 lines (29 loc) · 1.07 KB
/
translate_seq.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
#!/usr/bin/perl
use strict;
use Bio::SeqIO;
use Getopt::Long;
my ($in,$out,$unknown,$help);
my $unknown="X";
GetOptions(
'h|help|?' => \$help,#het the help information
'in:s' => \$in,
'out:s' => \$out,
'u|unknown:s' =>\$unknown,
);
if (($help)||!$in||!$out){
print "usage: translate_seq [-h] [-in text] [-out text] [-unknown Character]\n";
print "Part of Sequence-manipulation by J. Hughes (joseph(dot)hughes(at)glasgow(dot)ac(dot)uk\n\n";
print " [-h] = This helpful help screen.\n";
print " [-in text] = Multi-fasta file name input\n";
print " [-out text] = File name for the protein output.\n";
print " [-unknown char] = Single character to use for unknown amino acid translations, default is X.\n";
exit();
}
my $seqin = Bio::SeqIO->new( -format => 'fasta', -file => $in);
my $seqout = Bio::SeqIO->new( -format => 'fasta', -file => ">$out" );
while( (my $seq = $seqin->next_seq()) ) {
#print $seq->seq."\n";
my $pseq = $seq->translate(-unknown => $unknown);
#print "$pseq\n";
$seqout->write_seq($pseq);
}