EnsEMBL/Map/MarkerFeature.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 80 CC 7 SCAR 20.1
CC
7
Cov
0%
marker
12.0
display_id
12.0
_marker_id
6.0
CRAP 7.4
1 =head1 LICENSE
2  
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5  
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
9  
10 http://www.apache.org/licenses/LICENSE-2.0
11  
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.
17  
18 =cut
19  
20  
21 =head1 CONTACT
22  
23 Please email comments or questions to the public Ensembl
24 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25  
26 Questions may also be sent to the Ensembl help desk at
27 <http://www.ensembl.org/Help/Contact>.
28  
29 =cut
30  
31 =head1 NAME
32  
33 Bio::EnsEMBL::Map::MarkerFeature
34  
35 =head1 SYNOPSIS
36  
37 =head1 DESCRIPTION
38  
39 Represents a marker feature in the EnsEMBL database. A marker feature
40 is a marker which has been mapped to the genome by ePCR. Each marker
41 has one marker feature per mapped location.
42  
43 =head1 METHODS
44  
45 =cut
46  
47 package Bio::EnsEMBL::Map::MarkerFeature;
48 $Bio::EnsEMBL::Map::MarkerFeature::VERSION = '114.0.0';
49 use strict;
50 use vars qw(@ISA);
51  
52 use Bio::EnsEMBL::Feature;
53  
54 @ISA = qw(Bio::EnsEMBL::Feature);
55  
56  
57  
58 =head2 new
59  
60 Arg [1] : (optional) int $dbID
61 Arg [2] : (optional) Bio::EnsEMBL::Adaptor $adaptor
62 Arg [3] : (optional) int $start
63 Arg [4] : (optional) int $end
64 Arg [5] : (optional) Bio::EnsEMBL::Slice $slice
65 Arg [6] : (optional) Bio::EnsEMBL::Analysis
66 Arg [7] : (optional) int $marker_id
67 Arg [8] : (optional) int $map_weight
68 Arg [9] : (optional) Bio::EnsEMBL::Map::Marker $marker
69 Example : $marker = Bio::EnsEMBL::Map::MarkerFeature->new(123, $adaptor,
70 100, 200,
71 $ctg, 123);
72 Description: Creates a new MarkerFeature
73 Returntype : Bio::EnsEMBL::Map::MarkerFeature
74 Exceptions : none
75 Caller : general
76 Status : stable
77  
78 =cut
79  
80 sub new {
81 my ($caller, $dbID, $adaptor, $start, $end, $slice, $analysis,
82 $marker_id, $map_weight, $marker) = @_;
83  
84 my $class = ref($caller) || $caller;
85  
86 my $self = bless( {
87 'dbID' => $dbID,
88 'start' => $start,
89 'end' => $end,
90 'strand' => 0,
91 'slice' => $slice,
92 'analysis' => $analysis,
93 'marker_id' => $marker_id,
94 'marker' => $marker,
95 'map_weight' => $map_weight }, $class);
96  
97 $self->adaptor($adaptor);
98 return $self;
99 }
100  
101  
102  
103 =head2 _marker_id
104  
105 Arg [1] : (optional) int $marker_id
106 Example : none
107 Description: PRIVATE Getter/Setter for the internal identifier of the marker
108 associated with this marker feature
109 Returntype : int
110 Exceptions : none
111 Caller : internal
112 Status : stable
113  
114 =cut
115  
116 sub _marker_id {
117 my $self = shift;
118  
119 if(@_) {
120 $self->{'marker_id'} = shift;
121 }
122  
123 return $self->{'marker_id'};
124 }
125  
126  
127  
128 =head2 marker
129  
130 Arg [1] : (optional) Bio::EnsEMBL::Map::Marker $marker
131 Example : $marker = $marker_feature->marker;
132 Description: Getter/Setter for the marker associated with this marker feature
133 If the marker has not been set and the database is available
134 the marker will automatically be retrieved (lazy-loaded).
135 Returntype : Bio::EnsEMBL::Map::Marker
136 Exceptions : none
137 Caller : general
138 Status : stable
139  
140 =cut
141  
142 sub marker {
143 my $self = shift;
144  
145 if(@_) {
146 $self->{'marker'} = shift;
147 } elsif(!$self->{'marker'} && $self->adaptor && $self->{'marker_id'}) {
148 #lazy load the marker if it is not already loaded
149 my $ma = $self->adaptor->db->get_MarkerAdaptor;
150 $self->{'marker'} = $ma->fetch_by_dbID($self->{'marker_id'});
151 }
152  
153 return $self->{'marker'};
154 }
155  
156  
157  
158 =head2 map_weight
159  
160 Arg [1] : (optional) int $map_weight
161 Example : $map_weight = $marker_feature->map_weight;
162 Description: Getter/Setter for the map weight of this marker. This is the
163 number of times that this marker has been mapped to the genome.
164 E.g. a marker iwth map weight 3 has been mapped to 3 locations
165 in the genome.
166 Returntype : int
167 Exceptions : none
168 Caller : general
169 Status : stable
170  
171 =cut
172  
173 sub map_weight {
174 my $self = shift;
175  
176 if(@_) {
177 $self->{'map_weight'} = shift;
178 }
179  
180 return $self->{'map_weight'};
181 }
182  
183  
184  
185 =head2 display_id
186  
187 Arg [1] : none
188 Example : print $mf->display_id();
189 Description: This method returns a string that is considered to be
190 the 'display' identifier. For marker features this is the
191 name of the display synonym or '' if it is not defined.
192 Returntype : string
193 Exceptions : none
194 Caller : web drawing code
195 Status : stable
196  
197 =cut
198  
199 sub display_id {
200 my $self = shift;
201 my $marker = $self->{'marker'};
202  
203 return '' if(!$marker);
204 my $ms = $marker->display_MarkerSynonym();
205 return '' if(!$ms);
206 return $ms->name() || '';
207 }
208  
209  
210 1;