cgf

package module
v0.0.0-...-3209fe3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2016 License: AGPL-3.0 Imports: 13 Imported by: 3

README

cgf

Compact Genome Format

Documentation

Overview

package main

package main

package main

package main

package main

package main

package main

package main

package main

package main

package main

Index

Constants

View Source
const CGF_DEFAULT_LIBRARY_FILE string = "default_tile_map_v0.1.0.txt"
View Source
const CGF_DEFAULT_LIBRARY_VERSION string = "0.1.0"

Variables

View Source
var CGF_MAGIC []byte = []byte{'"', 'c', 'g', 'f', '.', 'b', '"', '{'}

const CGF_MAGIC uint64 = 0x7b226367662e6222

View Source
var DEFAULT_TILEMAP []string = []string{}/* 1024 elements not displayed */
View Source
var VERSION_STR string = "0.2.3"

Functions

func BytesFromFinalOverflowIntermediate

func BytesFromFinalOverflowIntermediate(fofsi FinalOverflowIntermediate) []byte

func BytesFromHeaderIntermediate

func BytesFromHeaderIntermediate(hdri HeaderIntermediate) []byte

func BytesFromLoqIntermediate

func BytesFromLoqIntermediate(loqi LoqIntermediate) []byte

func BytesFromOverflowIntermediate

func BytesFromOverflowIntermediate(ofsi OverflowIntermediate) []byte

func BytesFromPathIntermediate

func BytesFromPathIntermediate(pathi PathIntermediate) []byte

func CGFBegPeel

func CGFBegPeel(cgf_bytes []byte) (magic uint64,
	cgfver []byte, libver []byte, path_n uint64, tmap_len uint64, tmap []byte, step_per_path_b []byte, path_off_b []byte, path_b []byte)

func CGFDefaultHeaderBytes

func CGFDefaultHeaderBytes() []byte

