summaryrefslogtreecommitdiffstats
Unidiff
-rw-r--r--test/entropy/Align2Ref.m24
-rw-r--r--test/entropy/CalculateEntropy.m15
-rw-r--r--test/entropy/CalculateProteinEntropy.m25
-rw-r--r--test/entropy/FastNWalign2.c94
-rw-r--r--test/entropy/GenomeAlignments.m31
-rw-r--r--test/entropy/GenomePairwiseDist.m98
-rw-r--r--test/entropy/RefineAlignments.m276
-rw-r--r--test/entropy/don_anal.m40
-rw-r--r--test/entropy/nwalign_mod.m637
9 files changed, 1240 insertions, 0 deletions
diff --git a/test/entropy/FastNWalign2.c b/test/entropy/FastNWalign2.c
new file mode 100644
index 0000000..33b286d
--- a/dev/null
+++ b/test/entropy/FastNWalign2.c
@@ -0,0 +1,94 @@
1#include "mex.h"
2#include "matrix.h"
3
4void simplegap(double scoredMatchMat[],
5const double gap, int n, int m, double output_F[], double output_P[])
6{
7 // Standard Needleman-Wunsch algorithm
8
9 double up, left, diagonal, best, pos;
10
11
12 int i,j;
13
14
15 for(i=0;i<m;i++)
16 {
17 output_F[i]=i*gap;
18 output_P[i]=2;
19 }
20
21
22 for(j=0; j<n; j++) //put initial values in
23 {
24 output_F[j*m]=j*gap;
25 output_P[j*m]=4;
26 }
27 output_P[0]=1;
28
29
30
31 for(j=1;j<n;j++) //cycle through columns
32 {
33 best=output_F[(j)*m];
34
35 for(i=1; i<m; i++) //cycle through the rows
36 {
37 up=best+gap;
38 left=output_F[i+(j-1)*m]+gap;
39 diagonal=output_F[i-1+(j-1)*m]+scoredMatchMat[i-1+(j-1)*m];
40
41 if (up>left)
42 {
43 best=up;
44 pos=2;
45 }
46 else
47 {
48 best=left;
49 pos=4;
50 }
51
52 if (diagonal>=best)
53 {
54 best=diagonal;
55 output_P[i+j*m]=1;
56 }
57 else
58 {
59 output_P[i+j*m]=pos;
60 }
61 output_F[i+j*m]=best;
62 }
63 }
64}
65
66void mexFunction(int nlhs, mxArray *plhs[],
67int nrhs, const mxArray *prhs[])
68{
69
70 double *gap, *output_F, *output_P;
71 double *scoredMatchMat;
72 int n, m;
73 mwSize i;
74
75 //double *F_col, *ptr_col;
76 m=mxGetM(prhs[0]);
77 n=mxGetN(prhs[0]);
78 gap=mxGetPr(prhs[1]);
79
80 plhs[0]=mxCreateDoubleMatrix(m,n,mxREAL);
81 plhs[1]=mxCreateDoubleMatrix(m,n,mxREAL);
82
83 output_F=mxGetPr(plhs[0]);
84 output_P=mxGetPr(plhs[1]);
85
86
87 scoredMatchMat=mxGetPr(prhs[0]);
88 //
89
90
91 simplegap(scoredMatchMat,*gap,n,m,output_F,output_P);
92
93}
94

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.