sam

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2016 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package to read and write SAM format files

Index

Constants

This section is empty.

Variables

View Source
var (
	Regex = regexp.MustCompile(`^[\n\r]*[@[A-Z][A-Z][ \t]+[\S \t]+[\n\r]]*`)
)

Functions

func Format

func Format(s *seq.Seq, w io.Writer) (n int, err error)

To-do: not finished Format a single sequence into sam string

func NewReader

func NewReader(f file.SectionReader) seq.ReadRewinder

Returns a new Sam format reader using r.

func NewReaderName

func NewReaderName(name string) (r seq.ReadRewinder, err error)

Returns a new Sam format reader using a filename.

Types

type Reader

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

Sam sequence format reader type.

func (*Reader) GetReadOffset

func (self *Reader) GetReadOffset() (n int, err error)

Read a single sequence and return read offset for indexing.

func (*Reader) Read

func (self *Reader) Read() (sequence *seq.Seq, err error)

Read a single sequence and return it or an error.

func (*Reader) ReadRaw

func (self *Reader) ReadRaw(p []byte) (n int, err error)

Read a single sequence and return it or an error. (used for making record index)

func (*Reader) Rewind

func (self *Reader) Rewind() (err error)

Rewind the reader.

func (*Reader) SeekChunk

func (self *Reader) SeekChunk(offSet int64) (n int64, err error)

type Writer

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

Fasta sequence format writer type.

func NewWriter

func NewWriter(f io.WriteCloser, width int) *Writer

Returns a new sam format writer using f.

func NewWriterName

func NewWriterName(name string, width int) (w *Writer, err error)

Returns a new sam format writer using a filename, truncating any existing file. If appending is required use NewWriter and os.OpenFile.

func (*Writer) Close

func (self *Writer) Close() (err error)

Close the writer, flushing any unwritten sequence.

func (*Writer) Flush

func (self *Writer) Flush() error

Flush the writer.

func (*Writer) Write

func (self *Writer) Write(s *seq.Seq) (n int, err error)

Write a single sequence and return the number of bytes written and any error.

Jump to

Keyboard shortcuts

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