0
|
1 #
|
|
2 # Ensembl module for Bio::EnsEMBL::Funcgen::AnnotatedFeature
|
|
3 #
|
|
4 # You may distribute this module under the same terms as Perl itself
|
|
5
|
|
6 =head1 LICENSE
|
|
7
|
|
8 Copyright (c) 1999-2011 The European Bioinformatics Institute and
|
|
9 Genome Research Limited. All rights reserved.
|
|
10
|
|
11 This software is distributed under a modified Apache license.
|
|
12 For license details, please see
|
|
13
|
|
14 http://www.ensembl.org/info/about/code_licence.html
|
|
15
|
|
16 =head1 CONTACT
|
|
17
|
|
18 Please email comments or questions to the public Ensembl
|
|
19 developers list at <ensembl-dev@ebi.ac.uk>.
|
|
20
|
|
21 Questions may also be sent to the Ensembl help desk at
|
|
22 <helpdesk@ensembl.org>.
|
|
23
|
|
24
|
|
25 =head1 NAME
|
|
26
|
|
27 Bio::EnsEMBL::AnnotatedFeature - A module to represent a feature mapping as
|
|
28 predicted by the eFG pipeline.
|
|
29
|
|
30 =head1 SYNOPSIS
|
|
31
|
|
32 use Bio::EnsEMBL::Funcgen::AnnotatedFeature;
|
|
33
|
|
34 my $feature = Bio::EnsEMBL::Funcgen::AnnotatedFeature->new
|
|
35 (
|
|
36 -SLICE => $chr_1_slice,
|
|
37 -START => 1_000_000,
|
|
38 -SUMMIT => 1_000_019,
|
|
39 -END => 1_000_024,
|
|
40 -STRAND => -1,
|
|
41 -DISPLAY_LABEL => $text,
|
|
42 -SCORE => $score,
|
|
43 -FEATURE_SET => $fset,
|
|
44 );
|
|
45
|
|
46
|
|
47
|
|
48 =head1 DESCRIPTION
|
|
49
|
|
50 An AnnotatedFeature object represents the genomic placement of a prediction
|
|
51 generated by the eFG analysis pipeline. This normally represents the
|
|
52 output of a peak calling analysis. It can have a score and/or a summit, the
|
|
53 meaning of which depend on the specific Analysis used to infer the feature.
|
|
54 For example, in the case of a feature derived from a peak call over a ChIP-seq
|
|
55 experiment, the score is the peak caller score, and summit is the point in the
|
|
56 feature where more reads align with the genome.
|
|
57
|
|
58 =head1 SEE ALSO
|
|
59
|
|
60 Bio::EnsEMBL::Funcgen::DBSQL::AnnotatedFeatureAdaptor
|
|
61
|
|
62 =cut
|
|
63
|
|
64 use strict;
|
|
65 use warnings;
|
|
66
|
|
67 package Bio::EnsEMBL::Funcgen::AnnotatedFeature;
|
|
68
|
|
69 use Bio::EnsEMBL::Utils::Argument qw( rearrange );
|
|
70 use Bio::EnsEMBL::Utils::Exception qw( throw );
|
|
71 use Bio::EnsEMBL::Funcgen::SetFeature;
|
|
72
|
|
73 use vars qw(@ISA);
|
|
74 @ISA = qw(Bio::EnsEMBL::Funcgen::SetFeature);
|
|
75
|
|
76
|
|
77 =head2 new
|
|
78
|
|
79 Arg [-SLICE] : Bio::EnsEMBL::Slice - The slice on which this feature is.
|
|
80 Arg [-START] : int - The start coordinate of this feature relative to the start of the slice
|
|
81 it is sitting on. Coordinates start at 1 and are inclusive.
|
|
82 Arg [-END] : int -The end coordinate of this feature relative to the start of the slice
|
|
83 Arg [-STRAND] : int - The orientation of this feature. Valid values are 1, -1 and 0.
|
|
84 it is sitting on. Coordinates start at 1 and are inclusive.
|
|
85 Arg [-DISPLAY_LABEL]: string - Display label for this feature
|
|
86 Arg [-SUMMIT] : optional int - seq_region peak summit position
|
|
87 Arg [-SCORE] : optional int - Score assigned by analysis pipeline
|
|
88 Arg [-dbID] : optional int - Internal database ID.
|
|
89 Arg [-ADAPTOR] : optional Bio::EnsEMBL::DBSQL::BaseAdaptor - Database adaptor.
|
|
90 Example : my $feature = Bio::EnsEMBL::Funcgen::AnnotatedFeature->new
|
|
91 (
|
|
92 -SLICE => $chr_1_slice,
|
|
93 -START => 1_000_000,
|
|
94 -END => 1_000_024,
|
|
95 -STRAND => -1,
|
|
96 -FEATURE_SET => $fset,
|
|
97 -DISPLAY_LABEL => $text,
|
|
98 -SCORE => $score,
|
|
99 -SUMMIT => 1_000_019,
|
|
100 );
|
|
101
|
|
102
|
|
103 Description: Constructor for AnnotatedFeature objects.
|
|
104 Returntype : Bio::EnsEMBL::Funcgen::AnnotatedFeature
|
|
105 Exceptions : None
|
|
106 Caller : General
|
|
107 Status : Medium Risk
|
|
108
|
|
109 =cut
|
|
110
|
|
111 sub new {
|
|
112 my $caller = shift;
|
|
113
|
|
114 my $class = ref($caller) || $caller;
|
|
115 my $self = $class->SUPER::new(@_);
|
|
116 #Hard code strand => 0 here? And remove from input params?
|
|
117 my ($score, $summit) = rearrange(['SCORE', 'SUMMIT'], @_);
|
|
118
|
|
119 #Direct assingment here removes need for set arg test in method
|
|
120
|
|
121 $self->{'score'} = $score if defined $score;
|
|
122 $self->{'summit'} = $summit if defined $summit;
|
|
123
|
|
124 return $self;
|
|
125 }
|
|
126
|
|
127
|
|
128 =head2 score
|
|
129
|
|
130 Arg [1] : (optional) int - score
|
|
131 Example : my $score = $feature->score();
|
|
132 Description: Getter for the score attribute for this feature.
|
|
133 Returntype : int
|
|
134 Exceptions : None
|
|
135 Caller : General
|
|
136 Status : Low Risk
|
|
137
|
|
138 =cut
|
|
139
|
|
140 sub score {
|
|
141 my $self = shift;
|
|
142 return $self->{'score'};
|
|
143 }
|
|
144
|
|
145 =head2 summit
|
|
146
|
|
147 Arg [1] : (optional) int - summit postition
|
|
148 Example : my $peak_summit = $feature->summit;
|
|
149 Description: Getter for the summit attribute for this feature.
|
|
150 Returntype : int
|
|
151 Exceptions : None
|
|
152 Caller : General
|
|
153 Status : At Risk
|
|
154
|
|
155 =cut
|
|
156
|
|
157 sub summit {
|
|
158 my $self = shift;
|
|
159 return $self->{'summit'};
|
|
160 }
|
|
161
|
|
162
|
|
163 =head2 display_label
|
|
164
|
|
165 Example : my $label = $feature->display_label();
|
|
166 Description: Getter for the display label of this feature.
|
|
167 Returntype : String
|
|
168 Exceptions : None
|
|
169 Caller : General
|
|
170 Status : Medium Risk
|
|
171
|
|
172 =cut
|
|
173
|
|
174 sub display_label {
|
|
175 my $self = shift;
|
|
176
|
|
177 #auto generate here if not set in table
|
|
178 #need to go with one or other, or can we have both, split into diplay_name and display_label?
|
|
179
|
|
180 if(! $self->{'display_label'} && $self->adaptor){
|
|
181 $self->{'display_label'} = $self->feature_type->name()." -";
|
|
182 $self->{'display_label'} .= " ".$self->cell_type->name();
|
|
183 $self->{'display_label'} .= " Enriched Site";
|
|
184 }
|
|
185
|
|
186 return $self->{'display_label'};
|
|
187 }
|
|
188
|
|
189
|
|
190 =head2 is_focus_feature
|
|
191
|
|
192 Args : None
|
|
193 Example : if($feat->is_focus_feature){ ... }
|
|
194 Description: Returns true if AnnotatedFeature is part of a focus
|
|
195 set used in the RegulatoryBuild
|
|
196 Returntype : Boolean
|
|
197 Exceptions : None
|
|
198 Caller : General
|
|
199 Status : At Risk
|
|
200
|
|
201 =cut
|
|
202
|
|
203 sub is_focus_feature{
|
|
204 my $self = shift;
|
|
205
|
|
206 #Do we need to test for FeatureSet here?
|
|
207
|
|
208 return $self->feature_set->is_focus_set;
|
|
209 }
|
|
210
|
|
211
|
|
212 =head2 get_underlying_structure
|
|
213
|
|
214 Example : my @loci = @{ $af->get_underlying_structure() };
|
|
215 Description: Returns and array of loci consisting of:
|
|
216 (start, (motif_feature_start, motif_feature_end)*, end)
|
|
217 Returntype : ARRAYREF
|
|
218 Exceptions : None
|
|
219 Caller : General
|
|
220 Status : At Risk - This is TFBS specific and could move to TranscriptionFactorFeature
|
|
221
|
|
222 =cut
|
|
223
|
|
224 #This should really be precomputed and stored in the DB to avoid the MF attr fetch
|
|
225 #Need to be aware of projecting here, as these will expire if we project after this method is called
|
|
226
|
|
227 sub get_underlying_structure{
|
|
228 my $self = shift;
|
|
229
|
|
230 if(! defined $self->{underlying_structure}){
|
|
231 my @loci = ($self->start);
|
|
232
|
|
233 foreach my $mf(@{$self->get_associated_MotifFeatures}){
|
|
234 push @loci, ($mf->start, $mf->end);
|
|
235 }
|
|
236
|
|
237 push @loci, $self->end;
|
|
238
|
|
239 $self->{underlying_structure} = \@loci;
|
|
240 }
|
|
241
|
|
242 return $self->{underlying_structure};
|
|
243 }
|
|
244
|
|
245 =head2 get_associated_MotifFeatures
|
|
246
|
|
247 Example : my @assoc_mfs = @{ $af->get_associated_MotifFeatures };
|
|
248 Description: Returns and array associated MotifFeature i.e. MotifFeatures
|
|
249 representing a relevanting PWM/BindingMatrix
|
|
250 Returntype : ARRAYREF
|
|
251 Exceptions : None
|
|
252 Caller : General
|
|
253 Status : At Risk - This is TFBS specific and could move to TranscriptionFactorFeature
|
|
254
|
|
255 =cut
|
|
256
|
|
257 sub get_associated_MotifFeatures{
|
|
258 my ($self) = @_;
|
|
259
|
|
260 if(! defined $self->{'assoc_motif_features'}){
|
|
261 my $mf_adaptor = $self->adaptor->db->get_MotifFeatureAdaptor;
|
|
262
|
|
263 #These need reslicing!
|
|
264
|
|
265 $self->{'assoc_motif_features'} = $mf_adaptor->fetch_all_by_AnnotatedFeature($self, $self->slice);
|
|
266 }
|
|
267
|
|
268 return $self->{'assoc_motif_features'};
|
|
269 }
|
|
270
|
|
271
|
|
272 1;
|
|
273
|