+ saving alignment information now in array container (saves factor 8 memory
authorfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Sun, 15 Jun 2008 22:01:10 +0000 (22:01 +0000)
committerfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Sun, 15 Jun 2008 22:01:10 +0000 (22:01 +0000)
requirement)
TODO
+ check for all other places where it could be useful to use array.array instead
of [] (for example quality scores)

git-svn-id: http://svn.tuebingen.mpg.de/ag-raetsch/projects/QPalma@9613 e1793c9e-67f9-0310-80fc-b846ff1f7b36

scripts/qpalma_main.py

index e71f623..cf97fb4 100644 (file)
@@ -29,8 +29,9 @@ from numpy.linalg import norm
 import QPalmaDP
 import qpalma
 
 import QPalmaDP
 import qpalma
 
-from qpalma.SIQP_CPX import SIQPSolver
+#from qpalma.SIQP_CPX import SIQPSolver
 #from qpalma.SIQP_CVXOPT import SIQPSolver
 #from qpalma.SIQP_CVXOPT import SIQPSolver
+import array
 
 from qpalma.DataProc import *
 from qpalma.computeSpliceWeights import *
 
 from qpalma.DataProc import *
 from qpalma.computeSpliceWeights import *
@@ -273,11 +274,11 @@ class QPalma:
       # Initialize solver 
       self.plog('Initializing problem...\n')
       
       # Initialize solver 
       self.plog('Initializing problem...\n')
       
-      try:
-         solver = SIQPSolver(run['numFeatures'],numExamples,run['C'],self.logfh,run)
-      except:
-         self.plog('Got no license. Telling queue to reschedule job...\n')
-         sys.exit(99)
+      #try:
+      #   solver = SIQPSolver(run['numFeatures'],numExamples,run['C'],self.logfh,run)
+      #except:
+      #   self.plog('Got no license. Telling queue to reschedule job...\n')
+      #   sys.exit(99)
 
       #solver.enforceMonotonicity(lengthSP,lengthSP+donSP)
       #solver.enforceMonotonicity(lengthSP+donSP,lengthSP+donSP+accSP)
 
       #solver.enforceMonotonicity(lengthSP,lengthSP+donSP)
       #solver.enforceMonotonicity(lengthSP+donSP,lengthSP+donSP+accSP)
@@ -736,10 +737,14 @@ class QPalma:
       true_map[0] = 1
       pathNr = 0
 
       true_map[0] = 1
       pathNr = 0
 
-      _newSpliceAlign = newSpliceAlign.flatten().tolist()[0]
-      _newEstAlign = newEstAlign.flatten().tolist()[0]
+      _newSpliceAlign   = array.array('B',newSpliceAlign.flatten().tolist()[0])
+      _newEstAlign      = array.array('B',newEstAlign.flatten().tolist()[0])
        
       alignment = get_alignment(_newSpliceAlign,_newEstAlign, dna_array, est_array) #(qStart, qEnd, tStart, tEnd, num_exons, qExonSizes, qStarts, qEnds, tExonSizes, tStarts, tEnds)
        
       alignment = get_alignment(_newSpliceAlign,_newEstAlign, dna_array, est_array) #(qStart, qEnd, tStart, tEnd, num_exons, qExonSizes, qStarts, qEnds, tExonSizes, tStarts, tEnds)
+
+      dna_array = array.array('c',dna_array)
+      est_array = array.array('c',est_array)
+
       #line1,line2,line3 = pprint_alignment(_newSpliceAlign,_newEstAlign, dna_array, est_array)
       #self.plog(line1+'\n')
       #self.plog(line2+'\n')
       #line1,line2,line3 = pprint_alignment(_newSpliceAlign,_newEstAlign, dna_array, est_array)
       #self.plog(line1+'\n')
       #self.plog(line2+'\n')
@@ -748,7 +753,9 @@ class QPalma:
       newExons = self.calculatePredictedExons(newSpliceAlign)
 
       current_prediction = {'predExons':newExons, 'dna':dna, 'est':est, 'DPScores':newDPScores,\
       newExons = self.calculatePredictedExons(newSpliceAlign)
 
       current_prediction = {'predExons':newExons, 'dna':dna, 'est':est, 'DPScores':newDPScores,\
-      'alignment':alignment}
+      'alignment':alignment,\
+      'spliceAlign':_newSpliceAlign,'estAlign':_newEstAlign,\
+      'dna_array':dna_array, 'est_array':est_array }
 
       return current_prediction
 
 
       return current_prediction