EichlerLab / smrtsv2

Structural variant caller
MIT License
53 stars 6 forks source link

Accessing map value by index #29

Closed bioinfornatics closed 5 years ago

bioinfornatics commented 5 years ago

Dear, To my understanding, it seems you try to get a value by index using a map while a map is designed to get value by key. On my computer, this code does not build

Accessing map value by index on PrintCoverage.cp at line 59

moreover the makefile hardcode libdir cxfflags and so on ... while it seems they are some missing library to link as: libcurl libcrypto libbam ...

paudano commented 5 years ago

This is some of the oldest code left in the repository. It could use some work, but I have never updated it or its build process.

There is a binary included in the package, and nobody has needed to rebuild it. Does the binary coverage (same directory as the cpp) not work for you? Typically, you only need to build what's in dep (cd dep; make).

If you do need to compile it, you will probably need to set --std to an older standard depending on your GCC version.

bioinfornatics commented 5 years ago

Thanks @paudano to help on this old code. I need to rebuild it for two reasons

  1. our institute policy involved any tool to run on the cluster must be built from source
  2. I need to build with optimization enabled and link the binary to our libraries
  3. bamc binary is defined into the Makefile but the binary is not present

I tried to use std c++11 and c++98 with the same result

ERROR   smrtsv-2.0.0.87f346c: PrintCoverage.cpp:59:19: error: no match for 'operator[]' (operand types are 'std::map<std::__cxx11::basic_string<char>, std::vector<int> >' and 'int')
FINE    smrtsv-2.0.0.87f346c: coverage->counts[i-coverage->start] +=1;
FINE    smrtsv-2.0.0.87f346c: ^
INFO    smrtsv-2.0.0.87f346c: In file included from /somewhere/gcc-8.3.0/el6-x86_64-generic/include/c++/8/map:61,
INFO    smrtsv-2.0.0.87f346c: from PrintCoverage.cpp:8:
FINE    smrtsv-2.0.0.87f346c: /somewhere/gcc-8.3.0/el6-x86_64-generic/include/c++/8/bits/stl_map.h:490:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = std::vector<int>; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::vector<int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::__cxx11::basic_string<char>]'
FINE    smrtsv-2.0.0.87f346c: operator[](const key_type& __k)
FINE    smrtsv-2.0.0.87f346c: ^~~~~~~~
FINE    smrtsv-2.0.0.87f346c: /somewhere/gcc-8.3.0/el6-x86_64-generic/include/c++/8/bits/stl_map.h:490:7: note:   no known conversion for argument 1 from 'int' to 'const key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
FINE    smrtsv-2.0.0.87f346c: /somewhere/gcc-8.3.0/el6-x86_64-generic/include/c++/8/bits/stl_map.h:510:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = std::vector<int>; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::vector<int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::__cxx11::basic_string<char>]'
FINE    smrtsv-2.0.0.87f346c: operator[](key_type&& __k)
FINE    smrtsv-2.0.0.87f346c: ^~~~~~~~
FINE    smrtsv-2.0.0.87f346c: /somewhere/gcc-8.3.0/el6-x86_64-generic/include/c++/8/bits/stl_map.h:510:7: note:   no known conversion for argument 1 from 'int' to 'std::map<std::__cxx11::basic_string<char>, std::vector<int> >::key_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
INFO    smrtsv-2.0.0.87f346c: PrintCoverage.cpp: In function 'int main(int, char**)':
ERROR   smrtsv-2.0.0.87f346c: PrintCoverage.cpp:111:18: error: 'class std::map<std::__cxx11::basic_string<char>, std::vector<int> >' has no member named 'resize'; did you mean 'size'?
FINE    smrtsv-2.0.0.87f346c: coverage.counts.resize(tmp.end-tmp.beg,0);
FINE    smrtsv-2.0.0.87f346c: ^~~~~~
FINE    smrtsv-2.0.0.87f346c: size
WARNING smrtsv-2.0.0.87f346c: PrintCoverage.cpp:118:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::map<std::__cxx11::basic_string<char>, std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
FINE    smrtsv-2.0.0.87f346c: for (i = 0; i < coverage.counts.size(); i++) {
FINE    smrtsv-2.0.0.87f346c: ~~^~~~~~~~~~~~~~~~~~~~~~~~
ERROR   smrtsv-2.0.0.87f346c: PrintCoverage.cpp:119:52: error: no match for 'operator[]' (operand types are 'std::map<std::__cxx11::basic_string<char>, std::vector<int> >' and 'int')
paudano commented 5 years ago

I am going to try building it today, and I'll share process that works for me.

paudano commented 5 years ago

I got it to a certain point, but can't get all the dependent libraries. It's not linking bam, lzma, or curl libraries.

mcst.tar.gz

That is a set of notes and the revised Makefile I was using.

I don't know what versions of the libraries it was originally compiled against, so it's unclear if it will run after it is built. This might get you a little further, but there is more to work out.

bioinfornatics commented 5 years ago

thanks @paudano for your help