[Omaha.pm] BioPerl: Nucleic acids

Jay Hannah jay at jays.net
Fri Feb 29 11:45:35 PST 2008


Just another little demo...

Read a GenBank file and print all the NA sequences which compose CDSs.


#!/usr/bin/perl

use strict;
use Bio::SeqIO;

my $io = Bio::SeqIO->new( -format => 'genbank',
                          -file   => 'AP008934.gbk');
my $seq;
while ( $seq = $io->next_seq() ) {
   foreach my $feat ( $seq->get_SeqFeatures ) {
      next unless ($feat->primary_tag eq "CDS");
      print $feat->spliced_seq->seq, "\n";
   }
}


spliced_seq is an amazing, magical beast.   :)


References:
http://www.bioperl.org/wiki/HOWTO:Feature-Annotation
http://www.bioperl.org/wiki/HOWTO:SeqIO


Cheers,

j



More information about the Omaha-pm mailing list