| 1 | =head1 NAME | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | Bio::DB::GFF::Aggregator::alignment -- Alignment aggregator | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | use Bio::DB::GFF; | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # Open the sequence database | ||||||||||||||||||||||||||||
| 10 | my $db = Bio::DB::GFF->new( -adaptor => 'dbi:mysql', | ||||||||||||||||||||||||||||
| 11 | -dsn => 'dbi:mysql:elegans42', | ||||||||||||||||||||||||||||
| 12 | -aggregator => ['alignment'], | ||||||||||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | ----------------------------- | ||||||||||||||||||||||||||||
| 16 | Aggregator method: alignment | ||||||||||||||||||||||||||||
| 17 | Main method: (none) | ||||||||||||||||||||||||||||
| 18 | Sub methods: nucleotide_match,EST_match,cDNA_match,expressed_sequence_match, | ||||||||||||||||||||||||||||
| 19 | translated_nucleotide_match,protein_match,HSP | ||||||||||||||||||||||||||||
| 20 | ----------------------------- | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | Bio::DB::GFF::Aggregator::alignment is one of the default aggregators, | ||||||||||||||||||||||||||||
| 25 | and was written to be compatible with the C elegans GFF files. It | ||||||||||||||||||||||||||||
| 26 | aggregates raw "similarity" features into composite features of type | ||||||||||||||||||||||||||||
| 27 | "alignment". A better name for this class might be | ||||||||||||||||||||||||||||
| 28 | "gapped_alignment." | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | This aggregator does not insist that there be a single top-level | ||||||||||||||||||||||||||||
| 31 | feature that spans one end of the alignment to the other. As a | ||||||||||||||||||||||||||||
| 32 | result, it can produce truncated alignments if the entire alignment is | ||||||||||||||||||||||||||||
| 33 | not contained within the segment of interest. | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | =cut | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | package Bio::DB::GFF::Aggregator::alignment; | ||||||||||||||||||||||||||||
| 38 | 1 | $Bio::DB::GFF::Aggregator::alignment::VERSION = '1.7.4'; | |||||||||||||||||||||||||||
| 39 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | ▶ | use base qw(Bio::DB::GFF::Aggregator); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =head2 aggregate | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | Title : aggregate | ||||||||||||||||||||||||||||
| 47 | Usage : $features = $a->aggregate($features,$factory) | ||||||||||||||||||||||||||||
| 48 | Function: aggregate a feature list into composite features | ||||||||||||||||||||||||||||
| 49 | Returns : an array reference containing modified features | ||||||||||||||||||||||||||||
| 50 | Args : see L<Bio::DB::GFF::Aggregator> | ||||||||||||||||||||||||||||
| 51 | Status : Public | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | Because of the large number of similarity features, the aggregate() | ||||||||||||||||||||||||||||
| 54 | method is overridden in order to perform some optimizations. | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =cut | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # we look for features of type Sequence and add them to a pseudotype transcript | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub aggregate { | ||||||||||||||||||||||||||
|
Subroutine
aggregate: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||
| 60 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 61 | 0 | my $features = shift; | |||||||||||||||||||||||||||
| 62 | 0 | my $factory = shift; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | my $matchsub = $self->match_sub($factory) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 0 | my $passthru = $self->passthru_sub($factory); | |||||||||||||||||||||||||||
| 66 | 0 | my $method = $self->get_method; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | my (%alignments,%targets,@result); | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | warn "running alignment aggregator" if $factory->debug; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | for my $feature (@$features) { | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ($matchsub->($feature)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | my $group = $feature->{group}; | |||||||||||||||||||||||||||
| 76 | 0 | my $source = $feature->source; | |||||||||||||||||||||||||||
| 77 | 0 | ▶ | unless (exists $alignments{$group,$source}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 0 | my $type = Bio::DB::GFF::Typename->new($method,$source); | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 0 | my $f = $feature->clone; | |||||||||||||||||||||||||||
| 81 | # this is a violation of OO encapsulation, but need to do it this way | ||||||||||||||||||||||||||||
| 82 | # to achieve desired performance | ||||||||||||||||||||||||||||
| 83 | 0 | @{$f}{qw(type score phase)} = ($type,undef,undef); | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $alignments{$group,$source} = $f or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | my $main = $alignments{$group,$source}; | |||||||||||||||||||||||||||
| 89 | 0 | $main->add_subfeature($feature); | |||||||||||||||||||||||||||
| 90 | 0 | ▶ | push @result,$feature if $passthru && $passthru->($feature); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$passthru and &$passthru($feature)
MC/DC0%0/2
$passthru and &$passthru($feature)
$passthru
&$passthru($feature)
Truth table0%0/3
A and B
A= $passthruB= &$passthru($feature)
| |||||||||||||||||||||||||||||
| 91 | } else { | ||||||||||||||||||||||||||||
| 92 | 0 | push @result,$feature; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | warn "running aligner adjuster" if $factory->debug; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 0 | for my $alignment (values %alignments) { | |||||||||||||||||||||||||||
| 98 | 0 | $alignment->adjust_bounds; | |||||||||||||||||||||||||||
| 99 | 0 | $alignment->compound(1); | |||||||||||||||||||||||||||
| 100 | 0 | push @result,$alignment; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | 0 | ▶ | warn "aligner done" if $factory->debug; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 0 | @$features = @result; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =head2 method | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | Title : method | ||||||||||||||||||||||||||||
| 109 | Usage : $aggregator->method | ||||||||||||||||||||||||||||
| 110 | Function: return the method for the composite object | ||||||||||||||||||||||||||||
| 111 | Returns : the string "alignment" | ||||||||||||||||||||||||||||
| 112 | Args : none | ||||||||||||||||||||||||||||
| 113 | Status : Public | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =cut | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | ▶ | sub method { 'alignment' } | ||||||||||||||||||||||||||
|
Subroutine
method: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =head2 part_names | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | Title : part_names | ||||||||||||||||||||||||||||
| 122 | Usage : $aggregator->part_names | ||||||||||||||||||||||||||||
| 123 | Function: return the methods for the sub-parts | ||||||||||||||||||||||||||||
| 124 | Returns : the full list of aggregated methods | ||||||||||||||||||||||||||||
| 125 | Args : none | ||||||||||||||||||||||||||||
| 126 | Status : Public | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | =cut | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub part_names { | ||||||||||||||||||||||||||
|
Subroutine
part_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 131 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 132 | 0 | return qw(nucleotide_match EST_match cDNA_match | |||||||||||||||||||||||||||
| 133 | expressed_sequence_match | ||||||||||||||||||||||||||||
| 134 | translated_nucleotide_match | ||||||||||||||||||||||||||||
| 135 | protein_match HSP); | ||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 1 | 1; | |||||||||||||||||||||||||||