Author image Lincoln D. Stein
and 1 contributors


Bio::Das::Segment - Serial access to Bio::Das sequence "segments"


   my $das = Bio::Das->new(-server => '',
                           -dsn    => 'elegans',
                           -aggregators => ['primary_transcript','clone']);
   my $segment  = $das->segment('Chr1');
   my @features = $segment->features;
   my $dna      = $segment->dna;


The Bio::Das::Segment class is used to retrieve information about a genomic segment from a DAS server. You may retrieve a list of (optionally filtered) annotations on the segment, a summary of the feature types available across the segment, or the segment's DNA sequence.


Bio::Das::Segment objects are created by calling the segment() method of a Bio::Das object created earlier. See Bio::Das for details.


Once created, a number of methods allow you to query the segment for its features and/or DNA.

$ref= $segment->ref

Return the reference point that establishes the coordinate system for this segment, e.g. "chr1".

$start = $segment->start

Return the starting coordinate of this segment.

$end = $segment->end

Return the ending coordinate of this segment.

@features = $segment->features(@filter)
@features = $segment->features(-type=>$type,-category=>$category)

The features() method returns annotations across the length of the segment. Two forms of this method are recognized. In the first form, the @filter argument contains a series of category names to retrieve. Each category may be further qualified by a regular expression which will be used to filter features by their type ID. Filters have the format "category:typeID", where the category and type are separated by a colon. The typeID and category names are treated as an unanchored regular expression (but see the note below). As a special cse, you may use a type of "transcript" to fetch composite transcript model objects (the union of exons, introns and cds features).

Example 1: retrieve all the features in the "similarity" and "experimental" categories:

  @features = $segment->features('similarity','experimental');

Example 2: retrieve all the similarity features of type EST_elegans and EST_GENOME:

  @features = $segment->features('similarity:EST_elegans','similarity:EST_GENOME');

Example 3: retrieve all similarity features that have anything to do with ESTs:

  @features = $segment->features('similarity:EST');

Example 4: retrieve all the transcripts and experimental data

  @genes = $segment->features('transcript','experimental')

In the second form, the type and categories are given as named arguments. You may use regular expressions for either typeID or category. It is also possible to pass an array reference for either argument, in which case the DAS server will return the union of the features.

Example 5: retrieve all the features in the "similarity" and "experimental" categories:

  @features = $segment->features(-category=>['similarity','experimental']);

Example 6: retrieve all the similarity features of type EST_elegans and EST_GENOME:

  @features = $segment->features(-category=>'similarity',
                                 -type    =>/^EST_(elegans|GENOME)$/
$dna = $segment->dna

Return the DNA corresponding to the segment. The return value is a simple string, and not a Bio::Sequence object. This method may return undef when used with a DAS annotation server that does not maintain a copy of the DNA.

@types = $segment->types
$count = $segment->types($type)

This methods summarizes the feature types available across this segment. The items in this list can be used as arguments to features().

Called with no arguments, this method returns an array of Das::Segment::Type objects. See the manual page for details. Called with a TypeID, the method will return the number of instances of the named type on the segment, or undef if the type is invalid. Because the list and count of types is cached, there is no penalty for invoking this method several times.


Lincoln Stein <>.

Copyright (c) 2003 Cold Spring Harbor Laboratory

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.