align_alternate#
- TrackData.align_alternate(variant)[source]#
Aligns an alternate-allele 1-bp TrackData back to reference coordinates.
Matches server-side indel alignment: insertions collapse the anchor and inserted bases via
max, shift downstream bases left, and zero-pad up tolen(alt) - len(ref)trailing positions; deletions zero-fill deleted positions and shift downstream bases right; SNVs/MNVs return a copy.Assumes left-aligned VCF variants (use
genome.normalize_variant(variant, fasta_extractor)with a local FASTA for unnormalized variants) and ascending genomic coordinates (call beforeslice_by_interval()for insertions and beforereverse_complement()).- Parameters:
variant (
Variant) – Thegenome.Variantwhose alternate allele producedself.- Return type:
- Returns:
A new
TrackDataaligned to reference coordinates.- Raises:
ValueError – If
intervalis None,resolution != 1,values.ndim != 2,variantalleles are empty, orvariantfalls outsideinterval.