├── include ├── eigen3 │ ├── Eigen │ │ ├── Eigen │ │ ├── src │ │ │ ├── Core │ │ │ │ ├── util │ │ │ │ │ ├── NonMPL2.h │ │ │ │ │ ├── ReenableStupidWarnings.h │ │ │ │ │ └── DisableStupidWarnings.h │ │ │ │ ├── arch │ │ │ │ │ └── Default │ │ │ │ │ │ └── Settings.h │ │ │ │ └── CoreIterators.h │ │ │ ├── Eigen2Support │ │ │ │ ├── Macros.h │ │ │ │ ├── TriangularSolver.h │ │ │ │ ├── Memory.h │ │ │ │ ├── QR.h │ │ │ │ ├── Lazy.h │ │ │ │ └── MathFunctions.h │ │ │ ├── SparseCore │ │ │ │ ├── SparseFuzzy.h │ │ │ │ ├── SparseRedux.h │ │ │ │ └── SparseTranspose.h │ │ │ ├── plugins │ │ │ │ ├── CommonCwiseBinaryOps.h │ │ │ │ └── MatrixCwiseUnaryOps.h │ │ │ ├── SparseLU │ │ │ │ └── SparseLU_Utils.h │ │ │ ├── misc │ │ │ │ └── Solve.h │ │ │ └── Householder │ │ │ │ └── BlockHouseholder.h │ │ ├── Dense │ │ ├── Array │ │ ├── Householder │ │ ├── Sparse │ │ ├── Jacobi │ │ ├── StdList │ │ ├── QtAlignedMalloc │ │ ├── MetisSupport │ │ ├── LeastSquares │ │ ├── StdDeque │ │ ├── StdVector │ │ ├── Cholesky │ │ ├── PardisoSupport │ │ ├── SVD │ │ ├── SPQRSupport │ │ ├── QR │ │ ├── SparseQR │ │ ├── LU │ │ ├── UmfPackSupport │ │ ├── Eigenvalues │ │ ├── SparseCholesky │ │ ├── PaStiXSupport │ │ ├── IterativeLinearSolvers │ │ ├── Geometry │ │ ├── CholmodSupport │ │ ├── SparseLU │ │ ├── SparseCore │ │ ├── SuperLUSupport │ │ └── OrderingMethods │ ├── signature_of_eigen3_matrix_library │ └── unsupported │ │ └── Eigen │ │ ├── MoreVectorization │ │ ├── Splines │ │ ├── KroneckerProduct │ │ ├── Skyline │ │ ├── AutoDiff │ │ ├── src │ │ ├── NonLinearOptimization │ │ │ ├── r1mpyq.h │ │ │ ├── rwupdt.h │ │ │ ├── chkder.h │ │ │ ├── covar.h │ │ │ └── fdjac1.h │ │ ├── MatrixFunctions │ │ │ └── StemFunction.h │ │ └── AutoDiff │ │ │ └── AutoDiffJacobian.h │ │ ├── LevenbergMarquardt │ │ ├── IterativeSolvers │ │ ├── SparseExtra │ │ └── NumericalDiff ├── IOUtils.hpp ├── MicroOpts.hpp ├── spdlog │ ├── details │ │ ├── null_mutex.h │ │ ├── log_msg.h │ │ └── async_logger_impl.h │ ├── sinks │ │ ├── sink.h │ │ ├── null_sink.h │ │ ├── base_sink.h │ │ ├── ostream_sink.h │ │ ├── stdout_sinks.h │ │ ├── dist_sink.h │ │ ├── syslog_sink.h │ │ └── android_sink.h │ ├── formatter.h │ ├── common.h │ ├── tweakme.h │ └── async_logger.h ├── cereal │ ├── external │ │ ├── rapidjson │ │ │ ├── internal │ │ │ │ ├── strfunc.h │ │ │ │ └── stack.h │ │ │ ├── license.txt │ │ │ ├── filestream.h │ │ │ └── stringbuffer.h │ │ └── rapidxml │ │ │ └── license.txt │ └── types │ │ ├── utility.hpp │ │ ├── complex.hpp │ │ ├── list.hpp │ │ └── deque.hpp ├── SailfishSpinLock.hpp ├── cuckoohash_config.hh ├── SailfishConfig.hpp ├── CommonTypes.hpp ├── TranscriptGroup.hpp ├── SailfishOpts.hpp ├── GZipWriter.hpp ├── VersionChecker.hpp ├── ReadKmerDist.hpp ├── SailfishMath.hpp ├── EmpiricalDistribution.hpp ├── SailfishIndexVersionInfo.hpp └── cuckoohash_util.hh ├── qimage.001.png ├── external └── rapmap.zip ├── benchmark ├── mem_bench.png ├── time_bench.png ├── only_quark.stat └── quark.stat ├── Mince-Binaries-0.6.1 ├── .DS_Store ├── mince_mac ├── libtbb.so.2 ├── mince_linux ├── canoncmp_linux ├── canoncmp_mac ├── libtbb.dylib ├── mergepairs_mac ├── canonicalize_mac ├── mergepairs_linux ├── canonicalize_linux ├── libtbbmalloc.dylib ├── libjellyfish-2.0.2.dylib ├── libtbbmalloc_proxy.dylib └── testEncodeDecode.sh ├── cmake ├── UnitTests.cmake ├── TestSalmon.cmake ├── PostInstall.cmake ├── SimpleTest.cmake └── Modules │ ├── FindTcmalloc.cmake │ └── FindJemalloc.cmake ├── tests └── UnitTests.cpp ├── check_pair.sh ├── src ├── SailfishStringUtils.cpp ├── TranscriptGroup.cpp ├── FASTAParser.cpp └── TestUtils.cpp ├── scripts ├── cpld.bash ├── compile.sh ├── AddHeaders.sh ├── fetchRapMap.sh ├── ComputeMutationRate.py ├── make-release.sh ├── push-binary.sh └── MutateReference.py ├── .gitignore ├── runquark.sh ├── README.md └── batchquark.snake /include/eigen3/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /qimage.001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/qimage.001.png -------------------------------------------------------------------------------- /external/rapmap.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/external/rapmap.zip -------------------------------------------------------------------------------- /benchmark/mem_bench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/benchmark/mem_bench.png -------------------------------------------------------------------------------- /benchmark/time_bench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/benchmark/time_bench.png -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/.DS_Store -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/mince_mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/mince_mac -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/libtbb.so.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/libtbb.so.2 -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/mince_linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/mince_linux -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/canoncmp_linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/canoncmp_linux -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/canoncmp_mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/canoncmp_mac -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/libtbb.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/libtbb.dylib -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/mergepairs_mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/mergepairs_mac -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/canonicalize_mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/canonicalize_mac -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/mergepairs_linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/mergepairs_linux -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/canonicalize_linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/canonicalize_linux -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/libtbbmalloc.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/libtbbmalloc.dylib -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/libjellyfish-2.0.2.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/libjellyfish-2.0.2.dylib -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/libtbbmalloc_proxy.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/quark/HEAD/Mince-Binaries-0.6.1/libtbbmalloc_proxy.dylib -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /include/eigen3/signature_of_eigen3_matrix_library: -------------------------------------------------------------------------------- 1 | This file is just there as a signature to help identify directories containing Eigen3. When writing a script looking for Eigen3, just look for this file. This is especially useful to help disambiguate with Eigen2... 2 | -------------------------------------------------------------------------------- /include/IOUtils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef IO_UTILS 2 | #define IO_UTILS 3 | 4 | #include 5 | #include 6 | 7 | namespace ioutils{ 8 | 9 | const char RESET_COLOR[] = "\x1b[0;0m"; 10 | const char SET_GREEN[] = "\x1b[0;32m"; 11 | const char SET_RED[] = "\x1b[0;31m"; 12 | 13 | } 14 | 15 | #endif // IO_UTILS 16 | -------------------------------------------------------------------------------- /cmake/UnitTests.cmake: -------------------------------------------------------------------------------- 1 | set(TEST_COMMAND ${TOPLEVEL_DIR}/tests/unitTests) 2 | execute_process(COMMAND ${TEST_COMMAND} 3 | WORKING_DIRECTORY ${TOPLEVEL_DIR}/tests 4 | RESULT_VARIABLE UNIT_TEST_RESULT 5 | ) 6 | if (UNIT_TEST_RESULT) 7 | message(FATAL_ERROR "Error running ${UNIT_TEST_RESULT}") 8 | endif() 9 | 10 | 11 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/Array: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ARRAY_MODULE_H 2 | #define EIGEN_ARRAY_MODULE_H 3 | 4 | // include Core first to handle Eigen2 support macros 5 | #include "Core" 6 | 7 | #ifndef EIGEN2_SUPPORT 8 | #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. 9 | #endif 10 | 11 | #endif // EIGEN_ARRAY_MODULE_H 12 | -------------------------------------------------------------------------------- /tests/UnitTests.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file 2 | #include 3 | #include 4 | #include "catch.hpp" 5 | #include "LibraryFormat.hpp" 6 | #include "SailfishUtils.hpp" 7 | 8 | bool verbose=false; // Apparently, we *need* this (OSX) 9 | 10 | #include "LibraryTypeTests.cpp" 11 | #include "KmerHistTests.cpp" 12 | -------------------------------------------------------------------------------- /include/MicroOpts.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MICROOPTS_HPP 2 | #define MICROOPTS_HPP 3 | 4 | /** Based on Likely.h from FB's Folly library **/ 5 | 6 | #undef LIKELY 7 | #undef UNLIKELY 8 | 9 | #if defined(__GUNC__) && __GNUC__ >= 4 10 | #define LIKELY(X) (__builtin_expect((x), 1)) 11 | #define UNLIKELY(X) (__builtin_expect((x), 0)) 12 | #elif defined(__clang__) 13 | 14 | 15 | 16 | #endif // MICROOPTS_HPP 17 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #endif 12 | #endif 13 | 14 | #endif // EIGEN_WARNINGS_DISABLED 15 | -------------------------------------------------------------------------------- /include/spdlog/details/null_mutex.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // null, no cost mutex 9 | 10 | namespace spdlog 11 | { 12 | namespace details 13 | { 14 | struct null_mutex 15 | { 16 | void lock() {} 17 | void unlock() {} 18 | bool try_lock() 19 | { 20 | return true; 21 | } 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /include/spdlog/sinks/sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | 7 | #pragma once 8 | 9 | #include "../details/log_msg.h" 10 | 11 | namespace spdlog 12 | { 13 | namespace sinks 14 | { 15 | class sink 16 | { 17 | public: 18 | virtual ~sink() {} 19 | virtual void log(const details::log_msg& msg) = 0; 20 | virtual void flush() = 0; 21 | }; 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /check_pair.sh: -------------------------------------------------------------------------------- 1 | ORI1="$1" 2 | ORI2="$2" 3 | 4 | Q1="$3" 5 | Q2="$4" 6 | 7 | paste <(gunzip -c $ORI1) <(gunzip -c $ORI2) \ 8 | | gawk 'BEGIN {n=0} {if(n++ % 4 == 1) print $0}' \ 9 | | sort > original.seq 10 | 11 | paste $Q1 $Q2 \ 12 | | gawk 'BEGIN {n=0} {if(n++ % 4 == 1) print $0}' \ 13 | | sort > quark.seq 14 | 15 | cmp original.seq quark.seq 16 | if [ ${?} -eq 0 ] ; then 17 | echo "Looks ok; deleting files" 18 | rm original.seq 19 | rm quark.seq 20 | fi 21 | -------------------------------------------------------------------------------- /src/SailfishStringUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "SailfishStringUtils.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | uint8_t* sailfish::stringtools::encodeSequenceInSAM(const char* src, size_t len) { 7 | uint8_t* target = new uint8_t[static_cast(ceil(len / 2.0))](); 8 | for(size_t i = 0; i < len; ++i) { 9 | size_t byte = i >> 1; 10 | size_t nibble = i & 0x1; 11 | if (nibble) { 12 | target[byte] |= charToSamEncode[src[i]]; 13 | } else { 14 | target[byte] |= (charToSamEncode[src[i]] << 4); 15 | } 16 | } 17 | return target; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/Householder: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 2 | #define EIGEN_HOUSEHOLDER_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Householder_Module Householder module 9 | * This module provides Householder transformations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | */ 15 | 16 | #include "src/Householder/Householder.h" 17 | #include "src/Householder/HouseholderSequence.h" 18 | #include "src/Householder/BlockHouseholder.h" 19 | 20 | #include "src/Core/util/ReenableStupidWarnings.h" 21 | 22 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 23 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 24 | -------------------------------------------------------------------------------- /include/spdlog/sinks/null_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | #include 8 | #include "./base_sink.h" 9 | #include "../details/null_mutex.h" 10 | 11 | 12 | namespace spdlog 13 | { 14 | namespace sinks 15 | { 16 | 17 | template 18 | class null_sink : public base_sink < Mutex > 19 | { 20 | protected: 21 | void _sink_it(const details::log_msg&) override 22 | {} 23 | 24 | void flush() override 25 | {} 26 | 27 | }; 28 | typedef null_sink null_sink_st; 29 | typedef null_sink null_sink_mt; 30 | 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSE_MODULE_H 2 | #define EIGEN_SPARSE_MODULE_H 3 | 4 | /** \defgroup Sparse_Module Sparse meta-module 5 | * 6 | * Meta-module including all related modules: 7 | * - \ref SparseCore_Module 8 | * - \ref OrderingMethods_Module 9 | * - \ref SparseCholesky_Module 10 | * - \ref SparseLU_Module 11 | * - \ref SparseQR_Module 12 | * - \ref IterativeLinearSolvers_Module 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "SparseCore" 20 | #include "OrderingMethods" 21 | #include "SparseCholesky" 22 | #include "SparseLU" 23 | #include "SparseQR" 24 | #include "IterativeLinearSolvers" 25 | 26 | #endif // EIGEN_SPARSE_MODULE_H 27 | 28 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/MoreVectorization: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_MOREVECTORIZATION_MODULE_H 10 | #define EIGEN_MOREVECTORIZATION_MODULE_H 11 | 12 | #include 13 | 14 | namespace Eigen { 15 | 16 | /** 17 | * \defgroup MoreVectorization More vectorization module 18 | */ 19 | 20 | } 21 | 22 | #include "src/MoreVectorization/MathFunctions.h" 23 | 24 | #endif // EIGEN_MOREVECTORIZATION_MODULE_H 25 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Eigen2Support/Macros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MACROS_H 11 | #define EIGEN2_MACROS_H 12 | 13 | #define ei_assert eigen_assert 14 | #define ei_internal_assert eigen_internal_assert 15 | 16 | #define EIGEN_ALIGN_128 EIGEN_ALIGN16 17 | 18 | #define EIGEN_ARCH_WANTS_ALIGNMENT EIGEN_ALIGN_STATICALLY 19 | 20 | #endif // EIGEN2_MACROS_H 21 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_JACOBI_MODULE_H 2 | #define EIGEN_JACOBI_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Jacobi_Module Jacobi module 9 | * This module provides Jacobi and Givens rotations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | * 15 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 16 | * - MatrixBase::applyOnTheLeft() 17 | * - MatrixBase::applyOnTheRight(). 18 | */ 19 | 20 | #include "src/Jacobi/Jacobi.h" 21 | 22 | #include "src/Core/util/ReenableStupidWarnings.h" 23 | 24 | #endif // EIGEN_JACOBI_MODULE_H 25 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 26 | 27 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | 2 | #ifndef EIGEN_QTMALLOC_MODULE_H 3 | #define EIGEN_QTMALLOC_MODULE_H 4 | 5 | #include "Core" 6 | 7 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 8 | 9 | #include "src/Core/util/DisableStupidWarnings.h" 10 | 11 | void *qMalloc(size_t size) 12 | { 13 | return Eigen::internal::aligned_malloc(size); 14 | } 15 | 16 | void qFree(void *ptr) 17 | { 18 | Eigen::internal::aligned_free(ptr); 19 | } 20 | 21 | void *qRealloc(void *ptr, size_t size) 22 | { 23 | void* newPtr = Eigen::internal::aligned_malloc(size); 24 | memcpy(newPtr, ptr, size); 25 | Eigen::internal::aligned_free(ptr); 26 | return newPtr; 27 | } 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif 32 | 33 | #endif // EIGEN_QTMALLOC_MODULE_H 34 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 35 | -------------------------------------------------------------------------------- /include/cereal/external/rapidjson/internal/strfunc.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_INTERNAL_STRFUNC_H_ 2 | #define RAPIDJSON_INTERNAL_STRFUNC_H_ 3 | 4 | namespace rapidjson { 5 | namespace internal { 6 | 7 | //! Custom strlen() which works on different character types. 8 | /*! \tparam Ch Character type (e.g. char, wchar_t, short) 9 | \param s Null-terminated input string. 10 | \return Number of characters in the string. 11 | \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints. 12 | */ 13 | template 14 | inline SizeType StrLen(const Ch* s) { 15 | const Ch* p = s; 16 | while (*p != '\0') 17 | ++p; 18 | return SizeType(p - s); 19 | } 20 | 21 | } // namespace internal 22 | } // namespace rapidjson 23 | 24 | #endif // RAPIDJSON_INTERNAL_STRFUNC_H_ 25 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_METISSUPPORT_MODULE_H 2 | #define EIGEN_METISSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | 13 | /** \ingroup Support_modules 14 | * \defgroup MetisSupport_Module MetisSupport module 15 | * 16 | * \code 17 | * #include 18 | * \endcode 19 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 20 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 21 | */ 22 | 23 | 24 | #include "src/MetisSupport/MetisSupport.h" 25 | 26 | #include "src/Core/util/ReenableStupidWarnings.h" 27 | 28 | #endif // EIGEN_METISSUPPORT_MODULE_H 29 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/LeastSquares: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_REGRESSION_MODULE_H 2 | #define EIGEN_REGRESSION_MODULE_H 3 | 4 | #ifndef EIGEN2_SUPPORT 5 | #error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) 6 | #endif 7 | 8 | // exclude from normal eigen3-only documentation 9 | #ifdef EIGEN2_SUPPORT 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Eigenvalues" 16 | #include "Geometry" 17 | 18 | /** \defgroup LeastSquares_Module LeastSquares module 19 | * This module provides linear regression and related features. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/Eigen2Support/LeastSquares.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN2_SUPPORT 31 | 32 | #endif // EIGEN_REGRESSION_MODULE_H 33 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /scripts/cpld.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Author : Hemanth.HM 3 | # Email : hemanth[dot]hm[at]gmail[dot]com 4 | # License : GNU GPLv3 5 | # 6 | 7 | function useage() 8 | { 9 | cat << EOU 10 | Useage: bash $0 11 | EOU 12 | exit 1 13 | } 14 | 15 | #Validate the inputs 16 | [[ $# < 2 ]] && useage 17 | 18 | #Check if the paths are vaild 19 | [[ ! -e $1 ]] && echo "Not a vaild input $1" && exit 1 20 | [[ -d $2 ]] || echo "No such directory $2 creating..."&& mkdir -p "$2" 21 | 22 | #Get the library dependencies 23 | echo "Collecting the shared library dependencies for $1..." 24 | deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/') 25 | echo "Copying the dependencies to $2" 26 | 27 | #Copy the deps 28 | for dep in $deps 29 | do 30 | echo "Copying $dep to $2" 31 | cp "$dep" "$2" 32 | done 33 | 34 | echo "Done!" 35 | 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | sailfish/build/CMakeCache.txt sailfish/build/cmake_install.cmake sailfish/build/CPackConfig.cmake sailfish/build/CPackSourceConfig.cmake sailfish/build/CTestTestfile.cmake 2 | sailfish/external/jellyfish-2.2.3 sailfish/external/jellyfish-2.2.3.tgz sailfish/external/libdivsufsort.zip sailfish/external/libgff.tgz sailfish/external/rapmap.zip sailfish/external/sparsehash-2.0.2.tar.gz sailfish/external/sparsehash-sparsehash-2.0.2 sailfish/external/tbb_20140724oss_src.tgz 3 | sailfish/external/install sailfish/external/jellyfish-2.2.3 sailfish/external/jellyfish-2.2.3.tgz sailfish/external/libdivsufsort-master sailfish/external/libdivsufsort.zip sailfish/external/libgff sailfish/external/libgff.tgz sailfish/external/RapMap sailfish/external/rapmap.zip sailfish/external/sparsehash-2.0.2.tar.gz sailfish/external/sparsehash-sparsehash-2.0.2 sailfish/external/tbb_20140724oss_src.tgz sailfish/external/tbb43_20140724oss 4 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLESKY_MODULE_H 2 | #define EIGEN_CHOLESKY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Cholesky_Module Cholesky module 9 | * 10 | * 11 | * 12 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 13 | * Those decompositions are accessible via the following MatrixBase methods: 14 | * - MatrixBase::llt(), 15 | * - MatrixBase::ldlt() 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | */ 21 | 22 | #include "src/misc/Solve.h" 23 | #include "src/Cholesky/LLT.h" 24 | #include "src/Cholesky/LDLT.h" 25 | #ifdef EIGEN_USE_LAPACKE 26 | #include "src/Cholesky/LLT_MKL.h" 27 | #endif 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_CHOLESKY_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | -------------------------------------------------------------------------------- /scripts/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | branch=$1 5 | version=$2 6 | 7 | echo "Building sailfish [branch = ${branch}]. Tagging version as ${version}" 8 | 9 | # Activate Holy Build Box environment. 10 | source /hbb_exe/activate 11 | 12 | set -x 13 | 14 | # Install things we need 15 | yum install -y --quiet wget 16 | wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm 17 | rpm -i --quiet epel-release-5-4.noarch.rpm 18 | #yum install -y --quiet git 19 | yum install -y --quiet unzip 20 | yum install -y --quiet bzip2-devel.x86_64 21 | 22 | curl -k -L https://github.com/kingsfordgroup/sailfish/archive/${branch}.zip -o ${branch}.zip 23 | unzip ${branch}.zip 24 | mv sailfish-${branch} sailfish 25 | cd sailfish 26 | mkdir build 27 | cd build 28 | cmake -DFETCH_BOOST=TRUE .. 29 | make 30 | make install 31 | make test 32 | cd ../scripts 33 | bash make-release.sh -v ${version} -n CentOS5 34 | cd ../RELEASES 35 | cp *.tar.gz /io/ 36 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 2 | #define EIGEN_PARDISOSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | 10 | #include 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup PardisoSupport_Module PardisoSupport module 14 | * 15 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 22 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 23 | * 24 | */ 25 | 26 | #include "src/PardisoSupport/PardisoSupport.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 31 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/SVD: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SVD_MODULE_H 2 | #define EIGEN_SVD_MODULE_H 3 | 4 | #include "QR" 5 | #include "Householder" 6 | #include "Jacobi" 7 | 8 | #include "src/Core/util/DisableStupidWarnings.h" 9 | 10 | /** \defgroup SVD_Module SVD module 11 | * 12 | * 13 | * 14 | * This module provides SVD decomposition for matrices (both real and complex). 15 | * This decomposition is accessible via the following MatrixBase method: 16 | * - MatrixBase::jacobiSvd() 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/SVD/JacobiSVD.h" 25 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 26 | #include "src/SVD/JacobiSVD_MKL.h" 27 | #endif 28 | #include "src/SVD/UpperBidiagonalization.h" 29 | 30 | #ifdef EIGEN2_SUPPORT 31 | #include "src/Eigen2Support/SVD.h" 32 | #endif 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_SVD_MODULE_H 37 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 38 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/Splines: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 20010-2011 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPLINES_MODULE_H 11 | #define EIGEN_SPLINES_MODULE_H 12 | 13 | namespace Eigen 14 | { 15 | /** 16 | * \defgroup Splines_Module Spline and spline fitting module 17 | * 18 | * This module provides a simple multi-dimensional spline class while 19 | * offering most basic functionality to fit a spline to point sets. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | } 26 | 27 | #include "src/Splines/SplineFwd.h" 28 | #include "src/Splines/Spline.h" 29 | #include "src/Splines/SplineFitting.h" 30 | 31 | #endif // EIGEN_SPLINES_MODULE_H 32 | -------------------------------------------------------------------------------- /include/SailfishSpinLock.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __SPIN_LOCK_HPP__ 2 | #define __SPIN_LOCK_HPP__ 3 | 4 | #include 5 | 6 | /** 7 | * since std::mutex is *VERY SLOW* on OSX, we use 8 | * this there instead. 9 | * Taken from (http://stackoverflow.com/questions/22899053/why-is-stdmutex-so-slow-on-osx) 10 | */ 11 | class spin_lock { 12 | std::atomic _lock; 13 | public: 14 | spin_lock(const spin_lock&) = delete; 15 | spin_lock& operator=(const spin_lock&) = delete; 16 | 17 | spin_lock() : _lock(false) {} 18 | 19 | class scoped_lock { 20 | spin_lock &_lock; 21 | 22 | public: 23 | scoped_lock(const scoped_lock&) = delete; 24 | scoped_lock& operator=(const scoped_lock&) = delete; 25 | 26 | scoped_lock(spin_lock &lock) : _lock(lock) { 27 | bool expect = false; 28 | while (!_lock._lock.compare_exchange_weak(expect, true)) { 29 | expect = false; 30 | } 31 | } 32 | ~scoped_lock() { 33 | _lock._lock = false; 34 | } 35 | }; 36 | }; 37 | 38 | #endif // __SPIN_LOCK_HPP__ 39 | -------------------------------------------------------------------------------- /include/spdlog/formatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "details/log_msg.h" 9 | namespace spdlog 10 | { 11 | namespace details 12 | { 13 | class flag_formatter; 14 | } 15 | 16 | class formatter 17 | { 18 | public: 19 | virtual ~formatter() {} 20 | virtual void format(details::log_msg& msg) = 0; 21 | }; 22 | 23 | class pattern_formatter : public formatter 24 | { 25 | 26 | public: 27 | explicit pattern_formatter(const std::string& pattern); 28 | pattern_formatter(const pattern_formatter&) = delete; 29 | pattern_formatter& operator=(const pattern_formatter&) = delete; 30 | void format(details::log_msg& msg) override; 31 | private: 32 | const std::string _pattern; 33 | std::vector> _formatters; 34 | void handle_flag(char flag); 35 | void compile_pattern(const std::string& pattern); 36 | }; 37 | } 38 | 39 | #include "details/pattern_formatter_impl.h" 40 | 41 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/KroneckerProduct: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_KRONECKER_PRODUCT_MODULE_H 10 | #define EIGEN_KRONECKER_PRODUCT_MODULE_H 11 | 12 | #include "../../Eigen/Core" 13 | 14 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 15 | 16 | namespace Eigen { 17 | 18 | /** 19 | * \defgroup KroneckerProduct_Module KroneckerProduct module 20 | * 21 | * This module contains an experimental Kronecker product implementation. 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | } // namespace Eigen 29 | 30 | #include "src/KroneckerProduct/KroneckerTensorProduct.h" 31 | 32 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 33 | 34 | #endif // EIGEN_KRONECKER_PRODUCT_MODULE_H 35 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 2 | #define EIGEN_SPQRSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SuiteSparseQR.hpp" 9 | 10 | /** \ingroup Support_modules 11 | * \defgroup SPQRSupport_Module SuiteSparseQR module 12 | * 13 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 14 | * 15 | * \code 16 | * #include 17 | * \endcode 18 | * 19 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). 20 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | #include "src/CholmodSupport/CholmodSupport.h" 27 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/Skyline: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_SKYLINE_MODULE_H 10 | #define EIGEN_SKYLINE_MODULE_H 11 | 12 | 13 | #include "Eigen/Core" 14 | 15 | #include "Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * \defgroup Skyline_Module Skyline module 24 | * 25 | * 26 | * 27 | * 28 | */ 29 | 30 | #include "src/Skyline/SkylineUtil.h" 31 | #include "src/Skyline/SkylineMatrixBase.h" 32 | #include "src/Skyline/SkylineStorage.h" 33 | #include "src/Skyline/SkylineMatrix.h" 34 | #include "src/Skyline/SkylineInplaceLU.h" 35 | #include "src/Skyline/SkylineProduct.h" 36 | 37 | #include "Eigen/src/Core/util/ReenableStupidWarnings.h" 38 | 39 | #endif // EIGEN_SKYLINE_MODULE_H 40 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | // template 14 | // template 15 | // bool SparseMatrixBase::isApprox( 16 | // const OtherDerived& other, 17 | // typename NumTraits::Real prec 18 | // ) const 19 | // { 20 | // const typename internal::nested::type nested(derived()); 21 | // const typename internal::nested::type otherNested(other.derived()); 22 | // return (nested - otherNested).cwise().abs2().sum() 23 | // <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum()); 24 | // } 25 | 26 | #endif // EIGEN_SPARSE_FUZZY_H 27 | -------------------------------------------------------------------------------- /include/cuckoohash_config.hh: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef _CUCKOOHASH_CONFIG_HH 4 | #define _CUCKOOHASH_CONFIG_HH 5 | 6 | #include 7 | 8 | //! The default maximum number of keys per bucket 9 | const size_t DEFAULT_SLOT_PER_BUCKET = 4; 10 | 11 | //! The default number of elements in an empty hash table 12 | const size_t DEFAULT_SIZE = (1U << 16) * DEFAULT_SLOT_PER_BUCKET; 13 | 14 | //! The default minimum load factor that the table allows for automatic 15 | //! expansion. It must be a number between 0.0 and 1.0. The table will throw 16 | //! libcuckoo_load_factor_too_low if the load factor falls below this value 17 | //! during an automatic expansion. 18 | const double DEFAULT_MINIMUM_LOAD_FACTOR = 0.05; 19 | 20 | //! An alias for the value that sets no limit on the maximum hashpower. If this 21 | //! value is set as the maximum hashpower limit, there will be no limit. Since 0 22 | //! is the only hashpower that can never occur, it should stay at 0. 23 | const size_t NO_MAXIMUM_HASHPOWER = 0; 24 | 25 | //! set LIBCUCKOO_DEBUG to 1 to enable debug output 26 | #define LIBCUCKOO_DEBUG 0 27 | 28 | #endif // _CUCKOOHASH_CONFIG_HH 29 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/QR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_QR_MODULE_H 2 | #define EIGEN_QR_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | 12 | /** \defgroup QR_Module QR module 13 | * 14 | * 15 | * 16 | * This module provides various QR decompositions 17 | * This module also provides some MatrixBase methods, including: 18 | * - MatrixBase::qr(), 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include "src/misc/Solve.h" 26 | #include "src/QR/HouseholderQR.h" 27 | #include "src/QR/FullPivHouseholderQR.h" 28 | #include "src/QR/ColPivHouseholderQR.h" 29 | #ifdef EIGEN_USE_LAPACKE 30 | #include "src/QR/HouseholderQR_MKL.h" 31 | #include "src/QR/ColPivHouseholderQR_MKL.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/QR.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #ifdef EIGEN2_SUPPORT 41 | #include "Eigenvalues" 42 | #endif 43 | 44 | #endif // EIGEN_QR_MODULE_H 45 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 46 | -------------------------------------------------------------------------------- /scripts/AddHeaders.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | usage() 4 | { 5 | cat << EOF 6 | usage: $0 options 7 | 8 | This script adds a header to all files matching the provided pattern in the given directory 9 | 10 | OPTIONS: 11 | -h Show this message 12 | -l license file 13 | -d directory to search 14 | -p file pattern to match 15 | EOF 16 | } 17 | 18 | license= 19 | pattern= 20 | directory= 21 | while getopts "hl:p:d:" OPTION 22 | do 23 | case $OPTION in 24 | h) 25 | usage 26 | exit 1 27 | ;; 28 | l) 29 | license=$OPTARG 30 | ;; 31 | p) 32 | pattern=$OPTARG 33 | ;; 34 | d) 35 | directory=$OPTARG 36 | ;; 37 | ?) 38 | usage 39 | exit 40 | ;; 41 | esac 42 | done 43 | 44 | echo "Prepending ${license} to files with pattern ${pattern} in directory ${directory}" 45 | 46 | for i in ${directory}/${pattern} 47 | do 48 | if ! grep -q Copyright $i 49 | then 50 | cat ${license} $i >$i.new && mv $i.new $i 51 | fi 52 | done 53 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSEQR_MODULE_H 2 | #define EIGEN_SPARSEQR_MODULE_H 3 | 4 | #include "SparseCore" 5 | #include "OrderingMethods" 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup SparseQR_Module SparseQR module 9 | * \brief Provides QR decomposition for sparse matrices 10 | * 11 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 12 | * The columns of the input matrix should be reordered to limit the fill-in during the 13 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 14 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 15 | * of built-in and external ordering methods. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | 27 | #include "OrderingMethods" 28 | #include "src/SparseCore/SparseColEtree.h" 29 | #include "src/SparseQR/SparseQR.h" 30 | 31 | #include "src/Core/util/ReenableStupidWarnings.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /include/cereal/external/rapidjson/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 Milo Yip 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /include/eigen3/Eigen/LU: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_LU_MODULE_H 2 | #define EIGEN_LU_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup LU_Module LU module 9 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 10 | * This module defines the following MatrixBase methods: 11 | * - MatrixBase::inverse() 12 | * - MatrixBase::determinant() 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "src/misc/Solve.h" 20 | #include "src/misc/Kernel.h" 21 | #include "src/misc/Image.h" 22 | #include "src/LU/FullPivLU.h" 23 | #include "src/LU/PartialPivLU.h" 24 | #ifdef EIGEN_USE_LAPACKE 25 | #include "src/LU/PartialPivLU_MKL.h" 26 | #endif 27 | #include "src/LU/Determinant.h" 28 | #include "src/LU/Inverse.h" 29 | 30 | #if defined EIGEN_VECTORIZE_SSE 31 | #include "src/LU/arch/Inverse_SSE.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/LU.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_LU_MODULE_H 41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 42 | -------------------------------------------------------------------------------- /include/spdlog/sinks/base_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // base sink templated over a mutex (either dummy or realy) 9 | // concrete implementation should only overrid the _sink_it method. 10 | // all locking is taken care of here so no locking needed by the implementors.. 11 | // 12 | 13 | #include 14 | #include 15 | #include 16 | #include "./sink.h" 17 | #include "../formatter.h" 18 | #include "../common.h" 19 | #include "../details/log_msg.h" 20 | 21 | 22 | namespace spdlog 23 | { 24 | namespace sinks 25 | { 26 | template 27 | class base_sink:public sink 28 | { 29 | public: 30 | base_sink():_mutex() {} 31 | virtual ~base_sink() = default; 32 | 33 | base_sink(const base_sink&) = delete; 34 | base_sink& operator=(const base_sink&) = delete; 35 | 36 | void log(const details::log_msg& msg) override 37 | { 38 | std::lock_guard lock(_mutex); 39 | _sink_it(msg); 40 | } 41 | 42 | protected: 43 | virtual void _sink_it(const details::log_msg& msg) = 0; 44 | Mutex _mutex; 45 | }; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /runquark.sh: -------------------------------------------------------------------------------- 1 | usage() { echo "Usage $0 [-1 left end] [-2 right end] [-s path to sailfish binary] [-i path to sailfish index] [-p #threads] [-o output Dir]" 1>&2; exit 1;} 2 | 3 | while getopts ":1:2:s:i:p:o:" e; do 4 | case "${e}" in 5 | 1) 6 | left=${OPTARG} 7 | ;; 8 | 2) 9 | right=${OPTARG} 10 | ;; 11 | s) 12 | sailfish=${OPTARG} 13 | ;; 14 | i) 15 | ind=${OPTARG} 16 | ;; 17 | p) 18 | th=${OPTARG} 19 | ;; 20 | o) 21 | out=${OPTARG} 22 | ;; 23 | *) 24 | usage 25 | ;; 26 | esac 27 | done 28 | 29 | #echo "$#" 30 | echo "{left read $left}" 31 | echo "{right read $left}" 32 | echo "sailfish binary $sailfish" 33 | echo "sailfish index $ind" 34 | echo "threads #$th" 35 | echo "output dir $out" 36 | 37 | if [ "$#" -ne 12 ]; then 38 | exit 1 39 | fi 40 | 41 | shift $((OPTIND-1)) 42 | 43 | #echo "$sailfish quant -i $ind -l IU -1 $left -2 $right -p $th -o $out" 44 | $sailfish quant -i $ind -l IU -1 $left -2 $right -p $th -o $out 45 | ./decoder $out/aux/islands.quark $out/aux/reads.quark $out 46 | -------------------------------------------------------------------------------- /include/cereal/external/rapidjson/filestream.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_FILESTREAM_H_ 2 | #define RAPIDJSON_FILESTREAM_H_ 3 | 4 | #include 5 | 6 | namespace rapidjson { 7 | 8 | //! Wrapper of C file stream for input or output. 9 | /*! 10 | This simple wrapper does not check the validity of the stream. 11 | \implements Stream 12 | */ 13 | class FileStream { 14 | public: 15 | typedef char Ch; //!< Character type. Only support char. 16 | 17 | FileStream(FILE* fp) : fp_(fp), count_(0) { Read(); } 18 | 19 | char Peek() const { return current_; } 20 | char Take() { char c = current_; Read(); return c; } 21 | size_t Tell() const { return count_; } 22 | void Put(char c) { fputc(c, fp_); } 23 | 24 | // Not implemented 25 | char* PutBegin() { return 0; } 26 | size_t PutEnd(char*) { return 0; } 27 | 28 | private: 29 | void Read() { 30 | RAPIDJSON_ASSERT(fp_ != 0); 31 | int c = fgetc(fp_); 32 | if (c != EOF) { 33 | current_ = (char)c; 34 | count_++; 35 | } 36 | else 37 | current_ = '\0'; 38 | } 39 | 40 | FILE* fp_; 41 | char current_; 42 | size_t count_; 43 | }; 44 | 45 | } // namespace rapidjson 46 | 47 | #endif // RAPIDJSON_FILESTREAM_H_ 48 | -------------------------------------------------------------------------------- /include/SailfishConfig.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | >HEADER 3 | Copyright (c) 2013 Rob Patro robp@cs.cmu.edu 4 | 5 | This file is part of Sailfish. 6 | 7 | Sailfish is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | Sailfish is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with Sailfish. If not, see . 19 |
27 | 28 | namespace sailfish { 29 | constexpr char majorVersion[] = "0"; 30 | constexpr char minorVersion[] = "9"; 31 | constexpr char patchVersion[] = "2"; 32 | constexpr char version[] = "0.9.2"; 33 | constexpr uint32_t indexVersion = 2; 34 | } 35 | 36 | #endif // SAILFISH_CONFIG_HPP 37 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/AutoDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_AUTODIFF_MODULE 11 | #define EIGEN_AUTODIFF_MODULE 12 | 13 | namespace Eigen { 14 | 15 | /** 16 | * \defgroup AutoDiff_Module Auto Diff module 17 | * 18 | * This module features forward automatic differentation via a simple 19 | * templated scalar type wrapper AutoDiffScalar. 20 | * 21 | * Warning : this should NOT be confused with numerical differentiation, which 22 | * is a different method and has its own module in Eigen : \ref NumericalDiff_Module. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | //@{ 29 | 30 | } 31 | 32 | #include "src/AutoDiff/AutoDiffScalar.h" 33 | // #include "src/AutoDiff/AutoDiffVector.h" 34 | #include "src/AutoDiff/AutoDiffJacobian.h" 35 | 36 | namespace Eigen { 37 | //@} 38 | } 39 | 40 | #endif // EIGEN_AUTODIFF_MODULE 41 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | // TODO : move this to GivensQR once there's such a thing in Eigen 6 | 7 | template 8 | void r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector > &v_givens, const std::vector > &w_givens) 9 | { 10 | typedef DenseIndex Index; 11 | 12 | /* apply the first set of givens rotations to a. */ 13 | for (Index j = n-2; j>=0; --j) 14 | for (Index i = 0; i 9 | #include 10 | #include 11 | 12 | #include "../details/null_mutex.h" 13 | #include "./base_sink.h" 14 | 15 | namespace spdlog 16 | { 17 | namespace sinks 18 | { 19 | template 20 | class ostream_sink: public base_sink 21 | { 22 | public: 23 | explicit ostream_sink(std::ostream& os, bool force_flush=false) :_ostream(os), _force_flush(force_flush) {} 24 | ostream_sink(const ostream_sink&) = delete; 25 | ostream_sink& operator=(const ostream_sink&) = delete; 26 | virtual ~ostream_sink() = default; 27 | 28 | protected: 29 | void _sink_it(const details::log_msg& msg) override 30 | { 31 | _ostream.write(msg.formatted.data(), msg.formatted.size()); 32 | if (_force_flush) 33 | _ostream.flush(); 34 | } 35 | 36 | void flush() override 37 | { 38 | _ostream.flush(); 39 | } 40 | 41 | std::ostream& _ostream; 42 | bool _force_flush; 43 | }; 44 | 45 | typedef ostream_sink ostream_sink_mt; 46 | typedef ostream_sink ostream_sink_st; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/LevenbergMarquardt: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_LEVENBERGMARQUARDT_MODULE 11 | #define EIGEN_LEVENBERGMARQUARDT_MODULE 12 | 13 | // #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | /** 23 | * \defgroup LevenbergMarquardt_Module Levenberg-Marquardt module 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | * 29 | * 30 | */ 31 | 32 | #include "Eigen/SparseCore" 33 | #ifndef EIGEN_PARSED_BY_DOXYGEN 34 | 35 | #include "src/LevenbergMarquardt/LMqrsolv.h" 36 | #include "src/LevenbergMarquardt/LMcovar.h" 37 | #include "src/LevenbergMarquardt/LMpar.h" 38 | 39 | #endif 40 | 41 | #include "src/LevenbergMarquardt/LevenbergMarquardt.h" 42 | #include "src/LevenbergMarquardt/LMonestep.h" 43 | 44 | 45 | #endif // EIGEN_LEVENBERGMARQUARDT_MODULE 46 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 2 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup UmfPackSupport_Module UmfPackSupport module 14 | * 15 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 16 | * It provides the following factorization class: 17 | * - class UmfPackLU: a multifrontal sequential LU factorization. 18 | * 19 | * \code 20 | * #include 21 | * \endcode 22 | * 23 | * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. 24 | * The dependencies depend on how umfpack has been compiled. 25 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 26 | * 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/UmfPackSupport/UmfPackSupport.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 37 | -------------------------------------------------------------------------------- /include/CommonTypes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | >HEADER 3 | Copyright (c) 2013 Rob Patro robp@cs.cmu.edu 4 | 5 | This file is part of Sailfish. 6 | 7 | Sailfish is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | Sailfish is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with Sailfish. If not, see . 19 |
27 | #include 28 | 29 | namespace Sailfish { 30 | /* 31 | struct Kmer { 32 | uint64_t kmer; 33 | }; 34 | 35 | struct Index { 36 | uint64_t index; 37 | }; 38 | */ 39 | struct TranscriptFeatures{ 40 | std::string name; 41 | size_t length; 42 | double gcContent; 43 | std::array diNucleotides; 44 | }; 45 | } 46 | 47 | 48 | # endif // COMMON_TYPES_HPP 49 | -------------------------------------------------------------------------------- /cmake/TestSalmon.cmake: -------------------------------------------------------------------------------- 1 | execute_process(COMMAND tar xzvf sample_data.tgz 2 | WORKING_DIRECTORY ${TOPLEVEL_DIR} 3 | RESULT_VARIABLE TAR_RESULT 4 | ) 5 | 6 | if (TAR_RESULT) 7 | message(FATAL_ERROR "Error untarring sample_data.tgz") 8 | endif() 9 | 10 | set(SALMON_INDEX_CMD ${TOPLEVEL_DIR}/build/src/salmon index -t transcripts.fasta -i sample_salmon_index) 11 | execute_process(COMMAND ${SALMON_INDEX_CMD} 12 | WORKING_DIRECTORY ${TOPLEVEL_DIR}/sample_data 13 | RESULT_VARIABLE SALMON_INDEX_RESULT 14 | ) 15 | 16 | if (SALMON_INDEX_RESULT) 17 | message(FATAL_ERROR "Error running ${SALMON_INDEX_COMMAND}") 18 | endif() 19 | 20 | set(SALMON_QUANT_COMMAND ${TOPLEVEL_DIR}/build/src/salmon quant -i sample_salmon_index -l IU -1 reads_1.fastq -2 reads_2.fastq -o sample_salmon_quant -n 1000000) 21 | execute_process(COMMAND ${SALMON_QUANT_COMMAND} 22 | WORKING_DIRECTORY ${TOPLEVEL_DIR}/sample_data 23 | RESULT_VARIABLE SALMON_QUANT_RESULT 24 | ) 25 | if (SALMON_QUANT_RESULT) 26 | message(FATAL_ERROR "Error running ${QUANT_RESULT}") 27 | endif() 28 | 29 | if (EXISTS ${TOPLEVEL_DIR}/sample_data/sample_salmon_quant/quant.sf) 30 | message("Salmon (read) ran successfully") 31 | else() 32 | message(FATAL_ERROR "Salmon (read) failed to produce output") 33 | endif() 34 | 35 | 36 | -------------------------------------------------------------------------------- /cmake/PostInstall.cmake: -------------------------------------------------------------------------------- 1 | ## 2 | # Print some post install messages for the user 3 | ## 4 | message("\n\n") 5 | message("Installation complete. Please ensure the following paths are set properly.") 6 | message("==========================================================================") 7 | if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 8 | message("Fixing library names with install_name_tool") 9 | execute_process(COMMAND install_name_tool -add_rpath ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/bin/sailfish) 10 | #execute_process(COMMAND install_name_tool -add_rpath ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/bin/sailfish) 11 | #execute_process(COMMAND install_name_tool -add_rpath @executable_path ${CMAKE_INSTALL_PREFIX}/bin/sailfish) 12 | #execute_process(COMMAND install_name_tool -add_rpath ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib/libtbb.dylib) 13 | #execute_process(COMMAND install_name_tool -add_rpath ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib/libtbbmalloc.dylib) 14 | 15 | endif() 16 | message("Please add ${CMAKE_INSTALL_PREFIX}/bin to your PATH") 17 | if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") 18 | message("Please add ${CMAKE_INSTALL_PREFIX}/lib to your DYLD_FALLBACK_LIBRARY_PATH") 19 | else() 20 | message("Please add ${CMAKE_INSTALL_PREFIX}/lib to your LD_LIBRARY_PATH") 21 | endif() 22 | message("==========================================================================") 23 | -------------------------------------------------------------------------------- /include/spdlog/sinks/stdout_sinks.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "./ostream_sink.h" 11 | #include "../details/null_mutex.h" 12 | 13 | namespace spdlog 14 | { 15 | namespace sinks 16 | { 17 | 18 | template 19 | class stdout_sink : public ostream_sink 20 | { 21 | using MyType = stdout_sink; 22 | public: 23 | stdout_sink() : ostream_sink(std::cout, true) {} 24 | static std::shared_ptr instance() 25 | { 26 | static std::shared_ptr instance = std::make_shared(); 27 | return instance; 28 | } 29 | }; 30 | 31 | typedef stdout_sink stdout_sink_st; 32 | typedef stdout_sink stdout_sink_mt; 33 | 34 | 35 | template 36 | class stderr_sink : public ostream_sink 37 | { 38 | using MyType = stderr_sink; 39 | public: 40 | stderr_sink() : ostream_sink(std::cerr, true) {} 41 | static std::shared_ptr instance() 42 | { 43 | static std::shared_ptr instance = std::make_shared(); 44 | return instance; 45 | } 46 | 47 | }; 48 | 49 | typedef stderr_sink stderr_sink_mt; 50 | typedef stderr_sink stderr_sink_st; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /benchmark/only_quark.stat: -------------------------------------------------------------------------------- 1 | SRR1265495 2 2 | 1438.21user 269.72system 5:39.75elapsed 502%CPU (0avgtext+0avgdata 8979176maxresident)k 3 | 975736inputs+3466624outputs (30major+29232308minor)pagefaults 0swaps 4 | SRR1265496 2 5 | 1331.34user 273.22system 4:40.74elapsed 571%CPU (0avgtext+0avgdata 8755760maxresident)k 6 | 17528inputs+3405168outputs (0major+30366003minor)pagefaults 0swaps 7 | SRR037452 1 8 | 205.57user 151.90system 3:33.13elapsed 167%CPU (0avgtext+0avgdata 7014424maxresident)k 9 | 8inputs+1354832outputs (0major+10635834minor)pagefaults 0swaps 10 | SRR1294122 1 11 | 1993.72user 304.93system 7:48.81elapsed 490%CPU (0avgtext+0avgdata 10477144maxresident)k 12 | 0inputs+4779664outputs (0major+47631310minor)pagefaults 0swaps 13 | SRR445718 1 14 | 1693.77user 601.07system 10:01.73elapsed 381%CPU (0avgtext+0avgdata 10014184maxresident)k 15 | 320inputs+4260544outputs (4major+49940528minor)pagefaults 0swaps 16 | SRR490961 1 17 | 2469.68user 346.61system 9:15.12elapsed 507%CPU (0avgtext+0avgdata 11283068maxresident)k 18 | 0inputs+6535088outputs (0major+47203104minor)pagefaults 0swaps 19 | SRR635193 2 20 | 1516.20user 200.04system 5:15.38elapsed 544%CPU (0avgtext+0avgdata 10041784maxresident)k 21 | 8inputs+4226800outputs (1major+22164841minor)pagefaults 0swaps 22 | SRR689233 2 23 | 1008.13user 109.05system 4:06.69elapsed 452%CPU (0avgtext+0avgdata 8339180maxresident)k 24 | 5535160inputs+1874864outputs (0major+9516410minor)pagefaults 0swaps 25 | -------------------------------------------------------------------------------- /include/TranscriptGroup.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRANSCRIPT_GROUP_HPP 2 | #define TRANSCRIPT_GROUP_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | class TranscriptGroup { 10 | public: 11 | TranscriptGroup(); 12 | TranscriptGroup(std::vector txpsIn); 13 | 14 | TranscriptGroup( 15 | std::vector txpsIn, 16 | size_t hashIn); 17 | 18 | TranscriptGroup(TranscriptGroup&& other); 19 | TranscriptGroup(const TranscriptGroup& other); 20 | 21 | TranscriptGroup& operator=(const TranscriptGroup& other); 22 | TranscriptGroup& operator=(TranscriptGroup&& other); 23 | 24 | friend bool operator==(const TranscriptGroup& lhs, 25 | const TranscriptGroup& rhs); 26 | 27 | void setValid(bool v) const; 28 | 29 | std::vector txps; 30 | size_t hash; 31 | double totalMass; 32 | mutable bool valid; 33 | }; 34 | 35 | bool operator==(const TranscriptGroup& lhs, const TranscriptGroup& rhs); 36 | 37 | struct TranscriptGroupHasher { 38 | std::size_t operator()(const TranscriptGroup & k) const 39 | { 40 | return k.hash; 41 | /* 42 | std::size_t seed{0}; 43 | for (auto e : k.txps) { 44 | boost::hash_combine(seed, e); 45 | } 46 | return seed; 47 | */ 48 | } 49 | }; 50 | 51 | #endif // TRANSCRIPT_GROUP_HPP 52 | 53 | -------------------------------------------------------------------------------- /benchmark/quark.stat: -------------------------------------------------------------------------------- 1 | SRR689233 2 | 1641.66user 269.66system 6:36.58elapsed 481%CPU (0avgtext+0avgdata 8339268maxresident)k 3 | 59720inputs+2118472outputs (2major+31031784minor)pagefaults 0swaps 4 | SRR635193 5 | 3108.31user 391.15system 9:37.63elapsed 605%CPU (0avgtext+0avgdata 10042732maxresident)k 6 | 3811280inputs+4661128outputs (13major+71653672minor)pagefaults 0swaps 7 | SRR1265495 8 | 2649.47user 326.00system 8:37.69elapsed 574%CPU (0avgtext+0avgdata 8982004maxresident)k 9 | 4091792inputs+3942696outputs (0major+43536010minor)pagefaults 0swaps 10 | SRR1265496 11 | 2551.29user 286.45system 7:56.97elapsed 594%CPU (0avgtext+0avgdata 8756444maxresident)k 12 | 3597600inputs+3875072outputs (1major+40082925minor)pagefaults 0swaps 13 | SRR445718 14 | 3769.52user 327.22system 11:01.86elapsed 618%CPU (0avgtext+0avgdata 10011308maxresident)k 15 | 5539560inputs+4789208outputs (0major+84098026minor)pagefaults 0swaps 16 | SRR490961 17 | 5734.49user 537.42system 20:15.46elapsed 516%CPU (0avgtext+0avgdata 11281352maxresident)k 18 | 7739824inputs+6762288outputs (2major+109612764minor)pagefaults 0swaps 19 | SRR037452 20 | 1068.09user 200.04system 9:03.69elapsed 233%CPU (0avgtext+0avgdata 7014164maxresident)k 21 | 756912inputs+1664376outputs (0major+67918231minor)pagefaults 0swaps 22 | SRR1294122 23 | 4378.95user 453.90system 15:31.55elapsed 518%CPU (0avgtext+0avgdata 10476400maxresident)k 24 | 6609824inputs+5402640outputs (0major+123847986minor)pagefaults 0swaps 25 | -------------------------------------------------------------------------------- /scripts/fetchRapMap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CURR_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 4 | EXTERNAL_DIR=${CURR_DIR}/../external 5 | INSTALL_DIR=${CURR_DIR}/../external/install 6 | 7 | if [ -d ${EXTERNAL_DIR}/RapMap ] ; then 8 | rm -fr ${EXTERNAL_DIR}/RapMap 9 | fi 10 | 11 | if [ -d ${INSTALL_DIR}/include/rapmap ] ; then 12 | rm -fr ${INSTALL_DIR}/include/rapmap 13 | fi 14 | 15 | if [ -d ${INSTALL_DIR}/src/rapmap ] ; then 16 | rm -fr ${INSTALL_DIR}/src/rapmap 17 | fi 18 | 19 | mkdir -p ${EXTERNAL_DIR} 20 | curl -k -L https://github.com/COMBINE-lab/RapMap/archive/sf-v0.10.1.zip -o ${EXTERNAL_DIR}/rapmap.zip 21 | 22 | rm -fr ${EXTERNAL_DIR}/RapMap 23 | unzip ${EXTERNAL_DIR}/rapmap.zip -d ${EXTERNAL_DIR} 24 | mv ${EXTERNAL_DIR}/RapMap-sf-v0.10.1 ${EXTERNAL_DIR}/RapMap 25 | 26 | mkdir -p ${INSTALL_DIR}/include/rapmap 27 | mkdir -p ${INSTALL_DIR}/src/rapmap 28 | 29 | rm ${EXTERNAL_DIR}/RapMap/src/xxhash.c 30 | rm ${EXTERNAL_DIR}/RapMap/include/xxhash.h 31 | 32 | cp -r ${EXTERNAL_DIR}/RapMap/external/libdivsufsort.zip ${EXTERNAL_DIR} 33 | cp -r ${EXTERNAL_DIR}/RapMap/src/*.c ${INSTALL_DIR}/src/rapmap 34 | cp -r ${EXTERNAL_DIR}/RapMap/src/*.cpp ${INSTALL_DIR}/src/rapmap 35 | cp -r ${EXTERNAL_DIR}/RapMap/include/tclap ${INSTALL_DIR}/include/rapmap 36 | cp -r ${EXTERNAL_DIR}/RapMap/include/*.h ${INSTALL_DIR}/include/rapmap 37 | cp -r ${EXTERNAL_DIR}/RapMap/include/*.hpp ${INSTALL_DIR}/include/rapmap 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /include/SailfishOpts.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __SAILFISH_OPTS_HPP__ 2 | #define __SAILFISH_OPTS_HPP__ 3 | 4 | #include "spdlog/spdlog.h" 5 | #include 6 | #include 7 | #include 8 | 9 | struct SailfishOpts { 10 | uint32_t numThreads; // number of threads to use 11 | bool allowOrphans; 12 | std::string auxDir; 13 | bool dumpEq{false}; 14 | bool noEffectiveLengthCorrection; 15 | bool noFragLengthDist; 16 | bool useVBOpt{false}; 17 | bool useGSOpt{false}; 18 | bool useUnsmoothedFLD{false}; 19 | bool ignoreLibCompat{false}; 20 | bool enforceLibCompat{false}; 21 | bool allowDovetail{false}; 22 | bool biasCorrect{false}; 23 | bool strictIntersect{false}; 24 | bool gcBiasCorrect{false}; 25 | bool firstCorrectionPass{true}; 26 | std::atomic numBiasSamples{1000000}; 27 | uint32_t gcSampFactor; 28 | uint32_t pdfSampFactor; 29 | int32_t numFragSamples{10000}; 30 | uint32_t maxFragLen; 31 | uint32_t numGibbsSamples; 32 | uint32_t numBootstraps; 33 | uint32_t maxReadOccs; 34 | size_t fragLenDistMax; 35 | size_t fragLenDistPriorMean; 36 | size_t fragLenDistPriorSD; 37 | std::shared_ptr jointLog{nullptr}; 38 | std::shared_ptr fileLog{nullptr}; 39 | boost::filesystem::path indexDirectory; 40 | boost::filesystem::path outputDirectory; 41 | }; 42 | 43 | #endif // __SAILFISH_OPTS_HPP__ 44 | -------------------------------------------------------------------------------- /cmake/SimpleTest.cmake: -------------------------------------------------------------------------------- 1 | execute_process(COMMAND tar xzvf sample_data.tgz 2 | WORKING_DIRECTORY ${TOPLEVEL_DIR} 3 | RESULT_VARIABLE TAR_RESULT 4 | ) 5 | 6 | if (TAR_RESULT) 7 | message(FATAL_ERROR "Error untarring sample_data.tgz") 8 | endif() 9 | 10 | if (NOT EXISTS ${TOPLEVEL_DIR}/bin/sailfish) 11 | message(FATAL_ERROR "You must make install sailfish before you can run make test") 12 | endif() 13 | 14 | 15 | set(INDEX_CMD ${TOPLEVEL_DIR}/bin/sailfish index -t transcripts.fasta -o sample_index --force) 16 | execute_process(COMMAND ${INDEX_CMD} 17 | WORKING_DIRECTORY ${TOPLEVEL_DIR}/sample_data 18 | RESULT_VARIABLE INDEX_RESULT 19 | ) 20 | 21 | if (INDEX_RESULT) 22 | message(FATAL_ERROR "Error running ${INDEX_COMMAND}") 23 | endif() 24 | 25 | set(QUANT_COMMAND ${TOPLEVEL_DIR}/build/src/sailfish quant -i sample_index -l IU -1 reads_1.fastq -2 reads_2.fastq -o sample_quant) 26 | execute_process(COMMAND ${QUANT_COMMAND} 27 | WORKING_DIRECTORY ${TOPLEVEL_DIR}/sample_data 28 | RESULT_VARIABLE QUANT_RESULT 29 | ) 30 | if (QUANT_RESULT) 31 | message(FATAL_ERROR "Error running ${QUANT_RESULT}") 32 | endif() 33 | 34 | if (EXISTS ${TOPLEVEL_DIR}/sample_data/sample_quant/quant.sf) 35 | message("Sailfish ran successfully") 36 | else() 37 | message(FATAL_ERROR "Sailfish failed to produce output") 38 | endif() 39 | 40 | 41 | -------------------------------------------------------------------------------- /cmake/Modules/FindTcmalloc.cmake: -------------------------------------------------------------------------------- 1 | # - Find Tcmalloc 2 | # Find the native Tcmalloc includes and library 3 | # 4 | # Tcmalloc_INCLUDE_DIR - where to find Tcmalloc.h, etc. 5 | # Tcmalloc_LIBRARIES - List of libraries when using Tcmalloc. 6 | # Tcmalloc_FOUND - True if Tcmalloc found. 7 | 8 | find_path(Tcmalloc_INCLUDE_DIR google/tcmalloc.h NO_DEFAULT_PATH PATHS 9 | ${HT_DEPENDENCY_INCLUDE_DIR} 10 | /usr/include 11 | /opt/local/include 12 | /usr/local/include 13 | ) 14 | 15 | if (USE_TCMALLOC) 16 | set(Tcmalloc_NAMES tcmalloc) 17 | else () 18 | set(Tcmalloc_NAMES tcmalloc_minimal tcmalloc) 19 | endif () 20 | 21 | find_library(Tcmalloc_LIBRARY NO_DEFAULT_PATH 22 | NAMES ${Tcmalloc_NAMES} 23 | PATHS ${HT_DEPENDENCY_LIB_DIR} /lib /usr/lib /usr/local/lib /opt/local/lib 24 | ) 25 | 26 | if (Tcmalloc_INCLUDE_DIR AND Tcmalloc_LIBRARY) 27 | set(Tcmalloc_FOUND TRUE) 28 | set( Tcmalloc_LIBRARIES ${Tcmalloc_LIBRARY} ) 29 | else () 30 | set(Tcmalloc_FOUND FALSE) 31 | set( Tcmalloc_LIBRARIES ) 32 | endif () 33 | 34 | if (Tcmalloc_FOUND) 35 | message(STATUS "Found Tcmalloc: ${Tcmalloc_LIBRARY}") 36 | else () 37 | message(STATUS "Not Found Tcmalloc: ${Tcmalloc_LIBRARY}") 38 | if (Tcmalloc_FIND_REQUIRED) 39 | message(STATUS "Looked for Tcmalloc libraries named ${Tcmalloc_NAMES}.") 40 | message(FATAL_ERROR "Could NOT find Tcmalloc library") 41 | endif () 42 | endif () 43 | 44 | mark_as_advanced( 45 | Tcmalloc_LIBRARY 46 | Tcmalloc_INCLUDE_DIR 47 | ) 48 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_EIGENVALUES_MODULE_H 2 | #define EIGEN_EIGENVALUES_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | #include "LU" 12 | #include "Geometry" 13 | 14 | /** \defgroup Eigenvalues_Module Eigenvalues module 15 | * 16 | * 17 | * 18 | * This module mainly provides various eigenvalue solvers. 19 | * This module also provides some MatrixBase methods, including: 20 | * - MatrixBase::eigenvalues(), 21 | * - MatrixBase::operatorNorm() 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | #include "src/Eigenvalues/Tridiagonalization.h" 29 | #include "src/Eigenvalues/RealSchur.h" 30 | #include "src/Eigenvalues/EigenSolver.h" 31 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 32 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 33 | #include "src/Eigenvalues/HessenbergDecomposition.h" 34 | #include "src/Eigenvalues/ComplexSchur.h" 35 | #include "src/Eigenvalues/ComplexEigenSolver.h" 36 | #include "src/Eigenvalues/RealQZ.h" 37 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 38 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 39 | #ifdef EIGEN_USE_LAPACKE 40 | #include "src/Eigenvalues/RealSchur_MKL.h" 41 | #include "src/Eigenvalues/ComplexSchur_MKL.h" 42 | #include "src/Eigenvalues/SelfAdjointEigenSolver_MKL.h" 43 | #endif 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_EIGENVALUES_MODULE_H 48 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 49 | -------------------------------------------------------------------------------- /include/cereal/external/rapidjson/stringbuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_STRINGBUFFER_H_ 2 | #define RAPIDJSON_STRINGBUFFER_H_ 3 | 4 | #include "rapidjson.h" 5 | #include "internal/stack.h" 6 | 7 | namespace rapidjson { 8 | 9 | //! Represents an in-memory output stream. 10 | /*! 11 | \tparam Encoding Encoding of the stream. 12 | \tparam Allocator type for allocating memory buffer. 13 | \implements Stream 14 | */ 15 | template 16 | struct GenericStringBuffer { 17 | typedef typename Encoding::Ch Ch; 18 | 19 | GenericStringBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {} 20 | 21 | void Put(Ch c) { *stack_.template Push() = c; } 22 | 23 | void Clear() { stack_.Clear(); } 24 | 25 | const char* GetString() const { 26 | // Push and pop a null terminator. This is safe. 27 | *stack_.template Push() = '\0'; 28 | stack_.template Pop(1); 29 | 30 | return stack_.template Bottom(); 31 | } 32 | 33 | size_t Size() const { return stack_.GetSize(); } 34 | 35 | static const size_t kDefaultCapacity = 256; 36 | mutable internal::Stack stack_; 37 | }; 38 | 39 | typedef GenericStringBuffer > StringBuffer; 40 | 41 | //! Implement specialized version of PutN() with memset() for better performance. 42 | template<> 43 | inline void PutN(GenericStringBuffer >& stream, char c, size_t n) { 44 | memset(stream.stack_.Push(n), c, n * sizeof(c)); 45 | } 46 | 47 | } // namespace rapidjson 48 | 49 | #endif // RAPIDJSON_STRINGBUFFER_H_ 50 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/IterativeSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_ITERATIVE_SOLVERS_MODULE_H 11 | #define EIGEN_ITERATIVE_SOLVERS_MODULE_H 12 | 13 | #include 14 | 15 | /** 16 | * \defgroup IterativeSolvers_Module Iterative solvers module 17 | * This module aims to provide various iterative linear and non linear solver algorithms. 18 | * It currently provides: 19 | * - a constrained conjugate gradient 20 | * - a Householder GMRES implementation 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | //@{ 26 | 27 | #include "../../Eigen/src/misc/Solve.h" 28 | #include "../../Eigen/src/misc/SparseSolve.h" 29 | 30 | #ifndef EIGEN_MPL2_ONLY 31 | #include "src/IterativeSolvers/IterationController.h" 32 | #include "src/IterativeSolvers/ConstrainedConjGrad.h" 33 | #endif 34 | 35 | #include "src/IterativeSolvers/IncompleteLU.h" 36 | #include "../../Eigen/Jacobi" 37 | #include "../../Eigen/Householder" 38 | #include "src/IterativeSolvers/GMRES.h" 39 | #include "src/IterativeSolvers/IncompleteCholesky.h" 40 | //#include "src/IterativeSolvers/SSORPreconditioner.h" 41 | #include "src/IterativeSolvers/MINRES.h" 42 | 43 | //@} 44 | 45 | #endif // EIGEN_ITERATIVE_SOLVERS_MODULE_H 46 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | void rwupdt( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const Matrix< Scalar, Dynamic, 1> &w, 9 | Matrix< Scalar, Dynamic, 1> &b, 10 | Scalar alpha) 11 | { 12 | typedef DenseIndex Index; 13 | 14 | const Index n = r.cols(); 15 | eigen_assert(r.rows()>=n); 16 | std::vector > givens(n); 17 | 18 | /* Local variables */ 19 | Scalar temp, rowj; 20 | 21 | /* Function Body */ 22 | for (Index j = 0; j < n; ++j) { 23 | rowj = w[j]; 24 | 25 | /* apply the previous transformations to */ 26 | /* r(i,j), i=0,1,...,j-1, and to w(j). */ 27 | for (Index i = 0; i < j; ++i) { 28 | temp = givens[i].c() * r(i,j) + givens[i].s() * rowj; 29 | rowj = -givens[i].s() * r(i,j) + givens[i].c() * rowj; 30 | r(i,j) = temp; 31 | } 32 | 33 | /* determine a givens rotation which eliminates w(j). */ 34 | givens[j].makeGivens(-r(j,j), rowj); 35 | 36 | if (rowj == 0.) 37 | continue; // givens[j] is identity 38 | 39 | /* apply the current transformation to r(j,j), b(j), and alpha. */ 40 | r(j,j) = givens[j].c() * r(j,j) + givens[j].s() * rowj; 41 | temp = givens[j].c() * b[j] + givens[j].s() * alpha; 42 | alpha = -givens[j].s() * b[j] + givens[j].c() * alpha; 43 | b[j] = temp; 44 | } 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/SparseCholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2013 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H 11 | #define EIGEN_SPARSECHOLESKY_MODULE_H 12 | 13 | #include "SparseCore" 14 | #include "OrderingMethods" 15 | 16 | #include "src/Core/util/DisableStupidWarnings.h" 17 | 18 | /** 19 | * \defgroup SparseCholesky_Module SparseCholesky module 20 | * 21 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. 22 | * Those decompositions are accessible via the following classes: 23 | * - SimplicialLLt, 24 | * - SimplicialLDLt 25 | * 26 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #ifdef EIGEN_MPL2_ONLY 34 | #error The SparseCholesky module has nothing to offer in MPL2 only mode 35 | #endif 36 | 37 | #include "src/misc/Solve.h" 38 | #include "src/misc/SparseSolve.h" 39 | #include "src/SparseCholesky/SimplicialCholesky.h" 40 | 41 | #ifndef EIGEN_MPL2_ONLY 42 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 43 | #endif 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 48 | -------------------------------------------------------------------------------- /src/TranscriptGroup.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "TranscriptGroup.hpp" 5 | #include "xxhash.h" 6 | 7 | TranscriptGroup::TranscriptGroup() : hash(0) {} 8 | 9 | TranscriptGroup::TranscriptGroup(std::vector txpsIn) : txps(txpsIn), 10 | valid(true) { 11 | size_t seed{0}; 12 | hash = XXH64(static_cast(txps.data()), txps.size() * sizeof(uint32_t), seed); 13 | /* 14 | for (auto e : txps) { 15 | boost::hash_combine(seed, e); 16 | } 17 | hash = seed; 18 | */ 19 | } 20 | 21 | TranscriptGroup::TranscriptGroup( 22 | std::vector txpsIn, 23 | size_t hashIn) : txps(txpsIn), hash(hashIn), valid(true) {} 24 | 25 | TranscriptGroup::TranscriptGroup(const TranscriptGroup& other){ 26 | txps = other.txps; 27 | hash = other.hash; 28 | valid = other.valid; 29 | } 30 | 31 | TranscriptGroup& TranscriptGroup::operator=(const TranscriptGroup& other){ 32 | txps = other.txps; 33 | hash = other.hash; 34 | valid = other.valid; 35 | return *this; 36 | } 37 | 38 | TranscriptGroup::TranscriptGroup(TranscriptGroup&& other) { 39 | txps = std::move(other.txps); 40 | hash = other.hash; 41 | valid = other.valid; 42 | } 43 | 44 | void TranscriptGroup::setValid(bool b) const { valid = b; } 45 | 46 | TranscriptGroup& TranscriptGroup::operator=(TranscriptGroup&& other) { 47 | txps = std::move(other.txps); 48 | hash = other.hash; 49 | valid = other.valid; 50 | return *this; 51 | } 52 | 53 | bool operator==(const TranscriptGroup& lhs, const TranscriptGroup& rhs) { 54 | return lhs.txps == rhs.txps; 55 | }; 56 | 57 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 2 | #define EIGEN_PASTIXSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | extern "C" { 10 | #include 11 | #include 12 | } 13 | 14 | #ifdef complex 15 | #undef complex 16 | #endif 17 | 18 | /** \ingroup Support_modules 19 | * \defgroup PaStiXSupport_Module PaStiXSupport module 20 | * 21 | * This module provides an interface to the PaSTiX library. 22 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 23 | * It provides the two following main factorization classes: 24 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 25 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 26 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | * 32 | * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. 33 | * The dependencies depend on how PaSTiX has been compiled. 34 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 35 | * 36 | */ 37 | 38 | #include "src/misc/Solve.h" 39 | #include "src/misc/SparseSolve.h" 40 | 41 | #include "src/PaStiXSupport/PaStiXSupport.h" 42 | 43 | 44 | #include "src/Core/util/ReenableStupidWarnings.h" 45 | 46 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 47 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/SparseExtra: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_EXTRA_MODULE_H 11 | #define EIGEN_SPARSE_EXTRA_MODULE_H 12 | 13 | #include "../../Eigen/Sparse" 14 | 15 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef EIGEN_GOOGLEHASH_SUPPORT 26 | #include 27 | #endif 28 | 29 | /** 30 | * \defgroup SparseExtra_Module SparseExtra module 31 | * 32 | * This module contains some experimental features extending the sparse module. 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | */ 38 | 39 | 40 | #include "../../Eigen/src/misc/Solve.h" 41 | #include "../../Eigen/src/misc/SparseSolve.h" 42 | 43 | #include "src/SparseExtra/DynamicSparseMatrix.h" 44 | #include "src/SparseExtra/BlockOfDynamicSparseMatrix.h" 45 | #include "src/SparseExtra/RandomSetter.h" 46 | 47 | #include "src/SparseExtra/MarketIO.h" 48 | 49 | #if !defined(_WIN32) 50 | #include 51 | #include "src/SparseExtra/MatrixMarketIterator.h" 52 | #endif 53 | 54 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 55 | 56 | #endif // EIGEN_SPARSE_EXTRA_MODULE_H 57 | -------------------------------------------------------------------------------- /include/GZipWriter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __GZIP_WRITER_HPP__ 2 | #define __GZIP_WRITER_HPP__ 3 | 4 | #include 5 | #include 6 | 7 | #include "spdlog/spdlog.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "SailfishSpinLock.hpp" 14 | #include "SailfishOpts.hpp" 15 | #include "ReadExperiment.hpp" 16 | 17 | class GZipWriter { 18 | public: 19 | GZipWriter(const boost::filesystem::path path, std::shared_ptr logger); 20 | 21 | ~GZipWriter(); 22 | 23 | bool writeEncoding( 24 | const SailfishOpts& opts, 25 | ReadExperiment& experiment, 26 | std::vector>& unmapped, 27 | bool& qualityScore); 28 | 29 | 30 | 31 | 32 | bool writeMeta( 33 | const SailfishOpts& opts, 34 | const ReadExperiment& experiment, 35 | const std::string& tstring = "now" // the start time of the run 36 | ); 37 | 38 | bool writeAbundances( 39 | const SailfishOpts& sopt, 40 | ReadExperiment& readExp); 41 | 42 | template 43 | bool writeBootstrap(const std::vector& abund); 44 | 45 | private: 46 | boost::filesystem::path path_; 47 | boost::filesystem::path bsPath_; 48 | std::shared_ptr logger_; 49 | std::unique_ptr bsStream_{nullptr}; 50 | // only one writer thread at a time 51 | #if defined __APPLE__ 52 | spin_lock writeMutex_; 53 | #else 54 | std::mutex writeMutex_; 55 | #endif 56 | std::atomic numBootstrapsWritten_{0}; 57 | }; 58 | 59 | #endif //__GZIP_WRITER_HPP__ 60 | -------------------------------------------------------------------------------- /cmake/Modules/FindJemalloc.cmake: -------------------------------------------------------------------------------- 1 | # From: https://raw.githubusercontent.com/STEllAR-GROUP/hpx/master/cmake/FindJemalloc.cmake 2 | # Copyright (c) 2014 Thomas Heller 3 | # Copyright (c) 2007-2012 Hartmut Kaiser 4 | # Copyright (c) 2010-2011 Matt Anderson 5 | # Copyright (c) 2011 Bryce Lelbach 6 | # 7 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | find_package(PkgConfig) 11 | pkg_check_modules(PC_JEMALLOC QUIET libjemalloc) 12 | 13 | find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h 14 | HINTS 15 | ${JEMALLOC_ROOT} ENV JEMALLOC_ROOT 16 | ${PC_JEMALLOC_MINIMAL_INCLUDEDIR} 17 | ${PC_JEMALLOC_MINIMAL_INCLUDE_DIRS} 18 | ${PC_JEMALLOC_INCLUDEDIR} 19 | ${PC_JEMALLOC_INCLUDE_DIRS} 20 | PATH_SUFFIXES include) 21 | 22 | find_library(JEMALLOC_LIBRARY NAMES jemalloc libjemalloc 23 | HINTS 24 | ${JEMALLOC_ROOT} ENV JEMALLOC_ROOT 25 | ${PC_JEMALLOC_MINIMAL_LIBDIR} 26 | ${PC_JEMALLOC_MINIMAL_LIBRARY_DIRS} 27 | ${PC_JEMALLOC_LIBDIR} 28 | ${PC_JEMALLOC_LIBRARY_DIRS} 29 | PATH_SUFFIXES lib lib64) 30 | 31 | set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY}) 32 | set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR}) 33 | 34 | find_package_handle_standard_args(Jemalloc DEFAULT_MSG 35 | JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR) 36 | 37 | get_property(_type CACHE JEMALLOC_ROOT PROPERTY TYPE) 38 | if(_type) 39 | set_property(CACHE JEMALLOC_ROOT PROPERTY ADVANCED 1) 40 | if("x${_type}" STREQUAL "xUNINITIALIZED") 41 | set_property(CACHE JEMALLOC_ROOT PROPERTY TYPE PATH) 42 | endif() 43 | endif() 44 | 45 | mark_as_advanced(JEMALLOC_ROOT JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR) 46 | 47 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Eigen2Support/TriangularSolver.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TRIANGULAR_SOLVER2_H 11 | #define EIGEN_TRIANGULAR_SOLVER2_H 12 | 13 | namespace Eigen { 14 | 15 | const unsigned int UnitDiagBit = UnitDiag; 16 | const unsigned int SelfAdjointBit = SelfAdjoint; 17 | const unsigned int UpperTriangularBit = Upper; 18 | const unsigned int LowerTriangularBit = Lower; 19 | 20 | const unsigned int UpperTriangular = Upper; 21 | const unsigned int LowerTriangular = Lower; 22 | const unsigned int UnitUpperTriangular = UnitUpper; 23 | const unsigned int UnitLowerTriangular = UnitLower; 24 | 25 | template 26 | template 27 | typename ExpressionType::PlainObject 28 | Flagged::solveTriangular(const MatrixBase& other) const 29 | { 30 | return m_matrix.template triangularView().solve(other.derived()); 31 | } 32 | 33 | template 34 | template 35 | void Flagged::solveTriangularInPlace(const MatrixBase& other) const 36 | { 37 | m_matrix.template triangularView().solveInPlace(other.derived()); 38 | } 39 | 40 | } // end namespace Eigen 41 | 42 | #endif // EIGEN_TRIANGULAR_SOLVER2_H 43 | -------------------------------------------------------------------------------- /include/VersionChecker.hpp: -------------------------------------------------------------------------------- 1 | // based off of 2 | // async_client.cpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef VERSION_CHECKER_HPP 12 | #define VERSION_CHECKER_HPP 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | using boost::asio::ip::tcp; 24 | 25 | class VersionChecker 26 | { 27 | public: 28 | VersionChecker(boost::asio::io_service& io_service, 29 | const std::string& server, const std::string& path); 30 | std::string message(); 31 | 32 | private: 33 | void cancel_upgrade_check(const boost::system::error_code& err); 34 | void handle_resolve(const boost::system::error_code& err, 35 | tcp::resolver::iterator endpoint_iterator); 36 | void handle_connect(const boost::system::error_code& err); 37 | void handle_write_request(const boost::system::error_code& err); 38 | void handle_read_status_line(const boost::system::error_code& err); 39 | void handle_read_headers(const boost::system::error_code& err); 40 | void handle_read_content(const boost::system::error_code& err); 41 | 42 | tcp::resolver resolver_; 43 | tcp::socket socket_; 44 | boost::asio::streambuf request_; 45 | boost::asio::streambuf response_; 46 | boost::asio::deadline_timer deadline_; 47 | std::stringstream messageStream_; 48 | }; 49 | 50 | std::string getVersionMessage(); 51 | 52 | #endif //VERSION_CHECKER_HPP -------------------------------------------------------------------------------- /include/eigen3/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 2 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 3 | 4 | #include "SparseCore" 5 | #include "OrderingMethods" 6 | 7 | #include "src/Core/util/DisableStupidWarnings.h" 8 | 9 | /** 10 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 11 | * 12 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. 13 | * Those solvers are accessible via the following classes: 14 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 15 | * - BiCGSTAB for general square matrices. 16 | * 17 | * These iterative solvers are associated with some preconditioners: 18 | * - IdentityPreconditioner - not really useful 19 | * - DiagonalPreconditioner - also called JAcobi preconditioner, work very well on diagonal dominant matrices. 20 | * - IncompleteILUT - incomplete LU factorization with dual thresholding 21 | * 22 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 33 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 34 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 35 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 36 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 41 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/SparseCore/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSEREDUX_H 11 | #define EIGEN_SPARSEREDUX_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | typename internal::traits::Scalar 17 | SparseMatrixBase::sum() const 18 | { 19 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 20 | Scalar res(0); 21 | for (Index j=0; j 28 | typename internal::traits >::Scalar 29 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 30 | { 31 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 32 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 33 | } 34 | 35 | template 36 | typename internal::traits >::Scalar 37 | SparseVector<_Scalar,_Options,_Index>::sum() const 38 | { 39 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 40 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN_SPARSEREDUX_H 46 | -------------------------------------------------------------------------------- /Mince-Binaries-0.6.1/testEncodeDecode.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #============================ 4 | # USAGE: 5 | # ./testEncodeDecode.sh PATH_TO_MINCE file1.fastq [file2.fastq] 6 | # 7 | # If two files are given, they will be treated as paired-end reads 8 | # 9 | # This will report whether mince was able to encode and decode correctly 10 | #=========================== 11 | 12 | MINCE="$1" 13 | 14 | if [ ${#} -eq 2 ] ; then 15 | IN="$2" 16 | BN=`basename "$IN" .fastq` 17 | gawk 'BEGIN {n=0} {if(n++ % 4 == 1) print $1}' $IN | sort > $BN-sorted.reads 18 | echo "Compressing $IN to $BN" 19 | $MINCE -e -r $IN -o $BN-ENC 20 | echo "Decompressing $BN-ENC to $BN-DEC" 21 | $MINCE -d -i $BN-ENC -o $BN-DEC 22 | echo "" 23 | echo "Comparing $BN" 24 | grep -v ">" $BN-DEC.fa | sort > $BN-DEC-sorted.reads 25 | cmp $BN-sorted.reads $BN-DEC-sorted.reads 26 | if [ ${?} -eq 0 ] ; then 27 | echo "Looks ok; deleting files" 28 | rm $BN-sorted.reads $BN-DEC-sorted.reads 29 | rm $BN-ENC*.lz 30 | rm $BN-DEC.fa 31 | fi 32 | else 33 | IN1="$2" 34 | IN2="$3" 35 | BN=`basename "$IN1" .fastq` 36 | paste $IN1 $IN2 \ 37 | | gawk 'BEGIN {n=0} {if(n++ % 4 == 1) print $0}' \ 38 | | sort > $BN-sorted.reads 39 | 40 | echo "Compressing $IN to $BN" 41 | $MINCE -e -l IU -1 $IN1 -2 $IN2 -o $BN-ENC 42 | echo "Decompressing $BN-ENC to $BN-DEC" 43 | $MINCE -d -i $BN-ENC -o $BN-DEC 44 | echo "" 45 | echo "Comparing $BN" 46 | paste $BN-DEC1.fa $BN-DEC2.fa | grep -v ">" | sort > $BN-DEC-sorted.reads 47 | cmp $BN-sorted.reads $BN-DEC-sorted.reads 48 | if [ ${?} -eq 0 ] ; then 49 | echo "Looks ok; deleting files" 50 | rm $BN-sorted.reads $BN-DEC-sorted.reads 51 | rm $BN-DEC?.fa 52 | rm $BN-ENC*.lz 53 | fi 54 | fi 55 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Eigen2Support/Memory.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MEMORY_H 11 | #define EIGEN2_MEMORY_H 12 | 13 | namespace Eigen { 14 | 15 | inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); } 16 | inline void ei_aligned_free(void *ptr) { internal::aligned_free(ptr); } 17 | inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); } 18 | inline void* ei_handmade_aligned_malloc(size_t size) { return internal::handmade_aligned_malloc(size); } 19 | inline void ei_handmade_aligned_free(void *ptr) { internal::handmade_aligned_free(ptr); } 20 | 21 | template inline void* ei_conditional_aligned_malloc(size_t size) 22 | { 23 | return internal::conditional_aligned_malloc(size); 24 | } 25 | template inline void ei_conditional_aligned_free(void *ptr) 26 | { 27 | internal::conditional_aligned_free(ptr); 28 | } 29 | template inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size) 30 | { 31 | return internal::conditional_aligned_realloc(ptr, new_size, old_size); 32 | } 33 | 34 | template inline T* ei_aligned_new(size_t size) 35 | { 36 | return internal::aligned_new(size); 37 | } 38 | template inline void ei_aligned_delete(T *ptr, size_t size) 39 | { 40 | return internal::aligned_delete(ptr, size); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN2_MACROS_H 46 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_GEOMETRY_MODULE_H 2 | #define EIGEN_GEOMETRY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SVD" 9 | #include "LU" 10 | #include 11 | 12 | #ifndef M_PI 13 | #define M_PI 3.14159265358979323846 14 | #endif 15 | 16 | /** \defgroup Geometry_Module Geometry module 17 | * 18 | * 19 | * 20 | * This module provides support for: 21 | * - fixed-size homogeneous transformations 22 | * - translation, scaling, 2D and 3D rotations 23 | * - quaternions 24 | * - \ref MatrixBase::cross() "cross product" 25 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" 26 | * - some linear components: parametrized-lines and hyperplanes 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #include "src/Geometry/OrthoMethods.h" 34 | #include "src/Geometry/EulerAngles.h" 35 | 36 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS 37 | #include "src/Geometry/Homogeneous.h" 38 | #include "src/Geometry/RotationBase.h" 39 | #include "src/Geometry/Rotation2D.h" 40 | #include "src/Geometry/Quaternion.h" 41 | #include "src/Geometry/AngleAxis.h" 42 | #include "src/Geometry/Transform.h" 43 | #include "src/Geometry/Translation.h" 44 | #include "src/Geometry/Scaling.h" 45 | #include "src/Geometry/Hyperplane.h" 46 | #include "src/Geometry/ParametrizedLine.h" 47 | #include "src/Geometry/AlignedBox.h" 48 | #include "src/Geometry/Umeyama.h" 49 | 50 | #if defined EIGEN_VECTORIZE_SSE 51 | #include "src/Geometry/arch/Geometry_SSE.h" 52 | #endif 53 | #endif 54 | 55 | #ifdef EIGEN2_SUPPORT 56 | #include "src/Eigen2Support/Geometry/All.h" 57 | #endif 58 | 59 | #include "src/Core/util/ReenableStupidWarnings.h" 60 | 61 | #endif // EIGEN_GEOMETRY_MODULE_H 62 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 63 | 64 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 2 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup CholmodSupport_Module CholmodSupport module 14 | * 15 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 16 | * It provides the two following main factorization classes: 17 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 18 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 19 | * 20 | * For the sake of completeness, this module also propose the two following classes: 21 | * - class CholmodSimplicialLLT 22 | * - class CholmodSimplicialLDLT 23 | * Note that these classes does not bring any particular advantage compared to the built-in 24 | * SimplicialLLT and SimplicialLDLT factorization classes. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. 31 | * The dependencies depend on how cholmod has been compiled. 32 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/misc/Solve.h" 37 | #include "src/misc/SparseSolve.h" 38 | 39 | #include "src/CholmodSupport/CholmodSupport.h" 40 | 41 | 42 | #include "src/Core/util/ReenableStupidWarnings.h" 43 | 44 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 45 | 46 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | 12 | /* All the parameters defined in this file can be specialized in the 13 | * architecture specific files, and/or by the user. 14 | * More to come... */ 15 | 16 | #ifndef EIGEN_DEFAULT_SETTINGS_H 17 | #define EIGEN_DEFAULT_SETTINGS_H 18 | 19 | /** Defines the maximal loop size to enable meta unrolling of loops. 20 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 21 | * it does not correspond to the number of iterations or the number of instructions 22 | */ 23 | #ifndef EIGEN_UNROLLING_LIMIT 24 | #define EIGEN_UNROLLING_LIMIT 100 25 | #endif 26 | 27 | /** Defines the threshold between a "small" and a "large" matrix. 28 | * This threshold is mainly used to select the proper product implementation. 29 | */ 30 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 31 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 32 | #endif 33 | 34 | /** Defines the maximal width of the blocks used in the triangular product and solver 35 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 36 | */ 37 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 38 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 39 | #endif 40 | 41 | 42 | /** Defines the default number of registers available for that architecture. 43 | * Currently it must be 8 or 16. Other values will fail. 44 | */ 45 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 46 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 47 | #endif 48 | 49 | #endif // EIGEN_DEFAULT_SETTINGS_H 50 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/SparseLU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // Copyright (C) 2012 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSELU_MODULE_H 12 | #define EIGEN_SPARSELU_MODULE_H 13 | 14 | #include "SparseCore" 15 | 16 | /** 17 | * \defgroup SparseLU_Module SparseLU module 18 | * This module defines a supernodal factorization of general sparse matrices. 19 | * The code is fully optimized for supernode-panel updates with specialized kernels. 20 | * Please, see the documentation of the SparseLU class for more details. 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/misc/SparseSolve.h" 25 | 26 | // Ordering interface 27 | #include "OrderingMethods" 28 | 29 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 30 | 31 | #include "src/SparseLU/SparseLU_Structs.h" 32 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 33 | #include "src/SparseLU/SparseLUImpl.h" 34 | #include "src/SparseCore/SparseColEtree.h" 35 | #include "src/SparseLU/SparseLU_Memory.h" 36 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 37 | #include "src/SparseLU/SparseLU_relax_snode.h" 38 | #include "src/SparseLU/SparseLU_pivotL.h" 39 | #include "src/SparseLU/SparseLU_panel_dfs.h" 40 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 41 | #include "src/SparseLU/SparseLU_panel_bmod.h" 42 | #include "src/SparseLU/SparseLU_column_dfs.h" 43 | #include "src/SparseLU/SparseLU_column_bmod.h" 44 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 45 | #include "src/SparseLU/SparseLU_pruneL.h" 46 | #include "src/SparseLU/SparseLU_Utils.h" 47 | #include "src/SparseLU/SparseLU.h" 48 | 49 | #endif // EIGEN_SPARSELU_MODULE_H 50 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/NumericalDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_NUMERICALDIFF_MODULE 11 | #define EIGEN_NUMERICALDIFF_MODULE 12 | 13 | #include 14 | 15 | namespace Eigen { 16 | 17 | /** 18 | * \defgroup NumericalDiff_Module Numerical differentiation module 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | * 24 | * See http://en.wikipedia.org/wiki/Numerical_differentiation 25 | * 26 | * Warning : this should NOT be confused with automatic differentiation, which 27 | * is a different method and has its own module in Eigen : \ref 28 | * AutoDiff_Module. 29 | * 30 | * Currently only "Forward" and "Central" schemes are implemented. Those 31 | * are basic methods, and there exist some more elaborated way of 32 | * computing such approximates. They are implemented using both 33 | * proprietary and free software, and usually requires linking to an 34 | * external library. It is very easy for you to write a functor 35 | * using such software, and the purpose is quite orthogonal to what we 36 | * want to achieve with Eigen. 37 | * 38 | * This is why we will not provide wrappers for every great numerical 39 | * differentiation software that exist, but should rather stick with those 40 | * basic ones, that still are useful for testing. 41 | * 42 | * Also, the \ref NonLinearOptimization_Module needs this in order to 43 | * provide full features compatibility with the original (c)minpack 44 | * package. 45 | * 46 | */ 47 | } 48 | 49 | //@{ 50 | 51 | #include "src/NumericalDiff/NumericalDiff.h" 52 | 53 | //@} 54 | 55 | 56 | #endif // EIGEN_NUMERICALDIFF_MODULE 57 | -------------------------------------------------------------------------------- /include/spdlog/sinks/dist_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 David Schury, Gabi Melman 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "../details/log_msg.h" 14 | #include "../details/null_mutex.h" 15 | #include "./base_sink.h" 16 | #include "./sink.h" 17 | 18 | namespace spdlog 19 | { 20 | namespace sinks 21 | { 22 | template 23 | class dist_sink: public base_sink 24 | { 25 | public: 26 | explicit dist_sink() :_sinks() {} 27 | dist_sink(const dist_sink&) = delete; 28 | dist_sink& operator=(const dist_sink&) = delete; 29 | virtual ~dist_sink() = default; 30 | 31 | protected: 32 | void _sink_it(const details::log_msg& msg) override 33 | { 34 | for (auto iter = _sinks.begin(); iter != _sinks.end(); iter++) 35 | (*iter)->log(msg); 36 | } 37 | 38 | std::vector> _sinks; 39 | 40 | public: 41 | void flush() override 42 | { 43 | std::lock_guard lock(base_sink::_mutex); 44 | for (auto iter = _sinks.begin(); iter != _sinks.end(); iter++) 45 | (*iter)->flush(); 46 | } 47 | 48 | void add_sink(std::shared_ptr sink) 49 | { 50 | std::lock_guard lock(base_sink::_mutex); 51 | if (sink && 52 | _sinks.end() == std::find(_sinks.begin(), _sinks.end(), sink)) 53 | { 54 | _sinks.push_back(sink); 55 | } 56 | } 57 | 58 | void remove_sink(std::shared_ptr sink) 59 | { 60 | std::lock_guard lock(base_sink::_mutex); 61 | auto pos = std::find(_sinks.begin(), _sinks.end(), sink); 62 | if (pos != _sinks.end()) 63 | { 64 | _sinks.erase(pos); 65 | } 66 | } 67 | }; 68 | 69 | typedef dist_sink dist_sink_mt; 70 | typedef dist_sink dist_sink_st; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /scripts/ComputeMutationRate.py: -------------------------------------------------------------------------------- 1 | """Compute Mutation Rate 2 | 3 | Usage: 4 | ComputeMutationRate.py 5 | 6 | 7 | Options: 8 | -h --help Show this message. 9 | """ 10 | from docopt import docopt 11 | from Bio import SeqIO 12 | import itertools 13 | 14 | 15 | class bcolors: 16 | HEADER = '\033[95m' 17 | OKBLUE = '\033[94m' 18 | OKGREEN = '\033[92m' 19 | WARNING = '\033[93m' 20 | FAIL = '\033[91m' 21 | ENDC = '\033[0m' 22 | 23 | def disable(self): 24 | self.HEADER = '' 25 | self.OKBLUE = '' 26 | self.OKGREEN = '' 27 | self.WARNING = '' 28 | self.FAIL = '' 29 | self.ENDC = '' 30 | 31 | def main(args): 32 | in1 = args[''] 33 | in2 = args[''] 34 | 35 | seq1 = SeqIO.parse(in1, 'fasta') 36 | seq2 = SeqIO.parse(in2, 'fasta') 37 | nMut = 0 38 | totLen = 0 39 | i = 0 40 | 41 | for s1, s2 in itertools.izip(seq1, seq2): 42 | o1 = "" 43 | o2 = "" 44 | newMut = True 45 | assert(s1.name == s2.name) 46 | totLen += len(s1.seq) 47 | for a,b in itertools.izip(s1.seq, s2.seq): 48 | if a != b: 49 | nMut+= 1 50 | newMut = True 51 | o1 += bcolors.OKGREEN + a + bcolors.ENDC 52 | o2 += bcolors.FAIL + b + bcolors.ENDC 53 | else: 54 | if newMut: 55 | o1 += "***" 56 | o2 += "***" 57 | newMut = False 58 | 59 | i += 1 60 | print(o1) 61 | print(o2) 62 | if i % 1000 == 0: 63 | print("There were {} mutations in {} bases; total rate = {:0.2f}\r\r".format(\ 64 | nMut, totLen, (100.0 * nMut) / totLen)) 65 | print("There were {} mutations in {} bases; total rate = {:0.2f}\r\r".format(\ 66 | nMut, totLen, (100.0 * nMut) / totLen)) 67 | 68 | if __name__ == "__main__": 69 | args = docopt(__doc__, version="Compute Mutation Rate v1.0") 70 | main(args) 71 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Eigen2Support/QR.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2011 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_QR_H 12 | #define EIGEN2_QR_H 13 | 14 | namespace Eigen { 15 | 16 | template 17 | class QR : public HouseholderQR 18 | { 19 | public: 20 | 21 | typedef HouseholderQR Base; 22 | typedef Block MatrixRBlockType; 23 | 24 | QR() : Base() {} 25 | 26 | template 27 | explicit QR(const T& t) : Base(t) {} 28 | 29 | template 30 | bool solve(const MatrixBase& b, ResultType *result) const 31 | { 32 | *result = static_cast(this)->solve(b); 33 | return true; 34 | } 35 | 36 | MatrixType matrixQ(void) const { 37 | MatrixType ret = MatrixType::Identity(this->rows(), this->cols()); 38 | ret = this->householderQ() * ret; 39 | return ret; 40 | } 41 | 42 | bool isFullRank() const { 43 | return true; 44 | } 45 | 46 | const TriangularView 47 | matrixR(void) const 48 | { 49 | int cols = this->cols(); 50 | return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView(); 51 | } 52 | }; 53 | 54 | /** \return the QR decomposition of \c *this. 55 | * 56 | * \sa class QR 57 | */ 58 | template 59 | const QR::PlainObject> 60 | MatrixBase::qr() const 61 | { 62 | return QR(eval()); 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN2_QR_H 68 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSECORE_MODULE_H 2 | #define EIGEN_SPARSECORE_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /** 15 | * \defgroup SparseCore_Module SparseCore module 16 | * 17 | * This module provides a sparse matrix representation, and basic associatd matrix manipulations 18 | * and operations. 19 | * 20 | * See the \ref TutorialSparse "Sparse tutorial" 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * This module depends on: Core. 27 | */ 28 | 29 | namespace Eigen { 30 | 31 | /** The type used to identify a general sparse storage. */ 32 | struct Sparse {}; 33 | 34 | } 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/CompressedStorage.h" 39 | #include "src/SparseCore/AmbiVector.h" 40 | #include "src/SparseCore/SparseMatrix.h" 41 | #include "src/SparseCore/MappedSparseMatrix.h" 42 | #include "src/SparseCore/SparseVector.h" 43 | #include "src/SparseCore/SparseBlock.h" 44 | #include "src/SparseCore/SparseTranspose.h" 45 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 46 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 47 | #include "src/SparseCore/SparseDot.h" 48 | #include "src/SparseCore/SparsePermutation.h" 49 | #include "src/SparseCore/SparseRedux.h" 50 | #include "src/SparseCore/SparseFuzzy.h" 51 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 52 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 53 | #include "src/SparseCore/SparseProduct.h" 54 | #include "src/SparseCore/SparseDenseProduct.h" 55 | #include "src/SparseCore/SparseDiagonalProduct.h" 56 | #include "src/SparseCore/SparseTriangularView.h" 57 | #include "src/SparseCore/SparseSelfAdjointView.h" 58 | #include "src/SparseCore/TriangularSolver.h" 59 | #include "src/SparseCore/SparseView.h" 60 | 61 | #include "src/Core/util/ReenableStupidWarnings.h" 62 | 63 | #endif // EIGEN_SPARSECORE_MODULE_H 64 | 65 | -------------------------------------------------------------------------------- /scripts/make-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SOURCE="${BASH_SOURCE[0]}" 4 | while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 5 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 6 | SOURCE="$(readlink "$SOURCE")" 7 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 8 | done 9 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 10 | 11 | host= 12 | version= 13 | 14 | while getopts "v:n:" opt; do 15 | case $opt in 16 | n) 17 | echo "Host is $OPTARG" >&2 18 | host=$OPTARG 19 | ;; 20 | v) 21 | echo "Version is $OPTARG" >&2 22 | version=$OPTARG 23 | ;; 24 | \?) 25 | echo "Invalid option: -$OPTARG" >&2 26 | exit 1 27 | ;; 28 | esac 29 | done 30 | 31 | echo -e "Preparing binary release\n=====================\n" 32 | echo -e "Version = ${version}" 33 | echo -e "Host = ${host}" 34 | 35 | # create the binary directory 36 | betaname=SailfishBeta-${version}_${host} 37 | mkdir ${DIR}/../RELEASES 38 | mkdir ${DIR}/../RELEASES/${betaname} 39 | mkdir ${DIR}/../RELEASES/${betaname}/bin 40 | mkdir ${DIR}/../RELEASES/${betaname}/lib 41 | 42 | # copy over the executable and Intel TBB libraries 43 | echo -e "Copying over the binary and Intel TBB libraries\n" 44 | cp ${DIR}/../bin/sailfish ${DIR}/../RELEASES/${betaname}/bin/ 45 | cp ${DIR}/../lib/libtbb* ${DIR}/../RELEASES/${betaname}/lib/ 46 | 47 | # copy other dependencies (shared libraries) 48 | echo -e "Copying over other shared library dependencies\n" 49 | bash ${DIR}/../scripts/cpld.bash ${DIR}/../bin/sailfish ${DIR}/../RELEASES/${betaname}/lib/ 50 | echo -e "Removing dangerous dependencies\n" 51 | rm ${DIR}/../RELEASES/${betaname}/lib/libc.so.6 52 | rm ${DIR}/../RELEASES/${betaname}/lib/ld-linux-x86-64.so.2 53 | rm ${DIR}/../RELEASES/${betaname}/lib/libdl.so.2 54 | rm ${DIR}/../RELEASES/${betaname}/lib/libpthread*.so.* 55 | 56 | # now make the tarball 57 | echo -e "Making the tarball\n" 58 | cd ${DIR}/../RELEASES 59 | tar czvf ${betaname}.tar.gz ${betaname} 60 | 61 | echo -e "Done making release!" 62 | -------------------------------------------------------------------------------- /include/spdlog/details/log_msg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "../common.h" 10 | #include "./format.h" 11 | 12 | namespace spdlog 13 | { 14 | namespace details 15 | { 16 | struct log_msg 17 | { 18 | log_msg() = default; 19 | log_msg(level::level_enum l): 20 | logger_name(), 21 | level(l), 22 | raw(), 23 | formatted() {} 24 | 25 | 26 | log_msg(const log_msg& other) : 27 | logger_name(other.logger_name), 28 | level(other.level), 29 | time(other.time), 30 | thread_id(other.thread_id) 31 | { 32 | if (other.raw.size()) 33 | raw << fmt::BasicStringRef(other.raw.data(), other.raw.size()); 34 | if (other.formatted.size()) 35 | formatted << fmt::BasicStringRef(other.formatted.data(), other.formatted.size()); 36 | } 37 | 38 | log_msg(log_msg&& other) : 39 | logger_name(std::move(other.logger_name)), 40 | level(other.level), 41 | time(std::move(other.time)), 42 | thread_id(other.thread_id), 43 | raw(std::move(other.raw)), 44 | formatted(std::move(other.formatted)) 45 | { 46 | other.clear(); 47 | } 48 | 49 | log_msg& operator=(log_msg&& other) 50 | { 51 | if (this == &other) 52 | return *this; 53 | 54 | logger_name = std::move(other.logger_name); 55 | level = other.level; 56 | time = std::move(other.time); 57 | thread_id = other.thread_id; 58 | raw = std::move(other.raw); 59 | formatted = std::move(other.formatted); 60 | other.clear(); 61 | return *this; 62 | } 63 | 64 | void clear() 65 | { 66 | level = level::off; 67 | raw.clear(); 68 | formatted.clear(); 69 | } 70 | 71 | std::string logger_name; 72 | level::level_enum level; 73 | log_clock::time_point time; 74 | size_t thread_id; 75 | fmt::MemoryWriter raw; 76 | fmt::MemoryWriter formatted; 77 | }; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing common coefficient wise functions. 12 | 13 | /** \returns an expression of the difference of \c *this and \a other 14 | * 15 | * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). 16 | * 17 | * \sa class CwiseBinaryOp, operator-=() 18 | */ 19 | EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op) 20 | 21 | /** \returns an expression of the sum of \c *this and \a other 22 | * 23 | * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). 24 | * 25 | * \sa class CwiseBinaryOp, operator+=() 26 | */ 27 | EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op) 28 | 29 | /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other 30 | * 31 | * The template parameter \a CustomBinaryOp is the type of the functor 32 | * of the custom operator (see class CwiseBinaryOp for an example) 33 | * 34 | * Here is an example illustrating the use of custom functors: 35 | * \include class_CwiseBinaryOp.cpp 36 | * Output: \verbinclude class_CwiseBinaryOp.out 37 | * 38 | * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() 39 | */ 40 | template 41 | EIGEN_STRONG_INLINE const CwiseBinaryOp 42 | binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other, const CustomBinaryOp& func = CustomBinaryOp()) const 43 | { 44 | return CwiseBinaryOp(derived(), other.derived(), func); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 2 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #ifdef EMPTY 9 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 10 | #endif 11 | 12 | typedef int int_t; 13 | #include 14 | #include 15 | #include 16 | 17 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 18 | // so we remove it in favor of a SUPERLU_EMPTY token. 19 | // If EMPTY was already defined then we don't undef it. 20 | 21 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 22 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 23 | #elif defined(EMPTY) 24 | # undef EMPTY 25 | #endif 26 | 27 | #define SUPERLU_EMPTY (-1) 28 | 29 | namespace Eigen { struct SluMatrix; } 30 | 31 | /** \ingroup Support_modules 32 | * \defgroup SuperLUSupport_Module SuperLUSupport module 33 | * 34 | * This module provides an interface to the SuperLU library. 35 | * It provides the following factorization class: 36 | * - class SuperLU: a supernodal sequential LU factorization. 37 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 38 | * 39 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 40 | * 41 | * \code 42 | * #include 43 | * \endcode 44 | * 45 | * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. 46 | * The dependencies depend on how superlu has been compiled. 47 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 48 | * 49 | */ 50 | 51 | #include "src/misc/Solve.h" 52 | #include "src/misc/SparseSolve.h" 53 | 54 | #include "src/SuperLUSupport/SuperLUSupport.h" 55 | 56 | 57 | #include "src/Core/util/ReenableStupidWarnings.h" 58 | 59 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 60 | -------------------------------------------------------------------------------- /src/FASTAParser.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | #include "jellyfish/mer_dna.hpp" 8 | #include "jellyfish/stream_manager.hpp" 9 | #include "jellyfish/whole_sequence_parser.hpp" 10 | 11 | #include "FASTAParser.hpp" 12 | #include "Transcript.hpp" 13 | #include "SailfishStringUtils.hpp" 14 | 15 | FASTAParser::FASTAParser(const std::string& fname): fname_(fname) {} 16 | 17 | void FASTAParser::populateTargets(std::vector& refs) { 18 | using stream_manager = jellyfish::stream_manager::const_iterator>; 19 | using single_parser = jellyfish::whole_sequence_parser; 20 | 21 | using std::string; 22 | using std::unordered_map; 23 | 24 | unordered_map nameToID; 25 | for (size_t idx = 0; idx < refs.size(); ++idx) { nameToID[refs[idx].RefName] = idx; } 26 | 27 | std::vector readFiles{fname_}; 28 | size_t maxReadGroup{1000}; // Number of files to read simultaneously 29 | size_t concurrentFile{1}; // Number of reads in each "job" 30 | stream_manager streams(readFiles.cbegin(), readFiles.cend(), concurrentFile); 31 | single_parser parser(4, maxReadGroup, concurrentFile, streams); 32 | 33 | while(true) { 34 | typename single_parser::job j(parser); // Get a job from the parser: a bunch of read (at most max_read_group) 35 | if(j.is_empty()) break; // If got nothing, quit 36 | 37 | for(size_t i = 0; i < j->nb_filled; ++i) { // For all the read we got 38 | std::string& header = j->data[i].header; 39 | std::string name = header.substr(0, header.find(' ')); 40 | 41 | auto it = nameToID.find(name); 42 | if (it == nameToID.end()) { 43 | std::cerr << "WARNING: Transcript " << name << " appears in the reference but did not appear in the BAM\n"; 44 | } else { 45 | std::string& seq = j->data[i].seq; 46 | refs[it->second].Sequence = sailfish::stringtools::encodeSequenceInSAM(seq.c_str(), seq.size()); 47 | } 48 | } 49 | } 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/src/NonLinearOptimization/chkder.h: -------------------------------------------------------------------------------- 1 | #define chkder_log10e 0.43429448190325182765 2 | #define chkder_factor 100. 3 | 4 | namespace Eigen { 5 | 6 | namespace internal { 7 | 8 | template 9 | void chkder( 10 | const Matrix< Scalar, Dynamic, 1 > &x, 11 | const Matrix< Scalar, Dynamic, 1 > &fvec, 12 | const Matrix< Scalar, Dynamic, Dynamic > &fjac, 13 | Matrix< Scalar, Dynamic, 1 > &xp, 14 | const Matrix< Scalar, Dynamic, 1 > &fvecp, 15 | int mode, 16 | Matrix< Scalar, Dynamic, 1 > &err 17 | ) 18 | { 19 | using std::sqrt; 20 | using std::abs; 21 | using std::log; 22 | 23 | typedef DenseIndex Index; 24 | 25 | const Scalar eps = sqrt(NumTraits::epsilon()); 26 | const Scalar epsf = chkder_factor * NumTraits::epsilon(); 27 | const Scalar epslog = chkder_log10e * log(eps); 28 | Scalar temp; 29 | 30 | const Index m = fvec.size(), n = x.size(); 31 | 32 | if (mode != 2) { 33 | /* mode = 1. */ 34 | xp.resize(n); 35 | for (Index j = 0; j < n; ++j) { 36 | temp = eps * abs(x[j]); 37 | if (temp == 0.) 38 | temp = eps; 39 | xp[j] = x[j] + temp; 40 | } 41 | } 42 | else { 43 | /* mode = 2. */ 44 | err.setZero(m); 45 | for (Index j = 0; j < n; ++j) { 46 | temp = abs(x[j]); 47 | if (temp == 0.) 48 | temp = 1.; 49 | err += temp * fjac.col(j); 50 | } 51 | for (Index i = 0; i < m; ++i) { 52 | temp = 1.; 53 | if (fvec[i] != 0. && fvecp[i] != 0. && abs(fvecp[i] - fvec[i]) >= epsf * abs(fvec[i])) 54 | temp = eps * abs((fvecp[i] - fvec[i]) / eps - err[i]) / (abs(fvec[i]) + abs(fvecp[i])); 55 | err[i] = 1.; 56 | if (temp > NumTraits::epsilon() && temp < eps) 57 | err[i] = (chkder_log10e * log(temp) - epslog) / epslog; 58 | if (temp >= eps) 59 | err[i] = 0.; 60 | } 61 | } 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Core/CoreIterators.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_COREITERATORS_H 11 | #define EIGEN_COREITERATORS_H 12 | 13 | namespace Eigen { 14 | 15 | /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core 16 | */ 17 | 18 | /** \ingroup SparseCore_Module 19 | * \class InnerIterator 20 | * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression 21 | * 22 | * todo 23 | */ 24 | 25 | // generic version for dense matrix and expressions 26 | template class DenseBase::InnerIterator 27 | { 28 | protected: 29 | typedef typename Derived::Scalar Scalar; 30 | typedef typename Derived::Index Index; 31 | 32 | enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; 33 | public: 34 | EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) 35 | : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) 36 | {} 37 | 38 | EIGEN_STRONG_INLINE Scalar value() const 39 | { 40 | return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) 41 | : m_expression.coeff(m_inner, m_outer); 42 | } 43 | 44 | EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } 45 | 46 | EIGEN_STRONG_INLINE Index index() const { return m_inner; } 47 | inline Index row() const { return IsRowMajor ? m_outer : index(); } 48 | inline Index col() const { return IsRowMajor ? index() : m_outer; } 49 | 50 | EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } 51 | 52 | protected: 53 | const Derived& m_expression; 54 | Index m_inner; 55 | const Index m_outer; 56 | const Index m_end; 57 | }; 58 | 59 | } // end namespace Eigen 60 | 61 | #endif // EIGEN_COREITERATORS_H 62 | -------------------------------------------------------------------------------- /include/spdlog/common.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | //visual studio does not support noexcept yet 14 | #ifndef _MSC_VER 15 | #define SPDLOG_NOEXCEPT noexcept 16 | #else 17 | #define SPDLOG_NOEXCEPT throw() 18 | #endif 19 | 20 | 21 | namespace spdlog 22 | { 23 | 24 | class formatter; 25 | 26 | namespace sinks 27 | { 28 | class sink; 29 | } 30 | 31 | // Common types across the lib 32 | using log_clock = std::chrono::system_clock; 33 | using sink_ptr = std::shared_ptr < sinks::sink >; 34 | using sinks_init_list = std::initializer_list < sink_ptr >; 35 | using formatter_ptr = std::shared_ptr; 36 | 37 | 38 | //Log level enum 39 | namespace level 40 | { 41 | typedef enum 42 | { 43 | trace = 0, 44 | debug = 1, 45 | info = 2, 46 | notice = 3, 47 | warn = 4, 48 | err = 5, 49 | critical = 6, 50 | alert = 7, 51 | emerg = 8, 52 | off = 9 53 | } level_enum; 54 | 55 | static const char* level_names[] { "trace", "debug", "info", "notice", "warning", "error", "critical", "alert", "emerg", "off"}; 56 | 57 | static const char* short_level_names[] { "T", "D", "I", "N", "W", "E", "C", "A", "M", "O"}; 58 | 59 | inline const char* to_str(spdlog::level::level_enum l) 60 | { 61 | return level_names[l]; 62 | } 63 | 64 | inline const char* to_short_str(spdlog::level::level_enum l) 65 | { 66 | return short_level_names[l]; 67 | } 68 | } //level 69 | 70 | 71 | // 72 | // Async overflow policy - block by default. 73 | // 74 | enum class async_overflow_policy 75 | { 76 | block_retry, // Block / yield / sleep until message can be enqueued 77 | discard_log_msg // Discard the message it enqueue fails 78 | }; 79 | 80 | 81 | // 82 | // Log exception 83 | // 84 | class spdlog_ex : public std::exception 85 | { 86 | public: 87 | spdlog_ex(const std::string& msg) :_msg(msg) {} 88 | const char* what() const SPDLOG_NOEXCEPT override 89 | { 90 | return _msg.c_str(); 91 | } 92 | private: 93 | std::string _msg; 94 | 95 | }; 96 | 97 | } //spdlog -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/src/NonLinearOptimization/covar.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | void covar( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const VectorXi &ipvt, 9 | Scalar tol = std::sqrt(NumTraits::epsilon()) ) 10 | { 11 | using std::abs; 12 | typedef DenseIndex Index; 13 | 14 | /* Local variables */ 15 | Index i, j, k, l, ii, jj; 16 | bool sing; 17 | Scalar temp; 18 | 19 | /* Function Body */ 20 | const Index n = r.cols(); 21 | const Scalar tolr = tol * abs(r(0,0)); 22 | Matrix< Scalar, Dynamic, 1 > wa(n); 23 | eigen_assert(ipvt.size()==n); 24 | 25 | /* form the inverse of r in the full upper triangle of r. */ 26 | l = -1; 27 | for (k = 0; k < n; ++k) 28 | if (abs(r(k,k)) > tolr) { 29 | r(k,k) = 1. / r(k,k); 30 | for (j = 0; j <= k-1; ++j) { 31 | temp = r(k,k) * r(j,k); 32 | r(j,k) = 0.; 33 | r.col(k).head(j+1) -= r.col(j).head(j+1) * temp; 34 | } 35 | l = k; 36 | } 37 | 38 | /* form the full upper triangle of the inverse of (r transpose)*r */ 39 | /* in the full upper triangle of r. */ 40 | for (k = 0; k <= l; ++k) { 41 | for (j = 0; j <= k-1; ++j) 42 | r.col(j).head(j+1) += r.col(k).head(j+1) * r(j,k); 43 | r.col(k).head(k+1) *= r(k,k); 44 | } 45 | 46 | /* form the full lower triangle of the covariance matrix */ 47 | /* in the strict lower triangle of r and in wa. */ 48 | for (j = 0; j < n; ++j) { 49 | jj = ipvt[j]; 50 | sing = j > l; 51 | for (i = 0; i <= j; ++i) { 52 | if (sing) 53 | r(i,j) = 0.; 54 | ii = ipvt[i]; 55 | if (ii > jj) 56 | r(ii,jj) = r(i,j); 57 | if (ii < jj) 58 | r(jj,ii) = r(i,j); 59 | } 60 | wa[jj] = r(j,j); 61 | } 62 | 63 | /* symmetrize the covariance matrix in r. */ 64 | r.topLeftCorner(n,n).template triangularView() = r.topLeftCorner(n,n).transpose(); 65 | r.diagonal() = wa; 66 | } 67 | 68 | } // end namespace internal 69 | 70 | } // end namespace Eigen 71 | -------------------------------------------------------------------------------- /include/ReadKmerDist.hpp: -------------------------------------------------------------------------------- 1 | #ifndef READ_KMER_DIST_HPP 2 | #define READ_KMER_DIST_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "UtilityFunctions.hpp" 11 | #include "SailfishUtils.hpp" 12 | 13 | template 14 | class ReadKmerDist { 15 | public: 16 | std::array counts; 17 | 18 | ReadKmerDist() { 19 | // set a pseudo-count of 1 20 | for (size_t i = 0; i < counts.size(); ++i) { 21 | counts[i] = 1; 22 | } 23 | } 24 | 25 | inline constexpr uint32_t getK() { return K; } 26 | 27 | inline uint64_t totalCount() { 28 | CountT c{0}; 29 | for (auto const& rc : counts) { c += rc; } 30 | return c; 31 | } 32 | 33 | // update the k-mer context for the hit at position p. 34 | // The underlying transcript is from [start, end) 35 | inline bool update(const char* start, const char *p, const char *end, 36 | sailfish::utils::Direction dir) { 37 | using sailfish::utils::Direction; 38 | int posBeforeHit = 2; 39 | int posAfterHit = 4; 40 | bool success{false}; 41 | switch (dir) { 42 | case Direction::FORWARD : 43 | { 44 | // If we can fit the window before and after the read 45 | if ((p - start) >= posBeforeHit and 46 | ((p - posBeforeHit + K) < end) ) { 47 | p -= posBeforeHit; 48 | // If the read matches in the forward direction, we take 49 | // the RC sequence. 50 | auto idx = indexForKmer(p, K, Direction::REVERSE_COMPLEMENT); 51 | if (idx > counts.size()) { return false; } 52 | counts[idx]++; 53 | success = true; 54 | } 55 | } 56 | break; 57 | case Direction::REVERSE_COMPLEMENT : 58 | { 59 | if ((p - start) >= posAfterHit and 60 | ((p - posAfterHit + K) < end) ) { 61 | p -= posAfterHit; 62 | auto idx = indexForKmer(p, K, Direction::FORWARD); 63 | if (idx > counts.size()) { return false; } 64 | counts[idx]++; 65 | success = true; 66 | } 67 | } 68 | break; 69 | default: 70 | break; 71 | } 72 | return success; 73 | } 74 | 75 | }; 76 | #endif // READ_KMER_DIST_HPP 77 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_WARNINGS_DISABLED 2 | #define EIGEN_WARNINGS_DISABLED 3 | 4 | #ifdef _MSC_VER 5 | // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) 6 | // 4101 - unreferenced local variable 7 | // 4127 - conditional expression is constant 8 | // 4181 - qualifier applied to reference type ignored 9 | // 4211 - nonstandard extension used : redefined extern to static 10 | // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data 11 | // 4273 - QtAlignedMalloc, inconsistent DLL linkage 12 | // 4324 - structure was padded due to declspec(align()) 13 | // 4512 - assignment operator could not be generated 14 | // 4522 - 'class' : multiple assignment operators specified 15 | // 4700 - uninitialized local variable 'xyz' used 16 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 17 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 18 | #pragma warning( push ) 19 | #endif 20 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) 21 | #elif defined __INTEL_COMPILER 22 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 23 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 24 | // typedef that may be a reference type. 25 | // 279 - controlling expression is constant 26 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 27 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 28 | #pragma warning push 29 | #endif 30 | #pragma warning disable 2196 279 31 | #elif defined __clang__ 32 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 33 | // this is really a stupid warning as it warns on compile-time expressions involving enums 34 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 35 | #pragma clang diagnostic push 36 | #endif 37 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 38 | #endif 39 | 40 | #endif // not EIGEN_WARNINGS_DISABLED 41 | -------------------------------------------------------------------------------- /include/cereal/types/utility.hpp: -------------------------------------------------------------------------------- 1 | /*! \file utility.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of cereal nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_UTILITY_HPP_ 31 | #define CEREAL_TYPES_UTILITY_HPP_ 32 | 33 | #include 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Serializing for std::pair 39 | template inline 40 | void CEREAL_SERIALIZE_FUNCTION_NAME( Archive & ar, std::pair & pair ) 41 | { 42 | ar( CEREAL_NVP_("first", pair.first), 43 | CEREAL_NVP_("second", pair.second) ); 44 | } 45 | } // namespace cereal 46 | 47 | #endif // CEREAL_TYPES_UTILITY_HPP_ 48 | -------------------------------------------------------------------------------- /scripts/push-binary.sh: -------------------------------------------------------------------------------- 1 | echo -e "Preparing binary release\n=====================\n" 2 | 3 | # create the binary directory 4 | mkdir $HOME/SailfishBeta-latest_ubuntu-12.04 5 | mkdir $HOME/SailfishBeta-latest_ubuntu-12.04/bin 6 | mkdir $HOME/SailfishBeta-latest_ubuntu-12.04/lib 7 | 8 | # copy over the executable and Intel TBB libraries 9 | echo -e "Copying over the binary and Intel TBB libraries\n" 10 | cp $TRAVIS_BUILD_DIR/bin/sailfish $HOME/SailfishBeta-latest_ubuntu-12.04/bin/ 11 | cp $TRAVIS_BUILD_DIR/lib/libtbb* $HOME/SailfishBeta-latest_ubuntu-12.04/lib/ 12 | 13 | # copy other dependencies (shared libraries) 14 | echo -e "Copying over other shared library dependencies\n" 15 | bash $TRAVIS_BUILD_DIR/scripts/cpld.bash $TRAVIS_BUILD_DIR/bin/sailfish $HOME/SailfishBeta-latest_ubuntu-12.04/lib/ 16 | echo -e "Removing dangerous dependencies\n" 17 | rm $HOME/SailfishBeta-latest_ubuntu-12.04/lib/libc.so.6 18 | rm $HOME/SailfishBeta-latest_ubuntu-12.04/lib/ld-linux-x86-64.so.2 19 | rm $HOME/SailfishBeta-latest_ubuntu-12.04/lib/libdl.so.2 20 | rm $HOME/SailfishBeta-latest_ubuntu-12.04/lib/libpthread*.so.* 21 | 22 | # now make the tarball 23 | echo -e "Making the tarball\n" 24 | cd $HOME 25 | tar czvf SailfishBeta-latest_ubuntu-12.04.tar.gz SailfishBeta-latest_ubuntu-12.04 26 | 27 | echo -e "Pushing the tarball to GitHub\n" 28 | # Since it's currently unclear to me how to overwrite an asset via the GitHub 29 | # API, the following code deletes the old asset, and uploads the new one in its place 30 | 31 | # Get the previous asset id of the tarball 32 | echo -e "Getting previous asset ID\n" 33 | ASSETID=`curl -s -X GET https://api.github.com/repos/kingsfordgroup/sailfish/releases/749947/assets | grep "\"id" | head -1 | awk '{gsub(/,$/,""); print $2}'` 34 | 35 | # Delete the previous tarball 36 | echo -e "Deleting previous asset\n" 37 | curl -X DELETE -H "Authorization: token ${SAILFISH_PUSH_KEY}" https://api.github.com/repos/kingsfordgroup/sailfish/releases/assets/$ASSETID 38 | 39 | # Upload the new tarball 40 | echo -e "Uploading new asset\n" 41 | curl -X POST --data-binary "@SailfishBeta-latest_ubuntu-12.04.tar.gz" https://uploads.github.com/repos/kingsfordgroup/sailfish/releases/749947/assets?name=SailfishBeta-latest_ubuntu-12.04.tar.gz --header "Content-Type:application/gzip" -H "Authorization: token ${SAILFISH_PUSH_KEY}" 42 | echo -e "Done!\n" 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Quark 2 | ===== 3 | 4 | semi-reference-based short read compression 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Assumption 12 | 13 | The read files are in gzipped format i.e. they should be like .. 1.fastq.gz and 2.fastq.gz 14 | 15 | The software is tested on paired end and single end data on bash compatible shell (redirection might not work with *fish* kind of ad on), ~~*single end support will be added to the "quark.sh" script soon*.~~ 16 | 17 | ## Dependency 18 | 19 | Quark depends on `plzip` for downstream compression. More information about Plzip and installation guide can be found [here](http://www.nongnu.org/lzip/plzip.html). 20 | 21 | 22 | 23 | ## Compile 24 | 25 | ```{r, engine='bash', encode and decode} 26 | $git clone www.github.com/COMBINE-lab/quark.git 27 | $cd quark 28 | $mkdir build 29 | $cd build 30 | $cmake .. 31 | $make 32 | $cd .. 33 | ``` 34 | 35 | ##Running Quark 36 | 37 | To see the options 38 | 39 | ```{r, engine='bash', encode and decode} 40 | $./quark.sh -h 41 | 42 | ``` 43 | 44 | ### To build the index with kmer size k 45 | 46 | ```{r, engine='bash', encode and decode} 47 | snakemake -s quark.snake make_index --config out="" fasta="" kmer=<#k> 48 | ``` 49 | 50 | 51 | ### To Encode 52 | 53 | #### Single End 54 | 55 | ```{r, engine='bash', encode and decode} 56 | snakemake -s quark.snake encode --config out="" index="" r="" p=<#threads> lib="single" quality=0 57 | ``` 58 | 59 | 60 | #### Paired end 61 | 62 | ```{r, engine='bash', encode and decode} 63 | snakemake -s quark.snake encode --config out="" index="" m1="" m2="" p=<#threads> lib="paired" quality=0 64 | ``` 65 | 66 | ### To Decode 67 | 68 | ```{r, engine='bash', encode and decode} 69 | snakemake -s quark.snake decode --config in="" out="" lib="paired/single" quality=0 70 | ``` 71 | 72 | 73 | 74 | ## To check the encoded and decoded sequences are same !! (it is lossless) 75 | 76 | 77 | ```{r, engine='bash', encode and decode} 78 | $./check_pair.sh 79 | 80 | ``` 81 | ## Link to the preprint 82 | 83 | [Quark enables semi-reference-based compression of RNA-seq data](http://dx.doi.org/10.1101/085878) by Hirak Sarkar, Rob Patro 84 | 85 | -------------------------------------------------------------------------------- /include/SailfishMath.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SAILFISH_MATH_HPP 2 | #define SAILFISH_MATH_HPP 3 | 4 | // Deal with an older version of Boost gracefully. 5 | // Thanks, Titus! 6 | // If we have built-ins, do as Boost does 7 | #ifndef BOOST_LIKELY 8 | #if defined(__has_builtin) 9 | #if __has_builtin(__builtin_expect) 10 | #define BOOST_LIKELY(x) __builtin_expect(x, 1) 11 | #endif 12 | #endif 13 | #endif 14 | 15 | #ifndef BOOST_UNLIKELY 16 | #if defined(__has_builtin) 17 | #if __has_builtin(__builtin_expect) 18 | #define BOOST_UNLIKELY(x) __builtin_expect(x, 0) 19 | #endif 20 | #endif 21 | #endif 22 | 23 | // If we didn't have those built-ins fall back to this 24 | #ifndef BOOST_LIKELY 25 | #define BOOST_LIKELY(x) (x) 26 | #endif 27 | 28 | #ifndef BOOST_UNLIKELY 29 | #define BOOST_UNLIKELY(x) (x) 30 | #endif 31 | 32 | #include 33 | #include 34 | 35 | namespace sailfish { 36 | 37 | namespace math { 38 | constexpr double LOG_0 = HUGE_VAL; 39 | constexpr double LOG_1 = 0; 40 | constexpr double LOG_ONEHALF = -0.69314718055994530941; 41 | constexpr double LOG_ORPHAN_PROB = -2.30258509299404568401; 42 | constexpr double EPSILON = 0.375e-10; 43 | const double LOG_EPSILON = log(EPSILON); 44 | 45 | // Taken from https://github.com/adarob/eXpress/blob/master/src/main.h 46 | inline bool approxEqual(double a, double b, double eps=EPSILON) { 47 | return std::abs(a-b) <= eps; 48 | } 49 | 50 | // Taken from https://github.com/adarob/eXpress/blob/master/src/main.h 51 | inline double logAdd(double x, double y) { 52 | if (std::abs(x) == LOG_0) { return y; } 53 | if (std::abs(y) == LOG_0) { return x; } 54 | if (y > x) { std::swap(x,y); } 55 | double sum = x + std::log(1 + std::exp(y-x)); 56 | return sum; 57 | } 58 | 59 | // Taken from https://github.com/adarob/eXpress/blob/master/src/main.h 60 | inline double logSub(double x, double y) { 61 | if (std::abs(y) == LOG_0) { return x; } 62 | if (x <= y) { 63 | assert(std::fabs(x-y) < 1e-5); 64 | return LOG_0; 65 | } 66 | double diff = x + std::log(1-std::exp(y-x)); 67 | return diff; 68 | } 69 | 70 | 71 | } 72 | 73 | } 74 | 75 | 76 | #endif //SAILFISH_MATH_HPP 77 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | 11 | #ifndef EIGEN_SPARSELU_UTILS_H 12 | #define EIGEN_SPARSELU_UTILS_H 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | /** 18 | * \brief Count Nonzero elements in the factors 19 | */ 20 | template 21 | void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) 22 | { 23 | nnzL = 0; 24 | nnzU = (glu.xusub)(n); 25 | Index nsuper = (glu.supno)(n); 26 | Index jlen; 27 | Index i, j, fsupc; 28 | if (n <= 0 ) return; 29 | // For each supernode 30 | for (i = 0; i <= nsuper; i++) 31 | { 32 | fsupc = glu.xsup(i); 33 | jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 34 | 35 | for (j = fsupc; j < glu.xsup(i+1); j++) 36 | { 37 | nnzL += jlen; 38 | nnzU += j - fsupc + 1; 39 | jlen--; 40 | } 41 | } 42 | } 43 | 44 | /** 45 | * \brief Fix up the data storage lsub for L-subscripts. 46 | * 47 | * It removes the subscripts sets for structural pruning, 48 | * and applies permutation to the remaining subscripts 49 | * 50 | */ 51 | template 52 | void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) 53 | { 54 | Index fsupc, i, j, k, jstart; 55 | 56 | Index nextl = 0; 57 | Index nsuper = (glu.supno)(n); 58 | 59 | // For each supernode 60 | for (i = 0; i <= nsuper; i++) 61 | { 62 | fsupc = glu.xsup(i); 63 | jstart = glu.xlsub(fsupc); 64 | glu.xlsub(fsupc) = nextl; 65 | for (j = jstart; j < glu.xlsub(fsupc + 1); j++) 66 | { 67 | glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A 68 | nextl++; 69 | } 70 | for (k = fsupc+1; k < glu.xsup(i+1); k++) 71 | glu.xlsub(k) = nextl; // other columns in supernode i 72 | } 73 | 74 | glu.xlsub(n) = nextl; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | #endif // EIGEN_SPARSELU_UTILS_H 81 | -------------------------------------------------------------------------------- /include/EmpiricalDistribution.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * This implementation for keeping an empirical distribution and 3 | * querying the PDF and CDF is taken (and ever-so-slightly-modified) from 4 | * https://raw.githubusercontent.com/dcjones/isolator/master/src/emp_dist.hpp. 5 | * The original author is Daniel C. Jones; NOT me (Rob Patro). 6 | **/ 7 | #ifndef EMPIRICAL_DISTRIBUTION_HPP 8 | #define EMPIRICAL_DISTRIBUTION_HPP 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | class EmpiricalDistribution 16 | { 17 | public: 18 | EmpiricalDistribution(EmpiricalDistribution&); 19 | 20 | /* Construct a emperical distribution from n observations stored in xs. 21 | * 22 | * Input in run-length encoded samples, which must be in sorted order. 23 | * 24 | * Args: 25 | * vals: An array of unique observations. 26 | * lens: Nuber of occurances for each observation. 27 | * n: Length of vals and lens. 28 | */ 29 | EmpiricalDistribution(const std::vector& vals, 30 | const std::vector& count); 31 | 32 | 33 | EmpiricalDistribution(); 34 | 35 | void buildDistribution( const std::vector& vals, 36 | const std::vector& lens); 37 | 38 | /* Compute the median of the distribution. */ 39 | float median() const; 40 | 41 | /* Probability density function. */ 42 | float pdf(unsigned int x) const; 43 | 44 | /* Comulative p robabability. */ 45 | float cdf(unsigned int x) const; 46 | 47 | /* The minimum observed value. */ 48 | uint32_t minValue() const; 49 | 50 | /* The maximum observed value. */ 51 | uint32_t maxValue() const; 52 | 53 | /* True if there are observations and false otherwise */ 54 | bool valid() const; 55 | 56 | /* Realize the distribution as a vector of counts, where 57 | * numSamp samples are drawn from the underlying distribution 58 | */ 59 | std::vector realize(uint32_t numSamp = 10000) const; 60 | 61 | private: 62 | std::vector pdfvals; 63 | std::vector cdfvals; 64 | 65 | /* Precomputed median */ 66 | float med; 67 | 68 | /* Min and Max Values */ 69 | uint32_t minVal; 70 | uint32_t maxVal; 71 | std::atomic isValid_{false}; 72 | }; 73 | 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Eigen2Support/Lazy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_LAZY_H 11 | #define EIGEN_LAZY_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated it is only used by lazy() which is deprecated 16 | * 17 | * \returns an expression of *this with added flags 18 | * 19 | * Example: \include MatrixBase_marked.cpp 20 | * Output: \verbinclude MatrixBase_marked.out 21 | * 22 | * \sa class Flagged, extract(), part() 23 | */ 24 | template 25 | template 26 | inline const Flagged 27 | MatrixBase::marked() const 28 | { 29 | return derived(); 30 | } 31 | 32 | /** \deprecated use MatrixBase::noalias() 33 | * 34 | * \returns an expression of *this with the EvalBeforeAssigningBit flag removed. 35 | * 36 | * Example: \include MatrixBase_lazy.cpp 37 | * Output: \verbinclude MatrixBase_lazy.out 38 | * 39 | * \sa class Flagged, marked() 40 | */ 41 | template 42 | inline const Flagged 43 | MatrixBase::lazy() const 44 | { 45 | return derived(); 46 | } 47 | 48 | 49 | /** \internal 50 | * Overloaded to perform an efficient C += (A*B).lazy() */ 51 | template 52 | template 53 | Derived& MatrixBase::operator+=(const Flagged, 0, 54 | EvalBeforeAssigningBit>& other) 55 | { 56 | other._expression().derived().addTo(derived()); return derived(); 57 | } 58 | 59 | /** \internal 60 | * Overloaded to perform an efficient C -= (A*B).lazy() */ 61 | template 62 | template 63 | Derived& MatrixBase::operator-=(const Flagged, 0, 64 | EvalBeforeAssigningBit>& other) 65 | { 66 | other._expression().derived().subTo(derived()); return derived(); 67 | } 68 | 69 | } // end namespace Eigen 70 | 71 | #endif // EIGEN_LAZY_H 72 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/OrderingMethods: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 2 | #define EIGEN_ORDERINGMETHODS_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** 9 | * \defgroup OrderingMethods_Module OrderingMethods module 10 | * 11 | * This module is currently for internal use only 12 | * 13 | * It defines various built-in and external ordering methods for sparse matrices. 14 | * They are typically used to reduce the number of elements during 15 | * the sparse matrix decomposition (LLT, LU, QR). 16 | * Precisely, in a preprocessing step, a permutation matrix P is computed using 17 | * those ordering methods and applied to the columns of the matrix. 18 | * Using for instance the sparse Cholesky decomposition, it is expected that 19 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). 20 | * 21 | * 22 | * Usage : 23 | * \code 24 | * #include 25 | * \endcode 26 | * 27 | * A simple usage is as a template parameter in the sparse decomposition classes : 28 | * 29 | * \code 30 | * SparseLU > solver; 31 | * \endcode 32 | * 33 | * \code 34 | * SparseQR > solver; 35 | * \endcode 36 | * 37 | * It is possible as well to call directly a particular ordering method for your own purpose, 38 | * \code 39 | * AMDOrdering ordering; 40 | * PermutationMatrix perm; 41 | * SparseMatrix A; 42 | * //Fill the matrix ... 43 | * 44 | * ordering(A, perm); // Call AMD 45 | * \endcode 46 | * 47 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern 48 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, 49 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. 50 | * If your matrix is already symmetric (at leat in structure), you can avoid that 51 | * by calling the method with a SelfAdjointView type. 52 | * 53 | * \code 54 | * // Call the ordering on the pattern of the lower triangular matrix A 55 | * ordering(A.selfadjointView(), perm); 56 | * \endcode 57 | */ 58 | 59 | #ifndef EIGEN_MPL2_ONLY 60 | #include "src/OrderingMethods/Amd.h" 61 | #endif 62 | 63 | #include "src/OrderingMethods/Ordering.h" 64 | #include "src/Core/util/ReenableStupidWarnings.h" 65 | 66 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 67 | -------------------------------------------------------------------------------- /src/TestUtils.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | >HEADER 3 | Copyright (c) 2013 Rob Patro robp@cs.cmu.edu 4 | 5 | This file is part of Sailfish. 6 | 7 | Sailfish is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | Sailfish is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with Sailfish. If not, see . 19 |
24 | #include 25 | #include 26 | #include 27 | 28 | #include "utils.hpp" 29 | #include "matrix_tools.hpp" 30 | 31 | int main(int argc, char* argv[]) { 32 | using std::vector; 33 | using std::string; 34 | using std::ifstream; 35 | 36 | ifstream ifile(argv[1]); 37 | auto t2g = utils::readTranscriptToGeneMap(ifile); 38 | std::cerr << "read " << t2g.numTranscripts() << " transcripts\n"; 39 | std::cerr << "which mapped to " << t2g.numGenes() << " genes\n"; 40 | ifile.close(); 41 | 42 | 43 | /* 44 | * A = [0 1 0 0 0 1 1] 45 | * [0 0 1 1 0 1 1] 46 | * [0 0 0 1 1 0 0] 47 | * counts = [ 0 4 4 8 5 3 2 ] 48 | */ 49 | std::vector> A{{0,1,0,0,0,1,1}, 50 | {0,0,1,1,0,1,1}, 51 | {0,0,0,1,1,0,0}}; 52 | std::vector counts{0,4,4,8,5,3,2}; 53 | 54 | std::unique_ptr>> collapsedA{nullptr}; 55 | std::unique_ptr> collapsedCounts{nullptr}; 56 | matrix_tools::collapseIntoCategories(A, counts, collapsedA,collapsedCounts); 57 | 58 | for (size_t i = 0; i < collapsedA->size(); ++i ){ 59 | std::cerr << "["; 60 | for ( size_t j = 0; j < (*collapsedA)[0].size(); ++j ) { 61 | std::cerr << (*collapsedA)[i][j] << ", "; 62 | } 63 | std::cerr << "]\n"; 64 | } 65 | std::cerr << "\n["; 66 | for ( auto c : *collapsedCounts ) { std::cerr << c << ", "; } 67 | std::cerr << "]\n"; 68 | 69 | for ( auto i : boost::irange(0, 500) ) { 70 | std::cerr << i << ", "; 71 | } 72 | } -------------------------------------------------------------------------------- /include/spdlog/details/async_logger_impl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // Async Logger implementation 9 | // Use an async_sink (queue per logger) to perform the logging in a worker thread 10 | 11 | #include "./async_log_helper.h" 12 | 13 | 14 | template 15 | inline spdlog::async_logger::async_logger(const std::string& logger_name, 16 | const It& begin, 17 | const It& end, 18 | size_t queue_size, 19 | const async_overflow_policy overflow_policy, 20 | const std::function& worker_warmup_cb, 21 | const std::chrono::milliseconds& flush_interval_ms) : 22 | logger(logger_name, begin, end), 23 | _async_log_helper(new details::async_log_helper(_formatter, _sinks, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms)) 24 | { 25 | } 26 | 27 | inline spdlog::async_logger::async_logger(const std::string& logger_name, 28 | sinks_init_list sinks, 29 | size_t queue_size, 30 | const async_overflow_policy overflow_policy, 31 | const std::function& worker_warmup_cb, 32 | const std::chrono::milliseconds& flush_interval_ms) : 33 | async_logger(logger_name, sinks.begin(), sinks.end(), queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms) {} 34 | 35 | inline spdlog::async_logger::async_logger(const std::string& logger_name, 36 | sink_ptr single_sink, 37 | size_t queue_size, 38 | const async_overflow_policy overflow_policy, 39 | const std::function& worker_warmup_cb, 40 | const std::chrono::milliseconds& flush_interval_ms) : 41 | async_logger(logger_name, 42 | { 43 | single_sink 44 | }, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms) {} 45 | 46 | 47 | inline void spdlog::async_logger::flush() 48 | { 49 | 50 | _async_log_helper->flush(); 51 | } 52 | 53 | inline void spdlog::async_logger::_set_formatter(spdlog::formatter_ptr msg_formatter) 54 | { 55 | _formatter = msg_formatter; 56 | _async_log_helper->set_formatter(_formatter); 57 | } 58 | 59 | inline void spdlog::async_logger::_set_pattern(const std::string& pattern) 60 | { 61 | _formatter = std::make_shared(pattern); 62 | _async_log_helper->set_formatter(_formatter); 63 | } 64 | 65 | 66 | inline void spdlog::async_logger::_log_msg(details::log_msg& msg) 67 | { 68 | _async_log_helper->log(msg); 69 | } 70 | -------------------------------------------------------------------------------- /include/SailfishIndexVersionInfo.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __SAILFISH_INDEX_VERSION_INFO_HPP__ 2 | #define __SAILFISH_INDEX_VERSION_INFO_HPP__ 3 | 4 | #include "spdlog/details/format.h" 5 | #include "boost/filesystem.hpp" 6 | #include "cereal/archives/json.hpp" 7 | 8 | class SailfishIndexVersionInfo { 9 | public: 10 | /** 11 | * default constructor(s) 12 | */ 13 | SailfishIndexVersionInfo() : indexVersion_(sailfish::indexVersion), 14 | kmerLength_(0) {} 15 | 16 | SailfishIndexVersionInfo(uint32_t indexVersionIn, uint32_t kmerLenIn): 17 | indexVersion_(indexVersionIn), kmerLength_(kmerLenIn) {} 18 | 19 | /** 20 | * Read the index version info from file 21 | */ 22 | bool load(boost::filesystem::path& versionFile) { 23 | namespace bfs = boost::filesystem; 24 | if(!bfs::exists(versionFile)) { 25 | fmt::MemoryWriter infostr; 26 | infostr << "Error: The index version file " << versionFile.string() 27 | << " doesn't seem to exist. Please try re-building the sailfish " 28 | "index."; 29 | throw std::invalid_argument(infostr.str()); 30 | } 31 | std::ifstream ifs(versionFile.string()); 32 | { 33 | cereal::JSONInputArchive iarchive(ifs); // Create an input archive 34 | iarchive(cereal::make_nvp("indexVersion", indexVersion_), 35 | cereal::make_nvp("kmerLength", kmerLength_)); 36 | } 37 | ifs.close(); 38 | return true; 39 | } 40 | 41 | bool save(boost::filesystem::path& versionFile) { 42 | std::ofstream ofs(versionFile.string()); 43 | { 44 | cereal::JSONOutputArchive oarchive(ofs); 45 | oarchive(cereal::make_nvp("indexVersion", indexVersion_), 46 | cereal::make_nvp("kmerLength", kmerLength_)); 47 | } 48 | ofs.close(); 49 | return true; 50 | } 51 | 52 | uint32_t indexVersion() { return indexVersion_; } 53 | void indexVersion(uint32_t version) { indexVersion_ = version; } 54 | 55 | uint32_t kmerLength() { return kmerLength_; } 56 | void kmerLength(uint32_t len) { kmerLength_ = len; }; 57 | 58 | private: 59 | uint32_t indexVersion_; 60 | uint32_t kmerLength_; 61 | }; 62 | 63 | #endif // __SAILFISH_INDEX_VERSION_INFO_HPP__ 64 | 65 | -------------------------------------------------------------------------------- /include/spdlog/sinks/syslog_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifdef __linux__ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "./sink.h" 15 | #include "../common.h" 16 | #include "../details/log_msg.h" 17 | 18 | 19 | namespace spdlog 20 | { 21 | namespace sinks 22 | { 23 | /** 24 | * Sink that write to syslog using the `syscall()` library call. 25 | * 26 | * Locking is not needed, as `syslog()` itself is thread-safe. 27 | */ 28 | class syslog_sink : public sink 29 | { 30 | public: 31 | // 32 | syslog_sink(const std::string& ident = "", int syslog_option=0, int syslog_facility=LOG_USER): 33 | _ident(ident) 34 | { 35 | _priorities[static_cast(level::trace)] = LOG_DEBUG; 36 | _priorities[static_cast(level::debug)] = LOG_DEBUG; 37 | _priorities[static_cast(level::info)] = LOG_INFO; 38 | _priorities[static_cast(level::notice)] = LOG_NOTICE; 39 | _priorities[static_cast(level::warn)] = LOG_WARNING; 40 | _priorities[static_cast(level::err)] = LOG_ERR; 41 | _priorities[static_cast(level::critical)] = LOG_CRIT; 42 | _priorities[static_cast(level::alert)] = LOG_ALERT; 43 | _priorities[static_cast(level::emerg)] = LOG_EMERG; 44 | _priorities[static_cast(level::off)] = LOG_INFO; 45 | 46 | //set ident to be program name if empty 47 | ::openlog(_ident.empty()? nullptr:_ident.c_str(), syslog_option, syslog_facility); 48 | } 49 | ~syslog_sink() 50 | { 51 | ::closelog(); 52 | } 53 | 54 | syslog_sink(const syslog_sink&) = delete; 55 | syslog_sink& operator=(const syslog_sink&) = delete; 56 | 57 | void log(const details::log_msg &msg) override 58 | { 59 | ::syslog(syslog_prio_from_level(msg), "%s", msg.raw.str().c_str()); 60 | } 61 | 62 | void flush() override 63 | { 64 | } 65 | 66 | 67 | private: 68 | std::array _priorities; 69 | //must store the ident because the man says openlog might use the pointer as is and not a string copy 70 | const std::string _ident; 71 | 72 | // 73 | // Simply maps spdlog's log level to syslog priority level. 74 | // 75 | int syslog_prio_from_level(const details::log_msg &msg) const 76 | { 77 | return _priorities[static_cast(msg.level)]; 78 | } 79 | }; 80 | } 81 | } 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /include/spdlog/tweakme.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // 9 | // Edit this file to squeeze every last drop of performance out of spdlog. 10 | // 11 | 12 | /////////////////////////////////////////////////////////////////////////////// 13 | // Under Linux, the much faster CLOCK_REALTIME_COARSE clock can be used. 14 | // This clock is less accurate - can be off by dozens of millis - depending on the kernel HZ. 15 | // Uncomment to use it instead of the regular (but slower) clock. 16 | // #define SPDLOG_CLOCK_COARSE 17 | /////////////////////////////////////////////////////////////////////////////// 18 | 19 | 20 | /////////////////////////////////////////////////////////////////////////////// 21 | // Uncomment if date/time logging is not needed. 22 | // This will prevent spdlog from quering the clock on each log call. 23 | // #define SPDLOG_NO_DATETIME 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // Uncomment if thread id logging is not needed (i.e. no %t in the log pattern). 29 | // This will prevent spdlog from quering the thread id on each log call. 30 | // #define SPDLOG_NO_THREAD_ID 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | 34 | /////////////////////////////////////////////////////////////////////////////// 35 | // Uncomment if logger name logging is not needed. 36 | // This will prevent spdlog from copying the logger name on each log call. 37 | // #define SPDLOG_NO_NAME 38 | /////////////////////////////////////////////////////////////////////////////// 39 | 40 | 41 | /////////////////////////////////////////////////////////////////////////////// 42 | // Uncomment to enable the SPDLOG_DEBUG/SPDLOG_TRACE macros. 43 | // #define SPDLOG_DEBUG_ON 44 | // #define SPDLOG_TRACE_ON 45 | /////////////////////////////////////////////////////////////////////////////// 46 | 47 | 48 | /////////////////////////////////////////////////////////////////////////////// 49 | // Uncomment to avoid locking in the registry operations (spdlog::get(), spdlog::drop() spdlog::register()). 50 | // Use only if your code never modifes concurrently the registry. 51 | // Note that upon creating a logger the registry is modified by spdlog.. 52 | // #define SPDLOG_NO_REGISTRY_MUTEX 53 | /////////////////////////////////////////////////////////////////////////////// 54 | -------------------------------------------------------------------------------- /include/spdlog/sinks/android_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #if defined(__ANDROID__) 9 | 10 | #include 11 | #include "base_sink.h" 12 | #include "../details/null_mutex.h" 13 | 14 | #include 15 | 16 | namespace spdlog 17 | { 18 | namespace sinks 19 | { 20 | /* 21 | * Android sink (logging using __android_log_write) 22 | */ 23 | template 24 | class base_android_sink : public base_sink < Mutex > 25 | { 26 | public: 27 | explicit base_android_sink(std::string tag="spdlog"): _tag(tag) 28 | { 29 | } 30 | 31 | void flush() override 32 | { 33 | } 34 | 35 | protected: 36 | void _sink_it(const details::log_msg& msg) override 37 | { 38 | const android_LogPriority priority = convert_to_android(msg.level); 39 | const int expected_size = msg.formatted.size(); 40 | const int size = __android_log_write( 41 | priority, _tag.c_str(), msg.formatted.c_str() 42 | ); 43 | if (size > expected_size) 44 | { 45 | // Will write a little bit more than original message 46 | } 47 | else 48 | { 49 | throw spdlog_ex("Send to Android logcat failed"); 50 | } 51 | } 52 | 53 | private: 54 | static android_LogPriority convert_to_android(spdlog::level::level_enum level) 55 | { 56 | switch(level) 57 | { 58 | case spdlog::level::trace: 59 | return ANDROID_LOG_VERBOSE; 60 | case spdlog::level::debug: 61 | return ANDROID_LOG_DEBUG; 62 | case spdlog::level::info: 63 | return ANDROID_LOG_INFO; 64 | case spdlog::level::notice: 65 | return ANDROID_LOG_INFO; 66 | case spdlog::level::warn: 67 | return ANDROID_LOG_WARN; 68 | case spdlog::level::err: 69 | return ANDROID_LOG_ERROR; 70 | case spdlog::level::critical: 71 | return ANDROID_LOG_FATAL; 72 | case spdlog::level::alert: 73 | return ANDROID_LOG_FATAL; 74 | case spdlog::level::emerg: 75 | return ANDROID_LOG_FATAL; 76 | default: 77 | throw spdlog_ex("Incorrect level value"); 78 | } 79 | } 80 | 81 | std::string _tag; 82 | }; 83 | 84 | typedef base_android_sink android_sink_mt; 85 | typedef base_android_sink android_sink_st; 86 | 87 | } 88 | } 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /include/cereal/types/complex.hpp: -------------------------------------------------------------------------------- 1 | /*! \file complex.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of cereal nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_COMPLEX_HPP_ 31 | #define CEREAL_TYPES_COMPLEX_HPP_ 32 | 33 | #include 34 | 35 | namespace cereal 36 | { 37 | //! Serializing (save) for std::complex 38 | template inline 39 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::complex const & comp ) 40 | { 41 | ar( CEREAL_NVP_("real", comp.real()), 42 | CEREAL_NVP_("imag", comp.imag()) ); 43 | } 44 | 45 | //! Serializing (load) for std::complex 46 | template inline 47 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::complex & bits ) 48 | { 49 | T real, imag; 50 | ar( CEREAL_NVP_("real", real), 51 | CEREAL_NVP_("imag", imag) ); 52 | bits = {real, imag}; 53 | } 54 | } // namespace cereal 55 | 56 | #endif // CEREAL_TYPES_COMPLEX_HPP_ 57 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | DenseIndex fdjac1( 7 | const FunctorType &Functor, 8 | Matrix< Scalar, Dynamic, 1 > &x, 9 | Matrix< Scalar, Dynamic, 1 > &fvec, 10 | Matrix< Scalar, Dynamic, Dynamic > &fjac, 11 | DenseIndex ml, DenseIndex mu, 12 | Scalar epsfcn) 13 | { 14 | using std::sqrt; 15 | using std::abs; 16 | 17 | typedef DenseIndex Index; 18 | 19 | /* Local variables */ 20 | Scalar h; 21 | Index j, k; 22 | Scalar eps, temp; 23 | Index msum; 24 | int iflag; 25 | Index start, length; 26 | 27 | /* Function Body */ 28 | const Scalar epsmch = NumTraits::epsilon(); 29 | const Index n = x.size(); 30 | eigen_assert(fvec.size()==n); 31 | Matrix< Scalar, Dynamic, 1 > wa1(n); 32 | Matrix< Scalar, Dynamic, 1 > wa2(n); 33 | 34 | eps = sqrt((std::max)(epsfcn,epsmch)); 35 | msum = ml + mu + 1; 36 | if (msum >= n) { 37 | /* computation of dense approximate jacobian. */ 38 | for (j = 0; j < n; ++j) { 39 | temp = x[j]; 40 | h = eps * abs(temp); 41 | if (h == 0.) 42 | h = eps; 43 | x[j] = temp + h; 44 | iflag = Functor(x, wa1); 45 | if (iflag < 0) 46 | return iflag; 47 | x[j] = temp; 48 | fjac.col(j) = (wa1-fvec)/h; 49 | } 50 | 51 | }else { 52 | /* computation of banded approximate jacobian. */ 53 | for (k = 0; k < msum; ++k) { 54 | for (j = k; (msum<0) ? (j>n): (jn): (j(0,j-mu); 69 | length = (std::min)(n-1, j+ml) - start + 1; 70 | fjac.col(j).segment(start, length) = ( wa1.segment(start, length)-fvec.segment(start, length))/h; 71 | } 72 | } 73 | } 74 | return 0; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/src/MatrixFunctions/StemFunction.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Jitse Niesen 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STEM_FUNCTION 11 | #define EIGEN_STEM_FUNCTION 12 | 13 | namespace Eigen { 14 | 15 | /** \ingroup MatrixFunctions_Module 16 | * \brief Stem functions corresponding to standard mathematical functions. 17 | */ 18 | template 19 | class StdStemFunctions 20 | { 21 | public: 22 | 23 | /** \brief The exponential function (and its derivatives). */ 24 | static Scalar exp(Scalar x, int) 25 | { 26 | return std::exp(x); 27 | } 28 | 29 | /** \brief Cosine (and its derivatives). */ 30 | static Scalar cos(Scalar x, int n) 31 | { 32 | Scalar res; 33 | switch (n % 4) { 34 | case 0: 35 | res = std::cos(x); 36 | break; 37 | case 1: 38 | res = -std::sin(x); 39 | break; 40 | case 2: 41 | res = -std::cos(x); 42 | break; 43 | case 3: 44 | res = std::sin(x); 45 | break; 46 | } 47 | return res; 48 | } 49 | 50 | /** \brief Sine (and its derivatives). */ 51 | static Scalar sin(Scalar x, int n) 52 | { 53 | Scalar res; 54 | switch (n % 4) { 55 | case 0: 56 | res = std::sin(x); 57 | break; 58 | case 1: 59 | res = std::cos(x); 60 | break; 61 | case 2: 62 | res = -std::sin(x); 63 | break; 64 | case 3: 65 | res = -std::cos(x); 66 | break; 67 | } 68 | return res; 69 | } 70 | 71 | /** \brief Hyperbolic cosine (and its derivatives). */ 72 | static Scalar cosh(Scalar x, int n) 73 | { 74 | Scalar res; 75 | switch (n % 2) { 76 | case 0: 77 | res = std::cosh(x); 78 | break; 79 | case 1: 80 | res = std::sinh(x); 81 | break; 82 | } 83 | return res; 84 | } 85 | 86 | /** \brief Hyperbolic sine (and its derivatives). */ 87 | static Scalar sinh(Scalar x, int n) 88 | { 89 | Scalar res; 90 | switch (n % 2) { 91 | case 0: 92 | res = std::sinh(x); 93 | break; 94 | case 1: 95 | res = std::cosh(x); 96 | break; 97 | } 98 | return res; 99 | } 100 | 101 | }; // end of class StdStemFunctions 102 | 103 | } // end namespace Eigen 104 | 105 | #endif // EIGEN_STEM_FUNCTION 106 | -------------------------------------------------------------------------------- /include/cereal/types/list.hpp: -------------------------------------------------------------------------------- 1 | /*! \file list.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of cereal nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_LIST_HPP_ 31 | #define CEREAL_TYPES_LIST_HPP_ 32 | 33 | #include 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Saving for std::list 39 | template inline 40 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::list const & list ) 41 | { 42 | ar( make_size_tag( static_cast(list.size()) ) ); 43 | 44 | for( auto const & i : list ) 45 | ar( i ); 46 | } 47 | 48 | //! Loading for std::list 49 | template inline 50 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::list & list ) 51 | { 52 | size_type size; 53 | ar( make_size_tag( size ) ); 54 | 55 | list.resize( static_cast( size ) ); 56 | 57 | for( auto & i : list ) 58 | ar( i ); 59 | } 60 | } // namespace cereal 61 | 62 | #endif // CEREAL_TYPES_LIST_HPP_ 63 | -------------------------------------------------------------------------------- /include/cereal/types/deque.hpp: -------------------------------------------------------------------------------- 1 | /*! \file deque.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of cereal nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_DEQUE_HPP_ 31 | #define CEREAL_TYPES_DEQUE_HPP_ 32 | 33 | #include 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Saving for std::deque 39 | template inline 40 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::deque const & deque ) 41 | { 42 | ar( make_size_tag( static_cast(deque.size()) ) ); 43 | 44 | for( auto const & i : deque ) 45 | ar( i ); 46 | } 47 | 48 | //! Loading for std::deque 49 | template inline 50 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::deque & deque ) 51 | { 52 | size_type size; 53 | ar( make_size_tag( size ) ); 54 | 55 | deque.resize( static_cast( size ) ); 56 | 57 | for( auto & i : deque ) 58 | ar( i ); 59 | } 60 | } // namespace cereal 61 | 62 | #endif // CEREAL_TYPES_DEQUE_HPP_ 63 | -------------------------------------------------------------------------------- /batchquark.snake: -------------------------------------------------------------------------------- 1 | import os 2 | from glob import glob 3 | 4 | mouse_index="/mnt/scratch1/hirak/quark_data/mouse_index/" 5 | human_index="/mnt/scratch1/hirak/quark_data/sailfish_index/" 6 | 7 | quark=os.path.abspath("./build/src/quark") 8 | 9 | output_path=os.path.abspath(config['stat']) 10 | srrnames = ["/mnt/scratch1/hirak/quark_data/SRR1265495/", 11 | "/mnt/scratch1/hirak/quark_data/SRR1265496/", 12 | "/mnt/scratch1/hirak/quark_data/SRR037452/", 13 | "/mnt/scratch1/hirak/quark_data/SRR1294122/", 14 | "/mnt/scratch1/hirak/quark_data/SRR445718/", 15 | "/mnt/scratch1/hirak/quark_data/SRR490961/", 16 | "/mnt/scratch1/hirak/quark_data/SRR635193/", 17 | "/mnt/scratch1/hirak/quark_data/SRR689233/"] 18 | 19 | rule runbatchencode: 20 | run: 21 | for srrdir in srrnames: 22 | inputfiles=glob(os.path.join(srrdir,"*.fastq.gz")) 23 | shell("echo {} {} >> {}".format(os.path.basename(os.path.normpath(srrdir)),len(inputfiles),output_path)) 24 | quark_out=os.path.join(srrdir,"only_quark_out") 25 | if(not os.path.isdir(quark_out)): 26 | shell("mkdir -p {}".format(quark_out)) 27 | if(len(inputfiles) == 2): 28 | mate_1="" 29 | mate_2="" 30 | if(inputfiles[0].split("_")[-1].split(".")[0] == "1"): 31 | mate_1 = inputfiles[0] 32 | mate_2 = inputfiles[1] 33 | else: 34 | mate_2 = inputfiles[0] 35 | mate_1 = inputfiles[1] 36 | #run quark 37 | #if mouse 38 | if(os.path.basename(os.path.normpath(srrdir)) == "SRR689233"): 39 | shell("/usr/bin/time -o {} -a {} quant -i {} -l IU -1 <(gunzip -c {}) -2 <(gunzip -c {}) -p 20 -o {}"\ 40 | .format(output_path, quark, mouse_index, mate_1,mate_2,quark_out)) 41 | else: 42 | shell("/usr/bin/time -o {} -a {} quant -i {} -l IU -1 <(gunzip -c {}) -2 <(gunzip -c {}) -p 20 -o {}"\ 43 | .format(output_path, quark, human_index, mate_1,mate_2,quark_out)) 44 | else: 45 | mate=inputfiles[0] 46 | shell("/usr/bin/time -o {} -a {} quant -i {} -l U -r <(gunzip -c {}) -p 20 -o {}"\ 47 | .format(output_path, quark, human_index, mate, quark_out)) 48 | rule runbatchdecode: 49 | run: 50 | for srrdir in srrnames: 51 | leonfiles=glob(srrdir,"*.fastq.leon") 52 | shell("echo {} {} >> {}".format(os.path.basename(os.path.normpath(srrdir)),len(leonfiles),output_path)) 53 | #run leon 54 | 55 | 56 | -------------------------------------------------------------------------------- /include/cereal/external/rapidjson/internal/stack.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_INTERNAL_STACK_H_ 2 | #define RAPIDJSON_INTERNAL_STACK_H_ 3 | 4 | namespace rapidjson { 5 | namespace internal { 6 | 7 | /////////////////////////////////////////////////////////////////////////////// 8 | // Stack 9 | 10 | //! A type-unsafe stack for storing different types of data. 11 | /*! \tparam Allocator Allocator for allocating stack memory. 12 | */ 13 | template 14 | class Stack { 15 | public: 16 | Stack(Allocator* allocator, size_t stack_capacity) : allocator_(allocator), own_allocator_(0), stack_(0), stack_top_(0), stack_end_(0), stack_capacity_(stack_capacity) { 17 | RAPIDJSON_ASSERT(stack_capacity_ > 0); 18 | if (!allocator_) 19 | own_allocator_ = allocator_ = new Allocator(); 20 | stack_top_ = stack_ = (char*)allocator_->Malloc(stack_capacity_); 21 | stack_end_ = stack_ + stack_capacity_; 22 | } 23 | 24 | ~Stack() { 25 | Allocator::Free(stack_); 26 | delete own_allocator_; // Only delete if it is owned by the stack 27 | } 28 | 29 | void Clear() { /*stack_top_ = 0;*/ stack_top_ = stack_; } 30 | 31 | template 32 | T* Push(size_t count = 1) { 33 | // Expand the stack if needed 34 | if (stack_top_ + sizeof(T) * count >= stack_end_) { 35 | size_t new_capacity = stack_capacity_ * 2; 36 | size_t size = GetSize(); 37 | size_t new_size = GetSize() + sizeof(T) * count; 38 | if (new_capacity < new_size) 39 | new_capacity = new_size; 40 | stack_ = (char*)allocator_->Realloc(stack_, stack_capacity_, new_capacity); 41 | stack_capacity_ = new_capacity; 42 | stack_top_ = stack_ + size; 43 | stack_end_ = stack_ + stack_capacity_; 44 | } 45 | T* ret = (T*)stack_top_; 46 | stack_top_ += sizeof(T) * count; 47 | return ret; 48 | } 49 | 50 | template 51 | T* Pop(size_t count) { 52 | RAPIDJSON_ASSERT(GetSize() >= count * sizeof(T)); 53 | stack_top_ -= count * sizeof(T); 54 | return (T*)stack_top_; 55 | } 56 | 57 | template 58 | T* Top() { 59 | RAPIDJSON_ASSERT(GetSize() >= sizeof(T)); 60 | return (T*)(stack_top_ - sizeof(T)); 61 | } 62 | 63 | template 64 | T* Bottom() { return (T*)stack_; } 65 | 66 | Allocator& GetAllocator() { return *allocator_; } 67 | size_t GetSize() const { return stack_top_ - stack_; } 68 | size_t GetCapacity() const { return stack_capacity_; } 69 | 70 | private: 71 | Allocator* allocator_; 72 | Allocator* own_allocator_; 73 | char *stack_; 74 | char *stack_top_; 75 | char *stack_end_; 76 | size_t stack_capacity_; 77 | }; 78 | 79 | } // namespace internal 80 | } // namespace rapidjson 81 | 82 | #endif // RAPIDJSON_STACK_H_ 83 | -------------------------------------------------------------------------------- /include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_AUTODIFF_JACOBIAN_H 11 | #define EIGEN_AUTODIFF_JACOBIAN_H 12 | 13 | namespace Eigen 14 | { 15 | 16 | template class AutoDiffJacobian : public Functor 17 | { 18 | public: 19 | AutoDiffJacobian() : Functor() {} 20 | AutoDiffJacobian(const Functor& f) : Functor(f) {} 21 | 22 | // forward constructors 23 | template 24 | AutoDiffJacobian(const T0& a0) : Functor(a0) {} 25 | template 26 | AutoDiffJacobian(const T0& a0, const T1& a1) : Functor(a0, a1) {} 27 | template 28 | AutoDiffJacobian(const T0& a0, const T1& a1, const T2& a2) : Functor(a0, a1, a2) {} 29 | 30 | enum { 31 | InputsAtCompileTime = Functor::InputsAtCompileTime, 32 | ValuesAtCompileTime = Functor::ValuesAtCompileTime 33 | }; 34 | 35 | typedef typename Functor::InputType InputType; 36 | typedef typename Functor::ValueType ValueType; 37 | typedef typename Functor::JacobianType JacobianType; 38 | typedef typename JacobianType::Scalar Scalar; 39 | typedef typename JacobianType::Index Index; 40 | 41 | typedef Matrix DerivativeType; 42 | typedef AutoDiffScalar ActiveScalar; 43 | 44 | 45 | typedef Matrix ActiveInput; 46 | typedef Matrix ActiveValue; 47 | 48 | void operator() (const InputType& x, ValueType* v, JacobianType* _jac=0) const 49 | { 50 | eigen_assert(v!=0); 51 | if (!_jac) 52 | { 53 | Functor::operator()(x, v); 54 | return; 55 | } 56 | 57 | JacobianType& jac = *_jac; 58 | 59 | ActiveInput ax = x.template cast(); 60 | ActiveValue av(jac.rows()); 61 | 62 | if(InputsAtCompileTime==Dynamic) 63 | for (Index j=0; jinputs()); 65 | 66 | for (Index i=0; iinputs(),i); 68 | 69 | Functor::operator()(ax, &av); 70 | 71 | for (Index i=0; i 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSETRANSPOSE_H 11 | #define EIGEN_SPARSETRANSPOSE_H 12 | 13 | namespace Eigen { 14 | 15 | template class TransposeImpl 16 | : public SparseMatrixBase > 17 | { 18 | typedef typename internal::remove_all::type _MatrixTypeNested; 19 | public: 20 | 21 | EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose ) 22 | 23 | class InnerIterator; 24 | class ReverseInnerIterator; 25 | 26 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 27 | }; 28 | 29 | // NOTE: VC10 and VC11 trigger an ICE if don't put typename TransposeImpl:: in front of Index, 30 | // a typedef typename TransposeImpl::Index Index; 31 | // does not fix the issue. 32 | // An alternative is to define the nested class in the parent class itself. 33 | template class TransposeImpl::InnerIterator 34 | : public _MatrixTypeNested::InnerIterator 35 | { 36 | typedef typename _MatrixTypeNested::InnerIterator Base; 37 | typedef typename TransposeImpl::Index Index; 38 | public: 39 | 40 | EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl::Index outer) 41 | : Base(trans.derived().nestedExpression(), outer) 42 | {} 43 | typename TransposeImpl::Index row() const { return Base::col(); } 44 | typename TransposeImpl::Index col() const { return Base::row(); } 45 | }; 46 | 47 | template class TransposeImpl::ReverseInnerIterator 48 | : public _MatrixTypeNested::ReverseInnerIterator 49 | { 50 | typedef typename _MatrixTypeNested::ReverseInnerIterator Base; 51 | typedef typename TransposeImpl::Index Index; 52 | public: 53 | 54 | EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl::Index outer) 55 | : Base(xpr.derived().nestedExpression(), outer) 56 | {} 57 | typename TransposeImpl::Index row() const { return Base::col(); } 58 | typename TransposeImpl::Index col() const { return Base::row(); } 59 | }; 60 | 61 | } // end namespace Eigen 62 | 63 | #endif // EIGEN_SPARSETRANSPOSE_H 64 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/misc/Solve.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_SOLVE_H 11 | #define EIGEN_MISC_SOLVE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class solve_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix ReturnType; 30 | }; 31 | 32 | template struct solve_retval_base 33 | : public ReturnByValue > 34 | { 35 | typedef typename remove_all::type RhsNestedCleaned; 36 | typedef _DecompositionType DecompositionType; 37 | typedef ReturnByValue Base; 38 | typedef typename Base::Index Index; 39 | 40 | solve_retval_base(const DecompositionType& dec, const Rhs& rhs) 41 | : m_dec(dec), m_rhs(rhs) 42 | {} 43 | 44 | inline Index rows() const { return m_dec.cols(); } 45 | inline Index cols() const { return m_rhs.cols(); } 46 | inline const DecompositionType& dec() const { return m_dec; } 47 | inline const RhsNestedCleaned& rhs() const { return m_rhs; } 48 | 49 | template inline void evalTo(Dest& dst) const 50 | { 51 | static_cast*>(this)->evalTo(dst); 52 | } 53 | 54 | protected: 55 | const DecompositionType& m_dec; 56 | typename Rhs::Nested m_rhs; 57 | }; 58 | 59 | } // end namespace internal 60 | 61 | #define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \ 62 | typedef typename DecompositionType::MatrixType MatrixType; \ 63 | typedef typename MatrixType::Scalar Scalar; \ 64 | typedef typename MatrixType::RealScalar RealScalar; \ 65 | typedef typename MatrixType::Index Index; \ 66 | typedef Eigen::internal::solve_retval_base Base; \ 67 | using Base::dec; \ 68 | using Base::rhs; \ 69 | using Base::rows; \ 70 | using Base::cols; \ 71 | solve_retval(const DecompositionType& dec, const Rhs& rhs) \ 72 | : Base(dec, rhs) {} 73 | 74 | } // end namespace Eigen 75 | 76 | #endif // EIGEN_MISC_SOLVE_H 77 | -------------------------------------------------------------------------------- /include/spdlog/async_logger.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // Very fast asynchronous logger (millions of logs per second on an average desktop) 9 | // Uses pre allocated lockfree queue for maximum throughput even under large number of threads. 10 | // Creates a single back thread to pop messages from the queue and log them. 11 | // 12 | // Upon each log write the logger: 13 | // 1. Checks if its log level is enough to log the message 14 | // 2. Push a new copy of the message to a queue (or block the caller until space is available in the queue) 15 | // 3. will throw spdlog_ex upon log exceptions 16 | // Upong destruction, logs all remaining messages in the queue before destructing.. 17 | 18 | #include 19 | #include 20 | #include "common.h" 21 | #include "logger.h" 22 | #include "spdlog.h" 23 | 24 | 25 | namespace spdlog 26 | { 27 | 28 | namespace details 29 | { 30 | class async_log_helper; 31 | } 32 | 33 | class async_logger :public logger 34 | { 35 | public: 36 | template 37 | async_logger(const std::string& name, 38 | const It& begin, 39 | const It& end, 40 | size_t queue_size, 41 | const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, 42 | const std::function& worker_warmup_cb = nullptr, 43 | const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero()); 44 | 45 | async_logger(const std::string& logger_name, 46 | sinks_init_list sinks, 47 | size_t queue_size, 48 | const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, 49 | const std::function& worker_warmup_cb = nullptr, 50 | const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero()); 51 | 52 | async_logger(const std::string& logger_name, 53 | sink_ptr single_sink, 54 | size_t queue_size, 55 | const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, 56 | const std::function& worker_warmup_cb = nullptr, 57 | const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero()); 58 | 59 | 60 | void flush() override; 61 | protected: 62 | void _log_msg(details::log_msg& msg) override; 63 | void _set_formatter(spdlog::formatter_ptr msg_formatter) override; 64 | void _set_pattern(const std::string& pattern) override; 65 | 66 | private: 67 | std::unique_ptr _async_log_helper; 68 | }; 69 | } 70 | 71 | 72 | #include "./details/async_logger_impl.h" 73 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing matrix specifics coefficient wise functions. 12 | 13 | /** \returns an expression of the coefficient-wise absolute value of \c *this 14 | * 15 | * Example: \include MatrixBase_cwiseAbs.cpp 16 | * Output: \verbinclude MatrixBase_cwiseAbs.out 17 | * 18 | * \sa cwiseAbs2() 19 | */ 20 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 21 | cwiseAbs() const { return derived(); } 22 | 23 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this 24 | * 25 | * Example: \include MatrixBase_cwiseAbs2.cpp 26 | * Output: \verbinclude MatrixBase_cwiseAbs2.out 27 | * 28 | * \sa cwiseAbs() 29 | */ 30 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 31 | cwiseAbs2() const { return derived(); } 32 | 33 | /** \returns an expression of the coefficient-wise square root of *this. 34 | * 35 | * Example: \include MatrixBase_cwiseSqrt.cpp 36 | * Output: \verbinclude MatrixBase_cwiseSqrt.out 37 | * 38 | * \sa cwisePow(), cwiseSquare() 39 | */ 40 | inline const CwiseUnaryOp, const Derived> 41 | cwiseSqrt() const { return derived(); } 42 | 43 | /** \returns an expression of the coefficient-wise inverse of *this. 44 | * 45 | * Example: \include MatrixBase_cwiseInverse.cpp 46 | * Output: \verbinclude MatrixBase_cwiseInverse.out 47 | * 48 | * \sa cwiseProduct() 49 | */ 50 | inline const CwiseUnaryOp, const Derived> 51 | cwiseInverse() const { return derived(); } 52 | 53 | /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s 54 | * 55 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 56 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 57 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 58 | * isMuchSmallerThan(). 59 | * 60 | * \sa cwiseEqual(const MatrixBase &) const 61 | */ 62 | inline const CwiseUnaryOp >, const Derived> 63 | cwiseEqual(const Scalar& s) const 64 | { 65 | return CwiseUnaryOp >,const Derived> 66 | (derived(), std::bind1st(std::equal_to(), s)); 67 | } 68 | -------------------------------------------------------------------------------- /scripts/MutateReference.py: -------------------------------------------------------------------------------- 1 | """Mutate Reference. 2 | 3 | Usage: 4 | MutateReference.py --in= --out= --rate= 5 | 6 | Options: 7 | -h --help Show this message. 8 | --in= The input reference sequence. 9 | --out= The output [mutated] sequences. 10 | --rate= The rate of mutation. 11 | """ 12 | from docopt import docopt 13 | from Bio import SeqIO 14 | import itertools 15 | import random 16 | import copy 17 | import math 18 | import sys 19 | 20 | mutList = {'A' : ['T', 'C', 'G'], 21 | 'T' : ['A', 'C', 'G'], 22 | 'C' : ['A', 'G', 'T'], 23 | 'G' : ['A', 'C', 'T'], 24 | 'a' : ['c', 'g', 't'], 25 | 't' : ['a', 'c', 'g'], 26 | 'c' : ['a', 'g', 't'], 27 | 'g' : ['a', 'c', 't'], 28 | 'N' : ['A', 'T', 'C', 'G'], 29 | 'n' : ['a', 't', 'c', 'g']} 30 | 31 | def mutate(base): 32 | ml = mutList[base] 33 | return ml[random.randint(0, len(ml)-1)] 34 | 35 | def randCeilFloor(x): 36 | if x < 1.0 or random.random() < 0.5: 37 | return int(math.ceil(x)) 38 | else: 39 | return int(math.floor(x)) 40 | 41 | def main(args): 42 | mutRate = float(args['--rate']) 43 | refIn = args['--in'] 44 | refOut = args['--out'] 45 | 46 | ofile = open(refOut,'a') 47 | seqs = SeqIO.parse(refIn, 'fasta') 48 | currBase = 0 49 | nMut = 0 50 | totLen = 0 51 | nextMut = currBase + randCeilFloor(random.expovariate(mutRate)) 52 | mutList = [] 53 | for i, s in enumerate(seqs): 54 | lenS = len(s.seq) 55 | firstBase = currBase 56 | lastBase = currBase + lenS 57 | totLen += lenS 58 | o = copy.copy(s.seq) 59 | x = s.seq.tomutable() 60 | while nextMut < lastBase: 61 | offset = nextMut - firstBase 62 | orig = o[offset] 63 | x[offset] = mutate(orig) 64 | assert(x[offset] != orig) 65 | nMut += 1 66 | currBase = nextMut 67 | nextMut = currBase + randCeilFloor(random.expovariate(mutRate)) 68 | currBase = lastBase 69 | #assert(len(o) == len(x)) 70 | #for a,b in itertools.izip(o,x): 71 | # if a != b: nMut += 1 72 | s.seq = x 73 | SeqIO.write(s, ofile, 'fasta') 74 | if (i % 1000 == 0): 75 | sys.stderr.write("processed {} records; performed {} mutations; rate = {:.2f}%\r\r".format(i, nMut, (100.0 * nMut) / totLen)) 76 | # print("\n")/tmp/hg18_transcripts_mut0.001.fa/tmp/hg18_transcripts_mut0.001.fa/tmp/hg18_transcripts_mut0.001.fa 77 | # print('Num Rec = {}, Num Mut = {}, Tot. length = {}, rate = {}'.format(i, nMut, totLen, (100.0 * nMut) / totLen)) 78 | # print(mutList) 79 | print("\ndone.") 80 | 81 | if __name__ == "__main__": 82 | arguments = docopt(__doc__, version="Mutate Reference 1.0") 83 | main(arguments) 84 | -------------------------------------------------------------------------------- /include/cuckoohash_util.hh: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef _CUCKOOHASH_UTIL_HH 4 | #define _CUCKOOHASH_UTIL_HH 5 | 6 | #include 7 | #include 8 | #include "cuckoohash_config.hh" // for LIBCUCKOO_DEBUG 9 | 10 | #if LIBCUCKOO_DEBUG 11 | # define LIBCUCKOO_DBG(fmt, args...) \ 12 | fprintf(stderr, "\x1b[32m""[libcuckoo:%s:%d:%lu] " fmt"" "\x1b[0m", \ 13 | __FILE__,__LINE__, (unsigned long)pthread_self(), ##args) 14 | #else 15 | # define LIBCUCKOO_DBG(fmt, args...) do {} while (0) 16 | #endif 17 | 18 | // For enabling certain methods based on a condition. Here's an example. 19 | // ENABLE_IF(some_cond, type, static, inline) method() { 20 | // ... 21 | // } 22 | #define ENABLE_IF(preamble, condition, return_type) \ 23 | template \ 24 | preamble typename std::enable_if::type 26 | 27 | /** 28 | * Thrown when an automatic expansion is triggered, but the load factor of the 29 | * table is below a minimum threshold, which can be set by the \ref 30 | * cuckoohash_map::minimum_load_factor method. This can happen if the hash 31 | * function does not properly distribute keys, or for certain adversarial 32 | * workloads. 33 | */ 34 | class libcuckoo_load_factor_too_low : public std::exception { 35 | public: 36 | /** 37 | * Constructor 38 | * 39 | * @param lf the load factor of the table when the exception was thrown 40 | */ 41 | libcuckoo_load_factor_too_low(const double lf) 42 | : load_factor_(lf) {} 43 | 44 | virtual const char* what() const noexcept { 45 | return "Automatic expansion triggered when load factor was below " 46 | "minimum threshold"; 47 | } 48 | 49 | /** 50 | * @return the load factor of the table when the exception was thrown 51 | */ 52 | double load_factor() { 53 | return load_factor_; 54 | } 55 | private: 56 | const double load_factor_; 57 | }; 58 | 59 | /** 60 | * Thrown when an expansion is triggered, but the hashpower specified is greater 61 | * than the maximum, which can be set with the \ref 62 | * cuckoohash_map::maximum_hashpower method. 63 | */ 64 | class libcuckoo_maximum_hashpower_exceeded : public std::exception { 65 | public: 66 | /** 67 | * Constructor 68 | * 69 | * @param hp the hash power we were trying to expand to 70 | */ 71 | libcuckoo_maximum_hashpower_exceeded(const size_t hp) 72 | : hashpower_(hp) {} 73 | 74 | virtual const char* what() const noexcept { 75 | return "Expansion beyond maximum hashpower"; 76 | } 77 | 78 | /** 79 | * @return the hashpower we were trying to expand to 80 | */ 81 | size_t hashpower() { 82 | return hashpower_; 83 | } 84 | private: 85 | const size_t hashpower_; 86 | }; 87 | 88 | #endif // _CUCKOOHASH_UTIL_HH 89 | -------------------------------------------------------------------------------- /include/cereal/external/rapidxml/license.txt: -------------------------------------------------------------------------------- 1 | Use of this software is granted under one of the following two licenses, 2 | to be chosen freely by the user. 3 | 4 | 1. Boost Software License - Version 1.0 - August 17th, 2003 5 | =============================================================================== 6 | 7 | Copyright (c) 2006, 2007 Marcin Kalicinski 8 | 9 | Permission is hereby granted, free of charge, to any person or organization 10 | obtaining a copy of the software and accompanying documentation covered by 11 | this license (the "Software") to use, reproduce, display, distribute, 12 | execute, and transmit the Software, and to prepare derivative works of the 13 | Software, and to permit third-parties to whom the Software is furnished to 14 | do so, all subject to the following: 15 | 16 | The copyright notices in the Software and this entire statement, including 17 | the above license grant, this restriction and the following disclaimer, 18 | must be included in all copies of the Software, in whole or in part, and 19 | all derivative works of the Software, unless such copies or derivative 20 | works are solely in the form of machine-executable object code generated by 21 | a source language processor. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 26 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 27 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 28 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29 | DEALINGS IN THE SOFTWARE. 30 | 31 | 2. The MIT License 32 | =============================================================================== 33 | 34 | Copyright (c) 2006, 2007 Marcin Kalicinski 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a copy 37 | of this software and associated documentation files (the "Software"), to deal 38 | in the Software without restriction, including without limitation the rights 39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 40 | of the Software, and to permit persons to whom the Software is furnished to do so, 41 | subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in all 44 | copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 49 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 52 | IN THE SOFTWARE. 53 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Eigen2Support/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MATH_FUNCTIONS_H 11 | #define EIGEN2_MATH_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | template inline typename NumTraits::Real ei_real(const T& x) { return numext::real(x); } 16 | template inline typename NumTraits::Real ei_imag(const T& x) { return numext::imag(x); } 17 | template inline T ei_conj(const T& x) { return numext::conj(x); } 18 | template inline typename NumTraits::Real ei_abs (const T& x) { using std::abs; return abs(x); } 19 | template inline typename NumTraits::Real ei_abs2(const T& x) { return numext::abs2(x); } 20 | template inline T ei_sqrt(const T& x) { using std::sqrt; return sqrt(x); } 21 | template inline T ei_exp (const T& x) { using std::exp; return exp(x); } 22 | template inline T ei_log (const T& x) { using std::log; return log(x); } 23 | template inline T ei_sin (const T& x) { using std::sin; return sin(x); } 24 | template inline T ei_cos (const T& x) { using std::cos; return cos(x); } 25 | template inline T ei_atan2(const T& x,const T& y) { using std::atan2; return atan2(x,y); } 26 | template inline T ei_pow (const T& x,const T& y) { return numext::pow(x,y); } 27 | template inline T ei_random () { return internal::random(); } 28 | template inline T ei_random (const T& x, const T& y) { return internal::random(x, y); } 29 | 30 | template inline T precision () { return NumTraits::dummy_precision(); } 31 | template inline T machine_epsilon () { return NumTraits::epsilon(); } 32 | 33 | 34 | template 35 | inline bool ei_isMuchSmallerThan(const Scalar& x, const OtherScalar& y, 36 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 37 | { 38 | return internal::isMuchSmallerThan(x, y, precision); 39 | } 40 | 41 | template 42 | inline bool ei_isApprox(const Scalar& x, const Scalar& y, 43 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 44 | { 45 | return internal::isApprox(x, y, precision); 46 | } 47 | 48 | template 49 | inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y, 50 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 51 | { 52 | return internal::isApproxOrLessThan(x, y, precision); 53 | } 54 | 55 | } // end namespace Eigen 56 | 57 | #endif // EIGEN2_MATH_FUNCTIONS_H 58 | -------------------------------------------------------------------------------- /include/eigen3/Eigen/src/Householder/BlockHouseholder.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Vincent Lejeune 5 | // Copyright (C) 2010 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_BLOCK_HOUSEHOLDER_H 12 | #define EIGEN_BLOCK_HOUSEHOLDER_H 13 | 14 | // This file contains some helper function to deal with block householder reflectors 15 | 16 | namespace Eigen { 17 | 18 | namespace internal { 19 | 20 | /** \internal */ 21 | template 22 | void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) 23 | { 24 | typedef typename TriangularFactorType::Index Index; 25 | typedef typename VectorsType::Scalar Scalar; 26 | const Index nbVecs = vectors.cols(); 27 | eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); 28 | 29 | for(Index i = 0; i < nbVecs; i++) 30 | { 31 | Index rs = vectors.rows() - i; 32 | Scalar Vii = vectors(i,i); 33 | vectors.const_cast_derived().coeffRef(i,i) = Scalar(1); 34 | triFactor.col(i).head(i).noalias() = -hCoeffs(i) * vectors.block(i, 0, rs, i).adjoint() 35 | * vectors.col(i).tail(rs); 36 | vectors.const_cast_derived().coeffRef(i, i) = Vii; 37 | // FIXME add .noalias() once the triangular product can work inplace 38 | triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView() 39 | * triFactor.col(i).head(i); 40 | triFactor(i,i) = hCoeffs(i); 41 | } 42 | } 43 | 44 | /** \internal */ 45 | template 46 | void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs) 47 | { 48 | typedef typename MatrixType::Index Index; 49 | enum { TFactorSize = MatrixType::ColsAtCompileTime }; 50 | Index nbVecs = vectors.cols(); 51 | Matrix T(nbVecs,nbVecs); 52 | make_block_householder_triangular_factor(T, vectors, hCoeffs); 53 | 54 | const TriangularView& V(vectors); 55 | 56 | // A -= V T V^* A 57 | Matrix tmp = V.adjoint() * mat; 59 | // FIXME add .noalias() once the triangular product can work inplace 60 | tmp = T.template triangularView().adjoint() * tmp; 61 | mat.noalias() -= V * tmp; 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_BLOCK_HOUSEHOLDER_H 69 | --------------------------------------------------------------------------------