EnsEMBL/Map/MarkerFeature.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 11 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 75 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_50'; # TRIAL
49 $Bio::EnsEMBL::Map::MarkerFeature::VERSION = '114.0.050';
50 use strict;
51 use vars qw(@ISA);
52  
53 use Bio::EnsEMBL::Feature;
54  
55 @ISA = qw(Bio::EnsEMBL::Feature);
56  
57  
58  
59 =head2 new
60  
61 Arg [1] : (optional) int $dbID
62 Arg [2] : (optional) Bio::EnsEMBL::Adaptor $adaptor
63 Arg [3] : (optional) int $start
64 Arg [4] : (optional) int $end
65 Arg [5] : (optional) Bio::EnsEMBL::Slice $slice
66 Arg [6] : (optional) Bio::EnsEMBL::Analysis
67 Arg [7] : (optional) int $marker_id
68 Arg [8] : (optional) int $map_weight
69 Arg [9] : (optional) Bio::EnsEMBL::Map::Marker $marker
70 Example : $marker = Bio::EnsEMBL::Map::MarkerFeature->new(123, $adaptor,
71 100, 200,
72 $ctg, 123);
73 Description: Creates a new MarkerFeature
74 Returntype : Bio::EnsEMBL::Map::MarkerFeature
75 Exceptions : none
76 Caller : general
77 Status : stable
78  
79 =cut
80  
81 sub new {
82 my ($caller, $dbID, $adaptor, $start, $end, $slice, $analysis,
83 $marker_id, $map_weight, $marker) = @_;
84  
85 my $class = ref($caller) || $caller;
86  
87 my $self = bless( {
88 'dbID' => $dbID,
89 'start' => $start,
90 'end' => $end,
91 'strand' => 0,
92 'slice' => $slice,
93 'analysis' => $analysis,
94 'marker_id' => $marker_id,
95 'marker' => $marker,
96 'map_weight' => $map_weight }, $class);
97  
98 $self->adaptor($adaptor);
99 return $self;
100 }
101  
102  
103  
104 =head2 _marker_id
105  
106 Arg [1] : (optional) int $marker_id
107 Example : none
108 Description: PRIVATE Getter/Setter for the internal identifier of the marker
109 associated with this marker feature
110 Returntype : int
111 Exceptions : none
112 Caller : internal
113 Status : stable
114  
115 =cut
116  
117 sub _marker_id {
118 my $self = shift;
119  
120 if(@_) {
121 $self->{'marker_id'} = shift;
122 }
123  
124 return $self->{'marker_id'};
125 }
126  
127  
128  
129 =head2 marker
130  
131 Arg [1] : (optional) Bio::EnsEMBL::Map::Marker $marker
132 Example : $marker = $marker_feature->marker;
133 Description: Getter/Setter for the marker associated with this marker feature
134 If the marker has not been set and the database is available
135 the marker will automatically be retrieved (lazy-loaded).
136 Returntype : Bio::EnsEMBL::Map::Marker
137 Exceptions : none
138 Caller : general
139 Status : stable
140  
141 =cut
142  
143 sub marker {
144 my $self = shift;
145  
146 if(@_) {
147 $self->{'marker'} = shift;
148 } elsif(!$self->{'marker'} && $self->adaptor && $self->{'marker_id'}) {
149 #lazy load the marker if it is not already loaded
150 my $ma = $self->adaptor->db->get_MarkerAdaptor;
151 $self->{'marker'} = $ma->fetch_by_dbID($self->{'marker_id'});
152 }
153  
154 return $self->{'marker'};
155 }
156  
157  
158  
159 =head2 map_weight
160  
161 Arg [1] : (optional) int $map_weight
162 Example : $map_weight = $marker_feature->map_weight;
163 Description: Getter/Setter for the map weight of this marker. This is the
164 number of times that this marker has been mapped to the genome.
165 E.g. a marker iwth map weight 3 has been mapped to 3 locations
166 in the genome.
167 Returntype : int
168 Exceptions : none
169 Caller : general
170 Status : stable
171  
172 =cut
173  
174 sub map_weight {
175 my $self = shift;
176  
177 if(@_) {
178 $self->{'map_weight'} = shift;
179 }
180  
181 return $self->{'map_weight'};
182 }
183  
184  
185  
186 =head2 display_id
187  
188 Arg [1] : none
189 Example : print $mf->display_id();
190 Description: This method returns a string that is considered to be
191 the 'display' identifier. For marker features this is the
192 name of the display synonym or '' if it is not defined.
193 Returntype : string
194 Exceptions : none
195 Caller : web drawing code
196 Status : stable
197  
198 =cut
199  
200 sub display_id {
201 my $self = shift;
202 my $marker = $self->{'marker'};
203  
204 return '' if(!$marker);
205 my $ms = $marker->display_MarkerSynonym();
206 return '' if(!$ms);
207 return $ms->name() || '';
208 }
209  
210  
211 1;