cell2net.preprocessing.tf_to_gene#

cell2net.preprocessing.tf_to_gene(mdata, rna_mod='rna', atac_mod='atac', peak_to_gene_key='peak_to_gene', motif_match_key='motif_match', key_added='gene_tf', inplace=True)#

Link transcription factors (TFs) to target genes based on TF binding sites.

This function identifies potential transcription factor regulators for each gene by mapping TF binding motifs in accessible chromatin regions (peaks) to target genes. It avoids self-regulation by removing cases where the target gene is also a TF.

Parameters:
  • mdata (MuData) – A MuData object containing RNA and ATAC modalities.

  • rna_mod (str (default: 'rna')) – The name of the RNA modality in mdata.

  • atac_mod (str (default: 'atac')) – The name of the ATAC modality in mdata.

  • peak_to_gene_key (str (default: 'peak_to_gene')) – The key under which the peak-to-gene mapping is stored in mdata.uns.

  • motif_match_key (str (default: 'motif_match')) – The key under which the motif match information is stored in mdata[atac_mod].varm.

  • key_added (str (default: 'gene_tf')) – The key under which the resulting dataframe is added to mdata[rna_mod].uns.

  • inplace (bool (default: True)) – If True, the results are added to mdata. If False, the resulting dataframe is returned.

Return type:

None | DataFrame

Returns:

If inplace is True, the function modifies mdata in place and returns None. If inplace is False, it returns a dataframe linking genes to TFs.

Notes

  • Ensure that the peak-to-gene mapping (peak_to_gene) has been generated using cell2net.pp.peak_to_gene before running this function.

  • The input mdata must contain motif match information in adata_atac.varm[“motif_match”].

Examples

>>> import cell2net as cn
>>> mdata = cn.example_data()
>>> tf_to_gene(mdata)
>>> result_df = tf_to_gene(mdata, inplace=False)
>>> print(result_df)