def exclude_soft_clip(row, read_cigar):
    """
    Separated from extend_realign_region, used to exclude the soft clip at the start or end of the query_sequence. 
    Because sometimes realign region might include the softclip region and the softclip region usually is really 
    long which can lead to a wrong realignment result.
    """
    cigar_slice = read_cigar.cslice(start_ci=row['realign_start_ci'],
        end_ci=row['realign_end_ci'])
    if cigar_slice[0][1] == 'S':
        row['realign_start_rdp'] += cigar_slice[0][0]
        row['realign_start_ci'] = row['realign_start_ci'][0] + 1, 0
    if cigar_slice[-1][1] == 'S':
        row['realign_end_rdp'] -= cigar_slice[0][0]
        row['realign_end_ci'] = row['realign_end_ci'][0], 0
    return row
