Module cstag.consensus
Functions
def condense_deletions(s: str) ‑> str
def consensus(cs_tags: list[str], positions: list[int], prefix: bool = False) ‑> str
-
generate consensus of cs tags
Args
cs_tags
:list
- cs tags in the long format
positions
:list
- 1-based leftmost mapping position (4th column in SAM file)
prefix
:bool
, optional- Whether to add the prefix 'cs:Z:' to the cs tag. Defaults to False
Return
str: a consensus of cs tag in the long format
Example
>>> import cstag >>> cs_tags = ["=ACGT", "=AC*gt=T", "=C*gt=T", "=C*gt=T", "=ACT+ccc=T"] >>> positions = [1,1,1,2,1] >>> cstag.consensus(cs_tags, positions) '=AC*gt=T'
def get_consensus(cs_tags: list[list[str]]) ‑> str
def normalize_positions(positions: list[int]) ‑> list[int]
-
Normalize the positions in the given list by shifting them so that the minimum position becomes zero.
def normalize_read_lengths(cs_tags: list[str], positions: list[int]) ‑> list[list[str]]
-
Normalize the lengths of each read in cs_tags based on their starts positions. If the length is insufficient, fill in with
None
.Args
cs_tags
:list[str]
- list of cs tags.
positions
:list[int]
- Starting positions of each read.
Returns
list[list[str]]
- list of lists representing the reads, now normalized to the same length.
-
Split and process each cs tag in cs_tags.
Args
cs_tags
:list[str]
- list of cs tags in the long format.
Returns
list[list[str]]
- list of processed cs tags.
def split_deletion(cs_tag: str) ‑> list[str]