Documentation
¶
Overview ¶
Package sam decodes and encodes SAM files.
This package uses the format described in: https://en.wikipedia.org/wiki/SAM_(file_format)
Index ¶
- func File(file string) iter.Seq2[*SAM, error]
- func FileHeader(file string) iter.Seq2[SAMOrHeader, error]
- func Reader(r io.Reader) iter.Seq2[*SAM, error]
- func ReaderHeader(r io.Reader) iter.Seq2[SAMOrHeader, error]
- type Flag
- func (f Flag) Duplicate() bool
- func (f Flag) Each() bool
- func (f Flag) First() bool
- func (f Flag) Last() bool
- func (f Flag) Multiple() bool
- func (f Flag) NotPassing() bool
- func (f Flag) ReverseComplement() bool
- func (f Flag) ReverseComplement2() bool
- func (f Flag) Secondary() bool
- func (f *Flag) SetDuplicate(value bool)
- func (f *Flag) SetEach(value bool)
- func (f *Flag) SetFirst(value bool)
- func (f *Flag) SetLast(value bool)
- func (f *Flag) SetMultiple(value bool)
- func (f *Flag) SetNotPassing(value bool)
- func (f *Flag) SetReverseComplement(value bool)
- func (f *Flag) SetReverseComplement2(value bool)
- func (f *Flag) SetSecondary(value bool)
- func (f *Flag) SetSupplementary(value bool)
- func (f *Flag) SetUnmapped(value bool)
- func (f *Flag) SetUnmapped2(value bool)
- func (f Flag) Supplementary() bool
- func (f Flag) Unmapped() bool
- func (f Flag) Unmapped2() bool
- type SAM
- type SAMOrHeader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileHeader ¶ added in v1.0.0
func FileHeader(file string) iter.Seq2[SAMOrHeader, error]
FileHeader iterates over SAM or header entries in a file.
func ReaderHeader ¶ added in v1.0.0
ReaderHeader iterates over SAM or header entries in a reader.
Types ¶
type Flag ¶ added in v1.0.0
type Flag int
Flag is the bitwise flag field in a SAM entry.
const ( FlagMultiple Flag = 1 << iota // Template having multiple segments in sequencing FlagEach // Each segment properly aligned according to the aligner FlagUnmapped // Segment unmapped FlagUnmapped2 // Next segment in the template unmapped FlagReverseComplement // SEQ being reverse complemented FlagReverseComplement2 // SEQ of the next segment in the template being reverse complemented FlagFirst // The first segment in the template FlagLast // The last segment in the template FlagSecondary // Secondary alignment FlagNotPassing // Not passing filters, such as platform/vendor quality controls FlagDuplicate // PCR or optical duplicate FlagSupplementary // Supplementary alignment )
Bit values of the flag field.
func (Flag) NotPassing ¶ added in v1.0.0
NotPassing returns the FlagNotPassing bit value of this flag.
func (Flag) ReverseComplement ¶ added in v1.0.0
ReverseComplement returns the FlagReverseComplement bit value of this flag.
func (Flag) ReverseComplement2 ¶ added in v1.0.0
ReverseComplement2 returns the FlagReverseComplement2 bit value of this flag.
func (*Flag) SetDuplicate ¶ added in v1.0.0
func (*Flag) SetMultiple ¶ added in v1.0.0
SetMultiple sets the FlagMultiple bit value for this flag.
func (*Flag) SetNotPassing ¶ added in v1.0.0
func (*Flag) SetReverseComplement ¶ added in v1.0.0
func (*Flag) SetReverseComplement2 ¶ added in v1.0.0
func (*Flag) SetSecondary ¶ added in v1.0.0
func (*Flag) SetSupplementary ¶ added in v1.0.0
func (*Flag) SetUnmapped ¶ added in v1.0.0
func (*Flag) SetUnmapped2 ¶ added in v1.0.0
func (Flag) Supplementary ¶ added in v1.0.0
Supplementary returns the FlagSupplementary bit value of this flag.
type SAM ¶
type SAM struct { Qname string // Query name Flag Flag // 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]any // Typed optional tags. }
SAM is a single line (alignment) in a SAM file.
func (*SAM) MarshalText ¶ added in v0.1.17
MarshalText returns the textual representation of s in SAM format. Includes a trailing new line.
type SAMOrHeader ¶ added in v1.0.0
SAMOrHeader holds either a SAM or a header entry from a SAM-formatted input. If there is no error, exactly one of the fields will be non-nil.