+ changed interface for decoded plif features -> directly access double array
[qpalma.git] / python / set_param_palma.py
index 71fe2c6..694eb2e 100644 (file)
@@ -57,19 +57,20 @@ def set_param_palma(param, train_with_intronlengthinformation,\
    h = Plf()
    d = Plf()
    a = Plf()
-   qualityPlifs = [Plf()]*Configuration.numQualPlifs
+   qualityPlifs = [None]*Configuration.numQualPlifs
 
    donSP       = Configuration.numDonSuppPoints
    accSP       = Configuration.numAccSuppPoints
    lengthSP    = Configuration.numLengthSuppPoints
-   mmatrixSP   = Configuration.sizeMMatrix
+   mmatrixSP   = Configuration.sizeMatchmatrix[0]\
+   *Configuration.sizeMatchmatrix[1]
    totalQualSP = Configuration.totalQualSuppPoints
 
    ####################
    # Gapfunktion
    ####################
    h.limits    = logspace(math.log(min_intron_len,10),math.log(max_intron_len,10),30) 
-   h.penalties = param[0:lengthSP].flatten().tolist()
+   h.penalties = param[0:lengthSP].flatten().tolist()[0]
    #h.transform = '+1' 
    h.transform = '' 
    h.name      = 'h' 
@@ -84,7 +85,7 @@ def set_param_palma(param, train_with_intronlengthinformation,\
    # Donorfunktion
    ####################
    d.limits    = linspace(min_svm_score,max_svm_score,30) 
-   d.penalties = param[lengthSP:lengthSP+donSP].flatten().tolist()
+   d.penalties = param[lengthSP:lengthSP+donSP].flatten().tolist()[0]
    #d.transform = '+1' 
    d.transform = '' 
    d.name      = 'd' 
@@ -99,7 +100,7 @@ def set_param_palma(param, train_with_intronlengthinformation,\
    # Acceptorfunktion
    ####################
    a.limits    = linspace(min_svm_score,max_svm_score,30) 
-   a.penalties = param[lengthSP+donSP:lengthSP+donSP+accSP].flatten().tolist()
+   a.penalties = param[lengthSP+donSP:lengthSP+donSP+accSP].flatten().tolist()[0]
    #a.transform = '+1' 
    a.transform = '' 
    a.name      = 'a' 
@@ -109,7 +110,6 @@ def set_param_palma(param, train_with_intronlengthinformation,\
    a.use_svm   = 0 
    a.next_id   = 0 
 
-
    ####################
    # Matchmatrix
    ####################
@@ -120,25 +120,21 @@ def set_param_palma(param, train_with_intronlengthinformation,\
    # Quality Plifs
    ####################
    for idx in range(Configuration.numQualPlifs):
-      currentPlif = qualityPlifs[idx]
-      currentPlif.limits    = linspace(min_svm_score,max_svm_score,Configuration.numQualSuppPoints) 
+      currentPlif = Plf()
+      currentPlif.limits    = linspace(Configuration.min_qual,Configuration.max_qual,Configuration.numQualSuppPoints) 
       begin                 = lengthSP+donSP+accSP+mmatrixSP+(idx*Configuration.numQualSuppPoints)
       end                   = lengthSP+donSP+accSP+mmatrixSP+((idx+1)*Configuration.numQualSuppPoints)
-      currentPlif.penalties = param[begin:end].flatten().tolist()
+      print begin,end
+      currentPlif.penalties = param[begin:end].flatten().tolist()[0]
       currentPlif.transform = '' 
       currentPlif.name      = 'q' 
-      currentPlif.max_len   = 100  
-      currentPlif.min_len   = -100  
-
+      currentPlif.max_len   = Configuration.max_qual 
+      currentPlif.min_len   = Configuration.min_qual
       qualityPlifs[idx] = currentPlif
 
    return h,d,a,mmatrix,qualityPlifs
 
 if __name__ == '__main__':
-   #min_intron_len=20
-   #max_intron_len=1000
-   #print logspace(math.log(min_intron_len,10),math.log(max_intron_len,10),30) 
-
    min_svm_score=-5
    max_svm_score=5
    print linspace(min_svm_score,max_svm_score,30)