comparison variant_effect_predictor/Bio/EnsEMBL/Utils/VegaCuration/Gene.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1 =head1 LICENSE
2
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and
4 Genome Research Limited. All rights reserved.
5
6 This software is distributed under a modified Apache license.
7 For license details, please see
8
9 http://www.ensembl.org/info/about/code_licence.html
10
11 =head1 CONTACT
12
13 Please email comments or questions to the public Ensembl
14 developers list at <dev@ensembl.org>.
15
16 Questions may also be sent to the Ensembl help desk at
17 <helpdesk@ensembl.org>.
18
19 =cut
20
21 =head1 NAME
22
23 =head1 SYNOPSIS
24
25 =head1 DESCRIPTION
26
27 =head1 METHODS
28
29 =cut
30
31 package Bio::EnsEMBL::Utils::VegaCuration::Gene;
32
33 use strict;
34 use warnings;
35 use vars qw(@ISA);
36
37 use Bio::EnsEMBL::Utils::ConversionSupport;
38
39 @ISA = qw(Bio::EnsEMBL::Utils::ConversionSupport);
40
41
42 =head2 find_gaps
43
44 Args : arrayref of B::E::Transcripts
45 Example : my $gaps = find_gaps($all_transcripts)
46 Description: identifies regions of a gene that are not covered by any transcript
47 Returntype : int
48 Exceptions : none
49 Caller : internal
50
51 =cut
52
53 sub find_gaps {
54 my $self = shift;
55 my ($all_transcripts) = @_;
56 my $gaps = 0;
57 my @sorted_transcripts = sort {$a->start <=> $b->start || $b->end <=> $a->end} @{$all_transcripts};
58 if ( my $first_transcript = shift @sorted_transcripts ) {
59 my $pos = $first_transcript->end;
60 foreach my $transcript (@sorted_transcripts) {
61 next if ($transcript->end < $pos );
62 if ($transcript->start < $pos && $transcript->end > $pos ) {
63 $pos = $transcript->end;
64 next;
65 }
66 elsif ($transcript->end > $pos) {
67 $gaps++;
68 $pos = $transcript->end;
69 }
70 }
71 }
72 return $gaps;
73 }