[Bioperl-l] getting DNA sequence for exon features from GFF

kanmani radha kanmaninradha at gmail.com
Thu Aug 26 08:29:08 UTC 2010


Hi All,
I would like to get the DNA seq from GFF file. I'm using Bio::Tools::GFF
module. I could get everything else but not the DNA seq.

Can anyone help me to find this out, Please. I appreciate your help very
much.
thanks,
Kanmani

#!/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