Documentation ¶
Overview ¶
Package fasta is a library for parsing and representing FASTA files, and creating and reading elfasta files.
Index ¶
- Variables
- func ParseFai(filename string) (fai map[string]FaiReference)
- func ParseFasta(filename string, fai map[string]FaiReference, toUpper, toN bool) (fasta map[string][]byte)
- func ToElfasta(fasta map[string][]byte, filename string)
- func ToN(base byte) byte
- func ToUpperAndN(base byte) byte
- type FaiReference
- type MappedFasta
Constants ¶
This section is empty.
Variables ¶
var ElfastaMagic = []byte{0x31, 0xFA, 0x57, 0xA1} // 31FA57A1 => ELFASTA1
ElfastaMagic is the magic byte sequence that every .elfasta file starts with.
Functions ¶
func ParseFai ¶
func ParseFai(filename string) (fai map[string]FaiReference)
ParseFai parses an FAI file.
func ParseFasta ¶
func ParseFasta(filename string, fai map[string]FaiReference, toUpper, toN bool) (fasta map[string][]byte)
ParseFasta sequentially parses a FASTA file.
If fai is given, the sequences can be pre-allocated to reduce pressure on the garbage collector. If toUpper is true, the contents are converetd to upper case. If toN is true, ambiguity codes are normalized.
func ToUpperAndN ¶
ToUpperAndN can be used to normalize ambiguity codes in FASTA references, and convert all codes to upper case.
Types ¶
type FaiReference ¶
FaiReference represents an entry in an FAI file.
type MappedFasta ¶
type MappedFasta struct {
// contains filtered or unexported fields
}
MappedFasta represents the contents of an .elfasta file.
func OpenElfasta ¶
func OpenElfasta(filename string) (result *MappedFasta)
OpenElfasta opens a .elfasta file.
func (*MappedFasta) Seq ¶
func (fasta *MappedFasta) Seq(contig string) []byte
Seq fetches a sequence for the given contig from the .elfasta file.