func cgf_default_header_bytes() []byte {

func CGFDefaultTileMap

func CGFDefaultTileMap() []byte

No path structures, so some arrays are of 0 length

func cgf_default_tile_map() []byte {

func CGFFillHeader

func CGFFillHeader(cgf *CGF, b []byte) int

func fill_header_struct_from_bytes(cgf *CGF, b []byte) {

func CGFLibraryVersion

func CGFLibraryVersion(cgf_bytes []byte) string

func CGFMagic

func CGFMagic(cgf_bytes []byte) uint64

func CGFPathBytes

func CGFPathBytes(cgf_bytes []byte, path int) ([]byte, error)

func CGFPathCount

func CGFPathCount(cgf_bytes []byte) int

func CGFTilemapBytes

func CGFTilemapBytes(cgf_bytes []byte) ([]byte, error)

func CGFVectorUint64

func CGFVectorUint64(cgf_bytes []byte, path int) ([]uint64, error)

func CGFVersion

func CGFVersion(cgf_bytes []byte) string

func CGLFGetLibSeq

func CGLFGetLibSeq(path, step, varid, span uint64, cglf_path string) string

bootstrap. We will replace this with a more efficient lookup

func cglf_get_lib_seq(path, step, varid, span uint64, cglf_path string) string {

func CacheMapVal

func CacheMapVal(vec_val uint64, offset uint) int

func CountOverflow

func CountOverflow(cgf_bytes []byte, path, start_step, end_step int) (int, error)

func CountOverflowVectorUint64

func CountOverflowVectorUint64(vec []uint64, start_step, end_step int) int

Count number of actual overflow entries. This is needed for the overflow tables.

Entries that appear in the local hexit cache won't be counted unless they're greater than 0xd.

func CountOverflow_old

func CountOverflow_old(cgf_bytes []byte, path, start_step, step int) (int, error)

start_step is inclusive, end step is exclusive

func CreateCGFBytes

func CreateCGFBytes(ctx *CGFContext) []byte

ctx holds the populated CGF structure along with a filled in SGLF structure, populated TileMapArray and the variaous TileMapLookup and TileMapPosition.

This returns the raw bytes as they're to be stored on disk (or in memory presumably).

func create_cgf_bytes(ctx *CGFContext) []byte {

func DebugRead

func DebugRead(ifn string) error

func debug_read(ifn string) error {

func FillNocSeq

func FillNocSeq(seq string, delpos_len []int) string

func fill_noc_seq(seq string, delpos_len []int) string {

func FinalOverflowIntermediateCmp

func FinalOverflowIntermediateCmp(fofsi0, fofsi1 FinalOverflowIntermediate) error

func finaloverflowintermediate_cmp(fofsi0, fofsi1 finaloverflowintermediate) error {

func GetKnot

func GetKnot(tilemap []TileMapEntry, pathi PathIntermediate, anchor_step int) [][]TileInfo

func get_knot(tilemap []TileMapEntry, pathi pathintermediate, anchor_step int) [][]TileInfo {

func GetSimpleTileMapEntry

func GetSimpleTileMapEntry(tilemap []TileMapEntry, pathi PathIntermediate, anchor_step int) (int, bool, bool, bool)

func GetKnot(tilemap []TileMapEntry, pathi PathIntermediate, anchor_step int) (tilemap int, is_span bool, is_loq bool, is_complex bool) {

func HeaderIntermediateAddPath

func HeaderIntermediateAddPath(hdri *HeaderIntermediate, path int, PathBytes []byte)

func headerintermediate_add_path(hdri *headerintermediate, path int, PathBytes []byte) {

func HeaderIntermediateCmp

func HeaderIntermediateCmp(hdri0, hdri1 HeaderIntermediate) error

func HeaderIntermediateDebugPrint

func HeaderIntermediateDebugPrint(hdri HeaderIntermediate)

func headerintermediate_debug_print(hdri headerintermediate) {

func LoadSampleFastj

func LoadSampleFastj(scan *autoio.AutoioHandle) ([][]TileInfo, error)

func LookupTileMap

func LookupTileMap(cgf_bytes []byte, path, ver, step int) (int, error)

func LoqIntermediateCmp

func LoqIntermediateCmp(loqi0, loqi1 LoqIntermediate) error

func Md5sum2str

func Md5sum2str(md5sum [16]byte) string

func OverflowIntermediateCmp

func OverflowIntermediateCmp(ofsi0, ofsi1 OverflowIntermediate) error

func Ovf_b

func Ovf_b(path_bytes []byte, step_idx int) []byte

Get overflow bytes for step in path bytes

func ParseTilepos

func ParseTilepos(s string) (path, ver, step int, err error)

func parse_tilepos(s string) (path, ver, step int, err error) {

func PathBegInfo

func PathBegInfo(path_bytes []byte) ([]byte, uint64, []byte, uint64)

func PathFinalOverflowFastJFromBytes

func PathFinalOverflowFastJFromBytes(fin_ovf_bytes []byte, step int) string

func PathFinalOverflowKnotFromBytes

func PathFinalOverflowKnotFromBytes(rec_n uint64, fin_ovf_bytes []byte, step uint64) (knot_zipper [][]int)

func PathFinalOverflowPeel

func PathFinalOverflowPeel(fin_ovf_bytes []byte) (fin_ovf_rec_n uint64, fin_ovf_rec_byte_len uint64, fin_ovf_rec_bytes []byte, dn uint64)

func PathLowQualityKnotZipper

func PathLowQualityKnotZipper(loq_info_bytes []byte, anchor_step uint64) [][][]int

func PathLowQualityPeel

func PathLowQualityPeel(loq_info_bytes []byte) (loq_count uint64,
	loq_code uint64, loq_stride uint64,
	loq_offset_bytes []byte, loq_step_pos_bytes []byte, loq_hom_flag_bytes []byte,
	loq_aux_flag_byte_count uint64, loq_aux_flag_bytes []byte,
	loq_info_byte_count uint64, loq_bytes []byte, dn uint64)

func PathOverflowAdd

func PathOverflowAdd(overflow *OverflowStruct, overflow_count, anchor_step, tilemap_pos int)

func PathOverflowBytes

func PathOverflowBytes(path_bytes []byte, path int) ([]byte, error)

func PathOverflowOffsetUint64

func PathOverflowOffsetUint64(path_bytes []byte) []uint64

func PathOverflowPeel

func PathOverflowPeel(ovf_bytes []byte) (ovf_len uint64, ovf_stride uint64, ovf_mbc uint64, ovf_off_b []byte, ovf_pos_b []byte, ovf_map_b []byte, ovf_dn uint64)

func PathOverflowPositionUint64

func PathOverflowPositionUint64(path_bytes []byte) []uint64

func PathOvfPeel

func PathOvfPeel(ovf_bytes []byte) (uint64, uint64, uint64, []byte, []byte, []byte, uint64)

func Peel

func Peel(cgf_bytes []byte, path, step int)

func PopulateSGLFFromCGLF

func PopulateSGLFFromCGLF(cglf_path string, sglf *cglf.SGLF, path uint64) error

func populate_sglf_from_cglf(cglf_path string, sglf *SGLF, path uint64) error {

func PrintHeaderInfo

func PrintHeaderInfo(cgf *CGF)

func print_header_info(cgf *CGF) {

func PrintKnotFastjSGLF

func PrintKnotFastjSGLF(knot [][]TileInfo, sglf cglf.SGLF, path, ver uint64, hdri HeaderIntermediate)

func print_knot_fastj_sglf(knot [][]TileInfo, sglf SGLF, path, ver uint64, hdri headerintermediate) {

func PrintTileCGLF

func PrintTileCGLF(cgf_fn string, tilepos string, cglf_path string) error

func PrintTileMapInfo

func PrintTileMapInfo(cgf *CGF)

func print_tilemap_info(cgf *CGF) {

func PrintTileSGLF

func PrintTileSGLF(cgf_fn string, tilepos string, sglf cglf.SGLF) error

func print_tile_sglf(cgf_fn string, tilepos string, sglf SGLF) error {

func RelativeOvfCount

func RelativeOvfCount(vec_bytes []byte, step_start, step_end uint64) (ovf_count int)

Count overflow entries from step_start to step_end (inclusive)

Broadly, there are two conditions where it could overflow:

  1. The cached value is an overflow value (either low or high quality)
  2. The number of non canonical entries exceed the cache size

func VectorElementOverflowCount

func VectorElementOverflowCount(prep_vector []VectorElement, st, n int) int

func WriteCGFBytes

func WriteCGFBytes(cgf_bytes []byte, ofn string) error

func write_cgf_bytes(cgf_bytes []byte, ofn string) error {

func WriteCGFFromIntermediate

func WriteCGFFromIntermediate(ofn string, hdri *HeaderIntermediate)

func write_cgf_from_intermediate(ofn string, hdri *HeaderIntermediate) {

Types

type CGF

type CGF struct {
	Magic          uint64
	Version        string
	LibraryVersion string
	PathCount      uint64
	TileMapLen     uint64
	TileMap        []byte
	StepPerPath    []uint64
	PathOffset     []uint64
	Path           []PathStruct

	HeaderBytes []byte
	PathBytes   [][]byte

	PathByteOffset uint64
}

type CGFContext

type CGFContext struct {
	CGF *CGF
	//SGLF            *SGLF
	SGLF            *cglf.SGLF
	TileMapArray    []TileMapEntry
	TileMapLookup   map[string]TileMapEntry
	TileMapPosition map[string]int
}

func (*CGFContext) ConstructFinalOffsetIntermediate

func (ctx *CGFContext) ConstructFinalOffsetIntermediate(prep_vector []VectorElement) FinalOverflowIntermediate

func (*CGFContext) ConstructLoqIntermediate

func (ctx *CGFContext) ConstructLoqIntermediate(prep_vector []VectorElement) LoqIntermediate

func (*CGFContext) ConstructOffsetIntermediate

func (ctx *CGFContext) ConstructOffsetIntermediate(prep_vector []VectorElement) OverflowIntermediate

func (*CGFContext) ConstructTileMapLookup

func (ctx *CGFContext) ConstructTileMapLookup()

func CGFContext_construct_tilemap_lookup(ctx *CGFContext) {

func (*CGFContext) ConstructUint64Vector

func (ctx *CGFContext) ConstructUint64Vector(prep_vector []VectorElement) []uint64

func (*CGFContext) EmitPathBytes

func (ctx *CGFContext) EmitPathBytes(path_idx int, allele_path [][]TileInfo) ([]byte, error)

func emit_intermediate(ctx *CGFContext, path_idx int, allele_path [][]TileInfo) error { func emit_PathBytes(ctx *CGFContext, path_idx int, allele_path [][]TileInfo) ([]byte, error) {

func (*CGFContext) UpdateVectorPathSimple

func (ctx *CGFContext) UpdateVectorPathSimple(path_idx int, allele_path [][]TileInfo) error

Will overwrite cgf path structure if it exists, create a new path if it doesn't. It will create a new PathStruct if one doesn't already exist.

func update_vector_path_simple(ctx *CGFContext, path_idx int, allele_path [][]TileInfo) error {

func (*CGFContext) WriteCGF

func (ctx *CGFContext) WriteCGF(ofn string) error

func write_cgf(ctx *CGFContext, ofn string) error {

type CGFIntermediate

type CGFIntermediate struct {
	TileMapKey string
	TileMapPos int
	// contains filtered or unexported fields
}

type DataRecordStruct

type DataRecordStruct struct {

	// dlug
	//
	Code []byte

	// arbitrary data, should include length
	// in derived structures
	//
	Data []byte
}

type FinalOverflowIntermediate

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

func FinalOverflowIntermediateFromBytes

func FinalOverflowIntermediateFromBytes(b []byte) (FinalOverflowIntermediate, int)

type FinalOverflowStruct

type FinalOverflowStruct struct {
	Length     uint64
	Stride     uint64
	Offset     []uint64
	Position   []uint64
	DataRecord DataRecordStruct
}

type HeaderIntermediate

type HeaderIntermediate struct {
	TileMap      []TileMapEntry
	TileMapBytes []byte

	StepPerPath []int

	PathBytes [][]byte
	// contains filtered or unexported fields
}

func HeaderIntermediateFromBytes

func HeaderIntermediateFromBytes(b []byte) (HeaderIntermediate, int)

type LoqAlleleInfoStruct

type LoqAlleleInfoStruct struct {
	NAllele []byte
	Allele  []LoqInfoStruct
}

type LoqHetHomInfoStruct

type LoqHetHomInfoStruct struct {
	AllelInfo [][]LoqInfoStruct
}

type LoqInfoStruct

type LoqInfoStruct struct {

	// dlug
	//
	Len []byte

	// []dlug
	//
	Pos []byte

	// []dlug
	//
	LoqLen []byte
}

type LoqIntermediate

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

func LoqIntermediateFromBytes

func LoqIntermediateFromBytes(b []byte) (LoqIntermediate, int)

type LowQualityHetStruct

type LowQualityHetStruct struct {
	Length uint64
	Stride uint64
	Offset []uint64
	NTile  []uint64
	Info   []LoqAlleleInfoStruct
}

type LowQualityHomStruct

type LowQualityHomStruct struct {
	Length uint64
	Stride uint64
	Offset []uint64
	NTile  []uint64
	Info   []LoqInfoStruct
}

type LowQualityInfoStruct

type LowQualityInfoStruct struct {
	Length     uint64
	Stride     uint64
	Offset     []uint64
	Position   []uint64
	HetHomFlag []byte
	Info       []LoqHetHomInfoStruct
}

type OverflowIntermediate

type OverflowIntermediate struct {
	TileMap []int
	// contains filtered or unexported fields
}

func OverflowIntermediateFromBytes

func OverflowIntermediateFromBytes(b []byte) (OverflowIntermediate, int)

type OverflowStruct

type OverflowStruct struct {

	//Length is redundant since slices have built in
	// length, but used here as a placeholder
	Length uint64

	Stride   uint64
	Offset   []uint64
	Position []uint64

	// { dlug, dlug }
	//
	Map []byte
}

type PathIntermediate

type PathIntermediate struct {
	VecUint64 []uint64
	// contains filtered or unexported fields
}

func PathIntermediateFromBytes

func PathIntermediateFromBytes(b []byte) (PathIntermediate, int)

type PathOverflowStruct

type PathOverflowStruct struct {
	Length   uint64
	Stride   uint64
	Offset   []uint64
	Position []uint64
	Map      []byte
	IntMap   []int
}

func GetPathOverflow

func GetPathOverflow(path_bytes []byte) PathOverflowStruct

type PathStruct

type PathStruct struct {
	Name   string
	Vector []uint64

	Overflow      OverflowStruct
	FinalOverflow FinalOverflowStruct

	LowQualityBytes []byte
}

type TileInfo

type TileInfo struct {
	PfxTag         string
	SfxTag         string
	Seq            string
	Span           int
	Step           int
	VarId          int
	NocallStartLen []int
}

type TileMapEntry

type TileMapEntry struct {
	TileMap int
	Variant [][]int
	Span    [][]int
}

func LookupTileMapEntry

func LookupTileMapEntry(cgf_bytes []byte, path, ver, step int) (TileMapEntry, error)

func UnpackTileMap

func UnpackTileMap(tilemap_bytes []byte) []TileMapEntry

func unpack_tilemap(tilemap_bytes []byte) []TileMapEntry {

type VectorElement

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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