def calculate_orientation(
    index: int, clip_start: int, clip_end: int, target_start: int, target_end: int,
) -> str:
    """
    Calculate the orientation of the insertion. The clip start and end should
    be on either the left or the right of the target region depending on the
    strand.

    Ambiguous cases where the clipping center falls in the center of the target
    region are treated as being on the positive strand.


    :param index: The current row index
    :param clip_start: The potential start position of the insertion site
    :param clip_end: The potential end position of the insertion site
    :param target_start: The start position which matches the reference genome
    :param target_end: The end position which matches the reference genome
    :return:
    """
    clip_center = (clip_start + clip_end) / 2
    target_center = (target_start + target_end) / 2
    if clip_center <= target_center:
        return "+"
    if clip_center > target_center:
        return "-"
    raise ValueError("Repred orientation cannot be determined in row {}".format(index))