line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Wrapper module for Coil Bio::Tools::Run::Coil |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Coil |
4
|
|
|
|
|
|
|
# originally written by Marc Sohrmann (ms2@sanger.ac.uk) |
5
|
|
|
|
|
|
|
# Written in BioPipe by Balamurugan Kumarasamy |
6
|
|
|
|
|
|
|
# Please direct questions and support issues to |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org) |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Bio::Tools::Run::Coil - wrapper for ncoils program |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Build a Coil factory |
21
|
|
|
|
|
|
|
my $factory = Bio::Tools::Run::Coil->new($params); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Pass the factory a Bio::Seq object |
24
|
|
|
|
|
|
|
# @feats is an array of Bio::SeqFeature::Generic objects |
25
|
|
|
|
|
|
|
my @feats = $factory->run($seq); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This module is a wrapper for the B program available via |
30
|
|
|
|
|
|
|
L for predicting |
31
|
|
|
|
|
|
|
coiled coils in protein sequences. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
By default it looks for an executable called I and data/parameter files |
34
|
|
|
|
|
|
|
in the directory specified by the I environmental variable. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 REFERENCES |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Lupas, van Dyke & Stock, |
39
|
|
|
|
|
|
|
I, |
40
|
|
|
|
|
|
|
Science B<252>:1162-1164, 1991. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Lupas, A., |
43
|
|
|
|
|
|
|
I, |
44
|
|
|
|
|
|
|
Meth. Enzymology B<266>:513-525, 1996. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 FEEDBACK |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 Mailing Lists |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
51
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to one |
52
|
|
|
|
|
|
|
of the Bioperl mailing lists. Your participation is much appreciated. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
55
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 Support |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
I |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
64
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
65
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
66
|
|
|
|
|
|
|
with code and data examples if at all possible. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 Reporting Bugs |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
71
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via the |
72
|
|
|
|
|
|
|
web: |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
http://redmine.open-bio.org/projects/bioperl/ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHORS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Coil |
79
|
|
|
|
|
|
|
originally written by Marc Sohrmann (ms2@sanger.ac.uk) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Written in BioPipe by Balamurugan Kumarasamy |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Please direct questions and support issues to |
84
|
|
|
|
|
|
|
# |
85
|
|
|
|
|
|
|
Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org) |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 APPENDIX |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
The rest of the documentation details each of the object |
90
|
|
|
|
|
|
|
methods. Internal methods are usually preceded with a _ |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
package Bio::Tools::Run::Coil; |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
62
|
use vars qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR |
97
|
1
|
|
|
1
|
|
100003
|
$PROGRAMNAME @COIL_PARAMS %OK_FIELD); |
|
1
|
|
|
|
|
1
|
|
98
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
99
|
1
|
|
|
1
|
|
515
|
use Bio::SeqIO; |
|
1
|
|
|
|
|
38628
|
|
|
1
|
|
|
|
|
28
|
|
100
|
1
|
|
|
1
|
|
6
|
use Bio::Root::Root; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
101
|
1
|
|
|
1
|
|
3
|
use Bio::Root::IO; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
102
|
1
|
|
|
1
|
|
432
|
use Bio::Tools::Coil; |
|
1
|
|
|
|
|
42933
|
|
|
1
|
|
|
|
|
31
|
|
103
|
1
|
|
|
1
|
|
379
|
use Bio::Tools::Run::WrapperBase; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
@ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
BEGIN { |
108
|
1
|
|
|
1
|
|
2
|
@COIL_PARAMS=qw(PROGRAM VERBOSE QUIET SILENT); |
109
|
1
|
|
|
|
|
2
|
foreach my $attr ( @COIL_PARAMS) |
110
|
4
|
|
|
|
|
619
|
{ $OK_FIELD{$attr}++; } |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub AUTOLOAD { |
114
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
115
|
0
|
|
|
|
|
0
|
my $attr = $AUTOLOAD; |
116
|
0
|
|
|
|
|
0
|
$attr =~ s/.*:://; |
117
|
0
|
|
|
|
|
0
|
$attr = uc $attr; |
118
|
0
|
0
|
|
|
|
0
|
$self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr}; |
119
|
0
|
0
|
|
|
|
0
|
$self->{$attr} = shift if @_; |
120
|
0
|
|
|
|
|
0
|
return $self->{$attr}; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 program_name |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Title : program_name |
126
|
|
|
|
|
|
|
Usage : $factory>program_name() |
127
|
|
|
|
|
|
|
Function: holds the program name |
128
|
|
|
|
|
|
|
Returns: string |
129
|
|
|
|
|
|
|
Args : None |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub program_name { |
134
|
6
|
|
|
6
|
1
|
22
|
return 'ncoils'; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 program_dir |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Title : program_dir |
140
|
|
|
|
|
|
|
Usage : $factory->program_dir(@params) |
141
|
|
|
|
|
|
|
Function: returns the program directory, obtained from ENV variable. |
142
|
|
|
|
|
|
|
Returns: string |
143
|
|
|
|
|
|
|
Args : |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub program_dir { |
148
|
3
|
50
|
|
3
|
1
|
11
|
return Bio::Root::IO->catfile($ENV{COILSDIR}) if $ENV{COILSDIR}; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 new |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Title : new |
154
|
|
|
|
|
|
|
Usage : $coil->new(@params) |
155
|
|
|
|
|
|
|
Function: creates a new Coil factory |
156
|
|
|
|
|
|
|
Returns: Bio::Tools::Run::Coil |
157
|
|
|
|
|
|
|
Args : |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub new { |
162
|
1
|
|
|
1
|
1
|
72
|
my ($class,@args) = @_; |
163
|
1
|
|
|
|
|
13
|
my $self = $class->SUPER::new(@args); |
164
|
1
|
|
|
|
|
13
|
my ($attr, $value); |
165
|
1
|
|
|
|
|
4
|
while (@args) { |
166
|
0
|
|
|
|
|
0
|
$attr = shift @args; |
167
|
0
|
|
|
|
|
0
|
$value = shift @args; |
168
|
0
|
0
|
|
|
|
0
|
next if( $attr =~ /^-/ ); # don't want named parameters |
169
|
0
|
0
|
|
|
|
0
|
if ($attr =~/PROGRAM/i) { |
170
|
0
|
|
|
|
|
0
|
$self->executable($value); |
171
|
0
|
|
|
|
|
0
|
next; |
172
|
|
|
|
|
|
|
} |
173
|
0
|
|
|
|
|
0
|
$self->$attr($value); |
174
|
|
|
|
|
|
|
} |
175
|
1
|
|
|
|
|
4
|
return $self; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 predict_protein_features |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Title : predict_protein_features() |
181
|
|
|
|
|
|
|
Usage : DEPRECATED. Use $obj->run instead. |
182
|
|
|
|
|
|
|
Function: Runs Coil and creates an array of featrues |
183
|
|
|
|
|
|
|
Returns : An array of Bio::SeqFeature::Generic objects |
184
|
|
|
|
|
|
|
Args : A Bio::PrimarySeqI |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub predict_protein_features{ |
189
|
0
|
|
|
0
|
1
|
|
return shift->run(@_); |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 run |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Title : run |
195
|
|
|
|
|
|
|
Usage : $obj->run($seq) |
196
|
|
|
|
|
|
|
Function: Runs Coil and creates an array of featrues |
197
|
|
|
|
|
|
|
Returns : An array of Bio::SeqFeature::Generic objects |
198
|
|
|
|
|
|
|
Args : A Bio::PrimarySeqI, or a Fasta filename. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub run{ |
203
|
0
|
|
|
0
|
1
|
|
my ($self,$seq) = @_; |
204
|
0
|
|
|
|
|
|
my @feats; |
205
|
|
|
|
|
|
|
|
206
|
0
|
0
|
|
|
|
|
if (ref($seq) ) { # it is an object |
207
|
0
|
0
|
|
|
|
|
if (ref($seq) =~ /GLOB/) { |
208
|
0
|
|
|
|
|
|
$self->throw("cannot use filehandle"); |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
my $infile1 = $self->_writeSeqFile($seq); |
212
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
$self->_input($infile1); |
214
|
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
@feats = $self->_run(); |
216
|
0
|
|
|
|
|
|
unlink $infile1; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
else { |
219
|
|
|
|
|
|
|
#The argument is not a seq object but a sequence in a fasta file. |
220
|
|
|
|
|
|
|
#Perhaps should check here or before if this file is fasta format...if not die |
221
|
|
|
|
|
|
|
#Here the file does not need to be created or deleted. Its already written and may be used by other runnables. |
222
|
|
|
|
|
|
|
|
223
|
0
|
|
|
|
|
|
$self->_input($seq); |
224
|
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
@feats = $self->_run(); |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
|
229
|
0
|
|
|
|
|
|
return @feats; |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 _input |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Title : _input |
236
|
|
|
|
|
|
|
Usage : obj->_input($seqFile) |
237
|
|
|
|
|
|
|
Function: Internal(not to be used directly) |
238
|
|
|
|
|
|
|
Returns : |
239
|
|
|
|
|
|
|
Args : |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub _input() { |
244
|
0
|
|
|
0
|
|
|
my ($self,$infile1) = @_; |
245
|
0
|
0
|
|
|
|
|
if(defined $infile1){ |
246
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
|
$self->{'input'}=$infile1; |
248
|
|
|
|
|
|
|
} |
249
|
0
|
|
|
|
|
|
return $self->{'input'}; |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head2 _run |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Title : _run |
256
|
|
|
|
|
|
|
Usage : $obj->_run() |
257
|
|
|
|
|
|
|
Function: Internal(not to be used directly) |
258
|
|
|
|
|
|
|
Returns : An array of Bio::SeqFeature::Generic objects |
259
|
|
|
|
|
|
|
Args : |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=cut |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
sub _run { |
264
|
0
|
|
|
0
|
|
|
my ($self)= @_; |
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
|
my ($tfh1,$outfile) = $self->io->tempfile(-dir=>$self->tempdir()); |
267
|
0
|
|
|
|
|
|
my $str =$self->executable." -f < ".$self->{'input'}." > ".$outfile; |
268
|
0
|
0
|
0
|
|
|
|
if($self->quiet || $self->verbose <=0 || $self->silent){ |
|
|
|
0
|
|
|
|
|
269
|
0
|
0
|
|
|
|
|
my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null'; |
270
|
0
|
|
|
|
|
|
$str.=" 2>$null"; |
271
|
|
|
|
|
|
|
} |
272
|
0
|
|
|
|
|
|
my $status = system($str); |
273
|
0
|
0
|
|
|
|
|
$self->throw( "Coil call ($str) crashed: $? \n") unless $status==0; |
274
|
|
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
my $coil_parser = Bio::Tools::Coil->new(); |
276
|
0
|
|
|
|
|
|
my $filehandle; |
277
|
0
|
0
|
|
|
|
|
if (ref ($outfile) !~ /GLOB/) { |
278
|
0
|
0
|
|
|
|
|
open (COIL, "<".$outfile) or $self->throw ("Couldn't open file ".$outfile.": $!\n"); |
279
|
0
|
|
|
|
|
|
$filehandle = \*COIL; |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
else { |
282
|
0
|
|
|
|
|
|
$filehandle = $outfile; |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
|
my @coil_feat; |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
while(my $coil_feat = $coil_parser->next_result($filehandle)){ |
288
|
|
|
|
|
|
|
|
289
|
0
|
|
|
|
|
|
push @coil_feat, $coil_feat; |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
0
|
|
|
|
|
|
$self->cleanup(); |
293
|
0
|
|
|
|
|
|
close($tfh1); |
294
|
0
|
|
|
|
|
|
undef $tfh1; |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
unlink $outfile; |
297
|
0
|
|
|
|
|
|
return @coil_feat; |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head2 _writeSeqFile |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Title : _writeSeqFile |
304
|
|
|
|
|
|
|
Usage : obj->_writeSeqFile($seq) |
305
|
|
|
|
|
|
|
Function: Internal(not to be used directly) |
306
|
|
|
|
|
|
|
Returns : |
307
|
|
|
|
|
|
|
Args : |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub _writeSeqFile{ |
312
|
0
|
|
|
0
|
|
|
my ($self,$seq) = @_; |
313
|
0
|
|
|
|
|
|
my ($tfh,$inputfile) = $self->io->tempfile(-dir=>$self->tempdir()); |
314
|
0
|
|
|
|
|
|
my $in = Bio::SeqIO->new(-fh => $tfh , '-format' => 'Fasta'); |
315
|
0
|
|
|
|
|
|
$in->write_seq($seq); |
316
|
|
|
|
|
|
|
|
317
|
0
|
|
|
|
|
|
return $inputfile; |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
1; |