Example #1
0
// writeFlipped() writes out a stream of bits that says whether or not the
// reads were flipped.
func writeFlipped(out *bitio.Writer, reads []*FastQ) {
	for _, fq := range reads {
		if fq.IsFlipped {
			out.WriteBit(1)
		} else {
			out.WriteBit(0)
		}
	}
}
Example #2
0
// given a list of kmers, encode them to a file using the bittree scheme. The
// kmers must be sorted and they must be unique.
func encodeKmersToFile(kmers []string, out *bitio.Writer) {
	log.Printf("Encoding %v kmers to bittree file...", len(kmers))
	bits := make(chan byte, 1000000)
	go traverseToBitTree(kmers, bits)

	count := 0
	for c := range bits {
		out.WriteBit(c)
		count++
	}
	log.Printf("done. Wrote %v bits", count)
}