Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/RepeatFeature.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::RepeatFeature - A feature representing a repeat on a piece of | |
| 24 sequence. | |
| 25 | |
| 26 =head1 SYNOPSIS | |
| 27 | |
| 28 my $rf = new Bio::EnsEMBL::Feature( | |
| 29 -start => 100, | |
| 30 -end => 220, | |
| 31 -strand => -1, | |
| 32 -slice => $slice, | |
| 33 -analysis => $analysis, | |
| 34 -repeat_consensus => $rc, | |
| 35 -hstart => 10, | |
| 36 -hend => 100, | |
| 37 -hstrand => 1, | |
| 38 -score => 83.2 | |
| 39 ); | |
| 40 | |
| 41 my $hstart = $feat->hstart; | |
| 42 my $hend = $feat->hend; | |
| 43 | |
| 44 # move the feature to the chromosomal coordinate system | |
| 45 $feature = $feature->transform('chromosome'); | |
| 46 | |
| 47 # move the feature to a different slice | |
| 48 # (possibly on another coord system) | |
| 49 $feature = $feature->transfer($new_slice); | |
| 50 | |
| 51 # project the feature onto another coordinate system possibly across | |
| 52 # boundaries: | |
| 53 @projection = @{ $feature->project('contig') }; | |
| 54 | |
| 55 # change the start, end, and strand of the feature in place | |
| 56 $feature->move( $new_start, $new_end, $new_strand ); | |
| 57 | |
| 58 =head1 DESCRIPTION | |
| 59 | |
| 60 This a feature representing a repeat region on a sequence | |
| 61 | |
| 62 =head1 METHODS | |
| 63 | |
| 64 =cut | |
| 65 | |
| 66 package Bio::EnsEMBL::RepeatFeature; | |
| 67 | |
| 68 use strict; | |
| 69 | |
| 70 use Bio::EnsEMBL::Utils::Exception qw(throw); | |
| 71 use Bio::EnsEMBL::Utils::Argument qw(rearrange); | |
| 72 | |
| 73 use base qw/Bio::EnsEMBL::Feature/; | |
| 74 | |
| 75 =head2 new | |
| 76 | |
| 77 Arg [REPEAT_CONSENSUS] : Bio::EnsEMBL::RepeatConsensus (optional) | |
| 78 The repeat consensus for this repeat feature | |
| 79 Arg [HSTART] : int (optional) | |
| 80 The hit start on the consensus sequence | |
| 81 Arg [HEND] : int (optional) | |
| 82 The hit end on the consensus sequence | |
| 83 Arg [SCORE] : float (optional) | |
| 84 The score | |
| 85 Arg [...] : Named arguments to superclass constructor | |
| 86 (see Bio::EnsEMBL::Feaure) | |
| 87 Example : $rf = Bio::EnsEMBL::RepeatFeature->new(-REPEAT_CONSENSUS => $rc, | |
| 88 -HSTART => 10, | |
| 89 -HEND => 100, | |
| 90 -SCORE => 58.0, | |
| 91 -START => 1_000_100, | |
| 92 -END => 1_000_190, | |
| 93 -STRAND => 1, | |
| 94 -ANALYSIS => $an, | |
| 95 -SLICE => $chr_slice); | |
| 96 Description: Creates a new Bio::EnsEMBL::RepeatFeature object | |
| 97 Returntype : Bio::EnsEMBL::RepeatFeature | |
| 98 Exceptions : none | |
| 99 Caller : RepeatFeatureAdaptors | |
| 100 Status : Stable | |
| 101 | |
| 102 =cut | |
| 103 | |
| 104 sub new { | |
| 105 my $caller = shift; | |
| 106 | |
| 107 my $class = ref($caller) || $caller; | |
| 108 | |
| 109 my $self = $class->SUPER::new(@_); | |
| 110 | |
| 111 my ($repeat_consensus, $hstart, $hend, $score) = | |
| 112 rearrange(['REPEAT_CONSENSUS','HSTART','HEND','SCORE'], @_); | |
| 113 | |
| 114 $self->repeat_consensus($repeat_consensus); | |
| 115 $self->{'hstart'} = $hstart; | |
| 116 $self->{'hend'} = $hend; | |
| 117 $self->{'score'} = $score; | |
| 118 | |
| 119 return $self; | |
| 120 } | |
| 121 | |
| 122 | |
| 123 =head2 repeat_consensus | |
| 124 | |
| 125 Arg [1] : (optional) Bio::EnsEMBL::RepeatConsensus | |
| 126 Example : $repeat_consensus = $repeat->repeat_consensus; | |
| 127 Description: Getter/Setter for the repeat consensus of this repeat | |
| 128 Returntype : Bio::EnsEMBL::RepeatConsensus | |
| 129 Exceptions : none | |
| 130 Caller : general | |
| 131 Status : Stable | |
| 132 | |
| 133 =cut | |
| 134 | |
| 135 sub repeat_consensus { | |
| 136 my $self = shift; | |
| 137 | |
| 138 if(@_) { | |
| 139 my $rc = shift; | |
| 140 if(defined($rc)) { | |
| 141 if(!ref($rc) || !$rc->isa('Bio::EnsEMBL::RepeatConsensus')) { | |
| 142 throw('RepeatConsensus arg must be a Bio::EnsEMBL::RepeatConsensus'); | |
| 143 } | |
| 144 } | |
| 145 $self->{'repeat_consensus'} = $rc; | |
| 146 } | |
| 147 | |
| 148 return $self->{'repeat_consensus'}; | |
| 149 } | |
| 150 | |
| 151 | |
| 152 | |
| 153 =head2 hstart | |
| 154 | |
| 155 Arg [1] : (optional) int $hstart | |
| 156 Example : $hit_start = $repeat->hstart; | |
| 157 Description: Getter/Setter for the start bp of this repeat match on the | |
| 158 consensus sequence. | |
| 159 Returntype : int | |
| 160 Exceptions : none | |
| 161 Caller : general | |
| 162 Status : Stable | |
| 163 | |
| 164 =cut | |
| 165 | |
| 166 sub hstart { | |
| 167 my $self = shift; | |
| 168 $self->{'hstart'} = shift if(@_); | |
| 169 return $self->{'hstart'}; | |
| 170 } | |
| 171 | |
| 172 | |
| 173 =head2 score | |
| 174 | |
| 175 Arg [1] : (optional) float $score | |
| 176 Example : $score = $repeat->score(); | |
| 177 Description: Getter/Setter for the score of this repeat feature | |
| 178 Returntype : int | |
| 179 Exceptions : none | |
| 180 Caller : general | |
| 181 Status : Stable | |
| 182 | |
| 183 =cut | |
| 184 | |
| 185 sub score { | |
| 186 my $self = shift; | |
| 187 $self->{'score'} = shift if(@_); | |
| 188 return $self->{'score'}; | |
| 189 } | |
| 190 | |
| 191 | |
| 192 | |
| 193 =head2 hend | |
| 194 | |
| 195 Arg [1] : (optional) int $hend | |
| 196 Example : $hit_end = $repeat->hend; | |
| 197 Description: Getter/Setter for the end bp of this repeat match on the | |
| 198 consensus sequence. | |
| 199 Returntype : int | |
| 200 Exceptions : none | |
| 201 Caller : general | |
| 202 Status : Stable | |
| 203 | |
| 204 =cut | |
| 205 | |
| 206 sub hend { | |
| 207 my $self = shift; | |
| 208 $self->{'hend'} = shift if(@_); | |
| 209 return $self->{'hend'}; | |
| 210 } | |
| 211 | |
| 212 | |
| 213 | |
| 214 =head2 hstrand | |
| 215 | |
| 216 Arg [1] : none | |
| 217 Example : none | |
| 218 Description: always returns 1. method exists for consistancy with other | |
| 219 features. | |
| 220 Returntype : int | |
| 221 Exceptions : none | |
| 222 Caller : general | |
| 223 Status : Stable | |
| 224 | |
| 225 =cut | |
| 226 | |
| 227 sub hstrand { | |
| 228 return 1; | |
| 229 } | |
| 230 | |
| 231 | |
| 232 =head2 display_id | |
| 233 | |
| 234 Arg [1] : none | |
| 235 Example : print $rf->display_id(); | |
| 236 Description: This method returns a string that is considered to be | |
| 237 the 'display' identifier. For repeat_features this is the | |
| 238 name of the repeat consensus if it is available otherwise it is | |
| 239 an empty string. | |
| 240 Returntype : string | |
| 241 Exceptions : none | |
| 242 Caller : web drawing code | |
| 243 Status : Stable | |
| 244 | |
| 245 =cut | |
| 246 | |
| 247 sub display_id { | |
| 248 my $self = shift; | |
| 249 | |
| 250 my $id = ''; | |
| 251 | |
| 252 my $rc = $self->{'repeat_consensus'}; | |
| 253 if($rc) { | |
| 254 $id = $rc->name(); | |
| 255 } | |
| 256 | |
| 257 return $id; | |
| 258 } | |
| 259 | |
| 260 | |
| 261 1; | |
| 262 | |
| 263 __END__ | |
| 264 | |
| 265 =head1 NAME - Bio::EnsEMBL::RepeatFeature | |
| 266 | |
| 267 =head1 AUTHOR | |
| 268 | |
| 269 James Gilbert B<email> jgrg@sanger.ac.uk | |
| 270 |
