+ minor changes in the paths
[qpalma.git] / tests / test_sequence_utils.py
index b83c40a..00e8870 100644 (file)
@@ -26,6 +26,8 @@ class TestSequenceUtils(unittest.TestCase):
       accessWrapper = DataAccessWrapper(g_dir,acc_dir,don_dir,g_fmt,s_fmt)
       self.seqInfo = SeqSpliceInfo(accessWrapper,range(1,num_chromo))
 
       accessWrapper = DataAccessWrapper(g_dir,acc_dir,don_dir,g_fmt,s_fmt)
       self.seqInfo = SeqSpliceInfo(accessWrapper,range(1,num_chromo))
 
+      print self.seqInfo.chromo_sizes
+
       #self.lt1 = LookupTable(g_dir,acc_dir,don_dir,g_fmt,s_fmt,range(1,2))
 
 
       #self.lt1 = LookupTable(g_dir,acc_dir,don_dir,g_fmt,s_fmt,range(1,2))
 
 
@@ -182,7 +184,7 @@ class TestLookupTable(unittest.TestCase):
       pass
 
 
       pass
 
 
-   def _testTableThalianaData(self):
+   def testTableThalianaData(self):
       g_dir    = '/fml/ag-raetsch/share/projects/genomes/A_thaliana_best/genome/'
       acc_dir  = '/fml/ag-raetsch/home/fabio/tmp/interval_query_files/acc'
       don_dir  = '/fml/ag-raetsch/home/fabio/tmp/interval_query_files/don'
       g_dir    = '/fml/ag-raetsch/share/projects/genomes/A_thaliana_best/genome/'
       acc_dir  = '/fml/ag-raetsch/home/fabio/tmp/interval_query_files/acc'
       don_dir  = '/fml/ag-raetsch/home/fabio/tmp/interval_query_files/don'
@@ -190,10 +192,31 @@ class TestLookupTable(unittest.TestCase):
       g_fmt = 'chr%d.dna.flat'
       s_fmt = 'contig_%d%s'
 
       g_fmt = 'chr%d.dna.flat'
       s_fmt = 'contig_%d%s'
 
-      lt1 = LookupTable(g_dir,acc_dir,don_dir,g_fmt,s_fmt,range(1,100))
+      num_chromo = 2
+
+      lt1 = LookupTable(g_dir,acc_dir,don_dir,g_fmt,s_fmt,range(1,num_chromo))
+
+      accessWrapper = DataAccessWrapper(g_dir,acc_dir,don_dir,g_fmt,s_fmt)
+      seqInfo = SeqSpliceInfo(accessWrapper,range(1,num_chromo))
+
+      seq = 'CTGGCCAAAAGCTCAGGGAAGACGCAGCCTAGGGCTCC'.lower()
+      seq = reverse_complement(seq)
+      chromo = 1
+      strand = '-'
+      pos = 10475515
+      dna = seqInfo.get_seq_and_scores(chromo,strand,pos,pos+38,True)
+      self.assertEqual(seq,dna)
+
+      dna = lt1.get_seq_and_scores(chromo,strand,pos,pos+38,True)
+      pdb.set_trace()
+      self.assertEqual(seq,dna)
+
+      dna,acc,don = seqInfo.get_seq_and_scores(1,'+',1,1369)
+      dna_,acc_,don_ = lt1.get_seq_and_scores(1,'+',1,1369)
+
 
 
 
 
-   def testTableLyrataData(self):
+   def _testTableLyrataData(self):
       g_dir    = '/fml/ag-raetsch/home/fabio/tmp/Lyrata/contigs'
       acc_dir  = '/fml/ag-raetsch/home/fabio/tmp/Lyrata/splice_scores/acc'
       don_dir  = '/fml/ag-raetsch/home/fabio/tmp/Lyrata/splice_scores/don'
       g_dir    = '/fml/ag-raetsch/home/fabio/tmp/Lyrata/contigs'
       acc_dir  = '/fml/ag-raetsch/home/fabio/tmp/Lyrata/splice_scores/acc'
       don_dir  = '/fml/ag-raetsch/home/fabio/tmp/Lyrata/splice_scores/don'
@@ -236,6 +259,6 @@ def check_wrapper():
 
 
 if __name__ == '__main__':
 
 
 if __name__ == '__main__':
-   suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceUtils)
-   #suite = unittest.TestLoader().loadTestsFromTestCase(TestLookupTable)
+   #suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceUtils)
+   suite = unittest.TestLoader().loadTestsFromTestCase(TestLookupTable)
    unittest.TextTestRunner(verbosity=2).run(suite)
    unittest.TextTestRunner(verbosity=2).run(suite)