+ removed some obsolete dependencies
authorFabio <fabio@congo.fml.local>
Mon, 1 Sep 2008 14:14:24 +0000 (16:14 +0200)
committerFabio <fabio@congo.fml.local>
Mon, 1 Sep 2008 14:14:24 +0000 (16:14 +0200)
qpalma/sequence_utils.py
qpalma/set_param_palma.py
scripts/createAlignmentFileFromPrediction.py
scripts/qpalma_main.py
tests/test_qpalma_prediction.py

index 4d0cd47..a83dfdc 100644 (file)
@@ -17,7 +17,7 @@ import numpy
 
 from numpy.matlib import inf
 
-from Genefinding import *
+#from Genefinding import *
 from genome_utils import load_genomic
 
 extended_alphabet    = ['-','a','c','g','t','n','[',']']
@@ -160,7 +160,7 @@ def my_load_genomic(fname, strand, start, stop, one_based=True):
          idx = xrange(len(start)-1,-1,-1)
 
       seq = ''.join([load_genomic(chromosome, strand, start[ix], stop[ix], genome)\
-                       for ix in idx])
+      for ix in idx])
       return seq
 
    try:
index 71cddab..53c3795 100644 (file)
@@ -7,8 +7,6 @@ import QPalmaDP
 import pdb
 from Plif import *
 
-import QPalmaConfiguration as Conf
-
 def set_param_palma(param, train_with_intronlengthinformation, run):
 
    print 'Setting parameters ...'
index 351c294..e263395 100644 (file)
@@ -9,8 +9,6 @@ import os.path
 import pdb
 import sys
 
-import qparser
-
 from Utils import pprint_alignment
 
 import palma.palma_utils as pu
@@ -111,11 +109,6 @@ def create_alignment_file(current_loc,out_fname):
 
       id = current_prediction['id']
 
-      #current_ground_truth = qparser.fetch_read(id)
-      #true_cut = current_ground_truth['true_cut']
-      #seq = current_ground_truth['seq']
-      #q1 = current_ground_truth['prb']
-
       seq         = current_prediction['read']
       dna         = current_prediction['dna']
 
index afac4b8..164c1e5 100644 (file)
@@ -38,8 +38,6 @@ from qpalma.computeSpliceAlignWithQuality import *
 from qpalma.TrainingParam import Param
 from qpalma.Plif import Plf,compute_donacc
 
-import QPalmaConfiguration as Conf
-
 from Utils import calc_stat, calc_info, pprint_alignment, get_alignment
 
 class SpliceSiteException:
@@ -202,11 +200,11 @@ class QPalma:
       del c_qualityPlifsFeatures
       del currentAlignment
 
-      assert newSpliceAlign = __newSpliceAlign
-      assert newEstAlign    = __newEstAlign
-      assert newWeightMatch = __newWeightMatch
-      assert newDPScores    = __newDPScores 
-      assert newQualityPlifsFeatures = __newQualityPlifsFeatures 
+      assert newSpliceAlign == __newSpliceAlign
+      assert newEstAlign    == __newEstAlign
+      assert newWeightMatch == __newWeightMatch
+      assert newDPScores    == __newDPScores 
+      assert newQualityPlifsFeatures == __newQualityPlifsFeatures 
 
       return newSpliceAlign, newEstAlign, newWeightMatch, newDPScores,\
       newQualityPlifsFeatures, dna_array, est_array
@@ -615,6 +613,7 @@ class QPalma:
       """
 
       self.run = run
+      self.read_size = 38
 
       self.use_quality_scores = False
       if self.run['mode'] == 'using_quality_scores':
@@ -659,7 +658,7 @@ class QPalma:
             if not self.qpalma_debug_mode:
                self.plog('Loading example id: %d...\n'% int(id))
 
-            if use_quality_scores = True
+            if use_quality_scores:
                quality = currentQualities[quality_index]
             else:
                quality = [40]*len(read)
@@ -719,7 +718,7 @@ class QPalma:
       if '-' in read:
          self.plog('found gap\n')
          read = read.replace('-','')
-         assert len(read) == Conf.read_size
+         assert len(read) == self.read_size
 
       dna_len = len(dna)
       read_len = len(read)
index 2830382..936a163 100644 (file)
@@ -13,6 +13,8 @@ from Utils import print_prediction
 
 from createAlignmentFileFromPrediction import alignment_reconstruct
 
+from qpalma.sequence_utils import DataAccessWrapper,SeqSpliceInfo
+
 jp = os.path.join
 
 
@@ -96,9 +98,25 @@ class TestQPalmaPrediction(unittest.TestCase):
             print 'size'
             print len(example)
 
+
+      # fetch the data needed
+      g_dir    = run['dna_flat_files'] #'/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_fmt = 'chr%d.dna.flat'
+      s_fmt = 'contig_%d%s'
+
+      num_chromo = 6
+
+      accessWrapper = DataAccessWrapper(g_dir,acc_dir,don_dir,g_fmt,s_fmt)
+      seqInfo = SeqSpliceInfo(accessWrapper,range(1,num_chromo))
+
+
+
       qp = QPalma(True)
       #qp.init_prediction(run,set_name)
-      allPredictions = qp.predict(run,self.prediction_set,param)
+      allPredictions = qp.predict(run,self.prediction_set,param,seqInfo )
       for current_prediction in allPredictions:
          align_str = print_prediction(current_prediction)
          print align_str