2
2
# PACKAGE : Bio::Tools::Sigcleave
3
3
# AUTHOR : Chris Dagdigian, dag@sonsorol.org
4
4
# CREATED : Jan 28 1999
5
# REVISION: $Id: Sigcleave.pm,v 1.18 2003/06/04 08:36:43 heikki Exp $
5
# REVISION: $Id: Sigcleave.pm,v 1.22.4.1 2006/10/02 23:10:32 sendu Exp $
7
7
# Copyright (c) 1997-9 bioperl, Chris Dagdigian and others. All Rights Reserved.
8
8
# This module is free software; you can redistribute it and/or
130
129
=head2 Reporting Bugs
132
131
Report bugs to the Bioperl bug tracking system to help us keep track
133
the bugs and their resolution. Bug reports can be submitted via email
132
the bugs and their resolution. Bug reports can be submitted via the
136
bioperl-bugs@bio.perl.org
137
http://bugzilla.bioperl.org/
135
http://bugzilla.open-bio.org/
141
Chris Dagdigian, dag@sonsorol.org & others
139
Chris Dagdigian, dag-at-sonsorol.org & others
143
141
=head1 CONTRIBUTORS
145
Heikki Lehvaslaiho, heikki@ebi.ac.uk
143
Heikki Lehvaslaiho, heikki-at-bioperl-dot-org
149
Bio::Tools::Sigcleave.pm, $Id: Sigcleave.pm,v 1.18 2003/06/04 08:36:43 heikki Exp $
147
Bio::Tools::Sigcleave, $Id: Sigcleave.pm,v 1.22.4.1 2006/10/02 23:10:32 sendu Exp $
185
181
package Bio::Tools::Sigcleave;
188
183
use Bio::PrimarySeq;
190
@ISA = qw(Bio::Root::Root);
185
use base qw(Bio::Root::Root);
192
187
use vars qw ($ID %WeightTable_euc %WeightTable_pro );
193
188
$ID = 'Bio::Tools::Sigcleave';
259
254
foreach my $i (keys %WeightTable_euc) {
260
my $expected = $WeightTable_euc{$i}[15];
262
for (my $j=0; $j<16; $j++) {
263
if ($WeightTable_euc{$i}[$j] == 0) {
264
$WeightTable_euc{$i}[$j] = 1;
265
if ($j == 10 || $j == 12) {
266
$WeightTable_euc{$i}[$j] = 1.e-10;
255
my $expected = $WeightTable_euc{$i}[15];
257
for (my $j=0; $j<16; $j++) {
258
if ($WeightTable_euc{$i}[$j] == 0) {
259
$WeightTable_euc{$i}[$j] = 1;
260
if ($j == 10 || $j == 12) {
261
$WeightTable_euc{$i}[$j] = 1.e-10;
264
$WeightTable_euc{$i}[$j] = log($WeightTable_euc{$i}[$j]/$expected);
269
$WeightTable_euc{$i}[$j] = log($WeightTable_euc{$i}[$j]/$expected);
275
270
foreach my $i (keys %WeightTable_pro) {
276
my $expected = $WeightTable_pro{$i}[15];
278
for (my $j=0; $j<16; $j++) {
279
if ($WeightTable_pro{$i}[$j] == 0) {
280
$WeightTable_pro{$i}[$j] = 1;
281
if ($j == 10 || $j == 12) {
282
$WeightTable_pro{$i}[$j] = 1.e-10;
271
my $expected = $WeightTable_pro{$i}[15];
273
for (my $j=0; $j<16; $j++) {
274
if ($WeightTable_pro{$i}[$j] == 0) {
275
$WeightTable_pro{$i}[$j] = 1;
276
if ($j == 10 || $j == 12) {
277
$WeightTable_pro{$i}[$j] = 1.e-10;
280
$WeightTable_pro{$i}[$j] = log($WeightTable_pro{$i}[$j]/$expected);
285
$WeightTable_pro{$i}[$j] = log($WeightTable_pro{$i}[$j]/$expected);
292
285
#####################################################################################
293
286
## CONSTRUCTOR ##
294
287
#####################################################################################
327
320
#----------------
329
322
#----------------
330
my ($self, $value) = @_;
331
if( defined $value) {
332
$self->throw("I need a number, not [$value]")
333
if $value !~ /^[+-]?[\d\.]+$/;
334
$self->{'_threshold'} = $value;
336
return $self->{'_threshold'} || 3.5 ;
323
my ($self, $value) = @_;
324
if( defined $value) {
325
$self->throw("I need a number, not [$value]")
326
if $value !~ /^[+-]?[\d\.]+$/;
327
$self->{'_threshold'} = $value;
329
return $self->{'_threshold'} || 3.5 ;
352
345
#----------------
354
347
#----------------
355
my ($self, $value) = @_;
356
if( defined $value) {
357
$self->throw("I need 'eucaryotic' or 'procaryotic', not [$value]")
358
unless $value eq 'eucaryotic' or $value eq 'procaryotic';
359
$self->{'_matrix'} = $value;
361
return $self->{'_matrix'} || 'eucaryotic' ;
348
my ($self, $value) = @_;
349
if( defined $value) {
350
$self->throw("I need 'eucaryotic' or 'procaryotic', not [$value]")
351
unless $value eq 'eucaryotic' or $value eq 'procaryotic';
352
$self->{'_matrix'} = $value;
354
return $self->{'_matrix'} || 'eucaryotic' ;
368
Usage : $value = $self->seq('procaryotic')
369
Purpose : Read/write method sigcleave seq.
371
Argument : new value: 'eucaryotic' or 'procaryotic'
372
Throws : on non-number argument
373
Comments : defaults to 3.5
360
Usage : $value = $self->seq($seq_object)
361
Purpose : set the Seq object to be used
363
Argument : protein sequence or Seq object
378
368
#----------------
380
370
#----------------
381
my ($self, $value) = @_;
382
if( defined $value) {
383
if ($value->isa('Bio::PrimarySeqI')) {
384
$self->{'_seq'} = $value;
386
$self->{'_seq'} = Bio::PrimarySeq->new(-seq=>$value,
387
-alphabet=>'protein');
371
my ($self, $value) = @_;
372
if( defined $value) {
373
if ($value->isa('Bio::PrimarySeqI')) {
374
$self->{'_seq'} = $value;
376
$self->{'_seq'} = Bio::PrimarySeq->new(-seq => $value,
377
-alphabet => 'protein');
390
return $self->{'_seq'};
380
return $self->{'_seq'};
446
434
$pep =~ tr/a-z/A-Z/;
448
436
for ($seqPos = $seqBegin; $seqPos < $seqEnd; $seqPos++) {
449
$istart = (0 > $seqPos + $pVal)? 0 : $seqPos + $pVal;
450
$iend = ($seqPos + $nVal - 1 < $seqEnd)? $seqPos + $nVal - 1 : $seqEnd;
451
$icol= $iend - $istart + 1;
453
for ($k=0; $k<$icol; $k++) {
454
$c = substr($pep, $istart + $k, 1);
437
$istart = (0 > $seqPos + $pVal)? 0 : $seqPos + $pVal;
438
$iend = ($seqPos + $nVal - 1 < $seqEnd)? $seqPos + $nVal - 1 : $seqEnd;
439
$icol= $iend - $istart + 1;
441
for ($k=0; $k<$icol; $k++) {
442
$c = substr($pep, $istart + $k, 1);
456
## CD: The if(defined) stuff was put in here because Sigcleave.pm
457
## CD: kept getting warnings about undefined vals during 'make test' ...
458
if ($matrix eq 'eucaryotic') {
459
$weight += $WeightTable_euc{$c}[$k] if defined $WeightTable_euc{$c}[$k];
461
$weight += $WeightTable_pro{$c}[$k] if defined $WeightTable_pro{$c}[$k];
464
$signals{$seqPos+1} = sprintf ("%.1f", $weight) if $weight >= $minWeight;
444
## CD: The if(defined) stuff was put in here because Sigcleave.pm
445
## CD: kept getting warnings about undefined vals during 'make test' ...
446
if ($matrix eq 'eucaryotic') {
447
$weight += $WeightTable_euc{$c}[$k] if defined $WeightTable_euc{$c}[$k];
449
$weight += $WeightTable_pro{$c}[$k] if defined $WeightTable_pro{$c}[$k];
452
$signals{$seqPos+1} = sprintf ("%.1f", $weight) if $weight >= $minWeight;
467
454
$self->{"_signal_scores"} = { %signals };
489
476
#----------------
491
478
#----------------
496
# do the calculations
499
foreach $position ( sort keys %{ $self->{'_signal_scores'} } ) {
500
$results{$position} = $self->{'_signal_scores'}{$position};
483
# do the calculations
486
foreach $position ( sort keys %{ $self->{'_signal_scores'} } ) {
487
$results{$position} = $self->{'_signal_scores'}{$position};
565
552
$output = "SIGCLEAVE of $name from: 1 to $seqlen\n\n";
567
554
if ($hitcount > 0) {
568
$output .= "Report scores over $thresh\n";
569
foreach $pos ((sort { $results{$b} cmp $results{$a} } keys %results)) {
570
my $start = $pos - 15;
571
$start = 1 if $start < 1;
572
my $sig = substr($pep,$start -1,$pos-$start );
574
$output .= sprintf ("Maximum score %1.1f at residue %3d\n",$results{$pos},$pos);
576
$output .= " Sequence: ";
578
$output .= "-" x (15- length($sig));
580
$output .= substr($pep,$pos-1,50);
583
$output .= "| \(signal\) | \(mature peptide\)\n";
584
$output .= sprintf(" %3d %3d\n\n",$start,$pos);
586
if (($hitcount > 1) && ($cnt == 1)) {
587
$output .= " Other entries above $thresh\n\n";
555
$output .= "Report scores over $thresh\n";
556
foreach $pos ((sort { $results{$b} cmp $results{$a} } keys %results)) {
557
my $start = $pos - 15;
558
$start = 1 if $start < 1;
559
my $sig = substr($pep,$start -1,$pos-$start );
561
$output .= sprintf ("Maximum score %1.1f at residue %3d\n",$results{$pos},$pos);
563
$output .= " Sequence: ";
565
$output .= "-" x (15- length($sig));
567
$output .= substr($pep,$pos-1,50);
570
$output .= "| \(signal\) | \(mature peptide\)\n";
571
$output .= sprintf(" %3d %3d\n\n",$start,$pos);
573
if (($hitcount > 1) && ($cnt == 1)) {
574
$output .= " Other entries above $thresh\n\n";