Augustus
Augustus copied to clipboard
bam2wig compilation to working according to instructions
I have an Ubuntu 20.04 and followed the package install instructions at https://github.com/Gaius-Augustus/Augustus/blob/master/docs/INSTALL.md#HTSlib bam2wig fails to compile. (Not a problem for me personally, but probably annoying for other users)
Message:
bam2wig.c: In function ‘main’:
bam2wig.c:62:2: error: unknown type name ‘hts_pos_t’; did you mean ‘hts_itr_t’?
62 | hts_pos_t beg, end, pos;
| ^~~~~~~~~
| hts_itr_t
bam2wig.c:89:17: error: ‘HTS_POS_MAX’ undeclared (first use in this function)
89 | beg = 0; end = HTS_POS_MAX; tid = -1;
| ^~~~~~~~~~~
bam2wig.c:89:17: note: each undeclared identifier is reported only once for each function it appears in
bam2wig.c:107:2: error: unknown type name ‘sam_hdr_t’; did you mean ‘bam_hdr_t’?
107 | sam_hdr_t *htmp = bam_hdr_read(data[0]->bgzf_fp);
| ^~~~~~~~~
| bam_hdr_t
bam2wig.c:107:20: warning: initialization of ‘int *’ from incompatible pointer type ‘bam_hdr_t *’ {aka ‘struct <anonymous> *’} [-Wincompatible-pointer-types]
107 | sam_hdr_t *htmp = bam_hdr_read(data[0]->bgzf_fp);
| ^~~~~~~~~~~~
bam2wig.c:112:4: warning: implicit declaration of function ‘hts_parse_region’; did you mean ‘hts_parse_reg’? [-Wimplicit-function-declaration]
112 | hts_parse_region(reg, &tid, &beg, &end, (hts_name2id_f)bam_name2id, htmp, 0);
| ^~~~~~~~~~~~~~~~
| hts_parse_reg
bam2wig.c:141:21: warning: implicit declaration of function ‘bam_mplp64_auto’; did you mean ‘bam_mplp_auto’? [-Wimplicit-function-declaration]
141 | while ((exitCode = bam_mplp64_auto(mplp, &tid, &pos, n_plp, plp)) > 0)
| ^~~~~~~~~~~~~~~
| bam_mplp_auto
bam2wig.c:149:23: error: request for member ‘target_name’ in something not a structure or union
149 | newTargetName = htmp->target_name[tid];
| ^~
bam2wig.c:172:14: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=]
172 | printf("%ld %d\n", pos+1, coverage);
| ~~^ ~~~~~
| | |
| long int int
| %d
bam2wig.c:185:2: warning: implicit declaration of function ‘sam_hdr_destroy’; did you mean ‘bam_hdr_destroy’? [-Wimplicit-function-declaration]
185 | sam_hdr_destroy(htmp);
| ^~~~~~~~~~~~~~~
| bam_hdr_destroy
make[2]: [Makefile:63: bam2wig.o] Error 1 (ignored)
Check if HTSlib is installed and of version 1.10 or higher - see README.md
make[2]: *** [Makefile:64: bam2wig.o] Error 1
make[2]: Leaving directory '/home/katharina/git/Augustus/auxprogs/bam2wig'
make[1]: *** [Makefile:11: all] Error 2
make[1]: Leaving directory '/home/katharina/git/Augustus/auxprogs'
make: *** [Makefile:16: auxprogs] Error 2
The reference to Readme.md is not very useful, it would make more sense to refer to the install.md - but as stated above, that also doesn't solve the problem, yet.
It would be great if you could fix this for external users, @hmehlan :-) It's a matter of documentation, the libraries don't sit in that homebrew path in common.mk, I think they reside in /usr/local/lib on Ubuntu 20.04
tldr; - probably a version of HTSlib lower than 1.10 is used - see docs/INSTALL.md for help
Please check the compiler call
cc -Wall -O2 -I/usr/include/htslib -I/usr/local/include/htslib/ -c bam2wig.c
In this case, the HTSlib header files are in their default location /usr/* . You can find out the HTSlib version in this case using your package manager or try the following:
find /usr -name libhts.*
In my case, which reproduced the error, the file /usr/lib/x86_64-linux-gnu/libhts.so.1.7-2 was found, which means that version 1.7 is installed.
I have all kinds of htslib versions lol some are compatible, some are not. I guess this one will be compatible: /usr/lib/x86_64-linux-gnu/libhts.so.1.10.2-3 - but I don't recall whether that was installed via the ubuntu package manager, or manually compiled. (I also have 1.9 and 1.8 in /usr/bin/htslib and /usr/local/lib/)
@KatharinaHoff The fix is:
Download htslib 1.10 and manually compile, "install" locally, put it in your $PATH in bashrc file
Change Lines 33 and 34 in your common.mk file of the Augustus folder (downloaded from GitHub) to where you locally installed the htslib 1.10:
#INCLUDE_PATH_HTSLIB := -I/home/user/Programs/htslib/include
#LIBRARY_PATH_HTSLIB := -L/home/user/Programs/htslib -Wl,-rpath,/home/cbfgws6/Programs/htslib
Change the MakeFile for Bam2Wig (Augustus/auxprogs/bam2wig) on Lines 25 to read where your local htslib 1.10 folder is:
HTSLIB_INSTALL_DIR ?= $(HOME)/Programs/htslib
and Line 40 to read:
INCLUDE_PATH_HTSLIB ?= -I/home/user/Programs/htslib/include/htslib -I/home/user/Programs/htslib/include/htslib
Then follow the Augustus compile instructions and should work (works for Ubuntu 18.04).