| Summary | Included libraries | Package variables | Synopsis | Description | General documentation | Methods |
use Bio::Tools::Analysis::Protein::GOR4;
#get a Bio::Seq or Bio::PrimarySeq
use Bio::PrimarySeq;
$seq = new Bio::PrimarySeq
(-seq=>'IKLCVHHJHJHJHJHJHJHNLAILAKAHLIELALAL',
-primary_id=>'test'); # a Bio::PrimarySeqI object
my $gor4 = Bio::Tools::Analysis::Protein::GOR4->new (-seq=>$seq); $gor4->run; print $gor4->result;# #raw text to standard error
my $analysis_object = Bio::Tools::SimpleAnalysis::Protein::GOR4->creates a new object
new(-seq => $seq);
$analysis_object->run;submits the query to the server and obtains raw text output
my $rawdata = $analysis_object->result;
my $data_ref = $analysis_object->result('parsed');
print "score for helix at residue 2 is $data_ref->[1]{'helix'}\n";
print "predicted struc at residue 2 is $data_ref->[1]{'struc}\n";
my @fts = $analysis_object->result(Bio::SeqFeatureI);
for my $ft (@fts) {
print " From ", $ft->start, " to ",$ft->end, " struc: " ,
($ft->each_tag_value('type'))[0] ,"\n";
}
my $meta_sequence = $analysis_object->result('all');
print "helix scores from residues 10-20 are ",
$meta_sequence->named_submeta_text("GOR4_helix",10,20), "\n";
Meta sequence names are : GOR4_helix, GOR4_sheet, GOR4_coil,| result | Description | Code |
| _get_2ary_coords | No description | Code |
| _init | No description | Code |
| _run | No description | Code |
| result | code | next | Top |
Name : resultThe 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: undef Returns the raw ASCII data stream but without HTML tags 'Bio::SeqFeatureI' The argument string defines the type of bioperl objects returned in anarray. The objects are Bio::SeqFeature::Generic. Feature primary tag is "2ary". Feature tags are "type" (which can be helix, sheet or coil) "method" (GOR4). 'parsed' Array of hash references of { helix =>, sheet => , coil => , struc=>}. 'meta' A Bio::Seq::Meta::Array object. Scores can be accessed using methodsfrom this class. Meta sequence names are GOR4_helix, GOR4_sheet, GOR4_coil, GOR4_struc. |
| result | description | prev | next | Top |
my ($self,$value) = @_; my @scores; my @fts; if ($value ) { #parse into basic raw form, store this as well as '_result'}
if (!exists($self->{'_parsed'}) ) { my $result = IO::String->new($self->{'_result'}); while (my $line = <$result>) { next unless $line =~ /^\w\s/; # or for sopma/hnn /^[A-Z]\s/
$line =~/(\w)\s+(\d+)\s+(\d+)\s+(\d+)/; # or for so
push @scores, { struc => $1, helix => $2, sheet => $3, coil => $4, }; } $self->{'_parsed'} =\@ scores; } if ($value eq 'Bio::SeqFeatureI') { $self->_get_2ary_coords(); for my $type (keys %{$self->{'_parsed_coords'}} ) { next if $type =~ /\w{2,}/; #if not H,C,E or T
for my $loc (@{$self->{'_parsed_coords'}{$type}} ) { push @fts, Bio::SeqFeature::Generic->new (-start => $loc->{'start'}, -end => $loc->{'end'}, -source => 'GOR4', -primary => 'Region', -tag => { type => $type, method => $self->analysis_name, }); } #end of array of strucs of type
} # end of all 2nd struc elements
delete $self->{'_parsed_coords'}; #remove temp data
return @fts; } #endif BioSeqFeature
elsif ($value eq 'meta') { #1st of all make 3 or 4 arrays of scores for each type from column data
my %type_scores; for my $aa (@{$self->{'_parsed'}}) { push @{$type_scores{'struc'}}, $aa->{'struc'}; push @{$type_scores{'helix'}}, $aa->{'helix'}; push @{$type_scores{'sheet'}}, $aa->{'sheet'}; push @{$type_scores{'coil'}}, $aa->{'coil'}; } ## bless if necessary ##
if (!$self->seq->isa("Bio::Seq::Meta::Array")){ bless ($self->seq, "Bio::Seq::Meta::Array"); } $self->seq->isa("Bio::Seq::MetaI") || $self->throw("$self is not a Bio::Seq::MetaI"); $Bio::Seq::Meta::Array::DEFAULT_NAME = 'GOR4_struc'; ## now make meta_Sequence
for my $struc_type (keys %type_scores) { my $meta_name = "GOR4". "_" . "$struc_type"; my @meta = map{$_->{$struc_type}} @{$self->{'_parsed'}}; if (grep{$_ eq $meta_name}$self->seq->meta_names ) { $self->warn ("$meta_name already exists , not overwriting!"); next; } $self->seq->named_meta($meta_name,\@meta ); } # return seq array object implementing meta sequence #
return $self->seq; } else { return $self->{'_parsed'}; } } #endif ($value)
#return raw result if no return fomrt stated
return $self->{'_result'};
| _get_2ary_coords | description | prev | next | Top |
#helper sub for result;}
##extracts runs of structure > MIN_STRUC_LENresidues or less if Turn:
#i.e., helical prediction for 1 residue isn't very meaningful...
## and poulates array of hashes with start/end values.
##keys of $Result are 'H' 'T' 'C' 'E'.
#could be put into a secondary base class if need be
my ($self) = @_; my @prot = @{$self->{'_parsed'}}; my %Result; for (my $index = 0; $index <= $#prot; $index++) { my $type = $prot[$index]{'struc'}; next unless $type =~ /[HTCE]/; my $length = 1; for (my $j = $index + 1; $j <= $#prot; $j++) { my $test = $prot[$j]; if ($test->{'struc'} eq $type) { $length++; } elsif ( $length > MIN_STRUC_LEN || ($length <= MIN_STRUC_LEN && $type eq 'T') ) { push @{$Result{$type}}, {start => $index + 1 , end => $j}; $index += $length -1; last; } else { $index += $length - 1; last; } } } $self->{'_parsed_coords'} =\% Result; #temp assignment
| _init | description | prev | next | Top |
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;}
| _run | description | prev | next | Top |
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 $self->url, Content_Type => 'form-data', Content => [title => "", notice => $self->seq->seq, ali_width => 70, ]; my $content = $self->request($request); my $text = $content->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;
| SEE ALSO | Top |
| FEEDBACK | Top |
| Mailing Lists | Top |
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
| Reporting Bugs | Top |
http://bugzilla.open-bio.org/
| AUTHORS | Top |
| APPENDIX | Top |