[Bioperl-l] GFF synopsis code question

Sean Davis sdavis2 at mail.nih.gov
Thu Mar 18 07:30:38 EST 2004

I have been learning to use Bio::DB::GFF and had a question about the
synopsis code from Bio::DB::GFF.  The section of code is:

-------From Synopsis-------
  # pull out all transcript features
  my @transcripts = $segment->features('transcript');

  # for each transcript, total the length of the introns
  my %totals;
  for my $t (@transcripts) {
    my @introns = $t->Intron;
    $totals{$t->name} += $_->length foreach @introns;

  # Sort the exons of the first transcript by position
  my @exons = sort {$a->start <=> $b->start} $transcripts[0]->Exon;

  # Get a region 1000 bp upstream of first exon
  my $upstream = $exons[0]->segment(-1000,0);

  # get its DNA
  my $dna = $upstream->dna;

It seems here that $exons[0] is a feature, so does not have a segment
method?  Instead, one can get the segment of interest by:

my $upstream = $db->segment($exons[0],-1000=>0)

Am I mistaken?  I only bring it up as a documentation issue, as the code I
give works for me.


More information about the Bioperl-l mailing list