| 1 | =head1 NAME | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | Bio::DB::GFF::Aggregator::clone -- Clone 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 => ['transcript','clone'], | ||||||||||||||||||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||
| 15 | ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 16 | Aggregator method: clone | ||||||||||||||||||||||||||||||||||||
| 17 | Main method: -none- | ||||||||||||||||||||||||||||||||||||
| 18 | Sub methods: Clone_left_end Clone_right_end region:Genomic_canonical | ||||||||||||||||||||||||||||||||||||
| 19 | ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||
| 21 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||
| 23 | Bio::DB::GFF::Aggregator::clone is one of the default aggregators, and | ||||||||||||||||||||||||||||||||||||
| 24 | was written to be compatible with the C elegans GFF files. It | ||||||||||||||||||||||||||||||||||||
| 25 | aggregates raw "Clone_left_end", "Clone_right_end", and | ||||||||||||||||||||||||||||||||||||
| 26 | "region:Genomic_canonical" features into composite features of type | ||||||||||||||||||||||||||||||||||||
| 27 | "clone". | ||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||
| 31 | package Bio::DB::GFF::Aggregator::clone; | ||||||||||||||||||||||||||||||||||||
| 32 | 1 | $Bio::DB::GFF::Aggregator::clone::VERSION = '1.7.4'; | |||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | use base qw(Bio::DB::GFF::Aggregator); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||
| 38 | =head2 aggregate | ||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||
| 40 | Title : aggregate | ||||||||||||||||||||||||||||||||||||
| 41 | Usage : $features = $a->aggregate($features,$factory) | ||||||||||||||||||||||||||||||||||||
| 42 | Function: aggregate a feature list into composite features | ||||||||||||||||||||||||||||||||||||
| 43 | Returns : an array reference containing modified features | ||||||||||||||||||||||||||||||||||||
| 44 | Args : see L<Bio::DB::GFF::Aggregator> | ||||||||||||||||||||||||||||||||||||
| 45 | Status : Public | ||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||
| 47 | The WormBase GFF model is unusual in that clones aren't identified as | ||||||||||||||||||||||||||||||||||||
| 48 | a single feature with start and stop positions, but as two features, a | ||||||||||||||||||||||||||||||||||||
| 49 | "left end" and a "right end". One or both of these features may be | ||||||||||||||||||||||||||||||||||||
| 50 | absent. In order to accommodate this, the aggregator will return undef | ||||||||||||||||||||||||||||||||||||
| 51 | for the start and/or stop if one or both of the ends are missing. | ||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||
| 53 | =cut | ||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||
| 55 | #' | ||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||
| 57 | # we look for features of type Sequence and add them to a pseudotype transcript | ||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub aggregate { | ||||||||||||||||||||||||||||||||||
|
Subroutine
aggregate: not called CC=17 SCAR=57.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 60 | 0 | my $features = shift; | |||||||||||||||||||||||||||||||||||
| 61 | 0 | my $factory = shift; | |||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | my $matchsub = $self->match_sub($factory) or return; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $passthru = $self->passthru_sub($factory); | |||||||||||||||||||||||||||||||||||
| 65 | 0 | my $method = $self->get_method; | |||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||
| 67 | 0 | my (%clones,%types,@result); | |||||||||||||||||||||||||||||||||||
| 68 | 0 | for my $feature (@$features) { | |||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if ($feature->group && $matchsub->($feature)) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$feature->group and &$matchsub($feature)
MC/DC0%0/2
$feature->group and &$matchsub($feature)
$feature->group
&$matchsub($feature)
Truth table0%0/3
A and B
A= $feature->groupB= &$matchsub($feature)
| |||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ($feature->method =~ /^region|Sequence$/ && $feature->source eq 'Genomic_canonical') { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$feature->method =~ /^region|Sequence$/ and $feature->source eq "Genomic_canonical"
MC/DC0%0/2
$feature->method =~ /^region|Sequence$/ and $feature->source eq "Genomic_canonical"
$feature->method =~ /^region|Sequence$/
$feature->source eq "Genomic_canonical"
Truth table0%0/3
A and B
A= $feature->method =~ /^region|Sequence$/B= $feature->source eq "Genomic_canonical"
| |||||||||||||||||||||||||||||||||||||
| 73 | 0 | $clones{$feature->group}{canonical} = $feature; | |||||||||||||||||||||||||||||||||||
| 74 | } elsif ($feature->method eq 'Clone_left_end') { | ||||||||||||||||||||||||||||||||||||
| 75 | 0 | $clones{$feature->group}{left} = $feature; | |||||||||||||||||||||||||||||||||||
| 76 | } elsif ($feature->method eq 'Clone_right_end') { | ||||||||||||||||||||||||||||||||||||
| 77 | 0 | $clones{$feature->group}{right} = $feature; | |||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||
| 79 | 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)
| |||||||||||||||||||||||||||||||||||||
| 80 | } else { | ||||||||||||||||||||||||||||||||||||
| 81 | 0 | push @result,$feature; | |||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||
| 85 | 0 | for my $clone (keys %clones) { | |||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | my $canonical = $clones{$clone}{canonical} or next; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||
| 88 | # the genomic_canonical doesn't tell us where the clone starts and stops | ||||||||||||||||||||||||||||||||||||
| 89 | # so don't assume it | ||||||||||||||||||||||||||||||||||||
| 90 | 0 | my $duplicate = $canonical->clone; # make a duplicate of the feature | |||||||||||||||||||||||||||||||||||
| 91 | # munge the method and source fields | ||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $source = $duplicate->source; | |||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | my $type = $types{$method,$source} ||= Bio::DB::GFF::Typename->new($method,$source); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$types{join $;, $method, $source} ||= "Bio::DB::GFF::Typename"->new($method, $source)
MC/DC0%0/2
$types{join $;, $method, $source} ||= "Bio::DB::GFF::Typename"->new($method, $source)
$types{join $;, $method, $source}
"Bio::DB::GFF::Typename"->new($method, $source)
Truth table0%0/3
A ||= B
A= $types{join $;, $method, $source}B= "Bio::DB::GFF::Typename"->new($method, $source)
| |||||||||||||||||||||||||||||||||||||
| 94 | 0 | $duplicate->type($type); | |||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | my ($start,$stop) = $duplicate->strand > 0 ? ('start','stop') : ('stop','start'); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 97 | 0 | @{$duplicate}{$start,$stop} =(undef,undef); | |||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | $duplicate->{$start} = $clones{$clone}{left}{$start} if exists $clones{$clone}{left}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $duplicate->{$stop} = $clones{$clone}{right}{$stop} if exists $clones{$clone}{right}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 101 | 0 | $duplicate->method($self->method); | |||||||||||||||||||||||||||||||||||
| 102 | 0 | push @result,$duplicate; | |||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||
| 105 | 0 | @$features = @result; | |||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||
| 108 | =head2 method | ||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||
| 110 | Title : method | ||||||||||||||||||||||||||||||||||||
| 111 | Usage : $aggregator->method | ||||||||||||||||||||||||||||||||||||
| 112 | Function: return the method for the composite object | ||||||||||||||||||||||||||||||||||||
| 113 | Returns : the string "clone" | ||||||||||||||||||||||||||||||||||||
| 114 | Args : none | ||||||||||||||||||||||||||||||||||||
| 115 | Status : Public | ||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||
| 117 | =cut | ||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub method { 'clone' } | ||||||||||||||||||||||||||||||||||
|
Subroutine
method: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||
| 121 | =head2 part_names | ||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||
| 123 | Title : part_names | ||||||||||||||||||||||||||||||||||||
| 124 | Usage : $aggregator->part_names | ||||||||||||||||||||||||||||||||||||
| 125 | Function: return the methods for the sub-parts | ||||||||||||||||||||||||||||||||||||
| 126 | Returns : the list ("Clone_left_end", "Clone_right_end", "region:Genomic_canonical") | ||||||||||||||||||||||||||||||||||||
| 127 | Args : none | ||||||||||||||||||||||||||||||||||||
| 128 | Status : Public | ||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||
| 130 | =cut | ||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | sub part_names { | ||||||||||||||||||||||||||||||||||
|
Subroutine
part_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 134 | 0 | return qw(Clone_left_end Clone_right_end region:Genomic_canonical Sequence:Genomic_canonical); | |||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||
| 137 | 1 | 1; | |||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||
| 139 | __END__ | ||||||||||||||||||||||||||||||||||||