[Bioperl-l] Bio::Tools:GFF to get DNA sequences...

kanmani kanmaninradha at gmail.com
Thu Aug 26 04:23:28 EDT 2010


Hi I am trying to get the DNA sequences for each exon feature. I have
the following script. Everything works except getting sequences. Can
some one correct me.....Thanks.

#!/usr/bin/perl

use strict;
use warnings;
use Bio::Tools::GFF;


my $file = shift;
my $gffio = Bio::Tools::GFF->new(-file => $file, -gff_version => 3);
$gffio->features_attached_to_seqs(1);

while (my $feat = $gffio->next_feature()){
    my $start = $feat->start;
    my $end= $feat->end;
    my $size = $end-$start+1;
    my $strand = $feat->strand;
    my $seqid = $feat->seq_id;
    my $score = $feat->score;
    my $frame = $feat->frame;
    my $source = $feat->source_tag;
    my $type = $feat->primary_tag;
    my $gffstr = $gffio->gff_string($feat);
    my @alltags = $feat->all_tags();
    my @ID_tag_value = $feat->each_tag_value("ID");

   my  $seq = $feat->seq();
   print "$seq\n";

  if($type eq "gene"){
       print "@ID_tag_value\t$size\t$type\t$start\t$end\n";
    }
}



More information about the Bioperl-l mailing list