loosolab/TF-COMB

not possible to change distribution threshold in DiffCombObj.select_rules()

Closed this issue · 1 comments

Hi Mette,
Selina asked how the DiffCombObj.select_rules() can be adjusted to be more stringent (see loosolab/Datenanalyse-2021#4) . I had a look and it seems the user is able to adjust the pvalue theshold [y-axis]

def select_rules(self, contrast=None,
                                measure="cosine", 
                                measure_threshold=None,
                                pvalue_threshold=0.05,
                                plot = True, 
                               **kwargs) # goes into plot

But not the percentage used as distribution threshold [x-axis], although utils.get_threshold() provides this parameter:

def get_threshold(data, which="upper", percent=0.05, _n_max=10000, verbosity=0):

This seems a bit inconsistent to me. Is there a reason for preventing the user to change this? Or should we add this option to select_rules() ?

Hi, thank you for catching this @vheger and @selinaLa! It is indeed quite inconsistent, I agree. I added the option to do:
<CombObj>.select_significant_rules(x_threshold_percent=0.01, y_threshold_percent=0.01)
and
<DiffCombObj>.select_rules(measure_threshold_percent=0.01)

So that will make the automatic selection more strict (default is 0.05 for all thresholds). But I will also have a look at the select_rules for DiffCombObj again. The p-value calculation is not working out so well, so I might change this function in the future (but the output will still be a subset of the original object, so nothing should change in the following steps).