+ minor changes
authorfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Fri, 30 May 2008 09:30:59 +0000 (09:30 +0000)
committerfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Fri, 30 May 2008 09:30:59 +0000 (09:30 +0000)
git-svn-id: http://svn.tuebingen.mpg.de/ag-raetsch/projects/QPalma@9301 e1793c9e-67f9-0310-80fc-b846ff1f7b36

scripts/Evaluation.py
scripts/createCoverageFigures.sh

index 5957516..952eb4c 100644 (file)
@@ -597,7 +597,7 @@ def _predict_on(filename,filtered_reads,with_coverage):
 
 
 
-def predict_on(allPredictions,all_filtered_reads,with_coverage,coverage_fn,coverage_labels_fn):
+def predict_on(allPredictions,all_filtered_reads,all_labels_fn,with_coverage,coverage_fn,coverage_labels_fn):
    """
    This function evaluates the predictions  made by QPalma.
    It needs a pickled file containing the predictions themselves and the
@@ -611,6 +611,8 @@ def predict_on(allPredictions,all_filtered_reads,with_coverage,coverage_fn,cover
 
    coverage_labels_fh = open(coverage_labels_fn,'w+')
 
+   all_labels_fh = open(all_labels_fn,'w+')
+
    import qparser
    qparser.parse_reads(all_filtered_reads)
 
@@ -726,9 +728,6 @@ def predict_on(allPredictions,all_filtered_reads,with_coverage,coverage_fn,cover
          predExons[1] -= 1
          predExons[3] -= 1
 
-         #if predExons[0] == 19504568:
-         #   pdb.set_trace()
-
          cut_pos = current_ground_truth['true_cut']
          p_start = current_ground_truth['p_start']
          e_stop = current_ground_truth['exon_stop']
@@ -778,6 +777,7 @@ def predict_on(allPredictions,all_filtered_reads,with_coverage,coverage_fn,cover
 
          if is_spliced:
                correct_spliced_ctr += 1
+               all_labels_fh.write('%d correct\n'%id)
                if with_coverage and is_covered and current_coverage_nr >= min_coverage:
                   correct_covered_splice_ctr += 1 
 
@@ -789,13 +789,14 @@ def predict_on(allPredictions,all_filtered_reads,with_coverage,coverage_fn,cover
 
          if is_spliced:
                incorrect_spliced_ctr += 1
+               all_labels_fh.write('%d wrong\n'%id)
                if with_coverage and is_covered and current_coverage_nr >= min_coverage:
                   incorrect_covered_splice_ctr += 1 
 
          if not is_spliced:
                incorrect_unspliced_ctr += 1
 
-      if with_coverage and spliced_flag:
+      if with_coverage:
          if not is_covered:
             current_coverage_nr=0 
 
@@ -911,11 +912,14 @@ def predict_on_all_chunks(current_dir,training_keys_fn):
    #result_train = predict_on(training_set,all_filtered_reads,False,coverage_fn)
    #pdb.set_trace()
 
-   coverage_fn = '/fml/ag-raetsch/home/fabio/svn/projects/QPalma/scripts/all_coverages'
+   # this is the heuristic.parsed_spliced_reads.txt file from the vmatch remapping step
+   coverage_fn = '/fml/ag-raetsch/home/fabio/svn/projects/QPalma/scripts/all_coverages' 
+
    all_filtered_reads = '/fml/ag-raetsch/share/projects/qpalma/solexa/new_run/allReads.full'
+
    coverage_labels_fn = 'COVERAGE_LABELS'
 
-   result_test = predict_on(test_set,all_filtered_reads,True,coverage_fn,coverage_labels_fn)
+   result_test = predict_on(test_set,all_filtered_reads,'all_prediction_labels.txt',True,coverage_fn,coverage_labels_fn)
    #print_result(result_train)
 
    return result_test
index ee1bc8b..3ed57c3 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/bash
 
-
 cat $1 | grep correct | cut -f 3 > correct.coverage_labels
 cat $1 | grep wrong | cut -f 3 > wrong.coverage_labels