Author: osallou Date: 2014-08-18 16:55:38 +0000 (Mon, 18 Aug 2014) New Revision: 17768
Modified: trunk/packages/mapsembler2/trunk/debian/patches/use_debian_libs Log: fix patch Modified: trunk/packages/mapsembler2/trunk/debian/patches/use_debian_libs =================================================================== --- trunk/packages/mapsembler2/trunk/debian/patches/use_debian_libs 2014-08-18 16:28:48 UTC (rev 17767) +++ trunk/packages/mapsembler2/trunk/debian/patches/use_debian_libs 2014-08-18 16:55:38 UTC (rev 17768) @@ -70,2223 +70,94 @@ ################################################################################ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/LargeInt.hpp +Index: mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/LargeInt.hpp =================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/LargeInt.hpp -+++ /dev/null -@@ -1,547 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file LargeInt.hpp -- * \date 01/03/2013 -- * \author edrezen -- * \brief Class that manages large integers -- * -- * arbitrary-precision integer library -- * very limited: only does what minia needs (but not what minia deserves) -- * This file holds interfaces related to the Design Pattern Observer. -- */ -- --#ifndef _GATB_CORE_TOOLS_MATH_LARGEINT_HPP_ --#define _GATB_CORE_TOOLS_MATH_LARGEINT_HPP_ -- --/********************************************************************************/ -- --#include <stdint.h> --#include <algorithm> --#include <iostream> +--- mapsembler2_pipeline.orig/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/LargeInt.hpp ++++ mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/LargeInt.hpp +@@ -35,7 +35,7 @@ + #include <stdint.h> + #include <algorithm> + #include <iostream> -#include <hdf5/hdf5.h> -- --#include <gatb/system/api/Exception.hpp> --#include <gatb/tools/math/NativeInt64.hpp> -- --#ifndef ASSERTS --#define NDEBUG // disable asserts; those asserts make sure that with PRECISION == [1 or 2], all is correct --#endif -- --#include <assert.h> -- --// some 64-bit assert macros --#if defined(_LP64) --#define assert128(x) assert(precision != 2 || (x)); --#else --#define assert128(x) ; --#endif -- --extern const unsigned char revcomp_4NT[]; --extern const unsigned char comp_NT []; -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --/** \brief Math package */ --namespace math { --/********************************************************************************/ -- --/** \brief Large integer class -- */ --template<int precision> class LargeInt : public misc::ArrayData<u_int64_t, precision> --{ --public: -- -- static const char* getName () -- { -- static char buffer[256]; -- static bool first = true; -- if (first) { first = false; snprintf (buffer, sizeof(buffer), "LargeInt<%d>", precision); } -- return buffer; -- } -- -- u_int64_t getVal() { return this->value[0]; } -- static const size_t getSize () { return 8*sizeof(u_int64_t)*precision; } -- -- /********************************************************************************/ -- /** Constructor. -- * \param[in] val : initial value of the large integer. */ -- LargeInt(const u_int64_t& val = 0) -- { -- this->value[0] = val; for (int i = 1; i < precision; i++) { this->value[i] = 0; } -- } -- -- /********************************************************************************/ -- /** Returns lower 64 bits */ -- u_int64_t toInt () const { throw system::Exception ("LargeInt<%d> no support of toInt", precision); } -- -- /********************************************************************************/ -- LargeInt operator+ (const LargeInt& other) const -- { -- LargeInt result; -- int carry = 0; -- for (int i = 0 ; i < precision ; i++) -- { -- result.value[i] = this->value[i] + other.value[i] + carry; -- carry = (result.value[i] < this->value[i]) ? 1 : 0; -- } -- -- assert (precision != 1 || (result == other.value[0] + this->value[0])); -- assert128 (result.toInt128() == other.toInt128() + toInt128()); -- return result; -- } -- -- /********************************************************************************/ -- LargeInt operator- (const LargeInt& other) const -- { -- LargeInt result; -- int carry = 0; -- for (int i = 0 ; i < precision ; i++) -- { -- result.value[i] = this->value[i] - other.value[i] - carry; -- carry = (result.value[i] > this->value[i]) ? 1 : 0; -- } -- -- assert(precision != 1 || (result == this->value[0] - other.value[0])); -- assert128(result.toInt128() == toInt128() - other.toInt128()); -- return result; -- } -- -- -- -- /********************************************************************************/ -- LargeInt operator*(const int& coeff) const -- { -- LargeInt result (*this); -- // minia doesn't have that many multiplications cases -- -- if (coeff == 2 || coeff == 4) -- { -- result = result << (coeff / 2); -- } -- else -- { -- if (coeff == 21) -- { -- result = (result << 4) + (result << 2) + result; -- } -- else -- { -- printf("unsupported LargeInt multiplication: %d\n",coeff); -- exit(1); -- } -- } -- -- assert(precision != 1 || (result == this->value[0] * coeff)); -- assert128(result.toInt128() == toInt128() * coeff); -- return result; -- } -- -- /********************************************************************************/ -- LargeInt operator/(const uint32_t& divisor) const -- { -- LargeInt result; -- std::fill( result.value, result.value + precision, 0 ); -- -- // inspired by Divide32() from http://subversion.assembla.com/svn/pxcode/RakNet/Source/BigInt.cpp -- -- u_int64_t r = 0; -- uint32_t mask32bits = ~0; -- for (int i = precision-1; i >= 0; --i) -- { -- for (int j = 1; j >= 0; --j) // [j=1: high-32 bits, j=0: low-32 bits] of array[i] -- { -- u_int64_t n = (r << 32) | ((this->value[i] >> (32*j)) & mask32bits ); -- result.value[i] = result.value[i] | (((n / divisor) & mask32bits) << (32*j)); -- r = n % divisor; -- } -- } -- assert(precision != 1 || (result == this->value[0] / divisor)); -- assert128(result.toInt128() == toInt128() / divisor); -- return result; -- } -- -- /********************************************************************************/ -- uint32_t operator%(const uint32_t& divisor) const -- { -- u_int64_t r = 0; -- uint32_t mask32bits = ~0; -- for (int i = precision-1; i >= 0; --i) -- { -- for (int j = 1; j >= 0; --j) // [j=1: high-32 bits, j=0: low-32 bits] of array[i] -- { -- u_int64_t n = (r << 32) | ((this->value[i] >> (32*j)) & mask32bits ); -- r = n % divisor; -- } -- } -- -- assert(precision != 1 || (r == this->value[0] % divisor)); -- assert128(r == toInt128() % divisor); -- return (uint32_t)r; -- } -- -- /********************************************************************************/ -- LargeInt operator^(const LargeInt& other) const -- { -- LargeInt result; -- for (int i=0 ; i < precision ; i++) -- result.value[i] = this->value[i] ^ other.value[i]; -- -- assert(precision != 1 || (result == (this->value[0] ^ other.value[0]))); -- assert128(result.toInt128() == (toInt128() ^ other.toInt128())); -- return result; -- } -- -- /********************************************************************************/ -- LargeInt operator|(const LargeInt& other) const -- { -- LargeInt result; -- for (int i=0 ; i < precision ; i++) -- result.value[i] = this->value[i] | other.value[i]; -- -- assert(precision != 1 || (result == (this->value[0] | other.value[0]))); -- assert128(result.toInt128() == (toInt128() | other.toInt128())); -- return result; -- } -- -- /********************************************************************************/ -- LargeInt operator&(const LargeInt& other) const -- { -- LargeInt result; -- for (int i=0 ; i < precision ; i++) -- result.value[i] = this->value[i] & other.value[i]; -- -- assert(precision != 1 || (result == (this->value[0] & other.value[0]))); -- assert128(result.toInt128() == (toInt128() & other.toInt128())); -- return result; -- } -- -- /********************************************************************************/ -- LargeInt operator&(const char& other) const -- { -- LargeInt result; -- result.value[0] = this->value[0] & other; -- return result; -- } -- -- /********************************************************************************/ -- LargeInt operator~() const -- { -- LargeInt result; -- for (int i=0 ; i < precision ; i++) -- result.value[i] = ~this->value[i]; -- -- assert(precision != 1 || (result == ~this->value[0])); -- assert128(result.toInt128() == ~toInt128()); -- return result; -- } -- -- /********************************************************************************/ -- LargeInt operator<<(const int& coeff) const -- { -- LargeInt result (0); -- -- int large_shift = coeff / 64; -- int small_shift = coeff % 64; -- -- for (int i = large_shift ; i < precision-1; i++) -- { -- result.value[i] = result.value[i] | (this->value[i-large_shift] << small_shift); -- -- if (small_shift == 0) // gcc "bug".. u_int64_t x; x>>64 == 1<<63, x<<64 == 1 -- { -- result.value[i+1] = 0; -- } -- else -- { -- result.value[i+1] = this->value[i-large_shift] >> (64 - small_shift); -- } -- -- } -- result.value[precision-1] = result.value[precision-1] | (this->value[precision-1-large_shift] << small_shift); -- -- assert(precision != 1 || (result == (this->value[0] << coeff))); -- assert128(result.toInt128() == (toInt128() << coeff)); -- return result; -- } -- -- /********************************************************************************/ -- LargeInt operator>>(const int& coeff) const -- { -- LargeInt result (0); -- -- int large_shift = coeff / 64; -- int small_shift = coeff % 64; -- -- result.value[0] = (this->value[large_shift] >> small_shift); -- -- for (int i = 1 ; i < precision - large_shift ; i++) -- { -- result.value[i] = (this->value[i+large_shift] >> small_shift); -- if (small_shift == 0 && large_shift > 0) // gcc "bug".. u_int64_t x; x>>64 == 1<<63, x<<64 == 1 -- { -- result.value[i-1] = result.value[i-1]; -- } -- else -- { -- result.value[i-1] = result.value[i-1] | (this->value[i+large_shift] << (64 - small_shift)); -- } -- } -- -- assert(precision != 1 || ( small_shift == 0 || (result == this->value[0] >> coeff))); -- assert128(small_shift == 0 || (result.toInt128() == (toInt128() >> coeff))); -- return result; -- } -- -- /********************************************************************************/ -- bool operator!=(const LargeInt& c) const -- { -- for (int i = 0 ; i < precision ; i++) -- if( this->value[i] != c.value[i] ) -- return true; -- return false; -- } -- -- /********************************************************************************/ -- bool operator==(const LargeInt& c) const -- { -- for (int i = 0 ; i < precision ; i++) -- if( this->value[i] != c.value[i] ) -- return false; -- return true; -- } -- -- /********************************************************************************/ -- bool operator<(const LargeInt& c) const -- { -- for (int i = precision-1 ; i>=0 ; --i) -- if( this->value[i] != c.value[i] ) -- return this->value[i] < c.value[i]; -- -- return false; -- } -- -- /********************************************************************************/ -- bool operator<=(const LargeInt& c) const -- { -- return operator==(c) || operator<(c); -- } -- -- /********************************************************************************/ -- LargeInt& operator+= (const LargeInt& other) -- { -- // NOT so easy to optimize because of the carry -- *this = *this + other; -- return *this; -- } -- -- /********************************************************************************/ -- LargeInt& operator^= (const LargeInt& other) -- { -- for (int i=0 ; i < precision ; i++) { this->value[i] ^= other.value[i]; } -- return *this; -- } -- -- /********************************************************************************/ -- LargeInt& operator&= (const LargeInt& other) -- { -- for (int i=0 ; i < precision ; i++) { this->value[i] &= other.value[i]; } -- return *this; -- } -- -- /********************************************************************************/ -- LargeInt& operator|= (const LargeInt& other) -- { -- for (int i=0 ; i < precision ; i++) { this->value[i] |= other.value[i]; } -- return *this; -- } -- -- /********************************************************************************/ -- LargeInt& operator<<= (const int& coeff) -- { -- *(this) = (*this) << coeff; return *this; -- } -- -- /********************************************************************************/ -- LargeInt& operator>>= (const int& coeff) -- { -- *(this) = (*this) >> coeff; return *this; -- } -- -- /********************************************************************************/ -- LargeInt& sync_fetch_and_or (const LargeInt& other) -- { -- for (int i=0 ; i < precision ; i++) { __sync_fetch_and_or (this->value + i, other.value[i]); } -- return *this; -- } -- -- /********************************************************************************/ -- LargeInt& sync_fetch_and_and (const LargeInt& other) -- { -- for (int i=0 ; i < precision ; i++) { __sync_fetch_and_and (this->value + i, other.value[i]); } -- return *this; -- } -- -- /********************************************************************************/ -- friend std::ostream & operator<<(std::ostream & s, const LargeInt<precision> & l) -- { -- int i=0; -- -- /** We want to display the number in hexa (easier to do...) */ -- s << std::hex; -- -- /** We skip leading 0. */ -- for (i=precision-1; i>=0 && l.value[i]==0; i--) {} -- -- /** We dump the different parts of the large integer. */ -- for ( ; i>=0 ; i--) { s << l.value[i]; if (i>=1) { s << "."; } } -- -- /** We go back to decimal format. */ -- s << std::dec; -- -- /** We return the output stream. */ -- return s; -- } -- -- /********************************************************************************/ -- inline static hid_t hdf5 (bool& isCompound) -- { -- hid_t result = H5Tcopy (H5T_NATIVE_INT); -- H5Tset_precision (result, 2*precision); -- return result; -- } -- -- /********************************************************************************/ -- template<typename Map> -- static LargeInt polynom (const char* data, size_t size, Map fct) -- { -- LargeInt res (0); -- for (size_t i=0; i<size; ++i) { res = res * 4 + fct(data[i]); } -- return res; -- } -- -- /********************************************************************************/ -- /** Print corresponding kmer in ASCII -- * \param[in] sizeKmer : kmer size (def=32). -- */ -- std::string toString (size_t sizeKmer) const -- { -- char seq[65]; -- char bin2NT[4] = {'A','C','T','G'}; -- -- for (size_t i=0; i<sizeKmer; i++) { seq[sizeKmer-i-1] = bin2NT [(*this)[i]]; } -- seq[sizeKmer]='\0'; -- return seq; -- } -- -- /********************************************************************************/ -- u_int8_t operator[] (size_t idx) const { return (this->value[0] >> (2*idx)) & 3; } -- --private: --// u_int64_t value[precision]; -- -- template<int T> friend LargeInt<T> revcomp (const LargeInt<T>& i, size_t sizeKmer); -- template<int T> friend u_int64_t hash1 (const LargeInt<T>& key, u_int64_t seed); -- template<int T> friend u_int64_t oahash (const LargeInt<T>& key); -- template<int T> friend u_int64_t simplehash16 (const LargeInt<T>& key, int shift); -- -- // c++ fun fact: -- // "const" will ban the function from being anything which can attempt to alter any member variables in the object. -- // 2 months later: I don't understand this fun fact anymore. thanks c++. --}; -- --/********************************************************************************/ --template<int precision> inline LargeInt<precision> revcomp (const LargeInt<precision>& x, size_t sizeKmer) --{ -- const LargeInt<precision> res = x; -- -- unsigned char* kmerrev = (unsigned char *) (&(res.value[0])); -- unsigned char* kmer = (unsigned char *) (&(x.value[0])); -- -- for (size_t i=0; i<8*precision; ++i) -- { -- kmerrev[8*precision-1-i] = revcomp_4NT [kmer[i]]; -- } -- -- return (res >> (2*( 32*precision - sizeKmer)) ) ; --} -- --/********************************************************************************/ --template<int precision> inline u_int64_t hash1 (const LargeInt<precision>& elem, u_int64_t seed=0) --{ -- // hash = XOR_of_series[hash(i-th chunk iof 64 bits)] -- u_int64_t result = 0, chunk, mask = ~0; -- -- LargeInt<precision> intermediate = elem; -- for (size_t i=0;i<precision;i++) -- { -- chunk = (intermediate & mask).value[0]; -- intermediate = intermediate >> 64; -- -- result ^= NativeInt64::hash64 (chunk,seed); -- } -- return result; --} -- --/********************************************************************************/ --template<int precision> u_int64_t oahash (const LargeInt<precision>& elem) --{ -- // hash = XOR_of_series[hash(i-th chunk iof 64 bits)] -- u_int64_t result = 0, chunk, mask = ~0; -- -- LargeInt<precision> intermediate = elem; -- for (size_t i=0;i<precision;i++) -- { -- chunk = (intermediate & mask).value[0]; -- intermediate = intermediate >> 64; -- result ^= NativeInt64::oahash64 (chunk); -- } -- return result; --} -- --/********************************************************************************/ --template<int precision> inline u_int64_t simplehash16 (const LargeInt<precision>& elem, int shift) --{ -- u_int64_t result = 0, chunk, mask = ~0; -- LargeInt<precision> intermediate = elem; -- -- chunk = (intermediate & mask).value[0]; -- result ^= NativeInt64::simplehash16_64 (chunk,shift); -- -- return result; --} -- -- --/********************************************************************************/ --/******************** SPECIALIZATION FOR precision=1 ********************/ --/********************************************************************************/ --#include <gatb/tools/math/LargeInt1.pri> -- --/********************************************************************************/ --/******************** SPECIALIZATION FOR precision=2 ********************/ --/********************************************************************************/ --#include <gatb/tools/math/LargeInt2.pri> -- --/********************************************************************************/ --} } } } /* end of namespaces. */ --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_MATH_LARGEINT_HPP_ */ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt128.hpp ++#include <hdf5.h> + + #include <gatb/system/api/Exception.hpp> + #include <gatb/tools/math/NativeInt64.hpp> +Index: mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp =================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt128.hpp -+++ /dev/null -@@ -1,224 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file NativeInt128.hpp -- * \date 01/03/2013 -- * \author edrezen -- * \brief Integer class relying on native 128 bits integer type -- */ -- --#ifndef _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_128_HPP_ --#define _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_128_HPP_ -- --#include <gatb/system/api/config.hpp> -- --/********************************************************************************/ --#if INT128_FOUND == 1 --/********************************************************************************/ -- --#include <iostream> +--- mapsembler2_pipeline.orig/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp ++++ mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp +@@ -40,7 +40,7 @@ + #include <string> + #include <vector> + #include <stdarg.h> -#include <hdf5/hdf5.h> -- --#include <gatb/system/api/types.hpp> --#include <gatb/tools/misc/api/Abundance.hpp> --#include <gatb/tools/math/NativeInt64.hpp> -- --extern const unsigned char revcomp_4NT[]; --extern const unsigned char comp_NT []; -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --/** \brief Math package */ --namespace math { --/********************************************************************************/ -- --/** \brief Large integer class -- */ --class NativeInt128 : private misc::ArrayData<__uint128_t, 1> --{ --public: -- -- /** Constructor. -- * \param[in] c : initial value of the large integer. */ -- NativeInt128 (const __uint128_t& c=0) { value[0] = c; } -- -- static const char* getName () { return "NativeInt128"; } -- -- u_int64_t getVal () { return *value; } -- -- static const size_t getSize () { return 8*sizeof(__uint128_t); } -- -- NativeInt128 operator+ (const NativeInt128& other) const { return value[0] + other.value[0]; } -- NativeInt128 operator- (const NativeInt128& other) const { return value[0] - other.value[0]; } -- NativeInt128 operator| (const NativeInt128& other) const { return value[0] | other.value[0]; } -- NativeInt128 operator* (const int& coeff) const { return value[0] * coeff; } -- NativeInt128 operator/ (const u_int32_t& divisor) const { return value[0] / divisor; } -- u_int32_t operator% (const u_int32_t& divisor) const { return value[0] % divisor; } -- NativeInt128 operator^ (const NativeInt128& other) const { return value[0] ^ other.value[0]; } -- NativeInt128 operator& (const NativeInt128& other) const { return value[0] & other.value[0]; } -- NativeInt128 operator& (const char& other) const { return value[0] & other; } -- NativeInt128 operator~ () const { return ~value[0]; } -- NativeInt128 operator<< (const int& coeff) const { return value[0] << coeff; } -- NativeInt128 operator>> (const int& coeff) const { return value[0] >> coeff; } -- bool operator!= (const NativeInt128& c) const { return value[0] != c.value[0]; } -- bool operator== (const NativeInt128& c) const { return value[0] == c.value[0]; } -- bool operator< (const NativeInt128& c) const { return value[0] < c.value[0]; } -- bool operator<= (const NativeInt128& c) const { return value[0] <= c.value[0]; } -- -- NativeInt128& operator+= (const NativeInt128& other) { value[0] += other.value[0]; return *this; } -- NativeInt128& operator^= (const NativeInt128& other) { value[0] ^= other.value[0]; return *this; } -- NativeInt128& operator&= (const NativeInt128& other) { value[0] &= other.value[0]; return *this; } -- NativeInt128& operator|= (const NativeInt128& other) { value[0] |= other.value[0]; return *this; } -- NativeInt128& operator<<= (const int& coeff) { value[0] <<= coeff; return *this; } -- NativeInt128& operator>>= (const int& coeff) { value[0] >>= coeff; return *this; } -- -- /********************************************************************************/ -- NativeInt128& sync_fetch_and_or (const NativeInt128& other) -- { -- for (int i=0 ; i < 2 ; i++) { __sync_fetch_and_or ((u_int64_t*)(value + i), other.value[i]); } -- return *this; -- } -- -- /********************************************************************************/ -- NativeInt128& sync_fetch_and_and (const NativeInt128& other) -- { -- for (int i=0 ; i < 2 ; i++) { __sync_fetch_and_and (this->value + i, other.value[i]); } -- return *this; -- } -- -- /** Output stream overload. NOTE: for easier process, dump the value in hexadecimal. -- * \param[in] os : the output stream -- * \param[in] in : the integer value to be output. -- * \return the output stream. -- */ -- friend std::ostream & operator<<(std::ostream & os, const NativeInt128 & in) -- { -- __uint128_t x = in.value[0]; -- -- u_int64_t high_nucl = (u_int64_t) (x>>64); -- u_int64_t low_nucl = (u_int64_t)(x&((((__uint128_t)1)<<64)-1)); -- -- if (high_nucl == 0) { os << std::hex << low_nucl << std::dec; } -- else { os << std::hex << high_nucl << "." << low_nucl << std::dec; } -- return os; -- } -- -- /********************************************************************************/ -- -- /** Print corresponding kmer in ASCII -- * \param[sizeKmer] in : kmer size (def=64). -- */ -- inline void printASCII ( size_t sizeKmer = 64) -- { -- int i; -- u_int64_t temp = value[0]; -- -- -- char seq[65]; -- char bin2NT[4] = {'A','C','T','G'}; -- -- for (i=sizeKmer-1; i>=0; i--) -- { -- seq[i] = bin2NT[ temp&3 ]; -- temp = temp>>2; -- } -- seq[sizeKmer]='\0'; -- -- std::cout << seq << std::endl; -- } -- -- /********************************************************************************/ -- inline static hid_t hdf5 (bool& isCompound) -- { -- hid_t result = H5Tcopy (H5T_NATIVE_INT); -- H5Tset_precision (result, 128); -- return result; -- } -- --private: -- friend NativeInt128 revcomp (const NativeInt128& i, size_t sizeKmer); -- friend u_int64_t hash1 (const NativeInt128& key, u_int64_t seed); -- friend u_int64_t oahash (const NativeInt128& key); -- friend u_int64_t simplehash16 (const NativeInt128& key, int shift); -- --}; -- --/********************************************************************************/ --inline NativeInt128 revcomp (const NativeInt128& in, size_t sizeKmer) --{ -- // ---64bits-- ---64bits-- -- // original kmer: [__high_nucl__|__low_nucl___] -- // -- // ex: [ AC | .......TG ] -- // -- //revcomp: [ CA | .......GT ] -- // \_low_nucl__/\high_nucl/ -- -- const __uint128_t& x = in.value[0]; -- -- u_int64_t high_nucl = (u_int64_t)(x>>64); -- int nb_high_nucl = sizeKmer>32?sizeKmer - 32:0; -- -- __uint128_t revcomp_high_nucl = NativeInt64::revcomp64 (high_nucl, nb_high_nucl); -- -- if (sizeKmer<=32) revcomp_high_nucl = 0; // srsly dunno why this is needed. gcc bug? u_int64_t x ---> (x>>64) != 0 -- -- u_int64_t low_nucl = (u_int64_t)(x&((((__uint128_t)1)<<64)-1)); -- int nb_low_nucl = sizeKmer>32?32:sizeKmer; -- -- __uint128_t revcomp_low_nucl = NativeInt64::revcomp64 (low_nucl, nb_low_nucl); -- -- return (revcomp_low_nucl<<(2*nb_high_nucl)) + revcomp_high_nucl; --} -- --/********************************************************************************/ --inline u_int64_t hash1 (const NativeInt128& item, u_int64_t seed=0) --{ -- const __uint128_t& elem = item.value[0]; -- -- return NativeInt64::hash64 ((u_int64_t)(elem>>64),seed) ^ -- NativeInt64::hash64 ((u_int64_t)(elem&((((__uint128_t)1)<<64)-1)),seed); --} -- --/********************************************************************************/ --inline u_int64_t oahash (const NativeInt128& item) --{ -- const __uint128_t& elem = item.value[0]; -- -- return NativeInt64::oahash64 ((u_int64_t)(elem>>64)) ^ -- NativeInt64::oahash64 ((u_int64_t)(elem&((((__uint128_t)1)<<64)-1))); --} -- --/********************************************************************************/ --inline u_int64_t simplehash16 (const NativeInt128& key, int shift) --{ -- return NativeInt64::simplehash16_64 ((u_int64_t)key.value[0], shift); --} -- --/********************************************************************************/ --} } } } /* end of namespaces. */ --/********************************************************************************/ -- --/********************************************************************************/ --#endif //INT128_FOUND --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_128_HPP_ */ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt16.hpp ++#include <hdf5.h> + + /********************************************************************************/ + namespace gatb { +Index: mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/StorageHDF5.hpp =================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt16.hpp -+++ /dev/null -@@ -1,94 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file NativeInt16.hpp -- * \date 01/03/2013 -- * \author edrezen -- * \brief Integer class relying on native u_int16_t type -- */ -- --#ifndef _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_16_HPP_ --#define _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_16_HPP_ -- --/********************************************************************************/ -- --#include <iostream> --#include <gatb/system/api/types.hpp> --#include <gatb/tools/misc/api/Abundance.hpp> +--- mapsembler2_pipeline.orig/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/StorageHDF5.hpp ++++ mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/StorageHDF5.hpp +@@ -32,7 +32,7 @@ + + #include <gatb/tools/storage/impl/CollectionHDF5.hpp> + #include <gatb/system/impl/System.hpp> -#include <hdf5/hdf5.h> -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --/** \brief Math package */ --namespace math { --/********************************************************************************/ -- --/** \brief Large integer class -- */ --class NativeInt16 : private misc::ArrayData<u_int16_t, 1> --{ --public: -- -- typedef ArrayData<u_int16_t, 1> POD; -- -- /** Constructor. -- * \param[in] c : initial value of the large integer. */ -- NativeInt16 (const u_int8_t& c=0) { value[0] = c; } -- -- static const char* getName () { return "NativeInt16"; } -- -- static const size_t getSize () { return 8*sizeof(u_int16_t); } -- -- NativeInt16 operator+ (const NativeInt16& other) const { return value[0] + other.value[0]; } -- NativeInt16 operator- (const NativeInt16& other) const { return value[0] - other.value[0]; } -- NativeInt16 operator| (const NativeInt16& other) const { return value[0] | other.value[0]; } -- NativeInt16 operator^ (const NativeInt16& other) const { return value[0] ^ other.value[0]; } -- NativeInt16 operator& (const NativeInt16& other) const { return value[0] & other.value[0]; } -- NativeInt16 operator& (const char& other) const { return value[0] & other; } -- NativeInt16 operator~ () const { return ~value[0]; } -- NativeInt16 operator<< (const int& coeff) const { return value[0] << coeff; } -- NativeInt16 operator>> (const int& coeff) const { return value[0] >> coeff; } -- bool operator!= (const NativeInt16& c) const { return value[0] != c.value[0]; } -- bool operator== (const NativeInt16& c) const { return value[0] == c.value[0]; } -- bool operator< (const NativeInt16& c) const { return value[0] < c.value[0]; } -- bool operator<= (const NativeInt16& c) const { return value[0] <= c.value[0]; } -- bool operator>= (const NativeInt16& c) const { return value[0] >= c.value[0]; } -- NativeInt16& operator+= (const NativeInt16& other) { value[0] += other.value[0]; return *this; } -- NativeInt16& operator^= (const NativeInt16& other) { value[0] ^= other.value[0]; return *this; } -- -- /********************************************************************************/ -- friend std::ostream & operator<<(std::ostream & s, const NativeInt16 & l) -- { -- s << std::hex << l.value[0] << std::dec; return s; -- } -- -- /********************************************************************************/ -- inline static hid_t hdf5 (bool& isCompound) -- { -- return H5Tcopy (H5T_NATIVE_UINT16); -- } --}; -- --/********************************************************************************/ --} } } } /* end of namespaces. */ --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_16_HPP_ */ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt64.hpp ++#include <hdf5.h> + #include <typeinfo> + + /********************************************************************************/ +Index: mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt128.hpp =================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt64.hpp -+++ /dev/null -@@ -1,248 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file NativeInt64.hpp -- * \date 01/03/2013 -- * \author edrezen -- * \brief Integer class relying on native u_int64_t type -- */ -- --#ifndef _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_64_HPP_ --#define _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_64_HPP_ -- --/********************************************************************************/ -- --#include <iostream> --#include <gatb/system/api/types.hpp> --#include <gatb/tools/misc/api/Abundance.hpp> +--- mapsembler2_pipeline.orig/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt128.hpp ++++ mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt128.hpp +@@ -33,7 +33,7 @@ + /********************************************************************************/ + + #include <iostream> -#include <hdf5/hdf5.h> -- --extern const unsigned char revcomp_4NT[]; --extern const unsigned char comp_NT []; --extern const u_int64_t random_values [256]; -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --/** \brief Math package */ --namespace math { --/********************************************************************************/ -- --/** \brief Large integer class -- */ --class NativeInt64 : private misc::ArrayData<u_int64_t, 1> --{ --public: -- -- /** Constructor. -- * \param[in] c : initial value of the large integer. */ -- NativeInt64 (const u_int64_t& c=0) { value[0] = c; } -- -- static const char* getName () { return "NativeInt64"; } -- -- u_int64_t getVal () { return *value; } -- -- -- static const size_t getSize () { return 8*sizeof(u_int64_t); } -- -- NativeInt64 operator+ (const NativeInt64& other) const { return value[0] + other.value[0]; } -- NativeInt64 operator- (const NativeInt64& other) const { return value[0] - other.value[0]; } -- NativeInt64 operator| (const NativeInt64& other) const { return value[0] | other.value[0]; } -- NativeInt64 operator* (const int& coeff) const { return value[0] * coeff; } -- NativeInt64 operator/ (const u_int32_t& divisor) const { return value[0] / divisor; } -- u_int32_t operator% (const u_int32_t& divisor) const { return value[0] % divisor; } -- NativeInt64 operator^ (const NativeInt64& other) const { return value[0] ^ other.value[0]; } -- NativeInt64 operator& (const NativeInt64& other) const { return value[0] & other.value[0]; } -- NativeInt64 operator& (const char& other) const { return value[0] & other; } -- NativeInt64 operator~ () const { return ~value[0]; } -- NativeInt64 operator<< (const int& coeff) const { return value[0] << coeff; } -- NativeInt64 operator>> (const int& coeff) const { return value[0] >> coeff; } -- bool operator!= (const NativeInt64& c) const { return value[0] != c.value[0]; } -- bool operator== (const NativeInt64& c) const { return value[0] == c.value[0]; } -- bool operator< (const NativeInt64& c) const { return value[0] < c.value[0]; } -- bool operator<= (const NativeInt64& c) const { return value[0] <= c.value[0]; } -- -- NativeInt64& operator+= (const NativeInt64& other) { value[0] += other.value[0]; return *this; } -- NativeInt64& operator^= (const NativeInt64& other) { value[0] ^= other.value[0]; return *this; } -- NativeInt64& operator&= (const NativeInt64& other) { value[0] &= other.value[0]; return *this; } -- NativeInt64& operator|= (const NativeInt64& other) { value[0] |= other.value[0]; return *this; } -- NativeInt64& operator<<= (const int& coeff) { value[0] <<= coeff; return *this; } -- NativeInt64& operator>>= (const int& coeff) { value[0] >>= coeff; return *this; } -- -- NativeInt64& sync_fetch_and_or (const NativeInt64& other) { __sync_fetch_and_or (&(value[0]), other.value[0]); return *this; } -- NativeInt64& sync_fetch_and_and (const NativeInt64& other) { __sync_fetch_and_and (&(value[0]), other.value[0]); return *this; } -- -- u_int8_t operator[] (size_t idx) { return (value[0] >> (2*idx)) & 3; } -- -- u_int64_t toInt () const { return value[0]; } -- -- /********************************************************************************/ -- friend std::ostream & operator<<(std::ostream & s, const NativeInt64 & l) -- { -- s << std::hex << l.value[0] << std::dec; return s; -- } -- /********************************************************************************/ -- /** Print corresponding kmer in ASCII -- * \param[in] sizeKmer : kmer size (def=32). -- */ -- inline void printASCII ( size_t sizeKmer = 32) -- { -- int i; -- u_int64_t temp = value[0]; -- -- -- char seq[33]; -- char bin2NT[4] = {'A','C','T','G'}; -- -- for (i=sizeKmer-1; i>=0; i--) -- { -- seq[i] = bin2NT[ temp&3 ]; -- temp = temp>>2; -- } -- seq[sizeKmer]='\0'; -- -- std::cout << seq << std::endl; -- } -- -- /********************************************************************************/ -- /** Print corresponding kmer in ASCII -- * \param[in] sizeKmer : kmer size (def=32). -- */ -- std::string toString (size_t sizeKmer) const -- { -- int i; -- u_int64_t temp = value[0]; -- -- char seq[33]; -- char bin2NT[4] = {'A','C','T','G'}; -- -- for (i=sizeKmer-1; i>=0; i--) -- { -- seq[i] = bin2NT[ temp&3 ]; -- temp = temp>>2; -- } -- seq[sizeKmer]='\0'; -- return seq; -- } -- -- -- /********************************************************************************/ -- inline static u_int64_t revcomp64 (const u_int64_t& x, size_t sizeKmer) -- { -- u_int64_t res = x; -- -- unsigned char* kmerrev = (unsigned char *) (&(res)); -- unsigned char* kmer = (unsigned char *) (&(x)); -- -- for (size_t i=0; i<8; ++i) { kmerrev[8-1-i] = revcomp_4NT [kmer[i]]; } -- -- return (res >> (2*( 32 - sizeKmer))) ; -- } -- -- /********************************************************************************/ -- inline static u_int64_t hash64 (u_int64_t key, u_int64_t seed) -- { -- u_int64_t hash = seed; -- hash ^= (hash << 7) ^ key * (hash >> 3) ^ (~((hash << 11) + (key ^ (hash >> 5)))); -- hash = (~hash) + (hash << 21); // hash = (hash << 21) - hash - 1; -- hash = hash ^ (hash >> 24); -- hash = (hash + (hash << 3)) + (hash << 8); // hash * 265 -- hash = hash ^ (hash >> 14); -- hash = (hash + (hash << 2)) + (hash << 4); // hash * 21 -- hash = hash ^ (hash >> 28); -- hash = hash + (hash << 31); -- return hash; -- } -- -- /********************************************************************************/ -- inline static u_int64_t oahash64 (u_int64_t elem) -- { -- u_int64_t code = elem; -- code = code ^ (code >> 14); //supp -- code = (~code) + (code << 18); -- code = code ^ (code >> 31); -- code = code * 21; -- code = code ^ (code >> 11); -- code = code + (code << 6); -- code = code ^ (code >> 22); -- return code; -- } -- -- /********************************************************************************/ -- /** computes a simple, naive hash using only 16 bits from input key -- * \param[in] key : key of the hash -- * \param[in] shift : selects which of the input byte will be used for hash computation -- */ -- inline static u_int64_t simplehash16_64 (u_int64_t key, int shift) -- { -- u_int64_t input = key >> shift; -- u_int64_t res = random_values[input & 255] ; -- -- input = input >> 8; -- res ^= random_values[input & 255] ; -- -- return res; -- //could be improved by xor'ing result of multiple bytes -- } -- -- /********************************************************************************/ -- inline static hid_t hdf5 (bool& isCompound) -- { -- return H5Tcopy (H5T_NATIVE_UINT64); -- } -- --private: -- -- friend NativeInt64 revcomp (const NativeInt64& i, size_t sizeKmer); -- friend u_int64_t hash1 (const NativeInt64& key, u_int64_t seed); -- friend u_int64_t oahash (const NativeInt64& key); -- friend u_int64_t simplehash16 (const NativeInt64& key, int shift); -- --}; -- --/********************************************************************************/ --inline NativeInt64 revcomp (const NativeInt64& x, size_t sizeKmer) --{ -- return NativeInt64::revcomp64 (x.value[0], sizeKmer); --} -- --/********************************************************************************/ --inline u_int64_t hash1 (const NativeInt64& key, u_int64_t seed=0) --{ -- return NativeInt64::hash64 (key.value[0], seed); --} -- --/********************************************************************************/ --inline u_int64_t oahash (const NativeInt64& key) --{ -- return NativeInt64::oahash64 (key.value[0]); --} -- --/********************************************************************************/ --inline u_int64_t simplehash16 (const NativeInt64& key, int shift) --{ -- return NativeInt64::simplehash16_64 (key.value[0], shift); --} -- --/********************************************************************************/ --} } } } /* end of namespaces. */ --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_64_HPP_ */ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt8.hpp ++#include <hdf5.h> + + #include <gatb/system/api/types.hpp> + #include <gatb/tools/misc/api/Abundance.hpp> +Index: mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt16.hpp =================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt8.hpp -+++ /dev/null -@@ -1,93 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file NativeInt8.hpp -- * \date 01/03/2013 -- * \author edrezen -- * \brief Integer class relying on native u_int8_t type -- */ -- --#ifndef _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_8_HPP_ --#define _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_8_HPP_ -- --/********************************************************************************/ -- --#include <iostream> --#include <gatb/system/api/types.hpp> --#include <gatb/tools/misc/api/Abundance.hpp> +--- mapsembler2_pipeline.orig/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt16.hpp ++++ mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt16.hpp +@@ -31,7 +31,7 @@ + #include <iostream> + #include <gatb/system/api/types.hpp> + #include <gatb/tools/misc/api/Abundance.hpp> -#include <hdf5/hdf5.h> -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --/** \brief Math package */ --namespace math { --/********************************************************************************/ -- --/** \brief Large integer class -- */ --class NativeInt8 : private misc::ArrayData<u_int8_t, 1> --{ --public: -- -- /** Constructor. -- * \param[in] c : initial value of the large integer. */ -- NativeInt8 (const u_int8_t& c=0) { value[0] = c; } -- -- static const char* getName () { return "NativeInt8"; } -- -- static const size_t getSize () { return 8*sizeof(u_int8_t); } -- -- operator char () const { return (char) value[0]; } -- -- NativeInt8 operator+ (const NativeInt8& other) const { return value[0] + other.value[0]; } -- NativeInt8 operator- (const NativeInt8& other) const { return value[0] - other.value[0]; } -- NativeInt8 operator| (const NativeInt8& other) const { return value[0] | other.value[0]; } -- NativeInt8 operator^ (const NativeInt8& other) const { return value[0] ^ other.value[0]; } -- NativeInt8 operator& (const NativeInt8& other) const { return value[0] & other.value[0]; } -- NativeInt8 operator& (const char& other) const { return value[0] & other; } -- NativeInt8 operator~ () const { return ~value[0]; } -- NativeInt8 operator<< (const int& coeff) const { return value[0] << coeff; } -- NativeInt8 operator>> (const int& coeff) const { return value[0] >> coeff; } -- bool operator!= (const NativeInt8& c) const { return value[0] != c.value[0]; } -- bool operator== (const NativeInt8& c) const { return value[0] == c.value[0]; } -- bool operator< (const NativeInt8& c) const { return value[0] < c.value[0]; } -- bool operator<= (const NativeInt8& c) const { return value[0] <= c.value[0]; } -- NativeInt8& operator+= (const NativeInt8& other) { value[0] += other.value[0]; return *this; } -- NativeInt8& operator^= (const NativeInt8& other) { value[0] ^= other.value[0]; return *this; } -- -- /********************************************************************************/ -- friend std::ostream & operator<<(std::ostream & s, const NativeInt8 & l) -- { -- s << std::hex << l.value[0] << std::dec; return s; -- } -- -- /********************************************************************************/ -- inline static hid_t hdf5 (bool& isCompound) -- { -- return H5Tcopy (H5T_NATIVE_UINT8); -- } --}; -- --/********************************************************************************/ --} } } } /* end of namespaces. */ --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_MATH_INTEGER_NATIVE_8_HPP_ */ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp ++#include <hdf5.h> + + /********************************************************************************/ + namespace gatb { +Index: mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt64.hpp =================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp -+++ /dev/null -@@ -1,466 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file CollectionHDF5.hpp -- * \date 01/03/2013 -- * \author edrezen -- * \brief Collection interface -- * -- * This file holds interfaces related to the Collection interface -- */ -- --#ifndef _GATB_CORE_TOOLS_STORAGE_IMPL_COLLECTION_HDF5_HPP_ --#define _GATB_CORE_TOOLS_STORAGE_IMPL_COLLECTION_HDF5_HPP_ -- --/********************************************************************************/ -- --#include <gatb/tools/collections/api/Collection.hpp> --#include <gatb/tools/collections/impl/BagFile.hpp> --#include <gatb/tools/collections/impl/IteratorFile.hpp> --#include <gatb/tools/collections/impl/CollectionAbstract.hpp> --#include <gatb/tools/designpattern/impl/IteratorHelpers.hpp> --#include <gatb/system/impl/System.hpp> -- --#include <string> --#include <vector> --#include <stdarg.h> +--- mapsembler2_pipeline.orig/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt64.hpp ++++ mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt64.hpp +@@ -31,7 +31,7 @@ + #include <iostream> + #include <gatb/system/api/types.hpp> + #include <gatb/tools/misc/api/Abundance.hpp> -#include <hdf5/hdf5.h> -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --namespace storage { --namespace impl { --/********************************************************************************/ -- --template <class Item> class BagHDF5 : public collections::Bag<Item>, public system::SmartPointer --{ --public: -- -- /** */ -- BagHDF5 (hid_t datasetId, hid_t typeId, u_int64_t& nbItems, system::ISynchronizer* synchro) -- : _datasetId(datasetId), _typeId(typeId), _nbInserted(0), _nbItems(nbItems), _synchro(synchro) -- { -- } -- -- /** Insert an item into the bag. -- * \param[in] item : the item to be inserted. */ -- void insert (const Item& item) { insert (&item, 1); } -- -- void insert (const std::vector<Item>& items, size_t length=0) { insert (items.data(), length==0 ? items.size() : length); } -- -- /** Insert items into the bag. -- * \param[in] items : items to be inserted. */ -- void insert (const Item* items, size_t length) -- { -- if (items==0 || length==0) { return; } -- -- herr_t status = 0; -- -- system::LocalSynchronizer localsynchro (_synchro); -- -- /** Resize the memory dataspace to indicate the new size of our buffer. */ -- hsize_t memDim = length; -- hid_t memspaceId = H5Screate_simple (1, &memDim, NULL); -- -- /** Extend dataset. */ -- hsize_t newDim = _nbInserted + length; -- status = H5Dset_extent (_datasetId, &newDim); -- if (status != 0) { std::cout << "err H5Dset_extent" << std::endl; } -- -- /** Select hyperslab on file dataset. */ -- hid_t filespaceId = H5Dget_space(_datasetId); -- hsize_t start = _nbInserted; -- hsize_t count = length; -- status = H5Sselect_hyperslab (filespaceId, H5S_SELECT_SET, &start, NULL, &count, NULL); -- if (status != 0) { std::cout << "err H5Sselect_hyperslab" << std::endl; } -- -- /** Append buffer to dataset */ -- status = H5Dwrite (_datasetId, _typeId, memspaceId, filespaceId, H5P_DEFAULT, items); -- if (status != 0) { std::cout << "err H5Dwrite" << std::endl; } -- -- /** We increase the number of inserted items. */ -- _nbInserted += length; -- -- __sync_fetch_and_add (&_nbItems, length); -- -- /** Close resources. */ -- status = H5Sclose (filespaceId); -- status = H5Sclose (memspaceId); -- if (status != 0) { std::cout << "err H5Sclose" << std::endl; } -- -- } -- -- /** */ -- void flush () {} -- --private: -- -- hid_t _datasetId; -- hid_t _typeId; -- u_int64_t& _nbItems; -- u_int64_t _nbInserted; -- system::ISynchronizer* _synchro; -- --}; -- --/********************************************************************************/ -- --template<typename Item> class HDF5Iterator; -- --template <class Item> class IterableHDF5 : public collections::Iterable<Item>, public system::SmartPointer --{ --public: -- -- /** */ -- IterableHDF5 (hid_t datasetId, hid_t typeId, u_int64_t& nbItems, system::ISynchronizer* synchro) -- : _datasetId(datasetId), _typeId(typeId), _nbItems(nbItems), _synchro(synchro) {} -- -- /** */ -- ~IterableHDF5 () {} -- -- /** */ -- dp::Iterator<Item>* iterator () { return new HDF5Iterator<Item> (this); } -- -- /** */ -- int64_t getNbItems () -- { -- return _nbItems; -- } -- -- /** */ -- int64_t estimateNbItems () -- { -- return getNbItems(); -- } -- -- /** */ -- Item* getItems (Item*& buffer) -- { -- retrieveCache (buffer, 0, getNbItems()); -- return buffer; -- } -- -- --private: -- -- hid_t _datasetId; -- hid_t _typeId; -- u_int64_t& _nbItems; -- system::ISynchronizer* _synchro; -- -- -- /** */ -- u_int64_t retrieveCache (Item* data, hsize_t start, hsize_t count) -- { -- herr_t status = 0; -- -- system::LocalSynchronizer localsynchro (_synchro); -- -- hid_t memspaceId = H5Screate_simple (1, &count, NULL); -- -- /** Select hyperslab on file dataset. */ -- hid_t filespaceId = H5Dget_space(_datasetId); -- status = H5Sselect_hyperslab (filespaceId, H5S_SELECT_SET, &start, NULL, &count, NULL); -- if (status != 0) { std::cout << "err H5Sselect_hyperslab" << std::endl; } -- -- /** Read buffer from dataset */ -- status = H5Dread (_datasetId, _typeId, memspaceId, filespaceId, H5P_DEFAULT, data); -- if (status != 0) { std::cout << "err H5Dread" << std::endl; } -- -- /** Close resources. */ -- status = H5Sclose (filespaceId); -- status = H5Sclose (memspaceId); -- if (status != 0) { std::cout << "err H5Sclose" << std::endl; } -- -- return count; -- } -- -- template<typename U> -- friend class HDF5Iterator; --}; -- --/********************************************************************************/ -- --/** */ --template<typename Item> --class HDF5Iterator : public dp::Iterator<Item> --{ --public: -- -- /** */ -- HDF5Iterator () : _ref(0), _blockSize(0), -- _data(0), _dataSize(0), _dataIdx(0), _isDone (true), -- _nbRead(0), _memspaceId(0), _total(0) -- {} -- -- /** */ -- HDF5Iterator (const HDF5Iterator& it) -- : _ref(it._ref), _blockSize(it._blockSize), -- _data(0), _dataSize(0), _dataIdx(0), _isDone (true), -- _nbRead(0), _memspaceId(0), _total(0) -- { -- _data = (Item*) malloc (_blockSize*sizeof(Item)); -- memset (_data, 0, _blockSize*sizeof(Item)); -- _total = _ref->_nbItems; -- } -- -- /** */ -- HDF5Iterator (IterableHDF5<Item>* ref, size_t blockSize=4096) -- : _ref(ref), _blockSize(blockSize), -- _data(0), _dataSize(0), _dataIdx(0), _isDone (true), -- _nbRead(0), _memspaceId(0), _total(0) -- { -- _data = (Item*) malloc (_blockSize*sizeof(Item)); -- memset (_data, 0, _blockSize*sizeof(Item)); -- -- _total = _ref->_nbItems; -- } -- -- HDF5Iterator& operator= (const HDF5Iterator& it) -- { -- if (this != &it) -- { -- _ref = it._ref; -- _blockSize = it._blockSize; -- _dataSize = it._dataSize; -- _dataIdx = it._dataIdx; -- _isDone = it._isDone; -- _nbRead = it._nbRead; -- _memspaceId = it._memspaceId; -- _total = it._total; -- -- if (_data) { free (_data); } -- _data = (Item*) malloc (_blockSize*sizeof(Item)); -- memcpy (_data, it._data, _blockSize*sizeof(Item)); -- } -- return *this; -- } -- -- -- /** */ -- ~HDF5Iterator() -- { -- if (_data) { free (_data); } -- } -- -- void first() -- { -- _nbRead = 0; -- _dataIdx = 0; -- _dataSize = retrieveNextCache(); -- _isDone = _dataIdx >= _dataSize; -- -- if (!_isDone) { *this->_item = _data[_dataIdx]; } -- } -- -- void next() -- { -- _dataIdx++; -- _isDone = _dataIdx >= _dataSize; -- if (!_isDone) { *this->_item = _data[_dataIdx]; } -- else -- { -- _dataIdx = 0; -- _dataSize = retrieveNextCache(); -- _isDone = _dataIdx >= _dataSize; -- if (!_isDone) { *this->_item = _data[_dataIdx]; } -- } -- } -- -- bool isDone() -- { -- return _isDone; -- } -- -- Item& item () { return *this->_item; } -- --private: -- IterableHDF5<Item>* _ref; -- size_t _blockSize; -- -- Item* _data; -- u_int64_t _dataSize; -- u_int64_t _dataIdx; -- -- bool _isDone; -- -- u_int64_t _nbRead; -- u_int64_t _total; -- -- hid_t _memspaceId; -- -- u_int64_t retrieveNextCache () -- { -- if (_total <= _nbRead) { return 0; } -- hsize_t nbToRead = std::min ((u_int64_t)_blockSize, _total - _nbRead); -- -- _nbRead += _ref->retrieveCache (_data, _nbRead, nbToRead); -- -- return nbToRead; -- } --}; -- --/********************************************************************************/ -- --/** \brief Collection interface -- */ --template <class Item> class CollectionHDF5 : public collections::impl::CollectionAbstract<Item>, public system::SmartPointer --{ --public: -- -- /** Constructor. */ -- CollectionHDF5 (hid_t fileId, const std::string& filename, system::ISynchronizer* synchro) -- : collections::impl::CollectionAbstract<Item> (0,0), _datasetId(0), _typeId(0), _nbItems(0) -- { -- herr_t status; -- -- system::LocalSynchronizer localsynchro (synchro); -- -- /** We get the HDF5 type of the item. */ -- bool isCompound=false; -- _typeId = Item().hdf5(isCompound); -- -- /** We pack the type. */ -- hid_t actualType = H5Tcopy (_typeId); -- //if (isCompound) { status = H5Tpack(actualType); } -- -- std::string actualName = filename; -- -- /** We look whether the object exists or not. */ -- htri_t doesExist = H5Lexists (fileId, actualName.c_str(), H5P_DEFAULT); -- -- if (doesExist > 0) -- { -- _datasetId = H5Dopen2 (fileId, actualName.c_str(), H5P_DEFAULT); -- -- hid_t filespaceId = H5Dget_space (_datasetId); -- -- hsize_t dims; -- H5Sget_simple_extent_dims (filespaceId, &dims, NULL); -- -- _nbItems = dims; -- status = H5Sclose (filespaceId); -- } -- else -- { -- /** We create the dataspace. */ -- hsize_t dims = 0; -- hsize_t maxdims = H5S_UNLIMITED; -- hid_t dataspaceId = H5Screate_simple (1, &dims, &maxdims); -- -- /* Modify dataset creation properties, i.e. enable chunking */ -- hsize_t chunk_dims = 4096; -- hid_t propId = H5Pcreate (H5P_DATASET_CREATE); -- status = H5Pset_layout (propId, H5D_CHUNKED); -- status = H5Pset_chunk (propId, 1, &chunk_dims); -- -- /** We create the dataset. */ -- _datasetId = H5Dcreate2 (fileId, filename.c_str(), actualType, dataspaceId, H5P_DEFAULT, propId, H5P_DEFAULT); -- -- /** Some cleanup. */ -- H5Pclose (propId); -- H5Sclose (dataspaceId); -- H5Tclose (actualType); -- } -- -- /** We create the bag and the iterable instances. */ -- this->setBag (new BagHDF5<Item> (_datasetId, _typeId, _nbItems, synchro)); -- this->setIterable (new IterableHDF5<Item> (_datasetId, _typeId, _nbItems, synchro)); -- -- } -- -- /** Destructor. */ -- virtual ~CollectionHDF5() -- { -- herr_t status; -- status = H5Dclose (_datasetId); -- status = H5Tclose (_typeId); -- } -- -- /** \copydoc Collection::remove */ -- void remove () {} -- -- /** \copydoc Collection::addProperty */ -- void addProperty (const std::string& key, const std::string value) -- { -- hid_t datatype = H5Tcopy (H5T_C_S1); H5Tset_size (datatype, H5T_VARIABLE); -- -- hsize_t dims = 1; -- hid_t space_id = H5Screate_simple (1, &dims, NULL); -- -- /** We create the attribute. */ -- hid_t attrId = H5Acreate2 (_datasetId, key.c_str(), datatype, space_id, H5P_DEFAULT, H5P_DEFAULT); -- -- /** We write the data. */ -- const char* array[] = { value.c_str() }; -- H5Awrite (attrId, datatype, &array); -- -- /** We close resources. */ -- H5Aclose (attrId); -- H5Tclose (datatype); -- H5Sclose (space_id); -- } -- -- /** \copydoc Collection::getProperty */ -- std::string getProperty (const std::string& key) -- { -- std::string result; -- herr_t status; -- -- hid_t datatype = H5Tcopy (H5T_C_S1); H5Tset_size (datatype, H5T_VARIABLE); -- -- hid_t attrId = H5Aopen (_datasetId, key.c_str(), H5P_DEFAULT); -- -- hid_t space_id = H5Aget_space (attrId); -- -- hsize_t dims = 1; -- H5Sget_simple_extent_dims (space_id, &dims, NULL); -- char** rdata = (char **) malloc (dims * sizeof (char *)); -- -- status = H5Aread (attrId, datatype, rdata); -- -- /** We set the result. */ -- result.assign (rdata[0]); -- -- /** We release buffers. */ -- status = H5Dvlen_reclaim (datatype, space_id, H5P_DEFAULT, rdata); -- free (rdata); -- -- /** We close resources. */ -- H5Aclose (attrId); -- H5Tclose (datatype); -- H5Sclose (space_id); -- -- return result; -- } -- --private: -- -- hid_t _datasetId; -- hid_t _typeId; -- u_int64_t _nbItems; --}; -- --/********************************************************************************/ --} } } } } /* end of namespaces. */ --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_STORAGE_IMPL_COLLECTION_HDF5_HPP_ */ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/StorageHDF5.hpp ++#include <hdf5.h> + + extern const unsigned char revcomp_4NT[]; + extern const unsigned char comp_NT []; +Index: mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt8.hpp =================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/StorageHDF5.hpp -+++ /dev/null -@@ -1,301 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file StorageHDF5.hpp -- * \date 01/03/2013 -- * \author edrezen -- * \brief Collection interface -- * -- * This file holds interfaces related to the Collection interface -- */ -- --#ifndef _GATB_CORE_TOOLS_STORAGE_IMPL_STORAGE_HDF5_HPP_ --#define _GATB_CORE_TOOLS_STORAGE_IMPL_STORAGE_HDF5_HPP_ -- --/********************************************************************************/ -- --#include <gatb/tools/storage/impl/CollectionHDF5.hpp> --#include <gatb/system/impl/System.hpp> +--- mapsembler2_pipeline.orig/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt8.hpp ++++ mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/math/NativeInt8.hpp +@@ -31,7 +31,7 @@ + #include <iostream> + #include <gatb/system/api/types.hpp> + #include <gatb/tools/misc/api/Abundance.hpp> -#include <hdf5/hdf5.h> --#include <typeinfo> -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --namespace storage { --namespace impl { --/********************************************************************************/ -- --class StorageHDF5Factory --{ --public: -- -- /** */ -- static Storage* createStorage (const std::string& name, bool deleteIfExist, bool autoRemove) -- { -- return new StorageHDF5 (STORAGE_HDF5, name, deleteIfExist, autoRemove); -- } -- -- /** */ -- static bool exists (const std::string& name) -- { -- H5Eset_auto (0, NULL, NULL); -- -- bool result = false; -- { -- hid_t id = H5Fopen (name.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT); -- if (id > 0) { H5Fclose(id); result = true; } -- } -- { -- hid_t id = H5Fopen ((name+".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT); -- if (id > 0) { H5Fclose(id); result = true; } -- } -- return result; -- } -- -- /** */ -- static Group* createGroup (ICell* parent, const std::string& name) -- { -- StorageHDF5* storage = dynamic_cast<StorageHDF5*> (ICell::getRoot (parent)); -- assert (storage != 0); -- -- return new GroupHDF5 (storage, parent, name); -- } -- -- /** */ -- template<typename Type> -- static Partition<Type>* createPartition (ICell* parent, const std::string& name, size_t nb) -- { -- StorageHDF5* storage = dynamic_cast<StorageHDF5*> (ICell::getRoot (parent)); -- assert (storage != 0); -- -- std::string actualName = parent->getFullId('/') + "/" + name; -- -- /** We create the HDF5 group if needed. */ -- htri_t doesExist = H5Lexists (storage->getId(), actualName.c_str(), H5P_DEFAULT); -- if (doesExist <= 0) -- { -- hid_t group = H5Gcreate (storage->getId(), actualName.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); -- H5Gclose (group); -- } -- -- return new Partition<Type> (storage->getFactory(), parent, name, nb); -- } -- -- /** */ -- template<typename Type> -- static CollectionNode<Type>* createCollection (ICell* parent, const std::string& name, system::ISynchronizer* synchro) -- { --#if 1 -- synchro = GlobalSynchro::singleton(); --#endif -- -- StorageHDF5* storage = dynamic_cast<StorageHDF5*> (ICell::getRoot (parent)); -- assert (storage != 0); -- -- std::string actualName = parent->getFullId('/') + "/" + name; -- -- return new CollectionNode<Type> (storage->getFactory(), parent, name, new CollectionHDF5<Type>(storage->getId(), actualName, synchro)); -- } -- --private: -- -- class GlobalSynchro -- { -- public: -- static system::ISynchronizer* singleton() -- { -- static GlobalSynchro instance; -- return instance.synchro; -- } -- -- private: -- GlobalSynchro () { synchro = system::impl::System::thread().newSynchronizer(); } -- ~GlobalSynchro () { if (synchro) { delete synchro; } } -- system::ISynchronizer* synchro; -- }; -- -- /************************************************************/ -- class StorageHDF5 : public Storage -- { -- public: -- StorageHDF5 (StorageMode_e mode, const std::string& name, bool deleteIfExist, bool autoRemove) -- : Storage (mode, name, autoRemove), _fileId(0), _name(name) -- { -- if (deleteIfExist) { system::impl::System::file().remove (getActualName()); } -- -- /** We test the actual name exists in filesystem. */ -- bool exists = system::impl::System::file().doesExist(getActualName()); -- -- if (exists==true) -- { -- /** We open the existing file. */ -- _fileId = H5Fopen (getActualName().c_str(), H5P_DEFAULT, H5P_DEFAULT); -- } -- else -- { -- /** We create a new file using default properties. */ -- _fileId = H5Fcreate (getActualName().c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); -- } -- } -- -- virtual ~StorageHDF5 () -- { -- if (_autoRemove) { remove(); } -- H5Fclose(_fileId); -- } -- -- hid_t getId () { return _fileId; } -- -- void remove () -- { -- system::impl::System::file().remove (getActualName()); -- } -- -- -- private: -- hid_t _fileId; -- std::string _name; -- std::string _actualName; -- -- /** */ -- std::string getActualName () -- { -- /** We set the actual name at first call. */ -- if (_actualName.empty()) -- { -- _actualName = _name; -- /** We check whether the given name has a ".h5" suffix. */ -- if (_name.rfind(".h5") == std::string::npos) { _actualName += ".h5"; } -- -- } -- return _actualName; -- } -- -- /** */ -- std::string getName () const { return _name; } -- -- }; -- -- /************************************************************/ -- class GroupHDF5 : public Group -- { -- public: -- GroupHDF5 (StorageHDF5* storage, ICell* parent, const std::string& name) -- : Group(storage->getFactory(),parent,name), _groupId(0) -- { -- /** We may need to create the HDF5 group. Empty name means root group, which is constructed by default. */ -- if (name.empty() == false) -- { -- std::string actualName = this->getFullId('/'); -- -- /** We create the HDF5 group if needed. */ -- htri_t doesExist = H5Lexists (storage->getId(), actualName.c_str(), H5P_DEFAULT); -- -- if (doesExist <= 0) -- { -- _groupId = H5Gcreate (storage->getId(), actualName.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); -- } -- else -- { -- _groupId = H5Gopen2 (storage->getId(), actualName.c_str(), H5P_DEFAULT); -- } -- } -- else -- { -- _groupId = H5Gopen2 (storage->getId(), "/", H5P_DEFAULT); -- } -- } -- -- /** */ -- ~GroupHDF5() -- { -- /** We release the group handle. */ -- H5Gclose(_groupId); -- } -- -- /** */ -- void addProperty (const std::string& key, const std::string value) -- { -- hid_t datatype = H5Tcopy (H5T_C_S1); H5Tset_size (datatype, H5T_VARIABLE); -- -- hsize_t dims = 1; -- hid_t space_id = H5Screate_simple (1, &dims, NULL); -- -- /** We create the attribute. */ -- hid_t attrId = H5Acreate2 (_groupId, key.c_str(), datatype, space_id, H5P_DEFAULT, H5P_DEFAULT); -- if (attrId >= 0) -- { -- /** We write the data. */ -- const char* array[] = { value.c_str() }; -- H5Awrite (attrId, datatype, &array); -- -- /** We close resources. */ -- H5Aclose (attrId); -- H5Tclose (datatype); -- H5Sclose (space_id); -- } -- } -- -- /** */ -- std::string getProperty (const std::string& key) -- { -- std::string result; -- herr_t status; -- -- hid_t datatype = H5Tcopy (H5T_C_S1); H5Tset_size (datatype, H5T_VARIABLE); -- -- hid_t attrId = H5Aopen (_groupId, key.c_str(), H5P_DEFAULT); -- if (attrId >= 0) -- { -- hid_t space_id = H5Aget_space (attrId); -- -- hsize_t dims = 1; -- H5Sget_simple_extent_dims (space_id, &dims, NULL); -- char** rdata = (char **) malloc (dims * sizeof (char *)); -- -- status = H5Aread (attrId, datatype, rdata); -- -- /** We set the result. */ -- result.assign (rdata[0]); -- -- /** We release buffers. */ -- status = H5Dvlen_reclaim (datatype, space_id, H5P_DEFAULT, rdata); -- free (rdata); -- -- /** We close resources. */ -- H5Aclose (attrId); -- H5Tclose (datatype); -- H5Sclose (space_id); -- } -- -- return result; -- } -- -- private: -- hid_t _groupId; -- }; --}; -- --/********************************************************************************/ --} } } } } /* end of namespaces. */ --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_STORAGE_IMPL_STORAGE_HDF5_HPP_ */ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/misc/api/IHistogram.hpp -=================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/misc/api/IHistogram.hpp -+++ /dev/null -@@ -1,104 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file IHistogram.hpp -- * \date 01/03/2013 -- * \author edrezen -- * \brief Interface for histogram (something counting abundances). -- */ -- --#ifndef _GATB_CORE_TOOLS_MISC_IHISTOGRAM_HPP_ --#define _GATB_CORE_TOOLS_MISC_IHISTOGRAM_HPP_ -- --#include <gatb/system/api/ISmartPointer.hpp> --#include <hdf5/hdf5.h> -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --namespace misc { --/********************************************************************************/ -- --/** Here is a command line for showing the histogram with gnuplot from the hdf5 file 'graph.h5' -- h5dump -y -d dsk/histogram graph.h5 | grep [0-9] | grep -v [A-Z].* | paste - - | gnuplot -p -e 'plot [][0:100] "-" with lines' -- -- For the sum of the distribution, you can use; -- h5dump -y -d dsk/histogram graph.h5 | grep [0-9] | grep -v [A-Z].* | paste - - | gawk 'BEGIN{s=0; i=0} { s=s+$2; i=i+1; print i," ", s}' | gnuplot -p -e 'plot [0:10][0:] "-" with lines' --*/ -- --/** \brief TBD */ --class IHistogram : virtual public system::ISmartPointer --{ --public: -- -- /********************************************************************************/ -- struct Entry -- { -- u_int16_t index; -- u_int64_t abundance; -- -- inline static hid_t hdf5 (bool& compound) -- { -- hid_t result = H5Tcreate (H5T_COMPOUND, sizeof(Entry)); -- H5Tinsert (result, "index", HOFFSET(Entry, index), H5T_NATIVE_UINT16); -- H5Tinsert (result, "abundance", HOFFSET(Entry, abundance), H5T_NATIVE_UINT64); -- compound = true; -- return result; -- } -- -- /** Comparison operator -- * \param[in] other : object to be compared to -- * \return true if the provided kmer value is greater than the current one. */ -- bool operator< (const Entry& other) const { return this->index < other.index; } -- -- /** Equal operator -- * \param[in] other : object to be compared to -- * \return true if the provided kmer value is greater than the current one. */ -- bool operator== (const Entry& other) const { return (this->index == other.index && this->abundance == other.abundance); } -- }; -- -- /** */ -- virtual ~IHistogram() {} -- -- /** */ -- virtual size_t getLength() = 0; -- -- /** */ -- virtual void inc (u_int16_t index) = 0; -- -- /** */ -- virtual void save () = 0; -- -- /** */ -- virtual void compute_threshold () = 0; -- -- //compute_threshold needs to be called first -- virtual u_int16_t get_solid_cutoff () = 0; -- virtual u_int64_t get_nbsolids_auto () = 0; -- -- /** */ -- virtual u_int64_t& get (u_int16_t idx) = 0; --}; -- --/********************************************************************************/ --} } } } /* end of namespaces. */ --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_MISC_IHISTOGRAM_HPP_ */ -Index: mapsembler2_pipeline/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/misc/api/Abundance.hpp -=================================================================== ---- mapsembler2_pipeline.orig/home/osallou/Desktop/mapsembler2/mapsembler2_pipeline/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/misc/api/Abundance.hpp -+++ /dev/null -@@ -1,98 +0,0 @@ --/***************************************************************************** -- * GATB : Genome Assembly Tool Box -- * Copyright (C) 2014 INRIA -- * Authors: R.Chikhi, G.Rizk, E.Drezen -- * -- * This program is free software: you can redistribute it and/or modify -- * it under the terms of the GNU Affero General Public License as -- * published by the Free Software Foundation, either version 3 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Affero General Public License for more details. -- * -- * You should have received a copy of the GNU Affero General Public License -- * along with this program. If not, see <http://www.gnu.org/licenses/>. --*****************************************************************************/ -- --/** \file Abundance.hpp -- * \brief Abundance definition -- * \date 01/03/2013 -- * \author edrezen -- */ -- --/********************************************************************************/ -- --#ifndef _GATB_CORE_TOOLS_MISC_ABUNDANCE_HPP_ --#define _GATB_CORE_TOOLS_MISC_ABUNDANCE_HPP_ -- --/********************************************************************************/ -- --#include <sys/types.h> --#include <hdf5/hdf5.h> -- --/********************************************************************************/ --namespace gatb { --namespace core { --namespace tools { --namespace misc { --/********************************************************************************/ -- --template<typename Type, int precision> --struct ArrayData --{ -- Type value[precision]; --}; -- --/********************************************************************************/ -- --/** Define an abundance. */ --template<typename Type, typename Number=u_int16_t> struct Abundance --{ -- Abundance (const Type& val=0, const Number& abund=0) : value(val), abundance(abund) {} -- -- Abundance& operator=(const Abundance& a) -- { -- if (&a != this) { value = a.value; abundance=a.abundance; } -- return *this; -- } -- -- const Number& getAbundance() const { return abundance; } -- const Type& getValue() const { return value; } -- -- bool operator== (const Abundance& other) const { return value == other.value && abundance == other.abundance; } -- -- /** Creates a HDF5 type identifier for the [kmer,abundance] structure. This type will be used -- * for dumping Count instances in a HDF5 file (like SortingCount algorithm does). -- * \param[in] isCompound : tells whether the structure is compound (SHOULD BE OBSOLETE IN THE FUTURE) -- * \return the HDF5 identifier for the type. */ -- static hid_t hdf5 (bool& isCompound) -- { -- hid_t abundanceType = H5T_NATIVE_UINT16; -- -- if (sizeof(Number)==1) { abundanceType = H5T_NATIVE_UINT8; } -- else if (sizeof(Number)==2) { abundanceType = H5T_NATIVE_UINT16; } -- else if (sizeof(Number)==4) { abundanceType = H5T_NATIVE_UINT32; } -- else if (sizeof(Number)==8) { abundanceType = H5T_NATIVE_UINT64; } -- else { throw "Bad type size for Abundance HDF5 serialization"; } -- -- hid_t result = H5Tcreate (H5T_COMPOUND, sizeof(Abundance)); -- H5Tinsert (result, "value", HOFFSET(Abundance, value), Type::hdf5(isCompound)); -- H5Tinsert (result, "abundance", HOFFSET(Abundance, abundance), abundanceType); -- -- isCompound = true; -- -- return result; -- } -- -- Type value; -- Number abundance; --}; -- --/********************************************************************************/ --}}}} --/********************************************************************************/ -- --#endif /* _GATB_CORE_TOOLS_MISC_ABUNDANCE_HPP_ */ ++#include <hdf5.h> + + /********************************************************************************/ + namespace gatb { _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
