vampire.anno.tl.sample_msa#
- vampire.anno.tl.sample_msa(adata, *, match_score=2, mismatch_penalty=-3, gap_open_penalty=-5, gap_extend_penalty=-1, refine=True, max_refine_iter=3, store_key='aligned')[source]#
Multiple sequence alignment of motif arrays across samples.
Uses a guide-tree progressive alignment strategy: build a UPGMA tree from pairwise distances, then merge profiles bottom-up. Optionally refines the MSA via iterative consensus realignment.
Duplicate sequences are automatically deduplicated before alignment and mapped back afterwards.
- Parameters:
adata (
AnnData) – Annotated data withmotif_arrayandorientation_arrayinuns, andmotif_distanceinvarp.match_score (
int) – Reward coefficient for matching motifs. The substitution score is(avg_len - distance) * match_score + distance * mismatch_penalty, whereavg_lenis the average motif length of the two motifs.mismatch_penalty (
int) – Penalty coefficient for mismatched motifs.gap_open_penalty (
int) – Penalty for opening a gap.gap_extend_penalty (
int) – Penalty for extending a gap.refine (
bool) – Whether to perform iterative consensus-based refinement after the initial progressive alignment.max_refine_iter (
int) – Maximum number of refinement iterations. Ignored whenrefine=False.store_key (
str) – Key prefix for storing results inadata.uns. Stores{store_key}_motif_array,{store_key}_orientation_array,{store_key}_consensus, and{store_key}_consensus_orientation.
- Returns:
The updated AnnData with alignment results in
uns.- Return type:
AnnData
Examples
>>> import vampire as vp >>> adata = vp.datasets.wdr7_hprc() >>> vp.anno.tl.sample_msa(adata)