kingsfordgroup / sailfish

Rapid Mapping-based Isoform Quantification from RNA-Seq Reads
http://www.cs.cmu.edu/~ckingsf/software/sailfish
GNU General Public License v3.0
124 stars 45 forks source link

error: wrong number of template arguments #107

Open studident opened 6 years ago

studident commented 6 years ago

Using Cmake's make command on Sailfish following errors are returned:

/usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/include/SailfishIndex.hpp:125:66: error: wrong number of template arguments (1, should be 2) quasiIndex64_.reset(new RapMapSAIndex<int64_t>);

Can anyone suggest a way to resolve this?

rob-p commented 6 years ago

Hi @studident,

I anticipate that there will be difficulties building 0.7.6 from source. The reason is that there is an external dependency that doesn't have a properly tagged version (i.e. a version frozen with the interface used in 0.7.6). However, I was just able to successfully build the last tagged release (v0.10.0) from source after making a small modification to use a newer version of TBB (TBB's build, itself, seems to have some problems for older versions as Guillaume pointed out). Specifically, I replaced the ExternalProject_Add section for libtbb with the following:

ExternalProject_Add(libtbb
        DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external
        DOWNLOAD_COMMAND curl -k -L https://github.com/01org/tbb/archive/2017_U3.tar.gz -o tbb-2017_U3.tgz &&
                        tar -xzvf tbb-2017_U3.tgz
        ##
        #URL https://github.com/01org/tbb/archive/2017_U3.tar.gz
        #DOWNLOAD_NAME 2017_U3.tar.gz
        #URL_HASH SHA1=d6cf16a42ece60aad6a722b369e1a2aa753347b4
        #TLS_VERIFY FALSE
        ##
        SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/tbb-2017_U3
        INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install
        PATCH_COMMAND "${TBB_PATCH_STEP}"
        CONFIGURE_COMMAND ""
        BUILD_COMMAND make ${QUIET_MAKE} CXXFLAGS=${TBB_CXXFLAGS} lambdas=1 compiler=${TBB_COMPILER} cfg=release tbb_build_prefix=LIBS
        INSTALL_COMMAND sh -c "mkdir -p <INSTALL_DIR>/lib && cp <SOURCE_DIR>/build/LIBS_release/*.${SHARED_LIB_EXTENSION}* <INSTALL_DIR>/lib && cp -r <SOURCE_DIR>/include/* <INSTALL_DIR>/include"
        BUILD_IN_SOURCE 1
        )

SET( RECONFIG_FLAGS ${RECONFIG_FLAGS} -DTBB_WILL_RECONFIGURE=FALSE -DTBB_RECONFIGURE=TRUE)
ExternalProject_Add_Step(libtbb reconfigure
        COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR} ${RECONFIG_FLAGS}
        DEPENDEES install
        )

set (FETCHED_TBB TRUE)
endif()

Then, after cleaning the build directory, I was able to successfully build from source without any other modifications. I am using gcc 5.5.0:

$ g++ --version
g++ (Homebrew gcc 5.5.0_1) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and am running on ubuntu 16.10:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.10
Release:        16.10
Codename:       yakkety

Can you see if this build works for you?

studident commented 6 years ago

Hi Rob,

thanks for your answer. I'm a beginner and sadly didn't really understand the solution you proposed...

How exactly do I replace the ExternalProject_Add for litbb?

Sorry for the inconveniences. Just started this whole coding thing.

rob-p commented 6 years ago

Hi @studident,

Absolutely no need to apologize! The whole coding thing isn't easy, and Sailfish isn't a particularly simple piece of software to build. Anyway, a somewhat easier solution is to simply replace the file CMakeLists.txt in the top-level sailfish directory (for release v0.10.0) with the one I'm attaching here. It has exactly the modification I mention above. After that, the normal build process will hopefully work. Let me know if it gets you stuck at some other point.

Best, Rob

CMakeLists.txt

studident commented 6 years ago

Hi Rob,

thanks again. I copied the CMakeLists.txt file into my Sailfish folder. So I ran Cmake and Make again but ended up with more errors than before... Did I do it wrong?

