3 # Copyright Balamurugan Kumarasamy
5 # You may distribute this module under the same terms as perl itself
6 # POD documentation - main docs before the code
11 Bio::Tools::Run::Tmhmm - Object for identifying transmembrane helixes
12 in a given protein seequence.
16 # Build a Tmhmm factory
18 # $paramfile is the full path to the seg binary file
20 my @params = ('PROGRAM',$paramfile);
21 my $factory = Bio::Tools::Run::Tmhmm->new($param);
23 # Pass the factory a Bio::Seq object
24 # @feats is an array of Bio::SeqFeature::Generic objects
26 my @feats = $factory->run($seq);
30 Tmhmm is a program for identifying transmembrane helices in proteins
36 User feedback is an integral part of the evolution of this and other
37 Bioperl modules. Send your comments and suggestions preferably to one
38 of the Bioperl mailing lists. Your participation is much appreciated.
40 bioperl-l@bioperl.org - General discussion
41 http://bio.perl.org/MailList.html - About the mailing lists
45 Report bugs to the Bioperl bug tracking system to help us keep track
46 the bugs and their resolution. Bug reports can be submitted via
49 bioperl-bugs@bio.perl.org
50 http://bio.perl.org/bioperl-bugs/
54 Email savikalpa@fugu-sg.org
59 The rest of the documentation details each of the object
60 methods. Internal methods are usually preceded with a _
64 package Bio
::Tools
::Run
::Tmhmm
;
66 use vars
qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR
67 $PROGRAMNAME @TMHMM_PARAMS %OK_FIELD);
72 use Bio::Tools::Tmhmm;
73 use Bio::Tools::Run::WrapperBase;
75 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
78 $PROGRAMNAME = 'tmhmm' . ($^O
=~ /mswin/i ?
'.exe':'');
80 if (defined $ENV{TMHMMDIR
}) {
81 $PROGRAMDIR = $ENV{TMHMMDIR
} || '';
82 $PROGRAM = Bio
::Root
::IO
->catfile($PROGRAMDIR,
83 "tmhmm".($^O
=~ /mswin/i ?
'.exe':''));
88 @TMHMM_PARAMS=qw(PROGRAM VERBOSE);
89 foreach my $attr ( @TMHMM_PARAMS)
90 { $OK_FIELD{$attr}++; }
96 Usage : $factory>program_name()
97 Function: holds the program name
110 Usage : $factory->program_dir(@params)
111 Function: returns the program directory, obtiained from ENV variable.
118 return Bio
::Root
::IO
->catfile($ENV{TMHMMDIR
});
123 my $attr = $AUTOLOAD;
126 $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
127 $self->{$attr} = shift if @_;
128 return $self->{$attr};
134 Usage : $rm->new(@params)
135 Function: creates a new Tmhmm factory
136 Returns: Bio::Tools::Run::Tmhmm
142 my ($class,@args) = @_;
143 my $self = $class->SUPER::new
(@args);
148 $value = shift @args;
149 next if( $attr =~ /^-/ ); # don't want named parameters
150 $self->$attr($value);
155 =head2 predict_protein_features
157 Title : predict_protein_features()
158 Usage : DEPRECATED Use $obj->run($seq) instead
159 Function: Runs Tmhmm and creates an array of featrues
160 Returns : An array of Bio::SeqFeature::Generic objects
161 Args : A Bio::PrimarySeqI
165 sub predict_protein_features
{
166 return shift->run(@_);
172 Usage : $obj->run($seq)
173 Function: Runs Tmhmm and creates an array of featrues
174 Returns : An array of Bio::SeqFeature::Generic objects
175 Args : A Bio::PrimarySeqI
180 my ($self,$seq) = @_;
183 if (ref($seq) ) {# it is an object
185 if (ref($seq) =~ /GLOB/) {
186 $self->throw("cannot use filehandle");
189 my $infile1 = $self->_writeSeqFile($seq);
191 $self->_input($infile1);
193 @feats = $self->_run();
198 #The clone object is not a seq object but a file. Perhaps
199 #should check here or before if this file is fasta format...if
200 #not die Here the file does not need to be created or
201 #deleted. Its already written and may be used by other
206 @feats = $self->_run();
218 Usage : obj->_input($seqFile)
219 Function: Internal(not to be used directly)
226 my ($self,$infile1) = @_;
227 if (defined $infile1){
229 $self->{'input'}=$infile1;
231 return $self->{'input'};
238 Function: Internal(not to be used directly)
239 Returns : An array of Bio::SeqFeature::Generic objects
247 my ($tfh1,$outfile) = $self->io->tempfile(-dir
=>$self->tempdir());
248 my $str =$self->executable." ".$self->_input." > ".$outfile;
249 my $status = system($str);
250 $self->throw( "Tmhmm call ($str) crashed: $? \n") unless $status==0;
253 if (ref ($outfile) !~ /GLOB/) {
254 open (TMHMM
, "<".$outfile) or $self->throw ("Couldn't open file ".$outfile.": $!\n");
255 $filehandle = \
*TMHMM
;
258 $filehandle = $outfile;
261 my $tmhmm_parser = Bio
::Tools
::Tmhmm
->new(-fh
=>$filehandle);
265 while(my $tmhmm_feat = $tmhmm_parser->next_result){
267 push @tmhmm_feat, $tmhmm_feat;
280 Title : _writeSeqFile
281 Usage : obj->_writeSeqFile($seq)
282 Function: Internal(not to be used directly)
289 my ($self,$seq) = @_;
290 my ($tfh,$inputfile) = $self->io->tempfile(-dir
=>$self->tempdir());
291 my $in = Bio
::SeqIO
->new(-fh
=> $tfh , '-format' => 'Fasta');
292 $in->write_seq($seq);