[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] BioPerl: Nucleic acids



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