Summary | Included libraries | Package variables | Synopsis | Description | General documentation | Methods |
WebCvs | Raw content |
use Bio::DB::GFF;
my $agg1 = Bio::DB::GFF::Aggregator->new(-method => 'cistron', -main_method => 'locus', -sub_parts => ['allele','variant'] ); my $agg2 = Bio::DB::GFF::Aggregator->new(-method => 'splice_group', -sub_parts => 'transcript'); my $db = Bio::DB::GFF->new( -adaptor => 'dbi:mysql', -aggregator => [$agg1,$agg2], -dsn => 'dbi:mysql:elegans42', );
package Bio::DB::GFF::Aggregator::mutant;Once installed, this aggregator can be passed to Bio::DB::GFF->new()
use strict; use Bio::DB::GFF::Aggregator; use vars '@ISA'; @ISA = 'Bio::DB::GFF::Aggregator'; sub method { 'mutant' } sub part_names { return qw(allele polymorphism); } 1;
my $db = Bio::DB::GFF->new( -adaptor => 'dbi:mysql',
-aggregator => 'mutant',
-dsn => 'dbi:mysql:elegans42',
);
aggregate | Description | Code |
clone | No description | Code |
component_count | No description | Code |
components | Description | Code |
disaggregate | Description | Code |
get_main_name | Description | Code |
get_method | Description | Code |
get_part_names | Description | Code |
main_name | Description | Code |
match_sub | Description | Code |
method | Description | Code |
new | Description | Code |
part_names | Description | Code |
passthru | No description | Code |
passthru_sub | No description | Code |
require_whole_object | Description | Code |
aggregate | code | next | Top |
Title : aggregateThis method is called to aggregate a list of raw GFF features into the set of composite features. The method is called an array reference to a set of Bio::DB::GFF::Feature objects. It runs through the list, creating new composite features when appropriate. The method result is an array reference containing the composite features. Arguments: $features reference to an array of Bio::DB::GFF::Feature objectsNOTE: The reason that the function result contains the raw features as well as the aggregated ones is to allow queries like this one: @features = $segment->features('exon','transcript:curated');Assuming that "transcript" is the name of an aggregated feature and that "exon" is one of its components, we do not want the transcript aggregator to remove features of type "exon" because the user asked for them explicitly. |
components | code | prev | next | Top |
Title : componentsThis method is used internally to remember the parsed list of raw features that we will aggregate. The need for this subroutine is seen when a user requests a composite feature of type "clone:cosmid". This generates a list of components in which the source is appended to the method, like "clone_left_end:cosmid" and "clone_right_end:cosmid". components() stores this information for later use. |
disaggregate | code | prev | next | Top |
Title : disaggregateThis method is called to disaggregate a list of types into the set of low-level features to be retrieved from the GFF database. The list of types is passed as an array reference containing a series of [method,source] pairs. This method synthesizes a new set of [method,source] pairs, and appends them to the list of requested types, changing the list in situ. Arguments: $types reference to an array of [method,source] pairsNote that the API allows disaggregate() to remove types from the type list. This feature is probably not desirable and may be deprecated in the future. |
get_main_name | code | prev | next | Top |
Title : get_main_nameThis method is used internally to fetch the type of the "main part" of the feature. It checks instance variables first, and if not defined calls the main_name() method. |
get_method | code | prev | next | Top |
Title : get_methodThis method is used internally to fetch the type of the method that will be assigned to the composite feature once it is synthesized. |
get_part_names | code | prev | next | Top |
Title : get_part_namesThis method is used internally to fetch the list of feature types that form the components of the composite feature. Type names in the format "method:source" are recognized, as are "method" and Bio::DB::GFF::Typename objects as well. It checks instance variables first, and if not defined calls the part_names() method. |
main_name | code | prev | next | Top |
Title : main_nameThis method is called to get the method of the "main component" of the composite feature. It is called if the user did not explicitly supply a -main-method argument when the aggregator was created. This is the method that should be overridden in aggregator subclasses. |
match_sub | code | prev | next | Top |
Title : match_subThis method is used internally to generate a code sub that will quickly filter out the raw features that we're interested in aggregating. The returned sub accepts a Feature and returns true if we should aggregate it, false otherwise. |
method | code | prev | next | Top |
Title : methodThis method is called to get the method to be assigned to the composite feature once it is aggregated. It is called if the user did not explicitly supply a -method argument when the aggregator was created. This is the method that should be overridden in aggregator subclasses. |
new | code | prev | next | Top |
Title : newThis is the constructor for Bio::DB::GFF::Aggregator. Named arguments are as follows: -method the method for the composite feature |
part_names | code | prev | next | Top |
Title : part_namesThis method is called to get the list of methods of the "main component" of the composite feature. It is called if the user did not explicitly supply a -main-method argument when the aggregator was created. This is the method that should be overridden in aggregator subclasses. |
require_whole_object | code | prev | next | Top |
Title : require_whole_objectThis method returns true if the aggregator should refuse to aggregate an object unless both its main part and its subparts are present. |
aggregate | description | prev | next | Top |
my $self = shift; my $features = shift; my $factory = shift; my $main_method = $self->get_main_name; my $matchsub = $self->match_sub($factory) or return; my $passthru = $self->passthru_sub($factory); my (%aggregates,@result); for my $feature (@$features) { if ($feature->group && $matchsub->($feature)) { if ($main_method && lc $feature->method eq lc $main_method) { $aggregates{$feature->group,$feature->refseq}{base} ||= $feature->clone; } else { push @{$aggregates{$feature->group,$feature->refseq}{subparts}},$feature; } push @result,$feature if $passthru && $passthru->($feature); } else { push @result,$feature; } } # aggregate components}
my $pseudo_method = $self->get_method; my $require_whole_object = $self->require_whole_object; foreach (keys %aggregates) { if ($require_whole_object && $self->components) { next unless $aggregates{$_}{base} && $aggregates{$_}{subparts}; } my $base = $aggregates{$_}{base}; unless ($base) { # no base, so create one
my $first = $aggregates{$_}{subparts}[0]; $base = $first->clone; # to inherit parent coordinate system, etc
$base->score(undef); $base->phase(undef); } $base->method($pseudo_method); $base->add_subfeature($_) foreach @{$aggregates{$_}{subparts}}; $base->adjust_bounds; $base->compound(1); # set the compound flag
push @result,$base; } @$features = @result;
clone | description | prev | next | Top |
my $self = shift; my %new = %{$self}; return bless\% new,ref($self);}
component_count | description | prev | next | Top |
my @c = shift->components; scalar @c;}
components | description | prev | next | Top |
my $self = shift; my $d = $self->{components}; $self->{components} = shift if @_; return unless ref $d; return wantarray ? @$d : $d;}
disaggregate | description | prev | next | Top |
my $self = shift; my $types = shift; my $factory = shift; my $sub_features = $factory->parse_types($self->get_part_names); my $main_feature = $factory->parse_types($self->get_main_name); if (@$types) { my (@synthetic_types,@unchanged); foreach (@$types) { my ($method,$source) = @$_; if (lc $method eq lc $self->get_method) { # e.g. "transcript"}
push @synthetic_types,map { [$_->[0],$_->[1] || $source] } @$sub_features,@$main_feature; } else { push @unchanged,$_; } } # remember what we're searching for
$self->components(\@synthetic_types); $self->passthru(\@unchanged); @$types = (@unchanged,@synthetic_types); } # we get here when no search types are listed
else { my @stypes = map { [$_->[0],$_->[1]] } @$sub_features,@$main_feature; $self->components(\@stypes); $self->passthru(undef); } return $self->component_count > 0;
get_main_name | description | prev | next | Top |
my $self = shift; return $self->{main_method} if defined $self->{main_method}; return $self->main_name;}
get_method | description | prev | next | Top |
my $self = shift; return $self->{method} if defined $self->{method}; return $self->method; } 1;}
get_part_names | description | prev | next | Top |
my $self = shift; if ($self->{sub_parts}) { return ref $self->{sub_parts} ? @{$self->{sub_parts}} : $self->{sub_parts}; } else { return $self->part_names; }}
main_name | description | prev | next | Top |
my $self = shift; return;}
match_sub | description | prev | next | Top |
my $self = shift; my $factory = shift; my $types_to_aggregate = $self->components() or return; # saved from disaggregate call}
return unless @$types_to_aggregate; return $factory->make_match_sub($types_to_aggregate);
method | description | prev | next | Top |
my $self = shift; return;}
new | description | prev | next | Top |
my $class = shift; my ($method,$main,$sub_parts) = rearrange(['METHOD', ['MAIN_PART','MAIN_METHOD'], ['SUB_METHODS','SUB_PARTS'] ],@_); return bless { method => $method, main_method => $main, sub_parts => $sub_parts, },$class;}
part_names | description | prev | next | Top |
my $self = shift; return;}
passthru | description | prev | next | Top |
my $self = shift; my $d = $self->{passthru}; $self->{passthru} = shift if @_; return unless ref $d; return wantarray ? @$d : $d;}
passthru_sub | description | prev | next | Top |
my $self = shift; my $factory = shift; my $passthru = $self->passthru() or return; return unless @$passthru; return $factory->make_match_sub($passthru);}
require_whole_object | description | prev | next | Top |
0;}
API | Top |
BUGS | Top |
SEE ALSO | Top |
AUTHOR | Top |