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, err error)
- func ParseFasta(filename string, fai map[string]FaiReference, toUpper, toN bool) (fasta map[string][]byte, err error)
- func ToElfasta(fasta map[string][]byte, filename string) (err error)
- type ConcurrentFasta
- type ConcurrentFastaEntry
- 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, err error)
ParseFai parses an FAI file.
func ParseFasta ¶
func ParseFasta(filename string, fai map[string]FaiReference, toUpper, toN bool) (fasta map[string][]byte, err error)
ParseFasta sequentially parses a FASTA file.
If fai is given, the sequences can be pre-allocated to reduce pressure on the garbage collector.
Types ¶
type ConcurrentFasta ¶
type ConcurrentFasta map[string]*ConcurrentFastaEntry
ConcurrentFasta represents a FASTA file that can be parsed concurrently.
func OpenConcurrentFasta ¶
func OpenConcurrentFasta(filename, fai string, toUpper, toN bool) (fasta ConcurrentFasta, err error)
OpenConcurrentFasta prepares the FASTA representation for concurrent parsing. The fai parameter must be passed.
func (ConcurrentFasta) Seq ¶
func (fasta ConcurrentFasta) Seq(contig string) []byte
Seq fetches a sequence for the given contig from the FASTA file representation. This method blocks if the contig has not been parsed yet.
type ConcurrentFastaEntry ¶
type ConcurrentFastaEntry struct {
// contains filtered or unexported fields
}
ConcurrentFastaEntry represents an entry in a FASTA file.
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 a .elfasta file.
func OpenElfasta ¶
func OpenElfasta(filename string) (*MappedFasta, error)
OpenElfasta opens a .elfasta file.
func (*MappedFasta) Close ¶
func (fasta *MappedFasta) Close() (err error)
Close closes 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.