~ubuntu-branches/ubuntu/raring/bioperl/raring

« back to all changes in this revision

Viewing changes to Bio/Tools/Analysis/Protein/Scansite.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2008-03-18 14:44:57 UTC
  • mfrom: (4 hardy)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080318144457-1jjoztrvqwf0gruk
* debian/control:
  - Removed MIA Matt Hope (dopey) from the Uploaders field.
    Thank you for your work, Matt. I hope you are doing well.
  - Downgraded some recommended package to the 'Suggests' priority,
    according to the following discussion on Upstream's mail list.
    http://bioperl.org/pipermail/bioperl-l/2008-March/027379.html
    (Closes: #448890)
* debian/copyright converted to machine-readable format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: Scansite.pm,v 1.4 2003/12/16 00:25:26 allenday Exp $
 
1
# $Id: Scansite.pm,v 1.16.4.1 2006/10/02 23:10:32 sendu Exp $
2
2
#
3
3
# BioPerl module for Bio::Tools::Analysis::Protein::Scansite
4
4
#
21
21
  my $seq; # a Bio::PrimarySeqI object
22
22
 
23
23
  my $tool = Bio::Tools::Analysis::Protein::Scansite->new
24
 
     ( -seq => $seq->primary_seq(),
25
 
      ); 
 
24
     ( -seq => $seq->primary_seq ); 
26
25
 
27
26
  # run Scansite prediction on a sequence
28
 
   $tool->run();
 
27
  $tool->run();
29
28
 
30
29
  # alternatively you can say
31
30
  $tool->seq($seq->primary_seq)->run;
46
45
 
47
46
=head1 DESCRIPTION
48
47
 
49
 
This class is wrapper around the Scansite 2.0 server which produces
 
48
This class is a wrapper around the Scansite 2.0 server which produces
50
49
predictions for serine, threonine and tyrosine phosphorylation sites
51
50
in eukaryotic proteins. At present this is a basic wrapper for the
52
51
"Scan protein by input sequence" functionality, which takes a sequence
53
 
and searches for motifs. Optionally you can select the search
54
 
strincency as well. At present searches for specific phosphorylation
55
 
sites isn't supported, all predicted sites are returned.
56
 
 
57
 
See L<http://www.scansite.mit.edu/>.
58
 
 
59
 
This inherits Bio::SimpleAnalysisI which hopefully
60
 
 makes it easier to write wrappers on various services. This class
61
 
uses a web resource and therefore inherits from Bio::WebAgent.
 
52
and searches for motifs, with the option to select the search
 
53
stringency. At present, searches for specific phosphorylation
 
54
sites are not supported; all predicted sites are returned.
 
55
 
 
56
=head2 Return formats
 
57
 
 
58
The Scansite results can be obtained in several formats:
 
59
 
 
60
=over 3
 
61
 
 
62
=item 1.
 
63
 
 
64
By calling
 
65
 
 
66
  my $res = $tool->result('');
 
67
 
 
68
$res holds a string of the predicted sites in tabular format.
 
69
 
 
70
=item 2.
 
71
 
 
72
By calling 
 
73
 
 
74
  my $data_ref = $tool->result('value')
 
75
 
 
76
$data_ref is a reference to an array of hashes. Each element in the
 
77
array represents a predicted phosphorylation site. The hash keys are
 
78
the names of the data fields,i.e.,
 
79
 
 
80
    'motif'      => 'Casn_Kin1'       # name of kinase
 
81
    'percentile' => 0.155             # see Scansite docs
 
82
    'position'   => 9                 # position in protein
 
83
    'protein'    => 'A1'              # protein id
 
84
    'score'      => 0.3696            # see Scansite docs
 
85
    'sequence'   => 'ASYFDTASYFSADAT' # sequence surrounding site
 
86
    'site'       => 'S9'              # phosphorylated residue
 
87
    'zscore'     => '-3.110'          # see Scansite docs
 
88
 
 
89
=item 3.
 
90
 
 
91
By calling
 
92
 
 
93
  my @fts = $tool->Result('Bio::SeqFeatureI');
 
94
 
 
95
which returns an array of L<Bio::SeqFeatureI> compliant objects with
 
96
primary tag value 'Site' and tag names of 'motif', 'score',
 
97
'sequence', 'zscore' as above.
 
98
 
 
99
=back
 
100
 
 
101
See L<http://scansite.mit.edu/>.
 
102
 
 
103
This inherits Bio::SimpleAnalysisI which hopefully makes it easier to
 
104
write wrappers on various services. This class uses a web resource and
 
105
therefore inherits from L<Bio::WebAgent>.
62
106
 
63
107
=head1 SEE ALSO
64
108
 
73
117
Bioperl modules. Send your comments and suggestions preferably to one
74
118
of the Bioperl mailing lists.  Your participation is much appreciated.
75
119
 
76
 
  bioperl-l@bioperl.org                       - General discussion
77
 
  http://bio.perl.org/MailList.html           - About the mailing lists
 
120
  bioperl-l@bioperl.org                  - General discussion
 
121
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
78
122
 
79
123
=head2 Reporting Bugs
80
124
 
81
125
Report bugs to the Bioperl bug tracking system to help us keep track
82
 
the bugs and their resolution.  Bug reports can be submitted via email
83
 
or the web:
 
126
the bugs and their resolution.  Bug reports can be submitted via the
 
127
web:
84
128
 
85
 
  bioperl-bugs@bio.perl.org
86
 
  http://bugzilla.bioperl.org/
 
129
  http://bugzilla.open-bio.org/
87
130
 
88
131
=head1 AUTHORS
89
132
 
101
144
 
102
145
 
103
146
package Bio::Tools::Analysis::Protein::Scansite;
104
 
use vars qw(@ISA  $FLOAT @STRINGENCY );
 
147
use vars qw($FLOAT @STRINGENCY);
105
148
use strict;
106
149
use IO::String;
107
150
use Bio::SeqIO;
108
 
use HTTP::Request::Common qw (POST);
 
151
use HTTP::Request::Common qw(POST);
109
152
use Bio::SeqFeature::Generic;
110
 
use Bio::Tools::Analysis::SimpleAnalysisBase;
111
153
 
112
 
@ISA = qw(Bio::Tools::Analysis::SimpleAnalysisBase);
 
154
use base qw(Bio::Tools::Analysis::SimpleAnalysisBase);
113
155
 
114
156
$FLOAT = '[+-]?\d*\.\d*';
115
157
@STRINGENCY = qw(High Medium Low);
159
201
 
160
202
 
161
203
=head2 result
162
 
 
 
204
 
163
205
 Name    : result
164
206
 Usage   : $job->result (...)
165
207
 Returns : a result created by running an analysis
168
210
           the raw result)
