/* pbCalDist - Create tab delimited data files to be used by Proteome Browser stamps */ #include "common.h" #include "hCommon.h" #include "hdb.h" #include "spDb.h" void usage() /* Explain usage and exit. */ { errAbort( "pbCalDist- Create tab delimited data files to be used by Proteome Browser stamps.\n" "usage:\n" " pbCalDist spDb protsDb taxn gnDb\n" " spDb is the name of SWISS-PROT database\n" " protsDb is the name of proteinsXXXXXX database\n" " taxn is the taxnomy number of the Taxonomy ID\n" " gnDb is the genome database name\n" "Example: pbCalDist sp031112 proteins031112 9606 hg16\n"); } int calDist(double *measure, int nInput, int nDist, double xMin, double xDelta, char *oFileName) /* calculate histogram distribution of a double array of nInput elements */ { int distCnt[1000]; double xDist[1000]; FILE *o3; int i,j; int highestCnt, totalCnt; int lowCnt, hiCnt; assert(nDist < ArraySize(distCnt)); o3 = mustOpen(oFileName, "w"); for (j=0; j<=(nDist+1); j++) { distCnt[j] = 0; xDist[j] = xMin + xDelta * (double)j; } lowCnt = 0; hiCnt = 0; for (i=0; i= xDist[j]) && (measure[i] < xDist[j+1])) { distCnt[j]++; } } /* count values above xmax */ if (measure[i] >= xDist[nDist]) { hiCnt++; } } highestCnt = 0; totalCnt = 0; for (j=0; j highestCnt) highestCnt = distCnt[j]; totalCnt = totalCnt + distCnt[j]; } totalCnt = totalCnt + hiCnt + lowCnt; if (totalCnt != nInput) errAbort("nInput %d is not equal totalCnt %d, aborting ...\n", nInput, totalCnt); for (j=0; j