Scripts/Flag_placer.py
def flag_sameorientation(read, flags, isbuildingflags, all_flags, chromosome, start):
    """ The flag_sameorientation function checks if the current read should be added to a same_orientation flag or
    start creating a same_orientation 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 issameorientation(read):
        flags, isbuildingflags = generate_flag(read, flags, isbuildingflags, 0)

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

    return flags, isbuildingflags, all_flags
 The flag_sameorientation function checks if the current read should be added to a same_orientation flag or
    start creating a same_orientation 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_sameorientation function checks if the current read should be added to a same_orientation flag or
start creating a same_orientation flag.
The flag_sameorientation function checks if the current read should be added to a same_orientation flag or start creating a same_orientation flag .
def flag_sameorientation(read, flags, isbuildingflags, all_flags, chromosome, start):
    if issameorientation(read):
        flags, isbuildingflags = generate_flag(read, flags, isbuildingflags, 0)
    elif isbuildingflags[0] and start > flags[0][2]:
        percentage = round(flags[0][3]['count'] / flags[0][3]['total'], 2)
        if flags[0][3]['count'] > args.threshold and percentage > args.minpercentage:
            all_flags.append(flags[0])
        flags[0] = [chromosome, None, None, {'type': 'same_orientation', 'count': 0, 'total': 0}]
        isbuildingflags[0] = False
    return flags, isbuildingflags, all_flags
def flag_sameorientation ( read , flags , isbuildingflags , all_flags , chromosome , start ) : if issameorientation ( read ) : flags , isbuildingflags = generate_flag ( read , flags , isbuildingflags , 0 ) elif isbuildingflags [ 0 ] and start > flags [ 0 ] [ 2 ] : percentage = round ( flags [ 0 ] [ 3 ] [ 'count' ] / flags [ 0 ] [ 3 ] [ 'total' ] , 2 ) if flags [ 0 ] [ 3 ] [ 'count' ] > args . threshold and percentage > args . minpercentage : all_flags . append ( flags [ 0 ] ) flags [ 0 ] = [ chromosome , None , None , { 'type' : 'same_orientation' , 'count' : 0 , 'total' : 0 } ] isbuildingflags [ 0 ] = False return flags , isbuildingflags , all_flags
The flag_sameorientation function checks if the current read should be added to a same_orientation flag or
start creating a same_orientation flag.
The flag_sameorientation function checks if the current read should be added to a same_orientation flag or start creating a same_orientation flag .
""" The flag_sameorientation function checks if the current read should be added to a same_orientation flag or
    start creating a same_orientation 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 .