BioPerl
view release on metacpan or search on metacpan
Bio/Tools/Protparam.pm view on Meta::CPAN
"Composition of W : ", $pp->AA_comp('W'),"\n",
"Composition of Y : ", $pp->AA_comp('Y'),"\n",
"Composition of V : ", $pp->AA_comp('V'),"\n",
"Composition of B : ", $pp->AA_comp('B'),"\n",
"Composition of Z : ", $pp->AA_comp('Z'),"\n",
"Composition of X : ", $pp->AA_comp('X'),"\n";
}
=head1 DESCRIPTION
This module takes an amino acid sequence and submits it to the
Protparam program at www.expasy.org/cgi-bin/protparam. Many
properties of the submitted sequence are returned.
=head1 AUTHOR
Richard Dobson, r.j.dobson at qmul dot ac dot uk
=cut
# Let the code begin...
package Bio::Tools::Protparam;
use strict;
use base qw(Bio::Root::Root);
use LWP 5.64;
=head2 new
Title : new
Usage : $pp = Protparam->new(seq=>$seq->seq);
Function : Creates a new Protparam object
Returns : A Protparam object
Args : A sequence
=cut
sub new {
my ($class,@args) = @_;
@args=('-url'=>'http://web.expasy.org/cgi-bin/protparam/protparam','-form'=>'sequence',@args);
my $self=$class->SUPER::new(@args);
my ($url,$seq,$form)=$self->_rearrange([qw(URL SEQ FORM)],@args);
my $browser = LWP::UserAgent->new;
my $response;
#send request to PROTPARAM @ Expasy
$response = $browser->post($url,
[
$form => $seq
],
'User-Agent' => 'Mozilla/4.76 [en] (Win2000; U)',
);
#Check if successful
$self->throw("$url error: ".$response->status_line) unless $response->is_success;
$self->throw("Bad content type at $url ".$response->content_type) unless $response->content_type eq 'text/html';
my $protParamOutput=$response->decoded_content;
$self->{'output'}=$protParamOutput;
return bless $self,$class;
}
=head2 num_neg
Title : num_neg
Usage : $pp->num_neg()
Function : Retrieves the number of negative amino acids in a sequence
Returns : Returns the number of negative amino acids in a sequence
Args : none
=cut
sub num_neg{
my $self=shift;
($self->{'negAA'})=$self->{'output'}=~/<B>Total number of negatively charged residues.*?<\/B>\s*(\d*)/;
return $self->{'negAA'};
}
=head2 num_pos
Title : num_pos
Usage : $pp->num_pos()
Function : Retrieves the number of positive amino acids in a sequence
Returns : Returns the number of positive amino acids in a sequence
Args : none
=cut
sub num_pos{
my $self=shift;
($self->{'posAA'})=$self->{'output'}=~/<B>Total number of positively charged residues.*?<\/B>\s*(\d*)/;
return $self->{'posAA'};
}
=head2 amino_acid_number
Title : amino_acid_number
Usage : $pp->amino_acid_number()
Function : Retrieves the number of amino acids within a sequence
Returns : Returns the number of amino acids within a sequence
Args : none
=cut
sub amino_acid_number{
my $self=shift;
($self->{'numAA'})=$self->{'output'}=~/<B>Number of amino acids:<\/B> (\d+)/;
( run in 0.794 second using v1.01-cache-2.11-cpan-e1769b4cff6 )