def getSeqPos(ref_profile, seq):
    """
    Get the start and end position when mapped to refSeq.
    Sequence to feed to the func should be afa format 
    (e.x. one from mothurAligner).

    Parameters:
    -----------
    ref_profile : list
        a gap profile, 0 is gap and 1 is real base pair.
    seq : str
        align sequence

    Returns:
    --------
    tuple
        a tuple of two int. 
        First one is start position and second one is end postion.

    """

    profile = ref_profile
    length = len(profile)
    assert length == len(seq), 'check if afa format'
    tempLen = len(seq.lstrip('.').lstrip('-'))
    # use first position 0 system
    start1 = length - tempLen
    end1 = len(seq.rstrip('.').rstrip('-')) - 1

    start = sum(profile[:start1])
    end = sum(profile[:end1])

    return start, end