def get_alignment_dict(ali1,ali2):
    """
    Get a dictionary which tells you the index in sequence 2 that should align with the index in sequence 1 (key)
    
    ali1:  ----bcde-f---        seq1: bcdef
    ali2:  ---abcd--f---        seq2: abcdf

    alignment_dict={
        0:1,
        1:2,
        2:3,
        4:4
        }
    
    If the index is aligned with a gap do not include in the dictionary.
    e.g  1 in alignment_dict  --> True
    e.g  3 in alignment_dict  --> False
    """
    assert len(ali1)==len(ali2), "aligned sequences must be same lengths (including gaps)"
    alignment_dict={}
    p1=-1
    p2=-1
    for ap in range( len(ali1) ):
        if ali1[ap] != "-" and ali2[ap] != "-":
            assert ali1[ap] == ali2[ap], 'The sequence in the structure did not match that in the provided sequence (seqres entry)'
            p1+=1
            p2+=1
            alignment_dict[p1] = p2
        elif ali1[ap] != "-": 
            p1+=1 
        elif ali2[ap] != "-": 
            p2+=1    
    return alignment_dict