File: SVMLoc.pm

package info (click to toggle)
psortb 3.0.6%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 121,044 kB
  • sloc: perl: 3,652; ansic: 698; cpp: 338; sh: 27; makefile: 23
file content (68 lines) | stat: -rw-r--r-- 2,001 bytes parent folder | download | duplicates (5)
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
package Bio::Tools::PSort::Module::SVMLoc;

use Bio::Tools::PSort::Constants qw(:all);
use Bio::Tools::PSort::Module::AnalysisI;
use Bio::Tools::PSort::Report::Result;
use Bio::Tools::PSort::SVMLoc;

use vars qw(@ISA);
use strict;

@ISA = qw(Bio::Tools::PSort::Module::AnalysisI);


my %LOCMAP = (Cytoplasmic  => CYTOPLASM,
	      CytoplasmicMembrane => CYTOPLASMICMEMBRANE,
	      Periplasmic   => PERIPLASMIC,
	      OuterMembrane => OUTERMEMBRANE, 
	      Extracellular => EXTRACELLULAR,
	      Mitochondrial => MITOCHONDRIAL,
	      Nuclear       => NUCLEAR,
	       Unknown => UNKNOWN,
	      Membrane => MEMBRANE,
	      Cellwall => CELLWALL, 
	      Other => OTHER	   
	 	    
);

my %LOCS  = (Cytoplasmic   => 0, CytoplasmicMembrane => 1, Periplasmic   => 2,
	     OuterMembrane => 3, Extracellular => 4, Mitochondrial => 5,
	     Nuclear       => 6, Other       => 7,
	     Membrane => 8, Cellwall => 9, Unknown => 10 );

my %LOCSR = (0 => 'Cytoplasmic',   1 => 'CytoplasmicMembrane', 2 => 'Periplasmic',
	     3 => 'OuterMembrane', 4 => 'Extracellular', 5 => 'Mitochondrial',
	     6 => 'Nuclear',       7 => 'Other', 
	     8 => 'Membrane', 9 => 'Cellwall', 10 => 'Unknown');

sub new {
  my ($class, @args) = @_;
  my $self = $class->SUPER::new(@args);

##receive the SVM_MODEL (based on training data) and the Frequent patterns file
  my ($model, $patterns) = $self->_rearrange([qw(MODEL PATTERNS)], @args);

  $self->{subloc} = new Bio::Tools::PSort::SVMLoc(Model => $model, FreqPatt => $patterns) ||
    $self->throw("Couldn't create new Bio::Tools::PSort::SVMLoc object");

  return $self;
}

sub run {
  my ($self, $seq) = @_;


  $self->throw("Not a Bio::Seq object")
    if((! ref($seq)) && (! $seq->isa("Bio::Seq")));

  $self-throw("No sequence in Bio::Seq object")
      unless($seq->seq);

  my $loc = $self->{subloc}->classify($seq->seq);
 
  return new Bio::Tools::PSort::Report::Result(-details => [ ],
					       -score   => 0,
					       -loc     => $LOCSR{$loc});
}

1;