Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.72 KB

README.md

File metadata and controls

58 lines (39 loc) · 1.72 KB

sam_tags

CI Python Versions MyPy Checked Ruff

SAM tags in Python.

This package provides

  1. A class decorator (sam_tag) to validate that locally-defined SAM tags adhere to the SAM spec.
  2. Built-in enumerations over the predefined standard tags (StandardTag) and the tags used by several popular bioinformatics programs.

Installation

$ pip install sam_tags

Quickstart

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