#! /n/gnu/bin/gawk -f # Last edited on 1999-08-31 04:58:45 by hcgl # Reads a candidate list, writes the segments that # occur in those candidates. # If "shrink" dis defined, removes that many samples # from each end of each segment BEGIN { usage = "$ARGV[0] -v shrink=NNN < INFILE.can > OUTFILE.seg"; if (shrink eq "") { shrink = 0; } } /^begin/ { print "begin PZSegment.List (format of 99-07-25)"; next; } /^[|]/ { print; next; } /^candidates/ { printf "|\n| extract-segs-from-cands\n|\n"; print "segments = ", $3*2; next; } /^lambda/ { next; } /^[0-9]/ { aIni = ($3 + shrink) % $2; aLen = ($4 - 2*shrink); if ( aLen > 1 ) { print $1, $2, aIni, aLen, "+"; } bIni = ($8 + shrink) % $7; bLen = ($9 - 2*shrink); if ( bLen > 1 ) { print $6, $7, bIni, bLen, "+"; } next; } /^end/ { print "end PZSegment.List"; next; }