File: rev_and_trans.pl

package info (click to toggle)
bioperl 1.7.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 35,788 kB
  • sloc: perl: 94,019; xml: 14,811; makefile: 20
file content (52 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/perl

# PROGRAM  : rev_and_trans.pl
# PURPOSE  : Simple driver for Bio::Seq revcom and translate
# AUTHOR   : Ewan Birney birney@sanger.ac.uk 
# CREATED  : Tue Oct 27 1998
#
# INSTALLATION
#    If you have installed bioperl using the standard
#    makefile system everything should be fine and 
#    dandy.
#
#    if not edit the use lib "...." line to point the directory
#    containing your Bioperl modules.
#


use Bio::Seq;
use Bio::SeqIO;

# new sequence from raw memory...
# it is *very* important to get the type right so it
# is translated correctly.

$seq = Bio::Seq->new ( -id => "myseq",
		      -seq => "CGCCGAAGAAGCATCGTTAAAGTCTCTCTTCACCCTGCCGTCATGTCTAAGTCAGAGTCTCCT",
		      -type => 'Dna');

$seqout = Bio::SeqIO->new('-format' => 'fasta', -fh => \*STDOUT);

# make a reverse complement sequence

$rev = $seq->revcom();

# the actual sequence is here

$actual_bases = $rev->seq();

print "Reversed sequence as a string is [$actual_bases]\n";

# we could also write it as fasta formatted output

$seqout->write_seq($rev);

# make a translation

$trans = $seq->translate();

print "Translated sequence!\n";

$seqout->write_seq($trans);