~ubuntu-branches/ubuntu/trusty/bioperl/trusty-proposed

« back to all changes in this revision

Viewing changes to examples/tools/reverse-translate.pl

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
# $Id: reverse-translate.pl 15087 2008-12-04 02:48:00Z bosborne $
 
3
 
 
4
=head1 NAME
 
5
 
 
6
reverse-translate.pl
 
7
 
 
8
=head1 DESCRIPTION
 
9
 
 
10
Reverse-translates a nucleotide sequence using the most frequent codons.
 
11
Requires an input sequence file and a nucleotide sequence file containing 
 
12
one sequence comprised of one or more ORFs. This file supplies the codon
 
13
frequency data and will be parsed starting at the first triplet in the sequence.
 
14
 
 
15
=head1 OPTIONS
 
16
 
 
17
  -i   Input sequence, amino acid
 
18
  -c   Input sequence, nucleotide ORFs
 
19
 
 
20
Example:
 
21
 
 
22
 reverse-translate.pl -i ~/bioperl-live/t/data/cysprot.fa -c ~/bioperl-live/t/data/HUMBETGLOA.fa 
 
23
 
 
24
=cut
 
25
 
 
26
use strict;
 
27
use Bio::SeqIO;
 
28
use Bio::Tools::CodonTable;
 
29
use Bio::Tools::SeqStats;
 
30
use Bio::CodonUsage::Table;
 
31
use Getopt::Long;
 
32
 
 
33
my ($codonFile,$seqFile);
 
34
 
 
35
GetOptions( "c=s" => \$codonFile,
 
36
            "i=s" => \$seqFile );
 
37
 
 
38
die "Need input sequence and file containing coding regions"
 
39
  if ( !$codonFile || !$seqFile );
 
40
 
 
41
my $codonIn = Bio::SeqIO->new(-file => $codonFile,
 
42
                                                                                -format => 'fasta');
 
43
 
 
44
my $codonSeq = $codonIn->next_seq;
 
45
 
 
46
my $codonStats = Bio::Tools::SeqStats->count_codons($codonSeq);
 
47
 
 
48
my $codonUsage = Bio::CodonUsage::Table->new(-data => $codonStats );
 
49
 
 
50
my $codonTable = Bio::Tools::CodonTable->new;
 
51
 
 
52
my $seqIn = Bio::SeqIO->new(-file => $seqFile);
 
53
 
 
54
my $seq = $seqIn->next_seq;
 
55
 
 
56
my $rvSeq = $codonTable->reverse_translate_best($seq,$codonUsage);
 
57
 
 
58
print $rvSeq,"\n";
 
59
 
 
60
__END__