def getFirstNonClippedPositionInRead(alignedSegment, readSeq):
    """Gets the coordinate of the first non-clipped position in the read relative to the 
    complete read sequence (including any hard clipped bases).
    If the alignment is on the reverse strand the coordinate is negative, e.g. the reverse strand coordinate of
    the 2nd position of the read sequence is -1 (0 based).
    """
    if alignedSegment.cigar[0][0] == 5: #Translate the read position to the original 
        #coordinates by removing hard clipping
        readOffset = alignedSegment.cigar[0][1]
    else:
        readOffset = 0
    if alignedSegment.is_reverse: #SEQ is reverse complemented
        readOffset = -(len(readSeq) - 1 - readOffset)
    readOffset += alignedSegment.query_alignment_start #This removes any soft-clipping
    return readOffset