dinopy.sam_reader module¶
From the SAM format specification:
SAM stands for Sequence Alignment/Map format. It is a TAB-delimited text format consisting of a header section, which is optional, and an alignment section. If present, the header must be prior to the alignments. Header lines start with ‘@’, while alignment lines do not. Each alignment line has 11 mandatory fields for essential alignment information such as mapping position, and variable number of optional fields for flexible or aligner specific information.
- class dinopy.sam_reader.SamReader(filepath)¶
Class for reading SAM files.
Examples
Open SAM file and print all records:
from dinopy import SamReader sr = SamReader(filepath) for ar in sr.get_alignment_records(): print(ar.get_sam_repr())
Read and print SAM header:
from dinopy import SamReader sr = SamReader(filepath) print(sr.get_header())
- get_header(self) list ¶
Reads and returns the SAM-file’s header.
Returns: a list of header entries.
- records(self)¶
Reads and parses the SAM alignment records from the file iteratively.
- Yields: