[Bio] / FigKernelPackages / Sim.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Sim.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Mon Aug 1 22:22:13 2005 UTC revision 1.6, Mon Aug 29 21:25:46 2005 UTC
# Line 3  Line 3 
3  use FIGAttributes;  use FIGAttributes;
4  use base 'FIGAttributes';  use base 'FIGAttributes';
5    
6    use overload '""' => \&as_string;
7    
8    sub as_string
9    {
10        my($obj) = @_;
11    
12        return sprintf("sim:%s->%s:%s", $obj->id1, $obj->id2, $obj->psc);
13    }
14    
15    sub new_from_line
16    {
17        my($class, $line) = @_;
18    
19        chomp $line;
20        my $self = [split(/\t/, $line)];
21        return bless $self, $class;
22    }
23    
24    sub validate
25    {
26        my($self) = @_;
27    
28        return ($self->id1 ne "" and
29                $self->id2 ne "" and
30                $self->iden =~ /^[.\d]+$/ and
31                $self->ali_ln =~ /^\d+$/ and
32                $self->mismatches =~ /^\d+$/ and
33                $self->gaps =~ /^\d+$/ and
34                $self->b1 =~ /^\d+$/ and
35                $self->e1 =~ /^\d+$/ and
36                $self->b2 =~ /^\d+$/ and
37                $self->e2 =~ /^\d+$/ and
38                $self->psc =~ /^[-.e\d]+$/ and
39                $self->bsc =~ /^[-.\d]+$/ and
40                $self->ln1 =~ /^\d+$/ and
41                $self->ln2 =~ /^\d+$/);
42    }
43    
44    
45    sub as_line
46    {
47        my($self) = @_;
48    
49        return join("\t", @$self) . "\n";
50    }
51    
52    
53    
54  sub id1 :Scalar {  sub id1 :Scalar {
55      my($sim) = @_;      my($sim) = @_;
56      return $sim->[0];      return $sim->[0];

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3