lama/stats/permutation_stats/distributions.py
def _label_synthetic_mutants(info: pd.DataFrame, n: int, sets_done: List) -> bool:
    """
    Given a dataframe of wild type data, relabel n baselines as synthetic mutant in place.
    Keep track of combinations done in sets_done and do not duplicate

    Parameters
    ----------
    info
        columns
            label_num with 'x' prefix e.g. 'x1'
            staging
            genotype
    n
        how many specimens to relabel
    sets_done
        Contains Sets of previously selected specimen IDs

    Returns
    -------
    True if able to find a new combination of mutant and wildtype
    False if no more combinations are available for that specific n
    """

    # Set all to wt genotype
    info.loc[:, 'genotype'] = 'wt'

    # label n number of baselines as mutants from the maximum number of combination

    # max_comb = int(comb(len(info), n))
    #
    # for i in range(max_comb):
    #     synthetics_mut_indices = random.sample(range(0, len(info)), n)
    #     i += 1
    #     if not set(synthetics_mut_indices) in sets_done:
    #         break
    #
    # if i > max_comb - 1:
    #     msg = f"""Cannot find unique combinations of wild type baselines to relabel as synthetic mutants
    #     With a baseline n  of {len(info)}\n. Choosing {n} synthetics.
    #     Try increasing the number of baselines or reducing the number of permutations"""
    #     logger.warn(msg)
    #     raise ValueError(msg)

    sets_done.append(set(synthetics_mut_indices))

    # info.ix[synthetics_mut_indices, 'genotype'] = 'synth_hom'  # Why does iloc not work here?
    info.loc[info.index[synthetics_mut_indices], 'genotype'] = 'synth_hom'
    return True

    Given a dataframe of wild type data, relabel n baselines as synthetic mutant in place.
    Keep track of combinations done in sets_done and do not duplicate

    Parameters
    ----------
    info
        columns
            label_num with 'x' prefix e.g. 'x1'
            staging
            genotype
    n
        how many specimens to relabel
    sets_done
        Contains Sets of previously selected specimen IDs

    Returns
    -------
    True if able to find a new combination of mutant and wildtype
    False if no more combinations are available for that specific n
    
Given a dataframe of wild type data, relabel n baselines as synthetic mutant in place.
Keep track of combinations done in sets_done and do not duplicate

Parameters

info
columns
label_num with 'x' prefix e.g. 'x1'
staging
genotype
n
how many specimens to relabel
sets_done
Contains Sets of previously selected specimen IDs

Returns

True if able to find a new combination of mutant and wildtype
False if no more combinations are available for that specific n
Given a dataframe of wild type data relabel n baselines as synthetic mutant in place . Keep track of combinations done in sets_done and do not duplicate Parameters info columns label_num with ' x ' prefix e . g . ' x1 ' staging genotype n how many specimens to relabel sets_done Contains Sets of previously selected specimen IDs Returns True if able to find a new combination of mutant and wildtype False if no more combinations are available for that specific n
def _label_synthetic_mutants(info: pd.DataFrame, n: int, sets_done: List) -> bool:
    info.loc[:, 'genotype'] = 'wt'
     for i in range(max_comb):
         synthetics_mut_indices = random.sample(range(0, len(info)), n)
         i += 1
         if not set(synthetics_mut_indices) in sets_done:
             break
     if i > max_comb - 1:
         msg = f"""Cannot find unique combinations of wild type baselines to relabel as synthetic mutants
         With a baseline n  of {len(info)}\n. Choosing {n} synthetics.
         Try increasing the number of baselines or reducing the number of permutations"""
         logger.warn(msg)
         raise ValueError(msg)
    sets_done.append(set(synthetics_mut_indices))
     info.ix[synthetics_mut_indices, 'genotype'] = 'synth_hom'   Why does iloc not work here?
    info.loc[info.index[synthetics_mut_indices], 'genotype'] = 'synth_hom'
    return True
def _label_synthetic_mutants ( info : pd . DataFrame , n : int , sets_done : List ) -> bool : info . loc [ : , 'genotype' ] = 'wt' sets_done . append ( set ( synthetics_mut_indices ) ) info . loc [ info . index [ synthetics_mut_indices ] , 'genotype' ] = 'synth_hom' return True
Given a dataframe of wild type data, relabel n baselines as synthetic mutant in place.
Given a dataframe of wild type data relabel n baselines as synthetic mutant in place .
"""
    Given a dataframe of wild type data, relabel n baselines as synthetic mutant in place.
    Keep track of combinations done in sets_done and do not duplicate

    Parameters
    ----------
    info
        columns
            label_num with 'x' prefix e.g. 'x1'
            staging
            genotype
    n
        how many specimens to relabel
    sets_done
        Contains Sets of previously selected specimen IDs

    Returns
    -------
    True if able to find a new combination of mutant and wildtype
    False if no more combinations are available for that specific n
    """ # Set all to wt genotype # label n number of baselines as mutants from the maximum number of combination # max_comb = int(comb(len(info), n)) # # for i in range(max_comb): #     synthetics_mut_indices = random.sample(range(0, len(info)), n) #     i += 1 #     if not set(synthetics_mut_indices) in sets_done: #         break # # if i > max_comb - 1: #     msg = f"""Cannot find unique combinations of wild type baselines to relabel as synthetic mutants #     With a baseline n  of {len(info)}\n. Choosing {n} synthetics. #     Try increasing the number of baselines or reducing the number of permutations""" #     logger.warn(msg) #     raise ValueError(msg) # info.ix[synthetics_mut_indices, 'genotype'] = 'synth_hom'  # Why does iloc not work here?
info
pd.DataFrame
n
int
sets_done
List