snapatac2.PyDNAMotifScanner.with_background#

PyDNAMotifScanner.with_background(seqs, pvalue=1e-05)#

Create a motif test object using background sequences.

Use this method to define the background motif occurrence rate before testing enrichment in target sequences. The resulting PyDNAMotifTest stores the number of background sequences containing the motif.

Anti-Patterns#

  • Do NOT build the background from the same sequences later used as the target set.

  • Do NOT use a background set that is much smaller or compositionally unrelated to the target set.

type seqs:

list[str]

param seqs:

List of background DNA sequences.

type seqs:

list[str]

type pvalue:

float

param pvalue:

P-value threshold for reporting motif occurrences. Default is 1e-5.

type pvalue:

float

returns:

A DNA motif test object.

rtype:

PyDNAMotifTest

Examples

>>> background = ["ACGTACGT", "TTTTAAAA"]
>>> motif_test = scanner.with_background(background, pvalue=1e-5)