bin/bp_biofetch_genbank_proxy: move to Bio-DB-NCBIHelper
[bioperl-live.git] / examples / rev_and_trans.pl
blobacd38462abf9e3f8d1009f445514f25d1608e39a
1 #!/usr/bin/perl
3 # PROGRAM : rev_and_trans.pl
4 # PURPOSE : Simple driver for Bio::Seq revcom and translate
5 # AUTHOR : Ewan Birney birney@sanger.ac.uk
6 # CREATED : Tue Oct 27 1998
8 # INSTALLATION
9 # If you have installed bioperl using the standard
10 # makefile system everything should be fine and
11 # dandy.
13 # if not edit the use lib "...." line to point the directory
14 # containing your Bioperl modules.
18 use Bio::Seq;
19 use Bio::SeqIO;
21 # new sequence from raw memory...
22 # it is *very* important to get the type right so it
23 # is translated correctly.
25 $seq = Bio::Seq->new ( -id => "myseq",
26 -seq => "CGCCGAAGAAGCATCGTTAAAGTCTCTCTTCACCCTGCCGTCATGTCTAAGTCAGAGTCTCCT",
27 -type => 'Dna');
29 $seqout = Bio::SeqIO->new('-format' => 'fasta', -fh => \*STDOUT);
31 # make a reverse complement sequence
33 $rev = $seq->revcom();
35 # the actual sequence is here
37 $actual_bases = $rev->seq();
39 print "Reversed sequence as a string is [$actual_bases]\n";
41 # we could also write it as fasta formatted output
43 $seqout->write_seq($rev);
45 # make a translation
47 $trans = $seq->translate();
49 print "Translated sequence!\n";
51 $seqout->write_seq($trans);