used the last value of quality plifs to fill out the substitution matrix. Some cosmet...
authorong <ong@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Wed, 16 Jan 2008 19:23:02 +0000 (19:23 +0000)
committerong <ong@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Wed, 16 Jan 2008 19:23:02 +0000 (19:23 +0000)
git-svn-id: http://svn.tuebingen.mpg.de/ag-raetsch/projects/QPalma@7409 e1793c9e-67f9-0310-80fc-b846ff1f7b36

tools/plot_param.py

index 4091033..70055ce 100644 (file)
@@ -23,28 +23,56 @@ def plot_param(filename,train_with_intronlengthinformation=1):
        - acceptor and donor scores
        - intron length scores
     """
+    assert(Configuration.mode == 'using_quality_scores')
     param = cPickle.load(open(filename))
     [h,d,a,mmatrix,qualityPlifs] = set_param_palma(param,train_with_intronlengthinformation)
-    pylab.imshow(numpy.reshape(mmatrix,Configuration.sizeMatchmatrix),\
-                 cmap=pylab.cm.summer,interpolation='nearest')
 
+
+    # construct the substitution matrix using the last value of qualityPlif
+    substmat = numpy.matlib.zeros((1,(Configuration.estPlifs+1)*Configuration.dnaPlifs))
+    substmat[0,:Configuration.sizeMatchmatrix[0]] = mmatrix.T
+    
+    for sidx,plif in enumerate(qualityPlifs):
+        substmat[0,sidx+Configuration.sizeMatchmatrix[0]] = plif.penalties[-1]
+
+    substmat = numpy.reshape(substmat,(Configuration.estPlifs+1,Configuration.dnaPlifs))
+
+    # set up default parameters
+    pylab.rcParams.update({'xtick.labelsize' : 20,
+                           'ytick.labelsize' : 20,
+                           'legend.fontsize' : 20,
+                           })
+
+    # plot the substitution matrix
+    fig1=pylab.imshow(substmat,cmap=pylab.cm.summer,interpolation='nearest')
+    pylab.colorbar()
+    fig1.axes.xaxis.set_ticks_position('top')
+    fig1.axes.xaxis.set_label_position('top')
+    pylab.xticks( numpy.arange(0.5,6,1), ('-', 'A', 'C', 'G', 'T', 'N') )
+    pylab.yticks( numpy.arange(5.5,0,-1), ('-', 'A', 'C', 'G', 'T', 'N') )
+    pylab.xlabel('DNA',fontsize=20)
+    pylab.ylabel('EST',fontsize=20)
+    
+    # plot donor and acceptor transformations
     pylab.figure()
     pylab.plot(a.limits,a.penalties,'bd-',label='Acceptor',hold=True)
     pylab.plot(d.limits,d.penalties,'ro--',label='Donor')
-    pylab.xlabel('SVM output')
-    pylab.ylabel('transition score')
+    pylab.xlabel('SVM output',fontsize=20)
+    pylab.ylabel('transition score',fontsize=20)
     pylab.legend()
 
+    # plot intron length transformations
     pylab.figure()
     pylab.plot(h.limits,h.penalties,'k+-')
-    pylab.xlabel('intron length')
-    pylab.ylabel('transition score')
+    pylab.xlabel('intron length',fontsize=20)
+    pylab.ylabel('transition score',fontsize=20)
 
+    # plot quality score transformations
     pylab.figure()
     for plif in qualityPlifs:
         pylab.plot(plif.limits,plif.penalties,'b^-',hold=True)
-    pylab.xlabel('quality value')
-    pylab.ylabel('transition score')
+    pylab.xlabel('quality value',fontsize=20)
+    pylab.ylabel('transition score',fontsize=20)
 
     pylab.show()