Scripts/Flag_placer.py
def flag_unmapped_mate(read, flags, isbuildingflags, all_flags, chromosome, start):
    """ The flag_unmapped_mate function checks if the current read should be added to the unmapped_mate flag or start
    creating a unmapped_mate flag.

    :param read: pysam object containing data of a read.
    :param flags: a 2d list containing all the flag information.
    :param isbuildingflags: a list indicating which flags are currently being built.
    :param all_flags: A 2d list containing the coordinates of the flags and additional information.
    :param chromosome: The chromosome where the read is mapped.
    :param start: Integer indicating the starting position of the read.

    :return flags: a 2d list containing all the flag information.
    :return isbuildingflags: a list indicating which flags are currently being built.
    :return all_flags: A 2d list containing the coordinates of the flags and additional information.
    """
    if read.mate_is_unmapped:
        flags, isbuildingflags = generate_flag(read, flags, isbuildingflags, 2)

    elif isbuildingflags[2] and start > flags[2][2]:
        percentage = round(flags[2][3]['count'] / flags[2][3]['total'], 2)
        if flags[2][3]['count'] > args.threshold and percentage > args.minpercentage:
            all_flags.append(flags[2])
        flags[2] = [chromosome, None, None, {'type': 'unmapped_mate', 'count': 0, 'total': 0}]
        isbuildingflags[2] = False

    return flags, isbuildingflags, all_flags
 The flag_unmapped_mate function checks if the current read should be added to the unmapped_mate flag or start
    creating a unmapped_mate flag.

    :param read: pysam object containing data of a read.
    :param flags: a 2d list containing all the flag information.
    :param isbuildingflags: a list indicating which flags are currently being built.
    :param all_flags: A 2d list containing the coordinates of the flags and additional information.
    :param chromosome: The chromosome where the read is mapped.
    :param start: Integer indicating the starting position of the read.

    :return flags: a 2d list containing all the flag information.
    :return isbuildingflags: a list indicating which flags are currently being built.
    :return all_flags: A 2d list containing the coordinates of the flags and additional information.
    
The flag_unmapped_mate function checks if the current read should be added to the unmapped_mate flag or start
creating a unmapped_mate flag.
The flag_unmapped_mate function checks if the current read should be added to the unmapped_mate flag or start creating a unmapped_mate flag .
def flag_unmapped_mate(read, flags, isbuildingflags, all_flags, chromosome, start):
    if read.mate_is_unmapped:
        flags, isbuildingflags = generate_flag(read, flags, isbuildingflags, 2)
    elif isbuildingflags[2] and start > flags[2][2]:
        percentage = round(flags[2][3]['count'] / flags[2][3]['total'], 2)
        if flags[2][3]['count'] > args.threshold and percentage > args.minpercentage:
            all_flags.append(flags[2])
        flags[2] = [chromosome, None, None, {'type': 'unmapped_mate', 'count': 0, 'total': 0}]
        isbuildingflags[2] = False
    return flags, isbuildingflags, all_flags
def flag_unmapped_mate ( read , flags , isbuildingflags , all_flags , chromosome , start ) : if read . mate_is_unmapped : flags , isbuildingflags = generate_flag ( read , flags , isbuildingflags , 2 ) elif isbuildingflags [ 2 ] and start > flags [ 2 ] [ 2 ] : percentage = round ( flags [ 2 ] [ 3 ] [ 'count' ] / flags [ 2 ] [ 3 ] [ 'total' ] , 2 ) if flags [ 2 ] [ 3 ] [ 'count' ] > args . threshold and percentage > args . minpercentage : all_flags . append ( flags [ 2 ] ) flags [ 2 ] = [ chromosome , None , None , { 'type' : 'unmapped_mate' , 'count' : 0 , 'total' : 0 } ] isbuildingflags [ 2 ] = False return flags , isbuildingflags , all_flags
The flag_unmapped_mate function checks if the current read should be added to the unmapped_mate flag or start
creating a unmapped_mate flag.
The flag_unmapped_mate function checks if the current read should be added to the unmapped_mate flag or start creating a unmapped_mate flag .
""" The flag_unmapped_mate function checks if the current read should be added to the unmapped_mate flag or start
    creating a unmapped_mate flag.

    :param read: pysam object containing data of a read.
    :param flags: a 2d list containing all the flag information.
    :param isbuildingflags: a list indicating which flags are currently being built.
    :param all_flags: A 2d list containing the coordinates of the flags and additional information.
    :param chromosome: The chromosome where the read is mapped.
    :param start: Integer indicating the starting position of the read.

    :return flags: a 2d list containing all the flag information.
    :return isbuildingflags: a list indicating which flags are currently being built.
    :return all_flags: A 2d list containing the coordinates of the flags and additional information.
    """
a 2d list containing all the flag information.
a 2d list containing all the flag information .
flags
a list indicating which flags are currently being built.
a list indicating which flags are currently being built .
isbuildingflags
A 2d list containing the coordinates of the flags and additional information.
A 2d list containing the coordinates of the flags and additional information .
all_flags
read
pysam object containing data of a read.
pysam object containing data of a read .
flags
a 2d list containing all the flag information.
a 2d list containing all the flag information .
isbuildingflags
a list indicating which flags are currently being built.
a list indicating which flags are currently being built .
all_flags
A 2d list containing the coordinates of the flags and additional information.
A 2d list containing the coordinates of the flags and additional information .
chromosome
The chromosome where the read is mapped.
The chromosome where the read is mapped .
start
Integer indicating the starting position of the read.
Integer indicating the starting position of the read .