git-svn-id: http://svn.tuebingen.mpg.de/ag-raetsch/projects/QPalma@8620 e1793c9e...
authorraetsch <raetsch@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Thu, 17 Apr 2008 20:38:27 +0000 (20:38 +0000)
committerraetsch <raetsch@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Thu, 17 Apr 2008 20:38:27 +0000 (20:38 +0000)
scripts/PipelineHeuristic.py

index a858cf1..923982a 100644 (file)
@@ -261,24 +261,26 @@ class PipelineHeuristic:
 
 
    def findHighestScoringSpliceSites(self,currentAcc,currentDon):
-      max_don  = -inf
-      don_pos  = []
-      for idx,score in enumerate(currentDon):
-         if score > -inf and idx > 1 and idx < self.read_size:
-            don_pos.append(idx)
-
-         if len(don_pos) == 2:
-            break
 
-      max_acc  = -inf
-      acc_pos  = []
+      acc   = []
       for idx,score in enumerate(currentAcc):
-         if score > -inf and idx >= self.intron_size:
-            acc_pos = idx
-            #acc_pos.append(idx)
-            break
+         if score > -inf:
+            acc.append((idx,score))
+         if idx>self.read_size:
+             break 
 
-      return don_pos,acc_pos
+      acc.sort(lambda x,y: x[0]-y[0]) 
+
+      don   = []
+      for idx,score in enumerate(currentDon):
+         if score > -inf:
+            don.append((idx,score))
+         if idx>self.read_size:
+             break 
+
+      don.sort(lambda x,y: x[0]-y[0]) 
+
+      return don,acc
 
 
    def calcAlternativeAlignments(self,location):
@@ -315,7 +317,7 @@ class PipelineHeuristic:
       dna   = currentDNASeq
 
       start = cpu()
-      alt_don_pos,acc_pos = self.findHighestScoringSpliceSites(currentAcc,currentDon)
+      alt_don,alt_acc = self.findHighestScoringSpliceSites(currentAcc,currentDon)
       stop = cpu()
       self.splice_site_time = stop-start
 
@@ -335,12 +337,12 @@ class PipelineHeuristic:
       # inlined
 
       IntronScore = calculatePlif(h, [90])[0]
-      dummyAcceptorScore = calculatePlif(a, [0.8])[0] 
-      dummyDonorScore = calculatePlif(d, [0.8])[0]
+      dummyAcceptorScore = calculatePlif(a, [0.25])[0] 
+      dummyDonorScore = calculatePlif(d, [0.25])[0]
       print IntronScore,dummyAcceptorScore,dummyDonorScore
       
       _start = cpu()
-      for don_pos in alt_don_pos:
+      for (don_pos,don_score) in alt_don_pos:
          start = cpu()
 
          exons[0,0]     = 0
@@ -428,8 +430,10 @@ class PipelineHeuristic:
          assert(est_ptr<=len(est))
 
          # new score
+         DonorScore = calculatePlif(d, [don_score])[0]
+
          score = computeSpliceAlignScoreWithQuality(original_est_cut, quality, qualityPlifs, run, self.currentPhi)
-         score += dummyAcceptorScore + IntronScore
+         score += dummyAcceptorScore + IntronScore + DonorScore
          
          print 'diff %f,%f,%f' % ((trueWeight.T * self.currentPhi)[0,0] - score,(trueWeight.T * self.currentPhi)[0,0], score)