cram

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package cram is a WIP CRAM reader implementation.

Currently the package implements container, block and slice retrieval, and SAM header values can be retrieved from blocks.

See https://samtools.github.io/hts-specs/CRAMv3.pdf for the CRAM specification.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoEnd = errors.New("cram: cannot determine offset from end")

ErrNoEnd is returned when a stream cannot seek to a CRAM EOF block.

Functions

func HasEOF

func HasEOF(r io.ReaderAt) (bool, error)

HasEOF checks for the presence of a CRAM magic EOF block. The magic block is defined in the CRAM specification. A magic block is written by a Writer on calling Close. The ReaderAt must provide some method for determining valid ReadAt offsets.

Types

type Block

type Block struct {
	// contains filtered or unexported fields
}

Block is a CRAM block structure.

See CRAM spec section 8.

func (*Block) Value

func (b *Block) Value() (interface{}, error)

Value returns the value of the Block.

Note that rANS decompression is not implemented.

type Container

type Container struct {
	// contains filtered or unexported fields
}

Container is a CRAM container.

See CRAM spec section 7.

func (*Container) Block

func (c *Container) Block() *Block

Block returns the current CRAM block. The returned Blcok is only valid after a previous call to Next has returned true.

func (*Container) Err

func (c *Container) Err() error

Err returns the most recent error.

func (*Container) Next

func (c *Container) Next() bool

Next advances the Container to the next CRAM block. It returns false when the data ends, either by reaching the end of the container or encountering an error.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is a CRAM format reader.

func NewReader

func NewReader(r io.Reader) (*Reader, error)

NewReader returns a new Reader.

func (*Reader) Container

func (r *Reader) Container() *Container

Container returns the current CRAM container. The returned Container is only valid after a previous call to Next has returned true.

func (*Reader) Err

func (r *Reader) Err() error

Err returns the most recent error.

func (*Reader) Next

func (r *Reader) Next() bool

Next advances the Reader to the next CRAM container. It returns false when the stream ends, either by reaching the end of the stream or encountering an error.

type Slice

type Slice struct {
	// contains filtered or unexported fields
}

Slice is a CRAM slice header block.

See CRAM spec section 8.5.

Notes

Bugs

  • The rANS method is not implemented. Data blocks compressed with rANS will be returned compressed and an "unimplemented" error will be returned.

Directories

Path Synopsis
encoding
itf8
Package itf8 provides ITF-8 integer encoding.
Package itf8 provides ITF-8 integer encoding.
ltf8
Package ltf8 provides LTF-8 integer encoding.
Package ltf8 provides LTF-8 integer encoding.

Jump to

Keyboard shortcuts

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