10 "github.com/klauspost/pgzip"
11 "golang.org/x/crypto/blake2b"
14 type CompactGenome struct {
16 Variants []tileVariantID
19 type CompactSequence struct {
21 TileSequences map[string][]tileLibRef
24 type TileVariant struct {
27 Blake2b [blake2b.Size256]byte
31 type LibraryEntry struct {
33 CompactGenomes []CompactGenome
34 CompactSequences []CompactSequence
35 TileVariants []TileVariant
38 func ReadCompactGenomes(rdr io.Reader, gz bool) ([]CompactGenome, error) {
39 var ret []CompactGenome
40 err := DecodeLibrary(rdr, gz, func(ent *LibraryEntry) error {
41 ret = append(ret, ent.CompactGenomes...)
47 func DecodeLibrary(rdr io.Reader, gz bool, cb func(*LibraryEntry) error) error {
48 zrdr := ioutil.NopCloser(rdr)
51 zrdr, err = pgzip.NewReader(bufio.NewReaderSize(rdr, 1<<26))
56 dec := gob.NewDecoder(zrdr)
59 err = dec.Decode(&ent)