snapatac2.tl.link_tf_to_gene#
- snapatac2.tl.link_tf_to_gene(network)[source]#
Create a transcription-factor-to-gene network.
Use this function after
add_tf_bindinghas added motif-to-region edges to a region-gene network. A TF is linked to a gene when its motif binds a region that is linked to that gene.Anti-Patterns#
Do NOT call this before
add_tf_binding; no motif-to-region paths will exist.Do NOT treat the returned graph as weighted unless you add scores after conversion; new TF-gene edges contain default
LinkData.
- param network:
Graph containing gene, region, and motif nodes.
- type network:
PyDiGraph- returns:
Directed graph containing TF gene nodes linked to target gene nodes.
- rtype:
PyDiGraph
Examples
>>> import snapatac2 as snap >>> network = snap.tl.init_network_from_annotation(["chr1:10000-10500"], snap.genome.hg38) >>> tf_network = snap.tl.link_tf_to_gene(network) >>> tf_network.num_edges() >= 0 True