fasta

package
v0.8.23 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2014 License: BSD-2-Clause Imports: 9 Imported by: 4

Documentation

Overview

Package to read and write FASTA format files

Index

Constants

This section is empty.

Variables

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

Functions

func Format

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

Format a single sequence into fasta string

func NewReader

func NewReader(f file.SectionReader) seq.ReadRewinder

Returns a new fasta format reader using f.

Types

type Reader

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

Fasta 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.

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)

seek sequences which add up to a size close to the configured chunk size (conf.CHUNK_SIZE, e.g. 1M)

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 fasta format writer using f.

func NewWriterName

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

Returns a new fasta 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