169
211
 
170
212
The method returns a scalar representing a result of an executed
171
 
job. If the job was terminated by an error the result
 
213
job. If the job was terminated by an error, the result may contain 
 
214
an error message instead of the real data.
172
215
 
173
216
This implementation returns differently processed data depending on
174
217
argument:
187
230
=item 'parsed'
188
231
 
189
232
Returns a reference to an array of hashes containing the data of one
190
 
phosphorylation site prediction. Key values are :
 
233
phosphorylation site prediction. Key values are:
191
234
 
192
235
motif, percentile, position, protein, score, site, zscore,  sequence.
193
236
 
216
259
                                                score     => $hit->{'score'},
217
260
                                                zscore    => $hit->{'zscore'},
218
261
                                                motif     => $hit->{'motif'},
 
262
                                                site      => $hit->{'site'},
219
263
                                                sequence  => $hit->{'sequence'},
220
264
                                                        },
221
265
                                );
234
278
 
235
279
=head2  stringency
236
280
 
237
 
 Usage   : $job->stringency(...)
 
281
 Usage    : $job->stringency(...)
238
282
 Returns  : The significance stringency of a prediction
239
283
 Args     : None (retrieves value) or 'High', 'Medium' or 'Low'.
240
284
 Purpose  : Get/setter of the stringency to be sumitted for analysis.
252
296
       $self->{'_stringency'} = $value;
253
297
       return $self;
254
298
   }
255
 
   return $self->{'_stringency'} || $self->input_spec->[4]{'default'} ;
 
299
   return $self->{'_stringency'} || $self->input_spec->[2]{'default'} ;
256
300
}
257
301
 
258
302
=head2  protein_id
259
303
 
260
 
 Usage   : $job->protein_id(...)
 
304
 Usage    : $job->protein_id(...)
261
305
 Returns  : The sequence id of the protein or 'unnamed' if not set. 
262
306
 Args     : None  
263
307
 Purpose  : Getter of the seq_id. Returns the display_id of the sequence
264
 
                                object. 
 
308
            object. 
265
309
 
266
310
=cut
267
311
 
278
322
        $self->{'_ANALYSIS_SPEC'} = $ANALYSIS_SPEC;
279
323
        $self->{'_INPUT_SPEC'}    = $INPUT_SPEC;
280
324
        $self->{'_RESULT_SPEC'}   = $RESULT_SPEC;
281
 
        $self->{'_ANALYSIS_NAME'} = $ANALYSIS_SPEC->{name};
 
325
        $self->{'_ANALYSIS_NAME'} = $ANALYSIS_SPEC->{'name'};
282
326
        return $self;
283
327
}
284
328
 
336
380
    $self->{'_result'} = $out_Str;
337
381
        $self->{'_parsed'} = \@parsed_Results;
338
382
        
339
 
        ## is successssful if there are results or if there are no results and
 
383
        ## is successsful if there are results or if there are no results and
340
384
        ## this beacuse there are no matches, not because of parsing errors etc.
341
385
    $self->status('COMPLETED') if $text ne ''       &&
342
386
        (scalar @results > 0 || 
343
387
        (scalar @results == 0 && $text =~/No sites found/));
 
388
    if ($text =~ /server\s+error/i) {
 
389
        $self->warn("There was an internal server error !- text below") ;
 
390
                $self->warn($text);
 
391
        return; 
 
392
    }
 
393
}
 
394
 
 
395
sub _process_arguments {
 
396
 
 
397
    # extra checking for sequence length
 
398
    # mitoprot specific argument testing
 
399
    my ($self, $args) = @_;
 
400
    #use base checking for existence of mandatory fields
 
401
    $self->SUPER::_process_arguments($args); 
 
402
   
 
403
   # specific requirements
 
404
   $self->throw("Sequence must be > 15 amino acids long!") 
 
405
           if $self->seq->length < 15;
 
406
   $self->throw("Sequence must be protein")
 
407
          unless $self->seq->alphabet() eq 'protein';
344
408
}
345
409
 
346
410
sub _make_header {