Scripts/Flag_placer.py
def flag_high_isize(read, flags, isbuildingflags, all_flags, chromosome, start):
    """ The flag_high_isize function checks if the current read should be added to a high_insert_size flag or start
    creating a high_isize_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.
    """
    insert_size = abs(read.isize)

    if args.high_insert_size < insert_size < args.ultra_high_insert_size:
        flags, isbuildingflags = generate_flag(read, flags, isbuildingflags, 1)
        flags[1][3]['lengths'].append(insert_size)

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

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