GWW / scsnv

scSNV Mapping tool for 10X Single Cell Data
MIT License
22 stars 4 forks source link

C++ compilation issue #3

Closed omansn closed 3 years ago

omansn commented 3 years ago

Hello, first off— this seems like a great tool. I've been working on collapsing UMI reads in 10x data and this is a much better implementation than I could have done. :)

I'm trying to install following your instructions in the README. I'm running into some errors during the make step.

It seems like this issue beings while compiling fasta.hpp. I don't know c++ but it looks to me like rs is being evaluated as both a function and a local variable in one line (line 125). I might be totally wrong about this, but I've included the error messages below.

Thanks!

In file included from /usr/include/c++/4.8.2/algorithm:62:0,
                 from /gpfs/ASDF/home/user/bin/scsnv/include/misc.hpp:30,
                 from /gpfs/ASDF/home/user/bin/scsnv/include/annotation.hpp:33,
                 from /gpfs/ASDF/home/user/bin/scsnv/include/gtf.hpp:24,
                 from /gpfs/ASDF/home/user/bin/scsnv/include/build.hpp:25,
                 from /gpfs/ASDF/home/user/bin/scsnv/src/build.cpp:23:
/usr/include/c++/4.8.2/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<gwsc::Fasta*, std::vector<gwsc::Fasta> >; _Tp = gwsc::Fasta; _Compare = gwsc::FastaReader::read_all(gwsc::Fastas&, bool)::__lambda4]’:
/usr/include/c++/4.8.2/bits/stl_algo.h:2296:78:   required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<gwsc::Fasta*, std::vector<gwsc::Fasta> >; _Compare = gwsc::FastaReader::read_all(gwsc::Fastas&, bool)::__lambda4]’
/usr/include/c++/4.8.2/bits/stl_algo.h:2337:62:   required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<gwsc::Fasta*, std::vector<gwsc::Fasta> >; _Size = long int; _Compare = gwsc::FastaReader::read_all(gwsc::Fastas&, bool)::__lambda4]’
/usr/include/c++/4.8.2/bits/stl_algo.h:5499:44:   required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<gwsc::Fasta*, std::vector<gwsc::Fasta> >; _Compare = gwsc::FastaReader::read_all(gwsc::Fastas&, bool)::__lambda4]’
/gpfs/ASDF/home/user/bin/scsnv/include/fasta.hpp:125:113:   required from here
/usr/include/c++/4.8.2/bits/stl_algo.h:2263:35: error: no match for call to ‘(gwsc::FastaReader::read_all(gwsc::Fastas&, bool)::__lambda4) (gwsc::Fasta&, const gwsc::Fasta&)’
    while (__comp(*__first, __pivot))
                                   ^
In file included from /gpfs/ASDF/home/user/bin/scsnv/include/build.hpp:26:0,
                 from /gpfs/ASDF/home/user/bin/scsnv/src/build.cpp:23:
/gpfs/ASDF/home/user/bin/scsnv/include/fasta.hpp:125:55: note: candidate is:
                 std::sort(fas.begin(), fas.end(), [&rs](Fasta & r1, Fasta & r2) { return rs(r1.name, r2.name); });
                                                       ^
/gpfs/ASDF/home/user/bin/scsnv/include/fasta.hpp:125:79: note: gwsc::FastaReader::read_all(gwsc::Fastas&, bool)::__lambda4
                 std::sort(fas.begin(), fas.end(), [&rs](Fasta & r1, Fasta & r2) { return rs(r1.name, r2.name); });
                                                                               ^
/gpfs/ASDF/home/user/bin/scsnv/include/fasta.hpp:125:79: note:   no known conversion for argument 2 from ‘const gwsc::Fasta’ to ‘gwsc::Fasta&’
In file included from /usr/include/c++/4.8.2/algorithm:62:0,
                 from /gpfs/ASDF/home/user/bin/scsnv/include/misc.hpp:30,
                 from /gpfs/ASDF/home/user/bin/scsnv/include/annotation.hpp:33,
                 from /gpfs/ASDF/home/user/bin/scsnv/include/gtf.hpp:24,
                 from /gpfs/ASDF/home/user/bin/scsnv/include/build.hpp:25,
                 from /gpfs/ASDF/home/user/bin/scsnv/src/build.cpp:23:
/usr/include/c++/4.8.2/bits/stl_algo.h:2266:34: error: no match for call to ‘(gwsc::FastaReader::read_all(gwsc::Fastas&, bool)::__lambda4) (const gwsc::Fasta&, gwsc::Fasta&)’
    while (__comp(__pivot, *__last))
                                  ^
In file included from /gpfs/ASDF/home/user/bin/scsnv/include/build.hpp:26:0,
                 from /gpfs/ASDF/home/user/bin/scsnv/src/build.cpp:23:
/gpfs/ASDF/home/user/bin/scsnv/include/fasta.hpp:125:55: note: candidate is:
                 std::sort(fas.begin(), fas.end(), [&rs](Fasta & r1, Fasta & r2) { return rs(r1.name, r2.name); });
                                                       ^
/gpfs/ASDF/home/user/bin/scsnv/include/fasta.hpp:125:79: note: gwsc::FastaReader::read_all(gwsc::Fastas&, bool)::__lambda4
                 std::sort(fas.begin(), fas.end(), [&rs](Fasta & r1, Fasta & r2) { return rs(r1.name, r2.name); });
                                                                               ^
/gpfs/ASDF/home/user/bin/scsnv/include/fasta.hpp:125:79: note:   no known conversion for argument 1 from ‘const gwsc::Fasta’ to ‘gwsc::Fasta&’
make[2]: *** [src/CMakeFiles/scsnvlib.dir/build.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/scsnvlib.dir/all] Error 2
make: *** [all] Error 2
GWW commented 3 years ago

Hi,

I am glad you are interested in my collapsing method. It took quite a lot of fiddling to get it to work properly with INDELs etc.

Could you share the version of gcc / g++ that you are using the compile the code? You can use g++ --version to find out.

The problem appears to be with a Lambda expression, which is likely due an outdated compiler version.

If you have conda available you could create a new environment with newer versions of gcc/g++ with that. After activating the environment delete the build folder and start the compilating again. I've used this method on a computational cluster that had very outdated compilers.

I just tested compiling again on a fresh ubuntu install using g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 without error. I've compiled it on OSX using clang as well.

omansn commented 3 years ago

Ah! easy fix. I tried again with GCC 9.2.0 and it worked fine. Thank you for the fast response!

GWW commented 3 years ago

Oh great no problem. Let me know if you have any questions with any of the data formats or bam tags. The documentation needs some work I just haven't found time to update it all.