EnsEMBL/Map/Ditag.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 9 Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 100 CC 9 SCAR 20.3
CC
9
Cov
0%
new
20.0
name
6.0
dbID
6.0
CRAP 7.6
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::Ditag
34  
35 =head1 SYNOPSIS
36  
37 my $feature = Bio::EnsEMBL::Map::Ditag->new(
38 -dbID => $tag_id,
39 -name => $name,
40 -type => $type,
41 -tag_count => $tag_count,
42 -sequence => $sequence,
43 -adaptor => $dbAdaptor
44 );
45  
46 =head1 DESCRIPTION
47  
48 Represents an unmapped ditag object in the EnsEMBL database.
49 Corresponds to original tag containing the full sequence. This can be
50 a single piece of sequence like CAGE tags or a ditag with concatenated
51 sequence from 5' and 3' end like GIS or GSC tags.
52  
53 =head1 METHODS
54  
55 =cut
56  
57 package Bio::EnsEMBL::Map::Ditag;
58 $Bio::EnsEMBL::Map::Ditag::VERSION = '114.0.0_50'; # TRIAL
59 $Bio::EnsEMBL::Map::Ditag::VERSION = '114.0.050';
60 use strict;
61 use vars qw(@ISA);
62  
63 use Bio::EnsEMBL::Storable;
64 use Bio::EnsEMBL::Utils::Exception qw( throw );
65 use Bio::EnsEMBL::Utils::Argument qw( rearrange );
66  
67 @ISA = qw(Bio::EnsEMBL::Storable);
68  
69  
70 =head2 new
71  
72 Arg [1] : (optional) int $dbID
73 Arg [2] : (optional) string name
74 Arg [3] : (optional) string type
75 Arg [4] : (optional) int tag_count
76 Arg [5] : (optional) string sequence
77 Arg [6] : (optional) Bio::EnsEMBL::Map::DBSQL::DitagAdaptor $adaptor
78  
79 Description: Creates a new ditag
80 Returntype : Bio::EnsEMBL::Map::Ditag
81 Exceptions : none
82 Caller : general
83  
84 =cut
85  
86 sub new {
87 my ($caller, @args) = @_;
88 my ($dbID, $name, $type, $tag_count, $sequence, $adaptor) = rearrange(
89 [ 'DBID', 'NAME', 'TYPE', 'TAG_COUNT', 'SEQUENCE', 'ADAPTOR' ], @args);
90 my $class = ref($caller) || $caller;
91  
92 if(!$name or !$type or !$sequence) {
93 throw('Missing information for Ditag object:
94 Bio::EnsEMBL::Map::Ditag->new (
95 -dbID => $tag_id,
96 -name => $name,
97 -type => $type,
98 -tag_count => $tag_count,
99 -sequence => $sequence,
100 -adaptor => $dbAdaptor
101 );');
102 }
103  
104 if(!$tag_count){ $tag_count = 0; }
105  
106 if(!($sequence =~ /^[ATCGN]+$/i)){
107 throw('ditag sequence contains non-standard characters: '.$sequence);
108 }
109  
110 my $self = bless( {'dbID' => $dbID,
111 'name' => $name,
112 'type' => $type,
113 'tag_count' => $tag_count,
114 'sequence' => $sequence
115 }, $class);
116  
117 $self->adaptor($adaptor);
118 return $self;
119 }
120  
121 =head2 name
122  
123 Arg [1] : (optional) string $type
124 Example : $type = $ditag->name;
125 Description: Getter/Setter for the name of a ditag
126 Returntype : text
127 Caller : general
128  
129 =cut
130  
131 sub name {
132 my $self = shift;
133  
134 if(@_) {
135 $self->{'name'} = shift;
136 }
137  
138 return $self->{'name'};
139 }
140  
141 =head2 dbID
142  
143 Arg [1] : (optional) int id
144 Example : $ditag_id = $ditag->dbID;
145 Description: Getter/Setter for the dbID of a ditag
146 Returntype : int
147 Caller : general
148  
149 =cut
150  
151 sub dbID {
152 my $self = shift;
153  
154 if(@_) {
155 $self->{'dbID'} = shift;
156 }
157  
158 return $self->{'dbID'};
159 }
160  
161  
162 =head2 type
163  
164 Arg [1] : (optional) string $type
165 Example : $type = $ditag->type;
166 Description: Getter/Setter for the type of a ditag
167 Returntype : text
168 Caller : general
169  
170 =cut
171  
172 sub type {
173 my $self = shift;
174  
175 if(@_) {
176 $self->{'type'} = shift;
177 }
178  
179 return $self->{'type'};
180 }
181  
182 =head2 tag_count
183  
184 Arg [1] : (optional) string $tag_count
185 Example : $type = $ditag->tag_count;
186 Description: Getter/Setter for the tag_count of a ditag
187 Returntype : int
188 Caller : general
189  
190 =cut
191  
192 sub tag_count {
193 my $self = shift;
194  
195 if(@_) {
196 $self->{'tag_count'} = shift;
197 }
198  
199 return $self->{'tag_count'};
200 }
201  
202 =head2 sequence
203  
204 Arg [1] : (optional) string $sequence
205 Example : $sequence = $ditag->sequence;
206 Description: Getter/Setter for the sequence of a ditag
207 Returntype : text
208 Caller : general
209  
210 =cut
211  
212 sub sequence {
213 my $self = shift;
214  
215 if(@_) {
216 $self->{'sequence'} = shift;
217 }
218  
219 return $self->{'sequence'};
220 }
221  
222  
223 =head2 get_ditagFeatures
224  
225 Arg : none
226 Example : @features = @{$ditag->get_ditagFeatures};
227 Description: Fetch ditag_features created from this ditag
228 Returntype : listref of Bio::EnsEMBL::Map::DitagFeature
229 Caller : general
230  
231 =cut
232  
233 sub get_ditagFeatures {
234 my $self = shift;
235  
236 return $self->adaptor->db->get_adaptor("ditagFeature")
237 ->fetch_all_by_ditagID($self->dbID);
238 }
239  
240 1;