ArcInstitute / ScreenPro2

Flexible analysis of high-content CRISPR screening
https://screenpro2.rtfd.io
Other
21 stars 4 forks source link

Find and filter out low counts in a pair-wise comparison #16

Closed abearab closed 3 months ago

abearab commented 11 months ago

root – https://github.com/GilbertLabUCSF/ScreenPro2/issues/28

abearab commented 11 months ago

https://github.com/mhorlbeck/ScreenProcessing/blob/master/experiment_config_file_BLANK.txt

#############################################################
##                     Filter Settings                     ##
#############################################################
[filter_settings]
#Do you require greater than or equal to the minimum reads
#for both experiments in a comparison or either experiment?
#Default is either, other option is both
filter_type = either
minimum_reads = 40
abearab commented 3 months ago

https://github.com/mhorlbeck/ScreenProcessing/blob/master/process_experiments.py#L464C1-L478C1

The filterLowCounts function in ScreenProcessing is applied on the counts within the pair-wise comparison.

def filterLowCounts(countsColumns, filterType, filterThreshold):
    if filterType == 'both' or filterType == 'all':
        failFilterColumn = countsColumns.apply(
            lambda row: min(row) < filterThreshold, axis=1)
    elif filterType == 'either' or filterType == 'any':
        failFilterColumn = countsColumns.apply(
            lambda row: max(row) < filterThreshold, axis=1)
    else:
        raise ValueError('filter type not recognized or not implemented')

    resultTable = countsColumns.copy()
    resultTable.loc[failFilterColumn, :] = np.nan

    return resultTable

Prior filtering on guides across all samples in a larger set of samples has been problematic! I'll fix this in the upcoming release.