Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/PredictionExon.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 Bio::EnsEMBL::PredictionExon - A class representing an Exon from an ab | |
| 24 initio prediction method | |
| 25 | |
| 26 =head1 SYNOPSIS | |
| 27 | |
| 28 $exon = new Bio::EnsEMBL::PredictionExon( | |
| 29 -START => 100, | |
| 30 -END => 200, | |
| 31 -STRAND => 1, | |
| 32 -SLICE => $slice, | |
| 33 -DBID => $dbID, | |
| 34 -P_VALUE => 23.5, | |
| 35 -SCORE => 99 | |
| 36 ); | |
| 37 | |
| 38 # seq() returns a Bio::Seq | |
| 39 my $seq = $exon->seq->seq(); | |
| 40 | |
| 41 # peptide() only makes sense within transcript context | |
| 42 my $pep = $exon->peptide($transcript)->seq(); | |
| 43 | |
| 44 # Normal feature operations can be performed: | |
| 45 $exon = $exon->transform('clone'); | |
| 46 $exon->move( $new_start, $new_end, $new_strand ); | |
| 47 print $exon->slice->seq_region_name(); | |
| 48 | |
| 49 =head1 DESCRIPTION | |
| 50 | |
| 51 This is a class which represents an prediction exon which is part of a | |
| 52 predcition transcript. See Bio::EnsEMBL:PredictionTranscript | |
| 53 | |
| 54 =head1 METHODS | |
| 55 | |
| 56 =cut | |
| 57 | |
| 58 package Bio::EnsEMBL::PredictionExon; | |
| 59 use vars qw(@ISA); | |
| 60 use strict; | |
| 61 | |
| 62 use Bio::EnsEMBL::Feature; | |
| 63 use Bio::EnsEMBL::Exon; | |
| 64 use Bio::EnsEMBL::Utils::Exception qw( warning throw deprecate ); | |
| 65 use Bio::EnsEMBL::Utils::Argument qw( rearrange ); | |
| 66 | |
| 67 | |
| 68 @ISA = qw(Bio::EnsEMBL::Exon); | |
| 69 | |
| 70 | |
| 71 =head2 new | |
| 72 | |
| 73 Args : see SUPERCLASS Bio::EnsEMBL::Exon | |
| 74 Example : none | |
| 75 Description: create an Exon object | |
| 76 Returntype : Bio::EnsEMBL::PredictionExon | |
| 77 Exceptions : none | |
| 78 Caller : general | |
| 79 Status : Stable | |
| 80 | |
| 81 =cut | |
| 82 | |
| 83 sub new { | |
| 84 my $class = shift; | |
| 85 | |
| 86 $class = ref $class || $class; | |
| 87 | |
| 88 my $self = $class->SUPER::new( @_ ); | |
| 89 | |
| 90 my ( $p_value, $score ) = | |
| 91 rearrange( [ "P_VALUE", "SCORE" ], @_ ); | |
| 92 | |
| 93 $self->{'p_value'} = $p_value; | |
| 94 $self->{'score'} = $score; | |
| 95 | |
| 96 return $self; | |
| 97 } | |
| 98 | |
| 99 | |
| 100 =head2 score | |
| 101 | |
| 102 Arg [1] : string $newval (optional) | |
| 103 The new value to set the score attribute to | |
| 104 Example : $score = $obj->score() | |
| 105 Description: Getter/Setter for the score attribute | |
| 106 Returntype : string | |
| 107 Exceptions : none | |
| 108 Caller : general | |
| 109 Status : Stable | |
| 110 | |
| 111 =cut | |
| 112 | |
| 113 sub score{ | |
| 114 my $self = shift; | |
| 115 $self->{'score'} = shift if(@_); | |
| 116 return $self->{'score'}; | |
| 117 } | |
| 118 | |
| 119 | |
| 120 | |
| 121 =head2 p_value | |
| 122 | |
| 123 Arg [1] : string $newval (optional) | |
| 124 The new value to set the p_value attribute to | |
| 125 Example : $p_value = $obj->p_value() | |
| 126 Description: Getter/Setter for the p_value attribute | |
| 127 Returntype : string | |
| 128 Exceptions : none | |
| 129 Caller : general | |
| 130 Status : Stable | |
| 131 | |
| 132 =cut | |
| 133 | |
| 134 sub p_value{ | |
| 135 my $self = shift; | |
| 136 $self->{'p_value'} = shift if(@_); | |
| 137 return $self->{'p_value'}; | |
| 138 } | |
| 139 | |
| 140 | |
| 141 =head2 end_phase | |
| 142 | |
| 143 Arg [1] : (optional) int $end_phase | |
| 144 Example : $end_phase = $feat->end_phase; | |
| 145 Description: Gets/Sets the end phase of the exon. | |
| 146 end_phase = number of bases from the last incomplete codon of | |
| 147 this exon. | |
| 148 Usually, end_phase = (phase + exon_length)%3 | |
| 149 but end_phase could be -1 if the exon is half-coding and its 3 | |
| 150 prime end is UTR. | |
| 151 Returntype : int | |
| 152 Exceptions : warning if end_phase is called without an argument and the | |
| 153 value is not set. | |
| 154 Caller : general | |
| 155 Status : Stable | |
| 156 | |
| 157 =cut | |
| 158 | |
| 159 | |
| 160 | |
| 161 sub end_phase { | |
| 162 my $self = shift; | |
| 163 if( @_ ) { | |
| 164 throw( "End_phase setting not supported" ); | |
| 165 } | |
| 166 return ($self->phase() + $self->length()) % 3; | |
| 167 } | |
| 168 | |
| 169 | |
| 170 =head2 transform | |
| 171 | |
| 172 Arg 1 : String $coordinate_system_name | |
| 173 Arg [2] : String $coordinate_system_version | |
| 174 Description: moves this exon to the given coordinate system. If this exon has | |
| 175 attached supporting evidence, they move as well. | |
| 176 Returntype : Bio::EnsEMBL::Exon | |
| 177 Exceptions : wrong parameters | |
| 178 Caller : general | |
| 179 Status : Stable | |
| 180 | |
| 181 =cut | |
| 182 | |
| 183 | |
| 184 sub transform { | |
| 185 my $self = shift; | |
| 186 | |
| 187 # catch for old style transform calls | |
| 188 if( !@_ || ( ref $_[0] && ($_[0]->isa( "Bio::EnsEMBL::Slice" ) or $_[0]->isa( "Bio::EnsEMBL::LRGSlice" )))) { | |
| 189 throw( "transform needs coordinate systems details now," . | |
| 190 "please use transfer" ); | |
| 191 } | |
| 192 | |
| 193 my $new_exon = Bio::EnsEMBL::Feature::transform( $self, @_ ); | |
| 194 return undef unless $new_exon; | |
| 195 | |
| 196 #dont want to share the same sequence cache | |
| 197 delete $new_exon->{'_seq_cache'}; | |
| 198 | |
| 199 return $new_exon; | |
| 200 } | |
| 201 | |
| 202 | |
| 203 | |
| 204 =head2 transfer | |
| 205 | |
| 206 Arg [1] : Bio::EnsEMBL::Slice $destination_slice | |
| 207 Example : none | |
| 208 Description: Moves this Exon to given target slice coordinates. If Features | |
| 209 are attached they are moved as well. Returns a new exon. | |
| 210 Returntype : Bio::EnsEMBL::Gene | |
| 211 Exceptions : none | |
| 212 Caller : general | |
| 213 Status : Stable | |
| 214 | |
| 215 =cut | |
| 216 | |
| 217 sub transfer { | |
| 218 my $self = shift; | |
| 219 | |
| 220 my $new_exon = Bio::EnsEMBL::Feature::transfer( $self, @_ ); | |
| 221 return undef unless $new_exon; | |
| 222 | |
| 223 #dont want to share the same sequence cache | |
| 224 delete $new_exon->{'_seq_cache'}; | |
| 225 | |
| 226 return $new_exon; | |
| 227 } | |
| 228 | |
| 229 | |
| 230 =head2 add_supporting_features | |
| 231 | |
| 232 Description: For compatibility with Bio::EnsEMBL::Exon | |
| 233 Does nothing. | |
| 234 Returntype : none | |
| 235 Status : Stable | |
| 236 | |
| 237 =cut | |
| 238 | |
| 239 sub add_supporting_features { } | |
| 240 | |
| 241 | |
| 242 =head2 get_all_supporting_features | |
| 243 | |
| 244 Description: For compatibility with Bio::EnsEMBL::Exon | |
| 245 Does nothing and returns empty list | |
| 246 Returntype : empty list. | |
| 247 Status : Stable | |
| 248 | |
| 249 =cut | |
| 250 | |
| 251 sub get_all_supporting_features { return []; } | |
| 252 | |
| 253 | |
| 254 =head2 find_supporting_evidence | |
| 255 | |
| 256 Description: For compatibility with Bio::EnsEMBL::Exon | |
| 257 Does nothing. | |
| 258 Returntype : empty list. | |
| 259 Status : Stable | |
| 260 | |
| 261 =cut | |
| 262 | |
| 263 sub find_supporting_evidence { return []; } | |
| 264 | |
| 265 | |
| 266 1; |