I'm actually scared to paste it as the errors might fill pages. So this is an excerpt: /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/include/SailfishIndex.hpp:125:66: error: wrong number of template arguments (1, should be 2) quasiIndex64_.reset(new RapMapSAIndex<int64_t>); ^ In file included from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/src/SailfishIndexer.cpp:60:0: /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/rapmap/RapMapSAIndex.hpp:47:7: note: provided for ‘template<class IndexT, class HashT> class RapMapSAIndex’ class RapMapSAIndex { ^ In file included from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/src/SailfishIndexer.cpp:62:0: /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/include/SailfishIndex.hpp:126:39: error: base operand of ‘->’ is not a pointer if (!quasiIndex64_->load(indexStr)) { ^ /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/include/SailfishIndex.hpp:133:35: error: request for member ‘reset’ in ‘((SailfishIndex*)this)->SailfishIndex::quasiIndex32_’, which is of non-class type ‘int’ quasiIndex32_.reset(new RapMapSAIndex<int32_t>); ^ /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/include/SailfishIndex.hpp:133:66: error: wrong number of template arguments (1, should be 2) quasiIndex32_.reset(new RapMapSAIndex<int32_t>); ^ In file included from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/src/SailfishIndexer.cpp:60:0: /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/rapmap/RapMapSAIndex.hpp:47:7: note: provided for ‘template<class IndexT, class HashT> class RapMapSAIndex’ class RapMapSAIndex { ^ In file included from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/src/SailfishIndexer.cpp:62:0: /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/include/SailfishIndex.hpp:134:38: error: base operand of ‘->’ is not a pointer if(!quasiIndex32_->load(indexStr)) { ^ /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/src/SailfishIndexer.cpp: In function ‘int mainIndex(int, char**)’: /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/src/SailfishIndexer.cpp:106:18: warning: unused variable ‘numThreads’ [-Wunused-variable] uint32_t numThreads = vm["threads"].as<uint32_t>(); ^ /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/src/SailfishIndexer.cpp:71:10: warning: unused variable ‘useStreamingParser’ [-Wunused-variable] bool useStreamingParser = false; ^ In file included from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/system/system_error.hpp:14:0, from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/thread/exceptions.hpp:22, from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/thread/pthread/thread_data.hpp:10, from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/thread/thread_only.hpp:17, from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/thread/thread.hpp:12, from /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/src/SailfishIndexer.cpp:23: /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/system/error_code.hpp: At global scope: /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/system/error_code.hpp:221:36: warning: ‘boost::system::posix_category’ defined but not used [-Wunused-variable] static const error_category & posix_category = generic_category(); ^ /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/system/error_code.hpp:222:36: warning: ‘boost::system::errno_ecat’ defined but not used [-Wunused-variable] static const error_category & errno_ecat = generic_category(); ^ /usr/tools/SailfishBeta-0.7.6_Linux-x86-64/bin/sailfish/external/install/include/boost/system/error_code.hpp:223:36: warning: ‘boost::system::native_ecat’ defined but not used [-Wunused-variable] static const error_category & native_ecat = system_category(); ^ cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-register’

So sorry but I hope you can take a look when you find the time.

rob-p commented 6 years ago

Hi @studident,

It seems you are still trying to compile the older version. Can you try the following?

$ wget https://github.com/kingsfordgroup/sailfish/archive/v0.10.0.tar.gz -O sailfish-v0.10.0.tar.gz
$ tar xzvf sailfish-v0.10.0.tar.gz
$ cd sailfish-0.10.0
$ wget https://github.com/kingsfordgroup/sailfish/files/1735026/CMakeLists.txt -O CMakeLists.txt
$ mkdir build
$ cd build
$ cmake ..
$ make

This should be the process required to try and build the latest release from source on your system. Can you let me know if that works (or at least gives you a different error)? If it's not successful, can you tell me what compiler and version of linux you have? You can check the compiler version with $ c++ --version.

Thanks, Rob

studident commented 6 years ago

Hi Rob,

I started from scratch and now the code ran all the way through with one error left:

CMakeFiles/libboost.dir/build.make:119: recipe for target 'libboost-prefix/src/libboost-stamp/libboost-reconfigure' failed

Any way to fix this?

PS: My compiler version:

c++ (Ubuntu 5.4.0-6ubuntu1~16.04.6) 5.4.0 20160609

studident commented 6 years ago

I don't know exactly why but I accidentally repeated the make step and it gave me another error:

make[2]: *** No rule to make target 'src/CMakeFiles/sailfish_core.dir/build'. Stop. make[2]: Leaving directory '/usr/tools' CMakeFiles/Makefile2:240: recipe for target 'src/CMakeFiles/sailfish_core.dir/all' failed make[1]: *** [src/CMakeFiles/sailfish_core.dir/all] Error 2 make[1]: Leaving directory '/usr/tools' Makefile:163: recipe for target 'all' failed make: *** [all] Error 2

Now I'm a bit confused as it seems like the previous error has disappeared?

studident commented 6 years ago

Hi Rob,

I'm finally done, all errors are gone and installation went smoothly. make test resulted in passed tests.

