[med-svn] [diamond-aligner] 01/03: New upstream version 0.8.35+dfsg

Andreas Tille tille at debian.org
Fri Feb 3 21:28:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository diamond-aligner.

commit b84b9ffda98ae325186ce88dc60a8ff9e47b4018
Author: Andreas Tille <tille at debian.org>
Date:   Fri Feb 3 21:40:24 2017 +0100

    New upstream version 0.8.35+dfsg
---
 README.rst                           |  2 +-
 src/ChangeLog                        |  5 +++++
 src/basic/basic.cpp                  |  2 +-
 src/basic/const.h                    |  2 +-
 src/basic/shape.h                    |  1 +
 src/data/load_seqs.h                 |  2 +-
 src/data/reference.cpp               | 41 ++++++++++++++++++++++--------------
 src/data/reference.h                 | 12 ++++++-----
 src/data/seed_histogram.h            |  8 +++----
 src/data/string_set.h                |  2 +-
 src/extra/model_sim.cpp              |  5 +++--
 src/extra/opt.cpp                    | 17 ++++++++++++++-
 src/extra/roc.cpp                    |  2 +-
 src/output/blast_pairwise_format.cpp |  4 ++--
 src/util/binary_file.h               |  5 +++++
 src/util/text_buffer.h               |  2 +-
 src/util/util.h                      | 10 +++------
 17 files changed, 78 insertions(+), 44 deletions(-)

