Bio.motifs.thresholds module

Approximate calculation of appropriate thresholds for motif finding.

class Bio.motifs.thresholds.ScoreDistribution(motif=None, precision=10 ** 3, pssm=None, background=None)

Bases: object

Class representing approximate score distribution for a given motif.

Utilizes a dynamic programming approach to calculate the distribution of scores with a predefined precision. Provides a number of methods for calculating thresholds for motif occurrences.

__init__(self, motif=None, precision=10 ** 3, pssm=None, background=None)

Initialize the class.

modify(self, scores, mo_probs, bg_probs)

Modify motifs and background density.

threshold_fpr(self, fpr)

Approximate the log-odds threshold which makes the type I error (false positive rate).

threshold_fnr(self, fnr)

Approximate the log-odds threshold which makes the type II error (false negative rate).

threshold_balanced(self, rate_proportion=1.0, return_rate=False)

Approximate log-odds threshold making FNR equal to FPR times rate_proportion.

threshold_patser(self)

Threshold selection mimicking the behaviour of patser (Hertz, Stormo 1999) software.

It selects such a threshold that the log(fpr)=-ic(M) note: the actual patser software uses natural logarithms instead of log_2, so the numbers are not directly comparable.