Nevertheless, I'm missing the sailfish command, so I can't build my index. Am I missing something?

Best, Steve

rob-p commented 6 years ago

Hi Steve,

Great; I'm glad to hear you passed all of the hurdles of building Sailfish. The last problem should be easy to solve. When you issue a command from your command line in an "unqualified" way (i.e., without giving the full path to the file), linux looks for the command in a set of directories that is specified by the PATH variable. So, you need to add the sailfish binary path to your PATH variable. If you did make install at the end of your build, then you can do the following:

$ export PATH=<path_to_sailfish>/bin:$PATH

where <path_to_sailfish> is the full path to the top-level directory where you unzipped Sailfish. This will put it in your path in the current session. After that, you should be able to simply type sailfish from the command line. The only remaining issue is that modifications of the PATH variable made interactively only affect the current session (i.e. they will be gone when you log out and log back in). Fortunately, you can add this command to your login script to execute each time you login. Normally, this script is in your home directory and is called either ~/.profile or ~/.bashrc. You can add the line PATH=<path_to_sailfish>/bin:$PATH to always have Sailfish in your path when you log in.

Best, Rob

studident commented 6 years ago

Hi Rob,

this is awesome support here. Thank you so much!

Indexing tells me that Sailfish couldn't resolve upgrade information in the alotted time. Nevertheless, indexing runs through.

By the way, can you specify how the -k parameter works? It tells me -k must not be larger than 31; how would I use the parameter for a longer read?

Also in the quantification step it tells me that sailfish quant was invoked improperly. It's asking for a file named versionInfo.json and tells me to re-build the index, although the indexing step didn't give me any errors.

Just to make sure how to use the quant function, let's say I have a file named "knownGene.fasta". I indexed this file with sailfish index and is this also what I use in the quant function as unmated read?

Just assuming that I did it right, it tells me to file a bug report on GitHub:

[2018-02-19 10:17:48.370] [jointLog] [error] It seems that no transcripts are expressed; something is likely wrong! [2018-02-19 10:17:48.370] [jointLog] [error] Encountered error during optimization. This should not happen. Please file a bug report on GitHub.

Best, Steve

rob-p commented 6 years ago

Hi Steve,

I'm glad to hear you're able to get things to run now! To address your questions; the size of k doesn't make too much of a difference compared to the read length. Generally, one would like k < half the read length. These are just used for seed in mapping, and longer range information can be recovered.

The fact that it can't find the versionInfo.json file is strange. Can you do an ls on the directory where the index is contained and let me know what files are there?

Regarding the last question, if "knownGene.fasta" is the file you indexed, then you do not have to pass it to quant. The index contains the relevant information about the reference transcripts. During quantification, you pass the index you built and the read files. If you have single end reads, then you pass that in as the "unmated" read file. On the other hand, if you have paired end reads, you pass them to Sailfish as the left and right read files -1 and -2.

--Rob

studident commented 6 years ago

Hi Rob,

thanks again for being patient with me. I could fix the problem with versionInfo.json; I had a typo in my path...

This might be a dumb question but could you check following code? Let's assume I have following files:

knownGene.fasta test1.fastq test2.fastq

The line to index would be:

sailfish index -t knownGene.fasta -o . -k 9

And for quantification it would be:

sailfish quant -i . -l ISF -r knownGene.fasta -1 test1.fastq -2 test2.fastq -o .

Is this correct?

rob-p commented 6 years ago

Hi Steve,

No worries. I'm glad you got the index issue resolved. So, your indexing command looks OK, though I'd typically suggest giving the index a descriptive name, so something like

sailfish index -t knownGene.fasta -o knownGene.idx -k <KPARAM>

Generally, I would not recommend indexing with a k value as small as 9. The default is 31, and should be suitable for reads >= 75bp. I you have 50bp or shorter reads, then I'd probably go with k=23 or k=25. However, there's no real benefit in going shorter than that.

For quantification, assuming you used the index location (I.e. -o) as given above, the command would be:

sailfish quant -i knownGene.idx -l ISF -1 test1.fastq -2 test2.fastq -o test_quant

Note that this differs from your command in that I do not provide knownGene.fasta to sailfish via the -r flag. This is because the reference has already been indexed, and all relevant information is contained in knownGene.idx. In my command above, I also gave a different output folder name test_quant, as it makes things a bit cleaner. After this run, test_quant will contain (among others) a file called quant.sf with the output quantifications.

Best, Rob

studident commented 6 years ago

Hi Rob,

sorry been busy in lab and couldn't get back to you. I adjusted my code according to your suggestions and it works like a charm.

Are you by chance familiar with Java threading as well and would let me ask some questions?

Best, Steve