line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::CUA::Seq; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Bio::CUA::Seq - a module processing sequence object |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Bio::CUA::Seq; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $obj = Bio::CUA::Seq->new( |
12
|
|
|
|
|
|
|
-seq => 'AGGTGCCG...', |
13
|
|
|
|
|
|
|
-id => 'test_id', |
14
|
|
|
|
|
|
|
-desc => 'sequence description' |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# available methods |
18
|
|
|
|
|
|
|
$obj->length; # get sequence length |
19
|
|
|
|
|
|
|
$obj->id; # get sequence id |
20
|
|
|
|
|
|
|
$obj->desc; # get sequence description |
21
|
|
|
|
|
|
|
$obj->seq; # get sequence string |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This module is called by L to create sequence |
26
|
|
|
|
|
|
|
object which has some basic methods required by the modules in the |
27
|
|
|
|
|
|
|
distribution L. The purpose of |
28
|
|
|
|
|
|
|
this module is to increase the portability of the distribution. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
5
|
|
|
5
|
|
74
|
use 5.006; |
|
5
|
|
|
|
|
13
|
|
33
|
5
|
|
|
5
|
|
18
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
129
|
|
34
|
5
|
|
|
5
|
|
18
|
use warnings; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
148
|
|
35
|
5
|
|
|
5
|
|
18
|
use base qw/Bio::CUA/; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
1837
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 new |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Title : new |
42
|
|
|
|
|
|
|
Usage : my $obj = Bio::CUA::Seq->new(%params); |
43
|
|
|
|
|
|
|
Function: create sequence object |
44
|
|
|
|
|
|
|
Returns : an object of this class |
45
|
|
|
|
|
|
|
Args : arguments are specified in a hash and acceptable keys as follows: |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=over 5 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item C<-seq> |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
the sequence string for the object, which can only be characters in |
52
|
|
|
|
|
|
|
the range A-Z and a-z. Other characters are eliminated by the method. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item C<-id> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
the sequence name |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item C<-desc> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
extra description of this sequence |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=back |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub new |
67
|
|
|
|
|
|
|
{ |
68
|
104
|
|
|
104
|
1
|
493
|
my ($caller, @args) = @_; |
69
|
|
|
|
|
|
|
|
70
|
104
|
|
|
|
|
351
|
my $self = $caller->SUPER::new(@args); |
71
|
|
|
|
|
|
|
|
72
|
104
|
|
|
|
|
250
|
my $hashRef = $self->_array_to_hash(\@args); |
73
|
|
|
|
|
|
|
|
74
|
104
|
|
|
|
|
224
|
my $str = $hashRef->{'seq'}; |
75
|
104
|
|
|
|
|
3075
|
$str =~ s/[^a-z]+//gi; # eliminate unknown chars |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
$self->warn("No valid sequence string found", |
78
|
104
|
0
|
|
|
|
249
|
exists $hashRef->{'id'}? "for ".$hashRef->{'id'}:"") |
|
|
50
|
|
|
|
|
|
79
|
|
|
|
|
|
|
unless($str); |
80
|
|
|
|
|
|
|
|
81
|
104
|
|
|
|
|
323
|
$self->set_tag('seqstr', $str); |
82
|
104
|
50
|
|
|
|
375
|
$self->set_tag('id', $hashRef->{'id'}) if(exists $hashRef->{'id'}); |
83
|
|
|
|
|
|
|
$self->set_tag('desc', $hashRef->{'desc'}) if(exists |
84
|
104
|
50
|
|
|
|
351
|
$hashRef->{'desc'}); |
85
|
|
|
|
|
|
|
|
86
|
104
|
|
|
|
|
417
|
return $self; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 length |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Title : length |
92
|
|
|
|
|
|
|
Usage : my $len = $self->length; |
93
|
|
|
|
|
|
|
Function: get the length of the sequence |
94
|
|
|
|
|
|
|
Returns : an integer |
95
|
|
|
|
|
|
|
Args : None |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub length |
100
|
|
|
|
|
|
|
{ |
101
|
13
|
|
|
13
|
1
|
68
|
my $str = $_[0]->get_tag('seqstr'); |
102
|
13
|
|
|
|
|
43
|
return length($str); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 id |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Title : id |
108
|
|
|
|
|
|
|
Usage : my $id = $self->id; |
109
|
|
|
|
|
|
|
Function: get sequence name/id |
110
|
|
|
|
|
|
|
Returns : a string |
111
|
|
|
|
|
|
|
Args : None |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub id |
116
|
|
|
|
|
|
|
{ |
117
|
91
|
|
|
91
|
1
|
236
|
$_[0]->get_tag('id'); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 desc |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Title : desc |
123
|
|
|
|
|
|
|
Usage : my $desc = $self->desc |
124
|
|
|
|
|
|
|
Function: get sequence description |
125
|
|
|
|
|
|
|
Returns : a string or undef if not exist |
126
|
|
|
|
|
|
|
Args : None |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub desc |
131
|
|
|
|
|
|
|
{ |
132
|
0
|
|
|
0
|
1
|
0
|
$_[0]->get_tag('desc'); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 seq |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Title : seq |
138
|
|
|
|
|
|
|
Usage : my $seq = $self->seq |
139
|
|
|
|
|
|
|
Function: get sequence string of the object |
140
|
|
|
|
|
|
|
Returns : a string |
141
|
|
|
|
|
|
|
Args : None |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub seq |
146
|
|
|
|
|
|
|
{ |
147
|
130
|
|
|
130
|
1
|
326
|
$_[0]->get_tag('seqstr'); |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 AUTHOR |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Zhenguo Zhang, C<< >> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 BUGS |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
157
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
158
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 SUPPORT |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
perldoc Bio::CUA::Seq |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
You can also look for information at: |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=over 4 |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
L |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
L |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * CPAN Ratings |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
L |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * Search CPAN |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
L |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=back |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Copyright 2015 Zhenguo Zhang. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify |
198
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
199
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
200
|
|
|
|
|
|
|
(at your option) any later version. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
203
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
204
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
205
|
|
|
|
|
|
|
GNU General Public License for more details. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
208
|
|
|
|
|
|
|
along with this program. If not, see L. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=cut |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
1; # End of Bio::CUA::Seq |