def getRep(rep,L,originalWindow=510, W=3):
    """
    Extract a window of the matrix representation rep of size W around a mutation at location L

    Arguments:
    - rep : embedding matrix
    - L : The index of the variant about which windows will be taken
    - originalWindow : The size of the window used to generate the subset of the protein sequence that is embedded
    - W : the desired size of the window to be taken from embedding around the variant

    Example:
    variant at position 3
    what the function is given is 1 2 3 4 5
    Given these two you want to return a window of size 1 around position 3 : [2 3 4]

    Original Sequence               : 0 1 2 3 4 5 6
    Variant Position                :       L
    subset passed to model          :  [1 2 3 4 5]
                                        I       J
    pass to model a window of size 1:    [2 3 4]

                                          K   M


    Example:

    L = 2
    Original Window size used for embedding: 3
    Desired Window size : 1

    Original Sequence : 0 1 2 3 4 5 6
                        I   L     J
                          K   M

    """
    i,j = max(0, L-originalWindow),min(len(rep), L + originalWindow)
    k,m = max(0,L - W - i), min(len(rep),L + W - i + 1)
    assert k >= 0 and m <= len(rep)

    return rep[k : m]