Example #1
0
func tabixCloser(t *Tabix) {
	if t.tbx != nil {
		C.tbx_destroy(t.tbx)
	}
	if t.htf != nil {
		C.hts_close(t.htf)
	}
	if t.hdr != nil {
		C.bcf_hdr_destroy(t.hdr)
	}
}
Example #2
0
func (t *Tabix) AddInfoToHeader(id string, number string, vtype string, description string) {
	if t.original_header {
		hdr := C.bcf_hdr_dup(t.hdr)
		C.bcf_hdr_destroy(t.hdr)
		t.hdr = hdr

	}
	ckey := C.CString(fmt.Sprintf("##INFO=<ID=%s,Number=%s,Type=%s,Description=\"%s\"", id, number, vtype, description))
	e := C.bcf_hdr_append(t.hdr, ckey)
	C.free(unsafe.Pointer(ckey))
	if e != 0 {
		log.Fatalf("couldn't add to header\n")
	}
	if C.bcf_hdr_sync(t.hdr) != 0 {
		log.Fatalf("error syncing header\n")
	}
}