Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/AssemblyExceptionFeature.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 =head1 LICENSE | |
2 | |
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and | |
4 Genome Research Limited. All rights reserved. | |
5 | |
6 This software is distributed under a modified Apache license. | |
7 For license details, please see | |
8 | |
9 http://www.ensembl.org/info/about/code_licence.html | |
10 | |
11 =head1 CONTACT | |
12 | |
13 Please email comments or questions to the public Ensembl | |
14 developers list at <dev@ensembl.org>. | |
15 | |
16 Questions may also be sent to the Ensembl help desk at | |
17 <helpdesk@ensembl.org>. | |
18 | |
19 =cut | |
20 | |
21 =head1 NAME | |
22 | |
23 Bio::EnsEMBL::AssemblyExceptionFeature - A feature that represents an assembly exception | |
24 | |
25 =head1 SYNOPSIS | |
26 | |
27 use Bio::EnsEMBL::AssemblyExceptionFeature; | |
28 | |
29 $feature = Bio::EnsEMBL::AssemblyExceptionFeature->new( | |
30 -start => 100, | |
31 -end => 220, | |
32 -type => 'HAP', | |
33 -slice => $slice, | |
34 -adaptor => $adaptor | |
35 ); | |
36 | |
37 =head1 DESCRIPTION | |
38 | |
39 Certain features, e.g. Haplotypes and PARs, are represented as | |
40 "exceptions" to the normal assembly. This class represents such | |
41 features. | |
42 | |
43 =head1 METHODS | |
44 | |
45 =cut | |
46 | |
47 package Bio::EnsEMBL::AssemblyExceptionFeature; | |
48 | |
49 use strict; | |
50 | |
51 use vars qw(@ISA); | |
52 | |
53 use Bio::EnsEMBL::Feature; | |
54 use Bio::EnsEMBL::Utils::Argument qw(rearrange); | |
55 use Scalar::Util qw(weaken isweak); | |
56 | |
57 @ISA = qw(Bio::EnsEMBL::Feature); | |
58 | |
59 | |
60 =head2 new | |
61 | |
62 Arg [TYPE] : The type (e.g. HAP for haplotype, PAR for PAR) | |
63 Arg [...] : Named arguments passed to superclass | |
64 Example : $feature = Bio::EnsEMBL::AssemblyExceptionFeature->new | |
65 (-start => 1, | |
66 -end => 100, | |
67 -slice => $slice, | |
68 -alternate_slice => $alt_slice, | |
69 -adaptor => $adaptor, | |
70 -type => 'HAP') | |
71 Description: Constructs a new Bio::EnsEMBL::Feature. Generally subclasses | |
72 of this method are instantiated, rather than this class itself. | |
73 Returntype : Bio::EnsEMBL::Feature | |
74 Exceptions : Thrown on invalid -SLICE arguments | |
75 Caller : general, subclass constructors | |
76 Status : Stable | |
77 | |
78 =cut | |
79 | |
80 sub new { | |
81 | |
82 my $caller = shift; | |
83 | |
84 # allow this to be called as class or object method | |
85 my $class = ref($caller) || $caller; | |
86 my $self = $class->SUPER::new(@_); | |
87 | |
88 my ($type, $alternate_slice) = rearrange(['TYPE', 'ALTERNATE_SLICE'],@_); | |
89 $self->{'type'} = $type; | |
90 $self->{'alternate_slice'} = $alternate_slice; | |
91 | |
92 return $self; | |
93 } | |
94 | |
95 =head2 new_fast | |
96 | |
97 Arg [1] : hashref to be blessed | |
98 Description: Construct a new Bio::EnsEMBL::Feature using the hashref. | |
99 Exceptions : none | |
100 Returntype : Bio::EnsEMBL::Feature | |
101 Caller : general, subclass constructors | |
102 Status : Stable | |
103 | |
104 =cut | |
105 | |
106 sub new_fast { | |
107 my $class = shift; | |
108 my $hashref = shift; | |
109 my $self = bless $hashref, $class; | |
110 weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) ); | |
111 return $self; | |
112 } | |
113 | |
114 | |
115 =head2 type | |
116 | |
117 Arg [1] : (optional) string $value | |
118 Example : $type = $assembly_exception_feature->type(); | |
119 Description: Getter/Setter for the type associated with this | |
120 feature. | |
121 Returntype : string | |
122 Exceptions : none | |
123 Caller : general | |
124 Status : Stable | |
125 | |
126 =cut | |
127 | |
128 sub type { | |
129 | |
130 my $self = shift; | |
131 | |
132 $self->{'type'} = shift if(@_); | |
133 | |
134 return $self->{'type'}; | |
135 } | |
136 | |
137 | |
138 =head2 alternate_slice | |
139 | |
140 Arg [1] : (optional) string $value | |
141 Example : $alt_slice = $assembly_exception_feature->alternate_slice(); | |
142 Description: Getter/Setter for the alternate slice associated with this feature. | |
143 The alternate slice represents the "other side" of the AssemblyExceptionFeature. | |
144 Returntype : Bio::EnsEMBL::Slice | |
145 Exceptions : none | |
146 Caller : general | |
147 Status : Stable | |
148 | |
149 =cut | |
150 | |
151 sub alternate_slice { | |
152 | |
153 my $self = shift; | |
154 | |
155 $self->{'alternate_slice'} = shift if(@_); | |
156 | |
157 return $self->{'alternate_slice'}; | |
158 } | |
159 | |
160 | |
161 | |
162 =head2 display_id | |
163 | |
164 Arg [1] : none | |
165 Example : print $aef->display_id(); | |
166 Description: This method returns a string that is considered to be | |
167 the 'display' identifier. For assembly exception features | |
168 this is the name of the alternate seqregion or '' if the | |
169 alternate slice is not defined. | |
170 Returntype : string | |
171 Exceptions : none | |
172 Caller : web drawing code | |
173 Status : Stable | |
174 | |
175 =cut | |
176 | |
177 sub display_id { | |
178 my $self = shift; | |
179 my $slice = $self->{'alternate_slice'}; | |
180 return '' if(!$slice); | |
181 return $slice->seq_region_name(); | |
182 } | |
183 | |
184 | |
185 | |
186 1; |