Bio/SeqFeature/Gene/Intron.pm

filter: Statementstmt 54.1% 52 / 96 Branchbran 25.9% 14 / 54 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 70.0% 7 / 10 Podpod 100% 7 / 7 totaltotal 47.0% 81 / 172 CC 29 SCAR 38.0
CC
29
Cov
44%
acceptor_splice_site
90.0
donor_splice_site
90.0
location
6.6
CRAP 44.7
« Bio/SeqIO/tigrxml.pm ↑ Summary Bio/SearchIO/rnamotif.pm »
1 #
2 # BioPerl module for Bio::SeqFeature::Gene::Intron
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by David Block <dblock@gene.pbi.nrc.ca>
7 #
8 # Copyright David Block
9 #
10 # You may distribute this module under the same terms as perl itself
11  
12 # POD documentation - main docs before the code
13  
14 =head1 NAME
15  
16 Bio::SeqFeature::Gene::Intron - An intron feature
17  
18 =head1 SYNOPSIS
19  
20 Give standard usage here
21  
22 =head1 DESCRIPTION
23  
24 Describe the object here
25  
26 =head1 FEEDBACK
27  
28 =head2 Mailing Lists
29  
30 User feedback is an integral part of the evolution of this and other
31 Bioperl modules. Send your comments and suggestions preferably to
32 the Bioperl mailing list. Your participation is much appreciated.
33  
34 bioperl-l@bioperl.org - General discussion
35 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
36  
37 =head2 Support
38  
39 Please direct usage questions or support issues to the mailing list:
40  
41 I<bioperl-l@bioperl.org>
42  
43 rather than to the module maintainer directly. Many experienced and
44 reponsive experts will be able look at the problem and quickly
45 address it. Please include a thorough description of the problem
46 with code and data examples if at all possible.
47  
48 =head2 Reporting Bugs
49  
50 Report bugs to the Bioperl bug tracking system to help us keep track
51 of the bugs and their resolution. Bug reports can be submitted via the
52 web:
53  
54 https://github.com/bioperl/bioperl-live/issues
55  
56 =head1 AUTHOR - David Block
57  
58 Email dblock@gene.pbi.nrc.ca
59  
60 =head1 APPENDIX
61  
62 The rest of the documentation details each of the object methods.
63 Internal methods are usually preceded with a _
64  
65 =cut
66  
67  
68 # Let the code begin...
69  
70  
71 package Bio::SeqFeature::Gene::Intron;
72 10 $Bio::SeqFeature::Gene::Intron::VERSION = '1.7.8';
73 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
74  
75 10 ▶use Bio::SeqFeature::Gene::Exon;
Subroutine BEGIN: called CC=1 SCAR=0.0
76  
77 10 ▶use base qw(Bio::SeqFeature::Gene::NC_Feature);
Subroutine BEGIN: called CC=1 SCAR=0.0
78  
79 3 ▶sub new {
Subroutine new: called CC=4 SCAR=14.6
Pod documented
80 3 my($class,@args) = @_;
81  
82 # introns are non-coding by default
83 3 ▶ if(! grep { lc($_) eq '-is_coding'; } @args) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {lc $_ eq "-is_coding";} @args) 3 0 3
84 3 push(@args, '-is_coding', 0);
85 }
86 3 my $self = $class->SUPER::new(@args);
87  
88 3 my ($primary, $prim) =
89 $self->_rearrange([qw(PRIMARY PRIMARY_TAG)],@args);
90 3 ▶ $self->primary_tag('intron') unless $primary || $prim;
Branch: 1 branch
BranchTrueFalseTotal
unless $primary or $prim 0 3 3
Condition33%1/3
$primary or $prim
l!l&&r!l&&!r
300
MC/DC0%0/2
$primary or $prim
$primary $prim
Truth table33%1/3
A or B
A= $primaryB= $prim
ABresult
1X1
011
000
91  
92 3 return $self;
93 }
94  
95 =head2 upstream_Exon
96  
97 Title : upstream_Exon
98 Usage : $intron->upstream_Exon()
99 Function: exon upstream of the intron
100 Returns : Bio::EnsEMBL::Exon
101 Args :
102  
103 =cut
104  
105 6 ▶sub upstream_Exon {
Subroutine upstream_Exon: called CC=3 SCAR=11.0
Pod documented
106 6 my( $self, $exon ) = @_;
107
108 6 ▶ if ($exon) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exon) 3 3 6
109 3 $self->{'_intron_location'} = undef;
110 3 ▶ $self->throw("'$exon' is not a Bio::SeqFeature::Gene::ExonI")
Branch: 1 branch
BranchTrueFalseTotal
unless $exon->isa("Bio::SeqFeature::Gene::ExonI") 0 3 3
111 unless $exon->isa('Bio::SeqFeature::Gene::ExonI');
112 3 $self->{'_upstream_exon'} = $exon;
113 }
114 6 return $self->{'_upstream_exon'};
115 }
116  
117  
118 =head2 downstream_Exon
119  
120 Title : downstream_Exon
121 Usage : $intron->downstream_Exon()
122 Function: exon downstream of the intron
123 Returns : Bio::EnsEMBL::Exon
124 Args :
125  
126 =cut
127  
128 6 ▶sub downstream_Exon {
Subroutine downstream_Exon: called CC=3 SCAR=11.0
Pod documented
129 6 my( $self, $exon ) = @_;
130
131 6 ▶ if ($exon) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exon) 3 3 6
132 3 $self->{'_intron_location'} = undef;
133 3 ▶ $self->throw("'$exon' is not a Bio::SeqFeature::Gene::ExonI")
Branch: 1 branch
BranchTrueFalseTotal
unless $exon->isa("Bio::SeqFeature::Gene::ExonI") 0 3 3
134 unless $exon->isa('Bio::SeqFeature::Gene::ExonI');
135 3 $self->{'_downstream_exon'} = $exon;
136 }
137 6 return $self->{'_downstream_exon'};
138 }
139  
140 =head2 phase
141  
142 Title : phase
143 Usage : $intron->phase()
144 Function: returns the phase of the intron(where it interrupts the codon)
145 Returns : int(0,1,2)
146 Args :
147  
148 =cut
149  
150 0 ▶sub phase {
Subroutine phase: not called CC=1 SCAR=6.9
Pod documented
151 0 my ($self) = @_;
152 0 return $self->downstream_Exon->phase;
153 }
154  
155  
156 =head2 acceptor_splice_site
157  
158 Title : acceptor_splice_site
159 Usage : $intron->acceptor_splice_site(21,3)
160 Function: returns the sequence corresponding to the
161 consensus acceptor splice site. If start and
162 end are provided, it will number of base pairs
163 left and right of the canonical AG. Here 21 means
164 21 bp into intron and 3 means 3 bp into the exon.
165 --Intron--21----|AG|-3-----Exon
166 Defaults to 21,3
167  
168 Returns : Bio::Seq
169 Args : start and end
170  
171 =cut
172  
173 0 ▶sub acceptor_splice_site {
Subroutine acceptor_splice_site: not called CC=9 SCAR=45.0
Pod documented
174 0 my ($self,$ss_start,$ss_end) = @_;
175 0 ▶ $ss_start = 21 unless defined $ss_start;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ss_start 0 0 0
176 0 ▶ $ss_end = 3 unless defined $ss_end;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ss_end 0 0 0
177 0 ▶ if($self->strand < 0){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->strand < 0) 0 0 0
178 0 my $tmp= $ss_start;
179 0 $ss_start = $ss_end;
180 0 $ss_end = $tmp;
181 }
182 0 my $intron_end= $self->location->end;
183 0 my $down_exon = $self->downstream_Exon;
184 0 my $acceptor;
185 0 ▶ if($self->strand < 0){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->strand < 0) { } 0 0 0
186 0 ▶ $ss_start= $ss_start > $down_exon->length ? $down_exon->length: $ss_start;
Branch: 1 branch
BranchTrueFalseTotal
$ss_start > $down_exon->length ? : 0 0 0
187 0 ▶ $ss_end= $ss_end > $self->length-2 ? $self->length-2 : $ss_end;
Branch: 1 branch
BranchTrueFalseTotal
$ss_end > $self->length - 2 ? : 0 0 0
188 0 $acceptor = Bio::SeqFeature::Generic->new(-start=>$self->start - ($ss_start) ,
189 -end=>$self->start + ($ss_end+1),
190 -strand=>$self->strand,
191 -primary_tag=>"donor splice site");
192 }
193 else {
194 0 ▶ $ss_start = $ss_start > $self->length-2 ? $self->length-2 : $ss_start;
Branch: 1 branch
BranchTrueFalseTotal
$ss_start > $self->length - 2 ? : 0 0 0
195 0 ▶ $ss_end = $ss_end > $down_exon->length ? $down_exon->length : $ss_end;
Branch: 1 branch
BranchTrueFalseTotal
$ss_end > $down_exon->length ? : 0 0 0
196
197  
198 0 $acceptor = Bio::SeqFeature::Generic->new(-start=>$self->end - ($ss_start + 1),
199 -end=>$self->end + $ss_end,
200 -strand=>$self->strand,
201 -primary_tag=>"donor splice site");
202 }
203 0 $acceptor->attach_seq($self->entire_seq);
204  
205 0 return $acceptor;
206  
207 }
208  
209 =head2 donor_splice_site
210  
211 Title : donor_splice_site
212 Usage : $intron->donor_splice_site(3,6)
213 Function: returns the sequence corresponding to the
214 consensus donor splice site. If start and
215 end are provided, it will number of base pairs
216 left and right of the canonical GT. Here 3 means
217 3 bp into exon and 6 means 6 bp into the intron.
218 --Exon-3--|GT|-6----Intron-
219 Defaults to 3,6
220  
221 Returns : Bio::Seq
222 Args : start and end
223  
224 =cut
225  
226 0 ▶sub donor_splice_site {
Subroutine donor_splice_site: not called CC=9 SCAR=45.0
Pod documented
227 0 my ($self,$ss_start,$ss_end) = @_;
228 0 ▶ $ss_start = 3 unless defined $ss_start;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ss_start 0 0 0
229 0 ▶ $ss_end = 10 unless defined $ss_end;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ss_end 0 0 0
230 0 ▶ if($self->strand < 0){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->strand < 0) 0 0 0
231 0 my $tmp= $ss_start;
232 0 $ss_start = $ss_end;
233 0 $ss_end = $tmp;
234 }
235 0 my $up_exon = $self->upstream_Exon;
236 0 my $donor;
237 0 ▶ if($self->strand < 0){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->strand < 0) { } 0 0 0
238 0 ▶ $ss_end = $ss_end > $up_exon->length ? $up_exon->length : $ss_end;
Branch: 1 branch
BranchTrueFalseTotal
$ss_end > $up_exon->length ? : 0 0 0
239 0 ▶ $ss_start = $ss_start> $self->length -2 ? $self->length -2 : $ss_start;
Branch: 1 branch
BranchTrueFalseTotal
$ss_start > $self->length - 2 ? : 0 0 0
240 0 $donor = Bio::SeqFeature::Generic->new(-start=>$self->end - ($ss_start+1),
241 -end => $self->end + ($ss_end),
242 -strand=>$self->strand,
243 -primary_tag=>"acceptor splice site");
244 }
245 else {
246 0 ▶ $ss_start = $ss_start > $up_exon->length ? $up_exon->length : $ss_start;
Branch: 1 branch
BranchTrueFalseTotal
$ss_start > $up_exon->length ? : 0 0 0
247 0 ▶ $ss_end = $ss_end > $self->length -2 ? $self->length -2 : $ss_end;
Branch: 1 branch
BranchTrueFalseTotal
$ss_end > $self->length - 2 ? : 0 0 0
248 0 $donor = Bio::SeqFeature::Generic->new(-start=>$self->start - $ss_start,
249 -end => $self->start +($ss_end+1),
250 -strand=>$self->strand,
251 -primary_tag=>"acceptor splice site");
252 }
253 0 $donor->attach_seq($self->entire_seq);
254 0 return $donor;
255 }
256  
257 9 ▶sub location {
Subroutine location: called CC=6 SCAR=18.8
Pod documented
258 9 my( $self ) = @_;
259
260 9 ▶ unless ($self->{'_intron_location'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_intron_location"}) 3 6 9
261 3 my $loc = Bio::Location::Simple->new;
262
263 3 my $up_exon = $self->upstream_Exon;
264 3 my $down_exon = $self->downstream_Exon;
265
266 # Get the PrimarySeqs attached to both and check it is the same sequence
267 3 my $up_seq = $up_exon ->entire_seq;
268 3 my $down_seq = $down_exon->entire_seq;
269 3 ▶ unless (ref($up_seq) eq ref($down_seq) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $up_seq eq ref $down_seq) 0 3 3
270 0 $self->throw("upstream and downstream exons are attached to different sequences\n'$up_seq' and '$down_seq'");
271 }
272
273 # Check that the exons are on the same strand. (Do I need to bother?)
274 3 my $up_strand = $up_exon ->strand;
275 3 my $down_strand = $down_exon->strand;
276 3 ▶ unless ($up_strand == $down_strand) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($up_strand == $down_strand) 0 3 3
277 0 $self->throw("upstream and downstream exons are on different strands "
278 . "('$up_strand' and '$down_strand')");
279 }
280 3 $loc->strand($up_strand);
281
282 # $exon_end is the end of the exon which is 5' of the intron on the genomic sequence.
283 # $exon_start is the start of the exon which is 3' of the intron on the genomic sequence.
284 3 my( $exon_end, $exon_start );
285 3 ▶ if ($up_strand == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($up_strand == 1) { } 3 0 3
286 3 $exon_end = $up_exon ->end;
287 3 $exon_start = $down_exon->start;
288 } else {
289 0 $exon_end = $down_exon->end;
290 0 $exon_start = $up_exon ->start;
291 }
292 3 ▶ unless ($exon_end < $exon_start) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($exon_end < $exon_start) 0 3 3
293 0 $self->throw("Intron gap begins after '$exon_end' and ends before '$exon_start'");
294 }
295 3 $loc->start($exon_end + 1);
296 3 $loc->end ($exon_start - 1);
297
298 # Attach the sequence and location objects to the intron
299 3 $self->{'_intron_location'} = $loc;
300
301 }
302 9 return $self->{'_intron_location'};
303 }
304 10 1;
« Bio/SeqIO/tigrxml.pm ↑ Summary Bio/SearchIO/rnamotif.pm »