fastqreader

package
v0.0.0-...-324d411 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DifferentBarcode

func DifferentBarcode(a []byte, b []byte) bool

* Decide of two reads come from different gems

func Min

func Min(x, y int) int

func NotWhitelist

func NotWhitelist(a *FastQRecord) bool

func SliceCompare

func SliceCompare(a []byte, b []byte) bool

* A utility function to compare two slices

Types

type FastQReader

type FastQReader struct {
	Source        *ZipReader
	Buffer        *bufio.Reader
	Line          int
	DefferedError error
	Pending       *FastQRecord
	LastBarcode   []byte
}

* This struture reprensets a "fastQ" reader that can pull single records * as well as sets of records (on the same barcode) from a fastq file

func OpenFastQ

func OpenFastQ(path string) (*FastQReader, error)

Open a new fastQ files

func (*FastQReader) ReadBarcodeSet

func (fqr *FastQReader) ReadBarcodeSet(space *[]FastQRecord, trim int) ([]FastQRecord, error, bool)

* Reaturn an array of all of the reads from the same GEM. * "space" may be null or may be the result of a previous call to this function. * If present the array will be destructively re-used

func (*FastQReader) ReadOneLine

func (fqr *FastQReader) ReadOneLine(result *FastQRecord, trim int) error

* Read a single record from a fastQ file

type FastQRecord

type FastQRecord struct {
	Read1     []byte
	ReadQual1 []byte
	Read2     []byte
	ReadQual2 []byte
	TrimBases []byte
	TrimQuals []byte

	Barcode10X     []byte
	Barcode10XQual []byte
	RawBarcode10X  []byte

	Barcode     []byte
	BarcodeQual []byte

	ReadInfo    string
	ReadGroupId string
}

* This structure represents a single read from a fastq file

type ZipReader

type ZipReader struct {
	/* The exact reader that was passed to us */
	Source io.Reader
	Cmd    *exec.Cmd
}

* We need a "ZipReader" reader object. A ZipReader contains a source reader * but implements a read function that retries if the source reader returned * fewer bytes than requested.

func FastZipReader

func FastZipReader(path string) (*ZipReader, error)

* Implement an "uncompressing" reader that uses the system's * gunzip program to uncompress the input file. We do this * because the system gzip is much much faster than the go library

func MakeZipReader

func MakeZipReader(src io.Reader, cmd *exec.Cmd) *ZipReader

func (ZipReader) Close

func (r ZipReader) Close()

func (ZipReader) Read

func (r ZipReader) Read(data []byte) (int, error)

* Implement a "ReRead" function. It reads from a Reader and it retries * if it gets fewer bytes than it wanted. It will always completely fill * the "data" array or return an error.

Jump to

Keyboard shortcuts

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