snapatac2.tl.add_tf_binding#

snapatac2.tl.add_tf_binding(network, *, motifs, genome_fasta, pvalue=1e-05)[source]#

Add motif-to-region edges to a regulatory network.

Use this function after creating a region-gene network to scan region sequences for transcription factor motif matches and add motif nodes that point to bound regions.

Anti-Patterns#

  • Do NOT pass a FASTA from a different genome build than the network region coordinates.

  • Do NOT expect duplicate motif nodes to be merged with existing gene nodes; motif nodes are added separately with type "motif".

param network:

Graph containing region nodes with ids in chrom:start-end format.

type network:

PyDiGraph

param motifs:

Motifs to scan against region sequences.

type motifs:

list[PyDNAMotif]

param genome_fasta:

Genome FASTA path, or a Genome object containing a FASTA path.

type genome_fasta:

Path | Genome

param pvalue:

Motif match p-value threshold.

type pvalue:

float

returns:

Adds motif nodes and motif-to-region edges to network in place.

rtype:

None

Examples

>>> import snapatac2 as snap
>>> motifs = snap.datasets.cis_bp(unique=True)
>>> network = snap.tl.init_network_from_annotation(["chr1:10000-10500"], snap.genome.hg38)
>>> snap.tl.add_tf_binding(network, motifs=motifs[:2], genome_fasta=snap.genome.hg38)
>>> network.num_nodes() >= 0
True