/********************************************************************************************/ /** **/ /** SAM.c - Given parameters of covariant error model, find **/ /** significantly differentially expressed genes in two-channel expression data set **/ /** **/ /** evaluates lambda = **/ /** -2*Log( (max unconstrained likelihood)/(max constrained likelihood) ) **/ /** constrained: mu=mu_x=mu_y unconstrained mu_x != mu_y **/ /** **/ /** Reference: **/ /** T. E. Ideker, V. Thorsson, A. F. Siegel, and L. E. Hood **/ /** Testing for Differentially-expressed Genes by **/ /** Maximum Likelihood Analysis of Microarray Data **/ /** Journal of Computational Biology, 2001, Vol. 7, No. 6, pps. 805-817 **/ /** Implementation: Vesteinn Thorsson thorsson@systemsbiology.org **/ /** Version: February, 2001 **/ /********************************************************************************************/ #include #include #include #include #include "util.h" #include "arraystats.h" #include "objective.h" #include "conjugate_gradient.h" #include "io.h" #define NRANSI #define FTOL_HIGH 1.e-8 /* high fractional functional tolerance change for frprmn */ #define FTOL_LOW 1.e-10 /* low fractional functional tolerance change for frprmn */ #define LINMIN_TOL_HIGH 1.e-9 /* high tolerance for line minimization */ #define LINMIN_TOL_LOW 1.e-10 /* low tolerance for line minimization */ main (int argc,char *argv[] ){ int i, j, k, iter, num_sig=0; double result, fret; double *p, *del; char *infile, *modfile, *outfile; FILE *fpin, *fpmod, *fpout; double *mu_vec, *grad_mu; double mu_x, mu_y; double frac_change_1, frac_change_2 ; double ax, bx, xx, fa, fx, fb, xmin, xmin2; double numerator, denominator, llr, *loglr, numerator2; double mu_x_from_avg, mu_y_from_avg, mu_x_from_cns, mu_y_from_cns; double denominator_from_avg, denominator_from_cns; /* output version number and compilation parameters */ /* printf("SAM version: %s\n", __DATE__); */ #ifdef USERHOD printf("rho_delta may be non-zero, "); #else printf("rho_delta forced to zero, "); #endif #ifdef MUNONNEG printf("non-negative mus only.\n "); #else printf("mus may be negative.\n "); #endif /* initialize command line variables */ verbose = FALSE; disp_iter = FALSE; infile = NULL; modfile = NULL; outfile = NULL; /* start_time(); start timer */ /* parse command line, check to see if verbose and/or display iterations flag is on */ for (i=1; i 5000. ) llr = 5000. ; /* single instance observed of astronomical lambda, for now set to maximum for warning */ loglr[i] = llr; /* if ( llr > 3.84145882 ) num_sig++; */ } write_llr( fpin, fpout, loglr); fclose(fpmod); free(loglr); return 0; }