def getAbsoluteReadOffset(alignedRead, refSeq, readSeq):
    """Gets the absolute starting coordinate of the first non-clipped position in the read.
    """
    if alignedRead.cigar[0][0] == 5: #Translate the read position to the original coordinates by removing hard clipping
        readOffset = alignedRead.cigar[0][1]
    else:
        readOffset = 0
    if alignedRead.is_reverse: #SEQ is reverse complemented
        readOffset = -(len(readSeq) - 1 - readOffset)
    readOffset += alignedRead.qstart #This removes any soft-clipping
    return readOffset