The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bio::DasI - DAS-style access to a feature database

SYNOPSIS

  # Open up a feature database somehow...

  @segments = $db->segment(-name  => 'NT_29921.4',
                           -start => 1,
                           -end   => 1000000);

  # segments are Bio::DasSegmentI - compliant objects

  # fetch a list of features
  @features = $db->features(-type=>['type1','type2','type3']);

  # invoke a callback over features
  $db->features(-type=>['type1','type2','type3'],
                -callback => sub { ... }
                );

  $stream   = $db->get_seq_stream(-type=>['type1','type2','type3']);
  while (my $feature = $stream->next_seq) {
     # each feature is a Bio::SeqFeatureI-compliant object
  }

  # get all feature types
  @types   = $db->types;

  # count types
  %types   = $db->types(-enumerate=>1);

  @feature = $db->get_feature_by_name($name);
  @feature = $db->get_feature_by_id($id);
  @feature = $db->get_feature_by_target($target_name);
  @feature = $db->get_feature_by_attribute($att1=>$value1,$att2=>$value2);

  $error = $db->error;

DESCRIPTION

Bio::DasI is a simplified alternative interface to sequence annotation databases used by the distributed annotation system (see Bio::Das). In this scheme, the genome is represented as a series of features, a subset of which are named. Named features can be used as reference points for retrieving "segments" (see Bio::DasSegmentI), and these can, in turn, be used as the basis for exploring the genome further.

In addition to a name, each feature has a "class", which is essentially a namespace qualifier and a "type", which describes what type of feature it is. Das uses the GO consortium's ontology of feature types, and so the type is actually an object of class Bio::DasFeatureTypeI (see Bio::DasFeatureTypeI). Bio::DasI provides methods for interrogating the database for the types it contains and the counts of each type.

FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.

  bioperl-l@bio.perl.org

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via email or the web:

  bioperl-bugs@bio.perl.org
  http://bio.perl.org/bioperl-bugs/

AUTHOR - Lincoln Stein

Email lstein@cshl.org

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

types

 Title   : types
 Usage   : $db->types(@args)
 Function: return list of feature types in database
 Returns : a list of Bio::DasFeatureTypeI objects
 Args    : see below

This routine returns a list of feature types known to the database. It is also possible to find out how many times each feature occurs.

Arguments are -option=>value pairs as follows:

  -enumerate  if true, count the features

The returned value will be a list of Bio::DasFeatureTypeI objects (see Bio::DasFeatureTypeI.

If -enumerate is true, then the function returns a hash (not a hash reference) in which the keys are the stringified versions of Bio::DasFeatureTypeI and the values are the number of times each feature appears in the database.

segment

 Title   : segment
 Usage   : $db->segment(@args);
 Function: create a segment object
 Returns : segment object(s)
 Args    : see below

This method generates a Bio::DasSegmentI object (see Bio::DasSegmentI). The segment can be used to find overlapping features and the raw sequence.

When making the segment() call, you specify the ID of a sequence landmark (e.g. an accession number, a clone or contig), and a positional range relative to the landmark. If no range is specified, then the entire region spanned by the landmark is used to generate the segment.

Arguments are -option=>value pairs as follows:

 -name         ID of the landmark sequence.

 -class        A namespace qualifier.  It is not necessary for the
               database to honor namespace qualifiers, but if it
               does, this is where the qualifier is indicated.

 -version      Version number of the landmark.  It is not necessary for
               the database to honor versions, but if it does, this is
               where the version is indicated.

 -start        Start of the segment relative to landmark.  Positions
               follow standard 1-based sequence rules.  If not specified,
               defaults to the beginning of the landmark.

 -end          End of the segment relative to the landmark.  If not specified,
               defaults to the end of the landmark.

The return value is a list of Bio::DasSegmentI objects. If the method is called in a scalar context and there are no more than one segments that satisfy the request, then it is allowed to return the segment. Otherwise, the method must throw a "multiple segment exception".

features

 Title   : features
 Usage   : $db->features(@args)
 Function: get all features, possibly filtered by type
 Returns : a list of Bio::SeqFeatureI objects
 Args    : see below
 Status  : public

This routine will retrieve features in the database regardless of position. It can be used to return all features, or a subset based on their type

Arguments are -option=>value pairs as follows:

  -types     List of feature types to return.  Argument is an array
             of Bio::DasFeatureTypeI objects.

  -callback   A callback to invoke on each feature.  The subroutine
              will be passed each Bio::SeqFeatureI object in turn.

  -attributes A hash reference containing attributes to match.

The -attributes argument is a hashref containing one or more attributes to match against:

  -attributes => { Gene => 'abc-1',
                   Note => 'confirmed' }

Attribute matching is simple exact string matching, and multiple attributes are ANDed together. See Bio::DB::ConstraintsI for a more sophisticated take on this.

If one provides a callback, it will be invoked on each feature in turn. If the callback returns a false false value, iteration will be interrupted. When a callback is provided, the method returns undef.

get_seq_stream

 Title   : get_seq_stream
 Usage   : my $seqio = $self->get_seq_sream(@args)
 Function: Performs a query and returns an iterator over it
 Returns : a Bio::SeqIO stream capable of returning Bio::DasSegmentI objects
 Args    : As in features()
 Status  : public

This routine takes the same arguments as features(), but returns a Bio::SeqIO::Stream-compliant object. Use it like this:

  $stream = $db->get_seq_stream('exon');
  while (my $exon = $stream->next_seq) {
     print $exon,"\n";
  }

NOTE: In the interface this method is aliased to get_feature_stream(), as the name is more descriptive.