| 1 | # | ||
| 2 | # BioPerl module for FAST::Bio::SeqFeature::Gene::UTR | ||
| 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 | FAST::Bio::SeqFeature::Gene::UTR - A feature representing an untranslated region | ||
| 17 | that is part of a transcriptional unit | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | See documentation of methods | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | A UTR is a FAST::Bio::SeqFeature::Gene::ExonI compliant object that is | ||
| 26 | non-coding, and can be either 5' or 3' in a transcript. | ||
| 27 | |||
| 28 | =head1 FEEDBACK | ||
| 29 | |||
| 30 | =head2 Mailing Lists | ||
| 31 | |||
| 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. | ||
| 35 | |||
| 36 | bioperl-l@bioperl.org - General discussion | ||
| 37 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||
| 38 | |||
| 39 | =head2 Support | ||
| 40 | |||
| 41 | Please direct usage questions or support issues to the mailing list: | ||
| 42 | |||
| 43 | I<bioperl-l@bioperl.org> | ||
| 44 | |||
| 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. | ||
| 49 | |||
| 50 | =head2 Reporting Bugs | ||
| 51 | |||
| 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: | ||
| 55 | |||
| 56 | https://redmine.open-bio.org/projects/bioperl/ | ||
| 57 | |||
| 58 | =head1 AUTHOR - David Block | ||
| 59 | |||
| 60 | Email dblock@gene.pbi.nrc.ca | ||
| 61 | |||
| 62 | =head1 CONTRIBUTORS | ||
| 63 | |||
| 64 | This is based on the Gene Structure scaffolding erected by Hilmar Lapp | ||
| 65 | (hlapp@gmx.net). | ||
| 66 | |||
| 67 | =head1 APPENDIX | ||
| 68 | |||
| 69 | The rest of the documentation details each of the object methods. | ||
| 70 | Internal methods are usually preceded with a _ | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | |||
| 75 | # Let the code begin... | ||
| 76 | |||
| 77 | |||
| 78 | package FAST::Bio::SeqFeature::Gene::UTR; | ||
| 79 | use strict; | ||
| 80 | |||
| 81 | # Object preamble - inherits from FAST::Bio::Root::Root | ||
| 82 | |||
| 83 | |||
| 84 | use base qw(FAST::Bio::SeqFeature::Gene::Exon); | ||
| 85 | |||
| 86 | =head2 new | ||
| 87 | |||
| 88 | Title : new | ||
| 89 | Usage : | ||
| 90 | Function: We override the constructor here to set is_coding to false | ||
| 91 | unless explicitly overridden. | ||
| 92 | |||
| 93 | Example : | ||
| 94 | Returns : | ||
| 95 | Args : | ||
| 96 | |||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | sub new{ | ||
| 101 | my ($caller, @args) = @_; | ||
| 102 | |||
| 103 | if(! grep { lc($_) eq '-is_coding'; } @args) { | ||
| 104 | push(@args, '-is_coding', 0); | ||
| 105 | } | ||
| 106 | my $self = $caller->SUPER::new(@args); | ||
| 107 | |||
| 108 | my ($primary, $prim) = | ||
| 109 | $self->_rearrange([qw(PRIMARY PRIMARY_TAG)],@args); | ||
| 110 | |||
| 111 | $self->primary_tag('utr') unless $primary || $prim; | ||
| 112 | |||
| 113 | return $self; | ||
| 114 | } | ||
| 115 | |||
| 116 | =head2 primary_tag | ||
| 117 | |||
| 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 | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 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'."); | ||
| 137 | } | ||
| 138 | unshift(@_,$val); | ||
| 139 | } | ||
| 140 | return $self->SUPER::primary_tag(@_); | ||
| 141 | } | ||
| 142 | |||
| 143 | 1; |