Split gvcf2numpy command into import and export-numpy.
[lightning.git] / gob.go
1 package main
2
3 import (
4         "encoding/gob"
5         "io"
6         _ "net/http/pprof"
7
8         "golang.org/x/crypto/blake2b"
9 )
10
11 type CompactGenome struct {
12         Name     string
13         Variants []tileVariantID
14 }
15
16 type LibraryEntry struct {
17         TagSet         [][]byte
18         CompactGenomes []CompactGenome
19         TileVariants   []struct {
20                 Tag      tagID
21                 Blake2b  [blake2b.Size]byte
22                 Sequence []byte
23         }
24 }
25
26 func ReadCompactGenomes(rdr io.Reader) ([]CompactGenome, error) {
27         dec := gob.NewDecoder(rdr)
28         var ret []CompactGenome
29         for {
30                 var ent LibraryEntry
31                 err := dec.Decode(&ent)
32                 if err == io.EOF {
33                         return ret, nil
34                 } else if err != nil {
35                         return nil, err
36                 }
37                 ret = append(ret, ent.CompactGenomes...)
38         }
39 }