parser.add_argument('-N','--nsamples',default=10000,type=int ,help="Number of winows to sample.")
     parser.add_argument('-w','--window',default=1000, type=int ,help="Size of windows to examine.")
     parser.add_argument('-W','--binwindow',default=100000, type=int ,help="Size of windows to break reference contigs into.")
     parser.add_argument('-i','--infile',default=False ,help="Filename for serialised assembly input file.")
#     parser.add_argument('-o','--outfile',default=False,help="Filename for writing a list of segments on the raw contigs to mask for being promiscuous in linking.")

     args = parser.parse_args()

     if args.infile:
          asf = HiriseAssembly()
          asf.load_assembly(args.infile)
     n=0

     asf.binsize = args.binwindow

     while n<args.nsamples:
          try:
               c,a,b=asf.random_window(wlen=args.window)
               if args.test:
                    m=re.match("^(.*):(\d+)-(\d+)$",args.test)
                    c=m.group(1)
                    a=int(m.group(2))
                    b=int(m.group(3))
               asf.window_stats(c,a,b,debug=args.debug,bins=args.bin)
               n+=1
          except Exception as e:
               print("#",e,c,a,b)
               raise e
          if args.test: break

        help="Size of windows to break reference contigs into.")
    parser.add_argument('-i',
                        '--infile',
                        default=False,
                        help="Filename for serialised assembly input file.")
    #     parser.add_argument('-o','--outfile',default=False,help="Filename for writing a list of segments on the raw contigs to mask for being promiscuous in linking.")

    args = parser.parse_args()

    if args.infile:
        asf = HiriseAssembly()
        asf.load_assembly(args.infile)
    n = 0

    asf.binsize = args.binwindow

    while n < args.nsamples:
        try:
            c, a, b = asf.random_window(wlen=args.window)
            if args.test:
                m = re.match("^(.*):(\d+)-(\d+)$", args.test)
                c = m.group(1)
                a = int(m.group(2))
                b = int(m.group(3))
            asf.window_stats(c, a, b, debug=args.debug, bins=args.bin)
            n += 1
        except Exception as e:
            print("#", e, c, a, b)
            raise e
        if args.test: break