GilbertLabUCSF / ScreenPro2

[This is an archived repository, see the current version in Arc Institute GitHub]
https://github.com/ArcInstitute/ScreenPro2
MIT License
1 stars 1 forks source link

add multiple methods for `getDelta` function – e.g. `log2`, `log10`, etc. #12

Closed abearab closed 10 months ago

abearab commented 1 year ago

https://github.com/abearab/ScreenPro2/blob/7804e9415e4dc8a9316aed16daacfa48ce45f202/screenpro/phenoScore.py#L21C7-L21C7

abearab commented 1 year ago

pseudocount

similar to this part https://github.com/mhorlbeck/ScreenProcessing/blob/0ee5192ecc17348665bd1387ddfa9037efb7964f/process_experiments.py#L484C1-L502C1

    # pseudocount
    if pseudocountBehavior == 'default' or pseudocountBehavior == 'zeros only':
        def defaultBehavior(row): return row if min(
            row) != 0 else row + pseudocountValue
        combinedCountsPseudo = combinedCounts.apply(defaultBehavior, axis=1)
    elif pseudocountBehavior == 'all values':
        combinedCountsPseudo = combinedCounts.apply(
            lambda row: row + pseudocountValue, axis=1)
    elif pseudocountBehavior == 'filter out':
        combinedCountsPseudo = combinedCounts.copy()
        zeroRows = combinedCounts.apply(lambda row: min(row) <= 0, axis=1)
        combinedCountsPseudo.loc[zeroRows, :] = np.nan
    else:
        raise ValueError(
            'Pseudocount behavior not recognized or not implemented')

    totalCounts = combinedCountsPseudo.sum()
    countsRatio = float(totalCounts[0])/totalCounts[1]