Documentation
¶
Overview ¶
Package agc reads Assembled Genomes Compressor (AGC) v3 archives.
Archives are decoded lazily from an io.ReaderAt. The package is read-only.
Index ¶
- Variables
- type Archive
- func (a *Archive) Close() error
- func (a *Archive) Contig(sample Sample, name string) (Contig, error)
- func (a *Archive) Contigs(sample Sample) ([]ContigInfo, error)
- func (a *Archive) IterateAll(yield func(Contig) error) error
- func (a *Archive) IterateSample(sample Sample, yield func(Contig) error) error
- func (a *Archive) NewContigReader(sample Sample) (*ContigReader, error)
- func (a *Archive) ReferenceSample() (Sample, error)
- func (a *Archive) Samples() ([]Sample, error)
- func (a *Archive) Version() Version
- type Contig
- type ContigInfo
- type ContigReader
- type HTTPOptions
- type Sample
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( // ErrClosed is returned when an operation uses a closed archive. ErrClosed = errors.New("agc: archive is closed") // ErrCorruptArchive marks malformed, truncated, or inconsistent input. ErrCorruptArchive = errors.New("agc: corrupt archive") // ErrUnsupportedVersion marks an AGC archive whose file-format major version is not 3. ErrUnsupportedVersion = errors.New("agc: unsupported file-format version") // ErrSampleNotFound marks a lookup for a sample not present in the archive. ErrSampleNotFound = errors.New("agc: sample not found") // ErrContigNotFound marks a lookup for a contig not present in the selected sample. ErrContigNotFound = errors.New("agc: contig not found") )
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive struct {
// contains filtered or unexported fields
}
Archive is an open, read-only AGC v3 archive.
func OpenReaderAt ¶
OpenReaderAt opens an AGC v3 archive from a ReaderAt and its exact size. The caller retains ownership of r; Archive.Close does not close it.
func OpenURL ¶ added in v0.4.0
OpenURL opens an AGC v3 archive through HTTP byte-range requests. The context remains in force for the lifetime of the archive. A nil client uses http.DefaultClient. The server must support single byte ranges.
func OpenURLWithOptions ¶ added in v0.4.0
OpenURLWithOptions opens an HTTP byte-range-backed AGC v3 archive using the supplied retrieval policy.
func (*Archive) Contig ¶
Contig retrieves and decodes a named contig from a sample. Name matching follows AGC: the query and stored header are compared up to the first ASCII whitespace, while the returned Contig.Name retains the full stored header.
func (*Archive) Contigs ¶
func (a *Archive) Contigs(sample Sample) ([]ContigInfo, error)
Contigs returns a sample's contigs in archive order. Each result retains its sample identity separately from its stored contig name.
func (*Archive) IterateAll ¶
IterateAll decodes every contig in archive sample order and contig order, stopping on the first error returned by yield.
func (*Archive) IterateSample ¶
IterateSample decodes a sample's contigs in archive order, holding at most one yielded contig's sequence at a time. Iteration stops on the first error returned by yield.
func (*Archive) NewContigReader ¶ added in v0.2.0
func (a *Archive) NewContigReader(sample Sample) (*ContigReader, error)
NewContigReader returns a pull-style reader for one sample. Read holds at most one returned contig's decoded sequence at a time.
func (*Archive) ReferenceSample ¶
ReferenceSample returns the first sample stored in the v3 collection.
type ContigInfo ¶
ContigInfo identifies a contig and its owning sample separately.
type ContigReader ¶ added in v0.2.0
type ContigReader struct {
// contains filtered or unexported fields
}
ContigReader reads one sample's contigs in archive order. A reader is not safe for concurrent use, although independent readers may share an Archive.
func (*ContigReader) Read ¶ added in v0.2.0
func (r *ContigReader) Read() (Contig, error)
Read decodes and returns the next contig, or io.EOF after the sample's final contig.
type HTTPOptions ¶ added in v0.4.0
type HTTPOptions struct {
// Client performs HTTP requests. A nil client uses http.DefaultClient.
Client *http.Client
// ReadAheadBytes is fetched for small demand reads. The default is 64 KiB.
ReadAheadBytes int64
// MergeGapBytes is the largest gap included while joining nearby ranges.
// The default is 64 KiB.
MergeGapBytes int64
// MaxMergedRangeBytes caps one joined range. The default is 8 MiB.
MaxMergedRangeBytes int64
// CacheBytes bounds compressed remote range data. The default is 64 MiB.
CacheBytes int64
// Concurrency caps simultaneous range requests. The default is 8.
Concurrency int
// WholeObjectThreshold downloads objects at or below this size in one
// full-range request after the range-support probe. The default is 16 MiB;
// a negative value disables it.
WholeObjectThreshold int64
// WholeObjectFraction downloads the whole object when uncached planned
// ranges reach this fraction and the object fits CacheBytes. The default is
// 0.80; a negative value disables it.
WholeObjectFraction float64
}
HTTPOptions controls remote archive retrieval. Zero-valued fields select defaults. Set WholeObjectThreshold or WholeObjectFraction to a negative value to disable that whole-object optimization.