| 1 | =head1 LICENSE | ||
| 2 | |||
| 3 | See the NOTICE file distributed with this work for additional information | ||
| 4 | regarding copyright ownership. | ||
| 5 | |||
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 7 | you may not use this file except in compliance with the License. | ||
| 8 | You may obtain a copy of the License at | ||
| 9 | |||
| 10 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | |||
| 12 | Unless required by applicable law or agreed to in writing, software | ||
| 13 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 15 | See the License for the specific language governing permissions and | ||
| 16 | limitations under the License. | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | |||
| 21 | =head1 CONTACT | ||
| 22 | |||
| 23 | Please email comments or questions to the public Ensembl | ||
| 24 | developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. | ||
| 25 | |||
| 26 | Questions may also be sent to the Ensembl help desk at | ||
| 27 | <http://www.ensembl.org/Help/Contact>. | ||
| 28 | |||
| 29 | =cut | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | =head1 SYNOPSIS | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | =head1 METHODS | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | package Bio::EnsEMBL::Utils::VegaCuration::Gene; | ||
| 42 | $Bio::EnsEMBL::Utils::VegaCuration::Gene::VERSION = '114.0.0'; | ||
| 43 | use strict; | ||
| 44 | use warnings; | ||
| 45 | use vars qw(@ISA); | ||
| 46 | |||
| 47 | use Bio::EnsEMBL::Utils::ConversionSupport; | ||
| 48 | |||
| 49 | @ISA = qw(Bio::EnsEMBL::Utils::ConversionSupport); | ||
| 50 | |||
| 51 | |||
| 52 | =head2 find_gaps | ||
| 53 | |||
| 54 | Args : arrayref of B::E::Transcripts | ||
| 55 | Example : my $gaps = find_gaps($all_transcripts) | ||
| 56 | Description: identifies regions of a gene that are not covered by any transcript | ||
| 57 | Returntype : int | ||
| 58 | Exceptions : none | ||
| 59 | Caller : internal | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | sub find_gaps { | ||
| 64 | my $self = shift; | ||
| 65 | my ($all_transcripts) = @_; | ||
| 66 | my $gaps = 0; | ||
| 67 | my @sorted_transcripts = sort {$a->start <=> $b->start || $b->end <=> $a->end} @{$all_transcripts}; | ||
| 68 | if ( my $first_transcript = shift @sorted_transcripts ) { | ||
| 69 | my $pos = $first_transcript->end; | ||
| 70 | foreach my $transcript (@sorted_transcripts) { | ||
| 71 | next if ($transcript->end < $pos ); | ||
| 72 | if ($transcript->start < $pos && $transcript->end > $pos ) { | ||
| 73 | $pos = $transcript->end; | ||
| 74 | next; | ||
| 75 | } | ||
| 76 | elsif ($transcript->end > $pos) { | ||
| 77 | $gaps++; | ||
| 78 | $pos = $transcript->end; | ||
| 79 | } | ||
| 80 | } | ||
| 81 | } | ||
| 82 | return $gaps; | ||
| 83 | } |