EnsEMBL/AssemblyExceptionFeature.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 59 CC 4 SCAR 13.9
CC
4
Cov
0%
type
6.0
alternate_slice
6.0
display_id
6.0
CRAP 4.0
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::AssemblyExceptionFeature - A feature that represents an assembly exception
34  
35 =head1 SYNOPSIS
36  
37 use Bio::EnsEMBL::AssemblyExceptionFeature;
38  
39 $feature = Bio::EnsEMBL::AssemblyExceptionFeature->new(
40 -start => 100,
41 -end => 220,
42 -type => 'HAP',
43 -slice => $slice,
44 -adaptor => $adaptor
45 );
46  
47 =head1 DESCRIPTION
48  
49 Certain features, e.g. Haplotypes and PARs, are represented as
50 "exceptions" to the normal assembly. This class represents such
51 features.
52  
53 =head1 METHODS
54  
55 =cut
56  
57 package Bio::EnsEMBL::AssemblyExceptionFeature;
58 $Bio::EnsEMBL::AssemblyExceptionFeature::VERSION = '114.0.0_50'; # TRIAL
59 $Bio::EnsEMBL::AssemblyExceptionFeature::VERSION = '114.0.050';
60 use strict;
61  
62 use vars qw(@ISA);
63  
64 use Bio::EnsEMBL::Feature;
65 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
66 use Scalar::Util qw(weaken isweak);
67  
68 @ISA = qw(Bio::EnsEMBL::Feature);
69  
70  
71 =head2 new
72  
73 Arg [TYPE] : The type (e.g. HAP for haplotype, PAR for PAR)
74 Arg [...] : Named arguments passed to superclass
75 Example : $feature = Bio::EnsEMBL::AssemblyExceptionFeature->new
76 (-start => 1,
77 -end => 100,
78 -slice => $slice,
79 -alternate_slice => $alt_slice,
80 -adaptor => $adaptor,
81 -type => 'HAP')
82 Description: Constructs a new Bio::EnsEMBL::Feature. Generally subclasses
83 of this method are instantiated, rather than this class itself.
84 Returntype : Bio::EnsEMBL::Feature
85 Exceptions : Thrown on invalid -SLICE arguments
86 Caller : general, subclass constructors
87 Status : Stable
88  
89 =cut
90  
91 sub new {
92  
93 my $caller = shift;
94  
95 # allow this to be called as class or object method
96 my $class = ref($caller) || $caller;
97 my $self = $class->SUPER::new(@_);
98  
99 my ($type, $alternate_slice) = rearrange(['TYPE', 'ALTERNATE_SLICE'],@_);
100 $self->{'type'} = $type;
101 $self->{'alternate_slice'} = $alternate_slice;
102  
103 return $self;
104 }
105  
106  
107 =head2 type
108  
109 Arg [1] : (optional) string $value
110 Example : $type = $assembly_exception_feature->type();
111 Description: Getter/Setter for the type associated with this
112 feature.
113 Returntype : string
114 Exceptions : none
115 Caller : general
116 Status : Stable
117  
118 =cut
119  
120 sub type {
121  
122 my $self = shift;
123  
124 $self->{'type'} = shift if(@_);
125  
126 return $self->{'type'};
127 }
128  
129  
130 =head2 alternate_slice
131  
132 Arg [1] : (optional) string $value
133 Example : $alt_slice = $assembly_exception_feature->alternate_slice();
134 Description: Getter/Setter for the alternate slice associated with this feature.
135 The alternate slice represents the "other side" of the AssemblyExceptionFeature.
136 Returntype : Bio::EnsEMBL::Slice
137 Exceptions : none
138 Caller : general
139 Status : Stable
140  
141 =cut
142  
143 sub alternate_slice {
144  
145 my $self = shift;
146  
147 $self->{'alternate_slice'} = shift if(@_);
148  
149 return $self->{'alternate_slice'};
150 }
151  
152  
153  
154 =head2 display_id
155  
156 Arg [1] : none
157 Example : print $aef->display_id();
158 Description: This method returns a string that is considered to be
159 the 'display' identifier. For assembly exception features
160 this is the name of the alternate seqregion or '' if the
161 alternate slice is not defined.
162 Returntype : string
163 Exceptions : none
164 Caller : web drawing code
165 Status : Stable
166  
167 =cut
168  
169 sub display_id {
170 my $self = shift;
171 my $slice = $self->{'alternate_slice'};
172 return '' if(!$slice);
173 return $slice->seq_region_name();
174 }
175  
176  
177  
178 1;