[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.4, Fri Aug 21 21:31:01 2009 UTC revision 1.5, Sun Aug 23 01:20:23 2009 UTC
# Line 83  Line 83 
83          die "ProtSims::blastP: blat run failed with rc=$rc: $cmd\n";          die "ProtSims::blastP: blat run failed with rc=$rc: $cmd\n";
84      }      }
85    
86      my @sims1 = map { chomp; [split(/\s+/,$_)] } `cat $tmpF`;      my @sims1 = ();
87        open(BLAT,"<$tmpF") || die "could not open $tmpF";
88        my $sim = <BLAT>;
89        while ($sim && ($sim=~ /^(\S+\t\S+)/))
90        {
91            my $pegs = $1;
92            my @pieces = ();
93            while ($sim && ($sim=~ /^((\S+\t\S+).*\S)/) && ($2 eq $pegs))
94            {
95                push(@pieces,[split(/\t/,$1)]);
96                $sim = <BLAT>;
97            }
98            push(@sims1,&condense(\@pieces));
99        }
100        close(BLAT);
101      unlink $tmpF;      unlink $tmpF;
102      #print STDERR &Dumper(sims1 => \@sims1);      #print STDERR &Dumper(sims1 => \@sims1);
103    
# Line 138  Line 152 
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 }
155      return sort { ($a->id1 cmp $b->id1) or ($b->bsc <=> $a->bsc) or ($a->id2 cmp $b->id2) } @sims;      return sort { ($a->id1 cmp $b->id1) or ($a->id2 cmp $b->id2) or ($b->bsc <=> $a->bsc) } @sims;
156    }
157    
158    sub condense {
159        my($pieces) = @_;
160    
161        my $best_sc = $pieces->[0]->[9];
162        my @sims = sort { ($a->[6] <=> $b->[6]) } @$pieces;
163        while ((@sims > 1) &&
164               ($sims[1]->[6] <= ($sims[0]->[7] + 100)) &&
165               ($sims[1]->[8] <= ($sims[0]->[9] + 100)) &&
166               (abs(($sims[1]->[6] - $sims[0]->[7]) - ($sims[1]->[8] - $sims[0]->[9])) < 20))
167        {
168            $sims[0]->[7] = $sims[1]->[7];
169            $sims[0]->[9] = $sims[1]->[9];
170            splice(@sims,1,1);
171        }
172        return $sims[0];
173  }  }
174    
175  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3