Archive Ensembl HomeArchive Ensembl Home
Gene.pm
Go to the documentation of this file.
00001 =head1 LICENSE
00002 
00003   Copyright (c) 1999-2012 The European Bioinformatics Institute and
00004   Genome Research Limited.  All rights reserved.
00005 
00006   This software is distributed under a modified Apache license.
00007   For license details, please see
00008 
00009     http://www.ensembl.org/info/about/code_licence.html
00010 
00011 =head1 CONTACT
00012 
00013   Please email comments or questions to the public Ensembl
00014   developers list at <dev@ensembl.org>.
00015 
00016   Questions may also be sent to the Ensembl help desk at
00017   <helpdesk@ensembl.org>.
00018 
00019 =cut
00020 
00021 =head1 NAME
00022 
00023 =head1 SYNOPSIS
00024 
00025 =head1 DESCRIPTION
00026 
00027 =head1 METHODS
00028 
00029 =cut
00030 
00031 package Bio::EnsEMBL::Utils::VegaCuration::Gene;
00032 
00033 use strict;
00034 use warnings;
00035 use vars qw(@ISA);
00036 
00037 use Bio::EnsEMBL::Utils::ConversionSupport;
00038 
00039 @ISA = qw(Bio::EnsEMBL::Utils::ConversionSupport);
00040 
00041 
00042 =head2 find_gaps
00043 
00044    Args       : arrayref of B::E::Transcripts
00045    Example    : my $gaps = find_gaps($all_transcripts)
00046    Description: identifies regions of a gene that are not covered by any transcript
00047    Returntype : int
00048    Exceptions : none
00049    Caller     : internal
00050 
00051 =cut
00052 
00053 sub find_gaps {
00054   my $self = shift;
00055   my ($all_transcripts) = @_;
00056   my $gaps = 0;
00057   my @sorted_transcripts = sort {$a->start <=> $b->start || $b->end <=> $a->end} @{$all_transcripts};
00058   if ( my $first_transcript = shift @sorted_transcripts ) {
00059     my $pos = $first_transcript->end;
00060     foreach my $transcript (@sorted_transcripts) {
00061       next if ($transcript->end < $pos );
00062       if ($transcript->start < $pos && $transcript->end > $pos ) {
00063     $pos = $transcript->end;            
00064     next;
00065       }
00066       elsif ($transcript->end > $pos) {
00067     $gaps++;
00068     $pos = $transcript->end;
00069       }
00070     }
00071   }
00072   return $gaps;     
00073 }