snapatac2.read_motifs#

snapatac2.read_motifs(filename)#

Read DNA motifs from a MEME format file.

Use this function to load motif collections before motif scanning or motif enrichment analysis. Each MEME motif is returned as a PyDNAMotif.

Anti-Patterns#

  • Do NOT pass non-MEME files; parsing expects MEME motif syntax.

  • Do NOT assume motif names are unique unless the source collection enforces uniqueness.

type filename:

str | Path

param filename:

Path to the MEME format file.

type filename:

str | Path

returns:

List of PyDNAMotif objects.

rtype:

list[PyDNAMotif]

Examples

>>> import snapatac2 as snap
>>> motifs = snap.read_motifs("motifs.meme")
>>> scanner = motifs[0].with_nucl_prob()
>>> scanner.exist("ACGTACGT", pvalue=1e-5)