t/AlignIO/AlignIO.t: fix number of tests in plan (fixup c523e6bed866)
[bioperl-live.git] / Bio / SeqFeature / Gene / UTR.pm
blob30ef65265f42142fdd6cb849212d5e720a335cb6
2 # BioPerl module for Bio::SeqFeature::Gene::UTR
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by David Block <dblock@gene.pbi.nrc.ca>
8 # Copyright David Block
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::SeqFeature::Gene::UTR - A feature representing an untranslated region
17 that is part of a transcriptional unit
19 =head1 SYNOPSIS
21 See documentation of methods
23 =head1 DESCRIPTION
25 A UTR is a Bio::SeqFeature::Gene::ExonI compliant object that is
26 non-coding, and can be either 5' or 3' in a transcript.
28 =head1 FEEDBACK
30 =head2 Mailing Lists
32 User feedback is an integral part of the evolution of this and other
33 Bioperl modules. Send your comments and suggestions preferably to
34 the Bioperl mailing list. Your participation is much appreciated.
36 bioperl-l@bioperl.org - General discussion
37 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
39 =head2 Support
41 Please direct usage questions or support issues to the mailing list:
43 I<bioperl-l@bioperl.org>
45 rather than to the module maintainer directly. Many experienced and
46 reponsive experts will be able look at the problem and quickly
47 address it. Please include a thorough description of the problem
48 with code and data examples if at all possible.
50 =head2 Reporting Bugs
52 Report bugs to the Bioperl bug tracking system to help us keep track
53 of the bugs and their resolution. Bug reports can be submitted via the
54 web:
56 https://github.com/bioperl/bioperl-live/issues
58 =head1 AUTHOR - David Block
60 Email dblock@gene.pbi.nrc.ca
62 =head1 CONTRIBUTORS
64 This is based on the Gene Structure scaffolding erected by Hilmar Lapp
65 (hlapp@gmx.net).
67 =head1 APPENDIX
69 The rest of the documentation details each of the object methods.
70 Internal methods are usually preceded with a _
72 =cut
75 # Let the code begin...
78 package Bio::SeqFeature::Gene::UTR;
79 use strict;
81 # Object preamble - inherits from Bio::Root::Root
84 use base qw(Bio::SeqFeature::Gene::Exon);
86 =head2 new
88 Title : new
89 Usage :
90 Function: We override the constructor here to set is_coding to false
91 unless explicitly overridden.
93 Example :
94 Returns :
95 Args :
98 =cut
100 sub new{
101 my ($caller, @args) = @_;
103 if(! grep { lc($_) eq '-is_coding'; } @args) {
104 push(@args, '-is_coding', 0);
106 my $self = $caller->SUPER::new(@args);
108 my ($primary, $prim) =
109 $self->_rearrange([qw(PRIMARY PRIMARY_TAG)],@args);
111 $self->primary_tag('utr') unless $primary || $prim;
113 return $self;
116 =head2 primary_tag
118 Title : primary_tag
119 Usage : $tag = $feat->primary_tag()
120 Function: Returns the primary tag for a feature,
121 eg 'utr5prime'. This method insures that 5prime/3prime information
122 is uniformly stored
123 Returns : a string
124 Args : none
126 =cut
128 sub primary_tag{
129 my $self = shift;
130 if(@_ && defined($_[0])) {
131 my $val = shift;
132 if ($val =~ /(3|5)/ ) {
133 $val = "utr$1prime";
134 } else {
135 $self->warn("Primary tag should indicate if this is 3 or 5'. ".
136 "Preferred text is 'utr3prime' or 'utr5prime'.");
138 unshift(@_,$val);
140 return $self->SUPER::primary_tag(@_);