Scripts/Flag_placer.py
def generate_flag(read, flags, isbuildingflags, flagindex):
    """ The generate_flag function receives a read and decides if it should be included in the current working flag or
    not. Or it starts the creation of a new flag.

    :param read: pysam object containing data of a read.
    :param flags: a 2d list containing all the flag information.
    :param isbuildingflags; a list identifying which types of flags are being built/edited
    :param flagindex: an integer identifying which flag is being built/edited
    :return flags: a 2d list containing all the flag information.
    :return isbuildingflags: a list identifying which types of flags are being built/edited
    """
    start, end = true_position(read)

    if not isbuildingflags[flagindex]:
        flags[flagindex][0] = read.reference_name
        flags[flagindex][1] = start
        flags[flagindex][2] = end
        isbuildingflags[flagindex] = True

    if isbuildingflags[flagindex]:
        flags[flagindex][2] = end

    flags[flagindex][3]['count'] += 1

    return flags, isbuildingflags
 The generate_flag function receives a read and decides if it should be included in the current working flag or
    not. Or it starts the creation of a new flag.

    :param read: pysam object containing data of a read.
    :param flags: a 2d list containing all the flag information.
    :param isbuildingflags; a list identifying which types of flags are being built/edited
    :param flagindex: an integer identifying which flag is being built/edited
    :return flags: a 2d list containing all the flag information.
    :return isbuildingflags: a list identifying which types of flags are being built/edited
    
The generate_flag function receives a read and decides if it should be included in the current working flag or
not. Or it starts the creation of a new flag.

:param read: pysam object containing data of a read.
:param flags: a 2d list containing all the flag information.
The generate_flag function receives a read and decides if it should be included in the current working flag or not . Or it starts the creation of a new flag . : param read : pysam object containing data of a read . : param flags : a 2d list containing all the flag information .
def generate_flag(read, flags, isbuildingflags, flagindex):
    start, end = true_position(read)
    if not isbuildingflags[flagindex]:
        flags[flagindex][0] = read.reference_name
        flags[flagindex][1] = start
        flags[flagindex][2] = end
        isbuildingflags[flagindex] = True
    if isbuildingflags[flagindex]:
        flags[flagindex][2] = end
    flags[flagindex][3]['count'] += 1
    return flags, isbuildingflags
def generate_flag ( read , flags , isbuildingflags , flagindex ) : start , end = true_position ( read ) if not isbuildingflags [ flagindex ] : flags [ flagindex ] [ 0 ] = read . reference_name flags [ flagindex ] [ 1 ] = start flags [ flagindex ] [ 2 ] = end isbuildingflags [ flagindex ] = True if isbuildingflags [ flagindex ] : flags [ flagindex ] [ 2 ] = end flags [ flagindex ] [ 3 ] [ 'count' ] += 1 return flags , isbuildingflags
The generate_flag function receives a read and decides if it should be included in the current working flag or
not.
The generate_flag function receives a read and decides if it should be included in the current working flag or not .
""" The generate_flag function receives a read and decides if it should be included in the current working flag or
    not. Or it starts the creation of a new flag.

    :param read: pysam object containing data of a read.
    :param flags: a 2d list containing all the flag information.
    :param isbuildingflags; a list identifying which types of flags are being built/edited
    :param flagindex: an integer identifying which flag is being built/edited
    :return flags: a 2d list containing all the flag information.
    :return isbuildingflags: a list identifying which types of flags are being built/edited
    """
read
flags
isbuildingflags
flagindex