/* * xpsubs2.c * * subroutines for xprobe - fra(X) work */ #include #include #include #include #include "xprobe.h" #define max(a,b) a>b?a:b #define min(a,b) abtype); fprintf(out,"%1d ",(xf->Cbtype&XPROBE)?1:2); fprintf(out,"%1d ",xf->xrank); fprintf(out,"%2d ",xf->number); fprintf(out,"%2d ",xf->rank); fprintf(out,"%3d ",xf->relarea); c = xf->cindexa; if (c == -1) c = xf->pindexa; fprintf(out,"%2d ",c); fprintf(out,"%2d ",xf->pindexa); fprintf(out,"%2d ",xf->difpos); fprintf(out,"%3d ",xf->profpeak); fprintf(out,"%3d ",xf->deriv2); fprintf(out,"%3d ",xf->objpeak); fprintf(out,"%3d ",xf->objmedian); fprintf(out,"%s\n",xf->fname); } readxpboxfeat(in,xf) FILE *in; register struct xfeats *xf; { static char fname[100]; if (fscanf(in,"%1d",&xf->btype) == EOF) return(EOF); fscanf(in,"%d",&xf->Cbtype); fscanf(in,"%d",&xf->xrank); fscanf(in,"%d",&xf->number); fscanf(in,"%d",&xf->rank); fscanf(in,"%d",&xf->relarea); fscanf(in,"%d",&xf->cindexa); fscanf(in,"%d",&xf->pindexa); fscanf(in,"%d",&xf->difpos); fscanf(in,"%d",&xf->profpeak); fscanf(in,"%d",&xf->deriv2); fscanf(in,"%d",&xf->objpeak); fscanf(in,"%d",&xf->objmedian); fscanf(in,"%s",fname); xf->fname = fname; return(1); } writexpvcvfeat(out,xf) FILE *out; register struct xfeats *xf; { int c; if (xf->xrank == 1) c = 1; else if (xf->xrank >= 3) c = 2; else c = 3; fprintf(out,"%1d ",c); fprintf(out,"%2d ",xf->rank); fprintf(out,"%3d ",xf->relarea); fprintf(out,"%2d ",xf->cindexa); fprintf(out,"%2d ",xf->pindexa); fprintf(out,"%2d ",xf->difpos); fprintf(out,"%3d ",xf->profpeak); fprintf(out,"%3d ",xf->deriv2); fprintf(out,"%3d ",xf->objpeak); fprintf(out,"%3d ",xf->objmedian); fprintf(out,"\n"); } /* * pack the X-probe features into the * property list - * N.B. Inconsistent with G-band analysis */ putxpfeats(obj,xflp) struct chromosome *obj; register struct xfeats *xflp; { register struct chromplist *plist = obj->plist; plist->btype = xflp->btype; plist->dispor = xflp->rank; plist->disppos = xflp->xrank; plist->dispmark = xflp->relarea; plist->cindexa = xflp->cindexa; plist->cindexm = xflp->pindexa; plist->EXPAND0[0] = xflp->difpos; plist->EXPAND0[1] = xflp->profpeak; plist->EXPAND0[2] = xflp->deriv2; plist->EXPAND0[3] = xflp->objpeak; plist->EXPAND0[4] = xflp->objmedian; } /* * Unpack the X-probe features from the * property list - * N.B. Inconsistent with G-band analysis */ getxpfeats(obj,xflp) struct chromosome *obj; register struct xfeats *xflp; { register struct chromplist *plist = obj->plist; xflp->btype = plist->btype; xflp->rank = plist->dispor; xflp->xrank = plist->disppos; xflp->relarea = plist->dispmark; xflp->cindexa = plist->cindexa; xflp->pindexa = plist->cindexm; xflp->difpos = plist->EXPAND0[0]; xflp->profpeak = plist->EXPAND0[1]; xflp->deriv2 = plist->EXPAND0[2]; xflp->objpeak = plist->EXPAND0[3]; xflp->objmedian = plist->EXPAND0[4]; } fxfeat(f,xf) float *f; register struct xfeats *xf; { f[0] = xf->rank; f[1] = xf->relarea; f[2] = xf->cindexa; f[3] = xf->pindexa; f[4] = xf->difpos; f[5] = xf->profpeak; f[6] = xf->deriv2; f[7] = xf->objpeak; f[8] = xf->objmedian; } xpdispinit(o,n,f) struct object **o; int n; struct pframe *f; { int i, l1,ll,k1,kl, celll,cellw; struct intervaldomain *idom; for (i=0; iidom; if (i == 0) { l1 = idom->line1; k1 = idom->kol1; ll = idom->lastln; kl = idom->lastkl; } else { l1 = min(l1,idom->line1); k1 = min(k1,idom->kol1); ll = max(ll,idom->lastln); kl = max(kl,idom->lastkl); } } celll = ll - l1 + 1; cellw = kl - k1 + 1; /* f->scale = 3840/max(celll,cellw); */ f->scale = 1; if (celll < 512*4/3 && cellw < 512) f->scale = 2; f->type = 60; f->dx = f->dy = 2048; f->ix = 4; /* FIP digitisations */ f->iy = 3; f->ox = (k1 + kl)/2; f->oy = (l1 + ll)/2; colour(248); } xpdisp(o,f,hue,intensity) struct object *o; struct pframe *f; int intensity; { struct intervaldomain *idom = o->idom; struct irect r; struct object rm; rm.type = 20; rm.idom = (struct intervaldomain *) &r; r.type = 1; r.irk[0] = idom->kol1 - 8; r.irl[0] = idom->line1 - 8; r.irk[1] = idom->kol1 - 8; r.irl[1] = idom->lastln + 8; r.irk[2] = idom->lastkl + 8; r.irl[2] = idom->lastln + 8; r.irk[3] = idom->lastkl + 8; r.irl[3] = idom->line1 - 8; intens(intensity); colour(hue); picframe(&rm,f); update(); } /* * Set up overlays in look-up table: * plane 0 black * plane 1 red * plane 2 green */ lut_overlay() { int i; for (i=1; i<=255; i+=2) setrgb(i,0,0,0); for (i=2; i<=255; i+=4) setrgb(i,255,0,0); for (i=4; i<=255; i+=8) setrgb(i,0,255,0); update(); } /* * set up a grey-table in planes 3-7 */ defaultlut() { int i; setrgb(0,240,240,240); for (i=8; i<256; i+=8) setrgb(i,255-i,255-i,255-i); update(); }