SRCS= Mathmatics.cpp\
fill_matrix.cpp\
+ qpalma_dp.cpp\
result_align.cpp\
penalty_info.cpp\
print_align.cpp\
%module QPalmaDP
%{
+#include "common.h"
+#include "Mathmatics.h"
+#include "penalty_info.h"
#include "qpalma_dp.h"
%}
%include "carrays.i"
+%include "common.h"
+%include "Mathmatics.h"
+%include "penalty_info.h"
%include "qpalma_dp.h"
-
%array_functions(int, intArray) ;
-%array_functions(double, doubleArray) ;
+%array_function(double, doubleArray) ;
%array_class(Pre_score, Pre_scoreArray) ;
%pythoncode
}
}
-void delete_penalty_struct(struct penalty_struct &PEN)
+void delete_penalty_struct_palma(struct penalty_struct &PEN)
{
if (PEN.id!=-1)
{
void delete_penalty_struct_array(struct penalty_struct *PEN, INT len)
{
for (int i=0; i<len; i++)
- delete_penalty_struct(PEN[i]) ;
+ delete_penalty_struct_palma(PEN[i]) ;
delete[] PEN ;
}
} ;
void init_penalty_struct(struct penalty_struct &PEN) ;
-void delete_penalty_struct(struct penalty_struct &PEN) ;
-void delete_penalty_struct_array(struct penalty_struct *PEN, INT len) ;
+void delete_penalty_struct_palma(struct penalty_struct &PEN) ;
+//void delete_penalty_struct_array(struct penalty_struct *PEN, INT len) ;
//#ifdef HAVE_MATLAB
//struct penalty_struct * read_penalty_struct_from_cell(const mxArray * mx_penalty_info, mwSize &P) ;
nrhs - Number of inputs (Right Hand Side)
prhs - Array of pointers to input data. */
- myalign([nr_paths], dna, est, {h}, matchmatrix, donor, acceptor, remove_duplicate_scores, ...
- print_matrix) */
+Alignment::Alignment() {
+
+ len = 0;
+ limits = 0;
+ penalties = 0;
+ max_len = 0;
+ min_len = 0;
+ cache = 0;
+ enum ETransformType transform = T_LINEAR;
+ id = 0;
+ name = 0;
+ use_svm = 0;
+}
+
+Alignment::~Alignment() {}
+void Alignment::myalign(int nr_paths, char* dna, int dna_len, char* est,
+ int est_len, struct penalty_struct h, double* matchmatrix, int mm_len,
+ double* donor, int d_len, double* acceptor, int a_len,
+ bool remove_duplicate_scores, bool print_matrix) {}
+
+void Alignment::getSpliceAlign(){}
+void Alignment::getEstAlign(){}
+void Alignment::getWeightMatch(){}
+void Alignment::getTotalScores(){}
+void Alignment::getDNAEST(){}
+
+#if 0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
return;
}
-
+#endif
class Alignment {
private:
- SpliceAlign
- EstAlign;
- WeightMatch;
- TotalScores;
+ int SpliceAlign;
+ int EstAlign;
+ int WeightMatch;
+ int TotalScores;
+
+ INT len;
+ REAL *limits;
+ REAL *penalties;
+ INT max_len;
+ INT min_len;
+ REAL *cache;
+ enum ETransformType transform ;
+ INT id;
+ char * name;
+ INT use_svm;
public:
Alignment();
~Alignment();
- void myalign(int nr_paths, dna, est, h, matchmatrix, double* donor, double* acceptor, bool remove_duplicate_scores, bool print_matrix);
- getSpliceAlign()
- getEstAlign();
- getWeightMatch();
- getTotalScores();
- getDNAEST();
-
-
+ void myalign(int nr_paths, char* dna, int dna_len, char* est,
+ int est_len, struct penalty_struct h, double* matchmatrix, int mm_len,
+ double* donor, int d_len, double* acceptor, int a_len,
+ bool remove_duplicate_scores, bool print_matrix);
+
+ void penSetLength(int l) { len = l; }
+ void penSetLimits(REAL* lts) {
+ limits = new REAL[len];
+ for(int i=0; i<len; i++)
+ limits[i] = lts[i];
+ }
+
+
+ void getSpliceAlign();
+ void getEstAlign();
+ void getWeightMatch();
+ void getTotalScores();
+ void getDNAEST();
+
+
};
from computeSpliceAlign import *
from computeSpliceWeights import *
+import QPalmaDP
"""
A training method for the QPalma project
trueSpliceAlign, trueWeightMatch = computeSpliceAlign(dna, exons)
trueWeightDon, trueWeightAcc, trueWeightIntron = computeSpliceWeights(d, a, h, trueSpliceAlign, don_supp, acc_supp)
- pdb.set_trace()
#
# compute wrong alignments
#
+ nr_paths = 1
+ dna = 'acgtagct'
+ dna_len = len(dna)
+
+ est = 'acgtagct'
+ est_len = len(est)
+
+ matchmatrix = QPalmaDP.createDoubleArrayFromList([1.0]*36)
+ mm_len = 36
+ donor = QPalmaDP.createDoubleArrayFromList([1,2.0,4])
+ d_len = 3
+ acceptor = QPalmaDP.createDoubleArrayFromList([.1,2,4])
+ a_len = 3
+ remove_duplicate_scores = False
+ print_matrix = False
+
+ currentAlignment = QPalmaDP.Alignment()
+ currentAlignment.penSetLength(30)
+ dA = QPalmaDP.createDoubleArrayFromList([1.0]*30)
+ #currentAlignment.penSetLimits(dA)
+ ps = QPalmaDP.penalty_struct()
+ ps.len = 30
+ ps.limit = dA
+
+ currentAlignment.myalign( nr_paths, dna, dna_len,\
+ est, est_len, ps, matchmatrix, mm_len, donor, d_len,\
+ acceptor, a_len, remove_duplicate_scores, print_matrix)
+
+ pdb.set_trace()
- # Compute donor, acceptor with penalty_lookup_new
- # returns two double lists
- [donor, acceptor] = compute_donacc(don_supp, acc_supp, d, a) ;
+ # # Compute donor, acceptor with penalty_lookup_new
+ # # returns two double lists
+ # [donor, acceptor] = compute_donacc(don_supp, acc_supp, d, a) ;
- #myalign wants the acceptor site on the g of the ag
- acceptor = [acceptor(2:end) -Inf] ;
-
- # call myalign
- [SpliceAlign, EstAlign, weightMatch, Gesamtscores, dnaest] = ...
- myalign_local(num_path(id), dna, est, {h}, mmatrix, donor, acceptor, ...
- remove_duplicate_scores, print_matrix);
+ # #myalign wants the acceptor site on the g of the ag
+ # acceptor = [acceptor(2:end) -Inf] ;
+ #
+ # # call myalign
+ # [SpliceAlign, EstAlign, weightMatch, Gesamtscores, dnaest] = ...
+ # myalign_local(num_path(id), dna, est, {h}, mmatrix, donor, acceptor, ...
+ # remove_duplicate_scores, print_matrix);
- SpliceAlign = double(SpliceAlign') ; %column
- weightMatch = double(weightMatch') ;
-
+ # SpliceAlign = double(SpliceAlign') ; %column
+ # weightMatch = double(weightMatch') ;
iteration_nr += 1
break
import math
import numpy.matlib
+import QPalmaDP
def linspace(a,b,n):
intervalLength = b-a
return interval
class Plf: #means piecewise linear function
- len = 0
- limits = []
- penalties = []
- transform = ''
- name = ''
- max_len = 0
- min_len = 0
+
+ def __init_(self):
+ self.len = 0
+ self.limits = []
+ self.penalties = []
+ self.transform = ''
+ self.name = ''
+ self.max_len = 0
+ self.min_len = 0
+
+ #def convert2SWIG(self):
+ # ps = QPalmaDP.penalty_struct()
+ #
+ # #ps.len = self.len
+ # #ps.limits = self.limits
+ # ps.penalties = self.penalties
+ # ps.max_len = self.max_len
+ # ps.min_len = self.min_len
+ # ps.transform = 0
+ # ps.name = self.name
+
+ # return ps
+
def set_params_pa():
h = plf()