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

Diff of /FigKernelPackages/ProtSims.pm

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

revision 1.5, Sun Aug 23 01:20:23 2009 UTC revision 1.9, Sat Dec 12 23:43:13 2009 UTC
# Line 151  Line 151 
151      @sims = map { push(@$_,$lnQ{$_->[0]},$lnDB{$_->[1]}); bless($_,'Sim') } @sims;      @sims = map { push(@$_,$lnQ{$_->[0]},$lnDB{$_->[1]}); bless($_,'Sim') } @sims;
152    
153      if ($qF      eq "/tmp/query.$$")   { unlink $qF  }      if ($qF      eq "/tmp/query.$$")   { unlink $qF  }
154      if ($dbF     eq "/tmp/db.$$")      { unlink $dbF }      if ($dbF     eq "/tmp/db.$$")      { unlink($dbF,"$dbF.psq","$dbF.pin","$dbF.phr") }
155      return sort { ($a->id1 cmp $b->id1) or ($a->id2 cmp $b->id2) or ($b->bsc <=> $a->bsc) } @sims;      return sort { ($a->id1 cmp $b->id1) or ($a->psc <=> $b->psc) or ($a->id2 cmp $b->id2) } @sims;
156  }  }
157    
158  sub condense {  sub condense {
159      my($pieces) = @_;      my($pieces) = @_;
160    
161      my $best_sc = $pieces->[0]->[9];      my $best_sc = $pieces->[0]->[10];
162      my @sims = sort { ($a->[6] <=> $b->[6]) } @$pieces;      my @sims = sort { ($a->[6] <=> $b->[6]) } @$pieces;
163      while ((@sims > 1) &&      while (@sims > 1)
164             ($sims[1]->[6] <= ($sims[0]->[7] + 100)) &&      {
165             ($sims[1]->[8] <= ($sims[0]->[9] + 100)) &&          my $gap1 = $sims[1]->[6] - $sims[0]->[7];
166             (abs(($sims[1]->[6] - $sims[0]->[7]) - ($sims[1]->[8] - $sims[0]->[9])) < 20))          my $gap2 = $sims[1]->[8] - $sims[0]->[9];
167            my $diff = abs($gap1 - $gap2);
168            if (($gap1 <= 300) && ($gap2 <= 300) && ($diff <= (0.1 * &min($gap1,$gap2))))
169      {      {
170          $sims[0]->[7] = $sims[1]->[7];          $sims[0]->[7] = $sims[1]->[7];
171          $sims[0]->[9] = $sims[1]->[9];          $sims[0]->[9] = $sims[1]->[9];
172            }
173          splice(@sims,1,1);          splice(@sims,1,1);
174      }      }
175        $sims[0]->[10] = $best_sc;
176      return $sims[0];      return $sims[0];
177  }  }
178    
179    sub min {
180        my($x,$y) = @_;
181        return ($x <= $y) ? $x : $y;
182    }
183    
184  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3