/usr/share/perl5/Bio/Tools/TargetP.pm is in libbio-perl-perl 1.6.924-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | #
# Bioperl module for TargetP
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Emmanuel Quevillon <emmanuel.quevillon@versailles.inra.fr>
#
# You may distribute this module under the same terms as perl itself
#
# POD documentation - main docs before the code
=head1 NAME
Bio::Tools::TargetP - Results of one TargetP run
=head1 SYNOPSIS
use Bio::Tools::TargetP;
#filename for TargetP result :
$targetp = Bio::Tools::TargetP->new(-file => 'targetp.out');
# filehandle for TargetP :
$targetp = Bio::Tools::TargetP->new( -fh => \*INPUT );
### targetp v1.1 prediction results ##################################
#Number of query sequences: 11
#Cleavage site predictions included.
#Using NON-PLANT networks.
#
#Name Len mTP SP other Loc RC TPlen
#----------------------------------------------------------------------
#swall|Q9LIP3|C72Y_AR 500 0.245 0.935 0.009 S 2 22
#swall|Q52813|AAPQ_RH 400 0.170 0.462 0.577 _ 5 -
#swall|O86459|AAT_RHI 400 0.346 0.046 0.660 _ 4 -
# parse the results
while($feature = $targetp->next_prediction()) {
#$feature is a Bio::SeqFeature::Generic object
my $method = $targetp->analysis_method();
my $vesion = $targetp->analysis_method_version() || $feature->source();
my $seqid = $feature->seq_id();
# ...
}
# essential if you gave a filename at initialization (otherwise the file
# will stay open)
$targetp->close();
=head1 DESCRIPTION
TargetP modules will provides parsed information about protein
localization. It reads in a targetp output file. It parses the
results, and returns a Bio::SeqFeature::Generic object for each
seqeunces found to have a subcellular localization
=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
the Bioperl mailing list. 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
of the bugs and their resolution. Bug reports can be submitted via
the web:
https://github.com/bioperl/bioperl-live/issues
=head1 AUTHORS - Emmanuel Quevillon
Email emmanuel.quevillon@versailles.inra.fr
Describe contact details here
=head1 APPENDIX
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
=cut
# Let the code begin...
package Bio::Tools::TargetP;
use strict;
use Bio::Tools::AnalysisResult;
use Bio::SeqFeature::Generic;
use Data::Dumper;
use base qw(Bio::Tools::AnalysisResult);
#Definition of 'Loc' field according to http://www.cbs.dtu.dk/services/TargetP/output.php
my $MAPLOC = {
'S' => 'Secretory pathway',
'M' => 'Mitochondrion',
'C' => 'Chloroplast',
'_' => 'Any other',
'*' => 'Unknown',
'?' => 'Unknown',
};
=head1 analysis_method
Usage : $self->analysis_method();
Purpose : Inherited method. Overridden to ensure that the name matches
Returns : String
Argument : n/a
=cut
sub analysis_method {
my ($self, $method) = @_;
if($method && ($method !~ /TargetP/i)) {
$self->throw("method $method not supported in " . ref($self));
}
return $self->SUPER::analysis_method($method);
}
=head1 network
Title : network
Usage : $self->network($network)
Function: This method Get/Set the network used for the analysis (PLANT or NON-PLANT)
Example :
Returns : string
Arguments: On set, the network used
=cut
sub network {
my($self, $net) = @_;
if(defined($net)){
$self->{'_network'} = $net;
}
return $self->{'_network'};
}
=head1 cleavage
Title : cleavage
Usage : $self->cleavage($cleavage)
Function : This method Get/Set if SignalP program was used to run TargetP
Example :
Returns : 1 or 0
Arguments: On set, the cleavage used or not
=cut
sub cleavage {
my($self, $cleavage) = @_;
if(defined($cleavage)){
$self->{'_cleavage'} = $cleavage =~ /not included/ ? '0' : '1';
}
return $self->{'_cleavage'};
}
=head1 next_prediction
Usage : $targetp->next_prediction()
Purpose : Returns the next TargetP prediction
Returns : A Bio::SeqFeature::Generic object
Arguments: n/a
=cut
sub next_prediction {
my($self) = @_;
unless($self->_parsed()){
$self->_parse_results();
$self->_parsed(1);
}
return shift @{$self->{'_features'}} || undef;
}
=head1 create_feature
Title : create_feature
Usage : $self->create_feature(\%hash);
Function : This method creates a new Bio::SeqFeature::Generic object
Example :
Returns : Bio::SeqFeature::Generic
Arguments : hash reference
=cut
sub create_feature {
my($self, $feat) = @_;
$self->throw("Need a reference to hash table") unless($feat && ref($feat) eq 'HASH');
my $feature = Bio::SeqFeature::Generic->new(
-seq_id => $feat->{seqid},
-source_tag => $self->analysis_method(),
-primary_tag => 'signal_peptide', #Sequence Ontology compliant
-strand => '+',
);
if(defined($feat->{seqlen})){
$feature->start(1);
$feature->end($feat->{seqlen});
}
$feature->add_tag_value('location', $MAPLOC->{$feat->{loc}}) if(exists($MAPLOC->{$feat->{loc}}));
$feature->add_tag_value('chloroplastCutOff', $feat->{cTP}) if(defined($feat->{cTP}));
$feature->add_tag_value('mitochondrionCutOff', $feat->{mTP}) if(defined($feat->{mTP}));
$feature->add_tag_value('signalPeptideCutOff', $feat->{SP}) if(defined($feat->{SP}));
$feature->add_tag_value('otherCutOff', $feat->{other}) if(defined($feat->{other}));
$feature->add_tag_value('reliabilityClass', $feat->{RC}) if(defined($feat->{RC}));
$feature->add_tag_value('signalPeptideLength', $feat->{TPLen}) if(defined($feat->{TPLen}));
$feature->add_tag_value('network', $self->network());
return $feature;
}
=head2 PRIVATE METHODS
=cut
=head2 _initialize_state
Title : _initialize_state
Usage : n/a; usually called by _initialize() itself called by new()
Function: This method is supposed to reset the state such that any 'history'
is lost. State information that does not change during object
lifetime is not considered as history, e.g. parent, name, etc shall
not be reset. An inheriting object should only be concerned with
state information it introduces itself, and for everything else
call SUPER::_initialize_state(@args).
The argument syntax is the same as for new() and _initialize(),
i.e., named parameters following the -name=>$value convention.
The following parameters are dealt with by the implementation
provided here:
-INPUT, -FH, -FILE
(tags are case-insensitive).
Example :
Returns :
Args :
=cut
sub _initialize_state {
my ($self,@args,) = @_;
# first call the inherited method!
$self->SUPER::_initialize_state(@args);
# our private state variables
$self->{'_features'} = [ ];
$self->{'_parameters'} = undef;
$self->{'_format'} = undef;
$self->{'_network'} = undef;
$self->{'_cleavage'} = undef;
$self->{'_parsed'} = 0;
$self->analysis_method('TargetP');
return 1;
}
=head2 _predictions
Usage : $targetp->_prediction()
Purpose : Returns the number of TargetP predictions
Returns : A scalar (number)
Arguments: n/a
=cut
sub _predictions {
my($self) = @_;
return scalar(@{$self->{'_features'}}) || 0;
}
=head2 _parsed
Title : _parsed
Usage : $targetp->_parsed(1)
Function : This method is used to know if the output result is parsed or not
For internal use only
Example :
Returns : 1/0
Arguments : 1/0 for setting
=cut
sub _parsed {
my($self, $value) = @_;
if(defined($value)){
$self->{'_parsed'} = $value;
}
return $self->{'_parsed'};
}
=head2 _parse_results
Title : _parse_results
Usage : $self->_parse_results()
Function : This method parses a TargetP output
For internal use only
Example :
Returns : n/a
Arguments: none
=cut
sub _parse_results {
my($self) = @_;
### targetp v1.1 prediction results ##################################
#Number of query sequences: 11
#Cleavage site predictions included.
#Using NON-PLANT networks.
#
#Name Len mTP SP other Loc RC TPlen
#----------------------------------------------------------------------
#swall|Q9LIP3|C72Y_AR 500 0.245 0.935 0.009 S 2 22
#swall|Q52813|AAPQ_RH 400 0.170 0.462 0.577 _ 5 -
#swall|O86459|AAT_RHI 400 0.346 0.046 0.660 _ 4 -
while(defined(my $line = $self->_readline())){
if($line =~ /targetp (v[\d\.]+)/){
$self->analysis_method_version($1);
}elsif($line =~ /Cleavage site predictions (.*)/){
$self->cleavage($1);
}elsif($line =~ /Using (\S+) networks/){
$self->network($1);
}elsif($line =~ /^Name/){
#We skip the next line which is '------------------'
$self->_readline();
my $hash = { };
while(defined(my $line = $self->_readline())){
last if($line =~ /^----/);
my $hash = $self->_parse_line($line);
my $new_feature = $self->create_feature($hash);
$self->_add_feature($new_feature);
}
}
}
return;
}
=head2 _parse_line
Title : _parse_line
Usage : $self->_parse_line($line)
Function : This method parses the line result
For internal use only
Example :
Returns : Hash reference
Arguemnts: line to parse
=cut
sub _parse_line {
my($self, $line) = @_;
$self->throw("No line to parse given") unless($line);
my $hash = { };
my ($seqid, $seqlen, $cTP, $mTP, $SP, $other, $loc, $RC, $TPlen);
if($self->network() eq 'NON-PLANT'){
($seqid, $seqlen, $mTP, $SP, $other, $loc, $RC, $TPlen) = split(/\s+/, $line);
}else{
($seqid, $seqlen, $cTP, $mTP, $SP, $other, $loc, $RC, $TPlen) = split(/\s+/, $line);
}
$hash->{seqid} = $seqid;
$hash->{seqlen} = $seqlen;
$hash->{cTP} = $cTP || undef;
$hash->{mTP} = $mTP;
$hash->{SP} = $SP;
$hash->{other} = $other;
$hash->{loc} = $loc;
$hash->{RC} = $RC;
$hash->{TPLen} = ($TPlen && $TPlen =~ /\d+/) ? $TPlen : undef;
return $hash;
}
=head2 _add_feature
Title : _add_feature
Usage : $self->_add_feature($feature)
Function : This method stores a feature object
For internal use only
Example :
Returns : n/a
Arguments: Bio::SeqFeature::Generic
=cut
sub _add_feature {
my($self, $feature) = @_;
$self->throw("Need a Bio::SeqFeature::Generic object") unless $feature->isa("Bio::SeqFeature::Generic");
push(@{$self->{'_features'}}, $feature);
return;
}
=head2 _toString_location
Title : _toString_location
Usage : $self->_toString_location($key)
Function : This method convert the 'one letter code' location to
the corresponding definition
For internal use only
Example :
Returns : Location or undef
Arguments: String
=cut
sub _toString_location {
my($self, $key) = @_;
if($key && exists($MAPLOC->{$key})){
return $MAPLOC->{$key};
}
return;
}
1;
|