1 # Wrapper module for SignalP Bio::Tools::Run::Signalp
3 # Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Signalp
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)
12 Bio::Tools::Run::Signalp
16 Build a Signalp factory
18 my $factory = Bio::Tools::Run::Signalp->new();
19 # Pass the factory a Bio::Seq object
20 # @feats is an array of Bio::SeqFeature::Generic objects
21 my @feats = $factory->run($seq);
25 wrapper module for Signalp program
31 User feedback is an integral part of the evolution of this and other
32 Bioperl modules. Send your comments and suggestions preferably to one
33 of the Bioperl mailing lists. Your participation is much appreciated.
35 bioperl-l@bioperl.org - General discussion
36 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
40 Please direct usage questions or support issues to the mailing list:
42 I<bioperl-l@bioperl.org>
44 rather than to the module maintainer directly. Many experienced and
45 reponsive experts will be able look at the problem and quickly
46 address it. Please include a thorough description of the problem
47 with code and data examples if at all possible.
51 Report bugs to the Bioperl bug tracking system to help us keep track
52 the bugs and their resolution. Bug reports can be submitted via the
55 http://redmine.open-bio.org/projects/bioperl/
59 Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Signalp
60 originally written by Marc Sohrmann (ms2@sanger.ac.uk)
61 Written in BioPipe by Balamurugan Kumarasamy <savikalpa@fugu-sg.org>
62 Contributions by David Vilanova (david.vilanova@urbanet.ch)
63 Shawn Hoon (shawnh@fugu-sg.org)
64 # Please direct questions and support issues to <bioperl-l@bioperl.org>
66 Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
70 The rest of the documentation details each of the object
71 methods. Internal methods are usually preceded with a _
75 package Bio
::Tools
::Run
::Signalp
;
77 use vars
qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR
78 $PROGRAMNAME @SIGNALP_PARAMS %OK_FIELD);
83 use Bio::Factory::ApplicationFactoryI;
84 use Bio::Tools::Signalp;
85 use Bio::Tools::Run::WrapperBase;
87 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
90 @SIGNALP_PARAMS=qw(PROGRAM VERBOSE);
91 foreach my $attr ( @SIGNALP_PARAMS)
92 { $OK_FIELD{$attr}++; }
98 Usage : $factory>program_name()
99 Function: holds the program name
112 Usage : $factory->program_dir(@params)
113 Function: returns the program directory, obtained from ENV variable.
120 return Bio
::Root
::IO
->catfile($ENV{SIGNALPDIR
}) if $ENV{SIGNALPDIR
};
125 my $attr = $AUTOLOAD;
126 return $self->$attr if $self->$attr;
129 $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
130 $self->{$attr} = shift if @_;
131 return $self->{$attr};
137 Usage : my $factory= Bio::Tools::Run::Signalp->new();
138 Function: creates a new Signalp factory
139 Returns: Bio::Tools::Run::Signalp
145 my ($class,@args) = @_;
146 my $self = $class->SUPER::new
(@args);
151 $value = shift @args;
152 next if( $attr =~ /^-/ ); # don't want named parameters
153 if ($attr =~/PROGRAM/i) {
154 $self->executable($value);
157 $self->$attr($value);
162 =head2 predict_protein_features
164 Title : predict_protein_features()
165 Usage : DEPRECATED. Use $factory->run($seq) instead
166 Function: Runs Signalp and creates an array of featrues
167 Returns : An array of Bio::SeqFeature::Generic objects
168 Args : A Bio::PrimarySeqI
172 sub predict_protein_features
{
173 return shift->run(@_);
179 Usage : my $feats = $factory->run($seq)
180 Function: Runs Signalp
181 Returns : An array of Bio::SeqFeature::Generic objects
182 Args : A Bio::PrimarySeqI
187 my ($self,$seq) = @_;
192 if (ref($seq) =~ /GLOB/) {
193 $self->throw("cannot use filehandle");
196 my $infile1 = $self->_writeSeqFile($seq);
198 $self->_input($infile1);
200 @feats = $self->_run();
205 my $in = Bio
::SeqIO
->new(-file
=> $seq, '-format' =>'fasta');
208 while ( my $tmpseq = $in->next_seq() ) {
209 $infile1 = $self->_writeSeqFile($tmpseq);
212 $self->_input($infile1);
214 @feats = $self->_run();
223 Usage : $factory->_input($seqFile)
224 Function: get/set for input file
231 my ($self,$infile1) = @_;
232 $self->{'input'} = $infile1 if(defined $infile1);
233 return $self->{'input'};
239 Usage : $factory->_run()
240 Function: Makes a system call and runs signalp
241 Returns : An array of Bio::SeqFeature::Generic objects
249 my ($tfh1,$outfile) = $self->io->tempfile(-dir
=>$self->tempdir());
250 my $str =$self->executable." -t euk -trunc 50 ".$self->{'input'}." > ".$outfile;
251 my $status = system($str);
252 $self->throw( "Signalp call ($str) crashed: $? \n") unless $status==0;
255 if (ref ($outfile) !~ /GLOB/) {
256 open (SIGNALP
, "<".$outfile) or $self->throw ("Couldn't open file ".$outfile.": $!\n");
257 $filehandle = \
*SIGNALP
;
260 $filehandle = $outfile;
263 my $signalp_parser = Bio
::Tools
::Signalp
->new(-fh
=>$filehandle);
267 while(my $signalp_feat = $signalp_parser->next_result){
269 push @signalp_feat, $signalp_feat;
277 return @signalp_feat;
283 Title : _writeSeqFile
284 Usage : $factory->_writeSeqFile($seq)
285 Function: Creates a file from the given seq object
286 Returns : A string(filename)
287 Args : Bio::PrimarySeqI
292 my ($self,$seq) = @_;
293 my ($tfh,$inputfile) = $self->io->tempfile(-dir
=>$self->tempdir());
294 my $in = Bio
::SeqIO
->new(-fh
=> $tfh , '-format' => 'fasta');
295 $in->write_seq($seq);