| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#--------------------------------------------------------- |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Bio::Matrix::PSM::IO::meme - PSM meme parser implementation |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
See Bio::Matrix::PSM::IO for detailed documentation on how to use PSM parsers |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Parser for meme. |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 FEEDBACK |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head2 Mailing Lists |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this |
|
20
|
|
|
|
|
|
|
and other Bioperl modules. Send your comments and suggestions preferably |
|
21
|
|
|
|
|
|
|
to one of the Bioperl mailing lists. |
|
22
|
|
|
|
|
|
|
Your participation is much appreciated. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
|
25
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 Support |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
I |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
|
34
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
|
35
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
|
36
|
|
|
|
|
|
|
with code and data examples if at all possible. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 Reporting Bugs |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
|
41
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via the |
|
42
|
|
|
|
|
|
|
web: |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 AUTHOR - Stefan Kirov |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Email skirov@utk.edu |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 APPENDIX |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Let the code begin... |
|
56
|
|
|
|
|
|
|
package Bio::Matrix::PSM::IO::meme; |
|
57
|
2
|
|
|
2
|
|
539
|
use Bio::Matrix::PSM::InstanceSite; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
61
|
|
|
58
|
2
|
|
|
2
|
|
720
|
use Bio::Matrix::PSM::SiteMatrix; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
60
|
|
|
59
|
2
|
|
|
2
|
|
685
|
use Bio::Matrix::PSM::Psm; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
58
|
|
|
60
|
2
|
|
|
2
|
|
12
|
use vars qw(@HEADER); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
82
|
|
|
61
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
37
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
2
|
|
|
2
|
|
8
|
use base qw(Bio::Matrix::PSM::PsmHeader Bio::Matrix::PSM::IO); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
618
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
@Bio::Matrix::PSM::IO::meme::HEADER = qw(e_val sites IC width); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 new |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Title : new |
|
70
|
|
|
|
|
|
|
Usage : my $psmIO = Bio::Matrix::PSM::IO->new(-format=>'meme', |
|
71
|
|
|
|
|
|
|
-file=>$file); |
|
72
|
|
|
|
|
|
|
Function: Associates a file with the appropriate parser |
|
73
|
|
|
|
|
|
|
Throws : Throws if the file passed is in HTML format or |
|
74
|
|
|
|
|
|
|
if the MEME header cannot be found. |
|
75
|
|
|
|
|
|
|
Example : |
|
76
|
|
|
|
|
|
|
Args : hash |
|
77
|
|
|
|
|
|
|
Returns : "Bio::Matrix::PSM::$format"->new(@args); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub new { |
|
82
|
2
|
|
|
2
|
1
|
7
|
my($class, @args)=@_; |
|
83
|
2
|
|
|
|
|
10
|
my $self = $class->SUPER::new(@args); |
|
84
|
2
|
|
|
|
|
17
|
my ($file)=$self->_rearrange(['FILE'], @args); |
|
85
|
2
|
|
|
|
|
10
|
my ($query,$tr1)=split(/\./,$file,2); |
|
86
|
2
|
|
|
|
|
4
|
$self->{file} = $file; |
|
87
|
2
|
|
|
|
|
5
|
$self->{query}= $query; |
|
88
|
2
|
|
|
|
|
2
|
$self->{end} = 0; |
|
89
|
2
|
|
|
|
|
4
|
$self->{_strand}=0; #This we'll need to see if revcom option is used |
|
90
|
2
|
50
|
|
|
|
15
|
$self->_initialize_io(@args) || warn "Did you intend to use STDIN?"; #Read only for now |
|
91
|
|
|
|
|
|
|
#Skip header |
|
92
|
2
|
|
|
|
|
4
|
my $line; |
|
93
|
2
|
|
|
|
|
12
|
while (my $line=$self->_readline) { |
|
94
|
64
|
50
|
|
|
|
92
|
$self->throw('Cannot parse HTML, please use text output\n') if ($line=~//); #Should start parsing HTML output, not a bug deal |
|
95
|
64
|
|
|
|
|
64
|
chomp($line); |
|
96
|
64
|
100
|
|
|
|
72
|
if ($line=~"^ALPHABET") { |
|
97
|
2
|
|
|
|
|
7
|
$self=_parse_coordinates($self); |
|
98
|
2
|
|
|
|
|
5
|
last; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
62
|
100
|
100
|
|
|
167
|
push @{$self->{unstructured}},$line unless (($line=~/\*{10,}/) || ($line eq '')); |
|
|
32
|
|
|
|
|
73
|
|
|
101
|
|
|
|
|
|
|
} |
|
102
|
2
|
|
|
|
|
15
|
$self->_initialize; |
|
103
|
2
|
|
|
|
|
14
|
return $self; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 _parse_coordinates |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Title : _parse_coordinates |
|
109
|
|
|
|
|
|
|
Usage : |
|
110
|
|
|
|
|
|
|
Function: |
|
111
|
|
|
|
|
|
|
Throws : |
|
112
|
|
|
|
|
|
|
Example : Internal stuff |
|
113
|
|
|
|
|
|
|
Returns : |
|
114
|
|
|
|
|
|
|
Args : |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub _parse_coordinates { |
|
119
|
2
|
|
|
2
|
|
3
|
my $self=shift; |
|
120
|
2
|
|
|
|
|
4
|
$self->_readline; |
|
121
|
2
|
|
|
|
|
4
|
$self->_readline; |
|
122
|
2
|
|
|
|
|
4
|
my $line=$self->_readline; |
|
123
|
2
|
|
|
|
|
5
|
while ($line !~ /^\*{10,}/ ) { |
|
124
|
4
|
|
|
|
|
6
|
chomp $line; |
|
125
|
4
|
|
|
|
|
22
|
$line =~ s/\s+/,/g; |
|
126
|
4
|
|
|
|
|
14
|
my ($id1,$w1,$l1,$id2,$w2,$l2)=split(/,/,$line); |
|
127
|
4
|
|
|
|
|
5
|
push @{$self->{hid}},$id1; |
|
|
4
|
|
|
|
|
9
|
|
|
128
|
4
|
|
|
|
|
9
|
$self->{weight}->{$id1}=$w1; |
|
129
|
4
|
|
|
|
|
11
|
$self->{length}->{$id1}=$l1; |
|
130
|
4
|
50
|
|
|
|
7
|
if ($id2) { |
|
131
|
4
|
|
|
|
|
6
|
push @{$self->{hid}},$id2; |
|
|
4
|
|
|
|
|
5
|
|
|
132
|
4
|
|
|
|
|
7
|
$self->{weight}->{$id2}=$w2; |
|
133
|
4
|
|
|
|
|
5
|
$self->{length}->{$id2}=$l2; |
|
134
|
|
|
|
|
|
|
} |
|
135
|
4
|
|
|
|
|
8
|
$line=$self->_readline; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
2
|
|
|
|
|
5
|
return $self; |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 header |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Title : header |
|
143
|
|
|
|
|
|
|
Usage : my %header=$psmIO->header; |
|
144
|
|
|
|
|
|
|
Function: Returns the header for the MEME file |
|
145
|
|
|
|
|
|
|
Throws : |
|
146
|
|
|
|
|
|
|
Example : Fetching all the sequences included in the MEME analysis, |
|
147
|
|
|
|
|
|
|
being parsed |
|
148
|
|
|
|
|
|
|
my %header=$psmIO->header; |
|
149
|
|
|
|
|
|
|
foreach my $seqid (@{$header{instances}}) { |
|
150
|
|
|
|
|
|
|
my $seq=$db->get_Seq_by_acc($id); |
|
151
|
|
|
|
|
|
|
#Do something with the sequence |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
where $db might be Bio::DB:GenBank object, see |
|
154
|
|
|
|
|
|
|
Returns : Hash with three keys: instances, weights and lengths, which |
|
155
|
|
|
|
|
|
|
should be self-explenatory. Each value is an array |
|
156
|
|
|
|
|
|
|
reference. Each array element corresponds to the same |
|
157
|
|
|
|
|
|
|
element in the other two arrays. So $header{instances}->[$i] |
|
158
|
|
|
|
|
|
|
will refer to the same sequence in the motif file as |
|
159
|
|
|
|
|
|
|
$header{weights}->[$i] and $header{lengths}->[$i] |
|
160
|
|
|
|
|
|
|
Args : none |
|
161
|
|
|
|
|
|
|
Notes : OBSOLETE! |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub header { |
|
166
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
|
167
|
0
|
|
|
|
|
0
|
my @instances=@{$self->{_inst_name}}; |
|
|
0
|
|
|
|
|
0
|
|
|
168
|
0
|
|
|
|
|
0
|
my @weights=@{$self->{_inst_weight}}; |
|
|
0
|
|
|
|
|
0
|
|
|
169
|
0
|
|
|
|
|
0
|
my @lengths=@{$self->{_inst_coord}}; |
|
|
0
|
|
|
|
|
0
|
|
|
170
|
0
|
|
|
|
|
0
|
return (instances=>\@instances,weights=>\@weights,lengths=>\@lengths); |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 next_psm |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Title : next_psm |
|
176
|
|
|
|
|
|
|
Usage : my $psm=$psmIO->next_psm(); |
|
177
|
|
|
|
|
|
|
Function: Reads the next PSM from the input file, associated with this object |
|
178
|
|
|
|
|
|
|
Throws : Throws if the format is inconsistent with the rules for MEME 3.0.4: |
|
179
|
|
|
|
|
|
|
no SUMMARY Section present or some keywords are missing/altered. |
|
180
|
|
|
|
|
|
|
Example : |
|
181
|
|
|
|
|
|
|
Returns : Bio::Matrix::PSM::Psm object |
|
182
|
|
|
|
|
|
|
Args : none |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=cut |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub next_psm { |
|
187
|
|
|
|
|
|
|
#Parses the next prediction and returns a psm objects |
|
188
|
2
|
|
|
2
|
1
|
8
|
my $self=shift; |
|
189
|
2
|
50
|
|
|
|
6
|
return if ($self->{end}); |
|
190
|
2
|
|
|
|
|
5
|
my ($endm,$line,$instances,$tr,$width,$motif_id,$sites,$e_val,$id,$ic,$lA,$lC,$lG,$lT); |
|
191
|
2
|
|
|
|
|
6
|
while (defined( $line = $self->_readline) ) { |
|
192
|
|
|
|
|
|
|
#Check if revcom is enabled, not very original check.... |
|
193
|
182
|
50
|
66
|
|
|
310
|
$self->{_strand}=1 if (($line=~/^Sequence name/) && ($line=~/Strand/)); |
|
194
|
182
|
100
|
|
|
|
238
|
if ($line=~ m/\sSite\s/) { |
|
195
|
2
|
|
|
|
|
5
|
$instances= $self->_parseInstance; |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
#Here starts the next motif |
|
198
|
182
|
100
|
100
|
|
|
252
|
if ( ($line=~/width/) && ($line=~/sites/)) { |
|
199
|
2
|
|
|
|
|
5
|
chomp($line); |
|
200
|
2
|
|
|
|
|
23
|
$line=~s/[\t\s=]+/,/g; |
|
201
|
2
|
|
|
|
|
4
|
$line=~s/\t/,/g; |
|
202
|
|
|
|
|
|
|
#Parsing the general information for this prediction |
|
203
|
2
|
|
|
|
|
8
|
($tr,$motif_id,$tr,$width,$tr,$sites, |
|
204
|
|
|
|
|
|
|
$tr,$tr,$tr,$e_val)=split(/,/,$line); |
|
205
|
2
|
|
|
|
|
6
|
$self->{id}=$self->{query} . $motif_id; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
182
|
100
|
|
|
|
268
|
if ($line =~ /content/i) { |
|
208
|
2
|
|
|
|
|
4
|
$line=$self->_readline; |
|
209
|
2
|
|
|
|
|
3
|
chomp($line); |
|
210
|
2
|
|
|
|
|
8
|
$line=~s/[\)\(]//g; |
|
211
|
2
|
|
|
|
|
7
|
($ic)=split(/\s/,$line); |
|
212
|
|
|
|
|
|
|
} |
|
213
|
|
|
|
|
|
|
#Last info-prob matrix data |
|
214
|
182
|
100
|
|
|
|
236
|
if ($line=~/position-specific\s+scoring matrix/) { |
|
215
|
2
|
|
|
|
|
13
|
($lA,$lC,$lG,$lT)=_parse_logs($self); |
|
216
|
|
|
|
|
|
|
} |
|
217
|
182
|
100
|
|
|
|
220
|
if ($line=~/^letter-probability\smatrix/) { |
|
218
|
2
|
|
|
|
|
7
|
my %matrix_dat=$self->_parseMatrix($motif_id); |
|
219
|
2
|
|
|
|
|
31
|
my $psm= Bio::Matrix::PSM::Psm->new(%matrix_dat, |
|
220
|
|
|
|
|
|
|
-instances=>$instances, |
|
221
|
|
|
|
|
|
|
-e_val=>$e_val, |
|
222
|
|
|
|
|
|
|
-IC=>$ic, |
|
223
|
|
|
|
|
|
|
-width=>$width, |
|
224
|
|
|
|
|
|
|
-sites=>$sites, |
|
225
|
|
|
|
|
|
|
-lA=>$lA, |
|
226
|
|
|
|
|
|
|
-lC=>$lC, |
|
227
|
|
|
|
|
|
|
-lG=>$lG, |
|
228
|
|
|
|
|
|
|
-lT=>$lT, |
|
229
|
|
|
|
|
|
|
); |
|
230
|
2
|
|
|
|
|
11
|
return $psm; |
|
231
|
|
|
|
|
|
|
} |
|
232
|
180
|
50
|
|
|
|
204
|
if ($line=~"SUMMARY OF MOTIFS") { |
|
233
|
0
|
|
|
|
|
0
|
$self->{end}=1; |
|
234
|
0
|
|
|
|
|
0
|
return; |
|
235
|
|
|
|
|
|
|
} |
|
236
|
180
|
50
|
|
|
|
296
|
$endm=1 if ($line=~/^Time\s/); |
|
237
|
|
|
|
|
|
|
} |
|
238
|
0
|
0
|
|
|
|
0
|
if ($endm) { #End of file found, end of current motif too, but not all predictions were made as requested (No summary) |
|
239
|
0
|
|
|
|
|
0
|
$self->{end}=1; |
|
240
|
0
|
|
|
|
|
0
|
warn "This MEME analysis was terminated prematurely, you may have less motifs than you requested\n"; |
|
241
|
0
|
|
|
|
|
0
|
return; |
|
242
|
|
|
|
|
|
|
} |
|
243
|
0
|
|
|
|
|
0
|
$self->throw("Wrong format\n"); # Multiple keywords not found, probably wrong format |
|
244
|
|
|
|
|
|
|
} |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head2 _parseMatrix |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Title : _parseMatrix |
|
249
|
|
|
|
|
|
|
Usage : |
|
250
|
|
|
|
|
|
|
Function: Parses the next site matrix information in the meme file |
|
251
|
|
|
|
|
|
|
Throws : |
|
252
|
|
|
|
|
|
|
Example : Internal stuff |
|
253
|
|
|
|
|
|
|
Returns : hash as for constructing a SiteMatrix object (see SiteMatrixI) |
|
254
|
|
|
|
|
|
|
Args : string |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=cut |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub _parseMatrix { |
|
259
|
2
|
|
|
2
|
|
3
|
my ($self,$id)=@_; |
|
260
|
2
|
|
|
|
|
8
|
my (@pA,@pC,@pG,@pT); |
|
261
|
2
|
|
|
|
|
4
|
my $i=0; |
|
262
|
2
|
|
|
|
|
3
|
my $line = $self->_readline; |
|
263
|
|
|
|
|
|
|
#Most important part- the probability matrix |
|
264
|
2
|
|
|
|
|
3
|
do { |
|
265
|
50
|
|
|
|
|
60
|
chomp $line; |
|
266
|
50
|
50
|
|
|
|
65
|
last if ($line eq ''); |
|
267
|
50
|
|
|
|
|
120
|
$line=~s/^\s+//; |
|
268
|
50
|
|
|
|
|
183
|
$line=~s/\s+/,/g; |
|
269
|
50
|
|
|
|
|
163
|
($pA[$i],$pC[$i],$pG[$i],$pT[$i])=split(/,/,$line); |
|
270
|
50
|
|
|
|
|
68
|
$i++; |
|
271
|
50
|
|
|
|
|
71
|
$line=$self->_readline; |
|
272
|
|
|
|
|
|
|
} until $line =~ /\-{10,}/; |
|
273
|
2
|
|
|
|
|
19
|
return (-pA=>\@pA,-pC=>\@pC,-pG=>\@pG,-pT=>\@pT,-id=>$id); |
|
274
|
|
|
|
|
|
|
} |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head2 _parse_logs |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Title : _parse_logs |
|
279
|
|
|
|
|
|
|
Usage : |
|
280
|
|
|
|
|
|
|
Function: Parses the next site matrix log values in the meme file |
|
281
|
|
|
|
|
|
|
Throws : |
|
282
|
|
|
|
|
|
|
Example : Internal stuff |
|
283
|
|
|
|
|
|
|
Returns : array of array refs |
|
284
|
|
|
|
|
|
|
Args : string |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=cut |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
sub _parse_logs { |
|
289
|
2
|
|
|
2
|
|
4
|
my $self=shift; |
|
290
|
2
|
|
|
|
|
4
|
my (@lA,@lC,@lG,@lT); |
|
291
|
2
|
|
|
|
|
5
|
my $i=0; |
|
292
|
2
|
|
|
|
|
5
|
$self->_readline; $self->_readline; |
|
|
2
|
|
|
|
|
4
|
|
|
293
|
2
|
|
|
|
|
4
|
my $line = $self->_readline; |
|
294
|
|
|
|
|
|
|
#Most important part- the probability matrix |
|
295
|
2
|
|
|
|
|
2
|
do { |
|
296
|
50
|
|
|
|
|
56
|
chomp $line; |
|
297
|
50
|
50
|
|
|
|
63
|
last if ($line eq ''); |
|
298
|
50
|
|
|
|
|
107
|
$line=~s/^\s+//; |
|
299
|
50
|
|
|
|
|
156
|
$line=~s/\s+/,/g; |
|
300
|
50
|
|
|
|
|
163
|
($lA[$i],$lC[$i],$lG[$i],$lT[$i])=split(/,/,$line); |
|
301
|
50
|
|
|
|
|
57
|
$i++; |
|
302
|
50
|
|
|
|
|
66
|
$line=$self->_readline; |
|
303
|
|
|
|
|
|
|
} until $line =~ /\-{10,}/; |
|
304
|
|
|
|
|
|
|
|
|
305
|
2
|
|
|
|
|
8
|
return (\@lA,\@lC,\@lG,\@lT); |
|
306
|
|
|
|
|
|
|
} |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=head2 _parseInstance |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
Title : _parseInstance |
|
311
|
|
|
|
|
|
|
Usage : |
|
312
|
|
|
|
|
|
|
Function: Parses the next sites instances from the meme file |
|
313
|
|
|
|
|
|
|
Throws : |
|
314
|
|
|
|
|
|
|
Example : Internal stuff |
|
315
|
|
|
|
|
|
|
Returns : Bio::Matrix::PSM::InstanceSite object |
|
316
|
|
|
|
|
|
|
Args : none |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=cut |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
sub _parseInstance { |
|
321
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
|
322
|
2
|
|
|
|
|
2
|
my $i=0; |
|
323
|
2
|
|
|
|
|
4
|
$self->_readline; |
|
324
|
2
|
|
|
|
|
3
|
my ($line,@instance); |
|
325
|
2
|
|
|
|
|
5
|
while (defined($line=$self->_readline) ) { |
|
326
|
10
|
100
|
|
|
|
31
|
last if ($line =~ /\-{5}/ ); |
|
327
|
8
|
|
|
|
|
11
|
chomp($line); |
|
328
|
8
|
|
|
|
|
43
|
my @comp=split(/\s+/,$line); |
|
329
|
8
|
|
|
|
|
11
|
my ($id,$start,$score,$strand,$s1,$s2,$s3); |
|
330
|
8
|
50
|
|
|
|
18
|
if ( $self->{_strand}) { |
|
331
|
0
|
|
|
|
|
0
|
($id,$strand,$start,$score,$s1,$s2,$s3)=@comp; |
|
332
|
|
|
|
|
|
|
} else { |
|
333
|
8
|
|
|
|
|
16
|
($id,$start,$score,$s1,$s2,$s3)=@comp; |
|
334
|
8
|
|
|
|
|
10
|
$strand=1; |
|
335
|
|
|
|
|
|
|
} |
|
336
|
8
|
|
|
|
|
16
|
my $seq= $s1.$s2.$s3; |
|
337
|
8
|
50
|
|
|
|
28
|
if ($seq =~ /[^ACGTacgtNnXx\-\.]/) { |
|
338
|
0
|
|
|
|
|
0
|
my $col=$#comp; |
|
339
|
0
|
|
|
|
|
0
|
$self->throw("I have not been able to parse the correct instance sequence: $seq, $col columns\n"); |
|
340
|
|
|
|
|
|
|
} |
|
341
|
8
|
|
|
|
|
15
|
my $sid = $self->{id} . '@' . $id; |
|
342
|
|
|
|
|
|
|
$instance[$i] = Bio::Matrix::PSM::InstanceSite->new |
|
343
|
|
|
|
|
|
|
(-mid => $self->{id}, |
|
344
|
8
|
|
|
|
|
39
|
-start => $start, |
|
345
|
|
|
|
|
|
|
-score => $score, |
|
346
|
|
|
|
|
|
|
-seq => $seq, |
|
347
|
|
|
|
|
|
|
-strand => $strand, |
|
348
|
|
|
|
|
|
|
-accession_number => $id, |
|
349
|
|
|
|
|
|
|
-primary_id => $sid, |
|
350
|
|
|
|
|
|
|
-desc => 'Bioperl MEME parser object' ); |
|
351
|
8
|
|
|
|
|
53
|
$i++; |
|
352
|
|
|
|
|
|
|
} |
|
353
|
2
|
|
|
|
|
5
|
$self->{instances} = \@instance; |
|
354
|
2
|
|
|
|
|
4
|
return \@instance; |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
1; |