| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::SeqFeature::Gene::Exon | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Cared for by Hilmar Lapp <hlapp@gmx.net> | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright Hilmar Lapp | ||||||||||||||||||||||||||||||||||||||||||
| 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::Exon - a feature representing an exon | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # obtain an exon instance $exon somehow | ||||||||||||||||||||||||||||||||||||||||||
| 21 | print "exon from ", $exon->start(), " to ", $exon->end(), | ||||||||||||||||||||||||||||||||||||||||||
| 22 | " on seq ", $exon->seq_id(), ", strand ", $exon->strand(), | ||||||||||||||||||||||||||||||||||||||||||
| 23 | ", encodes the peptide sequence ", | ||||||||||||||||||||||||||||||||||||||||||
| 24 | $exon->cds()->translate()->seq(), "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | This module implements a feature representing an exon by implementing | ||||||||||||||||||||||||||||||||||||||||||
| 29 | the Bio::SeqFeature::Gene::ExonI interface. By default an Exon is | ||||||||||||||||||||||||||||||||||||||||||
| 30 | coding. Supply -is_coding =E<gt> 0 to the constructor or call | ||||||||||||||||||||||||||||||||||||||||||
| 31 | $exon-E<gt>is_coding(0) otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | Apart from that, this class also implements Bio::SeqFeatureI by | ||||||||||||||||||||||||||||||||||||||||||
| 34 | inheriting off Bio::SeqFeature::Generic. | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | User feedback is an integral part of the evolution of this | ||||||||||||||||||||||||||||||||||||||||||
| 41 | and other Bioperl modules. Send your comments and suggestions preferably | ||||||||||||||||||||||||||||||||||||||||||
| 42 | to one of the Bioperl mailing lists. | ||||||||||||||||||||||||||||||||||||||||||
| 43 | Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 46 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 55 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 56 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 57 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 62 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||
| 63 | web: | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | =head1 AUTHOR - Hilmar Lapp | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | Email hlapp@gmx.net | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||
| 74 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | package Bio::SeqFeature::Gene::Exon; | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 27 | $Bio::SeqFeature::Gene::Exon::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 27 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 27 | ▶ | use base qw(Bio::SeqFeature::Generic Bio::SeqFeature::Gene::ExonI); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | # | ||||||||||||||||||||||||||||||||||||||||||
| 90 | # A list of allowed exon types. See primary_tag(). | ||||||||||||||||||||||||||||||||||||||||||
| 91 | # | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 27 | my @valid_exon_types = ('initial', 'internal', 'terminal'); | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 511 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 511 | my ($caller, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 511 | my $self = $caller->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 511 | my ($is_coding) = | |||||||||||||||||||||||||||||||||||||||||
| 99 | $self->_rearrange([qw(IS_CODING)],@args); | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 511 | ▶ | $self->primary_tag('exon') unless $self->primary_tag(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 511 | ▶ | $self->is_coding(defined($is_coding) ? $is_coding : 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 511 | ▶ | $self->strand(0) if(! defined($self->strand())); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 511 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | =head2 is_coding | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | Title : is_coding | ||||||||||||||||||||||||||||||||||||||||||
| 110 | Usage : if($exon->is_coding()) { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | # do something | ||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | if($is_utr) { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | $exon->is_coding(0); | ||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | Function: Get/set whether or not the exon codes for amino acid. | ||||||||||||||||||||||||||||||||||||||||||
| 117 | Returns : TRUE if the object represents a feature translated into protein, | ||||||||||||||||||||||||||||||||||||||||||
| 118 | and FALSE otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 119 | Args : A boolean value on set. | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 798 | ▶ | sub is_coding { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_coding: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 798 | my ($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 798 | ▶ | if(defined($val)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 757 | $self->{'_iscoding'} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 798 | return $self->{'_iscoding'}; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | =head2 primary_tag | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | Title : primary_tag | ||||||||||||||||||||||||||||||||||||||||||
| 136 | Usage : $tag = $feat->primary_tag() | ||||||||||||||||||||||||||||||||||||||||||
| 137 | $feat->primary_tag('exon') | ||||||||||||||||||||||||||||||||||||||||||
| 138 | Function: Get/set the primary tag for the exon feature. | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | This method is overridden here in order to allow only for | ||||||||||||||||||||||||||||||||||||||||||
| 141 | tag values following a certain convention. For consistency reasons, | ||||||||||||||||||||||||||||||||||||||||||
| 142 | the tag value must either contain the string 'exon' or the string | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 'utr' (both case-insensitive). In the case of 'exon', a string | ||||||||||||||||||||||||||||||||||||||||||
| 144 | describing the type of exon may be appended or prefixed. Presently, | ||||||||||||||||||||||||||||||||||||||||||
| 145 | the following types are allowed: initial, internal, and terminal | ||||||||||||||||||||||||||||||||||||||||||
| 146 | (all case-insensitive). | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | If the supplied tag value matches 'utr' (case-insensitive), | ||||||||||||||||||||||||||||||||||||||||||
| 149 | is_coding() will automatically be set to FALSE, and to TRUE | ||||||||||||||||||||||||||||||||||||||||||
| 150 | otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | Returns : A string. | ||||||||||||||||||||||||||||||||||||||||||
| 153 | Args : A string on set. | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | # sub primary_tag { | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # my ($self,$value) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | # if(defined($value)) { | ||||||||||||||||||||||||||||||||||||||||||
| 162 | # if((lc($value) =~ /utr/i) || (lc($value) eq "exon") || | ||||||||||||||||||||||||||||||||||||||||||
| 163 | # ((lc($value) =~ /exon/i) && | ||||||||||||||||||||||||||||||||||||||||||
| 164 | # (grep { $value =~ /$_/i; } @valid_exon_types))) { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | # $self->is_coding($value =~ /utr/i ? 0 : 1); | ||||||||||||||||||||||||||||||||||||||||||
| 166 | # } else { | ||||||||||||||||||||||||||||||||||||||||||
| 167 | # $self->throw("primary tag $value is invalid for object of class ". | ||||||||||||||||||||||||||||||||||||||||||
| 168 | # ref($self)); | ||||||||||||||||||||||||||||||||||||||||||
| 169 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # return $self->SUPER::primary_tag($value); | ||||||||||||||||||||||||||||||||||||||||||
| 172 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | =head2 location | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | Title : location | ||||||||||||||||||||||||||||||||||||||||||
| 177 | Usage : my $location = $exon->location() | ||||||||||||||||||||||||||||||||||||||||||
| 178 | Function: Returns a location object suitable for identifying the location | ||||||||||||||||||||||||||||||||||||||||||
| 179 | of the exon on the sequence or parent feature. | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | This method is overridden here to restrict allowed location types | ||||||||||||||||||||||||||||||||||||||||||
| 182 | to non-compound locations. | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | Returns : Bio::LocationI object | ||||||||||||||||||||||||||||||||||||||||||
| 185 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 5665 | ▶ | sub location { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 5665 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 5665 | ▶ | if(defined($value) && $value->isa('Bio::Location::SplitLocationI')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value and $value->isa("Bio::Location::SplitLocationI")
MC/DC0%0/2
defined $value and $value->isa("Bio::Location::SplitLocationI")
defined $value
$value->isa("Bio::Location::SplitLocationI")
Truth table66%2/3
A and B
A= defined $valueB= $value->isa("Bio::Location::SplitLocationI")
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $self->throw("split or compound location is not allowed ". | |||||||||||||||||||||||||||||||||||||||||
| 195 | "for an object of type " . ref($self)); | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 5665 | return $self->SUPER::location($value); | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | =head2 cds | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | Title : cds() | ||||||||||||||||||||||||||||||||||||||||||
| 203 | Usage : $cds = $exon->cds(); | ||||||||||||||||||||||||||||||||||||||||||
| 204 | Function: Get the coding sequence of the exon as a sequence object. | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | The sequence of the returned object is prefixed by Ns (lower case) | ||||||||||||||||||||||||||||||||||||||||||
| 207 | if the frame of the exon is defined and different from zero. The | ||||||||||||||||||||||||||||||||||||||||||
| 208 | result is that the first base starts a codon (frame 0). | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | This implementation returns undef if the particular exon is | ||||||||||||||||||||||||||||||||||||||||||
| 211 | not translated to protein, i.e., is_coding() returns FALSE. Undef | ||||||||||||||||||||||||||||||||||||||||||
| 212 | will also be returned if no sequence is attached to this exon | ||||||||||||||||||||||||||||||||||||||||||
| 213 | feature. | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | Returns : A Bio::PrimarySeqI implementing object. | ||||||||||||||||||||||||||||||||||||||||||
| 216 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | ▶ | sub cds { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cds: called CC=5 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | # UTR is not translated | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | ▶ | return if(! $self->is_coding()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | my $seq = $self->seq(); | |||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | ▶ | if(defined($seq) && defined($self->frame()) && ($self->frame() != 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $seq and defined $self->frame and $self->frame != 0
defined $seq and defined $self->frame
MC/DC0%0/3
defined $seq and defined $self->frame and $self->frame != 0
defined $seq
defined $self->frame
$self->frame != 0
Truth table25%1/4
A and B and C
A= defined $seqB= defined $self->frameC= $self->frame != 0
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | my $prefix = "n" x $self->frame(); | |||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | $seq->seq($prefix . $seq->seq()); | |||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | return $seq; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 27 | 1; | |||||||||||||||||||||||||||||||||||||||||