3 Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
4 Copyright [2016-2024] EMBL-European Bioinformatics Institute
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
44 -analysis => $analysis,
46 -display_label =>
'EponineTSS',
53 This is a simple feature which extends the
Feature class to add
54 display_label and score attributes.
62 package Bio::EnsEMBL::SimpleFeature;
68 use Scalar::Util qw(weaken isweak);
72 use constant SEQUENCE_ONTOLOGY => {
74 term =>
'biological_region',
79 Arg [DISPLAY_LABEL]: The label assigned to
this simple feature
80 Arg [...] : Named arguments passed to superclass
86 -analysis => $analysis,
89 -display_label =>
'EponineTSS',
92 of
this method are instantiated, rather than
this class itself.
94 Exceptions : Thrown on invalid -SLICE, -ANALYSIS, -STRAND arguments
95 Caller : general, subclass constructors
103 #allow this to be called as class or object method
104 my $class = ref($caller) || $caller;
105 my $self = $class->SUPER::new(@_);
107 my ($display_label, $score) = rearrange([
'DISPLAY_LABEL',
'SCORE'],@_);
109 $self->{
'display_label'} = $display_label;
110 $self->{
'score'} = $score;
118 Arg [1] : (optional)
string $value
119 Example : $label = $simple_feature->display_label();
120 Description: Getter/Setter
for the display label associated with
this
132 $self->{
'display_label'} = shift
if(@_);
134 return $self->{
'display_label'};
141 Example : print $rf->display_id();
142 Description: This method returns a
string that is considered to be
143 the
'display' identifier. For simple features
this is the
144 display_label
if it is available otherwise it is an empty
148 Caller : web drawing code
155 return $self->{
'display_label'} ||
'';
162 Arg [1] : (optional)
string $value
163 Example : $score = $simple_feature->score();
164 Description: Getter/Setter
for the score associated with
this
175 $self->{
'score'} = shift
if(@_);
176 return $self->{
'score'};
180 =head2 summary_as_hash
182 Example : my $hash = $simple_feature->summary_as_hash();
183 Description: Generates a HashRef compatible with GFFSerializer. Adds
184 score, external_name and logic_name to the basic Feature
193 sub summary_as_hash {
195 my $hash = $self->SUPER::summary_as_hash();
196 $hash->{score} = $self->score()
if $self->score();
197 $hash->{
'external_name'} = $self->display_label()
if $self->display_label();
198 $hash->{
'logic_name'} = $self->analysis->logic_name();