index 1bb101b..330af57 100644 (file)
@@ -12,6 +12,7 @@

import cPickle
import random
+import sys
import math
import numpy
from numpy import inf
@@ -305,16 +306,30 @@ class TestQPalmaPrediction(unittest.TestCase):

print 'Problem counter is %d' % qp.problem_ctr

-def check_reverse_strand_calculation(id,b,e,seqInfo):
-   seq,acc,don = seqInfo.get_seq_and_scores(id,'-',b,e,only_seq=False,perform_checks=False)

+def check_reverse_strand_calculation(id,b,e,seqInfo):
total_size = seqInfo.getFragmentSize(1)
bp = total_size - e
ep = total_size - b
+
+   seq,acc,don = seqInfo.get_seq_and_scores(id,'-',b,e,only_seq=False,perform_checks=False)
seqp,acc,don  = seqInfo.get_seq_and_scores(id,'+',bp,ep,only_seq=False,perform_checks=False)
seqp = reverse_complement(seqp)

-   return (seq == seqp)
+   res1 = (seq == seqp)
+   #print seq
+   #print seqp
+
+   seq,acc,don  = seqInfo.get_seq_and_scores(id,'+',b,e,only_seq=False,perform_checks=False)
+   seq,acc,don = seqInfo.get_seq_and_scores(id,'-',bp,ep,only_seq=False,perform_checks=False)
+   #seqp = reverse_complement(seq)
+
+   res2 = (seq == seqp)
+   print seq
+   print seqp
+
+   return res1,res2
+

def check_example(chromo,strand,b,e,seqInfo,lt1):
dna,acc,don = seqInfo.get_seq_and_scores(1,strand,b,e)
@@ -351,8 +366,10 @@ def simple_check(settings,seqInfo,lt1):
for (b,e) in [(206,874),(545,874),(999,1234),(1000,total_size-1000),(3,total_size-3),(0,total_size)]:
check_example(chromo,strand,b,e,seqInfo,lt1)

-   for (b,e) in intervals:
-      print 'Rev strand calculation: %s'%str(check_reverse_strand_calculation(1,b,e,seqInfo))
+   #for (b,e) in intervals:
+   #   r1,r2 = check_reverse_strand_calculation(1,b,e,seqInfo)
+   #   print b,e
+   #   print 'Rev strand calculation: %s %s'%(str(r1),str(r2))

def checks():
@@ -371,8 +388,8 @@ def checks():
accessWrapper = DataAccessWrapper(settings)
seqInfo = SeqSpliceInfo(accessWrapper,settings['allowed_fragments'])

-   #lt1 = None
-   lt1 = LookupTable(settings)
+   lt1 = None
+   #lt1 = LookupTable(settings)

print 'Checking with toy data...'
simple_check(settings,seqInfo,lt1)
@@ -398,6 +415,11 @@ def checks():
#print 'Checking with real data...'
#simple_check(settings,seqInfo,lt1)

+   b = 30427463
+   e = 30427563
+   seq,acc,don = seqInfo.get_seq_and_scores(1,'-',b,e,only_seq=False,perform_checks=True)
+   print seq
+

def run():
print 'Creating some artifical data...'