diff --git a/README.rst b/README.rst
index 1fc2019..7b17658 100644
--- a/README.rst
+++ b/README.rst
@@ -8,7 +8,7 @@ Please read the `manual <https://github.com/bbuchfink/diamond/raw/master/diamond
 
 Installing the software on your system may be done by downloading it in binary format for immediate use::
 
-    wget http://github.com/bbuchfink/diamond/releases/download/v0.8.34/diamond-linux64.tar.gz
+    wget http://github.com/bbuchfink/diamond/releases/download/v0.8.35/diamond-linux64.tar.gz
     tar xzf diamond-linux64.tar.gz
 
 The extracted ``diamond`` binary file should be moved to a directory contained in your executable search path (PATH environment variable).
diff --git a/src/ChangeLog b/src/ChangeLog
index 8b304d0..4b0ef45 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+[0.8.35]
+- added a check to detect incomplete database files
+- database files will be deleted in case database building fails
+- fixed a compiler error on 32 bit systems
+
 [0.8.34]
 - fixed a compiler error
 
diff --git a/src/basic/basic.cpp b/src/basic/basic.cpp
index 4d32aaa..b7627eb 100644
--- a/src/basic/basic.cpp
+++ b/src/basic/basic.cpp
@@ -23,7 +23,7 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR P
 #include "statistics.h"
 #include "sequence.h"
 
-const char* Const::version_string = "0.8.34";
+const char* Const::version_string = "0.8.35";
 const char* Const::program_name = "diamond";
 const char* Const::id_delimiters = " \a\b\f\n\r\t\v";
 
diff --git a/src/basic/const.h b/src/basic/const.h
index 386460a..f915e31 100644
--- a/src/basic/const.h
+++ b/src/basic/const.h
@@ -23,7 +23,7 @@ struct Const
 {
 
 	enum {
-		build_version = 96,
+		build_version = 97,
 		daa_version = 0,
 		seedp_bits = 10,
 		seedp = 1<<seedp_bits,
diff --git a/src/basic/shape.h b/src/basic/shape.h
index 21187f4..266b930 100644
--- a/src/basic/shape.h
+++ b/src/basic/shape.h
@@ -76,6 +76,7 @@ struct Letter_trail
 		return m + 1;
 	}
 	double background_p() const;
+	double foreground_p(double id) const;
 	friend std::ostream& operator<<(std::ostream &s, const Letter_trail &t);
 	int bucket[20];
 };
diff --git a/src/data/load_seqs.h b/src/data/load_seqs.h
index c9ded80..124342c 100644
--- a/src/data/load_seqs.h
+++ b/src/data/load_seqs.h
@@ -71,7 +71,7 @@ inline size_t load_seqs(Input_stream &file,
 		ids->push_back(id);
 		letters += push_seq(**seqs, *source_seqs, seq);
 		++n;
-		if ((*seqs)->get_length() > std::numeric_limits<int>::max())
+		if ((*seqs)->get_length() > (size_t)std::numeric_limits<int>::max())
 			throw std::runtime_error("Number of sequences in file exceeds supported maximum.");
 	}
 	ids->finish_reserve();
diff --git a/src/data/reference.cpp b/src/data/reference.cpp
index 090fcd9..921b6a2 100644
--- a/src/data/reference.cpp
+++ b/src/data/reference.cpp
@@ -70,23 +70,32 @@ void make_db()
 	vector<Pos_record> pos_array;
 	FASTA_format format;
 
-	while (format.get_seq(id, seq, *db_file)) {
-		if (seq.size() == 0)
-			throw std::runtime_error("File format error: sequence of length 0 at line " + to_string(db_file->line_count));
-		if (n % 100000llu == 0llu) {
-			std::stringstream ss;
-			ss << "Loading sequence data (" << n << " sequences processed)";
-			timer.go(ss.str().c_str());
+	try {
+
+		while (format.get_seq(id, seq, *db_file)) {
+			if (seq.size() == 0)
+				throw std::runtime_error("File format error: sequence of length 0 at line " + to_string(db_file->line_count));
+			if (n % 100000llu == 0llu) {
+				std::stringstream ss;
+				ss << "Loading sequence data (" << n << " sequences processed)";
+				timer.go(ss.str().c_str());
+			}
+			pos_array.push_back(Pos_record(offset, seq.size()));
+			out.write("\xff", 1);
+			out.write(seq, false);
+			out.write("\xff", 1);
+			out.write(id, false);
+			out.write("\0", 1);
+			letters += seq.size();
+			++n;
+			offset += seq.size() + id.size() + 3;
 		}
-		pos_array.push_back(Pos_record(offset, seq.size()));
-		out.write("\xff", 1);
-		out.write(seq, false);
-		out.write("\xff", 1);
-		out.write(id, false);
-		out.write("\0", 1);
-		letters += seq.size();
-		++n;
-		offset += seq.size() + id.size() + 3;
+
+	}
+	catch (std::exception &e) {
+		out.close();
+		out.remove();
+		throw e;
 	}
 
 	timer.go("Writing trailer");
diff --git a/src/data/reference.h b/src/data/reference.h
index c12344f..138cc15 100644
--- a/src/data/reference.h
+++ b/src/data/reference.h
@@ -45,12 +45,12 @@ struct invalid_database_version_exception : public std::exception
 
 struct Reference_header
 {
-	Reference_header():
-		unique_id (0x24af8a415ee186dllu),
-		build (Const::build_version),
+	Reference_header() :
+		unique_id(0x24af8a415ee186dllu),
+		build(Const::build_version),
 		db_version(current_db_version),
-		sequences (0),
-		letters (0)
+		sequences(0),
+		letters(0)
 	{ }
 	uint64_t unique_id;
 	uint32_t build, db_version;
@@ -80,6 +80,8 @@ struct Database_file : public Input_stream
 			throw Database_format_exception ();
 		if(ref_header.build < min_build_required || ref_header.db_version != Reference_header::current_db_version)
 			throw invalid_database_version_exception();
+		if (ref_header.sequences == 0)
+			throw std::runtime_error("Incomplete database file. Database building did not complete successfully.");
 #ifdef EXTRA
 		if(sequence_type(_val()) != ref_header.sequence_type)
 			throw std::runtime_error("Database has incorrect sequence type for current alignment mode.");
diff --git a/src/data/seed_histogram.h b/src/data/seed_histogram.h
index f6063a9..0b47acd 100644
--- a/src/data/seed_histogram.h
+++ b/src/data/seed_histogram.h
@@ -136,9 +136,9 @@ private:
 	};
 
 	void build_seq_partition(const Sequence_set &seqs,
-			const unsigned seqp,
-			const size_t begin,
-			const size_t end,
+		const unsigned seqp,
+		const size_t begin,
+		const size_t end,
 		vector<char> &buf)
 	{
 		for (size_t i = begin; i < end; ++i) {
@@ -165,4 +165,4 @@ private:
 
 };
 
-#endif /* SEED_HISTOGRAM_H_ */
+#endif /* SEED_HISTOGRAM_H_ */
\ No newline at end of file
diff --git a/src/data/string_set.h b/src/data/string_set.h
index d66d7e9..5d01930 100644
--- a/src/data/string_set.h
+++ b/src/data/string_set.h
@@ -32,7 +32,7 @@ struct String_set
 {
 
 	typedef char _t;
-	static const unsigned PERIMETER_PADDING = 256;
+	enum { PERIMETER_PADDING = 256 };
 
 	String_set():
 		data_ (PERIMETER_PADDING)
diff --git a/src/extra/model_sim.cpp b/src/extra/model_sim.cpp
index 345ad09..0751d71 100644
--- a/src/extra/model_sim.cpp
+++ b/src/extra/model_sim.cpp
@@ -328,7 +328,7 @@ void model_sim()
 			++hit_fg;
 
 		if (n % 100 == 0) {
-			cout << "n=" << n << " background hit%=" << percentage(hit_bg, n) <<  " foreground hit%=" << percentage(hit_fg, n) << endl;
+			cout << "n=" << n << " background hit%=" << percentage<double,size_t>(hit_bg, n) <<  " foreground hit%=" << percentage<double, size_t>(hit_fg, n) << endl;
 		}
 		++n;
 	}
@@ -336,7 +336,8 @@ void model_sim()
 
 void model_sim()
 {
-	Reduction::reduction = Reduction("A KR EDNQ C G H ILVM FYW P ST"); // murphy.10
+	//Reduction::reduction = Reduction("A KR EDNQ C G H ILVM FYW P ST"); // murphy.10
+	Reduction::reduction = Reduction("A K R E D N Q C G H I L V M F Y W P S T");
 	model_sim<MSS_model>();
 }
 
diff --git a/src/extra/opt.cpp b/src/extra/opt.cpp
index 5f8366e..2946631 100644
--- a/src/extra/opt.cpp
+++ b/src/extra/opt.cpp
@@ -35,6 +35,16 @@ double Letter_trail::background_p() const
 	return p;
 }
 
+double Letter_trail::foreground_p(double id) const
+{
+	double p = 0;
+	for (int i = 0; i < 20; ++i)
+		for (int j = 0; j < 20; ++j)
+			if (bucket[i] == bucket[j] && i != j)
+				p += background_freq[i] * subst_freq[i][j];
+	return id + (1 - id)*p;
+}
+
 double background_p(const Trail& t)
 {
 	double p = 1.0;
@@ -239,7 +249,7 @@ void opt()
 	static const size_t region = 70;
 	static const size_t count = (size_t)1e6;
 	static const double id = 0.25;
-	
+
 	srand((unsigned)time(0));
 
 	Trail previous;
@@ -250,6 +260,11 @@ void opt()
 	previous[4] = Letter_trail(Reduction("A KR EDNQ C G H ILVM FYW P ST"));
 	previous[5] = Letter_trail(Reduction("A KR EDNQ C G H ILVM FYW P ST"));
 	previous[6] = Letter_trail(Reduction("A KR EDNQ C G H ILVM FYW P ST"));
+
+	previous[0] = Letter_trail(Reduction("A K R E D N Q C G H I L V M F Y W P S T"));
+	cout << previous[0].foreground_p(id) / previous[0].background_p() << endl;
+	
+	return;
 	
 	task_timer timer("Init");
 	vector<char> query(count*region);
diff --git a/src/extra/roc.cpp b/src/extra/roc.cpp
index 00dfd07..0fe2a75 100644
--- a/src/extra/roc.cpp
+++ b/src/extra/roc.cpp
@@ -136,7 +136,7 @@ void roc()
 			cout << pow(10.0, exp)*factor << endl;*/
 
 	cout << endl;
-	cout << "Targets = " << n_targets << " / " << target.size() << " (" << percentage(n_targets, target.size()) << "%)" << endl;
+	cout << "Targets = " << n_targets << " / " << target.size() << " (" << percentage<double,size_t>(n_targets, target.size()) << "%)" << endl;
 	cout << "max ev = " << max_ev << endl;
 	cout << "False positives = " << fp << endl;
 }
\ No newline at end of file
diff --git a/src/output/blast_pairwise_format.cpp b/src/output/blast_pairwise_format.cpp
index 7ce0d8f..fe95bfb 100644
--- a/src/output/blast_pairwise_format.cpp
+++ b/src/output/blast_pairwise_format.cpp
@@ -26,8 +26,8 @@ void Pairwise_format::print_match(const Hsp_context& r, Text_buffer &out) const
 	out << " Score = " << r.bit_score() << " bits (" << r.score() << "),  Expect = ";
 	out.print_e(r.evalue());
 	out << '\n';
-	out << " Identities = " << r.identities() << '/' << r.length() << " (" << percentage(r.identities(), r.length()) << "%), Positives = " << r.positives() << '/' << r.length() << " (" << percentage(r.positives(), r.length())
-		<< "%), Gaps = " << r.gaps() << '/' << r.length() << " (" << percentage(r.gaps(), r.length()) << "%)\n";
+	out << " Identities = " << r.identities() << '/' << r.length() << " (" << percentage<unsigned,unsigned>(r.identities(), r.length()) << "%), Positives = " << r.positives() << '/' << r.length() << " (" << percentage<unsigned, unsigned>(r.positives(), r.length())
+		<< "%), Gaps = " << r.gaps() << '/' << r.length() << " (" << percentage<unsigned, unsigned>(r.gaps(), r.length()) << "%)\n";
 	if (align_mode.query_translated)
 		out << " Frame = " << r.blast_query_frame() << '\n';
 	out << '\n';
diff --git a/src/util/binary_file.h b/src/util/binary_file.h
index 16e9ada..2c3563b 100644
--- a/src/util/binary_file.h
+++ b/src/util/binary_file.h
@@ -76,6 +76,11 @@ struct Output_stream
 	{
 		if (f_ == 0) throw File_open_exception(file_name_);
 	}
+	void remove()
+	{
+		if (::remove(file_name_.c_str()) != 0)
+			std::cerr << "Warning: Failed to delete file " << file_name_ << std::endl;
+	}
 	virtual void close()
 	{
 		if (f_ && f_ != stdout) {
diff --git a/src/util/text_buffer.h b/src/util/text_buffer.h
index ce5e3bb..a263fbf 100644
--- a/src/util/text_buffer.h
+++ b/src/util/text_buffer.h
@@ -151,7 +151,7 @@ struct Text_buffer
 		return *this;
 	}
 
-	Text_buffer& operator<<(size_t x)
+	Text_buffer& operator<<(uint64_t x)
 	{
 		reserve(32);
 		ptr_ += sprintf(ptr_, "%llu", (unsigned long long)x);
diff --git a/src/util/util.h b/src/util/util.h
index 6a4c654..69982f6 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -486,14 +486,10 @@ private:
 	_t data_[n];
 };
 
-inline unsigned percentage(unsigned x, unsigned y)
-{
-	return x * 100 / y;
-}
-
-inline double percentage(size_t x, size_t y)
+template<typename _t1, typename _t2>
+_t1 percentage(_t2 x, _t2 y)
 {
-	return x * 100.0 / y;
+	return x * (_t1)100 / y;
 }
 
 template<typename _t>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/diamond-aligner.git



More information about the debian-med-commit mailing list