def set_window(varPos, sequence, windowsSize):
    """
    From variant position and windowsSize set the windows left and right position
    Correct the windows position when the windows is outside the actual genome scaffold sequence
    Return a list with left position and right position of the window
    """
    ## VCF position is 1-based while python list is 0-based 
    varPos = varPos -1
    seqLeft = 0
    seqRight = len(sequence)
    varLeft = varPos - int(windowsSize/2)
    varRight = varPos + int(windowsSize/2)
    if varLeft < seqLeft:
        varLeft = seqLeft
    if varRight > seqRight:
        varRight = seqRight
    window = [varLeft, varRight]
    return window