BioPerl
view release on metacpan or search on metacpan
Bio/Tools/Analysis/Protein/HNN.pm view on Meta::CPAN
Many methods common to all analyses are inherited from
L<Bio::Tools::Analysis::SimpleAnalysisBase>.
=back
=head1 SEE ALSO
L<Bio::SimpleAnalysisI>,
L<Bio::Tools::Analysis::SimpleAnalysisBase>,
L<Bio::Seq::Meta::Array>,
L<Bio::WebAgent>
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<bioperl-l@bioperl.org>
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
https://github.com/bioperl/bioperl-live/issues
=head1 AUTHORS
Richard Adams, Richard.Adams@ed.ac.uk,
=head1 APPENDIX
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _
=cut
use strict;
package Bio::Tools::Analysis::Protein::HNN;
use IO::String;
use Bio::SeqIO;
use HTTP::Request::Common qw (POST);
use Bio::SeqFeature::Generic;
use Bio::Seq::Meta::Array;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
use base qw(Bio::Tools::Analysis::SimpleAnalysisBase);
#extends array for 2struc.
my $URL = 'http://npsa-pbil.ibcp.fr/cgi-bin/secpred_hnn.pl';
my $ANALYSIS_NAME= 'HNN';
my $ANALYSIS_SPEC= {name => 'HNN', type => 'Protein'};
my $INPUT_SPEC = [
{ mandatory => 'true',
type => 'Bio::PrimarySeqI',
'name' => 'seq',
},
];
my $RESULT_SPEC =
{
'' => 'bulk', # same as undef
'Bio::SeqFeatureI' => 'ARRAY of Bio::SeqFeature::Generic',
raw => '[ {helix=>, sheet=>, struc=>, coil=>}]',
meta => 'Bio::Seq::Meta::Array object',
};
use constant MIN_STRUC_LEN => 3;
sub _init {
my $self = shift;
$self->url($URL);
$self->{'_ANALYSIS_SPEC'} = $ANALYSIS_SPEC;
$self->{'_INPUT_SPEC'} = $INPUT_SPEC;
$self->{'_RESULT_SPEC'} = $RESULT_SPEC;
$self->{'_ANALYSIS_NAME'} = $ANALYSIS_NAME;
return $self;
}
sub _run {
my $self = shift;
$self->delay(1);
# delay repeated calls by default by 3 sec, set delay() to change
$self->sleep;
$self->status('TERMINATED_BY_ERROR');
my $request = POST 'https://npsa-prabi.ibcp.fr/cgi-bin/secpred_hnn.pl',
Content_Type => 'form-data',
Content => [
title => "",
notice => $self->seq->seq,
ali_width => 70,
];
my $text = $self->request($request)->content;
return unless $text;
my ($next) = $text =~ /Prediction.*?=(.*?)>/;
return unless $next;
my $out = "http://npsa-pbil.ibcp.fr/".$next;
my $req2 = HTTP::Request->new(GET=>$out);
my $resp2 = $self->request ($req2);
$self->status('COMPLETED') if $resp2 ne '';
$self->{'_result'} = $resp2->content;
return $self;
}
=head2 result
NAme : result
Usage : $job->result (...)
Returns : a result created by running an analysis
Args : see keys of $INPUT_SPEC
The method returns a result of an executed job. If the job was
terminated by an error the result may contain an error message instead
of the real data.
This implementation returns differently processed data depending on
argument:
=over 3
=item undef
Returns the raw ASCII data stream but without HTML tags.
=item 'Bio::SeqFeatureI'
The argument string defines the type of bioperl objects returned in an
array. The objects are L<Bio::SeqFeature::Generic>. Feature primary
tag is "2ary". Feature tags are "type" (which can be helix, sheet or
coil) "method" (HNN).
=item 'parsed'
Array of hash references of scores/structure assignations { helix =E<gt>,
sheet =E<gt> , coil =E<gt> , struc=E<gt>}.
=item 'all'
A Bio::Seq::Meta::Array object. Scores can be accessed using methods
from this class. Meta sequence names are HNN_helix, HNN_sheet,
HNN_coil, HNN_struc.
=back
=cut
sub result {
my ($self,$value) = @_;
my @scores;
my @fts;
if ($value ) {
#parse into basic raw form, store this as well as '_result'
if (!exists($self->{'_parsed'}) ) {
( run in 0.517 second using v1.01-cache-2.11-cpan-39bf76dae61 )