Documentation
¶
Overview ¶
add support to io.ReadSeeker interface by Xiaopeng Zhu
*
Index ¶
- Constants
- type BData
- type BTree
- type BVertex
- type BbiBlockDecoder
- type BbiBlockDecoderType
- type BbiBlockEncoder
- type BbiBlockEncoderType
- type BbiDataHeader
- type BbiHeader
- func (header *BbiHeader) Read(file io.ReadSeeker) error
- func (header *BbiHeader) Write(file io.WriteSeeker) error
- func (header *BbiHeader) WriteNBlocks(file io.WriteSeeker) error
- func (header *BbiHeader) WriteOffsets(file io.WriteSeeker) error
- func (header *BbiHeader) WriteUncompressBufSize(file io.WriteSeeker) error
- type BbiHeaderZoom
- type BbiQueryType
- type BbiReader
- func (bwf *BbiReader) Close() error
- func (bwf *BbiReader) Genome() ([]string, []int)
- func (bwf *BbiReader) InitIndex() error
- func (bwf *BbiReader) Query(idx, from, to, binsize int) <-chan *BbiQueryType
- func (bwf *BbiReader) QueryBedBin(idx, from, to, binsize int) <-chan *BedBbiQueryType
- func (bwf *BbiReader) QueryBedRaw(idx, from, to int) <-chan *BedBbiBlockDecoderType
- func (bwf *BbiReader) QueryRaw(idx, from, to int) <-chan *BbiBlockDecoderType
- func (bwf *BbiReader) ReadIndex(f io.ReadSeeker) error
- func (bwf *BbiReader) WriteIndex(f io.WriteSeeker) error
- type BbiSummaryRecord
- type BbiZoomBlockDecoder
- type BbiZoomBlockDecoderType
- type BbiZoomRecord
- type BedBbiBlockDecoder
- type BedBbiBlockDecoderType
- type BedBbiDataHeader
- type BedBbiQueryType
- type BedBbiSummaryRecord
- type BigBedReader
- func (bw *BigBedReader) Binsizes() []int
- func (bb *BigBedReader) Format(e *BedBbiBlockDecoderType) string
- func (bw *BigBedReader) GetBinsize(length int, width int) int
- func (bb *BigBedReader) Iter() <-chan *BedBbiBlockDecoderType
- func (bw *BigBedReader) Query(chr string, start int, end int, width int) (<-chan *BedBbiQueryType, error)
- func (bw *BigBedReader) QueryBin(chr string, start int, end int, binsize int) (<-chan *BedBbiQueryType, error)
- func (bw *BigBedReader) QueryRaw(chr string, start int, end int) (<-chan *BedBbiBlockDecoderType, error)
- type BigWigReader
- func (bw *BigWigReader) Binsizes() []int
- func (bw *BigWigReader) GetBinsize(length int, width int) int
- func (bw *BigWigReader) Query(chr string, start int, end int, width int) (<-chan *BbiQueryType, error)
- func (bw *BigWigReader) QueryBin(chr string, start int, end int, binsize int) (<-chan *BbiQueryType, error)
- func (bw *BigWigReader) QueryRaw(chr string, start int, end int) (<-chan *BbiBlockDecoderType, error)
- type Chromo
- type Genome
- type RTree
- type RTreeTraverser
- type RTreeTraverserType
- type RVertex
- type RVertexGenerator
- type RVertexGeneratorType
Constants ¶
View Source
const BIGBED_MAGIC = 0x8789F2EB
View Source
const BIGWIG_MAGIC = 0x888FFC26
View Source
const BbiMaxZoomLevels = 10 /* Max number of zoom levels */
View Source
const BbiResIncrement = 4 /* Amount to reduce at each zoom level */
View Source
const CIRTREE_MAGIC = 0x78ca8c91
View Source
const IDX_MAGIC = 0x2468ace0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BData ¶
type BTree ¶
type BbiBlockDecoder ¶
type BbiBlockDecoder struct { Header BbiDataHeader Buffer []byte }
func NewBbiBlockDecoder ¶
func NewBbiBlockDecoder(buffer []byte) (*BbiBlockDecoder, error)
func (*BbiBlockDecoder) Decode ¶
func (reader *BbiBlockDecoder) Decode() <-chan BbiBlockDecoderType
type BbiBlockDecoderType ¶
type BbiBlockEncoder ¶
type BbiBlockEncoder struct { ItemsPerSlot int // contains filtered or unexported fields }
func NewBbiBlockEncoder ¶
func NewBbiBlockEncoder(itemsPerSlot int) (*BbiBlockEncoder, error)
func (*BbiBlockEncoder) EncodeBlock ¶
func (writer *BbiBlockEncoder) EncodeBlock(chromid int, sequence []float64, binsize, reductionLevel int, fixedStep bool) <-chan BbiBlockEncoderType
type BbiBlockEncoderType ¶
type BbiDataHeader ¶
type BbiDataHeader struct { ChromId uint32 Start uint32 End uint32 Step uint32 Span uint32 Type byte Reserved byte ItemCount uint16 }
func (*BbiDataHeader) ReadBuffer ¶
func (header *BbiDataHeader) ReadBuffer(buffer []byte)
func (*BbiDataHeader) WriteBuffer ¶
func (header *BbiDataHeader) WriteBuffer(buffer []byte)
type BbiHeader ¶
type BbiHeader struct { Magic uint32 Version uint16 ZoomLevels uint16 CtOffset uint64 DataOffset uint64 IndexOffset uint64 FieldCould uint16 DefinedFieldCount uint16 SqlOffset uint64 SummaryOffset uint64 UncompressBufSize uint32 ExtensionOffset uint64 NBasesCovered uint64 MinVal uint64 MaxVal uint64 SumData uint64 SumSquared uint64 ZoomHeaders []BbiHeaderZoom NBlocks uint64 // offset positions PtrCtOffset int64 PtrDataOffset int64 PtrIndexOffset int64 PtrSqlOffset int64 PtrSummaryOffset int64 PtrUncompressBufSize int64 PtrExtensionOffset int64 }
func NewBbiHeader ¶
func NewBbiHeader() *BbiHeader
func (*BbiHeader) Read ¶
func (header *BbiHeader) Read(file io.ReadSeeker) error
func (header *BbiHeader) Read(file *os.File) error {
func (*BbiHeader) WriteNBlocks ¶
func (header *BbiHeader) WriteNBlocks(file io.WriteSeeker) error
func (*BbiHeader) WriteOffsets ¶
func (header *BbiHeader) WriteOffsets(file io.WriteSeeker) error
func (*BbiHeader) WriteUncompressBufSize ¶
func (header *BbiHeader) WriteUncompressBufSize(file io.WriteSeeker) error
type BbiHeaderZoom ¶
type BbiHeaderZoom struct { ReductionLevel uint32 Reserved uint32 DataOffset uint64 IndexOffset uint64 NBlocks uint32 PtrDataOffset int64 PtrIndexOffset int64 }
func (*BbiHeaderZoom) Read ¶
func (zoomHeader *BbiHeaderZoom) Read(file io.ReadSeeker) error
func (*BbiHeaderZoom) Write ¶
func (zoomHeader *BbiHeaderZoom) Write(file io.WriteSeeker) error
func (*BbiHeaderZoom) WriteNBlocks ¶
func (zoomHeader *BbiHeaderZoom) WriteNBlocks(file io.WriteSeeker) error
func (*BbiHeaderZoom) WriteOffsets ¶
func (zoomHeader *BbiHeaderZoom) WriteOffsets(file io.WriteSeeker) error
type BbiQueryType ¶
type BbiQueryType struct { BbiSummaryRecord Error error }
func NewBbiQueryType ¶
func NewBbiQueryType() *BbiQueryType
type BbiReader ¶
type BbiReader struct { Header BbiHeader ChromData BData Index RTree IndexZoom []RTree Fptr io.ReadSeeker // contains filtered or unexported fields }
func NewBbiReader ¶
func NewBbiReader(f io.ReadSeeker) *BbiReader
func (*BbiReader) Query ¶
func (bwf *BbiReader) Query(idx, from, to, binsize int) <-chan *BbiQueryType
func (*BbiReader) QueryBedBin ¶
func (bwf *BbiReader) QueryBedBin(idx, from, to, binsize int) <-chan *BedBbiQueryType
func (*BbiReader) QueryBedRaw ¶
func (bwf *BbiReader) QueryBedRaw(idx, from, to int) <-chan *BedBbiBlockDecoderType
func (*BbiReader) QueryRaw ¶
func (bwf *BbiReader) QueryRaw(idx, from, to int) <-chan *BbiBlockDecoderType
func (*BbiReader) WriteIndex ¶
func (bwf *BbiReader) WriteIndex(f io.WriteSeeker) error
type BbiSummaryRecord ¶
type BbiSummaryRecord struct { ChromId int From int To int Valid int Min float64 Max float64 Sum float64 SumSquares float64 }
func NewBbiSummaryRecord ¶
func NewBbiSummaryRecord() BbiSummaryRecord
func (*BbiSummaryRecord) AddRecord ¶
func (record *BbiSummaryRecord) AddRecord(x BbiSummaryRecord)
func (*BbiSummaryRecord) AddValue ¶
func (record *BbiSummaryRecord) AddValue(x float64)
type BbiZoomBlockDecoder ¶
type BbiZoomBlockDecoder struct {
Buffer []byte
}
func NewBbiZoomBlockDecoder ¶
func NewBbiZoomBlockDecoder(buffer []byte) *BbiZoomBlockDecoder
func (*BbiZoomBlockDecoder) Decode ¶
func (reader *BbiZoomBlockDecoder) Decode() <-chan BbiZoomBlockDecoderType
type BbiZoomBlockDecoderType ¶
type BbiZoomBlockDecoderType struct { BbiSummaryRecord Error error }
type BbiZoomRecord ¶
type BedBbiBlockDecoder ¶
type BedBbiBlockDecoder struct { //Header BedBbiDataHeader Buffer []byte }
func NewBedBbiBlockDecoder ¶
func NewBedBbiBlockDecoder(buffer []byte) (*BedBbiBlockDecoder, error)
func (*BedBbiBlockDecoder) Decode ¶
func (reader *BedBbiBlockDecoder) Decode() <-chan *BedBbiBlockDecoderType
type BedBbiBlockDecoderType ¶
type BedBbiDataHeader ¶
type BedBbiQueryType ¶
type BedBbiQueryType struct { *BedBbiSummaryRecord Error error }
func NewBedBbiQueryType ¶
func NewBedBbiQueryType() *BedBbiQueryType
type BedBbiSummaryRecord ¶
func NewBedBbiSummaryRecord ¶
func NewBedBbiSummaryRecord() *BedBbiSummaryRecord
func (*BedBbiSummaryRecord) AddRecord ¶
func (record *BedBbiSummaryRecord) AddRecord(x BbiSummaryRecord)
func (*BedBbiSummaryRecord) AddValue ¶
func (record *BedBbiSummaryRecord) AddValue(x float64)
type BigBedReader ¶
func NewBigBedReader ¶
func NewBigBedReader(b *BbiReader) *BigBedReader
func (*BigBedReader) Binsizes ¶
func (bw *BigBedReader) Binsizes() []int
func (*BigBedReader) Format ¶
func (bb *BigBedReader) Format(e *BedBbiBlockDecoderType) string
func (*BigBedReader) GetBinsize ¶
func (bw *BigBedReader) GetBinsize(length int, width int) int
func (*BigBedReader) Iter ¶
func (bb *BigBedReader) Iter() <-chan *BedBbiBlockDecoderType
func (*BigBedReader) Query ¶
func (bw *BigBedReader) Query(chr string, start int, end int, width int) (<-chan *BedBbiQueryType, error)
func (*BigBedReader) QueryBin ¶
func (bw *BigBedReader) QueryBin(chr string, start int, end int, binsize int) (<-chan *BedBbiQueryType, error)
func (*BigBedReader) QueryRaw ¶
func (bw *BigBedReader) QueryRaw(chr string, start int, end int) (<-chan *BedBbiBlockDecoderType, error)
type BigWigReader ¶
func NewBigWigReader ¶
func NewBigWigReader(b *BbiReader) *BigWigReader
func (*BigWigReader) Binsizes ¶
func (bw *BigWigReader) Binsizes() []int
func (*BigWigReader) GetBinsize ¶
func (bw *BigWigReader) GetBinsize(length int, width int) int
func (*BigWigReader) Query ¶
func (bw *BigWigReader) Query(chr string, start int, end int, width int) (<-chan *BbiQueryType, error)
func (*BigWigReader) QueryBin ¶
func (bw *BigWigReader) QueryBin(chr string, start int, end int, binsize int) (<-chan *BbiQueryType, error)
QueryBin: * Query with binsize
func (*BigWigReader) QueryRaw ¶
func (bw *BigWigReader) QueryRaw(chr string, start int, end int) (<-chan *BbiBlockDecoderType, error)
type RTree ¶
type RTreeTraverser ¶
type RTreeTraverser struct {
Tree *RTree
}
func NewRTreeTraverser ¶
func NewRTreeTraverser(tree *RTree) RTreeTraverser
func (RTreeTraverser) QueryVertices ¶
func (traverser RTreeTraverser) QueryVertices(idx, from, to int) <-chan RTreeTraverserType
type RTreeTraverserType ¶
type RVertex ¶
type RVertex struct { IsLeaf uint8 NChildren uint16 ChrIdxStart []uint32 BaseStart []uint32 ChrIdxEnd []uint32 BaseEnd []uint32 DataOffset []uint64 Sizes []uint64 Children []*RVertex // positions of DataOffset and Sizes values in file PtrDataOffset []int64 PtrSizes []int64 }
func (*RVertex) Read ¶
func (vertex *RVertex) Read(file io.ReadSeeker) error
TODO MV BbiFile to BbiWriteSeeker
func (vertex *RVertex) WriteBlock(bwf *BbiWriteSeeker, i int, block []byte) error { var err error if bwf.Header.UncompressBufSize != 0 { // update header.UncompressBufSize if block length // exceeds size if uint32(len(block)) > bwf.Header.UncompressBufSize { bwf.Header.UncompressBufSize = uint32(len(block)) if err = bwf.Header.WriteUncompressBufSize(bwf.Fptr); err != nil { return err } } if block, err = compressSlice(block); err != nil { return err } } // get current offset and update DataOffset[i] if offset, err := bwf.Fptr.Seek(0, 1); err != nil { return err } else { vertex.DataOffset[i] = uint64(offset) // write updated value to the required position in the file if vertex.PtrDataOffset[i] != 0 { if err = fileWriteAt(bwf.Fptr, binary.LittleEndian, int64(vertex.PtrDataOffset[i]), vertex.DataOffset[i]); err != nil { return err } } } // write data if err = binary.Write(bwf.Fptr, binary.LittleEndian, block); err != nil { return err } // update size of the data block vertex.Sizes[i] = uint64(len(block)) // write it to the required position in the file if vertex.PtrSizes[i] != 0 { if err = fileWriteAt(bwf.Fptr, binary.LittleEndian, int64(vertex.PtrSizes[i]), vertex.Sizes[i]); err != nil { return err } } return nil }
func (*RVertex) ReadBlockFromReader ¶
type RVertexGenerator ¶
type RVertexGenerator struct { BlockSize int ItemsPerSlot int Channel chan RVertexGeneratorType }
func NewRVertexGenerator ¶
func NewRVertexGenerator(blockSize, itemsPerSlot int) (*RVertexGenerator, error)
func (*RVertexGenerator) Generate ¶
func (generator *RVertexGenerator) Generate(idx int, sequence []float64, binsize, reductionLevel int, fixedStep bool) <-chan RVertexGeneratorType
type RVertexGeneratorType ¶
Click to show internal directories.
Click to hide internal directories.