odelaneau / shapeit5

Segmented HAPlotype Estimation and Imputation Tool
https://odelaneau.github.io/shapeit5/
MIT License
61 stars 9 forks source link

phase common failed to build #5

Closed zyhuang closed 1 year ago

zyhuang commented 1 year ago

Hello,

I noticed in a recent change in phase common module, it seems the method haplotype_writer:: writeHaplotypes() has inconsistent signature between the declaration and definition.

https://github.com/odelaneau/shapeit5/blob/5680ff4ac9f726ba3445d24487fc024cc6f70c3e/phase_common/src/io/haplotype_writer.h#L46

https://github.com/odelaneau/shapeit5/blob/5680ff4ac9f726ba3445d24487fc024cc6f70c3e/phase_common/src/io/haplotype_writer.cpp#L39

This made it failed to build phase common tool.

$ make
g++ -std=c++17 -O3 -mavx2 -mfma -D__COMMIT_ID__=\"acda0f5\" -D__COMMIT_DATE__=\"2022-12-09\" -c src/io/haplotype_writer.cpp -o obj/haplotype_writer.o -Isrc -I/usr/local/include/htslib -I/usr/local/include
src/io/haplotype_writer.cpp:39:24: error: out-of-line definition of 'writeHaplotypes' does not match any declaration in 'haplotype_writer'
void haplotype_writer::writeHaplotypes(string fname, double filter_maf) {
                       ^~~~~~~~~~~~~~~
1 error generated.
make: *** [obj/haplotype_writer.o] Error 1

The git version is v1.0.0-beta-20-gacda0f5.

Maybe I missed something. Please let me know if there is a workaround for this. Thanks!

Best, Zhuoyi

zyhuang commented 1 year ago

Hi again,

I have a temporary fix for the issue above

diff --git a/phase_common/src/io/haplotype_writer.h b/phase_common/src/io/haplotype_writer.h
index ea0e3db..b0ad6fe 100644
--- a/phase_common/src/io/haplotype_writer.h
+++ b/phase_common/src/io/haplotype_writer.h
@@ -43,7 +43,7 @@ public:
        ~haplotype_writer();

        //IO
-       void writeHaplotypes(std::string foutput);
+       void writeHaplotypes(std::string foutput, double filter_maf);
 };

 #endif
diff --git a/phase_common/src/phaser/phaser_finalise.cpp b/phase_common/src/phaser/phaser_finalise.cpp
index f4fca41..fb0d2e9 100644
--- a/phase_common/src/phaser/phaser_finalise.cpp
+++ b/phase_common/src/phaser/phaser_finalise.cpp
@@ -38,7 +38,7 @@ void phaser::write_files_and_finalise() {

        //step1: writing best guess haplotypes in VCF/BCF file
        if (options.count("bingraph")) graph_writer(G, V).writeGraphs(options["bingraph"].as < std::string > ());
-       if (options.count("output")) haplotype_writer(H, G, V, options["thread"].as < int > ()).writeHaplotypes(options["output"].as < std::string > (), options["filter-maf"].as < std::string > ());
+       if (options.count("output")) haplotype_writer(H, G, V, options["thread"].as < int > ()).writeHaplotypes(options["output"].as < std::string > (), options["filter-maf"].as < double > ());

        //step2: Measure overall running time
        vrb.bullet("Total running time = " + stb.str(tac.abs_time()) + " seconds");

Please see if this is useful or there are better ways. Thanks!

Best, Zhuoyi

odelaneau commented 1 year ago

Thanks for reporting this. I've just fixed it. Sorry about it, it's a development code that went into the main branch for some reasons...