From bd52eee8c4bdb7a82a709dde89f68279861de8c6 Mon Sep 17 00:00:00 2001 From: bbuchfink Date: Mon, 16 May 2016 14:21:25 +0200 Subject: [PATCH] fixed gcc4.6 errors, added --no-auto-append --- src/ChangeLog | 4 ++ src/align/align_read.h | 2 +- src/basic/basic.cpp | 2 +- src/basic/config.cpp | 9 +++-- src/basic/config.h | 1 + src/basic/const.h | 2 +- src/basic/score_traits.h | 68 ---------------------------------- src/basic/value_type.h | 74 ------------------------------------- src/dp/score_vector.h | 2 +- src/util/strict_fstream.hpp | 2 +- src/util/util.h | 15 ++------ 11 files changed, 19 insertions(+), 162 deletions(-) delete mode 100644 src/basic/score_traits.h delete mode 100644 src/basic/value_type.h diff --git a/src/ChangeLog b/src/ChangeLog index e4b8082c..359c76c5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +[0.8.1] +- added option to disable auto appending of DAA and DMND file extensions (--no-auto-append) +- fixed some compiler errors for GCC 4.6 + [0.8.0] - fixed a bug that would sometimes cause alignments to be missed - fixed a bug that would cause alignments on the reverse strand to be missed in blastx mode diff --git a/src/align/align_read.h b/src/align/align_read.h index 8dca37c7..ceb08fdc 100644 --- a/src/align/align_read.h +++ b/src/align/align_read.h @@ -58,7 +58,7 @@ void align_read(Output_buffer &buffer, const size_t db_letters = ref_header.letters; unsigned padding[6]; - typedef Map::iterator,typename hit::template Query_id<1> > Map_t; + typedef Map::iterator,typename hit::Query_id<1> > Map_t; Map_t hits (begin, end); typename Map_t::Iterator i = hits.begin(); while(i.valid()) { diff --git a/src/basic/basic.cpp b/src/basic/basic.cpp index 049405db..fffa6abf 100644 --- a/src/basic/basic.cpp +++ b/src/basic/basic.cpp @@ -4,7 +4,7 @@ #include "translate.h" #include "statistics.h" -const char* Const::version_string = "0.8.0"; +const char* Const::version_string = "0.8.1"; const char* Const::program_name = "diamond"; const char* Const::id_delimiters = " \a\b\f\n\r\t\v"; diff --git a/src/basic/config.cpp b/src/basic/config.cpp index 1f6138ab..21e03676 100644 --- a/src/basic/config.cpp +++ b/src/basic/config.cpp @@ -82,7 +82,8 @@ Config::Config(int argc, const char **argv) ("index-mode", 0, "index mode (0=4x12, 1=16x9)", index_mode) ("fetch-size", 0, "trace point fetch size", fetch_size, 4096u) ("single-domain", 0, "Discard secondary domains within one target sequence", single_domain) - ("dbsize", 0, "effective database size (in letters)", db_size); + ("dbsize", 0, "effective database size (in letters)", db_size) + ("no-auto-append", 0, "disable auto appending of DAA and DMND file extensions", no_auto_append); Options_group view_options("View options"); view_options.add() @@ -154,8 +155,10 @@ Config::Config(int argc, const char **argv) set_option(index_mode, 0u); } - auto_append_extension(database, ".dmnd"); - auto_append_extension(daa_file, ".daa"); + if (!no_auto_append) { + auto_append_extension(database, ".dmnd"); + auto_append_extension(daa_file, ".daa"); + } message_stream << Const::program_name << " v" << Const::version_string << "." << Const::build_version << " | by Benjamin Buchfink " << endl; message_stream << "Check http://github.com/bbuchfink/diamond/releases for updates." << endl << endl; diff --git a/src/basic/config.h b/src/basic/config.h index 0d7b6bb0..424fb5d2 100644 --- a/src/basic/config.h +++ b/src/basic/config.h @@ -66,6 +66,7 @@ struct Config bool mode_sensitive; unsigned verbosity; + bool no_auto_append; typedef enum { makedb = 0, blastp = 1, blastx = 2, view = 3, help = 4, version = 5 } Command; unsigned command; diff --git a/src/basic/const.h b/src/basic/const.h index 1965f0bb..7d0924cc 100644 --- a/src/basic/const.h +++ b/src/basic/const.h @@ -25,7 +25,7 @@ struct Const { enum { - build_version = 62, + build_version = 63, build_compatibility = 52, db_version = 0, daa_version = 0, diff --git a/src/basic/score_traits.h b/src/basic/score_traits.h deleted file mode 100644 index d08eaf45..00000000 --- a/src/basic/score_traits.h +++ /dev/null @@ -1,68 +0,0 @@ -/**** -Copyright (c) 2014, University of Tuebingen -Author: Benjamin Buchfink -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -****/ - -#ifndef SCORE_TRAITS_H_ -#define SCORE_TRAITS_H_ - -template -uint8_t blast_seq_code() -{ return 0; } - -template<> -uint8_t blast_seq_code() -{ return BLASTAA_SEQ_CODE; } - -template -int16_t blast_load_karlin_blk(Blast_KarlinBlk* kbp, - Blast_KarlinBlk* kbp_ungap, - int gap_open, - int gap_extend, - int reward, - int penalty, - const char *matrix) -{ return 0; } - -template<> -int16_t blast_load_karlin_blk(Blast_KarlinBlk* kbp, - Blast_KarlinBlk* kbp_ungap, - int gap_open, - int gap_extend, - int reward, - int penalty, - const char *matrix) -{ - return Blast_KarlinBlkGappedLoadFromTables(kbp, - gap_open, - gap_extend, - matrix); -} - -template -const uint8_t* blast_alphabet() -{ return 0; } - -template<> -const uint8_t* blast_alphabet() -{ return AMINOACID_TO_NCBISTDAA; } - -#ifdef EXTRA -#include "../../../extra/score_traits.h" -#endif - -#endif /* SCORE_TRAITS_H_ */ diff --git a/src/basic/value_type.h b/src/basic/value_type.h deleted file mode 100644 index 6d99be23..00000000 --- a/src/basic/value_type.h +++ /dev/null @@ -1,74 +0,0 @@ -/**** -Copyright (c) 2014, University of Tuebingen -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**** -Author: Benjamin Buchfink -****/ - -#ifndef VALUE_TYPE_H_ -#define VALUE_TYPE_H_ - -struct Letter_prot { }; -struct Letter_nucl { }; - -template -struct Value_type -{ - - Value_type(): - value_ () - { } - - Value_type(int v): - value_ ((char)v) - { } - - Value_type(char v): - value_ (v) - { } - - Value_type(unsigned v): - value_ ((char)v) - { } - - operator char() const - { return value_; } - - operator int() const - { return (int)value_; } - - operator unsigned() const - { return (unsigned)value_; } - - operator long() const - { return (long)value_; } - - bool operator==(const Value_type &rhs) const - { return value_ == rhs.value_; } - - bool operator!=(const Value_type &rhs) const - { return value_ != rhs.value_; } - -private: - - char value_; - -}; - -typedef Value_type Amino_acid; -typedef Value_type Nucleotide; - -#endif /* VALUE_TYPE_H_ */ diff --git a/src/dp/score_vector.h b/src/dp/score_vector.h index 0e9fab82..365ab09a 100644 --- a/src/dp/score_vector.h +++ b/src/dp/score_vector.h @@ -55,7 +55,7 @@ struct score_vector data_ = _mm_set1_epi8(score_traits::zero); } - explicit score_vector(int x): + explicit score_vector(char x): data_ (_mm_set(x)) { } diff --git a/src/util/strict_fstream.hpp b/src/util/strict_fstream.hpp index 9b3f99df..1b733941 100644 --- a/src/util/strict_fstream.hpp +++ b/src/util/strict_fstream.hpp @@ -58,7 +58,7 @@ struct static_method_holder "binary" }; std::string res; - for (size_t i = 0; i < n_modes; ++i) + for (size_t i = 0; i < (size_t)n_modes; ++i) { if (mode & mode_val_v[i]) { diff --git a/src/util/util.h b/src/util/util.h index 48e74a72..ffb103d3 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -254,19 +254,10 @@ inline string* get_str(const char *s, const char *delimiters) return new string (s, find_first_of(s, delimiters)); } -inline __m128i _mm_set(int a) +inline __m128i _mm_set(char a) { - int y = a << 8 | a; - __m128i z = __m128i(); - z = _mm_insert_epi16 (z, y, 0); - z = _mm_insert_epi16 (z, y, 1); - z = _mm_insert_epi16 (z, y, 2); - z = _mm_insert_epi16 (z, y, 3); - z = _mm_insert_epi16 (z, y, 4); - z = _mm_insert_epi16 (z, y, 5); - z = _mm_insert_epi16 (z, y, 6); - z = _mm_insert_epi16 (z, y, 7); - return z; + const int x = (int)a; + return _mm_set1_epi32(x << 24 | x << 16 | x << 8 | x); } template