0
|
1 # Parser module for SignalP Bio::Tools::Signalp
|
|
2 #
|
|
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 # Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
|
|
7
|
|
8 # You may distribute this module under the same terms as perl itself
|
|
9 #
|
|
10 # POD documentation - main docs before the code
|
|
11
|
|
12 =head1 NAME
|
|
13
|
|
14 Bio::Tools::SignalP
|
|
15
|
|
16 =head1 SYNOPSIS
|
|
17
|
|
18 use Bio::Tools::SignalP;
|
|
19 my $parser = new Bio::Tools::SignalP(-fh =>$filehandle );
|
|
20 while( my $sp_feat = $parser->next_result ) {
|
|
21 #do something
|
|
22 #eg
|
|
23 push @sp_feat, $sp_feat;
|
|
24 }
|
|
25
|
|
26 =head1 DESCRIPTION
|
|
27
|
|
28 Parser for SignalP output
|
|
29
|
|
30 =head1 FEEDBACK
|
|
31
|
|
32 =head2 Mailing Lists
|
|
33
|
|
34 User feedback is an integral part of the evolution of this and other
|
|
35 Bioperl modules. Send your comments and suggestions preferably to
|
|
36 the Bioperl mailing list. Your participation is much appreciated.
|
|
37
|
|
38 bioperl-l@bioperl.org - General discussion
|
|
39 http://bioperl.org/MailList.shtml - About the mailing lists
|
|
40
|
|
41 =head2 Reporting Bugs
|
|
42
|
|
43 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
44 of the bugs and their resolution. Bug reports can be submitted via
|
|
45 email or the web:
|
|
46
|
|
47 bioperl-bugs@bio.perl.org
|
|
48 http://bugzilla.bioperl.org/
|
|
49
|
|
50 =head1 AUTHOR
|
|
51
|
|
52 Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Signalp
|
|
53 originally written by Marc Sohrmann (ms2@sanger.ac.uk)
|
|
54 Written in BioPipe by Balamurugan Kumarasamy <savikalpa@fugu-sg.org>
|
|
55 Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
|
|
56
|
|
57 =head1 APPENDIX
|
|
58
|
|
59 The rest of the documentation details each of the object methods.
|
|
60 Internal methods are usually preceded with a _
|
|
61
|
|
62
|
|
63 =cut
|
|
64
|
|
65 package Bio::Tools::Signalp;
|
|
66 use vars qw(@ISA);
|
|
67 use strict;
|
|
68
|
|
69 use Bio::Root::Root;
|
|
70 use Bio::SeqFeature::FeaturePair;
|
|
71 use Bio::Root::IO;
|
|
72 use Bio::SeqFeature::Generic;
|
|
73 @ISA = qw(Bio::Root::Root Bio::Root::IO );
|
|
74
|
|
75
|
|
76
|
|
77 =head2 new
|
|
78
|
|
79 Title : new
|
|
80 Usage : my $obj = new Bio::Tools::SignalP();
|
|
81 Function: Builds a new Bio::Tools::SignalP object
|
|
82 Returns : Bio::Tools::SignalP
|
|
83 Args : -fh/-file => $val, # for initing input, see Bio::Root::IO
|
|
84
|
|
85
|
|
86 =cut
|
|
87
|
|
88 sub new {
|
|
89 my($class,@args) = @_;
|
|
90
|
|
91 my $self = $class->SUPER::new(@args);
|
|
92 $self->_initialize_io(@args);
|
|
93
|
|
94 return $self;
|
|
95 }
|
|
96
|
|
97 =head2 next_result
|
|
98
|
|
99 Title : next_result
|
|
100 Usage : my $feat = $signalp->next_result
|
|
101 Function: Get the next result set from parser data
|
|
102 Returns : Bio::SeqFeature::Generic
|
|
103 Args : none
|
|
104
|
|
105
|
|
106 =cut
|
|
107
|
|
108 sub next_result {
|
|
109 my ($self) = @_;
|
|
110
|
|
111 my $line;
|
|
112 # parse
|
|
113 my $id;
|
|
114 my ( $fact1, $fact2, $end);
|
|
115 while ($_=$self->_readline()) {
|
|
116 $line = $_;
|
|
117 chomp $line;
|
|
118
|
|
119 if ($line=~/^\>(\S+)/) {
|
|
120 $id = $1;
|
|
121 $self->seqname($id);
|
|
122 next;
|
|
123 }
|
|
124 elsif ($line=~/max\.\s+Y\s+(\S+)\s+\S+\s+\S+\s+(\S+)/) {
|
|
125 $fact1 = $2;
|
|
126 $self->fact1($fact1);
|
|
127 next;
|
|
128 }
|
|
129 elsif ($line=~/mean\s+S\s+(\S+)\s+\S+\s+\S+\s+(\S+)/) {
|
|
130 $fact2 = $2;
|
|
131 $fact1 = $self->fact1;
|
|
132 $id = $self->seqname;
|
|
133
|
|
134 if ($fact1 eq "YES" && $fact2 eq "YES") {
|
|
135
|
|
136 my $line = $self->_readline();
|
|
137
|
|
138 if ($line =~ /Most likely cleavage site between pos\.\s+(\d+)/) {
|
|
139 $end = $1;
|
|
140 }
|
|
141 else {
|
|
142 $self->throw ("parsing problem in signalp");
|
|
143 }
|
|
144 my (%feature);
|
|
145 $feature{name} = $id;
|
|
146 $feature{start} = 1;
|
|
147 $feature{end} = $end;
|
|
148 $feature{source} = 'Signalp';
|
|
149 $feature{primary}= 'signal_peptide';
|
|
150 $feature{program} = 'Signalp';
|
|
151 $feature{logic_name} = 'signal_peptide';
|
|
152
|
|
153 my $new_feat = $self->create_feature (\%feature);
|
|
154 return $new_feat;
|
|
155
|
|
156 }
|
|
157 next;
|
|
158
|
|
159 }
|
|
160
|
|
161 next;
|
|
162
|
|
163 }
|
|
164
|
|
165 }
|
|
166
|
|
167 =head2 create_feature
|
|
168
|
|
169 Title : create_feature
|
|
170 Usage : obj->create_feature(\%feature)
|
|
171 Function: Internal(not to be used directly)
|
|
172 Returns :
|
|
173 Args :
|
|
174
|
|
175
|
|
176 =cut
|
|
177
|
|
178 sub create_feature {
|
|
179 my ($self, $feat) = @_;
|
|
180
|
|
181
|
|
182 # create feature object
|
|
183 my $feature = Bio::SeqFeature::Generic->new(
|
|
184 -seq_id=>$feat->{name},
|
|
185 -start => $feat->{start},
|
|
186 -end => $feat->{end},
|
|
187 -score => $feat->{score},
|
|
188 -source => $feat->{source},
|
|
189 -primary => $feat->{primary},
|
|
190 -logic_name => $feat->{logic_name},
|
|
191 );
|
|
192
|
|
193
|
|
194 $feature->add_tag_value('evalue',0);
|
|
195 $feature->add_tag_value('percent_id','NULL');
|
|
196 $feature->add_tag_value("hid",$feat->{primary});
|
|
197
|
|
198 return $feature;
|
|
199
|
|
200 }
|
|
201 =head2 seqname
|
|
202
|
|
203 Title : seqname
|
|
204 Usage : obj->seqname($name)
|
|
205 Function: Internal(not to be used directly)
|
|
206 Returns :
|
|
207 Args :
|
|
208
|
|
209
|
|
210 =cut
|
|
211
|
|
212 sub seqname{
|
|
213 my ($self,$seqname)=@_;
|
|
214
|
|
215 if (defined$seqname){
|
|
216
|
|
217 $self->{'seqname'}=$seqname;
|
|
218 }
|
|
219
|
|
220 return $self->{'seqname'};
|
|
221
|
|
222 }
|
|
223
|
|
224 =head2 fact1
|
|
225
|
|
226 Title : fact1
|
|
227 Usage : obj->fact1($fact1)
|
|
228 Function: Internal(not to be used directly)
|
|
229 Returns :
|
|
230 Args :
|
|
231
|
|
232
|
|
233 =cut
|
|
234
|
|
235 sub fact1{
|
|
236 my ($self,$fact1)=@_;
|
|
237
|
|
238 if (defined$fact1){
|
|
239
|
|
240 $self->{'fact1'}=$fact1;
|
|
241 }
|
|
242
|
|
243 return $self->{'fact1'};
|
|
244
|
|
245 }
|
|
246
|
|
247
|
|
248
|
|
249 1;
|
|
250
|
|
251
|