smftools.preprocessing.label_deaminase_pcr_chimeras#
- smftools.preprocessing.label_deaminase_pcr_chimeras(adata, min_events_per_span=3, min_segment_purity=0.9, max_single_strand_fraction=0.8, obs_column='deaminase_PCR_chimera', uns_flag='label_deaminase_pcr_chimeras_performed', bypass=False, force_redo=True)#
Flag deaminase PCR-chimeric reads from per-read strand-switch metrics.
A deaminase PCR chimera is a molecule stitched from two templates of opposite deamination state, so along the read it shows a span of C->T (top-consistent) events and a span of G->A (bottom-consistent) events. The per-read metrics
ct_event_count,ga_event_countandstrand_segment_purityare computed at raw extraction (seesmftools.informatics.ragged_store.strand_switch_metrics) and carried onadata.obs. This step thresholds them into a booleanobs[obs_column]label; reads are not removed.A read is labeled a chimera when both strand signatures are present in sufficient number, the best two-segment (single-switch) model is highly pure, and the read is not overwhelmingly one-sided:
ct_event_count >= min_events_per_spanandga_event_count >= min_events_per_spanstrand_segment_purity >= min_segment_puritysingle_strand_fraction <= max_single_strand_fractionwheresingle_strand_fraction = max(ct, ga) / (ct + ga)
- Parameters:
adata (
AnnData) -- AnnData object (typically deaminase modality).min_events_per_span (
int(default:3)) -- Minimum C->T and G->A events required on each side.min_segment_purity (
float(default:0.9)) -- Minimum best two-segment purity to accept a clean switch.max_single_strand_fraction (
float(default:0.8)) -- Maximum one-sidedness for a read to qualify.obs_column (
str(default:'deaminase_PCR_chimera')) -- Name of the boolean obs column to write.uns_flag (
str(default:'label_deaminase_pcr_chimeras_performed')) -- Flag inadata.unsindicating prior completion.bypass (
bool(default:False)) -- Whether to skip processing.force_redo (
bool(default:True)) -- Whether to rerun even ifuns_flagis set.
- Returns:
The input AnnData with
obs[obs_column]set (label only).- Return type: