1 # Wrapper module for Coil Bio::Tools::Run::Coil
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 <savikalpa@fugu-sg.org>
6 # Please direct questions and support issues to <bioperl-l@bioperl.org>
8 # Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::Tools::Run::Coil - wrapper for ncoils program
20 # Build a Coil factory
21 my $factory = Bio::Tools::Run::Coil->new($params);
23 # Pass the factory a Bio::Seq object
24 # @feats is an array of Bio::SeqFeature::Generic objects
25 my @feats = $factory->run($seq);
29 This module is a wrapper for the B<ncoils> program available via
30 L<http://www.russell.embl-heidelberg.de/coils/coils.tar.gz> for predicting
31 coiled coils in protein sequences.
33 By default it looks for an executable called I<ncoils> and data/parameter files
34 in the directory specified by the I<COILSDIR> environmental variable.
38 Lupas, van Dyke & Stock,
39 I<Predicting coiled coils from protein sequences>,
40 Science B<252>:1162-1164, 1991.
43 I<Prediction and Analysis of Coiled-Coil Structures>,
44 Meth. Enzymology B<266>:513-525, 1996.
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.
54 bioperl-l@bioperl.org - General discussion
55 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
59 Please direct usage questions or support issues to the mailing list:
61 I<bioperl-l@bioperl.org>
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.
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
74 http://redmine.open-bio.org/projects/bioperl/
78 Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Coil
79 originally written by Marc Sohrmann (ms2@sanger.ac.uk)
81 Written in BioPipe by Balamurugan Kumarasamy <savikalpa@fugu-sg.org>
83 # Please direct questions and support issues to <bioperl-l@bioperl.org>
85 Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
89 The rest of the documentation details each of the object
90 methods. Internal methods are usually preceded with a _
94 package Bio
::Tools
::Run
::Coil
;
96 use vars
qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR
97 $PROGRAMNAME @COIL_PARAMS %OK_FIELD);
102 use Bio::Tools::Coil;
103 use Bio::Tools::Run::WrapperBase;
105 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
108 @COIL_PARAMS=qw(PROGRAM VERBOSE QUIET SILENT);
109 foreach my $attr ( @COIL_PARAMS)
110 { $OK_FIELD{$attr}++; }
115 my $attr = $AUTOLOAD;
118 $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
119 $self->{$attr} = shift if @_;
120 return $self->{$attr};
126 Usage : $factory>program_name()
127 Function: holds the program name
140 Usage : $factory->program_dir(@params)
141 Function: returns the program directory, obtained from ENV variable.
148 return Bio
::Root
::IO
->catfile($ENV{COILSDIR
}) if $ENV{COILSDIR
};
154 Usage : $coil->new(@params)
155 Function: creates a new Coil factory
156 Returns: Bio::Tools::Run::Coil
162 my ($class,@args) = @_;
163 my $self = $class->SUPER::new
(@args);
167 $value = shift @args;
168 next if( $attr =~ /^-/ ); # don't want named parameters
169 if ($attr =~/PROGRAM/i) {
170 $self->executable($value);
173 $self->$attr($value);
178 =head2 predict_protein_features
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
188 sub predict_protein_features
{
189 return shift->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.
203 my ($self,$seq) = @_;
206 if (ref($seq) ) { # it is an object
207 if (ref($seq) =~ /GLOB/) {
208 $self->throw("cannot use filehandle");
211 my $infile1 = $self->_writeSeqFile($seq);
213 $self->_input($infile1);
215 @feats = $self->_run();
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.
225 @feats = $self->_run();
236 Usage : obj->_input($seqFile)
237 Function: Internal(not to be used directly)
244 my ($self,$infile1) = @_;
245 if(defined $infile1){
247 $self->{'input'}=$infile1;
249 return $self->{'input'};
257 Function: Internal(not to be used directly)
258 Returns : An array of Bio::SeqFeature::Generic objects
266 my ($tfh1,$outfile) = $self->io->tempfile(-dir
=>$self->tempdir());
267 my $str =$self->executable." -f < ".$self->{'input'}." > ".$outfile;
268 if($self->quiet || $self->verbose <=0 || $self->silent){
269 $str.=" 2>/dev/null";
271 my $status = system($str);
272 $self->throw( "Coil call ($str) crashed: $? \n") unless $status==0;
274 my $coil_parser = Bio
::Tools
::Coil
->new();
276 if (ref ($outfile) !~ /GLOB/) {
277 open (COIL
, "<".$outfile) or $self->throw ("Couldn't open file ".$outfile.": $!\n");
278 $filehandle = \
*COIL
;
281 $filehandle = $outfile;
286 while(my $coil_feat = $coil_parser->next_result($filehandle)){
288 push @coil_feat, $coil_feat;
302 Title : _writeSeqFile
303 Usage : obj->_writeSeqFile($seq)
304 Function: Internal(not to be used directly)
311 my ($self,$seq) = @_;
312 my ($tfh,$inputfile) = $self->io->tempfile(-dir
=>$self->tempdir());
313 my $in = Bio
::SeqIO
->new(-fh
=> $tfh , '-format' => 'Fasta');
314 $in->write_seq($seq);