SAM tags in Python.
This package provides
- A class decorator (
sam_tag
) to validate that locally-defined SAM tags adhere to the SAM spec. - Built-in enumerations over the predefined standard tags (
StandardTag
) and the tags used by several popular bioinformatics programs.
$ pip install sam_tags
The sam_tags
decorator permits the specification of custom enumerations that adhere to the conventions described in the SAM specification.
from enum import StrEnum
from sam_tags import sam_tag
@sam_tag
class CustomTag(StrEnum):
"""Custom SAM tags."""
XF = "XF"
"""Some filter."""
vl = "vl"
"""Some value."""
The predefined standard tags are available as a built-in class.
from sam_tags import StandardTag
# read: pysam.AlignedSegment
read.get_tag(StandardTag.RX)
Docstrings on each predefined tag permit simple reference within an IDE.
Built-in classes are also available for sets of tags used in popular bioinformatics software.
from sam_tags.community import BwaTag
from sam_tags.community import CellrangerTag