File Coverage

blib/lib/Bio/DOOP/SequenceFeature.pm
Criterion Covered Total %
statement 6 106 5.6
branch 0 14 0.0
condition n/a
subroutine 2 23 8.7
pod 21 21 100.0
total 29 164 17.6


line stmt bran cond sub pod time code
1             package Bio::DOOP::SequenceFeature;
2              
3 1     1   4 use strict;
  1         1  
  1         28  
4 1     1   5 use warnings;
  1         1  
  1         923  
5              
6             =head1 NAME
7              
8             Bio::DOOP::SequenceFeature - Object for the sequence features
9              
10             =head1 VERSION
11              
12             Version 0.10
13              
14             =cut
15              
16             our $VERSION = '0.10';
17              
18             =head1 SYNOPSIS
19              
20             my $seqfeat = Bio::DOOP::SequenceFeature->new($db,"112");
21             my $type = $seqfeat->get_type;
22              
23             =head1 DESCRIPTION
24              
25             This object gives access to the sequence features (conserved motif, repeat, CpG island,
26             TFBS and TSS annotation).
27              
28             =head1 AUTHORS
29              
30             Tibor Nagy, Godollo, Hungary and Endre Sebestyen, Martonvasar, Hungary
31              
32             =head1 METHODS
33              
34             =head2 new
35              
36             Creates a new sequence feature object from the sequence feature primary id.
37              
38             Return type: Bio::DOOP::SequenceFeature object
39              
40             $seqfeat = Bio::DOOP::SequenceFeature->new($db,"112");
41              
42             =cut
43              
44             sub new {
45 0     0 1   my $self = {};
46 0           my $dummy = shift;
47 0           my $db = shift;
48 0           my $id = shift;
49              
50 0           my $ret = $db->query("SELECT * FROM sequence_feature WHERE sequence_feature_primary_id = \"$id\";");
51              
52 0 0         if ($#$ret == -1) {
53 0           return(-1);
54             }
55 0           my @fields = @{$$ret[0]};
  0            
56              
57 0           $self->{PRIMARY} = $fields[0];
58 0           $self->{SCORE} = $fields[1];
59 0           $self->{START} = $fields[2];
60 0           $self->{END} = $fields[3];
61 0           $self->{SEQ} = $fields[4];
62 0           $self->{TYPE} = $fields[5];
63 0           $self->{MOTIFID} = $fields[6];
64 0           $self->{TFBSID} = $fields[7];
65 0           $self->{CPGID} = $fields[8];
66 0           $self->{REPEATID} = $fields[9];
67 0           $self->{SSRID} = $fields[10];
68 0           $self->{TSSID} = $fields[11];
69 0           $self->{SUBSET_ID} = $fields[12];
70 0           $self->{SEQ_ID} = $fields[13];
71              
72 0 0         if ($self->{TYPE} eq "ssr"){
    0          
    0          
    0          
    0          
    0          
73 0           $ret = $db->query("SELECT * FROM ssr_annotation WHERE ssr_primary_id = \"".$self->{SSRID}."\";");
74 0           @fields = @{$$ret[0]};
  0            
75 0           $self->{SSRUNIT} = $fields[1];
76             }
77             elsif ($self->{TYPE} eq "rep"){
78 0           $ret = $db->query("SELECT * FROM repeat_annotation WHERE repeat_primary_id = \"".$self->{REPEATID}."\";");
79 0           @fields = @{$$ret[0]};
  0            
80 0           $self->{R_NAME} = $fields[1];
81 0           $self->{R_CLASS} = $fields[2];
82 0           $self->{R_DESC} = $fields[3];
83 0           $self->{R_XREF} = $fields[4];
84             }
85             elsif ($self->{TYPE} eq "tfbs"){
86 0           $ret = $db->query("SELECT * FROM tfbs_annotation WHERE tfbs_primary_id = \"".$self->{TFBSID}."\";");
87 0           @fields = @{$$ret[0]};
  0            
88 0           $self->{TF_NAME} = $fields[1];
89 0           $self->{TF_ORIG} = $fields[2];
90 0           $self->{TF_DESC} = $fields[3];
91 0           $self->{TF_TYPE} = $fields[4];
92 0           $self->{TF_CONS} = $fields[5];
93 0           $self->{TF_MTRX} = $fields[6];
94 0           $self->{TF_XREF} = $fields[7];
95             }
96             elsif ($self->{TYPE} eq "cpg"){
97 0           $ret = $db->query("SELECT * FROM cpg_annotation WHERE cpg_primary_id = \"".$self->{CPGID}."\";");
98 0           @fields = @{$$ret[0]};
  0            
99 0           $self->{CPG_P} = $fields[1];
100             }
101             elsif ($self->{TYPE} eq "tss"){
102 0           $ret = $db->query("SELECT * FROM tss_annotation WHERE tss_primary_id = \"".$self->{TSSID}."\";");
103 0           @fields = @{$$ret[0]};
  0            
104 0           $self->{T_TYPE} = $fields[1];
105 0           $self->{T_ID} = $fields[2];
106 0           $self->{T_DESC} = $fields[3];
107 0           $self->{T_XREF} = $fields[4];
108             }
109             elsif ($self->{TYPE} eq "con"){
110 0           my $motif = Bio::DOOP::Motif->new($db,$self->{MOTIFID});
111 0           $self->{MOTIF} = $motif;
112             }
113              
114 0           bless $self;
115 0           return($self);
116             }
117              
118             =head2 get_id
119              
120             Returns the primary ID of the feature. This is the internal ID from the MySQL database.
121              
122             =cut
123              
124             sub get_id {
125 0     0 1   my $self = shift;
126 0           return($self->{PRIMARY});
127             }
128              
129             =head2 get_score
130              
131             This method is not yet implemented.
132              
133             =cut
134              
135             sub get_score {
136 0     0 1   my $self = shift;
137 0           return($self->{SCORE});
138             }
139              
140             =head2 get_start
141              
142             Returns the start position of the feature.
143              
144             =cut
145              
146             sub get_start {
147 0     0 1   my $self = shift;
148 0           return($self->{START});
149             }
150              
151             =head2 get_end
152              
153             Returns the end position of the feature.
154              
155             =cut
156              
157             sub get_end {
158 0     0 1   my $self = shift;
159 0           return($self->{END});
160             }
161              
162             =head2 length
163              
164             Returns the length of the feature.
165              
166             =cut
167              
168             sub length {
169 0     0 1   my $self = shift;
170 0           return($self->{END} - $self->{START} + 1);
171             }
172              
173             =head2 get_seq
174              
175             Returns the sequence of the feature.
176              
177             =cut
178              
179             sub get_seq {
180 0     0 1   my $self = shift;
181 0           return($self->{SEQ});
182             }
183              
184             =head2 get_type
185              
186             Returns the type of the feature. (con, ssr, tfbs, rep, cpg, tss).
187              
188             con : evolutionary conserved non-coding region
189             ssr : simple sequence repeat
190             tfbs : transcription factor binding site
191             rep : repeat
192             cpg : cpg island
193             tss : transcription start site
194              
195             =cut
196              
197             sub get_type {
198 0     0 1   my $self = shift;
199 0           return($self->{TYPE});
200             }
201              
202             =head2 get_motifid
203              
204             Returns the motif primary ID, if the feature type is "con".
205              
206             =cut
207              
208             sub get_motifid {
209 0     0 1   my $self = shift;
210 0           return($self->{MOTIFID});
211             }
212              
213             =head2 get_tfbsid
214              
215             Returns the tfbs primary ID, if the feature type is "tfbs".
216              
217             =cut
218              
219             sub get_tfbsid {
220 0     0 1   my $self = shift;
221 0           return($self->{TFBSID});
222             }
223              
224             =head2 get_cpgid
225              
226             Returns the cpg primary ID, if the feature type is "cpg".
227              
228             =cut
229              
230             sub get_cpgid {
231 0     0 1   my $self = shift;
232 0           return($self->{CPGID});
233             }
234              
235             =head2 get_repeatid
236              
237             Returns the repeat primary ID, if the feature type is "rep".
238              
239             =cut
240              
241             sub get_repeatid {
242 0     0 1   my $self = shift;
243 0           return($self->{REPEATID});
244             }
245              
246             =head2 get_ssrid
247              
248             Returns the ssr primary ID, if the feature type is "ssr".
249              
250             =cut
251              
252             sub get_ssrid {
253 0     0 1   my $self = shift;
254 0           return($self->{SSRID});
255             }
256              
257             =head2 get_tssid
258              
259             Returns the tss primary ID, if the feature type is "tss".
260              
261             =cut
262              
263             sub get_tssid {
264 0     0 1   my $self = shift;
265 0           return($self->{TSSID});
266             }
267              
268             =head2 get_seqid
269              
270             Returns the primary ID of the sequence containing this feature.
271              
272             =cut
273              
274             sub get_seqid {
275 0     0 1   my $self = shift;
276 0           return($self->{SEQ_ID});
277             }
278              
279             =head2 get_subsetid
280              
281             Returns the subset primary ID of the feature, if the feature type is "con".
282              
283             =cut
284              
285             sub get_subsetid {
286 0     0 1   my $self = shift;
287 0           return($self->{SUBSET_ID});
288             }
289              
290             =head2 get_motif
291              
292             Returns the motif object associated with the feature.
293             If the feature type is not "con" this value is NULL.
294              
295             =cut
296              
297             sub get_motif {
298 0     0 1   my $self = shift;
299 0           return($self->{MOTIF});
300             }
301              
302             =head2 get_tss_type
303              
304             Returns the tss type, if the feature type is "tss".
305              
306             =cut
307              
308             sub get_tss_type {
309 0     0 1   my $self = shift;
310 0           return($self->{T_TYPE});
311             }
312              
313             =head2 get_tss_id
314              
315             Returns the tss id, if the feature type is "tss".
316              
317             =cut
318              
319             sub get_tss_id {
320 0     0 1   my $self = shift;
321 0           return($self->{T_ID});
322             }
323              
324             =head2 get_tss_desc
325              
326             Returns the description of the tss, if the feature type is "tss".
327              
328             =cut
329              
330             sub get_tss_desc {
331 0     0 1   my $self = shift;
332 0           return($self->{T_DESC});
333             }
334              
335             =head2 get_tss_xref
336              
337             Returns the xref of the tss, if the feature type is "tss".
338              
339             =cut
340              
341             sub get_tss_xref {
342 0     0 1   my $self = shift;
343 0           return($self->{T_XREF});
344             }
345              
346             1;