Version: v0.1.17 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 8 Imported by: 0



Package sam parses SAM files.

This package uses the format described in:



This section is empty.


This section is empty.


This section is empty.


type Reader

type Reader struct {
	// contains filtered or unexported fields

A Reader reads and parses SAM lines.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a new SAM reader that reads from r.

func (*Reader) NextHeader

func (r *Reader) NextHeader() (string, error)

NextHeader returns the next header line as a raw string, including the '@'. Returns EOF when out of header lines, then Next can be called for the data lines.

func (*Reader) Read added in v0.1.10

func (r *Reader) Read() (*SAM, error)

Read returns the next SAM line.

type SAM

type SAM struct {
	Qname string                 // Query name
	Flag  int                    // Bitwise flag
	Rname string                 // Reference sequence name
	Pos   int                    // Mapping position (1-based)
	Mapq  int                    // Mapping quality
	Cigar string                 // CIGAR string
	Rnext string                 // Ref. name of the mate/next read
	Pnext int                    // Position of the mate/next read
	Tlen  int                    // Observed template length
	Seq   string                 // Sequence
	Qual  string                 // Phred qualities (ASCII)
	Tags  map[string]interface{} // Typed optional tags.

SAM is a single line (alignment) in a SAM file.

func (*SAM) MarshalText added in v0.1.17

func (s *SAM) MarshalText() ([]byte, error)

MarshalText returns the textual representation of s in SAM format. Includes a trailing new line.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL