/* * xpsimp.c * * classify feature files from x-probed chromosomes */ #include #include #include #include #include "xprobeold.h" #include main(argc,argv) char **argv; { int i,j; struct xfeats xf[200],*xfp; FILE *in; int number,xfpcomp(),vcvcomp(),rank,max2d,xrank; char *fname = "stdin"; if (argc > 1) { fname = argv[1]; in = fopen(fname,"r"); if (in == NULL) { fprintf(stderr,"Cannot open file %s\n",fname); exit(2); } } else in = stdin; /* * read feature data file */ xfp = xf; max2d = 0; while (fscanf(in,"%d",&xfp->number) != EOF) { fscanf(in,"%d",&xfp->Cbtype); fscanf(in,"%d",&xfp->relarea); fscanf(in,"%d",&xfp->cindexa); fscanf(in,"%d",&xfp->pindexa); fscanf(in,"%d",&xfp->difpos); fscanf(in,"%d",&xfp->profpeak); fscanf(in,"%d",&xfp->deriv2); fscanf(in,"%d",&xfp->objpeak); fscanf(in,"%d",&xfp->objmedian); xfp->profpeak -= xfp->objmedian; xfp->fname = fname; if (xfp->deriv2 > max2d) max2d = xfp->deriv2; number++; xfp++; } /* * sort by density profile peak, code rank. */ qsort(xf,number,sizeof(struct xfeats),xfpcomp); /* * Classification: * (1) First 2 only */ xfp = xf; for (rank=1; rank<=2; rank++,xfp++) { /* * Potential probed X found */ xfp->xrank = rank; xfp->btype = 1; xfp->rank = rank; writexpboxfeat(stdout,xfp); } } int xfpcomp(x1,x2) register struct xfeats *x1,*x2; { return(x2->profpeak - x1->profpeak); }