TimD1/vcfdist

Errors during `make`

MariaNattestad opened this issue · 3 comments

Interesting tool! We usually use hap.py for evaluation of DeepVariant, but I am interested to try vcfdist.

I ran into an error immediately though:

# Checking I have htslib as README suggested:
echo $LD_LIBRARY_PATH
/usr/local/google/home/marianattestad/bin/htslib-1.9/

git clone https://github.com/timd1/vcfdist
cd vcfdist/src
make

During make, it gave this error:

g++ -c -Wall -std=c++17 -O2 print.cpp
g++ -c -Wall -std=c++17 -O2 variant.cpp
In file included from variant.h:12,
                 from variant.cpp:8:
variant.cpp: In constructor ‘variantData::variantData(std::string, std::shared_ptr<fastaData>, int)’:
variant.cpp:459:22: warning: format ‘%li’ expects argument of type ‘long int’, but argument 5 has type ‘int32_t’ {aka ‘int’} [-Wformat=]
  459 |                 WARN("No GQ tag in %s VCF at %s:%li",
  460 |                         callset_strs[callset].data(), seq.data(), rec->pos);
      |                                                                   ~~~~~~~~
      |                                                                        |
      |                                                                        int32_t {aka int}
defs.h:118:22: note: in definition of macro ‘WARN’
  118 |     fprintf(stderr, (f_), ##__VA_ARGS__);                       \
      |                      ^~
variant.cpp:467:19: warning: format ‘%li’ expects argument of type ‘long int’, but argument 5 has type ‘int32_t’ {aka ‘int’} [-Wformat=]
  467 |             ERROR("Failed to read %s GT at %s:%li\n",
  468 |                     callset_strs[callset].data(), seq.data(), rec->pos);
      |                                                               ~~~~~~~~
      |                                                                    |
      |                                                                    int32_t {aka int}
defs.h:144:22: note: in definition of macro ‘ERROR’
  144 |     fprintf(stderr, (f_), ##__VA_ARGS__);                        \
      |                      ^~
g++ -c -Wall -std=c++17 -O2 dist.cpp
g++ -c -Wall -std=c++17 -O2 bed.cpp
g++ -c -Wall -std=c++17 -O2 cluster.cpp
g++ -c -Wall -std=c++17 -O2 phase.cpp
g++ -c -Wall -std=c++17 -O2 edit.cpp
g++ -Wall -std=c++17 -O2 globals.o print.o variant.o dist.o bed.o cluster.o phase.o edit.o -o vcfdist main.cpp -lz -lhts -lstdc++fs

Is this a bug or am I missing something?

Thanks!

TimD1 commented

Hi Maria,

Thanks for raising an issue!

It looks like you're using an older version of HTSlib than I've tested (1.9); the current version is 1.17. It appears that older versions of HTSlib store genomic position in an int32_t, whereas newer versions use long int.

I'll add a bugfix, casting it to a long int to fix this issue.

I'm curious, did g++ build the final executable vcfdist with this bug? It looks like it only printed a warning and the rest of the compilation process continued, but I could be wrong. Either way, I'll add a bugfix now. Please let me know if you run into other issues!

TimD1 commented

Ah, I see the confusion. The WARN() and ERROR() functions are wrappers I wrote to report incorrect VCF formatting. The bug occurs in those functions, since they report the genomic position of the malformed VCF entry. But it looks like it's only a compilation warning.

Oh I see! Yea I saw the word ERROR and assumed it was an error 😂
I can see the vcfdist executable was still created, so this makes sense. I've updated htslib now and will rerun.
Thanks for the help!