#!/usr/bin/perl -w use strict; use Bio::Seq; use Bio::SeqIO; my $seqstr = 'ATTGATAGATCC'; my $id = 'Number1'; # Initialize a sequence object my $seq = Bio::Seq->new(-seq=> $seqstr, -id => $id); # Let's print some stuff # print the Sequence Id print $seq->display_id, "\n"; print $seq->seq, "\n"; print $seq->alphabet, "\n"; my $revcom = $seq->revcom; print $revcom->seq, " is reverse complement\n"; my $protein = $seq -> translate; print "protein is $protein\n"; print "protein sequence is ", $protein->seq, "\n"; $protein->display_id('ProteinNumber1'); print $protein->alphabet, "\n"; print "protein id ", $protein->display_id, "\n"; my $writer = Bio::SeqIO->new(-file => ">mysequence.fas", -format => 'fasta'); $writer->write_seq($protein); $writer->write_seq($seq);