]> git.donarmstrong.com Git - mothur.git/blobdiff - metastats2.c
fixed bug with normalize.shared, printed out numbins twice. fixed bug with summary...
[mothur.git] / metastats2.c
index 3b801a0b110c5685fcc3a62f66ab3ad516a862d2..136c0426f1609964322343157c148ff8971cc4dc 100644 (file)
@@ -1,6 +1,8 @@
 
 #include "metastats.h"
 
+//The following code has been modified using the original Metastats program from White, J.R., Nagarajan, N. & Pop, M. Statistical methods for detecting differentially abundant features in clinical metagenomic samples. PLoS Comput Biol 5, e1000352 (2009).
+
 int metastat_main (char* outputFileName, int numRows, int numCols, double threshold, int numPermutations, double** data, int secondGroupingStart){
   
   int size,c=0,i=0,j=0,k,counter=0, bflag=0; 
@@ -21,10 +23,11 @@ int metastat_main (char* outputFileName, int numRows, int numCols, double thresh
  
   // Initialize the matrices
   size = row*col;
+//printf("size = %d\n.", size);
   double matrix[row][col];
   double pmatrix[size],pmatrix2[size],permuted[size];  
   double storage[row][9];
-  
+//printf("here\n.", size);  
   for (i=0;i<row;i++){
        for (j =0;j<9;j++){
       storage[i][j]=0;                 
@@ -407,11 +410,11 @@ void permute_array(int *array, int n) {
   
   if (! seeded) {
     seeded = 1;
-    srandom(time(NULL));
+    srand(time(NULL));
   }
   
   for (i = 0; i < n; i++) {
-    int selection = random() % (n - i);
+    int selection = rand() % (n - i);
     int tmp = array[i + selection];
     array[i + selection] = array[i];
     array[i] = tmp;