split into windows using a slide criterion
    Args:
        size:       window size
        step:       moving step (default: 0.5*size)
    Returns:
        wnd_i:      number of windows
        nSnps:      vector of per-window number of SNPs

def splitGenoSlidingWindow(pos,out_file,size=5e4,step=None):
    """
    split into windows using a slide criterion
    Args:
        size:       window size
        step:       moving step (default: 0.5*size)
    Returns:
        wnd_i:      number of windows
        nSnps:      vector of per-window number of SNPs
    """
    if step is None:    step = 0.5*size
    chroms = SP.unique(pos[:,0])

    RV = []
    wnd_i = 0
    wnd_file = csv.writer(open(out_file,'w'),delimiter='\t')
    nSnps = [] 
    for chrom_i in chroms:
        Ichrom = pos[:,0]==chrom_i
        idx_chrom_start = SP.where(Ichrom)[0][0]
        pos_chr = pos[Ichrom,1]
        start = pos_chr.min()
        pos_chr_max = pos_chr.max()
        while 1:
            if start>pos_chr_max: break
            end = start+size
            Ir = (pos_chr>=start)*(pos_chr<end)
            _nSnps = Ir.sum()
            if _nSnps>0:
                idx_wnd_start = idx_chrom_start+SP.where(Ir)[0][0]
                nSnps.append(_nSnps)
                line = SP.array([wnd_i,chrom_i,start,end,idx_wnd_start,_nSnps],dtype=int)
                wnd_file.writerow(line)
                wnd_i+=1
            start += step
    nSnps = SP.array(nSnps)
    return wnd_i,nSnps