Motif.pm

filter: Statementstmt 15.6% 8 / 51 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 18.1% 2 / 11 Podpod 100% 9 / 9 totaltotal 25.3% 19 / 75 CC 4 SCAR 15.2
CC
4
Cov
15%
get_seqfeats
12.0
new
6.0
type
2.0
CRAP 4.6
« Util/Search.pm ↑ Summary DBSQL.pm »
1 package Bio::DOOP::Motif;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 Bio::DOOP::Motif - DOOP database motif object
9  
10 =head1 VERSION
11  
12 Version 0.7
13  
14 =cut
15  
16 2 our $VERSION = '0.7';
17  
18 =head1 SYNOPSIS
19  
20 use Bio::DOOP::Motif;
21  
22 $db = Bio::DOOP::DBSQL->connect("user","pass","database","somewhere.where.org");
23 my $motif = Bio::DOOP::Motif->new($db,"160945");
24 print $motif->seq,":",$motif->start," ",$motif->end,"\n";
25  
26 =head1 DESCRIPTION
27  
28 This object represents an evolutionary conserved motif from a subset.
29  
30 =head1 AUTHORS
31  
32 Tibor Nagy, Godollo, Hungary and Endre Sebestyen, Martonvasar, Hungary
33  
34 =head1 METHODS
35  
36 =head2 new
37  
38 Creates a new motif object from the motif primary id. You usually won't need this, as
39 you will get this object from other objects.
40  
41 Return type: Bio::DOOP::Motif object.
42  
43 $motif = Bio::DOOP::Motif->new($db,"1234");
44  
45 =cut
46  
47 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
48 0 my $dummy = shift;
49 0 my $db = shift;
50 0 my $id = shift;
51 0 my $self = {};
52  
53 0 my $ret = $db->query("SELECT * FROM motif_feature where motif_feature_primary_id=\"$id\";");
54  
55 0 ▶ if ($#$ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ret->$#* == -1) 0 0 0
56 0 return(-1);
57 }
58  
59 0 my @motif = @{$$ret[0]};
60 0 $self->{PRIMARY} = $motif[0];
61 0 $self->{SUBSET} = $motif[1];
62 0 $self->{CONSENSUS} = $motif[2];
63 0 $self->{TYPE} = $motif[3];
64 0 $self->{START} = $motif[4];
65 0 $self->{END} = $motif[5];
66 0 $self->{SUBSET_ID} = $motif[6];
67 0 $self->{DB} = $db;
68 0 bless $self;
69 0 return($self);
70 }
71  
72 =head2 type
73  
74 Returns the type of the motif.
75  
76 Return type : string
77
78 $motif_type = $motif->type;
79  
80 =cut
81  
82 0 ▶sub type {
Subroutine type: not called CC=1 SCAR=6.9
Pod documented
83 0 my $self = shift;
84 0 return($self->{TYPE});
85 }
86  
87 =head2 seq
88  
89 Returns the consensus sequence of the motif.
90  
91 Return type: string
92  
93 $motif_seq = $motif->seq;
94  
95 =cut
96  
97 0 ▶sub seq {
Subroutine seq: not called CC=1 SCAR=6.9
Pod documented
98 0 my $self = shift;
99 0 return($self->{CONSENSUS});
100 }
101  
102 =head2 start
103  
104 Returns the start position of the motif.
105  
106 Return type: string
107  
108 $start = $motif->start;
109  
110 =cut
111  
112 0 ▶sub start {
Subroutine start: not called CC=1 SCAR=6.9
Pod documented
113 0 my $self = shift;
114 0 return($self->{START});
115 }
116  
117 =head2 end
118  
119 Returns the end position of the motif.
120  
121 Return type: string;
122
123 $end = $motif->end;
124  
125 =cut
126  
127 0 ▶sub end {
Subroutine end: not called CC=1 SCAR=6.9
Pod documented
128 0 my $self = shift;
129 0 return($self->{END});
130 }
131  
132 =head2 length
133  
134 Returns the length of the motif.
135  
136 Return type: string
137  
138 $length = $motif->length;
139  
140 =cut
141  
142 0 ▶sub length {
Subroutine length: not called CC=1 SCAR=6.9
Pod documented
143 0 my $self = shift;
144 0 return($self->{END} - $self->{START} + 1);
145 }
146  
147 =head2 get_id
148  
149 Returns the primary ID of the motif. This is the internal ID from the MySQL database.
150  
151 Return type: string
152  
153 $primary_id = $motif->get_id;
154  
155 =cut
156  
157 0 ▶sub get_id {
Subroutine get_id: not called CC=1 SCAR=6.9
Pod documented
158 0 my $self = shift;
159 0 return($self->{PRIMARY});
160 }
161  
162 =head2 get_subset_id
163  
164 Returns the motif subset primary id.
165  
166 Return type: string
167  
168 $subset_id = $motif->get_subset_id;
169  
170 =cut
171  
172 0 ▶sub get_subset_id {
Subroutine get_subset_id: not called CC=1 SCAR=6.9
Pod documented
173 0 my $self = shift;
174 0 return($self->{SUBSET_ID});
175 }
176  
177 =head2 get_seqfeats
178  
179 Returns all the sequence features, associated with the motif. This basically means all the sequence
180 regions from which the motif was generated.
181  
182 Return type: arrayref, the array containing Bio::DOOP::SequenceFeature objects.
183  
184 @feats = @{$motif->get_seqfeats}
185  
186 =cut
187  
188 0 ▶sub get_seqfeats {
Subroutine get_seqfeats: not called CC=3 SCAR=24.8
Pod documented
189 0 my $self = shift;
190 0 my $db = $self->{DB};
191 0 my $id = $self->{PRIMARY};
192 0 my $ret = $db->query("SELECT sequence_feature_primary_id FROM sequence_feature WHERE motif_feature_primary_id = \"$id\";");
193  
194 0 ▶ if ($#$ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ret->$#* == -1) 0 0 0
195 0 return(-1);
196 }
197 0 my @seqfeats;
198  
199 0 for my $i (@$ret){
200 0 push @seqfeats,Bio::DOOP::SequenceFeature->new($db,$$i[0]);
201 }
202  
203 0 return(\@seqfeats);
204 }
205  
206 2 1;
« Util/Search.pm ↑ Summary DBSQL.pm »