+ minor changes to support transcriptome data
authorfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Wed, 11 Jun 2008 10:30:14 +0000 (10:30 +0000)
committerfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Wed, 11 Jun 2008 10:30:14 +0000 (10:30 +0000)
git-svn-id: http://svn.tuebingen.mpg.de/ag-raetsch/projects/QPalma@9561 e1793c9e-67f9-0310-80fc-b846ff1f7b36

scripts/createAlignmentFileFromPrediction.py

index cc37313..5da7bb2 100644 (file)
@@ -13,10 +13,6 @@ from Evaluation import load_chunks
 
 def prediction_on(current_dir,filtered_reads,out_fname):
     
-   #print 'parsing filtered reads..'
-   #all_filtered_reads = parse_filtered_reads(filtered_reads)
-   #print 'found %d filtered reads' % len(all_filtered_reads)
-
    import qparser
    qparser.parse_reads(filtered_reads)
 
@@ -28,16 +24,17 @@ def prediction_on(current_dir,filtered_reads,out_fname):
    for current_prediction in allPredictions:
       id = current_prediction['id']
 
-      #current_ground_truth = all_filtered_reads[id]
-      current_ground_truth = qparser.fetch_read(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['est']
 
-      true_cut = current_ground_truth['true_cut']
-      seq = current_ground_truth['seq']
-      q1 = current_ground_truth['prb']
+      # CHECK !!!
+      q1          = 'zzz'
 
       chr         = current_prediction['chr']
       strand      = current_prediction['strand']
-      #true_cut    = current_prediction['true_cut']
       start_pos   = current_prediction['start_pos']
       alignment   = current_prediction['alignment']
 
@@ -48,33 +45,9 @@ def prediction_on(current_dir,filtered_reads,out_fname):
       e_stop   = current_ground_truth['exon_stop']
       e_start  = current_ground_truth['exon_start']
       p_stop   = current_ground_truth['p_stop']
-      cut_pos = current_ground_truth['true_cut']
 
       correct_prediction = False
 
-      #if len(predExons) == 4:
-      #   spliced_flag = True
-      #   predExons[1] -= 1
-      #   predExons[3] -= 1
-
-      #   if p_start == predExons[0] and e_stop == predExons[1] and\
-      #   e_start == predExons[2] and p_stop == predExons[3]:
-      #      correct_prediction = True
-
-      #   if p_start == predExons[0] and e_stop == predExons[1] and\
-      #   e_start == predExons[2] and p_stop+1 == predExons[3]:
-      #      print 'special case'
-
-      #elif len(predExons) == 2:
-      #   spliced_flag = False
-      #   predExons[1] -= 1
-
-      #   if math.fabs(p_start - predExons[0]) <= 0 and math.fabs(p_stop - predExons[1]) <= 2:
-      #      correct_prediction = True
-      #      
-      #else:
-      #   pass
-
       (qStart, qEnd, tStart, tEnd, num_exons, qExonSizes, qStarts, qEnds,\
       tExonSizes,tStarts, tEnds) = alignment 
 
@@ -88,60 +61,6 @@ def prediction_on(current_dir,filtered_reads,out_fname):
 
    return allPositions
 
-
-#def writePredictions(fname,allPositions):
-#
-#
-#   allEntries = {}
-#
-#   for line in open('/fml/ag-raetsch/share/projects/qpalma/solexa/allReads.pipeline'):
-#      line = line.strip()
-#      id,seq,q1,q2,q3 = line.split()
-#      id = int(id)
-#      
-#      allEntries[id] = (seq,q1,q2,q3)
-#
-#
-#   for id,elems in allPositions.items():
-#      seq,q1,q2,q3 = allEntries[id]
-#      chr,strand,start_pos,true_cut,p1,p2,p3,p4,alignment = elems
-#
-#      p1 += start_pos
-#      p2 += start_pos
-#      p3 += start_pos
-#      p4 += start_pos
-#
-#   out_fh.close()
-#
-
-#def collect_prediction(current_dir):
-#   """
-#   Given the toplevel directory this function takes care that for each distinct
-#   experiment the training and test predictions are evaluated.
-#
-#   """
-#   train_suffix   = '_allPredictions_TRAIN'
-#   test_suffix    = '_allPredictions_TEST'
-#
-#   run_name = 'run_+_quality_+_splicesignals_+_intron_len_1'
-#
-#   jp = os.path.join
-#   b2s = ['-','+']
-#
-#   #currentRun = cPickle.load(open(jp(current_dir,'run_object_1.pickle')))
-#   #QFlag    = currentRun['enable_quality_scores']
-#   #SSFlag   = currentRun['enable_splice_signals']
-#   #ILFlag   = currentRun['enable_intron_length']
-#   #currentRunId = '%s%s%s' % (b2s[QFlag],b2s[SSFlag],b2s[ILFlag])
-#   
-#   filename =  jp(current_dir,run_name)+test_suffix
-#   print 'Prediction on: %s' % filename
-#   test_result = prediction_on(filename)
-#
-#   fname = 'predictions.txt'
-#   writePredictions(fname,test_result)
-#
-
 if __name__ == '__main__':
    current_dir = sys.argv[1]
    filtered_reads = sys.argv[2]