Commit 6e7e1b38 authored by Michael R. Crusoe's avatar Michael R. Crusoe 🏳️‍🌈
Browse files

New upstream version 2.2.1

parent 11cdcb81
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
class HashAgnosticCascadingBloom
{
  public:
	typedef uint64_t hash_t;
	/** Default constructor */
	HashAgnosticCascadingBloom()
	  : m_k(0)
@@ -91,7 +92,7 @@ class HashAgnosticCascadingBloom
	 * Return true if the element with the given hash values
	 * has count >= levels.
	 */
	bool contains(const std::vector<size_t>& hashes) const
	bool contains(const std::vector<hash_t>& hashes) const
	{
		assert(m_data.back() != NULL);
		return m_data.back()->contains(hashes);
@@ -101,14 +102,14 @@ class HashAgnosticCascadingBloom
	 * Return true if the element with the given hash values
	 * has count >= levels.
	 */
	bool contains(const size_t hashes[]) const
	bool contains(const hash_t hashes[]) const
	{
		assert(m_data.back() != NULL);
		return m_data.back()->contains(hashes);
	}

	/** Add the object with the specified index to this multiset. */
	void insert(const std::vector<size_t>& hashes)
	void insert(const std::vector<hash_t>& hashes)
	{
		for (unsigned i = 0; i < m_data.size(); ++i) {
			assert(m_data.at(i) != NULL);
@@ -120,7 +121,7 @@ class HashAgnosticCascadingBloom
	}

	/** Add the object with the specified index to this multiset. */
	void insert(const size_t hashes[])
	void insert(const hash_t hashes[])
	{
		for (unsigned i = 0; i < m_data.size(); ++i) {
			assert(m_data.at(i) != NULL);
+2 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ class RollingBloomDBGVisitor : public DefaultBFSVisitor<GraphT>

	typedef std::vector<std::pair<std::string, BloomFilter*>> BloomProperties;
	typedef typename BloomProperties::const_iterator BloomPropertiesIt;
	typedef uint64_t hash_t;

	/** Constructor */
	template<typename VertexSetT>
@@ -110,7 +111,7 @@ class RollingBloomDBGVisitor : public DefaultBFSVisitor<GraphT>
				m_out << "," << it->first;
		}

		size_t hashes[MAX_HASHES];
		hash_t hashes[MAX_HASHES];
		v.rollingHash().getHashes(hashes);

		for (BloomPropertiesIt it = m_bloomProperties.begin(); it != m_bloomProperties.end();
+6 −4
Original line number Diff line number Diff line
@@ -205,9 +205,10 @@ struct graph_traits< RollingBloomDBG<BF> > {

	/**
	 * Identifier for accessing a vertex in the graph.
	 * The second member of the pair (std::vector<size_t>) is
	 * The second member of the pair (std::vector<hash_t>) is
	 * a set of hash values associated with the k-mer.
	 */
	typedef uint64_t hash_t;
	typedef RollingBloomDBGVertex vertex_descriptor;
	typedef boost::directed_tag directed_category;
	struct traversal_category
@@ -223,11 +224,11 @@ struct graph_traits< RollingBloomDBG<BF> > {
	typedef unsigned degree_size_type;

	// VertexListGraph
	typedef size_t vertices_size_type;
	typedef uint64_t vertices_size_type;
	typedef void vertex_iterator;

	// EdgeListGraph
	typedef size_t edges_size_type;
	typedef uint64_t edges_size_type;
	typedef void edge_iterator;

// AdjacencyGraph
@@ -438,7 +439,8 @@ vertex_exists(
	const typename graph_traits<RollingBloomDBG<BloomT> >::vertex_descriptor& u,
	const RollingBloomDBG<BloomT>& g)
{
	size_t hashes[MAX_HASHES];
	typedef uint64_t hash_t;
	hash_t hashes[MAX_HASHES];
	u.rollingHash().getHashes(hashes);
	return g.m_bloom.contains(hashes);
}
+7 −5
Original line number Diff line number Diff line
@@ -19,11 +19,13 @@ class RollingHash
{
private:

	typedef uint64_t hash_t;

	/**
	 * Determine the canonical hash value, given hash values for
	 * forward and reverse-complement of the same k-mer.
	 */
	uint64_t canonicalHash(uint64_t hash, uint64_t rcHash) const
	hash_t canonicalHash(hash_t hash, hash_t rcHash) const
	{
		return (rcHash < hash) ? rcHash : hash;
	}
@@ -136,7 +138,7 @@ public:
	 *
	 * @param hashes array for returned hash values
	 */
	void getHashes(size_t hashes[]) const
	void getHashes(hash_t hashes[]) const
	{
		for (unsigned i = 0; i < m_numHashes; ++i)
			hashes[i] = NTE64(m_hash, m_k, i);
@@ -208,12 +210,12 @@ private:
	/** k-mer length */
	unsigned m_k;
	/** value of first hash function for current k-mer */
	uint64_t m_hash1;
	hash_t m_hash1;
	/** value of first hash function for current k-mer, after
	 * reverse-complementing */
	uint64_t m_rcHash1;
	hash_t m_rcHash1;
	/** current canonical hash value */
	uint64_t m_hash;
	hash_t m_hash;
};

#endif
+3 −2
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ private:

public:

	typedef uint64_t hash_t;
	/**
	 * Default constructor. Creates an iterator pointing to
	 * the end of the iterator range.
@@ -142,7 +143,7 @@ public:
	}

	/** get reference to hash values for current k-mer */
	const size_t* operator*() const
	const hash_t* operator*() const
	{
		assert(m_pos + m_k <= m_seq.length());
		return m_hashes;
@@ -216,7 +217,7 @@ private:
	/** number of hash functions */
	unsigned m_numHashes;
	/** hash values */
	size_t m_hashes[MAX_HASHES];
	hash_t m_hashes[MAX_HASHES];
	/** k-mer size */
	unsigned m_k;
	/** internal state for rolling hash */
Loading