Module cstag.call

Functions

def add_prefix(cs_tag: str) ‑> str
def call(cigar: str, md: str, seq: str, long: bool = False, prefix: bool = False) ‑> str

Generate a cs tag based on CIGAR, MD, and SEQ information.

Args

cigar : str
CIGAR string representing the alignment.
md : str
MD tag representing mismatching positions/base.
seq : str
The sequence of the read.
long : bool, optional
Whether to return the cs tag in long format. Defaults to False.
prefix : bool, optional
Whether to add the prefix 'cs:Z:' to the cs tag. Defaults to False

Returns

str
A cs tag representing the alignment and differences.

Example

>>> import cstag
>>> cigar = "8M2D4M2I3N1M"
>>> md = "2A5^AG7"
>>> seq = "ACGTACGTACGTACG"
>>> cstag.call(cigar, md, seq, long=True)
'=AC*ag=TACGT-ag=ACGT+ac~nn3nn=G'
def expand_cigar_operations(cigar: str) ‑> list[str]
def expand_md_operations(md: str) ‑> list[str]
def generate_cs_long(cigar: str, md: str, seq: str) ‑> str
def join_cigar(cigar_tuples: list[tuple[str, int]]) ‑> str
def parse_cigar(cigar: str) ‑> list[tuple[str, int]]

Parse a CIGAR string into a list of tuples containing operation and length.

def parse_md(md: str) ‑> list[tuple[str, int]]

Parse an MD tag into a list of tuples containing operation and length.

def remove_consecutive_equals(cs_long: list[str]) ‑> list[str]
def trim_clips(cigar: str, seq: str) ‑> tuple[str, str]