smftools.preprocessing.umi_bipartite_analysis

smftools.preprocessing.umi_bipartite_analysis#

Bipartite graph analysis for U1×U2 UMI cluster pairing QC.

Functions

analyze_umi_bipartite_graph(adata[, ...])

Build a bipartite U1×U2 count matrix per (sample, reference) group and annotate reads.

smftools.preprocessing.umi_bipartite_analysis.analyze_umi_bipartite_graph(adata, umi_cols=('U1', 'U2'), sample_col='Experiment_name_and_barcode', reference_col='Reference_strand', uns_flag='umi_bipartite_analysis_performed', bypass=False, force_redo=False)#

Build a bipartite U1×U2 count matrix per (sample, reference) group and annotate reads.

For each (sample_col, reference_col) group, constructs a count matrix with U1 clusters as rows and U2 clusters as columns. Per-read annotations are added to adata.obs: :rtype: AnnData

  • RX_edge_count – number of reads sharing this (U1_cluster, U2_cluster) pair

  • RX_is_dominant_pair – True when this pair is the dominant partner for both its U1 and U2 cluster

  • RX_U1_fidelity – fraction of reads with this U1_cluster that share this U2_cluster

  • RX_U2_fidelity – fraction of reads with this U2_cluster that share this U1_cluster

Parameters#

adataAnnData

Must contain U1_cluster and U2_cluster columns in .obs.

umi_colsSequence[str]

The two UMI column name prefixes (default ("U1", "U2")).

sample_col, reference_colstr

Columns used to define groups.

uns_flagstr

Key in adata.uns to mark completion.

bypassbool

Skip processing entirely.

force_redobool

Rerun even if uns_flag is already set.

Returns#

AnnData

Modified in-place with new .obs columns and adata.uns["umi_bipartite_stats"].