line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright Balamurugan Kumarasamy |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
6
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Bio::Tools::Run::Tmhmm - Object for identifying transmembrane helixes |
12
|
|
|
|
|
|
|
in a given protein seequence. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Build a Tmhmm factory |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# $paramfile is the full path to the seg binary file |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @params = ('PROGRAM',$paramfile); |
21
|
|
|
|
|
|
|
my $factory = Bio::Tools::Run::Tmhmm->new($param); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Pass the factory a Bio::Seq object |
24
|
|
|
|
|
|
|
# @feats is an array of Bio::SeqFeature::Generic objects |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my @feats = $factory->run($seq); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Tmhmm is a program for identifying transmembrane helices in proteins. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
You must have the environmental variable TMHMMDIR set to the base |
33
|
|
|
|
|
|
|
directory where I and it's associated data/option files reside |
34
|
|
|
|
|
|
|
(NOT the bin directory where the actual executable resides) |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 FEEDBACK |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 Mailing Lists |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
41
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to one |
42
|
|
|
|
|
|
|
of the Bioperl mailing lists. Your participation is much appreciated. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
45
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
head2 Reporting Bugs |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
50
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via the |
51
|
|
|
|
|
|
|
web: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
http://redmine.open-bio.org/projects/bioperl/ |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR - Bala |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Email savikalpa@fugu-sg.org |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 APPENDIX |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The rest of the documentation details each of the object |
63
|
|
|
|
|
|
|
methods. Internal methods are usually preceded with a _ |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
package Bio::Tools::Run::Tmhmm; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
1
|
|
118276
|
use vars qw($AUTOLOAD @ISA $PROGRAMNAME @TMHMM_PARAMS %OK_FIELD); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
68
|
|
70
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
71
|
1
|
|
|
1
|
|
3
|
use Cwd; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
72
|
1
|
|
|
1
|
|
403
|
use Bio::SeqIO; |
|
1
|
|
|
|
|
38630
|
|
|
1
|
|
|
|
|
31
|
|
73
|
1
|
|
|
1
|
|
8
|
use Bio::Root::Root; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
74
|
1
|
|
|
1
|
|
4
|
use Bio::Root::IO; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
75
|
1
|
|
|
1
|
|
285
|
use Bio::Tools::Tmhmm; |
|
1
|
|
|
|
|
43692
|
|
|
1
|
|
|
|
|
64
|
|
76
|
1
|
|
|
1
|
|
590
|
use Bio::Tools::Run::WrapperBase; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
103
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
@ISA = qw(Bio::Tools::Run::WrapperBase); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
BEGIN { |
81
|
1
|
50
|
|
1
|
|
8
|
$PROGRAMNAME = 'tmhmm' . ($^O =~ /mswin/i ?'.exe':''); |
82
|
1
|
|
|
|
|
3
|
@TMHMM_PARAMS=qw(PROGRAM VERBOSE NOPLOT); |
83
|
1
|
|
|
|
|
3
|
foreach my $attr ( @TMHMM_PARAMS) |
84
|
3
|
|
|
|
|
823
|
{ $OK_FIELD{$attr}++; } |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 program_name |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Title : program_name |
90
|
|
|
|
|
|
|
Usage : $factory>program_name() |
91
|
|
|
|
|
|
|
Function: holds the program name |
92
|
|
|
|
|
|
|
Returns: string |
93
|
|
|
|
|
|
|
Args : None |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub program_name { |
98
|
4
|
|
|
4
|
1
|
28
|
return $PROGRAMNAME; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 program_dir |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Title : program_dir |
104
|
|
|
|
|
|
|
Usage : $factory->program_dir(@params) |
105
|
|
|
|
|
|
|
Function: returns the program directory, obtained from ENV variable, in this |
106
|
|
|
|
|
|
|
case it is the tmhmm installation directory, not the location of |
107
|
|
|
|
|
|
|
the executable. |
108
|
|
|
|
|
|
|
Returns: string |
109
|
|
|
|
|
|
|
Args : |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub program_dir { |
114
|
3
|
|
50
|
3
|
1
|
18
|
return $ENV{TMHMMDIR} || ''; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 program_path |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Title : program_path |
120
|
|
|
|
|
|
|
Usage : my $path = $factory->program_path(); |
121
|
|
|
|
|
|
|
Function: Builds path for executable |
122
|
|
|
|
|
|
|
Returns : string representing the full path to the exe |
123
|
|
|
|
|
|
|
Args : none |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub program_path { |
128
|
2
|
|
|
2
|
1
|
5
|
my ($self) = @_; |
129
|
2
|
|
|
|
|
3
|
my @path; |
130
|
2
|
50
|
|
|
|
6
|
if ($self->program_dir) { |
131
|
0
|
|
|
|
|
0
|
my $program_dir = $self->program_dir; |
132
|
0
|
|
|
|
|
0
|
$program_dir =~ s/\/bin//; |
133
|
0
|
|
|
|
|
0
|
push @path, $program_dir; |
134
|
|
|
|
|
|
|
} |
135
|
2
|
|
|
|
|
5
|
push @path, 'bin'; |
136
|
2
|
50
|
|
|
|
6
|
push @path, $self->program_name.($^O =~ /mswin/i ?'.exe':''); |
137
|
|
|
|
|
|
|
|
138
|
2
|
|
|
|
|
35
|
return File::Spec->catfile(@path); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub AUTOLOAD { |
142
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
143
|
0
|
|
|
|
|
0
|
my $attr = $AUTOLOAD; |
144
|
0
|
|
|
|
|
0
|
$attr =~ s/.*:://; |
145
|
0
|
|
|
|
|
0
|
$attr = uc $attr; |
146
|
0
|
0
|
|
|
|
0
|
$self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr}; |
147
|
0
|
0
|
|
|
|
0
|
$self->{$attr} = shift if @_; |
148
|
0
|
|
|
|
|
0
|
return $self->{$attr}; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 new |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Title : new |
154
|
|
|
|
|
|
|
Usage : $rm->new(@params) |
155
|
|
|
|
|
|
|
Function: creates a new Tmhmm factory |
156
|
|
|
|
|
|
|
Returns: Bio::Tools::Run::Tmhmm |
157
|
|
|
|
|
|
|
Args : |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub new { |
162
|
1
|
|
|
1
|
1
|
88
|
my ($class,@args) = @_; |
163
|
1
|
|
|
|
|
15
|
my $self = $class->SUPER::new(@args); |
164
|
|
|
|
|
|
|
|
165
|
1
|
|
|
|
|
14
|
my ($attr, $value); |
166
|
1
|
|
|
|
|
4
|
while (@args) { |
167
|
0
|
|
|
|
|
0
|
$attr = shift @args; |
168
|
0
|
|
|
|
|
0
|
$value = shift @args; |
169
|
0
|
0
|
|
|
|
0
|
next if( $attr =~ /^-/ ); # don't want named parameters |
170
|
0
|
|
|
|
|
0
|
$self->$attr($value); |
171
|
|
|
|
|
|
|
} |
172
|
1
|
|
|
|
|
2
|
return $self; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 predict_protein_features |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Title : predict_protein_features() |
178
|
|
|
|
|
|
|
Usage : DEPRECATED Use $obj->run($seq) instead |
179
|
|
|
|
|
|
|
Function: Runs Tmhmm and creates an array of featrues |
180
|
|
|
|
|
|
|
Returns : An array of Bio::SeqFeature::Generic objects |
181
|
|
|
|
|
|
|
Args : A Bio::PrimarySeqI |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=cut |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub predict_protein_features{ |
186
|
0
|
|
|
0
|
1
|
0
|
return shift->run(@_); |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head2 executable |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Title : executable |
192
|
|
|
|
|
|
|
Usage : my $exe = $tmhmm->executable('tmhmm'); |
193
|
|
|
|
|
|
|
Function: Finds the full path to the 'tmhmm' executable |
194
|
|
|
|
|
|
|
Returns : string representing the full path to the exe |
195
|
|
|
|
|
|
|
Args : [optional] name of executable to set path to |
196
|
|
|
|
|
|
|
[optional] boolean flag whether or not warn when exe is not found |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub executable { |
201
|
1
|
|
|
1
|
1
|
951
|
my $self = shift; |
202
|
1
|
|
0
|
|
|
9
|
my $exe = $self->SUPER::executable(@_) || return; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
# even if its executable, we still need the environment variable to have |
205
|
|
|
|
|
|
|
# been set |
206
|
0
|
0
|
|
|
|
|
if (! $ENV{TMHMMDIR}) { |
207
|
0
|
|
|
|
|
|
$self->warn("Environment variable TMHMMDIR must be set, even if the tmhmm executable is in your path"); |
208
|
0
|
|
|
|
|
|
return undef; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
return $exe; |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 run |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Title : run() |
217
|
|
|
|
|
|
|
Usage : $obj->run($seq) |
218
|
|
|
|
|
|
|
Function: Runs Tmhmm and creates an array of featrues |
219
|
|
|
|
|
|
|
Returns : An array of Bio::SeqFeature::Generic objects |
220
|
|
|
|
|
|
|
Args : A Bio::PrimarySeqI |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=cut |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub run { |
225
|
0
|
|
|
0
|
1
|
|
my ($self,$seq) = @_; |
226
|
0
|
|
|
|
|
|
my @feats; |
227
|
|
|
|
|
|
|
|
228
|
0
|
0
|
|
|
|
|
if (ref($seq) ) { # it is an object |
229
|
0
|
0
|
|
|
|
|
if (ref($seq) =~ /GLOB/) { |
230
|
0
|
|
|
|
|
|
$self->throw("cannot use filehandle"); |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
0
|
|
|
|
|
|
my $infile1 = $self->_writeSeqFile($seq); |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
|
$self->_input($infile1); |
236
|
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
|
@feats = $self->_run(); |
238
|
0
|
|
|
|
|
|
unlink $infile1; |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
else { |
242
|
|
|
|
|
|
|
# The clone object is not a seq object but a file. Perhaps |
243
|
|
|
|
|
|
|
# should check here or before if this file is fasta format...if |
244
|
|
|
|
|
|
|
# not die Here the file does not need to be created or |
245
|
|
|
|
|
|
|
# deleted. Its already written and may be used by other |
246
|
|
|
|
|
|
|
# runnables. |
247
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
$self->_input($seq); |
249
|
0
|
|
|
|
|
|
@feats = $self->_run(); |
250
|
|
|
|
|
|
|
} |
251
|
0
|
|
|
|
|
|
return @feats; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head2 _input |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
Title : _input |
258
|
|
|
|
|
|
|
Usage : obj->_input($seqFile) |
259
|
|
|
|
|
|
|
Function: Internal(not to be used directly) |
260
|
|
|
|
|
|
|
Returns : |
261
|
|
|
|
|
|
|
Args : |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=cut |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
sub _input() { |
266
|
0
|
|
|
0
|
|
|
my ($self,$infile1) = @_; |
267
|
0
|
0
|
|
|
|
|
if (defined $infile1){ |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
$self->{'input'}=$infile1; |
270
|
|
|
|
|
|
|
} |
271
|
0
|
|
|
|
|
|
return $self->{'input'}; |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head2 _run |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Title : _run |
277
|
|
|
|
|
|
|
Usage : $obj->_run() |
278
|
|
|
|
|
|
|
Function: Internal(not to be used directly) |
279
|
|
|
|
|
|
|
Returns : An array of Bio::SeqFeature::Generic objects |
280
|
|
|
|
|
|
|
Args : |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=cut |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub _run { |
285
|
0
|
|
|
0
|
|
|
my ($self)= @_; |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
my ($tfh1,$outfile) = $self->io->tempfile(-dir=>$self->tempdir()); |
288
|
0
|
|
0
|
|
|
|
my $str = $self->executable || return; |
289
|
|
|
|
|
|
|
|
290
|
0
|
0
|
|
|
|
|
if( $self->NOPLOT ) { |
291
|
0
|
|
|
|
|
|
$str .= " --noplot"; |
292
|
|
|
|
|
|
|
} |
293
|
0
|
|
|
|
|
|
$str .= " -basedir=".$self->program_dir." -workdir=".$self->tempdir()." ".$self->_input." > ".$outfile; |
294
|
|
|
|
|
|
|
|
295
|
0
|
|
|
|
|
|
my $status = system($str); |
296
|
0
|
0
|
|
|
|
|
$self->throw( "Tmhmm call ($str) crashed: $? \n") unless $status==0; |
297
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
my $filehandle; |
299
|
0
|
0
|
|
|
|
|
if (ref ($outfile) !~ /GLOB/) { |
300
|
0
|
0
|
|
|
|
|
open (TMHMM, "<".$outfile) or $self->throw ("Couldn't open file ".$outfile.": $!\n"); |
301
|
0
|
|
|
|
|
|
$filehandle = \*TMHMM; |
302
|
|
|
|
|
|
|
} |
303
|
|
|
|
|
|
|
else { |
304
|
0
|
|
|
|
|
|
$filehandle = $outfile; |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
0
|
|
|
|
|
|
my $tmhmm_parser = Bio::Tools::Tmhmm->new(-fh=>$filehandle); |
308
|
|
|
|
|
|
|
|
309
|
0
|
|
|
|
|
|
my @tmhmm_feat; |
310
|
|
|
|
|
|
|
|
311
|
0
|
|
|
|
|
|
while(my $tmhmm_feat = $tmhmm_parser->next_result){ |
312
|
|
|
|
|
|
|
|
313
|
0
|
|
|
|
|
|
push @tmhmm_feat, $tmhmm_feat; |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
# free resources |
316
|
0
|
|
|
|
|
|
$self->cleanup(); |
317
|
0
|
|
|
|
|
|
unlink $outfile; |
318
|
0
|
|
|
|
|
|
close($tfh1); |
319
|
0
|
|
|
|
|
|
undef $tfh1; |
320
|
|
|
|
|
|
|
|
321
|
0
|
|
|
|
|
|
return @tmhmm_feat; |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=head2 _writeSeqFile |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Title : _writeSeqFile |
327
|
|
|
|
|
|
|
Usage : obj->_writeSeqFile($seq) |
328
|
|
|
|
|
|
|
Function: Internal(not to be used directly) |
329
|
|
|
|
|
|
|
Returns : |
330
|
|
|
|
|
|
|
Args : |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=cut |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub _writeSeqFile{ |
335
|
0
|
|
|
0
|
|
|
my ($self,$seq) = @_; |
336
|
0
|
|
|
|
|
|
my ($tfh,$inputfile) = $self->io->tempfile(-dir=>$self->tempdir()); |
337
|
0
|
|
|
|
|
|
my $in = Bio::SeqIO->new(-fh => $tfh , '-format' => 'Fasta'); |
338
|
0
|
|
|
|
|
|
$in->write_seq($seq); |
339
|
0
|
|
|
|
|
|
close($tfh); |
340
|
0
|
|
|
|
|
|
undef $tfh; |
341
|
0
|
|
|
|
|
|
return $inputfile; |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
} |
344
|
|
|
|
|
|
|
1; |