+ changed python and c code in order to perform easier parameter handling and
[qpalma.git] / dyn_prog / qpalma_dp.cpp
index 518591a..1c71936 100644 (file)
@@ -246,7 +246,7 @@ void Alignment::myalign(int nr_paths_p, char* dna, int dna_len_p, char* est,
       delete[] matrices[i];
 }
 
-void Alignment::getAlignmentResultsOld(int* s_align, int* e_align,
+void Alignment::getAlignmentResults(int* s_align, int* e_align,
       int* mmatrix_p, double* alignscores, double* qScores) {
 
    size_t idx;
@@ -285,7 +285,7 @@ void Alignment::getAlignmentResultsOld(int* s_align, int* e_align,
    //printf("Leaving getAlignmentResults...\n");
 }
 
-void Alignment::getAlignmentArraysOld(int* dna_align, int* est_align) {
+void Alignment::getAlignmentArrays(int* dna_align, int* est_align) {
 
    int idx;
    for(idx=0; idx<result_len; idx++) {
@@ -295,9 +295,8 @@ void Alignment::getAlignmentArraysOld(int* dna_align, int* est_align) {
 }
 
 
-PyObject* Alignment::getAlignmentResults() {
+PyObject* Alignment::getAlignmentResultsNew() {
 
-   PyObject* result = PyTuple_New(5);
    PyObject* py_splice_align  = PyList_New(splice_align_size);
    PyObject* py_est_align     = PyList_New(est_align_size);
    PyObject* py_mmatrix       = PyList_New(mmatrix_param_size);
@@ -345,26 +344,29 @@ PyObject* Alignment::getAlignmentResults() {
       //printf("\nctr is %d\n",ctr);
    }
 
-   PyTuple_SetItem(result,0,py_splice_align);
-   PyTuple_SetItem(result,1,py_est_align);
-   PyTuple_SetItem(result,2,py_mmatrix);
-   PyTuple_SetItem(result,3,py_align_scores);
-   PyTuple_SetItem(result,4,py_q_scores);
+   PyObject* result = PyTuple_Pack(5,
+   py_splice_align, py_est_align, py_mmatrix,
+   py_align_scores, py_q_scores);
+
+   //PyTuple_SetItem(result,0,py_splice_align);
+   //PyTuple_SetItem(result,1,py_est_align);
+   //PyTuple_SetItem(result,2,py_mmatrix);
+   //PyTuple_SetItem(result,3,py_align_scores);
+   //PyTuple_SetItem(result,4,py_q_scores);
 
    return result;
 }
 
-PyObject* Alignment::getAlignmentArrays() {
+PyObject* Alignment::getAlignmentArraysNew() {
 
-   PyObject* result = PyTuple_New(2);
-   PyObject* dna_align  = PyList_New(result_len);
-   PyObject* est_align  = PyList_New(result_len);
+   PyObject* py_dna_align = PyList_New(result_len);
+   PyObject* py_est_align = PyList_New(result_len);
 
-   int idx;
-   for(idx=0; idx<result_len; idx++) {
-      PyList_SetItem(dna_align,idx,PyInt_FromLong(DNA_ARRAY[idx]));
-      PyList_SetItem(est_align,idx,PyInt_FromLong(EST_ARRAY[idx]));
+   for(size_t idx=0; idx<result_len; idx++) {
+      PyList_SetItem(py_dna_align,idx,PyInt_FromLong(DNA_ARRAY[idx]));
+      PyList_SetItem(py_est_align,idx,PyInt_FromLong(EST_ARRAY[idx]));
    }
 
+   PyObject* result = PyTuple_Pack(2, py_dna_align, py_est_align);
    return result;
 }