/*#define NODERIV*/ #define BOUNDJUNK #define FIX_CVHHWDIFF /* * dcread.c Jim Piper 23-01-87 * * MODIFICATIONS * ------------- * 24-05-90 jimp Reverse values of new features to suit box classifier. * 01-06-89 ji/jimp Reverse curvature to suit output of "curvat()". * Alters effect of mods of 02-03-88 and 14-03-88. * 07-04-88 jimp Optionally pre-process CVHHWDIFF by MODALITY * 14-03-88 simon Make curvsum +ve by adding 180. * 02-03-88 jimp Make curmax, curvmin +ve by adding 180. * 29-02-88 jimp Added a junk filter for boundary candidates * (#ifdef BOUNDJUNK) * 25-02-88 jimp Added selneardist, enddist selection criteria. */ #include #include #include #include dcread(chc,cnd,infile,candsel,othneardist,selneardist,enddist,r) struct chromcands *chc; struct cand *cnd; FILE *infile; struct dcresults *r; { int number = 0; while (dcreadcand(chc,cnd,infile,candsel,othneardist,selneardist,enddist)) { #ifdef NODERIV if (chc->porigin == 0) { #endif NODERIV number++; r->nchrom++; cnd += chc->ncands; if (chc->ncands > 0) r->nwithcands++; chc++; #ifdef NODERIV } #endif NODERIV } return(number); } dcreadcand(chc,cnd,infile,candsel,othneardist,selneardist,enddist) register struct chromcands *chc; register struct cand *cnd; FILE *infile; { register int i,j; register struct cand *cnd1; fread(chc,sizeof(struct chromcands),1,infile); if (feof(infile)) return(0); chc->cands = cnd; for (i=0; incands; i++) { fread(cnd,sizeof(struct cand),1,infile); if (feof(infile)) return(0); #ifdef FIX_CVHHWDIFF if (cnd->u.sy.modality <= 1) cnd->u.sy.cvhhwdiff = 0; #endif FIX_CVHHWDIFF /* * make curvatures > 0 */ cnd->u.sy.curvmax = 100 - cnd->u.sy.curvmax; cnd->u.sy.curvmin = 100 - cnd->u.sy.curvmin; cnd->u.sy.curvsum = 100 - cnd->u.sy.curvsum; /* * Reverse ordering of new features */ cnd->u.sy.kurtosis = 2000 - cnd->u.sy.kurtosis; cnd->u.sy.cprofcurv = 100 - cnd->u.sy.cprofcurv; /* * check various candidate selection conditions */ if (cnd->candtype <= 0) { i--; chc->ncands--; } else if (cnd->profpos <= enddist || cnd->profpos >= chc->axislen-enddist) { i--; chc->ncands--; } #ifdef BOUNDJUNK else if (cnd->candtype == 2 && (cnd->u.sy.curvmax+cnd->u.sy.curvmin > 360-20)) { i--; chc->ncands--; } else if (cnd->candtype == 2 && 100*cnd->u.sy.profval > 90*chc->profmax) { i--; chc->ncands--; } #endif BOUNDJUNK #ifdef NODERIV else if (chc->porigin != 0) { i--; chc->ncands--; } #endif NODERIV else if (cnd->candtype == candsel) { cnd1 = chc->cands; for (j=0; jcandtype == candsel && abs(cnd1->profpos - cnd->profpos) < selneardist) { i--; chc->ncands--; cnd--; break; } } cnd++; } else if (cnd->neardist > othneardist && cnd->candtype > 0) { cnd1 = chc->cands; for (j=0; jcandtype == cnd->candtype && abs(cnd1->profpos - cnd->profpos) < selneardist) { i--; chc->ncands--; cnd--; break; } } cnd++; } else { i--; chc->ncands--; } } return(1); }