/* This code is compiled using the gcc compiler versio 4.1.2 on the high * performance computing cluster, tara, at UMBC. This code was written by * Andrew Coates in partnership with Alexey Ilchenko and advisor Matthias K. * Gobbert as a part of the REU Site: Interdisciplinary Program in High * Performance Computing at UMBC in Summer 2011. For more information see our * Tech Report at www.umbc.edu/hpcf > Publications as Technical Report * HPCF-2011-13. This code is last updated August 11, 2011. * * Calculates the expected entropy of a string of length n from a set of size 4 * as specifically applied to base pair analysis * * To compile, run " >> make "" at the linux command prompt. This will create * an executable named "EHn". To run, enter " >> ./EHn pa pt pc pg n " at the * command prompt. The values of pa,pt,pc and pg are the probabilities * associated with A,T,C and G. The value n is the number of samples. * This will print out n,pa,pt,pc,pg and the expected value of Hn. */ #include #include #include #include "EHn.h" /* The main function which takes in the inputted probabilites and n and computes * the expected value of Hn. */ int main(int argc, char *argv[]){ double sum,ps,hs,coef; int i,j,*cc, *row,n,rows; float pa,pt,pc,pg; pa = atof(argv[1]); pt = atof(argv[2]); pc = atof(argv[3]); pg = atof(argv[4]); n = atoi(argv[5]); printf("n=%d pa=%f pt=%f pc=%f pg=%f\n",n,pa,pt,pc,pg); /* allocates the memory of the matrix and row arrays*/ /* the number of rows in cc */ rows = (n+1)*(n+2)*(n+3)/6; /* the compostions matrix */ cc = malloc(4*rows*sizeof(int)); /* will act as the current row during iterations through cc */ row = malloc(4*sizeof(int)); /* creates the composition matrix, cc */ Counts(cc,n); sum = 0.0; /* iterates through the compositions matrix's rows */ for(i=0;i=0){ cc[0+4*m] = i; cc[1+4*m] = j; cc[2+4*m] = k; cc[3+4*m] = l; m++; } } } } }